2006-12-10 05:33:38 +08:00
|
|
|
/* GIMP - The GNU Image Manipulation Program
|
2001-04-22 08:38:56 +08:00
|
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
*
|
2005-05-12 04:26:12 +08:00
|
|
|
* gimpmenudock.c
|
2004-02-02 20:27:18 +08:00
|
|
|
* Copyright (C) 2001-2004 Michael Natterer <mitch@gimp.org>
|
2001-04-22 08:38:56 +08:00
|
|
|
*
|
2009-01-18 06:28:01 +08:00
|
|
|
* This program is free software: you can redistribute it and/or modify
|
2001-04-22 08:38:56 +08:00
|
|
|
* it under the terms of the GNU General Public License as published by
|
2009-01-18 06:28:01 +08:00
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
2001-04-22 08:38:56 +08:00
|
|
|
* (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
|
2009-01-18 06:28:01 +08:00
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2001-04-22 08:38:56 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
2003-10-11 05:24:12 +08:00
|
|
|
#include <string.h>
|
|
|
|
|
2008-10-10 04:24:04 +08:00
|
|
|
#include <gegl.h>
|
2001-04-22 08:38:56 +08:00
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
2004-02-02 20:27:18 +08:00
|
|
|
#include "libgimpbase/gimpbase.h"
|
2001-04-22 08:38:56 +08:00
|
|
|
#include "libgimpwidgets/gimpwidgets.h"
|
|
|
|
|
2001-05-08 11:48:54 +08:00
|
|
|
#include "widgets-types.h"
|
2001-04-22 08:38:56 +08:00
|
|
|
|
2001-07-07 20:19:21 +08:00
|
|
|
#include "core/gimp.h"
|
2001-05-09 10:32:03 +08:00
|
|
|
#include "core/gimpcontext.h"
|
|
|
|
#include "core/gimpimage.h"
|
2002-05-10 21:09:19 +08:00
|
|
|
#include "core/gimplist.h"
|
|
|
|
|
2001-04-22 08:38:56 +08:00
|
|
|
#include "gimpdialogfactory.h"
|
2004-05-12 00:01:00 +08:00
|
|
|
#include "gimpcontainercombobox.h"
|
|
|
|
#include "gimpcontainerview.h"
|
2003-05-03 19:59:44 +08:00
|
|
|
#include "gimpdockable.h"
|
2001-04-22 08:38:56 +08:00
|
|
|
#include "gimpdockbook.h"
|
2003-08-27 06:00:42 +08:00
|
|
|
#include "gimphelp-ids.h"
|
2005-05-12 04:26:12 +08:00
|
|
|
#include "gimpmenudock.h"
|
2007-05-25 19:42:28 +08:00
|
|
|
#include "gimpsessioninfo-aux.h"
|
2001-04-22 08:38:56 +08:00
|
|
|
|
2003-03-26 00:38:19 +08:00
|
|
|
#include "gimp-intl.h"
|
2001-04-22 08:38:56 +08:00
|
|
|
|
|
|
|
|
2008-03-22 09:10:51 +08:00
|
|
|
#define DEFAULT_MINIMAL_WIDTH 200
|
2006-01-17 18:08:50 +08:00
|
|
|
#define DEFAULT_MENU_VIEW_SIZE GTK_ICON_SIZE_SMALL_TOOLBAR
|
2002-03-15 01:07:02 +08:00
|
|
|
|
|
|
|
|
2005-05-12 04:26:12 +08:00
|
|
|
static GObject * gimp_menu_dock_constructor (GType type,
|
|
|
|
guint n_params,
|
|
|
|
GObjectConstructParam *params);
|
|
|
|
static void gimp_menu_dock_destroy (GtkObject *object);
|
|
|
|
|
|
|
|
static void gimp_menu_dock_style_set (GtkWidget *widget,
|
|
|
|
GtkStyle *prev_style);
|
|
|
|
|
|
|
|
static void gimp_menu_dock_setup (GimpDock *dock,
|
|
|
|
const GimpDock *template);
|
|
|
|
static void gimp_menu_dock_set_aux_info (GimpDock *dock,
|
|
|
|
GList *aux_info);
|
|
|
|
static GList *gimp_menu_dock_get_aux_info (GimpDock *dock);
|
2009-09-13 19:14:18 +08:00
|
|
|
static gchar *gimp_menu_dock_get_title (GimpDock *dock);
|
2005-05-12 04:26:12 +08:00
|
|
|
static void gimp_menu_dock_book_added (GimpDock *dock,
|
|
|
|
GimpDockbook *dockbook);
|
|
|
|
static void gimp_menu_dock_book_removed (GimpDock *dock,
|
|
|
|
GimpDockbook *dockbook);
|
|
|
|
|
|
|
|
static void gimp_menu_dock_dockbook_changed (GimpDockbook *dockbook,
|
|
|
|
GimpDockable *dockable,
|
|
|
|
GimpMenuDock *dock);
|
|
|
|
|
|
|
|
static void gimp_menu_dock_factory_display_changed (GimpContext *context,
|
|
|
|
GimpObject *display,
|
|
|
|
GimpDock *dock);
|
|
|
|
static void gimp_menu_dock_factory_image_changed (GimpContext *context,
|
2006-03-29 01:08:36 +08:00
|
|
|
GimpImage *image,
|
2005-05-12 04:26:12 +08:00
|
|
|
GimpDock *dock);
|
|
|
|
static void gimp_menu_dock_image_changed (GimpContext *context,
|
2006-03-29 01:08:36 +08:00
|
|
|
GimpImage *image,
|
2005-05-12 04:26:12 +08:00
|
|
|
GimpDock *dock);
|
|
|
|
static void gimp_menu_dock_auto_clicked (GtkWidget *widget,
|
|
|
|
GimpDock *dock);
|
2001-04-22 08:38:56 +08:00
|
|
|
|
|
|
|
|
2009-09-13 15:31:21 +08:00
|
|
|
G_DEFINE_TYPE (GimpMenuDock, gimp_menu_dock, GIMP_TYPE_DOCK)
|
2001-04-22 08:38:56 +08:00
|
|
|
|
2005-12-20 06:37:49 +08:00
|
|
|
#define parent_class gimp_menu_dock_parent_class
|
2001-04-22 08:38:56 +08:00
|
|
|
|
|
|
|
|
|
|
|
static void
|
2005-05-12 04:26:12 +08:00
|
|
|
gimp_menu_dock_class_init (GimpMenuDockClass *klass)
|
2001-04-22 08:38:56 +08:00
|
|
|
{
|
2005-02-01 00:09:52 +08:00
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
|
|
|
GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (klass);
|
|
|
|
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
|
|
|
|
GimpDockClass *dock_class = GIMP_DOCK_CLASS (klass);
|
2001-04-22 08:38:56 +08:00
|
|
|
|
2005-05-12 04:26:12 +08:00
|
|
|
object_class->constructor = gimp_menu_dock_constructor;
|
2003-05-03 19:59:44 +08:00
|
|
|
|
2005-05-12 04:26:12 +08:00
|
|
|
gtk_object_class->destroy = gimp_menu_dock_destroy;
|
2002-03-19 03:34:06 +08:00
|
|
|
|
2005-05-12 04:26:12 +08:00
|
|
|
widget_class->style_set = gimp_menu_dock_style_set;
|
2004-02-01 04:23:53 +08:00
|
|
|
|
2005-05-12 04:26:12 +08:00
|
|
|
dock_class->setup = gimp_menu_dock_setup;
|
|
|
|
dock_class->set_aux_info = gimp_menu_dock_set_aux_info;
|
|
|
|
dock_class->get_aux_info = gimp_menu_dock_get_aux_info;
|
2009-09-13 19:14:18 +08:00
|
|
|
dock_class->get_title = gimp_menu_dock_get_title;
|
2005-05-12 04:26:12 +08:00
|
|
|
dock_class->book_added = gimp_menu_dock_book_added;
|
|
|
|
dock_class->book_removed = gimp_menu_dock_book_removed;
|
2002-03-19 03:34:06 +08:00
|
|
|
|
|
|
|
gtk_widget_class_install_style_property (widget_class,
|
2005-03-10 01:02:35 +08:00
|
|
|
g_param_spec_int ("minimal-width",
|
2002-03-19 03:34:06 +08:00
|
|
|
NULL, NULL,
|
|
|
|
0,
|
|
|
|
G_MAXINT,
|
|
|
|
DEFAULT_MINIMAL_WIDTH,
|
2006-01-19 04:29:40 +08:00
|
|
|
GIMP_PARAM_READABLE));
|
2002-05-10 21:09:19 +08:00
|
|
|
gtk_widget_class_install_style_property (widget_class,
|
2005-03-10 01:02:35 +08:00
|
|
|
g_param_spec_enum ("menu-preview-size",
|
2002-05-10 22:50:27 +08:00
|
|
|
NULL, NULL,
|
|
|
|
GTK_TYPE_ICON_SIZE,
|
2006-01-17 18:08:50 +08:00
|
|
|
DEFAULT_MENU_VIEW_SIZE,
|
2006-01-19 04:29:40 +08:00
|
|
|
GIMP_PARAM_READABLE));
|
2001-04-22 08:38:56 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2005-05-12 04:26:12 +08:00
|
|
|
gimp_menu_dock_init (GimpMenuDock *dock)
|
2001-04-22 08:38:56 +08:00
|
|
|
{
|
2001-04-24 00:58:18 +08:00
|
|
|
GtkWidget *hbox;
|
|
|
|
|
2003-05-03 19:59:44 +08:00
|
|
|
dock->image_container = NULL;
|
|
|
|
dock->display_container = NULL;
|
|
|
|
dock->show_image_menu = FALSE;
|
|
|
|
dock->auto_follow_active = TRUE;
|
2001-04-24 00:58:18 +08:00
|
|
|
|
|
|
|
hbox = gtk_hbox_new (FALSE, 2);
|
2009-01-04 18:28:31 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (gimp_dock_get_main_vbox (GIMP_DOCK (dock))), hbox,
|
2001-04-22 08:38:56 +08:00
|
|
|
FALSE, FALSE, 0);
|
2009-01-04 18:28:31 +08:00
|
|
|
gtk_box_reorder_child (GTK_BOX (gimp_dock_get_main_vbox (GIMP_DOCK (dock))), hbox, 0);
|
2002-03-15 01:07:02 +08:00
|
|
|
|
|
|
|
if (dock->show_image_menu)
|
|
|
|
gtk_widget_show (hbox);
|
2001-04-24 00:58:18 +08:00
|
|
|
|
2004-05-12 00:01:00 +08:00
|
|
|
dock->image_combo = gimp_container_combo_box_new (NULL, NULL, 16, 1);
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), dock->image_combo, TRUE, TRUE, 0);
|
|
|
|
gtk_widget_show (dock->image_combo);
|
2001-04-22 08:38:56 +08:00
|
|
|
|
2004-05-12 00:01:00 +08:00
|
|
|
g_signal_connect (dock->image_combo, "destroy",
|
2006-04-12 20:49:29 +08:00
|
|
|
G_CALLBACK (gtk_widget_destroyed),
|
|
|
|
&dock->image_combo);
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-25 05:27:11 +08:00
|
|
|
|
2004-05-12 00:01:00 +08:00
|
|
|
gimp_help_set_help_data (dock->image_combo, NULL, GIMP_HELP_DOCK_IMAGE_MENU);
|
2003-08-27 06:00:42 +08:00
|
|
|
|
2001-07-02 22:58:02 +08:00
|
|
|
dock->auto_button = gtk_toggle_button_new_with_label (_("Auto"));
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dock->auto_button),
|
2005-02-01 00:09:52 +08:00
|
|
|
dock->auto_follow_active);
|
2001-07-02 22:58:02 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), dock->auto_button, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (dock->auto_button);
|
2001-04-24 00:58:18 +08:00
|
|
|
|
2003-01-06 06:07:10 +08:00
|
|
|
g_signal_connect (dock->auto_button, "clicked",
|
2005-05-12 04:26:12 +08:00
|
|
|
G_CALLBACK (gimp_menu_dock_auto_clicked),
|
2005-02-01 00:09:52 +08:00
|
|
|
dock);
|
2003-08-27 06:00:42 +08:00
|
|
|
|
2003-10-23 22:26:44 +08:00
|
|
|
gimp_help_set_help_data (dock->auto_button,
|
|
|
|
_("When enabled the dialog automatically "
|
|
|
|
"follows the image you are working on."),
|
2003-08-27 06:00:42 +08:00
|
|
|
GIMP_HELP_DOCK_AUTO_BUTTON);
|
2001-04-22 08:38:56 +08:00
|
|
|
}
|
|
|
|
|
2004-02-01 04:23:53 +08:00
|
|
|
static GObject *
|
2005-05-12 04:26:12 +08:00
|
|
|
gimp_menu_dock_constructor (GType type,
|
|
|
|
guint n_params,
|
|
|
|
GObjectConstructParam *params)
|
2001-04-22 08:38:56 +08:00
|
|
|
{
|
2005-05-12 04:26:12 +08:00
|
|
|
GObject *object;
|
|
|
|
GimpMenuDock *dock;
|
2004-02-01 04:23:53 +08:00
|
|
|
|
|
|
|
object = G_OBJECT_CLASS (parent_class)->constructor (type, n_params, params);
|
2001-04-22 08:38:56 +08:00
|
|
|
|
2005-05-12 04:26:12 +08:00
|
|
|
dock = GIMP_MENU_DOCK (object);
|
2001-04-22 08:38:56 +08:00
|
|
|
|
2004-02-01 04:23:53 +08:00
|
|
|
return object;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2005-05-12 04:26:12 +08:00
|
|
|
gimp_menu_dock_destroy (GtkObject *object)
|
2004-02-01 04:23:53 +08:00
|
|
|
{
|
2005-05-12 04:26:12 +08:00
|
|
|
GimpMenuDock *dock = GIMP_MENU_DOCK (object);
|
2004-02-01 04:23:53 +08:00
|
|
|
|
2001-04-24 00:58:18 +08:00
|
|
|
/* remove the image menu and the auto button manually here because
|
|
|
|
* of weird cross-connections with GimpDock's context
|
|
|
|
*/
|
2009-01-04 18:28:31 +08:00
|
|
|
if (gimp_dock_get_main_vbox (GIMP_DOCK (dock)) && dock->image_combo)
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-25 05:27:11 +08:00
|
|
|
{
|
2008-06-28 23:50:27 +08:00
|
|
|
GtkWidget *parent = gtk_widget_get_parent (dock->image_combo);
|
|
|
|
|
|
|
|
if (parent)
|
2009-01-04 18:28:31 +08:00
|
|
|
gtk_container_remove (GTK_CONTAINER (gimp_dock_get_main_vbox (GIMP_DOCK (dock))),
|
2008-06-28 23:50:27 +08:00
|
|
|
parent);
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-25 05:27:11 +08:00
|
|
|
}
|
2001-04-24 00:58:18 +08:00
|
|
|
|
2003-05-03 19:59:44 +08:00
|
|
|
GTK_OBJECT_CLASS (parent_class)->destroy (object);
|
2001-04-22 08:38:56 +08:00
|
|
|
}
|
|
|
|
|
2002-03-19 03:34:06 +08:00
|
|
|
static void
|
2005-05-12 04:26:12 +08:00
|
|
|
gimp_menu_dock_style_set (GtkWidget *widget,
|
|
|
|
GtkStyle *prev_style)
|
2002-03-19 03:34:06 +08:00
|
|
|
{
|
2008-03-30 07:43:39 +08:00
|
|
|
GimpMenuDock *menu_dock = GIMP_MENU_DOCK (widget);
|
2008-06-28 23:50:27 +08:00
|
|
|
GtkStyle *button_style;
|
2005-05-12 04:26:12 +08:00
|
|
|
gint minimal_width;
|
2006-01-17 18:08:50 +08:00
|
|
|
GtkIconSize menu_view_size;
|
2005-11-03 04:18:13 +08:00
|
|
|
GtkSettings *settings;
|
2006-01-17 18:08:50 +08:00
|
|
|
gint menu_view_width = 18;
|
|
|
|
gint menu_view_height = 18;
|
2005-05-12 04:26:12 +08:00
|
|
|
gint focus_line_width;
|
|
|
|
gint focus_padding;
|
|
|
|
gint ythickness;
|
|
|
|
|
2008-03-30 07:43:39 +08:00
|
|
|
GTK_WIDGET_CLASS (parent_class)->style_set (widget, prev_style);
|
2002-03-19 03:34:06 +08:00
|
|
|
|
|
|
|
gtk_widget_style_get (widget,
|
2005-08-03 17:34:55 +08:00
|
|
|
"minimal-width", &minimal_width,
|
2006-01-17 18:08:50 +08:00
|
|
|
"menu-preview-size", &menu_view_size,
|
2005-02-01 00:09:52 +08:00
|
|
|
NULL);
|
2002-03-19 03:34:06 +08:00
|
|
|
|
2005-11-03 04:18:13 +08:00
|
|
|
settings = gtk_widget_get_settings (menu_dock->image_combo);
|
|
|
|
gtk_icon_size_lookup_for_settings (settings,
|
2006-01-17 18:08:50 +08:00
|
|
|
menu_view_size,
|
|
|
|
&menu_view_width,
|
|
|
|
&menu_view_height);
|
2002-05-10 22:50:27 +08:00
|
|
|
|
2005-05-12 04:26:12 +08:00
|
|
|
gtk_widget_style_get (menu_dock->auto_button,
|
2005-08-03 17:34:55 +08:00
|
|
|
"focus-line-width", &focus_line_width,
|
|
|
|
"focus-padding", &focus_padding,
|
2005-02-01 00:09:52 +08:00
|
|
|
NULL);
|
2002-05-10 21:09:19 +08:00
|
|
|
|
2008-06-28 23:50:27 +08:00
|
|
|
button_style = gtk_widget_get_style (widget);
|
|
|
|
ythickness = button_style->ythickness;
|
2002-05-10 21:09:19 +08:00
|
|
|
|
2002-03-19 03:34:06 +08:00
|
|
|
gtk_widget_set_size_request (widget, minimal_width, -1);
|
2002-05-10 21:09:19 +08:00
|
|
|
|
2006-01-17 18:08:50 +08:00
|
|
|
gimp_container_view_set_view_size (GIMP_CONTAINER_VIEW (menu_dock->image_combo),
|
|
|
|
menu_view_height, 1);
|
2002-05-10 21:09:19 +08:00
|
|
|
|
2005-05-12 04:26:12 +08:00
|
|
|
gtk_widget_set_size_request (menu_dock->auto_button, -1,
|
2006-01-17 18:08:50 +08:00
|
|
|
menu_view_height +
|
2002-05-10 21:09:19 +08:00
|
|
|
2 * (1 /* CHILD_SPACING */ +
|
|
|
|
ythickness +
|
|
|
|
focus_padding +
|
|
|
|
focus_line_width));
|
2002-03-19 03:34:06 +08:00
|
|
|
}
|
|
|
|
|
2003-10-08 23:44:35 +08:00
|
|
|
static void
|
2005-05-12 04:26:12 +08:00
|
|
|
gimp_menu_dock_setup (GimpDock *dock,
|
|
|
|
const GimpDock *template)
|
2003-10-08 23:44:35 +08:00
|
|
|
{
|
2005-05-12 04:26:12 +08:00
|
|
|
if (GIMP_IS_MENU_DOCK (template))
|
2003-10-08 23:44:35 +08:00
|
|
|
{
|
|
|
|
gboolean auto_follow_active;
|
|
|
|
gboolean show_image_menu;
|
|
|
|
|
2005-05-12 04:26:12 +08:00
|
|
|
auto_follow_active = GIMP_MENU_DOCK (template)->auto_follow_active;
|
|
|
|
show_image_menu = GIMP_MENU_DOCK (template)->show_image_menu;
|
2003-10-08 23:44:35 +08:00
|
|
|
|
2005-05-12 04:26:12 +08:00
|
|
|
gimp_menu_dock_set_auto_follow_active (GIMP_MENU_DOCK (dock),
|
|
|
|
auto_follow_active);
|
|
|
|
gimp_menu_dock_set_show_image_menu (GIMP_MENU_DOCK (dock),
|
|
|
|
show_image_menu);
|
2003-10-08 23:44:35 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-10-19 01:10:36 +08:00
|
|
|
#define AUX_INFO_SHOW_IMAGE_MENU "show-image-menu"
|
|
|
|
#define AUX_INFO_FOLLOW_ACTIVE_IMAGE "follow-active-image"
|
|
|
|
|
2003-10-11 05:24:12 +08:00
|
|
|
static void
|
2005-05-12 04:26:12 +08:00
|
|
|
gimp_menu_dock_set_aux_info (GimpDock *dock,
|
|
|
|
GList *aux_info)
|
2003-10-11 05:24:12 +08:00
|
|
|
{
|
2005-05-12 04:26:12 +08:00
|
|
|
GimpMenuDock *menu_dock = GIMP_MENU_DOCK (dock);
|
|
|
|
GList *list;
|
|
|
|
gboolean menu_shown = menu_dock->show_image_menu;
|
|
|
|
gboolean auto_follow = menu_dock->auto_follow_active;
|
2003-10-11 05:24:12 +08:00
|
|
|
|
2003-10-12 00:50:35 +08:00
|
|
|
for (list = aux_info; list; list = g_list_next (list))
|
2003-10-11 05:24:12 +08:00
|
|
|
{
|
2003-10-12 00:50:35 +08:00
|
|
|
GimpSessionInfoAux *aux = list->data;
|
|
|
|
|
2003-10-19 01:10:36 +08:00
|
|
|
if (! strcmp (aux->name, AUX_INFO_SHOW_IMAGE_MENU))
|
2003-10-12 00:50:35 +08:00
|
|
|
{
|
|
|
|
menu_shown = ! g_ascii_strcasecmp (aux->value, "true");
|
|
|
|
}
|
2003-10-19 01:10:36 +08:00
|
|
|
else if (! strcmp (aux->name, AUX_INFO_FOLLOW_ACTIVE_IMAGE))
|
2003-10-12 00:50:35 +08:00
|
|
|
{
|
|
|
|
auto_follow = ! g_ascii_strcasecmp (aux->value, "true");
|
|
|
|
}
|
2003-10-11 05:24:12 +08:00
|
|
|
}
|
|
|
|
|
2005-05-12 04:26:12 +08:00
|
|
|
if (menu_shown != menu_dock->show_image_menu)
|
|
|
|
gimp_menu_dock_set_show_image_menu (menu_dock, menu_shown);
|
2003-10-11 05:24:12 +08:00
|
|
|
|
2005-05-12 04:26:12 +08:00
|
|
|
if (auto_follow != menu_dock->auto_follow_active)
|
|
|
|
gimp_menu_dock_set_auto_follow_active (menu_dock, auto_follow);
|
2003-10-11 05:24:12 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static GList *
|
2005-05-12 04:26:12 +08:00
|
|
|
gimp_menu_dock_get_aux_info (GimpDock *dock)
|
2003-10-11 05:24:12 +08:00
|
|
|
{
|
2005-05-12 04:26:12 +08:00
|
|
|
GimpMenuDock *menu_dock = GIMP_MENU_DOCK (dock);
|
|
|
|
GList *aux_info = NULL;
|
2003-10-12 00:50:35 +08:00
|
|
|
GimpSessionInfoAux *aux;
|
|
|
|
|
2003-10-19 01:10:36 +08:00
|
|
|
aux = gimp_session_info_aux_new (AUX_INFO_SHOW_IMAGE_MENU,
|
2005-05-12 04:26:12 +08:00
|
|
|
menu_dock->show_image_menu ?
|
2003-10-12 01:05:48 +08:00
|
|
|
"true" : "false");
|
2003-10-12 00:50:35 +08:00
|
|
|
aux_info = g_list_append (aux_info, aux);
|
2003-10-11 05:24:12 +08:00
|
|
|
|
2003-10-19 01:10:36 +08:00
|
|
|
aux = gimp_session_info_aux_new (AUX_INFO_FOLLOW_ACTIVE_IMAGE,
|
2005-05-12 04:26:12 +08:00
|
|
|
menu_dock->auto_follow_active ?
|
2003-10-12 01:05:48 +08:00
|
|
|
"true" : "false");
|
2003-10-12 00:50:35 +08:00
|
|
|
aux_info = g_list_append (aux_info, aux);
|
2003-10-11 05:24:12 +08:00
|
|
|
|
2003-10-12 00:50:35 +08:00
|
|
|
return aux_info;
|
2003-10-11 05:24:12 +08:00
|
|
|
}
|
|
|
|
|
2003-05-03 19:59:44 +08:00
|
|
|
static void
|
2005-05-12 04:26:12 +08:00
|
|
|
gimp_menu_dock_book_added (GimpDock *dock,
|
|
|
|
GimpDockbook *dockbook)
|
2003-05-03 19:59:44 +08:00
|
|
|
{
|
2005-08-03 17:34:55 +08:00
|
|
|
g_signal_connect (dockbook, "dockable-added",
|
2005-05-12 04:26:12 +08:00
|
|
|
G_CALLBACK (gimp_menu_dock_dockbook_changed),
|
2003-05-03 19:59:44 +08:00
|
|
|
dock);
|
2005-08-03 17:34:55 +08:00
|
|
|
g_signal_connect (dockbook, "dockable-removed",
|
2005-05-12 04:26:12 +08:00
|
|
|
G_CALLBACK (gimp_menu_dock_dockbook_changed),
|
2003-05-03 19:59:44 +08:00
|
|
|
dock);
|
2005-08-03 17:34:55 +08:00
|
|
|
g_signal_connect (dockbook, "dockable-reordered",
|
2005-05-12 04:26:12 +08:00
|
|
|
G_CALLBACK (gimp_menu_dock_dockbook_changed),
|
2003-05-03 19:59:44 +08:00
|
|
|
dock);
|
|
|
|
|
2009-09-13 19:14:18 +08:00
|
|
|
gimp_dock_invalidate_title (GIMP_DOCK (dock));
|
2003-05-03 19:59:44 +08:00
|
|
|
|
|
|
|
GIMP_DOCK_CLASS (parent_class)->book_added (dock, dockbook);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2005-05-12 04:26:12 +08:00
|
|
|
gimp_menu_dock_book_removed (GimpDock *dock,
|
|
|
|
GimpDockbook *dockbook)
|
2003-05-03 19:59:44 +08:00
|
|
|
{
|
|
|
|
g_signal_handlers_disconnect_by_func (dockbook,
|
2005-05-12 04:26:12 +08:00
|
|
|
gimp_menu_dock_dockbook_changed,
|
2003-05-03 19:59:44 +08:00
|
|
|
dock);
|
|
|
|
|
2009-09-13 19:14:18 +08:00
|
|
|
gimp_dock_invalidate_title (GIMP_DOCK (dock));
|
2003-05-03 19:59:44 +08:00
|
|
|
|
2003-05-14 18:18:03 +08:00
|
|
|
GIMP_DOCK_CLASS (parent_class)->book_removed (dock, dockbook);
|
2003-05-03 19:59:44 +08:00
|
|
|
}
|
|
|
|
|
2001-04-22 08:38:56 +08:00
|
|
|
GtkWidget *
|
2005-05-12 04:26:12 +08:00
|
|
|
gimp_menu_dock_new (GimpDialogFactory *dialog_factory,
|
|
|
|
GimpContainer *image_container,
|
|
|
|
GimpContainer *display_container)
|
2001-04-22 08:38:56 +08:00
|
|
|
{
|
2005-05-12 04:26:12 +08:00
|
|
|
GimpMenuDock *menu_dock;
|
|
|
|
GimpContext *context;
|
2005-11-03 04:18:13 +08:00
|
|
|
GtkSettings *settings;
|
2006-01-17 18:08:50 +08:00
|
|
|
gint menu_view_width;
|
|
|
|
gint menu_view_height;
|
2001-11-30 02:43:25 +08:00
|
|
|
|
2002-03-15 01:07:02 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_DIALOG_FACTORY (dialog_factory), NULL);
|
2001-04-24 00:58:18 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_CONTAINER (image_container), NULL);
|
2002-05-10 21:09:19 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_CONTAINER (display_container), NULL);
|
2001-04-24 00:58:18 +08:00
|
|
|
|
2009-09-12 19:29:18 +08:00
|
|
|
/* Create a separate context per dock so that docks can be bound to
|
|
|
|
* a specific image and does not necessarily have to follow the
|
|
|
|
* active image in the user context
|
|
|
|
*/
|
2002-03-15 01:07:02 +08:00
|
|
|
context = gimp_context_new (dialog_factory->context->gimp,
|
|
|
|
"Dock Context", NULL);
|
|
|
|
|
2005-05-12 04:26:12 +08:00
|
|
|
menu_dock = g_object_new (GIMP_TYPE_MENU_DOCK,
|
2009-09-13 15:49:56 +08:00
|
|
|
"context", context,
|
|
|
|
"dialog-factory", dialog_factory,
|
2005-05-12 04:26:12 +08:00
|
|
|
NULL);
|
2007-07-17 18:55:21 +08:00
|
|
|
g_object_unref (context);
|
2003-11-21 04:36:55 +08:00
|
|
|
|
2005-05-12 04:26:12 +08:00
|
|
|
menu_dock->image_container = image_container;
|
|
|
|
menu_dock->display_container = display_container;
|
2001-04-22 08:38:56 +08:00
|
|
|
|
2005-05-12 04:26:12 +08:00
|
|
|
gimp_help_connect (GTK_WIDGET (menu_dock), gimp_standard_help_func,
|
2003-08-27 06:00:42 +08:00
|
|
|
GIMP_HELP_DOCK, NULL);
|
|
|
|
|
2002-03-15 01:07:02 +08:00
|
|
|
gimp_context_define_properties (context,
|
2006-04-12 20:49:29 +08:00
|
|
|
GIMP_CONTEXT_ALL_PROPS_MASK &
|
|
|
|
~(GIMP_CONTEXT_IMAGE_MASK |
|
|
|
|
GIMP_CONTEXT_DISPLAY_MASK),
|
|
|
|
FALSE);
|
2002-03-15 01:07:02 +08:00
|
|
|
gimp_context_set_parent (context, dialog_factory->context);
|
2001-04-24 00:58:18 +08:00
|
|
|
|
2005-05-12 04:26:12 +08:00
|
|
|
if (menu_dock->auto_follow_active)
|
2002-05-08 20:39:01 +08:00
|
|
|
{
|
|
|
|
if (gimp_context_get_display (dialog_factory->context))
|
|
|
|
gimp_context_copy_property (dialog_factory->context, context,
|
|
|
|
GIMP_CONTEXT_PROP_DISPLAY);
|
|
|
|
else
|
|
|
|
gimp_context_copy_property (dialog_factory->context, context,
|
|
|
|
GIMP_CONTEXT_PROP_IMAGE);
|
|
|
|
}
|
2001-05-07 00:14:34 +08:00
|
|
|
|
2005-05-28 00:51:39 +08:00
|
|
|
g_signal_connect_object (dialog_factory->context, "display-changed",
|
2006-04-12 20:49:29 +08:00
|
|
|
G_CALLBACK (gimp_menu_dock_factory_display_changed),
|
|
|
|
menu_dock,
|
|
|
|
0);
|
2005-05-28 00:51:39 +08:00
|
|
|
g_signal_connect_object (dialog_factory->context, "image-changed",
|
2006-04-12 20:49:29 +08:00
|
|
|
G_CALLBACK (gimp_menu_dock_factory_image_changed),
|
|
|
|
menu_dock,
|
|
|
|
0);
|
2001-04-24 00:58:18 +08:00
|
|
|
|
2005-05-28 00:51:39 +08:00
|
|
|
g_signal_connect_object (context, "image-changed",
|
2006-04-12 20:49:29 +08:00
|
|
|
G_CALLBACK (gimp_menu_dock_image_changed),
|
|
|
|
menu_dock,
|
|
|
|
0);
|
2001-04-24 00:58:18 +08:00
|
|
|
|
2005-11-03 04:18:13 +08:00
|
|
|
settings = gtk_widget_get_settings (GTK_WIDGET (menu_dock));
|
|
|
|
gtk_icon_size_lookup_for_settings (settings,
|
2006-01-17 18:08:50 +08:00
|
|
|
DEFAULT_MENU_VIEW_SIZE,
|
|
|
|
&menu_view_width,
|
|
|
|
&menu_view_height);
|
2002-05-10 22:50:27 +08:00
|
|
|
|
2005-05-12 04:26:12 +08:00
|
|
|
g_object_set (menu_dock->image_combo,
|
2004-05-12 00:01:00 +08:00
|
|
|
"container", image_container,
|
|
|
|
"context", context,
|
|
|
|
NULL);
|
2002-03-15 01:07:02 +08:00
|
|
|
|
2005-05-12 04:26:12 +08:00
|
|
|
return GTK_WIDGET (menu_dock);
|
2001-04-22 08:38:56 +08:00
|
|
|
}
|
2001-04-24 00:58:18 +08:00
|
|
|
|
2001-07-02 22:58:02 +08:00
|
|
|
void
|
2005-05-12 04:26:12 +08:00
|
|
|
gimp_menu_dock_set_auto_follow_active (GimpMenuDock *menu_dock,
|
|
|
|
gboolean auto_follow_active)
|
2001-07-02 22:58:02 +08:00
|
|
|
{
|
2005-05-12 04:26:12 +08:00
|
|
|
g_return_if_fail (GIMP_IS_MENU_DOCK (menu_dock));
|
2001-07-02 22:58:02 +08:00
|
|
|
|
2005-05-12 04:26:12 +08:00
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (menu_dock->auto_button),
|
2006-04-12 20:49:29 +08:00
|
|
|
auto_follow_active ? TRUE : FALSE);
|
2001-07-02 22:58:02 +08:00
|
|
|
}
|
|
|
|
|
2001-06-30 03:25:03 +08:00
|
|
|
void
|
2005-05-12 04:26:12 +08:00
|
|
|
gimp_menu_dock_set_show_image_menu (GimpMenuDock *menu_dock,
|
|
|
|
gboolean show)
|
2001-06-30 03:25:03 +08:00
|
|
|
{
|
2008-06-28 23:50:27 +08:00
|
|
|
GtkWidget *parent;
|
|
|
|
|
2005-05-12 04:26:12 +08:00
|
|
|
g_return_if_fail (GIMP_IS_MENU_DOCK (menu_dock));
|
2001-06-30 03:25:03 +08:00
|
|
|
|
2008-06-28 23:50:27 +08:00
|
|
|
parent = gtk_widget_get_parent (menu_dock->image_combo);
|
|
|
|
|
2001-06-30 03:25:03 +08:00
|
|
|
if (show)
|
2008-06-28 23:50:27 +08:00
|
|
|
gtk_widget_show (parent);
|
2001-06-30 03:25:03 +08:00
|
|
|
else
|
2008-06-28 23:50:27 +08:00
|
|
|
gtk_widget_hide (parent);
|
2001-07-02 22:58:02 +08:00
|
|
|
|
2005-05-12 04:26:12 +08:00
|
|
|
menu_dock->show_image_menu = show ? TRUE : FALSE;
|
2001-06-30 03:25:03 +08:00
|
|
|
}
|
|
|
|
|
2003-05-03 19:59:44 +08:00
|
|
|
static void
|
2005-05-12 04:26:12 +08:00
|
|
|
gimp_menu_dock_dockbook_changed (GimpDockbook *dockbook,
|
|
|
|
GimpDockable *dockable,
|
|
|
|
GimpMenuDock *dock)
|
2003-05-03 19:59:44 +08:00
|
|
|
{
|
2009-09-13 19:14:18 +08:00
|
|
|
gimp_dock_invalidate_title (GIMP_DOCK (dock));
|
2003-05-03 19:59:44 +08:00
|
|
|
}
|
|
|
|
|
2009-09-13 19:14:18 +08:00
|
|
|
static gchar *
|
|
|
|
gimp_menu_dock_get_title (GimpDock *dock)
|
2003-05-03 19:59:44 +08:00
|
|
|
{
|
|
|
|
GString *title;
|
|
|
|
GList *list;
|
|
|
|
|
|
|
|
title = g_string_new (NULL);
|
|
|
|
|
2009-09-13 19:14:18 +08:00
|
|
|
for (list = gimp_dock_get_dockbooks (dock);
|
2003-05-03 19:59:44 +08:00
|
|
|
list;
|
|
|
|
list = g_list_next (list))
|
|
|
|
{
|
|
|
|
GimpDockbook *dockbook = list->data;
|
|
|
|
GList *children;
|
|
|
|
GList *child;
|
|
|
|
|
|
|
|
children = gtk_container_get_children (GTK_CONTAINER (dockbook));
|
|
|
|
|
|
|
|
for (child = children; child; child = g_list_next (child))
|
|
|
|
{
|
|
|
|
GimpDockable *dockable = child->data;
|
|
|
|
|
2003-07-08 23:07:56 +08:00
|
|
|
g_string_append (title, dockable->name);
|
2003-05-03 19:59:44 +08:00
|
|
|
|
|
|
|
if (g_list_next (child))
|
|
|
|
g_string_append (title, ", ");
|
|
|
|
}
|
|
|
|
|
|
|
|
g_list_free (children);
|
|
|
|
|
|
|
|
if (g_list_next (list))
|
2008-05-17 00:06:42 +08:00
|
|
|
g_string_append (title, " - ");
|
2003-05-03 19:59:44 +08:00
|
|
|
}
|
|
|
|
|
2009-09-13 19:14:18 +08:00
|
|
|
return g_string_free (title, FALSE);
|
2003-05-03 19:59:44 +08:00
|
|
|
}
|
|
|
|
|
2002-05-08 00:23:14 +08:00
|
|
|
static void
|
2005-05-12 04:26:12 +08:00
|
|
|
gimp_menu_dock_factory_display_changed (GimpContext *context,
|
|
|
|
GimpObject *display,
|
|
|
|
GimpDock *dock)
|
2002-05-08 00:23:14 +08:00
|
|
|
{
|
2005-05-12 04:26:12 +08:00
|
|
|
GimpMenuDock *menu_dock = GIMP_MENU_DOCK (dock);
|
2002-05-08 00:23:14 +08:00
|
|
|
|
2005-05-12 04:26:12 +08:00
|
|
|
if (display && menu_dock->auto_follow_active)
|
2009-01-04 18:28:31 +08:00
|
|
|
gimp_context_set_display (gimp_dock_get_context (dock), display);
|
2002-05-08 00:23:14 +08:00
|
|
|
}
|
|
|
|
|
2001-04-24 00:58:18 +08:00
|
|
|
static void
|
2005-05-12 04:26:12 +08:00
|
|
|
gimp_menu_dock_factory_image_changed (GimpContext *context,
|
2006-03-29 01:08:36 +08:00
|
|
|
GimpImage *image,
|
2005-05-12 04:26:12 +08:00
|
|
|
GimpDock *dock)
|
2001-04-24 00:58:18 +08:00
|
|
|
{
|
2005-05-12 04:26:12 +08:00
|
|
|
GimpMenuDock *menu_dock = GIMP_MENU_DOCK (dock);
|
2001-04-24 00:58:18 +08:00
|
|
|
|
2003-05-03 19:59:44 +08:00
|
|
|
/* won't do anything if we already set the display above */
|
2006-03-29 01:08:36 +08:00
|
|
|
if (image && menu_dock->auto_follow_active)
|
2009-01-04 18:28:31 +08:00
|
|
|
gimp_context_set_image (gimp_dock_get_context (dock), image);
|
2001-04-24 00:58:18 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2005-05-12 04:26:12 +08:00
|
|
|
gimp_menu_dock_image_changed (GimpContext *context,
|
2006-03-29 01:08:36 +08:00
|
|
|
GimpImage *image,
|
2005-05-12 04:26:12 +08:00
|
|
|
GimpDock *dock)
|
2001-04-24 00:58:18 +08:00
|
|
|
{
|
2005-05-12 04:26:12 +08:00
|
|
|
GimpMenuDock *menu_dock = GIMP_MENU_DOCK (dock);
|
|
|
|
GimpContainer *image_container = menu_dock->image_container;
|
|
|
|
GimpContainer *display_container = menu_dock->display_container;
|
2001-04-24 00:58:18 +08:00
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
if (image == NULL && ! gimp_container_is_empty (image_container))
|
2001-04-24 00:58:18 +08:00
|
|
|
{
|
2008-04-09 17:50:29 +08:00
|
|
|
image = GIMP_IMAGE (gimp_container_get_first_child (image_container));
|
2001-04-24 00:58:18 +08:00
|
|
|
|
2008-04-09 17:50:29 +08:00
|
|
|
/* this invokes this function recursively but we don't enter
|
|
|
|
* the if() branch the second time
|
|
|
|
*/
|
|
|
|
gimp_context_set_image (context, image);
|
|
|
|
|
|
|
|
/* stop the emission of the original signal (the emission of
|
|
|
|
* the recursive signal is finished)
|
|
|
|
*/
|
|
|
|
g_signal_stop_emission_by_name (context, "image-changed");
|
2001-04-24 00:58:18 +08:00
|
|
|
}
|
2006-03-29 01:08:36 +08:00
|
|
|
else if (image != NULL && ! gimp_container_is_empty (display_container))
|
2002-05-10 21:09:19 +08:00
|
|
|
{
|
2006-03-29 01:55:52 +08:00
|
|
|
GimpObject *display;
|
|
|
|
GimpImage *display_image;
|
2002-05-10 21:09:19 +08:00
|
|
|
gboolean find_display = TRUE;
|
|
|
|
|
2006-03-29 01:55:52 +08:00
|
|
|
display = gimp_context_get_display (context);
|
2002-05-10 21:09:19 +08:00
|
|
|
|
2006-03-29 01:55:52 +08:00
|
|
|
if (display)
|
2002-05-10 21:09:19 +08:00
|
|
|
{
|
2006-03-29 01:55:52 +08:00
|
|
|
g_object_get (display, "image", &display_image, NULL);
|
2002-05-10 21:09:19 +08:00
|
|
|
|
2006-03-29 01:55:52 +08:00
|
|
|
if (display_image)
|
2003-05-18 00:34:30 +08:00
|
|
|
{
|
2006-03-29 01:55:52 +08:00
|
|
|
g_object_unref (display_image);
|
2003-05-18 00:34:30 +08:00
|
|
|
|
2006-03-29 01:55:52 +08:00
|
|
|
if (display_image == image)
|
2003-05-18 00:34:30 +08:00
|
|
|
find_display = FALSE;
|
|
|
|
}
|
2002-05-10 21:09:19 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
if (find_display)
|
|
|
|
{
|
|
|
|
GList *list;
|
|
|
|
|
2005-04-13 07:31:47 +08:00
|
|
|
for (list = GIMP_LIST (display_container)->list;
|
2002-05-10 21:09:19 +08:00
|
|
|
list;
|
|
|
|
list = g_list_next (list))
|
|
|
|
{
|
2006-03-29 01:55:52 +08:00
|
|
|
display = GIMP_OBJECT (list->data);
|
2002-05-10 21:09:19 +08:00
|
|
|
|
2006-03-29 01:55:52 +08:00
|
|
|
g_object_get (display, "image", &display_image, NULL);
|
2002-05-10 21:09:19 +08:00
|
|
|
|
2006-03-29 01:55:52 +08:00
|
|
|
if (display_image)
|
2002-05-10 21:09:19 +08:00
|
|
|
{
|
2006-03-29 01:55:52 +08:00
|
|
|
g_object_unref (display_image);
|
2003-05-18 00:34:30 +08:00
|
|
|
|
2006-03-29 01:55:52 +08:00
|
|
|
if (display_image == image)
|
2003-05-18 00:34:30 +08:00
|
|
|
{
|
|
|
|
/* this invokes this function recursively but we
|
|
|
|
* don't enter the if(find_display) branch the
|
|
|
|
* second time
|
|
|
|
*/
|
2006-03-29 01:55:52 +08:00
|
|
|
gimp_context_set_display (context, display);
|
2003-05-18 00:34:30 +08:00
|
|
|
|
|
|
|
/* don't stop signal emission here because the
|
|
|
|
* context's image was not changed by the
|
|
|
|
* recursive call
|
|
|
|
*/
|
|
|
|
break;
|
|
|
|
}
|
2002-05-10 21:09:19 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2001-04-24 00:58:18 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2005-05-12 04:26:12 +08:00
|
|
|
gimp_menu_dock_auto_clicked (GtkWidget *widget,
|
|
|
|
GimpDock *dock)
|
2001-04-24 00:58:18 +08:00
|
|
|
{
|
2005-05-12 04:26:12 +08:00
|
|
|
GimpMenuDock *menu_dock = GIMP_MENU_DOCK (dock);
|
2001-04-24 00:58:18 +08:00
|
|
|
|
2005-05-12 04:26:12 +08:00
|
|
|
gimp_toggle_button_update (widget, &menu_dock->auto_follow_active);
|
2001-04-24 00:58:18 +08:00
|
|
|
|
2005-05-12 04:26:12 +08:00
|
|
|
if (menu_dock->auto_follow_active)
|
2001-04-24 00:58:18 +08:00
|
|
|
{
|
2009-01-04 18:28:31 +08:00
|
|
|
gimp_context_copy_properties (gimp_dock_get_dialog_factory (dock)->context,
|
|
|
|
gimp_dock_get_context (dock),
|
2008-03-30 06:29:55 +08:00
|
|
|
GIMP_CONTEXT_DISPLAY_MASK |
|
|
|
|
GIMP_CONTEXT_IMAGE_MASK);
|
2001-04-24 00:58:18 +08:00
|
|
|
}
|
|
|
|
}
|