2001-04-07 22:44:12 +08:00
|
|
|
/* The GIMP -- an image manipulation program
|
|
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
*
|
|
|
|
* gimpdock.c
|
2001-10-18 00:11:28 +08:00
|
|
|
* Copyright (C) 2001 Michael Natterer <mitch@gimp.org>
|
2001-04-07 22:44:12 +08:00
|
|
|
*
|
|
|
|
* 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 <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
|
|
|
|
2002-03-15 01:07:02 +08:00
|
|
|
#include "core/gimpcontext.h"
|
|
|
|
|
2001-04-15 00:37:28 +08:00
|
|
|
#include "gimpdialogfactory.h"
|
2001-05-08 11:48:54 +08:00
|
|
|
#include "gimpdnd.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"
|
|
|
|
|
2001-04-07 22:44:12 +08:00
|
|
|
|
2002-03-19 03:34:06 +08:00
|
|
|
#define DEFAULT_SEPARATOR_HEIGHT 6
|
|
|
|
|
|
|
|
|
2001-04-11 04:38:42 +08:00
|
|
|
static void gimp_dock_class_init (GimpDockClass *klass);
|
|
|
|
static void gimp_dock_init (GimpDock *dock);
|
2001-04-07 22:44:12 +08:00
|
|
|
|
2001-04-11 04:38:42 +08:00
|
|
|
static GtkWidget * gimp_dock_separator_new (GimpDock *dock);
|
|
|
|
|
|
|
|
static void gimp_dock_destroy (GtkObject *object);
|
2001-11-26 21:17:18 +08:00
|
|
|
static void gimp_dock_style_set (GtkWidget *widget,
|
|
|
|
GtkStyle *prev_style);
|
2001-04-11 04:38:42 +08:00
|
|
|
|
|
|
|
static gboolean gimp_dock_separator_button_press (GtkWidget *widget,
|
|
|
|
GdkEventButton *bevent,
|
|
|
|
gpointer data);
|
|
|
|
static gboolean gimp_dock_separator_button_release (GtkWidget *widget,
|
|
|
|
GdkEventButton *bevent,
|
|
|
|
gpointer data);
|
2001-04-07 22:44:12 +08:00
|
|
|
|
2001-04-11 00:03:40 +08:00
|
|
|
/*
|
2001-04-11 04:38:42 +08:00
|
|
|
static void gimp_dock_separator_drag_begin (GtkWidget *widget,
|
|
|
|
GdkDragContext *context,
|
|
|
|
gpointer data);
|
|
|
|
static void gimp_dock_separator_drag_end (GtkWidget *widget,
|
|
|
|
GdkDragContext *context,
|
|
|
|
gpointer data);
|
2001-04-11 00:03:40 +08:00
|
|
|
*/
|
|
|
|
|
2001-04-11 04:38:42 +08:00
|
|
|
static gboolean gimp_dock_separator_drag_drop (GtkWidget *widget,
|
|
|
|
GdkDragContext *context,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
guint time,
|
|
|
|
gpointer data);
|
2001-04-07 22:44:12 +08:00
|
|
|
|
|
|
|
|
|
|
|
static GtkWindowClass *parent_class = NULL;
|
|
|
|
|
2001-04-11 00:03:40 +08:00
|
|
|
static GtkTargetEntry dialog_target_table[] =
|
|
|
|
{
|
|
|
|
GIMP_TARGET_DIALOG
|
|
|
|
};
|
|
|
|
|
2001-04-07 22:44:12 +08:00
|
|
|
|
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
|
|
|
GType
|
2001-04-07 22:44:12 +08:00
|
|
|
gimp_dock_get_type (void)
|
|
|
|
{
|
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
|
|
|
static GType dock_type = 0;
|
2001-04-07 22:44:12 +08:00
|
|
|
|
|
|
|
if (! dock_type)
|
|
|
|
{
|
2001-10-17 19:33:43 +08:00
|
|
|
static const GTypeInfo dock_info =
|
2001-04-07 22:44:12 +08:00
|
|
|
{
|
2001-10-17 19:33:43 +08:00
|
|
|
sizeof (GimpDockClass),
|
|
|
|
NULL, /* base_init */
|
|
|
|
NULL, /* base_finalize */
|
|
|
|
(GClassInitFunc) gimp_dock_class_init,
|
|
|
|
NULL, /* class_finalize */
|
|
|
|
NULL, /* class_data */
|
|
|
|
sizeof (GimpDock),
|
|
|
|
0, /* n_preallocs */
|
|
|
|
(GInstanceInitFunc) gimp_dock_init,
|
2001-04-07 22:44:12 +08:00
|
|
|
};
|
|
|
|
|
2001-10-17 19:33:43 +08:00
|
|
|
dock_type = g_type_register_static (GTK_TYPE_WINDOW,
|
|
|
|
"GimpDock",
|
|
|
|
&dock_info, 0);
|
2001-04-07 22:44:12 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return dock_type;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_dock_class_init (GimpDockClass *klass)
|
|
|
|
{
|
|
|
|
GtkObjectClass *object_class;
|
2001-11-26 21:17:18 +08:00
|
|
|
GtkWidgetClass *widget_class;
|
2001-04-07 22:44:12 +08:00
|
|
|
|
2001-10-17 19:33:43 +08:00
|
|
|
object_class = GTK_OBJECT_CLASS (klass);
|
2001-11-26 21:17:18 +08:00
|
|
|
widget_class = GTK_WIDGET_CLASS (klass);
|
2001-04-07 22:44:12 +08:00
|
|
|
|
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
|
|
|
parent_class = g_type_class_peek_parent (klass);
|
2001-04-07 22:44:12 +08:00
|
|
|
|
2001-11-26 21:17:18 +08:00
|
|
|
object_class->destroy = gimp_dock_destroy;
|
|
|
|
|
|
|
|
widget_class->style_set = gimp_dock_style_set;
|
|
|
|
|
|
|
|
gtk_widget_class_install_style_property (widget_class,
|
|
|
|
g_param_spec_int ("separator_height",
|
|
|
|
NULL, NULL,
|
|
|
|
0,
|
|
|
|
G_MAXINT,
|
2002-03-19 03:34:06 +08:00
|
|
|
DEFAULT_SEPARATOR_HEIGHT,
|
2001-11-26 21:17:18 +08:00
|
|
|
G_PARAM_READABLE));
|
2001-04-07 22:44:12 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_dock_init (GimpDock *dock)
|
|
|
|
{
|
2001-04-11 00:03:40 +08:00
|
|
|
GtkWidget *separator;
|
|
|
|
|
2002-03-15 01:07:02 +08:00
|
|
|
dock->context = NULL;
|
|
|
|
dock->destroy_if_empty = FALSE;
|
2001-04-24 00:58:18 +08:00
|
|
|
|
2001-05-18 20:43:37 +08:00
|
|
|
gtk_window_set_wmclass (GTK_WINDOW (dock), "dock", "Gimp");
|
2002-01-26 02:34:33 +08:00
|
|
|
gtk_window_set_resizable (GTK_WINDOW (dock), TRUE);
|
2001-05-18 20:43:37 +08:00
|
|
|
|
2001-04-22 08:38:56 +08:00
|
|
|
dock->main_vbox = gtk_vbox_new (FALSE, 0);
|
|
|
|
gtk_container_add (GTK_CONTAINER (dock), dock->main_vbox);
|
|
|
|
gtk_widget_show (dock->main_vbox);
|
|
|
|
|
2001-04-07 22:44:12 +08:00
|
|
|
dock->vbox = gtk_vbox_new (FALSE, 0);
|
2001-04-22 08:38:56 +08:00
|
|
|
gtk_container_add (GTK_CONTAINER (dock->main_vbox), dock->vbox);
|
2001-04-07 22:44:12 +08:00
|
|
|
gtk_widget_show (dock->vbox);
|
|
|
|
|
2001-04-11 00:03:40 +08:00
|
|
|
separator = gimp_dock_separator_new (dock);
|
|
|
|
gtk_box_pack_start (GTK_BOX (dock->vbox), separator, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (separator);
|
2001-04-07 22:44:12 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_dock_destroy (GtkObject *object)
|
|
|
|
{
|
2001-04-11 00:03:40 +08:00
|
|
|
GimpDock *dock;
|
|
|
|
|
|
|
|
dock = GIMP_DOCK (object);
|
|
|
|
|
2001-04-24 00:58:18 +08:00
|
|
|
while (dock->dockbooks)
|
|
|
|
gimp_dock_remove_book (dock, GIMP_DOCKBOOK (dock->dockbooks->data));
|
|
|
|
|
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
|
|
|
if (dock->context)
|
|
|
|
{
|
|
|
|
g_object_unref (G_OBJECT (dock->context));
|
|
|
|
dock->context = NULL;
|
|
|
|
}
|
2001-04-11 00:03:40 +08:00
|
|
|
|
2001-04-07 22:44:12 +08:00
|
|
|
if (GTK_OBJECT_CLASS (parent_class))
|
|
|
|
GTK_OBJECT_CLASS (parent_class)->destroy (object);
|
|
|
|
}
|
|
|
|
|
2001-11-26 21:17:18 +08:00
|
|
|
static void
|
|
|
|
gimp_dock_style_set (GtkWidget *widget,
|
|
|
|
GtkStyle *prev_style)
|
|
|
|
{
|
2002-03-19 03:34:06 +08:00
|
|
|
GimpDock *dock;
|
|
|
|
GList *children;
|
|
|
|
GList *list;
|
|
|
|
gint separator_height;
|
|
|
|
|
|
|
|
dock = GIMP_DOCK (widget);
|
2001-11-26 21:17:18 +08:00
|
|
|
|
2001-11-27 23:44:02 +08:00
|
|
|
if (GTK_WIDGET_CLASS (parent_class)->style_set)
|
|
|
|
GTK_WIDGET_CLASS (parent_class)->style_set (widget, prev_style);
|
|
|
|
|
2001-11-26 21:17:18 +08:00
|
|
|
gtk_widget_style_get (widget,
|
|
|
|
"separator_height", &separator_height,
|
|
|
|
NULL);
|
|
|
|
|
2002-03-19 03:34:06 +08:00
|
|
|
children = gtk_container_get_children (GTK_CONTAINER (dock->vbox));
|
2001-11-26 21:17:18 +08:00
|
|
|
|
|
|
|
for (list = children; list; list = g_list_next (list))
|
|
|
|
{
|
2002-03-19 03:34:06 +08:00
|
|
|
if (GTK_IS_EVENT_BOX (list->data))
|
2001-11-26 21:17:18 +08:00
|
|
|
{
|
2002-03-19 03:34:06 +08:00
|
|
|
gtk_widget_set_size_request (GTK_WIDGET (list->data),
|
|
|
|
-1, separator_height);
|
2001-11-26 21:17:18 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
g_list_free (children);
|
|
|
|
}
|
|
|
|
|
2001-04-11 04:38:42 +08:00
|
|
|
static GtkWidget *
|
|
|
|
gimp_dock_separator_new (GimpDock *dock)
|
|
|
|
{
|
|
|
|
GtkWidget *event_box;
|
|
|
|
GtkWidget *frame;
|
2002-03-19 03:34:06 +08:00
|
|
|
gint separator_height;
|
2001-04-11 04:38:42 +08:00
|
|
|
|
|
|
|
event_box = gtk_event_box_new ();
|
2002-03-19 03:34:06 +08:00
|
|
|
|
|
|
|
gtk_widget_set_name (event_box, "dock-separator");
|
|
|
|
|
|
|
|
gtk_widget_style_get (GTK_WIDGET (dock),
|
|
|
|
"separator_height", &separator_height,
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
gtk_widget_set_size_request (event_box, -1, separator_height);
|
2001-04-11 04:38:42 +08:00
|
|
|
|
|
|
|
frame = gtk_frame_new (NULL);
|
|
|
|
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_OUT);
|
|
|
|
gtk_container_add (GTK_CONTAINER (event_box), frame);
|
|
|
|
gtk_widget_show (frame);
|
|
|
|
|
|
|
|
gtk_drag_dest_set (GTK_WIDGET (event_box),
|
|
|
|
GTK_DEST_DEFAULT_ALL,
|
2001-10-17 19:33:43 +08:00
|
|
|
dialog_target_table, G_N_ELEMENTS (dialog_target_table),
|
2001-04-11 04:38:42 +08:00
|
|
|
GDK_ACTION_MOVE);
|
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
|
|
|
g_signal_connect (G_OBJECT (event_box), "drag_drop",
|
2001-08-15 00:33:28 +08:00
|
|
|
G_CALLBACK (gimp_dock_separator_drag_drop),
|
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
|
|
|
dock);
|
2001-04-11 04:38:42 +08:00
|
|
|
|
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
|
|
|
g_signal_connect (G_OBJECT (event_box), "button_press_event",
|
|
|
|
G_CALLBACK (gimp_dock_separator_button_press),
|
|
|
|
dock);
|
|
|
|
g_signal_connect (G_OBJECT (event_box), "button_release_event",
|
|
|
|
G_CALLBACK (gimp_dock_separator_button_release),
|
|
|
|
dock);
|
2001-04-11 04:38:42 +08:00
|
|
|
|
|
|
|
return event_box;
|
|
|
|
}
|
|
|
|
|
2002-03-15 01:07:02 +08:00
|
|
|
gboolean
|
|
|
|
gimp_dock_construct (GimpDock *dock,
|
|
|
|
GimpDialogFactory *dialog_factory,
|
|
|
|
GimpContext *context,
|
|
|
|
gboolean destroy_if_empty)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_DOCK (dock), FALSE);
|
|
|
|
g_return_val_if_fail (GIMP_IS_DIALOG_FACTORY (dialog_factory), FALSE);
|
|
|
|
g_return_val_if_fail (GIMP_IS_CONTEXT (context), FALSE);
|
|
|
|
|
|
|
|
dock->dialog_factory = dialog_factory;
|
|
|
|
dock->context = context;
|
|
|
|
dock->destroy_if_empty = destroy_if_empty ? TRUE : FALSE;
|
|
|
|
|
|
|
|
g_object_ref (G_OBJECT (dock->context));
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2001-04-07 22:44:12 +08:00
|
|
|
void
|
|
|
|
gimp_dock_add (GimpDock *dock,
|
2001-04-11 00:03:40 +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);
|
|
|
|
|
|
|
|
dockbook = GIMP_DOCKBOOK (dock->dockbooks->data);
|
|
|
|
|
|
|
|
gimp_dockbook_add (dockbook, dockable, position);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gimp_dock_remove (GimpDock *dock,
|
|
|
|
GimpDockable *dockable)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_DOCK (dock));
|
|
|
|
g_return_if_fail (GIMP_IS_DOCKABLE (dockable));
|
|
|
|
|
|
|
|
g_return_if_fail (dockable->dockbook != NULL);
|
|
|
|
g_return_if_fail (dockable->dockbook->dock != NULL);
|
|
|
|
g_return_if_fail (dockable->dockbook->dock == dock);
|
|
|
|
|
|
|
|
gimp_dockbook_remove (dockable->dockbook, dockable);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gimp_dock_add_book (GimpDock *dock,
|
|
|
|
GimpDockbook *dockbook,
|
|
|
|
gint index)
|
|
|
|
{
|
|
|
|
GtkWidget *separator;
|
|
|
|
gint length;
|
|
|
|
|
|
|
|
g_return_if_fail (GIMP_IS_DOCK (dock));
|
|
|
|
g_return_if_fail (GIMP_IS_DOCKBOOK (dockbook));
|
|
|
|
|
|
|
|
g_return_if_fail (dockbook->dock == NULL);
|
|
|
|
|
|
|
|
length = g_list_length (dock->dockbooks);
|
|
|
|
|
|
|
|
if (index >= length || index < 0)
|
|
|
|
index = length;
|
|
|
|
|
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
|
|
|
dockbook->dock = dock;
|
2001-04-11 00:03:40 +08:00
|
|
|
dock->dockbooks = g_list_insert (dock->dockbooks, dockbook, index);
|
|
|
|
|
|
|
|
index *= 2;
|
|
|
|
|
|
|
|
gtk_box_pack_start (GTK_BOX (dock->vbox), GTK_WIDGET (dockbook),
|
|
|
|
TRUE, TRUE, 0);
|
|
|
|
gtk_box_reorder_child (GTK_BOX (dock->vbox), GTK_WIDGET (dockbook), index);
|
|
|
|
gtk_widget_show (GTK_WIDGET (dockbook));
|
|
|
|
|
|
|
|
separator = gimp_dock_separator_new (dock);
|
|
|
|
gtk_box_pack_start (GTK_BOX (dock->vbox), separator, FALSE, FALSE, 0);
|
|
|
|
gtk_box_reorder_child (GTK_BOX (dock->vbox), separator, index);
|
|
|
|
gtk_widget_show (separator);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gimp_dock_remove_book (GimpDock *dock,
|
|
|
|
GimpDockbook *dockbook)
|
|
|
|
{
|
2002-03-15 01:07:02 +08:00
|
|
|
GtkWidget *separator;
|
|
|
|
GList *children;
|
|
|
|
gint length;
|
|
|
|
gint index;
|
|
|
|
gint book_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));
|
|
|
|
|
|
|
|
g_return_if_fail (dockbook->dock == dock);
|
|
|
|
|
|
|
|
length = g_list_length (dock->dockbooks);
|
|
|
|
index = g_list_index (dock->dockbooks, dockbook);
|
|
|
|
|
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
|
|
|
dockbook->dock = NULL;
|
2001-04-11 00:03:40 +08:00
|
|
|
dock->dockbooks = g_list_remove (dock->dockbooks, dockbook);
|
|
|
|
|
2001-09-03 21:03:34 +08:00
|
|
|
children = gtk_container_get_children (GTK_CONTAINER (dock->vbox));
|
2001-04-11 00:03:40 +08:00
|
|
|
book_index = g_list_index (children, dockbook);
|
|
|
|
|
2002-03-15 01:07:02 +08:00
|
|
|
if (index == length -1)
|
|
|
|
{
|
|
|
|
separator = g_list_nth_data (children, book_index - 1);
|
|
|
|
}
|
|
|
|
else
|
2001-04-11 00:03:40 +08:00
|
|
|
{
|
2002-03-15 01:07:02 +08:00
|
|
|
separator = g_list_nth_data (children, book_index + 1);
|
2001-04-11 00:03:40 +08:00
|
|
|
}
|
|
|
|
|
2002-03-15 01:07:02 +08:00
|
|
|
gtk_container_remove (GTK_CONTAINER (dock->vbox), separator);
|
|
|
|
|
2001-09-03 21:03:34 +08:00
|
|
|
g_list_free (children);
|
|
|
|
|
2001-04-11 00:03:40 +08:00
|
|
|
gtk_container_remove (GTK_CONTAINER (dock->vbox), GTK_WIDGET (dockbook));
|
|
|
|
|
2002-03-15 01:07:02 +08:00
|
|
|
if ((length == 1) && (dock->destroy_if_empty))
|
2001-04-11 00:03:40 +08:00
|
|
|
{
|
2001-07-25 06:05:40 +08:00
|
|
|
gtk_widget_destroy (GTK_WIDGET (dock));
|
2001-04-11 00:03:40 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2001-04-11 04:38:42 +08:00
|
|
|
gimp_dock_separator_button_press (GtkWidget *widget,
|
|
|
|
GdkEventButton *bevent,
|
|
|
|
gpointer data)
|
2001-04-11 00:03:40 +08:00
|
|
|
{
|
2001-04-11 04:38:42 +08:00
|
|
|
if (bevent->type == GDK_BUTTON_PRESS)
|
|
|
|
{
|
|
|
|
if (bevent->button == 1)
|
|
|
|
{
|
|
|
|
gtk_grab_add (widget);
|
|
|
|
}
|
|
|
|
}
|
2001-04-11 00:03:40 +08:00
|
|
|
|
2001-04-11 04:38:42 +08:00
|
|
|
return TRUE;
|
|
|
|
}
|
2001-04-11 00:03:40 +08:00
|
|
|
|
2001-04-11 04:38:42 +08:00
|
|
|
static gboolean
|
|
|
|
gimp_dock_separator_button_release (GtkWidget *widget,
|
|
|
|
GdkEventButton *bevent,
|
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
if (bevent->button == 1)
|
2001-04-11 00:03:40 +08:00
|
|
|
{
|
2001-04-11 04:38:42 +08:00
|
|
|
gtk_grab_remove (widget);
|
2001-04-11 00:03:40 +08:00
|
|
|
}
|
|
|
|
|
2001-04-11 04:38:42 +08:00
|
|
|
return TRUE;
|
2001-04-11 00:03:40 +08:00
|
|
|
}
|
|
|
|
|
2001-04-11 04:38:42 +08:00
|
|
|
/*
|
2001-04-11 00:03:40 +08:00
|
|
|
static void
|
|
|
|
gimp_dock_tab_drag_begin (GtkWidget *widget,
|
|
|
|
GdkDragContext *context,
|
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
GimpDockable *dockable;
|
|
|
|
GtkWidget *window;
|
|
|
|
GtkWidget *frame;
|
|
|
|
GtkWidget *label;
|
|
|
|
|
|
|
|
dockable = GIMP_DOCKABLE (data);
|
|
|
|
|
|
|
|
window = gtk_window_new (GTK_WINDOW_POPUP);
|
|
|
|
|
|
|
|
frame = gtk_frame_new (NULL);
|
|
|
|
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_OUT);
|
|
|
|
gtk_container_add (GTK_CONTAINER (window), frame);
|
|
|
|
gtk_widget_show (frame);
|
|
|
|
|
|
|
|
label = gtk_label_new (dockable->name);
|
|
|
|
gtk_misc_set_padding (GTK_MISC (label), 10, 5);
|
|
|
|
gtk_container_add (GTK_CONTAINER (frame), label);
|
|
|
|
gtk_widget_show (label);
|
|
|
|
|
|
|
|
gtk_widget_show (window);
|
|
|
|
|
2001-07-28 00:08:05 +08:00
|
|
|
g_object_set_data_full (G_OBJECT (dockable), "gimp-dock-drag-widget",
|
|
|
|
window,
|
|
|
|
(GDestroyNotify) gtk_widget_destroy);
|
2001-04-11 00:03:40 +08:00
|
|
|
|
|
|
|
gtk_drag_set_icon_widget (context, window,
|
|
|
|
-8, -8);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_dock_tab_drag_end (GtkWidget *widget,
|
|
|
|
GdkDragContext *context,
|
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
GimpDockable *dockable;
|
|
|
|
GtkWidget *drag_widget;
|
|
|
|
|
|
|
|
dockable = GIMP_DOCKABLE (data);
|
|
|
|
|
2001-07-28 00:08:05 +08:00
|
|
|
drag_widget = g_object_get_data (G_OBJECT (dockable),
|
2001-04-22 08:38:56 +08:00
|
|
|
"gimp-dock-drag-widget");
|
2001-04-11 00:03:40 +08:00
|
|
|
|
|
|
|
if (drag_widget)
|
|
|
|
{
|
|
|
|
GtkWidget *dock;
|
|
|
|
|
2001-07-28 00:08:05 +08:00
|
|
|
g_object_set_data (G_OBJECT (dockable), "gimp-dock-drag-widget", NULL);
|
2001-04-11 00:03:40 +08:00
|
|
|
|
|
|
|
dock = gimp_dock_new ();
|
|
|
|
|
|
|
|
gtk_window_set_position (GTK_WINDOW (dock), GTK_WIN_POS_MOUSE);
|
|
|
|
|
2001-07-28 00:08:05 +08:00
|
|
|
g_object_ref (G_OBJECT (dockable));
|
2001-04-11 00:03:40 +08:00
|
|
|
|
|
|
|
gimp_dock_remove (dockable->dock, dockable);
|
|
|
|
gimp_dock_add (GIMP_DOCK (dock), dockable, -1, -1);
|
|
|
|
|
2001-07-28 00:08:05 +08:00
|
|
|
g_object_unref (G_OBJECT (dockable));
|
2001-04-11 00:03:40 +08:00
|
|
|
|
|
|
|
gtk_widget_show (dock);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gimp_dock_separator_drag_drop (GtkWidget *widget,
|
|
|
|
GdkDragContext *context,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
guint time,
|
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
GimpDock *dock;
|
|
|
|
GtkWidget *source;
|
|
|
|
|
|
|
|
dock = GIMP_DOCK (data);
|
|
|
|
|
|
|
|
source = gtk_drag_get_source_widget (context);
|
|
|
|
|
|
|
|
if (source)
|
|
|
|
{
|
|
|
|
GimpDockable *src_dockable;
|
|
|
|
|
2001-07-25 07:11:30 +08:00
|
|
|
src_dockable = (GimpDockable *) g_object_get_data (G_OBJECT (source),
|
|
|
|
"gimp-dockable");
|
2001-04-11 00:03:40 +08:00
|
|
|
|
|
|
|
if (src_dockable)
|
|
|
|
{
|
|
|
|
GtkWidget *dockbook;
|
|
|
|
GList *children;
|
|
|
|
gint index;
|
|
|
|
|
2001-07-25 07:11:30 +08:00
|
|
|
g_object_set_data (G_OBJECT (src_dockable),
|
|
|
|
"gimp-dock-drag-widget", NULL);
|
2001-04-11 00:03:40 +08:00
|
|
|
|
2001-12-29 21:26:29 +08:00
|
|
|
children = gtk_container_get_children (GTK_CONTAINER (widget->parent));
|
|
|
|
index = g_list_index (children, widget) / 2;
|
|
|
|
g_list_free (children);
|
2001-04-11 00:03:40 +08:00
|
|
|
|
|
|
|
dockbook = gimp_dockbook_new ();
|
|
|
|
|
|
|
|
gimp_dock_add_book (dock, GIMP_DOCKBOOK (dockbook), index);
|
|
|
|
|
2001-07-25 07:11:30 +08:00
|
|
|
g_object_ref (G_OBJECT (src_dockable));
|
2001-04-11 00:03:40 +08:00
|
|
|
|
|
|
|
gimp_dockbook_remove (src_dockable->dockbook, src_dockable);
|
|
|
|
gimp_dockbook_add (GIMP_DOCKBOOK (dockbook), src_dockable, -1);
|
|
|
|
|
2001-07-25 07:11:30 +08:00
|
|
|
g_object_unref (G_OBJECT (src_dockable));
|
2001-04-11 00:03:40 +08:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
2001-04-07 22:44:12 +08:00
|
|
|
}
|