diff --git a/ChangeLog b/ChangeLog index de9f139d13..e9ce5416d0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,103 @@ +2004-04-29 Michael Natterer + + Switch from GtkItemFactory to GtkUIManager. The migration is + almost complete, still stuff missing/incomplete, definitely added + a bunch of new bugs... + + * app/actions/*-commands.[ch]: converted all callback from + GtkItemFactory callbacks to GtkAction callbacks. + + * app/actions/debug-actions.c + * app/actions/gradient-editor-actions.c + * app/actions/help-actions.c + * app/actions/plug-in-actions.c + * app/actions/qmask-actions.c + * app/actions/tool-options-actions.c: various fixes. + + * app/display/gimpdisplay.[ch] + * app/display/gimpdisplayshell-appearance.[ch] + * app/display/gimpdisplayshell-callbacks.c + * app/display/gimpdisplayshell.[ch]: move everything from + GtkItemFactory to GtkUIManager. + + * app/gui/dialogs.[ch]: added new function dialogs_get_toolbox(). + Needed because the action callbacks don't have a widget parameter + and sometimes we need a parent window for showing dialogs. + + * app/gui/Makefile.am + * app/gui/brushes-menu.[ch] + * app/gui/buffers-menu.[ch] + * app/gui/channels-menu.[ch] + * app/gui/colormap-editor-menu.[ch] + * app/gui/dialogs-menu.[ch] + * app/gui/documents-menu.[ch] + * app/gui/error-console-menu.[ch] + * app/gui/fonts-menu.[ch] + * app/gui/gradient-editor-menu.[ch] + * app/gui/gradients-menu.[ch] + * app/gui/images-menu.[ch] + * app/gui/layers-menu.[ch] + * app/gui/palette-editor-menu.[ch] + * app/gui/palettes-menu.[ch] + * app/gui/patterns-menu.[ch] + * app/gui/qmask-menu.[ch] + * app/gui/templates-menu.[ch] + * app/gui/vectors-menu.[ch]: removed these files. + + * app/gui/gui.c: create a global UI manager for the image popup + menu and the toolbox menubar. + + * app/gui/menus.[ch]: removed all GtkItemFactory code. + + * app/gui/image-menu.[ch] + * app/gui/toolbox-menu.[ch]: removed everything except the trivial + setup_funcs. + + * app/gui/file-open-menu.c + * app/gui/file-save-menu.c + * app/gui/tool-options-menu.c: don't use the macros from menus.h + any more, they are gone. + + * app/gui/gui-vtable.c + * app/gui/plug-in-menus.[ch]: create/destroy the dynamic plug-in + menu entries. + + * app/tools/gimpimagemaptool.c: s/gimp_item_factory_update/ + gimp_ui_manager_update/g + + * app/widgets/gimpuimanager.[ch]: added API to get an action + group by name. + + * app/widgets/gimpmenufactory.c: don't choke on the item_factory + entries being NULL. + + * app/widgets/gimpactiongroup.c: make sure booleans set using + g_object_set() only have TRUE or FALSE values. + + * app/widgets/gimpcolormapeditor.c + * app/widgets/gimpcomponenteditor.c + * app/widgets/gimpcontainereditor.[ch] + * app/widgets/gimpcontainergridview.c + * app/widgets/gimpcontainertreeview.c + * app/widgets/gimpdockable.[ch] + * app/widgets/gimpdocked.[ch] + * app/widgets/gimpeditor.[ch] + * app/widgets/gimperrorconsole.c + * app/widgets/gimpgradienteditor.c + * app/widgets/gimpitemtreeview.c + * app/widgets/gimppaletteeditor.c + * app/widgets/gimptoolbox.c + * app/widgets/gimptooloptionseditor.c: removed all GtkItemFactory + code and enable the #if 0'ed UI manager stuff. + + * menus/gradient-editor-menu.xml: fixed typos. + + * menus/image-menu.xml: duplicate everything so we have both + an image menubar and an image popup menu. Badly cries for an + XSL processor. + + * menus/toolbox-menu.xml: added an "Extensions" placeholder. + 2004-04-27 Michael Natterer * app/widgets/Makefile.am diff --git a/app/actions/buffers-commands.c b/app/actions/buffers-commands.c index e09d0242cd..f63760e2dd 100644 --- a/app/actions/buffers-commands.c +++ b/app/actions/buffers-commands.c @@ -32,7 +32,7 @@ /* public functionss */ void -buffers_paste_buffer_cmd_callback (GtkWidget *widget, +buffers_paste_buffer_cmd_callback (GtkAction *action, gpointer data) { GimpBufferView *view = GIMP_BUFFER_VIEW (data); @@ -41,7 +41,7 @@ buffers_paste_buffer_cmd_callback (GtkWidget *widget, } void -buffers_paste_buffer_into_cmd_callback (GtkWidget *widget, +buffers_paste_buffer_into_cmd_callback (GtkAction *action, gpointer data) { GimpBufferView *view = GIMP_BUFFER_VIEW (data); @@ -50,7 +50,7 @@ buffers_paste_buffer_into_cmd_callback (GtkWidget *widget, } void -buffers_paste_buffer_as_new_cmd_callback (GtkWidget *widget, +buffers_paste_buffer_as_new_cmd_callback (GtkAction *action, gpointer data) { GimpBufferView *view = GIMP_BUFFER_VIEW (data); @@ -59,7 +59,7 @@ buffers_paste_buffer_as_new_cmd_callback (GtkWidget *widget, } void -buffers_delete_buffer_cmd_callback (GtkWidget *widget, +buffers_delete_buffer_cmd_callback (GtkAction *action, gpointer data) { GimpBufferView *view = GIMP_BUFFER_VIEW (data); diff --git a/app/actions/buffers-commands.h b/app/actions/buffers-commands.h index 49972c8f01..a989118a22 100644 --- a/app/actions/buffers-commands.h +++ b/app/actions/buffers-commands.h @@ -20,13 +20,13 @@ #define __BUFFERS_COMMANDS_H__ -void buffers_paste_buffer_cmd_callback (GtkWidget *widget, +void buffers_paste_buffer_cmd_callback (GtkAction *action, gpointer data); -void buffers_paste_buffer_into_cmd_callback (GtkWidget *widget, +void buffers_paste_buffer_into_cmd_callback (GtkAction *action, gpointer data); -void buffers_paste_buffer_as_new_cmd_callback (GtkWidget *widget, +void buffers_paste_buffer_as_new_cmd_callback (GtkAction *action, gpointer data); -void buffers_delete_buffer_cmd_callback (GtkWidget *widget, +void buffers_delete_buffer_cmd_callback (GtkAction *action, gpointer data); diff --git a/app/actions/channels-commands.c b/app/actions/channels-commands.c index 08fc3aa102..f64be4344f 100644 --- a/app/actions/channels-commands.c +++ b/app/actions/channels-commands.c @@ -43,6 +43,8 @@ #include "display/gimpdisplay.h" +#include "gui/dialogs.h" + #include "channels-commands.h" #include "gimp-intl.h" @@ -79,21 +81,41 @@ static void channels_color_changed (GimpColorButton *button, if (! channel) \ return +#define return_if_no_widget(widget,data) \ + if (GIMP_IS_DISPLAY (data)) \ + widget = ((GimpDisplay *) data)->shell; \ + else if (GIMP_IS_GIMP (data)) \ + widget = dialogs_get_toolbox (); \ + else if (GIMP_IS_DOCK (data)) \ + widget = data; \ + else if (GIMP_IS_COMPONENT_EDITOR (data)) \ + widget = data; \ + else if (GIMP_IS_ITEM_TREE_VIEW (data)) \ + widget = data; \ + else \ + widget = NULL; \ + \ + if (! widget) \ + return + + /* public functions */ void -channels_new_cmd_callback (GtkWidget *widget, +channels_new_cmd_callback (GtkAction *action, gpointer data) { GimpImage *gimage; + GtkWidget *widget; return_if_no_image (gimage, data); + return_if_no_widget (widget, data); channels_new_channel_query (gimage, NULL, TRUE, widget); } void -channels_raise_cmd_callback (GtkWidget *widget, +channels_raise_cmd_callback (GtkAction *action, gpointer data) { GimpImage *gimage; @@ -105,7 +127,7 @@ channels_raise_cmd_callback (GtkWidget *widget, } void -channels_raise_to_top_cmd_callback (GtkWidget *widget, +channels_raise_to_top_cmd_callback (GtkAction *action, gpointer data) { GimpImage *gimage; @@ -117,7 +139,7 @@ channels_raise_to_top_cmd_callback (GtkWidget *widget, } void -channels_lower_cmd_callback (GtkWidget *widget, +channels_lower_cmd_callback (GtkAction *action, gpointer data) { GimpImage *gimage; @@ -129,7 +151,7 @@ channels_lower_cmd_callback (GtkWidget *widget, } void -channels_lower_to_bottom_cmd_callback (GtkWidget *widget, +channels_lower_to_bottom_cmd_callback (GtkAction *action, gpointer data) { GimpImage *gimage; @@ -141,7 +163,7 @@ channels_lower_to_bottom_cmd_callback (GtkWidget *widget, } void -channels_duplicate_cmd_callback (GtkWidget *widget, +channels_duplicate_cmd_callback (GtkAction *action, gpointer data) { GimpImage *gimage; @@ -193,7 +215,7 @@ channels_duplicate_cmd_callback (GtkWidget *widget, } void -channels_delete_cmd_callback (GtkWidget *widget, +channels_delete_cmd_callback (GtkAction *action, gpointer data) { GimpImage *gimage; @@ -205,14 +227,14 @@ channels_delete_cmd_callback (GtkWidget *widget, } void -channels_to_selection_cmd_callback (GtkWidget *widget, - gpointer data, - guint action) +channels_to_selection_cmd_callback (GtkAction *action, + gint value, + gpointer data) { GimpChannelOps op; GimpImage *gimage; - op = (GimpChannelOps) action; + op = (GimpChannelOps) value; if (GIMP_IS_COMPONENT_EDITOR (data)) { @@ -239,12 +261,14 @@ channels_to_selection_cmd_callback (GtkWidget *widget, } void -channels_edit_attributes_cmd_callback (GtkWidget *widget, +channels_edit_attributes_cmd_callback (GtkAction *action, gpointer data) { GimpImage *gimage; GimpChannel *active_channel; + GtkWidget *widget; return_if_no_channel (gimage, active_channel, data); + return_if_no_widget (widget, data); channels_edit_channel_query (active_channel, widget); } diff --git a/app/actions/channels-commands.h b/app/actions/channels-commands.h index 43def974a1..298222f9b6 100644 --- a/app/actions/channels-commands.h +++ b/app/actions/channels-commands.h @@ -20,24 +20,24 @@ #define __CHANNELS_COMMANDS_H__ -void channels_new_cmd_callback (GtkWidget *widget, +void channels_new_cmd_callback (GtkAction *action, gpointer data); -void channels_raise_cmd_callback (GtkWidget *widget, +void channels_raise_cmd_callback (GtkAction *action, gpointer data); -void channels_raise_to_top_cmd_callback (GtkWidget *widget, +void channels_raise_to_top_cmd_callback (GtkAction *action, gpointer data); -void channels_lower_cmd_callback (GtkWidget *widget, +void channels_lower_cmd_callback (GtkAction *action, gpointer data); -void channels_lower_to_bottom_cmd_callback (GtkWidget *widget, +void channels_lower_to_bottom_cmd_callback (GtkAction *action, gpointer data); -void channels_duplicate_cmd_callback (GtkWidget *widget, +void channels_duplicate_cmd_callback (GtkAction *action, gpointer data); -void channels_delete_cmd_callback (GtkWidget *widget, +void channels_delete_cmd_callback (GtkAction *action, gpointer data); -void channels_to_selection_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); -void channels_edit_attributes_cmd_callback (GtkWidget *widget, +void channels_to_selection_cmd_callback (GtkAction *action, + gint value, + gpointer data); +void channels_edit_attributes_cmd_callback (GtkAction *action, gpointer data); void channels_new_channel_query (GimpImage *gimage, diff --git a/app/actions/colormap-commands.c b/app/actions/colormap-commands.c index c8c72c896d..b12dcbb218 100644 --- a/app/actions/colormap-commands.c +++ b/app/actions/colormap-commands.c @@ -32,7 +32,7 @@ /* public functions */ void -colormap_editor_edit_color_cmd_callback (GtkWidget *widget, +colormap_editor_edit_color_cmd_callback (GtkAction *action, gpointer data) { GimpColormapEditor *editor = GIMP_COLORMAP_EDITOR (data); @@ -42,13 +42,13 @@ colormap_editor_edit_color_cmd_callback (GtkWidget *widget, } void -colormap_editor_add_color_cmd_callback (GtkWidget *widget, - gpointer data, - guint action) +colormap_editor_add_color_cmd_callback (GtkAction *action, + gint value, + gpointer data) { GimpColormapEditor *editor = GIMP_COLORMAP_EDITOR (data); if (GTK_WIDGET_SENSITIVE (editor->add_button)) gimp_button_extended_clicked (GIMP_BUTTON (editor->add_button), - action ? GDK_CONTROL_MASK : 0); + value ? GDK_CONTROL_MASK : 0); } diff --git a/app/actions/colormap-commands.h b/app/actions/colormap-commands.h index d1222255c4..0c3b4a1f41 100644 --- a/app/actions/colormap-commands.h +++ b/app/actions/colormap-commands.h @@ -20,11 +20,11 @@ #define __COLORMAP_EDITOR_COMMANDS_H__ -void colormap_editor_edit_color_cmd_callback (GtkWidget *widget, +void colormap_editor_edit_color_cmd_callback (GtkAction *action, + gpointer data); +void colormap_editor_add_color_cmd_callback (GtkAction *action, + gint value, gpointer data); -void colormap_editor_add_color_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); #endif /* __COLORMAP_EDITOR_COMMANDS_H__ */ diff --git a/app/actions/colormap-editor-commands.c b/app/actions/colormap-editor-commands.c index c8c72c896d..b12dcbb218 100644 --- a/app/actions/colormap-editor-commands.c +++ b/app/actions/colormap-editor-commands.c @@ -32,7 +32,7 @@ /* public functions */ void -colormap_editor_edit_color_cmd_callback (GtkWidget *widget, +colormap_editor_edit_color_cmd_callback (GtkAction *action, gpointer data) { GimpColormapEditor *editor = GIMP_COLORMAP_EDITOR (data); @@ -42,13 +42,13 @@ colormap_editor_edit_color_cmd_callback (GtkWidget *widget, } void -colormap_editor_add_color_cmd_callback (GtkWidget *widget, - gpointer data, - guint action) +colormap_editor_add_color_cmd_callback (GtkAction *action, + gint value, + gpointer data) { GimpColormapEditor *editor = GIMP_COLORMAP_EDITOR (data); if (GTK_WIDGET_SENSITIVE (editor->add_button)) gimp_button_extended_clicked (GIMP_BUTTON (editor->add_button), - action ? GDK_CONTROL_MASK : 0); + value ? GDK_CONTROL_MASK : 0); } diff --git a/app/actions/colormap-editor-commands.h b/app/actions/colormap-editor-commands.h index d1222255c4..0c3b4a1f41 100644 --- a/app/actions/colormap-editor-commands.h +++ b/app/actions/colormap-editor-commands.h @@ -20,11 +20,11 @@ #define __COLORMAP_EDITOR_COMMANDS_H__ -void colormap_editor_edit_color_cmd_callback (GtkWidget *widget, +void colormap_editor_edit_color_cmd_callback (GtkAction *action, + gpointer data); +void colormap_editor_add_color_cmd_callback (GtkAction *action, + gint value, gpointer data); -void colormap_editor_add_color_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); #endif /* __COLORMAP_EDITOR_COMMANDS_H__ */ diff --git a/app/actions/data-commands.c b/app/actions/data-commands.c index 03a6cd3774..466798d600 100644 --- a/app/actions/data-commands.c +++ b/app/actions/data-commands.c @@ -30,7 +30,7 @@ void -data_new_data_cmd_callback (GtkWidget *widget, +data_new_data_cmd_callback (GtkAction *action, gpointer data) { GimpDataFactoryView *view = GIMP_DATA_FACTORY_VIEW (data); @@ -40,7 +40,7 @@ data_new_data_cmd_callback (GtkWidget *widget, } void -data_duplicate_data_cmd_callback (GtkWidget *widget, +data_duplicate_data_cmd_callback (GtkAction *action, gpointer data) { GimpDataFactoryView *view = GIMP_DATA_FACTORY_VIEW (data); @@ -50,7 +50,7 @@ data_duplicate_data_cmd_callback (GtkWidget *widget, } void -data_edit_data_cmd_callback (GtkWidget *widget, +data_edit_data_cmd_callback (GtkAction *action, gpointer data) { GimpDataFactoryView *view = GIMP_DATA_FACTORY_VIEW (data); @@ -60,7 +60,7 @@ data_edit_data_cmd_callback (GtkWidget *widget, } void -data_delete_data_cmd_callback (GtkWidget *widget, +data_delete_data_cmd_callback (GtkAction *action, gpointer data) { GimpDataFactoryView *view = GIMP_DATA_FACTORY_VIEW (data); @@ -70,7 +70,7 @@ data_delete_data_cmd_callback (GtkWidget *widget, } void -data_refresh_data_cmd_callback (GtkWidget *widget, +data_refresh_data_cmd_callback (GtkAction *action, gpointer data) { GimpDataFactoryView *view = GIMP_DATA_FACTORY_VIEW (data); diff --git a/app/actions/data-commands.h b/app/actions/data-commands.h index 89bbb3ad99..af109529ec 100644 --- a/app/actions/data-commands.h +++ b/app/actions/data-commands.h @@ -20,15 +20,15 @@ #define __DATA_COMMANDS_H__ -void data_new_data_cmd_callback (GtkWidget *widget, +void data_new_data_cmd_callback (GtkAction *action, gpointer data); -void data_duplicate_data_cmd_callback (GtkWidget *widget, +void data_duplicate_data_cmd_callback (GtkAction *action, gpointer data); -void data_edit_data_cmd_callback (GtkWidget *widget, +void data_edit_data_cmd_callback (GtkAction *action, gpointer data); -void data_delete_data_cmd_callback (GtkWidget *widget, +void data_delete_data_cmd_callback (GtkAction *action, gpointer data); -void data_refresh_data_cmd_callback (GtkWidget *widget, +void data_refresh_data_cmd_callback (GtkAction *action, gpointer data); diff --git a/app/actions/debug-actions.c b/app/actions/debug-actions.c index bfa0131b69..a6e0fb1a6f 100644 --- a/app/actions/debug-actions.c +++ b/app/actions/debug-actions.c @@ -32,8 +32,7 @@ static GimpActionEntry debug_actions[] = { - { "debug-menu", NULL, - "/File/D_ebug" }, + { "debug-menu", NULL, "D_ebug" }, { "debug-mem-profile", NULL, "_Mem Profile", NULL, NULL, diff --git a/app/actions/debug-commands.c b/app/actions/debug-commands.c index 57490af44b..0394a955cd 100644 --- a/app/actions/debug-commands.c +++ b/app/actions/debug-commands.c @@ -28,7 +28,6 @@ #include "core/gimpobject.h" -#include "widgets/gimpitemfactory.h" #include "widgets/gimpmenufactory.h" #include "debug-commands.h" @@ -47,7 +46,7 @@ static void debug_dump_menus_recurse_menu (GtkWidget *menu, /* public functions */ void -debug_dump_menus_cmd_callback (GtkWidget *widget, +debug_dump_menus_cmd_callback (GtkAction *action, gpointer data) { GList *list; @@ -56,11 +55,11 @@ debug_dump_menus_cmd_callback (GtkWidget *widget, list; list = g_list_next (list)) { - GimpMenuFactoryEntry *entry; +#if 0 + FIXME + GimpMenuFactoryEntry *entry = list->data; GimpItemFactory *item_factory; - entry = list->data; - item_factory = gimp_item_factory_from_path (entry->identifier); if (item_factory) @@ -80,11 +79,12 @@ debug_dump_menus_cmd_callback (GtkWidget *widget, g_print ("\n"); } +#endif } } void -debug_mem_profile_cmd_callback (GtkWidget *widget, +debug_mem_profile_cmd_callback (GtkAction *action, gpointer data) { extern gboolean gimp_debug_memsize; @@ -104,6 +104,7 @@ debug_dump_menus_recurse_menu (GtkWidget *menu, gint depth, gchar *path) { +#if 0 GtkItemFactory *item_factory; GtkWidget *menu_item; GList *list; @@ -141,6 +142,7 @@ debug_dump_menus_recurse_menu (GtkWidget *menu, g_free (full_path); } } +#endif } #endif /* ENABLE_DEBUG_MENU */ diff --git a/app/actions/debug-commands.h b/app/actions/debug-commands.h index 614154569c..6202f84393 100644 --- a/app/actions/debug-commands.h +++ b/app/actions/debug-commands.h @@ -27,9 +27,9 @@ #ifdef ENABLE_DEBUG_MENU -void debug_dump_menus_cmd_callback (GtkWidget *widget, +void debug_dump_menus_cmd_callback (GtkAction *action, gpointer data); -void debug_mem_profile_cmd_callback (GtkWidget *widget, +void debug_mem_profile_cmd_callback (GtkAction *action, gpointer data); #endif /* ENABLE_DEBUG_MENU */ diff --git a/app/actions/dialogs-commands.c b/app/actions/dialogs-commands.c index 42f561528b..15ee25b1a6 100644 --- a/app/actions/dialogs-commands.c +++ b/app/actions/dialogs-commands.c @@ -26,15 +26,34 @@ #include "actions-types.h" +#include "core/gimp.h" +#include "core/gimpcontext.h" + #include "widgets/gimpdialogfactory.h" #include "widgets/gimpdockable.h" #include "widgets/gimpdockbook.h" #include "widgets/gimpimagedock.h" +#include "display/gimpdisplay.h" + #include "gui/dialogs.h" #include "dialogs-commands.h" +#define return_if_no_widget(widget,data) \ + if (GIMP_IS_DISPLAY (data)) \ + widget = ((GimpDisplay *) data)->shell; \ + else if (GIMP_IS_GIMP (data)) \ + widget = dialogs_get_toolbox (); \ + else if (GIMP_IS_DOCK (data)) \ + widget = data; \ + else \ + widget = NULL; \ + \ + if (! widget) \ + return + + /* local function prototypes */ static void dialogs_create_dock (GdkScreen *screen, @@ -46,50 +65,47 @@ static void dialogs_create_dock (GdkScreen *screen, /* public functions */ void -dialogs_show_toolbox_cmd_callback (GtkWidget *widget, +dialogs_show_toolbox_cmd_callback (GtkAction *action, gpointer data) { dialogs_show_toolbox (); } void -dialogs_create_toplevel_cmd_callback (GtkWidget *widget, - gpointer data, - guint action) +dialogs_create_toplevel_cmd_callback (GtkAction *action, + const gchar *value, + gpointer data) { - if (action) - { - const gchar *identifier = g_quark_to_string ((GQuark) action); + GtkWidget *widget; + return_if_no_widget (widget, data); - if (identifier) - gimp_dialog_factory_dialog_new (global_dialog_factory, - gtk_widget_get_screen (widget), - identifier, -1); - } + if (value) + gimp_dialog_factory_dialog_new (global_dialog_factory, + gtk_widget_get_screen (widget), + value, -1); } void -dialogs_create_dockable_cmd_callback (GtkWidget *widget, - gpointer data, - guint action) +dialogs_create_dockable_cmd_callback (GtkAction *action, + const gchar *value, + gpointer data) { - if (action) - { - const gchar *identifier = g_quark_to_string ((GQuark) action); + GtkWidget *widget; + return_if_no_widget (widget, data); - if (!identifier) - return; - - gimp_dialog_factory_dialog_raise (global_dock_factory, - gtk_widget_get_screen (widget), - identifier, -1); - } + if (value) + gimp_dialog_factory_dialog_raise (global_dock_factory, + gtk_widget_get_screen (widget), + value, -1); } void -dialogs_create_lc_cmd_callback (GtkWidget *widget, +dialogs_create_lc_cmd_callback (GtkAction *action, gpointer data) { + GtkWidget *widget; + return_if_no_widget (widget, data); + static const gchar *tabs[] = { "gimp-layer-list", @@ -103,9 +119,12 @@ dialogs_create_lc_cmd_callback (GtkWidget *widget, } void -dialogs_create_data_cmd_callback (GtkWidget *widget, +dialogs_create_data_cmd_callback (GtkAction *action, gpointer data) { + GtkWidget *widget; + return_if_no_widget (widget, data); + static const gchar *tabs[] = { "gimp-brush-grid", @@ -120,9 +139,12 @@ dialogs_create_data_cmd_callback (GtkWidget *widget, } void -dialogs_create_stuff_cmd_callback (GtkWidget *widget, +dialogs_create_stuff_cmd_callback (GtkAction *action, gpointer data) { + GtkWidget *widget; + return_if_no_widget (widget, data); + static const gchar *tabs[] = { "gimp-buffer-list", diff --git a/app/actions/dialogs-commands.h b/app/actions/dialogs-commands.h index 039435b0d9..d3610cb755 100644 --- a/app/actions/dialogs-commands.h +++ b/app/actions/dialogs-commands.h @@ -20,21 +20,21 @@ #define __DIALOGS_COMMANDS_H__ -void dialogs_show_toolbox_cmd_callback (GtkWidget *widget, - gpointer data); -void dialogs_create_toplevel_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); -void dialogs_create_dockable_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); +void dialogs_show_toolbox_cmd_callback (GtkAction *action, + gpointer data); +void dialogs_create_toplevel_cmd_callback (GtkAction *action, + const gchar *value, + gpointer data); +void dialogs_create_dockable_cmd_callback (GtkAction *action, + const gchar *value, + gpointer data); -void dialogs_create_lc_cmd_callback (GtkWidget *widget, - gpointer data); -void dialogs_create_data_cmd_callback (GtkWidget *widget, - gpointer data); -void dialogs_create_stuff_cmd_callback (GtkWidget *widget, - gpointer data); +void dialogs_create_lc_cmd_callback (GtkAction *action, + gpointer data); +void dialogs_create_data_cmd_callback (GtkAction *action, + gpointer data); +void dialogs_create_stuff_cmd_callback (GtkAction *action, + gpointer data); void dialogs_show_toolbox (void); diff --git a/app/actions/dockable-commands.c b/app/actions/dockable-commands.c index 04962106f1..f0759a59b0 100644 --- a/app/actions/dockable-commands.c +++ b/app/actions/dockable-commands.c @@ -41,39 +41,32 @@ /* public functions */ void -dockable_add_tab_cmd_callback (GtkWidget *widget, - gpointer data, - guint action) +dockable_add_tab_cmd_callback (GtkAction *action, + const gchar *value, + gpointer data) { GimpDockbook *dockbook = GIMP_DOCKBOOK (data); - if (action) + if (value) { - GtkWidget *dockable; - const gchar *identifier; + GtkWidget *dockable; - identifier = g_quark_to_string ((GQuark) action); + dockable = + gimp_dialog_factory_dockable_new (dockbook->dock->dialog_factory, + dockbook->dock, + value, -1); - if (identifier) - { - dockable = - gimp_dialog_factory_dockable_new (dockbook->dock->dialog_factory, - dockbook->dock, - identifier, - -1); - - /* Maybe gimp_dialog_factory_dockable_new() returned an already - * existing singleton dockable, so check if it already is - * attached to a dockbook. - */ - if (dockable && ! GIMP_DOCKABLE (dockable)->dockbook) - gimp_dockbook_add (dockbook, GIMP_DOCKABLE (dockable), -1); - } + /* Maybe gimp_dialog_factory_dockable_new() returned an already + * existing singleton dockable, so check if it already is + * attached to a dockbook. + */ + if (dockable && ! GIMP_DOCKABLE (dockable)->dockbook) + gimp_dockbook_add (dockbook, GIMP_DOCKABLE (dockable), -1); } } void -dockable_close_tab_cmd_callback (GtkWidget *widget, +dockable_close_tab_cmd_callback (GtkAction *action, gpointer data) { GimpDockbook *dockbook = GIMP_DOCKBOOK (data); @@ -90,7 +83,7 @@ dockable_close_tab_cmd_callback (GtkWidget *widget, } void -dockable_detach_tab_cmd_callback (GtkWidget *widget, +dockable_detach_tab_cmd_callback (GtkAction *action, gpointer data) { GimpDockbook *dockbook = GIMP_DOCKBOOK (data); @@ -107,19 +100,17 @@ dockable_detach_tab_cmd_callback (GtkWidget *widget, } void -dockable_toggle_view_cmd_callback (GtkWidget *widget, - gpointer data, - guint action) +dockable_toggle_view_cmd_callback (GtkAction *action, + GtkAction *current, + gpointer data) { GimpDockbook *dockbook = GIMP_DOCKBOOK (data); GimpDockable *dockable; GimpViewType view_type; gint page_num; - if (! GTK_CHECK_MENU_ITEM (widget)->active) - return; - - view_type = (GimpViewType) action; + view_type = (GimpViewType) + gtk_radio_action_get_current_value (GTK_RADIO_ACTION (action)); page_num = gtk_notebook_get_current_page (GTK_NOTEBOOK (dockbook)); @@ -196,19 +187,16 @@ dockable_toggle_view_cmd_callback (GtkWidget *widget, } void -dockable_preview_size_cmd_callback (GtkWidget *widget, - gpointer data, - guint action) +dockable_preview_size_cmd_callback (GtkAction *action, + GtkAction *current, + gpointer data) { GimpDockbook *dockbook = GIMP_DOCKBOOK (data); GimpDockable *dockable; gint preview_size; gint page_num; - if (! GTK_CHECK_MENU_ITEM (widget)->active) - return; - - preview_size = (gint) action; + preview_size = gtk_radio_action_get_current_value (GTK_RADIO_ACTION (action)); page_num = gtk_notebook_get_current_page (GTK_NOTEBOOK (dockbook)); @@ -228,19 +216,17 @@ dockable_preview_size_cmd_callback (GtkWidget *widget, } void -dockable_tab_style_cmd_callback (GtkWidget *widget, - gpointer data, - guint action) +dockable_tab_style_cmd_callback (GtkAction *action, + GtkAction *current, + gpointer data) { GimpDockbook *dockbook = GIMP_DOCKBOOK (data); GimpDockable *dockable; GimpTabStyle tab_style; gint page_num; - if (! GTK_CHECK_MENU_ITEM (widget)->active) - return; - - tab_style = (gint) action; + tab_style = (GimpTabStyle) + gtk_radio_action_get_current_value (GTK_RADIO_ACTION (action)); page_num = gtk_notebook_get_current_page (GTK_NOTEBOOK (dockbook)); @@ -262,25 +248,31 @@ dockable_tab_style_cmd_callback (GtkWidget *widget, } void -dockable_toggle_image_menu_cmd_callback (GtkWidget *widget, +dockable_toggle_image_menu_cmd_callback (GtkAction *action, gpointer data) { GimpDockbook *dockbook = GIMP_DOCKBOOK (data); + gboolean active; + + active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)); if (GIMP_IS_IMAGE_DOCK (dockbook->dock)) gimp_image_dock_set_show_image_menu (GIMP_IMAGE_DOCK (dockbook->dock), - GTK_CHECK_MENU_ITEM (widget)->active); + active); } void -dockable_toggle_auto_cmd_callback (GtkWidget *widget, +dockable_toggle_auto_cmd_callback (GtkAction *action, gpointer data) { GimpDockbook *dockbook = GIMP_DOCKBOOK (data); + gboolean active; + + active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)); if (GIMP_IS_IMAGE_DOCK (dockbook->dock)) gimp_image_dock_set_auto_follow_active (GIMP_IMAGE_DOCK (dockbook->dock), - GTK_CHECK_MENU_ITEM (widget)->active); + active); } static void @@ -305,7 +297,7 @@ dockable_change_screen_destroy_callback (GtkWidget *query_box, } void -dockable_change_screen_cmd_callback (GtkWidget *widget, +dockable_change_screen_cmd_callback (GtkAction *action, gpointer data) { GimpDockbook *dockbook = GIMP_DOCKBOOK (data); diff --git a/app/actions/dockable-commands.h b/app/actions/dockable-commands.h index 04d7785d63..9f2c1f31d8 100644 --- a/app/actions/dockable-commands.h +++ b/app/actions/dockable-commands.h @@ -20,30 +20,30 @@ #define __DOCKABLE_COMMANDS_H__ -void dockable_add_tab_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); -void dockable_close_tab_cmd_callback (GtkWidget *widget, - gpointer data); -void dockable_detach_tab_cmd_callback (GtkWidget *widget, - gpointer data); +void dockable_add_tab_cmd_callback (GtkAction *action, + const gchar *value, + gpointer data); +void dockable_close_tab_cmd_callback (GtkAction *action, + gpointer data); +void dockable_detach_tab_cmd_callback (GtkAction *action, + gpointer data); -void dockable_toggle_view_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); -void dockable_preview_size_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); -void dockable_tab_style_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); +void dockable_toggle_view_cmd_callback (GtkAction *action, + GtkAction *current, + gpointer data); +void dockable_preview_size_cmd_callback (GtkAction *action, + GtkAction *current, + gpointer data); +void dockable_tab_style_cmd_callback (GtkAction *action, + GtkAction *current, + gpointer data); -void dockable_toggle_image_menu_cmd_callback (GtkWidget *widget, - gpointer data); -void dockable_toggle_auto_cmd_callback (GtkWidget *widget, - gpointer data); -void dockable_change_screen_cmd_callback (GtkWidget *widget, - gpointer data); +void dockable_toggle_image_menu_cmd_callback (GtkAction *action, + gpointer data); +void dockable_toggle_auto_cmd_callback (GtkAction *action, + gpointer data); +void dockable_change_screen_cmd_callback (GtkAction *action, + gpointer data); #endif /* __DOCKABLE_COMMANDS_H__ */ diff --git a/app/actions/documents-commands.c b/app/actions/documents-commands.c index d043c0a405..86bd552047 100644 --- a/app/actions/documents-commands.c +++ b/app/actions/documents-commands.c @@ -32,7 +32,7 @@ /* public functions */ void -documents_open_document_cmd_callback (GtkWidget *widget, +documents_open_document_cmd_callback (GtkAction *action, gpointer data) { GimpDocumentView *view = GIMP_DOCUMENT_VIEW (data); @@ -41,7 +41,7 @@ documents_open_document_cmd_callback (GtkWidget *widget, } void -documents_raise_or_open_document_cmd_callback (GtkWidget *widget, +documents_raise_or_open_document_cmd_callback (GtkAction *action, gpointer data) { GimpDocumentView *view = GIMP_DOCUMENT_VIEW (data); @@ -51,7 +51,7 @@ documents_raise_or_open_document_cmd_callback (GtkWidget *widget, } void -documents_file_open_dialog_cmd_callback (GtkWidget *widget, +documents_file_open_dialog_cmd_callback (GtkAction *action, gpointer data) { GimpDocumentView *view = GIMP_DOCUMENT_VIEW (data); @@ -61,7 +61,7 @@ documents_file_open_dialog_cmd_callback (GtkWidget *widget, } void -documents_remove_document_cmd_callback (GtkWidget *widget, +documents_remove_document_cmd_callback (GtkAction *action, gpointer data) { GimpDocumentView *view = GIMP_DOCUMENT_VIEW (data); @@ -71,7 +71,7 @@ documents_remove_document_cmd_callback (GtkWidget *widget, void -documents_recreate_preview_cmd_callback (GtkWidget *widget, +documents_recreate_preview_cmd_callback (GtkAction *action, gpointer data) { GimpDocumentView *view = GIMP_DOCUMENT_VIEW (data); @@ -80,7 +80,7 @@ documents_recreate_preview_cmd_callback (GtkWidget *widget, } void -documents_reload_previews_cmd_callback (GtkWidget *widget, +documents_reload_previews_cmd_callback (GtkAction *action, gpointer data) { GimpDocumentView *view = GIMP_DOCUMENT_VIEW (data); @@ -90,7 +90,7 @@ documents_reload_previews_cmd_callback (GtkWidget *widget, } void -documents_delete_dangling_documents_cmd_callback (GtkWidget *widget, +documents_delete_dangling_documents_cmd_callback (GtkAction *action, gpointer data) { GimpDocumentView *view = GIMP_DOCUMENT_VIEW (data); diff --git a/app/actions/documents-commands.h b/app/actions/documents-commands.h index 7d84b3249c..eb6bcc2301 100644 --- a/app/actions/documents-commands.h +++ b/app/actions/documents-commands.h @@ -20,19 +20,19 @@ #define __DOCUMENTS_COMMANDS_H__ -void documents_open_document_cmd_callback (GtkWidget *widget, +void documents_open_document_cmd_callback (GtkAction *action, gpointer data); -void documents_raise_or_open_document_cmd_callback (GtkWidget *widget, +void documents_raise_or_open_document_cmd_callback (GtkAction *action, gpointer data); -void documents_file_open_dialog_cmd_callback (GtkWidget *widget, +void documents_file_open_dialog_cmd_callback (GtkAction *action, gpointer data); -void documents_remove_document_cmd_callback (GtkWidget *widget, +void documents_remove_document_cmd_callback (GtkAction *action, gpointer data); -void documents_recreate_preview_cmd_callback (GtkWidget *widget, +void documents_recreate_preview_cmd_callback (GtkAction *action, gpointer data); -void documents_reload_previews_cmd_callback (GtkWidget *widget, +void documents_reload_previews_cmd_callback (GtkAction *action, gpointer data); -void documents_delete_dangling_documents_cmd_callback (GtkWidget *widget, +void documents_delete_dangling_documents_cmd_callback (GtkAction *action, gpointer data); diff --git a/app/actions/drawable-commands.c b/app/actions/drawable-commands.c index 315df5921d..2336af94a0 100644 --- a/app/actions/drawable-commands.c +++ b/app/actions/drawable-commands.c @@ -41,9 +41,11 @@ #include "display/gimpdisplay.h" -#include "drawable-commands.h" +#include "gui/dialogs.h" #include "gui/offset-dialog.h" +#include "drawable-commands.h" + #include "gimp-intl.h" @@ -68,11 +70,26 @@ if (! drawable) \ return +#define return_if_no_widget(widget,data) \ + if (GIMP_IS_DISPLAY (data)) \ + widget = ((GimpDisplay *) data)->shell; \ + else if (GIMP_IS_GIMP (data)) \ + widget = dialogs_get_toolbox (); \ + else if (GIMP_IS_DOCK (data)) \ + widget = data; \ + else if (GIMP_IS_ITEM_TREE_VIEW (data)) \ + widget = data; \ + else \ + widget = NULL; \ + \ + if (! widget) \ + return + /* public functions */ void -drawable_desaturate_cmd_callback (GtkWidget *widget, +drawable_desaturate_cmd_callback (GtkAction *action, gpointer data) { GimpImage *gimage; @@ -90,7 +107,7 @@ drawable_desaturate_cmd_callback (GtkWidget *widget, } void -drawable_invert_cmd_callback (GtkWidget *widget, +drawable_invert_cmd_callback (GtkAction *action, gpointer data) { GimpImage *gimage; @@ -108,7 +125,7 @@ drawable_invert_cmd_callback (GtkWidget *widget, } void -drawable_equalize_cmd_callback (GtkWidget *widget, +drawable_equalize_cmd_callback (GtkAction *action, gpointer data) { GimpImage *gimage; @@ -126,9 +143,9 @@ drawable_equalize_cmd_callback (GtkWidget *widget, } void -drawable_flip_cmd_callback (GtkWidget *widget, - gpointer data, - guint action) +drawable_flip_cmd_callback (GtkAction *action, + gint value, + gpointer data) { GimpImage *gimage; GimpDrawable *active_drawable; @@ -142,7 +159,7 @@ drawable_flip_cmd_callback (GtkWidget *widget, gimp_item_offsets (item, &off_x, &off_y); - switch ((GimpOrientationType) action) + switch ((GimpOrientationType) value) { case GIMP_ORIENTATION_HORIZONTAL: axis = ((gdouble) off_x + (gdouble) gimp_item_width (item) / 2.0); @@ -162,7 +179,7 @@ drawable_flip_cmd_callback (GtkWidget *widget, gimp_image_undo_group_start (gimage, GIMP_UNDO_GROUP_TRANSFORM, _("Flip Layer")); - gimp_item_flip (item, context, (GimpOrientationType) action, axis, FALSE); + gimp_item_flip (item, context, (GimpOrientationType) value, axis, FALSE); if (gimp_item_get_linked (item)) { @@ -175,9 +192,9 @@ drawable_flip_cmd_callback (GtkWidget *widget, } void -drawable_rotate_cmd_callback (GtkWidget *widget, - gpointer data, - guint action) +drawable_rotate_cmd_callback (GtkAction *action, + gint value, + gpointer data) { GimpImage *gimage; GimpDrawable *active_drawable; @@ -200,12 +217,12 @@ drawable_rotate_cmd_callback (GtkWidget *widget, gimp_image_undo_group_start (gimage, GIMP_UNDO_GROUP_TRANSFORM, _("Rotate Layer")); - gimp_item_rotate (item, context, (GimpRotationType) action, + gimp_item_rotate (item, context, (GimpRotationType) value, center_x, center_y, FALSE); if (gimp_item_get_linked (item)) { - gimp_item_linked_rotate (item, context, (GimpRotationType) action, + gimp_item_linked_rotate (item, context, (GimpRotationType) value, center_x, center_y, FALSE); gimp_image_undo_group_end (gimage); } @@ -214,13 +231,15 @@ drawable_rotate_cmd_callback (GtkWidget *widget, } void -drawable_offset_cmd_callback (GtkWidget *widget, +drawable_offset_cmd_callback (GtkAction *action, gpointer data) { GimpImage *gimage; GimpDrawable *drawable; + GtkWidget *widget; GtkWidget *dialog; return_if_no_drawable (gimage, drawable, data); + return_if_no_widget (widget, data); dialog = offset_dialog_new (drawable, widget); gtk_widget_show (dialog); diff --git a/app/actions/drawable-commands.h b/app/actions/drawable-commands.h index df3b6f2fa4..2e5b60fe6f 100644 --- a/app/actions/drawable-commands.h +++ b/app/actions/drawable-commands.h @@ -20,19 +20,19 @@ #define __DRAWABLE_COMMANDS_H__ -void drawable_desaturate_cmd_callback (GtkWidget *widget, +void drawable_desaturate_cmd_callback (GtkAction *action, gpointer data); -void drawable_invert_cmd_callback (GtkWidget *widget, +void drawable_invert_cmd_callback (GtkAction *action, gpointer data); -void drawable_equalize_cmd_callback (GtkWidget *widget, +void drawable_equalize_cmd_callback (GtkAction *action, gpointer data); -void drawable_flip_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); -void drawable_rotate_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); -void drawable_offset_cmd_callback (GtkWidget *widget, +void drawable_flip_cmd_callback (GtkAction *action, + gint value, + gpointer data); +void drawable_rotate_cmd_callback (GtkAction *action, + gint value, + gpointer data); +void drawable_offset_cmd_callback (GtkAction *action, gpointer data); diff --git a/app/actions/edit-commands.c b/app/actions/edit-commands.c index 196d2678d9..0960a539f3 100644 --- a/app/actions/edit-commands.c +++ b/app/actions/edit-commands.c @@ -96,7 +96,7 @@ static void copy_named_buffer_callback (GtkWidget *widget, /* public functions */ void -edit_undo_cmd_callback (GtkWidget *widget, +edit_undo_cmd_callback (GtkAction *action, gpointer data) { GimpImage *gimage; @@ -107,7 +107,7 @@ edit_undo_cmd_callback (GtkWidget *widget, } void -edit_redo_cmd_callback (GtkWidget *widget, +edit_redo_cmd_callback (GtkAction *action, gpointer data) { GimpImage *gimage; @@ -118,7 +118,7 @@ edit_redo_cmd_callback (GtkWidget *widget, } void -edit_cut_cmd_callback (GtkWidget *widget, +edit_cut_cmd_callback (GtkAction *action, gpointer data) { GimpImage *gimage; @@ -130,7 +130,7 @@ edit_cut_cmd_callback (GtkWidget *widget, } void -edit_copy_cmd_callback (GtkWidget *widget, +edit_copy_cmd_callback (GtkAction *action, gpointer data) { GimpImage *gimage; @@ -165,7 +165,7 @@ edit_paste (GimpDisplay *gdisp, } void -edit_paste_cmd_callback (GtkWidget *widget, +edit_paste_cmd_callback (GtkAction *action, gpointer data) { GimpDisplay *gdisp; @@ -175,7 +175,7 @@ edit_paste_cmd_callback (GtkWidget *widget, } void -edit_paste_into_cmd_callback (GtkWidget *widget, +edit_paste_into_cmd_callback (GtkAction *action, gpointer data) { GimpDisplay *gdisp; @@ -185,7 +185,7 @@ edit_paste_into_cmd_callback (GtkWidget *widget, } void -edit_paste_as_new_cmd_callback (GtkWidget *widget, +edit_paste_as_new_cmd_callback (GtkAction *action, gpointer data) { GimpDisplay *gdisp; @@ -200,7 +200,7 @@ edit_paste_as_new_cmd_callback (GtkWidget *widget, } void -edit_named_cut_cmd_callback (GtkWidget *widget, +edit_named_cut_cmd_callback (GtkAction *action, gpointer data) { GimpDisplay *gdisp; @@ -219,7 +219,7 @@ edit_named_cut_cmd_callback (GtkWidget *widget, } void -edit_named_copy_cmd_callback (GtkWidget *widget, +edit_named_copy_cmd_callback (GtkAction *action, gpointer data) { GimpDisplay *gdisp; @@ -238,16 +238,19 @@ edit_named_copy_cmd_callback (GtkWidget *widget, } void -edit_named_paste_cmd_callback (GtkWidget *widget, +edit_named_paste_cmd_callback (GtkAction *action, gpointer data) { + GimpDisplay *gdisp; + return_if_no_display (gdisp, data); + gimp_dialog_factory_dialog_raise (global_dock_factory, - gtk_widget_get_screen (widget), + gtk_widget_get_screen (gdisp->shell), "gimp-buffer-list|gimp-buffer-grid", -1); } void -edit_clear_cmd_callback (GtkWidget *widget, +edit_clear_cmd_callback (GtkAction *action, gpointer data) { GimpImage *gimage; @@ -259,16 +262,16 @@ edit_clear_cmd_callback (GtkWidget *widget, } void -edit_fill_cmd_callback (GtkWidget *widget, - gpointer data, - guint action) +edit_fill_cmd_callback (GtkAction *action, + gint value, + gpointer data) { GimpImage *gimage; GimpDrawable *drawable; GimpFillType fill_type; return_if_no_drawable (gimage, drawable, data); - fill_type = (GimpFillType) action; + fill_type = (GimpFillType) value; gimp_edit_fill (gimage, drawable, gimp_get_user_context (gimage->gimp), fill_type); @@ -276,14 +279,16 @@ edit_fill_cmd_callback (GtkWidget *widget, } void -edit_stroke_cmd_callback (GtkWidget *widget, +edit_stroke_cmd_callback (GtkAction *action, gpointer data) { + GimpDisplay *gdisp; GimpImage *gimage; GimpDrawable *drawable; + return_if_no_display (gdisp, data); return_if_no_drawable (gimage, drawable, data); - edit_stroke_selection (GIMP_ITEM (gimp_image_get_mask (gimage)), widget); + edit_stroke_selection (GIMP_ITEM (gimp_image_get_mask (gimage)), gdisp->shell); } void diff --git a/app/actions/edit-commands.h b/app/actions/edit-commands.h index a7d3913b91..d16215c733 100644 --- a/app/actions/edit-commands.h +++ b/app/actions/edit-commands.h @@ -20,32 +20,32 @@ #define __EDIT_COMMANDS_H__ -void edit_undo_cmd_callback (GtkWidget *widget, +void edit_undo_cmd_callback (GtkAction *action, gpointer data); -void edit_redo_cmd_callback (GtkWidget *widget, +void edit_redo_cmd_callback (GtkAction *action, gpointer data); -void edit_cut_cmd_callback (GtkWidget *widget, +void edit_cut_cmd_callback (GtkAction *action, gpointer data); -void edit_copy_cmd_callback (GtkWidget *widget, +void edit_copy_cmd_callback (GtkAction *action, gpointer data); -void edit_paste_cmd_callback (GtkWidget *widget, +void edit_paste_cmd_callback (GtkAction *action, gpointer data); -void edit_paste_into_cmd_callback (GtkWidget *widget, +void edit_paste_into_cmd_callback (GtkAction *action, gpointer data); -void edit_paste_as_new_cmd_callback (GtkWidget *widget, +void edit_paste_as_new_cmd_callback (GtkAction *action, gpointer data); -void edit_named_cut_cmd_callback (GtkWidget *widget, +void edit_named_cut_cmd_callback (GtkAction *action, gpointer data); -void edit_named_copy_cmd_callback (GtkWidget *widget, +void edit_named_copy_cmd_callback (GtkAction *action, gpointer data); -void edit_named_paste_cmd_callback (GtkWidget *widget, +void edit_named_paste_cmd_callback (GtkAction *action, gpointer data); -void edit_clear_cmd_callback (GtkWidget *widget, +void edit_clear_cmd_callback (GtkAction *action, gpointer data); -void edit_fill_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); -void edit_stroke_cmd_callback (GtkWidget *widget, +void edit_fill_cmd_callback (GtkAction *action, + gint value, + gpointer data); +void edit_stroke_cmd_callback (GtkAction *action, gpointer data); void edit_stroke_selection (GimpItem *item, diff --git a/app/actions/error-console-commands.c b/app/actions/error-console-commands.c index 4a3e48d7a4..021c6309da 100644 --- a/app/actions/error-console-commands.c +++ b/app/actions/error-console-commands.c @@ -32,7 +32,7 @@ /* public functions */ void -error_console_clear_cmd_callback (GtkWidget *widget, +error_console_clear_cmd_callback (GtkAction *action, gpointer data) { GimpErrorConsole *console = GIMP_ERROR_CONSOLE (data); @@ -42,7 +42,7 @@ error_console_clear_cmd_callback (GtkWidget *widget, } void -error_console_save_all_cmd_callback (GtkWidget *widget, +error_console_save_all_cmd_callback (GtkAction *action, gpointer data) { GimpErrorConsole *console = GIMP_ERROR_CONSOLE (data); @@ -52,7 +52,7 @@ error_console_save_all_cmd_callback (GtkWidget *widget, } void -error_console_save_selection_cmd_callback (GtkWidget *widget, +error_console_save_selection_cmd_callback (GtkAction *action, gpointer data) { GimpErrorConsole *console = GIMP_ERROR_CONSOLE (data); diff --git a/app/actions/error-console-commands.h b/app/actions/error-console-commands.h index e2b5cc6f6f..28d225472a 100644 --- a/app/actions/error-console-commands.h +++ b/app/actions/error-console-commands.h @@ -20,11 +20,11 @@ #define __ERROR_CONSOLE_COMMANDS_H__ -void error_console_clear_cmd_callback (GtkWidget *widget, +void error_console_clear_cmd_callback (GtkAction *action, gpointer data); -void error_console_save_all_cmd_callback (GtkWidget *widget, +void error_console_save_all_cmd_callback (GtkAction *action, gpointer data); -void error_console_save_selection_cmd_callback (GtkWidget *widget, +void error_console_save_selection_cmd_callback (GtkAction *action, gpointer data); diff --git a/app/actions/file-commands.c b/app/actions/file-commands.c index c81cefb1a6..3f547df595 100644 --- a/app/actions/file-commands.c +++ b/app/actions/file-commands.c @@ -74,7 +74,6 @@ if (! gimp) \ return - #define return_if_no_display(gdisp,data) \ if (GIMP_IS_DISPLAY (data)) \ gdisp = data; \ @@ -87,6 +86,18 @@ if (! gdisp) \ return +#define return_if_no_widget(widget,data) \ + if (GIMP_IS_DISPLAY (data)) \ + widget = ((GimpDisplay *) data)->shell; \ + else if (GIMP_IS_GIMP (data)) \ + widget = dialogs_get_toolbox (); \ + else if (GIMP_IS_DOCK (data)) \ + widget = data; \ + else \ + widget = NULL; \ + if (! widget) \ + return + /* local function prototypes */ @@ -101,17 +112,18 @@ static void file_revert_confirm_callback (GtkWidget *widget, /* public functions */ void -file_new_cmd_callback (GtkWidget *widget, - gpointer data, - guint action) +file_new_cmd_callback (GtkAction *action, + gpointer data) { Gimp *gimp; GimpImage *gimage; + GtkWidget *widget; GtkWidget *dialog; return_if_no_gimp (gimp, data); + return_if_no_widget (widget, data); /* if called from the image menu */ - if (action) + if (GIMP_IS_DISPLAY (data)) gimage = gimp_context_get_image (gimp_get_user_context (gimp)); else gimage = NULL; @@ -125,25 +137,26 @@ file_new_cmd_callback (GtkWidget *widget, } void -file_type_cmd_callback (GtkWidget *widget, +file_type_cmd_callback (GtkAction *action, gpointer data) { gimp_file_dialog_set_file_proc (GIMP_FILE_DIALOG (data), - g_object_get_data (G_OBJECT (widget), + g_object_get_data (G_OBJECT (action), "file-proc")); } void -file_open_cmd_callback (GtkWidget *widget, - gpointer data, - guint action) +file_open_cmd_callback (GtkAction *action, + gpointer data) { Gimp *gimp; GimpImage *gimage; + GtkWidget *widget; return_if_no_gimp (gimp, data); + return_if_no_widget (widget, data); /* if called from the image menu */ - if (action) + if (GIMP_IS_DISPLAY (data)) gimage = gimp_context_get_image (gimp_get_user_context (gimp)); else gimage = NULL; @@ -152,22 +165,22 @@ file_open_cmd_callback (GtkWidget *widget, } void -file_last_opened_cmd_callback (GtkWidget *widget, - gpointer data, - guint action) +file_last_opened_cmd_callback (GtkAction *action, + gint value, + gpointer data) { Gimp *gimp; GimpImagefile *imagefile; - guint num_entries; + gint num_entries; return_if_no_gimp (gimp, data); num_entries = gimp_container_num_children (gimp->documents); - if (action >= num_entries) + if (value >= num_entries) return; imagefile = (GimpImagefile *) - gimp_container_get_child_by_index (gimp->documents, action); + gimp_container_get_child_by_index (gimp->documents, value); if (imagefile) { @@ -196,7 +209,7 @@ file_last_opened_cmd_callback (GtkWidget *widget, } void -file_save_cmd_callback (GtkWidget *widget, +file_save_cmd_callback (GtkAction *action, gpointer data) { GimpDisplay *gdisp; @@ -214,7 +227,7 @@ file_save_cmd_callback (GtkWidget *widget, if (! uri) { - file_save_as_cmd_callback (widget, data); + file_save_as_cmd_callback (action, data); } else { @@ -243,27 +256,28 @@ file_save_cmd_callback (GtkWidget *widget, } void -file_save_as_cmd_callback (GtkWidget *widget, +file_save_as_cmd_callback (GtkAction *action, gpointer data) { GimpDisplay *gdisp; return_if_no_display (gdisp, data); - file_save_dialog_show (gdisp->gimage, global_menu_factory, widget); + file_save_dialog_show (gdisp->gimage, global_menu_factory, gdisp->shell); } void -file_save_a_copy_cmd_callback (GtkWidget *widget, +file_save_a_copy_cmd_callback (GtkAction *action, gpointer data) { GimpDisplay *gdisp; return_if_no_display (gdisp, data); - file_save_a_copy_dialog_show (gdisp->gimage, global_menu_factory, widget); + file_save_a_copy_dialog_show (gdisp->gimage, global_menu_factory, + gdisp->shell); } void -file_save_template_cmd_callback (GtkWidget *widget, +file_save_template_cmd_callback (GtkAction *action, gpointer data) { GimpDisplay *gdisp; @@ -282,7 +296,7 @@ file_save_template_cmd_callback (GtkWidget *widget, } void -file_revert_cmd_callback (GtkWidget *widget, +file_revert_cmd_callback (GtkAction *action, gpointer data) { GimpDisplay *gdisp; @@ -342,7 +356,7 @@ file_revert_cmd_callback (GtkWidget *widget, } void -file_close_cmd_callback (GtkWidget *widget, +file_close_cmd_callback (GtkAction *action, gpointer data) { GimpDisplay *gdisp; @@ -352,7 +366,7 @@ file_close_cmd_callback (GtkWidget *widget, } void -file_quit_cmd_callback (GtkWidget *widget, +file_quit_cmd_callback (GtkAction *action, gpointer data) { Gimp *gimp; @@ -400,9 +414,7 @@ file_revert_confirm_callback (GtkWidget *widget, gboolean revert, gpointer data) { - GimpImage *old_gimage; - - old_gimage = (GimpImage *) data; + GimpImage *old_gimage = GIMP_IMAGE (data); g_object_set_data (G_OBJECT (old_gimage), REVERT_DATA_KEY, NULL); diff --git a/app/actions/file-commands.h b/app/actions/file-commands.h index 0eda874a17..ddef0c5392 100644 --- a/app/actions/file-commands.h +++ b/app/actions/file-commands.h @@ -20,34 +20,32 @@ #define __FILE_COMMANDS_H__ -void file_new_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); - -void file_type_cmd_callback (GtkWidget *widget, +void file_new_cmd_callback (GtkAction *action, gpointer data); -void file_open_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); -void file_last_opened_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); - -void file_save_cmd_callback (GtkWidget *widget, - gpointer data); -void file_save_as_cmd_callback (GtkWidget *widget, - gpointer data); -void file_save_a_copy_cmd_callback (GtkWidget *widget, - gpointer data); -void file_save_template_cmd_callback (GtkWidget *widget, +void file_type_cmd_callback (GtkAction *action, gpointer data); -void file_revert_cmd_callback (GtkWidget *widget, +void file_open_cmd_callback (GtkAction *action, gpointer data); -void file_close_cmd_callback (GtkWidget *widget, +void file_last_opened_cmd_callback (GtkAction *action, + gint value, gpointer data); -void file_quit_cmd_callback (GtkWidget *widget, + +void file_save_cmd_callback (GtkAction *action, + gpointer data); +void file_save_as_cmd_callback (GtkAction *action, + gpointer data); +void file_save_a_copy_cmd_callback (GtkAction *action, + gpointer data); +void file_save_template_cmd_callback (GtkAction *action, + gpointer data); + +void file_revert_cmd_callback (GtkAction *action, + gpointer data); +void file_close_cmd_callback (GtkAction *action, + gpointer data); +void file_quit_cmd_callback (GtkAction *action, gpointer data); void file_file_open_dialog (Gimp *gimp, diff --git a/app/actions/fonts-commands.c b/app/actions/fonts-commands.c index 2671f8e999..8af156ce7d 100644 --- a/app/actions/fonts-commands.c +++ b/app/actions/fonts-commands.c @@ -32,7 +32,7 @@ /* public functionss */ void -fonts_refresh_cmd_callback (GtkWidget *widget, +fonts_refresh_cmd_callback (GtkAction *action, gpointer data) { GimpFontView *view = GIMP_FONT_VIEW (data); diff --git a/app/actions/fonts-commands.h b/app/actions/fonts-commands.h index 07a32c7513..86f8e4f8be 100644 --- a/app/actions/fonts-commands.h +++ b/app/actions/fonts-commands.h @@ -20,7 +20,7 @@ #define __FONTS_COMMANDS_H__ -void fonts_refresh_cmd_callback (GtkWidget *widget, +void fonts_refresh_cmd_callback (GtkAction *action, gpointer data); diff --git a/app/actions/gradient-editor-actions.c b/app/actions/gradient-editor-actions.c index 8128a7047b..4f733e687f 100644 --- a/app/actions/gradient-editor-actions.c +++ b/app/actions/gradient-editor-actions.c @@ -44,34 +44,23 @@ static GimpActionEntry gradient_editor_actions[] = { { "gradient-editor-popup", GIMP_STOCK_GRADIENT, N_("Gradient Editor Menu") }, + { "gradient-editor-load-left-color", NULL, N_("_Load Left Color From") }, + { "gradient-editor-save-left-color", NULL, N_("_Save Left Color To") }, + { "gradient-editor-load-right-color", NULL, N_("Load Right Color Fr_om") }, + { "gradient-editor-save-right-color", NULL, N_("Sa_ve Right Color To") }, + { "gradient-editor-blending-func", NULL, "blending-function" }, + { "gradient-editor-coloring-type", NULL, "coloring-type" }, + { "gradient-editor-left-color", NULL, N_("L_eft Endpoint's Color..."), NULL, NULL, G_CALLBACK (gradient_editor_left_color_cmd_callback), GIMP_HELP_GRADIENT_EDITOR_LEFT_COLOR }, - { "gradient-editor-load-left-color", NULL, - N_("_Load Left Color From") }, - - { "gradient-editor-save-left-color", NULL, - N_("/_Save Left Color To") }, - { "gradient-editor-right-color", NULL, N_("R_ight Endpoint's Color..."), NULL, NULL, G_CALLBACK (gradient_editor_right_color_cmd_callback), GIMP_HELP_GRADIENT_EDITOR_RIGHT_COLOR }, - { "gradient-editor-load-right-color", NULL, - N_("Load Right Color Fr_om") }, - - { "gradient-editor-save-right-color", NULL, - N_("Sa_ve Right Color To") }, - - { "gradient-editor-blending-func", NULL, - "blending-function" }, - - { "gradient-editor-coloring-type", NULL, - "coloring-type" }, - { "gradient-editor-flip", NULL, "flip", "F", NULL, G_CALLBACK (gradient_editor_flip_cmd_callback), @@ -489,7 +478,8 @@ gradient_editor_actions_update (GimpActionGroup *group, _("_Delete Segment")); SET_LABEL ("gradient-editor-recenter", _("Re-_center Segment's Midpoint")); - SET_LABEL ("/redistribute", _("Re-distribute _Handles in Segment")); + SET_LABEL ("gradient-editor-redistribute", + _("Re-distribute _Handles in Segment")); } else { diff --git a/app/actions/gradient-editor-commands.c b/app/actions/gradient-editor-commands.c index a329c4d50c..5e48c9f762 100644 --- a/app/actions/gradient-editor-commands.c +++ b/app/actions/gradient-editor-commands.c @@ -68,7 +68,7 @@ static void gradient_editor_replicate_response (GtkWidget *widge /* public functionss */ void -gradient_editor_left_color_cmd_callback (GtkWidget *widget, +gradient_editor_left_color_cmd_callback (GtkAction *action, gpointer data) { GimpGradientEditor *editor; @@ -97,26 +97,21 @@ gradient_editor_left_color_cmd_callback (GtkWidget *widget, } void -gradient_editor_load_left_cmd_callback (GtkWidget *widget, - gpointer data, - guint action) +gradient_editor_load_left_cmd_callback (GtkAction *action, + gint value, + gpointer data) { - GimpGradientEditor *editor; + GimpGradientEditor *editor = GIMP_GRADIENT_EDITOR (data); GimpGradient *gradient; GimpContext *user_context; GimpGradientSegment *seg; GimpRGB color; - gint i; - - editor = GIMP_GRADIENT_EDITOR (data); gradient = GIMP_GRADIENT (GIMP_DATA_EDITOR (editor)->data); user_context = gimp_get_user_context (GIMP_DATA_EDITOR (editor)->data_factory->gimp); - i = (gint) action; - - switch (i) + switch (value) { case 0: /* Fetch from left neighbor's right endpoint */ if (editor->control_sel_l->prev != NULL) @@ -162,7 +157,7 @@ gradient_editor_load_left_cmd_callback (GtkWidget *widget, default: /* Load a color */ gimp_gradient_segments_blend_endpoints (editor->control_sel_l, editor->control_sel_r, - &editor->saved_colors[i - 4], + &editor->saved_colors[value - 4], &editor->control_sel_r->right_color, TRUE, TRUE); break; @@ -172,26 +167,22 @@ gradient_editor_load_left_cmd_callback (GtkWidget *widget, } void -gradient_editor_save_left_cmd_callback (GtkWidget *widget, - gpointer data, - guint action) +gradient_editor_save_left_cmd_callback (GtkAction *action, + gint value, + gpointer data) { - GimpGradientEditor *editor; + GimpGradientEditor *editor = GIMP_GRADIENT_EDITOR (data); - editor = GIMP_GRADIENT_EDITOR (data); - - editor->saved_colors[action] = editor->control_sel_l->left_color; + editor->saved_colors[value] = editor->control_sel_l->left_color; } void -gradient_editor_right_color_cmd_callback (GtkWidget *widget, +gradient_editor_right_color_cmd_callback (GtkAction *action, gpointer data) { - GimpGradientEditor *editor; + GimpGradientEditor *editor = GIMP_GRADIENT_EDITOR (data); GimpGradient *gradient; - editor = GIMP_GRADIENT_EDITOR (data); - gradient = GIMP_GRADIENT (GIMP_DATA_EDITOR (editor)->data); editor->right_saved_dirty = GIMP_DATA (gradient)->dirty; @@ -213,26 +204,21 @@ gradient_editor_right_color_cmd_callback (GtkWidget *widget, } void -gradient_editor_load_right_cmd_callback (GtkWidget *widget, - gpointer data, - guint action) +gradient_editor_load_right_cmd_callback (GtkAction *action, + gint value, + gpointer data) { - GimpGradientEditor *editor; + GimpGradientEditor *editor = GIMP_GRADIENT_EDITOR (data); GimpGradient *gradient; GimpContext *user_context; GimpGradientSegment *seg; GimpRGB color; - gint i; - - editor = GIMP_GRADIENT_EDITOR (data); gradient = GIMP_GRADIENT (GIMP_DATA_EDITOR (editor)->data); user_context = gimp_get_user_context (GIMP_DATA_EDITOR (editor)->data_factory->gimp); - i = (gint) action; - - switch (i) + switch (value) { case 0: /* Fetch from right neighbor's left endpoint */ if (editor->control_sel_r->next != NULL) @@ -279,7 +265,7 @@ gradient_editor_load_right_cmd_callback (GtkWidget *widget, gimp_gradient_segments_blend_endpoints (editor->control_sel_l, editor->control_sel_r, &editor->control_sel_l->left_color, - &editor->saved_colors[i - 4], + &editor->saved_colors[value - 4], TRUE, TRUE); break; } @@ -288,35 +274,29 @@ gradient_editor_load_right_cmd_callback (GtkWidget *widget, } void -gradient_editor_save_right_cmd_callback (GtkWidget *widget, - gpointer data, - guint action) +gradient_editor_save_right_cmd_callback (GtkAction *action, + gint value, + gpointer data) { - GimpGradientEditor *editor; + GimpGradientEditor *editor = GIMP_GRADIENT_EDITOR (data); - editor = GIMP_GRADIENT_EDITOR (data); - - editor->saved_colors[action] = editor->control_sel_l->left_color; + editor->saved_colors[value] = editor->control_sel_l->left_color; } void -gradient_editor_blending_func_cmd_callback (GtkWidget *widget, - gpointer data, - guint action) +gradient_editor_blending_func_cmd_callback (GtkAction *action, + GtkAction *current, + gpointer data) { - GimpGradientEditor *editor; + GimpGradientEditor *editor = GIMP_GRADIENT_EDITOR (data); GimpGradient *gradient; GimpGradientSegmentType type; GimpGradientSegment *seg, *aseg; - if (! GTK_CHECK_MENU_ITEM (widget)->active) - return; - - editor = GIMP_GRADIENT_EDITOR (data); - gradient = GIMP_GRADIENT (GIMP_DATA_EDITOR (editor)->data); - type = (GimpGradientSegmentType) action; + type = (GimpGradientSegmentType) + gtk_radio_action_get_current_value (GTK_RADIO_ACTION (action)); seg = editor->control_sel_l; @@ -333,23 +313,19 @@ gradient_editor_blending_func_cmd_callback (GtkWidget *widget, } void -gradient_editor_coloring_type_cmd_callback (GtkWidget *widget, - gpointer data, - guint action) +gradient_editor_coloring_type_cmd_callback (GtkAction *action, + GtkAction *current, + gpointer data) { - GimpGradientEditor *editor; + GimpGradientEditor *editor = GIMP_GRADIENT_EDITOR (data); GimpGradient *gradient; GimpGradientSegmentColor color; GimpGradientSegment *seg, *aseg; - if (! GTK_CHECK_MENU_ITEM (widget)->active) - return; - - editor = GIMP_GRADIENT_EDITOR (data); - gradient = GIMP_GRADIENT (GIMP_DATA_EDITOR (editor)->data); - color = (GimpGradientSegmentColor) action; + color = (GimpGradientSegmentColor) + gtk_radio_action_get_current_value (GTK_RADIO_ACTION (action)); seg = editor->control_sel_l; @@ -366,18 +342,16 @@ gradient_editor_coloring_type_cmd_callback (GtkWidget *widget, } void -gradient_editor_flip_cmd_callback (GtkWidget *widget, +gradient_editor_flip_cmd_callback (GtkAction *action, gpointer data) { - GimpGradientEditor *editor; + GimpGradientEditor *editor = GIMP_GRADIENT_EDITOR (data); GimpGradient *gradient; GimpGradientSegment *oseg, *oaseg; GimpGradientSegment *seg, *prev, *tmp; GimpGradientSegment *lseg, *rseg; gdouble left, right; - editor = GIMP_GRADIENT_EDITOR (data); - gradient = GIMP_GRADIENT (GIMP_DATA_EDITOR (editor)->data); left = editor->control_sel_l->left; @@ -492,10 +466,10 @@ gradient_editor_flip_cmd_callback (GtkWidget *widget, } void -gradient_editor_replicate_cmd_callback (GtkWidget *widget, +gradient_editor_replicate_cmd_callback (GtkAction *action, gpointer data) { - GimpGradientEditor *editor; + GimpGradientEditor *editor = GIMP_GRADIENT_EDITOR (data); GtkWidget *dialog; GtkWidget *vbox; GtkWidget *label; @@ -504,8 +478,6 @@ gradient_editor_replicate_cmd_callback (GtkWidget *widget, const gchar *title; const gchar *desc; - editor = GIMP_GRADIENT_EDITOR (data); - if (editor->control_sel_l == editor->control_sel_r) { title = _("Replicate Segment"); @@ -569,15 +541,13 @@ gradient_editor_replicate_cmd_callback (GtkWidget *widget, } void -gradient_editor_split_midpoint_cmd_callback (GtkWidget *widget, +gradient_editor_split_midpoint_cmd_callback (GtkAction *action, gpointer data) { - GimpGradientEditor *editor; + GimpGradientEditor *editor = GIMP_GRADIENT_EDITOR (data); GimpGradient *gradient; GimpGradientSegment *seg, *lseg, *rseg; - editor = GIMP_GRADIENT_EDITOR (data); - gradient = GIMP_GRADIENT (GIMP_DATA_EDITOR (editor)->data); seg = editor->control_sel_l; @@ -596,10 +566,10 @@ gradient_editor_split_midpoint_cmd_callback (GtkWidget *widget, } void -gradient_editor_split_uniformly_cmd_callback (GtkWidget *widget, +gradient_editor_split_uniformly_cmd_callback (GtkAction *action, gpointer data) { - GimpGradientEditor *editor; + GimpGradientEditor *editor = GIMP_GRADIENT_EDITOR (data); GtkWidget *dialog; GtkWidget *vbox; GtkWidget *label; @@ -608,8 +578,6 @@ gradient_editor_split_uniformly_cmd_callback (GtkWidget *widget, const gchar *title; const gchar *desc; - editor = GIMP_GRADIENT_EDITOR (data); - if (editor->control_sel_l == editor->control_sel_r) { title = _("Split Segment Uniformly"); @@ -675,16 +643,14 @@ gradient_editor_split_uniformly_cmd_callback (GtkWidget *widget, } void -gradient_editor_delete_cmd_callback (GtkWidget *widget, +gradient_editor_delete_cmd_callback (GtkAction *action, gpointer data) { - GimpGradientEditor *editor; + GimpGradientEditor *editor = GIMP_GRADIENT_EDITOR (data); GimpGradient *gradient; GimpGradientSegment *lseg, *rseg, *seg, *aseg, *next; gdouble join; - editor = GIMP_GRADIENT_EDITOR (data); - gradient = GIMP_GRADIENT (GIMP_DATA_EDITOR (editor)->data); /* Remember segments to the left and to the right of the selection */ @@ -761,15 +727,13 @@ gradient_editor_delete_cmd_callback (GtkWidget *widget, } void -gradient_editor_recenter_cmd_callback (GtkWidget *widget, +gradient_editor_recenter_cmd_callback (GtkAction *action, gpointer data) { - GimpGradientEditor *editor; + GimpGradientEditor *editor = GIMP_GRADIENT_EDITOR (data); GimpGradient *gradient; GimpGradientSegment *seg, *aseg; - editor = GIMP_GRADIENT_EDITOR (data); - gradient = GIMP_GRADIENT (GIMP_DATA_EDITOR (editor)->data); seg = editor->control_sel_l; @@ -788,18 +752,16 @@ gradient_editor_recenter_cmd_callback (GtkWidget *widget, } void -gradient_editor_redistribute_cmd_callback (GtkWidget *widget, +gradient_editor_redistribute_cmd_callback (GtkAction *action, gpointer data) { - GimpGradientEditor *editor; + GimpGradientEditor *editor = GIMP_GRADIENT_EDITOR (data); GimpGradient *gradient; GimpGradientSegment *seg, *aseg; gdouble left, right, seg_len; gint num_segs; gint i; - editor = GIMP_GRADIENT_EDITOR (data); - gradient = GIMP_GRADIENT (GIMP_DATA_EDITOR (editor)->data); /* Count number of segments in selection */ @@ -846,12 +808,10 @@ gradient_editor_redistribute_cmd_callback (GtkWidget *widget, } void -gradient_editor_blend_color_cmd_callback (GtkWidget *widget, +gradient_editor_blend_color_cmd_callback (GtkAction *action, gpointer data) { - GimpGradientEditor *editor; - - editor = GIMP_GRADIENT_EDITOR (data); + GimpGradientEditor *editor = GIMP_GRADIENT_EDITOR (data); gimp_gradient_segments_blend_endpoints (editor->control_sel_l, editor->control_sel_r, @@ -863,12 +823,10 @@ gradient_editor_blend_color_cmd_callback (GtkWidget *widget, } void -gradient_editor_blend_opacity_cmd_callback (GtkWidget *widget, +gradient_editor_blend_opacity_cmd_callback (GtkAction *action, gpointer data) { - GimpGradientEditor *editor; - - editor = GIMP_GRADIENT_EDITOR (data); + GimpGradientEditor *editor = GIMP_GRADIENT_EDITOR (data); gimp_gradient_segments_blend_endpoints (editor->control_sel_l, editor->control_sel_r, diff --git a/app/actions/gradient-editor-commands.h b/app/actions/gradient-editor-commands.h index fc4ca29fd4..1602876ba9 100644 --- a/app/actions/gradient-editor-commands.h +++ b/app/actions/gradient-editor-commands.h @@ -20,49 +20,49 @@ #define __GRADIENT_EDITOR_COMMANDS_H__ -void gradient_editor_left_color_cmd_callback (GtkWidget *widget, +void gradient_editor_left_color_cmd_callback (GtkAction *action, gpointer data); -void gradient_editor_load_left_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); -void gradient_editor_save_left_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); - -void gradient_editor_right_color_cmd_callback (GtkWidget *widget, +void gradient_editor_load_left_cmd_callback (GtkAction *action, + gint value, gpointer data); -void gradient_editor_load_right_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); -void gradient_editor_save_right_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); - -void gradient_editor_blending_func_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); -void gradient_editor_coloring_type_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); - -void gradient_editor_flip_cmd_callback (GtkWidget *widget, - gpointer data); -void gradient_editor_replicate_cmd_callback (GtkWidget *widget, - gpointer data); -void gradient_editor_split_midpoint_cmd_callback (GtkWidget *widget, - gpointer data); -void gradient_editor_split_uniformly_cmd_callback (GtkWidget *widget, - gpointer data); -void gradient_editor_delete_cmd_callback (GtkWidget *widget, - gpointer data); -void gradient_editor_recenter_cmd_callback (GtkWidget *widget, - gpointer data); -void gradient_editor_redistribute_cmd_callback (GtkWidget *widget, +void gradient_editor_save_left_cmd_callback (GtkAction *action, + gint value, gpointer data); -void gradient_editor_blend_color_cmd_callback (GtkWidget *widget, +void gradient_editor_right_color_cmd_callback (GtkAction *action, gpointer data); -void gradient_editor_blend_opacity_cmd_callback (GtkWidget *widget, +void gradient_editor_load_right_cmd_callback (GtkAction *action, + gint value, + gpointer data); +void gradient_editor_save_right_cmd_callback (GtkAction *action, + gint value, + gpointer data); + +void gradient_editor_blending_func_cmd_callback (GtkAction *action, + GtkAction *current, + gpointer data); +void gradient_editor_coloring_type_cmd_callback (GtkAction *action, + GtkAction *current, + gpointer data); + +void gradient_editor_flip_cmd_callback (GtkAction *action, + gpointer data); +void gradient_editor_replicate_cmd_callback (GtkAction *action, + gpointer data); +void gradient_editor_split_midpoint_cmd_callback (GtkAction *action, + gpointer data); +void gradient_editor_split_uniformly_cmd_callback (GtkAction *action, + gpointer data); +void gradient_editor_delete_cmd_callback (GtkAction *action, + gpointer data); +void gradient_editor_recenter_cmd_callback (GtkAction *action, + gpointer data); +void gradient_editor_redistribute_cmd_callback (GtkAction *action, + gpointer data); + +void gradient_editor_blend_color_cmd_callback (GtkAction *action, + gpointer data); +void gradient_editor_blend_opacity_cmd_callback (GtkAction *action, gpointer data); diff --git a/app/actions/gradients-commands.c b/app/actions/gradients-commands.c index 0fc2040b7a..e0468d2ea9 100644 --- a/app/actions/gradients-commands.c +++ b/app/actions/gradients-commands.c @@ -47,7 +47,7 @@ static void gradients_save_as_pov_response (GtkWidget *dialog, /* public functions */ void -gradients_save_as_pov_ray_cmd_callback (GtkWidget *widget, +gradients_save_as_pov_ray_cmd_callback (GtkAction *action, gpointer data) { GimpContainerEditor *editor = GIMP_CONTAINER_EDITOR (data); diff --git a/app/actions/gradients-commands.h b/app/actions/gradients-commands.h index 14533e7a60..95aff6cf60 100644 --- a/app/actions/gradients-commands.h +++ b/app/actions/gradients-commands.h @@ -20,7 +20,7 @@ #define __GRADIENTS_COMMANDS_H__ -void gradients_save_as_pov_ray_cmd_callback (GtkWidget *widget, +void gradients_save_as_pov_ray_cmd_callback (GtkAction *action, gpointer data); diff --git a/app/actions/help-actions.c b/app/actions/help-actions.c index 942edd809b..e2a68cb237 100644 --- a/app/actions/help-actions.c +++ b/app/actions/help-actions.c @@ -35,8 +35,7 @@ static GimpActionEntry help_actions[] = { - { "help-menu", NULL, - N_("/_Help") }, + { "help-menu", NULL, N_("_Help") }, { "help-help", GTK_STOCK_HELP, N_("_Help"), "F1", NULL, diff --git a/app/actions/help-commands.c b/app/actions/help-commands.c index b13d892974..b53316b8cb 100644 --- a/app/actions/help-commands.c +++ b/app/actions/help-commands.c @@ -24,19 +24,37 @@ #include "actions-types.h" +#include "core/gimp.h" + +#include "widgets/gimpdock.h" + +#include "display/gimpdisplay.h" + +#include "gui/dialogs.h" + #include "help-commands.h" void -help_help_cmd_callback (GtkWidget *widget, +help_help_cmd_callback (GtkAction *action, gpointer data) { gimp_standard_help_func (NULL, NULL); } void -help_context_help_cmd_callback (GtkWidget *widget, +help_context_help_cmd_callback (GtkAction *action, gpointer data) { - gimp_context_help (widget); + GtkWidget *widget = NULL; + + if (GIMP_IS_GIMP (data)) + widget = dialogs_get_toolbox (); + else if (GIMP_IS_DISPLAY (data)) + widget = GIMP_DISPLAY (data)->shell; + else if (GIMP_IS_DOCK (data)) + widget = data; + + if (widget) + gimp_context_help (widget); } diff --git a/app/actions/help-commands.h b/app/actions/help-commands.h index 665978e730..85d18e57eb 100644 --- a/app/actions/help-commands.h +++ b/app/actions/help-commands.h @@ -20,9 +20,9 @@ #define __HELP_COMMANDS_H__ -void help_help_cmd_callback (GtkWidget *widget, +void help_help_cmd_callback (GtkAction *action, gpointer data); -void help_context_help_cmd_callback (GtkWidget *widget, +void help_context_help_cmd_callback (GtkAction *action, gpointer data); diff --git a/app/actions/image-commands.c b/app/actions/image-commands.c index ce40e512bf..975b2c9410 100644 --- a/app/actions/image-commands.c +++ b/app/actions/image-commands.c @@ -110,7 +110,7 @@ static void image_scale_implement (ImageResize *image_scale); /* public functions */ void -image_convert_rgb_cmd_callback (GtkWidget *widget, +image_convert_rgb_cmd_callback (GtkAction *action, gpointer data) { GimpImage *gimage; @@ -121,7 +121,7 @@ image_convert_rgb_cmd_callback (GtkWidget *widget, } void -image_convert_grayscale_cmd_callback (GtkWidget *widget, +image_convert_grayscale_cmd_callback (GtkAction *action, gpointer data) { GimpImage *gimage; @@ -132,19 +132,19 @@ image_convert_grayscale_cmd_callback (GtkWidget *widget, } void -image_convert_indexed_cmd_callback (GtkWidget *widget, +image_convert_indexed_cmd_callback (GtkAction *action, gpointer data) { - GimpImage *gimage; - GtkWidget *dialog; - return_if_no_image (gimage, data); + GimpDisplay *gdisp; + GtkWidget *dialog; + return_if_no_display (gdisp, data); - dialog = convert_dialog_new (gimage, widget); + dialog = convert_dialog_new (gdisp->gimage, gdisp->shell); gtk_widget_show (dialog); } void -image_resize_cmd_callback (GtkWidget *widget, +image_resize_cmd_callback (GtkAction *action, gpointer data) { GimpDisplay *gdisp; @@ -184,7 +184,7 @@ image_resize_cmd_callback (GtkWidget *widget, } void -image_scale_cmd_callback (GtkWidget *widget, +image_scale_cmd_callback (GtkAction *action, gpointer data) { GimpDisplay *gdisp; @@ -224,9 +224,9 @@ image_scale_cmd_callback (GtkWidget *widget, } void -image_flip_cmd_callback (GtkWidget *widget, - gpointer data, - guint action) +image_flip_cmd_callback (GtkAction *action, + gint value, + gpointer data) { GimpDisplay *gdisp; GimpProgress *progress; @@ -235,7 +235,7 @@ image_flip_cmd_callback (GtkWidget *widget, progress = gimp_progress_start (gdisp, _("Flipping..."), TRUE, NULL, NULL); gimp_image_flip (gdisp->gimage, gimp_get_user_context (gdisp->gimage->gimp), - (GimpOrientationType) action, + (GimpOrientationType) value, gimp_progress_update_and_flush, progress); gimp_progress_end (progress); @@ -244,9 +244,9 @@ image_flip_cmd_callback (GtkWidget *widget, } void -image_rotate_cmd_callback (GtkWidget *widget, - gpointer data, - guint action) +image_rotate_cmd_callback (GtkAction *action, + gint value, + gpointer data) { GimpDisplay *gdisp; GimpProgress *progress; @@ -255,7 +255,7 @@ image_rotate_cmd_callback (GtkWidget *widget, progress = gimp_progress_start (gdisp, _("Rotating..."), TRUE, NULL, NULL); gimp_image_rotate (gdisp->gimage, gimp_get_user_context (gdisp->gimage->gimp), - (GimpRotationType) action, + (GimpRotationType) value, gimp_progress_update_and_flush, progress); gimp_progress_end (progress); @@ -264,7 +264,7 @@ image_rotate_cmd_callback (GtkWidget *widget, } void -image_crop_cmd_callback (GtkWidget *widget, +image_crop_cmd_callback (GtkAction *action, gpointer data) { GimpDisplay *gdisp; @@ -284,7 +284,7 @@ image_crop_cmd_callback (GtkWidget *widget, } void -image_duplicate_cmd_callback (GtkWidget *widget, +image_duplicate_cmd_callback (GtkAction *action, gpointer data) { GimpImage *gimage; @@ -299,17 +299,17 @@ image_duplicate_cmd_callback (GtkWidget *widget, } void -image_merge_layers_cmd_callback (GtkWidget *widget, +image_merge_layers_cmd_callback (GtkAction *action, gpointer data) { - GimpImage *gimage; - return_if_no_image (gimage, data); + GimpDisplay *gdisp; + return_if_no_display (gdisp, data); - image_layers_merge_query (gimage, TRUE, widget); + image_layers_merge_query (gdisp->gimage, TRUE, gdisp->shell); } void -image_flatten_image_cmd_callback (GtkWidget *widget, +image_flatten_image_cmd_callback (GtkAction *action, gpointer data) { GimpImage *gimage; @@ -320,7 +320,7 @@ image_flatten_image_cmd_callback (GtkWidget *widget, } void -image_configure_grid_cmd_callback (GtkWidget *widget, +image_configure_grid_cmd_callback (GtkAction *action, gpointer data) { GimpDisplay *gdisp; @@ -329,14 +329,14 @@ image_configure_grid_cmd_callback (GtkWidget *widget, return_if_no_display (gdisp, data); shell = GIMP_DISPLAY_SHELL (gdisp->shell); - gimage = GIMP_IMAGE (gdisp->gimage); + gimage = gdisp->gimage; if (! shell->grid_dialog) { - shell->grid_dialog = grid_dialog_new (GIMP_IMAGE (gimage), widget); + shell->grid_dialog = grid_dialog_new (gdisp->gimage, gdisp->shell); gtk_window_set_transient_for (GTK_WINDOW (shell->grid_dialog), - GTK_WINDOW (shell)); + GTK_WINDOW (gdisp->shell)); gtk_window_set_destroy_with_parent (GTK_WINDOW (shell->grid_dialog), TRUE); diff --git a/app/actions/image-commands.h b/app/actions/image-commands.h index d372c8102c..c98c820ffe 100644 --- a/app/actions/image-commands.h +++ b/app/actions/image-commands.h @@ -20,39 +20,39 @@ #define __IMAGE_COMMANDS_H__ -void image_convert_rgb_cmd_callback (GtkWidget *widget, +void image_convert_rgb_cmd_callback (GtkAction *action, gpointer data); -void image_convert_grayscale_cmd_callback (GtkWidget *widget, +void image_convert_grayscale_cmd_callback (GtkAction *action, gpointer data); -void image_convert_indexed_cmd_callback (GtkWidget *widget, +void image_convert_indexed_cmd_callback (GtkAction *action, gpointer data); -void image_resize_cmd_callback (GtkWidget *widget, +void image_resize_cmd_callback (GtkAction *action, gpointer data); -void image_scale_cmd_callback (GtkWidget *widget, +void image_scale_cmd_callback (GtkAction *action, gpointer data); -void image_flip_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); -void image_rotate_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); -void image_crop_cmd_callback (GtkWidget *widget, - gpointer data); - -void image_duplicate_cmd_callback (GtkWidget *widget, - gpointer data); - -void image_merge_layers_cmd_callback (GtkWidget *widet, +void image_flip_cmd_callback (GtkAction *action, + gint value, gpointer data); -void image_flatten_image_cmd_callback (GtkWidget *widet, +void image_rotate_cmd_callback (GtkAction *action, + gint value, + gpointer data); +void image_crop_cmd_callback (GtkAction *action, + gpointer data); + +void image_duplicate_cmd_callback (GtkAction *action, + gpointer data); + +void image_merge_layers_cmd_callback (GtkAction *action, + gpointer data); +void image_flatten_image_cmd_callback (GtkAction *action, gpointer data); void image_layers_merge_query (GimpImage *gimage, gboolean merge_visible, GtkWidget *parent); -void image_configure_grid_cmd_callback (GtkWidget *widget, +void image_configure_grid_cmd_callback (GtkAction *action, gpointer data); #endif /* __IMAGE_COMMANDS_H__ */ diff --git a/app/actions/images-commands.c b/app/actions/images-commands.c index 473c2ecbe9..9f9919cb22 100644 --- a/app/actions/images-commands.c +++ b/app/actions/images-commands.c @@ -36,7 +36,7 @@ /* public functionss */ void -images_raise_views_cmd_callback (GtkWidget *widget, +images_raise_views_cmd_callback (GtkAction *action, gpointer data) { GimpImageView *view = GIMP_IMAGE_VIEW (data); @@ -46,7 +46,7 @@ images_raise_views_cmd_callback (GtkWidget *widget, } void -images_new_view_cmd_callback (GtkWidget *widget, +images_new_view_cmd_callback (GtkAction *action, gpointer data) { GimpImageView *view = GIMP_IMAGE_VIEW (data); @@ -56,7 +56,7 @@ images_new_view_cmd_callback (GtkWidget *widget, } void -images_delete_image_cmd_callback (GtkWidget *widget, +images_delete_image_cmd_callback (GtkAction *action, gpointer data) { GimpImageView *view = GIMP_IMAGE_VIEW (data); diff --git a/app/actions/images-commands.h b/app/actions/images-commands.h index 23068e4785..478dcbaf8a 100644 --- a/app/actions/images-commands.h +++ b/app/actions/images-commands.h @@ -20,11 +20,11 @@ #define __IMAGES_COMMANDS_H__ -void images_raise_views_cmd_callback (GtkWidget *widget, +void images_raise_views_cmd_callback (GtkAction *action, gpointer data); -void images_new_view_cmd_callback (GtkWidget *widget, +void images_new_view_cmd_callback (GtkAction *action, gpointer data); -void images_delete_image_cmd_callback (GtkWidget *widget, +void images_delete_image_cmd_callback (GtkAction *action, gpointer data); void images_raise_views (GimpImage *gimage); diff --git a/app/actions/layers-commands.c b/app/actions/layers-commands.c index e805a32bbb..07774e8eb0 100644 --- a/app/actions/layers-commands.c +++ b/app/actions/layers-commands.c @@ -58,6 +58,7 @@ #include "tools/gimptexttool.h" #include "tools/tool_manager.h" +#include "gui/dialogs.h" #include "gui/resize-dialog.h" #include "layers-commands.h" @@ -99,11 +100,25 @@ static void layers_resize_layer_query (GimpImage *gimage, if (! layer) \ return +#define return_if_no_widget(widget,data) \ + if (GIMP_IS_DISPLAY (data)) \ + widget = ((GimpDisplay *) data)->shell; \ + else if (GIMP_IS_GIMP (data)) \ + widget = dialogs_get_toolbox (); \ + else if (GIMP_IS_DOCK (data)) \ + widget = data; \ + else if (GIMP_IS_ITEM_TREE_VIEW (data)) \ + widget = data; \ + else \ + widget = NULL; \ + if (! widget) \ + return + /* public functions */ void -layers_select_previous_cmd_callback (GtkWidget *widget, +layers_select_previous_cmd_callback (GtkAction *action, gpointer data) { GimpImage *gimage; @@ -128,7 +143,7 @@ layers_select_previous_cmd_callback (GtkWidget *widget, } void -layers_select_next_cmd_callback (GtkWidget *widget, +layers_select_next_cmd_callback (GtkAction *action, gpointer data) { GimpImage *gimage; @@ -151,7 +166,7 @@ layers_select_next_cmd_callback (GtkWidget *widget, } void -layers_select_top_cmd_callback (GtkWidget *widget, +layers_select_top_cmd_callback (GtkAction *action, gpointer data) { GimpImage *gimage; @@ -169,7 +184,7 @@ layers_select_top_cmd_callback (GtkWidget *widget, } void -layers_select_bottom_cmd_callback (GtkWidget *widget, +layers_select_bottom_cmd_callback (GtkAction *action, gpointer data) { GimpImage *gimage; @@ -193,7 +208,7 @@ layers_select_bottom_cmd_callback (GtkWidget *widget, } void -layers_raise_cmd_callback (GtkWidget *widget, +layers_raise_cmd_callback (GtkAction *action, gpointer data) { GimpImage *gimage; @@ -205,7 +220,7 @@ layers_raise_cmd_callback (GtkWidget *widget, } void -layers_lower_cmd_callback (GtkWidget *widget, +layers_lower_cmd_callback (GtkAction *action, gpointer data) { GimpImage *gimage; @@ -217,7 +232,7 @@ layers_lower_cmd_callback (GtkWidget *widget, } void -layers_raise_to_top_cmd_callback (GtkWidget *widget, +layers_raise_to_top_cmd_callback (GtkAction *action, gpointer data) { GimpImage *gimage; @@ -229,7 +244,7 @@ layers_raise_to_top_cmd_callback (GtkWidget *widget, } void -layers_lower_to_bottom_cmd_callback (GtkWidget *widget, +layers_lower_to_bottom_cmd_callback (GtkAction *action, gpointer data) { GimpImage *gimage; @@ -241,17 +256,19 @@ layers_lower_to_bottom_cmd_callback (GtkWidget *widget, } void -layers_new_cmd_callback (GtkWidget *widget, +layers_new_cmd_callback (GtkAction *action, gpointer data) { GimpImage *gimage; + GtkWidget *widget; return_if_no_image (gimage, data); + return_if_no_widget (widget, data); layers_new_layer_query (gimage, NULL, TRUE, widget); } void -layers_duplicate_cmd_callback (GtkWidget *widget, +layers_duplicate_cmd_callback (GtkAction *action, gpointer data) { GimpImage *gimage; @@ -269,7 +286,7 @@ layers_duplicate_cmd_callback (GtkWidget *widget, } void -layers_anchor_cmd_callback (GtkWidget *widget, +layers_anchor_cmd_callback (GtkAction *action, gpointer data) { GimpImage *gimage; @@ -284,7 +301,7 @@ layers_anchor_cmd_callback (GtkWidget *widget, } void -layers_merge_down_cmd_callback (GtkWidget *widget, +layers_merge_down_cmd_callback (GtkAction *action, gpointer data) { GimpImage *gimage; @@ -298,7 +315,7 @@ layers_merge_down_cmd_callback (GtkWidget *widget, } void -layers_delete_cmd_callback (GtkWidget *widget, +layers_delete_cmd_callback (GtkAction *action, gpointer data) { GimpImage *gimage; @@ -314,7 +331,7 @@ layers_delete_cmd_callback (GtkWidget *widget, } void -layers_text_discard_cmd_callback (GtkWidget *widet, +layers_text_discard_cmd_callback (GtkAction *action, gpointer data) { GimpImage *gimage; @@ -326,18 +343,20 @@ layers_text_discard_cmd_callback (GtkWidget *widet, } void -layers_resize_cmd_callback (GtkWidget *widget, +layers_resize_cmd_callback (GtkAction *action, gpointer data) { GimpImage *gimage; GimpLayer *active_layer; + GtkWidget *widget; return_if_no_layer (gimage, active_layer, data); + return_if_no_widget (widget, data); layers_resize_layer_query (gimage, active_layer, widget); } void -layers_resize_to_image_cmd_callback (GtkWidget *widget, +layers_resize_to_image_cmd_callback (GtkAction *action, gpointer data) { GimpImage *gimage; @@ -350,19 +369,21 @@ layers_resize_to_image_cmd_callback (GtkWidget *widget, } void -layers_scale_cmd_callback (GtkWidget *widget, +layers_scale_cmd_callback (GtkAction *action, gpointer data) { GimpImage *gimage; GimpLayer *active_layer; + GtkWidget *widget; return_if_no_layer (gimage, active_layer, data); + return_if_no_widget (widget, data); layers_scale_layer_query (GIMP_IS_DISPLAY (data) ? data : NULL, gimage, active_layer, widget); } void -layers_crop_cmd_callback (GtkWidget *widget, +layers_crop_cmd_callback (GtkAction *action, gpointer data) { GimpImage *gimage; @@ -396,18 +417,20 @@ layers_crop_cmd_callback (GtkWidget *widget, } void -layers_mask_add_cmd_callback (GtkWidget *widget, +layers_mask_add_cmd_callback (GtkAction *action, gpointer data) { GimpImage *gimage; GimpLayer *active_layer; + GtkWidget *widget; return_if_no_layer (gimage, active_layer, data); + return_if_no_widget (widget, data); layers_add_mask_query (active_layer, widget); } void -layers_mask_apply_cmd_callback (GtkWidget *widget, +layers_mask_apply_cmd_callback (GtkAction *action, gpointer data) { GimpImage *gimage; @@ -422,7 +445,7 @@ layers_mask_apply_cmd_callback (GtkWidget *widget, } void -layers_mask_delete_cmd_callback (GtkWidget *widget, +layers_mask_delete_cmd_callback (GtkAction *action, gpointer data) { GimpImage *gimage; @@ -437,9 +460,9 @@ layers_mask_delete_cmd_callback (GtkWidget *widget, } void -layers_mask_to_selection_cmd_callback (GtkWidget *widget, - gpointer data, - guint action) +layers_mask_to_selection_cmd_callback (GtkAction *action, + gint value, + gpointer data) { GimpChannelOps op; GimpImage *gimage; @@ -447,7 +470,7 @@ layers_mask_to_selection_cmd_callback (GtkWidget *widget, GimpLayerMask *mask; return_if_no_layer (gimage, active_layer, data); - op = (GimpChannelOps) action; + op = (GimpChannelOps) value; mask = gimp_layer_get_mask (active_layer); @@ -467,7 +490,7 @@ layers_mask_to_selection_cmd_callback (GtkWidget *widget, } void -layers_alpha_add_cmd_callback (GtkWidget *widget, +layers_alpha_add_cmd_callback (GtkAction *action, gpointer data) { GimpImage *gimage; @@ -482,16 +505,16 @@ layers_alpha_add_cmd_callback (GtkWidget *widget, } void -layers_alpha_to_selection_cmd_callback (GtkWidget *widget, - gpointer data, - guint action) +layers_alpha_to_selection_cmd_callback (GtkAction *action, + gint value, + gpointer data) { GimpChannelOps op; GimpImage *gimage; GimpLayer *active_layer; return_if_no_layer (gimage, active_layer, data); - op = (GimpChannelOps) action; + op = (GimpChannelOps) value; gimp_channel_select_alpha (gimp_image_get_mask (gimage), GIMP_DRAWABLE (active_layer), @@ -500,17 +523,19 @@ layers_alpha_to_selection_cmd_callback (GtkWidget *widget, } void -layers_merge_layers_cmd_callback (GtkWidget *widget, +layers_merge_layers_cmd_callback (GtkAction *action, gpointer data) { GimpImage *gimage; + GtkWidget *widget; return_if_no_image (gimage, data); + return_if_no_widget (widget, data); image_layers_merge_query (gimage, TRUE, widget); } void -layers_flatten_image_cmd_callback (GtkWidget *widget, +layers_flatten_image_cmd_callback (GtkAction *action, gpointer data) { GimpImage *gimage; @@ -521,23 +546,27 @@ layers_flatten_image_cmd_callback (GtkWidget *widget, } void -layers_text_tool_cmd_callback (GtkWidget *widget, +layers_text_tool_cmd_callback (GtkAction *action, gpointer data) { GimpImage *gimage; GimpLayer *active_layer; + GtkWidget *widget; return_if_no_layer (gimage, active_layer, data); + return_if_no_widget (widget, data); layers_text_tool (active_layer, widget); } void -layers_edit_attributes_cmd_callback (GtkWidget *widget, +layers_edit_attributes_cmd_callback (GtkAction *action, gpointer data) { GimpImage *gimage; GimpLayer *active_layer; + GtkWidget *widget; return_if_no_layer (gimage, active_layer, data); + return_if_no_widget (widget, data); layers_edit_layer_query (active_layer, widget); } diff --git a/app/actions/layers-commands.h b/app/actions/layers-commands.h index 18fe2185ef..eb51750f9c 100644 --- a/app/actions/layers-commands.h +++ b/app/actions/layers-commands.h @@ -20,70 +20,70 @@ #define __LAYERS_COMMANDS_H__ -void layers_select_previous_cmd_callback (GtkWidget *widet, +void layers_select_previous_cmd_callback (GtkAction *action, gpointer data); -void layers_select_next_cmd_callback (GtkWidget *widet, +void layers_select_next_cmd_callback (GtkAction *action, gpointer data); -void layers_select_top_cmd_callback (GtkWidget *widet, +void layers_select_top_cmd_callback (GtkAction *action, gpointer data); -void layers_select_bottom_cmd_callback (GtkWidget *widet, +void layers_select_bottom_cmd_callback (GtkAction *action, gpointer data); -void layers_raise_cmd_callback (GtkWidget *widet, +void layers_raise_cmd_callback (GtkAction *action, gpointer data); -void layers_lower_cmd_callback (GtkWidget *widet, +void layers_lower_cmd_callback (GtkAction *action, gpointer data); -void layers_raise_to_top_cmd_callback (GtkWidget *widet, +void layers_raise_to_top_cmd_callback (GtkAction *action, gpointer data); -void layers_lower_to_bottom_cmd_callback (GtkWidget *widet, +void layers_lower_to_bottom_cmd_callback (GtkAction *action, gpointer data); -void layers_new_cmd_callback (GtkWidget *widet, +void layers_new_cmd_callback (GtkAction *action, gpointer data); -void layers_duplicate_cmd_callback (GtkWidget *widet, +void layers_duplicate_cmd_callback (GtkAction *action, gpointer data); -void layers_anchor_cmd_callback (GtkWidget *widet, +void layers_anchor_cmd_callback (GtkAction *action, gpointer data); -void layers_merge_down_cmd_callback (GtkWidget *widet, +void layers_merge_down_cmd_callback (GtkAction *action, gpointer data); -void layers_delete_cmd_callback (GtkWidget *widet, +void layers_delete_cmd_callback (GtkAction *action, gpointer data); -void layers_text_discard_cmd_callback (GtkWidget *widet, +void layers_text_discard_cmd_callback (GtkAction *action, gpointer data); -void layers_resize_cmd_callback (GtkWidget *widet, +void layers_resize_cmd_callback (GtkAction *action, gpointer data); -void layers_resize_to_image_cmd_callback (GtkWidget *widet, +void layers_resize_to_image_cmd_callback (GtkAction *action, gpointer data); -void layers_scale_cmd_callback (GtkWidget *widet, +void layers_scale_cmd_callback (GtkAction *action, gpointer data); -void layers_crop_cmd_callback (GtkWidget *widet, +void layers_crop_cmd_callback (GtkAction *action, gpointer data); -void layers_mask_add_cmd_callback (GtkWidget *widet, +void layers_mask_add_cmd_callback (GtkAction *action, gpointer data); -void layers_mask_apply_cmd_callback (GtkWidget *widet, +void layers_mask_apply_cmd_callback (GtkAction *action, gpointer data); -void layers_mask_delete_cmd_callback (GtkWidget *widet, +void layers_mask_delete_cmd_callback (GtkAction *action, gpointer data); -void layers_mask_to_selection_cmd_callback (GtkWidget *widet, - gpointer data, - guint action); - -void layers_alpha_add_cmd_callback (GtkWidget *widet, - gpointer data); -void layers_alpha_to_selection_cmd_callback (GtkWidget *widet, - gpointer data, - guint action); - -void layers_merge_layers_cmd_callback (GtkWidget *widget, - gpointer data); -void layers_flatten_image_cmd_callback (GtkWidget *widget, +void layers_mask_to_selection_cmd_callback (GtkAction *action, + gint value, gpointer data); -void layers_text_tool_cmd_callback (GtkWidget *widet, +void layers_alpha_add_cmd_callback (GtkAction *action, gpointer data); -void layers_edit_attributes_cmd_callback (GtkWidget *widet, +void layers_alpha_to_selection_cmd_callback (GtkAction *action, + gint value, + gpointer data); + +void layers_merge_layers_cmd_callback (GtkAction *action, + gpointer data); +void layers_flatten_image_cmd_callback (GtkAction *action, + gpointer data); + +void layers_text_tool_cmd_callback (GtkAction *action, + gpointer data); +void layers_edit_attributes_cmd_callback (GtkAction *action, gpointer data); void layers_text_tool (GimpLayer *layer, diff --git a/app/actions/palette-editor-commands.c b/app/actions/palette-editor-commands.c index 7fc20f02c9..5c4541cd9f 100644 --- a/app/actions/palette-editor-commands.c +++ b/app/actions/palette-editor-commands.c @@ -32,7 +32,7 @@ /* public functions */ void -palette_editor_edit_color_cmd_callback (GtkWidget *widget, +palette_editor_edit_color_cmd_callback (GtkAction *action, gpointer data) { GimpPaletteEditor *editor = GIMP_PALETTE_EDITOR (data); @@ -42,7 +42,7 @@ palette_editor_edit_color_cmd_callback (GtkWidget *widget, } void -palette_editor_new_color_fg_cmd_callback (GtkWidget *widget, +palette_editor_new_color_fg_cmd_callback (GtkAction *action, gpointer data) { GimpPaletteEditor *editor = GIMP_PALETTE_EDITOR (data); @@ -52,7 +52,7 @@ palette_editor_new_color_fg_cmd_callback (GtkWidget *widget, } void -palette_editor_new_color_bg_cmd_callback (GtkWidget *widget, +palette_editor_new_color_bg_cmd_callback (GtkAction *action, gpointer data) { GimpPaletteEditor *editor = GIMP_PALETTE_EDITOR (data); @@ -63,7 +63,7 @@ palette_editor_new_color_bg_cmd_callback (GtkWidget *widget, } void -palette_editor_delete_color_cmd_callback (GtkWidget *widget, +palette_editor_delete_color_cmd_callback (GtkAction *action, gpointer data) { GimpPaletteEditor *editor = GIMP_PALETTE_EDITOR (data); @@ -73,7 +73,7 @@ palette_editor_delete_color_cmd_callback (GtkWidget *widget, } void -palette_editor_zoom_in_cmd_callback (GtkWidget *widget, +palette_editor_zoom_in_cmd_callback (GtkAction *action, gpointer data) { GimpPaletteEditor *editor = GIMP_PALETTE_EDITOR (data); @@ -83,7 +83,7 @@ palette_editor_zoom_in_cmd_callback (GtkWidget *widget, } void -palette_editor_zoom_out_cmd_callback (GtkWidget *widget, +palette_editor_zoom_out_cmd_callback (GtkAction *action, gpointer data) { GimpPaletteEditor *editor = GIMP_PALETTE_EDITOR (data); @@ -93,7 +93,7 @@ palette_editor_zoom_out_cmd_callback (GtkWidget *widget, } void -palette_editor_zoom_all_cmd_callback (GtkWidget *widget, +palette_editor_zoom_all_cmd_callback (GtkAction *action, gpointer data) { GimpPaletteEditor *editor = GIMP_PALETTE_EDITOR (data); diff --git a/app/actions/palette-editor-commands.h b/app/actions/palette-editor-commands.h index dc106b9210..ab45e45150 100644 --- a/app/actions/palette-editor-commands.h +++ b/app/actions/palette-editor-commands.h @@ -20,20 +20,20 @@ #define __PALETTE_EDITOR_COMMANDS_H__ -void palette_editor_edit_color_cmd_callback (GtkWidget *widget, +void palette_editor_edit_color_cmd_callback (GtkAction *action, gpointer data); -void palette_editor_new_color_fg_cmd_callback (GtkWidget *widget, +void palette_editor_new_color_fg_cmd_callback (GtkAction *action, gpointer data); -void palette_editor_new_color_bg_cmd_callback (GtkWidget *widget, +void palette_editor_new_color_bg_cmd_callback (GtkAction *action, gpointer data); -void palette_editor_delete_color_cmd_callback (GtkWidget *widget, +void palette_editor_delete_color_cmd_callback (GtkAction *action, gpointer data); -void palette_editor_zoom_in_cmd_callback (GtkWidget *widget, +void palette_editor_zoom_in_cmd_callback (GtkAction *action, gpointer data); -void palette_editor_zoom_out_cmd_callback (GtkWidget *widget, +void palette_editor_zoom_out_cmd_callback (GtkAction *action, gpointer data); -void palette_editor_zoom_all_cmd_callback (GtkWidget *widget, +void palette_editor_zoom_all_cmd_callback (GtkAction *action, gpointer data); diff --git a/app/actions/palettes-commands.c b/app/actions/palettes-commands.c index a2bb6517eb..fe7c7e834b 100644 --- a/app/actions/palettes-commands.c +++ b/app/actions/palettes-commands.c @@ -51,23 +51,19 @@ static void palettes_merge_palettes_callback (GtkWidget *widget, /* public functionss */ void -palettes_import_palette_cmd_callback (GtkWidget *widget, +palettes_import_palette_cmd_callback (GtkAction *action, gpointer data) { - GimpContainerEditor *editor; - - editor = GIMP_CONTAINER_EDITOR (data); + GimpContainerEditor *editor = GIMP_CONTAINER_EDITOR (data); palette_import_dialog_show (editor->view->context->gimp); } void -palettes_merge_palettes_cmd_callback (GtkWidget *widget, +palettes_merge_palettes_cmd_callback (GtkAction *action, gpointer data) { - GimpContainerEditor *editor; - - editor = GIMP_CONTAINER_EDITOR (data); + GimpContainerEditor *editor = GIMP_CONTAINER_EDITOR (data); palettes_merge_palettes_query (editor); } diff --git a/app/actions/palettes-commands.h b/app/actions/palettes-commands.h index 707fdb6fbf..1283cc8ff3 100644 --- a/app/actions/palettes-commands.h +++ b/app/actions/palettes-commands.h @@ -20,9 +20,9 @@ #define __PALETTES_COMMANDS_H__ -void palettes_import_palette_cmd_callback (GtkWidget *widget, +void palettes_import_palette_cmd_callback (GtkAction *action, gpointer data); -void palettes_merge_palettes_cmd_callback (GtkWidget *widget, +void palettes_merge_palettes_cmd_callback (GtkAction *action, gpointer data); diff --git a/app/actions/plug-in-actions.c b/app/actions/plug-in-actions.c index 088165f587..24c09943c6 100644 --- a/app/actions/plug-in-actions.c +++ b/app/actions/plug-in-actions.c @@ -292,8 +292,10 @@ plug_in_actions_add_proc (GimpActionGroup *group, label = p2 + 1; +#if 0 g_print ("adding plug-in action '%s' (%s)\n", proc_def->db_info.name, label); +#endif action = gimp_plug_in_action_new (proc_def->db_info.name, label, NULL, NULL, @@ -335,8 +337,10 @@ plug_in_actions_remove_proc (GimpActionGroup *group, if (action) { +#if 0 g_print ("removing plug-in action '%s'\n", proc_def->db_info.name); +#endif gtk_action_group_remove_action (GTK_ACTION_GROUP (group), action); } @@ -377,8 +381,10 @@ plug_in_actions_build_path (GimpActionGroup *group, label = p2 + 1; +#if 0 g_print ("adding plug-in submenu '%s' (%s)\n", path_original, label); +#endif action = gtk_action_new (path_original, label, NULL, NULL); gtk_action_group_add_action (GTK_ACTION_GROUP (group), action); diff --git a/app/actions/plug-in-commands.c b/app/actions/plug-in-commands.c index c191e46a77..7df776dcb3 100644 --- a/app/actions/plug-in-commands.c +++ b/app/actions/plug-in-commands.c @@ -38,8 +38,6 @@ #include "display/gimpdisplay.h" -#include "gui/plug-in-menus.h" - #include "plug-in-commands.h" @@ -57,23 +55,28 @@ void -plug_in_run_cmd_callback (GtkWidget *widget, - gpointer data) +plug_in_run_cmd_callback (GtkAction *action, + PlugInProcDef *proc_def, + gpointer data) { - GtkItemFactory *item_factory; - Gimp *gimp; - ProcRecord *proc_rec; - Argument *args; - gint gdisp_ID = -1; - gint i; - gint argc; - GimpImageType drawable_type = GIMP_RGB_IMAGE; + Gimp *gimp; + ProcRecord *proc_rec; + Argument *args; + gint gdisp_ID = -1; + gint i; + gint argc; + GimpImageType drawable_type = GIMP_RGB_IMAGE; - item_factory = gtk_item_factory_from_widget (widget); + if (GIMP_IS_DISPLAY (data)) + gimp = ((GimpDisplay *) data)->gimage->gimp; + else if (GIMP_IS_GIMP (data)) + gimp = data; + else if (GIMP_IS_DOCK (data)) + gimp = ((GimpDock *) data)->context->gimp; + else + return; - gimp = GIMP_ITEM_FACTORY (item_factory)->gimp; - - proc_rec = (ProcRecord *) data; + proc_rec = &proc_def->db_info; /* construct the procedures arguments */ args = g_new0 (Argument, proc_rec->num_args); @@ -150,16 +153,19 @@ plug_in_run_cmd_callback (GtkWidget *widget, proc_rec->args[2].arg_type == GIMP_PDB_DRAWABLE) { gimp->last_plug_in = proc_rec; +#if 0 + FIXME plug_in_menus_update (GIMP_ITEM_FACTORY (item_factory), drawable_type); +#endif } g_free (args); } void -plug_in_repeat_cmd_callback (GtkWidget *widget, - gpointer data, - guint action) +plug_in_repeat_cmd_callback (GtkAction *action, + gint value, + gpointer data) { GimpDisplay *gdisp; GimpDrawable *drawable; @@ -171,7 +177,7 @@ plug_in_repeat_cmd_callback (GtkWidget *widget, if (! drawable) return; - interactive = action ? TRUE : FALSE; + interactive = value ? TRUE : FALSE; plug_in_repeat (gdisp->gimage->gimp, gimp_get_user_context (gdisp->gimage->gimp), diff --git a/app/actions/plug-in-commands.h b/app/actions/plug-in-commands.h index af31c06486..ecba10882f 100644 --- a/app/actions/plug-in-commands.h +++ b/app/actions/plug-in-commands.h @@ -20,11 +20,12 @@ #define __PLUG_IN_COMMANDS_H__ -void plug_in_run_cmd_callback (GtkWidget *widget, - gpointer data); -void plug_in_repeat_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); +void plug_in_run_cmd_callback (GtkAction *action, + PlugInProcDef *proc_def, + gpointer data); +void plug_in_repeat_cmd_callback (GtkAction *action, + gint value, + gpointer data); #endif /* __PLUG_IN_COMMANDS_H__ */ diff --git a/app/actions/qmask-actions.c b/app/actions/qmask-actions.c index 6707e0ebb2..69f7eaf34f 100644 --- a/app/actions/qmask-actions.c +++ b/app/actions/qmask-actions.c @@ -116,14 +116,15 @@ qmask_actions_update (GimpActionGroup *group, #define SET_COLOR(action,color) \ gimp_action_group_set_action_color (group, action, (color), FALSE) - SET_ACTIVE ("qmask-toggle", gimage->qmask_state); + SET_ACTIVE ("qmask-toggle", gimage && gimage->qmask_state); - if (gimage->qmask_inverted) + if (gimage && gimage->qmask_inverted) SET_ACTIVE ("qmask-invert-on", TRUE); else SET_ACTIVE ("qmask-invert-off", TRUE); - SET_COLOR ("qmask-configure", &gimage->qmask_color); + if (gimage) + SET_COLOR ("qmask-configure", &gimage->qmask_color); #undef SET_SENSITIVE #undef SET_COLOR diff --git a/app/actions/qmask-commands.c b/app/actions/qmask-commands.c index fdb421b4a8..fda1c5904b 100644 --- a/app/actions/qmask-commands.c +++ b/app/actions/qmask-commands.c @@ -100,31 +100,33 @@ static void qmask_query_color_changed (GimpColorButton *button, /* public functionss */ void -qmask_toggle_cmd_callback (GtkWidget *widget, +qmask_toggle_cmd_callback (GtkAction *action, gpointer data) { GimpImage *gimage; + gboolean active; return_if_no_image (gimage, data); - if (GTK_CHECK_MENU_ITEM (widget)->active != - gimp_image_get_qmask_state (gimage)) + active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)); + + if (active != gimp_image_get_qmask_state (gimage)) { - gimp_image_set_qmask_state (gimage, GTK_CHECK_MENU_ITEM (widget)->active); + gimp_image_set_qmask_state (gimage, active); gimp_image_flush (gimage); } } void -qmask_invert_cmd_callback (GtkWidget *widget, - gpointer data, - guint action) +qmask_invert_cmd_callback (GtkAction *action, + gint value, + gpointer data) { GimpImage *gimage; return_if_no_image (gimage, data); - if (GTK_CHECK_MENU_ITEM (widget)->active) + if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action))) { - if (action != gimage->qmask_inverted) + if (value != gimage->qmask_inverted) { gimp_image_qmask_invert (gimage); @@ -135,7 +137,7 @@ qmask_invert_cmd_callback (GtkWidget *widget, } void -qmask_configure_cmd_callback (GtkWidget *widget, +qmask_configure_cmd_callback (GtkAction *action, gpointer data) { GimpDisplay *gdisp; diff --git a/app/actions/qmask-commands.h b/app/actions/qmask-commands.h index 67e13f5b1d..4daa36ae50 100644 --- a/app/actions/qmask-commands.h +++ b/app/actions/qmask-commands.h @@ -20,12 +20,12 @@ #define __QMASK_COMMANDS_H__ -void qmask_toggle_cmd_callback (GtkWidget *widget, +void qmask_toggle_cmd_callback (GtkAction *action, gpointer data); -void qmask_invert_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); -void qmask_configure_cmd_callback (GtkWidget *widget, +void qmask_invert_cmd_callback (GtkAction *action, + gint value, + gpointer data); +void qmask_configure_cmd_callback (GtkAction *action, gpointer data); diff --git a/app/actions/quick-mask-actions.c b/app/actions/quick-mask-actions.c index 6707e0ebb2..69f7eaf34f 100644 --- a/app/actions/quick-mask-actions.c +++ b/app/actions/quick-mask-actions.c @@ -116,14 +116,15 @@ qmask_actions_update (GimpActionGroup *group, #define SET_COLOR(action,color) \ gimp_action_group_set_action_color (group, action, (color), FALSE) - SET_ACTIVE ("qmask-toggle", gimage->qmask_state); + SET_ACTIVE ("qmask-toggle", gimage && gimage->qmask_state); - if (gimage->qmask_inverted) + if (gimage && gimage->qmask_inverted) SET_ACTIVE ("qmask-invert-on", TRUE); else SET_ACTIVE ("qmask-invert-off", TRUE); - SET_COLOR ("qmask-configure", &gimage->qmask_color); + if (gimage) + SET_COLOR ("qmask-configure", &gimage->qmask_color); #undef SET_SENSITIVE #undef SET_COLOR diff --git a/app/actions/quick-mask-commands.c b/app/actions/quick-mask-commands.c index fdb421b4a8..fda1c5904b 100644 --- a/app/actions/quick-mask-commands.c +++ b/app/actions/quick-mask-commands.c @@ -100,31 +100,33 @@ static void qmask_query_color_changed (GimpColorButton *button, /* public functionss */ void -qmask_toggle_cmd_callback (GtkWidget *widget, +qmask_toggle_cmd_callback (GtkAction *action, gpointer data) { GimpImage *gimage; + gboolean active; return_if_no_image (gimage, data); - if (GTK_CHECK_MENU_ITEM (widget)->active != - gimp_image_get_qmask_state (gimage)) + active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)); + + if (active != gimp_image_get_qmask_state (gimage)) { - gimp_image_set_qmask_state (gimage, GTK_CHECK_MENU_ITEM (widget)->active); + gimp_image_set_qmask_state (gimage, active); gimp_image_flush (gimage); } } void -qmask_invert_cmd_callback (GtkWidget *widget, - gpointer data, - guint action) +qmask_invert_cmd_callback (GtkAction *action, + gint value, + gpointer data) { GimpImage *gimage; return_if_no_image (gimage, data); - if (GTK_CHECK_MENU_ITEM (widget)->active) + if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action))) { - if (action != gimage->qmask_inverted) + if (value != gimage->qmask_inverted) { gimp_image_qmask_invert (gimage); @@ -135,7 +137,7 @@ qmask_invert_cmd_callback (GtkWidget *widget, } void -qmask_configure_cmd_callback (GtkWidget *widget, +qmask_configure_cmd_callback (GtkAction *action, gpointer data) { GimpDisplay *gdisp; diff --git a/app/actions/quick-mask-commands.h b/app/actions/quick-mask-commands.h index 67e13f5b1d..4daa36ae50 100644 --- a/app/actions/quick-mask-commands.h +++ b/app/actions/quick-mask-commands.h @@ -20,12 +20,12 @@ #define __QMASK_COMMANDS_H__ -void qmask_toggle_cmd_callback (GtkWidget *widget, +void qmask_toggle_cmd_callback (GtkAction *action, gpointer data); -void qmask_invert_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); -void qmask_configure_cmd_callback (GtkWidget *widget, +void qmask_invert_cmd_callback (GtkAction *action, + gint value, + gpointer data); +void qmask_configure_cmd_callback (GtkAction *action, gpointer data); diff --git a/app/actions/select-commands.c b/app/actions/select-commands.c index 00ab5808e6..ef6b6dcf3c 100644 --- a/app/actions/select-commands.c +++ b/app/actions/select-commands.c @@ -102,7 +102,7 @@ static gboolean selection_shrink_edge_lock = FALSE; void -select_invert_cmd_callback (GtkWidget *widget, +select_invert_cmd_callback (GtkAction *action, gpointer data) { GimpImage *gimage; @@ -113,7 +113,7 @@ select_invert_cmd_callback (GtkWidget *widget, } void -select_all_cmd_callback (GtkWidget *widget, +select_all_cmd_callback (GtkAction *action, gpointer data) { GimpImage *gimage; @@ -124,7 +124,7 @@ select_all_cmd_callback (GtkWidget *widget, } void -select_none_cmd_callback (GtkWidget *widget, +select_none_cmd_callback (GtkAction *action, gpointer data) { GimpImage *gimage; @@ -135,7 +135,7 @@ select_none_cmd_callback (GtkWidget *widget, } void -select_from_vectors_cmd_callback (GtkWidget *widget, +select_from_vectors_cmd_callback (GtkAction *action, gpointer data) { GimpImage *gimage; @@ -155,7 +155,7 @@ select_from_vectors_cmd_callback (GtkWidget *widget, } void -select_float_cmd_callback (GtkWidget *widget, +select_float_cmd_callback (GtkAction *action, gpointer data) { GimpImage *gimage; @@ -169,7 +169,7 @@ select_float_cmd_callback (GtkWidget *widget, } void -select_feather_cmd_callback (GtkWidget *widget, +select_feather_cmd_callback (GtkAction *action, gpointer data) { GimpDisplay *gdisp; @@ -192,7 +192,7 @@ select_feather_cmd_callback (GtkWidget *widget, } void -select_sharpen_cmd_callback (GtkWidget *widget, +select_sharpen_cmd_callback (GtkAction *action, gpointer data) { GimpImage *gimage; @@ -203,7 +203,7 @@ select_sharpen_cmd_callback (GtkWidget *widget, } void -select_shrink_cmd_callback (GtkWidget *widget, +select_shrink_cmd_callback (GtkAction *action, gpointer data) { GimpDisplay *gdisp; @@ -239,7 +239,7 @@ select_shrink_cmd_callback (GtkWidget *widget, } void -select_grow_cmd_callback (GtkWidget *widget, +select_grow_cmd_callback (GtkAction *action, gpointer data) { GimpDisplay *gdisp; @@ -262,7 +262,7 @@ select_grow_cmd_callback (GtkWidget *widget, } void -select_border_cmd_callback (GtkWidget *widget, +select_border_cmd_callback (GtkAction *action, gpointer data) { GimpDisplay *gdisp; @@ -285,22 +285,22 @@ select_border_cmd_callback (GtkWidget *widget, } void -select_save_cmd_callback (GtkWidget *widget, +select_save_cmd_callback (GtkAction *action, gpointer data) { - GimpImage *gimage; - return_if_no_image (gimage, data); + GimpDisplay *gdisp; + return_if_no_display (gdisp, data); - gimp_selection_save (gimp_image_get_mask (gimage)); - gimp_image_flush (gimage); + gimp_selection_save (gimp_image_get_mask (gdisp->gimage)); + gimp_image_flush (gdisp->gimage); gimp_dialog_factory_dialog_raise (global_dock_factory, - gtk_widget_get_screen (widget), + gtk_widget_get_screen (gdisp->shell), "gimp-channel-list", -1); } void -select_toggle_quickmask_cmd_callback (GtkWidget *widget, +select_toggle_quickmask_cmd_callback (GtkAction *action, gpointer data) { GimpImage *gimage; diff --git a/app/actions/select-commands.h b/app/actions/select-commands.h index f9db9fc495..b4d08e19db 100644 --- a/app/actions/select-commands.h +++ b/app/actions/select-commands.h @@ -20,29 +20,29 @@ #define __SELECT_COMMANDS_H__ -void select_invert_cmd_callback (GtkWidget *widget, +void select_invert_cmd_callback (GtkAction *action, gpointer data); -void select_all_cmd_callback (GtkWidget *widget, +void select_all_cmd_callback (GtkAction *action, gpointer data); -void select_none_cmd_callback (GtkWidget *widget, +void select_none_cmd_callback (GtkAction *action, gpointer data); -void select_from_vectors_cmd_callback (GtkWidget *widget, +void select_from_vectors_cmd_callback (GtkAction *action, gpointer data); -void select_float_cmd_callback (GtkWidget *widget, +void select_float_cmd_callback (GtkAction *action, gpointer data); -void select_feather_cmd_callback (GtkWidget *widget, +void select_feather_cmd_callback (GtkAction *action, gpointer data); -void select_sharpen_cmd_callback (GtkWidget *widget, +void select_sharpen_cmd_callback (GtkAction *action, gpointer data); -void select_shrink_cmd_callback (GtkWidget *widget, +void select_shrink_cmd_callback (GtkAction *action, gpointer data); -void select_border_cmd_callback (GtkWidget *widget, +void select_border_cmd_callback (GtkAction *action, gpointer data); -void select_grow_cmd_callback (GtkWidget *widget, +void select_grow_cmd_callback (GtkAction *action, gpointer data); -void select_save_cmd_callback (GtkWidget *widget, +void select_save_cmd_callback (GtkAction *action, gpointer data); -void select_toggle_quickmask_cmd_callback (GtkWidget *widget, +void select_toggle_quickmask_cmd_callback (GtkAction *action, gpointer data); diff --git a/app/actions/templates-commands.c b/app/actions/templates-commands.c index f0b8974297..9e5009ec9f 100644 --- a/app/actions/templates-commands.c +++ b/app/actions/templates-commands.c @@ -50,7 +50,7 @@ /* public functions */ void -templates_new_template_cmd_callback (GtkWidget *widget, +templates_new_template_cmd_callback (GtkAction *action, gpointer data) { GimpTemplateView *view = GIMP_TEMPLATE_VIEW (data); @@ -59,7 +59,7 @@ templates_new_template_cmd_callback (GtkWidget *widget, } void -templates_duplicate_template_cmd_callback (GtkWidget *widget, +templates_duplicate_template_cmd_callback (GtkAction *action, gpointer data) { GimpTemplateView *view = GIMP_TEMPLATE_VIEW (data); @@ -68,7 +68,7 @@ templates_duplicate_template_cmd_callback (GtkWidget *widget, } void -templates_edit_template_cmd_callback (GtkWidget *widget, +templates_edit_template_cmd_callback (GtkAction *action, gpointer data) { GimpTemplateView *view = GIMP_TEMPLATE_VIEW (data); @@ -77,7 +77,7 @@ templates_edit_template_cmd_callback (GtkWidget *widget, } void -templates_create_image_cmd_callback (GtkWidget *widget, +templates_create_image_cmd_callback (GtkAction *action, gpointer data) { GimpTemplateView *view = GIMP_TEMPLATE_VIEW (data); @@ -86,7 +86,7 @@ templates_create_image_cmd_callback (GtkWidget *widget, } void -templates_delete_template_cmd_callback (GtkWidget *widget, +templates_delete_template_cmd_callback (GtkAction *action, gpointer data) { GimpTemplateView *view = GIMP_TEMPLATE_VIEW (data); diff --git a/app/actions/templates-commands.h b/app/actions/templates-commands.h index 752aa17146..3ec09ba971 100644 --- a/app/actions/templates-commands.h +++ b/app/actions/templates-commands.h @@ -20,15 +20,15 @@ #define __TEMPLATES_COMMANDS_H__ -void templates_new_template_cmd_callback (GtkWidget *widget, +void templates_new_template_cmd_callback (GtkAction *action, gpointer data); -void templates_duplicate_template_cmd_callback (GtkWidget *widget, +void templates_duplicate_template_cmd_callback (GtkAction *action, gpointer data); -void templates_edit_template_cmd_callback (GtkWidget *widget, +void templates_edit_template_cmd_callback (GtkAction *action, gpointer data); -void templates_create_image_cmd_callback (GtkWidget *widget, +void templates_create_image_cmd_callback (GtkAction *action, gpointer data); -void templates_delete_template_cmd_callback (GtkWidget *widget, +void templates_delete_template_cmd_callback (GtkAction *action, gpointer data); void templates_new_template_dialog (Gimp *gimp, diff --git a/app/actions/tool-options-actions.c b/app/actions/tool-options-actions.c index 870d2affc7..ea3cfa52e1 100644 --- a/app/actions/tool-options-actions.c +++ b/app/actions/tool-options-actions.c @@ -93,9 +93,9 @@ tool_options_actions_setup (GimpActionGroup *group) tool_options_actions, G_N_ELEMENTS (tool_options_actions)); - SET_IMPORTANT ("tool-options-restore-menu", FALSE); - SET_IMPORTANT ("tool-options-rename-menu", FALSE); - SET_IMPORTANT ("tool-options-delete-menu", FALSE); + SET_IMPORTANT ("tool-options-restore-menu", TRUE); + SET_IMPORTANT ("tool-options-rename-menu", TRUE); + SET_IMPORTANT ("tool-options-delete-menu", TRUE); } void diff --git a/app/actions/tool-options-commands.c b/app/actions/tool-options-commands.c index be4a52316f..b84bf7c7ce 100644 --- a/app/actions/tool-options-commands.c +++ b/app/actions/tool-options-commands.c @@ -36,8 +36,8 @@ #include "widgets/gimpeditor.h" #include "widgets/gimphelp-ids.h" -#include "widgets/gimpitemfactory.h" #include "widgets/gimptooloptionseditor.h" +#include "widgets/gimpuimanager.h" #include "tool-options-commands.h" @@ -57,7 +57,7 @@ static void tool_options_rename_callback (GtkWidget *widget, /* public functions */ void -tool_options_save_to_cmd_callback (GtkWidget *widget, +tool_options_save_to_cmd_callback (GtkAction *action, gpointer data) { GimpToolOptions *options = GIMP_TOOL_OPTIONS (data); @@ -73,7 +73,7 @@ tool_options_save_to_cmd_callback (GtkWidget *widget, } void -tool_options_save_new_cmd_callback (GtkWidget *widget, +tool_options_save_new_cmd_callback (GtkAction *action, gpointer data) { GimpEditor *editor = GIMP_EDITOR (data); @@ -81,7 +81,7 @@ tool_options_save_new_cmd_callback (GtkWidget *widget, GimpToolInfo *tool_info; GtkWidget *qbox; - context = gimp_get_user_context (editor->item_factory->gimp); + context = gimp_get_user_context (editor->ui_manager->gimp); tool_info = gimp_context_get_tool (context); qbox = gimp_query_string_box (_("Save Tool Options"), @@ -96,7 +96,7 @@ tool_options_save_new_cmd_callback (GtkWidget *widget, } void -tool_options_restore_from_cmd_callback (GtkWidget *widget, +tool_options_restore_from_cmd_callback (GtkAction *action, gpointer data) { GimpToolOptions *options = GIMP_TOOL_OPTIONS (data); @@ -106,14 +106,14 @@ tool_options_restore_from_cmd_callback (GtkWidget *widget, } void -tool_options_rename_saved_cmd_callback (GtkWidget *widget, +tool_options_rename_saved_cmd_callback (GtkAction *action, gpointer data) { GimpToolOptions *options = GIMP_TOOL_OPTIONS (data); GtkWidget *qbox; qbox = gimp_query_string_box (_("Rename Saved Tool Options"), - widget, + NULL /* FIXME */, gimp_standard_help_func, GIMP_HELP_TOOL_OPTIONS_DIALOG, _("Enter a new name for the saved options"), @@ -124,7 +124,7 @@ tool_options_rename_saved_cmd_callback (GtkWidget *widget, } void -tool_options_delete_saved_cmd_callback (GtkWidget *widget, +tool_options_delete_saved_cmd_callback (GtkAction *action, gpointer data) { GimpToolOptions *options = GIMP_TOOL_OPTIONS (data); @@ -134,7 +134,7 @@ tool_options_delete_saved_cmd_callback (GtkWidget *widget, } void -tool_options_reset_cmd_callback (GtkWidget *widget, +tool_options_reset_cmd_callback (GtkAction *action, gpointer data) { GimpToolOptionsEditor *editor = GIMP_TOOL_OPTIONS_EDITOR (data); @@ -144,7 +144,7 @@ tool_options_reset_cmd_callback (GtkWidget *widget, } void -tool_options_reset_all_cmd_callback (GtkWidget *widget, +tool_options_reset_all_cmd_callback (GtkAction *action, gpointer data) { GimpToolOptionsEditor *editor = GIMP_TOOL_OPTIONS_EDITOR (data); diff --git a/app/actions/tool-options-commands.h b/app/actions/tool-options-commands.h index ee6a150b4b..d2d65c2e1b 100644 --- a/app/actions/tool-options-commands.h +++ b/app/actions/tool-options-commands.h @@ -20,19 +20,19 @@ #define __TOOL_OPTIONS_COMMANDS_H__ -void tool_options_save_to_cmd_callback (GtkWidget *widget, +void tool_options_save_to_cmd_callback (GtkAction *action, gpointer data); -void tool_options_save_new_cmd_callback (GtkWidget *widget, +void tool_options_save_new_cmd_callback (GtkAction *action, gpointer data); -void tool_options_restore_from_cmd_callback (GtkWidget *widget, +void tool_options_restore_from_cmd_callback (GtkAction *action, gpointer data); -void tool_options_rename_saved_cmd_callback (GtkWidget *widget, +void tool_options_rename_saved_cmd_callback (GtkAction *action, gpointer data); -void tool_options_delete_saved_cmd_callback (GtkWidget *widget, +void tool_options_delete_saved_cmd_callback (GtkAction *action, gpointer data); -void tool_options_reset_cmd_callback (GtkWidget *widget, +void tool_options_reset_cmd_callback (GtkAction *action, gpointer data); -void tool_options_reset_all_cmd_callback (GtkWidget *widget, +void tool_options_reset_all_cmd_callback (GtkAction *action, gpointer data); diff --git a/app/actions/tools-commands.c b/app/actions/tools-commands.c index 5fa81825c3..20574c219e 100644 --- a/app/actions/tools-commands.c +++ b/app/actions/tools-commands.c @@ -52,9 +52,8 @@ void -tools_default_colors_cmd_callback (GtkWidget *widget, - gpointer data, - guint action) +tools_default_colors_cmd_callback (GtkAction *action, + gpointer data) { Gimp *gimp; return_if_no_gimp (gimp, data); @@ -63,9 +62,8 @@ tools_default_colors_cmd_callback (GtkWidget *widget, } void -tools_swap_colors_cmd_callback (GtkWidget *widget, - gpointer data, - guint action) +tools_swap_colors_cmd_callback (GtkAction *action, + gpointer data) { Gimp *gimp; return_if_no_gimp (gimp, data); @@ -74,21 +72,18 @@ tools_swap_colors_cmd_callback (GtkWidget *widget, } void -tools_select_cmd_callback (GtkWidget *widget, - gpointer data, - guint action) +tools_select_cmd_callback (GtkAction *action, + const gchar *value, + gpointer data) { Gimp *gimp; GimpToolInfo *tool_info; GimpContext *context; GimpDisplay *gdisp; - const gchar *identifier; return_if_no_gimp (gimp, data); - identifier = g_quark_to_string ((GQuark) action); - tool_info = (GimpToolInfo *) - gimp_container_get_child_by_name (gimp->tool_info_list, identifier); + gimp_container_get_child_by_name (gimp->tool_info_list, value); context = gimp_get_user_context (gimp); diff --git a/app/actions/tools-commands.h b/app/actions/tools-commands.h index e54a835232..9e7a80636b 100644 --- a/app/actions/tools-commands.h +++ b/app/actions/tools-commands.h @@ -20,15 +20,13 @@ #define __TOOLS_COMMANDS_H__ -void tools_default_colors_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); -void tools_swap_colors_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); -void tools_select_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); +void tools_default_colors_cmd_callback (GtkAction *action, + gpointer data); +void tools_swap_colors_cmd_callback (GtkAction *action, + gpointer data); +void tools_select_cmd_callback (GtkAction *action, + const gchar *value, + gpointer data); #endif /* __TOOLS_COMMANDS_H__ */ diff --git a/app/actions/vectors-commands.c b/app/actions/vectors-commands.c index 6100d6e57a..596a130470 100644 --- a/app/actions/vectors-commands.c +++ b/app/actions/vectors-commands.c @@ -54,6 +54,7 @@ #include "tools/gimpvectortool.h" #include "tools/tool_manager.h" +#include "gui/dialogs.h" #include "gui/stroke-dialog.h" #include "vectors-commands.h" @@ -82,28 +83,44 @@ if (! vectors) \ return +#define return_if_no_widget(widget,data) \ + if (GIMP_IS_DISPLAY (data)) \ + widget = ((GimpDisplay *) data)->shell; \ + else if (GIMP_IS_GIMP (data)) \ + widget = dialogs_get_toolbox (); \ + else if (GIMP_IS_DOCK (data)) \ + widget = data; \ + else if (GIMP_IS_ITEM_TREE_VIEW (data)) \ + widget = data; \ + else \ + widget = NULL; \ + if (! widget) \ + return -static void vectors_import_query (GimpImage *gimage, - GtkWidget *parent); -static void vectors_export_query (GimpImage *gimage, - GimpVectors *vectors, - GtkWidget *parent); + +static void vectors_import_query (GimpImage *gimage, + GtkWidget *parent); +static void vectors_export_query (GimpImage *gimage, + GimpVectors *vectors, + GtkWidget *parent); /* public functions */ void -vectors_new_cmd_callback (GtkWidget *widget, +vectors_new_cmd_callback (GtkAction *action, gpointer data) { GimpImage *gimage; + GtkWidget *widget; return_if_no_image (gimage, data); + return_if_no_widget (widget, data); vectors_new_vectors_query (gimage, NULL, TRUE, widget); } void -vectors_raise_to_top_cmd_callback (GtkWidget *widget, +vectors_raise_to_top_cmd_callback (GtkAction *action, gpointer data) { GimpImage *gimage; @@ -115,7 +132,7 @@ vectors_raise_to_top_cmd_callback (GtkWidget *widget, } void -vectors_raise_cmd_callback (GtkWidget *widget, +vectors_raise_cmd_callback (GtkAction *action, gpointer data) { GimpImage *gimage; @@ -127,7 +144,7 @@ vectors_raise_cmd_callback (GtkWidget *widget, } void -vectors_lower_cmd_callback (GtkWidget *widget, +vectors_lower_cmd_callback (GtkAction *action, gpointer data) { GimpImage *gimage; @@ -139,7 +156,7 @@ vectors_lower_cmd_callback (GtkWidget *widget, } void -vectors_lower_to_bottom_cmd_callback (GtkWidget *widget, +vectors_lower_to_bottom_cmd_callback (GtkAction *action, gpointer data) { GimpImage *gimage; @@ -151,7 +168,7 @@ vectors_lower_to_bottom_cmd_callback (GtkWidget *widget, } void -vectors_duplicate_cmd_callback (GtkWidget *widget, +vectors_duplicate_cmd_callback (GtkAction *action, gpointer data) { GimpImage *gimage; @@ -167,7 +184,7 @@ vectors_duplicate_cmd_callback (GtkWidget *widget, } void -vectors_delete_cmd_callback (GtkWidget *widget, +vectors_delete_cmd_callback (GtkAction *action, gpointer data) { GimpImage *gimage; @@ -179,7 +196,7 @@ vectors_delete_cmd_callback (GtkWidget *widget, } void -vectors_merge_visible_cmd_callback (GtkWidget *widget, +vectors_merge_visible_cmd_callback (GtkAction *action, gpointer data) { GimpImage *gimage; @@ -191,16 +208,16 @@ vectors_merge_visible_cmd_callback (GtkWidget *widget, } void -vectors_to_selection_cmd_callback (GtkWidget *widget, - gpointer data, - guint action) +vectors_to_selection_cmd_callback (GtkAction *action, + gint value, + gpointer data) { GimpChannelOps op; GimpImage *gimage; GimpVectors *active_vectors; return_if_no_vectors (gimage, active_vectors, data); - op = (GimpChannelOps) action; + op = (GimpChannelOps) value; gimp_channel_select_vectors (gimp_image_get_mask (gimage), _("Path to Selection"), @@ -210,7 +227,7 @@ vectors_to_selection_cmd_callback (GtkWidget *widget, } void -vectors_selection_to_vectors_cmd_callback (GtkWidget *widget, +vectors_selection_to_vectors_cmd_callback (GtkAction *action, gpointer data) { GimpImage *gimage; @@ -220,18 +237,20 @@ vectors_selection_to_vectors_cmd_callback (GtkWidget *widget, } void -vectors_stroke_cmd_callback (GtkWidget *widget, +vectors_stroke_cmd_callback (GtkAction *action, gpointer data) { - GimpImage *gimage; - GimpVectors *active_vectors; + GimpImage *gimage; + GimpVectors *active_vectors; + GtkWidget *widget; return_if_no_vectors (gimage, active_vectors, data); + return_if_no_widget (widget, data); vectors_stroke_vectors (GIMP_ITEM (active_vectors), widget); } void -vectors_copy_cmd_callback (GtkWidget *widget, +vectors_copy_cmd_callback (GtkAction *action, gpointer data) { GimpImage *gimage; @@ -244,7 +263,7 @@ vectors_copy_cmd_callback (GtkWidget *widget, } void -vectors_paste_cmd_callback (GtkWidget *widget, +vectors_paste_cmd_callback (GtkAction *action, gpointer data) { GimpImage *gimage; @@ -256,29 +275,33 @@ vectors_paste_cmd_callback (GtkWidget *widget, } void -vectors_import_cmd_callback (GtkWidget *widget, +vectors_import_cmd_callback (GtkAction *action, gpointer data) { GimpImage *gimage; + GtkWidget *widget; return_if_no_image (gimage, data); + return_if_no_widget (widget, data); vectors_import_query (gimage, widget); } void -vectors_export_cmd_callback (GtkWidget *widget, +vectors_export_cmd_callback (GtkAction *action, gpointer data) { GimpImage *gimage; GimpVectors *active_vectors; + GtkWidget *widget; return_if_no_vectors (gimage, active_vectors, data); + return_if_no_widget (widget, data); vectors_export_query (gimage, active_vectors, widget); } void -vectors_vectors_tool_cmd_callback (GtkWidget *widget, - gpointer data) +vectors_vectors_tool_cmd_callback (GtkAction *action, + gpointer data) { GimpImage *gimage; GimpVectors *active_vectors; @@ -288,12 +311,14 @@ vectors_vectors_tool_cmd_callback (GtkWidget *widget, } void -vectors_edit_attributes_cmd_callback (GtkWidget *widget, +vectors_edit_attributes_cmd_callback (GtkAction *action, gpointer data) { GimpImage *gimage; GimpVectors *active_vectors; + GtkWidget *widget; return_if_no_vectors (gimage, active_vectors, data); + return_if_no_widget (widget, data); vectors_edit_vectors_query (active_vectors, widget); } diff --git a/app/actions/vectors-commands.h b/app/actions/vectors-commands.h index b31b04f502..c461e3a383 100644 --- a/app/actions/vectors-commands.h +++ b/app/actions/vectors-commands.h @@ -20,40 +20,40 @@ #define __VECTORS_COMMANDS_H__ -void vectors_new_cmd_callback (GtkWidget *widget, +void vectors_new_cmd_callback (GtkAction *action, gpointer data); -void vectors_raise_cmd_callback (GtkWidget *widget, +void vectors_raise_cmd_callback (GtkAction *action, gpointer data); -void vectors_raise_to_top_cmd_callback (GtkWidget *widget, +void vectors_raise_to_top_cmd_callback (GtkAction *action, gpointer data); -void vectors_lower_cmd_callback (GtkWidget *widget, +void vectors_lower_cmd_callback (GtkAction *action, gpointer data); -void vectors_lower_to_bottom_cmd_callback (GtkWidget *widget, +void vectors_lower_to_bottom_cmd_callback (GtkAction *action, gpointer data); -void vectors_duplicate_cmd_callback (GtkWidget *widget, +void vectors_duplicate_cmd_callback (GtkAction *action, gpointer data); -void vectors_delete_cmd_callback (GtkWidget *widget, +void vectors_delete_cmd_callback (GtkAction *action, gpointer data); -void vectors_merge_visible_cmd_callback (GtkWidget *widget, +void vectors_merge_visible_cmd_callback (GtkAction *action, gpointer data); -void vectors_to_selection_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); -void vectors_selection_to_vectors_cmd_callback (GtkWidget *widget, +void vectors_to_selection_cmd_callback (GtkAction *action, + gint value, gpointer data); -void vectors_stroke_cmd_callback (GtkWidget *widget, +void vectors_selection_to_vectors_cmd_callback (GtkAction *action, gpointer data); -void vectors_copy_cmd_callback (GtkWidget *widget, +void vectors_stroke_cmd_callback (GtkAction *action, gpointer data); -void vectors_paste_cmd_callback (GtkWidget *widget, +void vectors_copy_cmd_callback (GtkAction *action, gpointer data); -void vectors_import_cmd_callback (GtkWidget *widget, +void vectors_paste_cmd_callback (GtkAction *action, gpointer data); -void vectors_export_cmd_callback (GtkWidget *widget, +void vectors_import_cmd_callback (GtkAction *action, gpointer data); -void vectors_vectors_tool_cmd_callback (GtkWidget *widget, +void vectors_export_cmd_callback (GtkAction *action, gpointer data); -void vectors_edit_attributes_cmd_callback (GtkWidget *widget, +void vectors_vectors_tool_cmd_callback (GtkAction *action, + gpointer data); +void vectors_edit_attributes_cmd_callback (GtkAction *action, gpointer data); void vectors_stroke_vectors (GimpItem *item, diff --git a/app/actions/view-commands.c b/app/actions/view-commands.c index c83fee60e2..b4235b67a0 100644 --- a/app/actions/view-commands.c +++ b/app/actions/view-commands.c @@ -37,9 +37,10 @@ #include "display/gimpdisplayshell-filter-dialog.h" #include "display/gimpdisplayshell-scale.h" +#include "widgets/gimpactiongroup.h" #include "widgets/gimpdock.h" #include "widgets/gimpdialogfactory.h" -#include "widgets/gimpitemfactory.h" +#include "widgets/gimpuimanager.h" #include "gui/dialogs.h" #include "gui/info-dialog.h" @@ -60,13 +61,18 @@ if (! gdisp) \ return +#define SET_ACTIVE(manager,group_name,action_name,active) \ + { GimpActionGroup *group = \ + gimp_ui_manager_get_action_group (manager, group_name); \ + gimp_action_group_set_action_active (group, action_name, active); } + #define IS_ACTIVE_DISPLAY(gdisp) \ ((gdisp) == \ gimp_context_get_display (gimp_get_user_context ((gdisp)->gimage->gimp))) void -view_zoom_out_cmd_callback (GtkWidget *widget, +view_zoom_out_cmd_callback (GtkAction *action, gpointer data) { GimpDisplay *gdisp; @@ -77,7 +83,7 @@ view_zoom_out_cmd_callback (GtkWidget *widget, } void -view_zoom_in_cmd_callback (GtkWidget *widget, +view_zoom_in_cmd_callback (GtkAction *action, gpointer data) { GimpDisplay *gdisp; @@ -88,7 +94,7 @@ view_zoom_in_cmd_callback (GtkWidget *widget, } void -view_zoom_fit_cmd_callback (GtkWidget *widget, +view_zoom_fit_cmd_callback (GtkAction *action, gpointer data) { GimpDisplay *gdisp; @@ -98,69 +104,62 @@ view_zoom_fit_cmd_callback (GtkWidget *widget, } void -view_zoom_cmd_callback (GtkWidget *widget, - gpointer data, - guint scale) -{ - GimpDisplay *gdisp; - GimpDisplayShell *shell; - return_if_no_display (gdisp, data); - - if (! GTK_CHECK_MENU_ITEM (widget)->active) - return; - - shell = GIMP_DISPLAY_SHELL (gdisp->shell); - - if (fabs (scale - shell->scale) > 0.0001) - gimp_display_shell_scale (shell, GIMP_ZOOM_TO, (gdouble) scale / 10000); -} - -void -view_zoom_other_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpDisplay *gdisp; - GimpDisplayShell *shell; - return_if_no_display (gdisp, data); - - if (! GTK_CHECK_MENU_ITEM (widget)->active) - return; - - shell = GIMP_DISPLAY_SHELL (gdisp->shell); - - /* check if we are activated by the user or from image_menu_set_zoom() */ - if (shell->scale != shell->other_scale) - gimp_display_shell_scale_dialog (shell); -} - -void -view_dot_for_dot_cmd_callback (GtkWidget *widget, - gpointer data) +view_zoom_cmd_callback (GtkAction *action, + GtkAction *current, + gpointer data) { GimpDisplay *gdisp; GimpDisplayShell *shell; + gint value; return_if_no_display (gdisp, data); shell = GIMP_DISPLAY_SHELL (gdisp->shell); - if (shell->dot_for_dot != GTK_CHECK_MENU_ITEM (widget)->active) + value = gtk_radio_action_get_current_value (GTK_RADIO_ACTION (action)); + + if (value == 0 /* Other... */) { - gimp_display_shell_scale_set_dot_for_dot (shell, - GTK_CHECK_MENU_ITEM (widget)->active); - - gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->menubar_factory), - "/View/Dot for Dot", - shell->dot_for_dot); - - if (IS_ACTIVE_DISPLAY (gdisp)) - gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->popup_factory), - "/View/Dot for Dot", - shell->dot_for_dot); + /* check if we are activated by the user + * or from view_actions_set_zoom() + */ + if (shell->scale != shell->other_scale) + gimp_display_shell_scale_dialog (shell); + } + else + { + if (fabs (value - shell->scale) > 0.0001) + gimp_display_shell_scale (shell, GIMP_ZOOM_TO, (gdouble) value / 10000); } } void -view_info_window_cmd_callback (GtkWidget *widget, +view_dot_for_dot_cmd_callback (GtkAction *action, + gpointer data) +{ + GimpDisplay *gdisp; + GimpDisplayShell *shell; + gboolean active; + return_if_no_display (gdisp, data); + + shell = GIMP_DISPLAY_SHELL (gdisp->shell); + + active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)); + + if (active != shell->dot_for_dot) + { + gimp_display_shell_scale_set_dot_for_dot (shell, active); + + SET_ACTIVE (shell->menubar_manager, "view", "view-dot-for-dot", + shell->dot_for_dot); + + if (IS_ACTIVE_DISPLAY (gdisp)) + SET_ACTIVE (shell->popup_manager, "view", "view-dot-for-dot", + shell->dot_for_dot); + } +} + +void +view_info_window_cmd_callback (GtkAction *action, gpointer data) { GimpDisplay *gdisp; @@ -188,7 +187,7 @@ view_info_window_cmd_callback (GtkWidget *widget, } void -view_navigation_window_cmd_callback (GtkWidget *widget, +view_navigation_window_cmd_callback (GtkAction *action, gpointer data) { GimpDisplay *gdisp; @@ -198,12 +197,12 @@ view_navigation_window_cmd_callback (GtkWidget *widget, shell = GIMP_DISPLAY_SHELL (gdisp->shell); gimp_dialog_factory_dialog_raise (global_dock_factory, - gtk_widget_get_screen (widget), + gtk_widget_get_screen (gdisp->shell), "gimp-navigation-view", -1); } void -view_display_filters_cmd_callback (GtkWidget *widget, +view_display_filters_cmd_callback (GtkAction *action, gpointer data) { GimpDisplay *gdisp; @@ -225,171 +224,168 @@ view_display_filters_cmd_callback (GtkWidget *widget, } void -view_toggle_selection_cmd_callback (GtkWidget *widget, +view_toggle_selection_cmd_callback (GtkAction *action, gpointer data) { GimpDisplay *gdisp; GimpDisplayShell *shell; + gboolean active; return_if_no_display (gdisp, data); shell = GIMP_DISPLAY_SHELL (gdisp->shell); - gimp_display_shell_set_show_selection (shell, - GTK_CHECK_MENU_ITEM (widget)->active); + active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)); + + gimp_display_shell_set_show_selection (shell, active); } void -view_toggle_layer_boundary_cmd_callback (GtkWidget *widget, +view_toggle_layer_boundary_cmd_callback (GtkAction *action, gpointer data) { GimpDisplay *gdisp; GimpDisplayShell *shell; + gboolean active; return_if_no_display (gdisp, data); shell = GIMP_DISPLAY_SHELL (gdisp->shell); - gimp_display_shell_set_show_layer (shell, - GTK_CHECK_MENU_ITEM (widget)->active); + active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)); + + gimp_display_shell_set_show_layer (shell, active); } void -view_toggle_menubar_cmd_callback (GtkWidget *widget, +view_toggle_menubar_cmd_callback (GtkAction *action, gpointer data) { GimpDisplay *gdisp; GimpDisplayShell *shell; + gboolean active; return_if_no_display (gdisp, data); shell = GIMP_DISPLAY_SHELL (gdisp->shell); - gimp_display_shell_set_show_menubar (shell, - GTK_CHECK_MENU_ITEM (widget)->active); + active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)); + + gimp_display_shell_set_show_menubar (shell, active); } void -view_toggle_rulers_cmd_callback (GtkWidget *widget, +view_toggle_rulers_cmd_callback (GtkAction *action, gpointer data) { GimpDisplay *gdisp; GimpDisplayShell *shell; + gboolean active; return_if_no_display (gdisp, data); shell = GIMP_DISPLAY_SHELL (gdisp->shell); - gimp_display_shell_set_show_rulers (shell, - GTK_CHECK_MENU_ITEM (widget)->active); + active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)); + + gimp_display_shell_set_show_rulers (shell, active); } void -view_toggle_scrollbars_cmd_callback (GtkWidget *widget, +view_toggle_scrollbars_cmd_callback (GtkAction *action, gpointer data) { GimpDisplay *gdisp; GimpDisplayShell *shell; + gboolean active; return_if_no_display (gdisp, data); shell = GIMP_DISPLAY_SHELL (gdisp->shell); - gimp_display_shell_set_show_scrollbars (shell, - GTK_CHECK_MENU_ITEM (widget)->active); + active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)); + + gimp_display_shell_set_show_scrollbars (shell, active); } void -view_toggle_statusbar_cmd_callback (GtkWidget *widget, +view_toggle_statusbar_cmd_callback (GtkAction *action, gpointer data) { GimpDisplay *gdisp; GimpDisplayShell *shell; + gboolean active; return_if_no_display (gdisp, data); shell = GIMP_DISPLAY_SHELL (gdisp->shell); - gimp_display_shell_set_show_statusbar (shell, - GTK_CHECK_MENU_ITEM (widget)->active); + active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)); + + gimp_display_shell_set_show_statusbar (shell, active); } void -view_toggle_guides_cmd_callback (GtkWidget *widget, +view_toggle_guides_cmd_callback (GtkAction *action, gpointer data) { GimpDisplay *gdisp; GimpDisplayShell *shell; + gboolean active; return_if_no_display (gdisp, data); shell = GIMP_DISPLAY_SHELL (gdisp->shell); - gimp_display_shell_set_show_guides (shell, - GTK_CHECK_MENU_ITEM (widget)->active); + active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)); + + gimp_display_shell_set_show_guides (shell, active); } void -view_snap_to_guides_cmd_callback (GtkWidget *widget, +view_snap_to_guides_cmd_callback (GtkAction *action, gpointer data) { GimpDisplay *gdisp; GimpDisplayShell *shell; + gboolean active; return_if_no_display (gdisp, data); shell = GIMP_DISPLAY_SHELL (gdisp->shell); - if (shell->snap_to_guides != GTK_CHECK_MENU_ITEM (widget)->active) - { - shell->snap_to_guides = GTK_CHECK_MENU_ITEM (widget)->active; + active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)); - gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->menubar_factory), - "/View/Snap to Guides", - shell->snap_to_guides); - - if (IS_ACTIVE_DISPLAY (gdisp)) - gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->popup_factory), - "/View/Snap to Guides", - shell->snap_to_guides); - } + gimp_display_shell_set_snap_to_guides (shell, active); } void -view_toggle_grid_cmd_callback (GtkWidget *widget, +view_toggle_grid_cmd_callback (GtkAction *action, gpointer data) { GimpDisplay *gdisp; GimpDisplayShell *shell; + gboolean active; return_if_no_display (gdisp, data); shell = GIMP_DISPLAY_SHELL (gdisp->shell); - gimp_display_shell_set_show_grid (shell, - GTK_CHECK_MENU_ITEM (widget)->active); + active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)); + gimp_display_shell_set_show_grid (shell, active); } void -view_snap_to_grid_cmd_callback (GtkWidget *widget, +view_snap_to_grid_cmd_callback (GtkAction *action, gpointer data) { GimpDisplay *gdisp; GimpDisplayShell *shell; + gboolean active; return_if_no_display (gdisp, data); shell = GIMP_DISPLAY_SHELL (gdisp->shell); - if (shell->snap_to_grid != GTK_CHECK_MENU_ITEM (widget)->active) - { - shell->snap_to_grid = GTK_CHECK_MENU_ITEM (widget)->active; + active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)); - gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->menubar_factory), - "/View/Snap to Grid", - shell->snap_to_grid); - - if (IS_ACTIVE_DISPLAY (gdisp)) - gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->popup_factory), - "/View/Snap to Grid", - shell->snap_to_grid); - } + gimp_display_shell_set_snap_to_grid (shell, active); } void -view_new_view_cmd_callback (GtkWidget *widget, +view_new_view_cmd_callback (GtkAction *action, gpointer data) { GimpDisplay *gdisp; @@ -400,7 +396,7 @@ view_new_view_cmd_callback (GtkWidget *widget, } void -view_shrink_wrap_cmd_callback (GtkWidget *widget, +view_shrink_wrap_cmd_callback (GtkAction *action, gpointer data) { GimpDisplay *gdisp; @@ -410,31 +406,31 @@ view_shrink_wrap_cmd_callback (GtkWidget *widget, } void -view_fullscreen_cmd_callback (GtkWidget *widget, +view_fullscreen_cmd_callback (GtkAction *action, gpointer data) { GimpDisplay *gdisp; GimpDisplayShell *shell; + gboolean active; gboolean fullscreen; return_if_no_display (gdisp, data); shell = GIMP_DISPLAY_SHELL (gdisp->shell); - gimp_display_shell_set_fullscreen (shell, - GTK_CHECK_MENU_ITEM (widget)->active); + active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)); + + gimp_display_shell_set_fullscreen (shell, active); fullscreen = (shell->window_state & GDK_WINDOW_STATE_FULLSCREEN) != 0; - if (fullscreen != GTK_CHECK_MENU_ITEM (widget)->active) + if (active != fullscreen) { - gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->menubar_factory), - "/View/Fullscreen", - fullscreen); + SET_ACTIVE (shell->menubar_manager, "view", "view-fullscreen", + fullscreen); if (IS_ACTIVE_DISPLAY (gdisp)) - gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->popup_factory), - "/View/Fullscreen", - fullscreen); + SET_ACTIVE (shell->popup_manager, "view", "view-fullscreen", + fullscreen); } } @@ -460,7 +456,7 @@ view_change_screen_destroy_callback (GtkWidget *query_box, } void -view_change_screen_cmd_callback (GtkWidget *widget, +view_change_screen_cmd_callback (GtkAction *action, gpointer data) { GimpDisplay *gdisp; diff --git a/app/actions/view-commands.h b/app/actions/view-commands.h index 5dc8a8ed8e..a10b908c82 100644 --- a/app/actions/view-commands.h +++ b/app/actions/view-commands.h @@ -20,53 +20,51 @@ #define __VIEW_COMMANDS_H__ -void view_zoom_out_cmd_callback (GtkWidget *widget, +void view_zoom_out_cmd_callback (GtkAction *action, gpointer data); -void view_zoom_in_cmd_callback (GtkWidget *widget, +void view_zoom_in_cmd_callback (GtkAction *action, gpointer data); -void view_zoom_fit_cmd_callback (GtkWidget *widget, +void view_zoom_fit_cmd_callback (GtkAction *action, gpointer data); -void view_zoom_cmd_callback (GtkWidget *widget, - gpointer data, - guint scale); -void view_zoom_other_cmd_callback (GtkWidget *widget, +void view_zoom_cmd_callback (GtkAction *action, + GtkAction *current, gpointer data); -void view_dot_for_dot_cmd_callback (GtkWidget *widget, +void view_dot_for_dot_cmd_callback (GtkAction *action, gpointer data); -void view_info_window_cmd_callback (GtkWidget *widget, +void view_info_window_cmd_callback (GtkAction *action, gpointer data); -void view_navigation_window_cmd_callback (GtkWidget *widget, +void view_navigation_window_cmd_callback (GtkAction *action, gpointer data); -void view_display_filters_cmd_callback (GtkWidget *widget, +void view_display_filters_cmd_callback (GtkAction *action, gpointer data); -void view_toggle_selection_cmd_callback (GtkWidget *widget, +void view_toggle_selection_cmd_callback (GtkAction *action, gpointer data); -void view_toggle_layer_boundary_cmd_callback (GtkWidget *widget, +void view_toggle_layer_boundary_cmd_callback (GtkAction *action, gpointer data); -void view_toggle_menubar_cmd_callback (GtkWidget *widget, +void view_toggle_menubar_cmd_callback (GtkAction *action, gpointer data); -void view_toggle_rulers_cmd_callback (GtkWidget *widget, +void view_toggle_rulers_cmd_callback (GtkAction *action, gpointer data); -void view_toggle_scrollbars_cmd_callback (GtkWidget *widget, +void view_toggle_scrollbars_cmd_callback (GtkAction *action, gpointer data); -void view_toggle_statusbar_cmd_callback (GtkWidget *widget, +void view_toggle_statusbar_cmd_callback (GtkAction *action, gpointer data); -void view_toggle_guides_cmd_callback (GtkWidget *widget, +void view_toggle_guides_cmd_callback (GtkAction *action, gpointer data); -void view_snap_to_guides_cmd_callback (GtkWidget *widget, +void view_snap_to_guides_cmd_callback (GtkAction *action, gpointer data); -void view_toggle_grid_cmd_callback (GtkWidget *widget, +void view_toggle_grid_cmd_callback (GtkAction *action, gpointer data); -void view_snap_to_grid_cmd_callback (GtkWidget *widget, +void view_snap_to_grid_cmd_callback (GtkAction *action, gpointer data); -void view_new_view_cmd_callback (GtkWidget *widget, +void view_new_view_cmd_callback (GtkAction *action, gpointer data); -void view_shrink_wrap_cmd_callback (GtkWidget *widget, +void view_shrink_wrap_cmd_callback (GtkAction *action, gpointer data); -void view_fullscreen_cmd_callback (GtkWidget *widget, +void view_fullscreen_cmd_callback (GtkAction *action, gpointer data); -void view_change_screen_cmd_callback (GtkWidget *widget, +void view_change_screen_cmd_callback (GtkAction *action, gpointer data); diff --git a/app/core/gimpprojection.c b/app/core/gimpprojection.c index f4200052ca..7c16a840d2 100644 --- a/app/core/gimpprojection.c +++ b/app/core/gimpprojection.c @@ -31,7 +31,6 @@ #include "core/gimpimage-projection.h" #include "core/gimplist.h" -#include "widgets/gimpitemfactory.h" #include "widgets/gimpuimanager.h" #include "tools/gimptool.h" @@ -204,7 +203,7 @@ GimpDisplay * gimp_display_new (GimpImage *gimage, gdouble scale, GimpMenuFactory *menu_factory, - GimpItemFactory *popup_factory) + GimpUIManager *popup_manager) { GimpDisplay *gdisp; @@ -223,7 +222,7 @@ gimp_display_new (GimpImage *gimage, /* create the shell for the image */ gdisp->shell = gimp_display_shell_new (gdisp, scale, - menu_factory, popup_factory); + menu_factory, popup_manager); gtk_widget_show (gdisp->shell); @@ -511,15 +510,12 @@ gimp_display_flush_whenever (GimpDisplay *gdisp, { GimpContext *user_context; - gimp_item_factory_update (shell->menubar_factory, shell); -#if 0 gimp_ui_manager_update (shell->menubar_manager, shell); -#endif user_context = gimp_get_user_context (gdisp->gimage->gimp); if (gdisp == gimp_context_get_display (user_context)) - gimp_item_factory_update (shell->popup_factory, shell); + gimp_ui_manager_update (shell->popup_manager, shell); } } diff --git a/app/core/gimpprojection.h b/app/core/gimpprojection.h index 7e94471962..cce9c81692 100644 --- a/app/core/gimpprojection.h +++ b/app/core/gimpprojection.h @@ -76,7 +76,7 @@ GType gimp_display_get_type (void) G_GNUC_CONST; GimpDisplay * gimp_display_new (GimpImage *gimage, gdouble scale, GimpMenuFactory *menu_factory, - GimpItemFactory *popup_factory); + GimpUIManager *popup_manager); void gimp_display_delete (GimpDisplay *gdisp); gint gimp_display_get_ID (GimpDisplay *gdisp); diff --git a/app/dialogs/dialogs.c b/app/dialogs/dialogs.c index 09c42f058c..16412953c6 100644 --- a/app/dialogs/dialogs.c +++ b/app/dialogs/dialogs.c @@ -264,3 +264,21 @@ dialogs_exit (Gimp *gimp) global_dock_factory = NULL; } } + +GtkWidget * +dialogs_get_toolbox (void) +{ + GList *list; + + g_return_val_if_fail (GIMP_IS_DIALOG_FACTORY (global_toolbox_factory), NULL); + + for (list = global_toolbox_factory->open_dialogs; + list; + list = g_list_next (list)) + { + if (GTK_WIDGET_TOPLEVEL (list->data)) + return list->data; + } + + return NULL; +} diff --git a/app/dialogs/dialogs.h b/app/dialogs/dialogs.h index 9b32296791..8498d7ee3c 100644 --- a/app/dialogs/dialogs.h +++ b/app/dialogs/dialogs.h @@ -25,8 +25,10 @@ extern GimpDialogFactory *global_dock_factory; extern GimpDialogFactory *global_toolbox_factory; -void dialogs_init (Gimp *gimp); -void dialogs_exit (Gimp *gimp); +void dialogs_init (Gimp *gimp); +void dialogs_exit (Gimp *gimp); + +GtkWidget * dialogs_get_toolbox (void); #endif /* __DIALOGS_H__ */ diff --git a/app/display/gimpdisplay.c b/app/display/gimpdisplay.c index f4200052ca..7c16a840d2 100644 --- a/app/display/gimpdisplay.c +++ b/app/display/gimpdisplay.c @@ -31,7 +31,6 @@ #include "core/gimpimage-projection.h" #include "core/gimplist.h" -#include "widgets/gimpitemfactory.h" #include "widgets/gimpuimanager.h" #include "tools/gimptool.h" @@ -204,7 +203,7 @@ GimpDisplay * gimp_display_new (GimpImage *gimage, gdouble scale, GimpMenuFactory *menu_factory, - GimpItemFactory *popup_factory) + GimpUIManager *popup_manager) { GimpDisplay *gdisp; @@ -223,7 +222,7 @@ gimp_display_new (GimpImage *gimage, /* create the shell for the image */ gdisp->shell = gimp_display_shell_new (gdisp, scale, - menu_factory, popup_factory); + menu_factory, popup_manager); gtk_widget_show (gdisp->shell); @@ -511,15 +510,12 @@ gimp_display_flush_whenever (GimpDisplay *gdisp, { GimpContext *user_context; - gimp_item_factory_update (shell->menubar_factory, shell); -#if 0 gimp_ui_manager_update (shell->menubar_manager, shell); -#endif user_context = gimp_get_user_context (gdisp->gimage->gimp); if (gdisp == gimp_context_get_display (user_context)) - gimp_item_factory_update (shell->popup_factory, shell); + gimp_ui_manager_update (shell->popup_manager, shell); } } diff --git a/app/display/gimpdisplay.h b/app/display/gimpdisplay.h index 7e94471962..cce9c81692 100644 --- a/app/display/gimpdisplay.h +++ b/app/display/gimpdisplay.h @@ -76,7 +76,7 @@ GType gimp_display_get_type (void) G_GNUC_CONST; GimpDisplay * gimp_display_new (GimpImage *gimage, gdouble scale, GimpMenuFactory *menu_factory, - GimpItemFactory *popup_factory); + GimpUIManager *popup_manager); void gimp_display_delete (GimpDisplay *gdisp); gint gimp_display_get_ID (GimpDisplay *gdisp); diff --git a/app/display/gimpdisplayshell-appearance.c b/app/display/gimpdisplayshell-appearance.c index 7499d544b4..4a12007b42 100644 --- a/app/display/gimpdisplayshell-appearance.c +++ b/app/display/gimpdisplayshell-appearance.c @@ -29,7 +29,8 @@ #include "core/gimpcontext.h" #include "core/gimpimage.h" -#include "widgets/gimpitemfactory.h" +#include "widgets/gimpactiongroup.h" +#include "widgets/gimpuimanager.h" #include "widgets/gimpwidgets-utils.h" #include "gimpcanvas.h" @@ -46,6 +47,11 @@ (gimp_display_shell_get_fullscreen (shell) ? \ shell->fullscreen_options : shell->options) +#define SET_ACTIVE(manager,group_name,action_name,active) \ + { GimpActionGroup *group = \ + gimp_ui_manager_get_action_group (manager, group_name); \ + gimp_action_group_set_action_active (group, action_name, active); } + #define IS_ACTIVE_DISPLAY(shell) \ ((shell)->gdisp == \ gimp_context_get_display (gimp_get_user_context \ @@ -89,7 +95,8 @@ gimp_display_shell_set_show_menubar (GimpDisplayShell *shell, g_object_set (options, "show-menubar", show, NULL); - menubar = GTK_ITEM_FACTORY (shell->menubar_factory)->widget; + menubar = gtk_ui_manager_get_widget (GTK_UI_MANAGER (shell->menubar_manager), + "/image-menubar"); vbox = GTK_CONTAINER (shell->qmask->parent->parent); if (show) @@ -102,12 +109,10 @@ gimp_display_shell_set_show_menubar (GimpDisplayShell *shell, else gtk_container_set_border_width (vbox, 0); - gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->menubar_factory), - "/View/Show Menubar", show); + SET_ACTIVE (shell->menubar_manager, "view", "view-show-menubar", show); if (IS_ACTIVE_DISPLAY (shell)) - gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->popup_factory), - "/View/Show Menubar", show); + SET_ACTIVE (shell->popup_manager, "view", "view-show-menubar", show); } gboolean @@ -152,12 +157,10 @@ gimp_display_shell_set_show_rulers (GimpDisplayShell *shell, gtk_table_set_row_spacing (table, 0, 0); } - gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->menubar_factory), - "/View/Show Rulers", show); + SET_ACTIVE (shell->menubar_manager, "view", "view-show-rulers", show); if (IS_ACTIVE_DISPLAY (shell)) - gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->popup_factory), - "/View/Show Rulers", show); + SET_ACTIVE (shell->popup_manager, "view", "view-show-rulers", show); } gboolean @@ -208,12 +211,10 @@ gimp_display_shell_set_show_scrollbars (GimpDisplayShell *shell, gtk_box_set_spacing (vbox, 0); } - gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->menubar_factory), - "/View/Show Scrollbars", show); + SET_ACTIVE (shell->menubar_manager, "view", "view-show-scrollbars", show); if (IS_ACTIVE_DISPLAY (shell)) - gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->popup_factory), - "/View/Show Scrollbars", show); + SET_ACTIVE (shell->popup_manager, "view", "view-show-scrollbars", show); } gboolean @@ -249,12 +250,10 @@ gimp_display_shell_set_show_statusbar (GimpDisplayShell *shell, else gtk_container_set_border_width (vbox, 0); - gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->menubar_factory), - "/View/Show Statusbar", show); + SET_ACTIVE (shell->menubar_manager, "view", "view-show-statusbar", show); if (IS_ACTIVE_DISPLAY (shell)) - gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->popup_factory), - "/View/Show Statusbar", show); + SET_ACTIVE (shell->popup_manager, "view", "view-show-statusbar", show); } gboolean @@ -280,12 +279,10 @@ gimp_display_shell_set_show_selection (GimpDisplayShell *shell, if (shell->select) gimp_display_shell_selection_set_hidden (shell->select, ! show); - gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->menubar_factory), - "/View/Show Selection", show); + SET_ACTIVE (shell->menubar_manager, "view", "view-show-selection", show); if (IS_ACTIVE_DISPLAY (shell)) - gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->popup_factory), - "/View/Show Selection", show); + SET_ACTIVE (shell->popup_manager, "view", "view-show-selection", show); } gboolean @@ -311,12 +308,10 @@ gimp_display_shell_set_show_layer (GimpDisplayShell *shell, if (shell->select) gimp_display_shell_selection_layer_set_hidden (shell->select, ! show); - gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->menubar_factory), - "/View/Show Layer Boundary", show); + SET_ACTIVE (shell->menubar_manager, "view", "view-show-layer-boundary", show); if (IS_ACTIVE_DISPLAY (shell)) - gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->popup_factory), - "/View/Show Layer Boundary", show); + SET_ACTIVE (shell->popup_manager, "view", "view-show-layer-boundary", show); } gboolean @@ -342,12 +337,10 @@ gimp_display_shell_set_show_grid (GimpDisplayShell *shell, if (shell->gdisp->gimage->grid) gimp_display_shell_expose_full (shell); - gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->menubar_factory), - "/View/Show Grid", show); + SET_ACTIVE (shell->menubar_manager, "view", "view-show-grid", show); if (IS_ACTIVE_DISPLAY (shell)) - gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->popup_factory), - "/View/Show Grid", show); + SET_ACTIVE (shell->popup_manager, "view", "view-show-grid", show); } gboolean @@ -368,12 +361,10 @@ gimp_display_shell_set_snap_to_grid (GimpDisplayShell *shell, { shell->snap_to_grid = snap ? TRUE : FALSE; - gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->menubar_factory), - "/View/Snap to Grid", snap); + SET_ACTIVE (shell->menubar_manager, "view", "view-snap-to-grid", snap); if (IS_ACTIVE_DISPLAY (shell)) - gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->popup_factory), - "/View/Snap to Grid", snap); + SET_ACTIVE (shell->popup_manager, "view", "view-snap-to-grid", snap); } } @@ -400,12 +391,10 @@ gimp_display_shell_set_show_guides (GimpDisplayShell *shell, if (shell->gdisp->gimage->guides) gimp_display_shell_expose_full (shell); - gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->menubar_factory), - "/View/Show Guides", show); + SET_ACTIVE (shell->menubar_manager, "view", "view-show-guides", show); if (IS_ACTIVE_DISPLAY (shell)) - gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->popup_factory), - "/View/Show Guides", show); + SET_ACTIVE (shell->popup_manager, "view", "view-show-guides", show); } gboolean @@ -416,6 +405,31 @@ gimp_display_shell_get_show_guides (GimpDisplayShell *shell) return GET_OPTIONS (shell)->show_guides; } +void +gimp_display_shell_set_snap_to_guides (GimpDisplayShell *shell, + gboolean snap) +{ + g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell)); + + if (snap != shell->snap_to_guides) + { + shell->snap_to_guides = snap ? TRUE : FALSE; + + SET_ACTIVE (shell->menubar_manager, "view", "view-snap-to-guides", snap); + + if (IS_ACTIVE_DISPLAY (shell)) + SET_ACTIVE (shell->popup_manager, "view", "view-snap-to-guides", snap); + } +} + +gboolean +gimp_display_shell_get_snap_to_guides (GimpDisplayShell *shell) +{ + g_return_val_if_fail (GIMP_IS_DISPLAY_SHELL (shell), FALSE); + + return shell->snap_to_guides; +} + void gimp_display_shell_set_padding (GimpDisplayShell *shell, GimpCanvasPaddingMode padding_mode, diff --git a/app/display/gimpdisplayshell-appearance.h b/app/display/gimpdisplayshell-appearance.h index 18eed7890b..666cd5f261 100644 --- a/app/display/gimpdisplayshell-appearance.h +++ b/app/display/gimpdisplayshell-appearance.h @@ -60,6 +60,10 @@ void gimp_display_shell_set_show_guides (GimpDisplayShell *shell, gboolean show); gboolean gimp_display_shell_get_show_guides (GimpDisplayShell *shell); +void gimp_display_shell_set_snap_to_guides (GimpDisplayShell *shell, + gboolean snap); +gboolean gimp_display_shell_get_snap_to_guides (GimpDisplayShell *shell); + void gimp_display_shell_set_padding (GimpDisplayShell *shell, GimpCanvasPaddingMode mode, const GimpRGB *color); diff --git a/app/display/gimpdisplayshell-callbacks.c b/app/display/gimpdisplayshell-callbacks.c index a24a089288..060c3fa2e7 100644 --- a/app/display/gimpdisplayshell-callbacks.c +++ b/app/display/gimpdisplayshell-callbacks.c @@ -46,8 +46,9 @@ #include "widgets/gimpcursor.h" #include "widgets/gimpdevices.h" -#include "widgets/gimpdialogfactory.h" #include "widgets/gimpitemfactory.h" +#include "widgets/gimpdialogfactory.h" +#include "widgets/gimpuimanager.h" #include "widgets/gimpwidgets-utils.h" #include "gimpcanvas.h" @@ -235,6 +236,8 @@ gimp_display_shell_events (GtkWidget *widget, options->padding_mode, &options->padding_color); +#if 0 + FIXME gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->menubar_factory), "/View/Fullscreen", fullscreen); @@ -242,6 +245,7 @@ gimp_display_shell_events (GtkWidget *widget, gimp_context_get_display (gimp_get_user_context (gimp))) gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->popup_factory), "/View/Fullscreen", fullscreen); +#endif } break; @@ -421,12 +425,12 @@ gimp_display_shell_popup_menu (GtkWidget *widget) gimp_context_set_display (gimp_get_user_context (shell->gdisp->gimage->gimp), shell->gdisp); - gimp_item_factory_popup_with_data (shell->popup_factory, - shell->gdisp, - GTK_WIDGET (shell), - gimp_display_shell_origin_menu_position, - shell->origin, - NULL); + gimp_ui_manager_ui_popup (shell->popup_manager, "/image-popup", + shell->gdisp, + GTK_WIDGET (shell), + gimp_display_shell_origin_menu_position, + shell->origin, + NULL); return TRUE; } @@ -732,10 +736,10 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas, case 3: state |= GDK_BUTTON3_MASK; - gimp_item_factory_popup_with_data (shell->popup_factory, - gdisp, - GTK_WIDGET (shell), - NULL, NULL, NULL); + gimp_ui_manager_ui_popup (shell->popup_manager, "/image-popup", + gdisp, + GTK_WIDGET (shell), + NULL, NULL, NULL); return_val = TRUE; break; @@ -1510,9 +1514,10 @@ gimp_display_shell_qmask_button_press (GtkWidget *widget, { if ((bevent->type == GDK_BUTTON_PRESS) && (bevent->button == 3)) { - gimp_item_factory_popup_with_data (shell->qmask_factory, shell, - GTK_WIDGET (shell), - NULL, NULL, NULL); + gimp_ui_manager_ui_popup (shell->menubar_manager, "/qmask-popup", + shell, + GTK_WIDGET (shell), + NULL, NULL, NULL); return TRUE; } diff --git a/app/display/gimpdisplayshell.c b/app/display/gimpdisplayshell.c index 7de28a460b..d3f3d63e34 100644 --- a/app/display/gimpdisplayshell.c +++ b/app/display/gimpdisplayshell.c @@ -57,7 +57,6 @@ #include "widgets/gimpcolorpanel.h" #include "widgets/gimpdnd.h" #include "widgets/gimphelp-ids.h" -#include "widgets/gimpitemfactory.h" #include "widgets/gimpmenufactory.h" #include "widgets/gimpuimanager.h" #include "widgets/gimpwidgets-utils.h" @@ -207,10 +206,9 @@ static void gimp_display_shell_init (GimpDisplayShell *shell) { shell->gdisp = NULL; - shell->menubar_factory = NULL; + shell->menubar_manager = NULL; - shell->popup_factory = NULL; - shell->qmask_factory = NULL; + shell->popup_manager = NULL; shell->scale = 1.0; shell->other_scale = 0.0; @@ -370,25 +368,13 @@ gimp_display_shell_destroy (GtkObject *object) if (shell->gdisp) gimp_display_shell_disconnect (shell); - if (shell->menubar_factory) - { - g_object_unref (shell->menubar_factory); - shell->menubar_factory = NULL; - } - if (shell->menubar_manager) { g_object_unref (shell->menubar_manager); shell->menubar_manager = NULL; } - shell->popup_factory = NULL; - - if (shell->qmask_factory) - { - g_object_unref (shell->qmask_factory); - shell->qmask_factory = NULL; - } + shell->popup_manager = NULL; if (shell->select) { @@ -485,22 +471,19 @@ gimp_display_shell_real_scaled (GimpDisplayShell *shell) gimp_display_shell_update_title (shell); /* update the /View/Zoom menu */ - gimp_item_factory_update (shell->menubar_factory, shell); -#if 0 gimp_ui_manager_update (shell->menubar_manager, shell); -#endif user_context = gimp_get_user_context (shell->gdisp->gimage->gimp); if (shell->gdisp == gimp_context_get_display (user_context)) - gimp_item_factory_update (shell->popup_factory, shell); + gimp_ui_manager_update (shell->popup_manager, shell); } GtkWidget * gimp_display_shell_new (GimpDisplay *gdisp, gdouble scale, GimpMenuFactory *menu_factory, - GimpItemFactory *popup_factory) + GimpUIManager *popup_manager) { GimpDisplayShell *shell; GimpDisplayConfig *config; @@ -520,7 +503,7 @@ gimp_display_shell_new (GimpDisplay *gdisp, g_return_val_if_fail (GIMP_IS_DISPLAY (gdisp), NULL); g_return_val_if_fail (GIMP_IS_MENU_FACTORY (menu_factory), NULL); - g_return_val_if_fail (GIMP_IS_ITEM_FACTORY (popup_factory), NULL); + g_return_val_if_fail (GIMP_IS_UI_MANAGER (popup_manager), NULL); /* the toplevel shell */ shell = g_object_new (GIMP_TYPE_DISPLAY_SHELL, NULL); @@ -599,29 +582,15 @@ gimp_display_shell_new (GimpDisplay *gdisp, n_height = s_height; } - - shell->menubar_factory = gimp_menu_factory_menu_new (menu_factory, - "", - GTK_TYPE_MENU_BAR, - gdisp, - FALSE); shell->menubar_manager = gimp_menu_factory_manager_new (menu_factory, "", gdisp, FALSE); - shell->popup_factory = popup_factory; + shell->popup_manager = popup_manager; - shell->qmask_factory = gimp_menu_factory_menu_new (menu_factory, - "", - GTK_TYPE_MENU, - shell, - FALSE); - - - /* The accelerator table for images */ gtk_window_add_accel_group (GTK_WINDOW (shell), - GTK_ITEM_FACTORY (shell->menubar_factory)->accel_group); + gtk_ui_manager_get_accel_group (GTK_UI_MANAGER (shell->menubar_manager))); /* GtkTable widgets are not able to shrink a row/column correctly if * widgets are attached with GTK_EXPAND even if those widgets have @@ -667,32 +636,6 @@ gimp_display_shell_new (GimpDisplay *gdisp, main_vbox = gtk_vbox_new (FALSE, 0); gtk_container_add (GTK_CONTAINER (shell), main_vbox); - menubar = GTK_ITEM_FACTORY (shell->menubar_factory)->widget; - - gtk_box_pack_start (GTK_BOX (main_vbox), menubar, FALSE, FALSE, 0); - - if (shell->options->show_menubar) - gtk_widget_show (menubar); - - /* make sure we can activate accels even if the menubar is invisible - * (see http://bugzilla.gnome.org/show_bug.cgi?id=137151) - */ - g_signal_connect (menubar, "can-activate-accel", - G_CALLBACK (gtk_true), - NULL); - - /* active display callback */ - g_signal_connect (menubar, "button_press_event", - G_CALLBACK (gimp_display_shell_events), - shell); - g_signal_connect (menubar, "button_release_event", - G_CALLBACK (gimp_display_shell_events), - shell); - g_signal_connect (menubar, "key_press_event", - G_CALLBACK (gimp_display_shell_events), - shell); - -#if 0 menubar = gimp_ui_manager_ui_get (shell->menubar_manager, "/image-menubar"); gtk_ui_manager_ensure_update (GTK_UI_MANAGER (shell->menubar_manager)); @@ -718,7 +661,6 @@ gimp_display_shell_new (GimpDisplay *gdisp, g_signal_connect (menubar, "key_press_event", G_CALLBACK (gimp_display_shell_events), shell); -#endif /* another vbox for everything except the statusbar */ disp_vbox = gtk_vbox_new (FALSE, 1); diff --git a/app/display/gimpdisplayshell.h b/app/display/gimpdisplayshell.h index aa6024188d..3512b6722c 100644 --- a/app/display/gimpdisplayshell.h +++ b/app/display/gimpdisplayshell.h @@ -70,11 +70,8 @@ struct _GimpDisplayShell GimpDisplay *gdisp; - GimpItemFactory *menubar_factory; GimpUIManager *menubar_manager; - - GimpItemFactory *popup_factory; - GimpItemFactory *qmask_factory; + GimpUIManager *popup_manager; gdouble monitor_xres; gdouble monitor_yres; @@ -178,7 +175,7 @@ GType gimp_display_shell_get_type (void) G_GNUC_CONST; GtkWidget * gimp_display_shell_new (GimpDisplay *gdisp, gdouble scale, GimpMenuFactory *menu_factory, - GimpItemFactory *popup_factory); + GimpUIManager *popup_manager); void gimp_display_shell_close (GimpDisplayShell *shell, gboolean kill_it); diff --git a/app/gui/Makefile.am b/app/gui/Makefile.am index d6699c0785..7d8be59985 100644 --- a/app/gui/Makefile.am +++ b/app/gui/Makefile.am @@ -59,56 +59,20 @@ dialogs_sources = \ user-install-dialog.h menus_sources = \ - brushes-menu.c \ - brushes-menu.h \ - buffers-menu.c \ - buffers-menu.h \ - channels-menu.c \ - channels-menu.h \ - colormap-editor-menu.c \ - colormap-editor-menu.h \ - dialogs-menu.c \ - dialogs-menu.h \ - documents-menu.c \ - documents-menu.h \ - error-console-menu.c \ - error-console-menu.h \ file-open-menu.c \ file-open-menu.h \ file-save-menu.c \ file-save-menu.h \ - fonts-menu.c \ - fonts-menu.h \ - gradient-editor-menu.c \ - gradient-editor-menu.h \ - gradients-menu.c \ - gradients-menu.h \ image-menu.c \ image-menu.h \ - images-menu.c \ - images-menu.h \ - layers-menu.c \ - layers-menu.h \ menus.c \ menus.h \ - palette-editor-menu.c \ - palette-editor-menu.h \ - palettes-menu.c \ - palettes-menu.h \ - patterns-menu.c \ - patterns-menu.h \ plug-in-menus.c \ plug-in-menus.h \ - qmask-menu.c \ - qmask-menu.h \ - templates-menu.c \ - templates-menu.h \ tool-options-menu.c \ tool-options-menu.h \ toolbox-menu.c \ - toolbox-menu.h \ - vectors-menu.c \ - vectors-menu.h + toolbox-menu.h libappgui_a_SOURCES = \ $(dialogs_sources) \ diff --git a/app/gui/brushes-menu.c b/app/gui/brushes-menu.c deleted file mode 100644 index 260f11b22a..0000000000 --- a/app/gui/brushes-menu.c +++ /dev/null @@ -1,108 +0,0 @@ -/* The GIMP -- an image manipulation program - * Copyright (C) 1995 Spencer Kimball and Peter Mattis - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -#include "config.h" - -#include - -#include "libgimpwidgets/gimpwidgets.h" - -#include "gui-types.h" - -#include "core/gimpcontext.h" -#include "core/gimpdata.h" - -#include "widgets/gimpcontainereditor.h" -#include "widgets/gimpcontainerview.h" -#include "widgets/gimpdatafactoryview.h" -#include "widgets/gimphelp-ids.h" -#include "widgets/gimpitemfactory.h" - -#include "actions/data-commands.h" - -#include "brushes-menu.h" -#include "menus.h" - -#include "gimp-intl.h" - - -GimpItemFactoryEntry brushes_menu_entries[] = -{ - { { N_("/_Edit Brush..."), NULL, - data_edit_data_cmd_callback, 0, - "", GIMP_STOCK_EDIT }, - NULL, - GIMP_HELP_BRUSH_EDIT, NULL }, - - MENU_SEPARATOR ("/---"), - - { { N_("/_New Brush"), "", - data_new_data_cmd_callback, 0, - "", GTK_STOCK_NEW }, - NULL, - GIMP_HELP_BRUSH_NEW, NULL }, - { { N_("/D_uplicate Brush"), NULL, - data_duplicate_data_cmd_callback, 0, - "", GIMP_STOCK_DUPLICATE }, - NULL, - GIMP_HELP_BRUSH_DUPLICATE, NULL }, - { { N_("/_Delete Brush"), "", - data_delete_data_cmd_callback, 0, - "", GTK_STOCK_DELETE }, - NULL, - GIMP_HELP_BRUSH_DELETE, NULL }, - - MENU_SEPARATOR ("/---"), - - { { N_("/_Refresh Brushes"), "", - data_refresh_data_cmd_callback, 0, - "", GTK_STOCK_REFRESH }, - NULL, - GIMP_HELP_BRUSH_REFRESH, NULL } -}; - -gint n_brushes_menu_entries = G_N_ELEMENTS (brushes_menu_entries); - - -void -brushes_menu_update (GtkItemFactory *factory, - gpointer user_data) -{ - GimpContainerEditor *editor; - GimpBrush *brush; - GimpData *data = NULL; - - editor = GIMP_CONTAINER_EDITOR (user_data); - - brush = gimp_context_get_brush (editor->view->context); - - if (brush) - data = GIMP_DATA (brush); - -#define SET_SENSITIVE(menu,condition) \ - gimp_item_factory_set_sensitive (factory, menu, (condition) != 0) - - SET_SENSITIVE ("/Edit Brush...", - brush && GIMP_DATA_FACTORY_VIEW (editor)->data_edit_func); - SET_SENSITIVE ("/Duplicate Brush", - brush && GIMP_DATA_GET_CLASS (data)->duplicate); - SET_SENSITIVE ("/Delete Brush", - brush && data->deletable); - -#undef SET_SENSITIVE -} diff --git a/app/gui/brushes-menu.h b/app/gui/brushes-menu.h deleted file mode 100644 index b116e0db57..0000000000 --- a/app/gui/brushes-menu.h +++ /dev/null @@ -1,31 +0,0 @@ -/* The GIMP -- an image manipulation program - * Copyright (C) 1995 Spencer Kimball and Peter Mattis - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -#ifndef __BRUSHES_MENU_H__ -#define __BRUSHES_MENU_H__ - - -extern GimpItemFactoryEntry brushes_menu_entries[]; -extern gint n_brushes_menu_entries; - - -void brushes_menu_update (GtkItemFactory *factory, - gpointer data); - - -#endif /* __BRUSHES_MENU_H__ */ diff --git a/app/gui/buffers-menu.c b/app/gui/buffers-menu.c deleted file mode 100644 index 0511043098..0000000000 --- a/app/gui/buffers-menu.c +++ /dev/null @@ -1,88 +0,0 @@ -/* The GIMP -- an image manipulation program - * Copyright (C) 1995 Spencer Kimball and Peter Mattis - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -#include "config.h" - -#include - -#include "libgimpwidgets/gimpwidgets.h" - -#include "gui-types.h" - -#include "core/gimpcontext.h" - -#include "widgets/gimpcontainereditor.h" -#include "widgets/gimpcontainerview.h" -#include "widgets/gimphelp-ids.h" -#include "widgets/gimpitemfactory.h" - -#include "actions/buffers-commands.h" - -#include "buffers-menu.h" - -#include "gimp-intl.h" - - -GimpItemFactoryEntry buffers_menu_entries[] = -{ - { { N_("/_Paste Buffer"), "", - buffers_paste_buffer_cmd_callback, 0, - "", GTK_STOCK_PASTE }, - NULL, - GIMP_HELP_BUFFER_PASTE, NULL }, - { { N_("/Paste Buffer _Into"), NULL, - buffers_paste_buffer_into_cmd_callback, 0, - "", GIMP_STOCK_PASTE_INTO }, - NULL, - GIMP_HELP_BUFFER_PASTE_INTO, NULL }, - { { N_("/Paste Buffer as _New"), NULL, - buffers_paste_buffer_as_new_cmd_callback, 0, - "", GIMP_STOCK_PASTE_AS_NEW }, - NULL, - GIMP_HELP_BUFFER_PASTE_AS_NEW, NULL }, - { { N_("/_Delete Buffer"), "", - buffers_delete_buffer_cmd_callback, 0, - "", GTK_STOCK_DELETE }, - NULL, - GIMP_HELP_BUFFER_DELETE, NULL } -}; - -gint n_buffers_menu_entries = G_N_ELEMENTS (buffers_menu_entries); - - -void -buffers_menu_update (GtkItemFactory *factory, - gpointer data) -{ - GimpContainerEditor *editor; - GimpBuffer *buffer; - - editor = GIMP_CONTAINER_EDITOR (data); - - buffer = gimp_context_get_buffer (editor->view->context); - -#define SET_SENSITIVE(menu,condition) \ - gimp_item_factory_set_sensitive (factory, menu, (condition) != 0) - - SET_SENSITIVE ("/Paste Buffer", buffer); - SET_SENSITIVE ("/Paste Buffer Into", buffer); - SET_SENSITIVE ("/Paste Buffer as New", buffer); - SET_SENSITIVE ("/Delete Buffer", buffer); - -#undef SET_SENSITIVE -} diff --git a/app/gui/buffers-menu.h b/app/gui/buffers-menu.h deleted file mode 100644 index c68f16f824..0000000000 --- a/app/gui/buffers-menu.h +++ /dev/null @@ -1,31 +0,0 @@ -/* The GIMP -- an image manipulation program - * Copyright (C) 1995 Spencer Kimball and Peter Mattis - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -#ifndef __BUFFERS_MENU_H__ -#define __BUFFERS_MENU_H__ - - -extern GimpItemFactoryEntry buffers_menu_entries[]; -extern gint n_buffers_menu_entries; - - -void buffers_menu_update (GtkItemFactory *factory, - gpointer data); - - -#endif /* __BUFFERS_MENU_H__ */ diff --git a/app/gui/channels-menu.c b/app/gui/channels-menu.c deleted file mode 100644 index 18745c9744..0000000000 --- a/app/gui/channels-menu.c +++ /dev/null @@ -1,171 +0,0 @@ -/* The GIMP -- an image manipulation program - * Copyright (C) 1995 Spencer Kimball and Peter Mattis - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -#include "config.h" - -#include - -#include "libgimpwidgets/gimpwidgets.h" - -#include "gui-types.h" - -#include "core/gimpimage.h" -#include "core/gimplist.h" - -#include "widgets/gimpcomponenteditor.h" -#include "widgets/gimphelp-ids.h" -#include "widgets/gimpitemfactory.h" -#include "widgets/gimpitemtreeview.h" - -#include "actions/channels-commands.h" - -#include "channels-menu.h" -#include "menus.h" - -#include "gimp-intl.h" - - -GimpItemFactoryEntry channels_menu_entries[] = -{ - { { N_("/_Edit Channel Attributes..."), NULL, - channels_edit_attributes_cmd_callback, 0, - "", GIMP_STOCK_EDIT }, - NULL, - GIMP_HELP_CHANNEL_EDIT, NULL }, - - MENU_SEPARATOR ("/---"), - - { { N_("/_New Channel..."), "", - channels_new_cmd_callback, 0, - "", GTK_STOCK_NEW }, - NULL, - GIMP_HELP_CHANNEL_NEW, NULL }, - { { N_("/_Raise Channel"), "", - channels_raise_cmd_callback, 0, - "", GTK_STOCK_GO_UP }, - NULL, - GIMP_HELP_CHANNEL_RAISE, NULL }, - { { N_("/_Lower Channel"), "", - channels_lower_cmd_callback, 0, - "", GTK_STOCK_GO_DOWN }, - NULL, - GIMP_HELP_CHANNEL_LOWER, NULL }, - { { N_("/D_uplicate Channel"), NULL, - channels_duplicate_cmd_callback, 0, - "", GIMP_STOCK_DUPLICATE }, - NULL, - GIMP_HELP_CHANNEL_DUPLICATE, NULL }, - { { N_("/_Delete Channel"), "", - channels_delete_cmd_callback, 0, - "", GTK_STOCK_DELETE }, - NULL, - GIMP_HELP_CHANNEL_DELETE, NULL }, - - MENU_SEPARATOR ("/---"), - - { { N_("/Channel to Sele_ction"), NULL, - channels_to_selection_cmd_callback, GIMP_CHANNEL_OP_REPLACE, - "", GIMP_STOCK_SELECTION_REPLACE }, - NULL, - GIMP_HELP_CHANNEL_SELECTION_REPLACE, NULL }, - { { N_("/_Add to Selection"), NULL, - channels_to_selection_cmd_callback, GIMP_CHANNEL_OP_ADD, - "", GIMP_STOCK_SELECTION_ADD }, - NULL, - GIMP_HELP_CHANNEL_SELECTION_ADD, NULL }, - { { N_("/_Subtract from Selection"), NULL, - channels_to_selection_cmd_callback, GIMP_CHANNEL_OP_SUBTRACT, - "", GIMP_STOCK_SELECTION_SUBTRACT }, - NULL, - GIMP_HELP_CHANNEL_SELECTION_SUBTRACT, NULL }, - { { N_("/_Intersect with Selection"), NULL, - channels_to_selection_cmd_callback, GIMP_CHANNEL_OP_INTERSECT, - "", GIMP_STOCK_SELECTION_INTERSECT }, - NULL, - GIMP_HELP_CHANNEL_SELECTION_INTERSECT, NULL } -}; - -gint n_channels_menu_entries = G_N_ELEMENTS (channels_menu_entries); - - -void -channels_menu_update (GtkItemFactory *factory, - gpointer data) -{ - GimpImage *gimage; - GimpChannel *channel = NULL; - gboolean fs = FALSE; - gboolean component = FALSE; - GList *next = NULL; - GList *prev = NULL; - - if (GIMP_IS_COMPONENT_EDITOR (data)) - { - gimage = GIMP_IMAGE_EDITOR (data)->gimage; - - if (gimage) - { - if (GIMP_COMPONENT_EDITOR (data)->clicked_component != -1) - component = TRUE; - } - } - else - { - gimage = GIMP_ITEM_TREE_VIEW (data)->gimage; - - if (gimage) - { - GList *list; - - channel = gimp_image_get_active_channel (gimage); - - for (list = GIMP_LIST (gimage->channels)->list; - list; - list = g_list_next (list)) - { - if (channel == (GimpChannel *) list->data) - { - prev = g_list_previous (list); - next = g_list_next (list); - break; - } - } - } - } - - if (gimage) - fs = (gimp_image_floating_sel (gimage) != NULL); - -#define SET_SENSITIVE(menu,condition) \ - gimp_item_factory_set_sensitive (factory, menu, (condition) != 0) - - SET_SENSITIVE ("/Edit Channel Attributes...", !fs && channel); - - SET_SENSITIVE ("/New Channel...", !fs && gimage); - SET_SENSITIVE ("/Raise Channel", !fs && channel && prev); - SET_SENSITIVE ("/Lower Channel", !fs && channel && next); - SET_SENSITIVE ("/Duplicate Channel", !fs && (channel || component)); - SET_SENSITIVE ("/Delete Channel", !fs && channel); - - SET_SENSITIVE ("/Channel to Selection", !fs && (channel || component)); - SET_SENSITIVE ("/Add to Selection", !fs && (channel || component)); - SET_SENSITIVE ("/Subtract from Selection", !fs && (channel || component)); - SET_SENSITIVE ("/Intersect with Selection", !fs && (channel || component)); - -#undef SET_SENSITIVE -} diff --git a/app/gui/channels-menu.h b/app/gui/channels-menu.h deleted file mode 100644 index 5ea0e91047..0000000000 --- a/app/gui/channels-menu.h +++ /dev/null @@ -1,31 +0,0 @@ -/* The GIMP -- an image manipulation program - * Copyright (C) 1995 Spencer Kimball and Peter Mattis - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -#ifndef __CHANNELS_MENU_H__ -#define __CHANNELS_MENU_H__ - - -extern GimpItemFactoryEntry channels_menu_entries[]; -extern gint n_channels_menu_entries; - - -void channels_menu_update (GtkItemFactory *factory, - gpointer data); - - -#endif /* __CHANNELS_MENU_H__ */ diff --git a/app/gui/colormap-editor-menu.c b/app/gui/colormap-editor-menu.c deleted file mode 100644 index c1025d60e2..0000000000 --- a/app/gui/colormap-editor-menu.c +++ /dev/null @@ -1,88 +0,0 @@ -/* The GIMP -- an image manipulation program - * Copyright (C) 1995 Spencer Kimball and Peter Mattis - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -#include "config.h" - -#include - -#include "libgimpwidgets/gimpwidgets.h" - -#include "gui-types.h" - -#include "core/gimpimage.h" - -#include "widgets/gimpcolormapeditor.h" -#include "widgets/gimphelp-ids.h" -#include "widgets/gimpitemfactory.h" - -#include "actions/colormap-editor-commands.h" - -#include "colormap-editor-menu.h" - -#include "gimp-intl.h" - - -GimpItemFactoryEntry colormap_editor_menu_entries[] = -{ - { { N_("/_Edit Color..."), NULL, - colormap_editor_edit_color_cmd_callback, 0, - "", GIMP_STOCK_EDIT }, - NULL, - GIMP_HELP_INDEXED_PALETTE_EDIT, NULL }, - { { N_("/_Add Color from FG"), "", - colormap_editor_add_color_cmd_callback, 0, - "", GTK_STOCK_ADD }, - NULL, - GIMP_HELP_INDEXED_PALETTE_ADD, NULL }, - { { N_("/_Add Color from BG"), "", - colormap_editor_add_color_cmd_callback, TRUE, - "", GTK_STOCK_ADD }, - NULL, - GIMP_HELP_INDEXED_PALETTE_ADD, NULL } -}; - -gint n_colormap_editor_menu_entries = G_N_ELEMENTS (colormap_editor_menu_entries); - - -void -colormap_editor_menu_update (GtkItemFactory *factory, - gpointer data) -{ - GimpColormapEditor *editor; - GimpImage *gimage; - gboolean indexed = FALSE; - gint num_colors = 0; - - editor = GIMP_COLORMAP_EDITOR (data); - gimage = GIMP_IMAGE_EDITOR (editor)->gimage; - - if (gimage) - { - indexed = gimp_image_base_type (gimage) == GIMP_INDEXED; - num_colors = gimage->num_cols; - } - -#define SET_SENSITIVE(menu,condition) \ - gimp_item_factory_set_sensitive (factory, menu, (condition) != 0) - - SET_SENSITIVE ("/Edit Color...", gimage && indexed); - SET_SENSITIVE ("/Add Color from FG", gimage && indexed && num_colors < 256); - SET_SENSITIVE ("/Add Color from BG", gimage && indexed && num_colors < 256); - -#undef SET_SENSITIVE -} diff --git a/app/gui/colormap-editor-menu.h b/app/gui/colormap-editor-menu.h deleted file mode 100644 index d27c059f2e..0000000000 --- a/app/gui/colormap-editor-menu.h +++ /dev/null @@ -1,31 +0,0 @@ -/* The GIMP -- an image manipulation program - * Copyright (C) 1995 Spencer Kimball and Peter Mattis - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -#ifndef __COLORMAP_EDITOR_MENU_H__ -#define __COLORMAP_EDITOR_MENU_H__ - - -extern GimpItemFactoryEntry colormap_editor_menu_entries[]; -extern gint n_colormap_editor_menu_entries; - - -void colormap_editor_menu_update (GtkItemFactory *factory, - gpointer data); - - -#endif /* __COLORMAP_EDITOR_MENU_H__ */ diff --git a/app/gui/dialogs-menu.c b/app/gui/dialogs-menu.c deleted file mode 100644 index 8e5923753b..0000000000 --- a/app/gui/dialogs-menu.c +++ /dev/null @@ -1,392 +0,0 @@ -/* The GIMP -- an image manipulation program - * Copyright (C) 1995 Spencer Kimball and Peter Mattis - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -#include "config.h" - -#include - -#include - -#include "libgimpwidgets/gimpwidgets.h" - -#include "gui-types.h" - -#include "widgets/gimpcontainerview.h" -#include "widgets/gimpcontainerview-utils.h" -#include "widgets/gimpdialogfactory.h" -#include "widgets/gimpdockable.h" -#include "widgets/gimpdockbook.h" -#include "widgets/gimpdocked.h" -#include "widgets/gimphelp-ids.h" -#include "widgets/gimpimagedock.h" -#include "widgets/gimpitemfactory.h" - -#include "actions/dockable-commands.h" - -#include "dialogs-menu.h" -#include "menus.h" - -#include "gimp-intl.h" - - -#define ADD_TAB(path,id,stock_id,help_id) \ - { { (path), "", dockable_add_tab_cmd_callback, 0, \ - "", (stock_id) }, \ - (id), (help_id), NULL } -#define PREVIEW_SIZE(path,size) \ - { { (path), NULL, dockable_preview_size_cmd_callback, \ - (size), "/Preview Size/Tiny" }, \ - NULL, GIMP_HELP_DOCK_PREVIEW_SIZE, NULL } -#define TAB_STYLE(path,style) \ - { { (path), NULL, dockable_tab_style_cmd_callback, \ - (style), "/Tab Style/Icon" }, \ - NULL, GIMP_HELP_DOCK_TAB_STYLE, NULL } - - -GimpItemFactoryEntry dialogs_menu_entries[] = -{ - { { "/dialog-menu", NULL, NULL, 0, - "", GTK_STOCK_MISSING_IMAGE }, - NULL, NULL, NULL }, - - MENU_BRANCH (N_("/_Add Tab")), - - ADD_TAB (N_("/Add Tab/Tool _Options"), "gimp-tool-options", - GIMP_STOCK_TOOL_OPTIONS, GIMP_HELP_TOOL_OPTIONS_DIALOG), - ADD_TAB (N_("/Add Tab/_Device Status"), "gimp-device-status", - GIMP_STOCK_DEVICE_STATUS, GIMP_HELP_DEVICE_STATUS_DIALOG), - - MENU_SEPARATOR ("/Add Tab/---"), - - ADD_TAB (N_("/Add Tab/_Layers"), "gimp-layer-list", - GIMP_STOCK_LAYERS, GIMP_HELP_LAYER_DIALOG), - ADD_TAB (N_("/Add Tab/_Channels"), "gimp-channel-list", - GIMP_STOCK_CHANNELS, GIMP_HELP_CHANNEL_DIALOG), - ADD_TAB (N_("/Add Tab/_Paths"), "gimp-vectors-list", - GIMP_STOCK_PATHS, GIMP_HELP_PATH_DIALOG), - ADD_TAB (N_("/Add Tab/Inde_xed Palette"), "gimp-indexed-palette", - GIMP_STOCK_INDEXED_PALETTE, GIMP_HELP_INDEXED_PALETTE_DIALOG), - ADD_TAB (N_("/Add Tab/Histogra_m"), "gimp-histogram-editor", - GIMP_STOCK_HISTOGRAM, GIMP_HELP_HISTOGRAM_DIALOG), - ADD_TAB (N_("/Add Tab/_Selection Editor"), "gimp-selection-editor", - GIMP_STOCK_TOOL_RECT_SELECT, GIMP_HELP_SELECTION_DIALOG), - ADD_TAB (N_("/Add Tab/Na_vigation"), "gimp-navigation-view", - GIMP_STOCK_NAVIGATION, GIMP_HELP_NAVIGATION_DIALOG), - ADD_TAB (N_("/Add Tab/_Undo History"), "gimp-undo-history", - GIMP_STOCK_UNDO_HISTORY, GIMP_HELP_UNDO_DIALOG), - - MENU_SEPARATOR ("/Add Tab/---"), - - ADD_TAB (N_("/Add Tab/Colo_rs"), "gimp-color-editor", - GIMP_STOCK_DEFAULT_COLORS, GIMP_HELP_COLOR_DIALOG), - ADD_TAB (N_("/Add Tab/Brus_hes"), "gimp-brush-grid", - GIMP_STOCK_BRUSH, GIMP_HELP_BRUSH_DIALOG), - ADD_TAB (N_("/Add Tab/P_atterns"), "gimp-pattern-grid", - GIMP_STOCK_PATTERN, GIMP_HELP_PATTERN_DIALOG), - ADD_TAB (N_("/Add Tab/_Gradients"), "gimp-gradient-list", - GIMP_STOCK_GRADIENT, GIMP_HELP_GRADIENT_DIALOG), - ADD_TAB (N_("/Add Tab/Pal_ettes"), "gimp-palette-list", - GIMP_STOCK_PALETTE, GIMP_HELP_PALETTE_DIALOG), - ADD_TAB (N_("/Add Tab/_Fonts"), "gimp-font-list", - GIMP_STOCK_FONT, GIMP_HELP_FONT_DIALOG), - ADD_TAB (N_("/Add Tab/_Buffers"), "gimp-buffer-list", - GIMP_STOCK_BUFFER, GIMP_HELP_BUFFER_DIALOG), - - MENU_SEPARATOR ("/Add Tab/---"), - - ADD_TAB (N_("/Add Tab/_Images"), "gimp-image-list", - GIMP_STOCK_IMAGES, GIMP_HELP_IMAGE_DIALOG), - ADD_TAB (N_("/Add Tab/Document Histor_y"), "gimp-document-list", - GTK_STOCK_OPEN, GIMP_HELP_DOCUMENT_DIALOG), - ADD_TAB (N_("/Add Tab/_Templates"), "gimp-template-list", - GIMP_STOCK_TEMPLATE, GIMP_HELP_TEMPLATE_DIALOG), - ADD_TAB (N_("/Add Tab/T_ools"), "gimp-tool-list", - GIMP_STOCK_TOOLS, GIMP_HELP_TOOLS_DIALOG), - ADD_TAB (N_("/Add Tab/Error Co_nsole"), "gimp-error-console", - GIMP_STOCK_WARNING, GIMP_HELP_ERRORS_DIALOG), - - { { N_("/_Close Tab"), "", - dockable_close_tab_cmd_callback, 0, - "", GTK_STOCK_CLOSE }, - NULL, - GIMP_HELP_DOCK_TAB_CLOSE, NULL }, - { { N_("/_Detach Tab"), "", - dockable_detach_tab_cmd_callback, 0, - "", GTK_STOCK_CONVERT }, - NULL, - GIMP_HELP_DOCK_TAB_DETACH, NULL }, - - MENU_SEPARATOR ("/properties-separator"), - - MENU_BRANCH (N_("/Preview Si_ze")), - - { { N_("/Preview Size/_Tiny"), NULL, - dockable_preview_size_cmd_callback, - GIMP_PREVIEW_SIZE_TINY, "" }, - NULL, - GIMP_HELP_DOCK_PREVIEW_SIZE, NULL }, - - PREVIEW_SIZE (N_("/Preview Size/E_xtra Small"), GIMP_PREVIEW_SIZE_EXTRA_SMALL), - PREVIEW_SIZE (N_("/Preview Size/_Small"), GIMP_PREVIEW_SIZE_SMALL), - PREVIEW_SIZE (N_("/Preview Size/_Medium"), GIMP_PREVIEW_SIZE_MEDIUM), - PREVIEW_SIZE (N_("/Preview Size/_Large"), GIMP_PREVIEW_SIZE_LARGE), - PREVIEW_SIZE (N_("/Preview Size/Ex_tra Large"), GIMP_PREVIEW_SIZE_EXTRA_LARGE), - PREVIEW_SIZE (N_("/Preview Size/_Huge"), GIMP_PREVIEW_SIZE_HUGE), - PREVIEW_SIZE (N_("/Preview Size/_Enormous"), GIMP_PREVIEW_SIZE_ENORMOUS), - PREVIEW_SIZE (N_("/Preview Size/_Gigantic"), GIMP_PREVIEW_SIZE_GIGANTIC), - - MENU_BRANCH (N_("/_Tab Style")), - - { { N_("/Tab Style/_Icon"), NULL, - dockable_tab_style_cmd_callback, - GIMP_TAB_STYLE_ICON, "" }, - NULL, - GIMP_HELP_DOCK_TAB_STYLE, NULL }, - - TAB_STYLE (N_("/Tab Style/Current _Status"), GIMP_TAB_STYLE_PREVIEW), - TAB_STYLE (N_("/Tab Style/_Text"), GIMP_TAB_STYLE_NAME), - TAB_STYLE (N_("/Tab Style/I_con & Text"), GIMP_TAB_STYLE_ICON_NAME), - TAB_STYLE (N_("/Tab Style/St_atus & Text"), GIMP_TAB_STYLE_PREVIEW_NAME), - - { { N_("/View as _List"), NULL, - dockable_toggle_view_cmd_callback, GIMP_VIEW_TYPE_LIST, "" }, - NULL, - GIMP_HELP_DOCK_VIEW_AS_LIST, NULL }, - { { N_("/View as _Grid"), NULL, - dockable_toggle_view_cmd_callback, GIMP_VIEW_TYPE_GRID, "/View as List" }, - NULL, - GIMP_HELP_DOCK_VIEW_AS_GRID, NULL }, - - MENU_SEPARATOR ("/image-menu-separator"), - - { { N_("/Show Image _Menu"), NULL, - dockable_toggle_image_menu_cmd_callback, 0, "" }, - NULL, - GIMP_HELP_DOCK_IMAGE_MENU, NULL }, - { { N_("/Auto Follow Active _Image"), NULL, - dockable_toggle_auto_cmd_callback, 0, "" }, - NULL, - GIMP_HELP_DOCK_AUTO_BUTTON, NULL }, - { { N_("/Move to Screen..."), NULL, - dockable_change_screen_cmd_callback, 0, - "", GIMP_STOCK_MOVE_TO_SCREEN }, - NULL, - GIMP_HELP_DOCK_CHANGE_SCREEN, NULL } -}; - -#undef ADD_TAB -#undef PREVIEW_SIZE -#undef TAB_STYLE - -gint n_dialogs_menu_entries = G_N_ELEMENTS (dialogs_menu_entries); - - -void -dialogs_menu_update (GtkItemFactory *factory, - gpointer data) -{ - GimpDockable *dockable; - GimpDockbook *dockbook; - GimpDialogFactoryEntry *entry; - GimpContainerView *view; - GimpViewType view_type = -1; - gboolean list_view_available = FALSE; - gboolean grid_view_available = FALSE; - GimpPreviewSize preview_size = -1; - GimpTabStyle tab_style = -1; - gint n_pages = 0; - gint n_screens = 1; - - if (GIMP_IS_DOCKBOOK (data)) - { - gint page_num; - - dockbook = GIMP_DOCKBOOK (data); - - page_num = gtk_notebook_get_current_page (GTK_NOTEBOOK (dockbook)); - - dockable = (GimpDockable *) - gtk_notebook_get_nth_page (GTK_NOTEBOOK (dockbook), page_num); - } - else if (GIMP_IS_DOCKABLE (data)) - { - dockable = GIMP_DOCKABLE (data); - dockbook = dockable->dockbook; - } - else - { - return; - } - - gimp_dialog_factory_from_widget (GTK_WIDGET (dockable), &entry); - - if (entry) - { - gchar *identifier; - gchar *substring = NULL; - - identifier = g_strdup (entry->identifier); - - if ((substring = strstr (identifier, "grid"))) - view_type = GIMP_VIEW_TYPE_GRID; - else if ((substring = strstr (identifier, "list"))) - view_type = GIMP_VIEW_TYPE_LIST; - - if (substring) - { - memcpy (substring, "list", 4); - if (gimp_dialog_factory_find_entry (dockbook->dock->dialog_factory, - identifier)) - list_view_available = TRUE; - - memcpy (substring, "grid", 4); - if (gimp_dialog_factory_find_entry (dockbook->dock->dialog_factory, - identifier)) - grid_view_available = TRUE; - } - - g_free (identifier); - } - - view = gimp_container_view_get_by_dockable (dockable); - - if (view) - preview_size = view->preview_size; - - tab_style = dockable->tab_style; - - n_pages = gtk_notebook_get_n_pages (GTK_NOTEBOOK (dockbook)); - -#define SET_ACTIVE(path,active) \ - gimp_item_factory_set_active (factory, (path), (active) != 0) -#define SET_VISIBLE(path,active) \ - gimp_item_factory_set_visible (factory, (path), (active) != 0) -#define SET_SENSITIVE(path,sensitive) \ - gimp_item_factory_set_sensitive (factory, (path), (sensitive) != 0) - - SET_VISIBLE ("/properties-separator", - preview_size != -1 || - n_pages > 1 || - view_type != -1); - - SET_VISIBLE ("/Preview Size", preview_size != -1); - - if (preview_size != -1) - { - if (preview_size >= GIMP_PREVIEW_SIZE_GIGANTIC) - { - SET_ACTIVE ("/Preview Size/Gigantic", TRUE); - } - else if (preview_size >= GIMP_PREVIEW_SIZE_ENORMOUS) - { - SET_ACTIVE ("/Preview Size/Enormous", TRUE); - } - else if (preview_size >= GIMP_PREVIEW_SIZE_HUGE) - { - SET_ACTIVE ("/Preview Size/Huge", TRUE); - } - else if (preview_size >= GIMP_PREVIEW_SIZE_EXTRA_LARGE) - { - SET_ACTIVE ("/Preview Size/Extra Large", TRUE); - } - else if (preview_size >= GIMP_PREVIEW_SIZE_LARGE) - { - SET_ACTIVE ("/Preview Size/Large", TRUE); - } - else if (preview_size >= GIMP_PREVIEW_SIZE_MEDIUM) - { - SET_ACTIVE ("/Preview Size/Medium", TRUE); - } - else if (preview_size >= GIMP_PREVIEW_SIZE_SMALL) - { - SET_ACTIVE ("/Preview Size/Small", TRUE); - } - else if (preview_size >= GIMP_PREVIEW_SIZE_EXTRA_SMALL) - { - SET_ACTIVE ("/Preview Size/Extra Small", TRUE); - } - else if (preview_size >= GIMP_PREVIEW_SIZE_TINY) - { - SET_ACTIVE ("/Preview Size/Tiny", TRUE); - } - } - - SET_VISIBLE ("/Tab Style", n_pages > 1); - - if (n_pages > 1) - { - GimpDockedInterface *docked_iface; - - docked_iface = GIMP_DOCKED_GET_INTERFACE (GTK_BIN (dockable)->child); - - if (tab_style == GIMP_TAB_STYLE_ICON) - SET_ACTIVE ("/Tab Style/Icon", TRUE); - else if (tab_style == GIMP_TAB_STYLE_PREVIEW) - SET_ACTIVE ("/Tab Style/Current Status", TRUE); - else if (tab_style == GIMP_TAB_STYLE_NAME) - SET_ACTIVE ("/Tab Style/Text", TRUE); - else if (tab_style == GIMP_TAB_STYLE_ICON_NAME) - SET_ACTIVE ("/Tab Style/Icon & Text", TRUE); - else if (tab_style == GIMP_TAB_STYLE_PREVIEW_NAME) - SET_ACTIVE ("/Tab Style/Status & Text", TRUE); - - SET_SENSITIVE ("/Tab Style/Current Status", docked_iface->get_preview); - SET_SENSITIVE ("/Tab Style/Status & Text", docked_iface->get_preview); - } - - SET_VISIBLE ("/View as Grid", view_type != -1); - SET_VISIBLE ("/View as List", view_type != -1); - - if (view_type != -1) - { - if (view_type == GIMP_VIEW_TYPE_LIST) - SET_ACTIVE ("/View as List", TRUE); - else - SET_ACTIVE ("/View as Grid", TRUE); - - SET_SENSITIVE ("/View as Grid", grid_view_available); - SET_SENSITIVE ("/View as List", list_view_available); - } - - n_screens = gdk_display_get_n_screens - (gtk_widget_get_display (GTK_WIDGET (dockbook->dock))); - - if (GIMP_IS_IMAGE_DOCK (dockbook->dock)) - { - GimpImageDock *image_dock = GIMP_IMAGE_DOCK (dockbook->dock); - - SET_VISIBLE ("/image-menu-separator", TRUE); - SET_VISIBLE ("/Show Image Menu", TRUE); - SET_VISIBLE ("/Auto Follow Active Image", TRUE); - - SET_ACTIVE ("/Show Image Menu", image_dock->show_image_menu); - SET_ACTIVE ("/Auto Follow Active Image", image_dock->auto_follow_active); - } - else - { - SET_VISIBLE ("/image-menu-separator", n_screens > 1); - SET_VISIBLE ("/Show Image Menu", FALSE); - SET_VISIBLE ("/Auto Follow Active Image", FALSE); - } - - SET_VISIBLE ("/Move to Screen...", n_screens > 1); - -#undef SET_ACTIVE -#undef SET_VISIBLE -#undef SET_SENSITIVE -} diff --git a/app/gui/dialogs-menu.h b/app/gui/dialogs-menu.h deleted file mode 100644 index 3eaa68d0e8..0000000000 --- a/app/gui/dialogs-menu.h +++ /dev/null @@ -1,31 +0,0 @@ -/* The GIMP -- an image manipulation program - * Copyright (C) 1995 Spencer Kimball and Peter Mattis - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -#ifndef __DIALOGS_MENU_H__ -#define __DIALOGS_MENU_H__ - - -extern GimpItemFactoryEntry dialogs_menu_entries[]; -extern gint n_dialogs_menu_entries; - - -void dialogs_menu_update (GtkItemFactory *factory, - gpointer data); - - -#endif /* __DIALOGS_MENU_H__ */ diff --git a/app/gui/dialogs.c b/app/gui/dialogs.c index 09c42f058c..16412953c6 100644 --- a/app/gui/dialogs.c +++ b/app/gui/dialogs.c @@ -264,3 +264,21 @@ dialogs_exit (Gimp *gimp) global_dock_factory = NULL; } } + +GtkWidget * +dialogs_get_toolbox (void) +{ + GList *list; + + g_return_val_if_fail (GIMP_IS_DIALOG_FACTORY (global_toolbox_factory), NULL); + + for (list = global_toolbox_factory->open_dialogs; + list; + list = g_list_next (list)) + { + if (GTK_WIDGET_TOPLEVEL (list->data)) + return list->data; + } + + return NULL; +} diff --git a/app/gui/dialogs.h b/app/gui/dialogs.h index 9b32296791..8498d7ee3c 100644 --- a/app/gui/dialogs.h +++ b/app/gui/dialogs.h @@ -25,8 +25,10 @@ extern GimpDialogFactory *global_dock_factory; extern GimpDialogFactory *global_toolbox_factory; -void dialogs_init (Gimp *gimp); -void dialogs_exit (Gimp *gimp); +void dialogs_init (Gimp *gimp); +void dialogs_exit (Gimp *gimp); + +GtkWidget * dialogs_get_toolbox (void); #endif /* __DIALOGS_H__ */ diff --git a/app/gui/documents-menu.c b/app/gui/documents-menu.c deleted file mode 100644 index e7fcadc767..0000000000 --- a/app/gui/documents-menu.c +++ /dev/null @@ -1,110 +0,0 @@ -/* The GIMP -- an image manipulation program - * Copyright (C) 1995 Spencer Kimball and Peter Mattis - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -#include "config.h" - -#include - -#include "libgimpwidgets/gimpwidgets.h" - -#include "gui-types.h" - -#include "core/gimpcontext.h" - -#include "widgets/gimpcontainereditor.h" -#include "widgets/gimpcontainerview.h" -#include "widgets/gimphelp-ids.h" -#include "widgets/gimpitemfactory.h" - -#include "actions/documents-commands.h" - -#include "documents-menu.h" -#include "menus.h" - -#include "gimp-intl.h" - - -GimpItemFactoryEntry documents_menu_entries[] = -{ - { { N_("/_Open Image"), "", - documents_open_document_cmd_callback, 0, - "", GTK_STOCK_OPEN }, - NULL, - GIMP_HELP_DOCUMENT_OPEN, NULL }, - { { N_("/_Raise or Open Image"), "", - documents_raise_or_open_document_cmd_callback, 0, - "", GTK_STOCK_OPEN }, - NULL, - GIMP_HELP_DOCUMENT_OPEN, NULL }, - { { N_("/File Open _Dialog"), "", - documents_file_open_dialog_cmd_callback, 0, - "", GTK_STOCK_OPEN }, - NULL, - GIMP_HELP_DOCUMENT_OPEN, NULL }, - { { N_("/Remove _Entry"), NULL, - documents_remove_document_cmd_callback, 0, - "", GTK_STOCK_REMOVE }, - NULL, - GIMP_HELP_DOCUMENT_REMOVE, NULL }, - - MENU_SEPARATOR ("/---"), - - { { N_("/Recreate _Preview"), "", - documents_recreate_preview_cmd_callback, 0, - "", GTK_STOCK_REFRESH }, - NULL, - GIMP_HELP_DOCUMENT_REFRESH, NULL }, - { { N_("/Reload _all Previews"), "", - documents_reload_previews_cmd_callback, 0, - "", GTK_STOCK_REFRESH }, - NULL, - GIMP_HELP_DOCUMENT_REFRESH, NULL }, - { { N_("/Remove Dangling E_ntries"), "", - documents_delete_dangling_documents_cmd_callback, 0, - "", GTK_STOCK_REFRESH }, - NULL, - GIMP_HELP_DOCUMENT_REFRESH, NULL }, -}; - -gint n_documents_menu_entries = G_N_ELEMENTS (documents_menu_entries); - - -void -documents_menu_update (GtkItemFactory *factory, - gpointer data) -{ - GimpContainerEditor *editor; - GimpImagefile *imagefile; - - editor = GIMP_CONTAINER_EDITOR (data); - - imagefile = gimp_context_get_imagefile (editor->view->context); - -#define SET_SENSITIVE(menu,condition) \ - gimp_item_factory_set_sensitive (factory, menu, (condition) != 0) - - SET_SENSITIVE ("/Open Image", imagefile); - SET_SENSITIVE ("/Raise or Open Image", imagefile); - SET_SENSITIVE ("/File Open Dialog", TRUE); - SET_SENSITIVE ("/Remove Entry", imagefile); - SET_SENSITIVE ("/Recreate Preview", imagefile); - SET_SENSITIVE ("/Reload all Previews", imagefile); - SET_SENSITIVE ("/Remove Dangling Entries", imagefile); - -#undef SET_SENSITIVE -} diff --git a/app/gui/documents-menu.h b/app/gui/documents-menu.h deleted file mode 100644 index c8bfed412d..0000000000 --- a/app/gui/documents-menu.h +++ /dev/null @@ -1,31 +0,0 @@ -/* The GIMP -- an image manipulation program - * Copyright (C) 1995 Spencer Kimball and Peter Mattis - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -#ifndef __DOCUMENTS_MENU_H__ -#define __DOCUMENTS_MENU_H__ - - -extern GimpItemFactoryEntry documents_menu_entries[]; -extern gint n_documents_menu_entries; - - -void documents_menu_update (GtkItemFactory *factory, - gpointer data); - - -#endif /* __DOCUMENTS_MENU_H__ */ diff --git a/app/gui/error-console-menu.c b/app/gui/error-console-menu.c deleted file mode 100644 index 693a634182..0000000000 --- a/app/gui/error-console-menu.c +++ /dev/null @@ -1,83 +0,0 @@ -/* The GIMP -- an image manipulation program - * Copyright (C) 1995 Spencer Kimball and Peter Mattis - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -#include "config.h" - -#include - -#include "libgimpwidgets/gimpwidgets.h" - -#include "gui-types.h" - -#include "widgets/gimperrorconsole.h" -#include "widgets/gimphelp-ids.h" -#include "widgets/gimpitemfactory.h" - -#include "actions/error-console-commands.h" - -#include "error-console-menu.h" - -#include "gimp-intl.h" - - -GimpItemFactoryEntry error_console_menu_entries[] = -{ - { { N_("/_Clear Errors"), "", - error_console_clear_cmd_callback, 0, - "", GTK_STOCK_CLEAR }, - NULL, - GIMP_HELP_ERRORS_CLEAR, NULL }, - - { { "/---", NULL, NULL, 0, "", NULL }, NULL, NULL, NULL }, - - { { N_("/Save _All Errors to File..."), "", - error_console_save_all_cmd_callback, 0, - "", GTK_STOCK_SAVE_AS }, - NULL, - GIMP_HELP_ERRORS_SAVE, NULL }, - { { N_("/Save _Selection to File..."), "", - error_console_save_selection_cmd_callback, 0, - "", GTK_STOCK_SAVE_AS }, - NULL, - GIMP_HELP_ERRORS_SAVE, NULL } -}; - -gint n_error_console_menu_entries = G_N_ELEMENTS (error_console_menu_entries); - - -void -error_console_menu_update (GtkItemFactory *factory, - gpointer data) -{ - GimpErrorConsole *console; - gboolean selection; - - console = GIMP_ERROR_CONSOLE (data); - - selection = gtk_text_buffer_get_selection_bounds (console->text_buffer, - NULL, NULL); - -#define SET_SENSITIVE(menu,condition) \ - gimp_item_factory_set_sensitive (factory, menu, (condition) != 0) - - SET_SENSITIVE ("/Clear Errors", TRUE); - SET_SENSITIVE ("/Save All Errors to File...", TRUE); - SET_SENSITIVE ("/Save Selection to File...", selection); - -#undef SET_SENSITIVE -} diff --git a/app/gui/error-console-menu.h b/app/gui/error-console-menu.h deleted file mode 100644 index 383ace64be..0000000000 --- a/app/gui/error-console-menu.h +++ /dev/null @@ -1,31 +0,0 @@ -/* The GIMP -- an image manipulation program - * Copyright (C) 1995 Spencer Kimball and Peter Mattis - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -#ifndef __ERROR_CONSOLE_MENU_H__ -#define __ERROR_CONSOLE_MENU_H__ - - -extern GimpItemFactoryEntry error_console_menu_entries[]; -extern gint n_error_console_menu_entries; - - -void error_console_menu_update (GtkItemFactory *factory, - gpointer data); - - -#endif /* __ERROR_CONSOLE_MENU_H__ */ diff --git a/app/gui/file-open-menu.c b/app/gui/file-open-menu.c index 3562261cdf..3baa469f3d 100644 --- a/app/gui/file-open-menu.c +++ b/app/gui/file-open-menu.c @@ -37,7 +37,6 @@ #include "actions/file-commands.h" #include "file-open-menu.h" -#include "menus.h" #include "gimp-intl.h" @@ -49,7 +48,7 @@ GimpItemFactoryEntry file_open_menu_entries[] = NULL, GIMP_HELP_FILE_OPEN_BY_EXTENSION, NULL }, - MENU_SEPARATOR ("/---") + { { "/---", NULL, NULL, 0, "" }, NULL, NULL, NULL } }; gint n_file_open_menu_entries = G_N_ELEMENTS (file_open_menu_entries); diff --git a/app/gui/file-save-menu.c b/app/gui/file-save-menu.c index 3a43d81b4e..acf5bae1dc 100644 --- a/app/gui/file-save-menu.c +++ b/app/gui/file-save-menu.c @@ -38,7 +38,6 @@ #include "actions/file-commands.h" #include "file-save-menu.h" -#include "menus.h" #include "gimp-intl.h" @@ -50,7 +49,7 @@ GimpItemFactoryEntry file_save_menu_entries[] = NULL, GIMP_HELP_FILE_SAVE_BY_EXTENSION, NULL }, - MENU_SEPARATOR ("/---") + { { "/---", NULL, NULL, 0, "" }, NULL, NULL, NULL } }; gint n_file_save_menu_entries = G_N_ELEMENTS (file_save_menu_entries); diff --git a/app/gui/fonts-menu.c b/app/gui/fonts-menu.c deleted file mode 100644 index 350d45cb1f..0000000000 --- a/app/gui/fonts-menu.c +++ /dev/null @@ -1,72 +0,0 @@ -/* The GIMP -- an image manipulation program - * Copyright (C) 1995 Spencer Kimball and Peter Mattis - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -#include "config.h" - -#include - -#include "libgimpwidgets/gimpwidgets.h" - -#include "gui-types.h" - -#include "core/gimpcontext.h" - -#include "text/gimpfont.h" - -#include "widgets/gimpcontainerview.h" -#include "widgets/gimpfontview.h" -#include "widgets/gimphelp-ids.h" -#include "widgets/gimpitemfactory.h" - -#include "actions/fonts-commands.h" - -#include "fonts-menu.h" - -#include "gimp-intl.h" - - -GimpItemFactoryEntry fonts_menu_entries[] = -{ - { { N_("/_Rescan Font List"), "", - fonts_refresh_cmd_callback, 0, - "", GTK_STOCK_REFRESH }, - NULL, - GIMP_HELP_FONT_REFRESH, NULL } -}; - -gint n_fonts_menu_entries = G_N_ELEMENTS (fonts_menu_entries); - - -void -fonts_menu_update (GtkItemFactory *factory, - gpointer data) -{ - GimpContainerEditor *editor; - GimpFont *font; - - editor = GIMP_CONTAINER_EDITOR (data); - - font = gimp_context_get_font (editor->view->context); - -#define SET_SENSITIVE(menu,condition) \ - gimp_item_factory_set_sensitive (factory, menu, (condition) != 0) - - SET_SENSITIVE ("/Rescan Font List", TRUE); - -#undef SET_SENSITIVE -} diff --git a/app/gui/fonts-menu.h b/app/gui/fonts-menu.h deleted file mode 100644 index b8b1e884ee..0000000000 --- a/app/gui/fonts-menu.h +++ /dev/null @@ -1,31 +0,0 @@ -/* The GIMP -- an image manipulation program - * Copyright (C) 1995 Spencer Kimball and Peter Mattis - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -#ifndef __FONTS_MENU_H__ -#define __FONTS_MENU_H__ - - -extern GimpItemFactoryEntry fonts_menu_entries[]; -extern gint n_fonts_menu_entries; - - -void fonts_menu_update (GtkItemFactory *factory, - gpointer data); - - -#endif /* __FONTS_MENU_H__ */ diff --git a/app/gui/gradient-editor-menu.c b/app/gui/gradient-editor-menu.c deleted file mode 100644 index d4037559b5..0000000000 --- a/app/gui/gradient-editor-menu.c +++ /dev/null @@ -1,490 +0,0 @@ -/* The GIMP -- an image manipulation program - * Copyright (C) 1995 Spencer Kimball and Peter Mattis - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -#include "config.h" - -#include - -#include "libgimpwidgets/gimpwidgets.h" - -#include "gui-types.h" - -#include "core/gimp.h" -#include "core/gimpcontext.h" -#include "core/gimpdatafactory.h" -#include "core/gimpgradient.h" - -#include "widgets/gimpdataeditor.h" -#include "widgets/gimpgradienteditor.h" -#include "widgets/gimphelp-ids.h" -#include "widgets/gimpitemfactory.h" - -#include "actions/gradient-editor-commands.h" - -#include "gradient-editor-menu.h" -#include "menus.h" - -#include "gimp-intl.h" - - -#define LOAD_LEFT_FROM(num,magic) \ - { { "/Load Left Color From/" num, NULL, \ - gradient_editor_load_left_cmd_callback, (magic) }, \ - NULL, GIMP_HELP_GRADIENT_EDITOR_LEFT_LOAD, NULL } -#define SAVE_LEFT_TO(num,magic) \ - { { "/Save Left Color To/" num, NULL, \ - gradient_editor_save_left_cmd_callback, (magic) }, \ - NULL, GIMP_HELP_GRADIENT_EDITOR_LEFT_SAVE, NULL } -#define LOAD_RIGHT_FROM(num,magic) \ - { { "/Load Right Color From/" num, NULL, \ - gradient_editor_load_right_cmd_callback, (magic) }, \ - NULL, GIMP_HELP_GRADIENT_EDITOR_RIGHT_LOAD, NULL } -#define SAVE_RIGHT_TO(num,magic) \ - { { "/Save Right Color To/" num, NULL, \ - gradient_editor_save_right_cmd_callback, (magic) }, \ - NULL, GIMP_HELP_GRADIENT_EDITOR_RIGHT_SAVE, NULL } - - -GimpItemFactoryEntry gradient_editor_menu_entries[] = -{ - { { N_("/L_eft Endpoint's Color..."), NULL, - gradient_editor_left_color_cmd_callback, 0 }, - NULL, - GIMP_HELP_GRADIENT_EDITOR_LEFT_COLOR, NULL }, - - MENU_BRANCH (N_("/_Load Left Color From")), - - { { N_("/Load Left Color From/_Left Neighbor's Right Endpoint"), NULL, - gradient_editor_load_left_cmd_callback, 0 }, - NULL, - NULL, NULL }, - { { N_("/Load Left Color From/_Right Endpoint"), NULL, - gradient_editor_load_left_cmd_callback, 1 }, - NULL, - GIMP_HELP_GRADIENT_EDITOR_LEFT_LOAD, NULL }, - { { N_("/Load Left Color From/_FG Color"), NULL, - gradient_editor_load_left_cmd_callback, 2 }, - NULL, - GIMP_HELP_GRADIENT_EDITOR_LEFT_LOAD, NULL }, - { { N_("/Load Left Color From/_BG Color"), NULL, - gradient_editor_load_left_cmd_callback, 3 }, - NULL, - GIMP_HELP_GRADIENT_EDITOR_LEFT_LOAD, NULL }, - - MENU_SEPARATOR ("/Load Left Color From/---"), - - LOAD_LEFT_FROM ("01", 4), - LOAD_LEFT_FROM ("02", 5), - LOAD_LEFT_FROM ("03", 6), - LOAD_LEFT_FROM ("04", 7), - LOAD_LEFT_FROM ("05", 8), - LOAD_LEFT_FROM ("06", 9), - LOAD_LEFT_FROM ("07", 10), - LOAD_LEFT_FROM ("08", 11), - LOAD_LEFT_FROM ("09", 12), - LOAD_LEFT_FROM ("10", 13), - - MENU_BRANCH (N_("/_Save Left Color To")), - - SAVE_LEFT_TO ("01", 0), - SAVE_LEFT_TO ("02", 1), - SAVE_LEFT_TO ("03", 2), - SAVE_LEFT_TO ("04", 3), - SAVE_LEFT_TO ("05", 4), - SAVE_LEFT_TO ("06", 5), - SAVE_LEFT_TO ("07", 6), - SAVE_LEFT_TO ("08", 7), - SAVE_LEFT_TO ("09", 8), - SAVE_LEFT_TO ("10", 9), - - MENU_SEPARATOR ("/---"), - - { { N_("/R_ight Endpoint's Color..."), NULL, - gradient_editor_right_color_cmd_callback, 0 }, - NULL, - GIMP_HELP_GRADIENT_EDITOR_RIGHT_COLOR, NULL }, - - MENU_BRANCH (N_("/Load Right Color Fr_om")), - - { { N_("/Load Right Color From/_Right Neighbor's Left Endpoint"), NULL, - gradient_editor_load_right_cmd_callback, 0 }, - NULL, - GIMP_HELP_GRADIENT_EDITOR_RIGHT_LOAD, NULL }, - { { N_("/Load Right Color From/_Left Endpoint"), NULL, - gradient_editor_load_right_cmd_callback, 1 }, - NULL, - GIMP_HELP_GRADIENT_EDITOR_RIGHT_LOAD, NULL }, - { { N_("/Load Right Color From/_FG Color"), NULL, - gradient_editor_load_right_cmd_callback, 2 }, - NULL, - GIMP_HELP_GRADIENT_EDITOR_RIGHT_LOAD, NULL }, - { { N_("/Load Right Color From/_BG Color"), NULL, - gradient_editor_load_right_cmd_callback, 3 }, - NULL, - GIMP_HELP_GRADIENT_EDITOR_RIGHT_LOAD, NULL }, - - MENU_SEPARATOR ("/Load Right Color From/---"), - - LOAD_RIGHT_FROM ("01", 4), - LOAD_RIGHT_FROM ("02", 5), - LOAD_RIGHT_FROM ("03", 6), - LOAD_RIGHT_FROM ("04", 7), - LOAD_RIGHT_FROM ("05", 8), - LOAD_RIGHT_FROM ("06", 9), - LOAD_RIGHT_FROM ("07", 10), - LOAD_RIGHT_FROM ("08", 11), - LOAD_RIGHT_FROM ("09", 12), - LOAD_RIGHT_FROM ("10", 13), - - MENU_BRANCH (N_("/Sa_ve Right Color To")), - - SAVE_RIGHT_TO ("01", 0), - SAVE_RIGHT_TO ("02", 1), - SAVE_RIGHT_TO ("03", 2), - SAVE_RIGHT_TO ("04", 3), - SAVE_RIGHT_TO ("05", 4), - SAVE_RIGHT_TO ("06", 5), - SAVE_RIGHT_TO ("07", 6), - SAVE_RIGHT_TO ("08", 7), - SAVE_RIGHT_TO ("09", 8), - SAVE_RIGHT_TO ("10", 9), - - MENU_SEPARATOR ("/---"), - - { { N_("/blendingfunction/_Linear"), NULL, - gradient_editor_blending_func_cmd_callback, - GIMP_GRAD_LINEAR, "" }, - NULL, - GIMP_HELP_GRADIENT_EDITOR_BLENDING, NULL }, - { { N_("/blendingfunction/_Curved"), NULL, - gradient_editor_blending_func_cmd_callback, - GIMP_GRAD_CURVED, "/blendingfunction/Linear" }, - NULL, - GIMP_HELP_GRADIENT_EDITOR_BLENDING, NULL }, - { { N_("/blendingfunction/_Sinusodial"), NULL, - gradient_editor_blending_func_cmd_callback, - GIMP_GRAD_SINE, "/blendingfunction/Linear" }, - NULL, - GIMP_HELP_GRADIENT_EDITOR_BLENDING, NULL }, - { { N_("/blendingfunction/Spherical (i_ncreasing)"), NULL, - gradient_editor_blending_func_cmd_callback, - GIMP_GRAD_SPHERE_INCREASING, "/blendingfunction/Linear" }, - NULL, - GIMP_HELP_GRADIENT_EDITOR_BLENDING, NULL }, - { { N_("/blendingfunction/Spherical (_decreasing)"), NULL, - gradient_editor_blending_func_cmd_callback, - GIMP_GRAD_SPHERE_DECREASING, "/blendingfunction/Linear" }, - NULL, - GIMP_HELP_GRADIENT_EDITOR_BLENDING, NULL }, - { { N_("/blendingfunction/(Varies)"), NULL, NULL, - 0, "/blendingfunction/Linear" }, - NULL, - GIMP_HELP_GRADIENT_EDITOR_BLENDING, NULL }, - - { { N_("/coloringtype/_RGB"), NULL, - gradient_editor_coloring_type_cmd_callback, - GIMP_GRAD_RGB, "" }, - NULL, - GIMP_HELP_GRADIENT_EDITOR_COLORING, NULL }, - { { N_("/coloringtype/HSV (_counter-clockwise hue)"), NULL, - gradient_editor_coloring_type_cmd_callback, - GIMP_GRAD_HSV_CCW, "/coloringtype/RGB" }, - NULL, - GIMP_HELP_GRADIENT_EDITOR_COLORING, NULL }, - { { N_("/coloringtype/HSV (clockwise _hue)"), NULL, - gradient_editor_coloring_type_cmd_callback, - GIMP_GRAD_HSV_CW, "/coloringtype/RGB" }, - NULL, - GIMP_HELP_GRADIENT_EDITOR_COLORING, NULL }, - { { N_("/coloringtype/(Varies)"), NULL, NULL, - 0, "/coloringtype/RGB" }, - NULL, - GIMP_HELP_GRADIENT_EDITOR_COLORING, NULL }, - - MENU_SEPARATOR ("/---"), - - { { "/flip", "F", - gradient_editor_flip_cmd_callback, 0 }, - NULL, - GIMP_HELP_GRADIENT_EDITOR_FLIP, NULL }, - { { "/replicate", "R", - gradient_editor_replicate_cmd_callback, 0 }, - NULL, - GIMP_HELP_GRADIENT_EDITOR_FLIP, NULL }, - { { "/splitmidpoint", "S", - gradient_editor_split_midpoint_cmd_callback, 0 }, - NULL, - GIMP_HELP_GRADIENT_EDITOR_SPLIT_MIDPOINT, NULL }, - { { "/splituniformly", "U", - gradient_editor_split_uniformly_cmd_callback, 0 }, - NULL, - GIMP_HELP_GRADIENT_EDITOR_SPLIT_MIDPOINT, NULL }, - { { "/delete", "D", - gradient_editor_delete_cmd_callback, 0 }, - NULL, - GIMP_HELP_GRADIENT_EDITOR_DELETE, NULL }, - { { "/recenter", "C", - gradient_editor_recenter_cmd_callback, 0 }, - NULL, - GIMP_HELP_GRADIENT_EDITOR_RECENTER, NULL }, - { { "/redistribute", "C", - gradient_editor_redistribute_cmd_callback, 0 }, - NULL, - GIMP_HELP_GRADIENT_EDITOR_REDISTRIBUTE, NULL }, - - MENU_SEPARATOR ("/---"), - - { { N_("/Ble_nd Endpoints' Colors"), "B", - gradient_editor_blend_color_cmd_callback, 0 }, - NULL, - GIMP_HELP_GRADIENT_EDITOR_BLEND_COLOR, NULL }, - { { N_("/Blend Endpoints' Opacit_y"), "B", - gradient_editor_blend_opacity_cmd_callback, 0 }, - NULL, - GIMP_HELP_GRADIENT_EDITOR_BLEND_OPACITY, NULL }, -}; - -#undef LOAD_LEFT_FROM -#undef SAVE_LEFT_TO -#undef LOAD_RIGHT_FROM -#undef SAVE_RIGHT_TO - -gint n_gradient_editor_menu_entries = G_N_ELEMENTS (gradient_editor_menu_entries); - - -void -gradient_editor_menu_update (GtkItemFactory *factory, - gpointer data) -{ - GimpGradientEditor *editor; - GimpContext *user_context; - GimpGradientSegment *left_seg; - GimpGradientSegment *right_seg; - GimpRGB fg; - GimpRGB bg; - gboolean blending_equal = TRUE; - gboolean coloring_equal = TRUE; - gboolean selection; - gboolean delete; - - editor = GIMP_GRADIENT_EDITOR (data); - - user_context = gimp_get_user_context (GIMP_DATA_EDITOR (editor)->data_factory->gimp); - - if (editor->control_sel_l->prev) - left_seg = editor->control_sel_l->prev; - else - left_seg = gimp_gradient_segment_get_last (editor->control_sel_l); - - if (editor->control_sel_r->next) - right_seg = editor->control_sel_r->next; - else - right_seg = gimp_gradient_segment_get_first (editor->control_sel_r); - - gimp_context_get_foreground (user_context, &fg); - gimp_context_get_background (user_context, &bg); - - { - GimpGradientSegmentType type; - GimpGradientSegmentColor color; - GimpGradientSegment *seg, *aseg; - - type = editor->control_sel_l->type; - color = editor->control_sel_l->color; - - seg = editor->control_sel_l; - - do - { - blending_equal = blending_equal && (seg->type == type); - coloring_equal = coloring_equal && (seg->color == color); - - aseg = seg; - seg = seg->next; - } - while (aseg != editor->control_sel_r); - } - - selection = (editor->control_sel_l != editor->control_sel_r); - delete = (editor->control_sel_l->prev || editor->control_sel_r->next); - -#define SET_ACTIVE(menu,active) \ - gimp_item_factory_set_active (factory, menu, (active)) -#define SET_COLOR(menu,color,set_label) \ - gimp_item_factory_set_color (factory, menu, (color), (set_label)) -#define SET_LABEL(menu,label) \ - gimp_item_factory_set_label (factory, menu, (label)) -#define SET_SENSITIVE(menu,condition) \ - gimp_item_factory_set_sensitive (factory, menu, (condition) != 0) -#define SET_VISIBLE(menu,condition) \ - gimp_item_factory_set_visible (factory, menu, (condition) != 0) - - SET_COLOR ("/Left Endpoint's Color...", - &editor->control_sel_l->left_color, FALSE); - SET_COLOR ("/Load Left Color From/Left Neighbor's Right Endpoint", - &left_seg->right_color, FALSE); - SET_COLOR ("/Load Left Color From/Right Endpoint", - &editor->control_sel_r->right_color, FALSE); - SET_COLOR ("/Load Left Color From/FG Color", &fg, FALSE); - SET_COLOR ("/Load Left Color From/BG Color", &bg, FALSE); - - SET_COLOR ("/Load Left Color From/01", &editor->saved_colors[0], TRUE); - SET_COLOR ("/Load Left Color From/02", &editor->saved_colors[1], TRUE); - SET_COLOR ("/Load Left Color From/03", &editor->saved_colors[2], TRUE); - SET_COLOR ("/Load Left Color From/04", &editor->saved_colors[3], TRUE); - SET_COLOR ("/Load Left Color From/05", &editor->saved_colors[4], TRUE); - SET_COLOR ("/Load Left Color From/06", &editor->saved_colors[5], TRUE); - SET_COLOR ("/Load Left Color From/07", &editor->saved_colors[6], TRUE); - SET_COLOR ("/Load Left Color From/08", &editor->saved_colors[7], TRUE); - SET_COLOR ("/Load Left Color From/09", &editor->saved_colors[8], TRUE); - SET_COLOR ("/Load Left Color From/10", &editor->saved_colors[9], TRUE); - - SET_COLOR ("/Save Left Color To/01", &editor->saved_colors[0], TRUE); - SET_COLOR ("/Save Left Color To/02", &editor->saved_colors[1], TRUE); - SET_COLOR ("/Save Left Color To/03", &editor->saved_colors[2], TRUE); - SET_COLOR ("/Save Left Color To/04", &editor->saved_colors[3], TRUE); - SET_COLOR ("/Save Left Color To/05", &editor->saved_colors[4], TRUE); - SET_COLOR ("/Save Left Color To/06", &editor->saved_colors[5], TRUE); - SET_COLOR ("/Save Left Color To/07", &editor->saved_colors[6], TRUE); - SET_COLOR ("/Save Left Color To/08", &editor->saved_colors[7], TRUE); - SET_COLOR ("/Save Left Color To/09", &editor->saved_colors[8], TRUE); - SET_COLOR ("/Save Left Color To/10", &editor->saved_colors[9], TRUE); - - SET_COLOR ("/Right Endpoint's Color...", - &editor->control_sel_r->right_color, FALSE); - SET_COLOR ("/Load Right Color From/Right Neighbor's Left Endpoint", - &right_seg->left_color, FALSE); - SET_COLOR ("/Load Right Color From/Left Endpoint", - &editor->control_sel_l->left_color, FALSE); - SET_COLOR ("/Load Right Color From/FG Color", &fg, FALSE); - SET_COLOR ("/Load Right Color From/BG Color", &bg, FALSE); - - SET_COLOR ("/Load Right Color From/01", &editor->saved_colors[0], TRUE); - SET_COLOR ("/Load Right Color From/02", &editor->saved_colors[1], TRUE); - SET_COLOR ("/Load Right Color From/03", &editor->saved_colors[2], TRUE); - SET_COLOR ("/Load Right Color From/04", &editor->saved_colors[3], TRUE); - SET_COLOR ("/Load Right Color From/05", &editor->saved_colors[4], TRUE); - SET_COLOR ("/Load Right Color From/06", &editor->saved_colors[5], TRUE); - SET_COLOR ("/Load Right Color From/07", &editor->saved_colors[6], TRUE); - SET_COLOR ("/Load Right Color From/08", &editor->saved_colors[7], TRUE); - SET_COLOR ("/Load Right Color From/09", &editor->saved_colors[8], TRUE); - SET_COLOR ("/Load Right Color From/10", &editor->saved_colors[9], TRUE); - - SET_COLOR ("/Save Right Color To/01", &editor->saved_colors[0], TRUE); - SET_COLOR ("/Save Right Color To/02", &editor->saved_colors[1], TRUE); - SET_COLOR ("/Save Right Color To/03", &editor->saved_colors[2], TRUE); - SET_COLOR ("/Save Right Color To/04", &editor->saved_colors[3], TRUE); - SET_COLOR ("/Save Right Color To/05", &editor->saved_colors[4], TRUE); - SET_COLOR ("/Save Right Color To/06", &editor->saved_colors[5], TRUE); - SET_COLOR ("/Save Right Color To/07", &editor->saved_colors[6], TRUE); - SET_COLOR ("/Save Right Color To/08", &editor->saved_colors[7], TRUE); - SET_COLOR ("/Save Right Color To/09", &editor->saved_colors[8], TRUE); - SET_COLOR ("/Save Right Color To/10", &editor->saved_colors[9], TRUE); - - if (! selection) - { - SET_LABEL ("/blendingfunction", _("_Blending Function for Segment")); - SET_LABEL ("/coloringtype", _("Coloring _Type for Segment")); - - SET_LABEL ("/flip", _("_Flip Segment")); - SET_LABEL ("/replicate", _("_Replicate Segment...")); - SET_LABEL ("/splitmidpoint", _("Split Segment at _Midpoint")); - SET_LABEL ("/splituniformly", _("Split Segment _Uniformly...")); - SET_LABEL ("/delete", _("_Delete Segment")); - SET_LABEL ("/recenter", _("Re-_center Segment's Midpoint")); - SET_LABEL ("/redistribute", _("Re-distribute _Handles in Segment")); - } - else - { - SET_LABEL ("/blendingfunction", _("_Blending Function for Selection")); - SET_LABEL ("/coloringtype", _("Coloring _Type for Selection")); - - SET_LABEL ("/flip", _("_Flip Selection")); - SET_LABEL ("/replicate", _("_Replicate Selection...")); - SET_LABEL ("/splitmidpoint", _("Split Segments at _Midpoints")); - SET_LABEL ("/splituniformly", _("Split Segments _Uniformly...")); - SET_LABEL ("/delete", _("_Delete Selection")); - SET_LABEL ("/recenter", _("Re-_center Midpoints in Selection")); - SET_LABEL ("/redistribute", _("Re-distribute _Handles in Selection")); - } - - SET_SENSITIVE ("/blendingfunction/(Varies)", FALSE); - SET_SENSITIVE ("/coloringtype/(Varies)", FALSE); - - if (blending_equal) - { - SET_VISIBLE ("/blendingfunction/(Varies)", FALSE); - - switch (editor->control_sel_l->type) - { - case GIMP_GRAD_LINEAR: - SET_ACTIVE ("/blendingfunction/Linear", TRUE); - break; - case GIMP_GRAD_CURVED: - SET_ACTIVE ("/blendingfunction/Curved", TRUE); - break; - case GIMP_GRAD_SINE: - SET_ACTIVE ("/blendingfunction/Sinusodial", TRUE); - break; - case GIMP_GRAD_SPHERE_INCREASING: - SET_ACTIVE ("/blendingfunction/Spherical (increasing)", TRUE); - break; - case GIMP_GRAD_SPHERE_DECREASING: - SET_ACTIVE ("/blendingfunction/Spherical (decreasing)", TRUE); - break; - } - } - else - { - SET_VISIBLE ("/blendingfunction/(Varies)", TRUE); - SET_ACTIVE ("/blendingfunction/(Varies)", TRUE); - } - - if (coloring_equal) - { - SET_VISIBLE ("/coloringtype/(Varies)", FALSE); - - switch (editor->control_sel_l->color) - { - case GIMP_GRAD_RGB: - SET_ACTIVE ("/coloringtype/RGB", TRUE); - break; - case GIMP_GRAD_HSV_CCW: - SET_ACTIVE ("/coloringtype/HSV (counter-clockwise hue)", TRUE); - break; - case GIMP_GRAD_HSV_CW: - SET_ACTIVE ("/coloringtype/HSV (clockwise hue)", TRUE); - break; - } - } - else - { - SET_VISIBLE ("/coloringtype/(Varies)", TRUE); - SET_ACTIVE ("/coloringtype/(Varies)", TRUE); - } - - SET_SENSITIVE ("/Blend Endpoints' Colors", selection); - SET_SENSITIVE ("/Blend Endpoints' Opacity", selection); - SET_SENSITIVE ("/delete", delete); - -#undef SET_ACTIVE -#undef SET_COLOR -#undef SET_LABEL -#undef SET_SENSITIVE -#undef SET_VISIBLE -} diff --git a/app/gui/gradient-editor-menu.h b/app/gui/gradient-editor-menu.h deleted file mode 100644 index 665009d218..0000000000 --- a/app/gui/gradient-editor-menu.h +++ /dev/null @@ -1,31 +0,0 @@ -/* The GIMP -- an image manipulation program - * Copyright (C) 1995 Spencer Kimball and Peter Mattis - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -#ifndef __GRADIENT_EDITOR_MENU_H__ -#define __GRADIENT_EDITOR_MENU_H__ - - -extern GimpItemFactoryEntry gradient_editor_menu_entries[]; -extern gint n_gradient_editor_menu_entries; - - -void gradient_editor_menu_update (GtkItemFactory *factory, - gpointer data); - - -#endif /* __GRADIENT_EDITOR_MENU_H__ */ diff --git a/app/gui/gradients-menu.c b/app/gui/gradients-menu.c deleted file mode 100644 index bfadf1c8c9..0000000000 --- a/app/gui/gradients-menu.c +++ /dev/null @@ -1,116 +0,0 @@ -/* The GIMP -- an image manipulation program - * Copyright (C) 1995 Spencer Kimball and Peter Mattis - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -#include "config.h" - -#include - -#include "libgimpwidgets/gimpwidgets.h" - -#include "gui-types.h" - -#include "core/gimpcontext.h" -#include "core/gimpdata.h" - -#include "widgets/gimpcontainereditor.h" -#include "widgets/gimpcontainerview.h" -#include "widgets/gimpdatafactoryview.h" -#include "widgets/gimphelp-ids.h" -#include "widgets/gimpitemfactory.h" - -#include "actions/data-commands.h" -#include "actions/gradients-commands.h" - -#include "gradients-menu.h" -#include "menus.h" - -#include "gimp-intl.h" - - -GimpItemFactoryEntry gradients_menu_entries[] = -{ - { { N_("/_Edit Gradient..."), NULL, - data_edit_data_cmd_callback, 0, - "", GIMP_STOCK_EDIT }, - NULL, - GIMP_HELP_GRADIENT_EDIT, NULL }, - - MENU_SEPARATOR ("/---"), - - { { N_("/_New Gradient"), "", - data_new_data_cmd_callback, 0, - "", GTK_STOCK_NEW }, - NULL, - GIMP_HELP_GRADIENT_NEW, NULL }, - { { N_("/D_uplicate Gradient"), NULL, - data_duplicate_data_cmd_callback, 0, - "", GIMP_STOCK_DUPLICATE }, - NULL, - GIMP_HELP_GRADIENT_DUPLICATE, NULL }, - { { N_("/Save as _POV-Ray..."), "", - gradients_save_as_pov_ray_cmd_callback, 0, - "", GTK_STOCK_SAVE_AS }, - NULL, - GIMP_HELP_GRADIENT_SAVE_AS_POV, NULL }, - { { N_("/_Delete Gradient..."), "", - data_delete_data_cmd_callback, 0, - "", GTK_STOCK_DELETE }, - NULL, - GIMP_HELP_GRADIENT_DELETE, NULL }, - - MENU_SEPARATOR ("/---"), - - { { N_("/_Refresh Gradients"), "", - data_refresh_data_cmd_callback, 0, - "", GTK_STOCK_REFRESH }, - NULL, - GIMP_HELP_GRADIENT_REFRESH, NULL } -}; - -gint n_gradients_menu_entries = G_N_ELEMENTS (gradients_menu_entries); - - -void -gradients_menu_update (GtkItemFactory *factory, - gpointer user_data) -{ - GimpContainerEditor *editor; - GimpGradient *gradient; - GimpData *data = NULL; - - editor = GIMP_CONTAINER_EDITOR (user_data); - - gradient = gimp_context_get_gradient (editor->view->context); - - if (gradient) - data = GIMP_DATA (gradient); - -#define SET_SENSITIVE(menu,condition) \ - gimp_item_factory_set_sensitive (factory, menu, (condition) != 0) - - SET_SENSITIVE ("/Edit Gradient...", - gradient && GIMP_DATA_FACTORY_VIEW (editor)->data_edit_func); - SET_SENSITIVE ("/Duplicate Gradient", - gradient && GIMP_DATA_GET_CLASS (data)->duplicate); - SET_SENSITIVE ("/Save as POV-Ray...", - gradient); - SET_SENSITIVE ("/Delete Gradient...", - gradient && data->deletable); - -#undef SET_SENSITIVE -} diff --git a/app/gui/gradients-menu.h b/app/gui/gradients-menu.h deleted file mode 100644 index 29bee20220..0000000000 --- a/app/gui/gradients-menu.h +++ /dev/null @@ -1,31 +0,0 @@ -/* The GIMP -- an image manipulation program - * Copyright (C) 1995 Spencer Kimball and Peter Mattis - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -#ifndef __GRADIENTS_MENU_H__ -#define __GRADIENTS_MENU_H__ - - -extern GimpItemFactoryEntry gradients_menu_entries[]; -extern gint n_gradients_menu_entries; - - -void gradients_menu_update (GtkItemFactory *factory, - gpointer data); - - -#endif /* __GRADIENTS_MENU_H__ */ diff --git a/app/gui/gui-vtable.c b/app/gui/gui-vtable.c index 2732d50c42..ef20eee882 100644 --- a/app/gui/gui-vtable.c +++ b/app/gui/gui-vtable.c @@ -38,7 +38,6 @@ #include "widgets/gimpactiongroup.h" #include "widgets/gimpdialogfactory.h" #include "widgets/gimperrorconsole.h" -#include "widgets/gimpitemfactory.h" #include "widgets/gimpuimanager.h" #include "widgets/gimpwidgets-utils.h" @@ -196,20 +195,20 @@ gui_display_new (GimpImage *gimage, { GimpDisplayShell *shell; GimpDisplay *gdisp; + GList *image_managers; + + image_managers = gimp_ui_managers_from_name (""); gdisp = gimp_display_new (gimage, scale, global_menu_factory, - gimp_item_factory_from_path ("")); + + image_managers->data); shell = GIMP_DISPLAY_SHELL (gdisp->shell); gimp_context_set_display (gimp_get_user_context (gimage->gimp), gdisp); -#if 0 gimp_ui_manager_update (shell->menubar_manager, shell); -#else - gimp_item_factory_update (shell->menubar_factory, shell); -#endif return GIMP_OBJECT (gdisp); } @@ -226,10 +225,7 @@ static void gui_menus_create_entry (Gimp *gimp, PlugInProcDef *proc_def) { - const gchar *progname; - const gchar *locale_domain; - const gchar *help_domain; - GList *list; + GList *list; for (list = gimp_action_groups_from_name ("plug-in"); list; @@ -252,13 +248,6 @@ gui_menus_create_entry (Gimp *gimp, plug_in_menus_add_proc (list->data, "/image-popup", proc_def); } } - - progname = plug_in_proc_def_get_progname (proc_def); - - locale_domain = plug_ins_locale_domain (gimp, progname, NULL); - help_domain = plug_ins_help_domain (gimp, progname, NULL); - - plug_in_menus_create_entry (NULL, proc_def, locale_domain, help_domain); } static void @@ -267,8 +256,6 @@ gui_menus_delete_entry (Gimp *gimp, { GList *list; - plug_in_menus_delete_entry (proc_def); - for (list = gimp_ui_managers_from_name (""); list; list = g_list_next (list)) diff --git a/app/gui/gui.c b/app/gui/gui.c index 0a74b9a27e..91bbaa117e 100644 --- a/app/gui/gui.c +++ b/app/gui/gui.c @@ -43,15 +43,16 @@ #include "tools/gimp-tools.h" +#include "widgets/gimpactiongroup.h" #include "widgets/gimpdevices.h" #include "widgets/gimpdevicestatus.h" #include "widgets/gimpdialogfactory.h" #include "widgets/gimpdnd.h" #include "widgets/gimphelp.h" #include "widgets/gimphelp-ids.h" -#include "widgets/gimpitemfactory.h" #include "widgets/gimpmenufactory.h" #include "widgets/gimpsessioninfo.h" +#include "widgets/gimpuimanager.h" #include "widgets/gimpwidgets-utils.h" #include "actions/actions.h" @@ -106,12 +107,9 @@ static void gui_image_disconnect (GimpImage *gimage, /* private variables */ -static Gimp *the_gui_gimp = NULL; - -static GQuark image_disconnect_handler_id = 0; - -static GimpItemFactory *toolbox_item_factory = NULL; -static GimpItemFactory *image_item_factory = NULL; +static Gimp *the_gui_gimp = NULL; +static GQuark image_disconnect_handler_id = 0; +static GimpUIManager *image_ui_manager = NULL; /* public functions */ @@ -342,17 +340,9 @@ gui_restore_after_callback (Gimp *gimp, if (gui_config->restore_accels) menus_restore (gimp); - toolbox_item_factory = gimp_menu_factory_menu_new (global_menu_factory, - "", - GTK_TYPE_MENU_BAR, - gimp, - TRUE); - - image_item_factory = gimp_menu_factory_menu_new (global_menu_factory, - "", - GTK_TYPE_MENU, - gimp, - TRUE); + image_ui_manager = gimp_menu_factory_manager_new (global_menu_factory, + "", + gimp, TRUE); gimp_devices_restore (gimp); @@ -379,9 +369,15 @@ gui_exit_callback (Gimp *gimp, if (! force && gimp_displays_dirty (gimp)) { GtkWidget *dialog; + GList *list; - gimp_item_factories_set_sensitive ("", "/File/Quit", FALSE); - gimp_item_factories_set_sensitive ("", "/File/Quit", FALSE); + for (list = gimp_action_groups_from_name ("file"); + list; + list = g_list_next (list)) + { + gimp_action_group_set_action_sensitive (list->data, "file-quit", + FALSE); + } dialog = gimp_query_boolean_box (_("Quit The GIMP?"), NULL, @@ -435,11 +431,8 @@ gui_exit_after_callback (Gimp *gimp, gimp_container_remove_handler (gimp->images, image_disconnect_handler_id); image_disconnect_handler_id = 0; - g_object_unref (toolbox_item_factory); - toolbox_item_factory = NULL; - - g_object_unref (image_item_factory); - image_item_factory = NULL; + g_object_unref (image_ui_manager); + image_ui_manager = NULL; menus_exit (gimp); actions_exit (gimp); @@ -468,8 +461,15 @@ gui_really_quit_callback (GtkWidget *button, } else { - gimp_item_factories_set_sensitive ("", "/File/Quit", TRUE); - gimp_item_factories_set_sensitive ("", "/File/Quit", TRUE); + GList *list; + + for (list = gimp_action_groups_from_name ("file"); + list; + list = g_list_next (list)) + { + gimp_action_group_set_action_sensitive (list->data, "file-quit", + TRUE); + } } } @@ -518,7 +518,7 @@ gui_display_changed (GimpContext *context, GimpDisplay *display, Gimp *gimp) { - gimp_item_factory_update (gimp_item_factory_from_path (""), display); + gimp_ui_manager_update (image_ui_manager, display); } static void diff --git a/app/gui/image-menu.c b/app/gui/image-menu.c index 2a1023516f..8864adaa6d 100644 --- a/app/gui/image-menu.c +++ b/app/gui/image-menu.c @@ -20,1755 +20,17 @@ #include -#include "libgimpwidgets/gimpwidgets.h" - #include "gui-types.h" -#include "config/gimpguiconfig.h" - -#include "core/gimp.h" -#include "core/gimpchannel.h" -#include "core/gimpcontext.h" -#include "core/gimpimage.h" -#include "core/gimplayer.h" -#include "core/gimplist.h" -#include "core/gimptoolinfo.h" -#include "core/gimpundostack.h" - -#include "plug-in/plug-ins.h" - -#include "text/gimptextlayer.h" - -#include "widgets/gimphelp-ids.h" -#include "widgets/gimpitemfactory.h" - -#include "display/gimpdisplay.h" -#include "display/gimpdisplayoptions.h" -#include "display/gimpdisplayshell.h" -#include "display/gimpdisplayshell-appearance.h" -#include "display/gimpdisplayshell-selection.h" - -#include "actions/dialogs-commands.h" -#include "actions/drawable-commands.h" -#include "actions/edit-commands.h" -#include "actions/file-commands.h" -#include "actions/image-commands.h" -#include "actions/layers-commands.h" -#include "actions/plug-in-commands.h" -#include "actions/select-commands.h" -#include "actions/tools-commands.h" -#include "actions/vectors-commands.h" -#include "actions/view-commands.h" - #include "image-menu.h" #include "menus.h" #include "plug-in-menus.h" -#include "gimp-intl.h" - - -#define VIEW_ZOOM_16_1 "/View/Zoom/16:1 (1600%)" -#define VIEW_ZOOM_8_1 "/View/Zoom/8:1 (800%)" -#define VIEW_ZOOM_4_1 "/View/Zoom/4:1 (400%)" -#define VIEW_ZOOM_2_1 "/View/Zoom/2:1 (200%)" -#define VIEW_ZOOM_1_1 "/View/Zoom/1:1 (100%)" -#define VIEW_ZOOM_1_2 "/View/Zoom/1:2 (50%)" -#define VIEW_ZOOM_1_4 "/View/Zoom/1:4 (25%)" -#define VIEW_ZOOM_1_8 "/View/Zoom/1:8 (12.5%)" -#define VIEW_ZOOM_1_16 "/View/Zoom/1:16 (6.25%)" - - -/* local function prototypes */ - -static void image_menu_buffer_changed (Gimp *gimp, - GimpItemFactory *item_factory); -static void image_menu_foreground_changed (GimpContext *context, - const GimpRGB *color, - GimpItemFactory *item_factory); -static void image_menu_background_changed (GimpContext *context, - const GimpRGB *color, - GimpItemFactory *item_factory); -static void image_menu_set_zoom (GtkItemFactory *item_factory, - GimpDisplayShell *shell); - - -GimpItemFactoryEntry image_menu_entries[] = -{ - { { "/tearoff", NULL, gimp_item_factory_tearoff_callback, 0, "" }, - NULL, NULL, NULL }, - - /* /File */ - - MENU_BRANCH (N_("/_File")), - - { { N_("/File/_New..."), "N", - file_new_cmd_callback, 1, - "", GTK_STOCK_NEW }, - NULL, - GIMP_HELP_FILE_NEW, NULL }, - { { N_("/File/_Open..."), "O", - file_open_cmd_callback, 1, - "", GTK_STOCK_OPEN }, - NULL, - GIMP_HELP_FILE_OPEN, NULL }, - - /* /File/Open Recent */ - - MENU_BRANCH (N_("/File/Open _Recent")), - - { { N_("/File/Open Recent/(None)"), NULL, NULL, 0 }, - NULL, NULL, NULL }, - - MENU_SEPARATOR ("/File/Open Recent/---"), - - { { N_("/File/Open Recent/Document _History"), "foo", - dialogs_create_dockable_cmd_callback, 0, - "", GTK_STOCK_OPEN }, - "gimp-document-list|gimp-document-grid", - GIMP_HELP_DOCUMENT_DIALOG, NULL }, - - MENU_SEPARATOR ("/File/---"), - - { { N_("/File/_Save"), "S", - file_save_cmd_callback, 0, - "", GTK_STOCK_SAVE }, - NULL, - GIMP_HELP_FILE_SAVE, NULL }, - { { N_("/File/Save _as..."), "S", - file_save_as_cmd_callback, 0, - "", GTK_STOCK_SAVE_AS }, - NULL, - GIMP_HELP_FILE_SAVE_AS, NULL }, - { { N_("/File/Save a Cop_y..."), NULL, - file_save_a_copy_cmd_callback, 0 }, - NULL, - GIMP_HELP_FILE_SAVE_A_COPY, NULL }, - { { N_("/File/Save as _Template..."), NULL, - file_save_template_cmd_callback, 0 }, - NULL, - GIMP_HELP_FILE_SAVE_AS_TEMPLATE, NULL }, - { { N_("/File/Re_vert"), NULL, - file_revert_cmd_callback, 0, - "", GTK_STOCK_REVERT_TO_SAVED }, - NULL, - GIMP_HELP_FILE_REVERT, NULL }, - - MENU_SEPARATOR ("/File/---"), - - { { N_( "/File/_Close"), "W", - file_close_cmd_callback, 0, - "", GTK_STOCK_CLOSE }, - NULL, - GIMP_HELP_FILE_CLOSE, NULL }, - { { N_("/File/_Quit"), "Q", - file_quit_cmd_callback, 0, - "", GTK_STOCK_QUIT }, - NULL, - GIMP_HELP_FILE_QUIT, NULL }, - - MENU_SEPARATOR ("/File/---moved"), - - /* /Edit */ - - MENU_BRANCH (N_("/_Edit")), - - { { N_("/Edit/_Undo"), "Z", - edit_undo_cmd_callback, 0, - "", GTK_STOCK_UNDO }, - NULL, - GIMP_HELP_EDIT_UNDO, NULL }, - { { N_("/Edit/_Redo"), "Y", - edit_redo_cmd_callback, 0, - "", GTK_STOCK_REDO }, - NULL, - GIMP_HELP_EDIT_REDO, NULL }, - { { N_("/Edit/Undo _History"), NULL, - dialogs_create_dockable_cmd_callback, 0, - "", GIMP_STOCK_UNDO_HISTORY }, - "gimp-undo-history", - GIMP_HELP_UNDO_DIALOG, NULL }, - - MENU_SEPARATOR ("/Edit/---"), - - { { N_("/Edit/Cu_t"), "X", - edit_cut_cmd_callback, 0, - "", GTK_STOCK_CUT }, - NULL, - GIMP_HELP_EDIT_CUT, NULL }, - { { N_("/Edit/_Copy"), "C", - edit_copy_cmd_callback, 0, - "", GTK_STOCK_COPY }, - NULL, - GIMP_HELP_EDIT_COPY, NULL }, - { { N_("/Edit/_Paste"), "V", - edit_paste_cmd_callback, 0, - "", GTK_STOCK_PASTE }, - NULL, - GIMP_HELP_EDIT_PASTE, NULL }, - { { N_("/Edit/Paste _Into"), NULL, - edit_paste_into_cmd_callback, 0, - "", GIMP_STOCK_PASTE_INTO }, - NULL, - GIMP_HELP_EDIT_PASTE_INTO, NULL }, - { { N_("/Edit/Paste as _New"), NULL, - edit_paste_as_new_cmd_callback, 0, - "", GIMP_STOCK_PASTE_AS_NEW }, - NULL, - GIMP_HELP_EDIT_PASTE_AS_NEW, NULL }, - - /* /Edit/Buffer */ - - MENU_BRANCH (N_("/Edit/_Buffer")), - - { { N_("/Edit/Buffer/Cu_t Named..."), "X", - edit_named_cut_cmd_callback, 0, - "", GTK_STOCK_CUT }, - NULL, - GIMP_HELP_BUFFER_CUT, NULL }, - { { N_("/Edit/Buffer/_Copy Named..."), "C", - edit_named_copy_cmd_callback, 0, - "", GTK_STOCK_COPY }, - NULL, - GIMP_HELP_BUFFER_COPY, NULL }, - { { N_("/Edit/Buffer/_Paste Named..."), "V", - edit_named_paste_cmd_callback, 0, - "", GTK_STOCK_PASTE }, - NULL, - GIMP_HELP_BUFFER_PASTE, NULL }, - - MENU_SEPARATOR ("/Edit/---"), - - { { N_("/Edit/Cl_ear"), "K", - edit_clear_cmd_callback, 0, - "", GTK_STOCK_CLEAR }, - NULL, - GIMP_HELP_EDIT_CLEAR, NULL }, - { { N_("/Edit/Fill with _FG Color"), "comma", - edit_fill_cmd_callback, (guint) GIMP_FOREGROUND_FILL, - "", GIMP_STOCK_TOOL_BUCKET_FILL }, - NULL, - GIMP_HELP_EDIT_FILL_FG, NULL }, - { { N_("/Edit/Fill with B_G Color"), "period", - edit_fill_cmd_callback, (guint) GIMP_BACKGROUND_FILL, - "", GIMP_STOCK_TOOL_BUCKET_FILL }, - NULL, - GIMP_HELP_EDIT_FILL_BG, NULL }, - { { N_("/Edit/Fill with P_attern"), NULL, - edit_fill_cmd_callback, (guint) GIMP_PATTERN_FILL, - "", GIMP_STOCK_TOOL_BUCKET_FILL }, - NULL, - GIMP_HELP_EDIT_FILL_PATTERN, NULL }, - { { N_("/Edit/_Stroke Selection..."), NULL, - edit_stroke_cmd_callback, 0, - "", GIMP_STOCK_SELECTION_STROKE }, - NULL, - GIMP_HELP_SELECTION_STROKE, NULL }, - { { N_("/Edit/St_roke Path..."), NULL, - vectors_stroke_cmd_callback, 0, - "", GIMP_STOCK_PATH_STROKE }, - NULL, - GIMP_HELP_PATH_STROKE, NULL }, - - MENU_SEPARATOR ("/Edit/---"), - - /* /Select */ - - MENU_BRANCH (N_("/_Select")), - - { { N_("/Select/_All"), "A", - select_all_cmd_callback, 0, - "", GIMP_STOCK_SELECTION_ALL }, - NULL, - GIMP_HELP_SELECTION_ALL, NULL }, - { { N_("/Select/_None"), "A", - select_none_cmd_callback, 0, - "", GIMP_STOCK_SELECTION_NONE }, - NULL, - GIMP_HELP_SELECTION_NONE, NULL }, - { { N_("/Select/_Invert"), "I", - select_invert_cmd_callback, 0, - "", GIMP_STOCK_INVERT }, - NULL, - GIMP_HELP_SELECTION_INVERT, NULL }, - { { N_("/Select/Fr_om Path"), "V", - select_from_vectors_cmd_callback, 0, - "", GIMP_STOCK_SELECTION_REPLACE }, - NULL, - GIMP_HELP_SELECTION_NONE, NULL }, - { { N_("/Select/_Float"), "L", - select_float_cmd_callback, 0, - "", GIMP_STOCK_FLOATING_SELECTION }, - NULL, - GIMP_HELP_SELECTION_FLOAT, NULL }, - { { N_("/Select/_By Color"), "O", - tools_select_cmd_callback, 0, - "", GIMP_STOCK_TOOL_BY_COLOR_SELECT }, - "gimp-by-color-select-tool", - GIMP_HELP_TOOL_BY_COLOR_SELECT, NULL }, - - MENU_SEPARATOR ("/Select/---"), - - { { N_("/Select/Fea_ther..."), NULL, - select_feather_cmd_callback, 0 }, - NULL, - GIMP_HELP_SELECTION_FEATHER, NULL }, - { { N_("/Select/_Sharpen"), NULL, - select_sharpen_cmd_callback, 0 }, - NULL, - GIMP_HELP_SELECTION_SHARPEN, NULL }, - { { N_("/Select/S_hrink..."), NULL, - select_shrink_cmd_callback, 0, - "", GIMP_STOCK_SELECTION_SHRINK }, - NULL, - GIMP_HELP_SELECTION_SHRINK, NULL }, - { { N_("/Select/_Grow..."), NULL, - select_grow_cmd_callback, 0, - "", GIMP_STOCK_SELECTION_GROW }, - NULL, - GIMP_HELP_SELECTION_GROW, NULL }, - { { N_("/Select/Bo_rder..."), NULL, - select_border_cmd_callback, 0, - "", GIMP_STOCK_SELECTION_BORDER }, - NULL, - GIMP_HELP_SELECTION_BORDER, NULL }, - - MENU_SEPARATOR ("/Select/---"), - - { { N_("/Select/Toggle _QuickMask"), "Q", - select_toggle_quickmask_cmd_callback, 0, - "", GIMP_STOCK_QMASK_ON }, - NULL, - GIMP_HELP_QMASK_TOGGLE, NULL }, - { { N_("/Select/Save to _Channel"), NULL, - select_save_cmd_callback, 0, - "", GIMP_STOCK_SELECTION_TO_CHANNEL }, - NULL, - GIMP_HELP_SELECTION_TO_CHANNEL, NULL }, - { { N_("/Select/To _Path"), NULL, - vectors_selection_to_vectors_cmd_callback, 0, - "", GIMP_STOCK_SELECTION_TO_PATH }, - NULL, - GIMP_HELP_SELECTION_TO_PATH, NULL }, - - /* /View */ - - MENU_BRANCH (N_("/_View")), - - { { N_("/View/_New View"), "", - view_new_view_cmd_callback, 0, - "", GTK_STOCK_NEW }, - NULL, - GIMP_HELP_VIEW_NEW, NULL }, - { { N_("/View/_Dot for Dot"), NULL, - view_dot_for_dot_cmd_callback, 0, "" }, - NULL, - GIMP_HELP_VIEW_DOT_FOR_DOT, NULL }, - - /* /View/Zoom */ - - MENU_BRANCH (N_("/View/_Zoom")), - - { { N_("/View/Zoom/Zoom _Out"), "minus", - view_zoom_out_cmd_callback, 0, - "", GTK_STOCK_ZOOM_OUT }, - NULL, - GIMP_HELP_VIEW_ZOOM_OUT, NULL }, - { { N_("/View/Zoom/Zoom _In"), "plus", - view_zoom_in_cmd_callback, 0, - "", GTK_STOCK_ZOOM_IN }, - NULL, - GIMP_HELP_VIEW_ZOOM_IN, NULL }, - { { N_("/View/Zoom/Zoom to _Fit Window"), "E", - view_zoom_fit_cmd_callback, 0, - "", GTK_STOCK_ZOOM_FIT }, - NULL, - GIMP_HELP_VIEW_ZOOM_FIT, NULL }, - - MENU_SEPARATOR ("/View/Zoom/---"), - - { { N_("/View/Zoom/16:1 (1600%)"), NULL, - view_zoom_cmd_callback, 160000, "" }, - NULL, - GIMP_HELP_VIEW_ZOOM_IN, NULL }, - { { N_("/View/Zoom/8:1 (800%)"), NULL, - view_zoom_cmd_callback, 80000, VIEW_ZOOM_16_1 }, - NULL, - GIMP_HELP_VIEW_ZOOM_IN, NULL }, - { { N_("/View/Zoom/4:1 (400%)"), NULL, - view_zoom_cmd_callback, 40000, VIEW_ZOOM_16_1 }, - NULL, - GIMP_HELP_VIEW_ZOOM_IN, NULL }, - { { N_("/View/Zoom/2:1 (200%)"), NULL, - view_zoom_cmd_callback, 20000, VIEW_ZOOM_16_1 }, - NULL, - GIMP_HELP_VIEW_ZOOM_IN, NULL }, - { { N_("/View/Zoom/1:1 (100%)"), "1", - view_zoom_cmd_callback, 10000, VIEW_ZOOM_16_1 }, - NULL, - GIMP_HELP_VIEW_ZOOM_100, NULL }, - { { N_("/View/Zoom/1:2 (50%)"), NULL, - view_zoom_cmd_callback, 5000, VIEW_ZOOM_16_1 }, - NULL, - GIMP_HELP_VIEW_ZOOM_OUT, NULL }, - { { N_("/View/Zoom/1:4 (25%)"), NULL, - view_zoom_cmd_callback, 2500, VIEW_ZOOM_16_1 }, - NULL, - GIMP_HELP_VIEW_ZOOM_OUT, NULL }, - { { N_("/View/Zoom/1:8 (12.5%)"), NULL, - view_zoom_cmd_callback, 1250, VIEW_ZOOM_16_1 }, - NULL, - GIMP_HELP_VIEW_ZOOM_OUT, NULL }, - { { N_("/View/Zoom/1:16 (6.25%)"), NULL, - view_zoom_cmd_callback, 625, VIEW_ZOOM_16_1 }, - NULL, - GIMP_HELP_VIEW_ZOOM_OUT, NULL }, - - MENU_SEPARATOR ("/View/Zoom/---"), - - { { "/View/Zoom/O_ther...", NULL, - view_zoom_other_cmd_callback, 0, VIEW_ZOOM_16_1 }, - NULL, - GIMP_HELP_VIEW_ZOOM_OTHER, NULL }, - - MENU_SEPARATOR ("/View/---"), - - { { N_("/View/_Info Window"), "I", - view_info_window_cmd_callback, 0, - "", GIMP_STOCK_INFO }, - NULL, - GIMP_HELP_INFO_DIALOG, NULL }, - { { N_("/View/Na_vigation Window"), "N", - view_navigation_window_cmd_callback, 0, - "", GIMP_STOCK_NAVIGATION }, - NULL, - GIMP_HELP_NAVIGATION_DIALOG, NULL }, - { { N_("/View/Display _Filters..."), NULL, - view_display_filters_cmd_callback, 0, - "", GIMP_STOCK_DISPLAY_FILTER }, - NULL, - GIMP_HELP_DISPLAY_FILTER_DIALOG, NULL }, - - MENU_SEPARATOR ("/View/---"), - - { { N_("/View/Show _Selection"), "T", - view_toggle_selection_cmd_callback, 0, "" }, - NULL, - GIMP_HELP_VIEW_SHOW_SELECTION, NULL }, - { { N_("/View/Show _Layer Boundary"), NULL, - view_toggle_layer_boundary_cmd_callback, 0, "" }, - NULL, - GIMP_HELP_VIEW_SHOW_LAYER_BOUNDARY, NULL }, - { { N_("/View/Show _Guides"), "T", - view_toggle_guides_cmd_callback, 0, "" }, - NULL, - GIMP_HELP_VIEW_SHOW_GUIDES, NULL }, - { { N_("/View/Sn_ap to Guides"), NULL, - view_snap_to_guides_cmd_callback, 0, "" }, - NULL, - GIMP_HELP_VIEW_SNAP_TO_GUIDES, NULL }, - { { N_("/View/S_how Grid"), NULL, - view_toggle_grid_cmd_callback, 0, "" }, - NULL, - GIMP_HELP_VIEW_SHOW_GRID, NULL }, - { { N_("/View/Sna_p to Grid"), NULL, - view_snap_to_grid_cmd_callback, 0, "" }, - NULL, - GIMP_HELP_VIEW_SNAP_TO_GRID, NULL }, - - MENU_SEPARATOR ("/View/---"), - - { { N_("/View/Show _Menubar"), NULL, - view_toggle_menubar_cmd_callback, 0, "" }, - NULL, - GIMP_HELP_VIEW_SHOW_MENUBAR, NULL }, - { { N_("/View/Show R_ulers"), "R", - view_toggle_rulers_cmd_callback, 0, "" }, - NULL, - GIMP_HELP_VIEW_SHOW_RULERS, NULL }, - { { N_("/View/Show Scroll_bars"), NULL, - view_toggle_scrollbars_cmd_callback, 0, "" }, - NULL, - GIMP_HELP_VIEW_SHOW_SCROLLBARS, NULL }, - { { N_("/View/Show S_tatusbar"), NULL, - view_toggle_statusbar_cmd_callback, 0, "" }, - NULL, - GIMP_HELP_VIEW_SHOW_STATUSBAR, NULL }, - - MENU_SEPARATOR ("/View/---"), - - { { N_("/View/Shrink _Wrap"), "E", - view_shrink_wrap_cmd_callback, 0 }, - NULL, - GIMP_HELP_VIEW_SHRINK_WRAP, NULL }, - - { { N_("/View/Fullscr_een"), "F11", - view_fullscreen_cmd_callback, 0, "" }, - NULL, - GIMP_HELP_VIEW_FULLSCREEN, NULL }, - - { { N_("/View/Move to Screen..."), NULL, - view_change_screen_cmd_callback, 0, - "", GIMP_STOCK_MOVE_TO_SCREEN }, - NULL, - GIMP_HELP_VIEW_CHANGE_SCREEN, NULL }, - - /* /Image */ - - MENU_BRANCH (N_("/_Image")), - - /* /Image/Mode */ - - MENU_BRANCH (N_("/Image/_Mode")), - - { { N_("/Image/Mode/_RGB"), NULL, - image_convert_rgb_cmd_callback, 0, - "", GIMP_STOCK_CONVERT_RGB }, - NULL, - GIMP_HELP_IMAGE_CONVERT_RGB, NULL }, - { { N_("/Image/Mode/_Grayscale"), NULL, - image_convert_grayscale_cmd_callback, 0, - "", GIMP_STOCK_CONVERT_GRAYSCALE }, - NULL, - GIMP_HELP_IMAGE_CONVERT_GRAYSCALE, NULL }, - { { N_("/Image/Mode/_Indexed..."), NULL, - image_convert_indexed_cmd_callback, 0, - "", GIMP_STOCK_CONVERT_INDEXED }, - NULL, - GIMP_HELP_IMAGE_CONVERT_INDEXED, NULL }, - - /* /Image/Transform */ - - MENU_BRANCH (N_("/Image/_Transform")), - - { { N_("/Image/Transform/Flip _Horizontally"), NULL, - image_flip_cmd_callback, GIMP_ORIENTATION_HORIZONTAL, - "", GIMP_STOCK_FLIP_HORIZONTAL }, - NULL, - GIMP_HELP_IMAGE_FLIP_HORIZONTAL, NULL }, - { { N_("/Image/Transform/Flip _Vertically"), NULL, - image_flip_cmd_callback, GIMP_ORIENTATION_VERTICAL, - "", GIMP_STOCK_FLIP_VERTICAL }, - NULL, - GIMP_HELP_IMAGE_FLIP_VERTICAL, NULL }, - - MENU_SEPARATOR ("/Image/Transform/---"), - - /* please use the degree symbol in the translation */ - { { N_("/Image/Transform/Rotate 90 degrees _CW"), NULL, - image_rotate_cmd_callback, GIMP_ROTATE_90, - "", GIMP_STOCK_ROTATE_90 }, - NULL, - GIMP_HELP_IMAGE_ROTATE_90, NULL }, - { { N_("/Image/Transform/Rotate 90 degrees CC_W"), NULL, - image_rotate_cmd_callback, GIMP_ROTATE_270, - "", GIMP_STOCK_ROTATE_270 }, - NULL, - GIMP_HELP_IMAGE_ROTATE_270, NULL }, - { { N_("/Image/Transform/Rotate _180 degrees"), NULL, - image_rotate_cmd_callback, GIMP_ROTATE_180, - "", GIMP_STOCK_ROTATE_180 }, - NULL, - GIMP_HELP_IMAGE_ROTATE_180, NULL }, - - MENU_SEPARATOR ("/Image/Transform/---"), - - MENU_SEPARATOR ("/Image/---"), - - { { N_("/Image/Can_vas Size..."), NULL, - image_resize_cmd_callback, 0, - "", GIMP_STOCK_RESIZE }, - NULL, - GIMP_HELP_IMAGE_RESIZE, NULL }, - { { N_("/Image/_Scale Image..."), NULL, - image_scale_cmd_callback, 0, - "", GIMP_STOCK_SCALE }, - NULL, - GIMP_HELP_IMAGE_SCALE, NULL }, - { { N_("/Image/_Crop Image"), NULL, - image_crop_cmd_callback, 0, - "", GIMP_STOCK_TOOL_CROP }, - NULL, - GIMP_HELP_IMAGE_CROP, NULL }, - { { N_("/Image/_Duplicate"), "D", - image_duplicate_cmd_callback, 0, - "", GIMP_STOCK_DUPLICATE }, - NULL, - GIMP_HELP_IMAGE_DUPLICATE, NULL }, - - MENU_SEPARATOR ("/Image/---"), - - { { N_("/Image/Merge Visible _Layers..."), "M", - image_merge_layers_cmd_callback, 0 }, - NULL, - GIMP_HELP_IMAGE_MERGE_LAYERS, NULL }, - { { N_("/Image/_Flatten Image"), NULL, - image_flatten_image_cmd_callback, 0 }, - NULL, - GIMP_HELP_IMAGE_FLATTEN, NULL }, - - MENU_SEPARATOR ("/Image/---"), - - { { N_("/Image/Configure G_rid..."), NULL, - image_configure_grid_cmd_callback, 0, - "", GIMP_STOCK_GRID }, - NULL, - GIMP_HELP_IMAGE_GRID, NULL }, - - /* /Layer */ - - MENU_BRANCH (N_("/_Layer")), - - { { N_("/Layer/_New Layer..."), "", - layers_new_cmd_callback, 0, - "", GTK_STOCK_NEW }, - NULL, - GIMP_HELP_LAYER_NEW, NULL }, - { { N_("/Layer/Du_plicate Layer"), NULL, - layers_duplicate_cmd_callback, 0, - "", GIMP_STOCK_DUPLICATE }, - NULL, - GIMP_HELP_LAYER_DUPLICATE, NULL }, - { { N_("/Layer/Anchor _Layer"), "H", - layers_anchor_cmd_callback, 0, - "", GIMP_STOCK_ANCHOR }, - NULL, - GIMP_HELP_LAYER_ANCHOR, NULL }, - { { N_("/Layer/Me_rge Down"), "M", - layers_merge_down_cmd_callback, 0, - "", GIMP_STOCK_MERGE_DOWN }, - NULL, - GIMP_HELP_LAYER_MERGE_DOWN, NULL }, - { { N_("/Layer/_Delete Layer"), NULL, - layers_delete_cmd_callback, 0, - "", GTK_STOCK_DELETE }, - NULL, - GIMP_HELP_LAYER_DELETE, NULL }, - { { N_("/Layer/Discard _Text Information"), NULL, - layers_text_discard_cmd_callback, 0, - "", GIMP_STOCK_TOOL_TEXT }, - NULL, - GIMP_HELP_LAYER_TEXT_DISCARD, NULL }, - - MENU_SEPARATOR ("/Layer/---"), - - /* /Layer/Stack */ - - MENU_BRANCH (N_("/Layer/Stac_k")), - - { { N_("/Layer/Stack/Select _Previous Layer"), "Prior", - layers_select_previous_cmd_callback, 0 }, - NULL, - GIMP_HELP_LAYER_PREVIOUS, NULL }, - { { N_("/Layer/Stack/Select _Next Layer"), "Next", - layers_select_next_cmd_callback, 0 }, - NULL, - GIMP_HELP_LAYER_NEXT, NULL }, - { { N_("/Layer/Stack/Select _Top Layer"), "Home", - layers_select_top_cmd_callback, 0 }, - NULL, - GIMP_HELP_LAYER_TOP, NULL }, - { { N_("/Layer/Stack/Select _Bottom Layer"), "End", - layers_select_bottom_cmd_callback, 0 }, - NULL, - GIMP_HELP_LAYER_BOTTOM, NULL }, - - MENU_SEPARATOR ("/Layer/Stack/---"), - - { { N_("/Layer/Stack/_Raise Layer"), "Prior", - layers_raise_cmd_callback, 0, - "", GTK_STOCK_GO_UP }, - NULL, - GIMP_HELP_LAYER_RAISE, NULL }, - { { N_("/Layer/Stack/_Lower Layer"), "Next", - layers_lower_cmd_callback, 0, - "", GTK_STOCK_GO_DOWN }, - NULL, - GIMP_HELP_LAYER_LOWER, NULL }, - { { N_("/Layer/Stack/Layer to T_op"), "Home", - layers_raise_to_top_cmd_callback, 0, - "", GTK_STOCK_GOTO_TOP }, - NULL, - GIMP_HELP_LAYER_RAISE_TO_TOP, NULL }, - { { N_("/Layer/Stack/Layer to Botto_m"), "End", - layers_lower_to_bottom_cmd_callback, 0, - "", GTK_STOCK_GOTO_BOTTOM }, - NULL, - GIMP_HELP_LAYER_LOWER_TO_BOTTOM, NULL }, - - /* /Layer/Colors */ - - MENU_BRANCH (N_("/Layer/_Colors")), - - { { N_("/Layer/Colors/Color _Balance..."), NULL, - tools_select_cmd_callback, 0, - "", GIMP_STOCK_TOOL_COLOR_BALANCE }, - "gimp-color-balance-tool", - GIMP_HELP_TOOL_COLOR_BALANCE, NULL }, - { { N_("/Layer/Colors/Hue-_Saturation..."), NULL, - tools_select_cmd_callback, 0, - "", GIMP_STOCK_TOOL_HUE_SATURATION }, - "gimp-hue-saturation-tool", - GIMP_HELP_TOOL_HUE_SATURATION, NULL }, - { { N_("/Layer/Colors/Colori_ze..."), NULL, - tools_select_cmd_callback, 0, - "", GIMP_STOCK_TOOL_COLORIZE }, - "gimp-colorize-tool", - GIMP_HELP_TOOL_COLORIZE, NULL }, - { { N_("/Layer/Colors/B_rightness-Contrast..."), NULL, - tools_select_cmd_callback, 0, - "", GIMP_STOCK_TOOL_BRIGHTNESS_CONTRAST }, - "gimp-brightness-contrast-tool", - GIMP_HELP_TOOL_BRIGHTNESS_CONTRAST, NULL }, - { { N_("/Layer/Colors/_Threshold..."), NULL, - tools_select_cmd_callback, 0, - "", GIMP_STOCK_TOOL_THRESHOLD }, - "gimp-threshold-tool", - GIMP_HELP_TOOL_THRESHOLD, NULL }, - { { N_("/Layer/Colors/_Levels..."), NULL, - tools_select_cmd_callback, 0, - "", GIMP_STOCK_TOOL_LEVELS }, - "gimp-levels-tool", - GIMP_HELP_TOOL_LEVELS, NULL }, - { { N_("/Layer/Colors/_Curves..."), NULL, - tools_select_cmd_callback, 0, - "", GIMP_STOCK_TOOL_CURVES }, - "gimp-curves-tool", - GIMP_HELP_TOOL_CURVES, NULL }, - { { N_("/Layer/Colors/_Posterize..."), NULL, - tools_select_cmd_callback, 0, - "", GIMP_STOCK_TOOL_POSTERIZE }, - "gimp-posterize-tool", - GIMP_HELP_TOOL_POSTERIZE, NULL }, - - MENU_SEPARATOR ("/Layer/Colors/---"), - - { { N_("/Layer/Colors/_Desaturate"), NULL, - drawable_desaturate_cmd_callback, 0, - "", GIMP_STOCK_CONVERT_GRAYSCALE }, - NULL, - GIMP_HELP_LAYER_DESATURATE, NULL }, - { { N_("/Layer/Colors/In_vert"), NULL, - drawable_invert_cmd_callback, 0, - "", GIMP_STOCK_INVERT }, - NULL, - GIMP_HELP_LAYER_INVERT, NULL }, - - /* /Layer/Colors/Auto */ - - MENU_BRANCH (N_("/Layer/Colors/_Auto")), - - { { N_("/Layer/Colors/Auto/_Equalize"), NULL, - drawable_equalize_cmd_callback, 0 }, - NULL, - GIMP_HELP_LAYER_EQUALIZE, NULL }, - - MENU_SEPARATOR ("/Layer/Colors/---"), - - { { N_("/Layer/Colors/_Histogram"), NULL, - dialogs_create_dockable_cmd_callback, 0, - "", GIMP_STOCK_HISTOGRAM }, - "gimp-histogram-editor", - GIMP_HELP_HISTOGRAM_DIALOG, NULL }, - - /* /Layer/Mask */ - - MENU_BRANCH (N_("/Layer/_Mask")), - - { { N_("/Layer/Mask/_Add Layer Mask..."), NULL, - layers_mask_add_cmd_callback, 0, - "", GIMP_STOCK_LAYER_MASK }, - NULL, - GIMP_HELP_LAYER_MASK_ADD, NULL }, - { { N_("/Layer/Mask/A_pply Layer Mask"), NULL, - layers_mask_apply_cmd_callback, 0 }, - NULL, - GIMP_HELP_LAYER_MASK_APPLY, NULL }, - { { N_("/Layer/Mask/_Delete Layer Mask"), NULL, - layers_mask_delete_cmd_callback, 0, - "", GTK_STOCK_DELETE }, - NULL, - GIMP_HELP_LAYER_MASK_DELETE, NULL }, - - MENU_SEPARATOR ("/Layer/Mask/---"), - - { { N_("/Layer/Mask/_Mask to Selection"), NULL, - layers_mask_to_selection_cmd_callback, GIMP_CHANNEL_OP_REPLACE, - "", GIMP_STOCK_SELECTION_REPLACE }, - NULL, - GIMP_HELP_LAYER_MASK_SELECTION_REPLACE, NULL }, - { { N_("/Layer/Mask/_Add to Selection"), NULL, - layers_mask_to_selection_cmd_callback, GIMP_CHANNEL_OP_ADD, - "", GIMP_STOCK_SELECTION_ADD }, - NULL, - GIMP_HELP_LAYER_MASK_SELECTION_ADD, NULL }, - { { N_("/Layer/Mask/_Subtract from Selection"), NULL, - layers_mask_to_selection_cmd_callback, GIMP_CHANNEL_OP_SUBTRACT, - "", GIMP_STOCK_SELECTION_SUBTRACT }, - NULL, - GIMP_HELP_LAYER_MASK_SELECTION_SUBTRACT, NULL }, - { { N_("/Layer/Mask/_Intersect with Selection"), NULL, - layers_mask_to_selection_cmd_callback, GIMP_CHANNEL_OP_INTERSECT, - "", GIMP_STOCK_SELECTION_INTERSECT }, - NULL, - GIMP_HELP_LAYER_MASK_SELECTION_INTERSECT, NULL }, - - /* /Layer/Transparency */ - - MENU_BRANCH (N_("/Layer/Tr_ansparency")), - - { { N_("/Layer/Transparency/_Add Alpha Channel"), NULL, - layers_alpha_add_cmd_callback, 0, - "", GIMP_STOCK_TRANSPARENCY }, - NULL, - GIMP_HELP_LAYER_ALPHA_ADD, NULL }, - - MENU_SEPARATOR ("/Layer/Transparency/---"), - - { { N_("/Layer/Transparency/Al_pha to Selection"), NULL, - layers_alpha_to_selection_cmd_callback, GIMP_CHANNEL_OP_REPLACE, - "", GIMP_STOCK_SELECTION_REPLACE }, - NULL, - GIMP_HELP_LAYER_ALPHA_SELECTION_REPLACE, NULL }, - { { N_("/Layer/Transparency/A_dd to Selection"), NULL, - layers_alpha_to_selection_cmd_callback, GIMP_CHANNEL_OP_ADD, - "", GIMP_STOCK_SELECTION_ADD }, - NULL, - GIMP_HELP_LAYER_ALPHA_SELECTION_ADD, NULL }, - { { N_("/Layer/Transparency/_Subtract from Selection"), NULL, - layers_alpha_to_selection_cmd_callback, GIMP_CHANNEL_OP_SUBTRACT, - "", GIMP_STOCK_SELECTION_SUBTRACT }, - NULL, - GIMP_HELP_LAYER_ALPHA_SELECTION_SUBTRACT, NULL }, - { { N_("/Layer/Transparency/_Intersect with Selection"), NULL, - layers_alpha_to_selection_cmd_callback, GIMP_CHANNEL_OP_INTERSECT, - "", GIMP_STOCK_SELECTION_INTERSECT }, - NULL, - GIMP_HELP_LAYER_ALPHA_SELECTION_INTERSECT, NULL }, - - MENU_SEPARATOR ("/Layer/Transparency/---"), - - /* /Layer/Transform */ - - MENU_BRANCH (N_("/Layer/_Transform")), - - { { N_("/Layer/Transform/Flip _Horizontally"), NULL, - drawable_flip_cmd_callback, GIMP_ORIENTATION_HORIZONTAL, - "", GIMP_STOCK_FLIP_HORIZONTAL }, - NULL, - GIMP_HELP_LAYER_FLIP_HORIZONTAL, NULL }, - { { N_("/Layer/Transform/Flip _Vertically"), NULL, - drawable_flip_cmd_callback, GIMP_ORIENTATION_VERTICAL, - "", GIMP_STOCK_FLIP_VERTICAL }, - NULL, - GIMP_HELP_LAYER_FLIP_VERTICAL, NULL }, - - MENU_SEPARATOR ("/Layer/Transform/---"), - - { { N_("/Layer/Transform/Rotate 90 degrees _CW"), NULL, - drawable_rotate_cmd_callback, GIMP_ROTATE_90, - "", GIMP_STOCK_ROTATE_90 }, - NULL, - GIMP_HELP_LAYER_ROTATE_90, NULL }, - { { N_("/Layer/Transform/Rotate 90 degrees CC_W"), NULL, - drawable_rotate_cmd_callback, GIMP_ROTATE_270, - "", GIMP_STOCK_ROTATE_270 }, - NULL, - GIMP_HELP_LAYER_ROTATE_270, NULL }, - { { N_("/Layer/Transform/Rotate _180 degrees"), NULL, - drawable_rotate_cmd_callback, GIMP_ROTATE_180, - "", GIMP_STOCK_ROTATE_180 }, - NULL, - GIMP_HELP_LAYER_ROTATE_180, NULL }, - { { N_("/Layer/Transform/_Arbitrary Rotation..."), NULL, - tools_select_cmd_callback, 0, - "", GIMP_STOCK_TOOL_ROTATE }, - "gimp-rotate-tool", - GIMP_HELP_TOOL_ROTATE, NULL }, - - MENU_SEPARATOR ("/Layer/Transform/---"), - - { { N_("/Layer/Transform/_Offset..."), "O", - drawable_offset_cmd_callback, 0 }, - NULL, - GIMP_HELP_LAYER_OFFSET, NULL }, - - MENU_SEPARATOR ("/Layer/---"), - - { { N_("/Layer/Layer _Boundary Size..."), NULL, - layers_resize_cmd_callback, 0, - "", GIMP_STOCK_RESIZE }, - NULL, - GIMP_HELP_LAYER_RESIZE, NULL }, - { { N_("/Layer/Layer to _Image Size"), NULL, - layers_resize_to_image_cmd_callback, 0, - "", GIMP_STOCK_LAYER_TO_IMAGESIZE }, - NULL, - GIMP_HELP_LAYER_RESIZE_TO_IMAGE, NULL }, - { { N_("/Layer/_Scale Layer..."), NULL, - layers_scale_cmd_callback, 0, - "", GIMP_STOCK_SCALE }, - NULL, - GIMP_HELP_LAYER_SCALE, NULL }, - { { N_("/Layer/Cr_op Layer"), NULL, - layers_crop_cmd_callback, 0, - "", GIMP_STOCK_TOOL_CROP }, - NULL, - GIMP_HELP_LAYER_CROP, NULL }, - - MENU_SEPARATOR ("/Layer/---"), - - /* /Tools */ - - MENU_BRANCH (N_("/_Tools")), - - { { N_("/Tools/Tool_box"), NULL, - dialogs_show_toolbox_cmd_callback, 0 }, - NULL, - GIMP_HELP_TOOLBOX, NULL }, - { { N_("/Tools/_Default Colors"), "D", - tools_default_colors_cmd_callback, 0, - "", GIMP_STOCK_DEFAULT_COLORS }, - NULL, - GIMP_HELP_TOOLBOX_DEFAULT_COLORS, NULL }, - { { N_("/Tools/S_wap Colors"), "X", - tools_swap_colors_cmd_callback, 0, - "", GIMP_STOCK_SWAP_COLORS }, - NULL, - GIMP_HELP_TOOLBOX_SWAP_COLORS, NULL }, - - MENU_SEPARATOR ("/Tools/---"), - - MENU_BRANCH (N_("/Tools/_Selection Tools")), - MENU_BRANCH (N_("/Tools/_Paint Tools")), - MENU_BRANCH (N_("/Tools/_Transform Tools")), - MENU_BRANCH (N_("/Tools/_Color Tools")), - - /* /Dialogs */ - - MENU_BRANCH (N_("/_Dialogs")), - - MENU_BRANCH (N_("/Dialogs/Create New Doc_k")), - - { { N_("/Dialogs/Create New Dock/_Layers, Channels & Paths"), NULL, - dialogs_create_lc_cmd_callback, 0 }, - NULL, - NULL, NULL }, - { { N_("/Dialogs/Create New Dock/_Brushes, Patterns & Gradients"), NULL, - dialogs_create_data_cmd_callback, 0 }, - NULL, - NULL, NULL }, - { { N_("/Dialogs/Create New Dock/_Misc. Stuff"), NULL, - dialogs_create_stuff_cmd_callback, 0 }, - NULL, - NULL, NULL }, - - { { N_("/Dialogs/Tool _Options"), NULL, - dialogs_create_dockable_cmd_callback, 0, - "", GIMP_STOCK_TOOL_OPTIONS }, - "gimp-tool-options", - GIMP_HELP_TOOL_OPTIONS_DIALOG, NULL }, - { { N_("/Dialogs/_Device Status"), NULL, - dialogs_create_dockable_cmd_callback, 0, - "", GIMP_STOCK_DEVICE_STATUS }, - "gimp-device-status", - GIMP_HELP_DEVICE_STATUS_DIALOG, NULL }, - - MENU_SEPARATOR ("/Dialogs/---"), - - { { N_("/Dialogs/_Layers"), "L", - dialogs_create_dockable_cmd_callback, 0, - "", GIMP_STOCK_LAYERS }, - "gimp-layer-list", - GIMP_HELP_LAYER_DIALOG, NULL }, - { { N_("/Dialogs/_Channels"), NULL, - dialogs_create_dockable_cmd_callback, 0, - "", GIMP_STOCK_CHANNELS }, - "gimp-channel-list", - GIMP_HELP_CHANNEL_DIALOG, NULL }, - { { N_("/Dialogs/_Paths"), NULL, - dialogs_create_dockable_cmd_callback, 0, - "", GIMP_STOCK_PATHS }, - "gimp-vectors-list", - GIMP_HELP_PATH_DIALOG, NULL }, - { { N_("/Dialogs/Inde_xed Palette"), NULL, - dialogs_create_dockable_cmd_callback, 0, - "", GIMP_STOCK_INDEXED_PALETTE }, - "gimp-indexed-palette", - GIMP_HELP_INDEXED_PALETTE_DIALOG, NULL }, - { { N_("/Dialogs/Histogra_m"), NULL, - dialogs_create_dockable_cmd_callback, 0, - "", GIMP_STOCK_HISTOGRAM }, - "gimp-histogram-editor", - GIMP_HELP_HISTOGRAM_DIALOG, NULL }, - { { N_("/Dialogs/_Selection Editor"), NULL, - dialogs_create_dockable_cmd_callback, 0, - "", GIMP_STOCK_TOOL_RECT_SELECT }, - "gimp-selection-editor", - GIMP_HELP_SELECTION_DIALOG, NULL }, - { { N_("/Dialogs/Na_vigation"), NULL, - dialogs_create_dockable_cmd_callback, 0, - "", GIMP_STOCK_NAVIGATION }, - "gimp-navigation-view", - GIMP_HELP_NAVIGATION_DIALOG, NULL }, - { { N_("/Dialogs/_Undo History"), NULL, - dialogs_create_dockable_cmd_callback, 0, - "", GIMP_STOCK_UNDO_HISTORY }, - "gimp-undo-history", - GIMP_HELP_UNDO_DIALOG, NULL }, - - MENU_SEPARATOR ("/Dialogs/---"), - - { { N_("/Dialogs/Colo_rs"), NULL, - dialogs_create_dockable_cmd_callback, 0, - "", GIMP_STOCK_DEFAULT_COLORS }, - "gimp-color-editor", - GIMP_HELP_COLOR_DIALOG, NULL }, - { { N_("/Dialogs/Brus_hes"), "B", - dialogs_create_dockable_cmd_callback, 0, - "", GIMP_STOCK_BRUSH }, - "gimp-brush-grid|gimp-brush-list", - GIMP_HELP_BRUSH_DIALOG, NULL }, - { { N_("/Dialogs/P_atterns"), "P", - dialogs_create_dockable_cmd_callback, 0, - "", GIMP_STOCK_PATTERN }, - "gimp-pattern-grid|gimp-pattern-list", - GIMP_HELP_PATTERN_DIALOG, NULL }, - { { N_("/Dialogs/_Gradients"), "G", - dialogs_create_dockable_cmd_callback, 0, - "", GIMP_STOCK_GRADIENT }, - "gimp-gradient-list|gimp-gradient-grid", - GIMP_HELP_GRADIENT_DIALOG, NULL }, - { { N_("/Dialogs/Pal_ettes"), "P", - dialogs_create_dockable_cmd_callback, 0, - "", GIMP_STOCK_PALETTE }, - "gimp-palette-list|gimp-palette-grid", - GIMP_HELP_PALETTE_DIALOG, NULL }, - { { N_("/Dialogs/_Fonts"), NULL, - dialogs_create_dockable_cmd_callback, 0, - "", GIMP_STOCK_FONT }, - "gimp-font-list|gimp-font-grid", - GIMP_HELP_FONT_DIALOG, NULL }, - { { N_("/Dialogs/_Buffers"), "foo", - dialogs_create_dockable_cmd_callback, 0, - "", GIMP_STOCK_BUFFER }, - "gimp-buffer-list|gimp-buffer-grid", - GIMP_HELP_BUFFER_DIALOG, NULL }, - - MENU_SEPARATOR ("/Dialogs/---"), - - { { N_("/Dialogs/_Images"), NULL, - dialogs_create_dockable_cmd_callback, 0, - "", GIMP_STOCK_IMAGES }, - "gimp-image-list|gimp-image-grid", - GIMP_HELP_IMAGE_DIALOG, NULL }, - { { N_("/Dialogs/Document Histor_y"), "", - dialogs_create_dockable_cmd_callback, 0, - "", GTK_STOCK_OPEN }, - "gimp-document-list|gimp-document-grid", - GIMP_HELP_DOCUMENT_DIALOG, NULL }, - { { N_("/Dialogs/_Templates"), NULL, - dialogs_create_dockable_cmd_callback, 0, - "", GIMP_STOCK_TEMPLATE }, - "gimp-template-list|gimp-template-grid", - GIMP_HELP_TEMPLATE_DIALOG, NULL }, - { { N_("/Dialogs/T_ools"), NULL, - dialogs_create_dockable_cmd_callback, 0, - "", GIMP_STOCK_TOOLS }, - "gimp-tool-list|gimp-tool-grid", - GIMP_HELP_TOOLS_DIALOG, NULL }, - { { N_("/Dialogs/Error Co_nsole"), NULL, - dialogs_create_dockable_cmd_callback, 0, - "", GIMP_STOCK_WARNING }, - "gimp-error-console", - GIMP_HELP_ERRORS_DIALOG, NULL }, - - - /* /Filters */ - - MENU_SEPARATOR ("/filters-separator"), - MENU_BRANCH (N_("/Filte_rs")), - - { { N_("/Filters/Repeat Last"), "F", - plug_in_repeat_cmd_callback, (guint) FALSE, - "", GTK_STOCK_EXECUTE }, - NULL, - GIMP_HELP_FILTER_REPEAT, NULL }, - { { N_("/Filters/Re-Show Last"), "F", - plug_in_repeat_cmd_callback, (guint) TRUE, - "", GIMP_STOCK_RESHOW_FILTER }, - NULL, - GIMP_HELP_FILTER_RESHOW, NULL }, - - MENU_SEPARATOR ("/Filters/---"), - - MENU_BRANCH (N_("/Filters/_Blur")), - MENU_BRANCH (N_("/Filters/_Colors")), - MENU_BRANCH (N_("/Filters/Colors/Ma_p")), - MENU_BRANCH (N_("/Filters/_Noise")), - MENU_BRANCH (N_("/Filters/Edge-De_tect")), - MENU_BRANCH (N_("/Filters/En_hance")), - MENU_BRANCH (N_("/Filters/_Generic")), - - MENU_SEPARATOR ("/Filters/---"), - - MENU_BRANCH (N_("/Filters/Gla_ss Effects")), - MENU_BRANCH (N_("/Filters/_Light Effects")), - MENU_BRANCH (N_("/Filters/_Distorts")), - MENU_BRANCH (N_("/Filters/_Artistic")), - MENU_BRANCH (N_("/Filters/_Map")), - MENU_BRANCH (N_("/Filters/_Render")), - MENU_BRANCH (N_("/Filters/Render/_Clouds")), - MENU_BRANCH (N_("/Filters/Render/_Nature")), - MENU_BRANCH (N_("/Filters/Render/_Pattern")), - MENU_BRANCH (N_("/Filters/_Web")), - - MENU_SEPARATOR ("/Filters/web-separator"), - - MENU_BRANCH (N_("/Filters/An_imation")), - MENU_BRANCH (N_("/Filters/C_ombine")), - - MENU_SEPARATOR ("/Filters/---"), - - MENU_BRANCH (N_("/Filters/To_ys")) -}; - -gint n_image_menu_entries = G_N_ELEMENTS (image_menu_entries); - void -image_menu_setup2 (GimpUIManager *manager, - const gchar *ui_path) +image_menu_setup (GimpUIManager *manager, + const gchar *ui_path) { menus_open_recent_add (manager, ui_path); plug_in_menus_setup (manager, ui_path); } - -void -image_menu_setup (GimpItemFactory *factory, - gpointer setup_data) -{ - if (GTK_IS_MENU_BAR (GTK_ITEM_FACTORY (factory)->widget)) - { - gimp_item_factory_set_visible (GTK_ITEM_FACTORY (factory), - "/filters-separator", FALSE); - } - - menus_last_opened_add (factory); - - /* create tool menu items */ - { - GimpToolInfo *tool_info; - GList *list; - - for (list = GIMP_LIST (factory->gimp->tool_info_list)->list; - list; - list = g_list_next (list)) - { - tool_info = GIMP_TOOL_INFO (list->data); - - if (tool_info->menu_path) - { - GimpItemFactoryEntry entry; - const gchar *stock_id; - const gchar *identifier; - - stock_id = gimp_viewable_get_stock_id (GIMP_VIEWABLE (tool_info)); - identifier = gimp_object_get_name (GIMP_OBJECT (tool_info)); - - entry.entry.path = tool_info->menu_path; - entry.entry.accelerator = tool_info->menu_accel; - entry.entry.callback = tools_select_cmd_callback; - entry.entry.callback_action = 0; - entry.entry.item_type = ""; - entry.entry.extra_data = stock_id; - entry.quark_string = identifier; - entry.help_id = tool_info->help_id; - entry.description = NULL; - - gimp_item_factory_create_item (factory, - &entry, - NULL, - factory->gimp, 2, FALSE); - } - } - } - - g_signal_connect_object (factory->gimp, "buffer_changed", - G_CALLBACK (image_menu_buffer_changed), - factory, 0); - - image_menu_buffer_changed (factory->gimp, factory); - - { - GimpContext *user_context; - GimpRGB fg; - GimpRGB bg; - - user_context = gimp_get_user_context (factory->gimp); - - g_signal_connect_object (user_context, "foreground_changed", - G_CALLBACK (image_menu_foreground_changed), - factory, 0); - g_signal_connect_object (user_context, "background_changed", - G_CALLBACK (image_menu_background_changed), - factory, 0); - - gimp_context_get_foreground (user_context, &fg); - gimp_context_get_background (user_context, &bg); - - image_menu_foreground_changed (user_context, &fg, factory); - image_menu_background_changed (user_context, &bg, factory); - } - - plug_in_menus_create (factory, factory->gimp->plug_in_proc_defs); - - { - static gchar *image_file_entries[] = { "---moved", - "Close", - "Quit" }; - static gchar *reorder_submenus[] = { "/Video", - "/Script-Fu" }; - static gchar *reorder_subsubmenus[] = { "/Filters" }; - - GtkWidget *menu_item; - GtkWidget *menu; - GList *list; - gchar *path; - gint i, pos; - - /* Move all menu items under "/Filters" which are not submenus or - * separators to the top of the menu - */ - pos = 3; - menu_item = gtk_item_factory_get_widget (GTK_ITEM_FACTORY (factory), - "/Filters/Filter all Layers..."); - if (menu_item && menu_item->parent && GTK_IS_MENU (menu_item->parent)) - { - menu = menu_item->parent; - - for (list = g_list_nth (GTK_MENU_SHELL (menu)->children, pos); - list; - list = g_list_next (list)) - { - menu_item = GTK_WIDGET (list->data); - - if (! GTK_MENU_ITEM (menu_item)->submenu && - GTK_IS_LABEL (GTK_BIN (menu_item)->child)) - { - gtk_menu_reorder_child (GTK_MENU (menu_item->parent), - menu_item, pos); - list = g_list_nth (GTK_MENU_SHELL (menu)->children, pos); - pos++; - } - } - } - - /* Reorder "/File" */ - for (i = 0; i < G_N_ELEMENTS (image_file_entries); i++) - { - path = g_strconcat ("/File/", image_file_entries[i], NULL); - menu_item = gtk_item_factory_get_widget (GTK_ITEM_FACTORY (factory), - path); - g_free (path); - - if (menu_item && menu_item->parent) - gtk_menu_reorder_child (GTK_MENU (menu_item->parent), menu_item, -1); - } - - /* Reorder menus where plugins registered submenus */ - for (i = 0; i < G_N_ELEMENTS (reorder_submenus); i++) - { - menu = gtk_item_factory_get_widget (GTK_ITEM_FACTORY (factory), - reorder_submenus[i]); - - if (menu && GTK_IS_MENU (menu)) - menus_filters_subdirs_to_top (GTK_MENU (menu)); - } - - for (i = 0; i < G_N_ELEMENTS (reorder_subsubmenus); i++) - { - menu = gtk_item_factory_get_widget (GTK_ITEM_FACTORY (factory), - reorder_subsubmenus[i]); - - if (menu && GTK_IS_MENU (menu)) - { - for (list = GTK_MENU_SHELL (menu)->children; list; - list = g_list_next (list)) - { - GtkMenuItem *menu_item; - - menu_item = GTK_MENU_ITEM (list->data); - - if (menu_item->submenu) - menus_filters_subdirs_to_top (GTK_MENU (menu_item->submenu)); - } - } - } - - /* Move all submenus which registered after "/Filters/Toys" - * before the separator after "/Filters/Web" - */ - menu_item = gtk_item_factory_get_widget (GTK_ITEM_FACTORY (factory), - "/Filters/web-separator"); - - if (menu_item && menu_item->parent && GTK_IS_MENU (menu_item->parent)) - { - menu = menu_item->parent; - pos = g_list_index (GTK_MENU_SHELL (menu)->children, menu_item); - - menu_item = gtk_item_factory_get_widget (GTK_ITEM_FACTORY (factory), - "/Filters/Toys"); - - if (menu_item && GTK_IS_MENU (menu_item)) - { - GList *list; - gint index = 1; - - for (list = GTK_MENU_SHELL (menu)->children; list; - list = g_list_next (list)) - { - if (GTK_MENU_ITEM (list->data)->submenu == menu_item) - break; - - index++; - } - - while ((menu_item = g_list_nth_data (GTK_MENU_SHELL (menu)->children, - index))) - { - gtk_menu_reorder_child (GTK_MENU (menu), menu_item, pos); - - pos++; - index++; - } - } - } - } -} - -void -image_menu_update (GtkItemFactory *item_factory, - gpointer data) -{ - Gimp *gimp = NULL; - GimpDisplay *gdisp = NULL; - GimpDisplayShell *shell = NULL; - GimpDisplayOptions *options = NULL; - GimpImage *gimage = NULL; - GimpDrawable *drawable = NULL; - GimpLayer *layer = NULL; - GimpVectors *vectors = NULL; - GimpImageType drawable_type = -1; - gboolean ad = FALSE; - gboolean is_rgb = FALSE; - gboolean is_gray = FALSE; - gboolean is_indexed = FALSE; - gboolean fs = FALSE; - gboolean aux = FALSE; - gboolean lm = FALSE; - gboolean lp = FALSE; - gboolean sel = FALSE; - gboolean alpha = FALSE; - gboolean text_layer = FALSE; - gint lind = -1; - gint lnum = -1; - gboolean fullscreen = FALSE; - gint n_screens = 1; - gboolean display_items = TRUE; - - gimp = GIMP_ITEM_FACTORY (item_factory)->gimp; - - if (! gtk_item_factory_get_item (item_factory, "/View/New View")) - display_items = FALSE; - - if (GIMP_IS_DISPLAY_SHELL (data)) - { - shell = GIMP_DISPLAY_SHELL (data); - gdisp = shell->gdisp; - } - else if (GIMP_IS_DISPLAY (data)) - { - gdisp = GIMP_DISPLAY (data); - shell = GIMP_DISPLAY_SHELL (gdisp->shell); - } - - if (gdisp) - { - GimpImageBaseType base_type; - - gimage = gdisp->gimage; - - base_type = gimp_image_base_type (gimage); - - is_rgb = (base_type == GIMP_RGB); - is_gray = (base_type == GIMP_GRAY); - is_indexed = (base_type == GIMP_INDEXED); - - fs = (gimp_image_floating_sel (gimage) != NULL); - aux = (gimp_image_get_active_channel (gimage) != NULL); - lp = ! gimp_image_is_empty (gimage); - sel = ! gimp_channel_is_empty (gimp_image_get_mask (gimage)); - - drawable = gimp_image_active_drawable (gimage); - if (drawable) - { - drawable_type = gimp_drawable_type (drawable); - ad = TRUE; - } - - if (lp) - { - layer = gimp_image_get_active_layer (gimage); - - if (layer) - { - lm = gimp_layer_get_mask (layer) ? TRUE : FALSE; - alpha = gimp_drawable_has_alpha (GIMP_DRAWABLE (layer)); - lind = gimp_image_get_layer_index (gimage, layer); - - text_layer = (GIMP_IS_TEXT_LAYER (layer) && - GIMP_TEXT_LAYER (layer)->text); - } - - lnum = gimp_container_num_children (gimage->layers); - } - - vectors = gimp_image_get_active_vectors (gimage); - - fullscreen = gimp_display_shell_get_fullscreen (shell); - - options = fullscreen ? shell->fullscreen_options : shell->options; - - n_screens = - gdk_display_get_n_screens (gtk_widget_get_display (GTK_WIDGET (shell))); - } - -#define SET_ACTIVE(menu,condition) \ - gimp_item_factory_set_active (item_factory, menu, (condition) != 0) -#define SET_VISIBLE(menu,condition) \ - gimp_item_factory_set_visible (item_factory, menu, (condition) != 0) -#define SET_LABEL(menu,label) \ - gimp_item_factory_set_label (item_factory, menu, (label)) -#define SET_SENSITIVE(menu,condition) \ - gimp_item_factory_set_sensitive (item_factory, menu, (condition) != 0) - - /* File */ - - SET_SENSITIVE ("/File/Save", gdisp && ad); - SET_SENSITIVE ("/File/Save as...", gdisp && ad); - SET_SENSITIVE ("/File/Save a Copy...", gdisp && ad); - SET_SENSITIVE ("/File/Save as Template...", gdisp); - SET_SENSITIVE ("/File/Revert", gdisp && GIMP_OBJECT (gimage)->name); - SET_SENSITIVE ("/File/Close", gdisp); - - /* Edit */ - - { - gchar *undo_name = NULL; - gchar *redo_name = NULL; - - if (gdisp && gimp_image_undo_is_enabled (gimage)) - { - GimpUndo *undo; - GimpUndo *redo; - - undo = gimp_undo_stack_peek (gimage->undo_stack); - redo = gimp_undo_stack_peek (gimage->redo_stack); - - if (undo) - undo_name = - g_strdup_printf (_("_Undo %s"), - gimp_object_get_name (GIMP_OBJECT (undo))); - - if (redo) - redo_name = - g_strdup_printf (_("_Redo %s"), - gimp_object_get_name (GIMP_OBJECT (redo))); - } - - SET_LABEL ("/Edit/Undo", undo_name ? undo_name : _("_Undo")); - SET_LABEL ("/Edit/Redo", redo_name ? redo_name : _("_Redo")); - - SET_SENSITIVE ("/Edit/Undo", undo_name); - SET_SENSITIVE ("/Edit/Redo", redo_name); - - g_free (undo_name); - g_free (redo_name); - } - - SET_SENSITIVE ("/Edit/Cut", ad); - SET_SENSITIVE ("/Edit/Copy", ad); - SET_SENSITIVE ("/Edit/Paste", gdisp && gimp->global_buffer); - SET_SENSITIVE ("/Edit/Paste Into", gdisp && gimp->global_buffer); - - SET_SENSITIVE ("/Edit/Buffer/Cut Named...", ad); - SET_SENSITIVE ("/Edit/Buffer/Copy Named...", ad); - - SET_SENSITIVE ("/Edit/Clear", ad); - SET_SENSITIVE ("/Edit/Fill with FG Color", ad); - SET_SENSITIVE ("/Edit/Fill with BG Color", ad); - SET_SENSITIVE ("/Edit/Fill with Pattern", ad); - SET_SENSITIVE ("/Edit/Stroke Selection...", ad && sel); - SET_SENSITIVE ("/Edit/Stroke Path...", ad && vectors); - - /* Select */ - - SET_SENSITIVE ("/Select/All", lp); - SET_SENSITIVE ("/Select/None", lp && sel); - SET_SENSITIVE ("/Select/Invert", lp && sel); - SET_SENSITIVE ("/Select/From Path", lp && vectors); - SET_SENSITIVE ("/Select/Float", lp && sel); - - if (display_items) - SET_SENSITIVE ("/Select/By Color", lp); - - SET_SENSITIVE ("/Select/Feather...", lp && sel); - SET_SENSITIVE ("/Select/Sharpen", lp && sel); - SET_SENSITIVE ("/Select/Shrink...", lp && sel); - SET_SENSITIVE ("/Select/Grow...", lp && sel); - SET_SENSITIVE ("/Select/Border...", lp && sel); - - if (display_items) - SET_SENSITIVE ("/Select/Toggle QuickMask", gdisp); - - SET_SENSITIVE ("/Select/Save to Channel", sel && !fs); - SET_SENSITIVE ("/Select/To Path", sel && !fs); - - /* View */ - - if (display_items) - { - SET_SENSITIVE ("/View/New View", gdisp); - - SET_SENSITIVE ("/View/Dot for Dot", gdisp); - SET_ACTIVE ("/View/Dot for Dot", gdisp && shell->dot_for_dot); - - SET_SENSITIVE ("/View/Zoom/Zoom Out", gdisp); - SET_SENSITIVE ("/View/Zoom/Zoom In", gdisp); - SET_SENSITIVE ("/View/Zoom/Zoom to Fit Window", gdisp); - - SET_SENSITIVE (VIEW_ZOOM_16_1, gdisp); - SET_SENSITIVE (VIEW_ZOOM_8_1, gdisp); - SET_SENSITIVE (VIEW_ZOOM_4_1, gdisp); - SET_SENSITIVE (VIEW_ZOOM_2_1, gdisp); - SET_SENSITIVE (VIEW_ZOOM_1_1, gdisp); - SET_SENSITIVE (VIEW_ZOOM_1_2, gdisp); - SET_SENSITIVE (VIEW_ZOOM_1_4, gdisp); - SET_SENSITIVE (VIEW_ZOOM_1_8, gdisp); - SET_SENSITIVE (VIEW_ZOOM_1_16, gdisp); - SET_SENSITIVE ("/View/Zoom/Other...", gdisp); - - if (gdisp) - image_menu_set_zoom (item_factory, shell); - - SET_SENSITIVE ("/View/Info Window", gdisp); - SET_SENSITIVE ("/View/Navigation Window", gdisp); - SET_SENSITIVE ("/View/Display Filters...", gdisp); - - SET_SENSITIVE ("/View/Show Selection", gdisp); - SET_ACTIVE ("/View/Show Selection", gdisp && options->show_selection); - SET_SENSITIVE ("/View/Show Layer Boundary", gdisp); - SET_ACTIVE ("/View/Show Layer Boundary", gdisp && options->show_layer_boundary); - SET_ACTIVE ("/View/Show Guides", gdisp && options->show_guides); - SET_ACTIVE ("/View/Snap to Guides", gdisp && shell->snap_to_guides); - SET_ACTIVE ("/View/Show Grid", gdisp && options->show_grid); - SET_ACTIVE ("/View/Snap to Grid", gdisp && shell->snap_to_grid); - - SET_SENSITIVE ("/View/Show Menubar", gdisp); - SET_ACTIVE ("/View/Show Menubar", gdisp && options->show_menubar); - SET_SENSITIVE ("/View/Show Rulers", gdisp); - SET_ACTIVE ("/View/Show Rulers", gdisp && options->show_rulers); - SET_SENSITIVE ("/View/Show Scrollbars", gdisp); - SET_ACTIVE ("/View/Show Scrollbars", gdisp && options->show_scrollbars); - SET_SENSITIVE ("/View/Show Statusbar", gdisp); - SET_ACTIVE ("/View/Show Statusbar", gdisp && options->show_statusbar); - - SET_SENSITIVE ("/View/Shrink Wrap", gdisp); - SET_SENSITIVE ("/View/Fullscreen", gdisp); - SET_ACTIVE ("/View/Fullscreen", gdisp && fullscreen); - SET_VISIBLE ("/View/Move to Screen...", gdisp && n_screens > 1); - } - - /* Image */ - - SET_SENSITIVE ("/Image/Mode/RGB", gdisp && ! is_rgb); - SET_SENSITIVE ("/Image/Mode/Grayscale", gdisp && ! is_gray); - SET_SENSITIVE ("/Image/Mode/Indexed...", gdisp && ! is_indexed); - - SET_SENSITIVE ("/Image/Transform/Flip Horizontally", gdisp); - SET_SENSITIVE ("/Image/Transform/Flip Vertically", gdisp); - SET_SENSITIVE ("/Image/Transform/Rotate 90 degrees CW", gdisp); - SET_SENSITIVE ("/Image/Transform/Rotate 90 degrees CCW", gdisp); - SET_SENSITIVE ("/Image/Transform/Rotate 180 degrees", gdisp); - - SET_SENSITIVE ("/Image/Canvas Size...", gdisp); - SET_SENSITIVE ("/Image/Scale Image...", gdisp); - SET_SENSITIVE ("/Image/Crop Image", gdisp && sel); - SET_SENSITIVE ("/Image/Duplicate", gdisp); - SET_SENSITIVE ("/Image/Merge Visible Layers...", gdisp && !fs && !aux && lp); - SET_SENSITIVE ("/Image/Flatten Image", gdisp && !fs && !aux && lp); - SET_SENSITIVE ("/Image/Configure Grid...", gdisp); - - /* Layer */ - - SET_SENSITIVE ("/Layer/New Layer...", gdisp); - SET_SENSITIVE ("/Layer/Duplicate Layer", lp && !fs && !aux); - SET_SENSITIVE ("/Layer/Anchor Layer", lp && fs && !aux); - SET_SENSITIVE ("/Layer/Merge Down", lp && !fs && !aux && lind < (lnum - 1)); - SET_SENSITIVE ("/Layer/Delete Layer", lp && !aux); - SET_VISIBLE ("/Layer/Discard Text Information", text_layer && !aux); - - SET_SENSITIVE ("/Layer/Layer Boundary Size...", lp && !aux); - SET_SENSITIVE ("/Layer/Layer to Image Size", lp && !aux); - SET_SENSITIVE ("/Layer/Scale Layer...", lp && !aux); - SET_SENSITIVE ("/Layer/Crop Layer", lp && !aux && sel); - - if (display_items) - { - SET_SENSITIVE ("/Layer/Stack/Select Previous Layer", - lp && !fs && !aux && lind > 0); - SET_SENSITIVE ("/Layer/Stack/Select Next Layer", - lp && !fs && !aux && lind < (lnum - 1)); - SET_SENSITIVE ("/Layer/Stack/Select Top Layer", - lp && !fs && !aux && lind > 0); - SET_SENSITIVE ("/Layer/Stack/Select Bottom Layer", - lp && !fs && !aux && lind < (lnum - 1)); - - SET_SENSITIVE ("/Layer/Stack/Raise Layer", - lp && !fs && !aux && alpha && lind > 0); - SET_SENSITIVE ("/Layer/Stack/Lower Layer", - lp && !fs && !aux && alpha && lind < (lnum - 1)); - SET_SENSITIVE ("/Layer/Stack/Layer to Top", - lp && !fs && !aux && alpha && lind > 0); - SET_SENSITIVE ("/Layer/Stack/Layer to Bottom", - lp && !fs && !aux && alpha && lind < (lnum - 1)); - } - - SET_SENSITIVE ("/Layer/Colors/Color Balance...", ad && is_rgb); - SET_SENSITIVE ("/Layer/Colors/Hue-Saturation...", ad && is_rgb); - SET_SENSITIVE ("/Layer/Colors/Colorize...", ad && is_rgb); - SET_SENSITIVE ("/Layer/Colors/Brightness-Contrast...", ad && ! is_indexed); - SET_SENSITIVE ("/Layer/Colors/Threshold...", ad && ! is_indexed); - SET_SENSITIVE ("/Layer/Colors/Levels...", ad && ! is_indexed); - SET_SENSITIVE ("/Layer/Colors/Curves...", ad && ! is_indexed); - SET_SENSITIVE ("/Layer/Colors/Posterize...", ad && ! is_indexed); - SET_SENSITIVE ("/Layer/Colors/Desaturate", ad && is_rgb); - SET_SENSITIVE ("/Layer/Colors/Invert", ad && ! is_indexed); - SET_SENSITIVE ("/Layer/Colors/Auto/Equalize", ad && ! is_indexed); - SET_SENSITIVE ("/Layer/Colors/Histogram", ad); - - SET_SENSITIVE ("/Layer/Mask/Add Layer Mask...", lp && !fs && !aux && !lm && alpha); - SET_SENSITIVE ("/Layer/Mask/Apply Layer Mask", lm && !fs && !aux); - SET_SENSITIVE ("/Layer/Mask/Delete Layer Mask", lm && !fs && !aux); - SET_SENSITIVE ("/Layer/Mask/Mask to Selection", lm && !fs && !aux); - SET_SENSITIVE ("/Layer/Mask/Add to Selection", lm && !fs && !aux); - SET_SENSITIVE ("/Layer/Mask/Subtract from Selection", lm && !fs && !aux); - SET_SENSITIVE ("/Layer/Mask/Intersect with Selection", lm && !fs && !aux); - - SET_SENSITIVE ("/Layer/Transparency/Add Alpha Channel", lp && !aux && !fs && !lm && !alpha); - SET_SENSITIVE ("/Layer/Transparency/Alpha to Selection", lp && !aux); - SET_SENSITIVE ("/Layer/Transparency/Add to Selection", lp && !aux); - SET_SENSITIVE ("/Layer/Transparency/Subtract from Selection", lp && !aux); - SET_SENSITIVE ("/Layer/Transparency/Intersect with Selection", lp && !aux); - - SET_SENSITIVE ("/Layer/Transform/Flip Horizontally", ad); - SET_SENSITIVE ("/Layer/Transform/Flip Vertically", ad); - SET_SENSITIVE ("/Layer/Transform/Rotate 90 degrees CW", ad); - SET_SENSITIVE ("/Layer/Transform/Rotate 90 degrees CCW", ad); - SET_SENSITIVE ("/Image/Transform/Rotate 180 degrees", ad); - SET_SENSITIVE ("/Layer/Transform/Offset...", ad); - -#undef SET_ACTIVE -#undef SET_VISIBLE -#undef SET_LABEL -#undef SET_SENSITIVE - - plug_in_menus_update (GIMP_ITEM_FACTORY (item_factory), drawable_type); -} - - -/* private functions */ - -static void -image_menu_buffer_changed (Gimp *gimp, - GimpItemFactory *item_factory) -{ - GtkItemFactory *gtk_factory = GTK_ITEM_FACTORY (item_factory); - gboolean buf = (gimp->global_buffer != NULL); - - if (GTK_IS_MENU_BAR (gtk_factory->widget)) - { - gimp_item_factory_set_sensitive (gtk_factory, "/Edit/Paste", buf); - gimp_item_factory_set_sensitive (gtk_factory, "/Edit/Paste Into", buf); - } - - gimp_item_factory_set_sensitive (gtk_factory, "/Edit/Paste as New", buf); -} - -static void -image_menu_foreground_changed (GimpContext *context, - const GimpRGB *color, - GimpItemFactory *item_factory) -{ - gimp_item_factory_set_color (GTK_ITEM_FACTORY (item_factory), - "/Edit/Fill with FG Color", color, FALSE); -} - -static void -image_menu_background_changed (GimpContext *context, - const GimpRGB *color, - GimpItemFactory *item_factory) -{ - gimp_item_factory_set_color (GTK_ITEM_FACTORY (item_factory), - "/Edit/Fill with BG Color", color, FALSE); -} - -static void -image_menu_set_zoom (GtkItemFactory *item_factory, - GimpDisplayShell *shell) -{ - const gchar *menu = NULL; - guint scale; - gchar buf[16]; - gchar *label; - - scale = ROUND (shell->scale * 1000); - - switch (scale) - { - case 16000: menu = VIEW_ZOOM_16_1; break; - case 8000: menu = VIEW_ZOOM_8_1; break; - case 4000: menu = VIEW_ZOOM_4_1; break; - case 2000: menu = VIEW_ZOOM_2_1; break; - case 1000: menu = VIEW_ZOOM_1_1; break; - case 500: menu = VIEW_ZOOM_1_2; break; - case 250: menu = VIEW_ZOOM_1_4; break; - case 125: menu = VIEW_ZOOM_1_8; break; - case 63: - case 62: menu = VIEW_ZOOM_1_16; break; - } - - g_snprintf (buf, sizeof (buf), - shell->scale >= 0.15 ? "%.0f%%" : "%.2f%%", - shell->scale * 100.0); - - if (!menu) - { - menu = "/View/Zoom/Other..."; - - label = g_strdup_printf (_("Other (%s) ..."), buf); - gimp_item_factory_set_label (item_factory, menu, label); - g_free (label); - - shell->other_scale = shell->scale; - } - - gimp_item_factory_set_active (item_factory, menu, TRUE); - - label = g_strdup_printf (_("_Zoom (%s)"), buf); - gimp_item_factory_set_label (item_factory, "/View/Zoom", label); - g_free (label); - - /* flag as dirty */ - shell->other_scale = - fabs (shell->other_scale); -} diff --git a/app/gui/image-menu.h b/app/gui/image-menu.h index e6223ab6fd..b8115da85b 100644 --- a/app/gui/image-menu.h +++ b/app/gui/image-menu.h @@ -20,17 +20,8 @@ #define __IMAGE_MENU_H__ -extern GimpItemFactoryEntry image_menu_entries[]; -extern gint n_image_menu_entries; - - -void image_menu_setup2 (GimpUIManager *manager, - const gchar *ui_path); - -void image_menu_setup (GimpItemFactory *factory, - gpointer callback_data); -void image_menu_update (GtkItemFactory *factory, - gpointer update_data); +void image_menu_setup (GimpUIManager *manager, + const gchar *ui_path); #endif /* __IMAGE_MENU_H__ */ diff --git a/app/gui/images-menu.c b/app/gui/images-menu.c deleted file mode 100644 index 0780f9741a..0000000000 --- a/app/gui/images-menu.c +++ /dev/null @@ -1,79 +0,0 @@ -/* The GIMP -- an image manipulation program - * Copyright (C) 1995 Spencer Kimball and Peter Mattis - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -#include "config.h" - -#include - -#include "libgimpwidgets/gimpwidgets.h" - -#include "gui-types.h" - -#include "core/gimpcontext.h" -#include "core/gimpimage.h" - -#include "widgets/gimpcontainereditor.h" -#include "widgets/gimpcontainerview.h" -#include "widgets/gimpitemfactory.h" - -#include "actions/images-commands.h" - -#include "images-menu.h" - -#include "gimp-intl.h" - - -GimpItemFactoryEntry images_menu_entries[] = -{ - { { N_("/_Raise Views"), "", - images_raise_views_cmd_callback, 0, - "", GTK_STOCK_GOTO_TOP }, - NULL, NULL, NULL }, - { { N_("/_New View"), "", - images_new_view_cmd_callback, 0, - "", GTK_STOCK_NEW }, - NULL, NULL, NULL }, - { { N_("/_Delete Image"), "", - images_delete_image_cmd_callback, 0, - "", GTK_STOCK_DELETE }, - NULL, NULL, NULL } -}; - -gint n_images_menu_entries = G_N_ELEMENTS (images_menu_entries); - - -void -images_menu_update (GtkItemFactory *factory, - gpointer data) -{ - GimpContainerEditor *editor; - GimpImage *image; - - editor = GIMP_CONTAINER_EDITOR (data); - - image = gimp_context_get_image (editor->view->context); - -#define SET_SENSITIVE(menu,condition) \ - gimp_item_factory_set_sensitive (factory, menu, (condition) != 0) - - SET_SENSITIVE ("/Raise Views", image); - SET_SENSITIVE ("/New View", image); - SET_SENSITIVE ("/Delete Image", image && image->disp_count == 0); - -#undef SET_SENSITIVE -} diff --git a/app/gui/images-menu.h b/app/gui/images-menu.h deleted file mode 100644 index 13ccd3ecd3..0000000000 --- a/app/gui/images-menu.h +++ /dev/null @@ -1,31 +0,0 @@ -/* The GIMP -- an image manipulation program - * Copyright (C) 1995 Spencer Kimball and Peter Mattis - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -#ifndef __IMAGES_MENU_H__ -#define __IMAGES_MENU_H__ - - -extern GimpItemFactoryEntry images_menu_entries[]; -extern gint n_images_menu_entries; - - -void images_menu_update (GtkItemFactory *factory, - gpointer data); - - -#endif /* __IMAGES_MENU_H__ */ diff --git a/app/gui/layers-menu.c b/app/gui/layers-menu.c deleted file mode 100644 index cfecacb36c..0000000000 --- a/app/gui/layers-menu.c +++ /dev/null @@ -1,277 +0,0 @@ -/* The GIMP -- an image manipulation program - * Copyright (C) 1995 Spencer Kimball and Peter Mattis - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -#include "config.h" - -#include - -#include "libgimpwidgets/gimpwidgets.h" - -#include "gui-types.h" - -#include "core/gimpimage.h" -#include "core/gimplayer.h" -#include "core/gimplist.h" - -#include "text/gimptextlayer.h" - -#include "widgets/gimphelp-ids.h" -#include "widgets/gimpitemfactory.h" -#include "widgets/gimpitemtreeview.h" - -#include "actions/layers-commands.h" - -#include "layers-menu.h" -#include "menus.h" - -#include "gimp-intl.h" - - -GimpItemFactoryEntry layers_menu_entries[] = -{ - { { N_("/Te_xt Tool"), NULL, - layers_text_tool_cmd_callback, 0, - "", GIMP_STOCK_TOOL_TEXT }, - NULL, - GIMP_HELP_TOOL_TEXT, NULL }, - { { N_("/_Edit Layer Attributes..."), NULL, - layers_edit_attributes_cmd_callback, 0, - "", GIMP_STOCK_EDIT }, - NULL, - GIMP_HELP_LAYER_EDIT, NULL }, - - MENU_SEPARATOR ("/---"), - - { { N_("/_New Layer..."), "", - layers_new_cmd_callback, 0, - "", GTK_STOCK_NEW }, - NULL, - GIMP_HELP_LAYER_NEW, NULL }, - - { { N_("/_Raise Layer"), "", - layers_raise_cmd_callback, 0, - "", GTK_STOCK_GO_UP }, - NULL, - GIMP_HELP_LAYER_RAISE, NULL }, - { { N_("/Layer to _Top"), "", - layers_raise_to_top_cmd_callback, 0, - "", GTK_STOCK_GOTO_TOP }, - NULL, - GIMP_HELP_LAYER_RAISE_TO_TOP, NULL }, - { { N_("/_Lower Layer"), "", - layers_lower_cmd_callback, 0, - "", GTK_STOCK_GO_DOWN }, - NULL, - GIMP_HELP_LAYER_LOWER, NULL }, - { { N_("/Layer to _Bottom"), "", - layers_lower_to_bottom_cmd_callback, 0, - "", GTK_STOCK_GOTO_BOTTOM }, - NULL, - GIMP_HELP_LAYER_LOWER_TO_BOTTOM, NULL }, - - { { N_("/D_uplicate Layer"), NULL, - layers_duplicate_cmd_callback, 0, - "", GIMP_STOCK_DUPLICATE }, - NULL, - GIMP_HELP_LAYER_DUPLICATE, NULL }, - { { N_("/_Anchor Layer"), NULL, - layers_anchor_cmd_callback, 0, - "", GIMP_STOCK_ANCHOR }, - NULL, - GIMP_HELP_LAYER_ANCHOR, NULL }, - { { N_("/Merge Do_wn"), NULL, - layers_merge_down_cmd_callback, 0, - "", GIMP_STOCK_MERGE_DOWN }, - NULL, - GIMP_HELP_LAYER_MERGE_DOWN, NULL }, - { { N_("/_Delete Layer"), "", - layers_delete_cmd_callback, 0, - "", GTK_STOCK_DELETE }, - NULL, - GIMP_HELP_LAYER_DELETE, NULL }, - { { N_("/_Discard Text Information"), NULL, - layers_text_discard_cmd_callback, 0, - "", GIMP_STOCK_TOOL_TEXT }, - NULL, - GIMP_HELP_LAYER_TEXT_DISCARD, NULL }, - - MENU_SEPARATOR ("/---"), - - { { N_("/Layer B_oundary Size..."), NULL, - layers_resize_cmd_callback, 0, - "", GIMP_STOCK_RESIZE }, - NULL, - GIMP_HELP_LAYER_RESIZE, NULL }, - { { N_("/Layer to _Image Size"), NULL, - layers_resize_to_image_cmd_callback, 0, - "", GIMP_STOCK_LAYER_TO_IMAGESIZE }, - NULL, - GIMP_HELP_LAYER_RESIZE_TO_IMAGE, NULL }, - { { N_("/_Scale Layer..."), NULL, - layers_scale_cmd_callback, 0, - "", GIMP_STOCK_SCALE }, - NULL, - GIMP_HELP_LAYER_SCALE, NULL }, - - MENU_SEPARATOR ("/---"), - - { { N_("/Add La_yer Mask..."), NULL, - layers_mask_add_cmd_callback, 0, - "", GIMP_STOCK_LAYER_MASK }, - NULL, - GIMP_HELP_LAYER_MASK_ADD, NULL }, - { { N_("/Apply Layer _Mask"), NULL, - layers_mask_apply_cmd_callback, 0 }, - NULL, - GIMP_HELP_LAYER_MASK_APPLY, NULL }, - { { N_("/Delete Layer Mas_k"), NULL, - layers_mask_delete_cmd_callback, 0, - "", GTK_STOCK_DELETE }, - NULL, - GIMP_HELP_LAYER_MASK_DELETE , NULL }, - { { N_("/Mask to Sele_ction"), NULL, - layers_mask_to_selection_cmd_callback, GIMP_CHANNEL_OP_REPLACE, - "", GIMP_STOCK_SELECTION_REPLACE }, - NULL, - GIMP_HELP_LAYER_MASK_SELECTION_REPLACE, NULL }, - - MENU_SEPARATOR ("/---"), - - { { N_("/Add Alpha C_hannel"), NULL, - layers_alpha_add_cmd_callback, 0, - "", GIMP_STOCK_TRANSPARENCY }, - NULL, - GIMP_HELP_LAYER_ALPHA_ADD, NULL }, - { { N_("/Al_pha to Selection"), NULL, - layers_alpha_to_selection_cmd_callback, GIMP_CHANNEL_OP_REPLACE, - "", GIMP_STOCK_SELECTION_REPLACE }, - NULL, - GIMP_HELP_LAYER_ALPHA_SELECTION_REPLACE, NULL }, - - MENU_SEPARATOR ("/---"), - - { { N_("/Merge _Visible Layers..."), NULL, - layers_merge_layers_cmd_callback, 0, - NULL, NULL }, - NULL, - GIMP_HELP_IMAGE_MERGE_LAYERS, NULL }, - { { N_("/_Flatten Image"), NULL, - layers_flatten_image_cmd_callback, 0, - NULL, NULL }, - NULL, - GIMP_HELP_IMAGE_FLATTEN, NULL } -}; - -gint n_layers_menu_entries = G_N_ELEMENTS (layers_menu_entries); - - -void -layers_menu_update (GtkItemFactory *factory, - gpointer data) -{ - GimpImage *gimage; - GimpLayer *layer = NULL; - gboolean fs = FALSE; /* floating sel */ - gboolean ac = FALSE; /* active channel */ - gboolean lm = FALSE; /* layer mask */ - gboolean alpha = FALSE; /* alpha channel present */ - gboolean indexed = FALSE; /* is indexed */ - gboolean next_alpha = FALSE; - gboolean text_layer = FALSE; - GList *next = NULL; - GList *prev = NULL; - - gimage = GIMP_ITEM_TREE_VIEW (data)->gimage; - - if (gimage) - { - GList *list; - - layer = gimp_image_get_active_layer (gimage); - - if (layer) - lm = (gimp_layer_get_mask (layer)) ? TRUE : FALSE; - - fs = (gimp_image_floating_sel (gimage) != NULL); - ac = (gimp_image_get_active_channel (gimage) != NULL); - - alpha = layer && gimp_drawable_has_alpha (GIMP_DRAWABLE (layer)); - - indexed = (gimp_image_base_type (gimage) == GIMP_INDEXED); - - for (list = GIMP_LIST (gimage->layers)->list; - list; - list = g_list_next (list)) - { - if (layer == (GimpLayer *) list->data) - { - prev = g_list_previous (list); - next = g_list_next (list); - break; - } - } - - if (next) - next_alpha = gimp_drawable_has_alpha (GIMP_DRAWABLE (next->data)); - else - next_alpha = FALSE; - - text_layer = (layer && - gimp_drawable_is_text_layer (GIMP_DRAWABLE (layer))); - } - -#define SET_SENSITIVE(menu,condition) \ - gimp_item_factory_set_sensitive (factory, menu, (condition) != 0) -#define SET_VISIBLE(menu,condition) \ - gimp_item_factory_set_visible (factory, menu, (condition) != 0) - - SET_VISIBLE ("/Text Tool", text_layer && !ac); - SET_SENSITIVE ("/Edit Layer Attributes...", layer && !fs && !ac); - - SET_SENSITIVE ("/New Layer...", gimage); - - SET_SENSITIVE ("/Raise Layer", layer && !fs && !ac && alpha && prev); - SET_SENSITIVE ("/Layer to Top", layer && !fs && !ac && alpha && prev); - - SET_SENSITIVE ("/Lower Layer", layer && !fs && !ac && next && next_alpha); - SET_SENSITIVE ("/Layer to Bottom", layer && !fs && !ac && next && next_alpha); - - SET_SENSITIVE ("/Duplicate Layer", layer && !fs && !ac); - SET_SENSITIVE ("/Anchor Layer", layer && fs && !ac); - SET_SENSITIVE ("/Merge Down", layer && !fs && !ac && next); - SET_SENSITIVE ("/Delete Layer", layer && !ac); - SET_VISIBLE ("/Discard Text Information", text_layer && !ac); - - SET_SENSITIVE ("/Layer Boundary Size...", layer && !ac); - SET_SENSITIVE ("/Layer to Image Size", layer && !ac); - SET_SENSITIVE ("/Scale Layer...", layer && !ac); - - SET_SENSITIVE ("/Add Layer Mask...", layer && !fs && !ac && !lm && alpha); - SET_SENSITIVE ("/Apply Layer Mask", layer && !fs && !ac && lm); - SET_SENSITIVE ("/Delete Layer Mask", layer && !fs && !ac && lm); - SET_SENSITIVE ("/Mask to Selection", layer && !fs && !ac && lm); - - SET_SENSITIVE ("/Add Alpha Channel", layer && !fs && !alpha); - SET_SENSITIVE ("/Alpha to Selection", layer && !fs && !ac); - - SET_SENSITIVE ("/Merge Visible Layers...", layer && !fs && !ac); - SET_SENSITIVE ("/Flatten Image", layer && !fs && !ac); - -#undef SET_SENSITIVE -#undef SET_VISIBLE -} diff --git a/app/gui/layers-menu.h b/app/gui/layers-menu.h deleted file mode 100644 index 8d188c1c93..0000000000 --- a/app/gui/layers-menu.h +++ /dev/null @@ -1,31 +0,0 @@ -/* The GIMP -- an image manipulation program - * Copyright (C) 1995 Spencer Kimball and Peter Mattis - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -#ifndef __LAYERS_MENU_H__ -#define __LAYERS_MENU_H__ - - -extern GimpItemFactoryEntry layers_menu_entries[]; -extern gint n_layers_menu_entries; - - -void layers_menu_update (GtkItemFactory *factory, - gpointer data); - - -#endif /* __LAYERS_MENU_H__ */ diff --git a/app/gui/menus.c b/app/gui/menus.c index 984f8aafd6..944085e894 100644 --- a/app/gui/menus.c +++ b/app/gui/menus.c @@ -39,47 +39,20 @@ #include "widgets/gimpuimanager.h" #include "actions/actions.h" -#include "actions/file-commands.h" -#include "brushes-menu.h" -#include "buffers-menu.h" -#include "channels-menu.h" -#include "colormap-editor-menu.h" -#include "dialogs-menu.h" -#include "documents-menu.h" -#include "error-console-menu.h" #include "file-open-menu.h" #include "file-save-menu.h" -#include "fonts-menu.h" -#include "gradient-editor-menu.h" -#include "gradients-menu.h" #include "image-menu.h" -#include "images-menu.h" -#include "layers-menu.h" #include "menus.h" -#include "palette-editor-menu.h" -#include "palettes-menu.h" -#include "patterns-menu.h" -#include "qmask-menu.h" -#include "templates-menu.h" #include "tool-options-menu.h" #include "toolbox-menu.h" -#include "vectors-menu.h" #include "gimp-intl.h" /* local function prototypes */ -static void menus_last_opened_update (GimpContainer *container, - GimpImagefile *unused, - GimpItemFactory *item_factory); -static void menus_last_opened_reorder (GimpContainer *container, - GimpImagefile *unused1, - gint unused2, - GimpItemFactory *item_factory); - -static void menu_can_change_accels (GimpGuiConfig *config); +static void menu_can_change_accels (GimpGuiConfig *config); /* global variables */ @@ -112,19 +85,11 @@ menus_init (Gimp *gimp) global_menu_factory = gimp_menu_factory_new (gimp, global_action_factory); - gimp_menu_factory_menu_register (global_menu_factory, "", - _("Toolbox Menu"), - GIMP_HELP_TOOLBOX, - toolbox_menu_setup, NULL, FALSE, - n_toolbox_menu_entries, - toolbox_menu_entries); - gimp_menu_factory_menu_register (global_menu_factory, "", _("Image Menu"), GIMP_HELP_IMAGE_WINDOW, - image_menu_setup, image_menu_update, FALSE, - n_image_menu_entries, - image_menu_entries); + NULL, NULL, FALSE, + 0, NULL); gimp_menu_factory_manager_register (global_menu_factory, "", "file", "debug", @@ -142,9 +107,11 @@ menus_init (Gimp *gimp) "qmask", NULL, "/toolbox-menubar", - "toolbox-menu.xml", toolbox_menu_setup2, + "toolbox-menu.xml", toolbox_menu_setup, "/image-menubar", - "image-menu.xml", image_menu_setup2, + "image-menu.xml", image_menu_setup, + "/image-popup", + "image-menu.xml", image_menu_setup, "/qmask-popup", "qmask-menu.xml", NULL, NULL); @@ -167,9 +134,8 @@ menus_init (Gimp *gimp) gimp_menu_factory_menu_register (global_menu_factory, "", _("Layers Menu"), GIMP_HELP_LAYER_DIALOG, - NULL, layers_menu_update, TRUE, - n_layers_menu_entries, - layers_menu_entries); + NULL, NULL, TRUE, + 0, NULL); gimp_menu_factory_manager_register (global_menu_factory, "", "layers", NULL, @@ -180,9 +146,8 @@ menus_init (Gimp *gimp) gimp_menu_factory_menu_register (global_menu_factory, "", _("Channels Menu"), GIMP_HELP_CHANNEL_DIALOG, - NULL, channels_menu_update, TRUE, - n_channels_menu_entries, - channels_menu_entries); + NULL, NULL, TRUE, + 0, NULL); gimp_menu_factory_manager_register (global_menu_factory, "", "channels", NULL, @@ -193,9 +158,8 @@ menus_init (Gimp *gimp) gimp_menu_factory_menu_register (global_menu_factory, "", _("Paths Menu"), GIMP_HELP_PATH_DIALOG, - NULL, vectors_menu_update, TRUE, - n_vectors_menu_entries, - vectors_menu_entries); + NULL, NULL, TRUE, + 0, NULL); gimp_menu_factory_manager_register (global_menu_factory, "", "vectors", NULL, @@ -206,9 +170,8 @@ menus_init (Gimp *gimp) gimp_menu_factory_menu_register (global_menu_factory, "", _("Dialogs Menu"), GIMP_HELP_DOCK, - NULL, dialogs_menu_update, TRUE, - n_dialogs_menu_entries, - dialogs_menu_entries); + NULL, NULL, TRUE, + 0, NULL); gimp_menu_factory_manager_register (global_menu_factory, "", "dockable", NULL, @@ -219,9 +182,8 @@ menus_init (Gimp *gimp) gimp_menu_factory_menu_register (global_menu_factory, "", _("Brushes Menu"), GIMP_HELP_BRUSH_DIALOG, - NULL, brushes_menu_update, TRUE, - n_brushes_menu_entries, - brushes_menu_entries); + NULL, NULL, TRUE, + 0, NULL); gimp_menu_factory_manager_register (global_menu_factory, "", "brushes", NULL, @@ -232,9 +194,8 @@ menus_init (Gimp *gimp) gimp_menu_factory_menu_register (global_menu_factory, "", _("Patterns Menu"), GIMP_HELP_PATTERN_DIALOG, - NULL, patterns_menu_update, TRUE, - n_patterns_menu_entries, - patterns_menu_entries); + NULL, NULL, TRUE, + 0, NULL); gimp_menu_factory_manager_register (global_menu_factory, "", "patterns", NULL, @@ -245,9 +206,8 @@ menus_init (Gimp *gimp) gimp_menu_factory_menu_register (global_menu_factory, "", _("Gradients Menu"), GIMP_HELP_GRADIENT_DIALOG, - NULL, gradients_menu_update, TRUE, - n_gradients_menu_entries, - gradients_menu_entries); + NULL, NULL, TRUE, + 0, NULL); gimp_menu_factory_manager_register (global_menu_factory, "", "gradients", NULL, @@ -258,9 +218,8 @@ menus_init (Gimp *gimp) gimp_menu_factory_menu_register (global_menu_factory, "", _("Palettes Menu"), GIMP_HELP_PALETTE_DIALOG, - NULL, palettes_menu_update, TRUE, - n_palettes_menu_entries, - palettes_menu_entries); + NULL, NULL, TRUE, + 0, NULL); gimp_menu_factory_manager_register (global_menu_factory, "", "palettes", NULL, @@ -271,9 +230,8 @@ menus_init (Gimp *gimp) gimp_menu_factory_menu_register (global_menu_factory, "", _("Fonts Menu"), GIMP_HELP_FONT_DIALOG, - NULL, fonts_menu_update, TRUE, - n_fonts_menu_entries, - fonts_menu_entries); + NULL, NULL, TRUE, + 0, NULL); gimp_menu_factory_manager_register (global_menu_factory, "", "fonts", NULL, @@ -284,9 +242,8 @@ menus_init (Gimp *gimp) gimp_menu_factory_menu_register (global_menu_factory, "", _("Buffers Menu"), GIMP_HELP_BUFFER_DIALOG, - NULL, buffers_menu_update, TRUE, - n_buffers_menu_entries, - buffers_menu_entries); + NULL, NULL, TRUE, + 0, NULL); gimp_menu_factory_manager_register (global_menu_factory, "", "buffers", NULL, @@ -297,9 +254,8 @@ menus_init (Gimp *gimp) gimp_menu_factory_menu_register (global_menu_factory, "", _("Documents Menu"), GIMP_HELP_DOCUMENT_DIALOG, - NULL, documents_menu_update, TRUE, - n_documents_menu_entries, - documents_menu_entries); + NULL, NULL, TRUE, + 0, NULL); gimp_menu_factory_manager_register (global_menu_factory, "", "documents", NULL, @@ -310,9 +266,8 @@ menus_init (Gimp *gimp) gimp_menu_factory_menu_register (global_menu_factory, "", _("Templates Menu"), GIMP_HELP_TEMPLATE_DIALOG, - NULL, templates_menu_update, TRUE, - n_templates_menu_entries, - templates_menu_entries); + NULL, NULL, TRUE, + 0, NULL); gimp_menu_factory_manager_register (global_menu_factory, "", "templates", NULL, @@ -323,9 +278,8 @@ menus_init (Gimp *gimp) gimp_menu_factory_menu_register (global_menu_factory, "", _("Images Menu"), GIMP_HELP_IMAGE_DIALOG, - NULL, images_menu_update, TRUE, - n_images_menu_entries, - images_menu_entries); + NULL, NULL, TRUE, + 0, NULL); gimp_menu_factory_manager_register (global_menu_factory, "", "images", NULL, @@ -336,9 +290,8 @@ menus_init (Gimp *gimp) gimp_menu_factory_menu_register (global_menu_factory, "", _("Gradient Editor Menu"), GIMP_HELP_GRADIENT_EDITOR_DIALOG, - NULL, gradient_editor_menu_update, TRUE, - n_gradient_editor_menu_entries, - gradient_editor_menu_entries); + NULL, NULL, TRUE, + 0, NULL); gimp_menu_factory_manager_register (global_menu_factory, "", "gradient-editor", NULL, @@ -349,9 +302,8 @@ menus_init (Gimp *gimp) gimp_menu_factory_menu_register (global_menu_factory, "", _("Palette Editor Menu"), GIMP_HELP_PALETTE_EDITOR_DIALOG, - NULL, palette_editor_menu_update, TRUE, - n_palette_editor_menu_entries, - palette_editor_menu_entries); + NULL, NULL, TRUE, + 0, NULL); gimp_menu_factory_manager_register (global_menu_factory, "", "palette-editor", NULL, @@ -362,9 +314,8 @@ menus_init (Gimp *gimp) gimp_menu_factory_menu_register (global_menu_factory, "", _("Indexed Palette Menu"), GIMP_HELP_INDEXED_PALETTE_DIALOG, - NULL, colormap_editor_menu_update, TRUE, - n_colormap_editor_menu_entries, - colormap_editor_menu_entries); + NULL, NULL, TRUE, + 0, NULL); gimp_menu_factory_manager_register (global_menu_factory, "", "colormap-editor", NULL, @@ -375,9 +326,8 @@ menus_init (Gimp *gimp) gimp_menu_factory_menu_register (global_menu_factory, "", _("QuickMask Menu"), GIMP_HELP_QMASK, - NULL, qmask_menu_update, TRUE, - n_qmask_menu_entries, - qmask_menu_entries); + NULL, NULL, TRUE, + 0, NULL); gimp_menu_factory_manager_register (global_menu_factory, "", "qmask", NULL, @@ -388,9 +338,8 @@ menus_init (Gimp *gimp) gimp_menu_factory_menu_register (global_menu_factory, "", _("Error Console Menu"), GIMP_HELP_ERRORS_DIALOG, - NULL, error_console_menu_update, TRUE, - n_error_console_menu_entries, - error_console_menu_entries); + NULL, NULL, TRUE, + 0, NULL); gimp_menu_factory_manager_register (global_menu_factory, "", "error-console", NULL, @@ -403,8 +352,7 @@ menus_init (Gimp *gimp) GIMP_HELP_TOOL_OPTIONS_DIALOG, tool_options_menu_setup, tool_options_menu_update, TRUE, - n_tool_options_menu_entries, - tool_options_menu_entries); + 0, NULL); gimp_menu_factory_manager_register (global_menu_factory, "", "tool-options", NULL, @@ -492,201 +440,9 @@ menus_open_recent_add (GimpUIManager *manager, } } -void -menus_last_opened_add (GimpItemFactory *item_factory) -{ - GimpItemFactoryEntry *last_opened_entries; - gint n_last_opened_entries; - gint i; - - g_return_if_fail (GIMP_IS_ITEM_FACTORY (item_factory)); - - n_last_opened_entries = - GIMP_GUI_CONFIG (item_factory->gimp->config)->last_opened_size; - - last_opened_entries = g_new (GimpItemFactoryEntry, n_last_opened_entries); - - for (i = 0; i < n_last_opened_entries; i++) - { - last_opened_entries[i].entry.path = - g_strdup_printf ("/File/Open Recent/%02d", i + 1); - - if (i < 9) - last_opened_entries[i].entry.accelerator = - g_strdup_printf ("%d", i + 1); - else if (i == 9) - last_opened_entries[i].entry.accelerator = "0"; - else - last_opened_entries[i].entry.accelerator = ""; - - last_opened_entries[i].entry.callback = file_last_opened_cmd_callback; - last_opened_entries[i].entry.callback_action = i; - last_opened_entries[i].entry.item_type = ""; - last_opened_entries[i].entry.extra_data = GTK_STOCK_OPEN; - last_opened_entries[i].quark_string = NULL; - last_opened_entries[i].help_id = GIMP_HELP_FILE_OPEN_RECENT; - last_opened_entries[i].description = NULL; - } - - gimp_item_factory_create_items (item_factory, - n_last_opened_entries, last_opened_entries, - item_factory->gimp, 2, FALSE); - - gimp_item_factory_set_sensitive (GTK_ITEM_FACTORY (item_factory), - "/File/Open Recent/(None)", - FALSE); - - for (i = 0; i < n_last_opened_entries; i++) - { - GtkWidget *widget; - - widget = gtk_item_factory_get_widget (GTK_ITEM_FACTORY (item_factory), - last_opened_entries[i].entry.path); - gtk_menu_reorder_child (GTK_MENU (widget->parent), widget, i + 1); - - gimp_item_factory_set_visible (GTK_ITEM_FACTORY (item_factory), - last_opened_entries[i].entry.path, - FALSE); - - g_free (last_opened_entries[i].entry.path); - if (i < 9) - g_free (last_opened_entries[i].entry.accelerator); - } - - g_free (last_opened_entries); - - g_signal_connect_object (item_factory->gimp->documents, "add", - G_CALLBACK (menus_last_opened_update), - item_factory, 0); - g_signal_connect_object (item_factory->gimp->documents, "remove", - G_CALLBACK (menus_last_opened_update), - item_factory, 0); - g_signal_connect_object (item_factory->gimp->documents, "reorder", - G_CALLBACK (menus_last_opened_reorder), - item_factory, 0); - - menus_last_opened_update (item_factory->gimp->documents, NULL, item_factory); -} - -void -menus_filters_subdirs_to_top (GtkMenu *menu) -{ - GtkMenuItem *menu_item; - GList *list; - gboolean submenus_passed = FALSE; - gint pos; - gint items; - - pos = 1; - items = 0; - - for (list = GTK_MENU_SHELL (menu)->children; list; list = g_list_next (list)) - { - menu_item = GTK_MENU_ITEM (list->data); - items++; - - if (menu_item->submenu) - { - if (submenus_passed) - { - menus_filters_subdirs_to_top (GTK_MENU (menu_item->submenu)); - gtk_menu_reorder_child (menu, GTK_WIDGET (menu_item), pos++); - } - } - else - { - submenus_passed = TRUE; - } - } - - if (pos > 1 && items > pos) - { - GtkWidget *separator; - - separator = gtk_menu_item_new (); - gtk_menu_shell_insert (GTK_MENU_SHELL (menu), separator, pos); - gtk_widget_show (separator); - } -} - /* private functions */ -static void -menus_last_opened_update (GimpContainer *container, - GimpImagefile *unused, - GimpItemFactory *item_factory) -{ - GtkWidget *widget; - gint num_documents; - gint i; - gint n = GIMP_GUI_CONFIG (item_factory->gimp->config)->last_opened_size; - - num_documents = gimp_container_num_children (container); - - gimp_item_factory_set_visible (GTK_ITEM_FACTORY (item_factory), - "/File/Open Recent/(None)", - num_documents == 0); - - for (i = 0; i < n; i++) - { - gchar *path_str; - - path_str = g_strdup_printf ("/File/Open Recent/%02d", i + 1); - - widget = gtk_item_factory_get_widget (GTK_ITEM_FACTORY (item_factory), - path_str); - - g_free (path_str); - - if (i < num_documents) - { - GimpImagefile *imagefile; - - imagefile = (GimpImagefile *) - gimp_container_get_child_by_index (container, i); - - if (g_object_get_data (G_OBJECT (widget), "gimp-imagefile") != - (gpointer) imagefile) - { - const gchar *uri; - gchar *filename; - gchar *basename; - - uri = gimp_object_get_name (GIMP_OBJECT (imagefile)); - - filename = file_utils_uri_to_utf8_filename (uri); - basename = file_utils_uri_to_utf8_basename (uri); - - gtk_label_set_text (GTK_LABEL (GTK_BIN (widget)->child), - basename); - gimp_help_set_help_data (widget, filename, NULL); - - g_free (filename); - g_free (basename); - - g_object_set_data (G_OBJECT (widget), - "gimp-imagefile", imagefile); - gtk_widget_show (widget); - } - } - else - { - g_object_set_data (G_OBJECT (widget), "gimp-imagefile", NULL); - gtk_widget_hide (widget); - } - } -} - -static void -menus_last_opened_reorder (GimpContainer *container, - GimpImagefile *unused1, - gint unused2, - GimpItemFactory *item_factory) -{ - menus_last_opened_update (container, unused1, item_factory); -} - static void menu_can_change_accels (GimpGuiConfig *config) { diff --git a/app/gui/menus.h b/app/gui/menus.h index 5d7be087d7..3e1e49a311 100644 --- a/app/gui/menus.h +++ b/app/gui/menus.h @@ -20,27 +20,17 @@ #define __MENUS_H__ -#define MENU_SEPARATOR(path) \ - { { (path), NULL, NULL, 0, "" }, NULL, NULL, NULL } - -#define MENU_BRANCH(path) \ - { { (path), NULL, NULL, 0, "" }, NULL, NULL, NULL } - - extern GimpMenuFactory *global_menu_factory; -void menus_init (Gimp *gimp); -void menus_exit (Gimp *gimp); -void menus_restore (Gimp *gimp); -void menus_save (Gimp *gimp); -void menus_clear (Gimp *gimp); +void menus_init (Gimp *gimp); +void menus_exit (Gimp *gimp); +void menus_restore (Gimp *gimp); +void menus_save (Gimp *gimp); +void menus_clear (Gimp *gimp); -void menus_open_recent_add (GimpUIManager *manager, - const gchar *ui_path); - -void menus_last_opened_add (GimpItemFactory *item_factory); -void menus_filters_subdirs_to_top (GtkMenu *menu); +void menus_open_recent_add (GimpUIManager *manager, + const gchar *ui_path); #endif /* __MENUS_H__ */ diff --git a/app/gui/palette-editor-menu.c b/app/gui/palette-editor-menu.c deleted file mode 100644 index 3f154390b4..0000000000 --- a/app/gui/palette-editor-menu.c +++ /dev/null @@ -1,114 +0,0 @@ -/* The GIMP -- an image manipulation program - * Copyright (C) 1995 Spencer Kimball and Peter Mattis - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -#include "config.h" - -#include - -#include "libgimpwidgets/gimpwidgets.h" - -#include "gui-types.h" - -#include "widgets/gimphelp-ids.h" -#include "widgets/gimpitemfactory.h" -#include "widgets/gimppaletteeditor.h" - -#include "actions/palette-editor-commands.h" - -#include "menus.h" -#include "palette-editor-menu.h" - -#include "gimp-intl.h" - - -GimpItemFactoryEntry palette_editor_menu_entries[] = -{ - { { N_("/_Edit Color..."), "", - palette_editor_edit_color_cmd_callback, 0, - "", GIMP_STOCK_EDIT }, - NULL, - GIMP_HELP_PALETTE_EDITOR_EDIT, NULL }, - - MENU_SEPARATOR ("/---"), - - { { N_("/New Color from _FG"), "", - palette_editor_new_color_fg_cmd_callback, 0, - "", GTK_STOCK_NEW }, - NULL, - GIMP_HELP_PALETTE_EDITOR_NEW, NULL }, - { { N_("/New Color from _BG"), "", - palette_editor_new_color_bg_cmd_callback, 0, - "", GTK_STOCK_NEW }, - NULL, - GIMP_HELP_PALETTE_EDITOR_NEW, NULL }, - { { N_("/_Delete Color"), "", - palette_editor_delete_color_cmd_callback, 0, - "", GTK_STOCK_DELETE }, - NULL, - GIMP_HELP_PALETTE_EDITOR_DELETE, NULL }, - - MENU_SEPARATOR ("/---"), - - { { N_("/Zoom _Out"), "", - palette_editor_zoom_out_cmd_callback, 0, - "", GTK_STOCK_ZOOM_OUT }, - NULL, - GIMP_HELP_PALETTE_EDITOR_ZOOM_OUT, NULL }, - { { N_("/Zoom _In"), "", - palette_editor_zoom_in_cmd_callback, 0, - "", GTK_STOCK_ZOOM_IN }, - NULL, - GIMP_HELP_PALETTE_EDITOR_ZOOM_IN, NULL }, - { { N_("/Zoom _All"), "", - palette_editor_zoom_all_cmd_callback, 0, - "", GTK_STOCK_ZOOM_FIT }, - NULL, - GIMP_HELP_PALETTE_EDITOR_ZOOM_ALL, NULL } -}; - -gint n_palette_editor_menu_entries = G_N_ELEMENTS (palette_editor_menu_entries); - - -void -palette_editor_menu_update (GtkItemFactory *factory, - gpointer data) -{ - GimpPaletteEditor *editor; - GimpDataEditor *data_editor; - gboolean editable = FALSE; - - editor = GIMP_PALETTE_EDITOR (data); - data_editor = GIMP_DATA_EDITOR (data); - - if (data_editor->data && data_editor->data_editable) - editable = TRUE; - -#define SET_SENSITIVE(menu,condition) \ - gimp_item_factory_set_sensitive (factory, menu, (condition) != 0) - - SET_SENSITIVE ("/Edit Color...", editable && editor->color); - SET_SENSITIVE ("/New Color from FG", editable); - SET_SENSITIVE ("/New Color from BG", editable); - SET_SENSITIVE ("/Delete Color", editable && editor->color); - - SET_SENSITIVE ("/Zoom Out", data_editor->data); - SET_SENSITIVE ("/Zoom In", data_editor->data); - SET_SENSITIVE ("/Zoom All", data_editor->data); - -#undef SET_SENSITIVE -} diff --git a/app/gui/palette-editor-menu.h b/app/gui/palette-editor-menu.h deleted file mode 100644 index 11ce6a96bc..0000000000 --- a/app/gui/palette-editor-menu.h +++ /dev/null @@ -1,31 +0,0 @@ -/* The GIMP -- an image manipulation program - * Copyright (C) 1995 Spencer Kimball and Peter Mattis - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -#ifndef __PALETTE_EDITOR_MENU_H__ -#define __PALETTE_EDITOR_MENU_H__ - - -extern GimpItemFactoryEntry palette_editor_menu_entries[]; -extern gint n_palette_editor_menu_entries; - - -void palette_editor_menu_update (GtkItemFactory *factory, - gpointer data); - - -#endif /* __PALETTE_EDITOR_MENU_H__ */ diff --git a/app/gui/palettes-menu.c b/app/gui/palettes-menu.c deleted file mode 100644 index 95b9da9afe..0000000000 --- a/app/gui/palettes-menu.c +++ /dev/null @@ -1,120 +0,0 @@ -/* The GIMP -- an image manipulation program - * Copyright (C) 1995 Spencer Kimball and Peter Mattis - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -#include "config.h" - -#include - -#include "libgimpwidgets/gimpwidgets.h" - -#include "gui-types.h" - -#include "core/gimpcontext.h" -#include "core/gimpdata.h" - -#include "widgets/gimpcontainereditor.h" -#include "widgets/gimpcontainerview.h" -#include "widgets/gimpdatafactoryview.h" -#include "widgets/gimphelp-ids.h" -#include "widgets/gimpitemfactory.h" - -#include "actions/data-commands.h" -#include "actions/palettes-commands.h" - -#include "palettes-menu.h" -#include "menus.h" - -#include "gimp-intl.h" - - -GimpItemFactoryEntry palettes_menu_entries[] = -{ - { { N_("/_Edit Palette..."), NULL, - data_edit_data_cmd_callback, 0, - "", GIMP_STOCK_EDIT }, - NULL, - GIMP_HELP_PALETTE_EDIT, NULL }, - - MENU_SEPARATOR ("/---"), - - { { N_("/_New Palette"), "", - data_new_data_cmd_callback, 0, - "", GTK_STOCK_NEW }, - NULL, - GIMP_HELP_PALETTE_NEW, NULL }, - { { N_("/_Import Palette..."), "", - palettes_import_palette_cmd_callback, 0, - "", GTK_STOCK_CONVERT }, - NULL, - GIMP_HELP_PALETTE_IMPORT, NULL }, - { { N_("/D_uplicate Palette"), NULL, - data_duplicate_data_cmd_callback, 0, - "", GIMP_STOCK_DUPLICATE }, - NULL, - GIMP_HELP_PALETTE_DUPLICATE, NULL }, - { { N_("/_Merge Palettes..."), NULL, - palettes_merge_palettes_cmd_callback, 0 }, - NULL, - GIMP_HELP_PALETTE_MERGE, NULL }, - { { N_("/_Delete Palette"), "", - data_delete_data_cmd_callback, 0, - "", GTK_STOCK_DELETE }, - NULL, - GIMP_HELP_PALETTE_DELETE, NULL }, - - MENU_SEPARATOR ("/---"), - - { { N_("/_Refresh Palettes"), "", - data_refresh_data_cmd_callback, 0, - "", GTK_STOCK_REFRESH }, - NULL, - GIMP_HELP_PALETTE_REFRESH, NULL } -}; - -gint n_palettes_menu_entries = G_N_ELEMENTS (palettes_menu_entries); - - -void -palettes_menu_update (GtkItemFactory *factory, - gpointer user_data) -{ - GimpContainerEditor *editor; - GimpPalette *palette; - GimpData *data = NULL; - - editor = GIMP_CONTAINER_EDITOR (user_data); - - palette = gimp_context_get_palette (editor->view->context); - - if (palette) - data = GIMP_DATA (palette); - -#define SET_SENSITIVE(menu,condition) \ - gimp_item_factory_set_sensitive (factory, menu, (condition) != 0) - - SET_SENSITIVE ("/Edit Palette...", - palette && GIMP_DATA_FACTORY_VIEW (editor)->data_edit_func); - SET_SENSITIVE ("/Duplicate Palette", - palette && GIMP_DATA_GET_CLASS (data)->duplicate); - SET_SENSITIVE ("/Merge Palettes...", - FALSE); /* FIXME palette && GIMP_IS_CONTAINER_LIST_VIEW (editor->view)); */ - SET_SENSITIVE ("/Delete Palette", - palette && data->deletable); - -#undef SET_SENSITIVE -} diff --git a/app/gui/palettes-menu.h b/app/gui/palettes-menu.h deleted file mode 100644 index 0cc65ac9ab..0000000000 --- a/app/gui/palettes-menu.h +++ /dev/null @@ -1,31 +0,0 @@ -/* The GIMP -- an image manipulation program - * Copyright (C) 1995 Spencer Kimball and Peter Mattis - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -#ifndef __PALETTES_MENU_H__ -#define __PALETTES_MENU_H__ - - -extern GimpItemFactoryEntry palettes_menu_entries[]; -extern gint n_palettes_menu_entries; - - -void palettes_menu_update (GtkItemFactory *factory, - gpointer data); - - -#endif /* __PALETTES_MENU_H__ */ diff --git a/app/gui/patterns-menu.c b/app/gui/patterns-menu.c deleted file mode 100644 index 891867cf13..0000000000 --- a/app/gui/patterns-menu.c +++ /dev/null @@ -1,113 +0,0 @@ -/* The GIMP -- an image manipulation program - * Copyright (C) 1995 Spencer Kimball and Peter Mattis - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -#include "config.h" - -#include - -#include "libgimpwidgets/gimpwidgets.h" - -#include "gui-types.h" - -#include "core/gimpcontext.h" -#include "core/gimpdata.h" - -#include "widgets/gimpcontainereditor.h" -#include "widgets/gimpcontainerview.h" -#include "widgets/gimpdatafactoryview.h" -#include "widgets/gimphelp-ids.h" -#include "widgets/gimpitemfactory.h" - -#include "actions/data-commands.h" - -#include "patterns-menu.h" -#include "menus.h" - -#include "gimp-intl.h" - - -GimpItemFactoryEntry patterns_menu_entries[] = -{ -#if 0 - /* disabled because they are useless now */ - { { N_("/_Edit Pattern..."), NULL, - data_edit_data_cmd_callback, 0, - "", GIMP_STOCK_EDIT }, - NULL, - GIMP_HELP_PATTERN_EDIT, NULL }, - - MENU_SEPARATOR ("/---"), - - { { N_("/_New Pattern"), "", - data_new_data_cmd_callback, 0, - "", GTK_STOCK_NEW }, - NULL, - GIMP_HELP_PATTERN_NEW, NULL }, - { { N_("/D_uplicate Pattern"), NULL, - data_duplicate_data_cmd_callback, 0, - "", GIMP_STOCK_DUPLICATE }, - NULL, - GIMP_HELP_PATTERN_DUPLICATE, NULL }, -#endif - { { N_("/_Delete Pattern..."), "", - data_delete_data_cmd_callback, 0, - "", GTK_STOCK_DELETE }, - NULL, - GIMP_HELP_PATTERN_DELETE, NULL }, - - MENU_SEPARATOR ("/---"), - - { { N_("/_Refresh Patterns"), "", - data_refresh_data_cmd_callback, 0, - "", GTK_STOCK_REFRESH }, - NULL, - GIMP_HELP_PATTERN_REFRESH, NULL } -}; - -gint n_patterns_menu_entries = G_N_ELEMENTS (patterns_menu_entries); - - -void -patterns_menu_update (GtkItemFactory *factory, - gpointer user_data) -{ - GimpContainerEditor *editor; - GimpPattern *pattern; - GimpData *data = NULL; - - editor = GIMP_CONTAINER_EDITOR (user_data); - - pattern = gimp_context_get_pattern (editor->view->context); - - if (pattern) - data = GIMP_DATA (pattern); - -#define SET_SENSITIVE(menu,condition) \ - gimp_item_factory_set_sensitive (factory, menu, (condition) != 0) - -#if 0 - SET_SENSITIVE ("/Edit Pattern...", - pattern && GIMP_DATA_FACTORY_VIEW (editor)->data_edit_func); - SET_SENSITIVE ("/Duplicate Pattern", - pattern && GIMP_DATA_GET_CLASS (data)->duplicate); -#endif - SET_SENSITIVE ("/Delete Pattern...", - pattern && data->deletable); - -#undef SET_SENSITIVE -} diff --git a/app/gui/patterns-menu.h b/app/gui/patterns-menu.h deleted file mode 100644 index 24584e92d0..0000000000 --- a/app/gui/patterns-menu.h +++ /dev/null @@ -1,31 +0,0 @@ -/* The GIMP -- an image manipulation program - * Copyright (C) 1995 Spencer Kimball and Peter Mattis - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -#ifndef __PATTERNS_MENU_H__ -#define __PATTERNS_MENU_H__ - - -extern GimpItemFactoryEntry patterns_menu_entries[]; -extern gint n_patterns_menu_entries; - - -void patterns_menu_update (GtkItemFactory *factory, - gpointer data); - - -#endif /* __PATTERNS_MENU_H__ */ diff --git a/app/gui/plug-in-menus.c b/app/gui/plug-in-menus.c index 755fd5ed79..31fa30d5cf 100644 --- a/app/gui/plug-in-menus.c +++ b/app/gui/plug-in-menus.c @@ -33,33 +33,16 @@ #include "plug-in/plug-in-proc.h" #include "plug-in/plug-in-run.h" -#include "widgets/gimpitemfactory.h" #include "widgets/gimpuimanager.h" #include "widgets/gimpwidgets-utils.h" -#include "actions/plug-in-commands.h" - #include "plug-in-menus.h" #include "gimp-intl.h" -typedef struct _PlugInMenuEntry PlugInMenuEntry; - -struct _PlugInMenuEntry -{ - PlugInProcDef *proc_def; - const gchar *locale_domain; - const gchar *help_domain; -}; - - /* local function prototypes */ -static gboolean plug_in_menu_tree_traverse_func (gpointer foo, - PlugInMenuEntry *menu_entry, - GimpItemFactory *item_factory); - static gboolean plug_in_menus_tree_traverse (gpointer foo, PlugInProcDef *proc_def, GimpUIManager *manager); @@ -199,6 +182,7 @@ plug_in_menus_add_proc (GimpUIManager *manager, if (p) { gchar *action_path; + gchar *merge_key; guint merge_id; *p = '\0'; @@ -209,8 +193,10 @@ plug_in_menus_add_proc (GimpUIManager *manager, action_path = g_strdup_printf ("%s%s", ui_path, strchr (path, '/')); +#if 0 g_print ("adding UI for '%s' (@ %s)\n", proc_def->db_info.name, action_path); +#endif gtk_ui_manager_add_ui (GTK_UI_MANAGER (manager), merge_id, action_path, @@ -220,6 +206,11 @@ plug_in_menus_add_proc (GimpUIManager *manager, FALSE); g_free (action_path); + + merge_key = g_strdup_printf ("%s-merge-id", proc_def->db_info.name); + g_object_set_data (G_OBJECT (manager), merge_key, + GUINT_TO_POINTER (merge_id)); + g_free (merge_key); } g_free (path); @@ -229,294 +220,24 @@ void plug_in_menus_remove_proc (GimpUIManager *manager, PlugInProcDef *proc_def) { + gchar *merge_key; + guint merge_id; + g_return_if_fail (GIMP_IS_UI_MANAGER (manager)); g_return_if_fail (proc_def != NULL); -} -void -plug_in_menus_create (GimpItemFactory *item_factory, - GSList *proc_defs) -{ - GSList *procs; - GTree *menu_entries; + merge_key = g_strdup_printf ("%s-merge-id", proc_def->db_info.name); + merge_id = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (manager), + merge_key)); + g_free (merge_key); - g_return_if_fail (GIMP_IS_ITEM_FACTORY (item_factory)); - g_return_if_fail (proc_defs != NULL); - - menu_entries = g_tree_new_full ((GCompareDataFunc) g_utf8_collate, NULL, - g_free, g_free); - - for (procs = proc_defs; procs; procs = procs->next) - { - PlugInProcDef *proc_def = procs->data; - - if (proc_def->prog && - proc_def->menu_path && - ! proc_def->extensions && - ! proc_def->prefixes && - ! proc_def->magics) - { - PlugInMenuEntry *menu_entry; - const gchar *progname; - const gchar *locale_domain; - const gchar *help_domain; - gchar *key; - - progname = plug_in_proc_def_get_progname (proc_def); - - locale_domain = plug_ins_locale_domain (item_factory->gimp, - progname, NULL); - help_domain = plug_ins_help_domain (item_factory->gimp, - progname, NULL); - - menu_entry = g_new0 (PlugInMenuEntry, 1); - - menu_entry->proc_def = proc_def; - menu_entry->locale_domain = locale_domain; - menu_entry->help_domain = help_domain; - - key = gimp_strip_uline (dgettext (locale_domain, - proc_def->menu_path)); - g_tree_insert (menu_entries, key, menu_entry); - } - } - - g_tree_foreach (menu_entries, - (GTraverseFunc) plug_in_menu_tree_traverse_func, - item_factory); - g_tree_destroy (menu_entries); -} - -void -plug_in_menus_create_entry (GimpItemFactory *item_factory, - PlugInProcDef *proc_def, - const gchar *locale_domain, - const gchar *help_domain) -{ - GimpItemFactoryEntry entry; - gchar *help_id; - - g_return_if_fail (item_factory == NULL || - GIMP_IS_ITEM_FACTORY (item_factory)); - g_return_if_fail (proc_def != NULL); - - help_id = plug_in_proc_def_get_help_id (proc_def, help_domain); - - entry.entry.path = strstr (proc_def->menu_path, "/"); - entry.entry.accelerator = proc_def->accelerator; - entry.entry.callback = plug_in_run_cmd_callback; - entry.entry.callback_action = 0; - entry.entry.item_type = NULL; - entry.quark_string = NULL; - entry.help_id = help_id; - entry.description = NULL; - - if (item_factory) - { - gchar *factory_path; - - factory_path = GTK_ITEM_FACTORY (item_factory)->path; - - if (! strncmp (proc_def->menu_path, - factory_path, strlen (factory_path))) - { - gimp_item_factory_create_item (item_factory, - &entry, - locale_domain, - &proc_def->db_info, 2, FALSE); - } - } - else - { - GList *list; - - for (list = gimp_item_factories_from_path (proc_def->menu_path); - list; - list = g_list_next (list)) - { - item_factory = list->data; - - gimp_item_factory_create_item (item_factory, - &entry, - locale_domain, - &proc_def->db_info, 2, FALSE); - } - } - - g_free (help_id); -} - -void -plug_in_menus_delete_entry (PlugInProcDef *proc_def) -{ - GList *list; - gchar *path; - - g_return_if_fail (proc_def != NULL); - g_return_if_fail (proc_def->menu_path != NULL); - - path = gimp_strip_uline (proc_def->menu_path); - - for (list = gimp_item_factories_from_path (proc_def->menu_path); - list; - list = g_list_next (list)) - { - GtkItemFactory *item_factory = list->data; - - gtk_item_factory_delete_item (GTK_ITEM_FACTORY (item_factory), path); - } - - g_free (path); -} - -void -plug_in_menus_update (GimpItemFactory *item_factory, - GimpImageType type) -{ - GSList *list; - gchar *factory_path; - gint factory_path_len; - gboolean is_image_factory = FALSE; - - g_return_if_fail (GIMP_IS_ITEM_FACTORY (item_factory)); - - factory_path = GTK_ITEM_FACTORY (item_factory)->path; - factory_path_len = strlen (factory_path); - - if (! strcmp (factory_path, "")) - is_image_factory = TRUE; - - for (list = item_factory->gimp->plug_in_proc_defs; - list; - list = g_slist_next (list)) - { - PlugInProcDef *proc_def = list->data; - - if (proc_def->menu_path && proc_def->image_types_val) - { - gboolean sensitive; - - switch (type) - { - case GIMP_RGB_IMAGE: - sensitive = proc_def->image_types_val & PLUG_IN_RGB_IMAGE; - break; - case GIMP_RGBA_IMAGE: - sensitive = proc_def->image_types_val & PLUG_IN_RGBA_IMAGE; - break; - case GIMP_GRAY_IMAGE: - sensitive = proc_def->image_types_val & PLUG_IN_GRAY_IMAGE; - break; - case GIMP_GRAYA_IMAGE: - sensitive = proc_def->image_types_val & PLUG_IN_GRAYA_IMAGE; - break; - case GIMP_INDEXED_IMAGE: - sensitive = proc_def->image_types_val & PLUG_IN_INDEXED_IMAGE; - break; - case GIMP_INDEXEDA_IMAGE: - sensitive = proc_def->image_types_val & PLUG_IN_INDEXEDA_IMAGE; - break; - default: - sensitive = FALSE; - break; - } - - if (! strncmp (proc_def->menu_path, factory_path, factory_path_len)) - { - gchar *menu_path; - - menu_path = gimp_strip_uline (proc_def->menu_path); - - gimp_item_factory_set_sensitive (GTK_ITEM_FACTORY (item_factory), - menu_path, - sensitive); - - g_free (menu_path); - } - - if (is_image_factory && - item_factory->gimp->last_plug_in && - item_factory->gimp->last_plug_in == &proc_def->db_info) - { - const gchar *progname; - const gchar *path; - gchar *stripped; - gchar *basename; - gchar *ellipses; - gchar *repeat; - gchar *reshow; - - progname = plug_in_proc_def_get_progname (proc_def); - - path = dgettext (plug_ins_locale_domain (item_factory->gimp, - progname, NULL), - proc_def->menu_path); - - stripped = gimp_strip_uline (path); - basename = g_path_get_basename (stripped); - - g_free (stripped); - - ellipses = strstr (basename, "..."); - - if (ellipses && ellipses == (basename + strlen (basename) - 3)) - *ellipses = '\0'; - - repeat = g_strdup_printf (_("Re_peat \"%s\""), basename); - reshow = g_strdup_printf (_("R_e-show \"%s\""), basename); - - g_free (basename); - - gimp_item_factory_set_label (GTK_ITEM_FACTORY (item_factory), - "/Filters/Repeat Last", repeat); - gimp_item_factory_set_label (GTK_ITEM_FACTORY (item_factory), - "/Filters/Re-Show Last", reshow); - - g_free (repeat); - g_free (reshow); - - gimp_item_factory_set_sensitive (GTK_ITEM_FACTORY (item_factory), - "/Filters/Repeat Last", - sensitive); - gimp_item_factory_set_sensitive (GTK_ITEM_FACTORY (item_factory), - "/Filters/Re-Show Last", - sensitive); - } - } - } - - if (is_image_factory && ! item_factory->gimp->last_plug_in) - { - gimp_item_factory_set_label (GTK_ITEM_FACTORY (item_factory), - "/Filters/Repeat Last", - _("Repeat Last")); - gimp_item_factory_set_label (GTK_ITEM_FACTORY (item_factory), - "/Filters/Re-Show Last", - _("Re-Show Last")); - - gimp_item_factory_set_sensitive (GTK_ITEM_FACTORY (item_factory), - "/Filters/Repeat Last", FALSE); - gimp_item_factory_set_sensitive (GTK_ITEM_FACTORY (item_factory), - "/Filters/Re-Show Last", FALSE); - } + if (merge_id) + gtk_ui_manager_remove_ui (GTK_UI_MANAGER (manager), merge_id); } /* private functions */ -static gboolean -plug_in_menu_tree_traverse_func (gpointer foo, - PlugInMenuEntry *menu_entry, - GimpItemFactory *item_factory) -{ - plug_in_menus_create_entry (item_factory, - menu_entry->proc_def, - menu_entry->locale_domain, - menu_entry->help_domain); - - return FALSE; -} - static gboolean plug_in_menus_tree_traverse (gpointer foo, PlugInProcDef *proc_def, @@ -557,8 +278,10 @@ plug_in_menus_build_path (GimpUIManager *manager, p = strrchr (action_path, '/'); *p = '\0'; +#if 0 g_print ("adding UI for '%s' (@ %s)\n", path, action_path); +#endif name = strrchr (path, '/') + 1; diff --git a/app/gui/plug-in-menus.h b/app/gui/plug-in-menus.h index c4389b0f87..20a9885527 100644 --- a/app/gui/plug-in-menus.h +++ b/app/gui/plug-in-menus.h @@ -32,16 +32,5 @@ void plug_in_menus_add_proc (GimpUIManager *manager, void plug_in_menus_remove_proc (GimpUIManager *manager, PlugInProcDef *proc_def); -void plug_in_menus_create (GimpItemFactory *item_factory, - GSList *proc_defs); -void plug_in_menus_create_entry (GimpItemFactory *item_factory, - PlugInProcDef *proc_def, - const gchar *locale_domain, - const gchar *help_domain); -void plug_in_menus_delete_entry (PlugInProcDef *proc_def); - -void plug_in_menus_update (GimpItemFactory *item_factory, - GimpImageType type); - #endif /* __PLUG_IN_MENUS_H__ */ diff --git a/app/gui/qmask-menu.c b/app/gui/qmask-menu.c deleted file mode 100644 index 7d312c617e..0000000000 --- a/app/gui/qmask-menu.c +++ /dev/null @@ -1,97 +0,0 @@ -/* The GIMP -- an image manipulation program - * Copyright (C) 1995 Spencer Kimball and Peter Mattis - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -#include "config.h" - -#include - -#include "libgimpwidgets/gimpwidgets.h" - -#include "gui-types.h" - -#include "core/gimpimage.h" - -#include "widgets/gimphelp-ids.h" -#include "widgets/gimpitemfactory.h" - -#include "display/gimpdisplay.h" -#include "display/gimpdisplayshell.h" - -#include "actions/qmask-commands.h" - -#include "qmask-menu.h" -#include "menus.h" - -#include "gimp-intl.h" - - -GimpItemFactoryEntry qmask_menu_entries[] = -{ - { { N_("/_QMask Active"), NULL, - qmask_toggle_cmd_callback, 0, "" }, - NULL, - GIMP_HELP_QMASK_TOGGLE, NULL }, - - MENU_SEPARATOR ("/---"), - - { { N_("/Mask _Selected Areas"), NULL, - qmask_invert_cmd_callback, TRUE, "" }, - NULL, - GIMP_HELP_QMASK_INVERT, NULL }, - { { N_("/Mask _Unselected Areas"), NULL, - qmask_invert_cmd_callback, FALSE, "/Mask Selected Areas" }, - NULL, - GIMP_HELP_QMASK_INVERT, NULL }, - - MENU_SEPARATOR ("/---"), - - { { N_("/_Configure Color and Opacity..."), NULL, - qmask_configure_cmd_callback, 0 }, - NULL, - GIMP_HELP_QMASK_EDIT, NULL } -}; - -gint n_qmask_menu_entries = G_N_ELEMENTS (qmask_menu_entries); - - -void -qmask_menu_update (GtkItemFactory *factory, - gpointer data) -{ - GimpDisplayShell *shell; - - shell = GIMP_DISPLAY_SHELL (data); - -#define SET_ACTIVE(menu,active) \ - gimp_item_factory_set_active (factory, "/" menu, (active)) -#define SET_COLOR(menu,color) \ - gimp_item_factory_set_color (factory, "/" menu, (color), FALSE) - - SET_ACTIVE ("QMask Active", shell->gdisp->gimage->qmask_state); - - if (shell->gdisp->gimage->qmask_inverted) - SET_ACTIVE ("Mask Selected Areas", TRUE); - else - SET_ACTIVE ("Mask Unselected Areas", TRUE); - - SET_COLOR ("Configure Color and Opacity...", - &shell->gdisp->gimage->qmask_color); - -#undef SET_SENSITIVE -#undef SET_COLOR -} diff --git a/app/gui/qmask-menu.h b/app/gui/qmask-menu.h deleted file mode 100644 index 85399adace..0000000000 --- a/app/gui/qmask-menu.h +++ /dev/null @@ -1,31 +0,0 @@ -/* The GIMP -- an image manipulation program - * Copyright (C) 1995 Spencer Kimball and Peter Mattis - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -#ifndef __QMASK_MENU_H__ -#define __QMASK_MENU_H__ - - -extern GimpItemFactoryEntry qmask_menu_entries[]; -extern gint n_qmask_menu_entries; - - -void qmask_menu_update (GtkItemFactory *factory, - gpointer data); - - -#endif /* __QMASK_MENU_H__ */ diff --git a/app/gui/templates-menu.c b/app/gui/templates-menu.c deleted file mode 100644 index 082e888d41..0000000000 --- a/app/gui/templates-menu.c +++ /dev/null @@ -1,98 +0,0 @@ -/* The GIMP -- an image manipulation program - * Copyright (C) 1995 Spencer Kimball and Peter Mattis - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -#include "config.h" - -#include - -#include "libgimpwidgets/gimpwidgets.h" - -#include "gui-types.h" - -#include "core/gimpcontext.h" - -#include "widgets/gimpcontainereditor.h" -#include "widgets/gimpcontainerview.h" -#include "widgets/gimphelp-ids.h" -#include "widgets/gimpitemfactory.h" - -#include "actions/templates-commands.h" - -#include "templates-menu.h" -#include "menus.h" - -#include "gimp-intl.h" - - -GimpItemFactoryEntry templates_menu_entries[] = -{ - { { N_("/_Create Image from Template..."), "", - templates_create_image_cmd_callback, 0, - "", GIMP_STOCK_IMAGE }, - NULL, - GIMP_HELP_TEMPLATE_IMAGE_NEW, NULL }, - - MENU_SEPARATOR ("/---"), - - { { N_("/_New Template..."), "", - templates_new_template_cmd_callback, 0, - "", GTK_STOCK_NEW }, - NULL, - GIMP_HELP_TEMPLATE_NEW, NULL }, - { { N_("/D_uplicate Template..."), "", - templates_duplicate_template_cmd_callback, 0, - "", GIMP_STOCK_DUPLICATE }, - NULL, - GIMP_HELP_TEMPLATE_DUPLICATE, NULL }, - { { N_("/_Edit Template..."), "", - templates_edit_template_cmd_callback, 0, - "", GIMP_STOCK_EDIT }, - NULL, - GIMP_HELP_TEMPLATE_EDIT, NULL }, - { { N_("/_Delete Template"), "", - templates_delete_template_cmd_callback, 0, - "", GTK_STOCK_DELETE }, - NULL, - GIMP_HELP_TEMPLATE_DELETE, NULL } -}; - -gint n_templates_menu_entries = G_N_ELEMENTS (templates_menu_entries); - - -void -templates_menu_update (GtkItemFactory *factory, - gpointer data) -{ - GimpContainerEditor *editor; - GimpTemplate *template; - - editor = GIMP_CONTAINER_EDITOR (data); - - template = gimp_context_get_template (editor->view->context); - -#define SET_SENSITIVE(menu,condition) \ - gimp_item_factory_set_sensitive (factory, menu, (condition) != 0) - - SET_SENSITIVE ("/Create Image from Template...", template); - SET_SENSITIVE ("/New Template...", TRUE); - SET_SENSITIVE ("/Duplicate Template...", template); - SET_SENSITIVE ("/Edit Template...", template); - SET_SENSITIVE ("/Delete Template", template); - -#undef SET_SENSITIVE -} diff --git a/app/gui/templates-menu.h b/app/gui/templates-menu.h deleted file mode 100644 index 32180c152f..0000000000 --- a/app/gui/templates-menu.h +++ /dev/null @@ -1,31 +0,0 @@ -/* The GIMP -- an image manipulation program - * Copyright (C) 1995 Spencer Kimball and Peter Mattis - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -#ifndef __TEMPLATES_MENU_H__ -#define __TEMPLATES_MENU_H__ - - -extern GimpItemFactoryEntry templates_menu_entries[]; -extern gint n_templates_menu_entries; - - -void templates_menu_update (GtkItemFactory *factory, - gpointer data); - - -#endif /* __TEMPLATES_MENU_H__ */ diff --git a/app/gui/tool-options-menu.c b/app/gui/tool-options-menu.c index 8cd2a7c837..9d99b6bd33 100644 --- a/app/gui/tool-options-menu.c +++ b/app/gui/tool-options-menu.c @@ -40,6 +40,10 @@ #include "gimp-intl.h" +#define MENU_BRANCH(path) \ + { { (path), NULL, NULL, 0, "" }, NULL, NULL, NULL } + + /* local function prototypes */ static void tool_options_menu_update_presets (GtkItemFactory *factory, diff --git a/app/gui/toolbox-menu.c b/app/gui/toolbox-menu.c index fa1b73ce41..b158b80dd5 100644 --- a/app/gui/toolbox-menu.c +++ b/app/gui/toolbox-menu.c @@ -20,339 +20,17 @@ #include -#include "libgimpwidgets/gimpwidgets.h" - #include "gui-types.h" -#include "core/gimp.h" - -#include "plug-in/plug-ins.h" - -#include "widgets/gimphelp-ids.h" -#include "widgets/gimpitemfactory.h" - -#include "actions/debug-commands.h" -#include "actions/dialogs-commands.h" -#include "actions/file-commands.h" -#include "actions/help-commands.h" - #include "menus.h" #include "plug-in-menus.h" #include "toolbox-menu.h" -#include "gimp-intl.h" - - -GimpItemFactoryEntry toolbox_menu_entries[] = -{ - /* /File */ - - MENU_BRANCH (N_("/_File")), - - { { N_("/File/_New..."), "N", - file_new_cmd_callback, 0, - "", GTK_STOCK_NEW }, - NULL, - GIMP_HELP_FILE_NEW, NULL }, - { { N_("/File/_Open..."), "O", - file_open_cmd_callback, 0, - "", GTK_STOCK_OPEN }, - NULL, - GIMP_HELP_FILE_OPEN, NULL }, - - /* /File/Open Recent */ - - MENU_BRANCH (N_("/File/Open _Recent")), - - { { N_("/File/Open Recent/(None)"), NULL, NULL, 0 }, - NULL, NULL, NULL }, - - MENU_SEPARATOR ("/File/Open Recent/---"), - - { { N_("/File/Open Recent/Document _History"), "foo", - dialogs_create_dockable_cmd_callback, 0, - "", GTK_STOCK_OPEN }, - "gimp-document-list|gimp-document-grid", - GIMP_HELP_DOCUMENT_DIALOG, NULL }, - - /* /File/Acquire */ - - MENU_BRANCH (N_("/File/_Acquire")), - - MENU_SEPARATOR ("/File/---"), - - { { N_("/File/_Preferences"), NULL, - dialogs_create_toplevel_cmd_callback, 0, - "", GTK_STOCK_PREFERENCES }, - "gimp-preferences-dialog", - GIMP_HELP_PREFS_DIALOG, NULL }, - - /* /File/Dialogs */ - - MENU_BRANCH (N_("/File/_Dialogs")), - - MENU_BRANCH (N_("/File/Dialogs/Create New Doc_k")), - - { { N_("/File/Dialogs/Create New Dock/_Layers, Channels & Paths"), NULL, - dialogs_create_lc_cmd_callback, 0 }, - NULL, - NULL, NULL }, - { { N_("/File/Dialogs/Create New Dock/_Brushes, Patterns & Gradients"), NULL, - dialogs_create_data_cmd_callback, 0 }, - NULL, - NULL, NULL }, - { { N_("/File/Dialogs/Create New Dock/_Misc. Stuff"), NULL, - dialogs_create_stuff_cmd_callback, 0 }, - NULL, - NULL, NULL }, - - { { N_("/File/Dialogs/Tool _Options"), "T", - dialogs_create_dockable_cmd_callback, 0, - "", GIMP_STOCK_TOOL_OPTIONS }, - "gimp-tool-options", - GIMP_HELP_TOOL_OPTIONS_DIALOG, NULL }, - { { N_("/File/Dialogs/_Device Status"), NULL, - dialogs_create_dockable_cmd_callback, 0, - "", GIMP_STOCK_DEVICE_STATUS }, - "gimp-device-status", - GIMP_HELP_DEVICE_STATUS_DIALOG, NULL }, - - MENU_SEPARATOR ("/File/Dialogs/---"), - - { { N_("/File/Dialogs/_Layers"), "L", - dialogs_create_dockable_cmd_callback, 0, - "", GIMP_STOCK_LAYERS }, - "gimp-layer-list", - GIMP_HELP_LAYER_DIALOG, NULL }, - { { N_("/File/Dialogs/_Channels"), NULL, - dialogs_create_dockable_cmd_callback, 0, - "", GIMP_STOCK_CHANNELS }, - "gimp-channel-list", - GIMP_HELP_CHANNEL_DIALOG, NULL }, - { { N_("/File/Dialogs/_Paths"), NULL, - dialogs_create_dockable_cmd_callback, 0, - "", GIMP_STOCK_PATHS }, - "gimp-vectors-list", - GIMP_HELP_PATH_DIALOG, NULL }, - { { N_("/File/Dialogs/Inde_xed Palette"), NULL, - dialogs_create_dockable_cmd_callback, 0, - "", GIMP_STOCK_INDEXED_PALETTE }, - "gimp-indexed-palette", - GIMP_HELP_INDEXED_PALETTE_DIALOG, NULL }, - { { N_("/File/Dialogs/Histogra_m"), NULL, - dialogs_create_dockable_cmd_callback, 0, - "", GIMP_STOCK_HISTOGRAM }, - "gimp-histogram-editor", - GIMP_HELP_HISTOGRAM_DIALOG, NULL }, - { { N_("/File/Dialogs/_Selection Editor"), NULL, - dialogs_create_dockable_cmd_callback, 0, - "", GIMP_STOCK_TOOL_RECT_SELECT }, - "gimp-selection-editor", - GIMP_HELP_SELECTION_DIALOG, NULL }, - { { N_("/File/Dialogs/Na_vigation"), NULL, - dialogs_create_dockable_cmd_callback, 0, - "", GIMP_STOCK_NAVIGATION }, - "gimp-navigation-view", - GIMP_HELP_NAVIGATION_DIALOG, NULL }, - { { N_("/File/Dialogs/_Undo History"), NULL, - dialogs_create_dockable_cmd_callback, 0, - "", GIMP_STOCK_UNDO_HISTORY }, - "gimp-undo-history", - GIMP_HELP_UNDO_DIALOG, NULL }, - - MENU_SEPARATOR ("/File/Dialogs/---"), - - { { N_("/File/Dialogs/Colo_rs"), NULL, - dialogs_create_dockable_cmd_callback, 0, - "", GIMP_STOCK_DEFAULT_COLORS }, - "gimp-color-editor", - GIMP_HELP_COLOR_DIALOG, NULL }, - { { N_("/File/Dialogs/Brus_hes"), "B", - dialogs_create_dockable_cmd_callback, 0, - "", GIMP_STOCK_BRUSH }, - "gimp-brush-grid", - GIMP_HELP_BRUSH_DIALOG, NULL }, - { { N_("/File/Dialogs/P_atterns"), "P", - dialogs_create_dockable_cmd_callback, 0, - "", GIMP_STOCK_PATTERN }, - "gimp-pattern-grid", - GIMP_HELP_PATTERN_DIALOG, NULL }, - { { N_("/File/Dialogs/_Gradients"), "G", - dialogs_create_dockable_cmd_callback, 0, - "", GIMP_STOCK_GRADIENT }, - "gimp-gradient-list|gimp-gradient-grid", - GIMP_HELP_GRADIENT_DIALOG, NULL }, - { { N_("/File/Dialogs/Pal_ettes"), "P", - dialogs_create_dockable_cmd_callback, 0, - "", GIMP_STOCK_PALETTE }, - "gimp-palette-list|gimp-palette-list", - GIMP_HELP_PALETTE_DIALOG, NULL }, - { { N_("/File/Dialogs/_Fonts"), NULL, - dialogs_create_dockable_cmd_callback, 0, - "", GIMP_STOCK_FONT }, - "gimp-font-list|gimp-font-grid", - GIMP_HELP_FONT_DIALOG, NULL }, - { { N_("/File/Dialogs/_Buffers"), "foo", - dialogs_create_dockable_cmd_callback, 0, - "", GIMP_STOCK_BUFFER }, - "gimp-buffer-list|gimp-buffer-grid", - GIMP_HELP_BUFFER_DIALOG, NULL }, - - MENU_SEPARATOR ("/File/Dialogs/---"), - - { { N_("/File/Dialogs/_Images"), NULL, - dialogs_create_dockable_cmd_callback, 0, - "", GIMP_STOCK_IMAGES }, - "gimp-image-list|gimp-image-grid", - GIMP_HELP_IMAGE_DIALOG, NULL }, - { { N_("/File/Dialogs/Document Histor_y"), "", - dialogs_create_dockable_cmd_callback, 0, - "", GTK_STOCK_OPEN }, - "gimp-document-list|gimp-document-grid", - GIMP_HELP_DOCUMENT_DIALOG, NULL }, - { { N_("/File/Dialogs/_Templates"), "", - dialogs_create_dockable_cmd_callback, 0, - "", GIMP_STOCK_TEMPLATE }, - "gimp-template-list|gimp-template-grid", - GIMP_HELP_TEMPLATE_DIALOG, NULL }, - { { N_("/File/Dialogs/T_ools"), NULL, - dialogs_create_dockable_cmd_callback, 0, - "", GIMP_STOCK_TOOLS }, - "gimp-tool-list|gimp-tool-grid", - GIMP_HELP_TOOLS_DIALOG, NULL }, - { { N_("/File/Dialogs/Error Co_nsole"), NULL, - dialogs_create_dockable_cmd_callback, 0, - "", GIMP_STOCK_WARNING }, - "gimp-error-console", - GIMP_HELP_ERRORS_DIALOG, NULL }, - -#ifdef ENABLE_DEBUG_MENU - MENU_BRANCH (N_("/File/D_ebug")), - - { { "/File/Debug/_Mem Profile", NULL, - debug_mem_profile_cmd_callback, 0 }, - NULL, NULL, NULL }, - { { "/File/Debug/_Dump Items", NULL, - debug_dump_menus_cmd_callback, 0 }, - NULL, NULL, NULL }, -#endif /* ENABLE_DEBUG_MENU */ - - MENU_SEPARATOR ("/File/---"), - - { { N_("/File/_Quit"), "Q", - file_quit_cmd_callback, 0, - "", GTK_STOCK_QUIT }, - NULL, - GIMP_HELP_FILE_QUIT, NULL }, - - /* /Xtns */ - - MENU_BRANCH (N_("/_Xtns")), - - { { N_("/Xtns/_Module Manager"), NULL, - dialogs_create_toplevel_cmd_callback, 0 }, - "gimp-module-manager-dialog", - GIMP_HELP_MODULE_DIALOG, NULL }, - - MENU_SEPARATOR ("/Xtns/---"), - - /* /Help */ - - MENU_BRANCH (N_("/_Help")), - - { { N_("/Help/_Help"), "F1", - help_help_cmd_callback, 0, - "", GTK_STOCK_HELP }, - NULL, - GIMP_HELP_HELP, NULL }, - { { N_("/Help/_Context Help"), "F1", - help_context_help_cmd_callback, 0, - "", GTK_STOCK_HELP }, - NULL, - GIMP_HELP_HELP_CONTEXT, NULL }, - { { N_("/Help/_Tip of the Day"), NULL, - dialogs_create_toplevel_cmd_callback, 0, - "", GIMP_STOCK_INFO }, - "gimp-tips-dialog", - GIMP_HELP_TIPS_DIALOG, NULL }, - { { N_("/Help/_About"), NULL, - dialogs_create_toplevel_cmd_callback, 0, - "", GIMP_STOCK_WILBER }, - "gimp-about-dialog", - GIMP_HELP_ABOUT_DIALOG, NULL } -}; - -gint n_toolbox_menu_entries = G_N_ELEMENTS (toolbox_menu_entries); - void -toolbox_menu_setup2 (GimpUIManager *manager, - const gchar *ui_path) +toolbox_menu_setup (GimpUIManager *manager, + const gchar *ui_path) { menus_open_recent_add (manager, ui_path); plug_in_menus_setup (manager, ui_path); } - -void -toolbox_menu_setup (GimpItemFactory *factory, - gpointer callback_data) -{ - static gchar *reorder_subsubmenus[] = { "/Xtns" }; - - GtkWidget *menu_item; - GtkWidget *menu; - GList *list; - gint i, pos; - - menus_last_opened_add (factory); - - plug_in_menus_create (factory, factory->gimp->plug_in_proc_defs); - - /* Move all menu items under "/Xtns" which are not submenus or - * separators to the top of the menu - */ - pos = 1; - menu_item = gtk_item_factory_get_widget (GTK_ITEM_FACTORY (factory), - "/Xtns/Module Manager"); - if (menu_item && menu_item->parent && GTK_IS_MENU (menu_item->parent)) - { - menu = menu_item->parent; - - for (list = g_list_nth (GTK_MENU_SHELL (menu)->children, pos); - list; - list = g_list_next (list)) - { - menu_item = GTK_WIDGET (list->data); - - if (! GTK_MENU_ITEM (menu_item)->submenu && - GTK_IS_LABEL (GTK_BIN (menu_item)->child)) - { - gtk_menu_reorder_child (GTK_MENU (menu_item->parent), - menu_item, pos); - list = g_list_nth (GTK_MENU_SHELL (menu)->children, pos); - pos++; - } - } - } - - for (i = 0; i < G_N_ELEMENTS (reorder_subsubmenus); i++) - { - menu = gtk_item_factory_get_widget (GTK_ITEM_FACTORY (factory), - reorder_subsubmenus[i]); - - if (menu && GTK_IS_MENU (menu)) - { - for (list = GTK_MENU_SHELL (menu)->children; - list; - list = g_list_next (list)) - { - GtkMenuItem *menu_item; - - menu_item = GTK_MENU_ITEM (list->data); - - if (menu_item->submenu) - menus_filters_subdirs_to_top (GTK_MENU (menu_item->submenu)); - } - } - } -} diff --git a/app/gui/toolbox-menu.h b/app/gui/toolbox-menu.h index 074d260649..c8e09a5838 100644 --- a/app/gui/toolbox-menu.h +++ b/app/gui/toolbox-menu.h @@ -20,15 +20,8 @@ #define __TOOLBOX_MENU_H__ -extern GimpItemFactoryEntry toolbox_menu_entries[]; -extern gint n_toolbox_menu_entries; - - -void toolbox_menu_setup2 (GimpUIManager *manager, - const gchar *ui_path); - -void toolbox_menu_setup (GimpItemFactory *factory, - gpointer callback_data); +void toolbox_menu_setup (GimpUIManager *manager, + const gchar *ui_path); #endif /* __TOOLBOX_MENU_H__ */ diff --git a/app/gui/vectors-menu.c b/app/gui/vectors-menu.c deleted file mode 100644 index 3ac34eb05a..0000000000 --- a/app/gui/vectors-menu.c +++ /dev/null @@ -1,213 +0,0 @@ -/* The GIMP -- an image manipulation program - * Copyright (C) 1995 Spencer Kimball and Peter Mattis - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -#include "config.h" - -#include - -#include "libgimpwidgets/gimpwidgets.h" - -#include "gui-types.h" - -#include "core/gimpchannel.h" -#include "core/gimpimage.h" -#include "core/gimplist.h" - -#include "widgets/gimphelp-ids.h" -#include "widgets/gimpitemfactory.h" -#include "widgets/gimpitemtreeview.h" - -#include "actions/vectors-commands.h" - -#include "vectors-menu.h" -#include "menus.h" - -#include "gimp-intl.h" - - -GimpItemFactoryEntry vectors_menu_entries[] = -{ - { { N_("/Path _Tool"), NULL, - vectors_vectors_tool_cmd_callback, 0, - "", GIMP_STOCK_TOOL_PATH }, - NULL, - GIMP_HELP_TOOL_VECTORS, NULL }, - { { N_("/_Edit Path Attributes..."), NULL, - vectors_edit_attributes_cmd_callback, 0, - "", GIMP_STOCK_EDIT }, - NULL, - GIMP_HELP_PATH_EDIT, NULL }, - - MENU_SEPARATOR ("/---"), - - { { N_("/_New Path..."), "", - vectors_new_cmd_callback, 0, - "", GTK_STOCK_NEW }, - NULL, - GIMP_HELP_PATH_NEW, NULL }, - { { N_("/_Raise Path"), "", - vectors_raise_cmd_callback, 0, - "", GTK_STOCK_GO_UP }, - NULL, - GIMP_HELP_PATH_RAISE, NULL }, - { { N_("/_Lower Path"), "", - vectors_lower_cmd_callback, 0, - "", GTK_STOCK_GO_DOWN }, - NULL, - GIMP_HELP_PATH_LOWER, NULL }, - { { N_("/D_uplicate Path"), NULL, - vectors_duplicate_cmd_callback, 0, - "", GIMP_STOCK_DUPLICATE }, - NULL, - GIMP_HELP_PATH_DUPLICATE, NULL }, - { { N_("/_Delete Path"), "", - vectors_delete_cmd_callback, 0, - "", GTK_STOCK_DELETE }, - NULL, - GIMP_HELP_PATH_DELETE, NULL }, - { { N_("/Merge _Visible Paths"), "", - vectors_merge_visible_cmd_callback, 0, - NULL, NULL }, - NULL, - GIMP_HELP_PATH_MERGE_VISIBLE, NULL }, - - MENU_SEPARATOR ("/---"), - - { { N_("/Path to Sele_ction"), NULL, - vectors_to_selection_cmd_callback, GIMP_CHANNEL_OP_REPLACE, - "", GIMP_STOCK_SELECTION_REPLACE }, - NULL, - GIMP_HELP_PATH_SELECTION_REPLACE, NULL }, - { { N_("/_Add to Selection"), NULL, - vectors_to_selection_cmd_callback, GIMP_CHANNEL_OP_ADD, - "", GIMP_STOCK_SELECTION_ADD }, - NULL, - GIMP_HELP_PATH_SELECTION_ADD, NULL }, - { { N_("/_Subtract from Selection"), NULL, - vectors_to_selection_cmd_callback, GIMP_CHANNEL_OP_SUBTRACT, - "", GIMP_STOCK_SELECTION_SUBTRACT }, - NULL, - GIMP_HELP_PATH_SELECTION_SUBTRACT, NULL }, - { { N_("/_Intersect with Selection"), NULL, - vectors_to_selection_cmd_callback, GIMP_CHANNEL_OP_INTERSECT, - "", GIMP_STOCK_SELECTION_INTERSECT }, - NULL, - GIMP_HELP_PATH_SELECTION_INTERSECT, NULL }, - - { { N_("/Selecti_on to Path"), NULL, - vectors_selection_to_vectors_cmd_callback, 0, - "", GIMP_STOCK_SELECTION_TO_PATH }, - NULL, - GIMP_HELP_SELECTION_TO_PATH, NULL }, - { { N_("/Stro_ke Path..."), NULL, - vectors_stroke_cmd_callback, 0, - "", GIMP_STOCK_PATH_STROKE }, - NULL, - GIMP_HELP_PATH_STROKE, NULL }, - - MENU_SEPARATOR ("/---"), - - { { N_("/Co_py Path"), "", - vectors_copy_cmd_callback, 0, - "", GTK_STOCK_COPY }, - NULL, - GIMP_HELP_PATH_COPY, NULL }, - - { { N_("/Paste Pat_h"), "", - vectors_paste_cmd_callback, 0, - "", GTK_STOCK_PASTE }, - NULL, - GIMP_HELP_PATH_PASTE, NULL }, - { { N_("/I_mport Path..."), "", - vectors_import_cmd_callback, 0, - "", GTK_STOCK_OPEN }, - NULL, - GIMP_HELP_PATH_IMPORT, NULL }, - { { N_("/E_xport Path..."), "", - vectors_export_cmd_callback, 0, - "", GTK_STOCK_SAVE }, - NULL, - GIMP_HELP_PATH_EXPORT, NULL } -}; - -gint n_vectors_menu_entries = G_N_ELEMENTS (vectors_menu_entries); - - -void -vectors_menu_update (GtkItemFactory *factory, - gpointer data) -{ - GimpImage *gimage; - GimpVectors *vectors = NULL; - gboolean mask_empty = TRUE; - gboolean global_buf = FALSE; - GList *next = NULL; - GList *prev = NULL; - - gimage = GIMP_ITEM_TREE_VIEW (data)->gimage; - - if (gimage) - { - GList *list; - - vectors = gimp_image_get_active_vectors (gimage); - - mask_empty = gimp_channel_is_empty (gimp_image_get_mask (gimage)); - - global_buf = FALSE; - - for (list = GIMP_LIST (gimage->vectors)->list; - list; - list = g_list_next (list)) - { - if (vectors == (GimpVectors *) list->data) - { - prev = g_list_previous (list); - next = g_list_next (list); - break; - } - } - } - -#define SET_SENSITIVE(menu,condition) \ - gimp_item_factory_set_sensitive (factory, menu, (condition) != 0) - - SET_SENSITIVE ("/Path Tool", vectors); - SET_SENSITIVE ("/Edit Path Attributes...", vectors); - - SET_SENSITIVE ("/New Path...", gimage); - SET_SENSITIVE ("/Raise Path", vectors && prev); - SET_SENSITIVE ("/Lower Path", vectors && next); - SET_SENSITIVE ("/Duplicate Path", vectors); - SET_SENSITIVE ("/Delete Path", vectors); - - SET_SENSITIVE ("/Path to Selection", vectors); - SET_SENSITIVE ("/Add to Selection", vectors); - SET_SENSITIVE ("/Subtract from Selection", vectors); - SET_SENSITIVE ("/Intersect with Selection", vectors); - - SET_SENSITIVE ("/Selection to Path", ! mask_empty); - SET_SENSITIVE ("/Stroke Path...", vectors); - - SET_SENSITIVE ("/Copy Path", vectors); - SET_SENSITIVE ("/Paste Path", global_buf); - SET_SENSITIVE ("/Import Path...", gimage); - SET_SENSITIVE ("/Export Path...", vectors); - -#undef SET_SENSITIVE -} diff --git a/app/gui/vectors-menu.h b/app/gui/vectors-menu.h deleted file mode 100644 index 91a070d1b3..0000000000 --- a/app/gui/vectors-menu.h +++ /dev/null @@ -1,31 +0,0 @@ -/* The GIMP -- an image manipulation program - * Copyright (C) 1995 Spencer Kimball and Peter Mattis - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -#ifndef __VECTORS_MENU_H__ -#define __VECTORS_MENU_H__ - - -extern GimpItemFactoryEntry vectors_menu_entries[]; -extern gint n_vectors_menu_entries; - - -void vectors_menu_update (GtkItemFactory *factory, - gpointer data); - - -#endif /* __VECTORS_MENU_H__ */ diff --git a/app/menus/file-open-menu.c b/app/menus/file-open-menu.c index 3562261cdf..3baa469f3d 100644 --- a/app/menus/file-open-menu.c +++ b/app/menus/file-open-menu.c @@ -37,7 +37,6 @@ #include "actions/file-commands.h" #include "file-open-menu.h" -#include "menus.h" #include "gimp-intl.h" @@ -49,7 +48,7 @@ GimpItemFactoryEntry file_open_menu_entries[] = NULL, GIMP_HELP_FILE_OPEN_BY_EXTENSION, NULL }, - MENU_SEPARATOR ("/---") + { { "/---", NULL, NULL, 0, "" }, NULL, NULL, NULL } }; gint n_file_open_menu_entries = G_N_ELEMENTS (file_open_menu_entries); diff --git a/app/menus/file-save-menu.c b/app/menus/file-save-menu.c index 3a43d81b4e..acf5bae1dc 100644 --- a/app/menus/file-save-menu.c +++ b/app/menus/file-save-menu.c @@ -38,7 +38,6 @@ #include "actions/file-commands.h" #include "file-save-menu.h" -#include "menus.h" #include "gimp-intl.h" @@ -50,7 +49,7 @@ GimpItemFactoryEntry file_save_menu_entries[] = NULL, GIMP_HELP_FILE_SAVE_BY_EXTENSION, NULL }, - MENU_SEPARATOR ("/---") + { { "/---", NULL, NULL, 0, "" }, NULL, NULL, NULL } }; gint n_file_save_menu_entries = G_N_ELEMENTS (file_save_menu_entries); diff --git a/app/menus/image-menu.c b/app/menus/image-menu.c index 2a1023516f..8864adaa6d 100644 --- a/app/menus/image-menu.c +++ b/app/menus/image-menu.c @@ -20,1755 +20,17 @@ #include -#include "libgimpwidgets/gimpwidgets.h" - #include "gui-types.h" -#include "config/gimpguiconfig.h" - -#include "core/gimp.h" -#include "core/gimpchannel.h" -#include "core/gimpcontext.h" -#include "core/gimpimage.h" -#include "core/gimplayer.h" -#include "core/gimplist.h" -#include "core/gimptoolinfo.h" -#include "core/gimpundostack.h" - -#include "plug-in/plug-ins.h" - -#include "text/gimptextlayer.h" - -#include "widgets/gimphelp-ids.h" -#include "widgets/gimpitemfactory.h" - -#include "display/gimpdisplay.h" -#include "display/gimpdisplayoptions.h" -#include "display/gimpdisplayshell.h" -#include "display/gimpdisplayshell-appearance.h" -#include "display/gimpdisplayshell-selection.h" - -#include "actions/dialogs-commands.h" -#include "actions/drawable-commands.h" -#include "actions/edit-commands.h" -#include "actions/file-commands.h" -#include "actions/image-commands.h" -#include "actions/layers-commands.h" -#include "actions/plug-in-commands.h" -#include "actions/select-commands.h" -#include "actions/tools-commands.h" -#include "actions/vectors-commands.h" -#include "actions/view-commands.h" - #include "image-menu.h" #include "menus.h" #include "plug-in-menus.h" -#include "gimp-intl.h" - - -#define VIEW_ZOOM_16_1 "/View/Zoom/16:1 (1600%)" -#define VIEW_ZOOM_8_1 "/View/Zoom/8:1 (800%)" -#define VIEW_ZOOM_4_1 "/View/Zoom/4:1 (400%)" -#define VIEW_ZOOM_2_1 "/View/Zoom/2:1 (200%)" -#define VIEW_ZOOM_1_1 "/View/Zoom/1:1 (100%)" -#define VIEW_ZOOM_1_2 "/View/Zoom/1:2 (50%)" -#define VIEW_ZOOM_1_4 "/View/Zoom/1:4 (25%)" -#define VIEW_ZOOM_1_8 "/View/Zoom/1:8 (12.5%)" -#define VIEW_ZOOM_1_16 "/View/Zoom/1:16 (6.25%)" - - -/* local function prototypes */ - -static void image_menu_buffer_changed (Gimp *gimp, - GimpItemFactory *item_factory); -static void image_menu_foreground_changed (GimpContext *context, - const GimpRGB *color, - GimpItemFactory *item_factory); -static void image_menu_background_changed (GimpContext *context, - const GimpRGB *color, - GimpItemFactory *item_factory); -static void image_menu_set_zoom (GtkItemFactory *item_factory, - GimpDisplayShell *shell); - - -GimpItemFactoryEntry image_menu_entries[] = -{ - { { "/tearoff", NULL, gimp_item_factory_tearoff_callback, 0, "" }, - NULL, NULL, NULL }, - - /* /File */ - - MENU_BRANCH (N_("/_File")), - - { { N_("/File/_New..."), "N", - file_new_cmd_callback, 1, - "", GTK_STOCK_NEW }, - NULL, - GIMP_HELP_FILE_NEW, NULL }, - { { N_("/File/_Open..."), "O", - file_open_cmd_callback, 1, - "", GTK_STOCK_OPEN }, - NULL, - GIMP_HELP_FILE_OPEN, NULL }, - - /* /File/Open Recent */ - - MENU_BRANCH (N_("/File/Open _Recent")), - - { { N_("/File/Open Recent/(None)"), NULL, NULL, 0 }, - NULL, NULL, NULL }, - - MENU_SEPARATOR ("/File/Open Recent/---"), - - { { N_("/File/Open Recent/Document _History"), "foo", - dialogs_create_dockable_cmd_callback, 0, - "", GTK_STOCK_OPEN }, - "gimp-document-list|gimp-document-grid", - GIMP_HELP_DOCUMENT_DIALOG, NULL }, - - MENU_SEPARATOR ("/File/---"), - - { { N_("/File/_Save"), "S", - file_save_cmd_callback, 0, - "", GTK_STOCK_SAVE }, - NULL, - GIMP_HELP_FILE_SAVE, NULL }, - { { N_("/File/Save _as..."), "S", - file_save_as_cmd_callback, 0, - "", GTK_STOCK_SAVE_AS }, - NULL, - GIMP_HELP_FILE_SAVE_AS, NULL }, - { { N_("/File/Save a Cop_y..."), NULL, - file_save_a_copy_cmd_callback, 0 }, - NULL, - GIMP_HELP_FILE_SAVE_A_COPY, NULL }, - { { N_("/File/Save as _Template..."), NULL, - file_save_template_cmd_callback, 0 }, - NULL, - GIMP_HELP_FILE_SAVE_AS_TEMPLATE, NULL }, - { { N_("/File/Re_vert"), NULL, - file_revert_cmd_callback, 0, - "", GTK_STOCK_REVERT_TO_SAVED }, - NULL, - GIMP_HELP_FILE_REVERT, NULL }, - - MENU_SEPARATOR ("/File/---"), - - { { N_( "/File/_Close"), "W", - file_close_cmd_callback, 0, - "", GTK_STOCK_CLOSE }, - NULL, - GIMP_HELP_FILE_CLOSE, NULL }, - { { N_("/File/_Quit"), "Q", - file_quit_cmd_callback, 0, - "", GTK_STOCK_QUIT }, - NULL, - GIMP_HELP_FILE_QUIT, NULL }, - - MENU_SEPARATOR ("/File/---moved"), - - /* /Edit */ - - MENU_BRANCH (N_("/_Edit")), - - { { N_("/Edit/_Undo"), "Z", - edit_undo_cmd_callback, 0, - "", GTK_STOCK_UNDO }, - NULL, - GIMP_HELP_EDIT_UNDO, NULL }, - { { N_("/Edit/_Redo"), "Y", - edit_redo_cmd_callback, 0, - "", GTK_STOCK_REDO }, - NULL, - GIMP_HELP_EDIT_REDO, NULL }, - { { N_("/Edit/Undo _History"), NULL, - dialogs_create_dockable_cmd_callback, 0, - "", GIMP_STOCK_UNDO_HISTORY }, - "gimp-undo-history", - GIMP_HELP_UNDO_DIALOG, NULL }, - - MENU_SEPARATOR ("/Edit/---"), - - { { N_("/Edit/Cu_t"), "X", - edit_cut_cmd_callback, 0, - "", GTK_STOCK_CUT }, - NULL, - GIMP_HELP_EDIT_CUT, NULL }, - { { N_("/Edit/_Copy"), "C", - edit_copy_cmd_callback, 0, - "", GTK_STOCK_COPY }, - NULL, - GIMP_HELP_EDIT_COPY, NULL }, - { { N_("/Edit/_Paste"), "V", - edit_paste_cmd_callback, 0, - "", GTK_STOCK_PASTE }, - NULL, - GIMP_HELP_EDIT_PASTE, NULL }, - { { N_("/Edit/Paste _Into"), NULL, - edit_paste_into_cmd_callback, 0, - "", GIMP_STOCK_PASTE_INTO }, - NULL, - GIMP_HELP_EDIT_PASTE_INTO, NULL }, - { { N_("/Edit/Paste as _New"), NULL, - edit_paste_as_new_cmd_callback, 0, - "", GIMP_STOCK_PASTE_AS_NEW }, - NULL, - GIMP_HELP_EDIT_PASTE_AS_NEW, NULL }, - - /* /Edit/Buffer */ - - MENU_BRANCH (N_("/Edit/_Buffer")), - - { { N_("/Edit/Buffer/Cu_t Named..."), "X", - edit_named_cut_cmd_callback, 0, - "", GTK_STOCK_CUT }, - NULL, - GIMP_HELP_BUFFER_CUT, NULL }, - { { N_("/Edit/Buffer/_Copy Named..."), "C", - edit_named_copy_cmd_callback, 0, - "", GTK_STOCK_COPY }, - NULL, - GIMP_HELP_BUFFER_COPY, NULL }, - { { N_("/Edit/Buffer/_Paste Named..."), "V", - edit_named_paste_cmd_callback, 0, - "", GTK_STOCK_PASTE }, - NULL, - GIMP_HELP_BUFFER_PASTE, NULL }, - - MENU_SEPARATOR ("/Edit/---"), - - { { N_("/Edit/Cl_ear"), "K", - edit_clear_cmd_callback, 0, - "", GTK_STOCK_CLEAR }, - NULL, - GIMP_HELP_EDIT_CLEAR, NULL }, - { { N_("/Edit/Fill with _FG Color"), "comma", - edit_fill_cmd_callback, (guint) GIMP_FOREGROUND_FILL, - "", GIMP_STOCK_TOOL_BUCKET_FILL }, - NULL, - GIMP_HELP_EDIT_FILL_FG, NULL }, - { { N_("/Edit/Fill with B_G Color"), "period", - edit_fill_cmd_callback, (guint) GIMP_BACKGROUND_FILL, - "", GIMP_STOCK_TOOL_BUCKET_FILL }, - NULL, - GIMP_HELP_EDIT_FILL_BG, NULL }, - { { N_("/Edit/Fill with P_attern"), NULL, - edit_fill_cmd_callback, (guint) GIMP_PATTERN_FILL, - "", GIMP_STOCK_TOOL_BUCKET_FILL }, - NULL, - GIMP_HELP_EDIT_FILL_PATTERN, NULL }, - { { N_("/Edit/_Stroke Selection..."), NULL, - edit_stroke_cmd_callback, 0, - "", GIMP_STOCK_SELECTION_STROKE }, - NULL, - GIMP_HELP_SELECTION_STROKE, NULL }, - { { N_("/Edit/St_roke Path..."), NULL, - vectors_stroke_cmd_callback, 0, - "", GIMP_STOCK_PATH_STROKE }, - NULL, - GIMP_HELP_PATH_STROKE, NULL }, - - MENU_SEPARATOR ("/Edit/---"), - - /* /Select */ - - MENU_BRANCH (N_("/_Select")), - - { { N_("/Select/_All"), "A", - select_all_cmd_callback, 0, - "", GIMP_STOCK_SELECTION_ALL }, - NULL, - GIMP_HELP_SELECTION_ALL, NULL }, - { { N_("/Select/_None"), "A", - select_none_cmd_callback, 0, - "", GIMP_STOCK_SELECTION_NONE }, - NULL, - GIMP_HELP_SELECTION_NONE, NULL }, - { { N_("/Select/_Invert"), "I", - select_invert_cmd_callback, 0, - "", GIMP_STOCK_INVERT }, - NULL, - GIMP_HELP_SELECTION_INVERT, NULL }, - { { N_("/Select/Fr_om Path"), "V", - select_from_vectors_cmd_callback, 0, - "", GIMP_STOCK_SELECTION_REPLACE }, - NULL, - GIMP_HELP_SELECTION_NONE, NULL }, - { { N_("/Select/_Float"), "L", - select_float_cmd_callback, 0, - "", GIMP_STOCK_FLOATING_SELECTION }, - NULL, - GIMP_HELP_SELECTION_FLOAT, NULL }, - { { N_("/Select/_By Color"), "O", - tools_select_cmd_callback, 0, - "", GIMP_STOCK_TOOL_BY_COLOR_SELECT }, - "gimp-by-color-select-tool", - GIMP_HELP_TOOL_BY_COLOR_SELECT, NULL }, - - MENU_SEPARATOR ("/Select/---"), - - { { N_("/Select/Fea_ther..."), NULL, - select_feather_cmd_callback, 0 }, - NULL, - GIMP_HELP_SELECTION_FEATHER, NULL }, - { { N_("/Select/_Sharpen"), NULL, - select_sharpen_cmd_callback, 0 }, - NULL, - GIMP_HELP_SELECTION_SHARPEN, NULL }, - { { N_("/Select/S_hrink..."), NULL, - select_shrink_cmd_callback, 0, - "", GIMP_STOCK_SELECTION_SHRINK }, - NULL, - GIMP_HELP_SELECTION_SHRINK, NULL }, - { { N_("/Select/_Grow..."), NULL, - select_grow_cmd_callback, 0, - "", GIMP_STOCK_SELECTION_GROW }, - NULL, - GIMP_HELP_SELECTION_GROW, NULL }, - { { N_("/Select/Bo_rder..."), NULL, - select_border_cmd_callback, 0, - "", GIMP_STOCK_SELECTION_BORDER }, - NULL, - GIMP_HELP_SELECTION_BORDER, NULL }, - - MENU_SEPARATOR ("/Select/---"), - - { { N_("/Select/Toggle _QuickMask"), "Q", - select_toggle_quickmask_cmd_callback, 0, - "", GIMP_STOCK_QMASK_ON }, - NULL, - GIMP_HELP_QMASK_TOGGLE, NULL }, - { { N_("/Select/Save to _Channel"), NULL, - select_save_cmd_callback, 0, - "", GIMP_STOCK_SELECTION_TO_CHANNEL }, - NULL, - GIMP_HELP_SELECTION_TO_CHANNEL, NULL }, - { { N_("/Select/To _Path"), NULL, - vectors_selection_to_vectors_cmd_callback, 0, - "", GIMP_STOCK_SELECTION_TO_PATH }, - NULL, - GIMP_HELP_SELECTION_TO_PATH, NULL }, - - /* /View */ - - MENU_BRANCH (N_("/_View")), - - { { N_("/View/_New View"), "", - view_new_view_cmd_callback, 0, - "", GTK_STOCK_NEW }, - NULL, - GIMP_HELP_VIEW_NEW, NULL }, - { { N_("/View/_Dot for Dot"), NULL, - view_dot_for_dot_cmd_callback, 0, "" }, - NULL, - GIMP_HELP_VIEW_DOT_FOR_DOT, NULL }, - - /* /View/Zoom */ - - MENU_BRANCH (N_("/View/_Zoom")), - - { { N_("/View/Zoom/Zoom _Out"), "minus", - view_zoom_out_cmd_callback, 0, - "", GTK_STOCK_ZOOM_OUT }, - NULL, - GIMP_HELP_VIEW_ZOOM_OUT, NULL }, - { { N_("/View/Zoom/Zoom _In"), "plus", - view_zoom_in_cmd_callback, 0, - "", GTK_STOCK_ZOOM_IN }, - NULL, - GIMP_HELP_VIEW_ZOOM_IN, NULL }, - { { N_("/View/Zoom/Zoom to _Fit Window"), "E", - view_zoom_fit_cmd_callback, 0, - "", GTK_STOCK_ZOOM_FIT }, - NULL, - GIMP_HELP_VIEW_ZOOM_FIT, NULL }, - - MENU_SEPARATOR ("/View/Zoom/---"), - - { { N_("/View/Zoom/16:1 (1600%)"), NULL, - view_zoom_cmd_callback, 160000, "" }, - NULL, - GIMP_HELP_VIEW_ZOOM_IN, NULL }, - { { N_("/View/Zoom/8:1 (800%)"), NULL, - view_zoom_cmd_callback, 80000, VIEW_ZOOM_16_1 }, - NULL, - GIMP_HELP_VIEW_ZOOM_IN, NULL }, - { { N_("/View/Zoom/4:1 (400%)"), NULL, - view_zoom_cmd_callback, 40000, VIEW_ZOOM_16_1 }, - NULL, - GIMP_HELP_VIEW_ZOOM_IN, NULL }, - { { N_("/View/Zoom/2:1 (200%)"), NULL, - view_zoom_cmd_callback, 20000, VIEW_ZOOM_16_1 }, - NULL, - GIMP_HELP_VIEW_ZOOM_IN, NULL }, - { { N_("/View/Zoom/1:1 (100%)"), "1", - view_zoom_cmd_callback, 10000, VIEW_ZOOM_16_1 }, - NULL, - GIMP_HELP_VIEW_ZOOM_100, NULL }, - { { N_("/View/Zoom/1:2 (50%)"), NULL, - view_zoom_cmd_callback, 5000, VIEW_ZOOM_16_1 }, - NULL, - GIMP_HELP_VIEW_ZOOM_OUT, NULL }, - { { N_("/View/Zoom/1:4 (25%)"), NULL, - view_zoom_cmd_callback, 2500, VIEW_ZOOM_16_1 }, - NULL, - GIMP_HELP_VIEW_ZOOM_OUT, NULL }, - { { N_("/View/Zoom/1:8 (12.5%)"), NULL, - view_zoom_cmd_callback, 1250, VIEW_ZOOM_16_1 }, - NULL, - GIMP_HELP_VIEW_ZOOM_OUT, NULL }, - { { N_("/View/Zoom/1:16 (6.25%)"), NULL, - view_zoom_cmd_callback, 625, VIEW_ZOOM_16_1 }, - NULL, - GIMP_HELP_VIEW_ZOOM_OUT, NULL }, - - MENU_SEPARATOR ("/View/Zoom/---"), - - { { "/View/Zoom/O_ther...", NULL, - view_zoom_other_cmd_callback, 0, VIEW_ZOOM_16_1 }, - NULL, - GIMP_HELP_VIEW_ZOOM_OTHER, NULL }, - - MENU_SEPARATOR ("/View/---"), - - { { N_("/View/_Info Window"), "I", - view_info_window_cmd_callback, 0, - "", GIMP_STOCK_INFO }, - NULL, - GIMP_HELP_INFO_DIALOG, NULL }, - { { N_("/View/Na_vigation Window"), "N", - view_navigation_window_cmd_callback, 0, - "", GIMP_STOCK_NAVIGATION }, - NULL, - GIMP_HELP_NAVIGATION_DIALOG, NULL }, - { { N_("/View/Display _Filters..."), NULL, - view_display_filters_cmd_callback, 0, - "", GIMP_STOCK_DISPLAY_FILTER }, - NULL, - GIMP_HELP_DISPLAY_FILTER_DIALOG, NULL }, - - MENU_SEPARATOR ("/View/---"), - - { { N_("/View/Show _Selection"), "T", - view_toggle_selection_cmd_callback, 0, "" }, - NULL, - GIMP_HELP_VIEW_SHOW_SELECTION, NULL }, - { { N_("/View/Show _Layer Boundary"), NULL, - view_toggle_layer_boundary_cmd_callback, 0, "" }, - NULL, - GIMP_HELP_VIEW_SHOW_LAYER_BOUNDARY, NULL }, - { { N_("/View/Show _Guides"), "T", - view_toggle_guides_cmd_callback, 0, "" }, - NULL, - GIMP_HELP_VIEW_SHOW_GUIDES, NULL }, - { { N_("/View/Sn_ap to Guides"), NULL, - view_snap_to_guides_cmd_callback, 0, "" }, - NULL, - GIMP_HELP_VIEW_SNAP_TO_GUIDES, NULL }, - { { N_("/View/S_how Grid"), NULL, - view_toggle_grid_cmd_callback, 0, "" }, - NULL, - GIMP_HELP_VIEW_SHOW_GRID, NULL }, - { { N_("/View/Sna_p to Grid"), NULL, - view_snap_to_grid_cmd_callback, 0, "" }, - NULL, - GIMP_HELP_VIEW_SNAP_TO_GRID, NULL }, - - MENU_SEPARATOR ("/View/---"), - - { { N_("/View/Show _Menubar"), NULL, - view_toggle_menubar_cmd_callback, 0, "" }, - NULL, - GIMP_HELP_VIEW_SHOW_MENUBAR, NULL }, - { { N_("/View/Show R_ulers"), "R", - view_toggle_rulers_cmd_callback, 0, "" }, - NULL, - GIMP_HELP_VIEW_SHOW_RULERS, NULL }, - { { N_("/View/Show Scroll_bars"), NULL, - view_toggle_scrollbars_cmd_callback, 0, "" }, - NULL, - GIMP_HELP_VIEW_SHOW_SCROLLBARS, NULL }, - { { N_("/View/Show S_tatusbar"), NULL, - view_toggle_statusbar_cmd_callback, 0, "" }, - NULL, - GIMP_HELP_VIEW_SHOW_STATUSBAR, NULL }, - - MENU_SEPARATOR ("/View/---"), - - { { N_("/View/Shrink _Wrap"), "E", - view_shrink_wrap_cmd_callback, 0 }, - NULL, - GIMP_HELP_VIEW_SHRINK_WRAP, NULL }, - - { { N_("/View/Fullscr_een"), "F11", - view_fullscreen_cmd_callback, 0, "" }, - NULL, - GIMP_HELP_VIEW_FULLSCREEN, NULL }, - - { { N_("/View/Move to Screen..."), NULL, - view_change_screen_cmd_callback, 0, - "", GIMP_STOCK_MOVE_TO_SCREEN }, - NULL, - GIMP_HELP_VIEW_CHANGE_SCREEN, NULL }, - - /* /Image */ - - MENU_BRANCH (N_("/_Image")), - - /* /Image/Mode */ - - MENU_BRANCH (N_("/Image/_Mode")), - - { { N_("/Image/Mode/_RGB"), NULL, - image_convert_rgb_cmd_callback, 0, - "", GIMP_STOCK_CONVERT_RGB }, - NULL, - GIMP_HELP_IMAGE_CONVERT_RGB, NULL }, - { { N_("/Image/Mode/_Grayscale"), NULL, - image_convert_grayscale_cmd_callback, 0, - "", GIMP_STOCK_CONVERT_GRAYSCALE }, - NULL, - GIMP_HELP_IMAGE_CONVERT_GRAYSCALE, NULL }, - { { N_("/Image/Mode/_Indexed..."), NULL, - image_convert_indexed_cmd_callback, 0, - "", GIMP_STOCK_CONVERT_INDEXED }, - NULL, - GIMP_HELP_IMAGE_CONVERT_INDEXED, NULL }, - - /* /Image/Transform */ - - MENU_BRANCH (N_("/Image/_Transform")), - - { { N_("/Image/Transform/Flip _Horizontally"), NULL, - image_flip_cmd_callback, GIMP_ORIENTATION_HORIZONTAL, - "", GIMP_STOCK_FLIP_HORIZONTAL }, - NULL, - GIMP_HELP_IMAGE_FLIP_HORIZONTAL, NULL }, - { { N_("/Image/Transform/Flip _Vertically"), NULL, - image_flip_cmd_callback, GIMP_ORIENTATION_VERTICAL, - "", GIMP_STOCK_FLIP_VERTICAL }, - NULL, - GIMP_HELP_IMAGE_FLIP_VERTICAL, NULL }, - - MENU_SEPARATOR ("/Image/Transform/---"), - - /* please use the degree symbol in the translation */ - { { N_("/Image/Transform/Rotate 90 degrees _CW"), NULL, - image_rotate_cmd_callback, GIMP_ROTATE_90, - "", GIMP_STOCK_ROTATE_90 }, - NULL, - GIMP_HELP_IMAGE_ROTATE_90, NULL }, - { { N_("/Image/Transform/Rotate 90 degrees CC_W"), NULL, - image_rotate_cmd_callback, GIMP_ROTATE_270, - "", GIMP_STOCK_ROTATE_270 }, - NULL, - GIMP_HELP_IMAGE_ROTATE_270, NULL }, - { { N_("/Image/Transform/Rotate _180 degrees"), NULL, - image_rotate_cmd_callback, GIMP_ROTATE_180, - "", GIMP_STOCK_ROTATE_180 }, - NULL, - GIMP_HELP_IMAGE_ROTATE_180, NULL }, - - MENU_SEPARATOR ("/Image/Transform/---"), - - MENU_SEPARATOR ("/Image/---"), - - { { N_("/Image/Can_vas Size..."), NULL, - image_resize_cmd_callback, 0, - "", GIMP_STOCK_RESIZE }, - NULL, - GIMP_HELP_IMAGE_RESIZE, NULL }, - { { N_("/Image/_Scale Image..."), NULL, - image_scale_cmd_callback, 0, - "", GIMP_STOCK_SCALE }, - NULL, - GIMP_HELP_IMAGE_SCALE, NULL }, - { { N_("/Image/_Crop Image"), NULL, - image_crop_cmd_callback, 0, - "", GIMP_STOCK_TOOL_CROP }, - NULL, - GIMP_HELP_IMAGE_CROP, NULL }, - { { N_("/Image/_Duplicate"), "D", - image_duplicate_cmd_callback, 0, - "", GIMP_STOCK_DUPLICATE }, - NULL, - GIMP_HELP_IMAGE_DUPLICATE, NULL }, - - MENU_SEPARATOR ("/Image/---"), - - { { N_("/Image/Merge Visible _Layers..."), "M", - image_merge_layers_cmd_callback, 0 }, - NULL, - GIMP_HELP_IMAGE_MERGE_LAYERS, NULL }, - { { N_("/Image/_Flatten Image"), NULL, - image_flatten_image_cmd_callback, 0 }, - NULL, - GIMP_HELP_IMAGE_FLATTEN, NULL }, - - MENU_SEPARATOR ("/Image/---"), - - { { N_("/Image/Configure G_rid..."), NULL, - image_configure_grid_cmd_callback, 0, - "", GIMP_STOCK_GRID }, - NULL, - GIMP_HELP_IMAGE_GRID, NULL }, - - /* /Layer */ - - MENU_BRANCH (N_("/_Layer")), - - { { N_("/Layer/_New Layer..."), "", - layers_new_cmd_callback, 0, - "", GTK_STOCK_NEW }, - NULL, - GIMP_HELP_LAYER_NEW, NULL }, - { { N_("/Layer/Du_plicate Layer"), NULL, - layers_duplicate_cmd_callback, 0, - "", GIMP_STOCK_DUPLICATE }, - NULL, - GIMP_HELP_LAYER_DUPLICATE, NULL }, - { { N_("/Layer/Anchor _Layer"), "H", - layers_anchor_cmd_callback, 0, - "", GIMP_STOCK_ANCHOR }, - NULL, - GIMP_HELP_LAYER_ANCHOR, NULL }, - { { N_("/Layer/Me_rge Down"), "M", - layers_merge_down_cmd_callback, 0, - "", GIMP_STOCK_MERGE_DOWN }, - NULL, - GIMP_HELP_LAYER_MERGE_DOWN, NULL }, - { { N_("/Layer/_Delete Layer"), NULL, - layers_delete_cmd_callback, 0, - "", GTK_STOCK_DELETE }, - NULL, - GIMP_HELP_LAYER_DELETE, NULL }, - { { N_("/Layer/Discard _Text Information"), NULL, - layers_text_discard_cmd_callback, 0, - "", GIMP_STOCK_TOOL_TEXT }, - NULL, - GIMP_HELP_LAYER_TEXT_DISCARD, NULL }, - - MENU_SEPARATOR ("/Layer/---"), - - /* /Layer/Stack */ - - MENU_BRANCH (N_("/Layer/Stac_k")), - - { { N_("/Layer/Stack/Select _Previous Layer"), "Prior", - layers_select_previous_cmd_callback, 0 }, - NULL, - GIMP_HELP_LAYER_PREVIOUS, NULL }, - { { N_("/Layer/Stack/Select _Next Layer"), "Next", - layers_select_next_cmd_callback, 0 }, - NULL, - GIMP_HELP_LAYER_NEXT, NULL }, - { { N_("/Layer/Stack/Select _Top Layer"), "Home", - layers_select_top_cmd_callback, 0 }, - NULL, - GIMP_HELP_LAYER_TOP, NULL }, - { { N_("/Layer/Stack/Select _Bottom Layer"), "End", - layers_select_bottom_cmd_callback, 0 }, - NULL, - GIMP_HELP_LAYER_BOTTOM, NULL }, - - MENU_SEPARATOR ("/Layer/Stack/---"), - - { { N_("/Layer/Stack/_Raise Layer"), "Prior", - layers_raise_cmd_callback, 0, - "", GTK_STOCK_GO_UP }, - NULL, - GIMP_HELP_LAYER_RAISE, NULL }, - { { N_("/Layer/Stack/_Lower Layer"), "Next", - layers_lower_cmd_callback, 0, - "", GTK_STOCK_GO_DOWN }, - NULL, - GIMP_HELP_LAYER_LOWER, NULL }, - { { N_("/Layer/Stack/Layer to T_op"), "Home", - layers_raise_to_top_cmd_callback, 0, - "", GTK_STOCK_GOTO_TOP }, - NULL, - GIMP_HELP_LAYER_RAISE_TO_TOP, NULL }, - { { N_("/Layer/Stack/Layer to Botto_m"), "End", - layers_lower_to_bottom_cmd_callback, 0, - "", GTK_STOCK_GOTO_BOTTOM }, - NULL, - GIMP_HELP_LAYER_LOWER_TO_BOTTOM, NULL }, - - /* /Layer/Colors */ - - MENU_BRANCH (N_("/Layer/_Colors")), - - { { N_("/Layer/Colors/Color _Balance..."), NULL, - tools_select_cmd_callback, 0, - "", GIMP_STOCK_TOOL_COLOR_BALANCE }, - "gimp-color-balance-tool", - GIMP_HELP_TOOL_COLOR_BALANCE, NULL }, - { { N_("/Layer/Colors/Hue-_Saturation..."), NULL, - tools_select_cmd_callback, 0, - "", GIMP_STOCK_TOOL_HUE_SATURATION }, - "gimp-hue-saturation-tool", - GIMP_HELP_TOOL_HUE_SATURATION, NULL }, - { { N_("/Layer/Colors/Colori_ze..."), NULL, - tools_select_cmd_callback, 0, - "", GIMP_STOCK_TOOL_COLORIZE }, - "gimp-colorize-tool", - GIMP_HELP_TOOL_COLORIZE, NULL }, - { { N_("/Layer/Colors/B_rightness-Contrast..."), NULL, - tools_select_cmd_callback, 0, - "", GIMP_STOCK_TOOL_BRIGHTNESS_CONTRAST }, - "gimp-brightness-contrast-tool", - GIMP_HELP_TOOL_BRIGHTNESS_CONTRAST, NULL }, - { { N_("/Layer/Colors/_Threshold..."), NULL, - tools_select_cmd_callback, 0, - "", GIMP_STOCK_TOOL_THRESHOLD }, - "gimp-threshold-tool", - GIMP_HELP_TOOL_THRESHOLD, NULL }, - { { N_("/Layer/Colors/_Levels..."), NULL, - tools_select_cmd_callback, 0, - "", GIMP_STOCK_TOOL_LEVELS }, - "gimp-levels-tool", - GIMP_HELP_TOOL_LEVELS, NULL }, - { { N_("/Layer/Colors/_Curves..."), NULL, - tools_select_cmd_callback, 0, - "", GIMP_STOCK_TOOL_CURVES }, - "gimp-curves-tool", - GIMP_HELP_TOOL_CURVES, NULL }, - { { N_("/Layer/Colors/_Posterize..."), NULL, - tools_select_cmd_callback, 0, - "", GIMP_STOCK_TOOL_POSTERIZE }, - "gimp-posterize-tool", - GIMP_HELP_TOOL_POSTERIZE, NULL }, - - MENU_SEPARATOR ("/Layer/Colors/---"), - - { { N_("/Layer/Colors/_Desaturate"), NULL, - drawable_desaturate_cmd_callback, 0, - "", GIMP_STOCK_CONVERT_GRAYSCALE }, - NULL, - GIMP_HELP_LAYER_DESATURATE, NULL }, - { { N_("/Layer/Colors/In_vert"), NULL, - drawable_invert_cmd_callback, 0, - "", GIMP_STOCK_INVERT }, - NULL, - GIMP_HELP_LAYER_INVERT, NULL }, - - /* /Layer/Colors/Auto */ - - MENU_BRANCH (N_("/Layer/Colors/_Auto")), - - { { N_("/Layer/Colors/Auto/_Equalize"), NULL, - drawable_equalize_cmd_callback, 0 }, - NULL, - GIMP_HELP_LAYER_EQUALIZE, NULL }, - - MENU_SEPARATOR ("/Layer/Colors/---"), - - { { N_("/Layer/Colors/_Histogram"), NULL, - dialogs_create_dockable_cmd_callback, 0, - "", GIMP_STOCK_HISTOGRAM }, - "gimp-histogram-editor", - GIMP_HELP_HISTOGRAM_DIALOG, NULL }, - - /* /Layer/Mask */ - - MENU_BRANCH (N_("/Layer/_Mask")), - - { { N_("/Layer/Mask/_Add Layer Mask..."), NULL, - layers_mask_add_cmd_callback, 0, - "", GIMP_STOCK_LAYER_MASK }, - NULL, - GIMP_HELP_LAYER_MASK_ADD, NULL }, - { { N_("/Layer/Mask/A_pply Layer Mask"), NULL, - layers_mask_apply_cmd_callback, 0 }, - NULL, - GIMP_HELP_LAYER_MASK_APPLY, NULL }, - { { N_("/Layer/Mask/_Delete Layer Mask"), NULL, - layers_mask_delete_cmd_callback, 0, - "", GTK_STOCK_DELETE }, - NULL, - GIMP_HELP_LAYER_MASK_DELETE, NULL }, - - MENU_SEPARATOR ("/Layer/Mask/---"), - - { { N_("/Layer/Mask/_Mask to Selection"), NULL, - layers_mask_to_selection_cmd_callback, GIMP_CHANNEL_OP_REPLACE, - "", GIMP_STOCK_SELECTION_REPLACE }, - NULL, - GIMP_HELP_LAYER_MASK_SELECTION_REPLACE, NULL }, - { { N_("/Layer/Mask/_Add to Selection"), NULL, - layers_mask_to_selection_cmd_callback, GIMP_CHANNEL_OP_ADD, - "", GIMP_STOCK_SELECTION_ADD }, - NULL, - GIMP_HELP_LAYER_MASK_SELECTION_ADD, NULL }, - { { N_("/Layer/Mask/_Subtract from Selection"), NULL, - layers_mask_to_selection_cmd_callback, GIMP_CHANNEL_OP_SUBTRACT, - "", GIMP_STOCK_SELECTION_SUBTRACT }, - NULL, - GIMP_HELP_LAYER_MASK_SELECTION_SUBTRACT, NULL }, - { { N_("/Layer/Mask/_Intersect with Selection"), NULL, - layers_mask_to_selection_cmd_callback, GIMP_CHANNEL_OP_INTERSECT, - "", GIMP_STOCK_SELECTION_INTERSECT }, - NULL, - GIMP_HELP_LAYER_MASK_SELECTION_INTERSECT, NULL }, - - /* /Layer/Transparency */ - - MENU_BRANCH (N_("/Layer/Tr_ansparency")), - - { { N_("/Layer/Transparency/_Add Alpha Channel"), NULL, - layers_alpha_add_cmd_callback, 0, - "", GIMP_STOCK_TRANSPARENCY }, - NULL, - GIMP_HELP_LAYER_ALPHA_ADD, NULL }, - - MENU_SEPARATOR ("/Layer/Transparency/---"), - - { { N_("/Layer/Transparency/Al_pha to Selection"), NULL, - layers_alpha_to_selection_cmd_callback, GIMP_CHANNEL_OP_REPLACE, - "", GIMP_STOCK_SELECTION_REPLACE }, - NULL, - GIMP_HELP_LAYER_ALPHA_SELECTION_REPLACE, NULL }, - { { N_("/Layer/Transparency/A_dd to Selection"), NULL, - layers_alpha_to_selection_cmd_callback, GIMP_CHANNEL_OP_ADD, - "", GIMP_STOCK_SELECTION_ADD }, - NULL, - GIMP_HELP_LAYER_ALPHA_SELECTION_ADD, NULL }, - { { N_("/Layer/Transparency/_Subtract from Selection"), NULL, - layers_alpha_to_selection_cmd_callback, GIMP_CHANNEL_OP_SUBTRACT, - "", GIMP_STOCK_SELECTION_SUBTRACT }, - NULL, - GIMP_HELP_LAYER_ALPHA_SELECTION_SUBTRACT, NULL }, - { { N_("/Layer/Transparency/_Intersect with Selection"), NULL, - layers_alpha_to_selection_cmd_callback, GIMP_CHANNEL_OP_INTERSECT, - "", GIMP_STOCK_SELECTION_INTERSECT }, - NULL, - GIMP_HELP_LAYER_ALPHA_SELECTION_INTERSECT, NULL }, - - MENU_SEPARATOR ("/Layer/Transparency/---"), - - /* /Layer/Transform */ - - MENU_BRANCH (N_("/Layer/_Transform")), - - { { N_("/Layer/Transform/Flip _Horizontally"), NULL, - drawable_flip_cmd_callback, GIMP_ORIENTATION_HORIZONTAL, - "", GIMP_STOCK_FLIP_HORIZONTAL }, - NULL, - GIMP_HELP_LAYER_FLIP_HORIZONTAL, NULL }, - { { N_("/Layer/Transform/Flip _Vertically"), NULL, - drawable_flip_cmd_callback, GIMP_ORIENTATION_VERTICAL, - "", GIMP_STOCK_FLIP_VERTICAL }, - NULL, - GIMP_HELP_LAYER_FLIP_VERTICAL, NULL }, - - MENU_SEPARATOR ("/Layer/Transform/---"), - - { { N_("/Layer/Transform/Rotate 90 degrees _CW"), NULL, - drawable_rotate_cmd_callback, GIMP_ROTATE_90, - "", GIMP_STOCK_ROTATE_90 }, - NULL, - GIMP_HELP_LAYER_ROTATE_90, NULL }, - { { N_("/Layer/Transform/Rotate 90 degrees CC_W"), NULL, - drawable_rotate_cmd_callback, GIMP_ROTATE_270, - "", GIMP_STOCK_ROTATE_270 }, - NULL, - GIMP_HELP_LAYER_ROTATE_270, NULL }, - { { N_("/Layer/Transform/Rotate _180 degrees"), NULL, - drawable_rotate_cmd_callback, GIMP_ROTATE_180, - "", GIMP_STOCK_ROTATE_180 }, - NULL, - GIMP_HELP_LAYER_ROTATE_180, NULL }, - { { N_("/Layer/Transform/_Arbitrary Rotation..."), NULL, - tools_select_cmd_callback, 0, - "", GIMP_STOCK_TOOL_ROTATE }, - "gimp-rotate-tool", - GIMP_HELP_TOOL_ROTATE, NULL }, - - MENU_SEPARATOR ("/Layer/Transform/---"), - - { { N_("/Layer/Transform/_Offset..."), "O", - drawable_offset_cmd_callback, 0 }, - NULL, - GIMP_HELP_LAYER_OFFSET, NULL }, - - MENU_SEPARATOR ("/Layer/---"), - - { { N_("/Layer/Layer _Boundary Size..."), NULL, - layers_resize_cmd_callback, 0, - "", GIMP_STOCK_RESIZE }, - NULL, - GIMP_HELP_LAYER_RESIZE, NULL }, - { { N_("/Layer/Layer to _Image Size"), NULL, - layers_resize_to_image_cmd_callback, 0, - "", GIMP_STOCK_LAYER_TO_IMAGESIZE }, - NULL, - GIMP_HELP_LAYER_RESIZE_TO_IMAGE, NULL }, - { { N_("/Layer/_Scale Layer..."), NULL, - layers_scale_cmd_callback, 0, - "", GIMP_STOCK_SCALE }, - NULL, - GIMP_HELP_LAYER_SCALE, NULL }, - { { N_("/Layer/Cr_op Layer"), NULL, - layers_crop_cmd_callback, 0, - "", GIMP_STOCK_TOOL_CROP }, - NULL, - GIMP_HELP_LAYER_CROP, NULL }, - - MENU_SEPARATOR ("/Layer/---"), - - /* /Tools */ - - MENU_BRANCH (N_("/_Tools")), - - { { N_("/Tools/Tool_box"), NULL, - dialogs_show_toolbox_cmd_callback, 0 }, - NULL, - GIMP_HELP_TOOLBOX, NULL }, - { { N_("/Tools/_Default Colors"), "D", - tools_default_colors_cmd_callback, 0, - "", GIMP_STOCK_DEFAULT_COLORS }, - NULL, - GIMP_HELP_TOOLBOX_DEFAULT_COLORS, NULL }, - { { N_("/Tools/S_wap Colors"), "X", - tools_swap_colors_cmd_callback, 0, - "", GIMP_STOCK_SWAP_COLORS }, - NULL, - GIMP_HELP_TOOLBOX_SWAP_COLORS, NULL }, - - MENU_SEPARATOR ("/Tools/---"), - - MENU_BRANCH (N_("/Tools/_Selection Tools")), - MENU_BRANCH (N_("/Tools/_Paint Tools")), - MENU_BRANCH (N_("/Tools/_Transform Tools")), - MENU_BRANCH (N_("/Tools/_Color Tools")), - - /* /Dialogs */ - - MENU_BRANCH (N_("/_Dialogs")), - - MENU_BRANCH (N_("/Dialogs/Create New Doc_k")), - - { { N_("/Dialogs/Create New Dock/_Layers, Channels & Paths"), NULL, - dialogs_create_lc_cmd_callback, 0 }, - NULL, - NULL, NULL }, - { { N_("/Dialogs/Create New Dock/_Brushes, Patterns & Gradients"), NULL, - dialogs_create_data_cmd_callback, 0 }, - NULL, - NULL, NULL }, - { { N_("/Dialogs/Create New Dock/_Misc. Stuff"), NULL, - dialogs_create_stuff_cmd_callback, 0 }, - NULL, - NULL, NULL }, - - { { N_("/Dialogs/Tool _Options"), NULL, - dialogs_create_dockable_cmd_callback, 0, - "", GIMP_STOCK_TOOL_OPTIONS }, - "gimp-tool-options", - GIMP_HELP_TOOL_OPTIONS_DIALOG, NULL }, - { { N_("/Dialogs/_Device Status"), NULL, - dialogs_create_dockable_cmd_callback, 0, - "", GIMP_STOCK_DEVICE_STATUS }, - "gimp-device-status", - GIMP_HELP_DEVICE_STATUS_DIALOG, NULL }, - - MENU_SEPARATOR ("/Dialogs/---"), - - { { N_("/Dialogs/_Layers"), "L", - dialogs_create_dockable_cmd_callback, 0, - "", GIMP_STOCK_LAYERS }, - "gimp-layer-list", - GIMP_HELP_LAYER_DIALOG, NULL }, - { { N_("/Dialogs/_Channels"), NULL, - dialogs_create_dockable_cmd_callback, 0, - "", GIMP_STOCK_CHANNELS }, - "gimp-channel-list", - GIMP_HELP_CHANNEL_DIALOG, NULL }, - { { N_("/Dialogs/_Paths"), NULL, - dialogs_create_dockable_cmd_callback, 0, - "", GIMP_STOCK_PATHS }, - "gimp-vectors-list", - GIMP_HELP_PATH_DIALOG, NULL }, - { { N_("/Dialogs/Inde_xed Palette"), NULL, - dialogs_create_dockable_cmd_callback, 0, - "", GIMP_STOCK_INDEXED_PALETTE }, - "gimp-indexed-palette", - GIMP_HELP_INDEXED_PALETTE_DIALOG, NULL }, - { { N_("/Dialogs/Histogra_m"), NULL, - dialogs_create_dockable_cmd_callback, 0, - "", GIMP_STOCK_HISTOGRAM }, - "gimp-histogram-editor", - GIMP_HELP_HISTOGRAM_DIALOG, NULL }, - { { N_("/Dialogs/_Selection Editor"), NULL, - dialogs_create_dockable_cmd_callback, 0, - "", GIMP_STOCK_TOOL_RECT_SELECT }, - "gimp-selection-editor", - GIMP_HELP_SELECTION_DIALOG, NULL }, - { { N_("/Dialogs/Na_vigation"), NULL, - dialogs_create_dockable_cmd_callback, 0, - "", GIMP_STOCK_NAVIGATION }, - "gimp-navigation-view", - GIMP_HELP_NAVIGATION_DIALOG, NULL }, - { { N_("/Dialogs/_Undo History"), NULL, - dialogs_create_dockable_cmd_callback, 0, - "", GIMP_STOCK_UNDO_HISTORY }, - "gimp-undo-history", - GIMP_HELP_UNDO_DIALOG, NULL }, - - MENU_SEPARATOR ("/Dialogs/---"), - - { { N_("/Dialogs/Colo_rs"), NULL, - dialogs_create_dockable_cmd_callback, 0, - "", GIMP_STOCK_DEFAULT_COLORS }, - "gimp-color-editor", - GIMP_HELP_COLOR_DIALOG, NULL }, - { { N_("/Dialogs/Brus_hes"), "B", - dialogs_create_dockable_cmd_callback, 0, - "", GIMP_STOCK_BRUSH }, - "gimp-brush-grid|gimp-brush-list", - GIMP_HELP_BRUSH_DIALOG, NULL }, - { { N_("/Dialogs/P_atterns"), "P", - dialogs_create_dockable_cmd_callback, 0, - "", GIMP_STOCK_PATTERN }, - "gimp-pattern-grid|gimp-pattern-list", - GIMP_HELP_PATTERN_DIALOG, NULL }, - { { N_("/Dialogs/_Gradients"), "G", - dialogs_create_dockable_cmd_callback, 0, - "", GIMP_STOCK_GRADIENT }, - "gimp-gradient-list|gimp-gradient-grid", - GIMP_HELP_GRADIENT_DIALOG, NULL }, - { { N_("/Dialogs/Pal_ettes"), "P", - dialogs_create_dockable_cmd_callback, 0, - "", GIMP_STOCK_PALETTE }, - "gimp-palette-list|gimp-palette-grid", - GIMP_HELP_PALETTE_DIALOG, NULL }, - { { N_("/Dialogs/_Fonts"), NULL, - dialogs_create_dockable_cmd_callback, 0, - "", GIMP_STOCK_FONT }, - "gimp-font-list|gimp-font-grid", - GIMP_HELP_FONT_DIALOG, NULL }, - { { N_("/Dialogs/_Buffers"), "foo", - dialogs_create_dockable_cmd_callback, 0, - "", GIMP_STOCK_BUFFER }, - "gimp-buffer-list|gimp-buffer-grid", - GIMP_HELP_BUFFER_DIALOG, NULL }, - - MENU_SEPARATOR ("/Dialogs/---"), - - { { N_("/Dialogs/_Images"), NULL, - dialogs_create_dockable_cmd_callback, 0, - "", GIMP_STOCK_IMAGES }, - "gimp-image-list|gimp-image-grid", - GIMP_HELP_IMAGE_DIALOG, NULL }, - { { N_("/Dialogs/Document Histor_y"), "", - dialogs_create_dockable_cmd_callback, 0, - "", GTK_STOCK_OPEN }, - "gimp-document-list|gimp-document-grid", - GIMP_HELP_DOCUMENT_DIALOG, NULL }, - { { N_("/Dialogs/_Templates"), NULL, - dialogs_create_dockable_cmd_callback, 0, - "", GIMP_STOCK_TEMPLATE }, - "gimp-template-list|gimp-template-grid", - GIMP_HELP_TEMPLATE_DIALOG, NULL }, - { { N_("/Dialogs/T_ools"), NULL, - dialogs_create_dockable_cmd_callback, 0, - "", GIMP_STOCK_TOOLS }, - "gimp-tool-list|gimp-tool-grid", - GIMP_HELP_TOOLS_DIALOG, NULL }, - { { N_("/Dialogs/Error Co_nsole"), NULL, - dialogs_create_dockable_cmd_callback, 0, - "", GIMP_STOCK_WARNING }, - "gimp-error-console", - GIMP_HELP_ERRORS_DIALOG, NULL }, - - - /* /Filters */ - - MENU_SEPARATOR ("/filters-separator"), - MENU_BRANCH (N_("/Filte_rs")), - - { { N_("/Filters/Repeat Last"), "F", - plug_in_repeat_cmd_callback, (guint) FALSE, - "", GTK_STOCK_EXECUTE }, - NULL, - GIMP_HELP_FILTER_REPEAT, NULL }, - { { N_("/Filters/Re-Show Last"), "F", - plug_in_repeat_cmd_callback, (guint) TRUE, - "", GIMP_STOCK_RESHOW_FILTER }, - NULL, - GIMP_HELP_FILTER_RESHOW, NULL }, - - MENU_SEPARATOR ("/Filters/---"), - - MENU_BRANCH (N_("/Filters/_Blur")), - MENU_BRANCH (N_("/Filters/_Colors")), - MENU_BRANCH (N_("/Filters/Colors/Ma_p")), - MENU_BRANCH (N_("/Filters/_Noise")), - MENU_BRANCH (N_("/Filters/Edge-De_tect")), - MENU_BRANCH (N_("/Filters/En_hance")), - MENU_BRANCH (N_("/Filters/_Generic")), - - MENU_SEPARATOR ("/Filters/---"), - - MENU_BRANCH (N_("/Filters/Gla_ss Effects")), - MENU_BRANCH (N_("/Filters/_Light Effects")), - MENU_BRANCH (N_("/Filters/_Distorts")), - MENU_BRANCH (N_("/Filters/_Artistic")), - MENU_BRANCH (N_("/Filters/_Map")), - MENU_BRANCH (N_("/Filters/_Render")), - MENU_BRANCH (N_("/Filters/Render/_Clouds")), - MENU_BRANCH (N_("/Filters/Render/_Nature")), - MENU_BRANCH (N_("/Filters/Render/_Pattern")), - MENU_BRANCH (N_("/Filters/_Web")), - - MENU_SEPARATOR ("/Filters/web-separator"), - - MENU_BRANCH (N_("/Filters/An_imation")), - MENU_BRANCH (N_("/Filters/C_ombine")), - - MENU_SEPARATOR ("/Filters/---"), - - MENU_BRANCH (N_("/Filters/To_ys")) -}; - -gint n_image_menu_entries = G_N_ELEMENTS (image_menu_entries); - void -image_menu_setup2 (GimpUIManager *manager, - const gchar *ui_path) +image_menu_setup (GimpUIManager *manager, + const gchar *ui_path) { menus_open_recent_add (manager, ui_path); plug_in_menus_setup (manager, ui_path); } - -void -image_menu_setup (GimpItemFactory *factory, - gpointer setup_data) -{ - if (GTK_IS_MENU_BAR (GTK_ITEM_FACTORY (factory)->widget)) - { - gimp_item_factory_set_visible (GTK_ITEM_FACTORY (factory), - "/filters-separator", FALSE); - } - - menus_last_opened_add (factory); - - /* create tool menu items */ - { - GimpToolInfo *tool_info; - GList *list; - - for (list = GIMP_LIST (factory->gimp->tool_info_list)->list; - list; - list = g_list_next (list)) - { - tool_info = GIMP_TOOL_INFO (list->data); - - if (tool_info->menu_path) - { - GimpItemFactoryEntry entry; - const gchar *stock_id; - const gchar *identifier; - - stock_id = gimp_viewable_get_stock_id (GIMP_VIEWABLE (tool_info)); - identifier = gimp_object_get_name (GIMP_OBJECT (tool_info)); - - entry.entry.path = tool_info->menu_path; - entry.entry.accelerator = tool_info->menu_accel; - entry.entry.callback = tools_select_cmd_callback; - entry.entry.callback_action = 0; - entry.entry.item_type = ""; - entry.entry.extra_data = stock_id; - entry.quark_string = identifier; - entry.help_id = tool_info->help_id; - entry.description = NULL; - - gimp_item_factory_create_item (factory, - &entry, - NULL, - factory->gimp, 2, FALSE); - } - } - } - - g_signal_connect_object (factory->gimp, "buffer_changed", - G_CALLBACK (image_menu_buffer_changed), - factory, 0); - - image_menu_buffer_changed (factory->gimp, factory); - - { - GimpContext *user_context; - GimpRGB fg; - GimpRGB bg; - - user_context = gimp_get_user_context (factory->gimp); - - g_signal_connect_object (user_context, "foreground_changed", - G_CALLBACK (image_menu_foreground_changed), - factory, 0); - g_signal_connect_object (user_context, "background_changed", - G_CALLBACK (image_menu_background_changed), - factory, 0); - - gimp_context_get_foreground (user_context, &fg); - gimp_context_get_background (user_context, &bg); - - image_menu_foreground_changed (user_context, &fg, factory); - image_menu_background_changed (user_context, &bg, factory); - } - - plug_in_menus_create (factory, factory->gimp->plug_in_proc_defs); - - { - static gchar *image_file_entries[] = { "---moved", - "Close", - "Quit" }; - static gchar *reorder_submenus[] = { "/Video", - "/Script-Fu" }; - static gchar *reorder_subsubmenus[] = { "/Filters" }; - - GtkWidget *menu_item; - GtkWidget *menu; - GList *list; - gchar *path; - gint i, pos; - - /* Move all menu items under "/Filters" which are not submenus or - * separators to the top of the menu - */ - pos = 3; - menu_item = gtk_item_factory_get_widget (GTK_ITEM_FACTORY (factory), - "/Filters/Filter all Layers..."); - if (menu_item && menu_item->parent && GTK_IS_MENU (menu_item->parent)) - { - menu = menu_item->parent; - - for (list = g_list_nth (GTK_MENU_SHELL (menu)->children, pos); - list; - list = g_list_next (list)) - { - menu_item = GTK_WIDGET (list->data); - - if (! GTK_MENU_ITEM (menu_item)->submenu && - GTK_IS_LABEL (GTK_BIN (menu_item)->child)) - { - gtk_menu_reorder_child (GTK_MENU (menu_item->parent), - menu_item, pos); - list = g_list_nth (GTK_MENU_SHELL (menu)->children, pos); - pos++; - } - } - } - - /* Reorder "/File" */ - for (i = 0; i < G_N_ELEMENTS (image_file_entries); i++) - { - path = g_strconcat ("/File/", image_file_entries[i], NULL); - menu_item = gtk_item_factory_get_widget (GTK_ITEM_FACTORY (factory), - path); - g_free (path); - - if (menu_item && menu_item->parent) - gtk_menu_reorder_child (GTK_MENU (menu_item->parent), menu_item, -1); - } - - /* Reorder menus where plugins registered submenus */ - for (i = 0; i < G_N_ELEMENTS (reorder_submenus); i++) - { - menu = gtk_item_factory_get_widget (GTK_ITEM_FACTORY (factory), - reorder_submenus[i]); - - if (menu && GTK_IS_MENU (menu)) - menus_filters_subdirs_to_top (GTK_MENU (menu)); - } - - for (i = 0; i < G_N_ELEMENTS (reorder_subsubmenus); i++) - { - menu = gtk_item_factory_get_widget (GTK_ITEM_FACTORY (factory), - reorder_subsubmenus[i]); - - if (menu && GTK_IS_MENU (menu)) - { - for (list = GTK_MENU_SHELL (menu)->children; list; - list = g_list_next (list)) - { - GtkMenuItem *menu_item; - - menu_item = GTK_MENU_ITEM (list->data); - - if (menu_item->submenu) - menus_filters_subdirs_to_top (GTK_MENU (menu_item->submenu)); - } - } - } - - /* Move all submenus which registered after "/Filters/Toys" - * before the separator after "/Filters/Web" - */ - menu_item = gtk_item_factory_get_widget (GTK_ITEM_FACTORY (factory), - "/Filters/web-separator"); - - if (menu_item && menu_item->parent && GTK_IS_MENU (menu_item->parent)) - { - menu = menu_item->parent; - pos = g_list_index (GTK_MENU_SHELL (menu)->children, menu_item); - - menu_item = gtk_item_factory_get_widget (GTK_ITEM_FACTORY (factory), - "/Filters/Toys"); - - if (menu_item && GTK_IS_MENU (menu_item)) - { - GList *list; - gint index = 1; - - for (list = GTK_MENU_SHELL (menu)->children; list; - list = g_list_next (list)) - { - if (GTK_MENU_ITEM (list->data)->submenu == menu_item) - break; - - index++; - } - - while ((menu_item = g_list_nth_data (GTK_MENU_SHELL (menu)->children, - index))) - { - gtk_menu_reorder_child (GTK_MENU (menu), menu_item, pos); - - pos++; - index++; - } - } - } - } -} - -void -image_menu_update (GtkItemFactory *item_factory, - gpointer data) -{ - Gimp *gimp = NULL; - GimpDisplay *gdisp = NULL; - GimpDisplayShell *shell = NULL; - GimpDisplayOptions *options = NULL; - GimpImage *gimage = NULL; - GimpDrawable *drawable = NULL; - GimpLayer *layer = NULL; - GimpVectors *vectors = NULL; - GimpImageType drawable_type = -1; - gboolean ad = FALSE; - gboolean is_rgb = FALSE; - gboolean is_gray = FALSE; - gboolean is_indexed = FALSE; - gboolean fs = FALSE; - gboolean aux = FALSE; - gboolean lm = FALSE; - gboolean lp = FALSE; - gboolean sel = FALSE; - gboolean alpha = FALSE; - gboolean text_layer = FALSE; - gint lind = -1; - gint lnum = -1; - gboolean fullscreen = FALSE; - gint n_screens = 1; - gboolean display_items = TRUE; - - gimp = GIMP_ITEM_FACTORY (item_factory)->gimp; - - if (! gtk_item_factory_get_item (item_factory, "/View/New View")) - display_items = FALSE; - - if (GIMP_IS_DISPLAY_SHELL (data)) - { - shell = GIMP_DISPLAY_SHELL (data); - gdisp = shell->gdisp; - } - else if (GIMP_IS_DISPLAY (data)) - { - gdisp = GIMP_DISPLAY (data); - shell = GIMP_DISPLAY_SHELL (gdisp->shell); - } - - if (gdisp) - { - GimpImageBaseType base_type; - - gimage = gdisp->gimage; - - base_type = gimp_image_base_type (gimage); - - is_rgb = (base_type == GIMP_RGB); - is_gray = (base_type == GIMP_GRAY); - is_indexed = (base_type == GIMP_INDEXED); - - fs = (gimp_image_floating_sel (gimage) != NULL); - aux = (gimp_image_get_active_channel (gimage) != NULL); - lp = ! gimp_image_is_empty (gimage); - sel = ! gimp_channel_is_empty (gimp_image_get_mask (gimage)); - - drawable = gimp_image_active_drawable (gimage); - if (drawable) - { - drawable_type = gimp_drawable_type (drawable); - ad = TRUE; - } - - if (lp) - { - layer = gimp_image_get_active_layer (gimage); - - if (layer) - { - lm = gimp_layer_get_mask (layer) ? TRUE : FALSE; - alpha = gimp_drawable_has_alpha (GIMP_DRAWABLE (layer)); - lind = gimp_image_get_layer_index (gimage, layer); - - text_layer = (GIMP_IS_TEXT_LAYER (layer) && - GIMP_TEXT_LAYER (layer)->text); - } - - lnum = gimp_container_num_children (gimage->layers); - } - - vectors = gimp_image_get_active_vectors (gimage); - - fullscreen = gimp_display_shell_get_fullscreen (shell); - - options = fullscreen ? shell->fullscreen_options : shell->options; - - n_screens = - gdk_display_get_n_screens (gtk_widget_get_display (GTK_WIDGET (shell))); - } - -#define SET_ACTIVE(menu,condition) \ - gimp_item_factory_set_active (item_factory, menu, (condition) != 0) -#define SET_VISIBLE(menu,condition) \ - gimp_item_factory_set_visible (item_factory, menu, (condition) != 0) -#define SET_LABEL(menu,label) \ - gimp_item_factory_set_label (item_factory, menu, (label)) -#define SET_SENSITIVE(menu,condition) \ - gimp_item_factory_set_sensitive (item_factory, menu, (condition) != 0) - - /* File */ - - SET_SENSITIVE ("/File/Save", gdisp && ad); - SET_SENSITIVE ("/File/Save as...", gdisp && ad); - SET_SENSITIVE ("/File/Save a Copy...", gdisp && ad); - SET_SENSITIVE ("/File/Save as Template...", gdisp); - SET_SENSITIVE ("/File/Revert", gdisp && GIMP_OBJECT (gimage)->name); - SET_SENSITIVE ("/File/Close", gdisp); - - /* Edit */ - - { - gchar *undo_name = NULL; - gchar *redo_name = NULL; - - if (gdisp && gimp_image_undo_is_enabled (gimage)) - { - GimpUndo *undo; - GimpUndo *redo; - - undo = gimp_undo_stack_peek (gimage->undo_stack); - redo = gimp_undo_stack_peek (gimage->redo_stack); - - if (undo) - undo_name = - g_strdup_printf (_("_Undo %s"), - gimp_object_get_name (GIMP_OBJECT (undo))); - - if (redo) - redo_name = - g_strdup_printf (_("_Redo %s"), - gimp_object_get_name (GIMP_OBJECT (redo))); - } - - SET_LABEL ("/Edit/Undo", undo_name ? undo_name : _("_Undo")); - SET_LABEL ("/Edit/Redo", redo_name ? redo_name : _("_Redo")); - - SET_SENSITIVE ("/Edit/Undo", undo_name); - SET_SENSITIVE ("/Edit/Redo", redo_name); - - g_free (undo_name); - g_free (redo_name); - } - - SET_SENSITIVE ("/Edit/Cut", ad); - SET_SENSITIVE ("/Edit/Copy", ad); - SET_SENSITIVE ("/Edit/Paste", gdisp && gimp->global_buffer); - SET_SENSITIVE ("/Edit/Paste Into", gdisp && gimp->global_buffer); - - SET_SENSITIVE ("/Edit/Buffer/Cut Named...", ad); - SET_SENSITIVE ("/Edit/Buffer/Copy Named...", ad); - - SET_SENSITIVE ("/Edit/Clear", ad); - SET_SENSITIVE ("/Edit/Fill with FG Color", ad); - SET_SENSITIVE ("/Edit/Fill with BG Color", ad); - SET_SENSITIVE ("/Edit/Fill with Pattern", ad); - SET_SENSITIVE ("/Edit/Stroke Selection...", ad && sel); - SET_SENSITIVE ("/Edit/Stroke Path...", ad && vectors); - - /* Select */ - - SET_SENSITIVE ("/Select/All", lp); - SET_SENSITIVE ("/Select/None", lp && sel); - SET_SENSITIVE ("/Select/Invert", lp && sel); - SET_SENSITIVE ("/Select/From Path", lp && vectors); - SET_SENSITIVE ("/Select/Float", lp && sel); - - if (display_items) - SET_SENSITIVE ("/Select/By Color", lp); - - SET_SENSITIVE ("/Select/Feather...", lp && sel); - SET_SENSITIVE ("/Select/Sharpen", lp && sel); - SET_SENSITIVE ("/Select/Shrink...", lp && sel); - SET_SENSITIVE ("/Select/Grow...", lp && sel); - SET_SENSITIVE ("/Select/Border...", lp && sel); - - if (display_items) - SET_SENSITIVE ("/Select/Toggle QuickMask", gdisp); - - SET_SENSITIVE ("/Select/Save to Channel", sel && !fs); - SET_SENSITIVE ("/Select/To Path", sel && !fs); - - /* View */ - - if (display_items) - { - SET_SENSITIVE ("/View/New View", gdisp); - - SET_SENSITIVE ("/View/Dot for Dot", gdisp); - SET_ACTIVE ("/View/Dot for Dot", gdisp && shell->dot_for_dot); - - SET_SENSITIVE ("/View/Zoom/Zoom Out", gdisp); - SET_SENSITIVE ("/View/Zoom/Zoom In", gdisp); - SET_SENSITIVE ("/View/Zoom/Zoom to Fit Window", gdisp); - - SET_SENSITIVE (VIEW_ZOOM_16_1, gdisp); - SET_SENSITIVE (VIEW_ZOOM_8_1, gdisp); - SET_SENSITIVE (VIEW_ZOOM_4_1, gdisp); - SET_SENSITIVE (VIEW_ZOOM_2_1, gdisp); - SET_SENSITIVE (VIEW_ZOOM_1_1, gdisp); - SET_SENSITIVE (VIEW_ZOOM_1_2, gdisp); - SET_SENSITIVE (VIEW_ZOOM_1_4, gdisp); - SET_SENSITIVE (VIEW_ZOOM_1_8, gdisp); - SET_SENSITIVE (VIEW_ZOOM_1_16, gdisp); - SET_SENSITIVE ("/View/Zoom/Other...", gdisp); - - if (gdisp) - image_menu_set_zoom (item_factory, shell); - - SET_SENSITIVE ("/View/Info Window", gdisp); - SET_SENSITIVE ("/View/Navigation Window", gdisp); - SET_SENSITIVE ("/View/Display Filters...", gdisp); - - SET_SENSITIVE ("/View/Show Selection", gdisp); - SET_ACTIVE ("/View/Show Selection", gdisp && options->show_selection); - SET_SENSITIVE ("/View/Show Layer Boundary", gdisp); - SET_ACTIVE ("/View/Show Layer Boundary", gdisp && options->show_layer_boundary); - SET_ACTIVE ("/View/Show Guides", gdisp && options->show_guides); - SET_ACTIVE ("/View/Snap to Guides", gdisp && shell->snap_to_guides); - SET_ACTIVE ("/View/Show Grid", gdisp && options->show_grid); - SET_ACTIVE ("/View/Snap to Grid", gdisp && shell->snap_to_grid); - - SET_SENSITIVE ("/View/Show Menubar", gdisp); - SET_ACTIVE ("/View/Show Menubar", gdisp && options->show_menubar); - SET_SENSITIVE ("/View/Show Rulers", gdisp); - SET_ACTIVE ("/View/Show Rulers", gdisp && options->show_rulers); - SET_SENSITIVE ("/View/Show Scrollbars", gdisp); - SET_ACTIVE ("/View/Show Scrollbars", gdisp && options->show_scrollbars); - SET_SENSITIVE ("/View/Show Statusbar", gdisp); - SET_ACTIVE ("/View/Show Statusbar", gdisp && options->show_statusbar); - - SET_SENSITIVE ("/View/Shrink Wrap", gdisp); - SET_SENSITIVE ("/View/Fullscreen", gdisp); - SET_ACTIVE ("/View/Fullscreen", gdisp && fullscreen); - SET_VISIBLE ("/View/Move to Screen...", gdisp && n_screens > 1); - } - - /* Image */ - - SET_SENSITIVE ("/Image/Mode/RGB", gdisp && ! is_rgb); - SET_SENSITIVE ("/Image/Mode/Grayscale", gdisp && ! is_gray); - SET_SENSITIVE ("/Image/Mode/Indexed...", gdisp && ! is_indexed); - - SET_SENSITIVE ("/Image/Transform/Flip Horizontally", gdisp); - SET_SENSITIVE ("/Image/Transform/Flip Vertically", gdisp); - SET_SENSITIVE ("/Image/Transform/Rotate 90 degrees CW", gdisp); - SET_SENSITIVE ("/Image/Transform/Rotate 90 degrees CCW", gdisp); - SET_SENSITIVE ("/Image/Transform/Rotate 180 degrees", gdisp); - - SET_SENSITIVE ("/Image/Canvas Size...", gdisp); - SET_SENSITIVE ("/Image/Scale Image...", gdisp); - SET_SENSITIVE ("/Image/Crop Image", gdisp && sel); - SET_SENSITIVE ("/Image/Duplicate", gdisp); - SET_SENSITIVE ("/Image/Merge Visible Layers...", gdisp && !fs && !aux && lp); - SET_SENSITIVE ("/Image/Flatten Image", gdisp && !fs && !aux && lp); - SET_SENSITIVE ("/Image/Configure Grid...", gdisp); - - /* Layer */ - - SET_SENSITIVE ("/Layer/New Layer...", gdisp); - SET_SENSITIVE ("/Layer/Duplicate Layer", lp && !fs && !aux); - SET_SENSITIVE ("/Layer/Anchor Layer", lp && fs && !aux); - SET_SENSITIVE ("/Layer/Merge Down", lp && !fs && !aux && lind < (lnum - 1)); - SET_SENSITIVE ("/Layer/Delete Layer", lp && !aux); - SET_VISIBLE ("/Layer/Discard Text Information", text_layer && !aux); - - SET_SENSITIVE ("/Layer/Layer Boundary Size...", lp && !aux); - SET_SENSITIVE ("/Layer/Layer to Image Size", lp && !aux); - SET_SENSITIVE ("/Layer/Scale Layer...", lp && !aux); - SET_SENSITIVE ("/Layer/Crop Layer", lp && !aux && sel); - - if (display_items) - { - SET_SENSITIVE ("/Layer/Stack/Select Previous Layer", - lp && !fs && !aux && lind > 0); - SET_SENSITIVE ("/Layer/Stack/Select Next Layer", - lp && !fs && !aux && lind < (lnum - 1)); - SET_SENSITIVE ("/Layer/Stack/Select Top Layer", - lp && !fs && !aux && lind > 0); - SET_SENSITIVE ("/Layer/Stack/Select Bottom Layer", - lp && !fs && !aux && lind < (lnum - 1)); - - SET_SENSITIVE ("/Layer/Stack/Raise Layer", - lp && !fs && !aux && alpha && lind > 0); - SET_SENSITIVE ("/Layer/Stack/Lower Layer", - lp && !fs && !aux && alpha && lind < (lnum - 1)); - SET_SENSITIVE ("/Layer/Stack/Layer to Top", - lp && !fs && !aux && alpha && lind > 0); - SET_SENSITIVE ("/Layer/Stack/Layer to Bottom", - lp && !fs && !aux && alpha && lind < (lnum - 1)); - } - - SET_SENSITIVE ("/Layer/Colors/Color Balance...", ad && is_rgb); - SET_SENSITIVE ("/Layer/Colors/Hue-Saturation...", ad && is_rgb); - SET_SENSITIVE ("/Layer/Colors/Colorize...", ad && is_rgb); - SET_SENSITIVE ("/Layer/Colors/Brightness-Contrast...", ad && ! is_indexed); - SET_SENSITIVE ("/Layer/Colors/Threshold...", ad && ! is_indexed); - SET_SENSITIVE ("/Layer/Colors/Levels...", ad && ! is_indexed); - SET_SENSITIVE ("/Layer/Colors/Curves...", ad && ! is_indexed); - SET_SENSITIVE ("/Layer/Colors/Posterize...", ad && ! is_indexed); - SET_SENSITIVE ("/Layer/Colors/Desaturate", ad && is_rgb); - SET_SENSITIVE ("/Layer/Colors/Invert", ad && ! is_indexed); - SET_SENSITIVE ("/Layer/Colors/Auto/Equalize", ad && ! is_indexed); - SET_SENSITIVE ("/Layer/Colors/Histogram", ad); - - SET_SENSITIVE ("/Layer/Mask/Add Layer Mask...", lp && !fs && !aux && !lm && alpha); - SET_SENSITIVE ("/Layer/Mask/Apply Layer Mask", lm && !fs && !aux); - SET_SENSITIVE ("/Layer/Mask/Delete Layer Mask", lm && !fs && !aux); - SET_SENSITIVE ("/Layer/Mask/Mask to Selection", lm && !fs && !aux); - SET_SENSITIVE ("/Layer/Mask/Add to Selection", lm && !fs && !aux); - SET_SENSITIVE ("/Layer/Mask/Subtract from Selection", lm && !fs && !aux); - SET_SENSITIVE ("/Layer/Mask/Intersect with Selection", lm && !fs && !aux); - - SET_SENSITIVE ("/Layer/Transparency/Add Alpha Channel", lp && !aux && !fs && !lm && !alpha); - SET_SENSITIVE ("/Layer/Transparency/Alpha to Selection", lp && !aux); - SET_SENSITIVE ("/Layer/Transparency/Add to Selection", lp && !aux); - SET_SENSITIVE ("/Layer/Transparency/Subtract from Selection", lp && !aux); - SET_SENSITIVE ("/Layer/Transparency/Intersect with Selection", lp && !aux); - - SET_SENSITIVE ("/Layer/Transform/Flip Horizontally", ad); - SET_SENSITIVE ("/Layer/Transform/Flip Vertically", ad); - SET_SENSITIVE ("/Layer/Transform/Rotate 90 degrees CW", ad); - SET_SENSITIVE ("/Layer/Transform/Rotate 90 degrees CCW", ad); - SET_SENSITIVE ("/Image/Transform/Rotate 180 degrees", ad); - SET_SENSITIVE ("/Layer/Transform/Offset...", ad); - -#undef SET_ACTIVE -#undef SET_VISIBLE -#undef SET_LABEL -#undef SET_SENSITIVE - - plug_in_menus_update (GIMP_ITEM_FACTORY (item_factory), drawable_type); -} - - -/* private functions */ - -static void -image_menu_buffer_changed (Gimp *gimp, - GimpItemFactory *item_factory) -{ - GtkItemFactory *gtk_factory = GTK_ITEM_FACTORY (item_factory); - gboolean buf = (gimp->global_buffer != NULL); - - if (GTK_IS_MENU_BAR (gtk_factory->widget)) - { - gimp_item_factory_set_sensitive (gtk_factory, "/Edit/Paste", buf); - gimp_item_factory_set_sensitive (gtk_factory, "/Edit/Paste Into", buf); - } - - gimp_item_factory_set_sensitive (gtk_factory, "/Edit/Paste as New", buf); -} - -static void -image_menu_foreground_changed (GimpContext *context, - const GimpRGB *color, - GimpItemFactory *item_factory) -{ - gimp_item_factory_set_color (GTK_ITEM_FACTORY (item_factory), - "/Edit/Fill with FG Color", color, FALSE); -} - -static void -image_menu_background_changed (GimpContext *context, - const GimpRGB *color, - GimpItemFactory *item_factory) -{ - gimp_item_factory_set_color (GTK_ITEM_FACTORY (item_factory), - "/Edit/Fill with BG Color", color, FALSE); -} - -static void -image_menu_set_zoom (GtkItemFactory *item_factory, - GimpDisplayShell *shell) -{ - const gchar *menu = NULL; - guint scale; - gchar buf[16]; - gchar *label; - - scale = ROUND (shell->scale * 1000); - - switch (scale) - { - case 16000: menu = VIEW_ZOOM_16_1; break; - case 8000: menu = VIEW_ZOOM_8_1; break; - case 4000: menu = VIEW_ZOOM_4_1; break; - case 2000: menu = VIEW_ZOOM_2_1; break; - case 1000: menu = VIEW_ZOOM_1_1; break; - case 500: menu = VIEW_ZOOM_1_2; break; - case 250: menu = VIEW_ZOOM_1_4; break; - case 125: menu = VIEW_ZOOM_1_8; break; - case 63: - case 62: menu = VIEW_ZOOM_1_16; break; - } - - g_snprintf (buf, sizeof (buf), - shell->scale >= 0.15 ? "%.0f%%" : "%.2f%%", - shell->scale * 100.0); - - if (!menu) - { - menu = "/View/Zoom/Other..."; - - label = g_strdup_printf (_("Other (%s) ..."), buf); - gimp_item_factory_set_label (item_factory, menu, label); - g_free (label); - - shell->other_scale = shell->scale; - } - - gimp_item_factory_set_active (item_factory, menu, TRUE); - - label = g_strdup_printf (_("_Zoom (%s)"), buf); - gimp_item_factory_set_label (item_factory, "/View/Zoom", label); - g_free (label); - - /* flag as dirty */ - shell->other_scale = - fabs (shell->other_scale); -} diff --git a/app/menus/image-menu.h b/app/menus/image-menu.h index e6223ab6fd..b8115da85b 100644 --- a/app/menus/image-menu.h +++ b/app/menus/image-menu.h @@ -20,17 +20,8 @@ #define __IMAGE_MENU_H__ -extern GimpItemFactoryEntry image_menu_entries[]; -extern gint n_image_menu_entries; - - -void image_menu_setup2 (GimpUIManager *manager, - const gchar *ui_path); - -void image_menu_setup (GimpItemFactory *factory, - gpointer callback_data); -void image_menu_update (GtkItemFactory *factory, - gpointer update_data); +void image_menu_setup (GimpUIManager *manager, + const gchar *ui_path); #endif /* __IMAGE_MENU_H__ */ diff --git a/app/menus/menus.c b/app/menus/menus.c index 984f8aafd6..944085e894 100644 --- a/app/menus/menus.c +++ b/app/menus/menus.c @@ -39,47 +39,20 @@ #include "widgets/gimpuimanager.h" #include "actions/actions.h" -#include "actions/file-commands.h" -#include "brushes-menu.h" -#include "buffers-menu.h" -#include "channels-menu.h" -#include "colormap-editor-menu.h" -#include "dialogs-menu.h" -#include "documents-menu.h" -#include "error-console-menu.h" #include "file-open-menu.h" #include "file-save-menu.h" -#include "fonts-menu.h" -#include "gradient-editor-menu.h" -#include "gradients-menu.h" #include "image-menu.h" -#include "images-menu.h" -#include "layers-menu.h" #include "menus.h" -#include "palette-editor-menu.h" -#include "palettes-menu.h" -#include "patterns-menu.h" -#include "qmask-menu.h" -#include "templates-menu.h" #include "tool-options-menu.h" #include "toolbox-menu.h" -#include "vectors-menu.h" #include "gimp-intl.h" /* local function prototypes */ -static void menus_last_opened_update (GimpContainer *container, - GimpImagefile *unused, - GimpItemFactory *item_factory); -static void menus_last_opened_reorder (GimpContainer *container, - GimpImagefile *unused1, - gint unused2, - GimpItemFactory *item_factory); - -static void menu_can_change_accels (GimpGuiConfig *config); +static void menu_can_change_accels (GimpGuiConfig *config); /* global variables */ @@ -112,19 +85,11 @@ menus_init (Gimp *gimp) global_menu_factory = gimp_menu_factory_new (gimp, global_action_factory); - gimp_menu_factory_menu_register (global_menu_factory, "", - _("Toolbox Menu"), - GIMP_HELP_TOOLBOX, - toolbox_menu_setup, NULL, FALSE, - n_toolbox_menu_entries, - toolbox_menu_entries); - gimp_menu_factory_menu_register (global_menu_factory, "", _("Image Menu"), GIMP_HELP_IMAGE_WINDOW, - image_menu_setup, image_menu_update, FALSE, - n_image_menu_entries, - image_menu_entries); + NULL, NULL, FALSE, + 0, NULL); gimp_menu_factory_manager_register (global_menu_factory, "", "file", "debug", @@ -142,9 +107,11 @@ menus_init (Gimp *gimp) "qmask", NULL, "/toolbox-menubar", - "toolbox-menu.xml", toolbox_menu_setup2, + "toolbox-menu.xml", toolbox_menu_setup, "/image-menubar", - "image-menu.xml", image_menu_setup2, + "image-menu.xml", image_menu_setup, + "/image-popup", + "image-menu.xml", image_menu_setup, "/qmask-popup", "qmask-menu.xml", NULL, NULL); @@ -167,9 +134,8 @@ menus_init (Gimp *gimp) gimp_menu_factory_menu_register (global_menu_factory, "", _("Layers Menu"), GIMP_HELP_LAYER_DIALOG, - NULL, layers_menu_update, TRUE, - n_layers_menu_entries, - layers_menu_entries); + NULL, NULL, TRUE, + 0, NULL); gimp_menu_factory_manager_register (global_menu_factory, "", "layers", NULL, @@ -180,9 +146,8 @@ menus_init (Gimp *gimp) gimp_menu_factory_menu_register (global_menu_factory, "", _("Channels Menu"), GIMP_HELP_CHANNEL_DIALOG, - NULL, channels_menu_update, TRUE, - n_channels_menu_entries, - channels_menu_entries); + NULL, NULL, TRUE, + 0, NULL); gimp_menu_factory_manager_register (global_menu_factory, "", "channels", NULL, @@ -193,9 +158,8 @@ menus_init (Gimp *gimp) gimp_menu_factory_menu_register (global_menu_factory, "", _("Paths Menu"), GIMP_HELP_PATH_DIALOG, - NULL, vectors_menu_update, TRUE, - n_vectors_menu_entries, - vectors_menu_entries); + NULL, NULL, TRUE, + 0, NULL); gimp_menu_factory_manager_register (global_menu_factory, "", "vectors", NULL, @@ -206,9 +170,8 @@ menus_init (Gimp *gimp) gimp_menu_factory_menu_register (global_menu_factory, "", _("Dialogs Menu"), GIMP_HELP_DOCK, - NULL, dialogs_menu_update, TRUE, - n_dialogs_menu_entries, - dialogs_menu_entries); + NULL, NULL, TRUE, + 0, NULL); gimp_menu_factory_manager_register (global_menu_factory, "", "dockable", NULL, @@ -219,9 +182,8 @@ menus_init (Gimp *gimp) gimp_menu_factory_menu_register (global_menu_factory, "", _("Brushes Menu"), GIMP_HELP_BRUSH_DIALOG, - NULL, brushes_menu_update, TRUE, - n_brushes_menu_entries, - brushes_menu_entries); + NULL, NULL, TRUE, + 0, NULL); gimp_menu_factory_manager_register (global_menu_factory, "", "brushes", NULL, @@ -232,9 +194,8 @@ menus_init (Gimp *gimp) gimp_menu_factory_menu_register (global_menu_factory, "", _("Patterns Menu"), GIMP_HELP_PATTERN_DIALOG, - NULL, patterns_menu_update, TRUE, - n_patterns_menu_entries, - patterns_menu_entries); + NULL, NULL, TRUE, + 0, NULL); gimp_menu_factory_manager_register (global_menu_factory, "", "patterns", NULL, @@ -245,9 +206,8 @@ menus_init (Gimp *gimp) gimp_menu_factory_menu_register (global_menu_factory, "", _("Gradients Menu"), GIMP_HELP_GRADIENT_DIALOG, - NULL, gradients_menu_update, TRUE, - n_gradients_menu_entries, - gradients_menu_entries); + NULL, NULL, TRUE, + 0, NULL); gimp_menu_factory_manager_register (global_menu_factory, "", "gradients", NULL, @@ -258,9 +218,8 @@ menus_init (Gimp *gimp) gimp_menu_factory_menu_register (global_menu_factory, "", _("Palettes Menu"), GIMP_HELP_PALETTE_DIALOG, - NULL, palettes_menu_update, TRUE, - n_palettes_menu_entries, - palettes_menu_entries); + NULL, NULL, TRUE, + 0, NULL); gimp_menu_factory_manager_register (global_menu_factory, "", "palettes", NULL, @@ -271,9 +230,8 @@ menus_init (Gimp *gimp) gimp_menu_factory_menu_register (global_menu_factory, "", _("Fonts Menu"), GIMP_HELP_FONT_DIALOG, - NULL, fonts_menu_update, TRUE, - n_fonts_menu_entries, - fonts_menu_entries); + NULL, NULL, TRUE, + 0, NULL); gimp_menu_factory_manager_register (global_menu_factory, "", "fonts", NULL, @@ -284,9 +242,8 @@ menus_init (Gimp *gimp) gimp_menu_factory_menu_register (global_menu_factory, "", _("Buffers Menu"), GIMP_HELP_BUFFER_DIALOG, - NULL, buffers_menu_update, TRUE, - n_buffers_menu_entries, - buffers_menu_entries); + NULL, NULL, TRUE, + 0, NULL); gimp_menu_factory_manager_register (global_menu_factory, "", "buffers", NULL, @@ -297,9 +254,8 @@ menus_init (Gimp *gimp) gimp_menu_factory_menu_register (global_menu_factory, "", _("Documents Menu"), GIMP_HELP_DOCUMENT_DIALOG, - NULL, documents_menu_update, TRUE, - n_documents_menu_entries, - documents_menu_entries); + NULL, NULL, TRUE, + 0, NULL); gimp_menu_factory_manager_register (global_menu_factory, "", "documents", NULL, @@ -310,9 +266,8 @@ menus_init (Gimp *gimp) gimp_menu_factory_menu_register (global_menu_factory, "", _("Templates Menu"), GIMP_HELP_TEMPLATE_DIALOG, - NULL, templates_menu_update, TRUE, - n_templates_menu_entries, - templates_menu_entries); + NULL, NULL, TRUE, + 0, NULL); gimp_menu_factory_manager_register (global_menu_factory, "", "templates", NULL, @@ -323,9 +278,8 @@ menus_init (Gimp *gimp) gimp_menu_factory_menu_register (global_menu_factory, "", _("Images Menu"), GIMP_HELP_IMAGE_DIALOG, - NULL, images_menu_update, TRUE, - n_images_menu_entries, - images_menu_entries); + NULL, NULL, TRUE, + 0, NULL); gimp_menu_factory_manager_register (global_menu_factory, "", "images", NULL, @@ -336,9 +290,8 @@ menus_init (Gimp *gimp) gimp_menu_factory_menu_register (global_menu_factory, "", _("Gradient Editor Menu"), GIMP_HELP_GRADIENT_EDITOR_DIALOG, - NULL, gradient_editor_menu_update, TRUE, - n_gradient_editor_menu_entries, - gradient_editor_menu_entries); + NULL, NULL, TRUE, + 0, NULL); gimp_menu_factory_manager_register (global_menu_factory, "", "gradient-editor", NULL, @@ -349,9 +302,8 @@ menus_init (Gimp *gimp) gimp_menu_factory_menu_register (global_menu_factory, "", _("Palette Editor Menu"), GIMP_HELP_PALETTE_EDITOR_DIALOG, - NULL, palette_editor_menu_update, TRUE, - n_palette_editor_menu_entries, - palette_editor_menu_entries); + NULL, NULL, TRUE, + 0, NULL); gimp_menu_factory_manager_register (global_menu_factory, "", "palette-editor", NULL, @@ -362,9 +314,8 @@ menus_init (Gimp *gimp) gimp_menu_factory_menu_register (global_menu_factory, "", _("Indexed Palette Menu"), GIMP_HELP_INDEXED_PALETTE_DIALOG, - NULL, colormap_editor_menu_update, TRUE, - n_colormap_editor_menu_entries, - colormap_editor_menu_entries); + NULL, NULL, TRUE, + 0, NULL); gimp_menu_factory_manager_register (global_menu_factory, "", "colormap-editor", NULL, @@ -375,9 +326,8 @@ menus_init (Gimp *gimp) gimp_menu_factory_menu_register (global_menu_factory, "", _("QuickMask Menu"), GIMP_HELP_QMASK, - NULL, qmask_menu_update, TRUE, - n_qmask_menu_entries, - qmask_menu_entries); + NULL, NULL, TRUE, + 0, NULL); gimp_menu_factory_manager_register (global_menu_factory, "", "qmask", NULL, @@ -388,9 +338,8 @@ menus_init (Gimp *gimp) gimp_menu_factory_menu_register (global_menu_factory, "", _("Error Console Menu"), GIMP_HELP_ERRORS_DIALOG, - NULL, error_console_menu_update, TRUE, - n_error_console_menu_entries, - error_console_menu_entries); + NULL, NULL, TRUE, + 0, NULL); gimp_menu_factory_manager_register (global_menu_factory, "", "error-console", NULL, @@ -403,8 +352,7 @@ menus_init (Gimp *gimp) GIMP_HELP_TOOL_OPTIONS_DIALOG, tool_options_menu_setup, tool_options_menu_update, TRUE, - n_tool_options_menu_entries, - tool_options_menu_entries); + 0, NULL); gimp_menu_factory_manager_register (global_menu_factory, "", "tool-options", NULL, @@ -492,201 +440,9 @@ menus_open_recent_add (GimpUIManager *manager, } } -void -menus_last_opened_add (GimpItemFactory *item_factory) -{ - GimpItemFactoryEntry *last_opened_entries; - gint n_last_opened_entries; - gint i; - - g_return_if_fail (GIMP_IS_ITEM_FACTORY (item_factory)); - - n_last_opened_entries = - GIMP_GUI_CONFIG (item_factory->gimp->config)->last_opened_size; - - last_opened_entries = g_new (GimpItemFactoryEntry, n_last_opened_entries); - - for (i = 0; i < n_last_opened_entries; i++) - { - last_opened_entries[i].entry.path = - g_strdup_printf ("/File/Open Recent/%02d", i + 1); - - if (i < 9) - last_opened_entries[i].entry.accelerator = - g_strdup_printf ("%d", i + 1); - else if (i == 9) - last_opened_entries[i].entry.accelerator = "0"; - else - last_opened_entries[i].entry.accelerator = ""; - - last_opened_entries[i].entry.callback = file_last_opened_cmd_callback; - last_opened_entries[i].entry.callback_action = i; - last_opened_entries[i].entry.item_type = ""; - last_opened_entries[i].entry.extra_data = GTK_STOCK_OPEN; - last_opened_entries[i].quark_string = NULL; - last_opened_entries[i].help_id = GIMP_HELP_FILE_OPEN_RECENT; - last_opened_entries[i].description = NULL; - } - - gimp_item_factory_create_items (item_factory, - n_last_opened_entries, last_opened_entries, - item_factory->gimp, 2, FALSE); - - gimp_item_factory_set_sensitive (GTK_ITEM_FACTORY (item_factory), - "/File/Open Recent/(None)", - FALSE); - - for (i = 0; i < n_last_opened_entries; i++) - { - GtkWidget *widget; - - widget = gtk_item_factory_get_widget (GTK_ITEM_FACTORY (item_factory), - last_opened_entries[i].entry.path); - gtk_menu_reorder_child (GTK_MENU (widget->parent), widget, i + 1); - - gimp_item_factory_set_visible (GTK_ITEM_FACTORY (item_factory), - last_opened_entries[i].entry.path, - FALSE); - - g_free (last_opened_entries[i].entry.path); - if (i < 9) - g_free (last_opened_entries[i].entry.accelerator); - } - - g_free (last_opened_entries); - - g_signal_connect_object (item_factory->gimp->documents, "add", - G_CALLBACK (menus_last_opened_update), - item_factory, 0); - g_signal_connect_object (item_factory->gimp->documents, "remove", - G_CALLBACK (menus_last_opened_update), - item_factory, 0); - g_signal_connect_object (item_factory->gimp->documents, "reorder", - G_CALLBACK (menus_last_opened_reorder), - item_factory, 0); - - menus_last_opened_update (item_factory->gimp->documents, NULL, item_factory); -} - -void -menus_filters_subdirs_to_top (GtkMenu *menu) -{ - GtkMenuItem *menu_item; - GList *list; - gboolean submenus_passed = FALSE; - gint pos; - gint items; - - pos = 1; - items = 0; - - for (list = GTK_MENU_SHELL (menu)->children; list; list = g_list_next (list)) - { - menu_item = GTK_MENU_ITEM (list->data); - items++; - - if (menu_item->submenu) - { - if (submenus_passed) - { - menus_filters_subdirs_to_top (GTK_MENU (menu_item->submenu)); - gtk_menu_reorder_child (menu, GTK_WIDGET (menu_item), pos++); - } - } - else - { - submenus_passed = TRUE; - } - } - - if (pos > 1 && items > pos) - { - GtkWidget *separator; - - separator = gtk_menu_item_new (); - gtk_menu_shell_insert (GTK_MENU_SHELL (menu), separator, pos); - gtk_widget_show (separator); - } -} - /* private functions */ -static void -menus_last_opened_update (GimpContainer *container, - GimpImagefile *unused, - GimpItemFactory *item_factory) -{ - GtkWidget *widget; - gint num_documents; - gint i; - gint n = GIMP_GUI_CONFIG (item_factory->gimp->config)->last_opened_size; - - num_documents = gimp_container_num_children (container); - - gimp_item_factory_set_visible (GTK_ITEM_FACTORY (item_factory), - "/File/Open Recent/(None)", - num_documents == 0); - - for (i = 0; i < n; i++) - { - gchar *path_str; - - path_str = g_strdup_printf ("/File/Open Recent/%02d", i + 1); - - widget = gtk_item_factory_get_widget (GTK_ITEM_FACTORY (item_factory), - path_str); - - g_free (path_str); - - if (i < num_documents) - { - GimpImagefile *imagefile; - - imagefile = (GimpImagefile *) - gimp_container_get_child_by_index (container, i); - - if (g_object_get_data (G_OBJECT (widget), "gimp-imagefile") != - (gpointer) imagefile) - { - const gchar *uri; - gchar *filename; - gchar *basename; - - uri = gimp_object_get_name (GIMP_OBJECT (imagefile)); - - filename = file_utils_uri_to_utf8_filename (uri); - basename = file_utils_uri_to_utf8_basename (uri); - - gtk_label_set_text (GTK_LABEL (GTK_BIN (widget)->child), - basename); - gimp_help_set_help_data (widget, filename, NULL); - - g_free (filename); - g_free (basename); - - g_object_set_data (G_OBJECT (widget), - "gimp-imagefile", imagefile); - gtk_widget_show (widget); - } - } - else - { - g_object_set_data (G_OBJECT (widget), "gimp-imagefile", NULL); - gtk_widget_hide (widget); - } - } -} - -static void -menus_last_opened_reorder (GimpContainer *container, - GimpImagefile *unused1, - gint unused2, - GimpItemFactory *item_factory) -{ - menus_last_opened_update (container, unused1, item_factory); -} - static void menu_can_change_accels (GimpGuiConfig *config) { diff --git a/app/menus/menus.h b/app/menus/menus.h index 5d7be087d7..3e1e49a311 100644 --- a/app/menus/menus.h +++ b/app/menus/menus.h @@ -20,27 +20,17 @@ #define __MENUS_H__ -#define MENU_SEPARATOR(path) \ - { { (path), NULL, NULL, 0, "" }, NULL, NULL, NULL } - -#define MENU_BRANCH(path) \ - { { (path), NULL, NULL, 0, "" }, NULL, NULL, NULL } - - extern GimpMenuFactory *global_menu_factory; -void menus_init (Gimp *gimp); -void menus_exit (Gimp *gimp); -void menus_restore (Gimp *gimp); -void menus_save (Gimp *gimp); -void menus_clear (Gimp *gimp); +void menus_init (Gimp *gimp); +void menus_exit (Gimp *gimp); +void menus_restore (Gimp *gimp); +void menus_save (Gimp *gimp); +void menus_clear (Gimp *gimp); -void menus_open_recent_add (GimpUIManager *manager, - const gchar *ui_path); - -void menus_last_opened_add (GimpItemFactory *item_factory); -void menus_filters_subdirs_to_top (GtkMenu *menu); +void menus_open_recent_add (GimpUIManager *manager, + const gchar *ui_path); #endif /* __MENUS_H__ */ diff --git a/app/menus/plug-in-menus.c b/app/menus/plug-in-menus.c index 755fd5ed79..31fa30d5cf 100644 --- a/app/menus/plug-in-menus.c +++ b/app/menus/plug-in-menus.c @@ -33,33 +33,16 @@ #include "plug-in/plug-in-proc.h" #include "plug-in/plug-in-run.h" -#include "widgets/gimpitemfactory.h" #include "widgets/gimpuimanager.h" #include "widgets/gimpwidgets-utils.h" -#include "actions/plug-in-commands.h" - #include "plug-in-menus.h" #include "gimp-intl.h" -typedef struct _PlugInMenuEntry PlugInMenuEntry; - -struct _PlugInMenuEntry -{ - PlugInProcDef *proc_def; - const gchar *locale_domain; - const gchar *help_domain; -}; - - /* local function prototypes */ -static gboolean plug_in_menu_tree_traverse_func (gpointer foo, - PlugInMenuEntry *menu_entry, - GimpItemFactory *item_factory); - static gboolean plug_in_menus_tree_traverse (gpointer foo, PlugInProcDef *proc_def, GimpUIManager *manager); @@ -199,6 +182,7 @@ plug_in_menus_add_proc (GimpUIManager *manager, if (p) { gchar *action_path; + gchar *merge_key; guint merge_id; *p = '\0'; @@ -209,8 +193,10 @@ plug_in_menus_add_proc (GimpUIManager *manager, action_path = g_strdup_printf ("%s%s", ui_path, strchr (path, '/')); +#if 0 g_print ("adding UI for '%s' (@ %s)\n", proc_def->db_info.name, action_path); +#endif gtk_ui_manager_add_ui (GTK_UI_MANAGER (manager), merge_id, action_path, @@ -220,6 +206,11 @@ plug_in_menus_add_proc (GimpUIManager *manager, FALSE); g_free (action_path); + + merge_key = g_strdup_printf ("%s-merge-id", proc_def->db_info.name); + g_object_set_data (G_OBJECT (manager), merge_key, + GUINT_TO_POINTER (merge_id)); + g_free (merge_key); } g_free (path); @@ -229,294 +220,24 @@ void plug_in_menus_remove_proc (GimpUIManager *manager, PlugInProcDef *proc_def) { + gchar *merge_key; + guint merge_id; + g_return_if_fail (GIMP_IS_UI_MANAGER (manager)); g_return_if_fail (proc_def != NULL); -} -void -plug_in_menus_create (GimpItemFactory *item_factory, - GSList *proc_defs) -{ - GSList *procs; - GTree *menu_entries; + merge_key = g_strdup_printf ("%s-merge-id", proc_def->db_info.name); + merge_id = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (manager), + merge_key)); + g_free (merge_key); - g_return_if_fail (GIMP_IS_ITEM_FACTORY (item_factory)); - g_return_if_fail (proc_defs != NULL); - - menu_entries = g_tree_new_full ((GCompareDataFunc) g_utf8_collate, NULL, - g_free, g_free); - - for (procs = proc_defs; procs; procs = procs->next) - { - PlugInProcDef *proc_def = procs->data; - - if (proc_def->prog && - proc_def->menu_path && - ! proc_def->extensions && - ! proc_def->prefixes && - ! proc_def->magics) - { - PlugInMenuEntry *menu_entry; - const gchar *progname; - const gchar *locale_domain; - const gchar *help_domain; - gchar *key; - - progname = plug_in_proc_def_get_progname (proc_def); - - locale_domain = plug_ins_locale_domain (item_factory->gimp, - progname, NULL); - help_domain = plug_ins_help_domain (item_factory->gimp, - progname, NULL); - - menu_entry = g_new0 (PlugInMenuEntry, 1); - - menu_entry->proc_def = proc_def; - menu_entry->locale_domain = locale_domain; - menu_entry->help_domain = help_domain; - - key = gimp_strip_uline (dgettext (locale_domain, - proc_def->menu_path)); - g_tree_insert (menu_entries, key, menu_entry); - } - } - - g_tree_foreach (menu_entries, - (GTraverseFunc) plug_in_menu_tree_traverse_func, - item_factory); - g_tree_destroy (menu_entries); -} - -void -plug_in_menus_create_entry (GimpItemFactory *item_factory, - PlugInProcDef *proc_def, - const gchar *locale_domain, - const gchar *help_domain) -{ - GimpItemFactoryEntry entry; - gchar *help_id; - - g_return_if_fail (item_factory == NULL || - GIMP_IS_ITEM_FACTORY (item_factory)); - g_return_if_fail (proc_def != NULL); - - help_id = plug_in_proc_def_get_help_id (proc_def, help_domain); - - entry.entry.path = strstr (proc_def->menu_path, "/"); - entry.entry.accelerator = proc_def->accelerator; - entry.entry.callback = plug_in_run_cmd_callback; - entry.entry.callback_action = 0; - entry.entry.item_type = NULL; - entry.quark_string = NULL; - entry.help_id = help_id; - entry.description = NULL; - - if (item_factory) - { - gchar *factory_path; - - factory_path = GTK_ITEM_FACTORY (item_factory)->path; - - if (! strncmp (proc_def->menu_path, - factory_path, strlen (factory_path))) - { - gimp_item_factory_create_item (item_factory, - &entry, - locale_domain, - &proc_def->db_info, 2, FALSE); - } - } - else - { - GList *list; - - for (list = gimp_item_factories_from_path (proc_def->menu_path); - list; - list = g_list_next (list)) - { - item_factory = list->data; - - gimp_item_factory_create_item (item_factory, - &entry, - locale_domain, - &proc_def->db_info, 2, FALSE); - } - } - - g_free (help_id); -} - -void -plug_in_menus_delete_entry (PlugInProcDef *proc_def) -{ - GList *list; - gchar *path; - - g_return_if_fail (proc_def != NULL); - g_return_if_fail (proc_def->menu_path != NULL); - - path = gimp_strip_uline (proc_def->menu_path); - - for (list = gimp_item_factories_from_path (proc_def->menu_path); - list; - list = g_list_next (list)) - { - GtkItemFactory *item_factory = list->data; - - gtk_item_factory_delete_item (GTK_ITEM_FACTORY (item_factory), path); - } - - g_free (path); -} - -void -plug_in_menus_update (GimpItemFactory *item_factory, - GimpImageType type) -{ - GSList *list; - gchar *factory_path; - gint factory_path_len; - gboolean is_image_factory = FALSE; - - g_return_if_fail (GIMP_IS_ITEM_FACTORY (item_factory)); - - factory_path = GTK_ITEM_FACTORY (item_factory)->path; - factory_path_len = strlen (factory_path); - - if (! strcmp (factory_path, "")) - is_image_factory = TRUE; - - for (list = item_factory->gimp->plug_in_proc_defs; - list; - list = g_slist_next (list)) - { - PlugInProcDef *proc_def = list->data; - - if (proc_def->menu_path && proc_def->image_types_val) - { - gboolean sensitive; - - switch (type) - { - case GIMP_RGB_IMAGE: - sensitive = proc_def->image_types_val & PLUG_IN_RGB_IMAGE; - break; - case GIMP_RGBA_IMAGE: - sensitive = proc_def->image_types_val & PLUG_IN_RGBA_IMAGE; - break; - case GIMP_GRAY_IMAGE: - sensitive = proc_def->image_types_val & PLUG_IN_GRAY_IMAGE; - break; - case GIMP_GRAYA_IMAGE: - sensitive = proc_def->image_types_val & PLUG_IN_GRAYA_IMAGE; - break; - case GIMP_INDEXED_IMAGE: - sensitive = proc_def->image_types_val & PLUG_IN_INDEXED_IMAGE; - break; - case GIMP_INDEXEDA_IMAGE: - sensitive = proc_def->image_types_val & PLUG_IN_INDEXEDA_IMAGE; - break; - default: - sensitive = FALSE; - break; - } - - if (! strncmp (proc_def->menu_path, factory_path, factory_path_len)) - { - gchar *menu_path; - - menu_path = gimp_strip_uline (proc_def->menu_path); - - gimp_item_factory_set_sensitive (GTK_ITEM_FACTORY (item_factory), - menu_path, - sensitive); - - g_free (menu_path); - } - - if (is_image_factory && - item_factory->gimp->last_plug_in && - item_factory->gimp->last_plug_in == &proc_def->db_info) - { - const gchar *progname; - const gchar *path; - gchar *stripped; - gchar *basename; - gchar *ellipses; - gchar *repeat; - gchar *reshow; - - progname = plug_in_proc_def_get_progname (proc_def); - - path = dgettext (plug_ins_locale_domain (item_factory->gimp, - progname, NULL), - proc_def->menu_path); - - stripped = gimp_strip_uline (path); - basename = g_path_get_basename (stripped); - - g_free (stripped); - - ellipses = strstr (basename, "..."); - - if (ellipses && ellipses == (basename + strlen (basename) - 3)) - *ellipses = '\0'; - - repeat = g_strdup_printf (_("Re_peat \"%s\""), basename); - reshow = g_strdup_printf (_("R_e-show \"%s\""), basename); - - g_free (basename); - - gimp_item_factory_set_label (GTK_ITEM_FACTORY (item_factory), - "/Filters/Repeat Last", repeat); - gimp_item_factory_set_label (GTK_ITEM_FACTORY (item_factory), - "/Filters/Re-Show Last", reshow); - - g_free (repeat); - g_free (reshow); - - gimp_item_factory_set_sensitive (GTK_ITEM_FACTORY (item_factory), - "/Filters/Repeat Last", - sensitive); - gimp_item_factory_set_sensitive (GTK_ITEM_FACTORY (item_factory), - "/Filters/Re-Show Last", - sensitive); - } - } - } - - if (is_image_factory && ! item_factory->gimp->last_plug_in) - { - gimp_item_factory_set_label (GTK_ITEM_FACTORY (item_factory), - "/Filters/Repeat Last", - _("Repeat Last")); - gimp_item_factory_set_label (GTK_ITEM_FACTORY (item_factory), - "/Filters/Re-Show Last", - _("Re-Show Last")); - - gimp_item_factory_set_sensitive (GTK_ITEM_FACTORY (item_factory), - "/Filters/Repeat Last", FALSE); - gimp_item_factory_set_sensitive (GTK_ITEM_FACTORY (item_factory), - "/Filters/Re-Show Last", FALSE); - } + if (merge_id) + gtk_ui_manager_remove_ui (GTK_UI_MANAGER (manager), merge_id); } /* private functions */ -static gboolean -plug_in_menu_tree_traverse_func (gpointer foo, - PlugInMenuEntry *menu_entry, - GimpItemFactory *item_factory) -{ - plug_in_menus_create_entry (item_factory, - menu_entry->proc_def, - menu_entry->locale_domain, - menu_entry->help_domain); - - return FALSE; -} - static gboolean plug_in_menus_tree_traverse (gpointer foo, PlugInProcDef *proc_def, @@ -557,8 +278,10 @@ plug_in_menus_build_path (GimpUIManager *manager, p = strrchr (action_path, '/'); *p = '\0'; +#if 0 g_print ("adding UI for '%s' (@ %s)\n", path, action_path); +#endif name = strrchr (path, '/') + 1; diff --git a/app/menus/plug-in-menus.h b/app/menus/plug-in-menus.h index c4389b0f87..20a9885527 100644 --- a/app/menus/plug-in-menus.h +++ b/app/menus/plug-in-menus.h @@ -32,16 +32,5 @@ void plug_in_menus_add_proc (GimpUIManager *manager, void plug_in_menus_remove_proc (GimpUIManager *manager, PlugInProcDef *proc_def); -void plug_in_menus_create (GimpItemFactory *item_factory, - GSList *proc_defs); -void plug_in_menus_create_entry (GimpItemFactory *item_factory, - PlugInProcDef *proc_def, - const gchar *locale_domain, - const gchar *help_domain); -void plug_in_menus_delete_entry (PlugInProcDef *proc_def); - -void plug_in_menus_update (GimpItemFactory *item_factory, - GimpImageType type); - #endif /* __PLUG_IN_MENUS_H__ */ diff --git a/app/menus/tool-options-menu.c b/app/menus/tool-options-menu.c index 8cd2a7c837..9d99b6bd33 100644 --- a/app/menus/tool-options-menu.c +++ b/app/menus/tool-options-menu.c @@ -40,6 +40,10 @@ #include "gimp-intl.h" +#define MENU_BRANCH(path) \ + { { (path), NULL, NULL, 0, "" }, NULL, NULL, NULL } + + /* local function prototypes */ static void tool_options_menu_update_presets (GtkItemFactory *factory, diff --git a/app/menus/toolbox-menu.c b/app/menus/toolbox-menu.c index fa1b73ce41..b158b80dd5 100644 --- a/app/menus/toolbox-menu.c +++ b/app/menus/toolbox-menu.c @@ -20,339 +20,17 @@ #include -#include "libgimpwidgets/gimpwidgets.h" - #include "gui-types.h" -#include "core/gimp.h" - -#include "plug-in/plug-ins.h" - -#include "widgets/gimphelp-ids.h" -#include "widgets/gimpitemfactory.h" - -#include "actions/debug-commands.h" -#include "actions/dialogs-commands.h" -#include "actions/file-commands.h" -#include "actions/help-commands.h" - #include "menus.h" #include "plug-in-menus.h" #include "toolbox-menu.h" -#include "gimp-intl.h" - - -GimpItemFactoryEntry toolbox_menu_entries[] = -{ - /* /File */ - - MENU_BRANCH (N_("/_File")), - - { { N_("/File/_New..."), "N", - file_new_cmd_callback, 0, - "", GTK_STOCK_NEW }, - NULL, - GIMP_HELP_FILE_NEW, NULL }, - { { N_("/File/_Open..."), "O", - file_open_cmd_callback, 0, - "", GTK_STOCK_OPEN }, - NULL, - GIMP_HELP_FILE_OPEN, NULL }, - - /* /File/Open Recent */ - - MENU_BRANCH (N_("/File/Open _Recent")), - - { { N_("/File/Open Recent/(None)"), NULL, NULL, 0 }, - NULL, NULL, NULL }, - - MENU_SEPARATOR ("/File/Open Recent/---"), - - { { N_("/File/Open Recent/Document _History"), "foo", - dialogs_create_dockable_cmd_callback, 0, - "", GTK_STOCK_OPEN }, - "gimp-document-list|gimp-document-grid", - GIMP_HELP_DOCUMENT_DIALOG, NULL }, - - /* /File/Acquire */ - - MENU_BRANCH (N_("/File/_Acquire")), - - MENU_SEPARATOR ("/File/---"), - - { { N_("/File/_Preferences"), NULL, - dialogs_create_toplevel_cmd_callback, 0, - "", GTK_STOCK_PREFERENCES }, - "gimp-preferences-dialog", - GIMP_HELP_PREFS_DIALOG, NULL }, - - /* /File/Dialogs */ - - MENU_BRANCH (N_("/File/_Dialogs")), - - MENU_BRANCH (N_("/File/Dialogs/Create New Doc_k")), - - { { N_("/File/Dialogs/Create New Dock/_Layers, Channels & Paths"), NULL, - dialogs_create_lc_cmd_callback, 0 }, - NULL, - NULL, NULL }, - { { N_("/File/Dialogs/Create New Dock/_Brushes, Patterns & Gradients"), NULL, - dialogs_create_data_cmd_callback, 0 }, - NULL, - NULL, NULL }, - { { N_("/File/Dialogs/Create New Dock/_Misc. Stuff"), NULL, - dialogs_create_stuff_cmd_callback, 0 }, - NULL, - NULL, NULL }, - - { { N_("/File/Dialogs/Tool _Options"), "T", - dialogs_create_dockable_cmd_callback, 0, - "", GIMP_STOCK_TOOL_OPTIONS }, - "gimp-tool-options", - GIMP_HELP_TOOL_OPTIONS_DIALOG, NULL }, - { { N_("/File/Dialogs/_Device Status"), NULL, - dialogs_create_dockable_cmd_callback, 0, - "", GIMP_STOCK_DEVICE_STATUS }, - "gimp-device-status", - GIMP_HELP_DEVICE_STATUS_DIALOG, NULL }, - - MENU_SEPARATOR ("/File/Dialogs/---"), - - { { N_("/File/Dialogs/_Layers"), "L", - dialogs_create_dockable_cmd_callback, 0, - "", GIMP_STOCK_LAYERS }, - "gimp-layer-list", - GIMP_HELP_LAYER_DIALOG, NULL }, - { { N_("/File/Dialogs/_Channels"), NULL, - dialogs_create_dockable_cmd_callback, 0, - "", GIMP_STOCK_CHANNELS }, - "gimp-channel-list", - GIMP_HELP_CHANNEL_DIALOG, NULL }, - { { N_("/File/Dialogs/_Paths"), NULL, - dialogs_create_dockable_cmd_callback, 0, - "", GIMP_STOCK_PATHS }, - "gimp-vectors-list", - GIMP_HELP_PATH_DIALOG, NULL }, - { { N_("/File/Dialogs/Inde_xed Palette"), NULL, - dialogs_create_dockable_cmd_callback, 0, - "", GIMP_STOCK_INDEXED_PALETTE }, - "gimp-indexed-palette", - GIMP_HELP_INDEXED_PALETTE_DIALOG, NULL }, - { { N_("/File/Dialogs/Histogra_m"), NULL, - dialogs_create_dockable_cmd_callback, 0, - "", GIMP_STOCK_HISTOGRAM }, - "gimp-histogram-editor", - GIMP_HELP_HISTOGRAM_DIALOG, NULL }, - { { N_("/File/Dialogs/_Selection Editor"), NULL, - dialogs_create_dockable_cmd_callback, 0, - "", GIMP_STOCK_TOOL_RECT_SELECT }, - "gimp-selection-editor", - GIMP_HELP_SELECTION_DIALOG, NULL }, - { { N_("/File/Dialogs/Na_vigation"), NULL, - dialogs_create_dockable_cmd_callback, 0, - "", GIMP_STOCK_NAVIGATION }, - "gimp-navigation-view", - GIMP_HELP_NAVIGATION_DIALOG, NULL }, - { { N_("/File/Dialogs/_Undo History"), NULL, - dialogs_create_dockable_cmd_callback, 0, - "", GIMP_STOCK_UNDO_HISTORY }, - "gimp-undo-history", - GIMP_HELP_UNDO_DIALOG, NULL }, - - MENU_SEPARATOR ("/File/Dialogs/---"), - - { { N_("/File/Dialogs/Colo_rs"), NULL, - dialogs_create_dockable_cmd_callback, 0, - "", GIMP_STOCK_DEFAULT_COLORS }, - "gimp-color-editor", - GIMP_HELP_COLOR_DIALOG, NULL }, - { { N_("/File/Dialogs/Brus_hes"), "B", - dialogs_create_dockable_cmd_callback, 0, - "", GIMP_STOCK_BRUSH }, - "gimp-brush-grid", - GIMP_HELP_BRUSH_DIALOG, NULL }, - { { N_("/File/Dialogs/P_atterns"), "P", - dialogs_create_dockable_cmd_callback, 0, - "", GIMP_STOCK_PATTERN }, - "gimp-pattern-grid", - GIMP_HELP_PATTERN_DIALOG, NULL }, - { { N_("/File/Dialogs/_Gradients"), "G", - dialogs_create_dockable_cmd_callback, 0, - "", GIMP_STOCK_GRADIENT }, - "gimp-gradient-list|gimp-gradient-grid", - GIMP_HELP_GRADIENT_DIALOG, NULL }, - { { N_("/File/Dialogs/Pal_ettes"), "P", - dialogs_create_dockable_cmd_callback, 0, - "", GIMP_STOCK_PALETTE }, - "gimp-palette-list|gimp-palette-list", - GIMP_HELP_PALETTE_DIALOG, NULL }, - { { N_("/File/Dialogs/_Fonts"), NULL, - dialogs_create_dockable_cmd_callback, 0, - "", GIMP_STOCK_FONT }, - "gimp-font-list|gimp-font-grid", - GIMP_HELP_FONT_DIALOG, NULL }, - { { N_("/File/Dialogs/_Buffers"), "foo", - dialogs_create_dockable_cmd_callback, 0, - "", GIMP_STOCK_BUFFER }, - "gimp-buffer-list|gimp-buffer-grid", - GIMP_HELP_BUFFER_DIALOG, NULL }, - - MENU_SEPARATOR ("/File/Dialogs/---"), - - { { N_("/File/Dialogs/_Images"), NULL, - dialogs_create_dockable_cmd_callback, 0, - "", GIMP_STOCK_IMAGES }, - "gimp-image-list|gimp-image-grid", - GIMP_HELP_IMAGE_DIALOG, NULL }, - { { N_("/File/Dialogs/Document Histor_y"), "", - dialogs_create_dockable_cmd_callback, 0, - "", GTK_STOCK_OPEN }, - "gimp-document-list|gimp-document-grid", - GIMP_HELP_DOCUMENT_DIALOG, NULL }, - { { N_("/File/Dialogs/_Templates"), "", - dialogs_create_dockable_cmd_callback, 0, - "", GIMP_STOCK_TEMPLATE }, - "gimp-template-list|gimp-template-grid", - GIMP_HELP_TEMPLATE_DIALOG, NULL }, - { { N_("/File/Dialogs/T_ools"), NULL, - dialogs_create_dockable_cmd_callback, 0, - "", GIMP_STOCK_TOOLS }, - "gimp-tool-list|gimp-tool-grid", - GIMP_HELP_TOOLS_DIALOG, NULL }, - { { N_("/File/Dialogs/Error Co_nsole"), NULL, - dialogs_create_dockable_cmd_callback, 0, - "", GIMP_STOCK_WARNING }, - "gimp-error-console", - GIMP_HELP_ERRORS_DIALOG, NULL }, - -#ifdef ENABLE_DEBUG_MENU - MENU_BRANCH (N_("/File/D_ebug")), - - { { "/File/Debug/_Mem Profile", NULL, - debug_mem_profile_cmd_callback, 0 }, - NULL, NULL, NULL }, - { { "/File/Debug/_Dump Items", NULL, - debug_dump_menus_cmd_callback, 0 }, - NULL, NULL, NULL }, -#endif /* ENABLE_DEBUG_MENU */ - - MENU_SEPARATOR ("/File/---"), - - { { N_("/File/_Quit"), "Q", - file_quit_cmd_callback, 0, - "", GTK_STOCK_QUIT }, - NULL, - GIMP_HELP_FILE_QUIT, NULL }, - - /* /Xtns */ - - MENU_BRANCH (N_("/_Xtns")), - - { { N_("/Xtns/_Module Manager"), NULL, - dialogs_create_toplevel_cmd_callback, 0 }, - "gimp-module-manager-dialog", - GIMP_HELP_MODULE_DIALOG, NULL }, - - MENU_SEPARATOR ("/Xtns/---"), - - /* /Help */ - - MENU_BRANCH (N_("/_Help")), - - { { N_("/Help/_Help"), "F1", - help_help_cmd_callback, 0, - "", GTK_STOCK_HELP }, - NULL, - GIMP_HELP_HELP, NULL }, - { { N_("/Help/_Context Help"), "F1", - help_context_help_cmd_callback, 0, - "", GTK_STOCK_HELP }, - NULL, - GIMP_HELP_HELP_CONTEXT, NULL }, - { { N_("/Help/_Tip of the Day"), NULL, - dialogs_create_toplevel_cmd_callback, 0, - "", GIMP_STOCK_INFO }, - "gimp-tips-dialog", - GIMP_HELP_TIPS_DIALOG, NULL }, - { { N_("/Help/_About"), NULL, - dialogs_create_toplevel_cmd_callback, 0, - "", GIMP_STOCK_WILBER }, - "gimp-about-dialog", - GIMP_HELP_ABOUT_DIALOG, NULL } -}; - -gint n_toolbox_menu_entries = G_N_ELEMENTS (toolbox_menu_entries); - void -toolbox_menu_setup2 (GimpUIManager *manager, - const gchar *ui_path) +toolbox_menu_setup (GimpUIManager *manager, + const gchar *ui_path) { menus_open_recent_add (manager, ui_path); plug_in_menus_setup (manager, ui_path); } - -void -toolbox_menu_setup (GimpItemFactory *factory, - gpointer callback_data) -{ - static gchar *reorder_subsubmenus[] = { "/Xtns" }; - - GtkWidget *menu_item; - GtkWidget *menu; - GList *list; - gint i, pos; - - menus_last_opened_add (factory); - - plug_in_menus_create (factory, factory->gimp->plug_in_proc_defs); - - /* Move all menu items under "/Xtns" which are not submenus or - * separators to the top of the menu - */ - pos = 1; - menu_item = gtk_item_factory_get_widget (GTK_ITEM_FACTORY (factory), - "/Xtns/Module Manager"); - if (menu_item && menu_item->parent && GTK_IS_MENU (menu_item->parent)) - { - menu = menu_item->parent; - - for (list = g_list_nth (GTK_MENU_SHELL (menu)->children, pos); - list; - list = g_list_next (list)) - { - menu_item = GTK_WIDGET (list->data); - - if (! GTK_MENU_ITEM (menu_item)->submenu && - GTK_IS_LABEL (GTK_BIN (menu_item)->child)) - { - gtk_menu_reorder_child (GTK_MENU (menu_item->parent), - menu_item, pos); - list = g_list_nth (GTK_MENU_SHELL (menu)->children, pos); - pos++; - } - } - } - - for (i = 0; i < G_N_ELEMENTS (reorder_subsubmenus); i++) - { - menu = gtk_item_factory_get_widget (GTK_ITEM_FACTORY (factory), - reorder_subsubmenus[i]); - - if (menu && GTK_IS_MENU (menu)) - { - for (list = GTK_MENU_SHELL (menu)->children; - list; - list = g_list_next (list)) - { - GtkMenuItem *menu_item; - - menu_item = GTK_MENU_ITEM (list->data); - - if (menu_item->submenu) - menus_filters_subdirs_to_top (GTK_MENU (menu_item->submenu)); - } - } - } -} diff --git a/app/menus/toolbox-menu.h b/app/menus/toolbox-menu.h index 074d260649..c8e09a5838 100644 --- a/app/menus/toolbox-menu.h +++ b/app/menus/toolbox-menu.h @@ -20,15 +20,8 @@ #define __TOOLBOX_MENU_H__ -extern GimpItemFactoryEntry toolbox_menu_entries[]; -extern gint n_toolbox_menu_entries; - - -void toolbox_menu_setup2 (GimpUIManager *manager, - const gchar *ui_path); - -void toolbox_menu_setup (GimpItemFactory *factory, - gpointer callback_data); +void toolbox_menu_setup (GimpUIManager *manager, + const gchar *ui_path); #endif /* __TOOLBOX_MENU_H__ */ diff --git a/app/tools/gimpimagemaptool.c b/app/tools/gimpimagemaptool.c index 9bfb8a66a4..a56cdec89f 100644 --- a/app/tools/gimpimagemaptool.c +++ b/app/tools/gimpimagemaptool.c @@ -36,9 +36,9 @@ #include "core/gimpimagemap.h" #include "core/gimptoolinfo.h" -#include "widgets/gimpitemfactory.h" #include "widgets/gimppropwidgets.h" #include "widgets/gimptooldialog.h" +#include "widgets/gimpuimanager.h" #include "widgets/gimpviewabledialog.h" #include "display/gimpdisplay.h" @@ -294,8 +294,8 @@ gimp_image_map_tool_initialize (GimpTool *tool, { GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (gdisp->shell); - gimp_item_factory_update (shell->menubar_factory, shell); - gimp_item_factory_update (shell->popup_factory, shell); + gimp_ui_manager_update (shell->menubar_manager, shell); + gimp_ui_manager_update (shell->popup_manager, shell); } return TRUE; @@ -438,11 +438,11 @@ gimp_image_map_tool_response (GtkWidget *widget, gimp_tool_control_set_preserve (tool->control, FALSE); - gimp_item_factory_update (shell->menubar_factory, shell); + gimp_ui_manager_update (shell->menubar_manager, shell); if (shell->gdisp == gimp_context_get_display (gimp_get_user_context (shell->gdisp->gimage->gimp))) - gimp_item_factory_update (shell->popup_factory, shell); + gimp_ui_manager_update (shell->popup_manager, shell); tool->gdisp = NULL; tool->drawable = NULL; diff --git a/app/widgets/gimpactiongroup.c b/app/widgets/gimpactiongroup.c index 059aec9373..25c75eb26b 100644 --- a/app/widgets/gimpactiongroup.c +++ b/app/widgets/gimpactiongroup.c @@ -486,7 +486,7 @@ gimp_action_group_set_action_visible (GimpActionGroup *group, return; } - g_object_set (action, "visible", visible, NULL); + g_object_set (action, "visible", visible ? TRUE : FALSE, NULL); } void @@ -509,7 +509,7 @@ gimp_action_group_set_action_sensitive (GimpActionGroup *group, return; } - g_object_set (action, "sensitive", sensitive, NULL); + g_object_set (action, "sensitive", sensitive ? TRUE : FALSE, NULL); } void @@ -540,7 +540,8 @@ gimp_action_group_set_action_active (GimpActionGroup *group, return; } - gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), active); + gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), + active ? TRUE : FALSE); } void @@ -747,5 +748,5 @@ gimp_action_group_set_action_important (GimpActionGroup *group, return; } - g_object_set (action, "is-important", is_important, NULL); + g_object_set (action, "is-important", is_important ? TRUE : FALSE, NULL); } diff --git a/app/widgets/gimpcolormapeditor.c b/app/widgets/gimpcolormapeditor.c index 4e20d15d2b..94daaca1f3 100644 --- a/app/widgets/gimpcolormapeditor.c +++ b/app/widgets/gimpcolormapeditor.c @@ -54,7 +54,6 @@ #include "gimpdnd.h" #include "gimpdialogfactory.h" #include "gimphelp-ids.h" -#include "gimpitemfactory.h" #include "gimpmenufactory.h" #include "gimpuimanager.h" #include "gimpwidgets-utils.h" @@ -754,20 +753,14 @@ gimp_colormap_preview_button_press (GtkWidget *widget, case 3: gimp_colormap_editor_set_index (editor, col); -#if 0 + gimp_ui_manager_update (GIMP_EDITOR (editor)->ui_manager, GIMP_EDITOR (editor)->popup_data); gimp_ui_manager_ui_popup (GIMP_EDITOR (editor)->ui_manager, - GIMP_EDITOR (editor)->ui_identifier, + GIMP_EDITOR (editor)->ui_path, GIMP_EDITOR (editor)->ui_manager, GTK_WIDGET (editor), NULL, NULL, NULL); -#else - gimp_item_factory_popup_with_data (GIMP_EDITOR (editor)->item_factory, - GIMP_EDITOR (editor)->popup_data, - GTK_WIDGET (editor), - NULL, NULL, NULL); -#endif return TRUE; default: diff --git a/app/widgets/gimpcomponenteditor.c b/app/widgets/gimpcomponenteditor.c index e42588cb6e..e190eab539 100644 --- a/app/widgets/gimpcomponenteditor.c +++ b/app/widgets/gimpcomponenteditor.c @@ -33,7 +33,6 @@ #include "gimpcellrenderertoggle.h" #include "gimpcellrendererviewable.h" #include "gimpcomponenteditor.h" -#include "gimpitemfactory.h" #include "gimpmenufactory.h" #include "gimppreviewrendererimage.h" #include "gimpuimanager.h" @@ -521,20 +520,13 @@ gimp_component_editor_button_press (GtkWidget *widget, break; case 3: -#if 0 gimp_ui_manager_update (GIMP_EDITOR (editor)->ui_manager, GIMP_EDITOR (editor)->popup_data); gimp_ui_manager_ui_popup (GIMP_EDITOR (editor)->ui_manager, - GIMP_EDITOR (editor)->ui_identifier, + GIMP_EDITOR (editor)->ui_path, GIMP_EDITOR (editor)->popup_data, GTK_WIDGET (editor), NULL, NULL, NULL); -#else - gimp_item_factory_popup_with_data (GIMP_EDITOR (editor)->item_factory, - GIMP_EDITOR (editor)->popup_data, - GTK_WIDGET (editor), - NULL, NULL, NULL); -#endif break; default: diff --git a/app/widgets/gimpcontainereditor.c b/app/widgets/gimpcontainereditor.c index b71af0baac..232e50112d 100644 --- a/app/widgets/gimpcontainereditor.c +++ b/app/widgets/gimpcontainereditor.c @@ -35,7 +35,6 @@ #include "gimpcontainergridview.h" #include "gimpcontainertreeview.h" #include "gimpdocked.h" -#include "gimpitemfactory.h" #include "gimpmenufactory.h" #include "gimppreviewrenderer.h" #include "gimpuimanager.h" @@ -66,10 +65,9 @@ static GtkWidget * gimp_container_editor_get_preview (GimpDocked *docke static void gimp_container_editor_set_context (GimpDocked *docked, GimpContext *context, GimpContext *prev_context); -static GimpItemFactory * gimp_container_editor_get_menu (GimpDocked *docked, - gpointer *popup_data, - GimpUIManager **manager, - const gchar **ui_identifier); +static GimpUIManager * gimp_container_editor_get_menu (GimpDocked *docked, + const gchar **ui_path, + gpointer *popup_data); static GtkVBoxClass *parent_class = NULL; @@ -266,25 +264,17 @@ gimp_container_editor_real_context_item (GimpContainerEditor *editor, { GimpEditor *gimp_editor = GIMP_EDITOR (editor->view); -#if 0 if (gimp_editor->ui_manager) { gimp_ui_manager_update (gimp_editor->ui_manager, gimp_editor->popup_data); gimp_ui_manager_ui_popup (gimp_editor->ui_manager, - gimp_editor->ui_identifier, + gimp_editor->ui_path, gimp_editor->popup_data, GTK_WIDGET (editor), NULL, NULL, NULL); return; } -#else - if (gimp_editor->item_factory) - gimp_item_factory_popup_with_data (gimp_editor->item_factory, - gimp_editor->popup_data, - GTK_WIDGET (editor), - NULL, NULL, NULL); -#endif } } @@ -310,14 +300,12 @@ gimp_container_editor_set_context (GimpDocked *docked, context, prev_context); } -static GimpItemFactory * -gimp_container_editor_get_menu (GimpDocked *docked, - gpointer *popup_data, - GimpUIManager **manager, - const gchar **ui_identifier) +static GimpUIManager * +gimp_container_editor_get_menu (GimpDocked *docked, + const gchar **ui_path, + gpointer *popup_data) { GimpContainerEditor *editor = GIMP_CONTAINER_EDITOR (docked); - return gimp_docked_get_menu (GIMP_DOCKED (editor->view), popup_data, - manager, ui_identifier); + return gimp_docked_get_menu (GIMP_DOCKED (editor->view), ui_path, popup_data); } diff --git a/app/widgets/gimpcontainereditor.h b/app/widgets/gimpcontainereditor.h index f20e96366f..4b5934ff78 100644 --- a/app/widgets/gimpcontainereditor.h +++ b/app/widgets/gimpcontainereditor.h @@ -70,7 +70,7 @@ gboolean gimp_container_editor_construct (GimpContainerEditor *editor, gboolean reorderable, GimpMenuFactory *menu_factory, const gchar *menu_identifier, - const gchar *ui_identifier); + const gchar *ui_path); #endif /* __GIMP_CONTAINER_EDITOR_H__ */ diff --git a/app/widgets/gimpcontainergridview.c b/app/widgets/gimpcontainergridview.c index fbd3b720c2..82ae482c7b 100644 --- a/app/widgets/gimpcontainergridview.c +++ b/app/widgets/gimpcontainergridview.c @@ -34,7 +34,6 @@ #include "core/gimpviewable.h" #include "gimpcontainergridview.h" -#include "gimpitemfactory.h" #include "gimppreview.h" #include "gimppreviewrenderer.h" #include "gimpuimanager.h" @@ -377,34 +376,18 @@ gimp_container_grid_view_popup_menu (GtkWidget *widget) GimpContainerGridView *grid_view = GIMP_CONTAINER_GRID_VIEW (widget); GimpEditor *editor = GIMP_EDITOR (widget); - if (grid_view->selected_item) + if (grid_view->selected_item && editor->ui_manager) { -#if 0 - if (editor->ui_manager) - { - gimp_ui_manager_update (editor->ui_manager, - editor->popup_data); - gimp_ui_manager_ui_popup (editor->ui_manager, - editor->ui_identifier, - editor->popup_data, - GTK_WIDGET (editor), - gimp_container_grid_view_menu_position, - grid_view->selected_item, - NULL); - return TRUE; - } -#else - if (editor->item_factory) - { - gimp_item_factory_popup_with_data (editor->item_factory, - editor->popup_data, - GTK_WIDGET (editor), - gimp_container_grid_view_menu_position, - grid_view->selected_item, - NULL); - return TRUE; - } -#endif + gimp_ui_manager_update (editor->ui_manager, + editor->popup_data); + gimp_ui_manager_ui_popup (editor->ui_manager, + editor->ui_path, + editor->popup_data, + GTK_WIDGET (editor), + gimp_container_grid_view_menu_position, + grid_view->selected_item, + NULL); + return TRUE; } return FALSE; diff --git a/app/widgets/gimpcontainertreeview.c b/app/widgets/gimpcontainertreeview.c index 018af5496b..bf134d2fbf 100644 --- a/app/widgets/gimpcontainertreeview.c +++ b/app/widgets/gimpcontainertreeview.c @@ -38,7 +38,6 @@ #include "gimpcontainertreeview.h" #include "gimpcontainertreeview-dnd.h" #include "gimpdnd.h" -#include "gimpitemfactory.h" #include "gimppreviewrenderer.h" #include "gimpuimanager.h" #include "gimpwidgets-utils.h" @@ -354,34 +353,19 @@ gimp_container_tree_view_popup_menu (GtkWidget *widget) tree_view = GIMP_CONTAINER_TREE_VIEW (widget); editor = GIMP_EDITOR (widget); - if (gtk_tree_selection_get_selected (tree_view->selection, NULL, NULL)) + if (gtk_tree_selection_get_selected (tree_view->selection, NULL, NULL) && + editor->ui_manager) { -#if 0 - if (editor->ui_manager) - { - gimp_ui_manager_update (editor->ui_manager, - editor->popup_data); - gimp_ui_manager_ui_popup (editor->ui_manager, - editor->ui_identifier, - editor->popup_data, - GTK_WIDGET (editor), - gimp_container_tree_view_menu_position, - editor, - NULL); - return TRUE; - } -#endif - - if (editor->item_factory) - { - gimp_item_factory_popup_with_data (editor->item_factory, - editor->popup_data, - GTK_WIDGET (editor), - gimp_container_tree_view_menu_position, - editor, - NULL); - return TRUE; - } + gimp_ui_manager_update (editor->ui_manager, + editor->popup_data); + gimp_ui_manager_ui_popup (editor->ui_manager, + editor->ui_path, + editor->popup_data, + GTK_WIDGET (editor), + gimp_container_tree_view_menu_position, + editor, + NULL); + return TRUE; } return FALSE; diff --git a/app/widgets/gimpdockable.c b/app/widgets/gimpdockable.c index 18cc1d3359..92b6465ce7 100644 --- a/app/widgets/gimpdockable.c +++ b/app/widgets/gimpdockable.c @@ -802,20 +802,18 @@ gimp_dockable_set_context (GimpDockable *dockable, dockable->context = context; } -GimpItemFactory * -gimp_dockable_get_menu (GimpDockable *dockable, - gpointer *popup_data, - GimpUIManager **manager, - const gchar **ui_identifier) +GimpUIManager * +gimp_dockable_get_menu (GimpDockable *dockable, + const gchar **ui_path, + gpointer *popup_data) { g_return_val_if_fail (GIMP_IS_DOCKABLE (dockable), NULL); + g_return_val_if_fail (ui_path != NULL, NULL); g_return_val_if_fail (popup_data != NULL, NULL); - g_return_val_if_fail (manager != NULL, NULL); - g_return_val_if_fail (ui_identifier != NULL, NULL); if (GTK_BIN (dockable)->child) return gimp_docked_get_menu (GIMP_DOCKED (GTK_BIN (dockable)->child), - popup_data, manager, ui_identifier); + ui_path, popup_data); return NULL; } @@ -904,29 +902,22 @@ gimp_dockable_menu_position (GtkMenu *menu, static void gimp_dockable_menu_end (GimpDockable *dockable) { - GimpItemFactory *dialog_item_factory; - gpointer dialog_popup_data; GimpUIManager *dialog_ui_manager; - const gchar *dialog_ui_identifier; + const gchar *dialog_ui_path; + gpointer dialog_popup_data; - dialog_item_factory = gimp_dockable_get_menu (dockable, - &dialog_popup_data, - &dialog_ui_manager, - &dialog_ui_identifier); + dialog_ui_manager = gimp_dockable_get_menu (dockable, + &dialog_ui_path, + &dialog_popup_data); -#if 0 if (dialog_ui_manager) { GtkWidget *child_menu_widget; child_menu_widget = gimp_ui_manager_ui_get (dialog_ui_manager, - dialog_ui_identifier); + dialog_ui_path); gtk_menu_detach (GTK_MENU (child_menu_widget)); } -#else - if (dialog_item_factory) - gtk_menu_detach (GTK_MENU (GTK_ITEM_FACTORY (dialog_item_factory)->widget)); -#endif /* release gimp_dockable_show_menu()'s references */ g_object_set_data (G_OBJECT (dockable), GIMP_DOCKABLE_DETACH_REF_KEY, NULL); @@ -936,25 +927,20 @@ gimp_dockable_menu_end (GimpDockable *dockable) static gboolean gimp_dockable_show_menu (GimpDockable *dockable) { - GimpItemFactory *dockbook_item_factory; GimpUIManager *dockbook_ui_manager; - GimpItemFactory *dialog_item_factory; - gpointer dialog_popup_data; GimpUIManager *dialog_ui_manager; - const gchar *dialog_ui_identifier; + const gchar *dialog_ui_path; + gpointer dialog_popup_data; - dockbook_item_factory = dockable->dockbook->item_factory; - dockbook_ui_manager = dockable->dockbook->ui_manager; + dockbook_ui_manager = dockable->dockbook->ui_manager; - if (! dockbook_item_factory) + if (! dockbook_ui_manager) return FALSE; - dialog_item_factory = gimp_dockable_get_menu (dockable, - &dialog_popup_data, - &dialog_ui_manager, - &dialog_ui_identifier); + dialog_ui_manager = gimp_dockable_get_menu (dockable, + &dialog_ui_path, + &dialog_popup_data); -#if 0 if (dialog_ui_manager) { GtkAction *parent_menu_action; @@ -969,7 +955,7 @@ gimp_dockable_show_menu (GimpDockable *dockable) child_menu_action = gtk_ui_manager_get_action (GTK_UI_MANAGER (dialog_ui_manager), - dialog_ui_identifier); + dialog_ui_path); g_object_get (child_menu_action, "label", &label, @@ -986,8 +972,7 @@ gimp_dockable_show_menu (GimpDockable *dockable) "/dockable-popup/dockable-menu"); child_menu_widget = - gimp_ui_manager_ui_get (dialog_ui_manager, - dialog_ui_identifier); + gimp_ui_manager_ui_get (dialog_ui_manager, dialog_ui_path); if (! GTK_IS_MENU (child_menu_widget)) { @@ -996,6 +981,17 @@ gimp_dockable_show_menu (GimpDockable *dockable) return FALSE; } + /* FIXME */ + { + GtkWidget *image; + + image = gtk_image_new_from_stock (dockable->stock_id, + GTK_ICON_SIZE_MENU); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (parent_menu_widget), + image); + gtk_widget_show (image); + } + gtk_menu_item_set_submenu (GTK_MENU_ITEM (parent_menu_widget), child_menu_widget); @@ -1011,50 +1007,15 @@ gimp_dockable_show_menu (GimpDockable *dockable) g_object_set (parent_menu_action, "visible", FALSE, NULL); } -#else - if (dialog_item_factory) - { - GtkWidget *dialog_menu_widget; - GtkWidget *image; - gimp_item_factory_set_label (GTK_ITEM_FACTORY (dockbook_item_factory), - "/dialog-menu", - dialog_item_factory->title); - gimp_item_factory_set_visible (GTK_ITEM_FACTORY (dockbook_item_factory), - "/dialog-menu", TRUE); - - dialog_menu_widget = - gtk_item_factory_get_widget (GTK_ITEM_FACTORY (dockbook_item_factory), - "/dialog-menu"); - - image = gtk_image_new_from_stock (dockable->stock_id, - GTK_ICON_SIZE_MENU); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (dialog_menu_widget), - image); - gtk_widget_show (image); - - gtk_menu_item_set_submenu (GTK_MENU_ITEM (dialog_menu_widget), - GTK_ITEM_FACTORY (dialog_item_factory)->widget); - - gimp_ui_manager_update (dialog_ui_manager, dialog_popup_data); - gimp_item_factory_update (dialog_item_factory, dialog_popup_data); - } - else - { - gimp_item_factory_set_visible (GTK_ITEM_FACTORY (dockbook_item_factory), - "/dialog-menu", FALSE); - } -#endif - - /* an item factory callback may destroy both dockable and dockbook, - * so reference them for gimp_dockable_menu_end() + /* an action callback may destroy both dockable and dockbook, so + * reference them for gimp_dockable_menu_end() */ g_object_ref (dockable); g_object_set_data_full (G_OBJECT (dockable), GIMP_DOCKABLE_DETACH_REF_KEY, g_object_ref (dockable->dockbook), g_object_unref); -#if 0 gimp_ui_manager_update (dockbook_ui_manager, dockable); gimp_ui_manager_ui_popup (dockbook_ui_manager, "/dockable-popup", dockable, @@ -1062,15 +1023,6 @@ gimp_dockable_show_menu (GimpDockable *dockable) gimp_dockable_menu_position, dockable, (GtkDestroyNotify) gimp_dockable_menu_end); -#else - gimp_item_factory_popup_with_data (dockbook_item_factory, - dockable, - GTK_WIDGET (dockable), - gimp_dockable_menu_position, - dockable, - (GtkDestroyNotify) gimp_dockable_menu_end); -#endif - return TRUE; } diff --git a/app/widgets/gimpdockable.h b/app/widgets/gimpdockable.h index 8ffa9c9d14..6cd78d73b2 100644 --- a/app/widgets/gimpdockable.h +++ b/app/widgets/gimpdockable.h @@ -62,32 +62,28 @@ struct _GimpDockableClass }; -GType gimp_dockable_get_type (void) G_GNUC_CONST; +GType gimp_dockable_get_type (void) G_GNUC_CONST; -GtkWidget * gimp_dockable_new (const gchar *name, - const gchar *blurb, - const gchar *stock_id, - const gchar *help_id); +GtkWidget * gimp_dockable_new (const gchar *name, + const gchar *blurb, + const gchar *stock_id, + const gchar *help_id); -void gimp_dockable_set_aux_info (GimpDockable *dockable, - GList *aux_info); -GList * gimp_dockable_get_aux_info (GimpDockable *dockable); +void gimp_dockable_set_aux_info (GimpDockable *dockable, + GList *aux_info); +GList * gimp_dockable_get_aux_info (GimpDockable *dockable); -GtkWidget * gimp_dockable_get_tab_widget (GimpDockable *dockable, - GimpContext *context, - GimpTabStyle tab_style, - GtkIconSize size); -void gimp_dockable_set_context (GimpDockable *dockable, - GimpContext *context); -GimpItemFactory * gimp_dockable_get_menu (GimpDockable *dockable, - gpointer *popup_data, - GimpUIManager **manager, - const gchar **ui_identifier); -GimpUIManager * gimp_dockable_get_manager (GimpDockable *dockable, - gpointer *manager_data, - const gchar **ui_identifier); +GtkWidget * gimp_dockable_get_tab_widget (GimpDockable *dockable, + GimpContext *context, + GimpTabStyle tab_style, + GtkIconSize size); +void gimp_dockable_set_context (GimpDockable *dockable, + GimpContext *context); +GimpUIManager * gimp_dockable_get_menu (GimpDockable *dockable, + const gchar **ui_path, + gpointer *popup_data); -void gimp_dockable_detach (GimpDockable *dockable); +void gimp_dockable_detach (GimpDockable *dockable); #endif /* __GIMP_DOCKABLE_H__ */ diff --git a/app/widgets/gimpdocked.c b/app/widgets/gimpdocked.c index c96b27c96b..ce06bd9ee0 100644 --- a/app/widgets/gimpdocked.c +++ b/app/widgets/gimpdocked.c @@ -143,23 +143,21 @@ gimp_docked_get_preview (GimpDocked *docked, return NULL; } -GimpItemFactory * +GimpUIManager * gimp_docked_get_menu (GimpDocked *docked, - gpointer *popup_data, - GimpUIManager **manager, - const gchar **ui_identifier) + const gchar **ui_path, + gpointer *popup_data) { GimpDockedInterface *docked_iface; g_return_val_if_fail (GIMP_IS_DOCKED (docked), NULL); + g_return_val_if_fail (ui_path != NULL, NULL); g_return_val_if_fail (popup_data != NULL, NULL); - g_return_val_if_fail (manager != NULL, NULL); - g_return_val_if_fail (ui_identifier != NULL, NULL); docked_iface = GIMP_DOCKED_GET_INTERFACE (docked); if (docked_iface->get_menu) - return docked_iface->get_menu (docked, popup_data, manager, ui_identifier); + return docked_iface->get_menu (docked, ui_path, popup_data); return NULL; } diff --git a/app/widgets/gimpdocked.h b/app/widgets/gimpdocked.h index 0d1900aca2..8e83fa75f9 100644 --- a/app/widgets/gimpdocked.h +++ b/app/widgets/gimpdocked.h @@ -34,48 +34,46 @@ struct _GimpDockedInterface GTypeInterface base_iface; /* signals */ - void (* title_changed) (GimpDocked *docked); + void (* title_changed) (GimpDocked *docked); /* virtual functions */ - void (* set_aux_info) (GimpDocked *docked, - GList *aux_info); - GList * (* get_aux_info) (GimpDocked *docked); + void (* set_aux_info) (GimpDocked *docked, + GList *aux_info); + GList * (* get_aux_info) (GimpDocked *docked); - GtkWidget * (* get_preview) (GimpDocked *docked, - GimpContext *context, - GtkIconSize size); - GimpItemFactory * (* get_menu) (GimpDocked *docked, - gpointer *popup_data, - GimpUIManager **manager, - const gchar **ui_identifier); - gchar * (* get_title) (GimpDocked *docked); + GtkWidget * (* get_preview) (GimpDocked *docked, + GimpContext *context, + GtkIconSize size); + GimpUIManager * (* get_menu) (GimpDocked *docked, + const gchar **ui_path, + gpointer *popup_data); + gchar * (* get_title) (GimpDocked *docked); - void (* set_context) (GimpDocked *docked, + void (* set_context) (GimpDocked *docked, GimpContext *context, GimpContext *prev_context); }; -GType gimp_docked_interface_get_type (void) G_GNUC_CONST; +GType gimp_docked_interface_get_type (void) G_GNUC_CONST; -void gimp_docked_title_changed (GimpDocked *docked); +void gimp_docked_title_changed (GimpDocked *docked); -void gimp_docked_set_aux_info (GimpDocked *docked, - GList *aux_info); -GList * gimp_docked_get_aux_info (GimpDocked *docked); +void gimp_docked_set_aux_info (GimpDocked *docked, + GList *aux_info); +GList * gimp_docked_get_aux_info (GimpDocked *docked); -GtkWidget * gimp_docked_get_preview (GimpDocked *docked, - GimpContext *context, - GtkIconSize size); -GimpItemFactory * gimp_docked_get_menu (GimpDocked *docked, - gpointer *popup_data, - GimpUIManager **manager, - const gchar **ui_idenfier); -gchar * gimp_docked_get_title (GimpDocked *docked); +GtkWidget * gimp_docked_get_preview (GimpDocked *docked, + GimpContext *context, + GtkIconSize size); +GimpUIManager * gimp_docked_get_menu (GimpDocked *docked, + const gchar **ui_path, + gpointer *popup_data); +gchar * gimp_docked_get_title (GimpDocked *docked); -void gimp_docked_set_context (GimpDocked *docked, - GimpContext *context, - GimpContext *prev_context); +void gimp_docked_set_context (GimpDocked *docked, + GimpContext *context, + GimpContext *prev_context); #endif /* __GIMP_DOCKED_H__ */ diff --git a/app/widgets/gimpeditor.c b/app/widgets/gimpeditor.c index ae02b3c12d..4501c48836 100644 --- a/app/widgets/gimpeditor.c +++ b/app/widgets/gimpeditor.c @@ -47,10 +47,9 @@ static void gimp_editor_destroy (GtkObject *object); static void gimp_editor_style_set (GtkWidget *widget, GtkStyle *prev_style); -static GimpItemFactory * gimp_editor_get_menu (GimpDocked *docked, - gpointer *popup_data, - GimpUIManager **manager, - const gchar **ui_identifier); +static GimpUIManager * gimp_editor_get_menu (GimpDocked *docked, + const gchar **ui_path, + gpointer *popup_data); static GtkIconSize gimp_editor_ensure_button_box (GimpEditor *editor); @@ -137,12 +136,11 @@ gimp_editor_class_init (GimpEditorClass *klass) static void gimp_editor_init (GimpEditor *editor) { - editor->menu_factory = NULL; - editor->item_factory = NULL; - editor->ui_manager = NULL; - editor->ui_identifier = NULL; - editor->popup_data = NULL; - editor->button_box = NULL; + editor->menu_factory = NULL; + editor->ui_manager = NULL; + editor->ui_path = NULL; + editor->popup_data = NULL; + editor->button_box = NULL; } static void @@ -156,22 +154,16 @@ gimp_editor_destroy (GtkObject *object) { GimpEditor *editor = GIMP_EDITOR (object); - if (editor->item_factory) - { - g_object_unref (editor->item_factory); - editor->item_factory = NULL; - } - if (editor->ui_manager) { g_object_unref (editor->ui_manager); editor->ui_manager = NULL; } - if (editor->ui_identifier) + if (editor->ui_path) { - g_free (editor->ui_identifier); - editor->ui_identifier = NULL; + g_free (editor->ui_path); + editor->ui_path = NULL; } GTK_OBJECT_CLASS (parent_class)->destroy (object); @@ -195,19 +187,17 @@ gimp_editor_style_set (GtkWidget *widget, gimp_editor_set_box_style (editor, GTK_BOX (editor->button_box)); } -static GimpItemFactory * -gimp_editor_get_menu (GimpDocked *docked, - gpointer *popup_data, - GimpUIManager **ui_manager, - const gchar **ui_identifier) +static GimpUIManager * +gimp_editor_get_menu (GimpDocked *docked, + const gchar **ui_path, + gpointer *popup_data) { GimpEditor *editor = GIMP_EDITOR (docked); - *ui_manager = editor->ui_manager; - *ui_identifier = editor->ui_identifier; - *popup_data = editor->popup_data; + *ui_path = editor->ui_path; + *popup_data = editor->popup_data; - return editor->item_factory; + return editor->ui_manager; } GtkWidget * @@ -224,23 +214,16 @@ void gimp_editor_create_menu (GimpEditor *editor, GimpMenuFactory *menu_factory, const gchar *menu_identifier, - const gchar *ui_identifier, + const gchar *ui_path, gpointer callback_data) { g_return_if_fail (GIMP_IS_EDITOR (editor)); g_return_if_fail (GIMP_IS_MENU_FACTORY (menu_factory)); g_return_if_fail (menu_identifier != NULL); - g_return_if_fail (ui_identifier != NULL); - - if (editor->item_factory) - g_object_unref (editor->item_factory); + g_return_if_fail (ui_path != NULL); editor->menu_factory = menu_factory; - editor->item_factory = gimp_menu_factory_menu_new (menu_factory, - menu_identifier, - GTK_TYPE_MENU, - callback_data, - FALSE); + if (editor->ui_manager) g_object_unref (editor->ui_manager); @@ -249,10 +232,10 @@ gimp_editor_create_menu (GimpEditor *editor, callback_data, FALSE); - if (editor->ui_identifier) - g_free (editor->ui_identifier); + if (editor->ui_path) + g_free (editor->ui_path); - editor->ui_identifier = g_strdup (ui_identifier); + editor->ui_path = g_strdup (ui_path); editor->popup_data = callback_data; } diff --git a/app/widgets/gimpeditor.h b/app/widgets/gimpeditor.h index 558649b56e..08a4761e2d 100644 --- a/app/widgets/gimpeditor.h +++ b/app/widgets/gimpeditor.h @@ -41,9 +41,8 @@ struct _GimpEditor GtkVBox parent_instance; GimpMenuFactory *menu_factory; - GimpItemFactory *item_factory; GimpUIManager *ui_manager; - gchar *ui_identifier; + gchar *ui_path; gpointer popup_data; GtkWidget *button_box; @@ -62,7 +61,7 @@ GtkWidget * gimp_editor_new (void); void gimp_editor_create_menu (GimpEditor *editor, GimpMenuFactory *menu_factory, const gchar *menu_identifier, - const gchar *ui_identifier, + const gchar *ui_path, gpointer callback_data); GtkWidget * gimp_editor_add_button (GimpEditor *editor, diff --git a/app/widgets/gimperrorconsole.c b/app/widgets/gimperrorconsole.c index aa478abeeb..bc67ff86d6 100644 --- a/app/widgets/gimperrorconsole.c +++ b/app/widgets/gimperrorconsole.c @@ -58,7 +58,6 @@ #include "gimperrorconsole.h" #include "gimphelp-ids.h" -#include "gimpitemfactory.h" #include "gimpmenufactory.h" #include "gimpuimanager.h" #include "gimpwidgets-utils.h" @@ -305,20 +304,14 @@ gimp_error_console_button_press (GtkWidget *widget, { GimpEditor *editor = GIMP_EDITOR (console); -#if 0 gimp_ui_manager_update (editor->ui_manager, editor->popup_data); gimp_ui_manager_ui_popup (editor->ui_manager, - editor->ui_identifier, + editor->ui_path, editor->popup_data, GTK_WIDGET (editor), NULL, NULL, NULL); -#else - gimp_item_factory_popup_with_data (editor->item_factory, - editor->popup_data, - GTK_WIDGET (editor), - NULL, NULL, NULL); -#endif + return TRUE; } diff --git a/app/widgets/gimpgradienteditor.c b/app/widgets/gimpgradienteditor.c index bbd0cac9db..55444cb6db 100644 --- a/app/widgets/gimpgradienteditor.c +++ b/app/widgets/gimpgradienteditor.c @@ -69,7 +69,6 @@ #include "gimpdnd.h" #include "gimpgradienteditor.h" #include "gimphelp-ids.h" -#include "gimpitemfactory.h" #include "gimppreview.h" #include "gimppreviewrenderergradient.h" #include "gimpuimanager.h" @@ -712,20 +711,13 @@ preview_events (GtkWidget *widget, { GimpEditor *gimp_editor = GIMP_EDITOR (editor); -#if 0 gimp_ui_manager_update (gimp_editor->ui_manager, gimp_editor->popup_data); - gimp_ui_manager_ui_pupup (gimp_editor->ui_manager, - gimp_editor->ui_identifier, + gimp_ui_manager_ui_popup (gimp_editor->ui_manager, + gimp_editor->ui_path, gimp_editor->popup_data, GTK_WIDGET (editor), NULL, NULL, NULL); -#else - gimp_item_factory_popup_with_data (gimp_editor->item_factory, - gimp_editor->popup_data, - GTK_WIDGET (editor), - NULL, NULL, NULL); -#endif } break; @@ -1162,20 +1154,13 @@ control_button_press (GimpGradientEditor *editor, { GimpEditor *gimp_editor = GIMP_EDITOR (editor); -#if 0 gimp_ui_manager_update (gimp_editor->ui_manager, gimp_editor->popup_data); - gimp_ui_manager_ui_pupup (gimp_editor->ui_manager, - gimp_editor->ui_identifier, + gimp_ui_manager_ui_popup (gimp_editor->ui_manager, + gimp_editor->ui_path, gimp_editor->popup_data, GTK_WIDGET (editor), NULL, NULL, NULL); -#else - gimp_item_factory_popup_with_data (gimp_editor->item_factory, - gimp_editor->popup_data, - GTK_WIDGET (editor), - NULL, NULL, NULL); -#endif return; } diff --git a/app/widgets/gimpitemtreeview.c b/app/widgets/gimpitemtreeview.c index da85661597..cb1469c478 100644 --- a/app/widgets/gimpitemtreeview.c +++ b/app/widgets/gimpitemtreeview.c @@ -885,33 +885,23 @@ gimp_item_tree_view_context_item (GimpContainerView *view, GimpViewable *item, gpointer insert_data) { - GimpEditor *editor; + GimpEditor *editor = GIMP_EDITOR (view); if (GIMP_CONTAINER_VIEW_CLASS (parent_class)->context_item) GIMP_CONTAINER_VIEW_CLASS (parent_class)->context_item (view, item, insert_data); - editor = GIMP_EDITOR (view); - -#if 0 if (editor->ui_manager) { gimp_ui_manager_update (editor->ui_manager, editor->popup_data); gimp_ui_manager_ui_popup (editor->ui_manager, - editor->ui_identifier, + editor->ui_path, editor->popup_data, GTK_WIDGET (editor), NULL, NULL, NULL); } -#else - if (editor->item_factory) - gimp_item_factory_popup_with_data (editor->item_factory, - editor->popup_data, - GTK_WIDGET (editor), - NULL, NULL, NULL); -#endif } static gboolean diff --git a/app/widgets/gimpmenufactory.c b/app/widgets/gimpmenufactory.c index 45552b325e..a255835bb3 100644 --- a/app/widgets/gimpmenufactory.c +++ b/app/widgets/gimpmenufactory.c @@ -163,8 +163,7 @@ gimp_menu_factory_menu_register (GimpMenuFactory *factory, g_return_if_fail (identifier != NULL); g_return_if_fail (title != NULL); g_return_if_fail (help_id != NULL); - g_return_if_fail (n_entries > 0); - g_return_if_fail (entries != NULL); + g_return_if_fail (entries == NULL || n_entries > 0); entry = g_new0 (GimpMenuFactoryEntry, 1); diff --git a/app/widgets/gimppaletteeditor.c b/app/widgets/gimppaletteeditor.c index 464d95d8eb..34bde8328b 100644 --- a/app/widgets/gimppaletteeditor.c +++ b/app/widgets/gimppaletteeditor.c @@ -43,7 +43,6 @@ #include "gimpdnd.h" #include "gimpdocked.h" #include "gimphelp-ids.h" -#include "gimpitemfactory.h" #include "gimppaletteeditor.h" #include "gimppreview.h" #include "gimpsessioninfo.h" @@ -586,20 +585,13 @@ palette_editor_eventbox_button_press (GtkWidget *widget, { GimpEditor *gimp_editor = GIMP_EDITOR (editor); -#if 0 gimp_ui_manager_update (gimp_editor->ui_manager, gimp_editor->popup_data); gimp_ui_manager_ui_popup (gimp_editor->ui_manager, - gimp_editor->ui_identifier, + gimp_editor->ui_path, gimp_editor->popup_data, GTK_WIDGET (editor), NULL, NULL, NULL); -#else - gimp_item_factory_popup_with_data (gimp_editor->item_factory, - gimp_editor->popup_data, - GTK_WIDGET (editor), - NULL, NULL, NULL); -#endif } return TRUE; @@ -610,7 +602,7 @@ palette_editor_color_area_button_press (GtkWidget *widget, GdkEventButton *bevent, GimpPaletteEditor *editor) { - GimpDataEditor *data_editor; + GimpDataEditor *data_editor = GIMP_DATA_EDITOR (editor); GimpPalette *palette; GimpContext *user_context; GList *list; @@ -619,8 +611,6 @@ palette_editor_color_area_button_press (GtkWidget *widget, gint row, col; gint pos; - data_editor = GIMP_DATA_EDITOR (editor); - palette = GIMP_PALETTE (data_editor->data); user_context = gimp_get_user_context (data_editor->data_factory->gimp); diff --git a/app/widgets/gimptoolbox.c b/app/widgets/gimptoolbox.c index f13cd8d6b8..b5539c04e7 100644 --- a/app/widgets/gimptoolbox.c +++ b/app/widgets/gimptoolbox.c @@ -37,11 +37,11 @@ #include "gimpdevices.h" #include "gimpdialogfactory.h" #include "gimphelp-ids.h" -#include "gimpitemfactory.h" #include "gimptoolbox.h" #include "gimptoolbox-color-area.h" #include "gimptoolbox-dnd.h" #include "gimptoolbox-indicator-area.h" +#include "gimpuimanager.h" #include "gimpwidgets-utils.h" #include "gtkhwrapbox.h" @@ -165,9 +165,9 @@ gimp_toolbox_class_init (GimpToolboxClass *klass) static void gimp_toolbox_init (GimpToolbox *toolbox) { - GimpItemFactory *toolbox_factory; - GtkWidget *main_vbox; - GtkWidget *vbox; + GimpUIManager *manager; + GtkWidget *main_vbox; + GtkWidget *vbox; gtk_window_set_role (GTK_WINDOW (toolbox), "gimp-toolbox"); @@ -178,14 +178,14 @@ gimp_toolbox_init (GimpToolbox *toolbox) gtk_box_reorder_child (GTK_BOX (main_vbox), vbox, 0); gtk_widget_show (vbox); - toolbox_factory = gimp_item_factory_from_path (""); + manager = gimp_ui_managers_from_name ("")->data; - toolbox->menu_bar = GTK_ITEM_FACTORY (toolbox_factory)->widget; + toolbox->menu_bar = gimp_ui_manager_ui_get (manager, "/toolbox-menubar"); gtk_box_pack_start (GTK_BOX (vbox), toolbox->menu_bar, FALSE, FALSE, 0); gtk_widget_show (toolbox->menu_bar); gtk_window_add_accel_group (GTK_WINDOW (toolbox), - GTK_ITEM_FACTORY (toolbox_factory)->accel_group); + gtk_ui_manager_get_accel_group (GTK_UI_MANAGER (manager))); toolbox->wbox = gtk_hwrap_box_new (FALSE); gtk_wrap_box_set_justify (GTK_WRAP_BOX (toolbox->wbox), GTK_JUSTIFY_TOP); @@ -607,12 +607,17 @@ static void toolbox_create_tools (GimpToolbox *toolbox, GimpContext *context) { +#if 0 + FIXME GimpItemFactory *item_factory; +#endif GimpToolInfo *active_tool; GList *list; GSList *group = NULL; +#if 0 item_factory = gimp_item_factory_from_path (""); +#endif active_tool = gimp_context_get_tool (context); @@ -661,6 +666,7 @@ toolbox_create_tools (GimpToolbox *toolbox, G_CALLBACK (toolbox_tool_button_press), toolbox); +#if 0 if (item_factory) { GtkWidget *menu_item; @@ -709,6 +715,7 @@ toolbox_create_tools (GimpToolbox *toolbox, g_list_free (accel_closures); } } +#endif } } diff --git a/app/widgets/gimptooloptionseditor.c b/app/widgets/gimptooloptionseditor.c index 2226271332..9a6c88ac75 100644 --- a/app/widgets/gimptooloptionseditor.c +++ b/app/widgets/gimptooloptionseditor.c @@ -36,7 +36,6 @@ #include "gimpdnd.h" #include "gimpdocked.h" #include "gimphelp-ids.h" -#include "gimpitemfactory.h" #include "gimpmenufactory.h" #include "gimppreview.h" #include "gimppreviewrenderer.h" @@ -321,18 +320,17 @@ gimp_tool_options_editor_menu_popup (GimpToolOptionsEditor *editor, GimpEditor *gimp_editor = GIMP_EDITOR (editor); GtkWidget *menu; -#if 0 gimp_ui_manager_update (gimp_editor->ui_manager, gimp_editor->popup_data); gimp_ui_manager_ui_popup (gimp_editor->ui_manager, - gimp_editor->ui_identifier, + gimp_editor->ui_path, gimp_editor->popup_data, GTK_WIDGET (button), - foo, foo, foo); -#else + NULL, NULL, NULL); + +#if 0 gimp_item_factory_update (gimp_editor->item_factory, gimp_editor->popup_data); -#endif menu = gtk_item_factory_get_widget (GTK_ITEM_FACTORY (gimp_editor->item_factory), @@ -342,6 +340,7 @@ gimp_tool_options_editor_menu_popup (GimpToolOptionsEditor *editor, gtk_menu_popup (GTK_MENU (menu), NULL, NULL, gimp_tool_options_editor_menu_pos, button, 0, GDK_CURRENT_TIME); +#endif } static void @@ -354,6 +353,7 @@ gimp_tool_options_editor_save_clicked (GtkWidget *widget, } else { +#if 0 GtkItemFactory *item_factory; GtkWidget *item; @@ -364,6 +364,7 @@ gimp_tool_options_editor_save_clicked (GtkWidget *widget, if (item) gtk_widget_activate (item); +#endif } } diff --git a/app/widgets/gimpuimanager.c b/app/widgets/gimpuimanager.c index 875dc43098..f0f956d457 100644 --- a/app/widgets/gimpuimanager.c +++ b/app/widgets/gimpuimanager.c @@ -314,13 +314,35 @@ gimp_ui_manager_update (GimpUIManager *manager, g_return_if_fail (GIMP_IS_UI_MANAGER (manager)); for (list = gtk_ui_manager_get_action_groups (GTK_UI_MANAGER (manager)); - list; - list = g_list_next (list)) + list; + list = g_list_next (list)) { gimp_action_group_update (list->data, update_data); } } +GimpActionGroup * +gimp_ui_manager_get_action_group (GimpUIManager *manager, + const gchar *name) +{ + GList *list; + + g_return_val_if_fail (GIMP_IS_UI_MANAGER (manager), NULL); + g_return_val_if_fail (name != NULL, NULL); + + for (list = gtk_ui_manager_get_action_groups (GTK_UI_MANAGER (manager)); + list; + list = g_list_next (list)) + { + GimpActionGroup *group = list->data; + + if (! strcmp (gtk_action_group_get_name (GTK_ACTION_GROUP (group)), name)) + return group; + } + + return NULL; +} + void gimp_ui_manager_ui_register (GimpUIManager *manager, const gchar *ui_path, diff --git a/app/widgets/gimpuimanager.h b/app/widgets/gimpuimanager.h index aa71d408d5..a0cc4be315 100644 --- a/app/widgets/gimpuimanager.h +++ b/app/widgets/gimpuimanager.h @@ -72,6 +72,8 @@ GList * gimp_ui_managers_from_name (const gchar *name); void gimp_ui_manager_update (GimpUIManager *manager, gpointer update_data); +GimpActionGroup * gimp_ui_manager_get_action_group (GimpUIManager *manager, + const gchar *name); void gimp_ui_manager_ui_register (GimpUIManager *manager, const gchar *ui_path, diff --git a/menus/gradient-editor-menu.xml b/menus/gradient-editor-menu.xml index 9ff54c50bc..b5db855498 100644 --- a/menus/gradient-editor-menu.xml +++ b/menus/gradient-editor-menu.xml @@ -2,7 +2,7 @@ - + @@ -53,19 +53,19 @@ - - - - - - - - - - + + + + + + + + + + - + @@ -73,7 +73,7 @@ - + diff --git a/menus/image-menu.xml b/menus/image-menu.xml index a7c6675a91..87f0094d60 100644 --- a/menus/image-menu.xml +++ b/menus/image-menu.xml @@ -2,6 +2,9 @@ + + + @@ -316,7 +319,7 @@ - + @@ -354,4 +357,359 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/menus/toolbox-menu.xml b/menus/toolbox-menu.xml index 70c8648b85..f12a74d9bf 100644 --- a/menus/toolbox-menu.xml +++ b/menus/toolbox-menu.xml @@ -57,7 +57,9 @@ - + + +