Commit b1ebd9cd authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

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.
parent cd858c5a
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,