44#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_control_log(_(
"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;
259 if(imgid <= 0)
return FALSE;
267 ctx ? &ctx->
batch : NULL) == 0;
293 if(res != GTK_RESPONSE_OK)
306 if(imgid <= 0)
return FALSE;
314 ctx ? &ctx->
batch : NULL) == 0;
338 if(imgid <= 0)
return FALSE;
418 return changed ? 0 : 1;
428 if(imgid <= 0)
return FALSE;
431 const gboolean undo = params ? params->undo :
TRUE;
459gboolean
delete_history_callback(GtkAccelGroup *group, GObject *acceleratable, guint keyval, GdkModifierType mods, gpointer user_data)
468 const int img_count = g_list_length(imgs);
470 GtkWidget *dialog = gtk_message_dialog_new(
471 GTK_WINDOW(win), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO,
472 ngettext(
"Do you really want to clear history of %d image?",
473 "Do you really want to clear history of %d images?", img_count),
475#ifdef GDK_WINDOWING_QUARTZ
478 gtk_window_set_title(GTK_WINDOW(dialog), ngettext(
"Delete image's history?",
"Delete images' history?", img_count));
480 GtkWidget *message_area = gtk_message_dialog_get_message_area(GTK_MESSAGE_DIALOG(dialog));
481 GtkWidget *ask_check = gtk_check_button_new_with_label(_(
"Always ask"));
482 gtk_widget_set_tooltip_text(ask_check,
483 _(
"when unchecked, history will be deleted silently from now on without this confirmation.\n"
484 "you can turn it back on from preferences."));
485 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ask_check),
TRUE);
486 gtk_box_pack_start(GTK_BOX(message_area), ask_check,
FALSE,
FALSE, 6);
487 gtk_widget_show(ask_check);
489 const gint res = gtk_dialog_run(GTK_DIALOG(dialog));
490 dt_conf_set_bool(
"ask_before_discard", gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ask_check)));
491 gtk_widget_destroy(dialog);
493 if(res != GTK_RESPONSE_YES)
502 if(is_darkroom_image_in_list)
509 if(is_darkroom_image_in_list)
535 int32_t newimgid = imgid;
536 if(params->duplicate)
555 hist->
imgid = newimgid;
565 const gboolean changed = (ret_val == 0);
576 .duplicate = duplicate,
580 if(params.style_id == 0)
return FALSE;
594 .duplicate = duplicate,
598 if(params.style_id == 0)
return FALSE;
GList * dt_act_on_get_images()
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_PROP_UNDEF
@ DT_COLLECTION_CHANGE_RELOAD
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_no_reload(const int32_t imgid)
void dt_image_history_changed(const int32_t imgid, const gboolean refresh_filmstrip)
void dt_conf_set_bool(const char *name, int val)
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_control_queue_redraw_center()
request redraw of center window. This redraws the center view within a gdk critical section to preven...
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...
void dt_apply_dev_history_update(dt_develop_t *dev)
Reload the current darkroom history and refresh every dependent GUI.
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.
gboolean dt_dev_history_is_image_in_dev(GList *imgs)
Check whether any image of the list is the one currently loaded in the darkroom.
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)
void dt_dev_undo_start_record(dt_develop_t *dev)
void dt_dev_undo_end_record(dt_develop_t *dev)
int dt_exif_xmp_read(dt_image_t *img, const char *filename, const int history_only)
void dt_gui_refocus_parent(GtkWindow *parent)
GtkWidget * dt_ui_main_window(dt_ui_t *ui)
get the main window widget
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)
gboolean delete_history_callback(GtkAccelGroup *group, GObject *acceleratable, guint keyval, GdkModifierType mods, gpointer user_data)
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)
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)
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)
void dt_osx_disallow_fullscreen(GtkWidget *widget)
#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
struct _GtkWidget GtkWidget
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_gui_gtk_t * gui
struct dt_collection_t * collection
struct dt_control_signal_t * signals
struct dt_image_cache_t * image_cache
struct dt_develop_t * develop
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))