mirror of https://github.com/GNOME/gimp.git
The unbelievable happened: a menu bar per display (optionally)
2002-12-10 Michael Natterer <mitch@gimp.org> The unbelievable happened: a menu bar per display (optionally) * app/widgets/gimpitemfactory.[ch]: Added the possibility to have more than one item factory per <Prefix>. Added gimp_item_factories_set_foobar() variants of all functions which set menu item properties (label, sensitive, ...). Removed the #ifndef ENABLE_NLS code since that's no longer possible. * app/widgets/gimptoolbox.c: made it robust againt the <Image> factory not existing at the time of toolbox creation. * app/config/gimpconfig-blurbs.h * app/config/gimpdisplayconfig.[ch]: added boolean "menu_bar_per_display" property. * app/gui/preferences-dialog.c: added a toggle for the new option. * app/gui/menus.[ch]: added menus_get_new_image_factory() as temporary solution. Will add a GimpMenuFactory which creates the item factories soon. * app/display/gimpdisplayshell.c: add the menu bar if requested. Changed widget packing slightly for the menu bar case. * app/display/gimpdisplayshell-callbacks.c: changed accordingly. Currently there is no right-click popup menu when we have a menu bar. This will change soon. * app/gui/file-dialog-utils.c * app/gui/gui.c: use gimp_item_factories_set_foo(). * app/gui/channels-commands.c * app/gui/dialogs-commands.c * app/gui/dialogs-constructors.c * app/gui/drawable-commands.c * app/gui/edit-commands.c * app/gui/file-commands.c * app/gui/image-commands.c * app/gui/layers-commands.c * app/gui/plug-in-commands.c * app/gui/select-commands.c * app/gui/tools-commands.c * app/gui/vectors-commands.c * app/gui/view-commands.c: per-display item factories pass the GimpDisplay as user_data to callbacks, not a Gimp. Changed all return_if_no_foo() macros to handle both cases. Cleaned up the plug-in menu stuff: * app/plug-in/plug-in-types.h: removed PlugInMenuEntry type. * app/plug-in/plug-ins.[ch]: added plug_ins_proc_def_add() as counterpart to plug_ins_proc_def_remove(). Added plug_ins_locale_domain() as counterpart to plug_ins_help_path(). Remember the locale domains just as the help paths. Changed plug-in initialization so that their menus can be created multiple times. * app/plug-in/plug-in.[ch]: use plug_ins_proc_def_add() instead of doing it manually. * app/gui/plug-in-menus.[ch]: added plug_in_menus_init() which just registers the locale domains. Changed plug_in_make_menu() to take a list of proc_defs, not plug_ins_defs so it can be used after plug-in query.
This commit is contained in:
parent
cd858c5a6a
commit
b1ebd9cddf
70
ChangeLog
70
ChangeLog
|
@ -1,3 +1,71 @@
|
|||
2002-12-10 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
The unbelievable happened: a menu bar per display (optionally)
|
||||
|
||||
* app/widgets/gimpitemfactory.[ch]: Added the possibility to have
|
||||
more than one item factory per <Prefix>. Added
|
||||
gimp_item_factories_set_foobar() variants of all functions which
|
||||
set menu item properties (label, sensitive, ...). Removed
|
||||
the #ifndef ENABLE_NLS code since that's no longer possible.
|
||||
|
||||
* app/widgets/gimptoolbox.c: made it robust againt the <Image>
|
||||
factory not existing at the time of toolbox creation.
|
||||
|
||||
* app/config/gimpconfig-blurbs.h
|
||||
* app/config/gimpdisplayconfig.[ch]: added boolean
|
||||
"menu_bar_per_display" property.
|
||||
|
||||
* app/gui/preferences-dialog.c: added a toggle for the new option.
|
||||
|
||||
* app/gui/menus.[ch]: added menus_get_new_image_factory() as
|
||||
temporary solution. Will add a GimpMenuFactory which creates the
|
||||
item factories soon.
|
||||
|
||||
* app/display/gimpdisplayshell.c: add the menu bar if requested.
|
||||
Changed widget packing slightly for the menu bar case.
|
||||
|
||||
* app/display/gimpdisplayshell-callbacks.c: changed accordingly.
|
||||
Currently there is no right-click popup menu when we have a menu
|
||||
bar. This will change soon.
|
||||
|
||||
* app/gui/file-dialog-utils.c
|
||||
* app/gui/gui.c: use gimp_item_factories_set_foo().
|
||||
|
||||
* app/gui/channels-commands.c
|
||||
* app/gui/dialogs-commands.c
|
||||
* app/gui/dialogs-constructors.c
|
||||
* app/gui/drawable-commands.c
|
||||
* app/gui/edit-commands.c
|
||||
* app/gui/file-commands.c
|
||||
* app/gui/image-commands.c
|
||||
* app/gui/layers-commands.c
|
||||
* app/gui/plug-in-commands.c
|
||||
* app/gui/select-commands.c
|
||||
* app/gui/tools-commands.c
|
||||
* app/gui/vectors-commands.c
|
||||
* app/gui/view-commands.c: per-display item factories pass the
|
||||
GimpDisplay as user_data to callbacks, not a Gimp. Changed all
|
||||
return_if_no_foo() macros to handle both cases.
|
||||
|
||||
Cleaned up the plug-in menu stuff:
|
||||
|
||||
* app/plug-in/plug-in-types.h: removed PlugInMenuEntry type.
|
||||
|
||||
* app/plug-in/plug-ins.[ch]: added plug_ins_proc_def_add() as
|
||||
counterpart to plug_ins_proc_def_remove(). Added
|
||||
plug_ins_locale_domain() as counterpart to plug_ins_help_path().
|
||||
Remember the locale domains just as the help paths. Changed
|
||||
plug-in initialization so that their menus can be created multiple
|
||||
times.
|
||||
|
||||
* app/plug-in/plug-in.[ch]: use plug_ins_proc_def_add() instead of
|
||||
doing it manually.
|
||||
|
||||
* app/gui/plug-in-menus.[ch]: added plug_in_menus_init() which
|
||||
just registers the locale domains. Changed plug_in_make_menu() to
|
||||
take a list of proc_defs, not plug_ins_defs so it can be used
|
||||
after plug-in query.
|
||||
|
||||
2002-12-10 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/app_procs.c: fixed typo, use "gimp->no_interface" instead of
|
||||
|
@ -41,7 +109,7 @@
|
|||
Added gimp_boolean_handled_accumulator() so the emission of "exit"
|
||||
can be stopped by returning TRUE from a callback. Removed
|
||||
gimp_shutdown() from the public API and made it "exit"'s default
|
||||
implementation. Addec gimp_exit() to emit the signal.
|
||||
implementation. Added gimp_exit() to emit the signal.
|
||||
|
||||
* app/core/gimpmarshal.list: added BOOLEAN__BOOLEAN marshaller.
|
||||
|
||||
|
|
|
@ -40,6 +40,8 @@
|
|||
#include "widgets/gimpviewabledialog.h"
|
||||
#include "widgets/gimpwidgets-utils.h"
|
||||
|
||||
#include "display/gimpdisplay.h"
|
||||
|
||||
#include "channels-commands.h"
|
||||
|
||||
#include "undo.h"
|
||||
|
@ -55,15 +57,19 @@ static void channels_color_changed (GimpColorButton *button,
|
|||
gpointer data);
|
||||
|
||||
|
||||
#define return_if_no_image(gimage) \
|
||||
#define return_if_no_image(gimage,data) \
|
||||
gimage = (GimpImage *) gimp_widget_get_callback_context (widget); \
|
||||
if (! GIMP_IS_IMAGE (gimage)) \
|
||||
gimage = gimp_context_get_image (gimp_get_user_context (GIMP (data))); \
|
||||
if (! GIMP_IS_IMAGE (gimage)) { \
|
||||
if (GIMP_IS_DISPLAY (data)) \
|
||||
gimage = ((GimpDisplay *) data)->gimage; \
|
||||
else if (GIMP_IS_GIMP (data)) \
|
||||
gimage = gimp_context_get_image (gimp_get_user_context (GIMP (data))); \
|
||||
} \
|
||||
if (! gimage) \
|
||||
return
|
||||
|
||||
#define return_if_no_channel(gimage,channel) \
|
||||
return_if_no_image (gimage); \
|
||||
#define return_if_no_channel(gimage,channel,data) \
|
||||
return_if_no_image (gimage,data); \
|
||||
channel = gimp_image_get_active_channel (gimage); \
|
||||
if (! channel) \
|
||||
return
|
||||
|
@ -76,7 +82,7 @@ channels_new_channel_cmd_callback (GtkWidget *widget,
|
|||
gpointer data)
|
||||
{
|
||||
GimpImage *gimage;
|
||||
return_if_no_image (gimage);
|
||||
return_if_no_image (gimage, data);
|
||||
|
||||
channels_new_channel_query (gimage, NULL, TRUE);
|
||||
}
|
||||
|
@ -87,7 +93,7 @@ channels_raise_channel_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GimpImage *gimage;
|
||||
GimpChannel *active_channel;
|
||||
return_if_no_channel (gimage, active_channel);
|
||||
return_if_no_channel (gimage, active_channel, data);
|
||||
|
||||
gimp_image_raise_channel (gimage, active_channel);
|
||||
gimp_image_flush (gimage);
|
||||
|
@ -99,7 +105,7 @@ channels_lower_channel_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GimpImage *gimage;
|
||||
GimpChannel *active_channel;
|
||||
return_if_no_channel (gimage, active_channel);
|
||||
return_if_no_channel (gimage, active_channel, data);
|
||||
|
||||
gimp_image_lower_channel (gimage, active_channel);
|
||||
gimp_image_flush (gimage);
|
||||
|
@ -112,7 +118,7 @@ channels_duplicate_channel_cmd_callback (GtkWidget *widget,
|
|||
GimpImage *gimage;
|
||||
GimpChannel *active_channel;
|
||||
GimpChannel *new_channel;
|
||||
return_if_no_channel (gimage, active_channel);
|
||||
return_if_no_channel (gimage, active_channel, data);
|
||||
|
||||
new_channel = gimp_channel_copy (active_channel,
|
||||
G_TYPE_FROM_INSTANCE (active_channel),
|
||||
|
@ -127,7 +133,7 @@ channels_delete_channel_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GimpImage *gimage;
|
||||
GimpChannel *active_channel;
|
||||
return_if_no_channel (gimage, active_channel);
|
||||
return_if_no_channel (gimage, active_channel, data);
|
||||
|
||||
gimp_image_remove_channel (gimage, active_channel);
|
||||
gimp_image_flush (gimage);
|
||||
|
@ -140,7 +146,7 @@ channels_channel_to_sel (GtkWidget *widget,
|
|||
{
|
||||
GimpImage *gimage;
|
||||
GimpChannel *active_channel;
|
||||
return_if_no_channel (gimage, active_channel);
|
||||
return_if_no_channel (gimage, active_channel, data);
|
||||
|
||||
gimp_image_mask_select_channel (gimage,
|
||||
active_channel,
|
||||
|
@ -184,7 +190,7 @@ channels_edit_channel_attributes_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GimpImage *gimage;
|
||||
GimpChannel *active_channel;
|
||||
return_if_no_channel (gimage, active_channel);
|
||||
return_if_no_channel (gimage, active_channel, data);
|
||||
|
||||
channels_edit_channel_query (active_channel);
|
||||
}
|
||||
|
|
|
@ -201,7 +201,7 @@ dialogs_toggle_view_cmd_callback (GtkWidget *widget,
|
|||
identifier,
|
||||
preview_size);
|
||||
|
||||
/* Maybe gimp_dialog_factory_dockable_new() returned
|
||||
/* Maybe gimp_dialog_factory_dockable_new() returned
|
||||
* an already existing singleton dockable, so check
|
||||
* if it already is attached to a dockbook.
|
||||
*/
|
||||
|
@ -255,9 +255,7 @@ dialogs_preview_size_cmd_callback (GtkWidget *widget,
|
|||
view = gimp_container_view_get_by_dockable (dockable);
|
||||
|
||||
if (view)
|
||||
{
|
||||
gimp_container_view_set_preview_size (view, preview_size);
|
||||
}
|
||||
gimp_container_view_set_preview_size (view, preview_size);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,21 +37,27 @@
|
|||
#include "widgets/gimpitemfactory.h"
|
||||
#include "widgets/gimpwidgets-utils.h"
|
||||
|
||||
#include "display/gimpdisplay.h"
|
||||
|
||||
#include "drawable-commands.h"
|
||||
#include "offset-dialog.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
||||
#define return_if_no_image(gimage) \
|
||||
#define return_if_no_image(gimage,data) \
|
||||
gimage = (GimpImage *) gimp_widget_get_callback_context (widget); \
|
||||
if (! GIMP_IS_IMAGE (gimage)) \
|
||||
gimage = gimp_context_get_image (gimp_get_user_context (GIMP (data))); \
|
||||
if (! GIMP_IS_IMAGE (gimage)) { \
|
||||
if (GIMP_IS_DISPLAY (data)) \
|
||||
gimage = ((GimpDisplay *) data)->gimage; \
|
||||
else if (GIMP_IS_GIMP (data)) \
|
||||
gimage = gimp_context_get_image (gimp_get_user_context (GIMP (data))); \
|
||||
} \
|
||||
if (! gimage) \
|
||||
return
|
||||
|
||||
#define return_if_no_drawable(gimage,drawable) \
|
||||
return_if_no_image (gimage); \
|
||||
#define return_if_no_drawable(gimage,drawable,data) \
|
||||
return_if_no_image (gimage,data); \
|
||||
drawable = gimp_image_active_drawable (gimage); \
|
||||
if (! drawable) \
|
||||
return
|
||||
|
@ -65,7 +71,7 @@ drawable_desaturate_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GimpImage *gimage;
|
||||
GimpDrawable *active_drawable;
|
||||
return_if_no_drawable (gimage, active_drawable);
|
||||
return_if_no_drawable (gimage, active_drawable, data);
|
||||
|
||||
if (! gimp_drawable_is_rgb (active_drawable))
|
||||
{
|
||||
|
@ -83,7 +89,7 @@ drawable_invert_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GimpImage *gimage;
|
||||
GimpDrawable *active_drawable;
|
||||
return_if_no_drawable (gimage, active_drawable);
|
||||
return_if_no_drawable (gimage, active_drawable, data);
|
||||
|
||||
if (gimp_drawable_is_indexed (active_drawable))
|
||||
{
|
||||
|
@ -101,7 +107,7 @@ drawable_equalize_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GimpImage *gimage;
|
||||
GimpDrawable *active_drawable;
|
||||
return_if_no_drawable (gimage, active_drawable);
|
||||
return_if_no_drawable (gimage, active_drawable, data);
|
||||
|
||||
if (gimp_drawable_is_indexed (active_drawable))
|
||||
{
|
||||
|
@ -119,7 +125,7 @@ drawable_offset_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GimpImage *gimage;
|
||||
GimpDrawable *active_drawable;
|
||||
return_if_no_drawable (gimage, active_drawable);
|
||||
return_if_no_drawable (gimage, active_drawable, data);
|
||||
|
||||
offset_dialog_create (active_drawable);
|
||||
}
|
||||
|
|
|
@ -50,12 +50,22 @@
|
|||
|
||||
|
||||
#define return_if_no_display(gdisp,data) \
|
||||
gdisp = gimp_context_get_display (gimp_get_user_context (GIMP (data))); \
|
||||
if (GIMP_IS_DISPLAY (data)) \
|
||||
gdisp = data; \
|
||||
else if (GIMP_IS_GIMP (data)) \
|
||||
gdisp = gimp_context_get_display (gimp_get_user_context (GIMP (data))); \
|
||||
else \
|
||||
gdisp = NULL; \
|
||||
if (! gdisp) \
|
||||
return
|
||||
|
||||
#define return_if_no_image(gimage,data) \
|
||||
gimage = gimp_context_get_image (gimp_get_user_context (GIMP (data))); \
|
||||
if (GIMP_IS_DISPLAY (data)) \
|
||||
gimage = ((GimpDisplay *) data)->gimage; \
|
||||
else if (GIMP_IS_GIMP (data)) \
|
||||
gimage = gimp_context_get_image (gimp_get_user_context (GIMP (data))); \
|
||||
else \
|
||||
gimage = NULL; \
|
||||
if (! gimage) \
|
||||
return
|
||||
|
||||
|
|
|
@ -52,9 +52,27 @@
|
|||
|
||||
#define REVERT_DATA_KEY "revert-confirm-dialog"
|
||||
|
||||
|
||||
#define return_if_no_gimp(gimp,data) \
|
||||
if (GIMP_IS_DISPLAY (data)) \
|
||||
gimp = ((GimpDisplay *) data)->gimage->gimp; \
|
||||
else if (GIMP_IS_GIMP (data)) \
|
||||
gimp = data; \
|
||||
else \
|
||||
gimp = NULL; \
|
||||
if (! gimp) \
|
||||
return
|
||||
|
||||
|
||||
#define return_if_no_display(gdisp,data) \
|
||||
gdisp = gimp_context_get_display (gimp_get_user_context (GIMP (data))); \
|
||||
if (!gdisp) return
|
||||
if (GIMP_IS_DISPLAY (data)) \
|
||||
gdisp = data; \
|
||||
else if (GIMP_IS_GIMP (data)) \
|
||||
gdisp = gimp_context_get_display (gimp_get_user_context (GIMP (data))); \
|
||||
else \
|
||||
gdisp = NULL; \
|
||||
if (! gdisp) \
|
||||
return
|
||||
|
||||
|
||||
/* local function prototypes */
|
||||
|
@ -72,13 +90,14 @@ file_new_cmd_callback (GtkWidget *widget,
|
|||
guint action)
|
||||
{
|
||||
Gimp *gimp;
|
||||
GimpImage *gimage = NULL;
|
||||
|
||||
gimp = GIMP (data);
|
||||
GimpImage *gimage;
|
||||
return_if_no_gimp (gimp, data);
|
||||
|
||||
/* if called from the image menu */
|
||||
if (action)
|
||||
gimage = gimp_context_get_image (gimp_get_user_context (gimp));
|
||||
else
|
||||
gimage = NULL;
|
||||
|
||||
file_new_dialog_create (gimp, gimage);
|
||||
}
|
||||
|
@ -97,13 +116,14 @@ file_open_cmd_callback (GtkWidget *widget,
|
|||
guint action)
|
||||
{
|
||||
Gimp *gimp;
|
||||
GimpImage *gimage = NULL;
|
||||
|
||||
gimp = GIMP (data);
|
||||
GimpImage *gimage;
|
||||
return_if_no_gimp (gimp, data);
|
||||
|
||||
/* if called from the image menu */
|
||||
if (action)
|
||||
gimage = gimp_context_get_image (gimp_get_user_context (gimp));
|
||||
else
|
||||
gimage = NULL;
|
||||
|
||||
file_open_dialog_show (gimp, gimage, NULL);
|
||||
}
|
||||
|
@ -116,8 +136,7 @@ file_last_opened_cmd_callback (GtkWidget *widget,
|
|||
Gimp *gimp;
|
||||
GimpImagefile *imagefile;
|
||||
guint num_entries;
|
||||
|
||||
gimp = GIMP (data);
|
||||
return_if_no_gimp (gimp, data);
|
||||
|
||||
num_entries = gimp_container_num_children (gimp->documents);
|
||||
|
||||
|
@ -218,7 +237,6 @@ file_revert_cmd_callback (GtkWidget *widget,
|
|||
GimpDisplay *gdisp;
|
||||
GtkWidget *query_box;
|
||||
const gchar *uri;
|
||||
|
||||
return_if_no_display (gdisp, data);
|
||||
|
||||
uri = gimp_object_get_name (GIMP_OBJECT (gdisp->gimage));
|
||||
|
@ -285,7 +303,10 @@ file_quit_cmd_callback (GtkWidget *widget,
|
|||
gpointer data,
|
||||
guint action)
|
||||
{
|
||||
gimp_exit (GIMP (data), FALSE);
|
||||
Gimp *gimp;
|
||||
return_if_no_gimp (gimp, data);
|
||||
|
||||
gimp_exit (gimp, FALSE);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -58,12 +58,22 @@ typedef struct
|
|||
|
||||
|
||||
#define return_if_no_display(gdisp,data) \
|
||||
gdisp = gimp_context_get_display (gimp_get_user_context (GIMP (data))); \
|
||||
if (GIMP_IS_DISPLAY (data)) \
|
||||
gdisp = data; \
|
||||
else if (GIMP_IS_GIMP (data)) \
|
||||
gdisp = gimp_context_get_display (gimp_get_user_context (GIMP (data))); \
|
||||
else \
|
||||
gdisp = NULL; \
|
||||
if (! gdisp) \
|
||||
return
|
||||
|
||||
#define return_if_no_image(gimage,data) \
|
||||
gimage = gimp_context_get_image (gimp_get_user_context (GIMP (data))); \
|
||||
if (GIMP_IS_DISPLAY (data)) \
|
||||
gimage = ((GimpDisplay *) data)->gimage; \
|
||||
else if (GIMP_IS_GIMP (data)) \
|
||||
gimage = gimp_context_get_image (gimp_get_user_context (GIMP (data))); \
|
||||
else \
|
||||
gimage = NULL; \
|
||||
if (! gimage) \
|
||||
return
|
||||
|
||||
|
|
|
@ -45,6 +45,8 @@
|
|||
#include "widgets/gimpviewabledialog.h"
|
||||
#include "widgets/gimpwidgets-utils.h"
|
||||
|
||||
#include "display/gimpdisplay.h"
|
||||
|
||||
#include "layers-commands.h"
|
||||
#include "resize-dialog.h"
|
||||
|
||||
|
@ -62,15 +64,19 @@ static void layers_resize_layer_query (GimpImage *gimage,
|
|||
GimpLayer *layer);
|
||||
|
||||
|
||||
#define return_if_no_image(gimage) \
|
||||
#define return_if_no_image(gimage,data) \
|
||||
gimage = (GimpImage *) gimp_widget_get_callback_context (widget); \
|
||||
if (! GIMP_IS_IMAGE (gimage)) \
|
||||
gimage = gimp_context_get_image (gimp_get_user_context (GIMP (data))); \
|
||||
if (! GIMP_IS_IMAGE (gimage)) { \
|
||||
if (GIMP_IS_DISPLAY (data)) \
|
||||
gimage = ((GimpDisplay *) data)->gimage; \
|
||||
else if (GIMP_IS_GIMP (data)) \
|
||||
gimage = gimp_context_get_image (gimp_get_user_context (GIMP (data))); \
|
||||
} \
|
||||
if (! gimage) \
|
||||
return
|
||||
|
||||
#define return_if_no_layer(gimage,layer) \
|
||||
return_if_no_image (gimage); \
|
||||
#define return_if_no_layer(gimage,layer,data) \
|
||||
return_if_no_image (gimage,data); \
|
||||
layer = gimp_image_get_active_layer (gimage); \
|
||||
if (! layer) \
|
||||
return
|
||||
|
@ -85,7 +91,7 @@ layers_previous_cmd_callback (GtkWidget *widget,
|
|||
GimpImage *gimage;
|
||||
GimpLayer *new_layer;
|
||||
gint current_layer;
|
||||
return_if_no_image (gimage);
|
||||
return_if_no_image (gimage, data);
|
||||
|
||||
current_layer =
|
||||
gimp_image_get_layer_index (gimage, gimp_image_get_active_layer (gimage));
|
||||
|
@ -110,7 +116,7 @@ layers_next_cmd_callback (GtkWidget *widget,
|
|||
GimpImage *gimage;
|
||||
GimpLayer *new_layer;
|
||||
gint current_layer;
|
||||
return_if_no_image (gimage);
|
||||
return_if_no_image (gimage, data);
|
||||
|
||||
current_layer =
|
||||
gimp_image_get_layer_index (gimage, gimp_image_get_active_layer (gimage));
|
||||
|
@ -132,7 +138,7 @@ layers_raise_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GimpImage *gimage;
|
||||
GimpLayer *active_layer;
|
||||
return_if_no_layer (gimage,active_layer);
|
||||
return_if_no_layer (gimage, active_layer, data);
|
||||
|
||||
gimp_image_raise_layer (gimage, active_layer);
|
||||
gimp_image_flush (gimage);
|
||||
|
@ -144,7 +150,7 @@ layers_lower_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GimpImage *gimage;
|
||||
GimpLayer *active_layer;
|
||||
return_if_no_layer (gimage,active_layer);
|
||||
return_if_no_layer (gimage, active_layer, data);
|
||||
|
||||
gimp_image_lower_layer (gimage, active_layer);
|
||||
gimp_image_flush (gimage);
|
||||
|
@ -156,7 +162,7 @@ layers_raise_to_top_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GimpImage *gimage;
|
||||
GimpLayer *active_layer;
|
||||
return_if_no_layer (gimage,active_layer);
|
||||
return_if_no_layer (gimage, active_layer, data);
|
||||
|
||||
gimp_image_raise_layer_to_top (gimage, active_layer);
|
||||
gimp_image_flush (gimage);
|
||||
|
@ -168,7 +174,7 @@ layers_lower_to_bottom_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GimpImage *gimage;
|
||||
GimpLayer *active_layer;
|
||||
return_if_no_layer (gimage, active_layer);
|
||||
return_if_no_layer (gimage, active_layer, data);
|
||||
|
||||
gimp_image_lower_layer_to_bottom (gimage, active_layer);
|
||||
gimp_image_flush (gimage);
|
||||
|
@ -179,7 +185,7 @@ layers_new_cmd_callback (GtkWidget *widget,
|
|||
gpointer data)
|
||||
{
|
||||
GimpImage *gimage;
|
||||
return_if_no_image (gimage);
|
||||
return_if_no_image (gimage, data);
|
||||
|
||||
layers_new_layer_query (gimage, NULL, TRUE);
|
||||
}
|
||||
|
@ -191,7 +197,7 @@ layers_duplicate_cmd_callback (GtkWidget *widget,
|
|||
GimpImage *gimage;
|
||||
GimpLayer *active_layer;
|
||||
GimpLayer *new_layer;
|
||||
return_if_no_layer (gimage, active_layer);
|
||||
return_if_no_layer (gimage, active_layer, data);
|
||||
|
||||
new_layer = gimp_layer_copy (active_layer,
|
||||
G_TYPE_FROM_INSTANCE (active_layer),
|
||||
|
@ -207,7 +213,7 @@ layers_anchor_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GimpImage *gimage;
|
||||
GimpLayer *active_layer;
|
||||
return_if_no_layer (gimage, active_layer);
|
||||
return_if_no_layer (gimage, active_layer, data);
|
||||
|
||||
layers_anchor_layer (active_layer);
|
||||
}
|
||||
|
@ -218,7 +224,7 @@ layers_merge_down_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GimpImage *gimage;
|
||||
GimpLayer *active_layer;
|
||||
return_if_no_layer (gimage, active_layer);
|
||||
return_if_no_layer (gimage, active_layer, data);
|
||||
|
||||
gimp_image_merge_down (gimage, active_layer, GIMP_EXPAND_AS_NECESSARY);
|
||||
gimp_image_flush (gimage);
|
||||
|
@ -230,7 +236,7 @@ layers_delete_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GimpImage *gimage;
|
||||
GimpLayer *active_layer;
|
||||
return_if_no_layer (gimage, active_layer);
|
||||
return_if_no_layer (gimage, active_layer, data);
|
||||
|
||||
if (gimp_layer_is_floating_sel (active_layer))
|
||||
floating_sel_remove (active_layer);
|
||||
|
@ -246,7 +252,7 @@ layers_resize_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GimpImage *gimage;
|
||||
GimpLayer *active_layer;
|
||||
return_if_no_layer (gimage, active_layer);
|
||||
return_if_no_layer (gimage, active_layer, data);
|
||||
|
||||
layers_resize_layer_query (gimage, active_layer);
|
||||
}
|
||||
|
@ -257,7 +263,7 @@ layers_resize_to_image_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GimpImage *gimage;
|
||||
GimpLayer *active_layer;
|
||||
return_if_no_layer (gimage, active_layer);
|
||||
return_if_no_layer (gimage, active_layer, data);
|
||||
|
||||
gimp_layer_resize_to_image (active_layer);
|
||||
gimp_image_flush (gimage);
|
||||
|
@ -269,7 +275,7 @@ layers_scale_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GimpImage *gimage;
|
||||
GimpLayer *active_layer;
|
||||
return_if_no_layer (gimage, active_layer);
|
||||
return_if_no_layer (gimage, active_layer, data);
|
||||
|
||||
layers_scale_layer_query (gimage, active_layer);
|
||||
}
|
||||
|
@ -282,7 +288,7 @@ layers_crop_cmd_callback (GtkWidget *widget,
|
|||
GimpLayer *active_layer;
|
||||
gint x1, y1, x2, y2;
|
||||
gint off_x, off_y;
|
||||
return_if_no_layer (gimage, active_layer);
|
||||
return_if_no_layer (gimage, active_layer, data);
|
||||
|
||||
if (! gimp_image_mask_bounds (gimage, &x1, &y1, &x2, &y2))
|
||||
{
|
||||
|
@ -316,7 +322,7 @@ layers_add_layer_mask_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GimpImage *gimage;
|
||||
GimpLayer *active_layer;
|
||||
return_if_no_layer (gimage, active_layer);
|
||||
return_if_no_layer (gimage, active_layer, data);
|
||||
|
||||
layers_add_mask_query (active_layer);
|
||||
}
|
||||
|
@ -327,7 +333,7 @@ layers_apply_layer_mask_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GimpImage *gimage;
|
||||
GimpLayer *active_layer;
|
||||
return_if_no_layer (gimage, active_layer);
|
||||
return_if_no_layer (gimage, active_layer, data);
|
||||
|
||||
if (gimp_layer_get_mask (active_layer))
|
||||
{
|
||||
|
@ -348,7 +354,7 @@ layers_delete_layer_mask_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GimpImage *gimage;
|
||||
GimpLayer *active_layer;
|
||||
return_if_no_layer (gimage, active_layer);
|
||||
return_if_no_layer (gimage, active_layer, data);
|
||||
|
||||
if (gimp_layer_get_mask (active_layer))
|
||||
{
|
||||
|
@ -369,7 +375,7 @@ layers_mask_select_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GimpImage *gimage;
|
||||
GimpLayer *active_layer;
|
||||
return_if_no_layer (gimage, active_layer);
|
||||
return_if_no_layer (gimage, active_layer, data);
|
||||
|
||||
if (gimp_layer_get_mask (active_layer))
|
||||
{
|
||||
|
@ -384,7 +390,7 @@ layers_alpha_select_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GimpImage *gimage;
|
||||
GimpLayer *active_layer;
|
||||
return_if_no_layer (gimage, active_layer);
|
||||
return_if_no_layer (gimage, active_layer, data);
|
||||
|
||||
gimp_image_mask_layer_alpha (gimage, active_layer);
|
||||
gimp_image_flush (gimage);
|
||||
|
@ -396,7 +402,7 @@ layers_add_alpha_channel_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GimpImage *gimage;
|
||||
GimpLayer *active_layer;
|
||||
return_if_no_layer (gimage, active_layer);
|
||||
return_if_no_layer (gimage, active_layer, data);
|
||||
|
||||
if (! gimp_drawable_has_alpha (GIMP_DRAWABLE (active_layer)))
|
||||
{
|
||||
|
@ -411,7 +417,7 @@ layers_edit_attributes_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GimpImage *gimage;
|
||||
GimpLayer *active_layer;
|
||||
return_if_no_layer (gimage, active_layer);
|
||||
return_if_no_layer (gimage, active_layer, data);
|
||||
|
||||
layers_edit_layer_query (active_layer);
|
||||
}
|
||||
|
|
|
@ -39,6 +39,17 @@
|
|||
#include "app_procs.h"
|
||||
|
||||
|
||||
#define return_if_no_display(gdisp,data) \
|
||||
if (GIMP_IS_DISPLAY (data)) \
|
||||
gdisp = data; \
|
||||
else if (GIMP_IS_GIMP (data)) \
|
||||
gdisp = gimp_context_get_display (gimp_get_user_context (GIMP (data))); \
|
||||
else \
|
||||
gdisp = NULL; \
|
||||
if (! gdisp) \
|
||||
return
|
||||
|
||||
|
||||
void
|
||||
plug_in_run_cmd_callback (GtkWidget *widget,
|
||||
gpointer data,
|
||||
|
@ -137,11 +148,7 @@ plug_in_repeat_cmd_callback (GtkWidget *widget,
|
|||
GimpDisplay *gdisp;
|
||||
GimpDrawable *drawable;
|
||||
gboolean interactive;
|
||||
|
||||
gdisp = gimp_context_get_display (gimp_get_user_context (GIMP (data)));
|
||||
|
||||
if (! gdisp)
|
||||
return;
|
||||
return_if_no_display (gdisp, data);
|
||||
|
||||
drawable = gimp_image_active_drawable (gdisp->gimage);
|
||||
|
||||
|
|
|
@ -38,12 +38,22 @@
|
|||
|
||||
|
||||
#define return_if_no_display(gdisp,data) \
|
||||
gdisp = gimp_context_get_display (gimp_get_user_context (GIMP (data))); \
|
||||
if (GIMP_IS_DISPLAY (data)) \
|
||||
gdisp = data; \
|
||||
else if (GIMP_IS_GIMP (data)) \
|
||||
gdisp = gimp_context_get_display (gimp_get_user_context (GIMP (data))); \
|
||||
else \
|
||||
gdisp = NULL; \
|
||||
if (! gdisp) \
|
||||
return
|
||||
|
||||
#define return_if_no_image(gimage,data) \
|
||||
gimage = gimp_context_get_image (gimp_get_user_context (GIMP (data))); \
|
||||
if (GIMP_IS_DISPLAY (data)) \
|
||||
gimage = ((GimpDisplay *) data)->gimage; \
|
||||
else if (GIMP_IS_GIMP (data)) \
|
||||
gimage = gimp_context_get_image (gimp_get_user_context (GIMP (data))); \
|
||||
else \
|
||||
gimage = NULL; \
|
||||
if (! gimage) \
|
||||
return
|
||||
|
||||
|
|
|
@ -33,12 +33,26 @@
|
|||
#include "tools/tool_manager.h"
|
||||
|
||||
|
||||
#define return_if_no_gimp(gimp,data) \
|
||||
if (GIMP_IS_DISPLAY (data)) \
|
||||
gimp = ((GimpDisplay *) data)->gimage->gimp; \
|
||||
else if (GIMP_IS_GIMP (data)) \
|
||||
gimp = data; \
|
||||
else \
|
||||
gimp = NULL; \
|
||||
if (! gimp) \
|
||||
return
|
||||
|
||||
|
||||
void
|
||||
tools_default_colors_cmd_callback (GtkWidget *widget,
|
||||
gpointer data,
|
||||
guint action)
|
||||
{
|
||||
gimp_context_set_default_colors (gimp_get_user_context (GIMP (data)));
|
||||
Gimp *gimp;
|
||||
return_if_no_gimp (gimp, data);
|
||||
|
||||
gimp_context_set_default_colors (gimp_get_user_context (gimp));
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -46,7 +60,10 @@ tools_swap_colors_cmd_callback (GtkWidget *widget,
|
|||
gpointer data,
|
||||
guint action)
|
||||
{
|
||||
gimp_context_swap_colors (gimp_get_user_context (GIMP (data)));
|
||||
Gimp *gimp;
|
||||
return_if_no_gimp (gimp, data);
|
||||
|
||||
gimp_context_swap_colors (gimp_get_user_context (gimp));
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -58,8 +75,7 @@ tools_swap_contexts_cmd_callback (GtkWidget *widget,
|
|||
static GimpContext *temp_context = NULL;
|
||||
|
||||
Gimp *gimp;
|
||||
|
||||
gimp = GIMP (data);
|
||||
return_if_no_gimp (gimp, data);
|
||||
|
||||
if (! swap_context)
|
||||
{
|
||||
|
|
|
@ -45,6 +45,8 @@
|
|||
#include "widgets/gimpviewabledialog.h"
|
||||
#include "widgets/gimpwidgets-utils.h"
|
||||
|
||||
#include "display/gimpdisplay.h"
|
||||
|
||||
#include "tools/gimppainttool.h"
|
||||
#include "tools/gimpvectortool.h"
|
||||
#include "tools/tool_manager.h"
|
||||
|
@ -56,15 +58,21 @@
|
|||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
||||
#define return_if_no_image(gimage) \
|
||||
#define return_if_no_image(gimage,data) \
|
||||
gimage = (GimpImage *) gimp_widget_get_callback_context (widget); \
|
||||
if (! GIMP_IS_IMAGE (gimage)) \
|
||||
gimage = gimp_context_get_image (gimp_get_user_context (GIMP (data))); \
|
||||
if (! GIMP_IS_IMAGE (gimage)) { \
|
||||
if (GIMP_IS_DISPLAY (data)) \
|
||||
gimage = ((GimpDisplay *) data)->gimage; \
|
||||
else if (GIMP_IS_GIMP (data)) \
|
||||
gimage = gimp_context_get_image (gimp_get_user_context (GIMP (data))); \
|
||||
else \
|
||||
gimage = NULL; \
|
||||
} \
|
||||
if (! gimage) \
|
||||
return
|
||||
|
||||
#define return_if_no_vectors(gimage,vectors) \
|
||||
return_if_no_image (gimage); \
|
||||
#define return_if_no_vectors(gimage,vectors,data) \
|
||||
return_if_no_image (gimage,data); \
|
||||
vectors = gimp_image_get_active_vectors (gimage); \
|
||||
if (! vectors) \
|
||||
return
|
||||
|
@ -77,7 +85,7 @@ vectors_new_vectors_cmd_callback (GtkWidget *widget,
|
|||
gpointer data)
|
||||
{
|
||||
GimpImage *gimage;
|
||||
return_if_no_image (gimage);
|
||||
return_if_no_image (gimage, data);
|
||||
|
||||
vectors_new_vectors_query (gimage, NULL, TRUE);
|
||||
}
|
||||
|
@ -88,7 +96,7 @@ vectors_raise_vectors_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GimpImage *gimage;
|
||||
GimpVectors *active_vectors;
|
||||
return_if_no_vectors (gimage, active_vectors);
|
||||
return_if_no_vectors (gimage, active_vectors, data);
|
||||
|
||||
gimp_image_raise_vectors (gimage, active_vectors);
|
||||
gimp_image_flush (gimage);
|
||||
|
@ -100,7 +108,7 @@ vectors_lower_vectors_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GimpImage *gimage;
|
||||
GimpVectors *active_vectors;
|
||||
return_if_no_vectors (gimage, active_vectors);
|
||||
return_if_no_vectors (gimage, active_vectors, data);
|
||||
|
||||
gimp_image_lower_vectors (gimage, active_vectors);
|
||||
gimp_image_flush (gimage);
|
||||
|
@ -113,9 +121,13 @@ vectors_duplicate_vectors_cmd_callback (GtkWidget *widget,
|
|||
GimpImage *gimage;
|
||||
GimpVectors *active_vectors;
|
||||
GimpVectors *new_vectors;
|
||||
return_if_no_vectors (gimage, active_vectors);
|
||||
return_if_no_vectors (gimage, active_vectors, data);
|
||||
|
||||
new_vectors = NULL;
|
||||
|
||||
#ifdef __GNUC__
|
||||
#warning FIXME: need gimp_vectors_copy()
|
||||
#endif
|
||||
#if 0
|
||||
new_vectors = gimp_vectors_copy (active_vectors,
|
||||
G_TYPE_FROM_INSTANCE (active_vectors),
|
||||
|
@ -131,7 +143,7 @@ vectors_delete_vectors_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GimpImage *gimage;
|
||||
GimpVectors *active_vectors;
|
||||
return_if_no_vectors (gimage, active_vectors);
|
||||
return_if_no_vectors (gimage, active_vectors, data);
|
||||
|
||||
gimp_image_remove_vectors (gimage, active_vectors);
|
||||
gimp_image_flush (gimage);
|
||||
|
@ -144,7 +156,7 @@ vectors_vectors_to_sel (GtkWidget *widget,
|
|||
{
|
||||
GimpImage *gimage;
|
||||
GimpVectors *active_vectors;
|
||||
return_if_no_vectors (gimage, active_vectors);
|
||||
return_if_no_vectors (gimage, active_vectors, data);
|
||||
|
||||
gimp_image_mask_select_vectors (gimage,
|
||||
active_vectors,
|
||||
|
@ -187,9 +199,11 @@ vectors_sel_to_vectors_cmd_callback (GtkWidget *widget,
|
|||
gpointer data)
|
||||
{
|
||||
GimpImage *gimage;
|
||||
return_if_no_image (gimage);
|
||||
return_if_no_image (gimage, data);
|
||||
|
||||
/* TODO */
|
||||
#ifdef __GNUC__
|
||||
#warning FIXME: need gimp_vectors_from_mask(or something)
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -198,7 +212,7 @@ vectors_stroke_vectors_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GimpImage *gimage;
|
||||
GimpVectors *active_vectors;
|
||||
return_if_no_vectors (gimage, active_vectors);
|
||||
return_if_no_vectors (gimage, active_vectors, data);
|
||||
|
||||
vectors_stroke_vectors (active_vectors);
|
||||
}
|
||||
|
@ -209,9 +223,11 @@ vectors_copy_vectors_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GimpImage *gimage;
|
||||
GimpVectors *active_vectors;
|
||||
return_if_no_vectors (gimage, active_vectors);
|
||||
return_if_no_vectors (gimage, active_vectors, data);
|
||||
|
||||
/* TODO */
|
||||
#ifdef __GNUC__
|
||||
#warning FIXME: need vectors clipoard
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -219,9 +235,11 @@ vectors_paste_vectors_cmd_callback (GtkWidget *widget,
|
|||
gpointer data)
|
||||
{
|
||||
GimpImage *gimage;
|
||||
return_if_no_image (gimage);
|
||||
return_if_no_image (gimage, data);
|
||||
|
||||
/* TODO */
|
||||
#ifdef __GNUC__
|
||||
#warning FIXME: need vectors clipoard
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -229,9 +247,11 @@ vectors_import_vectors_cmd_callback (GtkWidget *widget,
|
|||
gpointer data)
|
||||
{
|
||||
GimpImage *gimage;
|
||||
return_if_no_image (gimage);
|
||||
return_if_no_image (gimage, data);
|
||||
|
||||
/* TODO */
|
||||
#ifdef __GNUC__
|
||||
#warning FIXME: need vectors import/export
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -240,9 +260,11 @@ vectors_export_vectors_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GimpImage *gimage;
|
||||
GimpVectors *active_vectors;
|
||||
return_if_no_vectors (gimage, active_vectors);
|
||||
return_if_no_vectors (gimage, active_vectors, data);
|
||||
|
||||
/* TODO */
|
||||
#ifdef __GNUC__
|
||||
#warning FIXME: need vectors import/export
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -251,7 +273,7 @@ vectors_vectors_tool_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GimpImage *gimage;
|
||||
GimpVectors *active_vectors;
|
||||
return_if_no_vectors (gimage, active_vectors);
|
||||
return_if_no_vectors (gimage, active_vectors, data);
|
||||
|
||||
vectors_vectors_tool (active_vectors);
|
||||
}
|
||||
|
@ -262,7 +284,7 @@ vectors_edit_vectors_attributes_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GimpImage *gimage;
|
||||
GimpVectors *active_vectors;
|
||||
return_if_no_vectors (gimage, active_vectors);
|
||||
return_if_no_vectors (gimage, active_vectors, data);
|
||||
|
||||
vectors_edit_vectors_query (active_vectors);
|
||||
}
|
||||
|
|
|
@ -45,7 +45,12 @@
|
|||
|
||||
|
||||
#define return_if_no_display(gdisp, data) \
|
||||
gdisp = gimp_context_get_display (gimp_get_user_context (GIMP (data))); \
|
||||
if (GIMP_IS_DISPLAY (data)) \
|
||||
gdisp = data; \
|
||||
else if (GIMP_IS_GIMP (data)) \
|
||||
gdisp = gimp_context_get_display (gimp_get_user_context (GIMP (data))); \
|
||||
else \
|
||||
gdisp = NULL; \
|
||||
if (! gdisp) \
|
||||
return
|
||||
|
||||
|
@ -201,17 +206,22 @@ void
|
|||
view_toggle_rulers_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GimpDisplay *gdisp;
|
||||
GimpDisplayShell *shell;
|
||||
GimpDisplay *gdisp;
|
||||
GimpDisplayShell *shell;
|
||||
GimpDisplayConfig *config;
|
||||
return_if_no_display (gdisp, data);
|
||||
|
||||
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
|
||||
|
||||
config = GIMP_DISPLAY_CONFIG (gdisp->gimage->gimp->config);
|
||||
|
||||
if (! GTK_CHECK_MENU_ITEM (widget)->active)
|
||||
{
|
||||
if (GTK_WIDGET_VISIBLE (shell->origin))
|
||||
if (GTK_WIDGET_VISIBLE (shell->hrule))
|
||||
{
|
||||
gtk_widget_hide (shell->origin);
|
||||
if (! config->menu_bar_per_display)
|
||||
gtk_widget_hide (shell->origin);
|
||||
|
||||
gtk_widget_hide (shell->hrule);
|
||||
gtk_widget_hide (shell->vrule);
|
||||
|
||||
|
@ -220,9 +230,11 @@ view_toggle_rulers_cmd_callback (GtkWidget *widget,
|
|||
}
|
||||
else
|
||||
{
|
||||
if (! GTK_WIDGET_VISIBLE (shell->origin))
|
||||
if (! GTK_WIDGET_VISIBLE (shell->hrule))
|
||||
{
|
||||
gtk_widget_show (shell->origin);
|
||||
if (! config->menu_bar_per_display)
|
||||
gtk_widget_show (shell->origin);
|
||||
|
||||
gtk_widget_show (shell->hrule);
|
||||
gtk_widget_show (shell->vrule);
|
||||
|
||||
|
|
|
@ -249,6 +249,7 @@
|
|||
#define NAVIGATION_PREVIEW_SIZE_BLURB NULL
|
||||
#define CANVAS_PADDING_MODE_BLURB NULL
|
||||
#define CANVAS_PADDING_COLOR_BLURB NULL
|
||||
#define MENU_BAR_PER_DISPLAY_BLURB NULL
|
||||
#define HELP_BROWSER_BLURB NULL
|
||||
#define MAX_NEW_IMAGE_SIZE_BLURB NULL
|
||||
|
||||
|
|
|
@ -72,7 +72,8 @@ enum
|
|||
PROP_MONITOR_RES_FROM_GDK,
|
||||
PROP_NAV_PREVIEW_SIZE,
|
||||
PROP_CANVAS_PADDING_MODE,
|
||||
PROP_CANVAS_PADDING_COLOR
|
||||
PROP_CANVAS_PADDING_COLOR,
|
||||
PROP_MENU_BAR_PER_DISPLAY
|
||||
};
|
||||
|
||||
static GObjectClass *parent_class = NULL;
|
||||
|
@ -213,6 +214,11 @@ gimp_display_config_class_init (GimpDisplayConfigClass *klass)
|
|||
CANVAS_PADDING_COLOR_BLURB,
|
||||
&white,
|
||||
0);
|
||||
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_MENU_BAR_PER_DISPLAY,
|
||||
"menu-bar-per-display",
|
||||
MENU_BAR_PER_DISPLAY_BLURB,
|
||||
FALSE,
|
||||
GIMP_PARAM_RESTART);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -299,6 +305,9 @@ gimp_display_config_set_property (GObject *object,
|
|||
case PROP_CANVAS_PADDING_COLOR:
|
||||
display_config->canvas_padding_color = *(GimpRGB *) g_value_get_boxed (value);
|
||||
break;
|
||||
case PROP_MENU_BAR_PER_DISPLAY:
|
||||
display_config->menu_bar_per_display = g_value_get_boolean (value);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
|
@ -375,6 +384,9 @@ gimp_display_config_get_property (GObject *object,
|
|||
case PROP_CANVAS_PADDING_COLOR:
|
||||
g_value_set_boxed (value, &display_config->canvas_padding_color);
|
||||
break;
|
||||
case PROP_MENU_BAR_PER_DISPLAY:
|
||||
g_value_set_boolean (value, display_config->menu_bar_per_display);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
|
|
|
@ -59,6 +59,7 @@ struct _GimpDisplayConfig
|
|||
GimpPreviewSize nav_preview_size;
|
||||
GimpDisplayPaddingMode canvas_padding_mode;
|
||||
GimpRGB canvas_padding_color;
|
||||
gboolean menu_bar_per_display;
|
||||
};
|
||||
|
||||
struct _GimpDisplayConfigClass
|
||||
|
|
|
@ -80,7 +80,6 @@
|
|||
#include "error-console-dialog.h"
|
||||
#include "gradients-commands.h"
|
||||
#include "layers-commands.h"
|
||||
#include "menus.h"
|
||||
#include "module-browser.h"
|
||||
#include "palettes-commands.h"
|
||||
#include "paths-dialog.h"
|
||||
|
|
|
@ -110,16 +110,12 @@ file_dialog_new (Gimp *gimp,
|
|||
void
|
||||
file_dialog_show (GtkWidget *filesel)
|
||||
{
|
||||
GtkItemFactory *item_factory;
|
||||
gimp_item_factories_set_sensitive ("<Toolbox>", "/File/Open...", FALSE);
|
||||
|
||||
item_factory = GTK_ITEM_FACTORY (gimp_item_factory_from_path ("<Toolbox>"));
|
||||
gimp_item_factory_set_sensitive (item_factory, "/File/Open...", FALSE);
|
||||
|
||||
item_factory = GTK_ITEM_FACTORY (gimp_item_factory_from_path ("<Image>"));
|
||||
gimp_item_factory_set_sensitive (item_factory, "/File/Open...", FALSE);
|
||||
gimp_item_factory_set_sensitive (item_factory, "/File/Save", FALSE);
|
||||
gimp_item_factory_set_sensitive (item_factory, "/File/Save as...", FALSE);
|
||||
gimp_item_factory_set_sensitive (item_factory, "/File/Save a Copy...", FALSE);
|
||||
gimp_item_factories_set_sensitive ("<Image>", "/File/Open...", FALSE);
|
||||
gimp_item_factories_set_sensitive ("<Image>", "/File/Save", FALSE);
|
||||
gimp_item_factories_set_sensitive ("<Image>", "/File/Save as...", FALSE);
|
||||
gimp_item_factories_set_sensitive ("<Image>", "/File/Save a Copy...", FALSE);
|
||||
|
||||
gtk_widget_grab_focus (GTK_FILE_SELECTION (filesel)->selection_entry);
|
||||
gtk_widget_show (filesel);
|
||||
|
@ -128,18 +124,14 @@ file_dialog_show (GtkWidget *filesel)
|
|||
gboolean
|
||||
file_dialog_hide (GtkWidget *filesel)
|
||||
{
|
||||
GtkItemFactory *item_factory;
|
||||
|
||||
gtk_widget_hide (filesel);
|
||||
|
||||
item_factory = GTK_ITEM_FACTORY (gimp_item_factory_from_path ("<Toolbox>"));
|
||||
gimp_item_factory_set_sensitive (item_factory, "/File/Open...", TRUE);
|
||||
gimp_item_factories_set_sensitive ("<Toolbox>", "/File/Open...", TRUE);
|
||||
|
||||
item_factory = GTK_ITEM_FACTORY (gimp_item_factory_from_path ("<Image>"));
|
||||
gimp_item_factory_set_sensitive (item_factory, "/File/Open...", TRUE);
|
||||
gimp_item_factory_set_sensitive (item_factory, "/File/Save", TRUE);
|
||||
gimp_item_factory_set_sensitive (item_factory, "/File/Save as...", TRUE);
|
||||
gimp_item_factory_set_sensitive (item_factory, "/File/Save a Copy...", TRUE);
|
||||
gimp_item_factories_set_sensitive ("<Image>", "/File/Open...", TRUE);
|
||||
gimp_item_factories_set_sensitive ("<Image>", "/File/Save", TRUE);
|
||||
gimp_item_factories_set_sensitive ("<Image>", "/File/Save as...", TRUE);
|
||||
gimp_item_factories_set_sensitive ("<Image>", "/File/Save a Copy...", TRUE);
|
||||
|
||||
/* return TRUE because we are used as "delete_event" handler */
|
||||
return TRUE;
|
||||
|
|
|
@ -181,13 +181,13 @@ prefs_config_copy_notify (GObject *config_copy,
|
|||
{
|
||||
if (param_spec->flags & GIMP_PARAM_CONFIRM)
|
||||
{
|
||||
g_print ("NOT Applying prefs change of '%s' to global config "
|
||||
g_print ("NOT Applying prefs change of '%s' to edit_config "
|
||||
"because it needs confirmation\n",
|
||||
param_spec->name);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_print ("Applying prefs change of '%s' to global config\n",
|
||||
g_print ("Applying prefs change of '%s' to edit_config\n",
|
||||
param_spec->name);
|
||||
|
||||
g_signal_handlers_block_by_func (config,
|
||||
|
@ -1145,7 +1145,10 @@ prefs_dialog_new (Gimp *gimp,
|
|||
vbox2 = prefs_frame_new (_("Menus"), GTK_CONTAINER (vbox), FALSE);
|
||||
|
||||
prefs_check_button_add (config, "tearoff-menus",
|
||||
_("Disable _Tearoff Menus"),
|
||||
_("Enable _Tearoff Menus"),
|
||||
GTK_BOX (vbox2));
|
||||
prefs_check_button_add (config, "menu-bar-per-display",
|
||||
_("Menu _Bar Per Display"),
|
||||
GTK_BOX (vbox2));
|
||||
|
||||
/* Window Positions */
|
||||
|
|
|
@ -121,40 +121,41 @@ gimp_display_shell_events (GtkWidget *widget,
|
|||
GdkEventKey *kevent;
|
||||
|
||||
case GDK_KEY_PRESS:
|
||||
{
|
||||
gchar *accel = NULL;
|
||||
if (! GIMP_DISPLAY_CONFIG (gimp->config)->menu_bar_per_display)
|
||||
{
|
||||
gchar *accel = NULL;
|
||||
|
||||
g_object_get (G_OBJECT (gtk_widget_get_settings (widget)),
|
||||
"gtk-menu-bar-accel",
|
||||
&accel,
|
||||
NULL);
|
||||
g_object_get (G_OBJECT (gtk_widget_get_settings (widget)),
|
||||
"gtk-menu-bar-accel", &accel,
|
||||
NULL);
|
||||
|
||||
if (accel)
|
||||
{
|
||||
guint keyval = 0;
|
||||
GdkModifierType mods = 0;
|
||||
if (accel)
|
||||
{
|
||||
guint keyval = 0;
|
||||
GdkModifierType mods = 0;
|
||||
|
||||
gtk_accelerator_parse (accel, &keyval, &mods);
|
||||
gtk_accelerator_parse (accel, &keyval, &mods);
|
||||
|
||||
if (keyval == 0)
|
||||
g_warning ("Failed to parse menu bar accelerator '%s'\n", accel);
|
||||
if (keyval == 0)
|
||||
g_warning ("Failed to parse menu bar accelerator '%s'\n", accel);
|
||||
|
||||
kevent = (GdkEventKey *) event;
|
||||
kevent = (GdkEventKey *) event;
|
||||
|
||||
/* FIXME this is wrong, needs to be in the global accel resolution
|
||||
* thing, to properly consider i18n etc., but that probably requires
|
||||
* AccelGroup changes etc.
|
||||
*/
|
||||
if (kevent->keyval == keyval &&
|
||||
((kevent->state & gtk_accelerator_get_default_mod_mask ()) ==
|
||||
(mods & gtk_accelerator_get_default_mod_mask ())))
|
||||
{
|
||||
popup_menu = TRUE;
|
||||
}
|
||||
/* FIXME this is wrong, needs to be in the global accel
|
||||
* resolution thing, to properly consider i18n etc., but
|
||||
* that probably requires AccelGroup changes etc.
|
||||
*/
|
||||
if (kevent->keyval == keyval &&
|
||||
((kevent->state & gtk_accelerator_get_default_mod_mask ()) ==
|
||||
(mods & gtk_accelerator_get_default_mod_mask ())))
|
||||
{
|
||||
popup_menu = TRUE;
|
||||
}
|
||||
|
||||
g_free (accel);
|
||||
}
|
||||
}
|
||||
g_free (accel);
|
||||
}
|
||||
}
|
||||
/* fallthru */
|
||||
|
||||
case GDK_KEY_RELEASE:
|
||||
kevent = (GdkEventKey *) event;
|
||||
|
@ -606,9 +607,10 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas,
|
|||
|
||||
case 3:
|
||||
state |= GDK_BUTTON3_MASK;
|
||||
gimp_item_factory_popup_with_data (shell->item_factory,
|
||||
gimage,
|
||||
NULL);
|
||||
if (! GIMP_DISPLAY_CONFIG (gimage->gimp->config)->menu_bar_per_display)
|
||||
gimp_item_factory_popup_with_data (shell->item_factory,
|
||||
gimage,
|
||||
NULL);
|
||||
return_val = TRUE;
|
||||
break;
|
||||
|
||||
|
|
|
@ -58,6 +58,7 @@
|
|||
|
||||
#include "gui/info-window.h"
|
||||
#include "gui/plug-in-menus.h"
|
||||
#include "gui/menus.h"
|
||||
|
||||
#include "tools/tools-types.h"
|
||||
|
||||
|
@ -339,6 +340,12 @@ gimp_display_shell_destroy (GtkObject *object)
|
|||
gimp_display_shell_disconnect (shell);
|
||||
}
|
||||
|
||||
if (shell->item_factory)
|
||||
{
|
||||
g_object_unref (shell->item_factory);
|
||||
shell->item_factory = NULL;
|
||||
}
|
||||
|
||||
if (shell->select)
|
||||
{
|
||||
gimp_display_shell_selection_free (shell->select);
|
||||
|
@ -461,7 +468,21 @@ gimp_display_shell_new (GimpDisplay *gdisp,
|
|||
|
||||
shell->scale = (scaledest << 8) + scalesrc;
|
||||
|
||||
shell->item_factory = gimp_item_factory_from_path ("<Image>");
|
||||
if (config->menu_bar_per_display)
|
||||
{
|
||||
shell->item_factory =
|
||||
menus_get_new_image_factory (shell->gdisp->gimage->gimp,
|
||||
shell->gdisp,
|
||||
TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
shell->item_factory =
|
||||
menus_get_new_image_factory (shell->gdisp->gimage->gimp,
|
||||
shell->gdisp->gimage->gimp,
|
||||
FALSE);
|
||||
g_object_ref (shell->item_factory);
|
||||
}
|
||||
|
||||
/* The accelerator table for images */
|
||||
gimp_window_add_accel_group (GTK_WINDOW (shell),
|
||||
|
@ -507,8 +528,40 @@ gimp_display_shell_new (GimpDisplay *gdisp,
|
|||
/* first, set up the container hierarchy *********************************/
|
||||
|
||||
/* the vbox containing all widgets */
|
||||
main_vbox = gtk_vbox_new (FALSE, 2);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 2);
|
||||
|
||||
if (config->menu_bar_per_display)
|
||||
{
|
||||
GtkWidget *menu_bar;
|
||||
|
||||
main_vbox = gtk_vbox_new (FALSE, 0);
|
||||
|
||||
gimp_item_factory_set_visible (GTK_ITEM_FACTORY (shell->item_factory),
|
||||
"/tearoff1", FALSE);
|
||||
gimp_item_factory_set_visible (GTK_ITEM_FACTORY (shell->item_factory),
|
||||
"/filters-separator", FALSE);
|
||||
|
||||
menu_bar = GTK_ITEM_FACTORY (shell->item_factory)->widget;
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (main_vbox), menu_bar, FALSE, FALSE, 0);
|
||||
gtk_widget_show (menu_bar);
|
||||
|
||||
/* active display callback */
|
||||
g_signal_connect (G_OBJECT (menu_bar), "button_press_event",
|
||||
G_CALLBACK (gimp_display_shell_events),
|
||||
shell);
|
||||
g_signal_connect (G_OBJECT (menu_bar), "button_release_event",
|
||||
G_CALLBACK (gimp_display_shell_events),
|
||||
shell);
|
||||
g_signal_connect (G_OBJECT (menu_bar), "key_press_event",
|
||||
G_CALLBACK (gimp_display_shell_events),
|
||||
shell);
|
||||
}
|
||||
else
|
||||
{
|
||||
main_vbox = gtk_vbox_new (FALSE, 2);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 2);
|
||||
}
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (shell), main_vbox);
|
||||
|
||||
/* another vbox for everything except the statusbar */
|
||||
|
@ -516,6 +569,9 @@ gimp_display_shell_new (GimpDisplay *gdisp,
|
|||
gtk_box_pack_start (GTK_BOX (main_vbox), disp_vbox, TRUE, TRUE, 0);
|
||||
gtk_widget_show (disp_vbox);
|
||||
|
||||
if (config->menu_bar_per_display)
|
||||
gtk_container_set_border_width (GTK_CONTAINER (disp_vbox), 2);
|
||||
|
||||
/* a hbox for the inner_table and the vertical scrollbar */
|
||||
upper_hbox = gtk_hbox_new (FALSE, 1);
|
||||
gtk_box_pack_start (GTK_BOX (disp_vbox), upper_hbox, TRUE, TRUE, 0);
|
||||
|
@ -558,11 +614,11 @@ gimp_display_shell_new (GimpDisplay *gdisp,
|
|||
shell->origin = gtk_button_new ();
|
||||
GTK_WIDGET_UNSET_FLAGS (shell->origin, GTK_CAN_FOCUS);
|
||||
gtk_widget_set_events (GTK_WIDGET (shell->origin),
|
||||
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK);
|
||||
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK);
|
||||
|
||||
g_signal_connect (G_OBJECT (shell->origin), "button_press_event",
|
||||
G_CALLBACK (gimp_display_shell_origin_button_press),
|
||||
shell);
|
||||
G_CALLBACK (gimp_display_shell_origin_button_press),
|
||||
shell);
|
||||
|
||||
gimp_help_set_help_data (shell->origin, NULL, "#origin_button");
|
||||
|
||||
|
@ -571,12 +627,15 @@ gimp_display_shell_new (GimpDisplay *gdisp,
|
|||
gtk_container_add (GTK_CONTAINER (shell->origin), arrow);
|
||||
gtk_widget_show (arrow);
|
||||
|
||||
/* EEK */
|
||||
shell->canvas = gtk_drawing_area_new ();
|
||||
|
||||
/* the horizontal ruler */
|
||||
shell->hrule = gtk_hruler_new ();
|
||||
gtk_widget_set_events (GTK_WIDGET (shell->hrule),
|
||||
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK);
|
||||
|
||||
g_signal_connect_swapped (G_OBJECT (shell), "motion_notify_event",
|
||||
g_signal_connect_swapped (G_OBJECT (shell->canvas), "motion_notify_event",
|
||||
G_CALLBACK (GTK_WIDGET_GET_CLASS (shell->hrule)->motion_notify_event),
|
||||
shell->hrule);
|
||||
g_signal_connect (G_OBJECT (shell->hrule), "button_press_event",
|
||||
|
@ -590,7 +649,7 @@ gimp_display_shell_new (GimpDisplay *gdisp,
|
|||
gtk_widget_set_events (GTK_WIDGET (shell->vrule),
|
||||
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK);
|
||||
|
||||
g_signal_connect_swapped (G_OBJECT (shell), "motion_notify_event",
|
||||
g_signal_connect_swapped (G_OBJECT (shell->canvas), "motion_notify_event",
|
||||
G_CALLBACK (GTK_WIDGET_GET_CLASS (shell->vrule)->motion_notify_event),
|
||||
shell->vrule);
|
||||
g_signal_connect (G_OBJECT (shell->vrule), "button_press_event",
|
||||
|
@ -600,7 +659,6 @@ gimp_display_shell_new (GimpDisplay *gdisp,
|
|||
gimp_help_set_help_data (shell->vrule, NULL, "#ruler");
|
||||
|
||||
/* the canvas */
|
||||
shell->canvas = gtk_drawing_area_new ();
|
||||
gtk_widget_set_name (shell->canvas, "gimp-canvas");
|
||||
gtk_widget_set_size_request (shell->canvas, n_width, n_height);
|
||||
gtk_widget_set_events (shell->canvas, GIMP_DISPLAY_SHELL_CANVAS_EVENT_MASK);
|
||||
|
@ -722,7 +780,7 @@ gimp_display_shell_new (GimpDisplay *gdisp,
|
|||
|
||||
/* fill the inner_table */
|
||||
gtk_table_attach (GTK_TABLE (inner_table), shell->origin, 0, 1, 0, 1,
|
||||
GTK_FILL, GTK_FILL, 0, 0);
|
||||
GTK_FILL, GTK_FILL, 0, 0);
|
||||
gtk_table_attach (GTK_TABLE (inner_table), shell->hrule, 1, 2, 0, 1,
|
||||
GTK_EXPAND | GTK_SHRINK | GTK_FILL, GTK_FILL, 0, 0);
|
||||
gtk_table_attach (GTK_TABLE (inner_table), shell->vrule, 0, 1, 1, 2,
|
||||
|
@ -747,7 +805,9 @@ gimp_display_shell_new (GimpDisplay *gdisp,
|
|||
|
||||
if (config->show_rulers)
|
||||
{
|
||||
gtk_widget_show (shell->origin);
|
||||
if (! config->menu_bar_per_display)
|
||||
gtk_widget_show (shell->origin);
|
||||
|
||||
gtk_widget_show (shell->hrule);
|
||||
gtk_widget_show (shell->vrule);
|
||||
}
|
||||
|
@ -1056,7 +1116,20 @@ gimp_display_shell_set_menu_sensitivity (GimpDisplayShell *shell,
|
|||
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
||||
|
||||
if (shell)
|
||||
gdisp = shell->gdisp;
|
||||
{
|
||||
gdisp = shell->gdisp;
|
||||
item_factory = GTK_ITEM_FACTORY (shell->item_factory);
|
||||
}
|
||||
else
|
||||
{
|
||||
item_factory = GTK_ITEM_FACTORY (gimp_item_factory_from_path ("<Image>"));
|
||||
}
|
||||
|
||||
if (! item_factory)
|
||||
{
|
||||
plug_in_set_menu_sensitivity (NULL, type);
|
||||
return;
|
||||
}
|
||||
|
||||
if (gdisp)
|
||||
{
|
||||
|
@ -1092,14 +1165,11 @@ gimp_display_shell_set_menu_sensitivity (GimpDisplayShell *shell,
|
|||
|
||||
lnum = gimp_container_num_children (gimage->layers);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
gimp_context_get_foreground (gimp_get_user_context (gimp), &fg);
|
||||
gimp_context_get_background (gimp_get_user_context (gimp), &bg);
|
||||
|
||||
item_factory = GTK_ITEM_FACTORY (gimp_item_factory_from_path ("<Image>"));
|
||||
|
||||
#define SET_ACTIVE(menu,condition) \
|
||||
gimp_item_factory_set_active (item_factory, menu, (condition) != 0)
|
||||
#define SET_LABEL(menu,label) \
|
||||
|
@ -1205,7 +1275,7 @@ gimp_display_shell_set_menu_sensitivity (GimpDisplayShell *shell,
|
|||
|
||||
SET_SENSITIVE ("/View/Toggle Rulers", gdisp);
|
||||
SET_ACTIVE ("/View/Toggle Rulers",
|
||||
gdisp && GTK_WIDGET_VISIBLE (shell->origin) ? 1 : 0);
|
||||
gdisp && GTK_WIDGET_VISIBLE (shell->hrule) ? 1 : 0);
|
||||
|
||||
SET_SENSITIVE ("/View/Toggle Statusbar", gdisp);
|
||||
SET_ACTIVE ("/View/Toggle Statusbar",
|
||||
|
@ -1280,7 +1350,7 @@ gimp_display_shell_set_menu_sensitivity (GimpDisplayShell *shell,
|
|||
#undef SET_LABEL
|
||||
#undef SET_SENSITIVE
|
||||
|
||||
plug_in_set_menu_sensitivity (type);
|
||||
plug_in_set_menu_sensitivity (GIMP_ITEM_FACTORY (item_factory), type);
|
||||
}
|
||||
|
||||
GimpGuide *
|
||||
|
|
|
@ -58,6 +58,7 @@
|
|||
|
||||
#include "gui/info-window.h"
|
||||
#include "gui/plug-in-menus.h"
|
||||
#include "gui/menus.h"
|
||||
|
||||
#include "tools/tools-types.h"
|
||||
|
||||
|
@ -339,6 +340,12 @@ gimp_display_shell_destroy (GtkObject *object)
|
|||
gimp_display_shell_disconnect (shell);
|
||||
}
|
||||
|
||||
if (shell->item_factory)
|
||||
{
|
||||
g_object_unref (shell->item_factory);
|
||||
shell->item_factory = NULL;
|
||||
}
|
||||
|
||||
if (shell->select)
|
||||
{
|
||||
gimp_display_shell_selection_free (shell->select);
|
||||
|
@ -461,7 +468,21 @@ gimp_display_shell_new (GimpDisplay *gdisp,
|
|||
|
||||
shell->scale = (scaledest << 8) + scalesrc;
|
||||
|
||||
shell->item_factory = gimp_item_factory_from_path ("<Image>");
|
||||
if (config->menu_bar_per_display)
|
||||
{
|
||||
shell->item_factory =
|
||||
menus_get_new_image_factory (shell->gdisp->gimage->gimp,
|
||||
shell->gdisp,
|
||||
TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
shell->item_factory =
|
||||
menus_get_new_image_factory (shell->gdisp->gimage->gimp,
|
||||
shell->gdisp->gimage->gimp,
|
||||
FALSE);
|
||||
g_object_ref (shell->item_factory);
|
||||
}
|
||||
|
||||
/* The accelerator table for images */
|
||||
gimp_window_add_accel_group (GTK_WINDOW (shell),
|
||||
|
@ -507,8 +528,40 @@ gimp_display_shell_new (GimpDisplay *gdisp,
|
|||
/* first, set up the container hierarchy *********************************/
|
||||
|
||||
/* the vbox containing all widgets */
|
||||
main_vbox = gtk_vbox_new (FALSE, 2);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 2);
|
||||
|
||||
if (config->menu_bar_per_display)
|
||||
{
|
||||
GtkWidget *menu_bar;
|
||||
|
||||
main_vbox = gtk_vbox_new (FALSE, 0);
|
||||
|
||||
gimp_item_factory_set_visible (GTK_ITEM_FACTORY (shell->item_factory),
|
||||
"/tearoff1", FALSE);
|
||||
gimp_item_factory_set_visible (GTK_ITEM_FACTORY (shell->item_factory),
|
||||
"/filters-separator", FALSE);
|
||||
|
||||
menu_bar = GTK_ITEM_FACTORY (shell->item_factory)->widget;
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (main_vbox), menu_bar, FALSE, FALSE, 0);
|
||||
gtk_widget_show (menu_bar);
|
||||
|
||||
/* active display callback */
|
||||
g_signal_connect (G_OBJECT (menu_bar), "button_press_event",
|
||||
G_CALLBACK (gimp_display_shell_events),
|
||||
shell);
|
||||
g_signal_connect (G_OBJECT (menu_bar), "button_release_event",
|
||||
G_CALLBACK (gimp_display_shell_events),
|
||||
shell);
|
||||
g_signal_connect (G_OBJECT (menu_bar), "key_press_event",
|
||||
G_CALLBACK (gimp_display_shell_events),
|
||||
shell);
|
||||
}
|
||||
else
|
||||
{
|
||||
main_vbox = gtk_vbox_new (FALSE, 2);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 2);
|
||||
}
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (shell), main_vbox);
|
||||
|
||||
/* another vbox for everything except the statusbar */
|
||||
|
@ -516,6 +569,9 @@ gimp_display_shell_new (GimpDisplay *gdisp,
|
|||
gtk_box_pack_start (GTK_BOX (main_vbox), disp_vbox, TRUE, TRUE, 0);
|
||||
gtk_widget_show (disp_vbox);
|
||||
|
||||
if (config->menu_bar_per_display)
|
||||
gtk_container_set_border_width (GTK_CONTAINER (disp_vbox), 2);
|
||||
|
||||
/* a hbox for the inner_table and the vertical scrollbar */
|
||||
upper_hbox = gtk_hbox_new (FALSE, 1);
|
||||
gtk_box_pack_start (GTK_BOX (disp_vbox), upper_hbox, TRUE, TRUE, 0);
|
||||
|
@ -558,11 +614,11 @@ gimp_display_shell_new (GimpDisplay *gdisp,
|
|||
shell->origin = gtk_button_new ();
|
||||
GTK_WIDGET_UNSET_FLAGS (shell->origin, GTK_CAN_FOCUS);
|
||||
gtk_widget_set_events (GTK_WIDGET (shell->origin),
|
||||
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK);
|
||||
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK);
|
||||
|
||||
g_signal_connect (G_OBJECT (shell->origin), "button_press_event",
|
||||
G_CALLBACK (gimp_display_shell_origin_button_press),
|
||||
shell);
|
||||
G_CALLBACK (gimp_display_shell_origin_button_press),
|
||||
shell);
|
||||
|
||||
gimp_help_set_help_data (shell->origin, NULL, "#origin_button");
|
||||
|
||||
|
@ -571,12 +627,15 @@ gimp_display_shell_new (GimpDisplay *gdisp,
|
|||
gtk_container_add (GTK_CONTAINER (shell->origin), arrow);
|
||||
gtk_widget_show (arrow);
|
||||
|
||||
/* EEK */
|
||||
shell->canvas = gtk_drawing_area_new ();
|
||||
|
||||
/* the horizontal ruler */
|
||||
shell->hrule = gtk_hruler_new ();
|
||||
gtk_widget_set_events (GTK_WIDGET (shell->hrule),
|
||||
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK);
|
||||
|
||||
g_signal_connect_swapped (G_OBJECT (shell), "motion_notify_event",
|
||||
g_signal_connect_swapped (G_OBJECT (shell->canvas), "motion_notify_event",
|
||||
G_CALLBACK (GTK_WIDGET_GET_CLASS (shell->hrule)->motion_notify_event),
|
||||
shell->hrule);
|
||||
g_signal_connect (G_OBJECT (shell->hrule), "button_press_event",
|
||||
|
@ -590,7 +649,7 @@ gimp_display_shell_new (GimpDisplay *gdisp,
|
|||
gtk_widget_set_events (GTK_WIDGET (shell->vrule),
|
||||
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK);
|
||||
|
||||
g_signal_connect_swapped (G_OBJECT (shell), "motion_notify_event",
|
||||
g_signal_connect_swapped (G_OBJECT (shell->canvas), "motion_notify_event",
|
||||
G_CALLBACK (GTK_WIDGET_GET_CLASS (shell->vrule)->motion_notify_event),
|
||||
shell->vrule);
|
||||
g_signal_connect (G_OBJECT (shell->vrule), "button_press_event",
|
||||
|
@ -600,7 +659,6 @@ gimp_display_shell_new (GimpDisplay *gdisp,
|
|||
gimp_help_set_help_data (shell->vrule, NULL, "#ruler");
|
||||
|
||||
/* the canvas */
|
||||
shell->canvas = gtk_drawing_area_new ();
|
||||
gtk_widget_set_name (shell->canvas, "gimp-canvas");
|
||||
gtk_widget_set_size_request (shell->canvas, n_width, n_height);
|
||||
gtk_widget_set_events (shell->canvas, GIMP_DISPLAY_SHELL_CANVAS_EVENT_MASK);
|
||||
|
@ -722,7 +780,7 @@ gimp_display_shell_new (GimpDisplay *gdisp,
|
|||
|
||||
/* fill the inner_table */
|
||||
gtk_table_attach (GTK_TABLE (inner_table), shell->origin, 0, 1, 0, 1,
|
||||
GTK_FILL, GTK_FILL, 0, 0);
|
||||
GTK_FILL, GTK_FILL, 0, 0);
|
||||
gtk_table_attach (GTK_TABLE (inner_table), shell->hrule, 1, 2, 0, 1,
|
||||
GTK_EXPAND | GTK_SHRINK | GTK_FILL, GTK_FILL, 0, 0);
|
||||
gtk_table_attach (GTK_TABLE (inner_table), shell->vrule, 0, 1, 1, 2,
|
||||
|
@ -747,7 +805,9 @@ gimp_display_shell_new (GimpDisplay *gdisp,
|
|||
|
||||
if (config->show_rulers)
|
||||
{
|
||||
gtk_widget_show (shell->origin);
|
||||
if (! config->menu_bar_per_display)
|
||||
gtk_widget_show (shell->origin);
|
||||
|
||||
gtk_widget_show (shell->hrule);
|
||||
gtk_widget_show (shell->vrule);
|
||||
}
|
||||
|
@ -1056,7 +1116,20 @@ gimp_display_shell_set_menu_sensitivity (GimpDisplayShell *shell,
|
|||
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
||||
|
||||
if (shell)
|
||||
gdisp = shell->gdisp;
|
||||
{
|
||||
gdisp = shell->gdisp;
|
||||
item_factory = GTK_ITEM_FACTORY (shell->item_factory);
|
||||
}
|
||||
else
|
||||
{
|
||||
item_factory = GTK_ITEM_FACTORY (gimp_item_factory_from_path ("<Image>"));
|
||||
}
|
||||
|
||||
if (! item_factory)
|
||||
{
|
||||
plug_in_set_menu_sensitivity (NULL, type);
|
||||
return;
|
||||
}
|
||||
|
||||
if (gdisp)
|
||||
{
|
||||
|
@ -1092,14 +1165,11 @@ gimp_display_shell_set_menu_sensitivity (GimpDisplayShell *shell,
|
|||
|
||||
lnum = gimp_container_num_children (gimage->layers);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
gimp_context_get_foreground (gimp_get_user_context (gimp), &fg);
|
||||
gimp_context_get_background (gimp_get_user_context (gimp), &bg);
|
||||
|
||||
item_factory = GTK_ITEM_FACTORY (gimp_item_factory_from_path ("<Image>"));
|
||||
|
||||
#define SET_ACTIVE(menu,condition) \
|
||||
gimp_item_factory_set_active (item_factory, menu, (condition) != 0)
|
||||
#define SET_LABEL(menu,label) \
|
||||
|
@ -1205,7 +1275,7 @@ gimp_display_shell_set_menu_sensitivity (GimpDisplayShell *shell,
|
|||
|
||||
SET_SENSITIVE ("/View/Toggle Rulers", gdisp);
|
||||
SET_ACTIVE ("/View/Toggle Rulers",
|
||||
gdisp && GTK_WIDGET_VISIBLE (shell->origin) ? 1 : 0);
|
||||
gdisp && GTK_WIDGET_VISIBLE (shell->hrule) ? 1 : 0);
|
||||
|
||||
SET_SENSITIVE ("/View/Toggle Statusbar", gdisp);
|
||||
SET_ACTIVE ("/View/Toggle Statusbar",
|
||||
|
@ -1280,7 +1350,7 @@ gimp_display_shell_set_menu_sensitivity (GimpDisplayShell *shell,
|
|||
#undef SET_LABEL
|
||||
#undef SET_SENSITIVE
|
||||
|
||||
plug_in_set_menu_sensitivity (type);
|
||||
plug_in_set_menu_sensitivity (GIMP_ITEM_FACTORY (item_factory), type);
|
||||
}
|
||||
|
||||
GimpGuide *
|
||||
|
|
|
@ -40,6 +40,8 @@
|
|||
#include "widgets/gimpviewabledialog.h"
|
||||
#include "widgets/gimpwidgets-utils.h"
|
||||
|
||||
#include "display/gimpdisplay.h"
|
||||
|
||||
#include "channels-commands.h"
|
||||
|
||||
#include "undo.h"
|
||||
|
@ -55,15 +57,19 @@ static void channels_color_changed (GimpColorButton *button,
|
|||
gpointer data);
|
||||
|
||||
|
||||
#define return_if_no_image(gimage) \
|
||||
#define return_if_no_image(gimage,data) \
|
||||
gimage = (GimpImage *) gimp_widget_get_callback_context (widget); \
|
||||
if (! GIMP_IS_IMAGE (gimage)) \
|
||||
gimage = gimp_context_get_image (gimp_get_user_context (GIMP (data))); \
|
||||
if (! GIMP_IS_IMAGE (gimage)) { \
|
||||
if (GIMP_IS_DISPLAY (data)) \
|
||||
gimage = ((GimpDisplay *) data)->gimage; \
|
||||
else if (GIMP_IS_GIMP (data)) \
|
||||
gimage = gimp_context_get_image (gimp_get_user_context (GIMP (data))); \
|
||||
} \
|
||||
if (! gimage) \
|
||||
return
|
||||
|
||||
#define return_if_no_channel(gimage,channel) \
|
||||
return_if_no_image (gimage); \
|
||||
#define return_if_no_channel(gimage,channel,data) \
|
||||
return_if_no_image (gimage,data); \
|
||||
channel = gimp_image_get_active_channel (gimage); \
|
||||
if (! channel) \
|
||||
return
|
||||
|
@ -76,7 +82,7 @@ channels_new_channel_cmd_callback (GtkWidget *widget,
|
|||
gpointer data)
|
||||
{
|
||||
GimpImage *gimage;
|
||||
return_if_no_image (gimage);
|
||||
return_if_no_image (gimage, data);
|
||||
|
||||
channels_new_channel_query (gimage, NULL, TRUE);
|
||||
}
|
||||
|
@ -87,7 +93,7 @@ channels_raise_channel_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GimpImage *gimage;
|
||||
GimpChannel *active_channel;
|
||||
return_if_no_channel (gimage, active_channel);
|
||||
return_if_no_channel (gimage, active_channel, data);
|
||||
|
||||
gimp_image_raise_channel (gimage, active_channel);
|
||||
gimp_image_flush (gimage);
|
||||
|
@ -99,7 +105,7 @@ channels_lower_channel_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GimpImage *gimage;
|
||||
GimpChannel *active_channel;
|
||||
return_if_no_channel (gimage, active_channel);
|
||||
return_if_no_channel (gimage, active_channel, data);
|
||||
|
||||
gimp_image_lower_channel (gimage, active_channel);
|
||||
gimp_image_flush (gimage);
|
||||
|
@ -112,7 +118,7 @@ channels_duplicate_channel_cmd_callback (GtkWidget *widget,
|
|||
GimpImage *gimage;
|
||||
GimpChannel *active_channel;
|
||||
GimpChannel *new_channel;
|
||||
return_if_no_channel (gimage, active_channel);
|
||||
return_if_no_channel (gimage, active_channel, data);
|
||||
|
||||
new_channel = gimp_channel_copy (active_channel,
|
||||
G_TYPE_FROM_INSTANCE (active_channel),
|
||||
|
@ -127,7 +133,7 @@ channels_delete_channel_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GimpImage *gimage;
|
||||
GimpChannel *active_channel;
|
||||
return_if_no_channel (gimage, active_channel);
|
||||
return_if_no_channel (gimage, active_channel, data);
|
||||
|
||||
gimp_image_remove_channel (gimage, active_channel);
|
||||
gimp_image_flush (gimage);
|
||||
|
@ -140,7 +146,7 @@ channels_channel_to_sel (GtkWidget *widget,
|
|||
{
|
||||
GimpImage *gimage;
|
||||
GimpChannel *active_channel;
|
||||
return_if_no_channel (gimage, active_channel);
|
||||
return_if_no_channel (gimage, active_channel, data);
|
||||
|
||||
gimp_image_mask_select_channel (gimage,
|
||||
active_channel,
|
||||
|
@ -184,7 +190,7 @@ channels_edit_channel_attributes_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GimpImage *gimage;
|
||||
GimpChannel *active_channel;
|
||||
return_if_no_channel (gimage, active_channel);
|
||||
return_if_no_channel (gimage, active_channel, data);
|
||||
|
||||
channels_edit_channel_query (active_channel);
|
||||
}
|
||||
|
|
|
@ -201,7 +201,7 @@ dialogs_toggle_view_cmd_callback (GtkWidget *widget,
|
|||
identifier,
|
||||
preview_size);
|
||||
|
||||
/* Maybe gimp_dialog_factory_dockable_new() returned
|
||||
/* Maybe gimp_dialog_factory_dockable_new() returned
|
||||
* an already existing singleton dockable, so check
|
||||
* if it already is attached to a dockbook.
|
||||
*/
|
||||
|
@ -255,9 +255,7 @@ dialogs_preview_size_cmd_callback (GtkWidget *widget,
|
|||
view = gimp_container_view_get_by_dockable (dockable);
|
||||
|
||||
if (view)
|
||||
{
|
||||
gimp_container_view_set_preview_size (view, preview_size);
|
||||
}
|
||||
gimp_container_view_set_preview_size (view, preview_size);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -80,7 +80,6 @@
|
|||
#include "error-console-dialog.h"
|
||||
#include "gradients-commands.h"
|
||||
#include "layers-commands.h"
|
||||
#include "menus.h"
|
||||
#include "module-browser.h"
|
||||
#include "palettes-commands.h"
|
||||
#include "paths-dialog.h"
|
||||
|
|
|
@ -37,21 +37,27 @@
|
|||
#include "widgets/gimpitemfactory.h"
|
||||
#include "widgets/gimpwidgets-utils.h"
|
||||
|
||||
#include "display/gimpdisplay.h"
|
||||
|
||||
#include "drawable-commands.h"
|
||||
#include "offset-dialog.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
||||
#define return_if_no_image(gimage) \
|
||||
#define return_if_no_image(gimage,data) \
|
||||
gimage = (GimpImage *) gimp_widget_get_callback_context (widget); \
|
||||
if (! GIMP_IS_IMAGE (gimage)) \
|
||||
gimage = gimp_context_get_image (gimp_get_user_context (GIMP (data))); \
|
||||
if (! GIMP_IS_IMAGE (gimage)) { \
|
||||
if (GIMP_IS_DISPLAY (data)) \
|
||||
gimage = ((GimpDisplay *) data)->gimage; \
|
||||
else if (GIMP_IS_GIMP (data)) \
|
||||
gimage = gimp_context_get_image (gimp_get_user_context (GIMP (data))); \
|
||||
} \
|
||||
if (! gimage) \
|
||||
return
|
||||
|
||||
#define return_if_no_drawable(gimage,drawable) \
|
||||
return_if_no_image (gimage); \
|
||||
#define return_if_no_drawable(gimage,drawable,data) \
|
||||
return_if_no_image (gimage,data); \
|
||||
drawable = gimp_image_active_drawable (gimage); \
|
||||
if (! drawable) \
|
||||
return
|
||||
|
@ -65,7 +71,7 @@ drawable_desaturate_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GimpImage *gimage;
|
||||
GimpDrawable *active_drawable;
|
||||
return_if_no_drawable (gimage, active_drawable);
|
||||
return_if_no_drawable (gimage, active_drawable, data);
|
||||
|
||||
if (! gimp_drawable_is_rgb (active_drawable))
|
||||
{
|
||||
|
@ -83,7 +89,7 @@ drawable_invert_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GimpImage *gimage;
|
||||
GimpDrawable *active_drawable;
|
||||
return_if_no_drawable (gimage, active_drawable);
|
||||
return_if_no_drawable (gimage, active_drawable, data);
|
||||
|
||||
if (gimp_drawable_is_indexed (active_drawable))
|
||||
{
|
||||
|
@ -101,7 +107,7 @@ drawable_equalize_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GimpImage *gimage;
|
||||
GimpDrawable *active_drawable;
|
||||
return_if_no_drawable (gimage, active_drawable);
|
||||
return_if_no_drawable (gimage, active_drawable, data);
|
||||
|
||||
if (gimp_drawable_is_indexed (active_drawable))
|
||||
{
|
||||
|
@ -119,7 +125,7 @@ drawable_offset_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GimpImage *gimage;
|
||||
GimpDrawable *active_drawable;
|
||||
return_if_no_drawable (gimage, active_drawable);
|
||||
return_if_no_drawable (gimage, active_drawable, data);
|
||||
|
||||
offset_dialog_create (active_drawable);
|
||||
}
|
||||
|
|
|
@ -50,12 +50,22 @@
|
|||
|
||||
|
||||
#define return_if_no_display(gdisp,data) \
|
||||
gdisp = gimp_context_get_display (gimp_get_user_context (GIMP (data))); \
|
||||
if (GIMP_IS_DISPLAY (data)) \
|
||||
gdisp = data; \
|
||||
else if (GIMP_IS_GIMP (data)) \
|
||||
gdisp = gimp_context_get_display (gimp_get_user_context (GIMP (data))); \
|
||||
else \
|
||||
gdisp = NULL; \
|
||||
if (! gdisp) \
|
||||
return
|
||||
|
||||
#define return_if_no_image(gimage,data) \
|
||||
gimage = gimp_context_get_image (gimp_get_user_context (GIMP (data))); \
|
||||
if (GIMP_IS_DISPLAY (data)) \
|
||||
gimage = ((GimpDisplay *) data)->gimage; \
|
||||
else if (GIMP_IS_GIMP (data)) \
|
||||
gimage = gimp_context_get_image (gimp_get_user_context (GIMP (data))); \
|
||||
else \
|
||||
gimage = NULL; \
|
||||
if (! gimage) \
|
||||
return
|
||||
|
||||
|
|
|
@ -52,9 +52,27 @@
|
|||
|
||||
#define REVERT_DATA_KEY "revert-confirm-dialog"
|
||||
|
||||
|
||||
#define return_if_no_gimp(gimp,data) \
|
||||
if (GIMP_IS_DISPLAY (data)) \
|
||||
gimp = ((GimpDisplay *) data)->gimage->gimp; \
|
||||
else if (GIMP_IS_GIMP (data)) \
|
||||
gimp = data; \
|
||||
else \
|
||||
gimp = NULL; \
|
||||
if (! gimp) \
|
||||
return
|
||||
|
||||
|
||||
#define return_if_no_display(gdisp,data) \
|
||||
gdisp = gimp_context_get_display (gimp_get_user_context (GIMP (data))); \
|
||||
if (!gdisp) return
|
||||
if (GIMP_IS_DISPLAY (data)) \
|
||||
gdisp = data; \
|
||||
else if (GIMP_IS_GIMP (data)) \
|
||||
gdisp = gimp_context_get_display (gimp_get_user_context (GIMP (data))); \
|
||||
else \
|
||||
gdisp = NULL; \
|
||||
if (! gdisp) \
|
||||
return
|
||||
|
||||
|
||||
/* local function prototypes */
|
||||
|
@ -72,13 +90,14 @@ file_new_cmd_callback (GtkWidget *widget,
|
|||
guint action)
|
||||
{
|
||||
Gimp *gimp;
|
||||
GimpImage *gimage = NULL;
|
||||
|
||||
gimp = GIMP (data);
|
||||
GimpImage *gimage;
|
||||
return_if_no_gimp (gimp, data);
|
||||
|
||||
/* if called from the image menu */
|
||||
if (action)
|
||||
gimage = gimp_context_get_image (gimp_get_user_context (gimp));
|
||||
else
|
||||
gimage = NULL;
|
||||
|
||||
file_new_dialog_create (gimp, gimage);
|
||||
}
|
||||
|
@ -97,13 +116,14 @@ file_open_cmd_callback (GtkWidget *widget,
|
|||
guint action)
|
||||
{
|
||||
Gimp *gimp;
|
||||
GimpImage *gimage = NULL;
|
||||
|
||||
gimp = GIMP (data);
|
||||
GimpImage *gimage;
|
||||
return_if_no_gimp (gimp, data);
|
||||
|
||||
/* if called from the image menu */
|
||||
if (action)
|
||||
gimage = gimp_context_get_image (gimp_get_user_context (gimp));
|
||||
else
|
||||
gimage = NULL;
|
||||
|
||||
file_open_dialog_show (gimp, gimage, NULL);
|
||||
}
|
||||
|
@ -116,8 +136,7 @@ file_last_opened_cmd_callback (GtkWidget *widget,
|
|||
Gimp *gimp;
|
||||
GimpImagefile *imagefile;
|
||||
guint num_entries;
|
||||
|
||||
gimp = GIMP (data);
|
||||
return_if_no_gimp (gimp, data);
|
||||
|
||||
num_entries = gimp_container_num_children (gimp->documents);
|
||||
|
||||
|
@ -218,7 +237,6 @@ file_revert_cmd_callback (GtkWidget *widget,
|
|||
GimpDisplay *gdisp;
|
||||
GtkWidget *query_box;
|
||||
const gchar *uri;
|
||||
|
||||
return_if_no_display (gdisp, data);
|
||||
|
||||
uri = gimp_object_get_name (GIMP_OBJECT (gdisp->gimage));
|
||||
|
@ -285,7 +303,10 @@ file_quit_cmd_callback (GtkWidget *widget,
|
|||
gpointer data,
|
||||
guint action)
|
||||
{
|
||||
gimp_exit (GIMP (data), FALSE);
|
||||
Gimp *gimp;
|
||||
return_if_no_gimp (gimp, data);
|
||||
|
||||
gimp_exit (gimp, FALSE);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -110,16 +110,12 @@ file_dialog_new (Gimp *gimp,
|
|||
void
|
||||
file_dialog_show (GtkWidget *filesel)
|
||||
{
|
||||
GtkItemFactory *item_factory;
|
||||
gimp_item_factories_set_sensitive ("<Toolbox>", "/File/Open...", FALSE);
|
||||
|
||||
item_factory = GTK_ITEM_FACTORY (gimp_item_factory_from_path ("<Toolbox>"));
|
||||
gimp_item_factory_set_sensitive (item_factory, "/File/Open...", FALSE);
|
||||
|
||||
item_factory = GTK_ITEM_FACTORY (gimp_item_factory_from_path ("<Image>"));
|
||||
gimp_item_factory_set_sensitive (item_factory, "/File/Open...", FALSE);
|
||||
gimp_item_factory_set_sensitive (item_factory, "/File/Save", FALSE);
|
||||
gimp_item_factory_set_sensitive (item_factory, "/File/Save as...", FALSE);
|
||||
gimp_item_factory_set_sensitive (item_factory, "/File/Save a Copy...", FALSE);
|
||||
gimp_item_factories_set_sensitive ("<Image>", "/File/Open...", FALSE);
|
||||
gimp_item_factories_set_sensitive ("<Image>", "/File/Save", FALSE);
|
||||
gimp_item_factories_set_sensitive ("<Image>", "/File/Save as...", FALSE);
|
||||
gimp_item_factories_set_sensitive ("<Image>", "/File/Save a Copy...", FALSE);
|
||||
|
||||
gtk_widget_grab_focus (GTK_FILE_SELECTION (filesel)->selection_entry);
|
||||
gtk_widget_show (filesel);
|
||||
|
@ -128,18 +124,14 @@ file_dialog_show (GtkWidget *filesel)
|
|||
gboolean
|
||||
file_dialog_hide (GtkWidget *filesel)
|
||||
{
|
||||
GtkItemFactory *item_factory;
|
||||
|
||||
gtk_widget_hide (filesel);
|
||||
|
||||
item_factory = GTK_ITEM_FACTORY (gimp_item_factory_from_path ("<Toolbox>"));
|
||||
gimp_item_factory_set_sensitive (item_factory, "/File/Open...", TRUE);
|
||||
gimp_item_factories_set_sensitive ("<Toolbox>", "/File/Open...", TRUE);
|
||||
|
||||
item_factory = GTK_ITEM_FACTORY (gimp_item_factory_from_path ("<Image>"));
|
||||
gimp_item_factory_set_sensitive (item_factory, "/File/Open...", TRUE);
|
||||
gimp_item_factory_set_sensitive (item_factory, "/File/Save", TRUE);
|
||||
gimp_item_factory_set_sensitive (item_factory, "/File/Save as...", TRUE);
|
||||
gimp_item_factory_set_sensitive (item_factory, "/File/Save a Copy...", TRUE);
|
||||
gimp_item_factories_set_sensitive ("<Image>", "/File/Open...", TRUE);
|
||||
gimp_item_factories_set_sensitive ("<Image>", "/File/Save", TRUE);
|
||||
gimp_item_factories_set_sensitive ("<Image>", "/File/Save as...", TRUE);
|
||||
gimp_item_factories_set_sensitive ("<Image>", "/File/Save a Copy...", TRUE);
|
||||
|
||||
/* return TRUE because we are used as "delete_event" handler */
|
||||
return TRUE;
|
||||
|
|
|
@ -511,14 +511,10 @@ gui_exit_callback (Gimp *gimp,
|
|||
|
||||
if (! kill_it && gimp_displays_dirty (gimp))
|
||||
{
|
||||
GtkItemFactory *item_factory;
|
||||
GtkWidget *dialog;
|
||||
GtkWidget *dialog;
|
||||
|
||||
item_factory = GTK_ITEM_FACTORY (gimp_item_factory_from_path ("<Toolbox>"));
|
||||
gimp_item_factory_set_sensitive (item_factory, "/File/Quit", FALSE);
|
||||
|
||||
item_factory = GTK_ITEM_FACTORY (gimp_item_factory_from_path ("<Image>"));
|
||||
gimp_item_factory_set_sensitive (item_factory, "/File/Quit", FALSE);
|
||||
gimp_item_factories_set_sensitive ("<Toolbox>", "/File/Quit", FALSE);
|
||||
gimp_item_factories_set_sensitive ("<Image>", "/File/Quit", FALSE);
|
||||
|
||||
dialog = gimp_query_boolean_box (_("Quit The GIMP?"),
|
||||
gimp_standard_help_func,
|
||||
|
@ -596,13 +592,8 @@ gui_really_quit_callback (GtkWidget *button,
|
|||
}
|
||||
else
|
||||
{
|
||||
GtkItemFactory *item_factory;
|
||||
|
||||
item_factory = GTK_ITEM_FACTORY (gimp_item_factory_from_path ("<Toolbox>"));
|
||||
gimp_item_factory_set_sensitive (item_factory, "/File/Quit", TRUE);
|
||||
|
||||
item_factory = GTK_ITEM_FACTORY (gimp_item_factory_from_path ("<Image>"));
|
||||
gimp_item_factory_set_sensitive (item_factory, "/File/Quit", TRUE);
|
||||
gimp_item_factories_set_sensitive ("<Toolbox>", "/File/Quit", TRUE);
|
||||
gimp_item_factories_set_sensitive ("<Image>", "/File/Quit", TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -58,12 +58,22 @@ typedef struct
|
|||
|
||||
|
||||
#define return_if_no_display(gdisp,data) \
|
||||
gdisp = gimp_context_get_display (gimp_get_user_context (GIMP (data))); \
|
||||
if (GIMP_IS_DISPLAY (data)) \
|
||||
gdisp = data; \
|
||||
else if (GIMP_IS_GIMP (data)) \
|
||||
gdisp = gimp_context_get_display (gimp_get_user_context (GIMP (data))); \
|
||||
else \
|
||||
gdisp = NULL; \
|
||||
if (! gdisp) \
|
||||
return
|
||||
|
||||
#define return_if_no_image(gimage,data) \
|
||||
gimage = gimp_context_get_image (gimp_get_user_context (GIMP (data))); \
|
||||
if (GIMP_IS_DISPLAY (data)) \
|
||||
gimage = ((GimpDisplay *) data)->gimage; \
|
||||
else if (GIMP_IS_GIMP (data)) \
|
||||
gimage = gimp_context_get_image (gimp_get_user_context (GIMP (data))); \
|
||||
else \
|
||||
gimage = NULL; \
|
||||
if (! gimage) \
|
||||
return
|
||||
|
||||
|
|
|
@ -45,6 +45,8 @@
|
|||
#include "widgets/gimpviewabledialog.h"
|
||||
#include "widgets/gimpwidgets-utils.h"
|
||||
|
||||
#include "display/gimpdisplay.h"
|
||||
|
||||
#include "layers-commands.h"
|
||||
#include "resize-dialog.h"
|
||||
|
||||
|
@ -62,15 +64,19 @@ static void layers_resize_layer_query (GimpImage *gimage,
|
|||
GimpLayer *layer);
|
||||
|
||||
|
||||
#define return_if_no_image(gimage) \
|
||||
#define return_if_no_image(gimage,data) \
|
||||
gimage = (GimpImage *) gimp_widget_get_callback_context (widget); \
|
||||
if (! GIMP_IS_IMAGE (gimage)) \
|
||||
gimage = gimp_context_get_image (gimp_get_user_context (GIMP (data))); \
|
||||
if (! GIMP_IS_IMAGE (gimage)) { \
|
||||
if (GIMP_IS_DISPLAY (data)) \
|
||||
gimage = ((GimpDisplay *) data)->gimage; \
|
||||
else if (GIMP_IS_GIMP (data)) \
|
||||
gimage = gimp_context_get_image (gimp_get_user_context (GIMP (data))); \
|
||||
} \
|
||||
if (! gimage) \
|
||||
return
|
||||
|
||||
#define return_if_no_layer(gimage,layer) \
|
||||
return_if_no_image (gimage); \
|
||||
#define return_if_no_layer(gimage,layer,data) \
|
||||
return_if_no_image (gimage,data); \
|
||||
layer = gimp_image_get_active_layer (gimage); \
|
||||
if (! layer) \
|
||||
return
|
||||
|
@ -85,7 +91,7 @@ layers_previous_cmd_callback (GtkWidget *widget,
|
|||
GimpImage *gimage;
|
||||
GimpLayer *new_layer;
|
||||
gint current_layer;
|
||||
return_if_no_image (gimage);
|
||||
return_if_no_image (gimage, data);
|
||||
|
||||
current_layer =
|
||||
gimp_image_get_layer_index (gimage, gimp_image_get_active_layer (gimage));
|
||||
|
@ -110,7 +116,7 @@ layers_next_cmd_callback (GtkWidget *widget,
|
|||
GimpImage *gimage;
|
||||
GimpLayer *new_layer;
|
||||
gint current_layer;
|
||||
return_if_no_image (gimage);
|
||||
return_if_no_image (gimage, data);
|
||||
|
||||
current_layer =
|
||||
gimp_image_get_layer_index (gimage, gimp_image_get_active_layer (gimage));
|
||||
|
@ -132,7 +138,7 @@ layers_raise_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GimpImage *gimage;
|
||||
GimpLayer *active_layer;
|
||||
return_if_no_layer (gimage,active_layer);
|
||||
return_if_no_layer (gimage, active_layer, data);
|
||||
|
||||
gimp_image_raise_layer (gimage, active_layer);
|
||||
gimp_image_flush (gimage);
|
||||
|
@ -144,7 +150,7 @@ layers_lower_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GimpImage *gimage;
|
||||
GimpLayer *active_layer;
|
||||
return_if_no_layer (gimage,active_layer);
|
||||
return_if_no_layer (gimage, active_layer, data);
|
||||
|
||||
gimp_image_lower_layer (gimage, active_layer);
|
||||
gimp_image_flush (gimage);
|
||||
|
@ -156,7 +162,7 @@ layers_raise_to_top_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GimpImage *gimage;
|
||||
GimpLayer *active_layer;
|
||||
return_if_no_layer (gimage,active_layer);
|
||||
return_if_no_layer (gimage, active_layer, data);
|
||||
|
||||
gimp_image_raise_layer_to_top (gimage, active_layer);
|
||||
gimp_image_flush (gimage);
|
||||
|
@ -168,7 +174,7 @@ layers_lower_to_bottom_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GimpImage *gimage;
|
||||
GimpLayer *active_layer;
|
||||
return_if_no_layer (gimage, active_layer);
|
||||
return_if_no_layer (gimage, active_layer, data);
|
||||
|
||||
gimp_image_lower_layer_to_bottom (gimage, active_layer);
|
||||
gimp_image_flush (gimage);
|
||||
|
@ -179,7 +185,7 @@ layers_new_cmd_callback (GtkWidget *widget,
|
|||
gpointer data)
|
||||
{
|
||||
GimpImage *gimage;
|
||||
return_if_no_image (gimage);
|
||||
return_if_no_image (gimage, data);
|
||||
|
||||
layers_new_layer_query (gimage, NULL, TRUE);
|
||||
}
|
||||
|
@ -191,7 +197,7 @@ layers_duplicate_cmd_callback (GtkWidget *widget,
|
|||
GimpImage *gimage;
|
||||
GimpLayer *active_layer;
|
||||
GimpLayer *new_layer;
|
||||
return_if_no_layer (gimage, active_layer);
|
||||
return_if_no_layer (gimage, active_layer, data);
|
||||
|
||||
new_layer = gimp_layer_copy (active_layer,
|
||||
G_TYPE_FROM_INSTANCE (active_layer),
|
||||
|
@ -207,7 +213,7 @@ layers_anchor_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GimpImage *gimage;
|
||||
GimpLayer *active_layer;
|
||||
return_if_no_layer (gimage, active_layer);
|
||||
return_if_no_layer (gimage, active_layer, data);
|
||||
|
||||
layers_anchor_layer (active_layer);
|
||||
}
|
||||
|
@ -218,7 +224,7 @@ layers_merge_down_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GimpImage *gimage;
|
||||
GimpLayer *active_layer;
|
||||
return_if_no_layer (gimage, active_layer);
|
||||
return_if_no_layer (gimage, active_layer, data);
|
||||
|
||||
gimp_image_merge_down (gimage, active_layer, GIMP_EXPAND_AS_NECESSARY);
|
||||
gimp_image_flush (gimage);
|
||||
|
@ -230,7 +236,7 @@ layers_delete_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GimpImage *gimage;
|
||||
GimpLayer *active_layer;
|
||||
return_if_no_layer (gimage, active_layer);
|
||||
return_if_no_layer (gimage, active_layer, data);
|
||||
|
||||
if (gimp_layer_is_floating_sel (active_layer))
|
||||
floating_sel_remove (active_layer);
|
||||
|
@ -246,7 +252,7 @@ layers_resize_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GimpImage *gimage;
|
||||
GimpLayer *active_layer;
|
||||
return_if_no_layer (gimage, active_layer);
|
||||
return_if_no_layer (gimage, active_layer, data);
|
||||
|
||||
layers_resize_layer_query (gimage, active_layer);
|
||||
}
|
||||
|
@ -257,7 +263,7 @@ layers_resize_to_image_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GimpImage *gimage;
|
||||
GimpLayer *active_layer;
|
||||
return_if_no_layer (gimage, active_layer);
|
||||
return_if_no_layer (gimage, active_layer, data);
|
||||
|
||||
gimp_layer_resize_to_image (active_layer);
|
||||
gimp_image_flush (gimage);
|
||||
|
@ -269,7 +275,7 @@ layers_scale_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GimpImage *gimage;
|
||||
GimpLayer *active_layer;
|
||||
return_if_no_layer (gimage, active_layer);
|
||||
return_if_no_layer (gimage, active_layer, data);
|
||||
|
||||
layers_scale_layer_query (gimage, active_layer);
|
||||
}
|
||||
|
@ -282,7 +288,7 @@ layers_crop_cmd_callback (GtkWidget *widget,
|
|||
GimpLayer *active_layer;
|
||||
gint x1, y1, x2, y2;
|
||||
gint off_x, off_y;
|
||||
return_if_no_layer (gimage, active_layer);
|
||||
return_if_no_layer (gimage, active_layer, data);
|
||||
|
||||
if (! gimp_image_mask_bounds (gimage, &x1, &y1, &x2, &y2))
|
||||
{
|
||||
|
@ -316,7 +322,7 @@ layers_add_layer_mask_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GimpImage *gimage;
|
||||
GimpLayer *active_layer;
|
||||
return_if_no_layer (gimage, active_layer);
|
||||
return_if_no_layer (gimage, active_layer, data);
|
||||
|
||||
layers_add_mask_query (active_layer);
|
||||
}
|
||||
|
@ -327,7 +333,7 @@ layers_apply_layer_mask_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GimpImage *gimage;
|
||||
GimpLayer *active_layer;
|
||||
return_if_no_layer (gimage, active_layer);
|
||||
return_if_no_layer (gimage, active_layer, data);
|
||||
|
||||
if (gimp_layer_get_mask (active_layer))
|
||||
{
|
||||
|
@ -348,7 +354,7 @@ layers_delete_layer_mask_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GimpImage *gimage;
|
||||
GimpLayer *active_layer;
|
||||
return_if_no_layer (gimage, active_layer);
|
||||
return_if_no_layer (gimage, active_layer, data);
|
||||
|
||||
if (gimp_layer_get_mask (active_layer))
|
||||
{
|
||||
|
@ -369,7 +375,7 @@ layers_mask_select_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GimpImage *gimage;
|
||||
GimpLayer *active_layer;
|
||||
return_if_no_layer (gimage, active_layer);
|
||||
return_if_no_layer (gimage, active_layer, data);
|
||||
|
||||
if (gimp_layer_get_mask (active_layer))
|
||||
{
|
||||
|
@ -384,7 +390,7 @@ layers_alpha_select_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GimpImage *gimage;
|
||||
GimpLayer *active_layer;
|
||||
return_if_no_layer (gimage, active_layer);
|
||||
return_if_no_layer (gimage, active_layer, data);
|
||||
|
||||
gimp_image_mask_layer_alpha (gimage, active_layer);
|
||||
gimp_image_flush (gimage);
|
||||
|
@ -396,7 +402,7 @@ layers_add_alpha_channel_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GimpImage *gimage;
|
||||
GimpLayer *active_layer;
|
||||
return_if_no_layer (gimage, active_layer);
|
||||
return_if_no_layer (gimage, active_layer, data);
|
||||
|
||||
if (! gimp_drawable_has_alpha (GIMP_DRAWABLE (active_layer)))
|
||||
{
|
||||
|
@ -411,7 +417,7 @@ layers_edit_attributes_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GimpImage *gimage;
|
||||
GimpLayer *active_layer;
|
||||
return_if_no_layer (gimage, active_layer);
|
||||
return_if_no_layer (gimage, active_layer, data);
|
||||
|
||||
layers_edit_layer_query (active_layer);
|
||||
}
|
||||
|
|
592
app/gui/menus.c
592
app/gui/menus.c
|
@ -38,6 +38,8 @@
|
|||
|
||||
#include "file/file-utils.h"
|
||||
|
||||
#include "plug-in/plug-ins.h"
|
||||
|
||||
#include "widgets/gimpitemfactory.h"
|
||||
|
||||
#include "brushes-commands.h"
|
||||
|
@ -62,6 +64,7 @@
|
|||
#include "paths-dialog.h"
|
||||
#include "patterns-commands.h"
|
||||
#include "plug-in-commands.h"
|
||||
#include "plug-in-menus.h"
|
||||
#include "qmask-commands.h"
|
||||
#include "select-commands.h"
|
||||
#include "test-commands.h"
|
||||
|
@ -86,8 +89,11 @@ static void menus_last_opened_reorder (GimpContainer *container,
|
|||
GimpImagefile *unused1,
|
||||
gint unused2,
|
||||
GimpItemFactory *item_factory);
|
||||
static void menus_color_changed (GimpContext *context,
|
||||
const GimpRGB *unused,
|
||||
static void menus_foreground_changed (GimpContext *context,
|
||||
const GimpRGB *color,
|
||||
GimpItemFactory *item_factory);
|
||||
static void menus_background_changed (GimpContext *context,
|
||||
const GimpRGB *color,
|
||||
GimpItemFactory *item_factory);
|
||||
static void menus_filters_subdirs_to_top (GtkMenu *menu);
|
||||
#ifdef ENABLE_DEBUG_ENTRIES
|
||||
|
@ -1001,7 +1007,7 @@ static GimpItemFactoryEntry image_entries[] =
|
|||
"gimp-error-console",
|
||||
"dialogs/error_console.html", NULL },
|
||||
|
||||
SEPARATOR ("/---"),
|
||||
SEPARATOR ("/filters-separator"),
|
||||
|
||||
/* <Image>/Filters */
|
||||
|
||||
|
@ -2056,11 +2062,288 @@ static GList *all_factories = NULL;
|
|||
|
||||
/* public functions */
|
||||
|
||||
GimpItemFactory *
|
||||
menus_get_new_image_factory (Gimp *gimp,
|
||||
gpointer callback_data,
|
||||
gboolean menu_bar)
|
||||
{
|
||||
GimpItemFactory *image_factory;
|
||||
|
||||
if (! GIMP_DISPLAY_CONFIG (gimp->config)->menu_bar_per_display)
|
||||
{
|
||||
image_factory = gimp_item_factory_from_path ("<Image>");
|
||||
|
||||
if (image_factory)
|
||||
return image_factory;
|
||||
}
|
||||
|
||||
image_factory = gimp_item_factory_new (gimp,
|
||||
menu_bar ?
|
||||
GTK_TYPE_MENU_BAR : GTK_TYPE_MENU,
|
||||
"<Image>", "image",
|
||||
NULL,
|
||||
G_N_ELEMENTS (image_entries),
|
||||
image_entries,
|
||||
callback_data,
|
||||
TRUE);
|
||||
menus_last_opened_add (image_factory, gimp);
|
||||
|
||||
/* create tool menu items */
|
||||
{
|
||||
static const gchar *color_tools[] = { "gimp-color-balance-tool",
|
||||
"gimp-hue-saturation-tool",
|
||||
"gimp-brightness-contrast-tool",
|
||||
"gimp-threshold-tool",
|
||||
"gimp-levels-tool",
|
||||
"gimp-curves-tool" };
|
||||
GtkWidget *menu_item;
|
||||
GimpToolInfo *tool_info;
|
||||
GList *list;
|
||||
gint i;
|
||||
|
||||
for (list = GIMP_LIST (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;
|
||||
|
||||
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 = "<StockItem>";
|
||||
entry.entry.extra_data = tool_info->stock_id;
|
||||
entry.quark_string = NULL;
|
||||
entry.help_page = tool_info->help_data;
|
||||
entry.description = NULL;
|
||||
|
||||
gimp_item_factory_create_item (image_factory,
|
||||
&entry,
|
||||
NULL,
|
||||
tool_info, 2,
|
||||
TRUE, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
/* reorder <Image>/Image/Colors */
|
||||
tool_info = (GimpToolInfo *)
|
||||
gimp_container_get_child_by_name (gimp->tool_info_list,
|
||||
"gimp-posterize-tool");
|
||||
|
||||
menu_item = gtk_item_factory_get_widget (GTK_ITEM_FACTORY (image_factory),
|
||||
tool_info->menu_path);
|
||||
if (menu_item && menu_item->parent)
|
||||
gtk_menu_reorder_child (GTK_MENU (menu_item->parent), menu_item, 4);
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (color_tools); i++)
|
||||
{
|
||||
tool_info = (GimpToolInfo *)
|
||||
gimp_container_get_child_by_name (gimp->tool_info_list,
|
||||
color_tools[i]);
|
||||
|
||||
menu_item = gtk_item_factory_get_widget (GTK_ITEM_FACTORY (image_factory),
|
||||
tool_info->menu_path);
|
||||
if (menu_item && menu_item->parent)
|
||||
{
|
||||
gtk_menu_reorder_child (GTK_MENU (menu_item->parent),
|
||||
menu_item, i + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
GimpContext *user_context;
|
||||
GimpRGB fg;
|
||||
GimpRGB bg;
|
||||
|
||||
user_context = gimp_get_user_context (gimp);
|
||||
|
||||
g_signal_connect_object (G_OBJECT (user_context), "foreground_changed",
|
||||
G_CALLBACK (menus_foreground_changed),
|
||||
image_factory, 0);
|
||||
g_signal_connect_object (G_OBJECT (user_context), "background_changed",
|
||||
G_CALLBACK (menus_background_changed),
|
||||
image_factory, 0);
|
||||
|
||||
gimp_context_get_foreground (user_context, &fg);
|
||||
gimp_context_get_background (user_context, &bg);
|
||||
|
||||
menus_foreground_changed (user_context, &fg, image_factory);
|
||||
menus_background_changed (user_context, &bg, image_factory);
|
||||
}
|
||||
|
||||
plug_in_make_menu (image_factory, proc_defs);
|
||||
|
||||
{
|
||||
static gchar *rotate_plugins[] = { "Rotate 90 degrees",
|
||||
"Rotate 180 degrees",
|
||||
"Rotate 270 degrees" };
|
||||
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 "<Image>/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 (image_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 Rotate plugin menu entries */
|
||||
pos = 1;
|
||||
for (i = 0; i < G_N_ELEMENTS (rotate_plugins); i++)
|
||||
{
|
||||
path = g_strconcat ("/Image/Transform/", rotate_plugins[i], NULL);
|
||||
menu_item = gtk_item_factory_get_widget (GTK_ITEM_FACTORY (image_factory),
|
||||
path);
|
||||
g_free (path);
|
||||
|
||||
if (menu_item && menu_item->parent)
|
||||
{
|
||||
gtk_menu_reorder_child (GTK_MENU (menu_item->parent),
|
||||
menu_item, pos);
|
||||
pos++;
|
||||
}
|
||||
}
|
||||
|
||||
pos = 1;
|
||||
for (i = 0; i < G_N_ELEMENTS (rotate_plugins); i++)
|
||||
{
|
||||
path = g_strconcat ("/Layer/Transform/", rotate_plugins[i], NULL);
|
||||
menu_item = gtk_item_factory_get_widget (GTK_ITEM_FACTORY (image_factory),
|
||||
path);
|
||||
g_free (path);
|
||||
|
||||
if (menu_item && menu_item->parent)
|
||||
{
|
||||
gtk_menu_reorder_child (GTK_MENU (menu_item->parent),
|
||||
menu_item, pos);
|
||||
pos++;
|
||||
}
|
||||
}
|
||||
|
||||
/* Reorder "<Image>/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 (image_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 (image_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 (image_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 "<Image>/Filters/Toys"
|
||||
* before the separator after "<Image>/Filters/Web"
|
||||
*/
|
||||
menu_item = gtk_item_factory_get_widget (GTK_ITEM_FACTORY (image_factory),
|
||||
"/Filters/---INSERT");
|
||||
|
||||
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 (image_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++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return image_factory;
|
||||
}
|
||||
|
||||
void
|
||||
menus_init (Gimp *gimp)
|
||||
{
|
||||
GimpItemFactory *toolbox_factory;
|
||||
GimpItemFactory *image_factory;
|
||||
gchar *filename;
|
||||
|
||||
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
||||
g_return_if_fail (menus_initialized == FALSE);
|
||||
|
@ -2080,16 +2363,7 @@ menus_init (Gimp *gimp)
|
|||
menus_last_opened_add (toolbox_factory, gimp);
|
||||
ADD_FACTORY (toolbox_factory);
|
||||
|
||||
image_factory = gimp_item_factory_new (gimp,
|
||||
GTK_TYPE_MENU,
|
||||
"<Image>", "image",
|
||||
NULL,
|
||||
G_N_ELEMENTS (image_entries),
|
||||
image_entries,
|
||||
gimp,
|
||||
TRUE);
|
||||
menus_last_opened_add (image_factory, gimp);
|
||||
ADD_FACTORY (image_factory);
|
||||
ADD_FACTORY (menus_get_new_image_factory (gimp, gimp, FALSE));
|
||||
|
||||
ADD_FACTORY (gimp_item_factory_new (gimp,
|
||||
GTK_TYPE_MENU,
|
||||
|
@ -2236,123 +2510,20 @@ menus_init (Gimp *gimp)
|
|||
gimp,
|
||||
FALSE));
|
||||
|
||||
filename = gimp_personal_rc_file ("menurc");
|
||||
gtk_accel_map_load (filename);
|
||||
g_free (filename);
|
||||
|
||||
#undef ADD_FACTORY
|
||||
|
||||
/* create tool menu items */
|
||||
{
|
||||
static const gchar *color_tools[] = { "gimp-color-balance-tool",
|
||||
"gimp-hue-saturation-tool",
|
||||
"gimp-brightness-contrast-tool",
|
||||
"gimp-threshold-tool",
|
||||
"gimp-levels-tool",
|
||||
"gimp-curves-tool" };
|
||||
GtkWidget *menu_item;
|
||||
GimpToolInfo *tool_info;
|
||||
GList *list;
|
||||
gint i;
|
||||
|
||||
for (list = GIMP_LIST (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;
|
||||
|
||||
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 = "<StockItem>";
|
||||
entry.entry.extra_data = tool_info->stock_id;
|
||||
entry.quark_string = NULL;
|
||||
entry.help_page = tool_info->help_data;
|
||||
entry.description = NULL;
|
||||
|
||||
gimp_item_factory_create_item (image_factory,
|
||||
&entry,
|
||||
NULL,
|
||||
tool_info, 2,
|
||||
TRUE, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
/* reorder <Image>/Image/Colors */
|
||||
tool_info = (GimpToolInfo *)
|
||||
gimp_container_get_child_by_name (gimp->tool_info_list,
|
||||
"gimp-posterize-tool");
|
||||
|
||||
menu_item = gtk_item_factory_get_widget (GTK_ITEM_FACTORY (image_factory),
|
||||
tool_info->menu_path);
|
||||
if (menu_item && menu_item->parent)
|
||||
gtk_menu_reorder_child (GTK_MENU (menu_item->parent), menu_item, 4);
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (color_tools); i++)
|
||||
{
|
||||
tool_info = (GimpToolInfo *)
|
||||
gimp_container_get_child_by_name (gimp->tool_info_list,
|
||||
color_tools[i]);
|
||||
|
||||
menu_item = gtk_item_factory_get_widget (GTK_ITEM_FACTORY (image_factory),
|
||||
tool_info->menu_path);
|
||||
if (menu_item && menu_item->parent)
|
||||
{
|
||||
gtk_menu_reorder_child (GTK_MENU (menu_item->parent),
|
||||
menu_item, i + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
gchar *filename;
|
||||
|
||||
filename = gimp_personal_rc_file ("menurc");
|
||||
gtk_accel_map_load (filename);
|
||||
g_free (filename);
|
||||
}
|
||||
|
||||
{
|
||||
GimpContext *user_context;
|
||||
|
||||
user_context = gimp_get_user_context (gimp);
|
||||
|
||||
g_signal_connect (G_OBJECT (user_context), "foreground_changed",
|
||||
G_CALLBACK (menus_color_changed),
|
||||
image_factory);
|
||||
g_signal_connect (G_OBJECT (user_context), "background_changed",
|
||||
G_CALLBACK (menus_color_changed),
|
||||
image_factory);
|
||||
|
||||
menus_color_changed (user_context, NULL, image_factory);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
menus_exit (Gimp *gimp)
|
||||
{
|
||||
GimpItemFactory *item_factory;
|
||||
gchar *filename;
|
||||
gchar *filename;
|
||||
|
||||
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
||||
|
||||
item_factory = gimp_item_factory_from_path ("<Toolbox>");
|
||||
g_signal_handlers_disconnect_by_func (G_OBJECT (gimp->documents),
|
||||
menus_last_opened_update,
|
||||
item_factory);
|
||||
g_signal_handlers_disconnect_by_func (G_OBJECT (gimp->documents),
|
||||
menus_last_opened_reorder,
|
||||
item_factory);
|
||||
|
||||
item_factory = gimp_item_factory_from_path ("<Image>");
|
||||
g_signal_handlers_disconnect_by_func (G_OBJECT (gimp->documents),
|
||||
menus_last_opened_update,
|
||||
item_factory);
|
||||
g_signal_handlers_disconnect_by_func (G_OBJECT (gimp->documents),
|
||||
menus_last_opened_reorder,
|
||||
item_factory);
|
||||
|
||||
filename = gimp_personal_rc_file ("menurc");
|
||||
gtk_accel_map_save (filename);
|
||||
g_free (filename);
|
||||
|
@ -2365,22 +2536,12 @@ menus_exit (Gimp *gimp)
|
|||
void
|
||||
menus_restore (Gimp *gimp)
|
||||
{
|
||||
static gchar *rotate_plugins[] = { "Rotate 90 degrees",
|
||||
"Rotate 180 degrees",
|
||||
"Rotate 270 degrees" };
|
||||
static gchar *image_file_entries[] = { "---moved",
|
||||
"Close",
|
||||
"Quit" };
|
||||
static gchar *reorder_submenus[] = { "<Image>/Video",
|
||||
"<Image>/Script-Fu" };
|
||||
static gchar *reorder_subsubmenus[] = { "<Image>/Filters",
|
||||
"<Toolbox>/Xtns" };
|
||||
static gchar *reorder_subsubmenus[] = { "<Toolbox>/Xtns" };
|
||||
|
||||
GimpItemFactory *item_factory;
|
||||
GtkWidget *menu_item;
|
||||
GtkWidget *menu;
|
||||
GList *list;
|
||||
gchar *path;
|
||||
gint i, pos;
|
||||
|
||||
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
||||
|
@ -2412,90 +2573,6 @@ menus_restore (Gimp *gimp)
|
|||
}
|
||||
}
|
||||
|
||||
/* Move all menu items under "<Image>/Filters" which are not submenus or
|
||||
* separators to the top of the menu
|
||||
*/
|
||||
pos = 3;
|
||||
item_factory = gimp_item_factory_from_path ("<Image>");
|
||||
menu_item = gtk_item_factory_get_widget (GTK_ITEM_FACTORY (item_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 Rotate plugin menu entries */
|
||||
pos = 1;
|
||||
for (i = 0; i < G_N_ELEMENTS (rotate_plugins); i++)
|
||||
{
|
||||
path = g_strconcat ("/Image/Transform/", rotate_plugins[i], NULL);
|
||||
menu_item = gtk_item_factory_get_widget (GTK_ITEM_FACTORY (item_factory),
|
||||
path);
|
||||
g_free (path);
|
||||
|
||||
if (menu_item && menu_item->parent)
|
||||
{
|
||||
gtk_menu_reorder_child (GTK_MENU (menu_item->parent), menu_item, pos);
|
||||
pos++;
|
||||
}
|
||||
}
|
||||
|
||||
pos = 1;
|
||||
for (i = 0; i < G_N_ELEMENTS (rotate_plugins); i++)
|
||||
{
|
||||
path = g_strconcat ("/Layer/Transform/", rotate_plugins[i], NULL);
|
||||
menu_item = gtk_item_factory_get_widget (GTK_ITEM_FACTORY (item_factory),
|
||||
path);
|
||||
g_free (path);
|
||||
|
||||
if (menu_item && menu_item->parent)
|
||||
{
|
||||
gtk_menu_reorder_child (GTK_MENU (menu_item->parent), menu_item, pos);
|
||||
pos++;
|
||||
}
|
||||
}
|
||||
|
||||
/* Reorder "<Image>/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 (item_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++)
|
||||
{
|
||||
item_factory = gimp_item_factory_from_path (reorder_submenus[i]);
|
||||
|
||||
menu = gtk_item_factory_get_widget (GTK_ITEM_FACTORY (item_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++)
|
||||
{
|
||||
item_factory = gimp_item_factory_from_path (reorder_subsubmenus[i]);
|
||||
|
@ -2517,46 +2594,6 @@ menus_restore (Gimp *gimp)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Move all submenus which registered after "<Image>/Filters/Toys"
|
||||
* before the separator after "<Image>/Filters/Web"
|
||||
*/
|
||||
item_factory = gimp_item_factory_from_path ("<Image>");
|
||||
menu_item = gtk_item_factory_get_widget (GTK_ITEM_FACTORY (item_factory),
|
||||
"/Filters/---INSERT");
|
||||
|
||||
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 (item_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++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -2617,15 +2654,15 @@ menus_last_opened_add (GimpItemFactory *item_factory,
|
|||
|
||||
g_free (last_opened_entries);
|
||||
|
||||
g_signal_connect (G_OBJECT (gimp->documents), "add",
|
||||
G_CALLBACK (menus_last_opened_update),
|
||||
item_factory);
|
||||
g_signal_connect (G_OBJECT (gimp->documents), "remove",
|
||||
G_CALLBACK (menus_last_opened_update),
|
||||
item_factory);
|
||||
g_signal_connect (G_OBJECT (gimp->documents), "reorder",
|
||||
G_CALLBACK (menus_last_opened_reorder),
|
||||
item_factory);
|
||||
g_signal_connect_object (G_OBJECT (gimp->documents), "add",
|
||||
G_CALLBACK (menus_last_opened_update),
|
||||
item_factory, 0);
|
||||
g_signal_connect_object (G_OBJECT (gimp->documents), "remove",
|
||||
G_CALLBACK (menus_last_opened_update),
|
||||
item_factory, 0);
|
||||
g_signal_connect_object (G_OBJECT (gimp->documents), "reorder",
|
||||
G_CALLBACK (menus_last_opened_reorder),
|
||||
item_factory, 0);
|
||||
|
||||
menus_last_opened_update (gimp->documents, NULL, item_factory);
|
||||
}
|
||||
|
@ -2706,20 +2743,21 @@ menus_last_opened_reorder (GimpContainer *container,
|
|||
}
|
||||
|
||||
static void
|
||||
menus_color_changed (GimpContext *context,
|
||||
const GimpRGB *unused,
|
||||
GimpItemFactory *item_factory)
|
||||
menus_foreground_changed (GimpContext *context,
|
||||
const GimpRGB *color,
|
||||
GimpItemFactory *item_factory)
|
||||
{
|
||||
GimpRGB fg;
|
||||
GimpRGB bg;
|
||||
|
||||
gimp_context_get_foreground (context, &fg);
|
||||
gimp_context_get_background (context, &bg);
|
||||
|
||||
gimp_item_factory_set_color (GTK_ITEM_FACTORY (item_factory),
|
||||
"/Edit/Fill with FG Color", &fg, FALSE);
|
||||
"/Edit/Fill with FG Color", color, FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
menus_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", &bg, FALSE);
|
||||
"/Edit/Fill with BG Color", color, FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -25,4 +25,12 @@ void menus_exit (Gimp *gimp);
|
|||
void menus_restore (Gimp *gimp);
|
||||
|
||||
|
||||
/* FIXME: remove this and add a GimpMenuFactory class which produces
|
||||
* GimpItemFactories on demand
|
||||
*/
|
||||
GimpItemFactory * menus_get_new_image_factory (Gimp *gimp,
|
||||
gpointer callback_data,
|
||||
gboolean menu_bar);
|
||||
|
||||
|
||||
#endif /* __MENUS_H__ */
|
||||
|
|
|
@ -39,6 +39,17 @@
|
|||
#include "app_procs.h"
|
||||
|
||||
|
||||
#define return_if_no_display(gdisp,data) \
|
||||
if (GIMP_IS_DISPLAY (data)) \
|
||||
gdisp = data; \
|
||||
else if (GIMP_IS_GIMP (data)) \
|
||||
gdisp = gimp_context_get_display (gimp_get_user_context (GIMP (data))); \
|
||||
else \
|
||||
gdisp = NULL; \
|
||||
if (! gdisp) \
|
||||
return
|
||||
|
||||
|
||||
void
|
||||
plug_in_run_cmd_callback (GtkWidget *widget,
|
||||
gpointer data,
|
||||
|
@ -137,11 +148,7 @@ plug_in_repeat_cmd_callback (GtkWidget *widget,
|
|||
GimpDisplay *gdisp;
|
||||
GimpDrawable *drawable;
|
||||
gboolean interactive;
|
||||
|
||||
gdisp = gimp_context_get_display (gimp_get_user_context (GIMP (data)));
|
||||
|
||||
if (! gdisp)
|
||||
return;
|
||||
return_if_no_display (gdisp, data);
|
||||
|
||||
drawable = gimp_image_active_drawable (gdisp->gimage);
|
||||
|
||||
|
|
|
@ -40,101 +40,340 @@
|
|||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
||||
void
|
||||
plug_in_make_menu (GSList *plug_in_defs,
|
||||
const gchar *std_plugins_domain)
|
||||
{
|
||||
PlugInDef *plug_in_def;
|
||||
PlugInProcDef *proc_def;
|
||||
PlugInMenuEntry *menu_entry;
|
||||
GSList *domains = NULL;
|
||||
GSList *procs;
|
||||
GSList *tmp;
|
||||
GTree *menu_entries;
|
||||
typedef struct _PlugInMenuEntry PlugInMenuEntry;
|
||||
|
||||
struct _PlugInMenuEntry
|
||||
{
|
||||
PlugInProcDef *proc_def;
|
||||
const gchar *domain;
|
||||
const gchar *help_path;
|
||||
};
|
||||
|
||||
|
||||
/* local function prototypes */
|
||||
|
||||
static gboolean plug_in_menu_tree_traverse_func (gpointer foo,
|
||||
PlugInMenuEntry *menu_entry,
|
||||
GimpItemFactory *image_factory);
|
||||
static gchar * plug_in_escape_uline (const gchar *menu_path);
|
||||
|
||||
|
||||
/* public functions */
|
||||
|
||||
void
|
||||
plug_in_menus_init (GSList *plug_in_defs,
|
||||
const gchar *std_plugins_domain)
|
||||
{
|
||||
PlugInDef *plug_in_def;
|
||||
GSList *domains = NULL;
|
||||
GSList *tmp;
|
||||
|
||||
g_return_if_fail (plug_in_defs != NULL);
|
||||
g_return_if_fail (std_plugins_domain != NULL);
|
||||
|
||||
domains = g_slist_append (domains, (gpointer) std_plugins_domain);
|
||||
|
||||
#ifdef ENABLE_NLS
|
||||
bindtextdomain (std_plugins_domain, gimp_locale_directory ());
|
||||
bind_textdomain_codeset (std_plugins_domain, "UTF-8");
|
||||
domains = g_slist_append (domains, (gpointer) std_plugins_domain);
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_NLS
|
||||
menu_entries = g_tree_new ((GCompareFunc) strcoll);
|
||||
#else
|
||||
menu_entries = g_tree_new ((GCompareFunc) strcmp);
|
||||
#endif
|
||||
|
||||
tmp = plug_in_defs;
|
||||
while (tmp)
|
||||
for (tmp = plug_in_defs; tmp; tmp = g_slist_next (tmp))
|
||||
{
|
||||
const gchar *locale_domain;
|
||||
const gchar *locale_path;
|
||||
GSList *list;
|
||||
|
||||
plug_in_def = tmp->data;
|
||||
tmp = tmp->next;
|
||||
|
||||
procs = plug_in_def->proc_defs;
|
||||
if (! plug_in_def->proc_defs)
|
||||
continue;
|
||||
|
||||
if (!procs)
|
||||
continue;
|
||||
locale_domain = plug_ins_locale_domain (plug_in_def->prog,
|
||||
&locale_path);
|
||||
|
||||
#ifdef ENABLE_NLS
|
||||
{
|
||||
gchar *domain;
|
||||
GSList *list;
|
||||
gboolean found = FALSE;
|
||||
for (list = domains; list; list = list->next)
|
||||
{
|
||||
if (! strcmp (locale_domain, (gchar *) list->data))
|
||||
break;
|
||||
}
|
||||
|
||||
if (plug_in_def->locale_domain)
|
||||
{
|
||||
domain = plug_in_def->locale_domain;
|
||||
for (list = domains; list && !found; list = list->next)
|
||||
{
|
||||
if (strcmp (domain, (gchar*)(list->data)) == 0)
|
||||
found = TRUE;
|
||||
}
|
||||
if (!found)
|
||||
{
|
||||
domains = g_slist_append (domains, domain);
|
||||
if (plug_in_def->locale_path)
|
||||
bindtextdomain (domain, plug_in_def->locale_path);
|
||||
else
|
||||
bindtextdomain (domain, gimp_locale_directory ());
|
||||
bind_textdomain_codeset (domain, "UTF-8");
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif /* ENABLE_NLS */
|
||||
if (! list)
|
||||
{
|
||||
domains = g_slist_append (domains, (gpointer) locale_domain);
|
||||
|
||||
while (procs)
|
||||
{
|
||||
proc_def = procs->data;
|
||||
procs = procs->next;
|
||||
bindtextdomain (locale_domain, locale_path);
|
||||
bind_textdomain_codeset (locale_domain, "UTF-8");
|
||||
}
|
||||
}
|
||||
|
||||
if (proc_def->prog &&
|
||||
proc_def->menu_path &&
|
||||
! proc_def->extensions &&
|
||||
! proc_def->prefixes &&
|
||||
! proc_def->magics)
|
||||
{
|
||||
menu_entry = g_new0 (PlugInMenuEntry, 1);
|
||||
g_slist_free (domains);
|
||||
}
|
||||
|
||||
menu_entry->proc_def = proc_def;
|
||||
menu_entry->domain = (plug_in_def->locale_domain ?
|
||||
plug_in_def->locale_domain :
|
||||
(gchar *) std_plugins_domain);
|
||||
menu_entry->help_path = plug_in_def->help_path;
|
||||
void
|
||||
plug_in_make_menu (GimpItemFactory *image_factory,
|
||||
GSList *proc_defs)
|
||||
{
|
||||
PlugInProcDef *proc_def;
|
||||
GSList *procs;
|
||||
GTree *menu_entries;
|
||||
|
||||
g_tree_insert (menu_entries,
|
||||
dgettext (menu_entry->domain,
|
||||
proc_def->menu_path),
|
||||
menu_entry);
|
||||
g_return_if_fail (image_factory == NULL ||
|
||||
GIMP_IS_ITEM_FACTORY (image_factory));
|
||||
g_return_if_fail (proc_defs != NULL);
|
||||
|
||||
menu_entries = g_tree_new_full ((GCompareDataFunc) g_utf8_collate, NULL,
|
||||
NULL, g_free);
|
||||
|
||||
for (procs = proc_defs; procs; procs = procs->next)
|
||||
{
|
||||
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 *locale_domain;
|
||||
|
||||
locale_domain = plug_ins_locale_domain (proc_def->prog, NULL);
|
||||
|
||||
menu_entry = g_new0 (PlugInMenuEntry, 1);
|
||||
|
||||
menu_entry->proc_def = proc_def;
|
||||
menu_entry->domain = locale_domain;
|
||||
menu_entry->help_path = plug_ins_help_path (proc_def->prog);
|
||||
|
||||
g_tree_insert (menu_entries,
|
||||
dgettext (locale_domain, proc_def->menu_path),
|
||||
menu_entry);
|
||||
}
|
||||
}
|
||||
|
||||
g_tree_foreach (menu_entries,
|
||||
(GTraverseFunc) plug_in_menu_tree_traverse_func,
|
||||
image_factory);
|
||||
g_tree_destroy (menu_entries);
|
||||
}
|
||||
|
||||
void
|
||||
plug_in_make_menu_entry (GimpItemFactory *image_factory,
|
||||
PlugInProcDef *proc_def,
|
||||
const gchar *domain,
|
||||
const gchar *help_path)
|
||||
{
|
||||
GimpItemFactoryEntry entry;
|
||||
gchar *menu_path;
|
||||
gchar *help_page;
|
||||
gchar *basename;
|
||||
gchar *lowercase_page;
|
||||
|
||||
g_return_if_fail (image_factory == NULL ||
|
||||
GIMP_IS_ITEM_FACTORY (image_factory));
|
||||
|
||||
basename = g_path_get_basename (proc_def->prog);
|
||||
|
||||
if (help_path)
|
||||
{
|
||||
help_page = g_strconcat (help_path,
|
||||
"@", /* HACK: locale subdir */
|
||||
basename,
|
||||
".html",
|
||||
NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
help_page = g_strconcat ("filters/", /* _not_ G_DIR_SEPARATOR_S */
|
||||
basename,
|
||||
".html",
|
||||
NULL);
|
||||
}
|
||||
|
||||
g_free (basename);
|
||||
|
||||
lowercase_page = g_ascii_strdown (help_page, -1);
|
||||
|
||||
g_free (help_page);
|
||||
|
||||
menu_path = plug_in_escape_uline (strstr (proc_def->menu_path, "/"));
|
||||
|
||||
entry.entry.path = 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_page = lowercase_page;
|
||||
entry.description = NULL;
|
||||
|
||||
if (image_factory)
|
||||
{
|
||||
if (! strncmp (proc_def->menu_path, "<Image>", 7))
|
||||
{
|
||||
gimp_item_factory_create_item (image_factory,
|
||||
&entry,
|
||||
domain,
|
||||
&proc_def->db_info, 2,
|
||||
TRUE, FALSE);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
GList *list;
|
||||
|
||||
for (list = gimp_item_factories_from_path (proc_def->menu_path);
|
||||
list;
|
||||
list = g_list_next (list))
|
||||
{
|
||||
GimpItemFactory *item_factory = list->data;
|
||||
|
||||
gimp_item_factory_create_item (item_factory,
|
||||
&entry,
|
||||
domain,
|
||||
&proc_def->db_info, 2,
|
||||
TRUE, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
g_free (menu_path);
|
||||
g_free (lowercase_page);
|
||||
}
|
||||
|
||||
void
|
||||
plug_in_delete_menu_entry (const gchar *menu_path)
|
||||
{
|
||||
GList *list;
|
||||
|
||||
g_return_if_fail (menu_path != NULL);
|
||||
|
||||
for (list = gimp_item_factories_from_path (menu_path);
|
||||
list;
|
||||
list = g_list_next (list))
|
||||
{
|
||||
GtkItemFactory *item_factory = list->data;
|
||||
|
||||
gtk_item_factory_delete_item (GTK_ITEM_FACTORY (item_factory), menu_path);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
plug_in_set_menu_sensitivity (GimpItemFactory *image_factory,
|
||||
GimpImageType type)
|
||||
{
|
||||
PlugInProcDef *proc_def;
|
||||
GSList *tmp;
|
||||
gboolean sensitive = FALSE;
|
||||
|
||||
g_return_if_fail (image_factory == NULL ||
|
||||
GIMP_IS_ITEM_FACTORY (image_factory));
|
||||
|
||||
for (tmp = proc_defs; tmp; tmp = g_slist_next (tmp))
|
||||
{
|
||||
proc_def = tmp->data;
|
||||
|
||||
if (proc_def->image_types_val && proc_def->menu_path)
|
||||
{
|
||||
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 (image_factory && ! strncmp (proc_def->menu_path, "<Image>", 7))
|
||||
gimp_item_factory_set_sensitive (GTK_ITEM_FACTORY (image_factory),
|
||||
proc_def->menu_path,
|
||||
sensitive);
|
||||
else
|
||||
gimp_item_factories_set_sensitive (proc_def->menu_path,
|
||||
proc_def->menu_path,
|
||||
sensitive);
|
||||
|
||||
if (last_plug_in && (last_plug_in == &proc_def->db_info))
|
||||
{
|
||||
gchar *basename;
|
||||
gchar *ellipses;
|
||||
gchar *repeat;
|
||||
gchar *reshow;
|
||||
|
||||
basename = g_path_get_basename (proc_def->menu_path);
|
||||
|
||||
ellipses = strstr (basename, "...");
|
||||
|
||||
if (ellipses && ellipses == (basename + strlen (basename) - 3))
|
||||
*ellipses = '\0';
|
||||
|
||||
repeat = g_strdup_printf (_("Repeat \"%s\""), basename);
|
||||
reshow = g_strdup_printf (_("Re-show \"%s\""), basename);
|
||||
|
||||
g_free (basename);
|
||||
|
||||
gimp_item_factories_set_label ("<Image>",
|
||||
"/Filters/Repeat Last", repeat);
|
||||
gimp_item_factories_set_label ("<Image>",
|
||||
"/Filters/Re-Show Last", reshow);
|
||||
|
||||
g_free (repeat);
|
||||
g_free (reshow);
|
||||
|
||||
gimp_item_factories_set_sensitive ("<Image>",
|
||||
"/Filters/Repeat Last",
|
||||
sensitive);
|
||||
gimp_item_factories_set_sensitive ("<Image>",
|
||||
"/Filters/Re-Show Last",
|
||||
sensitive);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
g_tree_foreach (menu_entries,
|
||||
(GTraverseFunc) plug_in_make_menu_entry,
|
||||
NULL);
|
||||
g_tree_destroy (menu_entries);
|
||||
if (! last_plug_in)
|
||||
{
|
||||
gimp_item_factories_set_label ("<Image>",
|
||||
"/Filters/Repeat Last",
|
||||
_("Repeat Last"));
|
||||
gimp_item_factories_set_label ("<Image>",
|
||||
"/Filters/Re-Show Last",
|
||||
_("Re-Show Last"));
|
||||
|
||||
g_slist_free (domains);
|
||||
gimp_item_factories_set_sensitive ("<Image>",
|
||||
"/Filters/Repeat Last", FALSE);
|
||||
gimp_item_factories_set_sensitive ("<Image>",
|
||||
"/Filters/Re-Show Last", FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* private functions */
|
||||
|
||||
static gboolean
|
||||
plug_in_menu_tree_traverse_func (gpointer foo,
|
||||
PlugInMenuEntry *menu_entry,
|
||||
GimpItemFactory *image_factory)
|
||||
{
|
||||
plug_in_make_menu_entry (image_factory,
|
||||
menu_entry->proc_def,
|
||||
menu_entry->domain,
|
||||
menu_entry->help_path);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gchar *
|
||||
|
@ -166,186 +405,3 @@ plug_in_escape_uline (const gchar *menu_path)
|
|||
|
||||
return escaped;
|
||||
}
|
||||
|
||||
/* The following function has to be a GTraverseFunction,
|
||||
* but is also called directly. Please note that it frees the
|
||||
* menu_entry strcuture. --Sven
|
||||
*/
|
||||
gint
|
||||
plug_in_make_menu_entry (gpointer foo,
|
||||
PlugInMenuEntry *menu_entry,
|
||||
gpointer bar)
|
||||
{
|
||||
GimpItemFactoryEntry entry;
|
||||
gchar *menu_path;
|
||||
gchar *help_page;
|
||||
gchar *basename;
|
||||
gchar *lowercase_page;
|
||||
|
||||
basename = g_path_get_basename (menu_entry->proc_def->prog);
|
||||
|
||||
if (menu_entry->help_path)
|
||||
{
|
||||
help_page = g_strconcat (menu_entry->help_path,
|
||||
"@", /* HACK: locale subdir */
|
||||
basename,
|
||||
".html",
|
||||
NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
help_page = g_strconcat ("filters/", /* _not_ G_DIR_SEPARATOR_S */
|
||||
basename,
|
||||
".html",
|
||||
NULL);
|
||||
}
|
||||
|
||||
g_free (basename);
|
||||
|
||||
lowercase_page = g_ascii_strdown (help_page, -1);
|
||||
|
||||
g_free (help_page);
|
||||
|
||||
menu_path = plug_in_escape_uline (strstr (menu_entry->proc_def->menu_path, "/"));
|
||||
|
||||
entry.entry.path = menu_path;
|
||||
entry.entry.accelerator = menu_entry->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_page = lowercase_page;
|
||||
entry.description = NULL;
|
||||
|
||||
{
|
||||
GimpItemFactory *item_factory;
|
||||
|
||||
item_factory =
|
||||
gimp_item_factory_from_path (menu_entry->proc_def->menu_path);
|
||||
|
||||
gimp_item_factory_create_item (item_factory,
|
||||
&entry,
|
||||
menu_entry->domain,
|
||||
&menu_entry->proc_def->db_info, 2,
|
||||
TRUE, FALSE);
|
||||
}
|
||||
|
||||
g_free (menu_path);
|
||||
g_free (lowercase_page);
|
||||
|
||||
g_free (menu_entry);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
plug_in_delete_menu_entry (const gchar *menu_path)
|
||||
{
|
||||
GimpItemFactory *item_factory;
|
||||
|
||||
item_factory = gimp_item_factory_from_path (menu_path);
|
||||
|
||||
gtk_item_factory_delete_item (GTK_ITEM_FACTORY (item_factory), menu_path);
|
||||
}
|
||||
|
||||
void
|
||||
plug_in_set_menu_sensitivity (GimpImageType type)
|
||||
{
|
||||
GtkItemFactory *item_factory;
|
||||
PlugInProcDef *proc_def;
|
||||
GSList *tmp;
|
||||
gboolean sensitive = FALSE;
|
||||
|
||||
for (tmp = proc_defs; tmp; tmp = g_slist_next (tmp))
|
||||
{
|
||||
proc_def = tmp->data;
|
||||
|
||||
if (proc_def->image_types_val && proc_def->menu_path)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
item_factory =
|
||||
GTK_ITEM_FACTORY (gimp_item_factory_from_path (proc_def->menu_path));
|
||||
|
||||
gimp_item_factory_set_sensitive (item_factory,
|
||||
proc_def->menu_path,
|
||||
sensitive);
|
||||
|
||||
if (last_plug_in && (last_plug_in == &(proc_def->db_info)))
|
||||
{
|
||||
gchar *basename;
|
||||
gchar *ellipses;
|
||||
gchar *repeat;
|
||||
gchar *reshow;
|
||||
|
||||
basename = g_path_get_basename (proc_def->menu_path);
|
||||
|
||||
ellipses = strstr (basename, "...");
|
||||
|
||||
if (ellipses && ellipses == (basename + strlen (basename) - 3))
|
||||
*ellipses = '\0';
|
||||
|
||||
repeat = g_strdup_printf (_("Repeat \"%s\""), basename);
|
||||
reshow = g_strdup_printf (_("Re-show \"%s\""), basename);
|
||||
|
||||
g_free (basename);
|
||||
|
||||
gimp_item_factory_set_label (item_factory,
|
||||
"/Filters/Repeat Last", repeat);
|
||||
gimp_item_factory_set_label (item_factory,
|
||||
"/Filters/Re-Show Last", reshow);
|
||||
|
||||
g_free (repeat);
|
||||
g_free (reshow);
|
||||
|
||||
gimp_item_factory_set_sensitive (item_factory,
|
||||
"/Filters/Repeat Last",
|
||||
sensitive);
|
||||
gimp_item_factory_set_sensitive (item_factory,
|
||||
"/Filters/Re-Show Last",
|
||||
sensitive);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (! last_plug_in)
|
||||
{
|
||||
item_factory =
|
||||
GTK_ITEM_FACTORY (gimp_item_factory_from_path ("<Image>"));
|
||||
|
||||
gimp_item_factory_set_label (item_factory,
|
||||
"/Filters/Repeat Last",
|
||||
_("Repeat Last"));
|
||||
gimp_item_factory_set_label (item_factory,
|
||||
"/Filters/Re-Show Last",
|
||||
_("Re-Show Last"));
|
||||
|
||||
gimp_item_factory_set_sensitive (item_factory,
|
||||
"/Filters/Repeat Last", FALSE);
|
||||
gimp_item_factory_set_sensitive (item_factory,
|
||||
"/Filters/Re-Show Last", FALSE);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,13 +20,18 @@
|
|||
#define __PLUG_IN_MENUS_H__
|
||||
|
||||
|
||||
void plug_in_make_menu (GSList *plug_in_defs,
|
||||
void plug_in_menus_init (GSList *plug_in_defs,
|
||||
const gchar *std_plugins_domain);
|
||||
gint plug_in_make_menu_entry (gpointer foo,
|
||||
PlugInMenuEntry *menu_entry,
|
||||
gpointer bar);
|
||||
|
||||
void plug_in_make_menu (GimpItemFactory *image_factory,
|
||||
GSList *proc_defs);
|
||||
void plug_in_make_menu_entry (GimpItemFactory *image_factory,
|
||||
PlugInProcDef *proc_def,
|
||||
const gchar *locale_domain,
|
||||
const gchar *help_path);
|
||||
void plug_in_delete_menu_entry (const gchar *menu_path);
|
||||
void plug_in_set_menu_sensitivity (GimpImageType type);
|
||||
void plug_in_set_menu_sensitivity (GimpItemFactory *image_factory,
|
||||
GimpImageType type);
|
||||
|
||||
|
||||
#endif /* __PLUG_IN_MENUS_H__ */
|
||||
|
|
|
@ -181,13 +181,13 @@ prefs_config_copy_notify (GObject *config_copy,
|
|||
{
|
||||
if (param_spec->flags & GIMP_PARAM_CONFIRM)
|
||||
{
|
||||
g_print ("NOT Applying prefs change of '%s' to global config "
|
||||
g_print ("NOT Applying prefs change of '%s' to edit_config "
|
||||
"because it needs confirmation\n",
|
||||
param_spec->name);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_print ("Applying prefs change of '%s' to global config\n",
|
||||
g_print ("Applying prefs change of '%s' to edit_config\n",
|
||||
param_spec->name);
|
||||
|
||||
g_signal_handlers_block_by_func (config,
|
||||
|
@ -1145,7 +1145,10 @@ prefs_dialog_new (Gimp *gimp,
|
|||
vbox2 = prefs_frame_new (_("Menus"), GTK_CONTAINER (vbox), FALSE);
|
||||
|
||||
prefs_check_button_add (config, "tearoff-menus",
|
||||
_("Disable _Tearoff Menus"),
|
||||
_("Enable _Tearoff Menus"),
|
||||
GTK_BOX (vbox2));
|
||||
prefs_check_button_add (config, "menu-bar-per-display",
|
||||
_("Menu _Bar Per Display"),
|
||||
GTK_BOX (vbox2));
|
||||
|
||||
/* Window Positions */
|
||||
|
|
|
@ -38,12 +38,22 @@
|
|||
|
||||
|
||||
#define return_if_no_display(gdisp,data) \
|
||||
gdisp = gimp_context_get_display (gimp_get_user_context (GIMP (data))); \
|
||||
if (GIMP_IS_DISPLAY (data)) \
|
||||
gdisp = data; \
|
||||
else if (GIMP_IS_GIMP (data)) \
|
||||
gdisp = gimp_context_get_display (gimp_get_user_context (GIMP (data))); \
|
||||
else \
|
||||
gdisp = NULL; \
|
||||
if (! gdisp) \
|
||||
return
|
||||
|
||||
#define return_if_no_image(gimage,data) \
|
||||
gimage = gimp_context_get_image (gimp_get_user_context (GIMP (data))); \
|
||||
if (GIMP_IS_DISPLAY (data)) \
|
||||
gimage = ((GimpDisplay *) data)->gimage; \
|
||||
else if (GIMP_IS_GIMP (data)) \
|
||||
gimage = gimp_context_get_image (gimp_get_user_context (GIMP (data))); \
|
||||
else \
|
||||
gimage = NULL; \
|
||||
if (! gimage) \
|
||||
return
|
||||
|
||||
|
|
|
@ -33,12 +33,26 @@
|
|||
#include "tools/tool_manager.h"
|
||||
|
||||
|
||||
#define return_if_no_gimp(gimp,data) \
|
||||
if (GIMP_IS_DISPLAY (data)) \
|
||||
gimp = ((GimpDisplay *) data)->gimage->gimp; \
|
||||
else if (GIMP_IS_GIMP (data)) \
|
||||
gimp = data; \
|
||||
else \
|
||||
gimp = NULL; \
|
||||
if (! gimp) \
|
||||
return
|
||||
|
||||
|
||||
void
|
||||
tools_default_colors_cmd_callback (GtkWidget *widget,
|
||||
gpointer data,
|
||||
guint action)
|
||||
{
|
||||
gimp_context_set_default_colors (gimp_get_user_context (GIMP (data)));
|
||||
Gimp *gimp;
|
||||
return_if_no_gimp (gimp, data);
|
||||
|
||||
gimp_context_set_default_colors (gimp_get_user_context (gimp));
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -46,7 +60,10 @@ tools_swap_colors_cmd_callback (GtkWidget *widget,
|
|||
gpointer data,
|
||||
guint action)
|
||||
{
|
||||
gimp_context_swap_colors (gimp_get_user_context (GIMP (data)));
|
||||
Gimp *gimp;
|
||||
return_if_no_gimp (gimp, data);
|
||||
|
||||
gimp_context_swap_colors (gimp_get_user_context (gimp));
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -58,8 +75,7 @@ tools_swap_contexts_cmd_callback (GtkWidget *widget,
|
|||
static GimpContext *temp_context = NULL;
|
||||
|
||||
Gimp *gimp;
|
||||
|
||||
gimp = GIMP (data);
|
||||
return_if_no_gimp (gimp, data);
|
||||
|
||||
if (! swap_context)
|
||||
{
|
||||
|
|
|
@ -45,6 +45,8 @@
|
|||
#include "widgets/gimpviewabledialog.h"
|
||||
#include "widgets/gimpwidgets-utils.h"
|
||||
|
||||
#include "display/gimpdisplay.h"
|
||||
|
||||
#include "tools/gimppainttool.h"
|
||||
#include "tools/gimpvectortool.h"
|
||||
#include "tools/tool_manager.h"
|
||||
|
@ -56,15 +58,21 @@
|
|||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
||||
#define return_if_no_image(gimage) \
|
||||
#define return_if_no_image(gimage,data) \
|
||||
gimage = (GimpImage *) gimp_widget_get_callback_context (widget); \
|
||||
if (! GIMP_IS_IMAGE (gimage)) \
|
||||
gimage = gimp_context_get_image (gimp_get_user_context (GIMP (data))); \
|
||||
if (! GIMP_IS_IMAGE (gimage)) { \
|
||||
if (GIMP_IS_DISPLAY (data)) \
|
||||
gimage = ((GimpDisplay *) data)->gimage; \
|
||||
else if (GIMP_IS_GIMP (data)) \
|
||||
gimage = gimp_context_get_image (gimp_get_user_context (GIMP (data))); \
|
||||
else \
|
||||
gimage = NULL; \
|
||||
} \
|
||||
if (! gimage) \
|
||||
return
|
||||
|
||||
#define return_if_no_vectors(gimage,vectors) \
|
||||
return_if_no_image (gimage); \
|
||||
#define return_if_no_vectors(gimage,vectors,data) \
|
||||
return_if_no_image (gimage,data); \
|
||||
vectors = gimp_image_get_active_vectors (gimage); \
|
||||
if (! vectors) \
|
||||
return
|
||||
|
@ -77,7 +85,7 @@ vectors_new_vectors_cmd_callback (GtkWidget *widget,
|
|||
gpointer data)
|
||||
{
|
||||
GimpImage *gimage;
|
||||
return_if_no_image (gimage);
|
||||
return_if_no_image (gimage, data);
|
||||
|
||||
vectors_new_vectors_query (gimage, NULL, TRUE);
|
||||
}
|
||||
|
@ -88,7 +96,7 @@ vectors_raise_vectors_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GimpImage *gimage;
|
||||
GimpVectors *active_vectors;
|
||||
return_if_no_vectors (gimage, active_vectors);
|
||||
return_if_no_vectors (gimage, active_vectors, data);
|
||||
|
||||
gimp_image_raise_vectors (gimage, active_vectors);
|
||||
gimp_image_flush (gimage);
|
||||
|
@ -100,7 +108,7 @@ vectors_lower_vectors_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GimpImage *gimage;
|
||||
GimpVectors *active_vectors;
|
||||
return_if_no_vectors (gimage, active_vectors);
|
||||
return_if_no_vectors (gimage, active_vectors, data);
|
||||
|
||||
gimp_image_lower_vectors (gimage, active_vectors);
|
||||
gimp_image_flush (gimage);
|
||||
|
@ -113,9 +121,13 @@ vectors_duplicate_vectors_cmd_callback (GtkWidget *widget,
|
|||
GimpImage *gimage;
|
||||
GimpVectors *active_vectors;
|
||||
GimpVectors *new_vectors;
|
||||
return_if_no_vectors (gimage, active_vectors);
|
||||
return_if_no_vectors (gimage, active_vectors, data);
|
||||
|
||||
new_vectors = NULL;
|
||||
|
||||
#ifdef __GNUC__
|
||||
#warning FIXME: need gimp_vectors_copy()
|
||||
#endif
|
||||
#if 0
|
||||
new_vectors = gimp_vectors_copy (active_vectors,
|
||||
G_TYPE_FROM_INSTANCE (active_vectors),
|
||||
|
@ -131,7 +143,7 @@ vectors_delete_vectors_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GimpImage *gimage;
|
||||
GimpVectors *active_vectors;
|
||||
return_if_no_vectors (gimage, active_vectors);
|
||||
return_if_no_vectors (gimage, active_vectors, data);
|
||||
|
||||
gimp_image_remove_vectors (gimage, active_vectors);
|
||||
gimp_image_flush (gimage);
|
||||
|
@ -144,7 +156,7 @@ vectors_vectors_to_sel (GtkWidget *widget,
|
|||
{
|
||||
GimpImage *gimage;
|
||||
GimpVectors *active_vectors;
|
||||
return_if_no_vectors (gimage, active_vectors);
|
||||
return_if_no_vectors (gimage, active_vectors, data);
|
||||
|
||||
gimp_image_mask_select_vectors (gimage,
|
||||
active_vectors,
|
||||
|
@ -187,9 +199,11 @@ vectors_sel_to_vectors_cmd_callback (GtkWidget *widget,
|
|||
gpointer data)
|
||||
{
|
||||
GimpImage *gimage;
|
||||
return_if_no_image (gimage);
|
||||
return_if_no_image (gimage, data);
|
||||
|
||||
/* TODO */
|
||||
#ifdef __GNUC__
|
||||
#warning FIXME: need gimp_vectors_from_mask(or something)
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -198,7 +212,7 @@ vectors_stroke_vectors_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GimpImage *gimage;
|
||||
GimpVectors *active_vectors;
|
||||
return_if_no_vectors (gimage, active_vectors);
|
||||
return_if_no_vectors (gimage, active_vectors, data);
|
||||
|
||||
vectors_stroke_vectors (active_vectors);
|
||||
}
|
||||
|
@ -209,9 +223,11 @@ vectors_copy_vectors_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GimpImage *gimage;
|
||||
GimpVectors *active_vectors;
|
||||
return_if_no_vectors (gimage, active_vectors);
|
||||
return_if_no_vectors (gimage, active_vectors, data);
|
||||
|
||||
/* TODO */
|
||||
#ifdef __GNUC__
|
||||
#warning FIXME: need vectors clipoard
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -219,9 +235,11 @@ vectors_paste_vectors_cmd_callback (GtkWidget *widget,
|
|||
gpointer data)
|
||||
{
|
||||
GimpImage *gimage;
|
||||
return_if_no_image (gimage);
|
||||
return_if_no_image (gimage, data);
|
||||
|
||||
/* TODO */
|
||||
#ifdef __GNUC__
|
||||
#warning FIXME: need vectors clipoard
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -229,9 +247,11 @@ vectors_import_vectors_cmd_callback (GtkWidget *widget,
|
|||
gpointer data)
|
||||
{
|
||||
GimpImage *gimage;
|
||||
return_if_no_image (gimage);
|
||||
return_if_no_image (gimage, data);
|
||||
|
||||
/* TODO */
|
||||
#ifdef __GNUC__
|
||||
#warning FIXME: need vectors import/export
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -240,9 +260,11 @@ vectors_export_vectors_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GimpImage *gimage;
|
||||
GimpVectors *active_vectors;
|
||||
return_if_no_vectors (gimage, active_vectors);
|
||||
return_if_no_vectors (gimage, active_vectors, data);
|
||||
|
||||
/* TODO */
|
||||
#ifdef __GNUC__
|
||||
#warning FIXME: need vectors import/export
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -251,7 +273,7 @@ vectors_vectors_tool_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GimpImage *gimage;
|
||||
GimpVectors *active_vectors;
|
||||
return_if_no_vectors (gimage, active_vectors);
|
||||
return_if_no_vectors (gimage, active_vectors, data);
|
||||
|
||||
vectors_vectors_tool (active_vectors);
|
||||
}
|
||||
|
@ -262,7 +284,7 @@ vectors_edit_vectors_attributes_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GimpImage *gimage;
|
||||
GimpVectors *active_vectors;
|
||||
return_if_no_vectors (gimage, active_vectors);
|
||||
return_if_no_vectors (gimage, active_vectors, data);
|
||||
|
||||
vectors_edit_vectors_query (active_vectors);
|
||||
}
|
||||
|
|
|
@ -45,7 +45,12 @@
|
|||
|
||||
|
||||
#define return_if_no_display(gdisp, data) \
|
||||
gdisp = gimp_context_get_display (gimp_get_user_context (GIMP (data))); \
|
||||
if (GIMP_IS_DISPLAY (data)) \
|
||||
gdisp = data; \
|
||||
else if (GIMP_IS_GIMP (data)) \
|
||||
gdisp = gimp_context_get_display (gimp_get_user_context (GIMP (data))); \
|
||||
else \
|
||||
gdisp = NULL; \
|
||||
if (! gdisp) \
|
||||
return
|
||||
|
||||
|
@ -201,17 +206,22 @@ void
|
|||
view_toggle_rulers_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GimpDisplay *gdisp;
|
||||
GimpDisplayShell *shell;
|
||||
GimpDisplay *gdisp;
|
||||
GimpDisplayShell *shell;
|
||||
GimpDisplayConfig *config;
|
||||
return_if_no_display (gdisp, data);
|
||||
|
||||
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
|
||||
|
||||
config = GIMP_DISPLAY_CONFIG (gdisp->gimage->gimp->config);
|
||||
|
||||
if (! GTK_CHECK_MENU_ITEM (widget)->active)
|
||||
{
|
||||
if (GTK_WIDGET_VISIBLE (shell->origin))
|
||||
if (GTK_WIDGET_VISIBLE (shell->hrule))
|
||||
{
|
||||
gtk_widget_hide (shell->origin);
|
||||
if (! config->menu_bar_per_display)
|
||||
gtk_widget_hide (shell->origin);
|
||||
|
||||
gtk_widget_hide (shell->hrule);
|
||||
gtk_widget_hide (shell->vrule);
|
||||
|
||||
|
@ -220,9 +230,11 @@ view_toggle_rulers_cmd_callback (GtkWidget *widget,
|
|||
}
|
||||
else
|
||||
{
|
||||
if (! GTK_WIDGET_VISIBLE (shell->origin))
|
||||
if (! GTK_WIDGET_VISIBLE (shell->hrule))
|
||||
{
|
||||
gtk_widget_show (shell->origin);
|
||||
if (! config->menu_bar_per_display)
|
||||
gtk_widget_show (shell->origin);
|
||||
|
||||
gtk_widget_show (shell->hrule);
|
||||
gtk_widget_show (shell->vrule);
|
||||
|
||||
|
|
|
@ -38,6 +38,8 @@
|
|||
|
||||
#include "file/file-utils.h"
|
||||
|
||||
#include "plug-in/plug-ins.h"
|
||||
|
||||
#include "widgets/gimpitemfactory.h"
|
||||
|
||||
#include "brushes-commands.h"
|
||||
|
@ -62,6 +64,7 @@
|
|||
#include "paths-dialog.h"
|
||||
#include "patterns-commands.h"
|
||||
#include "plug-in-commands.h"
|
||||
#include "plug-in-menus.h"
|
||||
#include "qmask-commands.h"
|
||||
#include "select-commands.h"
|
||||
#include "test-commands.h"
|
||||
|
@ -86,8 +89,11 @@ static void menus_last_opened_reorder (GimpContainer *container,
|
|||
GimpImagefile *unused1,
|
||||
gint unused2,
|
||||
GimpItemFactory *item_factory);
|
||||
static void menus_color_changed (GimpContext *context,
|
||||
const GimpRGB *unused,
|
||||
static void menus_foreground_changed (GimpContext *context,
|
||||
const GimpRGB *color,
|
||||
GimpItemFactory *item_factory);
|
||||
static void menus_background_changed (GimpContext *context,
|
||||
const GimpRGB *color,
|
||||
GimpItemFactory *item_factory);
|
||||
static void menus_filters_subdirs_to_top (GtkMenu *menu);
|
||||
#ifdef ENABLE_DEBUG_ENTRIES
|
||||
|
@ -1001,7 +1007,7 @@ static GimpItemFactoryEntry image_entries[] =
|
|||
"gimp-error-console",
|
||||
"dialogs/error_console.html", NULL },
|
||||
|
||||
SEPARATOR ("/---"),
|
||||
SEPARATOR ("/filters-separator"),
|
||||
|
||||
/* <Image>/Filters */
|
||||
|
||||
|
@ -2056,11 +2062,288 @@ static GList *all_factories = NULL;
|
|||
|
||||
/* public functions */
|
||||
|
||||
GimpItemFactory *
|
||||
menus_get_new_image_factory (Gimp *gimp,
|
||||
gpointer callback_data,
|
||||
gboolean menu_bar)
|
||||
{
|
||||
GimpItemFactory *image_factory;
|
||||
|
||||
if (! GIMP_DISPLAY_CONFIG (gimp->config)->menu_bar_per_display)
|
||||
{
|
||||
image_factory = gimp_item_factory_from_path ("<Image>");
|
||||
|
||||
if (image_factory)
|
||||
return image_factory;
|
||||
}
|
||||
|
||||
image_factory = gimp_item_factory_new (gimp,
|
||||
menu_bar ?
|
||||
GTK_TYPE_MENU_BAR : GTK_TYPE_MENU,
|
||||
"<Image>", "image",
|
||||
NULL,
|
||||
G_N_ELEMENTS (image_entries),
|
||||
image_entries,
|
||||
callback_data,
|
||||
TRUE);
|
||||
menus_last_opened_add (image_factory, gimp);
|
||||
|
||||
/* create tool menu items */
|
||||
{
|
||||
static const gchar *color_tools[] = { "gimp-color-balance-tool",
|
||||
"gimp-hue-saturation-tool",
|
||||
"gimp-brightness-contrast-tool",
|
||||
"gimp-threshold-tool",
|
||||
"gimp-levels-tool",
|
||||
"gimp-curves-tool" };
|
||||
GtkWidget *menu_item;
|
||||
GimpToolInfo *tool_info;
|
||||
GList *list;
|
||||
gint i;
|
||||
|
||||
for (list = GIMP_LIST (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;
|
||||
|
||||
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 = "<StockItem>";
|
||||
entry.entry.extra_data = tool_info->stock_id;
|
||||
entry.quark_string = NULL;
|
||||
entry.help_page = tool_info->help_data;
|
||||
entry.description = NULL;
|
||||
|
||||
gimp_item_factory_create_item (image_factory,
|
||||
&entry,
|
||||
NULL,
|
||||
tool_info, 2,
|
||||
TRUE, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
/* reorder <Image>/Image/Colors */
|
||||
tool_info = (GimpToolInfo *)
|
||||
gimp_container_get_child_by_name (gimp->tool_info_list,
|
||||
"gimp-posterize-tool");
|
||||
|
||||
menu_item = gtk_item_factory_get_widget (GTK_ITEM_FACTORY (image_factory),
|
||||
tool_info->menu_path);
|
||||
if (menu_item && menu_item->parent)
|
||||
gtk_menu_reorder_child (GTK_MENU (menu_item->parent), menu_item, 4);
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (color_tools); i++)
|
||||
{
|
||||
tool_info = (GimpToolInfo *)
|
||||
gimp_container_get_child_by_name (gimp->tool_info_list,
|
||||
color_tools[i]);
|
||||
|
||||
menu_item = gtk_item_factory_get_widget (GTK_ITEM_FACTORY (image_factory),
|
||||
tool_info->menu_path);
|
||||
if (menu_item && menu_item->parent)
|
||||
{
|
||||
gtk_menu_reorder_child (GTK_MENU (menu_item->parent),
|
||||
menu_item, i + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
GimpContext *user_context;
|
||||
GimpRGB fg;
|
||||
GimpRGB bg;
|
||||
|
||||
user_context = gimp_get_user_context (gimp);
|
||||
|
||||
g_signal_connect_object (G_OBJECT (user_context), "foreground_changed",
|
||||
G_CALLBACK (menus_foreground_changed),
|
||||
image_factory, 0);
|
||||
g_signal_connect_object (G_OBJECT (user_context), "background_changed",
|
||||
G_CALLBACK (menus_background_changed),
|
||||
image_factory, 0);
|
||||
|
||||
gimp_context_get_foreground (user_context, &fg);
|
||||
gimp_context_get_background (user_context, &bg);
|
||||
|
||||
menus_foreground_changed (user_context, &fg, image_factory);
|
||||
menus_background_changed (user_context, &bg, image_factory);
|
||||
}
|
||||
|
||||
plug_in_make_menu (image_factory, proc_defs);
|
||||
|
||||
{
|
||||
static gchar *rotate_plugins[] = { "Rotate 90 degrees",
|
||||
"Rotate 180 degrees",
|
||||
"Rotate 270 degrees" };
|
||||
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 "<Image>/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 (image_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 Rotate plugin menu entries */
|
||||
pos = 1;
|
||||
for (i = 0; i < G_N_ELEMENTS (rotate_plugins); i++)
|
||||
{
|
||||
path = g_strconcat ("/Image/Transform/", rotate_plugins[i], NULL);
|
||||
menu_item = gtk_item_factory_get_widget (GTK_ITEM_FACTORY (image_factory),
|
||||
path);
|
||||
g_free (path);
|
||||
|
||||
if (menu_item && menu_item->parent)
|
||||
{
|
||||
gtk_menu_reorder_child (GTK_MENU (menu_item->parent),
|
||||
menu_item, pos);
|
||||
pos++;
|
||||
}
|
||||
}
|
||||
|
||||
pos = 1;
|
||||
for (i = 0; i < G_N_ELEMENTS (rotate_plugins); i++)
|
||||
{
|
||||
path = g_strconcat ("/Layer/Transform/", rotate_plugins[i], NULL);
|
||||
menu_item = gtk_item_factory_get_widget (GTK_ITEM_FACTORY (image_factory),
|
||||
path);
|
||||
g_free (path);
|
||||
|
||||
if (menu_item && menu_item->parent)
|
||||
{
|
||||
gtk_menu_reorder_child (GTK_MENU (menu_item->parent),
|
||||
menu_item, pos);
|
||||
pos++;
|
||||
}
|
||||
}
|
||||
|
||||
/* Reorder "<Image>/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 (image_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 (image_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 (image_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 "<Image>/Filters/Toys"
|
||||
* before the separator after "<Image>/Filters/Web"
|
||||
*/
|
||||
menu_item = gtk_item_factory_get_widget (GTK_ITEM_FACTORY (image_factory),
|
||||
"/Filters/---INSERT");
|
||||
|
||||
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 (image_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++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return image_factory;
|
||||
}
|
||||
|
||||
void
|
||||
menus_init (Gimp *gimp)
|
||||
{
|
||||
GimpItemFactory *toolbox_factory;
|
||||
GimpItemFactory *image_factory;
|
||||
gchar *filename;
|
||||
|
||||
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
||||
g_return_if_fail (menus_initialized == FALSE);
|
||||
|
@ -2080,16 +2363,7 @@ menus_init (Gimp *gimp)
|
|||
menus_last_opened_add (toolbox_factory, gimp);
|
||||
ADD_FACTORY (toolbox_factory);
|
||||
|
||||
image_factory = gimp_item_factory_new (gimp,
|
||||
GTK_TYPE_MENU,
|
||||
"<Image>", "image",
|
||||
NULL,
|
||||
G_N_ELEMENTS (image_entries),
|
||||
image_entries,
|
||||
gimp,
|
||||
TRUE);
|
||||
menus_last_opened_add (image_factory, gimp);
|
||||
ADD_FACTORY (image_factory);
|
||||
ADD_FACTORY (menus_get_new_image_factory (gimp, gimp, FALSE));
|
||||
|
||||
ADD_FACTORY (gimp_item_factory_new (gimp,
|
||||
GTK_TYPE_MENU,
|
||||
|
@ -2236,123 +2510,20 @@ menus_init (Gimp *gimp)
|
|||
gimp,
|
||||
FALSE));
|
||||
|
||||
filename = gimp_personal_rc_file ("menurc");
|
||||
gtk_accel_map_load (filename);
|
||||
g_free (filename);
|
||||
|
||||
#undef ADD_FACTORY
|
||||
|
||||
/* create tool menu items */
|
||||
{
|
||||
static const gchar *color_tools[] = { "gimp-color-balance-tool",
|
||||
"gimp-hue-saturation-tool",
|
||||
"gimp-brightness-contrast-tool",
|
||||
"gimp-threshold-tool",
|
||||
"gimp-levels-tool",
|
||||
"gimp-curves-tool" };
|
||||
GtkWidget *menu_item;
|
||||
GimpToolInfo *tool_info;
|
||||
GList *list;
|
||||
gint i;
|
||||
|
||||
for (list = GIMP_LIST (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;
|
||||
|
||||
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 = "<StockItem>";
|
||||
entry.entry.extra_data = tool_info->stock_id;
|
||||
entry.quark_string = NULL;
|
||||
entry.help_page = tool_info->help_data;
|
||||
entry.description = NULL;
|
||||
|
||||
gimp_item_factory_create_item (image_factory,
|
||||
&entry,
|
||||
NULL,
|
||||
tool_info, 2,
|
||||
TRUE, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
/* reorder <Image>/Image/Colors */
|
||||
tool_info = (GimpToolInfo *)
|
||||
gimp_container_get_child_by_name (gimp->tool_info_list,
|
||||
"gimp-posterize-tool");
|
||||
|
||||
menu_item = gtk_item_factory_get_widget (GTK_ITEM_FACTORY (image_factory),
|
||||
tool_info->menu_path);
|
||||
if (menu_item && menu_item->parent)
|
||||
gtk_menu_reorder_child (GTK_MENU (menu_item->parent), menu_item, 4);
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (color_tools); i++)
|
||||
{
|
||||
tool_info = (GimpToolInfo *)
|
||||
gimp_container_get_child_by_name (gimp->tool_info_list,
|
||||
color_tools[i]);
|
||||
|
||||
menu_item = gtk_item_factory_get_widget (GTK_ITEM_FACTORY (image_factory),
|
||||
tool_info->menu_path);
|
||||
if (menu_item && menu_item->parent)
|
||||
{
|
||||
gtk_menu_reorder_child (GTK_MENU (menu_item->parent),
|
||||
menu_item, i + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
gchar *filename;
|
||||
|
||||
filename = gimp_personal_rc_file ("menurc");
|
||||
gtk_accel_map_load (filename);
|
||||
g_free (filename);
|
||||
}
|
||||
|
||||
{
|
||||
GimpContext *user_context;
|
||||
|
||||
user_context = gimp_get_user_context (gimp);
|
||||
|
||||
g_signal_connect (G_OBJECT (user_context), "foreground_changed",
|
||||
G_CALLBACK (menus_color_changed),
|
||||
image_factory);
|
||||
g_signal_connect (G_OBJECT (user_context), "background_changed",
|
||||
G_CALLBACK (menus_color_changed),
|
||||
image_factory);
|
||||
|
||||
menus_color_changed (user_context, NULL, image_factory);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
menus_exit (Gimp *gimp)
|
||||
{
|
||||
GimpItemFactory *item_factory;
|
||||
gchar *filename;
|
||||
gchar *filename;
|
||||
|
||||
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
||||
|
||||
item_factory = gimp_item_factory_from_path ("<Toolbox>");
|
||||
g_signal_handlers_disconnect_by_func (G_OBJECT (gimp->documents),
|
||||
menus_last_opened_update,
|
||||
item_factory);
|
||||
g_signal_handlers_disconnect_by_func (G_OBJECT (gimp->documents),
|
||||
menus_last_opened_reorder,
|
||||
item_factory);
|
||||
|
||||
item_factory = gimp_item_factory_from_path ("<Image>");
|
||||
g_signal_handlers_disconnect_by_func (G_OBJECT (gimp->documents),
|
||||
menus_last_opened_update,
|
||||
item_factory);
|
||||
g_signal_handlers_disconnect_by_func (G_OBJECT (gimp->documents),
|
||||
menus_last_opened_reorder,
|
||||
item_factory);
|
||||
|
||||
filename = gimp_personal_rc_file ("menurc");
|
||||
gtk_accel_map_save (filename);
|
||||
g_free (filename);
|
||||
|
@ -2365,22 +2536,12 @@ menus_exit (Gimp *gimp)
|
|||
void
|
||||
menus_restore (Gimp *gimp)
|
||||
{
|
||||
static gchar *rotate_plugins[] = { "Rotate 90 degrees",
|
||||
"Rotate 180 degrees",
|
||||
"Rotate 270 degrees" };
|
||||
static gchar *image_file_entries[] = { "---moved",
|
||||
"Close",
|
||||
"Quit" };
|
||||
static gchar *reorder_submenus[] = { "<Image>/Video",
|
||||
"<Image>/Script-Fu" };
|
||||
static gchar *reorder_subsubmenus[] = { "<Image>/Filters",
|
||||
"<Toolbox>/Xtns" };
|
||||
static gchar *reorder_subsubmenus[] = { "<Toolbox>/Xtns" };
|
||||
|
||||
GimpItemFactory *item_factory;
|
||||
GtkWidget *menu_item;
|
||||
GtkWidget *menu;
|
||||
GList *list;
|
||||
gchar *path;
|
||||
gint i, pos;
|
||||
|
||||
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
||||
|
@ -2412,90 +2573,6 @@ menus_restore (Gimp *gimp)
|
|||
}
|
||||
}
|
||||
|
||||
/* Move all menu items under "<Image>/Filters" which are not submenus or
|
||||
* separators to the top of the menu
|
||||
*/
|
||||
pos = 3;
|
||||
item_factory = gimp_item_factory_from_path ("<Image>");
|
||||
menu_item = gtk_item_factory_get_widget (GTK_ITEM_FACTORY (item_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 Rotate plugin menu entries */
|
||||
pos = 1;
|
||||
for (i = 0; i < G_N_ELEMENTS (rotate_plugins); i++)
|
||||
{
|
||||
path = g_strconcat ("/Image/Transform/", rotate_plugins[i], NULL);
|
||||
menu_item = gtk_item_factory_get_widget (GTK_ITEM_FACTORY (item_factory),
|
||||
path);
|
||||
g_free (path);
|
||||
|
||||
if (menu_item && menu_item->parent)
|
||||
{
|
||||
gtk_menu_reorder_child (GTK_MENU (menu_item->parent), menu_item, pos);
|
||||
pos++;
|
||||
}
|
||||
}
|
||||
|
||||
pos = 1;
|
||||
for (i = 0; i < G_N_ELEMENTS (rotate_plugins); i++)
|
||||
{
|
||||
path = g_strconcat ("/Layer/Transform/", rotate_plugins[i], NULL);
|
||||
menu_item = gtk_item_factory_get_widget (GTK_ITEM_FACTORY (item_factory),
|
||||
path);
|
||||
g_free (path);
|
||||
|
||||
if (menu_item && menu_item->parent)
|
||||
{
|
||||
gtk_menu_reorder_child (GTK_MENU (menu_item->parent), menu_item, pos);
|
||||
pos++;
|
||||
}
|
||||
}
|
||||
|
||||
/* Reorder "<Image>/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 (item_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++)
|
||||
{
|
||||
item_factory = gimp_item_factory_from_path (reorder_submenus[i]);
|
||||
|
||||
menu = gtk_item_factory_get_widget (GTK_ITEM_FACTORY (item_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++)
|
||||
{
|
||||
item_factory = gimp_item_factory_from_path (reorder_subsubmenus[i]);
|
||||
|
@ -2517,46 +2594,6 @@ menus_restore (Gimp *gimp)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Move all submenus which registered after "<Image>/Filters/Toys"
|
||||
* before the separator after "<Image>/Filters/Web"
|
||||
*/
|
||||
item_factory = gimp_item_factory_from_path ("<Image>");
|
||||
menu_item = gtk_item_factory_get_widget (GTK_ITEM_FACTORY (item_factory),
|
||||
"/Filters/---INSERT");
|
||||
|
||||
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 (item_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++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -2617,15 +2654,15 @@ menus_last_opened_add (GimpItemFactory *item_factory,
|
|||
|
||||
g_free (last_opened_entries);
|
||||
|
||||
g_signal_connect (G_OBJECT (gimp->documents), "add",
|
||||
G_CALLBACK (menus_last_opened_update),
|
||||
item_factory);
|
||||
g_signal_connect (G_OBJECT (gimp->documents), "remove",
|
||||
G_CALLBACK (menus_last_opened_update),
|
||||
item_factory);
|
||||
g_signal_connect (G_OBJECT (gimp->documents), "reorder",
|
||||
G_CALLBACK (menus_last_opened_reorder),
|
||||
item_factory);
|
||||
g_signal_connect_object (G_OBJECT (gimp->documents), "add",
|
||||
G_CALLBACK (menus_last_opened_update),
|
||||
item_factory, 0);
|
||||
g_signal_connect_object (G_OBJECT (gimp->documents), "remove",
|
||||
G_CALLBACK (menus_last_opened_update),
|
||||
item_factory, 0);
|
||||
g_signal_connect_object (G_OBJECT (gimp->documents), "reorder",
|
||||
G_CALLBACK (menus_last_opened_reorder),
|
||||
item_factory, 0);
|
||||
|
||||
menus_last_opened_update (gimp->documents, NULL, item_factory);
|
||||
}
|
||||
|
@ -2706,20 +2743,21 @@ menus_last_opened_reorder (GimpContainer *container,
|
|||
}
|
||||
|
||||
static void
|
||||
menus_color_changed (GimpContext *context,
|
||||
const GimpRGB *unused,
|
||||
GimpItemFactory *item_factory)
|
||||
menus_foreground_changed (GimpContext *context,
|
||||
const GimpRGB *color,
|
||||
GimpItemFactory *item_factory)
|
||||
{
|
||||
GimpRGB fg;
|
||||
GimpRGB bg;
|
||||
|
||||
gimp_context_get_foreground (context, &fg);
|
||||
gimp_context_get_background (context, &bg);
|
||||
|
||||
gimp_item_factory_set_color (GTK_ITEM_FACTORY (item_factory),
|
||||
"/Edit/Fill with FG Color", &fg, FALSE);
|
||||
"/Edit/Fill with FG Color", color, FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
menus_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", &bg, FALSE);
|
||||
"/Edit/Fill with BG Color", color, FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -25,4 +25,12 @@ void menus_exit (Gimp *gimp);
|
|||
void menus_restore (Gimp *gimp);
|
||||
|
||||
|
||||
/* FIXME: remove this and add a GimpMenuFactory class which produces
|
||||
* GimpItemFactories on demand
|
||||
*/
|
||||
GimpItemFactory * menus_get_new_image_factory (Gimp *gimp,
|
||||
gpointer callback_data,
|
||||
gboolean menu_bar);
|
||||
|
||||
|
||||
#endif /* __MENUS_H__ */
|
||||
|
|
|
@ -40,101 +40,340 @@
|
|||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
||||
void
|
||||
plug_in_make_menu (GSList *plug_in_defs,
|
||||
const gchar *std_plugins_domain)
|
||||
{
|
||||
PlugInDef *plug_in_def;
|
||||
PlugInProcDef *proc_def;
|
||||
PlugInMenuEntry *menu_entry;
|
||||
GSList *domains = NULL;
|
||||
GSList *procs;
|
||||
GSList *tmp;
|
||||
GTree *menu_entries;
|
||||
typedef struct _PlugInMenuEntry PlugInMenuEntry;
|
||||
|
||||
struct _PlugInMenuEntry
|
||||
{
|
||||
PlugInProcDef *proc_def;
|
||||
const gchar *domain;
|
||||
const gchar *help_path;
|
||||
};
|
||||
|
||||
|
||||
/* local function prototypes */
|
||||
|
||||
static gboolean plug_in_menu_tree_traverse_func (gpointer foo,
|
||||
PlugInMenuEntry *menu_entry,
|
||||
GimpItemFactory *image_factory);
|
||||
static gchar * plug_in_escape_uline (const gchar *menu_path);
|
||||
|
||||
|
||||
/* public functions */
|
||||
|
||||
void
|
||||
plug_in_menus_init (GSList *plug_in_defs,
|
||||
const gchar *std_plugins_domain)
|
||||
{
|
||||
PlugInDef *plug_in_def;
|
||||
GSList *domains = NULL;
|
||||
GSList *tmp;
|
||||
|
||||
g_return_if_fail (plug_in_defs != NULL);
|
||||
g_return_if_fail (std_plugins_domain != NULL);
|
||||
|
||||
domains = g_slist_append (domains, (gpointer) std_plugins_domain);
|
||||
|
||||
#ifdef ENABLE_NLS
|
||||
bindtextdomain (std_plugins_domain, gimp_locale_directory ());
|
||||
bind_textdomain_codeset (std_plugins_domain, "UTF-8");
|
||||
domains = g_slist_append (domains, (gpointer) std_plugins_domain);
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_NLS
|
||||
menu_entries = g_tree_new ((GCompareFunc) strcoll);
|
||||
#else
|
||||
menu_entries = g_tree_new ((GCompareFunc) strcmp);
|
||||
#endif
|
||||
|
||||
tmp = plug_in_defs;
|
||||
while (tmp)
|
||||
for (tmp = plug_in_defs; tmp; tmp = g_slist_next (tmp))
|
||||
{
|
||||
const gchar *locale_domain;
|
||||
const gchar *locale_path;
|
||||
GSList *list;
|
||||
|
||||
plug_in_def = tmp->data;
|
||||
tmp = tmp->next;
|
||||
|
||||
procs = plug_in_def->proc_defs;
|
||||
if (! plug_in_def->proc_defs)
|
||||
continue;
|
||||
|
||||
if (!procs)
|
||||
continue;
|
||||
locale_domain = plug_ins_locale_domain (plug_in_def->prog,
|
||||
&locale_path);
|
||||
|
||||
#ifdef ENABLE_NLS
|
||||
{
|
||||
gchar *domain;
|
||||
GSList *list;
|
||||
gboolean found = FALSE;
|
||||
for (list = domains; list; list = list->next)
|
||||
{
|
||||
if (! strcmp (locale_domain, (gchar *) list->data))
|
||||
break;
|
||||
}
|
||||
|
||||
if (plug_in_def->locale_domain)
|
||||
{
|
||||
domain = plug_in_def->locale_domain;
|
||||
for (list = domains; list && !found; list = list->next)
|
||||
{
|
||||
if (strcmp (domain, (gchar*)(list->data)) == 0)
|
||||
found = TRUE;
|
||||
}
|
||||
if (!found)
|
||||
{
|
||||
domains = g_slist_append (domains, domain);
|
||||
if (plug_in_def->locale_path)
|
||||
bindtextdomain (domain, plug_in_def->locale_path);
|
||||
else
|
||||
bindtextdomain (domain, gimp_locale_directory ());
|
||||
bind_textdomain_codeset (domain, "UTF-8");
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif /* ENABLE_NLS */
|
||||
if (! list)
|
||||
{
|
||||
domains = g_slist_append (domains, (gpointer) locale_domain);
|
||||
|
||||
while (procs)
|
||||
{
|
||||
proc_def = procs->data;
|
||||
procs = procs->next;
|
||||
bindtextdomain (locale_domain, locale_path);
|
||||
bind_textdomain_codeset (locale_domain, "UTF-8");
|
||||
}
|
||||
}
|
||||
|
||||
if (proc_def->prog &&
|
||||
proc_def->menu_path &&
|
||||
! proc_def->extensions &&
|
||||
! proc_def->prefixes &&
|
||||
! proc_def->magics)
|
||||
{
|
||||
menu_entry = g_new0 (PlugInMenuEntry, 1);
|
||||
g_slist_free (domains);
|
||||
}
|
||||
|
||||
menu_entry->proc_def = proc_def;
|
||||
menu_entry->domain = (plug_in_def->locale_domain ?
|
||||
plug_in_def->locale_domain :
|
||||
(gchar *) std_plugins_domain);
|
||||
menu_entry->help_path = plug_in_def->help_path;
|
||||
void
|
||||
plug_in_make_menu (GimpItemFactory *image_factory,
|
||||
GSList *proc_defs)
|
||||
{
|
||||
PlugInProcDef *proc_def;
|
||||
GSList *procs;
|
||||
GTree *menu_entries;
|
||||
|
||||
g_tree_insert (menu_entries,
|
||||
dgettext (menu_entry->domain,
|
||||
proc_def->menu_path),
|
||||
menu_entry);
|
||||
g_return_if_fail (image_factory == NULL ||
|
||||
GIMP_IS_ITEM_FACTORY (image_factory));
|
||||
g_return_if_fail (proc_defs != NULL);
|
||||
|
||||
menu_entries = g_tree_new_full ((GCompareDataFunc) g_utf8_collate, NULL,
|
||||
NULL, g_free);
|
||||
|
||||
for (procs = proc_defs; procs; procs = procs->next)
|
||||
{
|
||||
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 *locale_domain;
|
||||
|
||||
locale_domain = plug_ins_locale_domain (proc_def->prog, NULL);
|
||||
|
||||
menu_entry = g_new0 (PlugInMenuEntry, 1);
|
||||
|
||||
menu_entry->proc_def = proc_def;
|
||||
menu_entry->domain = locale_domain;
|
||||
menu_entry->help_path = plug_ins_help_path (proc_def->prog);
|
||||
|
||||
g_tree_insert (menu_entries,
|
||||
dgettext (locale_domain, proc_def->menu_path),
|
||||
menu_entry);
|
||||
}
|
||||
}
|
||||
|
||||
g_tree_foreach (menu_entries,
|
||||
(GTraverseFunc) plug_in_menu_tree_traverse_func,
|
||||
image_factory);
|
||||
g_tree_destroy (menu_entries);
|
||||
}
|
||||
|
||||
void
|
||||
plug_in_make_menu_entry (GimpItemFactory *image_factory,
|
||||
PlugInProcDef *proc_def,
|
||||
const gchar *domain,
|
||||
const gchar *help_path)
|
||||
{
|
||||
GimpItemFactoryEntry entry;
|
||||
gchar *menu_path;
|
||||
gchar *help_page;
|
||||
gchar *basename;
|
||||
gchar *lowercase_page;
|
||||
|
||||
g_return_if_fail (image_factory == NULL ||
|
||||
GIMP_IS_ITEM_FACTORY (image_factory));
|
||||
|
||||
basename = g_path_get_basename (proc_def->prog);
|
||||
|
||||
if (help_path)
|
||||
{
|
||||
help_page = g_strconcat (help_path,
|
||||
"@", /* HACK: locale subdir */
|
||||
basename,
|
||||
".html",
|
||||
NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
help_page = g_strconcat ("filters/", /* _not_ G_DIR_SEPARATOR_S */
|
||||
basename,
|
||||
".html",
|
||||
NULL);
|
||||
}
|
||||
|
||||
g_free (basename);
|
||||
|
||||
lowercase_page = g_ascii_strdown (help_page, -1);
|
||||
|
||||
g_free (help_page);
|
||||
|
||||
menu_path = plug_in_escape_uline (strstr (proc_def->menu_path, "/"));
|
||||
|
||||
entry.entry.path = 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_page = lowercase_page;
|
||||
entry.description = NULL;
|
||||
|
||||
if (image_factory)
|
||||
{
|
||||
if (! strncmp (proc_def->menu_path, "<Image>", 7))
|
||||
{
|
||||
gimp_item_factory_create_item (image_factory,
|
||||
&entry,
|
||||
domain,
|
||||
&proc_def->db_info, 2,
|
||||
TRUE, FALSE);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
GList *list;
|
||||
|
||||
for (list = gimp_item_factories_from_path (proc_def->menu_path);
|
||||
list;
|
||||
list = g_list_next (list))
|
||||
{
|
||||
GimpItemFactory *item_factory = list->data;
|
||||
|
||||
gimp_item_factory_create_item (item_factory,
|
||||
&entry,
|
||||
domain,
|
||||
&proc_def->db_info, 2,
|
||||
TRUE, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
g_free (menu_path);
|
||||
g_free (lowercase_page);
|
||||
}
|
||||
|
||||
void
|
||||
plug_in_delete_menu_entry (const gchar *menu_path)
|
||||
{
|
||||
GList *list;
|
||||
|
||||
g_return_if_fail (menu_path != NULL);
|
||||
|
||||
for (list = gimp_item_factories_from_path (menu_path);
|
||||
list;
|
||||
list = g_list_next (list))
|
||||
{
|
||||
GtkItemFactory *item_factory = list->data;
|
||||
|
||||
gtk_item_factory_delete_item (GTK_ITEM_FACTORY (item_factory), menu_path);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
plug_in_set_menu_sensitivity (GimpItemFactory *image_factory,
|
||||
GimpImageType type)
|
||||
{
|
||||
PlugInProcDef *proc_def;
|
||||
GSList *tmp;
|
||||
gboolean sensitive = FALSE;
|
||||
|
||||
g_return_if_fail (image_factory == NULL ||
|
||||
GIMP_IS_ITEM_FACTORY (image_factory));
|
||||
|
||||
for (tmp = proc_defs; tmp; tmp = g_slist_next (tmp))
|
||||
{
|
||||
proc_def = tmp->data;
|
||||
|
||||
if (proc_def->image_types_val && proc_def->menu_path)
|
||||
{
|
||||
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 (image_factory && ! strncmp (proc_def->menu_path, "<Image>", 7))
|
||||
gimp_item_factory_set_sensitive (GTK_ITEM_FACTORY (image_factory),
|
||||
proc_def->menu_path,
|
||||
sensitive);
|
||||
else
|
||||
gimp_item_factories_set_sensitive (proc_def->menu_path,
|
||||
proc_def->menu_path,
|
||||
sensitive);
|
||||
|
||||
if (last_plug_in && (last_plug_in == &proc_def->db_info))
|
||||
{
|
||||
gchar *basename;
|
||||
gchar *ellipses;
|
||||
gchar *repeat;
|
||||
gchar *reshow;
|
||||
|
||||
basename = g_path_get_basename (proc_def->menu_path);
|
||||
|
||||
ellipses = strstr (basename, "...");
|
||||
|
||||
if (ellipses && ellipses == (basename + strlen (basename) - 3))
|
||||
*ellipses = '\0';
|
||||
|
||||
repeat = g_strdup_printf (_("Repeat \"%s\""), basename);
|
||||
reshow = g_strdup_printf (_("Re-show \"%s\""), basename);
|
||||
|
||||
g_free (basename);
|
||||
|
||||
gimp_item_factories_set_label ("<Image>",
|
||||
"/Filters/Repeat Last", repeat);
|
||||
gimp_item_factories_set_label ("<Image>",
|
||||
"/Filters/Re-Show Last", reshow);
|
||||
|
||||
g_free (repeat);
|
||||
g_free (reshow);
|
||||
|
||||
gimp_item_factories_set_sensitive ("<Image>",
|
||||
"/Filters/Repeat Last",
|
||||
sensitive);
|
||||
gimp_item_factories_set_sensitive ("<Image>",
|
||||
"/Filters/Re-Show Last",
|
||||
sensitive);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
g_tree_foreach (menu_entries,
|
||||
(GTraverseFunc) plug_in_make_menu_entry,
|
||||
NULL);
|
||||
g_tree_destroy (menu_entries);
|
||||
if (! last_plug_in)
|
||||
{
|
||||
gimp_item_factories_set_label ("<Image>",
|
||||
"/Filters/Repeat Last",
|
||||
_("Repeat Last"));
|
||||
gimp_item_factories_set_label ("<Image>",
|
||||
"/Filters/Re-Show Last",
|
||||
_("Re-Show Last"));
|
||||
|
||||
g_slist_free (domains);
|
||||
gimp_item_factories_set_sensitive ("<Image>",
|
||||
"/Filters/Repeat Last", FALSE);
|
||||
gimp_item_factories_set_sensitive ("<Image>",
|
||||
"/Filters/Re-Show Last", FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* private functions */
|
||||
|
||||
static gboolean
|
||||
plug_in_menu_tree_traverse_func (gpointer foo,
|
||||
PlugInMenuEntry *menu_entry,
|
||||
GimpItemFactory *image_factory)
|
||||
{
|
||||
plug_in_make_menu_entry (image_factory,
|
||||
menu_entry->proc_def,
|
||||
menu_entry->domain,
|
||||
menu_entry->help_path);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gchar *
|
||||
|
@ -166,186 +405,3 @@ plug_in_escape_uline (const gchar *menu_path)
|
|||
|
||||
return escaped;
|
||||
}
|
||||
|
||||
/* The following function has to be a GTraverseFunction,
|
||||
* but is also called directly. Please note that it frees the
|
||||
* menu_entry strcuture. --Sven
|
||||
*/
|
||||
gint
|
||||
plug_in_make_menu_entry (gpointer foo,
|
||||
PlugInMenuEntry *menu_entry,
|
||||
gpointer bar)
|
||||
{
|
||||
GimpItemFactoryEntry entry;
|
||||
gchar *menu_path;
|
||||
gchar *help_page;
|
||||
gchar *basename;
|
||||
gchar *lowercase_page;
|
||||
|
||||
basename = g_path_get_basename (menu_entry->proc_def->prog);
|
||||
|
||||
if (menu_entry->help_path)
|
||||
{
|
||||
help_page = g_strconcat (menu_entry->help_path,
|
||||
"@", /* HACK: locale subdir */
|
||||
basename,
|
||||
".html",
|
||||
NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
help_page = g_strconcat ("filters/", /* _not_ G_DIR_SEPARATOR_S */
|
||||
basename,
|
||||
".html",
|
||||
NULL);
|
||||
}
|
||||
|
||||
g_free (basename);
|
||||
|
||||
lowercase_page = g_ascii_strdown (help_page, -1);
|
||||
|
||||
g_free (help_page);
|
||||
|
||||
menu_path = plug_in_escape_uline (strstr (menu_entry->proc_def->menu_path, "/"));
|
||||
|
||||
entry.entry.path = menu_path;
|
||||
entry.entry.accelerator = menu_entry->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_page = lowercase_page;
|
||||
entry.description = NULL;
|
||||
|
||||
{
|
||||
GimpItemFactory *item_factory;
|
||||
|
||||
item_factory =
|
||||
gimp_item_factory_from_path (menu_entry->proc_def->menu_path);
|
||||
|
||||
gimp_item_factory_create_item (item_factory,
|
||||
&entry,
|
||||
menu_entry->domain,
|
||||
&menu_entry->proc_def->db_info, 2,
|
||||
TRUE, FALSE);
|
||||
}
|
||||
|
||||
g_free (menu_path);
|
||||
g_free (lowercase_page);
|
||||
|
||||
g_free (menu_entry);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
plug_in_delete_menu_entry (const gchar *menu_path)
|
||||
{
|
||||
GimpItemFactory *item_factory;
|
||||
|
||||
item_factory = gimp_item_factory_from_path (menu_path);
|
||||
|
||||
gtk_item_factory_delete_item (GTK_ITEM_FACTORY (item_factory), menu_path);
|
||||
}
|
||||
|
||||
void
|
||||
plug_in_set_menu_sensitivity (GimpImageType type)
|
||||
{
|
||||
GtkItemFactory *item_factory;
|
||||
PlugInProcDef *proc_def;
|
||||
GSList *tmp;
|
||||
gboolean sensitive = FALSE;
|
||||
|
||||
for (tmp = proc_defs; tmp; tmp = g_slist_next (tmp))
|
||||
{
|
||||
proc_def = tmp->data;
|
||||
|
||||
if (proc_def->image_types_val && proc_def->menu_path)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
item_factory =
|
||||
GTK_ITEM_FACTORY (gimp_item_factory_from_path (proc_def->menu_path));
|
||||
|
||||
gimp_item_factory_set_sensitive (item_factory,
|
||||
proc_def->menu_path,
|
||||
sensitive);
|
||||
|
||||
if (last_plug_in && (last_plug_in == &(proc_def->db_info)))
|
||||
{
|
||||
gchar *basename;
|
||||
gchar *ellipses;
|
||||
gchar *repeat;
|
||||
gchar *reshow;
|
||||
|
||||
basename = g_path_get_basename (proc_def->menu_path);
|
||||
|
||||
ellipses = strstr (basename, "...");
|
||||
|
||||
if (ellipses && ellipses == (basename + strlen (basename) - 3))
|
||||
*ellipses = '\0';
|
||||
|
||||
repeat = g_strdup_printf (_("Repeat \"%s\""), basename);
|
||||
reshow = g_strdup_printf (_("Re-show \"%s\""), basename);
|
||||
|
||||
g_free (basename);
|
||||
|
||||
gimp_item_factory_set_label (item_factory,
|
||||
"/Filters/Repeat Last", repeat);
|
||||
gimp_item_factory_set_label (item_factory,
|
||||
"/Filters/Re-Show Last", reshow);
|
||||
|
||||
g_free (repeat);
|
||||
g_free (reshow);
|
||||
|
||||
gimp_item_factory_set_sensitive (item_factory,
|
||||
"/Filters/Repeat Last",
|
||||
sensitive);
|
||||
gimp_item_factory_set_sensitive (item_factory,
|
||||
"/Filters/Re-Show Last",
|
||||
sensitive);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (! last_plug_in)
|
||||
{
|
||||
item_factory =
|
||||
GTK_ITEM_FACTORY (gimp_item_factory_from_path ("<Image>"));
|
||||
|
||||
gimp_item_factory_set_label (item_factory,
|
||||
"/Filters/Repeat Last",
|
||||
_("Repeat Last"));
|
||||
gimp_item_factory_set_label (item_factory,
|
||||
"/Filters/Re-Show Last",
|
||||
_("Re-Show Last"));
|
||||
|
||||
gimp_item_factory_set_sensitive (item_factory,
|
||||
"/Filters/Repeat Last", FALSE);
|
||||
gimp_item_factory_set_sensitive (item_factory,
|
||||
"/Filters/Re-Show Last", FALSE);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,13 +20,18 @@
|
|||
#define __PLUG_IN_MENUS_H__
|
||||
|
||||
|
||||
void plug_in_make_menu (GSList *plug_in_defs,
|
||||
void plug_in_menus_init (GSList *plug_in_defs,
|
||||
const gchar *std_plugins_domain);
|
||||
gint plug_in_make_menu_entry (gpointer foo,
|
||||
PlugInMenuEntry *menu_entry,
|
||||
gpointer bar);
|
||||
|
||||
void plug_in_make_menu (GimpItemFactory *image_factory,
|
||||
GSList *proc_defs);
|
||||
void plug_in_make_menu_entry (GimpItemFactory *image_factory,
|
||||
PlugInProcDef *proc_def,
|
||||
const gchar *locale_domain,
|
||||
const gchar *help_path);
|
||||
void plug_in_delete_menu_entry (const gchar *menu_path);
|
||||
void plug_in_set_menu_sensitivity (GimpImageType type);
|
||||
void plug_in_set_menu_sensitivity (GimpItemFactory *image_factory,
|
||||
GimpImageType type);
|
||||
|
||||
|
||||
#endif /* __PLUG_IN_MENUS_H__ */
|
||||
|
|
|
@ -90,7 +90,6 @@
|
|||
#include "core/gimpenvirontable.h"
|
||||
#include "core/gimpimage.h"
|
||||
|
||||
#include "gui/plug-in-menus.h"
|
||||
#include "gui/brush-select.h"
|
||||
#include "gui/gradient-select.h"
|
||||
#include "gui/palette-select.h"
|
||||
|
@ -1300,15 +1299,14 @@ static void
|
|||
plug_in_handle_proc_install (PlugIn *plug_in,
|
||||
GPProcInstall *proc_install)
|
||||
{
|
||||
PlugInDef *plug_in_def = NULL;
|
||||
PlugInProcDef *proc_def;
|
||||
ProcRecord *proc = NULL;
|
||||
PlugInMenuEntry *menu_entry;
|
||||
GSList *tmp = NULL;
|
||||
gchar *prog = NULL;
|
||||
gboolean add_proc_def;
|
||||
gboolean valid;
|
||||
gint i;
|
||||
PlugInDef *plug_in_def = NULL;
|
||||
PlugInProcDef *proc_def;
|
||||
ProcRecord *proc = NULL;
|
||||
GSList *tmp = NULL;
|
||||
gchar *prog = NULL;
|
||||
gboolean add_proc_def;
|
||||
gboolean valid;
|
||||
gint i;
|
||||
|
||||
/* Argument checking
|
||||
* --only sanity check arguments when the procedure requests a menu path
|
||||
|
@ -1563,38 +1561,11 @@ plug_in_handle_proc_install (PlugIn *plug_in,
|
|||
plug_in->temp_proc_defs = g_slist_prepend (plug_in->temp_proc_defs,
|
||||
proc_def);
|
||||
|
||||
proc_defs = g_slist_append (proc_defs, proc_def);
|
||||
proc->exec_method.temporary.plug_in = plug_in;
|
||||
procedural_db_register (plug_in->gimp, proc);
|
||||
|
||||
if (! plug_in->gimp->no_interface)
|
||||
{
|
||||
/* If there is a menu path specified, create a menu entry */
|
||||
if (proc_install->menu_path)
|
||||
{
|
||||
menu_entry = g_new (PlugInMenuEntry, 1);
|
||||
menu_entry->proc_def = proc_def;
|
||||
|
||||
/* Below we use a hack to allow translations of Script-Fu paths.
|
||||
* Would be nice if we could solve this properly, but I haven't
|
||||
* found a way yet ... (Sven)
|
||||
*/
|
||||
if (plug_in_def && plug_in_def->locale_domain)
|
||||
menu_entry->domain = plug_in_def->locale_domain;
|
||||
else if (strncmp (proc_def->db_info.name, "script_fu", 9) == 0)
|
||||
menu_entry->domain = "gimp14-script-fu";
|
||||
else
|
||||
menu_entry->domain = std_plugins_domain;
|
||||
|
||||
if (plug_in_def)
|
||||
menu_entry->help_path = plug_in_def->help_path;
|
||||
else
|
||||
menu_entry->help_path = NULL;
|
||||
|
||||
/* plug_in_make_menu_entry frees the menu_entry for us */
|
||||
plug_in_make_menu_entry (NULL, menu_entry, NULL);
|
||||
}
|
||||
}
|
||||
plug_ins_proc_def_add (proc_def, plug_in->gimp,
|
||||
plug_in_def ? plug_in_def->locale_domain : NULL,
|
||||
plug_in_def ? plug_in_def->help_path : NULL);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -90,7 +90,6 @@
|
|||
#include "core/gimpenvirontable.h"
|
||||
#include "core/gimpimage.h"
|
||||
|
||||
#include "gui/plug-in-menus.h"
|
||||
#include "gui/brush-select.h"
|
||||
#include "gui/gradient-select.h"
|
||||
#include "gui/palette-select.h"
|
||||
|
@ -1300,15 +1299,14 @@ static void
|
|||
plug_in_handle_proc_install (PlugIn *plug_in,
|
||||
GPProcInstall *proc_install)
|
||||
{
|
||||
PlugInDef *plug_in_def = NULL;
|
||||
PlugInProcDef *proc_def;
|
||||
ProcRecord *proc = NULL;
|
||||
PlugInMenuEntry *menu_entry;
|
||||
GSList *tmp = NULL;
|
||||
gchar *prog = NULL;
|
||||
gboolean add_proc_def;
|
||||
gboolean valid;
|
||||
gint i;
|
||||
PlugInDef *plug_in_def = NULL;
|
||||
PlugInProcDef *proc_def;
|
||||
ProcRecord *proc = NULL;
|
||||
GSList *tmp = NULL;
|
||||
gchar *prog = NULL;
|
||||
gboolean add_proc_def;
|
||||
gboolean valid;
|
||||
gint i;
|
||||
|
||||
/* Argument checking
|
||||
* --only sanity check arguments when the procedure requests a menu path
|
||||
|
@ -1563,38 +1561,11 @@ plug_in_handle_proc_install (PlugIn *plug_in,
|
|||
plug_in->temp_proc_defs = g_slist_prepend (plug_in->temp_proc_defs,
|
||||
proc_def);
|
||||
|
||||
proc_defs = g_slist_append (proc_defs, proc_def);
|
||||
proc->exec_method.temporary.plug_in = plug_in;
|
||||
procedural_db_register (plug_in->gimp, proc);
|
||||
|
||||
if (! plug_in->gimp->no_interface)
|
||||
{
|
||||
/* If there is a menu path specified, create a menu entry */
|
||||
if (proc_install->menu_path)
|
||||
{
|
||||
menu_entry = g_new (PlugInMenuEntry, 1);
|
||||
menu_entry->proc_def = proc_def;
|
||||
|
||||
/* Below we use a hack to allow translations of Script-Fu paths.
|
||||
* Would be nice if we could solve this properly, but I haven't
|
||||
* found a way yet ... (Sven)
|
||||
*/
|
||||
if (plug_in_def && plug_in_def->locale_domain)
|
||||
menu_entry->domain = plug_in_def->locale_domain;
|
||||
else if (strncmp (proc_def->db_info.name, "script_fu", 9) == 0)
|
||||
menu_entry->domain = "gimp14-script-fu";
|
||||
else
|
||||
menu_entry->domain = std_plugins_domain;
|
||||
|
||||
if (plug_in_def)
|
||||
menu_entry->help_path = plug_in_def->help_path;
|
||||
else
|
||||
menu_entry->help_path = NULL;
|
||||
|
||||
/* plug_in_make_menu_entry frees the menu_entry for us */
|
||||
plug_in_make_menu_entry (NULL, menu_entry, NULL);
|
||||
}
|
||||
}
|
||||
plug_ins_proc_def_add (proc_def, plug_in->gimp,
|
||||
plug_in_def ? plug_in_def->locale_domain : NULL,
|
||||
plug_in_def ? plug_in_def->help_path : NULL);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,14 +57,6 @@ struct _PlugIn
|
|||
};
|
||||
|
||||
|
||||
struct _PlugInMenuEntry
|
||||
{
|
||||
PlugInProcDef *proc_def;
|
||||
const gchar *domain;
|
||||
const gchar *help_path;
|
||||
};
|
||||
|
||||
|
||||
void plug_in_init (Gimp *gimp);
|
||||
void plug_in_kill (Gimp *gimp);
|
||||
|
||||
|
|
|
@ -90,7 +90,6 @@
|
|||
#include "core/gimpenvirontable.h"
|
||||
#include "core/gimpimage.h"
|
||||
|
||||
#include "gui/plug-in-menus.h"
|
||||
#include "gui/brush-select.h"
|
||||
#include "gui/gradient-select.h"
|
||||
#include "gui/palette-select.h"
|
||||
|
@ -1300,15 +1299,14 @@ static void
|
|||
plug_in_handle_proc_install (PlugIn *plug_in,
|
||||
GPProcInstall *proc_install)
|
||||
{
|
||||
PlugInDef *plug_in_def = NULL;
|
||||
PlugInProcDef *proc_def;
|
||||
ProcRecord *proc = NULL;
|
||||
PlugInMenuEntry *menu_entry;
|
||||
GSList *tmp = NULL;
|
||||
gchar *prog = NULL;
|
||||
gboolean add_proc_def;
|
||||
gboolean valid;
|
||||
gint i;
|
||||
PlugInDef *plug_in_def = NULL;
|
||||
PlugInProcDef *proc_def;
|
||||
ProcRecord *proc = NULL;
|
||||
GSList *tmp = NULL;
|
||||
gchar *prog = NULL;
|
||||
gboolean add_proc_def;
|
||||
gboolean valid;
|
||||
gint i;
|
||||
|
||||
/* Argument checking
|
||||
* --only sanity check arguments when the procedure requests a menu path
|
||||
|
@ -1563,38 +1561,11 @@ plug_in_handle_proc_install (PlugIn *plug_in,
|
|||
plug_in->temp_proc_defs = g_slist_prepend (plug_in->temp_proc_defs,
|
||||
proc_def);
|
||||
|
||||
proc_defs = g_slist_append (proc_defs, proc_def);
|
||||
proc->exec_method.temporary.plug_in = plug_in;
|
||||
procedural_db_register (plug_in->gimp, proc);
|
||||
|
||||
if (! plug_in->gimp->no_interface)
|
||||
{
|
||||
/* If there is a menu path specified, create a menu entry */
|
||||
if (proc_install->menu_path)
|
||||
{
|
||||
menu_entry = g_new (PlugInMenuEntry, 1);
|
||||
menu_entry->proc_def = proc_def;
|
||||
|
||||
/* Below we use a hack to allow translations of Script-Fu paths.
|
||||
* Would be nice if we could solve this properly, but I haven't
|
||||
* found a way yet ... (Sven)
|
||||
*/
|
||||
if (plug_in_def && plug_in_def->locale_domain)
|
||||
menu_entry->domain = plug_in_def->locale_domain;
|
||||
else if (strncmp (proc_def->db_info.name, "script_fu", 9) == 0)
|
||||
menu_entry->domain = "gimp14-script-fu";
|
||||
else
|
||||
menu_entry->domain = std_plugins_domain;
|
||||
|
||||
if (plug_in_def)
|
||||
menu_entry->help_path = plug_in_def->help_path;
|
||||
else
|
||||
menu_entry->help_path = NULL;
|
||||
|
||||
/* plug_in_make_menu_entry frees the menu_entry for us */
|
||||
plug_in_make_menu_entry (NULL, menu_entry, NULL);
|
||||
}
|
||||
}
|
||||
plug_ins_proc_def_add (proc_def, plug_in->gimp,
|
||||
plug_in_def ? plug_in_def->locale_domain : NULL,
|
||||
plug_in_def ? plug_in_def->help_path : NULL);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -90,7 +90,6 @@
|
|||
#include "core/gimpenvirontable.h"
|
||||
#include "core/gimpimage.h"
|
||||
|
||||
#include "gui/plug-in-menus.h"
|
||||
#include "gui/brush-select.h"
|
||||
#include "gui/gradient-select.h"
|
||||
#include "gui/palette-select.h"
|
||||
|
@ -1300,15 +1299,14 @@ static void
|
|||
plug_in_handle_proc_install (PlugIn *plug_in,
|
||||
GPProcInstall *proc_install)
|
||||
{
|
||||
PlugInDef *plug_in_def = NULL;
|
||||
PlugInProcDef *proc_def;
|
||||
ProcRecord *proc = NULL;
|
||||
PlugInMenuEntry *menu_entry;
|
||||
GSList *tmp = NULL;
|
||||
gchar *prog = NULL;
|
||||
gboolean add_proc_def;
|
||||
gboolean valid;
|
||||
gint i;
|
||||
PlugInDef *plug_in_def = NULL;
|
||||
PlugInProcDef *proc_def;
|
||||
ProcRecord *proc = NULL;
|
||||
GSList *tmp = NULL;
|
||||
gchar *prog = NULL;
|
||||
gboolean add_proc_def;
|
||||
gboolean valid;
|
||||
gint i;
|
||||
|
||||
/* Argument checking
|
||||
* --only sanity check arguments when the procedure requests a menu path
|
||||
|
@ -1563,38 +1561,11 @@ plug_in_handle_proc_install (PlugIn *plug_in,
|
|||
plug_in->temp_proc_defs = g_slist_prepend (plug_in->temp_proc_defs,
|
||||
proc_def);
|
||||
|
||||
proc_defs = g_slist_append (proc_defs, proc_def);
|
||||
proc->exec_method.temporary.plug_in = plug_in;
|
||||
procedural_db_register (plug_in->gimp, proc);
|
||||
|
||||
if (! plug_in->gimp->no_interface)
|
||||
{
|
||||
/* If there is a menu path specified, create a menu entry */
|
||||
if (proc_install->menu_path)
|
||||
{
|
||||
menu_entry = g_new (PlugInMenuEntry, 1);
|
||||
menu_entry->proc_def = proc_def;
|
||||
|
||||
/* Below we use a hack to allow translations of Script-Fu paths.
|
||||
* Would be nice if we could solve this properly, but I haven't
|
||||
* found a way yet ... (Sven)
|
||||
*/
|
||||
if (plug_in_def && plug_in_def->locale_domain)
|
||||
menu_entry->domain = plug_in_def->locale_domain;
|
||||
else if (strncmp (proc_def->db_info.name, "script_fu", 9) == 0)
|
||||
menu_entry->domain = "gimp14-script-fu";
|
||||
else
|
||||
menu_entry->domain = std_plugins_domain;
|
||||
|
||||
if (plug_in_def)
|
||||
menu_entry->help_path = plug_in_def->help_path;
|
||||
else
|
||||
menu_entry->help_path = NULL;
|
||||
|
||||
/* plug_in_make_menu_entry frees the menu_entry for us */
|
||||
plug_in_make_menu_entry (NULL, menu_entry, NULL);
|
||||
}
|
||||
}
|
||||
plug_ins_proc_def_add (proc_def, plug_in->gimp,
|
||||
plug_in_def ? plug_in_def->locale_domain : NULL,
|
||||
plug_in_def ? plug_in_def->help_path : NULL);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,6 +35,11 @@
|
|||
#include "core/gimpdrawable.h"
|
||||
#include "core/gimpimage.h"
|
||||
|
||||
#ifdef __GNUC__
|
||||
#warning FIXME #include "gui/gui-types.h"
|
||||
#endif
|
||||
#include "gui/gui-types.h"
|
||||
|
||||
#include "gui/plug-in-menus.h"
|
||||
|
||||
#include "plug-in.h"
|
||||
|
@ -48,7 +53,19 @@
|
|||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
||||
typedef struct _PlugInHelpPathDef PlugInHelpPathDef;
|
||||
#define STD_PLUGINS_DOMAIN "gimp14-std-plug-ins"
|
||||
#define SCRIPT_FU_DOMAIN "gimp14-script-fu"
|
||||
|
||||
|
||||
typedef struct _PlugInLocaleDomainDef PlugInLocaleDomainDef;
|
||||
typedef struct _PlugInHelpPathDef PlugInHelpPathDef;
|
||||
|
||||
struct _PlugInLocaleDomainDef
|
||||
{
|
||||
gchar *prog_name;
|
||||
gchar *locale_domain;
|
||||
gchar *locale_path;
|
||||
};
|
||||
|
||||
struct _PlugInHelpPathDef
|
||||
{
|
||||
|
@ -65,10 +82,10 @@ static void plug_ins_proc_def_dead (void *freed_proc_def);
|
|||
|
||||
|
||||
GSList *proc_defs = NULL;
|
||||
const gchar *std_plugins_domain = "gimp14-std-plug-ins";
|
||||
|
||||
static GSList *plug_in_defs = NULL;
|
||||
static GSList *gimprc_proc_defs = NULL;
|
||||
static GSList *locale_domain_defs = NULL;
|
||||
static GSList *help_path_defs = NULL;
|
||||
|
||||
static gboolean write_pluginrc = FALSE;
|
||||
|
@ -156,7 +173,7 @@ plug_ins_init (Gimp *gimp,
|
|||
{
|
||||
proc_def = tmp2->data;
|
||||
|
||||
proc_def->mtime = plug_in_def->mtime;
|
||||
proc_def->mtime = plug_in_def->mtime;
|
||||
plug_ins_proc_def_insert (proc_def, plug_ins_proc_def_dead);
|
||||
}
|
||||
}
|
||||
|
@ -175,64 +192,25 @@ plug_ins_init (Gimp *gimp,
|
|||
/* add the plug-in procs to the procedure database */
|
||||
plug_ins_add_to_db (gimp);
|
||||
|
||||
if (! gimp->no_interface)
|
||||
{
|
||||
/* make the menu */
|
||||
plug_in_make_menu (plug_in_defs, std_plugins_domain);
|
||||
}
|
||||
|
||||
/* initial the plug-ins */
|
||||
(* status_callback) (_("Initializing Plug-ins"), "", 0);
|
||||
|
||||
for (tmp = plug_in_defs, nth = 0; tmp; tmp = g_slist_next (tmp), nth++)
|
||||
{
|
||||
plug_in_def = tmp->data;
|
||||
|
||||
if (plug_in_def->has_init)
|
||||
{
|
||||
if (gimp->be_verbose)
|
||||
g_print (_("initializing plug-in: \"%s\"\n"), plug_in_def->prog);
|
||||
|
||||
plug_in_call_init (gimp, plug_in_def);
|
||||
}
|
||||
|
||||
basename = g_path_get_basename (plug_in_def->prog);
|
||||
(* status_callback) (NULL, basename, nth / nplugins);
|
||||
g_free (basename);
|
||||
}
|
||||
|
||||
/* run the available extensions */
|
||||
if (gimp->be_verbose)
|
||||
g_print (_("Starting extensions: "));
|
||||
|
||||
(* status_callback) (_("Starting Extensions"), "", 0);
|
||||
nplugins = g_slist_length (proc_defs);
|
||||
|
||||
for (tmp = proc_defs, nth = 0; tmp; tmp = g_slist_next (tmp), nth++)
|
||||
{
|
||||
proc_def = tmp->data;
|
||||
|
||||
if (proc_def->prog &&
|
||||
(proc_def->db_info.num_args == 0) &&
|
||||
(proc_def->db_info.proc_type == GIMP_EXTENSION))
|
||||
{
|
||||
if (gimp->be_verbose)
|
||||
g_print ("%s ", proc_def->db_info.name);
|
||||
|
||||
(* status_callback) (NULL, proc_def->db_info.name, nth / nplugins);
|
||||
|
||||
plug_in_run (gimp, &proc_def->db_info, NULL, 0, FALSE, TRUE, -1);
|
||||
}
|
||||
}
|
||||
|
||||
if (gimp->be_verbose)
|
||||
g_print ("\n");
|
||||
|
||||
/* create help path list and free up stuff */
|
||||
/* create help_path and locale_domain lists */
|
||||
for (tmp = plug_in_defs; tmp; tmp = g_slist_next (tmp))
|
||||
{
|
||||
plug_in_def = tmp->data;
|
||||
|
||||
if (plug_in_def->locale_domain)
|
||||
{
|
||||
PlugInLocaleDomainDef *locale_domain_def;
|
||||
|
||||
locale_domain_def = g_new (PlugInLocaleDomainDef, 1);
|
||||
|
||||
locale_domain_def->prog_name = g_strdup (plug_in_def->prog);
|
||||
locale_domain_def->locale_domain = g_strdup (plug_in_def->locale_domain);
|
||||
locale_domain_def->locale_path = g_strdup (plug_in_def->locale_path);
|
||||
|
||||
locale_domain_defs = g_slist_prepend (locale_domain_defs,
|
||||
locale_domain_def);
|
||||
}
|
||||
|
||||
if (plug_in_def->help_path)
|
||||
{
|
||||
PlugInHelpPathDef *help_path_def;
|
||||
|
@ -244,6 +222,61 @@ plug_ins_init (Gimp *gimp,
|
|||
|
||||
help_path_defs = g_slist_prepend (help_path_defs, help_path_def);
|
||||
}
|
||||
}
|
||||
|
||||
if (! gimp->no_interface)
|
||||
{
|
||||
plug_in_menus_init (plug_in_defs, STD_PLUGINS_DOMAIN);
|
||||
|
||||
/* make the menu */
|
||||
plug_in_make_menu (NULL, proc_defs);
|
||||
}
|
||||
|
||||
/* initial the plug-ins */
|
||||
(* status_callback) (_("Initializing Plug-ins"), "", 0);
|
||||
|
||||
for (tmp = plug_in_defs, nth = 0; tmp; tmp = g_slist_next (tmp), nth++)
|
||||
{
|
||||
plug_in_def = tmp->data;
|
||||
|
||||
if (plug_in_def->has_init)
|
||||
{
|
||||
if (gimp->be_verbose)
|
||||
g_print (_("Initializing plug-in: \"%s\"\n"), plug_in_def->prog);
|
||||
|
||||
plug_in_call_init (gimp, plug_in_def);
|
||||
}
|
||||
|
||||
basename = g_path_get_basename (plug_in_def->prog);
|
||||
(* status_callback) (NULL, basename, nth / nplugins);
|
||||
g_free (basename);
|
||||
}
|
||||
|
||||
/* run the available extensions */
|
||||
(* status_callback) (_("Starting Extensions"), "", 0);
|
||||
nplugins = g_slist_length (proc_defs);
|
||||
|
||||
for (tmp = proc_defs, nth = 0; tmp; tmp = g_slist_next (tmp), nth++)
|
||||
{
|
||||
proc_def = tmp->data;
|
||||
|
||||
if (proc_def->prog &&
|
||||
(proc_def->db_info.num_args == 0) &&
|
||||
(proc_def->db_info.proc_type == GIMP_EXTENSION))
|
||||
{
|
||||
if (gimp->be_verbose)
|
||||
g_print (_("Starting extension: \"%s\""), proc_def->db_info.name);
|
||||
|
||||
(* status_callback) (NULL, proc_def->db_info.name, nth / nplugins);
|
||||
|
||||
plug_in_run (gimp, &proc_def->db_info, NULL, 0, FALSE, TRUE, -1);
|
||||
}
|
||||
}
|
||||
|
||||
/* free up stuff */
|
||||
for (tmp = plug_in_defs; tmp; tmp = g_slist_next (tmp))
|
||||
{
|
||||
plug_in_def = tmp->data;
|
||||
|
||||
plug_in_def_free (plug_in_def, FALSE);
|
||||
}
|
||||
|
@ -491,14 +524,43 @@ plug_ins_menu_path (gchar *name)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
gchar *
|
||||
plug_ins_help_path (gchar *prog_name)
|
||||
const gchar *
|
||||
plug_ins_locale_domain (const gchar *prog_name,
|
||||
const gchar **locale_path)
|
||||
{
|
||||
PlugInLocaleDomainDef *locale_domain_def;
|
||||
GSList *list;
|
||||
|
||||
g_return_val_if_fail (prog_name != NULL, NULL);
|
||||
|
||||
if (locale_path)
|
||||
*locale_path = gimp_locale_directory ();
|
||||
|
||||
for (list = locale_domain_defs; list; list = g_slist_next (list))
|
||||
{
|
||||
locale_domain_def = (PlugInLocaleDomainDef *) list->data;
|
||||
|
||||
if (locale_domain_def &&
|
||||
locale_domain_def->prog_name &&
|
||||
strcmp (locale_domain_def->prog_name, prog_name) == 0)
|
||||
{
|
||||
if (locale_path && locale_domain_def->locale_path)
|
||||
*locale_path = locale_domain_def->locale_path;
|
||||
|
||||
return locale_domain_def->locale_domain;
|
||||
}
|
||||
}
|
||||
|
||||
return STD_PLUGINS_DOMAIN;
|
||||
}
|
||||
|
||||
const gchar *
|
||||
plug_ins_help_path (const gchar *prog_name)
|
||||
{
|
||||
PlugInHelpPathDef *help_path_def;
|
||||
GSList *list;
|
||||
GSList *list;
|
||||
|
||||
if (!prog_name || !strlen (prog_name))
|
||||
return NULL;
|
||||
g_return_val_if_fail (prog_name != NULL, NULL);
|
||||
|
||||
for (list = help_path_defs; list; list = g_slist_next (list))
|
||||
{
|
||||
|
@ -687,6 +749,39 @@ plug_ins_proc_def_dead (void *freed_proc_def)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
plug_ins_proc_def_add (PlugInProcDef *proc_def,
|
||||
Gimp *gimp,
|
||||
const gchar *locale_domain,
|
||||
const gchar *help_path)
|
||||
{
|
||||
if (! gimp->no_interface)
|
||||
{
|
||||
if (proc_def->menu_path)
|
||||
{
|
||||
/* Below we use a hack to allow translations of Script-Fu paths.
|
||||
* Would be nice if we could solve this properly, but I haven't
|
||||
* found a way yet ... (Sven)
|
||||
*/
|
||||
if (! locale_domain)
|
||||
{
|
||||
if (strncmp (proc_def->db_info.name, "script_fu", 9) == 0)
|
||||
locale_domain = SCRIPT_FU_DOMAIN;
|
||||
else
|
||||
locale_domain = STD_PLUGINS_DOMAIN;
|
||||
}
|
||||
|
||||
plug_in_make_menu_entry (NULL, proc_def, locale_domain, help_path);
|
||||
}
|
||||
}
|
||||
|
||||
/* Register the procedural database entry */
|
||||
procedural_db_register (gimp, &proc_def->db_info);
|
||||
|
||||
/* Remove the defintion from the global list */
|
||||
proc_defs = g_slist_append (proc_defs, proc_def);
|
||||
}
|
||||
|
||||
void
|
||||
plug_ins_proc_def_remove (PlugInProcDef *proc_def,
|
||||
Gimp *gimp)
|
||||
|
|
|
@ -36,14 +36,22 @@ PlugInProcDef * plug_ins_file_handler (gchar *name,
|
|||
/* Add a plug-in definition. */
|
||||
void plug_ins_def_add (PlugInDef *plug_in_def);
|
||||
|
||||
void plug_ins_proc_def_add (PlugInProcDef *proc_def,
|
||||
Gimp *gimp,
|
||||
const gchar *locale_domain,
|
||||
const gchar *help_path);
|
||||
void plug_ins_proc_def_remove (PlugInProcDef *proc_def,
|
||||
Gimp *gimp);
|
||||
|
||||
/* Retrieve a plug-ins menu path */
|
||||
gchar * plug_ins_menu_path (gchar *name);
|
||||
|
||||
/* Retrieve a plug-ins locale domain */
|
||||
const gchar * plug_ins_locale_domain (const gchar *prog_name,
|
||||
const gchar **locale_path);
|
||||
|
||||
/* Retrieve a plug-ins help path */
|
||||
gchar * plug_ins_help_path (gchar *prog_name);
|
||||
const gchar * plug_ins_help_path (const gchar *prog_name);
|
||||
|
||||
|
||||
/* Register an internal plug-in. This is for file load-save
|
||||
|
@ -55,8 +63,7 @@ GSList * plug_ins_extensions_parse (gchar *extensions);
|
|||
PlugInImageType plug_ins_image_types_parse (gchar *image_types);
|
||||
|
||||
|
||||
extern GSList *proc_defs;
|
||||
extern const gchar *std_plugins_domain;
|
||||
extern GSList *proc_defs;
|
||||
|
||||
|
||||
#endif /* __PLUG_INS_H__ */
|
||||
|
|
|
@ -90,7 +90,6 @@
|
|||
#include "core/gimpenvirontable.h"
|
||||
#include "core/gimpimage.h"
|
||||
|
||||
#include "gui/plug-in-menus.h"
|
||||
#include "gui/brush-select.h"
|
||||
#include "gui/gradient-select.h"
|
||||
#include "gui/palette-select.h"
|
||||
|
@ -1300,15 +1299,14 @@ static void
|
|||
plug_in_handle_proc_install (PlugIn *plug_in,
|
||||
GPProcInstall *proc_install)
|
||||
{
|
||||
PlugInDef *plug_in_def = NULL;
|
||||
PlugInProcDef *proc_def;
|
||||
ProcRecord *proc = NULL;
|
||||
PlugInMenuEntry *menu_entry;
|
||||
GSList *tmp = NULL;
|
||||
gchar *prog = NULL;
|
||||
gboolean add_proc_def;
|
||||
gboolean valid;
|
||||
gint i;
|
||||
PlugInDef *plug_in_def = NULL;
|
||||
PlugInProcDef *proc_def;
|
||||
ProcRecord *proc = NULL;
|
||||
GSList *tmp = NULL;
|
||||
gchar *prog = NULL;
|
||||
gboolean add_proc_def;
|
||||
gboolean valid;
|
||||
gint i;
|
||||
|
||||
/* Argument checking
|
||||
* --only sanity check arguments when the procedure requests a menu path
|
||||
|
@ -1563,38 +1561,11 @@ plug_in_handle_proc_install (PlugIn *plug_in,
|
|||
plug_in->temp_proc_defs = g_slist_prepend (plug_in->temp_proc_defs,
|
||||
proc_def);
|
||||
|
||||
proc_defs = g_slist_append (proc_defs, proc_def);
|
||||
proc->exec_method.temporary.plug_in = plug_in;
|
||||
procedural_db_register (plug_in->gimp, proc);
|
||||
|
||||
if (! plug_in->gimp->no_interface)
|
||||
{
|
||||
/* If there is a menu path specified, create a menu entry */
|
||||
if (proc_install->menu_path)
|
||||
{
|
||||
menu_entry = g_new (PlugInMenuEntry, 1);
|
||||
menu_entry->proc_def = proc_def;
|
||||
|
||||
/* Below we use a hack to allow translations of Script-Fu paths.
|
||||
* Would be nice if we could solve this properly, but I haven't
|
||||
* found a way yet ... (Sven)
|
||||
*/
|
||||
if (plug_in_def && plug_in_def->locale_domain)
|
||||
menu_entry->domain = plug_in_def->locale_domain;
|
||||
else if (strncmp (proc_def->db_info.name, "script_fu", 9) == 0)
|
||||
menu_entry->domain = "gimp14-script-fu";
|
||||
else
|
||||
menu_entry->domain = std_plugins_domain;
|
||||
|
||||
if (plug_in_def)
|
||||
menu_entry->help_path = plug_in_def->help_path;
|
||||
else
|
||||
menu_entry->help_path = NULL;
|
||||
|
||||
/* plug_in_make_menu_entry frees the menu_entry for us */
|
||||
plug_in_make_menu_entry (NULL, menu_entry, NULL);
|
||||
}
|
||||
}
|
||||
plug_ins_proc_def_add (proc_def, plug_in->gimp,
|
||||
plug_in_def ? plug_in_def->locale_domain : NULL,
|
||||
plug_in_def ? plug_in_def->help_path : NULL);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -90,7 +90,6 @@
|
|||
#include "core/gimpenvirontable.h"
|
||||
#include "core/gimpimage.h"
|
||||
|
||||
#include "gui/plug-in-menus.h"
|
||||
#include "gui/brush-select.h"
|
||||
#include "gui/gradient-select.h"
|
||||
#include "gui/palette-select.h"
|
||||
|
@ -1300,15 +1299,14 @@ static void
|
|||
plug_in_handle_proc_install (PlugIn *plug_in,
|
||||
GPProcInstall *proc_install)
|
||||
{
|
||||
PlugInDef *plug_in_def = NULL;
|
||||
PlugInProcDef *proc_def;
|
||||
ProcRecord *proc = NULL;
|
||||
PlugInMenuEntry *menu_entry;
|
||||
GSList *tmp = NULL;
|
||||
gchar *prog = NULL;
|
||||
gboolean add_proc_def;
|
||||
gboolean valid;
|
||||
gint i;
|
||||
PlugInDef *plug_in_def = NULL;
|
||||
PlugInProcDef *proc_def;
|
||||
ProcRecord *proc = NULL;
|
||||
GSList *tmp = NULL;
|
||||
gchar *prog = NULL;
|
||||
gboolean add_proc_def;
|
||||
gboolean valid;
|
||||
gint i;
|
||||
|
||||
/* Argument checking
|
||||
* --only sanity check arguments when the procedure requests a menu path
|
||||
|
@ -1563,38 +1561,11 @@ plug_in_handle_proc_install (PlugIn *plug_in,
|
|||
plug_in->temp_proc_defs = g_slist_prepend (plug_in->temp_proc_defs,
|
||||
proc_def);
|
||||
|
||||
proc_defs = g_slist_append (proc_defs, proc_def);
|
||||
proc->exec_method.temporary.plug_in = plug_in;
|
||||
procedural_db_register (plug_in->gimp, proc);
|
||||
|
||||
if (! plug_in->gimp->no_interface)
|
||||
{
|
||||
/* If there is a menu path specified, create a menu entry */
|
||||
if (proc_install->menu_path)
|
||||
{
|
||||
menu_entry = g_new (PlugInMenuEntry, 1);
|
||||
menu_entry->proc_def = proc_def;
|
||||
|
||||
/* Below we use a hack to allow translations of Script-Fu paths.
|
||||
* Would be nice if we could solve this properly, but I haven't
|
||||
* found a way yet ... (Sven)
|
||||
*/
|
||||
if (plug_in_def && plug_in_def->locale_domain)
|
||||
menu_entry->domain = plug_in_def->locale_domain;
|
||||
else if (strncmp (proc_def->db_info.name, "script_fu", 9) == 0)
|
||||
menu_entry->domain = "gimp14-script-fu";
|
||||
else
|
||||
menu_entry->domain = std_plugins_domain;
|
||||
|
||||
if (plug_in_def)
|
||||
menu_entry->help_path = plug_in_def->help_path;
|
||||
else
|
||||
menu_entry->help_path = NULL;
|
||||
|
||||
/* plug_in_make_menu_entry frees the menu_entry for us */
|
||||
plug_in_make_menu_entry (NULL, menu_entry, NULL);
|
||||
}
|
||||
}
|
||||
plug_ins_proc_def_add (proc_def, plug_in->gimp,
|
||||
plug_in_def ? plug_in_def->locale_domain : NULL,
|
||||
plug_in_def ? plug_in_def->help_path : NULL);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -90,7 +90,6 @@
|
|||
#include "core/gimpenvirontable.h"
|
||||
#include "core/gimpimage.h"
|
||||
|
||||
#include "gui/plug-in-menus.h"
|
||||
#include "gui/brush-select.h"
|
||||
#include "gui/gradient-select.h"
|
||||
#include "gui/palette-select.h"
|
||||
|
@ -1300,15 +1299,14 @@ static void
|
|||
plug_in_handle_proc_install (PlugIn *plug_in,
|
||||
GPProcInstall *proc_install)
|
||||
{
|
||||
PlugInDef *plug_in_def = NULL;
|
||||
PlugInProcDef *proc_def;
|
||||
ProcRecord *proc = NULL;
|
||||
PlugInMenuEntry *menu_entry;
|
||||
GSList *tmp = NULL;
|
||||
gchar *prog = NULL;
|
||||
gboolean add_proc_def;
|
||||
gboolean valid;
|
||||
gint i;
|
||||
PlugInDef *plug_in_def = NULL;
|
||||
PlugInProcDef *proc_def;
|
||||
ProcRecord *proc = NULL;
|
||||
GSList *tmp = NULL;
|
||||
gchar *prog = NULL;
|
||||
gboolean add_proc_def;
|
||||
gboolean valid;
|
||||
gint i;
|
||||
|
||||
/* Argument checking
|
||||
* --only sanity check arguments when the procedure requests a menu path
|
||||
|
@ -1563,38 +1561,11 @@ plug_in_handle_proc_install (PlugIn *plug_in,
|
|||
plug_in->temp_proc_defs = g_slist_prepend (plug_in->temp_proc_defs,
|
||||
proc_def);
|
||||
|
||||
proc_defs = g_slist_append (proc_defs, proc_def);
|
||||
proc->exec_method.temporary.plug_in = plug_in;
|
||||
procedural_db_register (plug_in->gimp, proc);
|
||||
|
||||
if (! plug_in->gimp->no_interface)
|
||||
{
|
||||
/* If there is a menu path specified, create a menu entry */
|
||||
if (proc_install->menu_path)
|
||||
{
|
||||
menu_entry = g_new (PlugInMenuEntry, 1);
|
||||
menu_entry->proc_def = proc_def;
|
||||
|
||||
/* Below we use a hack to allow translations of Script-Fu paths.
|
||||
* Would be nice if we could solve this properly, but I haven't
|
||||
* found a way yet ... (Sven)
|
||||
*/
|
||||
if (plug_in_def && plug_in_def->locale_domain)
|
||||
menu_entry->domain = plug_in_def->locale_domain;
|
||||
else if (strncmp (proc_def->db_info.name, "script_fu", 9) == 0)
|
||||
menu_entry->domain = "gimp14-script-fu";
|
||||
else
|
||||
menu_entry->domain = std_plugins_domain;
|
||||
|
||||
if (plug_in_def)
|
||||
menu_entry->help_path = plug_in_def->help_path;
|
||||
else
|
||||
menu_entry->help_path = NULL;
|
||||
|
||||
/* plug_in_make_menu_entry frees the menu_entry for us */
|
||||
plug_in_make_menu_entry (NULL, menu_entry, NULL);
|
||||
}
|
||||
}
|
||||
plug_ins_proc_def_add (proc_def, plug_in->gimp,
|
||||
plug_in_def ? plug_in_def->locale_domain : NULL,
|
||||
plug_in_def ? plug_in_def->help_path : NULL);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -90,7 +90,6 @@
|
|||
#include "core/gimpenvirontable.h"
|
||||
#include "core/gimpimage.h"
|
||||
|
||||
#include "gui/plug-in-menus.h"
|
||||
#include "gui/brush-select.h"
|
||||
#include "gui/gradient-select.h"
|
||||
#include "gui/palette-select.h"
|
||||
|
@ -1300,15 +1299,14 @@ static void
|
|||
plug_in_handle_proc_install (PlugIn *plug_in,
|
||||
GPProcInstall *proc_install)
|
||||
{
|
||||
PlugInDef *plug_in_def = NULL;
|
||||
PlugInProcDef *proc_def;
|
||||
ProcRecord *proc = NULL;
|
||||
PlugInMenuEntry *menu_entry;
|
||||
GSList *tmp = NULL;
|
||||
gchar *prog = NULL;
|
||||
gboolean add_proc_def;
|
||||
gboolean valid;
|
||||
gint i;
|
||||
PlugInDef *plug_in_def = NULL;
|
||||
PlugInProcDef *proc_def;
|
||||
ProcRecord *proc = NULL;
|
||||
GSList *tmp = NULL;
|
||||
gchar *prog = NULL;
|
||||
gboolean add_proc_def;
|
||||
gboolean valid;
|
||||
gint i;
|
||||
|
||||
/* Argument checking
|
||||
* --only sanity check arguments when the procedure requests a menu path
|
||||
|
@ -1563,38 +1561,11 @@ plug_in_handle_proc_install (PlugIn *plug_in,
|
|||
plug_in->temp_proc_defs = g_slist_prepend (plug_in->temp_proc_defs,
|
||||
proc_def);
|
||||
|
||||
proc_defs = g_slist_append (proc_defs, proc_def);
|
||||
proc->exec_method.temporary.plug_in = plug_in;
|
||||
procedural_db_register (plug_in->gimp, proc);
|
||||
|
||||
if (! plug_in->gimp->no_interface)
|
||||
{
|
||||
/* If there is a menu path specified, create a menu entry */
|
||||
if (proc_install->menu_path)
|
||||
{
|
||||
menu_entry = g_new (PlugInMenuEntry, 1);
|
||||
menu_entry->proc_def = proc_def;
|
||||
|
||||
/* Below we use a hack to allow translations of Script-Fu paths.
|
||||
* Would be nice if we could solve this properly, but I haven't
|
||||
* found a way yet ... (Sven)
|
||||
*/
|
||||
if (plug_in_def && plug_in_def->locale_domain)
|
||||
menu_entry->domain = plug_in_def->locale_domain;
|
||||
else if (strncmp (proc_def->db_info.name, "script_fu", 9) == 0)
|
||||
menu_entry->domain = "gimp14-script-fu";
|
||||
else
|
||||
menu_entry->domain = std_plugins_domain;
|
||||
|
||||
if (plug_in_def)
|
||||
menu_entry->help_path = plug_in_def->help_path;
|
||||
else
|
||||
menu_entry->help_path = NULL;
|
||||
|
||||
/* plug_in_make_menu_entry frees the menu_entry for us */
|
||||
plug_in_make_menu_entry (NULL, menu_entry, NULL);
|
||||
}
|
||||
}
|
||||
plug_ins_proc_def_add (proc_def, plug_in->gimp,
|
||||
plug_in_def ? plug_in_def->locale_domain : NULL,
|
||||
plug_in_def ? plug_in_def->help_path : NULL);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,10 +41,9 @@ typedef enum /*< pdb-skip >*/ /*< skip >*/
|
|||
} PlugInImageType;
|
||||
|
||||
|
||||
typedef struct _PlugIn PlugIn;
|
||||
typedef struct _PlugInDef PlugInDef;
|
||||
typedef struct _PlugInProcDef PlugInProcDef;
|
||||
typedef struct _PlugInMenuEntry PlugInMenuEntry;
|
||||
typedef struct _PlugIn PlugIn;
|
||||
typedef struct _PlugInDef PlugInDef;
|
||||
typedef struct _PlugInProcDef PlugInProcDef;
|
||||
|
||||
|
||||
#endif /* __PLUG_IN_TYPES_H__ */
|
||||
|
|
|
@ -90,7 +90,6 @@
|
|||
#include "core/gimpenvirontable.h"
|
||||
#include "core/gimpimage.h"
|
||||
|
||||
#include "gui/plug-in-menus.h"
|
||||
#include "gui/brush-select.h"
|
||||
#include "gui/gradient-select.h"
|
||||
#include "gui/palette-select.h"
|
||||
|
@ -1300,15 +1299,14 @@ static void
|
|||
plug_in_handle_proc_install (PlugIn *plug_in,
|
||||
GPProcInstall *proc_install)
|
||||
{
|
||||
PlugInDef *plug_in_def = NULL;
|
||||
PlugInProcDef *proc_def;
|
||||
ProcRecord *proc = NULL;
|
||||
PlugInMenuEntry *menu_entry;
|
||||
GSList *tmp = NULL;
|
||||
gchar *prog = NULL;
|
||||
gboolean add_proc_def;
|
||||
gboolean valid;
|
||||
gint i;
|
||||
PlugInDef *plug_in_def = NULL;
|
||||
PlugInProcDef *proc_def;
|
||||
ProcRecord *proc = NULL;
|
||||
GSList *tmp = NULL;
|
||||
gchar *prog = NULL;
|
||||
gboolean add_proc_def;
|
||||
gboolean valid;
|
||||
gint i;
|
||||
|
||||
/* Argument checking
|
||||
* --only sanity check arguments when the procedure requests a menu path
|
||||
|
@ -1563,38 +1561,11 @@ plug_in_handle_proc_install (PlugIn *plug_in,
|
|||
plug_in->temp_proc_defs = g_slist_prepend (plug_in->temp_proc_defs,
|
||||
proc_def);
|
||||
|
||||
proc_defs = g_slist_append (proc_defs, proc_def);
|
||||
proc->exec_method.temporary.plug_in = plug_in;
|
||||
procedural_db_register (plug_in->gimp, proc);
|
||||
|
||||
if (! plug_in->gimp->no_interface)
|
||||
{
|
||||
/* If there is a menu path specified, create a menu entry */
|
||||
if (proc_install->menu_path)
|
||||
{
|
||||
menu_entry = g_new (PlugInMenuEntry, 1);
|
||||
menu_entry->proc_def = proc_def;
|
||||
|
||||
/* Below we use a hack to allow translations of Script-Fu paths.
|
||||
* Would be nice if we could solve this properly, but I haven't
|
||||
* found a way yet ... (Sven)
|
||||
*/
|
||||
if (plug_in_def && plug_in_def->locale_domain)
|
||||
menu_entry->domain = plug_in_def->locale_domain;
|
||||
else if (strncmp (proc_def->db_info.name, "script_fu", 9) == 0)
|
||||
menu_entry->domain = "gimp14-script-fu";
|
||||
else
|
||||
menu_entry->domain = std_plugins_domain;
|
||||
|
||||
if (plug_in_def)
|
||||
menu_entry->help_path = plug_in_def->help_path;
|
||||
else
|
||||
menu_entry->help_path = NULL;
|
||||
|
||||
/* plug_in_make_menu_entry frees the menu_entry for us */
|
||||
plug_in_make_menu_entry (NULL, menu_entry, NULL);
|
||||
}
|
||||
}
|
||||
plug_ins_proc_def_add (proc_def, plug_in->gimp,
|
||||
plug_in_def ? plug_in_def->locale_domain : NULL,
|
||||
plug_in_def ? plug_in_def->help_path : NULL);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,14 +57,6 @@ struct _PlugIn
|
|||
};
|
||||
|
||||
|
||||
struct _PlugInMenuEntry
|
||||
{
|
||||
PlugInProcDef *proc_def;
|
||||
const gchar *domain;
|
||||
const gchar *help_path;
|
||||
};
|
||||
|
||||
|
||||
void plug_in_init (Gimp *gimp);
|
||||
void plug_in_kill (Gimp *gimp);
|
||||
|
||||
|
|
|
@ -35,6 +35,11 @@
|
|||
#include "core/gimpdrawable.h"
|
||||
#include "core/gimpimage.h"
|
||||
|
||||
#ifdef __GNUC__
|
||||
#warning FIXME #include "gui/gui-types.h"
|
||||
#endif
|
||||
#include "gui/gui-types.h"
|
||||
|
||||
#include "gui/plug-in-menus.h"
|
||||
|
||||
#include "plug-in.h"
|
||||
|
@ -48,7 +53,19 @@
|
|||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
||||
typedef struct _PlugInHelpPathDef PlugInHelpPathDef;
|
||||
#define STD_PLUGINS_DOMAIN "gimp14-std-plug-ins"
|
||||
#define SCRIPT_FU_DOMAIN "gimp14-script-fu"
|
||||
|
||||
|
||||
typedef struct _PlugInLocaleDomainDef PlugInLocaleDomainDef;
|
||||
typedef struct _PlugInHelpPathDef PlugInHelpPathDef;
|
||||
|
||||
struct _PlugInLocaleDomainDef
|
||||
{
|
||||
gchar *prog_name;
|
||||
gchar *locale_domain;
|
||||
gchar *locale_path;
|
||||
};
|
||||
|
||||
struct _PlugInHelpPathDef
|
||||
{
|
||||
|
@ -65,10 +82,10 @@ static void plug_ins_proc_def_dead (void *freed_proc_def);
|
|||
|
||||
|
||||
GSList *proc_defs = NULL;
|
||||
const gchar *std_plugins_domain = "gimp14-std-plug-ins";
|
||||
|
||||
static GSList *plug_in_defs = NULL;
|
||||
static GSList *gimprc_proc_defs = NULL;
|
||||
static GSList *locale_domain_defs = NULL;
|
||||
static GSList *help_path_defs = NULL;
|
||||
|
||||
static gboolean write_pluginrc = FALSE;
|
||||
|
@ -156,7 +173,7 @@ plug_ins_init (Gimp *gimp,
|
|||
{
|
||||
proc_def = tmp2->data;
|
||||
|
||||
proc_def->mtime = plug_in_def->mtime;
|
||||
proc_def->mtime = plug_in_def->mtime;
|
||||
plug_ins_proc_def_insert (proc_def, plug_ins_proc_def_dead);
|
||||
}
|
||||
}
|
||||
|
@ -175,64 +192,25 @@ plug_ins_init (Gimp *gimp,
|
|||
/* add the plug-in procs to the procedure database */
|
||||
plug_ins_add_to_db (gimp);
|
||||
|
||||
if (! gimp->no_interface)
|
||||
{
|
||||
/* make the menu */
|
||||
plug_in_make_menu (plug_in_defs, std_plugins_domain);
|
||||
}
|
||||
|
||||
/* initial the plug-ins */
|
||||
(* status_callback) (_("Initializing Plug-ins"), "", 0);
|
||||
|
||||
for (tmp = plug_in_defs, nth = 0; tmp; tmp = g_slist_next (tmp), nth++)
|
||||
{
|
||||
plug_in_def = tmp->data;
|
||||
|
||||
if (plug_in_def->has_init)
|
||||
{
|
||||
if (gimp->be_verbose)
|
||||
g_print (_("initializing plug-in: \"%s\"\n"), plug_in_def->prog);
|
||||
|
||||
plug_in_call_init (gimp, plug_in_def);
|
||||
}
|
||||
|
||||
basename = g_path_get_basename (plug_in_def->prog);
|
||||
(* status_callback) (NULL, basename, nth / nplugins);
|
||||
g_free (basename);
|
||||
}
|
||||
|
||||
/* run the available extensions */
|
||||
if (gimp->be_verbose)
|
||||
g_print (_("Starting extensions: "));
|
||||
|
||||
(* status_callback) (_("Starting Extensions"), "", 0);
|
||||
nplugins = g_slist_length (proc_defs);
|
||||
|
||||
for (tmp = proc_defs, nth = 0; tmp; tmp = g_slist_next (tmp), nth++)
|
||||
{
|
||||
proc_def = tmp->data;
|
||||
|
||||
if (proc_def->prog &&
|
||||
(proc_def->db_info.num_args == 0) &&
|
||||
(proc_def->db_info.proc_type == GIMP_EXTENSION))
|
||||
{
|
||||
if (gimp->be_verbose)
|
||||
g_print ("%s ", proc_def->db_info.name);
|
||||
|
||||
(* status_callback) (NULL, proc_def->db_info.name, nth / nplugins);
|
||||
|
||||
plug_in_run (gimp, &proc_def->db_info, NULL, 0, FALSE, TRUE, -1);
|
||||
}
|
||||
}
|
||||
|
||||
if (gimp->be_verbose)
|
||||
g_print ("\n");
|
||||
|
||||
/* create help path list and free up stuff */
|
||||
/* create help_path and locale_domain lists */
|
||||
for (tmp = plug_in_defs; tmp; tmp = g_slist_next (tmp))
|
||||
{
|
||||
plug_in_def = tmp->data;
|
||||
|
||||
if (plug_in_def->locale_domain)
|
||||
{
|
||||
PlugInLocaleDomainDef *locale_domain_def;
|
||||
|
||||
locale_domain_def = g_new (PlugInLocaleDomainDef, 1);
|
||||
|
||||
locale_domain_def->prog_name = g_strdup (plug_in_def->prog);
|
||||
locale_domain_def->locale_domain = g_strdup (plug_in_def->locale_domain);
|
||||
locale_domain_def->locale_path = g_strdup (plug_in_def->locale_path);
|
||||
|
||||
locale_domain_defs = g_slist_prepend (locale_domain_defs,
|
||||
locale_domain_def);
|
||||
}
|
||||
|
||||
if (plug_in_def->help_path)
|
||||
{
|
||||
PlugInHelpPathDef *help_path_def;
|
||||
|
@ -244,6 +222,61 @@ plug_ins_init (Gimp *gimp,
|
|||
|
||||
help_path_defs = g_slist_prepend (help_path_defs, help_path_def);
|
||||
}
|
||||
}
|
||||
|
||||
if (! gimp->no_interface)
|
||||
{
|
||||
plug_in_menus_init (plug_in_defs, STD_PLUGINS_DOMAIN);
|
||||
|
||||
/* make the menu */
|
||||
plug_in_make_menu (NULL, proc_defs);
|
||||
}
|
||||
|
||||
/* initial the plug-ins */
|
||||
(* status_callback) (_("Initializing Plug-ins"), "", 0);
|
||||
|
||||
for (tmp = plug_in_defs, nth = 0; tmp; tmp = g_slist_next (tmp), nth++)
|
||||
{
|
||||
plug_in_def = tmp->data;
|
||||
|
||||
if (plug_in_def->has_init)
|
||||
{
|
||||
if (gimp->be_verbose)
|
||||
g_print (_("Initializing plug-in: \"%s\"\n"), plug_in_def->prog);
|
||||
|
||||
plug_in_call_init (gimp, plug_in_def);
|
||||
}
|
||||
|
||||
basename = g_path_get_basename (plug_in_def->prog);
|
||||
(* status_callback) (NULL, basename, nth / nplugins);
|
||||
g_free (basename);
|
||||
}
|
||||
|
||||
/* run the available extensions */
|
||||
(* status_callback) (_("Starting Extensions"), "", 0);
|
||||
nplugins = g_slist_length (proc_defs);
|
||||
|
||||
for (tmp = proc_defs, nth = 0; tmp; tmp = g_slist_next (tmp), nth++)
|
||||
{
|
||||
proc_def = tmp->data;
|
||||
|
||||
if (proc_def->prog &&
|
||||
(proc_def->db_info.num_args == 0) &&
|
||||
(proc_def->db_info.proc_type == GIMP_EXTENSION))
|
||||
{
|
||||
if (gimp->be_verbose)
|
||||
g_print (_("Starting extension: \"%s\""), proc_def->db_info.name);
|
||||
|
||||
(* status_callback) (NULL, proc_def->db_info.name, nth / nplugins);
|
||||
|
||||
plug_in_run (gimp, &proc_def->db_info, NULL, 0, FALSE, TRUE, -1);
|
||||
}
|
||||
}
|
||||
|
||||
/* free up stuff */
|
||||
for (tmp = plug_in_defs; tmp; tmp = g_slist_next (tmp))
|
||||
{
|
||||
plug_in_def = tmp->data;
|
||||
|
||||
plug_in_def_free (plug_in_def, FALSE);
|
||||
}
|
||||
|
@ -491,14 +524,43 @@ plug_ins_menu_path (gchar *name)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
gchar *
|
||||
plug_ins_help_path (gchar *prog_name)
|
||||
const gchar *
|
||||
plug_ins_locale_domain (const gchar *prog_name,
|
||||
const gchar **locale_path)
|
||||
{
|
||||
PlugInLocaleDomainDef *locale_domain_def;
|
||||
GSList *list;
|
||||
|
||||
g_return_val_if_fail (prog_name != NULL, NULL);
|
||||
|
||||
if (locale_path)
|
||||
*locale_path = gimp_locale_directory ();
|
||||
|
||||
for (list = locale_domain_defs; list; list = g_slist_next (list))
|
||||
{
|
||||
locale_domain_def = (PlugInLocaleDomainDef *) list->data;
|
||||
|
||||
if (locale_domain_def &&
|
||||
locale_domain_def->prog_name &&
|
||||
strcmp (locale_domain_def->prog_name, prog_name) == 0)
|
||||
{
|
||||
if (locale_path && locale_domain_def->locale_path)
|
||||
*locale_path = locale_domain_def->locale_path;
|
||||
|
||||
return locale_domain_def->locale_domain;
|
||||
}
|
||||
}
|
||||
|
||||
return STD_PLUGINS_DOMAIN;
|
||||
}
|
||||
|
||||
const gchar *
|
||||
plug_ins_help_path (const gchar *prog_name)
|
||||
{
|
||||
PlugInHelpPathDef *help_path_def;
|
||||
GSList *list;
|
||||
GSList *list;
|
||||
|
||||
if (!prog_name || !strlen (prog_name))
|
||||
return NULL;
|
||||
g_return_val_if_fail (prog_name != NULL, NULL);
|
||||
|
||||
for (list = help_path_defs; list; list = g_slist_next (list))
|
||||
{
|
||||
|
@ -687,6 +749,39 @@ plug_ins_proc_def_dead (void *freed_proc_def)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
plug_ins_proc_def_add (PlugInProcDef *proc_def,
|
||||
Gimp *gimp,
|
||||
const gchar *locale_domain,
|
||||
const gchar *help_path)
|
||||
{
|
||||
if (! gimp->no_interface)
|
||||
{
|
||||
if (proc_def->menu_path)
|
||||
{
|
||||
/* Below we use a hack to allow translations of Script-Fu paths.
|
||||
* Would be nice if we could solve this properly, but I haven't
|
||||
* found a way yet ... (Sven)
|
||||
*/
|
||||
if (! locale_domain)
|
||||
{
|
||||
if (strncmp (proc_def->db_info.name, "script_fu", 9) == 0)
|
||||
locale_domain = SCRIPT_FU_DOMAIN;
|
||||
else
|
||||
locale_domain = STD_PLUGINS_DOMAIN;
|
||||
}
|
||||
|
||||
plug_in_make_menu_entry (NULL, proc_def, locale_domain, help_path);
|
||||
}
|
||||
}
|
||||
|
||||
/* Register the procedural database entry */
|
||||
procedural_db_register (gimp, &proc_def->db_info);
|
||||
|
||||
/* Remove the defintion from the global list */
|
||||
proc_defs = g_slist_append (proc_defs, proc_def);
|
||||
}
|
||||
|
||||
void
|
||||
plug_ins_proc_def_remove (PlugInProcDef *proc_def,
|
||||
Gimp *gimp)
|
||||
|
|
|
@ -36,14 +36,22 @@ PlugInProcDef * plug_ins_file_handler (gchar *name,
|
|||
/* Add a plug-in definition. */
|
||||
void plug_ins_def_add (PlugInDef *plug_in_def);
|
||||
|
||||
void plug_ins_proc_def_add (PlugInProcDef *proc_def,
|
||||
Gimp *gimp,
|
||||
const gchar *locale_domain,
|
||||
const gchar *help_path);
|
||||
void plug_ins_proc_def_remove (PlugInProcDef *proc_def,
|
||||
Gimp *gimp);
|
||||
|
||||
/* Retrieve a plug-ins menu path */
|
||||
gchar * plug_ins_menu_path (gchar *name);
|
||||
|
||||
/* Retrieve a plug-ins locale domain */
|
||||
const gchar * plug_ins_locale_domain (const gchar *prog_name,
|
||||
const gchar **locale_path);
|
||||
|
||||
/* Retrieve a plug-ins help path */
|
||||
gchar * plug_ins_help_path (gchar *prog_name);
|
||||
const gchar * plug_ins_help_path (const gchar *prog_name);
|
||||
|
||||
|
||||
/* Register an internal plug-in. This is for file load-save
|
||||
|
@ -55,8 +63,7 @@ GSList * plug_ins_extensions_parse (gchar *extensions);
|
|||
PlugInImageType plug_ins_image_types_parse (gchar *image_types);
|
||||
|
||||
|
||||
extern GSList *proc_defs;
|
||||
extern const gchar *std_plugins_domain;
|
||||
extern GSList *proc_defs;
|
||||
|
||||
|
||||
#endif /* __PLUG_INS_H__ */
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
static void gimp_item_factory_class_init (GimpItemFactoryClass *klass);
|
||||
static void gimp_item_factory_init (GimpItemFactory *factory);
|
||||
|
||||
static void gimp_item_factory_finalize (GObject *object);
|
||||
static void gimp_item_factory_destroy (GtkObject *object);
|
||||
|
||||
static void gimp_item_factory_create_branches (GimpItemFactory *factory,
|
||||
GimpItemFactoryEntry *entry,
|
||||
|
@ -60,12 +60,8 @@ static void gimp_item_factory_item_realize (GtkWidget *widget,
|
|||
static gboolean gimp_item_factory_item_key_press (GtkWidget *widget,
|
||||
GdkEventKey *kevent,
|
||||
gpointer data);
|
||||
#ifdef ENABLE_NLS
|
||||
static gchar * gimp_item_factory_translate_func (const gchar *path,
|
||||
gpointer data);
|
||||
#else
|
||||
#define gimp_item_factory_translate_func (NULL)
|
||||
#endif
|
||||
|
||||
|
||||
static GtkItemFactoryClass *parent_class = NULL;
|
||||
|
@ -102,40 +98,63 @@ gimp_item_factory_get_type (void)
|
|||
static void
|
||||
gimp_item_factory_class_init (GimpItemFactoryClass *klass)
|
||||
{
|
||||
GObjectClass *object_class;
|
||||
GtkObjectClass *object_class;
|
||||
|
||||
object_class = G_OBJECT_CLASS (klass);
|
||||
object_class = GTK_OBJECT_CLASS (klass);
|
||||
|
||||
parent_class = g_type_class_peek_parent (klass);
|
||||
|
||||
object_class->finalize = gimp_item_factory_finalize;
|
||||
object_class->destroy = gimp_item_factory_destroy;
|
||||
|
||||
klass->factories = g_hash_table_new (g_str_hash, g_str_equal);
|
||||
klass->factories = g_hash_table_new_full (g_str_hash, g_str_equal,
|
||||
g_free, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_item_factory_init (GimpItemFactory *factory)
|
||||
{
|
||||
factory->factory_path = NULL;
|
||||
factory->gimp = NULL;
|
||||
factory->update_func = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_item_factory_finalize (GObject *object)
|
||||
gimp_item_factory_destroy (GtkObject *object)
|
||||
{
|
||||
GimpItemFactory *factory;
|
||||
gchar *factory_path;
|
||||
|
||||
factory = GIMP_ITEM_FACTORY (object);
|
||||
|
||||
if (factory->factory_path)
|
||||
{
|
||||
g_hash_table_remove (GIMP_ITEM_FACTORY_GET_CLASS (object)->factories,
|
||||
factory->factory_path);
|
||||
factory_path = GTK_ITEM_FACTORY (object)->path;
|
||||
|
||||
g_free (factory->factory_path);
|
||||
factory->factory_path = NULL;
|
||||
g_print ("gimp_item_factory_destroy (%s)\n", factory_path);
|
||||
|
||||
if (factory_path)
|
||||
{
|
||||
GimpItemFactoryClass *factory_class;
|
||||
GList *list;
|
||||
|
||||
factory_class = GIMP_ITEM_FACTORY_GET_CLASS (factory);
|
||||
|
||||
list = g_hash_table_lookup (factory_class->factories, factory_path);
|
||||
|
||||
if (list)
|
||||
{
|
||||
list = g_list_remove (list, factory);
|
||||
|
||||
g_print ("gimp_item_factory_destroy (%d %s factories remaining)\n",
|
||||
g_list_length (list), factory_path);
|
||||
|
||||
if (list)
|
||||
g_hash_table_replace (factory_class->factories,
|
||||
g_strdup (factory_path),
|
||||
list);
|
||||
else
|
||||
g_hash_table_remove (factory_class->factories, factory_path);
|
||||
}
|
||||
}
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
GTK_OBJECT_CLASS (parent_class)->destroy (object);
|
||||
}
|
||||
|
||||
|
||||
|
@ -144,8 +163,8 @@ gimp_item_factory_finalize (GObject *object)
|
|||
GimpItemFactory *
|
||||
gimp_item_factory_new (Gimp *gimp,
|
||||
GType container_type,
|
||||
const gchar *path,
|
||||
const gchar *factory_path,
|
||||
const gchar *help_path,
|
||||
GimpItemFactoryUpdateFunc update_func,
|
||||
guint n_entries,
|
||||
GimpItemFactoryEntry *entries,
|
||||
|
@ -154,47 +173,43 @@ gimp_item_factory_new (Gimp *gimp,
|
|||
{
|
||||
GimpItemFactoryClass *factory_class;
|
||||
GimpItemFactory *factory;
|
||||
GList *list;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
|
||||
g_return_val_if_fail (path != NULL, NULL);
|
||||
g_return_val_if_fail (factory_path != NULL, NULL);
|
||||
g_return_val_if_fail (help_path != NULL, NULL);
|
||||
g_return_val_if_fail (factory_path[0] == '<', NULL);
|
||||
g_return_val_if_fail (factory_path[strlen (factory_path) - 1] == '>', NULL);
|
||||
|
||||
factory_class = g_type_class_ref (GIMP_TYPE_ITEM_FACTORY);
|
||||
|
||||
if (g_hash_table_lookup (factory_class->factories, path))
|
||||
{
|
||||
g_warning ("%s: item factory with path \"%s\" already exists",
|
||||
G_STRLOC, path);
|
||||
|
||||
g_type_class_unref (factory_class);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
factory = g_object_new (GIMP_TYPE_ITEM_FACTORY, NULL);
|
||||
|
||||
gtk_item_factory_construct (GTK_ITEM_FACTORY (factory),
|
||||
container_type,
|
||||
path,
|
||||
factory_path,
|
||||
NULL);
|
||||
|
||||
gtk_item_factory_set_translate_func (GTK_ITEM_FACTORY (factory),
|
||||
gimp_item_factory_translate_func,
|
||||
(gpointer) path,
|
||||
factory,
|
||||
NULL);
|
||||
|
||||
factory->gimp = gimp;
|
||||
factory->gimp = gimp;
|
||||
factory->update_func = update_func;
|
||||
|
||||
/* this is correct! <mitch> */
|
||||
factory->factory_path = g_strdup (path);
|
||||
factory->update_func = update_func;
|
||||
list = g_hash_table_lookup (factory_class->factories, factory_path);
|
||||
|
||||
g_hash_table_insert (factory_class->factories,
|
||||
factory->factory_path,
|
||||
factory);
|
||||
list = g_list_append (list, factory);
|
||||
|
||||
g_hash_table_replace (factory_class->factories,
|
||||
g_strdup (factory_path),
|
||||
list);
|
||||
|
||||
/* this will go away <mitch> */
|
||||
g_object_set_data (G_OBJECT (factory), "factory_path",
|
||||
(gpointer) factory_path);
|
||||
g_object_set_data_full (G_OBJECT (factory), "help_path",
|
||||
g_strdup (help_path),
|
||||
(GDestroyNotify) g_free);
|
||||
|
||||
gimp_item_factory_create_items (factory,
|
||||
n_entries,
|
||||
|
@ -211,9 +226,22 @@ gimp_item_factory_new (Gimp *gimp,
|
|||
|
||||
GimpItemFactory *
|
||||
gimp_item_factory_from_path (const gchar *path)
|
||||
{
|
||||
GList *list;
|
||||
|
||||
list = gimp_item_factories_from_path (path);
|
||||
|
||||
if (list)
|
||||
return list->data;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
GList *
|
||||
gimp_item_factories_from_path (const gchar *path)
|
||||
{
|
||||
GimpItemFactoryClass *factory_class;
|
||||
GimpItemFactory *factory;
|
||||
GList *list;
|
||||
gchar *base_path;
|
||||
gchar *p;
|
||||
|
||||
|
@ -228,13 +256,13 @@ gimp_item_factory_from_path (const gchar *path)
|
|||
|
||||
factory_class = g_type_class_ref (GIMP_TYPE_ITEM_FACTORY);
|
||||
|
||||
factory = g_hash_table_lookup (factory_class->factories, base_path);
|
||||
list = g_hash_table_lookup (factory_class->factories, base_path);
|
||||
|
||||
g_type_class_unref (factory_class);
|
||||
|
||||
g_free (base_path);
|
||||
|
||||
return factory;
|
||||
return list;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -364,7 +392,7 @@ gimp_item_factory_popup_with_data (GimpItemFactory *item_factory,
|
|||
|
||||
void
|
||||
gimp_item_factory_set_active (GtkItemFactory *factory,
|
||||
gchar *path,
|
||||
const gchar *path,
|
||||
gboolean active)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
|
@ -397,9 +425,28 @@ gimp_item_factory_set_active (GtkItemFactory *factory,
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
gimp_item_factories_set_active (const gchar *factory_path,
|
||||
const gchar *path,
|
||||
gboolean active)
|
||||
{
|
||||
GList *list;
|
||||
|
||||
g_return_if_fail (factory_path != NULL);
|
||||
g_return_if_fail (path != NULL);
|
||||
|
||||
for (list = gimp_item_factories_from_path (factory_path);
|
||||
list;
|
||||
list = g_list_next (list))
|
||||
{
|
||||
gimp_item_factory_set_active (GTK_ITEM_FACTORY (list->data),
|
||||
path, active);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gimp_item_factory_set_color (GtkItemFactory *factory,
|
||||
gchar *path,
|
||||
const gchar *path,
|
||||
const GimpRGB *color,
|
||||
gboolean set_label)
|
||||
{
|
||||
|
@ -556,9 +603,30 @@ gimp_item_factory_set_color (GtkItemFactory *factory,
|
|||
#undef COLOR_BOX_HEIGHT
|
||||
}
|
||||
|
||||
void
|
||||
gimp_item_factories_set_color (const gchar *factory_path,
|
||||
const gchar *path,
|
||||
const GimpRGB *color,
|
||||
gboolean set_label)
|
||||
{
|
||||
GList *list;
|
||||
|
||||
g_return_if_fail (factory_path != NULL);
|
||||
g_return_if_fail (path != NULL);
|
||||
g_return_if_fail (color != NULL);
|
||||
|
||||
for (list = gimp_item_factories_from_path (factory_path);
|
||||
list;
|
||||
list = g_list_next (list))
|
||||
{
|
||||
gimp_item_factory_set_color (GTK_ITEM_FACTORY (list->data),
|
||||
path, color, set_label);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gimp_item_factory_set_label (GtkItemFactory *factory,
|
||||
gchar *path,
|
||||
const gchar *path,
|
||||
const gchar *label)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
|
@ -585,9 +653,29 @@ gimp_item_factory_set_label (GtkItemFactory *factory,
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
gimp_item_factories_set_label (const gchar *factory_path,
|
||||
const gchar *path,
|
||||
const gchar *label)
|
||||
{
|
||||
GList *list;
|
||||
|
||||
g_return_if_fail (factory_path != NULL);
|
||||
g_return_if_fail (path != NULL);
|
||||
g_return_if_fail (label != NULL);
|
||||
|
||||
for (list = gimp_item_factories_from_path (factory_path);
|
||||
list;
|
||||
list = g_list_next (list))
|
||||
{
|
||||
gimp_item_factory_set_label (GTK_ITEM_FACTORY (list->data),
|
||||
path, label);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gimp_item_factory_set_sensitive (GtkItemFactory *factory,
|
||||
gchar *path,
|
||||
const gchar *path,
|
||||
gboolean sensitive)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
|
@ -603,15 +691,34 @@ gimp_item_factory_set_sensitive (GtkItemFactory *factory,
|
|||
}
|
||||
else if (! strstr (path, "Script-Fu"))
|
||||
{
|
||||
g_warning ("%s: Unable to set sensitivity of menu item"
|
||||
g_warning ("%s: Unable to set sensitivity of menu item "
|
||||
"which doesn't exist: %s",
|
||||
G_STRLOC, path);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gimp_item_factories_set_sensitive (const gchar *factory_path,
|
||||
const gchar *path,
|
||||
gboolean sensitive)
|
||||
{
|
||||
GList *list;
|
||||
|
||||
g_return_if_fail (factory_path != NULL);
|
||||
g_return_if_fail (path != NULL);
|
||||
|
||||
for (list = gimp_item_factories_from_path (factory_path);
|
||||
list;
|
||||
list = g_list_next (list))
|
||||
{
|
||||
gimp_item_factory_set_sensitive (GTK_ITEM_FACTORY (list->data),
|
||||
path, sensitive);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gimp_item_factory_set_visible (GtkItemFactory *factory,
|
||||
gchar *path,
|
||||
const gchar *path,
|
||||
gboolean visible)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
|
@ -633,12 +740,31 @@ gimp_item_factory_set_visible (GtkItemFactory *factory,
|
|||
}
|
||||
else
|
||||
{
|
||||
g_warning ("%s: Unable to set visibility of menu item"
|
||||
g_warning ("%s: Unable to set visibility of menu item "
|
||||
"which doesn't exist: %s",
|
||||
G_STRLOC, path);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gimp_item_factories_set_visible (const gchar *factory_path,
|
||||
const gchar *path,
|
||||
gboolean visible)
|
||||
{
|
||||
GList *list;
|
||||
|
||||
g_return_if_fail (factory_path != NULL);
|
||||
g_return_if_fail (path != NULL);
|
||||
|
||||
for (list = gimp_item_factories_from_path (factory_path);
|
||||
list;
|
||||
list = g_list_next (list))
|
||||
{
|
||||
gimp_item_factory_set_visible (GTK_ITEM_FACTORY (list->data),
|
||||
path, visible);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gimp_item_factory_tearoff_callback (GtkWidget *widget,
|
||||
gpointer data,
|
||||
|
@ -795,11 +921,11 @@ gimp_item_factory_item_key_press (GtkWidget *widget,
|
|||
GdkEventKey *kevent,
|
||||
gpointer data)
|
||||
{
|
||||
GtkItemFactory *item_factory = NULL;
|
||||
GtkWidget *active_menu_item = NULL;
|
||||
gchar *factory_path = NULL;
|
||||
gchar *help_path = NULL;
|
||||
gchar *help_page = NULL;
|
||||
GtkItemFactory *item_factory = NULL;
|
||||
GtkWidget *active_menu_item = NULL;
|
||||
gchar *factory_help_path = NULL;
|
||||
gchar *help_path = NULL;
|
||||
gchar *help_page = NULL;
|
||||
|
||||
item_factory = (GtkItemFactory *) data;
|
||||
active_menu_item = GTK_MENU_SHELL (widget)->active_menu_item;
|
||||
|
@ -837,13 +963,13 @@ gimp_item_factory_item_key_press (GtkWidget *widget,
|
|||
|
||||
/* ...finally, if F1 was pressed over any menu, show it's help page... */
|
||||
|
||||
factory_path = (gchar *) g_object_get_data (G_OBJECT (item_factory),
|
||||
"factory_path");
|
||||
factory_help_path = (gchar *) g_object_get_data (G_OBJECT (item_factory),
|
||||
"help_path");
|
||||
|
||||
if (! help_page)
|
||||
help_page = "index.html";
|
||||
|
||||
if (factory_path && help_page)
|
||||
if (factory_help_path && help_page)
|
||||
{
|
||||
gchar *help_string;
|
||||
gchar *at;
|
||||
|
@ -860,7 +986,7 @@ gimp_item_factory_item_key_press (GtkWidget *widget,
|
|||
}
|
||||
else
|
||||
{
|
||||
help_string = g_strdup_printf ("%s/%s", factory_path, help_page);
|
||||
help_string = g_strdup_printf ("%s/%s", factory_help_path, help_page);
|
||||
}
|
||||
|
||||
gimp_help (GIMP_ITEM_FACTORY (item_factory)->gimp,
|
||||
|
@ -877,23 +1003,20 @@ gimp_item_factory_item_key_press (GtkWidget *widget,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_NLS
|
||||
|
||||
static gchar *
|
||||
gimp_item_factory_translate_func (const gchar *path,
|
||||
gpointer data)
|
||||
{
|
||||
static gchar *menupath = NULL;
|
||||
|
||||
GtkItemFactory *item_factory = NULL;
|
||||
GtkItemFactory *item_factory;
|
||||
gchar *retval;
|
||||
gchar *factory;
|
||||
gchar *translation;
|
||||
gchar *domain = NULL;
|
||||
gchar *complete = NULL;
|
||||
gchar *p, *t;
|
||||
|
||||
factory = (gchar *) data;
|
||||
item_factory = GTK_ITEM_FACTORY (data);
|
||||
|
||||
if (menupath)
|
||||
g_free (menupath);
|
||||
|
@ -905,26 +1028,20 @@ gimp_item_factory_translate_func (const gchar *path,
|
|||
(strstr (path, "/MRU") != NULL))
|
||||
return retval;
|
||||
|
||||
if (factory)
|
||||
item_factory = (GtkItemFactory *) gimp_item_factory_from_path (factory);
|
||||
|
||||
if (item_factory)
|
||||
{
|
||||
domain = g_object_get_data (G_OBJECT (item_factory), "textdomain");
|
||||
complete = g_object_get_data (G_OBJECT (item_factory), "complete");
|
||||
}
|
||||
domain = g_object_get_data (G_OBJECT (item_factory), "textdomain");
|
||||
complete = g_object_get_data (G_OBJECT (item_factory), "complete");
|
||||
|
||||
if (domain) /* use the plugin textdomain */
|
||||
{
|
||||
g_free (menupath);
|
||||
menupath = g_strconcat (factory, path, NULL);
|
||||
menupath = g_strconcat (item_factory->path, path, NULL);
|
||||
|
||||
if (complete)
|
||||
{
|
||||
/* This is a branch, use the complete path for translation,
|
||||
* then strip off entries from the end until it matches.
|
||||
*/
|
||||
complete = g_strconcat (factory, complete, NULL);
|
||||
complete = g_strconcat (item_factory->path, complete, NULL);
|
||||
translation = g_strdup (dgettext (domain, complete));
|
||||
|
||||
while (*complete && *translation && strcmp (complete, menupath))
|
||||
|
@ -950,9 +1067,10 @@ gimp_item_factory_translate_func (const gchar *path,
|
|||
/*
|
||||
* Work around a bug in GTK+ prior to 1.2.7 (similar workaround below)
|
||||
*/
|
||||
if (strncmp (factory, translation, strlen (factory)) == 0)
|
||||
if (strncmp (item_factory->path, translation,
|
||||
strlen (item_factory->path)) == 0)
|
||||
{
|
||||
retval = translation + strlen (factory);
|
||||
retval = translation + strlen (item_factory->path);
|
||||
if (complete)
|
||||
{
|
||||
g_free (menupath);
|
||||
|
@ -964,7 +1082,7 @@ gimp_item_factory_translate_func (const gchar *path,
|
|||
g_warning ("%s: bad translation for menupath: %s",
|
||||
G_STRLOC, menupath);
|
||||
|
||||
retval = menupath + strlen (factory);
|
||||
retval = menupath + strlen (item_factory->path);
|
||||
if (complete)
|
||||
g_free (translation);
|
||||
}
|
||||
|
@ -1018,5 +1136,3 @@ gimp_item_factory_translate_func (const gchar *path,
|
|||
|
||||
return retval;
|
||||
}
|
||||
|
||||
#endif /* ENABLE_NLS */
|
||||
|
|
|
@ -54,8 +54,6 @@ struct _GimpItemFactory
|
|||
GtkItemFactory parent_instance;
|
||||
|
||||
Gimp *gimp;
|
||||
|
||||
gchar *factory_path;
|
||||
GimpItemFactoryUpdateFunc update_func;
|
||||
};
|
||||
|
||||
|
@ -67,59 +65,80 @@ struct _GimpItemFactoryClass
|
|||
};
|
||||
|
||||
|
||||
GType gimp_item_factory_get_type (void) G_GNUC_CONST;
|
||||
GType gimp_item_factory_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GimpItemFactory * gimp_item_factory_new (Gimp *gimp,
|
||||
GType container_type,
|
||||
const gchar *path,
|
||||
const gchar *factory_path,
|
||||
GimpItemFactoryUpdateFunc update_func,
|
||||
guint n_entries,
|
||||
GimpItemFactoryEntry *entries,
|
||||
gpointer callback_data,
|
||||
gboolean create_tearoff);
|
||||
GimpItemFactory * gimp_item_factory_new (Gimp *gimp,
|
||||
GType container_type,
|
||||
const gchar *factory_path,
|
||||
const gchar *help_path,
|
||||
GimpItemFactoryUpdateFunc update_func,
|
||||
guint n_entries,
|
||||
GimpItemFactoryEntry *entries,
|
||||
gpointer callback_data,
|
||||
gboolean create_tearoff);
|
||||
|
||||
GimpItemFactory * gimp_item_factory_from_path (const gchar *path);
|
||||
GimpItemFactory * gimp_item_factory_from_path (const gchar *path);
|
||||
GList * gimp_item_factories_from_path (const gchar *path);
|
||||
|
||||
void gimp_item_factory_create_item (GimpItemFactory *factory,
|
||||
GimpItemFactoryEntry *entry,
|
||||
const gchar *textdomain,
|
||||
gpointer callback_data,
|
||||
guint callback_type,
|
||||
gboolean create_tearoff,
|
||||
gboolean static_entry);
|
||||
void gimp_item_factory_create_items (GimpItemFactory *factory,
|
||||
guint n_entries,
|
||||
GimpItemFactoryEntry *entries,
|
||||
gpointer callback_data,
|
||||
guint callback_type,
|
||||
gboolean create_tearoff,
|
||||
gboolean static_entries);
|
||||
void gimp_item_factory_create_item (GimpItemFactory *factory,
|
||||
GimpItemFactoryEntry *entry,
|
||||
const gchar *textdomain,
|
||||
gpointer callback_data,
|
||||
guint callback_type,
|
||||
gboolean create_tearoff,
|
||||
gboolean static_entry);
|
||||
void gimp_item_factory_create_items (GimpItemFactory *factory,
|
||||
guint n_entries,
|
||||
GimpItemFactoryEntry *entries,
|
||||
gpointer callback_data,
|
||||
guint callback_type,
|
||||
gboolean create_tearoff,
|
||||
gboolean static_entries);
|
||||
|
||||
void gimp_item_factory_popup_with_data (GimpItemFactory *factory,
|
||||
gpointer data,
|
||||
GtkDestroyNotify popdown_func);
|
||||
void gimp_item_factory_popup_with_data (GimpItemFactory *factory,
|
||||
gpointer data,
|
||||
GtkDestroyNotify popdown_func);
|
||||
|
||||
void gimp_item_factory_set_active (GtkItemFactory *factory,
|
||||
gchar *path,
|
||||
gboolean state);
|
||||
void gimp_item_factory_set_color (GtkItemFactory *factory,
|
||||
gchar *path,
|
||||
const GimpRGB *color,
|
||||
gboolean set_label);
|
||||
void gimp_item_factory_set_label (GtkItemFactory *factory,
|
||||
gchar *path,
|
||||
const gchar *label);
|
||||
void gimp_item_factory_set_sensitive (GtkItemFactory *factory,
|
||||
gchar *path,
|
||||
gboolean sensitive);
|
||||
void gimp_item_factory_set_visible (GtkItemFactory *factory,
|
||||
gchar *path,
|
||||
gboolean visible);
|
||||
void gimp_item_factory_set_active (GtkItemFactory *factory,
|
||||
const gchar *path,
|
||||
gboolean state);
|
||||
void gimp_item_factories_set_active (const gchar *factory_path,
|
||||
const gchar *path,
|
||||
gboolean state);
|
||||
|
||||
void gimp_item_factory_tearoff_callback (GtkWidget *widget,
|
||||
gpointer data,
|
||||
guint action);
|
||||
void gimp_item_factory_set_color (GtkItemFactory *factory,
|
||||
const gchar *path,
|
||||
const GimpRGB *color,
|
||||
gboolean set_label);
|
||||
void gimp_item_factories_set_color (const gchar *factory_path,
|
||||
const gchar *path,
|
||||
const GimpRGB *color,
|
||||
gboolean set_label);
|
||||
|
||||
void gimp_item_factory_set_label (GtkItemFactory *factory,
|
||||
const gchar *path,
|
||||
const gchar *label);
|
||||
void gimp_item_factories_set_label (const gchar *factory_path,
|
||||
const gchar *path,
|
||||
const gchar *label);
|
||||
|
||||
void gimp_item_factory_set_sensitive (GtkItemFactory *factory,
|
||||
const gchar *path,
|
||||
gboolean sensitive);
|
||||
void gimp_item_factories_set_sensitive (const gchar *factory_path,
|
||||
const gchar *path,
|
||||
gboolean sensitive);
|
||||
|
||||
void gimp_item_factory_set_visible (GtkItemFactory *factory,
|
||||
const gchar *path,
|
||||
gboolean visible);
|
||||
void gimp_item_factories_set_visible (const gchar *factory_path,
|
||||
const gchar *path,
|
||||
gboolean visible);
|
||||
|
||||
void gimp_item_factory_tearoff_callback (GtkWidget *widget,
|
||||
gpointer data,
|
||||
guint action);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
|
|
@ -662,6 +662,9 @@ toolbox_create_tools (GimpToolbox *toolbox,
|
|||
G_CALLBACK (toolbox_tool_button_press),
|
||||
toolbox);
|
||||
|
||||
if (! item_factory)
|
||||
continue;
|
||||
|
||||
menu_item = gtk_item_factory_get_widget (GTK_ITEM_FACTORY (item_factory),
|
||||
tool_info->menu_path);
|
||||
accel_closures = gtk_widget_list_accel_closures (menu_item);
|
||||
|
|
Loading…
Reference in New Issue