56 gboolean sensitive =
FALSE;
77#define DT_UNDO_ANNOUNCE_FROM 20
84 for(
int i = 0;
i < 32 && gtk_events_pending();
i++) gtk_main_iteration_do(
FALSE);
94static gboolean
undo_callback(GtkAccelGroup *group, GObject *acceleratable, guint keyval, GdkModifierType mods, gpointer user_data)
109 const gboolean announced =
_undo_announce(records, _(
"undoing, please wait…"));
129 gboolean sensitive =
FALSE;
142static gboolean
redo_callback(GtkAccelGroup *group, GObject *acceleratable, guint keyval, GdkModifierType mods, gpointer user_data)
157 const gboolean announced =
_undo_announce(records, _(
"redoing, please wait…"));
166static gboolean
compress_history_callback(GtkAccelGroup *group, GObject *acceleratable, guint keyval, GdkModifierType mods, gpointer user_data)
173 if(is_darkroom_image_in_list)
197static gboolean
copy_callback(GtkAccelGroup *group, GObject *acceleratable, guint keyval, GdkModifierType mods, gpointer user_data)
202 dt_control_log(_(
"Copy is allowed only with exactly one image selected"));
211 if(is_darkroom_image_in_list)
224static gboolean
copy_parts_callback(GtkAccelGroup *group, GObject *acceleratable, guint keyval, GdkModifierType mods, gpointer user_data)
229 dt_control_log(_(
"Copy is allowed only with exactly one image selected"));
238 if(is_darkroom_image_in_list)
256static gboolean
paste_all_callback(GtkAccelGroup *group, GObject *acceleratable, guint keyval, GdkModifierType mods, gpointer user_data)
267 "history/paste/mode",
268 "history/paste/copy_iop_order",
278 imgs = g_list_remove(imgs, GINT_TO_POINTER(
dt_dev_get_global()->image_storage.id));
287static gboolean
paste_parts_callback(GtkAccelGroup *group, GObject *acceleratable, guint keyval, GdkModifierType mods, gpointer user_data)
298 "history/paste/mode",
299 "history/paste/copy_iop_order",
316 imgs = g_list_remove(imgs, GINT_TO_POINTER(
dt_dev_get_global()->image_storage.id));
326static gboolean
load_xmp_callback(GtkAccelGroup *group, GObject *acceleratable, guint keyval, GdkModifierType mods, gpointer user_data)
337 GtkFileChooserNative *filechooser = gtk_file_chooser_native_new(
338 _(
"open sidecar file"), GTK_WINDOW(win), GTK_FILE_CHOOSER_ACTION_OPEN,
339 _(
"_open"), _(
"_cancel"));
340 gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(filechooser),
FALSE);
345 const int32_t imgid = GPOINTER_TO_INT(imgs->data);
351 gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(filechooser), pathname);
367 GtkFileFilter *filter;
368 filter = GTK_FILE_FILTER(gtk_file_filter_new());
369 gtk_file_filter_add_pattern(filter,
"*.xmp");
370 gtk_file_filter_add_pattern(filter,
"*.XMP");
371 gtk_file_filter_set_name(filter, _(
"XMP sidecar files"));
372 gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(filechooser), filter);
374 filter = GTK_FILE_FILTER(gtk_file_filter_new());
375 gtk_file_filter_add_pattern(filter,
"*");
376 gtk_file_filter_set_name(filter, _(
"all files"));
377 gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(filechooser), filter);
379 if(gtk_native_dialog_run(GTK_NATIVE_DIALOG(filechooser)) == GTK_RESPONSE_ACCEPT)
381 gchar *dtfilename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(filechooser));
385 = gtk_message_dialog_new(GTK_WINDOW(win), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR,
386 GTK_BUTTONS_CLOSE, _(
"error loading file '%s'"), dtfilename);
387#ifdef GDK_WINDOWING_QUARTZ
390 gtk_dialog_run(GTK_DIALOG(dialog));
391 gtk_widget_destroy(dialog);
409 g_object_unref(filechooser);
415static gboolean
duplicate_callback(GtkAccelGroup *group, GObject *acceleratable, guint keyval, GdkModifierType mods, gpointer user_data)
438static gboolean
new_history_callback(GtkAccelGroup *group, GObject *acceleratable, guint keyval, GdkModifierType mods, gpointer user_data)
456 dt_control_log(_(
"Creating new historys needs selected images to work"));
461static gboolean
shortcuts_callback(GtkAccelGroup *group, GObject *acceleratable, guint keyval, GdkModifierType mods, gpointer user_data)
467static gboolean
history_append_callback(GtkAccelGroup *group, GObject *acceleratable, guint keyval, GdkModifierType mods, gpointer user_data)
478static gboolean
history_prepend_callback(GtkAccelGroup *group, GObject *acceleratable, guint keyval, GdkModifierType mods, gpointer user_data)
490 GdkModifierType mods, gpointer user_data)
501static gboolean
copy_iop_order_callback(GtkAccelGroup *group, GObject *acceleratable, guint keyval, GdkModifierType mods, gpointer user_data)
512static gboolean
paste_ask_callback(GtkAccelGroup *group, GObject *acceleratable, guint keyval, GdkModifierType mods, gpointer user_data)
525 add_sub_menu_entry(menus, lists, _(
"Undo"), index, NULL,
undo_callback, NULL, NULL,
undo_sensitive_callback, GDK_KEY_z,
DT_PRIMARY_MASK);
527 add_sub_menu_entry(menus, lists, _(
"Redo"), index, NULL,
redo_callback, NULL, NULL,
redo_sensitive_callback, GDK_KEY_y,
DT_PRIMARY_MASK);
531 add_sub_menu_entry(menus, lists, _(
"Copy history (all)"), index, NULL,
copy_callback, NULL, NULL,
has_selection, GDK_KEY_c,
DT_PRIMARY_MASK);
533 add_sub_menu_entry(menus, lists, _(
"Copy history (parts)..."), index, NULL,
copy_parts_callback, NULL, NULL,
has_selection, GDK_KEY_c,
DT_PRIMARY_MASK | GDK_SHIFT_MASK);
551 _(
"Paste copied history BEFORE the current history.\n"
552 "CURRENT EDITS are applied afterwards and win conflicts."));
557 _(
"Paste copied history AFTER the current history.\n"
558 "COPIED EDITS are applied afterwards and win conflicts."));
563 _(
"Discard the current history and replace it entirely with the copied history."));
593 add_sub_menu_entry(menus, lists, _(
"Preferences..."), index, NULL,
GET_ACCEL_WRAPPER(
dt_gui_preferences_show), NULL, NULL, NULL, 0, 0);
594 add_sub_menu_entry(menus, lists, _(
"Keyboard shortcuts..."), index, NULL,
shortcuts_callback, NULL, NULL, NULL, 0, 0);
void dt_accels_window(dt_accels_t *accels, GtkWindow *main_window)
Show the modal dialog listing all available keyboard shortcuts and letting user to set them.
Handle default and user-set shortcuts (accelerators)
GList * dt_act_on_get_images()
GtkWidget * dt_gui_main_window(void)
struct dt_accels_t * dt_gui_get_accels(void)
struct _GtkWidget GtkWidget
GtkWidget, opaque, spelled exactly as GTK spells it.
void dt_conf_set_bool(const char *name, int val)
int dt_conf_get_bool(const char *name)
void dt_conf_set_int(const char *name, int val)
int dt_conf_get_int(const char *name)
Integer for name, clamped to the bounds declared in the XML.
void dt_conf_set_folder_from_file_chooser(const char *name, GtkFileChooser *chooser)
gboolean dt_conf_get_folder_to_file_chooser(const char *name, GtkFileChooser *chooser)
void dt_image_film_roll_directory(const dt_image_t *img, char *pathname, size_t pathname_len)
void dt_control_log(const char *msg,...)
void dt_control_queue_redraw_center()
Request a redraw of the centre view.
void dt_control_change_cursor_by_name_and_flush(const char *curs_str)
Apply a named cursor immediatelly and flush display updates for immediate feedback.
void dt_control_commit_cursor()
void dt_control_duplicate_images(gboolean virgin)
struct dt_develop_t * dt_dev_get_global(void)
struct dt_view_manager_t * dt_view_manager_get_global(void)
void dt_apply_dev_history_update(dt_develop_t *dev)
Reload the current darkroom history and refresh every dependent GUI.
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.
void dt_dev_write_history(dt_develop_t *dev, gboolean async)
Thread-safe wrapper around dt_dev_write_history_ext() for dev->image_storage.id.
void dt_dev_undo_start_record(dt_develop_t *dev)
void dt_dev_undo_end_record(dt_develop_t *dev)
static gboolean redo_callback(GtkAccelGroup *group, GObject *acceleratable, guint keyval, GdkModifierType mods, gpointer user_data)
static gboolean _undo_announce(const int records, const char *message)
static gboolean history_prepend_callback(GtkAccelGroup *group, GObject *acceleratable, guint keyval, GdkModifierType mods, gpointer user_data)
static gboolean paste_sensitive_callback()
static gboolean new_history_callback(GtkAccelGroup *group, GObject *acceleratable, guint keyval, GdkModifierType mods, gpointer user_data)
static gboolean history_replace_checked_callback(GtkWidget *widget)
static gboolean undo_callback(GtkAccelGroup *group, GObject *acceleratable, guint keyval, GdkModifierType mods, gpointer user_data)
static gboolean compress_history_callback(GtkAccelGroup *group, GObject *acceleratable, guint keyval, GdkModifierType mods, gpointer user_data)
static void _undo_announce_end(const gboolean announced)
static gboolean copy_iop_order_checked_callback(GtkWidget *widget)
static gboolean copy_parts_callback(GtkAccelGroup *group, GObject *acceleratable, guint keyval, GdkModifierType mods, gpointer user_data)
static gboolean paste_all_callback(GtkAccelGroup *group, GObject *acceleratable, guint keyval, GdkModifierType mods, gpointer user_data)
static gboolean redo_sensitive_callback()
static gboolean history_append_checked_callback(GtkWidget *widget)
static gboolean copy_callback(GtkAccelGroup *group, GObject *acceleratable, guint keyval, GdkModifierType mods, gpointer user_data)
static gboolean duplicate_callback(GtkAccelGroup *group, GObject *acceleratable, guint keyval, GdkModifierType mods, gpointer user_data)
static gboolean paste_ask_callback(GtkAccelGroup *group, GObject *acceleratable, guint keyval, GdkModifierType mods, gpointer user_data)
static gboolean paste_parts_callback(GtkAccelGroup *group, GObject *acceleratable, guint keyval, GdkModifierType mods, gpointer user_data)
void append_edit(GtkWidget **menus, GList **lists, const dt_menus_t index)
static gboolean shortcuts_callback(GtkAccelGroup *group, GObject *acceleratable, guint keyval, GdkModifierType mods, gpointer user_data)
#define DT_UNDO_ANNOUNCE_FROM
static gboolean history_append_callback(GtkAccelGroup *group, GObject *acceleratable, guint keyval, GdkModifierType mods, gpointer user_data)
static gboolean copy_iop_order_callback(GtkAccelGroup *group, GObject *acceleratable, guint keyval, GdkModifierType mods, gpointer user_data)
static gboolean undo_sensitive_callback()
static gboolean paste_ask_checked_callback(GtkWidget *widget)
static gboolean load_xmp_callback(GtkAccelGroup *group, GObject *acceleratable, guint keyval, GdkModifierType mods, gpointer user_data)
static gboolean history_prepend_checked_callback(GtkWidget *widget)
static gboolean history_replace_callback(GtkAccelGroup *group, GObject *acceleratable, guint keyval, GdkModifierType mods, gpointer user_data)
#define g_list_is_singleton(list)
gboolean dt_history_paste_on_list(const GList *list)
gboolean dt_history_copy(int32_t imgid)
gboolean dt_history_paste_parts_on_list(const GList *list)
dt_history_copy_item_t * dt_history_copy_paste_get(void)
The history clipboard: what "copy history" put there, for "paste" to read.
int dt_history_load_and_apply_on_list(gchar *filename, const GList *list)
int dt_history_compress_on_list(const GList *imgs)
void dt_history_compress_on_image(const int32_t imgid)
gboolean delete_history_callback(GtkAccelGroup *group, GObject *acceleratable, guint keyval, GdkModifierType mods, gpointer user_data)
gboolean dt_history_paste_parts_prepare(void)
gboolean dt_history_copy_parts(int32_t imgid)
@ DT_HISTORY_MERGE_REPLACE
@ DT_HISTORY_MERGE_PREPEND
@ DT_HISTORY_MERGE_APPEND
gboolean dt_gui_merge_options_dialog(const char *title, const char *mode_key, const char *iop_order_key, const char *ask_key, const gboolean iop_order_available)
Show a modal dialog to pick merge mode and pipeline order before a paste or style apply.
dt_image_t * dt_image_cache_get(const int32_t imgid, char mode)
void dt_image_cache_read_release(const dt_image_t *img)
#define IS_NULL_PTR(p)
C is way too permissive with !=, == and if(var) checks, which can mean too many things depending on w...
#define dt_free(ptr)
g_free() ptr and set it to NULL, skipping both if it is already NULL.
void dt_osx_disallow_fullscreen(GtkWidget *widget)
#define DT_PATH_MAX
Buffer size for a filesystem path anywhere in Ansel.
void dt_gui_preferences_show()
int32_t dt_selection_get_first_id(struct dt_selection_t *selection)
struct dt_selection_t * dt_selection_get_global(void)
int dt_selection_get_length(struct dt_selection_t *selection)
GList * dt_selection_get_list(struct dt_selection_t *selection)
int dt_redo_list_length(dt_undo_t *self, uint32_t filter)
void dt_undo_do_redo(dt_undo_t *self, uint32_t filter)
gboolean dt_is_redo_list_populated(dt_undo_t *self, uint32_t filter)
int dt_undo_list_length(dt_undo_t *self, uint32_t filter)
How many records match filter, so a caller can tell a one-record undo from a batch of a thousand....
void dt_undo_do_undo(dt_undo_t *self, uint32_t filter)
gboolean dt_is_undo_list_populated(dt_undo_t *self, uint32_t filter)
dt_undo_t * dt_undo_get_global(void)
Telling the user something happened.
const dt_view_t * dt_view_manager_get_current_view(dt_view_manager_t *vm)