Commit 8d86ec25 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

Move away from creating all item_factories statically in menus_init() but

2003-01-10  Michael Natterer  <mitch@gimp.org>

	Move away from creating all item_factories statically in
	menus_init() but create a new one for each place where one is
	needed:

	* app/widgets/Makefile.am
	* app/widgets/widgets-types.h
	* app/widgets/gimpmenufactory.[ch]: new factory which creates and
	configures the GimpItemFactories it knows about on-the-fly.

	* app/widgets/gimpitemfactory.[ch]: added
	gimp_item_factory_update() which calls the "update_func". Added
	"gboolean update_on_popup" so item_factories can be configured to
	require manual updates (used for the <Image> factory).

	* app/gui/menus.[ch]: create a "global_menu_factory" and register
	all menus we have with it. Added various setup functions which
	do stuff like adding the "Open Recent" menu or reorder plug-in
	menu entries. Removed the debugging stuff...

	* app/gui/Makefile.am
	* app/gui/debug-commands.[ch]: ...and added it here.

	* app/gui/gui.c: create the <Toolbox>, the popup-<Image> and the
	<Paths> factories here because they are still global.

	* app/gui/plug-in-menus.[ch]: changed the "image_factory"
	parameters to "item_factory" and create/update the entries for the
	passed item_factory only. Makes the whole stuff much more
	straightforward.

	* app/plug-in/plug-ins.c: don't call plug_in_make_menu().

	* app/display/gimpdisplay.[ch]
	* app/display/gimpdisplayshell.[ch]: added "menu_factory" and
	"popup_factory" parameters to gimp_display_new() and
	gimp_display_shell_new(). Create the menubar_factory and the
	qmask_factory dynamically. Pass the shell, not a Gimp to the QMask
	callbacks. Changed gimp_display_shell_set_menu_sensitivity() to
	gimp_display_shell_menu_update() and don't call it directly (it's
	a GimpItemFactory update_func now). Call gimp_item_factory_update()
	on the resp. factories instead.

	* app/gui/qmask-commands.c
	* app/display/gimpdisplayshell-callbacks.c
	* app/tools/gimpimagemaptool.c: changed accordingly.

	* app/widgets/gimpbrusheditor.c
	* app/widgets/gimpbrushfactoryview.[ch]
	* app/widgets/gimpbufferview.[ch]
	* app/widgets/gimpcolormapeditor.[ch]
	* app/widgets/gimpcontainereditor.[ch]
	* app/widgets/gimpdataeditor.[ch]
	* app/widgets/gimpdatafactoryview.[ch]
	* app/widgets/gimpdialogfactory.[ch]
	* app/widgets/gimpdock.c
	* app/widgets/gimpdockbook.[ch]
	* app/widgets/gimpdocumentview.[ch]
	* app/widgets/gimpgradienteditor.[ch]
	* app/widgets/gimpimageview.[ch]
	* app/widgets/gimpitemlistview.[ch]
	* app/widgets/gimppaletteeditor.[ch]: pass around lots of
	GimpMenuFactory pointers and menu_identifiers so all views can
	create their item_factories themselves. Unref the factories when
	they are no longer needed because they belong to the views now.

	* app/gui/dialogs-commands.c
	* app/gui/dialogs-constructors.c
	* app/gui/dialogs.c
	* app/gui/brush-select.c
	* app/gui/gradient-select.c
	* app/gui/palette-select.c
	* app/gui/pattern-select.c: changed accordingly.

	* app/gui/file-dialog-utils.[ch] (file_dialog_new): require
	menu_factory and menu_identifier parameters.

	* app/gui/file-open-dialog.[ch]
	* app/gui/file-save-dialog.[ch]: removed file_*_dialog_menu_init()
	(they went to menus.c as setup_funcs). Added file_*_dialog_set_type()
	and moved the <Load> and <Save> factory callbacks to file-commands.c

	* app/gui/file-commands.[ch]: changed accordingly.

	* app/gui/view-commands.c: changed the statusbar, menubar, rulers
	and guides callbacks to do their job only if the setting has
	actually changed. Don't update whole item factories afterwards.
	Instead, just change the state of the items that actually need
	update.

	Unrelated:

	* app/core/gimpchannel.c (gimp_channel_init): set "bounds_known"
	and friends to FALSE since we don't know that the new channel will
	be empty (fixes QMask and probably other stuff).

	* app/gui/image-commands.c
	* app/gui/vectors-commands.c: cleanup.
parent 2a6d3edd
2003-01-10 Michael Natterer <mitch@gimp.org>
Move away from creating all item_factories statically in
menus_init() but create a new one for each place where one is
needed:
* app/widgets/Makefile.am
* app/widgets/widgets-types.h
* app/widgets/gimpmenufactory.[ch]: new factory which creates and
configures the GimpItemFactories it knows about on-the-fly.
* app/widgets/gimpitemfactory.[ch]: added
gimp_item_factory_update() which calls the "update_func". Added
"gboolean update_on_popup" so item_factories can be configured to
require manual updates (used for the <Image> factory).
* app/gui/menus.[ch]: create a "global_menu_factory" and register
all menus we have with it. Added various setup functions which
do stuff like adding the "Open Recent" menu or reorder plug-in
menu entries. Removed the debugging stuff...
* app/gui/Makefile.am
* app/gui/debug-commands.[ch]: ...and added it here.
* app/gui/gui.c: create the <Toolbox>, the popup-<Image> and the
<Paths> factories here because they are still global.
* app/gui/plug-in-menus.[ch]: changed the "image_factory"
parameters to "item_factory" and create/update the entries for the
passed item_factory only. Makes the whole stuff much more
straightforward.
* app/plug-in/plug-ins.c: don't call plug_in_make_menu().
* app/display/gimpdisplay.[ch]
* app/display/gimpdisplayshell.[ch]: added "menu_factory" and
"popup_factory" parameters to gimp_display_new() and
gimp_display_shell_new(). Create the menubar_factory and the
qmask_factory dynamically. Pass the shell, not a Gimp to the QMask
callbacks. Changed gimp_display_shell_set_menu_sensitivity() to
gimp_display_shell_menu_update() and don't call it directly (it's
a GimpItemFactory update_func now). Call gimp_item_factory_update()
on the resp. factories instead.
* app/gui/qmask-commands.c
* app/display/gimpdisplayshell-callbacks.c
* app/tools/gimpimagemaptool.c: changed accordingly.
* app/widgets/gimpbrusheditor.c
* app/widgets/gimpbrushfactoryview.[ch]
* app/widgets/gimpbufferview.[ch]
* app/widgets/gimpcolormapeditor.[ch]
* app/widgets/gimpcontainereditor.[ch]
* app/widgets/gimpdataeditor.[ch]
* app/widgets/gimpdatafactoryview.[ch]
* app/widgets/gimpdialogfactory.[ch]
* app/widgets/gimpdock.c
* app/widgets/gimpdockbook.[ch]
* app/widgets/gimpdocumentview.[ch]
* app/widgets/gimpgradienteditor.[ch]
* app/widgets/gimpimageview.[ch]
* app/widgets/gimpitemlistview.[ch]
* app/widgets/gimppaletteeditor.[ch]: pass around lots of
GimpMenuFactory pointers and menu_identifiers so all views can
create their item_factories themselves. Unref the factories when
they are no longer needed because they belong to the views now.
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/dialogs.c
* app/gui/brush-select.c
* app/gui/gradient-select.c
* app/gui/palette-select.c
* app/gui/pattern-select.c: changed accordingly.
* app/gui/file-dialog-utils.[ch] (file_dialog_new): require
menu_factory and menu_identifier parameters.
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.[ch]: removed file_*_dialog_menu_init()
(they went to menus.c as setup_funcs). Added file_*_dialog_set_type()
and moved the <Load> and <Save> factory callbacks to file-commands.c
* app/gui/file-commands.[ch]: changed accordingly.
* app/gui/view-commands.c: changed the statusbar, menubar, rulers
and guides callbacks to do their job only if the setting has
actually changed. Don't update whole item factories afterwards.
Instead, just change the state of the items that actually need
update.
Unrelated:
* app/core/gimpchannel.c (gimp_channel_init): set "bounds_known"
and friends to FALSE since we don't know that the new channel will
be empty (fixes QMask and probably other stuff).
* app/gui/image-commands.c
* app/gui/vectors-commands.c: cleanup.
2003-01-10 Sven Neumann <sven@gimp.org>
* libgimpwidgets/gimpstock.c (gimp_stock_init): fixed my last commit.
......
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <string.h>
#include <gtk/gtk.h>
#include "libgimpbase/gimpbase.h"
#include "gui-types.h"
#include "core/gimpobject.h"
#include "widgets/gimpitemfactory.h"
#include "widgets/gimpmenufactory.h"
#include "debug-commands.h"
#include "menus.h"
#ifdef ENABLE_DEBUG_ENTRIES
/* local function prototypes */
static void debug_dump_menus_recurse_menu (GtkWidget *menu,
gint depth,
gchar *path);
/* public functions */
void
debug_dump_menus_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
GList *list;
for (list = global_menu_factory->registered_menus;
list;
list = g_list_next (list))
{
GimpMenuFactoryEntry *entry;
GimpItemFactory *item_factory;
entry = list->data;
item_factory = gimp_item_factory_from_path (entry->identifier);
if (item_factory)
{
GtkWidget *menu_item;
g_print ("%s\n", entry->identifier);
menu_item = gtk_item_factory_get_item (GTK_ITEM_FACTORY (item_factory),
entry->entries[0].entry.path);
if (menu_item &&
menu_item->parent &&
GTK_IS_MENU (menu_item->parent))
debug_dump_menus_recurse_menu (menu_item->parent, 1,
entry->identifier);
g_print ("\n");
}
}
}
void
debug_mem_profile_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
extern gboolean gimp_debug_memsize;
gimp_debug_memsize = TRUE;
gimp_object_get_memsize (GIMP_OBJECT (data));
gimp_debug_memsize = FALSE;
}
/* private functions */
static void
debug_dump_menus_recurse_menu (GtkWidget *menu,
gint depth,
gchar *path)
{
GtkItemFactory *item_factory;
GtkWidget *menu_item;
GList *list;
const gchar *label;
gchar *help_page;
gchar *help_path;
gchar *factory_path;
gchar *hash;
gchar *full_path;
gchar *format_str;
for (list = GTK_MENU_SHELL (menu)->children; list; list = g_list_next (list))
{
menu_item = GTK_WIDGET (list->data);
if (GTK_IS_LABEL (GTK_BIN (menu_item)->child))
{
label = gtk_label_get_text (GTK_LABEL (GTK_BIN (menu_item)->child));
full_path = g_strconcat (path, "/", label, NULL);
item_factory = GTK_ITEM_FACTORY (gimp_item_factory_from_path (path));
help_page = g_object_get_data (G_OBJECT (menu_item), "help_page");
if (item_factory)
{
factory_path = g_object_get_data (G_OBJECT (item_factory),
"factory_path");
if (factory_path)
{
help_page = g_build_filename (factory_path, help_page, NULL);
}
else
{
help_page = g_strdup (help_page);
}
}
else
{
help_page = g_strdup (help_page);
}
if (help_page)
{
help_path = g_build_filename (gimp_data_directory (),
"help", "C", help_page, NULL);
if ((hash = strchr (help_path, '#')) != NULL)
*hash = '\0';
if (g_file_test (help_path, G_FILE_TEST_EXISTS))
{
g_free (help_path);
help_path = g_strconcat ("! ", help_page, NULL);
g_free (help_page);
help_page = help_path;
}
else
{
g_free (help_path);
}
}
format_str = g_strdup_printf ("%%%ds%%%ds %%-20s %%s\n",
depth * 2, depth * 2 - 40);
g_print (format_str,
"", label, "", help_page ? help_page : "");
g_free (format_str);
g_free (help_page);
if (GTK_MENU_ITEM (menu_item)->submenu)
debug_dump_menus_recurse_menu (GTK_MENU_ITEM (menu_item)->submenu,
depth + 1, full_path);
g_free (full_path);
}
}
}
#endif /* ENABLE_DEBUG_ENTRIES */
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __DEBUG_COMMANDS_H__
#define __DEBUG_COMMANDS_H__
#define ENABLE_DEBUG_ENTRIES 1
#ifdef ENABLE_DEBUG_ENTRIES
void debug_dump_menus_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void debug_mem_profile_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
#endif /* ENABLE_DEBUG_ENTRIES */
#endif /* __DEBUG_COMMANDS_H__ */
......@@ -24,6 +24,8 @@
#include "gui-types.h"
#include "core/gimpcontext.h"
#include "widgets/gimpcontainerview.h"
#include "widgets/gimpcontainerview-utils.h"
#include "widgets/gimpdialogfactory.h"
......@@ -314,7 +316,7 @@ dialogs_create_lc_cmd_callback (GtkWidget *widget,
gimp_image_dock_set_show_image_menu (GIMP_IMAGE_DOCK (dock), TRUE);
dockbook = gimp_dockbook_new ();
dockbook = gimp_dockbook_new (global_dock_factory->menu_factory);
gimp_dock_add_book (GIMP_DOCK (dock), GIMP_DOCKBOOK (dockbook), 0);
......@@ -353,7 +355,7 @@ dialogs_create_stuff_cmd_callback (GtkWidget *widget,
dock = gimp_dialog_factory_dock_new (global_dock_factory);
dockbook = gimp_dockbook_new ();
dockbook = gimp_dockbook_new (global_dock_factory->menu_factory);
gimp_dock_add_book (GIMP_DOCK (dock), GIMP_DOCKBOOK (dockbook), 0);
......
......@@ -44,6 +44,7 @@
#include "file-new-dialog.h"
#include "file-open-dialog.h"
#include "file-save-dialog.h"
#include "menus.h"
#include "undo.h"
......@@ -107,7 +108,15 @@ file_open_by_extension_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
file_open_dialog_menu_reset ();
file_open_dialog_set_type (NULL);
}
void
file_open_type_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
file_open_dialog_set_type ((PlugInProcDef *) data);
}
void
......@@ -125,7 +134,7 @@ file_open_cmd_callback (GtkWidget *widget,
else
gimage = NULL;
file_open_dialog_show (gimp, gimage, NULL);
file_open_dialog_show (gimp, gimage, NULL, global_menu_factory);
}
void
......@@ -160,7 +169,15 @@ file_save_by_extension_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
file_save_dialog_menu_reset ();
file_save_dialog_set_type (NULL);
}
void
file_save_type_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
file_save_dialog_set_type ((PlugInProcDef *) data);
}
void
......@@ -215,7 +232,7 @@ file_save_as_cmd_callback (GtkWidget *widget,
GimpDisplay *gdisp;
return_if_no_display (gdisp, data);
file_save_dialog_show (gdisp->gimage);
file_save_dialog_show (gdisp->gimage, global_menu_factory);
}
void
......@@ -226,7 +243,7 @@ file_save_a_copy_cmd_callback (GtkWidget *widget,
GimpDisplay *gdisp;
return_if_no_display (gdisp, data);
file_save_a_copy_dialog_show (gdisp->gimage);
file_save_a_copy_dialog_show (gdisp->gimage, global_menu_factory);
}
void
......@@ -309,6 +326,12 @@ file_quit_cmd_callback (GtkWidget *widget,
gimp_exit (gimp, FALSE);
}
void
file_file_open_dialog (Gimp *gimp,
const gchar *uri)
{
file_open_dialog_show (gimp, NULL, uri, global_menu_factory);
}
/* private functions */
......
......@@ -20,45 +20,54 @@
#define __FILE_COMMANDS_H__
void file_new_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void file_new_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void file_open_by_extension_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void file_open_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void file_last_opened_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void file_open_by_extension_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void file_open_type_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void file_open_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void file_last_opened_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void file_save_by_extension_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void file_save_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void file_save_as_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void file_save_a_copy_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void file_save_by_extension_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void file_save_type_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void file_save_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void file_save_as_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void file_save_a_copy_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void file_revert_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void file_pref_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void file_close_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void file_quit_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void file_revert_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void file_pref_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void file_close_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void file_quit_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void file_file_open_dialog (Gimp *gimp,
const gchar *uri);
#endif /* __FILE_COMMANDS_H__ */
......@@ -254,6 +254,8 @@ image_flatten_image_cmd_callback (GtkWidget *widget,
gimp_image_flatten (gimage);
gimp_image_flush (gimage);
}
/****************************/
/* The layer merge dialog */
/****************************/
......
......@@ -33,7 +33,6 @@
#include "widgets/gimpcolorpanel.h"
#include "widgets/gimpitemfactory.h"
#include "widgets/gimpviewabledialog.h"
#include "widgets/gimpwidgets-utils.h"
#include "display/gimpdisplay.h"
#include "display/gimpdisplayshell.h"
......@@ -57,13 +56,13 @@ struct _EditQmaskOptions
/* local function prototypes */
static void qmask_channel_query (GimpDisplayShell *shell);
static void qmask_query_ok_callback (GtkWidget *widget,
gpointer client_data);
static void qmask_query_scale_update (GtkAdjustment *adjustment,
gpointer data);
static void qmask_query_color_changed (GimpColorButton *button,
gpointer data);
static void qmask_channel_query (GimpDisplayShell *shell);
static void qmask_query_ok_callback (GtkWidget *widget,
gpointer client_data);
static void qmask_query_scale_update (GtkAdjustment *adjustment,
gpointer data);
static void qmask_query_color_changed (GimpColorButton *button,
gpointer data);
/* public functionss */
......@@ -75,15 +74,15 @@ qmask_toggle_cmd_callback (GtkWidget *widget,
{
GimpDisplayShell *shell;
shell = (GimpDisplayShell *) gimp_widget_get_callback_context (widget);
if (! shell)
return;
shell = GIMP_DISPLAY_SHELL (data);
gimp_image_set_qmask_state (shell->gdisp->gimage,
GTK_CHECK_MENU_ITEM (widget)->active);
if (GTK_CHECK_MENU_ITEM (widget)->active != shell->gdisp->gimage->qmask_state)
{
gimp_image_set_qmask_state (shell->gdisp->gimage,
GTK_CHECK_MENU_ITEM (widget)->active);
gimp_image_flush (shell->gdisp->gimage);
gimp_image_flush (shell->gdisp->gimage);
}
}
void
......@@ -93,17 +92,17 @@ qmask_invert_cmd_callback (GtkWidget *widget,
{
GimpDisplayShell *shell;
shell = (GimpDisplayShell *) gimp_widget_get_callback_context (widget);
if (! shell)
return;
shell = GIMP_DISPLAY_SHELL (data);
if (GTK_CHECK_MENU_ITEM (widget)->active)
{
gimp_image_qmask_invert (shell->gdisp->gimage);
if (action != shell->gdisp->gimage->qmask_inverted)
{
gimp_image_qmask_invert (shell->gdisp->gimage);
if (shell->gdisp->gimage->qmask_state)
gimp_image_flush (shell->gdisp->gimage);
if (shell->gdisp->gimage->qmask_state)
gimp_image_flush (shell->gdisp->gimage);
}
}
}
......@@ -114,10 +113,7 @@ qmask_configure_cmd_callback (GtkWidget *widget,
{
GimpDisplayShell *shell;
shell = (GimpDisplayShell *) gimp_widget_get_callback_context (widget);
if (! shell)
return;
shell = GIMP_DISPLAY_SHELL (data);
qmask_channel_query (shell);
}
......
......@@ -33,7 +33,6 @@
#include "widgets/gimpcolorpanel.h"
#include "widgets/gimpitemfactory.h"
#include "widgets/gimpviewabledialog.h"
#include "widgets/gimpwidgets-utils.h"
#include "display/gimpdisplay.h"
#include "display/gimpdisplayshell.h"
......@@ -57,13 +56,13 @@ struct _EditQmaskOptions
/* local function prototypes */
static void qmask_channel_query (GimpDisplayShell *shell);
static void qmask_query_ok_callback (GtkWidget *widget,
gpointer client_data);
static void qmask_query_scale_update (GtkAdjustment *adjustment,
gpointer data);
static void qmask_query_color_changed (GimpColorButton *button,
gpointer data);
static void qmask_channel_query (GimpDisplayShell *shell);
static void qmask_query_ok_callback (GtkWidget *widget,
gpointer client_data);
static void qmask_query_scale_update (GtkAdjustment *adjustment,
gpointer data);
static void qmask_query_color_changed (GimpColorButton *button,
gpointer data);
/* public functionss */
......@@ -75,15 +74,15 @@ qmask_toggle_cmd_callback (GtkWidget *widget,
{
GimpDisplayShell *shell;
shell = (GimpDisplayShell *) gimp_widget_get_callback_context (widget);
if (! shell)
return;
shell = GIMP_DISPLAY_SHELL (data);
gimp_image_set_qmask_state (shell->gdisp->gimage,
GTK_CHECK_MENU_ITEM (widget)->active);
if (GTK_CHECK_MENU_ITEM (widget)->active != shell->gdisp->gimage->qmask_state)
{
gimp_image_set_qmask_state (shell->gdisp->gimage,
GTK_CHECK_MENU_ITEM (widget)->active);
gimp_image_flush (shell->gdisp->gimage);
gimp_image_flush (shell->gdisp->gimage);
}
}
void
......@@ -93,17 +92,17 @@ qmask_invert_cmd_callback (GtkWidget *widget,
{
GimpDisplayShell *shell;
shell = (GimpDisplayShell *) gimp_widget_get_callback_context (widget);
if (! shell)
return;
shell = GIMP_DISPLAY_SHELL (data);
if (GTK_CHECK_MENU_ITEM (widget)->active)
{
gimp_image_qmask_invert (shell->gdisp->gimage);
if (action != shell->gdisp->gimage->qmask_inverted)
{
gimp_image_qmask_invert (shell->gdisp->gimage);
if (shell->gdisp->gimage->qmask_state)
gimp_image_flush (shell->gdisp->gimage);
if (shell->gdisp->gimage->qmask_state)
gimp_image_flush (shell->gdisp->gimage);
}
}
}
......@@ -114,10 +113,7 @@ qmask_configure_cmd_callback (GtkWidget *widget,
{
GimpDisplayShell *shell;
shell = (GimpDisplayShell *) gimp_widget_get_callback_context (widget);
if (! shell)
return;
shell = GIMP_DISPLAY_SHELL (data);