51 const gboolean use_undo)
56 gboolean changed =
FALSE;
57 for(
const GList *l = list; l; l = g_list_next(l))
59 const int32_t imgid = GPOINTER_TO_INT(l->data);
60 changed |= action(imgid, user_data);
85 GList *mod_list = NULL;
92 for(
const GList *l = g_list_last(ops); l; l = g_list_previous(l))
94 const unsigned int num = GPOINTER_TO_UINT(l->data);
96 for(GList *h = g_list_last(dev_src->
history); h; h = g_list_previous(h))
99 if(item && item->
num == (
int)num)
113 mod_list = g_list_prepend(mod_list, mod);
123 for(GList *modules_src = g_list_first(dev_src->
iop); modules_src; modules_src = g_list_next(modules_src))
134 mod_list = g_list_prepend(mod_list, mod_src);
139 return g_list_reverse(mod_list);
180 copy_iop_order, mode,
182 g_list_free(mod_list);
194 if(imgid == dest_imgid)
return 1;
198 dt_control_log(_(
"you need to copy history from an image before you paste it onto another"));
203 hist->
imgid = dest_imgid;
221 if(imgid <= 0)
return FALSE;
251 if(imgid <= 0)
return FALSE;
259 ctx ? &ctx->
batch : NULL) == 0;
283 if(res != GTK_RESPONSE_OK)
296 if(imgid <= 0)
return FALSE;
304 ctx ? &ctx->
batch : NULL) == 0;
326 if(imgid <= 0)
return FALSE;
406 return changed ? 0 : 1;
416 if(imgid <= 0)
return FALSE;
419 const gboolean undo = params ? params->undo :
TRUE;
461 int32_t newimgid = imgid;
462 if(params->duplicate)
475 hist->
imgid = newimgid;
485 const gboolean changed = (ret_val == 0);
496 .duplicate = duplicate,
500 if(params.style_id == 0)
return FALSE;
512 .duplicate = duplicate,
516 if(params.style_id == 0)
return FALSE;
typedef void((*dt_cache_allocate_t)(void *userdata, dt_cache_entry_t *entry))
void dt_history_delete_on_image_ext(int32_t imgid, gboolean undo)
int32_t dt_image_duplicate(const int32_t imgid)
void dt_image_history_changed(const int32_t imgid, const gboolean refresh_filmstrip)
int dt_conf_get_bool(const char *name)
int dt_conf_get_int(const char *name)
void dt_control_log(const char *msg,...)
void dt_print(dt_debug_thread_t thread, const char *msg,...)
#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_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().
void dt_dev_history_compress_or_truncate(dt_develop_t *dev)
Compress history if history_end is at top, otherwise truncate.
gboolean dt_history_module_skip_copy(const int flags)
Determine whether a module should be skipped during history copy.
void dt_dev_write_history_ext(dt_develop_t *dev, const int32_t imgid)
Write dev->history to DB and XMP for a given image id.
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_cleanup(dt_develop_t *dev)
void dt_dev_init(dt_develop_t *dev, int32_t gui_attached)
int dt_exif_xmp_read(dt_image_t *img, const char *filename, const int history_only)
int dt_gui_hist_dialog_new(dt_history_copy_item_t *d, int32_t imgid, gboolean iscopy)
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)
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.
gboolean dt_history_paste_parts_prepare(void)
static void _history_action_finalize_list(const GList *list, const gboolean changed)
int dt_history_load_and_apply_on_list(gchar *filename, const GList *list)
int dt_history_compress_on_list(const GList *imgs)
gboolean dt_history_copy_parts(int32_t imgid)
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)
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)
dt_image_t * dt_image_cache_get(dt_image_cache_t *cache, const int32_t imgid, char mode)
void dt_image_cache_write_release(dt_image_cache_t *cache, dt_image_t *img, dt_image_cache_write_mode_t mode)
gboolean dt_iop_is_hidden(dt_iop_module_t *module)
#define DT_DEBUG_CONTROL_SIGNAL_RAISE(ctlsig, signal,...)
@ DT_SIGNAL_IMAGE_INFO_CHANGED
This signal is raised when any of image info has changed
@ DT_SIGNAL_TAG_CHANGED
This signal is raised when a tag is added/deleted/changed
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
struct dt_control_signal_t * signals
struct dt_image_cache_t * image_cache
struct dt_view_manager_t * view_manager
dt_history_merge_strategy_t mode
dt_hm_batch_state_t batch
GModule *dt_dev_operation_t op
dt_history_copy_item_t copy_paste
A widget to manage and display image thumbnails in Ansel's lighttable and filmstrip views.
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))