2006-12-10 05:33:38 +08:00
|
|
|
/* GIMP - The GNU Image Manipulation Program
|
2001-04-07 22:44:12 +08:00
|
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
*
|
|
|
|
* gimpdock.c
|
2005-05-12 04:26:12 +08:00
|
|
|
* Copyright (C) 2001-2005 Michael Natterer <mitch@gimp.org>
|
2001-04-07 22:44:12 +08:00
|
|
|
*
|
2009-01-18 06:28:01 +08:00
|
|
|
* This program is free software: you can redistribute it and/or modify
|
2001-04-07 22:44:12 +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-07 22:44:12 +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-07 22:44:12 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
2001-04-11 00:03:40 +08:00
|
|
|
#include "libgimpwidgets/gimpwidgets.h"
|
|
|
|
|
2001-05-08 11:48:54 +08:00
|
|
|
#include "widgets-types.h"
|
2001-04-07 22:44:12 +08:00
|
|
|
|
2003-11-21 04:36:55 +08:00
|
|
|
#include "core/gimp.h"
|
2002-03-15 01:07:02 +08:00
|
|
|
#include "core/gimpcontext.h"
|
2002-10-25 21:21:54 +08:00
|
|
|
#include "core/gimpmarshal.h"
|
2002-03-15 01:07:02 +08:00
|
|
|
|
2001-04-15 00:37:28 +08:00
|
|
|
#include "gimpdialogfactory.h"
|
2001-04-07 22:44:12 +08:00
|
|
|
#include "gimpdock.h"
|
|
|
|
#include "gimpdockable.h"
|
2001-04-11 00:03:40 +08:00
|
|
|
#include "gimpdockbook.h"
|
2005-09-13 01:48:40 +08:00
|
|
|
#include "gimpdockseparator.h"
|
2009-09-21 01:24:04 +08:00
|
|
|
#include "gimpuimanager.h"
|
2001-04-11 00:03:40 +08:00
|
|
|
|
2003-03-26 00:38:19 +08:00
|
|
|
#include "gimp-intl.h"
|
2003-03-15 02:37:12 +08:00
|
|
|
|
2001-04-07 22:44:12 +08:00
|
|
|
|
2003-11-21 04:36:55 +08:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
PROP_0,
|
|
|
|
PROP_CONTEXT,
|
2009-09-21 01:24:04 +08:00
|
|
|
PROP_DIALOG_FACTORY,
|
|
|
|
PROP_UI_MANAGER
|
2003-11-21 04:36:55 +08:00
|
|
|
};
|
|
|
|
|
2002-10-25 21:21:54 +08:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
BOOK_ADDED,
|
|
|
|
BOOK_REMOVED,
|
2009-09-13 19:14:18 +08:00
|
|
|
TITLE_INVALIDATED,
|
2009-09-13 20:14:08 +08:00
|
|
|
GEOMETRY_INVALIDATED,
|
2002-10-25 21:21:54 +08:00
|
|
|
LAST_SIGNAL
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2009-09-06 06:15:25 +08:00
|
|
|
struct _GimpDockPrivate
|
2009-01-04 18:28:31 +08:00
|
|
|
{
|
|
|
|
GimpDialogFactory *dialog_factory;
|
|
|
|
GimpContext *context;
|
2009-09-21 01:24:04 +08:00
|
|
|
GimpUIManager *ui_manager;
|
2009-01-04 18:28:31 +08:00
|
|
|
|
|
|
|
GtkWidget *main_vbox;
|
|
|
|
GtkWidget *vbox;
|
|
|
|
|
|
|
|
GList *dockbooks;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2005-09-14 05:07:28 +08:00
|
|
|
static void gimp_dock_set_property (GObject *object,
|
|
|
|
guint property_id,
|
|
|
|
const GValue *value,
|
|
|
|
GParamSpec *pspec);
|
|
|
|
static void gimp_dock_get_property (GObject *object,
|
|
|
|
guint property_id,
|
|
|
|
GValue *value,
|
|
|
|
GParamSpec *pspec);
|
2003-11-21 04:36:55 +08:00
|
|
|
|
2005-09-14 05:07:28 +08:00
|
|
|
static void gimp_dock_destroy (GtkObject *object);
|
2001-04-11 04:38:42 +08:00
|
|
|
|
2005-09-14 05:07:28 +08:00
|
|
|
static void gimp_dock_real_book_added (GimpDock *dock,
|
|
|
|
GimpDockbook *dockbook);
|
|
|
|
static void gimp_dock_real_book_removed (GimpDock *dock,
|
|
|
|
GimpDockbook *dockbook);
|
2003-11-21 04:36:55 +08:00
|
|
|
|
2002-10-25 21:21:54 +08:00
|
|
|
|
2009-09-10 00:15:34 +08:00
|
|
|
G_DEFINE_TYPE (GimpDock, gimp_dock, GIMP_TYPE_DOCK_WINDOW)
|
2001-04-11 00:03:40 +08:00
|
|
|
|
2005-12-20 06:37:49 +08:00
|
|
|
#define parent_class gimp_dock_parent_class
|
|
|
|
|
|
|
|
static guint dock_signals[LAST_SIGNAL] = { 0 };
|
2001-04-07 22:44:12 +08:00
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_dock_class_init (GimpDockClass *klass)
|
|
|
|
{
|
2005-02-01 00:09:52 +08:00
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
|
|
|
GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (klass);
|
2001-04-07 22:44:12 +08:00
|
|
|
|
2002-10-25 21:21:54 +08:00
|
|
|
dock_signals[BOOK_ADDED] =
|
2005-05-27 21:05:26 +08:00
|
|
|
g_signal_new ("book-added",
|
2006-04-12 20:49:29 +08:00
|
|
|
G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_FIRST,
|
|
|
|
G_STRUCT_OFFSET (GimpDockClass, book_added),
|
|
|
|
NULL, NULL,
|
|
|
|
gimp_marshal_VOID__OBJECT,
|
|
|
|
G_TYPE_NONE, 1,
|
|
|
|
GIMP_TYPE_DOCKBOOK);
|
2002-10-25 21:21:54 +08:00
|
|
|
|
|
|
|
dock_signals[BOOK_REMOVED] =
|
2005-05-27 21:05:26 +08:00
|
|
|
g_signal_new ("book-removed",
|
2006-04-12 20:49:29 +08:00
|
|
|
G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_FIRST,
|
|
|
|
G_STRUCT_OFFSET (GimpDockClass, book_removed),
|
|
|
|
NULL, NULL,
|
|
|
|
gimp_marshal_VOID__OBJECT,
|
|
|
|
G_TYPE_NONE, 1,
|
|
|
|
GIMP_TYPE_DOCKBOOK);
|
2002-10-25 21:21:54 +08:00
|
|
|
|
2009-09-13 19:14:18 +08:00
|
|
|
dock_signals[TITLE_INVALIDATED] =
|
|
|
|
g_signal_new ("title-invalidated",
|
|
|
|
G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_FIRST,
|
|
|
|
G_STRUCT_OFFSET (GimpDockClass, title_invalidated),
|
|
|
|
NULL, NULL,
|
|
|
|
gimp_marshal_VOID__VOID,
|
|
|
|
G_TYPE_NONE, 0);
|
|
|
|
|
2009-09-13 20:14:08 +08:00
|
|
|
dock_signals[GEOMETRY_INVALIDATED] =
|
|
|
|
g_signal_new ("geometry-invalidated",
|
|
|
|
G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_FIRST,
|
|
|
|
G_STRUCT_OFFSET (GimpDockClass, geometry_invalidated),
|
|
|
|
NULL, NULL,
|
|
|
|
gimp_marshal_VOID__VOID,
|
|
|
|
G_TYPE_NONE, 0);
|
|
|
|
|
|
|
|
object_class->set_property = gimp_dock_set_property;
|
|
|
|
object_class->get_property = gimp_dock_get_property;
|
2001-11-26 21:17:18 +08:00
|
|
|
|
2009-09-13 20:14:08 +08:00
|
|
|
gtk_object_class->destroy = gimp_dock_destroy;
|
2001-11-26 21:17:18 +08:00
|
|
|
|
2009-09-13 20:14:08 +08:00
|
|
|
klass->setup = NULL;
|
|
|
|
klass->set_host_geometry_hints = NULL;
|
|
|
|
klass->book_added = gimp_dock_real_book_added;
|
|
|
|
klass->book_removed = gimp_dock_real_book_removed;
|
|
|
|
klass->title_invalidated = NULL;
|
|
|
|
klass->geometry_invalidated = NULL;
|
2003-11-21 04:36:55 +08:00
|
|
|
|
|
|
|
g_object_class_install_property (object_class, PROP_CONTEXT,
|
|
|
|
g_param_spec_object ("context", NULL, NULL,
|
|
|
|
GIMP_TYPE_CONTEXT,
|
2006-01-19 04:29:40 +08:00
|
|
|
GIMP_PARAM_READWRITE |
|
2003-11-21 04:36:55 +08:00
|
|
|
G_PARAM_CONSTRUCT_ONLY));
|
2005-09-14 05:07:28 +08:00
|
|
|
|
2003-11-21 04:36:55 +08:00
|
|
|
g_object_class_install_property (object_class, PROP_DIALOG_FACTORY,
|
2005-09-14 05:07:28 +08:00
|
|
|
g_param_spec_object ("dialog-factory",
|
|
|
|
NULL, NULL,
|
2003-11-21 04:36:55 +08:00
|
|
|
GIMP_TYPE_DIALOG_FACTORY,
|
2006-01-19 04:29:40 +08:00
|
|
|
GIMP_PARAM_READWRITE |
|
2003-11-21 04:36:55 +08:00
|
|
|
G_PARAM_CONSTRUCT_ONLY));
|
2002-10-25 21:21:54 +08:00
|
|
|
|
2009-09-21 01:24:04 +08:00
|
|
|
g_object_class_install_property (object_class, PROP_UI_MANAGER,
|
|
|
|
g_param_spec_object ("ui-manager",
|
|
|
|
NULL, NULL,
|
|
|
|
GIMP_TYPE_UI_MANAGER,
|
|
|
|
GIMP_PARAM_READWRITE |
|
|
|
|
G_PARAM_CONSTRUCT_ONLY));
|
|
|
|
|
2009-09-06 06:15:25 +08:00
|
|
|
g_type_class_add_private (klass, sizeof (GimpDockPrivate));
|
2001-04-07 22:44:12 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_dock_init (GimpDock *dock)
|
|
|
|
{
|
2009-09-13 17:23:02 +08:00
|
|
|
GtkWidget *separator;
|
2001-04-11 00:03:40 +08:00
|
|
|
|
2009-09-06 06:15:25 +08:00
|
|
|
dock->p = G_TYPE_INSTANCE_GET_PRIVATE (dock,
|
|
|
|
GIMP_TYPE_DOCK,
|
|
|
|
GimpDockPrivate);
|
|
|
|
dock->p->context = NULL;
|
|
|
|
dock->p->dialog_factory = NULL;
|
|
|
|
dock->p->dockbooks = NULL;
|
2001-04-24 00:58:18 +08:00
|
|
|
|
2009-09-06 06:15:25 +08:00
|
|
|
dock->p->main_vbox = gtk_vbox_new (FALSE, 0);
|
|
|
|
gtk_container_add (GTK_CONTAINER (dock), dock->p->main_vbox);
|
|
|
|
gtk_widget_show (dock->p->main_vbox);
|
2001-04-22 08:38:56 +08:00
|
|
|
|
2009-09-06 06:15:25 +08:00
|
|
|
dock->p->vbox = gtk_vbox_new (FALSE, 0);
|
|
|
|
gtk_container_add (GTK_CONTAINER (dock->p->main_vbox), dock->p->vbox);
|
|
|
|
gtk_widget_show (dock->p->vbox);
|
2001-04-07 22:44:12 +08:00
|
|
|
|
2008-10-11 07:10:21 +08:00
|
|
|
separator = gimp_dock_separator_new (dock, GTK_ANCHOR_NORTH);
|
2009-09-06 06:15:25 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (dock->p->vbox), separator, FALSE, FALSE, 0);
|
2001-04-11 00:03:40 +08:00
|
|
|
gtk_widget_show (separator);
|
2001-04-07 22:44:12 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2003-11-21 04:36:55 +08:00
|
|
|
gimp_dock_set_property (GObject *object,
|
|
|
|
guint property_id,
|
|
|
|
const GValue *value,
|
|
|
|
GParamSpec *pspec)
|
2001-04-07 22:44:12 +08:00
|
|
|
{
|
2003-11-21 04:36:55 +08:00
|
|
|
GimpDock *dock = GIMP_DOCK (object);
|
2001-04-11 00:03:40 +08:00
|
|
|
|
2003-11-21 04:36:55 +08:00
|
|
|
switch (property_id)
|
|
|
|
{
|
|
|
|
case PROP_CONTEXT:
|
2009-09-06 06:15:25 +08:00
|
|
|
dock->p->context = g_value_dup_object (value);
|
2003-11-21 04:36:55 +08:00
|
|
|
break;
|
2008-07-23 15:47:10 +08:00
|
|
|
|
2003-11-21 04:36:55 +08:00
|
|
|
case PROP_DIALOG_FACTORY:
|
2009-09-06 06:15:25 +08:00
|
|
|
dock->p->dialog_factory = g_value_get_object (value);
|
2003-11-21 04:36:55 +08:00
|
|
|
break;
|
2008-07-23 15:47:10 +08:00
|
|
|
|
2009-09-21 01:24:04 +08:00
|
|
|
case PROP_UI_MANAGER:
|
|
|
|
dock->p->ui_manager = g_value_dup_object (value);
|
|
|
|
break;
|
|
|
|
|
2003-11-21 04:36:55 +08:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2001-04-11 00:03:40 +08:00
|
|
|
|
2003-11-21 04:36:55 +08:00
|
|
|
static void
|
|
|
|
gimp_dock_get_property (GObject *object,
|
2005-02-01 00:09:52 +08:00
|
|
|
guint property_id,
|
|
|
|
GValue *value,
|
|
|
|
GParamSpec *pspec)
|
2003-11-21 04:36:55 +08:00
|
|
|
{
|
|
|
|
GimpDock *dock = GIMP_DOCK (object);
|
|
|
|
|
|
|
|
switch (property_id)
|
|
|
|
{
|
|
|
|
case PROP_CONTEXT:
|
2009-09-06 06:15:25 +08:00
|
|
|
g_value_set_object (value, dock->p->context);
|
2003-11-21 04:36:55 +08:00
|
|
|
break;
|
2008-07-23 15:47:10 +08:00
|
|
|
|
2003-11-21 04:36:55 +08:00
|
|
|
case PROP_DIALOG_FACTORY:
|
2009-09-06 06:15:25 +08:00
|
|
|
g_value_set_object (value, dock->p->dialog_factory);
|
2003-11-21 04:36:55 +08:00
|
|
|
break;
|
2008-07-23 15:47:10 +08:00
|
|
|
|
2009-09-21 01:24:04 +08:00
|
|
|
case PROP_UI_MANAGER:
|
|
|
|
g_value_set_object (value, dock->p->ui_manager);
|
|
|
|
break;
|
|
|
|
|
2003-11-21 04:36:55 +08:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2003-11-21 06:32:59 +08:00
|
|
|
gimp_dock_destroy (GtkObject *object)
|
2003-11-21 04:36:55 +08:00
|
|
|
{
|
|
|
|
GimpDock *dock = GIMP_DOCK (object);
|
2001-04-24 00:58:18 +08:00
|
|
|
|
2009-09-06 06:15:25 +08:00
|
|
|
while (dock->p->dockbooks)
|
|
|
|
gimp_dock_remove_book (dock, GIMP_DOCKBOOK (dock->p->dockbooks->data));
|
2003-11-21 06:32:59 +08:00
|
|
|
|
2009-09-21 01:24:04 +08:00
|
|
|
if (dock->p->ui_manager)
|
|
|
|
{
|
|
|
|
g_object_unref (dock->p->ui_manager);
|
|
|
|
dock->p->ui_manager = NULL;
|
|
|
|
}
|
|
|
|
|
2009-09-06 06:15:25 +08:00
|
|
|
if (dock->p->context)
|
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
|
|
|
{
|
2009-09-06 06:15:25 +08:00
|
|
|
g_object_unref (dock->p->context);
|
|
|
|
dock->p->context = NULL;
|
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-11 00:03:40 +08:00
|
|
|
|
2003-05-03 19:59:44 +08:00
|
|
|
GTK_OBJECT_CLASS (parent_class)->destroy (object);
|
2001-04-07 22:44:12 +08:00
|
|
|
}
|
|
|
|
|
2002-10-25 21:21:54 +08:00
|
|
|
static void
|
|
|
|
gimp_dock_real_book_added (GimpDock *dock,
|
|
|
|
GimpDockbook *dockbook)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_dock_real_book_removed (GimpDock *dock,
|
|
|
|
GimpDockbook *dockbook)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2002-03-19 03:34:06 +08:00
|
|
|
|
2005-02-01 00:09:52 +08:00
|
|
|
/* public functions */
|
2001-04-11 04:38:42 +08:00
|
|
|
|
2003-10-08 23:44:35 +08:00
|
|
|
void
|
|
|
|
gimp_dock_setup (GimpDock *dock,
|
|
|
|
const GimpDock *template)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_DOCK (dock));
|
|
|
|
g_return_if_fail (GIMP_IS_DOCK (template));
|
|
|
|
|
|
|
|
if (GIMP_DOCK_GET_CLASS (dock)->setup)
|
|
|
|
GIMP_DOCK_GET_CLASS (dock)->setup (dock, template);
|
|
|
|
}
|
|
|
|
|
2003-10-10 23:59:12 +08:00
|
|
|
void
|
|
|
|
gimp_dock_set_aux_info (GimpDock *dock,
|
|
|
|
GList *aux_info)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_DOCK (dock));
|
|
|
|
|
|
|
|
if (GIMP_DOCK_GET_CLASS (dock)->set_aux_info)
|
|
|
|
GIMP_DOCK_GET_CLASS (dock)->set_aux_info (dock, aux_info);
|
|
|
|
}
|
|
|
|
|
|
|
|
GList *
|
|
|
|
gimp_dock_get_aux_info (GimpDock *dock)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_DOCK (dock), NULL);
|
|
|
|
|
|
|
|
if (GIMP_DOCK_GET_CLASS (dock)->get_aux_info)
|
|
|
|
return GIMP_DOCK_GET_CLASS (dock)->get_aux_info (dock);
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2009-09-13 19:14:18 +08:00
|
|
|
gchar *
|
|
|
|
gimp_dock_get_title (GimpDock *dock)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_DOCK (dock), NULL);
|
2009-09-13 20:14:08 +08:00
|
|
|
|
2009-09-13 19:14:18 +08:00
|
|
|
if (GIMP_DOCK_GET_CLASS (dock)->get_title)
|
|
|
|
return GIMP_DOCK_GET_CLASS (dock)->get_title (dock);
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gimp_dock_invalidate_title (GimpDock *dock)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_DOCK (dock));
|
2009-09-13 20:14:08 +08:00
|
|
|
|
2009-09-13 19:14:18 +08:00
|
|
|
g_signal_emit (dock, dock_signals[TITLE_INVALIDATED], 0);
|
|
|
|
}
|
|
|
|
|
2009-09-13 20:14:08 +08:00
|
|
|
/**
|
|
|
|
* gimp_dock_set_host_geometry_hints:
|
|
|
|
* @dock: The dock
|
|
|
|
* @window: The #GtkWindow to adapt to hosting the dock
|
|
|
|
*
|
|
|
|
* Some docks have some specific needs on the #GtkWindow they are
|
|
|
|
* in. This function allows such docks to perform any such setup on
|
|
|
|
* the #GtkWindow they are in/will be put in.
|
|
|
|
**/
|
|
|
|
void
|
|
|
|
gimp_dock_set_host_geometry_hints (GimpDock *dock,
|
|
|
|
GtkWindow *window)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_DOCK (dock));
|
|
|
|
g_return_if_fail (GTK_IS_WINDOW (window));
|
|
|
|
|
|
|
|
if (GIMP_DOCK_GET_CLASS (dock)->set_host_geometry_hints)
|
|
|
|
GIMP_DOCK_GET_CLASS (dock)->set_host_geometry_hints (dock, window);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_dock_invalidate_geometry:
|
|
|
|
* @dock:
|
|
|
|
*
|
|
|
|
* Call when the dock needs to setup its host #GtkWindow with
|
|
|
|
* GtkDock::set_host_geometry_hints().
|
|
|
|
**/
|
|
|
|
void
|
|
|
|
gimp_dock_invalidate_geometry (GimpDock *dock)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_DOCK (dock));
|
|
|
|
|
|
|
|
g_signal_emit (dock, dock_signals[GEOMETRY_INVALIDATED], 0);
|
|
|
|
}
|
|
|
|
|
2009-01-04 18:28:31 +08:00
|
|
|
GimpContext *
|
|
|
|
gimp_dock_get_context (GimpDock *dock)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_DOCK (dock), NULL);
|
|
|
|
|
2009-09-06 06:15:25 +08:00
|
|
|
return dock->p->context;
|
2009-01-04 18:28:31 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
GimpDialogFactory *
|
|
|
|
gimp_dock_get_dialog_factory (GimpDock *dock)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_DOCK (dock), NULL);
|
|
|
|
|
2009-09-06 06:15:25 +08:00
|
|
|
return dock->p->dialog_factory;
|
2009-01-04 18:28:31 +08:00
|
|
|
}
|
|
|
|
|
2009-09-21 01:24:04 +08:00
|
|
|
GimpUIManager *
|
|
|
|
gimp_dock_get_ui_manager (GimpDock *dock)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_DOCK (dock), NULL);
|
|
|
|
|
|
|
|
return dock->p->ui_manager;
|
|
|
|
}
|
|
|
|
|
2009-01-04 18:28:31 +08:00
|
|
|
GList *
|
|
|
|
gimp_dock_get_dockbooks (GimpDock *dock)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_DOCK (dock), NULL);
|
|
|
|
|
2009-09-06 06:15:25 +08:00
|
|
|
return dock->p->dockbooks;
|
2009-01-04 18:28:31 +08:00
|
|
|
}
|
|
|
|
|
2009-09-13 17:51:39 +08:00
|
|
|
gint
|
|
|
|
gimp_dock_get_n_dockables (GimpDock *dock)
|
|
|
|
{
|
|
|
|
GList *list = NULL;
|
|
|
|
gint n = 0;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GIMP_IS_DOCK (dock), 0);
|
|
|
|
|
|
|
|
for (list = dock->p->dockbooks; list; list = list->next)
|
|
|
|
n += gtk_notebook_get_n_pages (GTK_NOTEBOOK (list->data));
|
|
|
|
|
|
|
|
return n;
|
|
|
|
}
|
|
|
|
|
2009-01-04 18:28:31 +08:00
|
|
|
GtkWidget *
|
|
|
|
gimp_dock_get_main_vbox (GimpDock *dock)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_DOCK (dock), NULL);
|
|
|
|
|
2009-09-06 06:15:25 +08:00
|
|
|
return dock->p->main_vbox;
|
2009-01-04 18:28:31 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
GtkWidget *
|
|
|
|
gimp_dock_get_vbox (GimpDock *dock)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_DOCK (dock), NULL);
|
|
|
|
|
2009-09-06 06:15:25 +08:00
|
|
|
return dock->p->vbox;
|
2009-01-04 18:28:31 +08:00
|
|
|
}
|
|
|
|
|
2001-04-07 22:44:12 +08:00
|
|
|
void
|
|
|
|
gimp_dock_add (GimpDock *dock,
|
2006-04-12 20:49:29 +08:00
|
|
|
GimpDockable *dockable,
|
|
|
|
gint section,
|
|
|
|
gint position)
|
2001-04-07 22:44:12 +08:00
|
|
|
{
|
2001-04-11 00:03:40 +08:00
|
|
|
GimpDockbook *dockbook;
|
|
|
|
|
2001-04-07 22:44:12 +08:00
|
|
|
g_return_if_fail (GIMP_IS_DOCK (dock));
|
|
|
|
g_return_if_fail (GIMP_IS_DOCKABLE (dockable));
|
2001-04-11 00:03:40 +08:00
|
|
|
g_return_if_fail (dockable->dockbook == NULL);
|
|
|
|
|
2009-09-06 06:15:25 +08:00
|
|
|
dockbook = GIMP_DOCKBOOK (dock->p->dockbooks->data);
|
2001-04-11 00:03:40 +08:00
|
|
|
|
|
|
|
gimp_dockbook_add (dockbook, dockable, position);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gimp_dock_remove (GimpDock *dock,
|
2006-04-12 20:49:29 +08:00
|
|
|
GimpDockable *dockable)
|
2001-04-11 00:03:40 +08:00
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_DOCK (dock));
|
|
|
|
g_return_if_fail (GIMP_IS_DOCKABLE (dockable));
|
|
|
|
g_return_if_fail (dockable->dockbook != NULL);
|
2009-09-13 22:30:09 +08:00
|
|
|
g_return_if_fail (gimp_dockbook_get_dock (dockable->dockbook) == dock);
|
2001-04-11 00:03:40 +08:00
|
|
|
|
|
|
|
gimp_dockbook_remove (dockable->dockbook, dockable);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gimp_dock_add_book (GimpDock *dock,
|
2006-04-12 20:49:29 +08:00
|
|
|
GimpDockbook *dockbook,
|
|
|
|
gint index)
|
2001-04-11 00:03:40 +08:00
|
|
|
{
|
2002-03-22 08:07:53 +08:00
|
|
|
gint old_length;
|
2001-04-11 00:03:40 +08:00
|
|
|
|
|
|
|
g_return_if_fail (GIMP_IS_DOCK (dock));
|
|
|
|
g_return_if_fail (GIMP_IS_DOCKBOOK (dockbook));
|
2009-09-13 22:30:09 +08:00
|
|
|
g_return_if_fail (gimp_dockbook_get_dock (dockbook) == NULL);
|
2001-04-11 00:03:40 +08:00
|
|
|
|
2009-09-06 06:15:25 +08:00
|
|
|
old_length = g_list_length (dock->p->dockbooks);
|
2001-04-11 00:03:40 +08:00
|
|
|
|
2002-03-22 08:07:53 +08:00
|
|
|
if (index >= old_length || index < 0)
|
|
|
|
index = old_length;
|
2001-04-11 00:03:40 +08:00
|
|
|
|
2009-09-13 22:30:09 +08:00
|
|
|
gimp_dockbook_set_dock (dockbook, dock);
|
2009-09-06 06:15:25 +08:00
|
|
|
dock->p->dockbooks = g_list_insert (dock->p->dockbooks, dockbook, index);
|
2001-04-11 00:03:40 +08:00
|
|
|
|
2002-03-22 08:07:53 +08:00
|
|
|
if (old_length == 0)
|
2002-03-22 06:23:39 +08:00
|
|
|
{
|
2002-03-22 08:07:53 +08:00
|
|
|
GtkWidget *separator;
|
2001-04-11 00:03:40 +08:00
|
|
|
|
2009-09-06 06:15:25 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (dock->p->vbox), GTK_WIDGET (dockbook),
|
2002-03-22 06:23:39 +08:00
|
|
|
TRUE, TRUE, 0);
|
2001-04-11 00:03:40 +08:00
|
|
|
|
2008-10-11 07:10:21 +08:00
|
|
|
separator = gimp_dock_separator_new (dock, GTK_ANCHOR_SOUTH);
|
2009-09-06 06:15:25 +08:00
|
|
|
gtk_box_pack_end (GTK_BOX (dock->p->vbox), separator, FALSE, FALSE, 0);
|
2002-03-22 06:23:39 +08:00
|
|
|
gtk_widget_show (separator);
|
|
|
|
}
|
2002-03-22 08:07:53 +08:00
|
|
|
else
|
2002-03-22 06:23:39 +08:00
|
|
|
{
|
|
|
|
GtkWidget *old_book;
|
|
|
|
GtkWidget *parent;
|
|
|
|
GtkWidget *paned;
|
|
|
|
|
|
|
|
if (index == 0)
|
2009-09-06 06:15:25 +08:00
|
|
|
old_book = g_list_nth_data (dock->p->dockbooks, index + 1);
|
2002-03-22 06:23:39 +08:00
|
|
|
else
|
2009-09-06 06:15:25 +08:00
|
|
|
old_book = g_list_nth_data (dock->p->dockbooks, index - 1);
|
2002-03-22 06:23:39 +08:00
|
|
|
|
2008-06-28 23:50:27 +08:00
|
|
|
parent = gtk_widget_get_parent (old_book);
|
2002-03-22 06:23:39 +08:00
|
|
|
|
2002-03-22 08:07:53 +08:00
|
|
|
if ((old_length > 1) && (index > 0))
|
|
|
|
{
|
|
|
|
GtkWidget *grandparent;
|
|
|
|
|
2008-06-28 23:50:27 +08:00
|
|
|
grandparent = gtk_widget_get_parent (parent);
|
2002-03-22 08:07:53 +08:00
|
|
|
|
|
|
|
old_book = parent;
|
|
|
|
parent = grandparent;
|
|
|
|
}
|
|
|
|
|
2003-01-06 06:07:10 +08:00
|
|
|
g_object_ref (old_book);
|
2002-03-22 06:23:39 +08:00
|
|
|
|
|
|
|
gtk_container_remove (GTK_CONTAINER (parent), old_book);
|
|
|
|
|
|
|
|
paned = gtk_vpaned_new ();
|
2002-03-22 08:07:53 +08:00
|
|
|
|
|
|
|
if (GTK_IS_VPANED (parent))
|
|
|
|
gtk_paned_pack1 (GTK_PANED (parent), paned, TRUE, FALSE);
|
|
|
|
else
|
|
|
|
gtk_box_pack_start (GTK_BOX (parent), paned, TRUE, TRUE, 0);
|
|
|
|
|
2002-03-22 06:23:39 +08:00
|
|
|
gtk_widget_show (paned);
|
|
|
|
|
|
|
|
if (index == 0)
|
|
|
|
{
|
|
|
|
gtk_paned_pack1 (GTK_PANED (paned), GTK_WIDGET (dockbook),
|
|
|
|
TRUE, FALSE);
|
|
|
|
gtk_paned_pack2 (GTK_PANED (paned), old_book,
|
|
|
|
TRUE, FALSE);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gtk_paned_pack1 (GTK_PANED (paned), old_book,
|
|
|
|
TRUE, FALSE);
|
|
|
|
gtk_paned_pack2 (GTK_PANED (paned), GTK_WIDGET (dockbook),
|
|
|
|
TRUE, FALSE);
|
|
|
|
}
|
|
|
|
|
2003-01-06 06:07:10 +08:00
|
|
|
g_object_unref (old_book);
|
2002-03-22 06:23:39 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
gtk_widget_show (GTK_WIDGET (dockbook));
|
2002-10-25 21:21:54 +08:00
|
|
|
|
2003-01-06 06:07:10 +08:00
|
|
|
g_signal_emit (dock, dock_signals[BOOK_ADDED], 0, dockbook);
|
2001-04-11 00:03:40 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gimp_dock_remove_book (GimpDock *dock,
|
2006-04-12 20:49:29 +08:00
|
|
|
GimpDockbook *dockbook)
|
2001-04-11 00:03:40 +08:00
|
|
|
{
|
2002-03-22 06:49:29 +08:00
|
|
|
gint old_length;
|
2002-03-22 06:23:39 +08:00
|
|
|
gint index;
|
2001-04-11 00:03:40 +08:00
|
|
|
|
|
|
|
g_return_if_fail (GIMP_IS_DOCK (dock));
|
|
|
|
g_return_if_fail (GIMP_IS_DOCKBOOK (dockbook));
|
|
|
|
|
2009-09-13 22:30:09 +08:00
|
|
|
g_return_if_fail (gimp_dockbook_get_dock (dockbook) == dock);
|
2001-04-11 00:03:40 +08:00
|
|
|
|
2009-09-06 06:15:25 +08:00
|
|
|
old_length = g_list_length (dock->p->dockbooks);
|
|
|
|
index = g_list_index (dock->p->dockbooks, dockbook);
|
2001-04-11 00:03:40 +08:00
|
|
|
|
2009-09-13 22:30:09 +08:00
|
|
|
gimp_dockbook_set_dock (dockbook, NULL);
|
2009-09-06 06:15:25 +08:00
|
|
|
dock->p->dockbooks = g_list_remove (dock->p->dockbooks, dockbook);
|
2001-04-11 00:03:40 +08:00
|
|
|
|
2002-10-25 21:21:54 +08:00
|
|
|
g_object_ref (dockbook);
|
|
|
|
|
2002-03-22 06:49:29 +08:00
|
|
|
if (old_length == 1)
|
2002-03-22 06:23:39 +08:00
|
|
|
{
|
|
|
|
GtkWidget *separator;
|
|
|
|
GList *children;
|
|
|
|
|
2009-09-06 06:15:25 +08:00
|
|
|
children = gtk_container_get_children (GTK_CONTAINER (dock->p->vbox));
|
2002-03-22 06:23:39 +08:00
|
|
|
|
|
|
|
separator = g_list_nth_data (children, 2);
|
|
|
|
|
2009-09-06 06:15:25 +08:00
|
|
|
gtk_container_remove (GTK_CONTAINER (dock->p->vbox), separator);
|
|
|
|
gtk_container_remove (GTK_CONTAINER (dock->p->vbox), GTK_WIDGET (dockbook));
|
2001-04-11 00:03:40 +08:00
|
|
|
|
2002-03-22 06:23:39 +08:00
|
|
|
g_list_free (children);
|
|
|
|
}
|
2002-03-15 01:07:02 +08:00
|
|
|
else
|
2001-04-11 00:03:40 +08:00
|
|
|
{
|
2002-03-22 06:23:39 +08:00
|
|
|
GtkWidget *other_book;
|
|
|
|
GtkWidget *parent;
|
|
|
|
GtkWidget *grandparent;
|
2001-04-11 00:03:40 +08:00
|
|
|
|
2008-06-28 23:50:27 +08:00
|
|
|
parent = gtk_widget_get_parent (GTK_WIDGET (dockbook));
|
|
|
|
grandparent = gtk_widget_get_parent (parent);
|
2002-03-22 06:23:39 +08:00
|
|
|
|
2002-03-22 06:49:29 +08:00
|
|
|
if (index == 0)
|
2008-03-13 00:58:28 +08:00
|
|
|
other_book = gtk_paned_get_child2 (GTK_PANED (parent));
|
2002-03-22 06:23:39 +08:00
|
|
|
else
|
2008-03-13 00:58:28 +08:00
|
|
|
other_book = gtk_paned_get_child1 (GTK_PANED (parent));
|
2002-03-22 06:23:39 +08:00
|
|
|
|
2003-01-06 06:07:10 +08:00
|
|
|
g_object_ref (other_book);
|
2002-03-22 06:23:39 +08:00
|
|
|
|
2002-03-22 06:49:29 +08:00
|
|
|
gtk_container_remove (GTK_CONTAINER (parent), other_book);
|
|
|
|
gtk_container_remove (GTK_CONTAINER (parent), GTK_WIDGET (dockbook));
|
2001-09-03 21:03:34 +08:00
|
|
|
|
2002-03-22 06:49:29 +08:00
|
|
|
gtk_container_remove (GTK_CONTAINER (grandparent), parent);
|
2002-03-22 06:23:39 +08:00
|
|
|
|
2002-03-22 06:49:29 +08:00
|
|
|
if (GTK_IS_VPANED (grandparent))
|
|
|
|
gtk_paned_pack1 (GTK_PANED (grandparent), other_book, TRUE, FALSE);
|
|
|
|
else
|
2009-09-06 06:15:25 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (dock->p->vbox), other_book, TRUE, TRUE, 0);
|
2002-03-22 06:23:39 +08:00
|
|
|
|
2003-01-06 06:07:10 +08:00
|
|
|
g_object_unref (other_book);
|
2002-03-22 06:23:39 +08:00
|
|
|
}
|
2001-04-11 00:03:40 +08:00
|
|
|
|
2003-01-06 06:07:10 +08:00
|
|
|
g_signal_emit (dock, dock_signals[BOOK_REMOVED], 0, dockbook);
|
2002-10-25 21:21:54 +08:00
|
|
|
|
|
|
|
g_object_unref (dockbook);
|
2001-04-11 00:03:40 +08:00
|
|
|
}
|