35#ifdef GDK_WINDOWING_QUARTZ
59 const gboolean use_undo)
64 gboolean changed =
FALSE;
65 for(
const GList *l = list; l; l = g_list_next(l))
67 const int32_t imgid = GPOINTER_TO_INT(l->data);
68 changed |= action(imgid, user_data);
93 GList *mod_list = NULL;
100 for(
const GList *l = g_list_last(ops); l; l = g_list_previous(l))
102 const unsigned int num = GPOINTER_TO_UINT(l->data);
104 for(GList *h = g_list_last(dev_src->
history); h; h = g_list_previous(h))
107 if(item && item->
num == (
int)num)
121 mod_list = g_list_prepend(mod_list, mod);
131 for(GList *modules_src = g_list_first(dev_src->
iop); modules_src; modules_src = g_list_next(modules_src))
142 mod_list = g_list_prepend(mod_list, mod_src);
147 return g_list_reverse(mod_list);
188 copy_iop_order, mode,
190 g_list_free(mod_list);
202 if(imgid == dest_imgid)
return 1;
206 dt_history_message(_(
"you need to copy history from an image before you paste it onto another"));
211 hist->
imgid = dest_imgid;
229 if(imgid <= 0)
return FALSE;
246 if(imgid <= 0)
return FALSE;
254 ctx ? &ctx->
batch : NULL) == 0;
278 if(imgid <= 0)
return FALSE;
286 ctx ? &ctx->
batch : NULL) == 0;
311 if(imgid <= 0)
return FALSE;
391 return changed ? 0 : 1;
401 if(imgid <= 0)
return FALSE;
404 const gboolean undo = params ? params->undo :
TRUE;
446 int32_t newimgid = imgid;
447 if(params->duplicate)
466 hist->
imgid = newimgid;
476 const gboolean changed = (ret_val == 0);
487 .duplicate = duplicate,
491 if(params.style_id == 0)
return FALSE;
505 .duplicate = duplicate,
509 if(params.style_id == 0)
return FALSE;
typedef void((*dt_cache_allocate_t)(void *userdata, dt_cache_entry_t *entry))
void dt_collection_update_query(const dt_collection_t *collection, dt_collection_change_t query_change, dt_collection_properties_t changed_property, GList *list)
dt_collection_t * dt_collection_get_global(void)
@ DT_COLLECTION_PROP_UNDEF
@ DT_COLLECTION_CHANGE_RELOAD
int dt_conf_get_bool(const char *name)
int dt_conf_get_int(const char *name)
Integer for name, clamped to the bounds declared in the XML.
int32_t dt_image_duplicate_no_reload(const int32_t imgid)
void dt_image_history_changed(const int32_t imgid, const gboolean refresh_filmstrip)
void dt_dev_history_compress_or_truncate(dt_develop_t *dev) REQUIRES_SHARED(dev -> history_mutex)
Compress history if history_end is at top, otherwise truncate.
int dt_dev_replace_history_on_image(dt_develop_t *dev_src, const int32_t dest_imgid, const gboolean reload_defaults, const char *msg)
Replace an image history with the content of dev_src.
int dt_dev_merge_history_into_image(dt_develop_t *dev_src, int32_t dest_imgid, const GList *mod_list, gboolean merge_iop_order, const dt_history_merge_strategy_t mode, const gboolean paste_instances, const char *source_label, dt_hm_batch_state_t *batch)
Merge a list of modules into a destination image history via dt_history_merge().
gboolean dt_history_module_skip_copy(const int flags)
Determine whether a module should be skipped during history copy.
gboolean dt_dev_reload_history_items(dt_develop_t *dev, const int32_t imgid)
Reload history from DB and rebuild pipelines/GUI state.
dt_dev_history_item_t * dt_dev_history_get_first_item_by_module(GList *history_list, dt_iop_module_t *module)
Find the first history item referencing a module.
void dt_dev_write_history_ext(dt_develop_t *dev, const int32_t imgid) REQUIRES_SHARED(dev -> history_mutex)
Write dev->history to DB and XMP for a given image id.
void dt_dev_cleanup(dt_develop_t *dev)
void dt_dev_init(dt_develop_t *dev, int32_t gui_attached)
void dt_history_delete_on_image_ext(int32_t imgid, gboolean undo)
void dt_history_message(const char *format,...)
void dt_history_changed_images(const GList *imgs)
void dt_history_changed(const dt_history_change_t what)
Raise it. Internal to this code.
Everything the history, styles and presets code says to the outside world: messages for the user,...
static gboolean _history_action_on_list_with_undo(const GList *list, dt_history_action_fn action, void *user_data, const gboolean use_undo)
gboolean dt_history_paste_on_list(const GList *list)
static gboolean _history_paste_apply(const int32_t imgid, void *user_data)
int dt_history_load_and_apply(const int32_t imgid, gchar *filename, int history_only)
gboolean dt_history_copy(int32_t imgid)
static gboolean _history_style_apply(const int32_t imgid, void *user_data)
gboolean dt_history_paste_parts_on_list(const GList *list)
static gboolean _history_paste_parts_apply(const int32_t imgid, void *user_data)
static GList * _get_user_mod_list(dt_develop_t *dev_src, GList *ops, gboolean copy_full)
Build a module list to copy based on selected history indices.
int dt_history_load_and_apply_on_image(int32_t imgid, gchar *filename, int history_only)
dt_history_copy_item_t * dt_history_copy_paste_get(void)
The history clipboard: what "copy history" put there, for "paste" to read.
static gboolean _history_action_on_list(const GList *list, dt_history_action_fn action, void *user_data)
gboolean dt_history_delete_on_list(const GList *list, gboolean undo)
gboolean dt_history_paste_on_image(const int32_t imgid)
gboolean dt_history_style_on_image(const int32_t imgid, const char *name, const gboolean duplicate)
static gboolean _history_load_and_apply_apply(const int32_t imgid, void *user_data)
static int _history_copy_and_paste_on_image_merge(int32_t imgid, int32_t dest_imgid, GList *ops, const gboolean copy_full, const dt_history_merge_strategy_t mode, const gboolean copy_iop_order, dt_hm_batch_state_t *batch)
Copy/merge history between images using the merge pipeline.
static void _history_action_finalize_list(const GList *list, const gboolean changed)
static dt_history_copy_item_t _copy_paste
int dt_history_load_and_apply_on_list(gchar *filename, const GList *list)
int dt_history_compress_on_list(const GList *imgs)
static gboolean _history_delete_apply(const int32_t imgid, void *user_data)
gboolean dt_history_paste_parts_on_image(const int32_t imgid)
gboolean dt_history_copy_and_paste_on_image(const int32_t imgid, const int32_t dest_imgid, GList *ops, const gboolean copy_full, const dt_history_merge_strategy_t mode, const gboolean copy_iop_order, dt_hm_batch_state_t *batch)
static gboolean _history_compress_apply(const int32_t imgid, void *user_data)
void dt_history_compress_on_image(const int32_t imgid)
gboolean dt_history_style_on_list(const GList *list, const char *name, const gboolean duplicate)
gboolean(* dt_history_action_fn)(const int32_t imgid, void *user_data)
void dt_hm_batch_state_cleanup(dt_hm_batch_state_t *batch)
Release resources held by a batch state (the cached order). Safe to call on a zeroed state.
dt_history_merge_strategy_t
@ DT_HISTORY_MERGE_REPLACE
void dt_history_snapshot_undo_create(const int32_t imgid, int *snap_id, int *history_end)
void dt_history_snapshot_undo_lt_history_data_free(gpointer data)
dt_undo_lt_history_t * dt_history_snapshot_item_init(void)
void dt_history_snapshot_undo_pop(gpointer user_data, dt_undo_type_t type, dt_undo_data_t data, dt_undo_action_t action, GList **imgs)
void dt_image_cache_write_release(dt_image_t *img, dt_image_cache_write_mode_t mode)
dt_image_t * dt_image_cache_get(const int32_t imgid, char mode)
gboolean dt_iop_is_hidden(dt_iop_module_t *module)
void dt_print(dt_debug_thread_t thread, const char *msg,...) __attribute__((format(printf
Print to stdout when thread is enabled, prefixed with seconds since startup.
#define IS_NULL_PTR(p)
C is way too permissive with !=, == and if(var) checks, which can mean too many things depending on w...
int dt_styles_apply_to_image_merge(const char *name, const int style_id, const int32_t newimgid, const dt_history_merge_strategy_t mode, dt_hm_batch_state_t *batch)
int32_t dt_styles_get_id_by_name(const char *name)
dt_hm_batch_state_t batch
dt_history_merge_strategy_t mode
dt_hm_batch_state_t batch
void dt_undo_end_group(dt_undo_t *self)
void dt_undo_start_group(dt_undo_t *self, dt_undo_type_t type)
void dt_undo_record(dt_undo_t *self, gpointer user_data, dt_undo_type_t type, dt_undo_data_t data, void(*undo)(gpointer user_data, dt_undo_type_t type, dt_undo_data_t item, dt_undo_action_t action, GList **imgs), void(*free_data)(gpointer data))
dt_undo_t * dt_undo_get_global(void)
int dt_exif_xmp_read(dt_image_t *img, const char *filename, const int history_only)
The XMP document that carries an image's development: history stack, mask shapes, module order,...