2006-12-10 05:33:38 +08:00
|
|
|
/* GIMP - The GNU Image Manipulation Program
|
2001-04-11 00:03:40 +08:00
|
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
*
|
|
|
|
* gimpdockbook.c
|
2007-09-17 23:40:01 +08:00
|
|
|
* Copyright (C) 2001-2007 Michael Natterer <mitch@gimp.org>
|
2001-04-11 00:03:40 +08:00
|
|
|
*
|
2009-01-18 06:28:01 +08:00
|
|
|
* This program is free software: you can redistribute it and/or modify
|
2001-04-11 00:03:40 +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-11 00:03:40 +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-11 00:03:40 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
2009-10-18 02:20:39 +08:00
|
|
|
#undef GSEAL_ENABLE
|
|
|
|
|
2001-11-24 00:25:01 +08:00
|
|
|
#include <string.h>
|
|
|
|
|
2001-04-11 00:03:40 +08:00
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
|
|
|
#include "libgimpwidgets/gimpwidgets.h"
|
|
|
|
|
2001-05-08 11:48:54 +08:00
|
|
|
#include "widgets-types.h"
|
2001-04-11 00:03:40 +08:00
|
|
|
|
2003-01-11 01:55:53 +08:00
|
|
|
#include "core/gimpcontext.h"
|
2003-05-03 19:59:44 +08:00
|
|
|
#include "core/gimpmarshal.h"
|
2003-01-11 01:55:53 +08:00
|
|
|
|
2001-05-08 11:48:54 +08:00
|
|
|
#include "gimpdnd.h"
|
2009-09-13 15:31:21 +08:00
|
|
|
#include "gimpdock.h"
|
2001-04-11 00:03:40 +08:00
|
|
|
#include "gimpdockable.h"
|
|
|
|
#include "gimpdockbook.h"
|
2008-05-20 05:11:03 +08:00
|
|
|
#include "gimpdocked.h"
|
2009-09-15 13:58:14 +08:00
|
|
|
#include "gimpdockwindow.h"
|
2003-08-26 18:07:01 +08:00
|
|
|
#include "gimphelp-ids.h"
|
2003-01-11 01:55:53 +08:00
|
|
|
#include "gimpmenufactory.h"
|
2009-10-25 00:52:48 +08:00
|
|
|
#include "gimppanedbox.h"
|
2005-10-31 02:41:18 +08:00
|
|
|
#include "gimpstringaction.h"
|
|
|
|
#include "gimpuimanager.h"
|
2004-08-25 01:16:46 +08:00
|
|
|
#include "gimpview.h"
|
2005-10-31 02:41:18 +08:00
|
|
|
#include "gimpwidgets-utils.h"
|
2001-11-24 00:25:01 +08:00
|
|
|
|
app: Use a GdkWindow instead of GimpDockSeparators for dockable DND
Make drag-and-drop rearrangement of dockables happen directly in the
existing widget hierarchy so we don't have to use special, ugly
widgets (read GimpDockSeparator:s) for that.
More specifically, make edges of dockables and dockbooks have the same
semantics as the GimpDockSeparators had. We put a highlight colored
GdkWindow on top of the widget in question to highlight these special
drop areas. This GdkWindow is not taken into consideration in the GTK+
drag-and-drop code, so it does not interupt the DND interaction.
To achive this, there is a problem we must solve: Drag events in GTK+
are propagated inwards and out, but we sometimes want ancenstor
widgets to take care of drop events. We solve this by introducing the
concept of "drag handlers". A drag handler is asked if it will handle
a given drag event, and if it will, a client will let the drag event
be propagated upwards in the widget hierarchy. Right now, the
GimpPanedBox is the only "drag handler". The code could be generalized
more but it doesn't feel worth it at this point.
The size of the special drop area is 5px, the same size as the default
GtkPaned handles. This is because the plan is to later use these
handles as drop areas too.
Other changes of interest are:
* We need to take care of "drag-motion", "drag-drop" and widget
highlightning ourselves. We can not use the GtkDestDefaults
conveniences with gtk_drag_dest_set() any longer since we need more
control.
* Make the drop callback pass the insert index directly instead of a
GimpDockSeparator
* Add some GIMP_LOG() debug output for DND
* Disable the GimpDockSeparator code in GimpToolbox
2009-11-30 01:22:12 +08:00
|
|
|
#include "gimp-log.h"
|
2001-04-11 00:03:40 +08:00
|
|
|
|
2003-03-22 03:18:52 +08:00
|
|
|
#define DEFAULT_TAB_BORDER 0
|
|
|
|
#define DEFAULT_TAB_ICON_SIZE GTK_ICON_SIZE_BUTTON
|
2005-06-04 20:54:24 +08:00
|
|
|
#define DND_WIDGET_ICON_SIZE GTK_ICON_SIZE_BUTTON
|
2003-03-22 03:18:52 +08:00
|
|
|
#define MENU_WIDGET_ICON_SIZE GTK_ICON_SIZE_MENU
|
|
|
|
#define MENU_WIDGET_SPACING 4
|
2007-09-17 23:40:01 +08:00
|
|
|
#define TAB_HOVER_TIMEOUT 500
|
2001-05-07 00:14:34 +08:00
|
|
|
|
|
|
|
|
2003-05-03 19:59:44 +08:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
DOCKABLE_ADDED,
|
|
|
|
DOCKABLE_REMOVED,
|
|
|
|
DOCKABLE_REORDERED,
|
|
|
|
LAST_SIGNAL
|
|
|
|
};
|
|
|
|
|
2009-09-13 22:30:09 +08:00
|
|
|
struct _GimpDockbookPrivate
|
|
|
|
{
|
|
|
|
GimpDock *dock;
|
|
|
|
GimpUIManager *ui_manager;
|
|
|
|
|
|
|
|
guint tab_hover_timeout;
|
|
|
|
GimpDockable *tab_hover_dockable;
|
app: Use a GdkWindow instead of GimpDockSeparators for dockable DND
Make drag-and-drop rearrangement of dockables happen directly in the
existing widget hierarchy so we don't have to use special, ugly
widgets (read GimpDockSeparator:s) for that.
More specifically, make edges of dockables and dockbooks have the same
semantics as the GimpDockSeparators had. We put a highlight colored
GdkWindow on top of the widget in question to highlight these special
drop areas. This GdkWindow is not taken into consideration in the GTK+
drag-and-drop code, so it does not interupt the DND interaction.
To achive this, there is a problem we must solve: Drag events in GTK+
are propagated inwards and out, but we sometimes want ancenstor
widgets to take care of drop events. We solve this by introducing the
concept of "drag handlers". A drag handler is asked if it will handle
a given drag event, and if it will, a client will let the drag event
be propagated upwards in the widget hierarchy. Right now, the
GimpPanedBox is the only "drag handler". The code could be generalized
more but it doesn't feel worth it at this point.
The size of the special drop area is 5px, the same size as the default
GtkPaned handles. This is because the plan is to later use these
handles as drop areas too.
Other changes of interest are:
* We need to take care of "drag-motion", "drag-drop" and widget
highlightning ourselves. We can not use the GtkDestDefaults
conveniences with gtk_drag_dest_set() any longer since we need more
control.
* Make the drop callback pass the insert index directly instead of a
GimpDockSeparator
* Add some GIMP_LOG() debug output for DND
* Disable the GimpDockSeparator code in GimpToolbox
2009-11-30 01:22:12 +08:00
|
|
|
|
|
|
|
GimpPanedBox *drag_handler;
|
2009-09-13 22:30:09 +08:00
|
|
|
};
|
|
|
|
|
2003-05-03 19:59:44 +08:00
|
|
|
|
2007-09-17 23:40:01 +08:00
|
|
|
static void gimp_dockbook_dispose (GObject *object);
|
|
|
|
static void gimp_dockbook_finalize (GObject *object);
|
|
|
|
|
|
|
|
static void gimp_dockbook_style_set (GtkWidget *widget,
|
|
|
|
GtkStyle *prev_style);
|
app: Use a GdkWindow instead of GimpDockSeparators for dockable DND
Make drag-and-drop rearrangement of dockables happen directly in the
existing widget hierarchy so we don't have to use special, ugly
widgets (read GimpDockSeparator:s) for that.
More specifically, make edges of dockables and dockbooks have the same
semantics as the GimpDockSeparators had. We put a highlight colored
GdkWindow on top of the widget in question to highlight these special
drop areas. This GdkWindow is not taken into consideration in the GTK+
drag-and-drop code, so it does not interupt the DND interaction.
To achive this, there is a problem we must solve: Drag events in GTK+
are propagated inwards and out, but we sometimes want ancenstor
widgets to take care of drop events. We solve this by introducing the
concept of "drag handlers". A drag handler is asked if it will handle
a given drag event, and if it will, a client will let the drag event
be propagated upwards in the widget hierarchy. Right now, the
GimpPanedBox is the only "drag handler". The code could be generalized
more but it doesn't feel worth it at this point.
The size of the special drop area is 5px, the same size as the default
GtkPaned handles. This is because the plan is to later use these
handles as drop areas too.
Other changes of interest are:
* We need to take care of "drag-motion", "drag-drop" and widget
highlightning ourselves. We can not use the GtkDestDefaults
conveniences with gtk_drag_dest_set() any longer since we need more
control.
* Make the drop callback pass the insert index directly instead of a
GimpDockSeparator
* Add some GIMP_LOG() debug output for DND
* Disable the GimpDockSeparator code in GimpToolbox
2009-11-30 01:22:12 +08:00
|
|
|
|
|
|
|
static void gimp_dockbook_drag_leave (GtkWidget *widget,
|
|
|
|
GdkDragContext *context,
|
|
|
|
guint time);
|
|
|
|
static gboolean gimp_dockbook_drag_motion (GtkWidget *widget,
|
|
|
|
GdkDragContext *context,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
guint time);
|
2007-09-17 23:40:01 +08:00
|
|
|
static gboolean gimp_dockbook_drag_drop (GtkWidget *widget,
|
|
|
|
GdkDragContext *context,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
guint time);
|
|
|
|
|
|
|
|
static void gimp_dockbook_dockable_added (GimpDockbook *dockbook,
|
|
|
|
GimpDockable *dockable);
|
|
|
|
static void gimp_dockbook_dockable_removed (GimpDockbook *dockbook,
|
|
|
|
GimpDockable *dockable);
|
|
|
|
static void gimp_dockbook_update_tabs (GimpDockbook *dockbook,
|
|
|
|
gboolean added);
|
|
|
|
|
2008-05-20 05:11:03 +08:00
|
|
|
static void gimp_dockbook_tab_drag_source_setup (GtkWidget *widget,
|
|
|
|
GimpDockable *dockable);
|
2007-09-17 23:40:01 +08:00
|
|
|
static void gimp_dockbook_tab_drag_begin (GtkWidget *widget,
|
|
|
|
GdkDragContext *context,
|
|
|
|
GimpDockable *dockable);
|
|
|
|
static void gimp_dockbook_tab_drag_end (GtkWidget *widget,
|
|
|
|
GdkDragContext *context,
|
|
|
|
GimpDockable *dockable);
|
|
|
|
|
|
|
|
static void gimp_dockbook_tab_drag_leave (GtkWidget *widget,
|
|
|
|
GdkDragContext *context,
|
|
|
|
guint time,
|
|
|
|
GimpDockable *dockable);
|
|
|
|
static gboolean gimp_dockbook_tab_drag_motion (GtkWidget *widget,
|
|
|
|
GdkDragContext *context,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
guint time,
|
|
|
|
GimpDockable *dockable);
|
|
|
|
static gboolean gimp_dockbook_tab_drag_drop (GtkWidget *widget,
|
|
|
|
GdkDragContext *context,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
guint time);
|
|
|
|
|
|
|
|
static void gimp_dockbook_add_tab_timeout (GimpDockbook *dockbook,
|
|
|
|
GimpDockable *dockable);
|
|
|
|
static void gimp_dockbook_remove_tab_timeout (GimpDockbook *dockbook);
|
|
|
|
static gboolean gimp_dockbook_tab_timeout (GimpDockbook *dockbook);
|
2008-05-20 05:11:03 +08:00
|
|
|
static void gimp_dockbook_tab_locked_notify (GimpDockable *dockable,
|
|
|
|
GParamSpec *pspec,
|
|
|
|
GimpDockbook *dockbook);
|
2007-09-17 23:40:01 +08:00
|
|
|
|
|
|
|
static void gimp_dockbook_help_func (const gchar *help_id,
|
|
|
|
gpointer help_data);
|
2001-04-11 00:03:40 +08:00
|
|
|
|
|
|
|
|
2006-05-15 17:46:31 +08:00
|
|
|
G_DEFINE_TYPE (GimpDockbook, gimp_dockbook, GTK_TYPE_NOTEBOOK)
|
2005-12-20 06:37:49 +08:00
|
|
|
|
|
|
|
#define parent_class gimp_dockbook_parent_class
|
2001-04-11 00:03:40 +08:00
|
|
|
|
2005-12-20 06:37:49 +08:00
|
|
|
static guint dockbook_signals[LAST_SIGNAL] = { 0 };
|
2003-05-03 19:59:44 +08:00
|
|
|
|
2006-04-06 20:43:58 +08:00
|
|
|
static const GtkTargetEntry dialog_target_table[] = { GIMP_TARGET_DIALOG };
|
2001-04-11 00:03:40 +08:00
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_dockbook_class_init (GimpDockbookClass *klass)
|
|
|
|
{
|
2005-08-03 17:34:55 +08:00
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
|
|
|
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
|
2001-04-11 00:03:40 +08:00
|
|
|
|
2003-05-03 19:59:44 +08:00
|
|
|
dockbook_signals[DOCKABLE_ADDED] =
|
2005-05-27 21:05:26 +08:00
|
|
|
g_signal_new ("dockable-added",
|
2004-08-25 01:16:46 +08:00
|
|
|
G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_FIRST,
|
|
|
|
G_STRUCT_OFFSET (GimpDockbookClass, dockable_added),
|
|
|
|
NULL, NULL,
|
|
|
|
gimp_marshal_VOID__OBJECT,
|
|
|
|
G_TYPE_NONE, 1,
|
|
|
|
GIMP_TYPE_DOCKABLE);
|
2003-05-03 19:59:44 +08:00
|
|
|
|
|
|
|
dockbook_signals[DOCKABLE_REMOVED] =
|
2005-05-27 21:05:26 +08:00
|
|
|
g_signal_new ("dockable-removed",
|
2004-08-25 01:16:46 +08:00
|
|
|
G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_FIRST,
|
|
|
|
G_STRUCT_OFFSET (GimpDockbookClass, dockable_removed),
|
|
|
|
NULL, NULL,
|
|
|
|
gimp_marshal_VOID__OBJECT,
|
|
|
|
G_TYPE_NONE, 1,
|
|
|
|
GIMP_TYPE_DOCKABLE);
|
2003-05-03 19:59:44 +08:00
|
|
|
|
|
|
|
dockbook_signals[DOCKABLE_REORDERED] =
|
2005-05-27 21:05:26 +08:00
|
|
|
g_signal_new ("dockable-reordered",
|
2004-08-25 01:16:46 +08:00
|
|
|
G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_FIRST,
|
|
|
|
G_STRUCT_OFFSET (GimpDockbookClass, dockable_reordered),
|
|
|
|
NULL, NULL,
|
|
|
|
gimp_marshal_VOID__OBJECT,
|
|
|
|
G_TYPE_NONE, 1,
|
|
|
|
GIMP_TYPE_DOCKABLE);
|
2003-05-03 19:59:44 +08:00
|
|
|
|
2007-09-17 23:40:01 +08:00
|
|
|
object_class->dispose = gimp_dockbook_dispose;
|
2003-05-03 19:59:44 +08:00
|
|
|
object_class->finalize = gimp_dockbook_finalize;
|
|
|
|
|
|
|
|
widget_class->style_set = gimp_dockbook_style_set;
|
app: Use a GdkWindow instead of GimpDockSeparators for dockable DND
Make drag-and-drop rearrangement of dockables happen directly in the
existing widget hierarchy so we don't have to use special, ugly
widgets (read GimpDockSeparator:s) for that.
More specifically, make edges of dockables and dockbooks have the same
semantics as the GimpDockSeparators had. We put a highlight colored
GdkWindow on top of the widget in question to highlight these special
drop areas. This GdkWindow is not taken into consideration in the GTK+
drag-and-drop code, so it does not interupt the DND interaction.
To achive this, there is a problem we must solve: Drag events in GTK+
are propagated inwards and out, but we sometimes want ancenstor
widgets to take care of drop events. We solve this by introducing the
concept of "drag handlers". A drag handler is asked if it will handle
a given drag event, and if it will, a client will let the drag event
be propagated upwards in the widget hierarchy. Right now, the
GimpPanedBox is the only "drag handler". The code could be generalized
more but it doesn't feel worth it at this point.
The size of the special drop area is 5px, the same size as the default
GtkPaned handles. This is because the plan is to later use these
handles as drop areas too.
Other changes of interest are:
* We need to take care of "drag-motion", "drag-drop" and widget
highlightning ourselves. We can not use the GtkDestDefaults
conveniences with gtk_drag_dest_set() any longer since we need more
control.
* Make the drop callback pass the insert index directly instead of a
GimpDockSeparator
* Add some GIMP_LOG() debug output for DND
* Disable the GimpDockSeparator code in GimpToolbox
2009-11-30 01:22:12 +08:00
|
|
|
widget_class->drag_leave = gimp_dockbook_drag_leave;
|
|
|
|
widget_class->drag_motion = gimp_dockbook_drag_motion;
|
2003-05-03 19:59:44 +08:00
|
|
|
widget_class->drag_drop = gimp_dockbook_drag_drop;
|
|
|
|
|
2003-10-06 01:26:21 +08:00
|
|
|
klass->dockable_added = gimp_dockbook_dockable_added;
|
|
|
|
klass->dockable_removed = gimp_dockbook_dockable_removed;
|
2003-05-03 19:59:44 +08:00
|
|
|
klass->dockable_reordered = NULL;
|
2001-11-30 00:44:51 +08:00
|
|
|
|
|
|
|
gtk_widget_class_install_style_property (widget_class,
|
2005-05-27 21:05:26 +08:00
|
|
|
g_param_spec_int ("tab-border",
|
2001-11-30 00:44:51 +08:00
|
|
|
NULL, NULL,
|
2002-03-19 03:34:06 +08:00
|
|
|
0, G_MAXINT,
|
|
|
|
DEFAULT_TAB_BORDER,
|
2006-01-19 04:29:40 +08:00
|
|
|
GIMP_PARAM_READABLE));
|
2002-03-19 03:34:06 +08:00
|
|
|
gtk_widget_class_install_style_property (widget_class,
|
2005-05-27 21:05:26 +08:00
|
|
|
g_param_spec_enum ("tab-icon-size",
|
2002-05-10 22:50:27 +08:00
|
|
|
NULL, NULL,
|
|
|
|
GTK_TYPE_ICON_SIZE,
|
2003-03-22 03:18:52 +08:00
|
|
|
DEFAULT_TAB_ICON_SIZE,
|
2006-01-19 04:29:40 +08:00
|
|
|
GIMP_PARAM_READABLE));
|
2009-09-13 22:30:09 +08:00
|
|
|
|
|
|
|
g_type_class_add_private (klass, sizeof (GimpDockbookPrivate));
|
2001-04-11 00:03:40 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_dockbook_init (GimpDockbook *dockbook)
|
|
|
|
{
|
2009-09-13 22:30:09 +08:00
|
|
|
dockbook->p = G_TYPE_INSTANCE_GET_PRIVATE (dockbook,
|
|
|
|
GIMP_TYPE_DOCKBOOK,
|
|
|
|
GimpDockbookPrivate);
|
|
|
|
dockbook->p->dock = NULL;
|
|
|
|
dockbook->p->ui_manager = NULL;
|
2001-04-11 00:03:40 +08:00
|
|
|
|
|
|
|
gtk_notebook_popup_enable (GTK_NOTEBOOK (dockbook));
|
2001-08-04 22:10:58 +08:00
|
|
|
gtk_notebook_set_scrollable (GTK_NOTEBOOK (dockbook), TRUE);
|
2007-05-17 22:09:50 +08:00
|
|
|
gtk_notebook_set_show_border (GTK_NOTEBOOK (dockbook), FALSE);
|
2001-04-11 00:03:40 +08:00
|
|
|
|
|
|
|
gtk_drag_dest_set (GTK_WIDGET (dockbook),
|
app: Use a GdkWindow instead of GimpDockSeparators for dockable DND
Make drag-and-drop rearrangement of dockables happen directly in the
existing widget hierarchy so we don't have to use special, ugly
widgets (read GimpDockSeparator:s) for that.
More specifically, make edges of dockables and dockbooks have the same
semantics as the GimpDockSeparators had. We put a highlight colored
GdkWindow on top of the widget in question to highlight these special
drop areas. This GdkWindow is not taken into consideration in the GTK+
drag-and-drop code, so it does not interupt the DND interaction.
To achive this, there is a problem we must solve: Drag events in GTK+
are propagated inwards and out, but we sometimes want ancenstor
widgets to take care of drop events. We solve this by introducing the
concept of "drag handlers". A drag handler is asked if it will handle
a given drag event, and if it will, a client will let the drag event
be propagated upwards in the widget hierarchy. Right now, the
GimpPanedBox is the only "drag handler". The code could be generalized
more but it doesn't feel worth it at this point.
The size of the special drop area is 5px, the same size as the default
GtkPaned handles. This is because the plan is to later use these
handles as drop areas too.
Other changes of interest are:
* We need to take care of "drag-motion", "drag-drop" and widget
highlightning ourselves. We can not use the GtkDestDefaults
conveniences with gtk_drag_dest_set() any longer since we need more
control.
* Make the drop callback pass the insert index directly instead of a
GimpDockSeparator
* Add some GIMP_LOG() debug output for DND
* Disable the GimpDockSeparator code in GimpToolbox
2009-11-30 01:22:12 +08:00
|
|
|
0,
|
2001-10-17 19:33:43 +08:00
|
|
|
dialog_target_table, G_N_ELEMENTS (dialog_target_table),
|
2001-04-11 00:03:40 +08:00
|
|
|
GDK_ACTION_MOVE);
|
|
|
|
}
|
|
|
|
|
2007-09-17 23:40:01 +08:00
|
|
|
static void
|
|
|
|
gimp_dockbook_dispose (GObject *object)
|
|
|
|
{
|
|
|
|
GimpDockbook *dockbook = GIMP_DOCKBOOK (object);
|
|
|
|
|
|
|
|
gimp_dockbook_remove_tab_timeout (dockbook);
|
|
|
|
|
|
|
|
G_OBJECT_CLASS (parent_class)->dispose (object);
|
|
|
|
}
|
|
|
|
|
2003-01-11 01:55:53 +08:00
|
|
|
static void
|
|
|
|
gimp_dockbook_finalize (GObject *object)
|
|
|
|
{
|
2003-10-06 01:26:21 +08:00
|
|
|
GimpDockbook *dockbook = GIMP_DOCKBOOK (object);
|
2003-01-11 01:55:53 +08:00
|
|
|
|
2009-09-13 22:30:09 +08:00
|
|
|
if (dockbook->p->ui_manager)
|
2004-04-23 01:14:22 +08:00
|
|
|
{
|
2009-09-13 22:30:09 +08:00
|
|
|
g_object_unref (dockbook->p->ui_manager);
|
|
|
|
dockbook->p->ui_manager = NULL;
|
2004-04-23 01:14:22 +08:00
|
|
|
}
|
|
|
|
|
2003-01-11 01:55:53 +08:00
|
|
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
|
|
|
}
|
|
|
|
|
2001-11-30 00:44:51 +08:00
|
|
|
static void
|
|
|
|
gimp_dockbook_style_set (GtkWidget *widget,
|
|
|
|
GtkStyle *prev_style)
|
|
|
|
{
|
2002-03-19 03:34:06 +08:00
|
|
|
GList *children;
|
|
|
|
GList *list;
|
|
|
|
gint tab_border;
|
2001-11-30 00:44:51 +08:00
|
|
|
|
2008-03-30 07:43:39 +08:00
|
|
|
GTK_WIDGET_CLASS (parent_class)->style_set (widget, prev_style);
|
2001-11-30 00:44:51 +08:00
|
|
|
|
|
|
|
gtk_widget_style_get (widget,
|
2005-08-03 17:34:55 +08:00
|
|
|
"tab-border", &tab_border,
|
2001-11-30 00:44:51 +08:00
|
|
|
NULL);
|
|
|
|
|
2003-01-06 06:07:10 +08:00
|
|
|
g_object_set (widget,
|
2005-08-03 17:34:55 +08:00
|
|
|
"tab-border", tab_border,
|
2002-01-26 02:34:33 +08:00
|
|
|
NULL);
|
2002-03-19 03:34:06 +08:00
|
|
|
|
|
|
|
children = gtk_container_get_children (GTK_CONTAINER (widget));
|
|
|
|
|
|
|
|
for (list = children; list; list = g_list_next (list))
|
|
|
|
{
|
|
|
|
GtkWidget *tab_widget;
|
|
|
|
|
2008-05-20 05:11:03 +08:00
|
|
|
tab_widget = gimp_dockbook_create_tab_widget (GIMP_DOCKBOOK (widget),
|
|
|
|
GIMP_DOCKABLE (list->data));
|
2002-03-19 03:34:06 +08:00
|
|
|
|
|
|
|
gtk_notebook_set_tab_label (GTK_NOTEBOOK (widget),
|
|
|
|
GTK_WIDGET (list->data),
|
|
|
|
tab_widget);
|
|
|
|
}
|
|
|
|
|
|
|
|
g_list_free (children);
|
2001-11-30 00:44:51 +08:00
|
|
|
}
|
|
|
|
|
app: Use a GdkWindow instead of GimpDockSeparators for dockable DND
Make drag-and-drop rearrangement of dockables happen directly in the
existing widget hierarchy so we don't have to use special, ugly
widgets (read GimpDockSeparator:s) for that.
More specifically, make edges of dockables and dockbooks have the same
semantics as the GimpDockSeparators had. We put a highlight colored
GdkWindow on top of the widget in question to highlight these special
drop areas. This GdkWindow is not taken into consideration in the GTK+
drag-and-drop code, so it does not interupt the DND interaction.
To achive this, there is a problem we must solve: Drag events in GTK+
are propagated inwards and out, but we sometimes want ancenstor
widgets to take care of drop events. We solve this by introducing the
concept of "drag handlers". A drag handler is asked if it will handle
a given drag event, and if it will, a client will let the drag event
be propagated upwards in the widget hierarchy. Right now, the
GimpPanedBox is the only "drag handler". The code could be generalized
more but it doesn't feel worth it at this point.
The size of the special drop area is 5px, the same size as the default
GtkPaned handles. This is because the plan is to later use these
handles as drop areas too.
Other changes of interest are:
* We need to take care of "drag-motion", "drag-drop" and widget
highlightning ourselves. We can not use the GtkDestDefaults
conveniences with gtk_drag_dest_set() any longer since we need more
control.
* Make the drop callback pass the insert index directly instead of a
GimpDockSeparator
* Add some GIMP_LOG() debug output for DND
* Disable the GimpDockSeparator code in GimpToolbox
2009-11-30 01:22:12 +08:00
|
|
|
static void
|
|
|
|
gimp_dockbook_drag_leave (GtkWidget *widget,
|
|
|
|
GdkDragContext *context,
|
|
|
|
guint time)
|
|
|
|
{
|
|
|
|
gimp_highlight_widget (widget, FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gimp_dockbook_drag_motion (GtkWidget *widget,
|
|
|
|
GdkDragContext *context,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
guint time)
|
|
|
|
{
|
|
|
|
GimpDockbook *dockbook = GIMP_DOCKBOOK (widget);
|
|
|
|
gboolean other_will_handle = FALSE;
|
|
|
|
|
|
|
|
other_will_handle = gimp_paned_box_will_handle_drag (dockbook->p->drag_handler,
|
|
|
|
widget,
|
|
|
|
context,
|
|
|
|
x, y,
|
|
|
|
time);
|
|
|
|
|
|
|
|
gdk_drag_status (context, other_will_handle ? 0 : GDK_ACTION_MOVE, time);
|
|
|
|
gimp_highlight_widget (widget, ! other_will_handle);
|
|
|
|
return other_will_handle ? FALSE : TRUE;
|
|
|
|
}
|
|
|
|
|
2001-04-11 00:03:40 +08:00
|
|
|
static gboolean
|
|
|
|
gimp_dockbook_drag_drop (GtkWidget *widget,
|
2004-08-25 01:16:46 +08:00
|
|
|
GdkDragContext *context,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
guint time)
|
2001-04-11 00:03:40 +08:00
|
|
|
{
|
app: Use a GdkWindow instead of GimpDockSeparators for dockable DND
Make drag-and-drop rearrangement of dockables happen directly in the
existing widget hierarchy so we don't have to use special, ugly
widgets (read GimpDockSeparator:s) for that.
More specifically, make edges of dockables and dockbooks have the same
semantics as the GimpDockSeparators had. We put a highlight colored
GdkWindow on top of the widget in question to highlight these special
drop areas. This GdkWindow is not taken into consideration in the GTK+
drag-and-drop code, so it does not interupt the DND interaction.
To achive this, there is a problem we must solve: Drag events in GTK+
are propagated inwards and out, but we sometimes want ancenstor
widgets to take care of drop events. We solve this by introducing the
concept of "drag handlers". A drag handler is asked if it will handle
a given drag event, and if it will, a client will let the drag event
be propagated upwards in the widget hierarchy. Right now, the
GimpPanedBox is the only "drag handler". The code could be generalized
more but it doesn't feel worth it at this point.
The size of the special drop area is 5px, the same size as the default
GtkPaned handles. This is because the plan is to later use these
handles as drop areas too.
Other changes of interest are:
* We need to take care of "drag-motion", "drag-drop" and widget
highlightning ourselves. We can not use the GtkDestDefaults
conveniences with gtk_drag_dest_set() any longer since we need more
control.
* Make the drop callback pass the insert index directly instead of a
GimpDockSeparator
* Add some GIMP_LOG() debug output for DND
* Disable the GimpDockSeparator code in GimpToolbox
2009-11-30 01:22:12 +08:00
|
|
|
GimpDockbook *dockbook = GIMP_DOCKBOOK (widget);
|
|
|
|
gboolean handled = FALSE;
|
|
|
|
|
|
|
|
if (gimp_paned_box_will_handle_drag (dockbook->p->drag_handler,
|
|
|
|
widget,
|
|
|
|
context,
|
|
|
|
x, y,
|
|
|
|
time))
|
|
|
|
{
|
|
|
|
/* Make event fall through to the drag handler */
|
|
|
|
handled = FALSE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
handled =
|
|
|
|
gimp_dockbook_drop_dockable (dockbook,
|
|
|
|
gtk_drag_get_source_widget (context));
|
|
|
|
}
|
|
|
|
|
|
|
|
/* We must call gtk_drag_finish() ourselves */
|
|
|
|
if (handled)
|
|
|
|
gtk_drag_finish (context, TRUE, TRUE, time);
|
|
|
|
|
|
|
|
return handled;
|
2003-10-06 01:26:21 +08:00
|
|
|
}
|
2001-04-11 00:03:40 +08:00
|
|
|
|
2003-10-06 01:26:21 +08:00
|
|
|
static void
|
|
|
|
gimp_dockbook_dockable_added (GimpDockbook *dockbook,
|
|
|
|
GimpDockable *dockable)
|
|
|
|
{
|
|
|
|
gimp_dockbook_update_tabs (dockbook, TRUE);
|
2005-12-30 06:07:38 +08:00
|
|
|
|
|
|
|
gtk_notebook_set_current_page (GTK_NOTEBOOK (dockbook),
|
|
|
|
gtk_notebook_page_num (GTK_NOTEBOOK (dockbook),
|
|
|
|
GTK_WIDGET (dockable)));
|
2003-10-06 01:26:21 +08:00
|
|
|
}
|
2001-04-11 00:03:40 +08:00
|
|
|
|
2003-10-06 01:26:21 +08:00
|
|
|
static void
|
|
|
|
gimp_dockbook_dockable_removed (GimpDockbook *dockbook,
|
|
|
|
GimpDockable *dockable)
|
|
|
|
{
|
|
|
|
gimp_dockbook_update_tabs (dockbook, FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_dockbook_update_tabs (GimpDockbook *dockbook,
|
|
|
|
gboolean added)
|
|
|
|
{
|
|
|
|
switch (gtk_notebook_get_n_pages (GTK_NOTEBOOK (dockbook)))
|
2001-04-11 00:03:40 +08:00
|
|
|
{
|
2003-10-06 01:26:21 +08:00
|
|
|
case 1:
|
|
|
|
gtk_notebook_set_show_tabs (GTK_NOTEBOOK (dockbook), FALSE);
|
|
|
|
break;
|
2001-04-11 00:03:40 +08:00
|
|
|
|
2003-10-06 01:26:21 +08:00
|
|
|
case 2:
|
|
|
|
if (added)
|
|
|
|
gtk_notebook_set_show_tabs (GTK_NOTEBOOK (dockbook), TRUE);
|
|
|
|
break;
|
2001-04-11 00:03:40 +08:00
|
|
|
|
2003-10-06 01:26:21 +08:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2001-04-11 00:03:40 +08:00
|
|
|
|
2003-10-06 01:26:21 +08:00
|
|
|
GtkWidget *
|
|
|
|
gimp_dockbook_new (GimpMenuFactory *menu_factory)
|
|
|
|
{
|
|
|
|
GimpDockbook *dockbook;
|
2001-04-11 00:03:40 +08:00
|
|
|
|
2003-10-06 01:26:21 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_MENU_FACTORY (menu_factory), NULL);
|
2001-04-11 00:03:40 +08:00
|
|
|
|
2003-10-06 01:26:21 +08:00
|
|
|
dockbook = g_object_new (GIMP_TYPE_DOCKBOOK, NULL);
|
2001-04-11 00:03:40 +08:00
|
|
|
|
2009-09-13 22:30:09 +08:00
|
|
|
dockbook->p->ui_manager = gimp_menu_factory_manager_new (menu_factory,
|
2004-05-05 19:40:20 +08:00
|
|
|
"<Dockable>",
|
2004-04-23 01:14:22 +08:00
|
|
|
dockbook,
|
|
|
|
FALSE);
|
|
|
|
|
2003-10-06 01:26:21 +08:00
|
|
|
gimp_help_connect (GTK_WIDGET (dockbook), gimp_dockbook_help_func,
|
|
|
|
GIMP_HELP_DOCK, dockbook);
|
|
|
|
|
|
|
|
return GTK_WIDGET (dockbook);
|
2001-04-11 00:03:40 +08:00
|
|
|
}
|
|
|
|
|
2009-09-13 22:30:09 +08:00
|
|
|
GimpDock *
|
|
|
|
gimp_dockbook_get_dock (GimpDockbook *dockbook)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_DOCKBOOK (dockbook), NULL);
|
|
|
|
|
|
|
|
return dockbook->p->dock;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gimp_dockbook_set_dock (GimpDockbook *dockbook,
|
|
|
|
GimpDock *dock)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_DOCKBOOK (dockbook));
|
|
|
|
g_return_if_fail (dock == NULL || GIMP_IS_DOCK (dock));
|
|
|
|
|
|
|
|
dockbook->p->dock = dock;
|
|
|
|
}
|
|
|
|
|
|
|
|
GimpUIManager *
|
|
|
|
gimp_dockbook_get_ui_manager (GimpDockbook *dockbook)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_DOCKBOOK (dockbook), NULL);
|
|
|
|
|
|
|
|
return dockbook->p->ui_manager;
|
|
|
|
}
|
|
|
|
|
2001-04-11 00:03:40 +08:00
|
|
|
void
|
|
|
|
gimp_dockbook_add (GimpDockbook *dockbook,
|
2004-08-25 01:16:46 +08:00
|
|
|
GimpDockable *dockable,
|
|
|
|
gint position)
|
2001-04-11 00:03:40 +08:00
|
|
|
{
|
|
|
|
GtkWidget *tab_widget;
|
|
|
|
GtkWidget *menu_widget;
|
|
|
|
|
|
|
|
g_return_if_fail (GIMP_IS_DOCKBOOK (dockbook));
|
2009-09-13 22:30:09 +08:00
|
|
|
g_return_if_fail (dockbook->p->dock != NULL);
|
2001-04-11 00:03:40 +08:00
|
|
|
g_return_if_fail (GIMP_IS_DOCKABLE (dockable));
|
|
|
|
g_return_if_fail (dockable->dockbook == NULL);
|
|
|
|
|
app: Use a GdkWindow instead of GimpDockSeparators for dockable DND
Make drag-and-drop rearrangement of dockables happen directly in the
existing widget hierarchy so we don't have to use special, ugly
widgets (read GimpDockSeparator:s) for that.
More specifically, make edges of dockables and dockbooks have the same
semantics as the GimpDockSeparators had. We put a highlight colored
GdkWindow on top of the widget in question to highlight these special
drop areas. This GdkWindow is not taken into consideration in the GTK+
drag-and-drop code, so it does not interupt the DND interaction.
To achive this, there is a problem we must solve: Drag events in GTK+
are propagated inwards and out, but we sometimes want ancenstor
widgets to take care of drop events. We solve this by introducing the
concept of "drag handlers". A drag handler is asked if it will handle
a given drag event, and if it will, a client will let the drag event
be propagated upwards in the widget hierarchy. Right now, the
GimpPanedBox is the only "drag handler". The code could be generalized
more but it doesn't feel worth it at this point.
The size of the special drop area is 5px, the same size as the default
GtkPaned handles. This is because the plan is to later use these
handles as drop areas too.
Other changes of interest are:
* We need to take care of "drag-motion", "drag-drop" and widget
highlightning ourselves. We can not use the GtkDestDefaults
conveniences with gtk_drag_dest_set() any longer since we need more
control.
* Make the drop callback pass the insert index directly instead of a
GimpDockSeparator
* Add some GIMP_LOG() debug output for DND
* Disable the GimpDockSeparator code in GimpToolbox
2009-11-30 01:22:12 +08:00
|
|
|
GIMP_LOG (DND, "Adding GimpDockable %p to GimpDockbook %p", dockable, dockbook);
|
|
|
|
|
2008-05-20 05:11:03 +08:00
|
|
|
tab_widget = gimp_dockbook_create_tab_widget (dockbook, dockable);
|
2001-04-11 00:03:40 +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_return_if_fail (GTK_IS_WIDGET (tab_widget));
|
|
|
|
|
app: Use a GdkWindow instead of GimpDockSeparators for dockable DND
Make drag-and-drop rearrangement of dockables happen directly in the
existing widget hierarchy so we don't have to use special, ugly
widgets (read GimpDockSeparator:s) for that.
More specifically, make edges of dockables and dockbooks have the same
semantics as the GimpDockSeparators had. We put a highlight colored
GdkWindow on top of the widget in question to highlight these special
drop areas. This GdkWindow is not taken into consideration in the GTK+
drag-and-drop code, so it does not interupt the DND interaction.
To achive this, there is a problem we must solve: Drag events in GTK+
are propagated inwards and out, but we sometimes want ancenstor
widgets to take care of drop events. We solve this by introducing the
concept of "drag handlers". A drag handler is asked if it will handle
a given drag event, and if it will, a client will let the drag event
be propagated upwards in the widget hierarchy. Right now, the
GimpPanedBox is the only "drag handler". The code could be generalized
more but it doesn't feel worth it at this point.
The size of the special drop area is 5px, the same size as the default
GtkPaned handles. This is because the plan is to later use these
handles as drop areas too.
Other changes of interest are:
* We need to take care of "drag-motion", "drag-drop" and widget
highlightning ourselves. We can not use the GtkDestDefaults
conveniences with gtk_drag_dest_set() any longer since we need more
control.
* Make the drop callback pass the insert index directly instead of a
GimpDockSeparator
* Add some GIMP_LOG() debug output for DND
* Disable the GimpDockSeparator code in GimpToolbox
2009-11-30 01:22:12 +08:00
|
|
|
gimp_dockable_set_drag_handler (dockable, dockbook->p->drag_handler);
|
|
|
|
|
2003-07-08 23:07:56 +08:00
|
|
|
menu_widget = gimp_dockable_get_tab_widget (dockable,
|
2009-09-13 22:30:09 +08:00
|
|
|
gimp_dock_get_context (dockbook->p->dock),
|
2003-07-08 23:07:56 +08:00
|
|
|
GIMP_TAB_STYLE_ICON_BLURB,
|
2004-08-25 01:16:46 +08:00
|
|
|
MENU_WIDGET_ICON_SIZE);
|
2001-04-11 00:03:40 +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_return_if_fail (GTK_IS_WIDGET (menu_widget));
|
|
|
|
|
2001-04-11 00:03:40 +08:00
|
|
|
if (position == -1)
|
|
|
|
{
|
|
|
|
gtk_notebook_append_page_menu (GTK_NOTEBOOK (dockbook),
|
2004-08-25 01:16:46 +08:00
|
|
|
GTK_WIDGET (dockable),
|
|
|
|
tab_widget,
|
|
|
|
menu_widget);
|
2001-04-11 00:03:40 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gtk_notebook_insert_page_menu (GTK_NOTEBOOK (dockbook),
|
2004-08-25 01:16:46 +08:00
|
|
|
GTK_WIDGET (dockable),
|
|
|
|
tab_widget,
|
|
|
|
menu_widget,
|
|
|
|
position);
|
2001-04-11 00:03:40 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
gtk_widget_show (GTK_WIDGET (dockable));
|
|
|
|
|
|
|
|
dockable->dockbook = dockbook;
|
2001-04-24 00:58:18 +08:00
|
|
|
|
2009-09-13 22:30:09 +08:00
|
|
|
gimp_dockable_set_context (dockable, gimp_dock_get_context (dockbook->p->dock));
|
2003-05-03 19:59:44 +08:00
|
|
|
|
2008-05-20 05:11:03 +08:00
|
|
|
g_signal_connect (dockable, "notify::locked",
|
|
|
|
G_CALLBACK (gimp_dockbook_tab_locked_notify),
|
|
|
|
dockbook);
|
|
|
|
|
2003-05-03 19:59:44 +08:00
|
|
|
g_signal_emit (dockbook, dockbook_signals[DOCKABLE_ADDED], 0, dockable);
|
2001-04-11 00:03:40 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gimp_dockbook_remove (GimpDockbook *dockbook,
|
2004-08-25 01:16:46 +08:00
|
|
|
GimpDockable *dockable)
|
2001-04-11 00:03:40 +08:00
|
|
|
{
|
2001-09-03 21:03:34 +08:00
|
|
|
GList *children;
|
|
|
|
|
2001-04-11 00:03:40 +08:00
|
|
|
g_return_if_fail (GIMP_IS_DOCKBOOK (dockbook));
|
|
|
|
g_return_if_fail (GIMP_IS_DOCKABLE (dockable));
|
|
|
|
g_return_if_fail (dockable->dockbook == dockbook);
|
|
|
|
|
app: Use a GdkWindow instead of GimpDockSeparators for dockable DND
Make drag-and-drop rearrangement of dockables happen directly in the
existing widget hierarchy so we don't have to use special, ugly
widgets (read GimpDockSeparator:s) for that.
More specifically, make edges of dockables and dockbooks have the same
semantics as the GimpDockSeparators had. We put a highlight colored
GdkWindow on top of the widget in question to highlight these special
drop areas. This GdkWindow is not taken into consideration in the GTK+
drag-and-drop code, so it does not interupt the DND interaction.
To achive this, there is a problem we must solve: Drag events in GTK+
are propagated inwards and out, but we sometimes want ancenstor
widgets to take care of drop events. We solve this by introducing the
concept of "drag handlers". A drag handler is asked if it will handle
a given drag event, and if it will, a client will let the drag event
be propagated upwards in the widget hierarchy. Right now, the
GimpPanedBox is the only "drag handler". The code could be generalized
more but it doesn't feel worth it at this point.
The size of the special drop area is 5px, the same size as the default
GtkPaned handles. This is because the plan is to later use these
handles as drop areas too.
Other changes of interest are:
* We need to take care of "drag-motion", "drag-drop" and widget
highlightning ourselves. We can not use the GtkDestDefaults
conveniences with gtk_drag_dest_set() any longer since we need more
control.
* Make the drop callback pass the insert index directly instead of a
GimpDockSeparator
* Add some GIMP_LOG() debug output for DND
* Disable the GimpDockSeparator code in GimpToolbox
2009-11-30 01:22:12 +08:00
|
|
|
GIMP_LOG (DND, "Removing GimpDockable %p from GimpDockbook %p", dockable, dockbook);
|
|
|
|
|
|
|
|
gimp_dockable_set_drag_handler (dockable, NULL);
|
|
|
|
|
2003-05-03 19:59:44 +08:00
|
|
|
g_object_ref (dockable);
|
|
|
|
|
2008-05-20 05:11:03 +08:00
|
|
|
g_signal_handlers_disconnect_by_func (dockable,
|
|
|
|
G_CALLBACK (gimp_dockbook_tab_locked_notify),
|
|
|
|
dockbook);
|
|
|
|
|
2009-09-13 22:30:09 +08:00
|
|
|
if (dockbook->p->tab_hover_dockable == dockable)
|
2007-09-17 23:40:01 +08:00
|
|
|
gimp_dockbook_remove_tab_timeout (dockbook);
|
|
|
|
|
2001-04-11 00:03:40 +08:00
|
|
|
dockable->dockbook = NULL;
|
|
|
|
|
2001-05-07 00:14:34 +08:00
|
|
|
gimp_dockable_set_context (dockable, NULL);
|
|
|
|
|
2001-04-11 00:03:40 +08:00
|
|
|
gtk_container_remove (GTK_CONTAINER (dockbook), GTK_WIDGET (dockable));
|
|
|
|
|
2003-05-03 19:59:44 +08:00
|
|
|
g_signal_emit (dockbook, dockbook_signals[DOCKABLE_REMOVED], 0, dockable);
|
|
|
|
|
|
|
|
g_object_unref (dockable);
|
|
|
|
|
2001-09-03 21:03:34 +08:00
|
|
|
children = gtk_container_get_children (GTK_CONTAINER (dockbook));
|
|
|
|
|
|
|
|
if (! g_list_length (children))
|
2009-09-13 22:30:09 +08:00
|
|
|
gimp_dock_remove_book (dockbook->p->dock, dockbook);
|
2001-09-03 21:03:34 +08:00
|
|
|
|
|
|
|
g_list_free (children);
|
2001-04-11 00:03:40 +08:00
|
|
|
}
|
|
|
|
|
2003-07-08 23:07:56 +08:00
|
|
|
GtkWidget *
|
2008-05-20 05:11:03 +08:00
|
|
|
gimp_dockbook_create_tab_widget (GimpDockbook *dockbook,
|
|
|
|
GimpDockable *dockable)
|
2002-03-20 20:57:59 +08:00
|
|
|
{
|
2009-09-15 13:58:14 +08:00
|
|
|
GtkWidget *tab_widget;
|
|
|
|
GimpDockWindow *dock_window;
|
|
|
|
GtkIconSize tab_size = DEFAULT_TAB_ICON_SIZE;
|
|
|
|
GtkAction *action = NULL;
|
2002-03-20 20:57:59 +08:00
|
|
|
|
|
|
|
gtk_widget_style_get (GTK_WIDGET (dockbook),
|
2005-08-03 17:34:55 +08:00
|
|
|
"tab-icon-size", &tab_size,
|
2002-03-20 20:57:59 +08:00
|
|
|
NULL);
|
|
|
|
|
2003-07-08 23:07:56 +08:00
|
|
|
tab_widget = gimp_dockable_get_tab_widget (dockable,
|
2009-09-13 22:30:09 +08:00
|
|
|
gimp_dock_get_context (dockbook->p->dock),
|
2003-07-08 23:07:56 +08:00
|
|
|
dockable->tab_style,
|
|
|
|
tab_size);
|
2002-03-20 20:57:59 +08:00
|
|
|
|
2004-08-25 01:16:46 +08:00
|
|
|
if (! GIMP_IS_VIEW (tab_widget))
|
2002-03-20 20:57:59 +08:00
|
|
|
{
|
|
|
|
GtkWidget *event_box;
|
|
|
|
|
|
|
|
event_box = gtk_event_box_new ();
|
2006-06-15 18:44:24 +08:00
|
|
|
gtk_event_box_set_visible_window (GTK_EVENT_BOX (event_box), FALSE);
|
2006-06-17 17:36:18 +08:00
|
|
|
gtk_event_box_set_above_child (GTK_EVENT_BOX (event_box), TRUE);
|
2002-03-20 20:57:59 +08:00
|
|
|
gtk_container_add (GTK_CONTAINER (event_box), tab_widget);
|
|
|
|
gtk_widget_show (tab_widget);
|
|
|
|
|
|
|
|
tab_widget = event_box;
|
|
|
|
}
|
|
|
|
|
2005-10-31 02:41:18 +08:00
|
|
|
/* EEK */
|
2009-09-15 13:58:14 +08:00
|
|
|
dock_window = gimp_dock_window_from_dock (dockbook->p->dock);
|
|
|
|
if (dock_window && gimp_dock_window_get_ui_manager (dock_window))
|
2005-10-31 02:41:18 +08:00
|
|
|
{
|
|
|
|
const gchar *dialog_id;
|
|
|
|
|
|
|
|
dialog_id = g_object_get_data (G_OBJECT (dockable),
|
|
|
|
"gimp-dialog-identifier");
|
|
|
|
|
|
|
|
if (dialog_id)
|
|
|
|
{
|
|
|
|
GimpActionGroup *group;
|
|
|
|
|
|
|
|
group = gimp_ui_manager_get_action_group
|
2009-09-15 13:58:14 +08:00
|
|
|
(gimp_dock_window_get_ui_manager (dock_window), "dialogs");
|
2005-10-31 02:41:18 +08:00
|
|
|
|
|
|
|
if (group)
|
|
|
|
{
|
|
|
|
GList *actions;
|
|
|
|
GList *list;
|
|
|
|
|
|
|
|
actions = gtk_action_group_list_actions (GTK_ACTION_GROUP (group));
|
|
|
|
|
|
|
|
for (list = actions; list; list = g_list_next (list))
|
|
|
|
{
|
|
|
|
if (GIMP_IS_STRING_ACTION (list->data) &&
|
|
|
|
strstr (GIMP_STRING_ACTION (list->data)->value,
|
|
|
|
dialog_id))
|
|
|
|
{
|
|
|
|
action = list->data;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
g_list_free (actions);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (action)
|
|
|
|
gimp_widget_set_accel_help (tab_widget, action);
|
|
|
|
else
|
|
|
|
gimp_help_set_help_data (tab_widget, dockable->blurb, dockable->help_id);
|
2002-03-20 20:57:59 +08:00
|
|
|
|
|
|
|
g_object_set_data (G_OBJECT (tab_widget), "gimp-dockable", dockable);
|
|
|
|
|
2008-05-20 05:11:03 +08:00
|
|
|
gimp_dockbook_tab_drag_source_setup (tab_widget, dockable);
|
|
|
|
|
2005-08-03 17:34:55 +08:00
|
|
|
g_signal_connect (tab_widget, "drag-begin",
|
2004-08-25 01:16:46 +08:00
|
|
|
G_CALLBACK (gimp_dockbook_tab_drag_begin),
|
|
|
|
dockable);
|
2005-08-03 17:34:55 +08:00
|
|
|
g_signal_connect (tab_widget, "drag-end",
|
2004-08-25 01:16:46 +08:00
|
|
|
G_CALLBACK (gimp_dockbook_tab_drag_end),
|
|
|
|
dockable);
|
2002-03-20 20:57:59 +08:00
|
|
|
|
2005-08-03 17:34:55 +08:00
|
|
|
g_signal_connect (dockable, "drag-begin",
|
2004-08-25 01:16:46 +08:00
|
|
|
G_CALLBACK (gimp_dockbook_tab_drag_begin),
|
|
|
|
dockable);
|
2005-08-03 17:34:55 +08:00
|
|
|
g_signal_connect (dockable, "drag-end",
|
2004-08-25 01:16:46 +08:00
|
|
|
G_CALLBACK (gimp_dockbook_tab_drag_end),
|
|
|
|
dockable);
|
2003-10-06 01:26:21 +08:00
|
|
|
|
2008-05-20 05:11:03 +08:00
|
|
|
gtk_drag_dest_set (tab_widget,
|
app: Use a GdkWindow instead of GimpDockSeparators for dockable DND
Make drag-and-drop rearrangement of dockables happen directly in the
existing widget hierarchy so we don't have to use special, ugly
widgets (read GimpDockSeparator:s) for that.
More specifically, make edges of dockables and dockbooks have the same
semantics as the GimpDockSeparators had. We put a highlight colored
GdkWindow on top of the widget in question to highlight these special
drop areas. This GdkWindow is not taken into consideration in the GTK+
drag-and-drop code, so it does not interupt the DND interaction.
To achive this, there is a problem we must solve: Drag events in GTK+
are propagated inwards and out, but we sometimes want ancenstor
widgets to take care of drop events. We solve this by introducing the
concept of "drag handlers". A drag handler is asked if it will handle
a given drag event, and if it will, a client will let the drag event
be propagated upwards in the widget hierarchy. Right now, the
GimpPanedBox is the only "drag handler". The code could be generalized
more but it doesn't feel worth it at this point.
The size of the special drop area is 5px, the same size as the default
GtkPaned handles. This is because the plan is to later use these
handles as drop areas too.
Other changes of interest are:
* We need to take care of "drag-motion", "drag-drop" and widget
highlightning ourselves. We can not use the GtkDestDefaults
conveniences with gtk_drag_dest_set() any longer since we need more
control.
* Make the drop callback pass the insert index directly instead of a
GimpDockSeparator
* Add some GIMP_LOG() debug output for DND
* Disable the GimpDockSeparator code in GimpToolbox
2009-11-30 01:22:12 +08:00
|
|
|
0,
|
2002-03-20 20:57:59 +08:00
|
|
|
dialog_target_table, G_N_ELEMENTS (dialog_target_table),
|
|
|
|
GDK_ACTION_MOVE);
|
2007-09-17 23:40:01 +08:00
|
|
|
g_signal_connect (tab_widget, "drag-leave",
|
|
|
|
G_CALLBACK (gimp_dockbook_tab_drag_leave),
|
|
|
|
dockable);
|
|
|
|
g_signal_connect (tab_widget, "drag-motion",
|
|
|
|
G_CALLBACK (gimp_dockbook_tab_drag_motion),
|
|
|
|
dockable);
|
2005-08-03 17:34:55 +08:00
|
|
|
g_signal_connect (tab_widget, "drag-drop",
|
2004-08-25 01:16:46 +08:00
|
|
|
G_CALLBACK (gimp_dockbook_tab_drag_drop),
|
|
|
|
dockbook);
|
2002-03-20 20:57:59 +08:00
|
|
|
|
|
|
|
return tab_widget;
|
|
|
|
}
|
|
|
|
|
2003-10-06 01:26:21 +08:00
|
|
|
gboolean
|
|
|
|
gimp_dockbook_drop_dockable (GimpDockbook *dockbook,
|
|
|
|
GtkWidget *drag_source)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_DOCKBOOK (dockbook), FALSE);
|
|
|
|
|
|
|
|
if (drag_source)
|
|
|
|
{
|
2009-10-26 06:02:05 +08:00
|
|
|
GimpDockable *dockable =
|
|
|
|
gimp_dockbook_drag_source_to_dockable (drag_source);
|
2003-10-06 01:26:21 +08:00
|
|
|
|
|
|
|
if (dockable)
|
|
|
|
{
|
2006-03-29 03:19:55 +08:00
|
|
|
if (dockable->dockbook == dockbook)
|
2006-04-12 20:49:29 +08:00
|
|
|
{
|
|
|
|
gtk_notebook_reorder_child (GTK_NOTEBOOK (dockbook),
|
2006-03-29 03:19:55 +08:00
|
|
|
GTK_WIDGET (dockable), -1);
|
2006-04-12 20:49:29 +08:00
|
|
|
}
|
|
|
|
else
|
2003-10-06 01:26:21 +08:00
|
|
|
{
|
|
|
|
g_object_ref (dockable);
|
|
|
|
|
|
|
|
gimp_dockbook_remove (dockable->dockbook, dockable);
|
|
|
|
gimp_dockbook_add (dockbook, dockable, -1);
|
|
|
|
|
|
|
|
g_object_unref (dockable);
|
|
|
|
}
|
2006-03-29 03:19:55 +08:00
|
|
|
|
2006-04-12 20:49:29 +08:00
|
|
|
return TRUE;
|
2003-10-06 01:26:21 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
app: Use a GdkWindow instead of GimpDockSeparators for dockable DND
Make drag-and-drop rearrangement of dockables happen directly in the
existing widget hierarchy so we don't have to use special, ugly
widgets (read GimpDockSeparator:s) for that.
More specifically, make edges of dockables and dockbooks have the same
semantics as the GimpDockSeparators had. We put a highlight colored
GdkWindow on top of the widget in question to highlight these special
drop areas. This GdkWindow is not taken into consideration in the GTK+
drag-and-drop code, so it does not interupt the DND interaction.
To achive this, there is a problem we must solve: Drag events in GTK+
are propagated inwards and out, but we sometimes want ancenstor
widgets to take care of drop events. We solve this by introducing the
concept of "drag handlers". A drag handler is asked if it will handle
a given drag event, and if it will, a client will let the drag event
be propagated upwards in the widget hierarchy. Right now, the
GimpPanedBox is the only "drag handler". The code could be generalized
more but it doesn't feel worth it at this point.
The size of the special drop area is 5px, the same size as the default
GtkPaned handles. This is because the plan is to later use these
handles as drop areas too.
Other changes of interest are:
* We need to take care of "drag-motion", "drag-drop" and widget
highlightning ourselves. We can not use the GtkDestDefaults
conveniences with gtk_drag_dest_set() any longer since we need more
control.
* Make the drop callback pass the insert index directly instead of a
GimpDockSeparator
* Add some GIMP_LOG() debug output for DND
* Disable the GimpDockSeparator code in GimpToolbox
2009-11-30 01:22:12 +08:00
|
|
|
/**
|
|
|
|
* gimp_dockable_set_drag_handler:
|
|
|
|
* @dockable:
|
|
|
|
* @handler:
|
|
|
|
*
|
|
|
|
* Set a drag handler that will be asked if it will handle drag events
|
|
|
|
* before the dockbook handles the event itself.
|
|
|
|
**/
|
|
|
|
void
|
|
|
|
gimp_dockbook_set_drag_handler (GimpDockbook *dockbook,
|
|
|
|
GimpPanedBox *drag_handler)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_DOCKBOOK (dockbook));
|
|
|
|
|
|
|
|
dockbook->p->drag_handler = drag_handler;
|
|
|
|
}
|
|
|
|
|
2009-10-26 06:02:05 +08:00
|
|
|
/**
|
|
|
|
* gimp_dockbook_drag_source_to_dockable:
|
|
|
|
* @drag_source: A drag-and-drop source widget
|
|
|
|
*
|
|
|
|
* Gets the dockable associated with a drag-and-drop source. If
|
|
|
|
* successfull, the function will also cleanup the dockable.
|
|
|
|
*
|
|
|
|
* Returns: The dockable
|
|
|
|
**/
|
|
|
|
GimpDockable *
|
|
|
|
gimp_dockbook_drag_source_to_dockable (GtkWidget *drag_source)
|
|
|
|
{
|
|
|
|
GimpDockable *dockable = NULL;
|
|
|
|
|
|
|
|
if (GIMP_IS_DOCKABLE (drag_source))
|
|
|
|
dockable = GIMP_DOCKABLE (drag_source);
|
|
|
|
else
|
|
|
|
dockable = g_object_get_data (G_OBJECT (drag_source),
|
|
|
|
"gimp-dockable");
|
|
|
|
if (dockable)
|
|
|
|
g_object_set_data (G_OBJECT (dockable),
|
|
|
|
"gimp-dock-drag-widget", NULL);
|
|
|
|
|
|
|
|
return dockable;
|
|
|
|
}
|
2007-09-17 23:40:01 +08:00
|
|
|
|
|
|
|
/* tab DND source side */
|
|
|
|
|
2008-05-20 05:11:03 +08:00
|
|
|
static void
|
|
|
|
gimp_dockbook_tab_drag_source_setup (GtkWidget *widget,
|
|
|
|
GimpDockable *dockable)
|
|
|
|
{
|
|
|
|
if (gimp_dockable_is_locked (dockable))
|
|
|
|
{
|
|
|
|
if (widget)
|
|
|
|
gtk_drag_source_unset (widget);
|
|
|
|
|
|
|
|
gtk_drag_source_unset (GTK_WIDGET (dockable));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (widget)
|
|
|
|
gtk_drag_source_set (widget,
|
|
|
|
GDK_BUTTON1_MASK | GDK_BUTTON2_MASK,
|
|
|
|
dialog_target_table,
|
|
|
|
G_N_ELEMENTS (dialog_target_table),
|
|
|
|
GDK_ACTION_MOVE);
|
|
|
|
|
|
|
|
gtk_drag_source_set (GTK_WIDGET (dockable),
|
|
|
|
GDK_BUTTON1_MASK | GDK_BUTTON2_MASK,
|
|
|
|
dialog_target_table,
|
|
|
|
G_N_ELEMENTS (dialog_target_table),
|
|
|
|
GDK_ACTION_MOVE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-04-11 00:03:40 +08:00
|
|
|
static void
|
|
|
|
gimp_dockbook_tab_drag_begin (GtkWidget *widget,
|
2004-08-25 01:16:46 +08:00
|
|
|
GdkDragContext *context,
|
2005-12-30 00:42:45 +08:00
|
|
|
GimpDockable *dockable)
|
2001-04-11 00:03:40 +08:00
|
|
|
{
|
2009-10-25 00:52:48 +08:00
|
|
|
GimpDock *dock;
|
|
|
|
GimpPanedBoxClass *paned_box_class;
|
|
|
|
GtkWidget *window;
|
|
|
|
GtkWidget *view;
|
|
|
|
GtkRequisition requisition;
|
|
|
|
|
|
|
|
dock = GIMP_DOCK (dockable->dockbook->p->dock);
|
|
|
|
paned_box_class = GIMP_PANED_BOX_GET_CLASS (gimp_dock_get_vbox (dock));
|
2001-04-11 00:03:40 +08:00
|
|
|
|
2007-10-16 21:56:34 +08:00
|
|
|
window = gtk_window_new (GTK_WINDOW_POPUP);
|
|
|
|
gtk_window_set_type_hint (GTK_WINDOW (window), GDK_WINDOW_TYPE_HINT_DND);
|
|
|
|
gtk_window_set_screen (GTK_WINDOW (window), gtk_widget_get_screen (widget));
|
|
|
|
|
2008-03-11 00:01:48 +08:00
|
|
|
view = gimp_dockable_get_drag_widget (dockable);
|
2005-12-29 12:05:50 +08:00
|
|
|
gtk_container_add (GTK_CONTAINER (window), view);
|
2004-08-25 01:16:46 +08:00
|
|
|
gtk_widget_show (view);
|
2001-04-11 00:03:40 +08:00
|
|
|
|
2005-12-29 11:48:35 +08:00
|
|
|
gtk_widget_size_request (view, &requisition);
|
|
|
|
|
|
|
|
if (requisition.width < widget->allocation.width)
|
|
|
|
gtk_widget_set_size_request (view, widget->allocation.width, -1);
|
|
|
|
|
2001-04-11 00:03:40 +08:00
|
|
|
gtk_widget_show (window);
|
|
|
|
|
2001-07-25 07:11:30 +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,
|
2005-12-29 12:45:41 +08:00
|
|
|
dockable->drag_x, dockable->drag_y);
|
2005-12-30 00:42:45 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Set the source dockable insensitive to give a visual clue that
|
|
|
|
* it's the dockable that's being dragged around
|
|
|
|
*/
|
|
|
|
gtk_widget_set_sensitive (GTK_WIDGET (dockable), FALSE);
|
2001-04-11 00:03:40 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_dockbook_tab_drag_end (GtkWidget *widget,
|
2004-08-25 01:16:46 +08:00
|
|
|
GdkDragContext *context,
|
2005-12-30 00:42:45 +08:00
|
|
|
GimpDockable *dockable)
|
2001-04-11 00:03:40 +08:00
|
|
|
{
|
2009-10-25 00:52:48 +08:00
|
|
|
GimpDock *dock;
|
|
|
|
GimpPanedBoxClass *paned_box_class;
|
|
|
|
GtkWidget *drag_widget;
|
|
|
|
|
|
|
|
dock = GIMP_DOCK (dockable->dockbook->p->dock);
|
|
|
|
paned_box_class = GIMP_PANED_BOX_GET_CLASS (gimp_dock_get_vbox (dock));
|
|
|
|
drag_widget = g_object_get_data (G_OBJECT (dockable),
|
|
|
|
"gimp-dock-drag-widget");
|
2001-04-11 00:03:40 +08:00
|
|
|
|
2001-07-27 07:35:00 +08:00
|
|
|
/* finding the drag_widget means the drop was not successful, so
|
|
|
|
* pop up a new dock and move the dockable there
|
|
|
|
*/
|
2001-04-11 00:03:40 +08:00
|
|
|
if (drag_widget)
|
|
|
|
{
|
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_object_set_data (G_OBJECT (dockable), "gimp-dock-drag-widget", NULL);
|
2003-10-07 20:24:01 +08:00
|
|
|
gimp_dockable_detach (dockable);
|
2001-04-11 00:03:40 +08:00
|
|
|
}
|
2005-12-30 00:42:45 +08:00
|
|
|
|
2005-12-30 09:37:35 +08:00
|
|
|
dockable->drag_x = GIMP_DOCKABLE_DRAG_OFFSET;
|
|
|
|
dockable->drag_y = GIMP_DOCKABLE_DRAG_OFFSET;
|
2005-12-30 00:42:45 +08:00
|
|
|
gtk_widget_set_sensitive (GTK_WIDGET (dockable), TRUE);
|
2001-04-11 00:03:40 +08:00
|
|
|
}
|
|
|
|
|
2007-09-17 23:40:01 +08:00
|
|
|
|
|
|
|
/* tab DND target side */
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_dockbook_tab_drag_leave (GtkWidget *widget,
|
|
|
|
GdkDragContext *context,
|
|
|
|
guint time,
|
|
|
|
GimpDockable *dockable)
|
|
|
|
{
|
|
|
|
GimpDockbook *dockbook = dockable->dockbook;
|
|
|
|
|
|
|
|
gimp_dockbook_remove_tab_timeout (dockbook);
|
|
|
|
|
2009-11-29 02:12:39 +08:00
|
|
|
gimp_highlight_widget (widget, FALSE);
|
2007-09-17 23:40:01 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gimp_dockbook_tab_drag_motion (GtkWidget *widget,
|
|
|
|
GdkDragContext *context,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
guint time,
|
|
|
|
GimpDockable *dockable)
|
|
|
|
{
|
|
|
|
GimpDockbook *dockbook = dockable->dockbook;
|
|
|
|
GtkTargetList *target_list;
|
|
|
|
GdkAtom target_atom;
|
app: Use a GdkWindow instead of GimpDockSeparators for dockable DND
Make drag-and-drop rearrangement of dockables happen directly in the
existing widget hierarchy so we don't have to use special, ugly
widgets (read GimpDockSeparator:s) for that.
More specifically, make edges of dockables and dockbooks have the same
semantics as the GimpDockSeparators had. We put a highlight colored
GdkWindow on top of the widget in question to highlight these special
drop areas. This GdkWindow is not taken into consideration in the GTK+
drag-and-drop code, so it does not interupt the DND interaction.
To achive this, there is a problem we must solve: Drag events in GTK+
are propagated inwards and out, but we sometimes want ancenstor
widgets to take care of drop events. We solve this by introducing the
concept of "drag handlers". A drag handler is asked if it will handle
a given drag event, and if it will, a client will let the drag event
be propagated upwards in the widget hierarchy. Right now, the
GimpPanedBox is the only "drag handler". The code could be generalized
more but it doesn't feel worth it at this point.
The size of the special drop area is 5px, the same size as the default
GtkPaned handles. This is because the plan is to later use these
handles as drop areas too.
Other changes of interest are:
* We need to take care of "drag-motion", "drag-drop" and widget
highlightning ourselves. We can not use the GtkDestDefaults
conveniences with gtk_drag_dest_set() any longer since we need more
control.
* Make the drop callback pass the insert index directly instead of a
GimpDockSeparator
* Add some GIMP_LOG() debug output for DND
* Disable the GimpDockSeparator code in GimpToolbox
2009-11-30 01:22:12 +08:00
|
|
|
gboolean handle = FALSE;
|
|
|
|
|
|
|
|
/* If the handler will handle the drag, return FALSE */
|
|
|
|
if (gimp_paned_box_will_handle_drag (dockbook->p->drag_handler,
|
|
|
|
widget,
|
|
|
|
context,
|
|
|
|
x, y,
|
|
|
|
time))
|
|
|
|
{
|
|
|
|
handle = FALSE;
|
|
|
|
goto finish;
|
|
|
|
}
|
2007-09-17 23:40:01 +08:00
|
|
|
|
2009-09-13 22:30:09 +08:00
|
|
|
if (! dockbook->p->tab_hover_timeout ||
|
|
|
|
dockbook->p->tab_hover_dockable != dockable)
|
2007-09-17 23:40:01 +08:00
|
|
|
{
|
|
|
|
gint page_num;
|
|
|
|
|
|
|
|
gimp_dockbook_remove_tab_timeout (dockbook);
|
|
|
|
|
|
|
|
page_num = gtk_notebook_page_num (GTK_NOTEBOOK (dockbook),
|
|
|
|
GTK_WIDGET (dockable));
|
|
|
|
|
|
|
|
if (page_num != gtk_notebook_get_current_page (GTK_NOTEBOOK (dockbook)))
|
|
|
|
gimp_dockbook_add_tab_timeout (dockbook, dockable);
|
|
|
|
}
|
|
|
|
|
|
|
|
target_list = gtk_drag_dest_get_target_list (widget);
|
|
|
|
target_atom = gtk_drag_dest_find_target (widget, context, target_list);
|
|
|
|
|
app: Use a GdkWindow instead of GimpDockSeparators for dockable DND
Make drag-and-drop rearrangement of dockables happen directly in the
existing widget hierarchy so we don't have to use special, ugly
widgets (read GimpDockSeparator:s) for that.
More specifically, make edges of dockables and dockbooks have the same
semantics as the GimpDockSeparators had. We put a highlight colored
GdkWindow on top of the widget in question to highlight these special
drop areas. This GdkWindow is not taken into consideration in the GTK+
drag-and-drop code, so it does not interupt the DND interaction.
To achive this, there is a problem we must solve: Drag events in GTK+
are propagated inwards and out, but we sometimes want ancenstor
widgets to take care of drop events. We solve this by introducing the
concept of "drag handlers". A drag handler is asked if it will handle
a given drag event, and if it will, a client will let the drag event
be propagated upwards in the widget hierarchy. Right now, the
GimpPanedBox is the only "drag handler". The code could be generalized
more but it doesn't feel worth it at this point.
The size of the special drop area is 5px, the same size as the default
GtkPaned handles. This is because the plan is to later use these
handles as drop areas too.
Other changes of interest are:
* We need to take care of "drag-motion", "drag-drop" and widget
highlightning ourselves. We can not use the GtkDestDefaults
conveniences with gtk_drag_dest_set() any longer since we need more
control.
* Make the drop callback pass the insert index directly instead of a
GimpDockSeparator
* Add some GIMP_LOG() debug output for DND
* Disable the GimpDockSeparator code in GimpToolbox
2009-11-30 01:22:12 +08:00
|
|
|
handle = gtk_target_list_find (target_list, target_atom, NULL);
|
2007-09-17 23:40:01 +08:00
|
|
|
|
app: Use a GdkWindow instead of GimpDockSeparators for dockable DND
Make drag-and-drop rearrangement of dockables happen directly in the
existing widget hierarchy so we don't have to use special, ugly
widgets (read GimpDockSeparator:s) for that.
More specifically, make edges of dockables and dockbooks have the same
semantics as the GimpDockSeparators had. We put a highlight colored
GdkWindow on top of the widget in question to highlight these special
drop areas. This GdkWindow is not taken into consideration in the GTK+
drag-and-drop code, so it does not interupt the DND interaction.
To achive this, there is a problem we must solve: Drag events in GTK+
are propagated inwards and out, but we sometimes want ancenstor
widgets to take care of drop events. We solve this by introducing the
concept of "drag handlers". A drag handler is asked if it will handle
a given drag event, and if it will, a client will let the drag event
be propagated upwards in the widget hierarchy. Right now, the
GimpPanedBox is the only "drag handler". The code could be generalized
more but it doesn't feel worth it at this point.
The size of the special drop area is 5px, the same size as the default
GtkPaned handles. This is because the plan is to later use these
handles as drop areas too.
Other changes of interest are:
* We need to take care of "drag-motion", "drag-drop" and widget
highlightning ourselves. We can not use the GtkDestDefaults
conveniences with gtk_drag_dest_set() any longer since we need more
control.
* Make the drop callback pass the insert index directly instead of a
GimpDockSeparator
* Add some GIMP_LOG() debug output for DND
* Disable the GimpDockSeparator code in GimpToolbox
2009-11-30 01:22:12 +08:00
|
|
|
finish:
|
|
|
|
gdk_drag_status (context, handle ? GDK_ACTION_MOVE : 0, time);
|
|
|
|
gimp_highlight_widget (widget, handle);
|
|
|
|
return handle;
|
2007-09-17 23:40:01 +08:00
|
|
|
}
|
|
|
|
|
2001-04-11 00:03:40 +08:00
|
|
|
static gboolean
|
|
|
|
gimp_dockbook_tab_drag_drop (GtkWidget *widget,
|
2004-08-25 01:16:46 +08:00
|
|
|
GdkDragContext *context,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
2005-12-30 00:42:45 +08:00
|
|
|
guint time)
|
2001-04-11 00:03:40 +08:00
|
|
|
{
|
|
|
|
GimpDockable *dest_dockable;
|
|
|
|
GtkWidget *source;
|
app: Use a GdkWindow instead of GimpDockSeparators for dockable DND
Make drag-and-drop rearrangement of dockables happen directly in the
existing widget hierarchy so we don't have to use special, ugly
widgets (read GimpDockSeparator:s) for that.
More specifically, make edges of dockables and dockbooks have the same
semantics as the GimpDockSeparators had. We put a highlight colored
GdkWindow on top of the widget in question to highlight these special
drop areas. This GdkWindow is not taken into consideration in the GTK+
drag-and-drop code, so it does not interupt the DND interaction.
To achive this, there is a problem we must solve: Drag events in GTK+
are propagated inwards and out, but we sometimes want ancenstor
widgets to take care of drop events. We solve this by introducing the
concept of "drag handlers". A drag handler is asked if it will handle
a given drag event, and if it will, a client will let the drag event
be propagated upwards in the widget hierarchy. Right now, the
GimpPanedBox is the only "drag handler". The code could be generalized
more but it doesn't feel worth it at this point.
The size of the special drop area is 5px, the same size as the default
GtkPaned handles. This is because the plan is to later use these
handles as drop areas too.
Other changes of interest are:
* We need to take care of "drag-motion", "drag-drop" and widget
highlightning ourselves. We can not use the GtkDestDefaults
conveniences with gtk_drag_dest_set() any longer since we need more
control.
* Make the drop callback pass the insert index directly instead of a
GimpDockSeparator
* Add some GIMP_LOG() debug output for DND
* Disable the GimpDockSeparator code in GimpToolbox
2009-11-30 01:22:12 +08:00
|
|
|
gboolean handle = FALSE;
|
2001-04-11 00:03:40 +08:00
|
|
|
|
2003-10-06 01:26:21 +08:00
|
|
|
dest_dockable = g_object_get_data (G_OBJECT (widget), "gimp-dockable");
|
2001-04-11 00:03:40 +08:00
|
|
|
|
|
|
|
source = gtk_drag_get_source_widget (context);
|
|
|
|
|
app: Use a GdkWindow instead of GimpDockSeparators for dockable DND
Make drag-and-drop rearrangement of dockables happen directly in the
existing widget hierarchy so we don't have to use special, ugly
widgets (read GimpDockSeparator:s) for that.
More specifically, make edges of dockables and dockbooks have the same
semantics as the GimpDockSeparators had. We put a highlight colored
GdkWindow on top of the widget in question to highlight these special
drop areas. This GdkWindow is not taken into consideration in the GTK+
drag-and-drop code, so it does not interupt the DND interaction.
To achive this, there is a problem we must solve: Drag events in GTK+
are propagated inwards and out, but we sometimes want ancenstor
widgets to take care of drop events. We solve this by introducing the
concept of "drag handlers". A drag handler is asked if it will handle
a given drag event, and if it will, a client will let the drag event
be propagated upwards in the widget hierarchy. Right now, the
GimpPanedBox is the only "drag handler". The code could be generalized
more but it doesn't feel worth it at this point.
The size of the special drop area is 5px, the same size as the default
GtkPaned handles. This is because the plan is to later use these
handles as drop areas too.
Other changes of interest are:
* We need to take care of "drag-motion", "drag-drop" and widget
highlightning ourselves. We can not use the GtkDestDefaults
conveniences with gtk_drag_dest_set() any longer since we need more
control.
* Make the drop callback pass the insert index directly instead of a
GimpDockSeparator
* Add some GIMP_LOG() debug output for DND
* Disable the GimpDockSeparator code in GimpToolbox
2009-11-30 01:22:12 +08:00
|
|
|
/* If the handler will handle the drag, return FALSE */
|
|
|
|
if (gimp_paned_box_will_handle_drag (dest_dockable->drag_handler,
|
|
|
|
widget,
|
|
|
|
context,
|
|
|
|
x, y,
|
|
|
|
time))
|
|
|
|
{
|
|
|
|
handle = FALSE;
|
|
|
|
goto finish;
|
|
|
|
}
|
|
|
|
|
2001-05-07 00:14:34 +08:00
|
|
|
if (dest_dockable && source)
|
2001-04-11 00:03:40 +08:00
|
|
|
{
|
2009-10-26 06:02:05 +08:00
|
|
|
GimpDockable *src_dockable =
|
|
|
|
gimp_dockbook_drag_source_to_dockable (source);
|
2001-04-11 00:03:40 +08:00
|
|
|
|
|
|
|
if (src_dockable)
|
2004-08-25 01:16:46 +08:00
|
|
|
{
|
|
|
|
gint dest_index;
|
2001-04-11 00:03:40 +08:00
|
|
|
|
2004-08-25 01:16:46 +08:00
|
|
|
dest_index =
|
|
|
|
gtk_notebook_page_num (GTK_NOTEBOOK (dest_dockable->dockbook),
|
|
|
|
GTK_WIDGET (dest_dockable));
|
2001-04-11 00:03:40 +08:00
|
|
|
|
2004-08-25 01:16:46 +08:00
|
|
|
if (src_dockable->dockbook != dest_dockable->dockbook)
|
|
|
|
{
|
|
|
|
g_object_ref (src_dockable);
|
2001-04-11 00:03:40 +08:00
|
|
|
|
2004-08-25 01:16:46 +08:00
|
|
|
gimp_dockbook_remove (src_dockable->dockbook, src_dockable);
|
|
|
|
gimp_dockbook_add (dest_dockable->dockbook, src_dockable,
|
|
|
|
dest_index);
|
2001-04-11 00:03:40 +08:00
|
|
|
|
2004-08-25 01:16:46 +08:00
|
|
|
g_object_unref (src_dockable);
|
2001-04-11 00:03:40 +08:00
|
|
|
|
app: Use a GdkWindow instead of GimpDockSeparators for dockable DND
Make drag-and-drop rearrangement of dockables happen directly in the
existing widget hierarchy so we don't have to use special, ugly
widgets (read GimpDockSeparator:s) for that.
More specifically, make edges of dockables and dockbooks have the same
semantics as the GimpDockSeparators had. We put a highlight colored
GdkWindow on top of the widget in question to highlight these special
drop areas. This GdkWindow is not taken into consideration in the GTK+
drag-and-drop code, so it does not interupt the DND interaction.
To achive this, there is a problem we must solve: Drag events in GTK+
are propagated inwards and out, but we sometimes want ancenstor
widgets to take care of drop events. We solve this by introducing the
concept of "drag handlers". A drag handler is asked if it will handle
a given drag event, and if it will, a client will let the drag event
be propagated upwards in the widget hierarchy. Right now, the
GimpPanedBox is the only "drag handler". The code could be generalized
more but it doesn't feel worth it at this point.
The size of the special drop area is 5px, the same size as the default
GtkPaned handles. This is because the plan is to later use these
handles as drop areas too.
Other changes of interest are:
* We need to take care of "drag-motion", "drag-drop" and widget
highlightning ourselves. We can not use the GtkDestDefaults
conveniences with gtk_drag_dest_set() any longer since we need more
control.
* Make the drop callback pass the insert index directly instead of a
GimpDockSeparator
* Add some GIMP_LOG() debug output for DND
* Disable the GimpDockSeparator code in GimpToolbox
2009-11-30 01:22:12 +08:00
|
|
|
handle = TRUE;
|
2004-08-25 01:16:46 +08:00
|
|
|
}
|
|
|
|
else if (src_dockable != dest_dockable)
|
|
|
|
{
|
|
|
|
gtk_notebook_reorder_child (GTK_NOTEBOOK (src_dockable->dockbook),
|
|
|
|
GTK_WIDGET (src_dockable),
|
|
|
|
dest_index);
|
2001-04-11 00:03:40 +08:00
|
|
|
|
2003-05-03 19:59:44 +08:00
|
|
|
g_signal_emit (src_dockable->dockbook,
|
|
|
|
dockbook_signals[DOCKABLE_REORDERED], 0,
|
|
|
|
src_dockable);
|
|
|
|
|
app: Use a GdkWindow instead of GimpDockSeparators for dockable DND
Make drag-and-drop rearrangement of dockables happen directly in the
existing widget hierarchy so we don't have to use special, ugly
widgets (read GimpDockSeparator:s) for that.
More specifically, make edges of dockables and dockbooks have the same
semantics as the GimpDockSeparators had. We put a highlight colored
GdkWindow on top of the widget in question to highlight these special
drop areas. This GdkWindow is not taken into consideration in the GTK+
drag-and-drop code, so it does not interupt the DND interaction.
To achive this, there is a problem we must solve: Drag events in GTK+
are propagated inwards and out, but we sometimes want ancenstor
widgets to take care of drop events. We solve this by introducing the
concept of "drag handlers". A drag handler is asked if it will handle
a given drag event, and if it will, a client will let the drag event
be propagated upwards in the widget hierarchy. Right now, the
GimpPanedBox is the only "drag handler". The code could be generalized
more but it doesn't feel worth it at this point.
The size of the special drop area is 5px, the same size as the default
GtkPaned handles. This is because the plan is to later use these
handles as drop areas too.
Other changes of interest are:
* We need to take care of "drag-motion", "drag-drop" and widget
highlightning ourselves. We can not use the GtkDestDefaults
conveniences with gtk_drag_dest_set() any longer since we need more
control.
* Make the drop callback pass the insert index directly instead of a
GimpDockSeparator
* Add some GIMP_LOG() debug output for DND
* Disable the GimpDockSeparator code in GimpToolbox
2009-11-30 01:22:12 +08:00
|
|
|
handle = TRUE;
|
2004-08-25 01:16:46 +08:00
|
|
|
}
|
|
|
|
}
|
2001-04-11 00:03:40 +08:00
|
|
|
}
|
|
|
|
|
app: Use a GdkWindow instead of GimpDockSeparators for dockable DND
Make drag-and-drop rearrangement of dockables happen directly in the
existing widget hierarchy so we don't have to use special, ugly
widgets (read GimpDockSeparator:s) for that.
More specifically, make edges of dockables and dockbooks have the same
semantics as the GimpDockSeparators had. We put a highlight colored
GdkWindow on top of the widget in question to highlight these special
drop areas. This GdkWindow is not taken into consideration in the GTK+
drag-and-drop code, so it does not interupt the DND interaction.
To achive this, there is a problem we must solve: Drag events in GTK+
are propagated inwards and out, but we sometimes want ancenstor
widgets to take care of drop events. We solve this by introducing the
concept of "drag handlers". A drag handler is asked if it will handle
a given drag event, and if it will, a client will let the drag event
be propagated upwards in the widget hierarchy. Right now, the
GimpPanedBox is the only "drag handler". The code could be generalized
more but it doesn't feel worth it at this point.
The size of the special drop area is 5px, the same size as the default
GtkPaned handles. This is because the plan is to later use these
handles as drop areas too.
Other changes of interest are:
* We need to take care of "drag-motion", "drag-drop" and widget
highlightning ourselves. We can not use the GtkDestDefaults
conveniences with gtk_drag_dest_set() any longer since we need more
control.
* Make the drop callback pass the insert index directly instead of a
GimpDockSeparator
* Add some GIMP_LOG() debug output for DND
* Disable the GimpDockSeparator code in GimpToolbox
2009-11-30 01:22:12 +08:00
|
|
|
finish:
|
|
|
|
if (handle)
|
|
|
|
gtk_drag_finish (context, TRUE, TRUE, time);
|
|
|
|
|
|
|
|
return handle;
|
2001-04-11 00:03:40 +08:00
|
|
|
}
|
2003-08-26 18:07:01 +08:00
|
|
|
|
2007-09-17 23:40:01 +08:00
|
|
|
static void
|
|
|
|
gimp_dockbook_add_tab_timeout (GimpDockbook *dockbook,
|
|
|
|
GimpDockable *dockable)
|
|
|
|
{
|
2009-09-13 22:30:09 +08:00
|
|
|
dockbook->p->tab_hover_timeout =
|
2007-09-17 23:40:01 +08:00
|
|
|
g_timeout_add (TAB_HOVER_TIMEOUT,
|
|
|
|
(GSourceFunc) gimp_dockbook_tab_timeout,
|
|
|
|
dockbook);
|
2008-03-11 00:01:48 +08:00
|
|
|
|
2009-09-13 22:30:09 +08:00
|
|
|
dockbook->p->tab_hover_dockable = dockable;
|
2007-09-17 23:40:01 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_dockbook_remove_tab_timeout (GimpDockbook *dockbook)
|
|
|
|
{
|
2009-09-13 22:30:09 +08:00
|
|
|
if (dockbook->p->tab_hover_timeout)
|
2007-09-17 23:40:01 +08:00
|
|
|
{
|
2009-09-13 22:30:09 +08:00
|
|
|
g_source_remove (dockbook->p->tab_hover_timeout);
|
|
|
|
dockbook->p->tab_hover_timeout = 0;
|
|
|
|
dockbook->p->tab_hover_dockable = NULL;
|
2007-09-17 23:40:01 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gimp_dockbook_tab_timeout (GimpDockbook *dockbook)
|
|
|
|
{
|
|
|
|
gint page_num;
|
|
|
|
|
|
|
|
GDK_THREADS_ENTER ();
|
|
|
|
|
|
|
|
page_num = gtk_notebook_page_num (GTK_NOTEBOOK (dockbook),
|
2009-09-13 22:30:09 +08:00
|
|
|
GTK_WIDGET (dockbook->p->tab_hover_dockable));
|
2007-09-17 23:40:01 +08:00
|
|
|
gtk_notebook_set_current_page (GTK_NOTEBOOK (dockbook), page_num);
|
|
|
|
|
2009-09-13 22:30:09 +08:00
|
|
|
dockbook->p->tab_hover_timeout = 0;
|
|
|
|
dockbook->p->tab_hover_dockable = NULL;
|
2007-09-17 23:40:01 +08:00
|
|
|
|
|
|
|
GDK_THREADS_LEAVE ();
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2008-05-20 05:11:03 +08:00
|
|
|
static void
|
|
|
|
gimp_dockbook_tab_locked_notify (GimpDockable *dockable,
|
|
|
|
GParamSpec *pspec,
|
|
|
|
GimpDockbook *dockbook)
|
|
|
|
{
|
|
|
|
GtkWidget *tab_widget;
|
|
|
|
|
|
|
|
tab_widget = gtk_notebook_get_tab_label (GTK_NOTEBOOK (dockbook),
|
|
|
|
GTK_WIDGET (dockable));
|
|
|
|
|
|
|
|
gimp_dockbook_tab_drag_source_setup (tab_widget, dockable);
|
|
|
|
}
|
|
|
|
|
2003-08-26 18:07:01 +08:00
|
|
|
static void
|
|
|
|
gimp_dockbook_help_func (const gchar *help_id,
|
|
|
|
gpointer help_data)
|
|
|
|
{
|
2008-05-20 05:11:03 +08:00
|
|
|
GimpDockbook *dockbook = GIMP_DOCKBOOK (help_data);
|
2003-08-26 18:07:01 +08:00
|
|
|
GtkWidget *dockable;
|
|
|
|
gint page_num;
|
|
|
|
|
|
|
|
page_num = gtk_notebook_get_current_page (GTK_NOTEBOOK (dockbook));
|
|
|
|
|
|
|
|
dockable = gtk_notebook_get_nth_page (GTK_NOTEBOOK (dockbook), page_num);
|
|
|
|
|
|
|
|
if (GIMP_IS_DOCKABLE (dockable))
|
|
|
|
gimp_standard_help_func (GIMP_DOCKABLE (dockable)->help_id, NULL);
|
|
|
|
else
|
|
|
|
gimp_standard_help_func (GIMP_HELP_DOCK, NULL);
|
|
|
|
}
|