54 GdkModifierType mods, gpointer user_data)
61 gchar *title = g_strdup_printf(_(
"Apply style \"%s\" — merge settings"), style_name);
64 "history/style/copy_iop_order",
72 const gboolean duplicate =
dt_conf_get_bool(
"ui_last/styles_create_duplicate");
75 if(is_darkroom_image_in_list)
100 GdkModifierType mods, gpointer user_data)
103 if(imgid <= 0)
return FALSE;
113 gtk_container_remove(GTK_CONTAINER(content),
dt_gui_get_global()->styles_popup.module);
118 GdkModifierType mods, gpointer user_data)
137#ifdef GDK_WINDOWING_QUARTZ
139 gtk_window_set_position(GTK_WINDOW(dialog), GTK_WIN_POS_CENTER_ON_PARENT);
141 gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_CANCEL);
142 gtk_window_set_modal(GTK_WINDOW(dialog),
FALSE);
144 gtk_window_set_title(GTK_WINDOW(dialog), _(
"Ansel - Styles"));
151 GtkWidget *content = gtk_dialog_get_content_area(GTK_DIALOG(dialog));
152 gtk_box_pack_start(GTK_BOX(content), w,
TRUE,
TRUE, 0);
153 gtk_widget_set_visible(w,
TRUE);
154 gtk_widget_show_all(dialog);
165 if(items_string && *items_string)
169 gchar *desc = g_markup_escape_text(style->
description, -1);
170 tooltip = g_strconcat(
"<b>", desc,
"</b>\n", items_string, NULL);
175 tooltip = g_strdup(items_string);
188 GtkWidget *parent,
const gchar *path,
const gchar *label,
194 GtkWidget *submenu = g_hash_table_lookup(submenus, path);
195 if(submenu)
return submenu;
197 gchar *menu_label = g_markup_escape_text(label, -1);
198 if(
IS_NULL_PTR(menu_label)) menu_label = g_strdup(
"");
200 submenu = gtk_menu_new();
204 gchar *accel_path =
dt_accels_build_path(gtk_menu_get_accel_path(GTK_MENU(parent)), clean_label);
205 gtk_menu_set_accel_path(GTK_MENU(submenu), accel_path);
210 NULL, NULL, NULL, NULL, 0, 0,
212 gtk_menu_item_set_submenu(GTK_MENU_ITEM(entry->
widget), submenu);
213 gtk_menu_shell_append(GTK_MENU_SHELL(parent), entry->
widget);
215 g_hash_table_insert(submenus, g_strdup(path), submenu);
221 const gchar *label,
const gchar *
tooltip,
const gchar *style_name)
227 gtk_menu_shell_append(GTK_MENU_SHELL(parent), entry->
widget);
228 gtk_menu_item_set_reserve_indicator(GTK_MENU_ITEM(entry->
widget),
TRUE);
229 g_object_set_data_full(G_OBJECT(entry->
widget),
"custom-data", g_strdup(style_name), g_free);
236 GdkModifierType mods, gpointer user_data)
248 GdkModifierType mods, gpointer user_data)
260 GdkModifierType mods, gpointer user_data)
272 GdkModifierType mods, gpointer user_data)
284 GdkModifierType mods, gpointer user_data)
300 GList *children = gtk_container_get_children(GTK_CONTAINER(menu));
301 for(GList *child = children; child; child = g_list_next(child))
302 gtk_widget_destroy(GTK_WIDGET(child->data));
303 g_list_free(children);
321 return G_SOURCE_REMOVE;
330 return G_SOURCE_REMOVE;
356 add_sub_menu_entry(menus, lists, _(
"No styles available"), index, NULL, NULL, NULL, NULL,
361 GHashTable *submenus = g_hash_table_new_full(g_str_hash, g_str_equal,
dt_free_gpointer, NULL);
363 for(GList *iter = styles; iter; iter = g_list_next(iter))
368 gchar **split = g_strsplit(style->
name,
"|", -1);
372 for(
int i = 0; split[
i];
i++)
373 if(split[
i][0] !=
'\0')
377 GString *submenu_path = g_string_new(NULL);
378 for(
int i = 0;
i < leaf;
i++)
380 if(split[
i][0] ==
'\0')
continue;
382 if(submenu_path->len > 0)
383 g_string_append_c(submenu_path,
'|');
384 g_string_append(submenu_path, split[
i]);
386 submenu_path->str, split[
i], index);
389 gchar *label = g_markup_escape_text(leaf >= 0 ? split[leaf] : style->
name, -1);
393 g_string_free(submenu_path,
TRUE);
399 g_hash_table_destroy(submenus);
412 _(
"Apply style BEFORE the current history.\n"
413 "CURRENT EDITS are applied afterwards and win conflicts."));
418 _(
"Apply style AFTER the current history.\n"
419 "STYLE EDITS are applied afterwards and win conflicts."));
424 _(
"Discard the current history and replace it entirely with the style."));
gchar * dt_accels_build_path(const gchar *scope, const gchar *feature)
Build the accel path of feature under scope.
Handle default and user-set shortcuts (accelerators)
int dt_act_on_get_images_nb(const gboolean only_visible, const gboolean force)
GList * dt_act_on_get_images()
int32_t dt_act_on_get_first_image()
GtkWidget * dt_gui_main_window(void)
struct dt_accels_t * dt_gui_get_accels(void)
void dt_gui_add_help_link(GtkWidget *widget, char *link)
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.
struct dt_develop_t * dt_dev_get_global(void)
struct dt_gui_gtk_t * dt_gui_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_undo_start_record(dt_develop_t *dev)
void dt_dev_undo_end_record(dt_develop_t *dev)
void dt_gui_styles_dialog_new(int32_t imgid)
gboolean dt_history_style_on_image(const int32_t imgid, const char *name, const gboolean duplicate)
gboolean dt_history_style_on_list(const GList *list, const char *name, const gboolean duplicate)
@ 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.
gchar * strip_markup(const char *s)
Remove Pango/Gtk markup and accel mnemonics from a text label. If markup parsing fails,...
void dt_lib_gui_set_expanded(dt_lib_module_t *module, gboolean expanded)
GtkWidget * dt_lib_gui_get_expander(dt_lib_module_t *module)
#define IS_NULL_PTR(p)
C is way too permissive with !=, == and if(var) checks, which can mean too many things depending on w...
static void dt_free_gpointer(gpointer ptr)
g_free() one pointer, with the signature GDestroyNotify wants.
#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)
struct dt_control_signal_t * dt_control_signal_get_global(void)
@ DT_SIGNAL_STYLE_CHANGED
This signal is raised when a style is added/deleted/changed
#define DT_DEBUG_CONTROL_SIGNAL_CONNECT(ctlsig, signal, cb, user_data)
char * dt_styles_get_item_list_as_string(const char *name)
void dt_style_free(gpointer data)
gboolean dt_styles_has_module_order(const char *name)
GList * dt_styles_get_list(const char *filter)
static GList ** _styles_lists
static dt_menus_t _styles_index
static void _styles_menu_rebuild_callback(gpointer instance, gpointer user_data)
static GtkWidget ** _styles_menus
static gboolean _styles_ask_checked_callback(GtkWidget *widget)
static gboolean _styles_history_prepend_callback(GtkAccelGroup *group, GObject *acceleratable, guint keyval, GdkModifierType mods, gpointer user_data)
static GtkWidget * _styles_get_submenu(GtkWidget **menus, GList **lists, GHashTable *submenus, GtkWidget *parent, const gchar *path, const gchar *label, const dt_menus_t index)
static gboolean _styles_apply_callback(GtkAccelGroup *group, GObject *acceleratable, guint keyval, GdkModifierType mods, gpointer user_data)
static gboolean _styles_ask_callback(GtkAccelGroup *group, GObject *acceleratable, guint keyval, GdkModifierType mods, gpointer user_data)
static gboolean _styles_history_prepend_checked_callback(GtkWidget *widget)
static gboolean _styles_copy_iop_order_callback(GtkAccelGroup *group, GObject *acceleratable, guint keyval, GdkModifierType mods, gpointer user_data)
static void _close_styles_popup(GtkWidget *dialog, gint response_id, gpointer data)
static gboolean _styles_open_popup_callback(GtkAccelGroup *group, GObject *acceleratable, guint keyval, GdkModifierType mods, gpointer user_data)
static gboolean _styles_signal_connected
static gboolean _styles_menu_disabled(GtkWidget *widget)
static gboolean _styles_history_append_checked_callback(GtkWidget *widget)
void append_styles(GtkWidget **menus, GList **lists, const dt_menus_t index)
static void _styles_add_menu_entry(GtkWidget **menus, GList **lists, GtkWidget *parent, const dt_menus_t index, const gchar *label, const gchar *tooltip, const gchar *style_name)
static guint _styles_menu_rebuild_source
static gboolean _styles_history_append_callback(GtkAccelGroup *group, GObject *acceleratable, guint keyval, GdkModifierType mods, gpointer user_data)
static gboolean _styles_copy_iop_order_checked_callback(GtkWidget *widget)
static gchar * _styles_build_tooltip(const dt_style_t *style)
static gboolean _styles_create_sensitive_callback(GtkWidget *widget)
static gboolean _styles_create_callback(GtkAccelGroup *group, GObject *acceleratable, guint keyval, GdkModifierType mods, gpointer user_data)
static gboolean _styles_history_replace_checked_callback(GtkWidget *widget)
static void _styles_menu_clear(void)
static gboolean _styles_menu_rebuild_idle(gpointer user_data)
static gboolean _styles_history_replace_callback(GtkAccelGroup *group, GObject *acceleratable, guint keyval, GdkModifierType mods, gpointer user_data)
struct dt_gui_gtk_t::@35 styles_popup
char * dt_get_help_url(char *name)