2006-12-10 05:33:38 +08:00
|
|
|
/* GIMP - The GNU Image Manipulation Program
|
2001-04-07 22:44:12 +08:00
|
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
*
|
|
|
|
* gimpdockable.c
|
2003-10-11 05:24:12 +08:00
|
|
|
* Copyright (C) 2001-2003 Michael Natterer <mitch@gimp.org>
|
2001-04-07 22:44:12 +08:00
|
|
|
*
|
2009-01-18 06:28:01 +08:00
|
|
|
* This program is free software: you can redistribute it and/or modify
|
2001-04-07 22:44:12 +08:00
|
|
|
* it under the terms of the GNU General Public License as published by
|
2009-01-18 06:28:01 +08:00
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
2001-04-07 22:44:12 +08:00
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2009-01-18 06:28:01 +08:00
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2001-04-07 22:44:12 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
2008-05-20 05:11:03 +08:00
|
|
|
#include <string.h>
|
|
|
|
|
2001-04-07 22:44:12 +08:00
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
2003-08-26 09:30:05 +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
|
|
|
|
2009-12-11 02:26:23 +08:00
|
|
|
#include "menus/menus.h"
|
|
|
|
|
2001-05-09 10:32:03 +08:00
|
|
|
#include "core/gimpcontext.h"
|
|
|
|
|
2003-10-07 20:24:01 +08:00
|
|
|
#include "gimpdialogfactory.h"
|
2003-10-06 01:26:21 +08:00
|
|
|
#include "gimpdnd.h"
|
2003-10-08 23:44:35 +08:00
|
|
|
#include "gimpdock.h"
|
2001-04-07 22:44:12 +08:00
|
|
|
#include "gimpdockable.h"
|
2001-04-16 00:16:13 +08:00
|
|
|
#include "gimpdockbook.h"
|
2003-10-11 05:24:12 +08:00
|
|
|
#include "gimpdocked.h"
|
2009-09-26 22:21:10 +08:00
|
|
|
#include "gimpdockwindow.h"
|
2004-08-18 17:53:38 +08:00
|
|
|
#include "gimphelp-ids.h"
|
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 "gimppanedbox.h"
|
2008-05-20 05:11:03 +08:00
|
|
|
#include "gimpsessioninfo-aux.h"
|
2004-04-23 01:14:22 +08:00
|
|
|
#include "gimpuimanager.h"
|
2003-10-01 02:50:55 +08:00
|
|
|
#include "gimpwidgets-utils.h"
|
2001-04-07 22:44:12 +08:00
|
|
|
|
2003-10-19 06:12:32 +08:00
|
|
|
#include "gimp-intl.h"
|
|
|
|
|
2001-04-07 22:44:12 +08:00
|
|
|
|
2008-05-20 05:11:03 +08:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
PROP_0,
|
|
|
|
PROP_LOCKED
|
|
|
|
};
|
|
|
|
|
2010-01-05 07:30:10 +08:00
|
|
|
|
|
|
|
struct _GimpDockablePrivate
|
|
|
|
{
|
|
|
|
gchar *name;
|
|
|
|
gchar *blurb;
|
|
|
|
gchar *stock_id;
|
|
|
|
gchar *help_id;
|
|
|
|
GimpTabStyle tab_style;
|
2010-06-12 05:18:49 +08:00
|
|
|
GimpTabStyle actual_tab_style;
|
2010-01-05 07:30:10 +08:00
|
|
|
gboolean locked;
|
|
|
|
|
|
|
|
GimpDockbook *dockbook;
|
|
|
|
|
|
|
|
GimpContext *context;
|
|
|
|
|
|
|
|
guint blink_timeout_id;
|
|
|
|
gint blink_counter;
|
|
|
|
|
|
|
|
GimpPanedBox *drag_handler;
|
|
|
|
|
|
|
|
/* drag icon hotspot */
|
|
|
|
gint drag_x;
|
|
|
|
gint drag_y;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2010-10-15 20:08:36 +08:00
|
|
|
static void gimp_dockable_dispose (GObject *object);
|
2008-05-20 05:11:03 +08:00
|
|
|
static void gimp_dockable_set_property (GObject *object,
|
|
|
|
guint property_id,
|
|
|
|
const GValue *value,
|
|
|
|
GParamSpec *pspec);
|
|
|
|
static void gimp_dockable_get_property (GObject *object,
|
|
|
|
guint property_id,
|
|
|
|
GValue *value,
|
|
|
|
GParamSpec *pspec);
|
2010-10-15 20:08:36 +08:00
|
|
|
|
2003-10-11 05:24:12 +08:00
|
|
|
static void gimp_dockable_size_request (GtkWidget *widget,
|
|
|
|
GtkRequisition *requisition);
|
|
|
|
static void gimp_dockable_size_allocate (GtkWidget *widget,
|
|
|
|
GtkAllocation *allocation);
|
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_dockable_drag_leave (GtkWidget *widget,
|
|
|
|
GdkDragContext *context,
|
|
|
|
guint time);
|
|
|
|
static gboolean gimp_dockable_drag_motion (GtkWidget *widget,
|
|
|
|
GdkDragContext *context,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
guint time);
|
2003-10-11 05:24:12 +08:00
|
|
|
static gboolean gimp_dockable_drag_drop (GtkWidget *widget,
|
|
|
|
GdkDragContext *context,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
guint time);
|
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
|
|
|
|
2003-10-11 05:24:12 +08:00
|
|
|
static void gimp_dockable_style_set (GtkWidget *widget,
|
|
|
|
GtkStyle *prev_style);
|
|
|
|
|
2003-10-21 22:49:12 +08:00
|
|
|
static void gimp_dockable_add (GtkContainer *container,
|
|
|
|
GtkWidget *widget);
|
2003-10-11 05:24:12 +08:00
|
|
|
static GType gimp_dockable_child_type (GtkContainer *container);
|
2010-05-23 02:11:43 +08:00
|
|
|
static GimpTabStyle
|
|
|
|
gimp_dockable_convert_tab_style (GimpDockable *dockable,
|
|
|
|
GimpTabStyle tab_style);
|
2005-01-18 23:18:35 +08:00
|
|
|
static gboolean gimp_dockable_blink_timeout (GimpDockable *dockable);
|
2001-04-07 22:44:12 +08:00
|
|
|
|
2001-08-04 03:43:19 +08:00
|
|
|
|
2006-05-15 17:46:31 +08:00
|
|
|
G_DEFINE_TYPE (GimpDockable, gimp_dockable, GTK_TYPE_BIN)
|
2001-04-07 22:44:12 +08:00
|
|
|
|
2005-12-20 06:37:49 +08:00
|
|
|
#define parent_class gimp_dockable_parent_class
|
2003-10-06 01:26:21 +08:00
|
|
|
|
2006-04-06 20:43:58 +08:00
|
|
|
static const GtkTargetEntry dialog_target_table[] = { GIMP_TARGET_DIALOG };
|
2001-04-07 22:44:12 +08:00
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_dockable_class_init (GimpDockableClass *klass)
|
|
|
|
{
|
2010-10-15 20:08:36 +08:00
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
|
|
|
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
|
|
|
|
GtkContainerClass *container_class = GTK_CONTAINER_CLASS (klass);
|
2001-04-07 22:44:12 +08:00
|
|
|
|
2010-10-15 20:08:36 +08:00
|
|
|
object_class->dispose = gimp_dockable_dispose;
|
2008-05-20 05:11:03 +08:00
|
|
|
object_class->set_property = gimp_dockable_set_property;
|
|
|
|
object_class->get_property = gimp_dockable_get_property;
|
|
|
|
|
2003-04-12 00:51:49 +08:00
|
|
|
widget_class->size_request = gimp_dockable_size_request;
|
|
|
|
widget_class->size_allocate = gimp_dockable_size_allocate;
|
|
|
|
widget_class->style_set = gimp_dockable_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_dockable_drag_leave;
|
|
|
|
widget_class->drag_motion = gimp_dockable_drag_motion;
|
2003-10-06 01:26:21 +08:00
|
|
|
widget_class->drag_drop = gimp_dockable_drag_drop;
|
2003-09-22 03:35:54 +08:00
|
|
|
|
2003-10-21 22:49:12 +08:00
|
|
|
container_class->add = gimp_dockable_add;
|
2003-10-11 05:24:12 +08:00
|
|
|
container_class->child_type = gimp_dockable_child_type;
|
2001-08-04 03:43:19 +08:00
|
|
|
|
2008-05-20 05:11:03 +08:00
|
|
|
g_object_class_install_property (object_class, PROP_LOCKED,
|
|
|
|
g_param_spec_boolean ("locked", NULL, NULL,
|
|
|
|
FALSE,
|
|
|
|
GIMP_PARAM_READWRITE));
|
|
|
|
|
2001-08-04 03:43:19 +08:00
|
|
|
gtk_widget_class_install_style_property (widget_class,
|
2005-05-28 00:51:39 +08:00
|
|
|
g_param_spec_int ("content-border",
|
2001-08-04 03:43:19 +08:00
|
|
|
NULL, NULL,
|
|
|
|
0,
|
|
|
|
G_MAXINT,
|
|
|
|
0,
|
2006-01-19 04:29:40 +08:00
|
|
|
GIMP_PARAM_READABLE));
|
2010-01-05 07:30:10 +08:00
|
|
|
|
|
|
|
g_type_class_add_private (klass, sizeof (GimpDockablePrivate));
|
2001-04-07 22:44:12 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_dockable_init (GimpDockable *dockable)
|
|
|
|
{
|
2010-01-05 07:30:10 +08:00
|
|
|
dockable->p = G_TYPE_INSTANCE_GET_PRIVATE (dockable,
|
|
|
|
GIMP_TYPE_DOCKABLE,
|
|
|
|
GimpDockablePrivate);
|
2010-06-12 05:18:49 +08:00
|
|
|
dockable->p->tab_style = GIMP_TAB_STYLE_AUTOMATIC;
|
|
|
|
dockable->p->actual_tab_style = GIMP_TAB_STYLE_UNDEFINED;
|
|
|
|
dockable->p->drag_x = GIMP_DOCKABLE_DRAG_OFFSET;
|
|
|
|
dockable->p->drag_y = GIMP_DOCKABLE_DRAG_OFFSET;
|
2005-12-29 11:12:26 +08:00
|
|
|
|
2003-10-06 01:26:21 +08:00
|
|
|
gtk_drag_dest_set (GTK_WIDGET (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
|
|
|
0,
|
2003-10-06 01:26:21 +08:00
|
|
|
dialog_target_table, G_N_ELEMENTS (dialog_target_table),
|
|
|
|
GDK_ACTION_MOVE);
|
2001-04-07 22:44:12 +08:00
|
|
|
}
|
|
|
|
|
2010-10-15 20:08:36 +08:00
|
|
|
static void
|
|
|
|
gimp_dockable_dispose (GObject *object)
|
|
|
|
{
|
|
|
|
GimpDockable *dockable = GIMP_DOCKABLE (object);
|
|
|
|
|
|
|
|
gimp_dockable_blink_cancel (dockable);
|
|
|
|
|
|
|
|
if (dockable->p->context)
|
|
|
|
gimp_dockable_set_context (dockable, NULL);
|
|
|
|
|
|
|
|
if (dockable->p->blurb)
|
|
|
|
{
|
|
|
|
if (dockable->p->blurb != dockable->p->name)
|
|
|
|
g_free (dockable->p->blurb);
|
|
|
|
|
|
|
|
dockable->p->blurb = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (dockable->p->name)
|
|
|
|
{
|
|
|
|
g_free (dockable->p->name);
|
|
|
|
dockable->p->name = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (dockable->p->stock_id)
|
|
|
|
{
|
|
|
|
g_free (dockable->p->stock_id);
|
|
|
|
dockable->p->stock_id = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (dockable->p->help_id)
|
|
|
|
{
|
|
|
|
g_free (dockable->p->help_id);
|
|
|
|
dockable->p->help_id = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
G_OBJECT_CLASS (parent_class)->dispose (object);
|
|
|
|
}
|
|
|
|
|
2008-05-20 05:11:03 +08:00
|
|
|
static void
|
|
|
|
gimp_dockable_set_property (GObject *object,
|
|
|
|
guint property_id,
|
|
|
|
const GValue *value,
|
|
|
|
GParamSpec *pspec)
|
|
|
|
{
|
|
|
|
GimpDockable *dockable = GIMP_DOCKABLE (object);
|
|
|
|
|
|
|
|
switch (property_id)
|
|
|
|
{
|
|
|
|
case PROP_LOCKED:
|
|
|
|
gimp_dockable_set_locked (dockable, g_value_get_boolean (value));
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_dockable_get_property (GObject *object,
|
|
|
|
guint property_id,
|
|
|
|
GValue *value,
|
|
|
|
GParamSpec *pspec)
|
|
|
|
{
|
|
|
|
GimpDockable *dockable = GIMP_DOCKABLE (object);
|
|
|
|
|
|
|
|
switch (property_id)
|
|
|
|
{
|
|
|
|
case PROP_LOCKED:
|
2010-01-05 07:30:10 +08:00
|
|
|
g_value_set_boolean (value, dockable->p->locked);
|
2008-05-20 05:11:03 +08:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-04-12 00:51:49 +08:00
|
|
|
static void
|
|
|
|
gimp_dockable_size_request (GtkWidget *widget,
|
|
|
|
GtkRequisition *requisition)
|
|
|
|
{
|
2004-09-01 05:29:30 +08:00
|
|
|
GtkContainer *container = GTK_CONTAINER (widget);
|
2008-03-13 00:58:28 +08:00
|
|
|
GtkWidget *child = gtk_bin_get_child (GTK_BIN (widget));
|
2004-09-01 05:29:30 +08:00
|
|
|
GtkRequisition child_requisition;
|
2008-06-28 23:50:27 +08:00
|
|
|
gint border_width;
|
2003-04-12 00:51:49 +08:00
|
|
|
|
2008-06-28 23:50:27 +08:00
|
|
|
border_width = gtk_container_get_border_width (container);
|
|
|
|
|
|
|
|
requisition->width = border_width * 2;
|
|
|
|
requisition->height = border_width * 2;
|
2003-09-22 03:35:54 +08:00
|
|
|
|
2009-10-18 02:20:39 +08:00
|
|
|
if (child && gtk_widget_get_visible (child))
|
2003-09-22 03:35:54 +08:00
|
|
|
{
|
2008-03-13 00:58:28 +08:00
|
|
|
gtk_widget_size_request (child, &child_requisition);
|
2003-04-12 00:51:49 +08:00
|
|
|
|
|
|
|
requisition->width += child_requisition.width;
|
|
|
|
requisition->height += child_requisition.height;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_dockable_size_allocate (GtkWidget *widget,
|
|
|
|
GtkAllocation *allocation)
|
|
|
|
{
|
2004-09-01 05:29:30 +08:00
|
|
|
GtkContainer *container = GTK_CONTAINER (widget);
|
2008-03-13 00:58:28 +08:00
|
|
|
GtkWidget *child = gtk_bin_get_child (GTK_BIN (widget));
|
2004-09-01 05:29:30 +08:00
|
|
|
|
2003-09-22 03:35:54 +08:00
|
|
|
GtkRequisition button_requisition = { 0, };
|
|
|
|
GtkAllocation child_allocation;
|
2008-06-28 23:50:27 +08:00
|
|
|
gint border_width;
|
2003-09-22 03:35:54 +08:00
|
|
|
|
2010-05-27 00:10:31 +08:00
|
|
|
|
2010-01-15 22:33:08 +08:00
|
|
|
gtk_widget_set_allocation (widget, allocation);
|
2003-04-12 00:51:49 +08:00
|
|
|
|
2008-06-28 23:50:27 +08:00
|
|
|
border_width = gtk_container_get_border_width (container);
|
|
|
|
|
2009-10-18 02:20:39 +08:00
|
|
|
if (child && gtk_widget_get_visible (child))
|
2003-09-22 03:35:54 +08:00
|
|
|
{
|
2008-06-28 23:50:27 +08:00
|
|
|
child_allocation.x = allocation->x + border_width;
|
|
|
|
child_allocation.y = allocation->y + border_width;
|
2003-04-12 00:51:49 +08:00
|
|
|
child_allocation.width = MAX (allocation->width -
|
2008-06-28 23:50:27 +08:00
|
|
|
border_width * 2,
|
2003-04-12 00:51:49 +08:00
|
|
|
0);
|
|
|
|
child_allocation.height = MAX (allocation->height -
|
2008-06-28 23:50:27 +08:00
|
|
|
border_width * 2 -
|
2003-09-22 03:35:54 +08:00
|
|
|
button_requisition.height,
|
2003-04-12 00:51:49 +08:00
|
|
|
0);
|
|
|
|
|
2003-09-22 03:35:54 +08:00
|
|
|
child_allocation.y += button_requisition.height;
|
|
|
|
|
2008-03-13 00:58:28 +08:00
|
|
|
gtk_widget_size_allocate (child, &child_allocation);
|
2003-04-12 00:51:49 +08:00
|
|
|
}
|
2003-10-06 01:26:21 +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_dockable_drag_leave (GtkWidget *widget,
|
|
|
|
GdkDragContext *context,
|
|
|
|
guint time)
|
|
|
|
{
|
|
|
|
gimp_highlight_widget (widget, FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gimp_dockable_drag_motion (GtkWidget *widget,
|
|
|
|
GdkDragContext *context,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
guint time)
|
|
|
|
{
|
|
|
|
GimpDockable *dockable = GIMP_DOCKABLE (widget);
|
|
|
|
gboolean other_will_handle = FALSE;
|
|
|
|
|
2010-01-05 07:30:10 +08:00
|
|
|
other_will_handle = gimp_paned_box_will_handle_drag (dockable->p->drag_handler,
|
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,
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2003-10-06 01:26:21 +08:00
|
|
|
static gboolean
|
|
|
|
gimp_dockable_drag_drop (GtkWidget *widget,
|
|
|
|
GdkDragContext *context,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
guint time)
|
|
|
|
{
|
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
|
|
|
GimpDockable *dockable = GIMP_DOCKABLE (widget);
|
|
|
|
gboolean handled = FALSE;
|
|
|
|
|
2010-01-05 07:30:10 +08:00
|
|
|
if (gimp_paned_box_will_handle_drag (dockable->p->drag_handler,
|
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,
|
|
|
|
context,
|
|
|
|
x, y,
|
|
|
|
time))
|
|
|
|
{
|
|
|
|
/* Make event fall through to the drag handler */
|
|
|
|
handled = FALSE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
handled =
|
2010-01-05 07:30:10 +08:00
|
|
|
gimp_dockbook_drop_dockable (GIMP_DOCKABLE (widget)->p->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
|
|
|
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-04-12 00:51:49 +08:00
|
|
|
}
|
|
|
|
|
2001-08-04 03:43:19 +08:00
|
|
|
static void
|
|
|
|
gimp_dockable_style_set (GtkWidget *widget,
|
2004-09-01 05:29:30 +08:00
|
|
|
GtkStyle *prev_style)
|
2001-08-04 03:43:19 +08:00
|
|
|
{
|
2010-05-27 00:10:31 +08:00
|
|
|
gint content_border;
|
2001-08-04 03:43:19 +08:00
|
|
|
|
2008-03-30 07:43:39 +08:00
|
|
|
GTK_WIDGET_CLASS (parent_class)->style_set (widget, prev_style);
|
2007-11-14 22:42:05 +08:00
|
|
|
|
2001-08-04 03:43:19 +08:00
|
|
|
gtk_widget_style_get (widget,
|
2005-05-28 00:51:39 +08:00
|
|
|
"content-border", &content_border,
|
2004-09-01 05:29:30 +08:00
|
|
|
NULL);
|
2001-08-04 03:43:19 +08:00
|
|
|
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (widget), content_border);
|
2003-12-12 03:34:37 +08:00
|
|
|
}
|
|
|
|
|
2003-09-24 00:17:25 +08:00
|
|
|
|
2003-10-21 22:49:12 +08:00
|
|
|
static void
|
|
|
|
gimp_dockable_add (GtkContainer *container,
|
|
|
|
GtkWidget *widget)
|
|
|
|
{
|
2005-03-26 05:58:48 +08:00
|
|
|
GimpDockable *dockable;
|
|
|
|
|
2008-03-13 00:58:28 +08:00
|
|
|
g_return_if_fail (gtk_bin_get_child (GTK_BIN (container)) == NULL);
|
2003-10-21 22:49:12 +08:00
|
|
|
|
|
|
|
GTK_CONTAINER_CLASS (parent_class)->add (container, widget);
|
|
|
|
|
2005-03-26 05:58:48 +08:00
|
|
|
/* not all tab styles are supported by all children */
|
|
|
|
dockable = GIMP_DOCKABLE (container);
|
2010-01-05 07:30:10 +08:00
|
|
|
gimp_dockable_set_tab_style (dockable, dockable->p->tab_style);
|
2003-10-21 22:49:12 +08:00
|
|
|
}
|
|
|
|
|
2003-10-11 05:24:12 +08:00
|
|
|
static GType
|
|
|
|
gimp_dockable_child_type (GtkContainer *container)
|
|
|
|
{
|
2008-03-13 00:58:28 +08:00
|
|
|
if (gtk_bin_get_child (GTK_BIN (container)))
|
2003-10-11 05:24:12 +08:00
|
|
|
return G_TYPE_NONE;
|
|
|
|
|
|
|
|
return GIMP_TYPE_DOCKED;
|
|
|
|
}
|
|
|
|
|
2008-03-11 00:01:48 +08:00
|
|
|
static GtkWidget *
|
2010-04-18 23:42:26 +08:00
|
|
|
gimp_dockable_new_tab_widget_internal (GimpDockable *dockable,
|
2008-03-11 00:01:48 +08:00
|
|
|
GimpContext *context,
|
|
|
|
GimpTabStyle tab_style,
|
|
|
|
GtkIconSize size,
|
|
|
|
gboolean dnd)
|
|
|
|
{
|
|
|
|
GtkWidget *tab_widget = NULL;
|
|
|
|
GtkWidget *label = NULL;
|
|
|
|
GtkWidget *icon = NULL;
|
|
|
|
|
|
|
|
switch (tab_style)
|
|
|
|
{
|
|
|
|
case GIMP_TAB_STYLE_NAME:
|
|
|
|
case GIMP_TAB_STYLE_ICON_NAME:
|
|
|
|
case GIMP_TAB_STYLE_PREVIEW_NAME:
|
2010-01-05 07:30:10 +08:00
|
|
|
label = gtk_label_new (dockable->p->name);
|
2008-03-11 00:01:48 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_TAB_STYLE_BLURB:
|
|
|
|
case GIMP_TAB_STYLE_ICON_BLURB:
|
|
|
|
case GIMP_TAB_STYLE_PREVIEW_BLURB:
|
2010-01-05 07:30:10 +08:00
|
|
|
label = gtk_label_new (dockable->p->blurb);
|
2008-03-11 00:01:48 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (tab_style)
|
|
|
|
{
|
|
|
|
case GIMP_TAB_STYLE_ICON:
|
|
|
|
case GIMP_TAB_STYLE_ICON_NAME:
|
|
|
|
case GIMP_TAB_STYLE_ICON_BLURB:
|
2008-08-22 16:57:11 +08:00
|
|
|
icon = gimp_dockable_get_icon (dockable, size);
|
2008-03-11 00:01:48 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_TAB_STYLE_PREVIEW:
|
|
|
|
case GIMP_TAB_STYLE_PREVIEW_NAME:
|
|
|
|
case GIMP_TAB_STYLE_PREVIEW_BLURB:
|
2008-03-13 00:58:28 +08:00
|
|
|
{
|
|
|
|
GtkWidget *child = gtk_bin_get_child (GTK_BIN (dockable));
|
2008-03-11 00:01:48 +08:00
|
|
|
|
2008-03-13 00:58:28 +08:00
|
|
|
if (child)
|
|
|
|
icon = gimp_docked_get_preview (GIMP_DOCKED (child),
|
|
|
|
context, size);
|
|
|
|
|
|
|
|
if (! icon)
|
2008-08-22 16:57:11 +08:00
|
|
|
icon = gimp_dockable_get_icon (dockable, size);
|
2008-03-13 00:58:28 +08:00
|
|
|
}
|
2008-03-11 00:01:48 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (label && dnd)
|
|
|
|
gimp_label_set_attributes (GTK_LABEL (label),
|
|
|
|
PANGO_ATTR_WEIGHT, PANGO_WEIGHT_SEMIBOLD,
|
|
|
|
-1);
|
|
|
|
|
|
|
|
switch (tab_style)
|
|
|
|
{
|
|
|
|
case GIMP_TAB_STYLE_ICON:
|
|
|
|
case GIMP_TAB_STYLE_PREVIEW:
|
|
|
|
tab_widget = icon;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_TAB_STYLE_NAME:
|
|
|
|
case GIMP_TAB_STYLE_BLURB:
|
|
|
|
tab_widget = label;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_TAB_STYLE_ICON_NAME:
|
|
|
|
case GIMP_TAB_STYLE_ICON_BLURB:
|
|
|
|
case GIMP_TAB_STYLE_PREVIEW_NAME:
|
|
|
|
case GIMP_TAB_STYLE_PREVIEW_BLURB:
|
|
|
|
tab_widget = gtk_hbox_new (FALSE, dnd ? 6 : 2);
|
|
|
|
|
|
|
|
gtk_box_pack_start (GTK_BOX (tab_widget), icon, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (icon);
|
|
|
|
|
|
|
|
gtk_box_pack_start (GTK_BOX (tab_widget), label, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (label);
|
|
|
|
break;
|
2010-06-12 05:18:49 +08:00
|
|
|
|
|
|
|
case GIMP_TAB_STYLE_UNDEFINED:
|
|
|
|
case GIMP_TAB_STYLE_AUTOMATIC:
|
|
|
|
g_warning ("Tab style error, unexpected code path taken, fix!");
|
|
|
|
break;
|
2008-03-11 00:01:48 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return tab_widget;
|
|
|
|
}
|
2005-01-18 23:18:35 +08:00
|
|
|
|
|
|
|
/* public functions */
|
|
|
|
|
2001-04-07 22:44:12 +08:00
|
|
|
GtkWidget *
|
2003-10-11 05:24:12 +08:00
|
|
|
gimp_dockable_new (const gchar *name,
|
2004-09-01 05:29:30 +08:00
|
|
|
const gchar *blurb,
|
2003-10-11 05:24:12 +08:00
|
|
|
const gchar *stock_id,
|
|
|
|
const gchar *help_id)
|
2001-04-07 22:44:12 +08:00
|
|
|
{
|
2001-04-11 00:03:40 +08:00
|
|
|
GimpDockable *dockable;
|
|
|
|
|
2001-04-07 22:44:12 +08:00
|
|
|
g_return_val_if_fail (name != NULL, NULL);
|
2003-07-08 23:07:56 +08:00
|
|
|
g_return_val_if_fail (stock_id != NULL, NULL);
|
2003-08-25 22:18:33 +08:00
|
|
|
g_return_val_if_fail (help_id != NULL, NULL);
|
2001-04-11 00:03:40 +08:00
|
|
|
|
2001-08-10 22:41:39 +08:00
|
|
|
dockable = g_object_new (GIMP_TYPE_DOCKABLE, NULL);
|
2001-04-11 00:03:40 +08:00
|
|
|
|
2010-01-05 07:30:10 +08:00
|
|
|
dockable->p->name = g_strdup (name);
|
|
|
|
dockable->p->stock_id = g_strdup (stock_id);
|
|
|
|
dockable->p->help_id = g_strdup (help_id);
|
2001-04-11 00:03:40 +08:00
|
|
|
|
2003-10-01 02:50:55 +08:00
|
|
|
if (blurb)
|
2010-01-05 07:30:10 +08:00
|
|
|
dockable->p->blurb = g_strdup (blurb);
|
2003-10-01 02:50:55 +08:00
|
|
|
else
|
2010-01-05 07:30:10 +08:00
|
|
|
dockable->p->blurb = dockable->p->name;
|
2003-10-01 02:50:55 +08:00
|
|
|
|
2003-08-26 09:30:05 +08:00
|
|
|
gimp_help_set_help_data (GTK_WIDGET (dockable), NULL, help_id);
|
|
|
|
|
2001-04-11 00:03:40 +08:00
|
|
|
return GTK_WIDGET (dockable);
|
|
|
|
}
|
|
|
|
|
2010-01-05 07:30:10 +08:00
|
|
|
void
|
|
|
|
gimp_dockable_set_dockbook (GimpDockable *dockable,
|
|
|
|
GimpDockbook *dockbook)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_DOCKABLE (dockable));
|
2010-01-05 17:28:16 +08:00
|
|
|
g_return_if_fail (dockbook == NULL ||
|
|
|
|
GIMP_IS_DOCKBOOK (dockbook));
|
2010-01-05 07:30:10 +08:00
|
|
|
|
|
|
|
dockable->p->dockbook = dockbook;
|
|
|
|
}
|
|
|
|
|
|
|
|
GimpDockbook *
|
|
|
|
gimp_dockable_get_dockbook (GimpDockable *dockable)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_DOCKABLE (dockable), NULL);
|
|
|
|
|
|
|
|
return dockable->p->dockbook;
|
|
|
|
}
|
|
|
|
|
|
|
|
GimpTabStyle
|
|
|
|
gimp_dockable_get_tab_style (GimpDockable *dockable)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_DOCKABLE (dockable), -1);
|
|
|
|
|
|
|
|
return dockable->p->tab_style;
|
|
|
|
}
|
|
|
|
|
2010-06-12 05:18:49 +08:00
|
|
|
/**
|
|
|
|
* gimp_dockable_get_actual_tab_style:
|
|
|
|
* @dockable:
|
|
|
|
*
|
|
|
|
* Get actual tab style, i.e. never "automatic". This state should
|
|
|
|
* actually be hold on a per-dockbook basis, but at this point that
|
|
|
|
* feels like over-engineering...
|
|
|
|
**/
|
|
|
|
GimpTabStyle
|
|
|
|
gimp_dockable_get_actual_tab_style (GimpDockable *dockable)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_DOCKABLE (dockable), -1);
|
|
|
|
|
|
|
|
return dockable->p->actual_tab_style;
|
|
|
|
}
|
|
|
|
|
2010-01-05 07:30:10 +08:00
|
|
|
const gchar *
|
|
|
|
gimp_dockable_get_name (GimpDockable *dockable)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_DOCKABLE (dockable), NULL);
|
|
|
|
|
|
|
|
return dockable->p->name;
|
|
|
|
}
|
|
|
|
|
|
|
|
const gchar *
|
|
|
|
gimp_dockable_get_blurb (GimpDockable *dockable)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_DOCKABLE (dockable), NULL);
|
|
|
|
|
|
|
|
return dockable->p->blurb;
|
|
|
|
}
|
|
|
|
|
|
|
|
const gchar *
|
|
|
|
gimp_dockable_get_help_id (GimpDockable *dockable)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_DOCKABLE (dockable), NULL);
|
|
|
|
|
|
|
|
return dockable->p->help_id;
|
|
|
|
}
|
|
|
|
|
2010-05-27 00:10:31 +08:00
|
|
|
const gchar *
|
|
|
|
gimp_dockable_get_stock_id (GimpDockable *dockable)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_DOCKABLE (dockable), NULL);
|
|
|
|
|
|
|
|
return dockable->p->stock_id;
|
|
|
|
}
|
|
|
|
|
|
|
|
GtkWidget *
|
|
|
|
gimp_dockable_get_icon (GimpDockable *dockable,
|
|
|
|
GtkIconSize size)
|
|
|
|
{
|
|
|
|
GdkScreen *screen = gtk_widget_get_screen (GTK_WIDGET (dockable));
|
|
|
|
GtkIconTheme *theme = gtk_icon_theme_get_for_screen (screen);
|
|
|
|
|
|
|
|
if (gtk_icon_theme_has_icon (theme, dockable->p->stock_id))
|
|
|
|
{
|
|
|
|
return gtk_image_new_from_icon_name (dockable->p->stock_id, size);
|
|
|
|
}
|
|
|
|
|
|
|
|
return gtk_image_new_from_stock (dockable->p->stock_id, size);
|
|
|
|
}
|
|
|
|
|
2010-01-05 07:30:10 +08:00
|
|
|
gboolean
|
|
|
|
gimp_dockable_get_locked (GimpDockable *dockable)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_DOCKABLE (dockable), FALSE);
|
|
|
|
|
|
|
|
return dockable->p->locked;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gimp_dockable_set_drag_pos (GimpDockable *dockable,
|
|
|
|
gint drag_x,
|
|
|
|
gint drag_y)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_DOCKABLE (dockable));
|
|
|
|
|
|
|
|
dockable->p->drag_x = drag_x;
|
|
|
|
dockable->p->drag_y = drag_y;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gimp_dockable_get_drag_pos (GimpDockable *dockable,
|
|
|
|
gint *drag_x,
|
|
|
|
gint *drag_y)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_DOCKABLE (dockable));
|
|
|
|
|
|
|
|
if (drag_x != NULL)
|
|
|
|
*drag_x = dockable->p->drag_x;
|
|
|
|
if (drag_y != NULL)
|
|
|
|
*drag_y = dockable->p->drag_y;
|
|
|
|
}
|
|
|
|
|
|
|
|
GimpPanedBox *
|
|
|
|
gimp_dockable_get_drag_handler (GimpDockable *dockable)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_DOCKABLE (dockable), NULL);
|
|
|
|
|
|
|
|
return dockable->p->drag_handler;
|
|
|
|
}
|
2008-05-20 05:11:03 +08:00
|
|
|
|
2003-10-10 23:59:12 +08:00
|
|
|
void
|
|
|
|
gimp_dockable_set_aux_info (GimpDockable *dockable,
|
|
|
|
GList *aux_info)
|
|
|
|
{
|
2008-03-13 00:58:28 +08:00
|
|
|
GtkWidget *child;
|
|
|
|
|
2003-10-10 23:59:12 +08:00
|
|
|
g_return_if_fail (GIMP_IS_DOCKABLE (dockable));
|
|
|
|
|
2008-03-13 00:58:28 +08:00
|
|
|
child = gtk_bin_get_child (GTK_BIN (dockable));
|
|
|
|
|
|
|
|
if (child)
|
|
|
|
gimp_docked_set_aux_info (GIMP_DOCKED (child), aux_info);
|
2003-10-10 23:59:12 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
GList *
|
|
|
|
gimp_dockable_get_aux_info (GimpDockable *dockable)
|
|
|
|
{
|
2008-03-13 00:58:28 +08:00
|
|
|
GtkWidget *child;
|
|
|
|
|
2003-10-10 23:59:12 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_DOCKABLE (dockable), NULL);
|
|
|
|
|
2008-03-13 00:58:28 +08:00
|
|
|
child = gtk_bin_get_child (GTK_BIN (dockable));
|
2003-10-11 05:24:12 +08:00
|
|
|
|
2008-03-13 00:58:28 +08:00
|
|
|
if (child)
|
|
|
|
return gimp_docked_get_aux_info (GIMP_DOCKED (child));
|
2003-10-11 05:24:12 +08:00
|
|
|
|
|
|
|
return NULL;
|
2003-10-10 23:59:12 +08:00
|
|
|
}
|
|
|
|
|
2008-05-20 05:11:03 +08:00
|
|
|
|
|
|
|
void
|
|
|
|
gimp_dockable_set_locked (GimpDockable *dockable,
|
|
|
|
gboolean lock)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_DOCKABLE (dockable));
|
|
|
|
|
2010-01-05 07:30:10 +08:00
|
|
|
if (dockable->p->locked != lock)
|
2008-05-20 05:11:03 +08:00
|
|
|
{
|
2010-01-05 07:30:10 +08:00
|
|
|
dockable->p->locked = lock ? TRUE : FALSE;
|
2008-05-20 05:11:03 +08:00
|
|
|
|
|
|
|
g_object_notify (G_OBJECT (dockable), "locked");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
|
|
|
gimp_dockable_is_locked (GimpDockable *dockable)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_DOCKABLE (dockable), FALSE);
|
|
|
|
|
2010-01-05 07:30:10 +08:00
|
|
|
return dockable->p->locked;
|
2008-05-20 05:11:03 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-06-01 20:31:44 +08:00
|
|
|
void
|
|
|
|
gimp_dockable_set_tab_style (GimpDockable *dockable,
|
|
|
|
GimpTabStyle tab_style)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_DOCKABLE (dockable));
|
|
|
|
|
2010-05-23 02:11:43 +08:00
|
|
|
dockable->p->tab_style = gimp_dockable_convert_tab_style (dockable, tab_style);
|
2010-06-12 05:18:49 +08:00
|
|
|
|
|
|
|
if (tab_style == GIMP_TAB_STYLE_AUTOMATIC)
|
|
|
|
gimp_dockable_set_actual_tab_style (dockable, GIMP_TAB_STYLE_UNDEFINED);
|
|
|
|
else
|
|
|
|
gimp_dockable_set_actual_tab_style (dockable, tab_style);
|
|
|
|
|
|
|
|
if (dockable->p->dockbook)
|
|
|
|
gimp_dockbook_update_auto_tab_style (dockable->p->dockbook);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_dockable_set_actual_tab_style:
|
|
|
|
* @dockable:
|
|
|
|
* @tab_style:
|
|
|
|
*
|
|
|
|
* Sets actual tab style, meant for those that decides what
|
|
|
|
* "automatic" tab style means.
|
|
|
|
*
|
|
|
|
* Returns: %TRUE if changed, %FALSE otherwise.
|
|
|
|
**/
|
|
|
|
gboolean
|
|
|
|
gimp_dockable_set_actual_tab_style (GimpDockable *dockable,
|
|
|
|
GimpTabStyle tab_style)
|
|
|
|
{
|
|
|
|
GimpTabStyle new_tab_style = gimp_dockable_convert_tab_style (dockable, tab_style);
|
|
|
|
GimpTabStyle old_tab_style = dockable->p->actual_tab_style;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GIMP_IS_DOCKABLE (dockable), FALSE);
|
|
|
|
g_return_val_if_fail (tab_style != GIMP_TAB_STYLE_AUTOMATIC, FALSE);
|
|
|
|
|
|
|
|
dockable->p->actual_tab_style = new_tab_style;
|
|
|
|
|
|
|
|
return new_tab_style != old_tab_style;
|
2004-06-01 20:31:44 +08:00
|
|
|
}
|
|
|
|
|
2001-04-11 00:03:40 +08:00
|
|
|
GtkWidget *
|
2010-04-19 10:32:18 +08:00
|
|
|
gimp_dockable_create_tab_widget (GimpDockable *dockable,
|
|
|
|
GimpContext *context,
|
|
|
|
GimpTabStyle tab_style,
|
|
|
|
GtkIconSize size)
|
2001-08-04 03:43:19 +08:00
|
|
|
{
|
2003-10-11 05:24:12 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_DOCKABLE (dockable), NULL);
|
|
|
|
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
|
|
|
|
|
2010-04-18 23:42:26 +08:00
|
|
|
return gimp_dockable_new_tab_widget_internal (dockable, context,
|
2008-03-11 00:01:48 +08:00
|
|
|
tab_style, size, FALSE);
|
|
|
|
}
|
2003-07-08 23:07:56 +08:00
|
|
|
|
2008-03-11 00:01:48 +08:00
|
|
|
GtkWidget *
|
2010-04-19 10:32:18 +08:00
|
|
|
gimp_dockable_create_drag_widget (GimpDockable *dockable)
|
2008-03-11 00:01:48 +08:00
|
|
|
{
|
|
|
|
GtkWidget *frame;
|
|
|
|
GtkWidget *widget;
|
2003-07-08 23:07:56 +08:00
|
|
|
|
2008-03-11 00:01:48 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_DOCKABLE (dockable), NULL);
|
2003-07-08 23:07:56 +08:00
|
|
|
|
2008-03-11 00:01:48 +08:00
|
|
|
frame = gtk_frame_new (NULL);
|
|
|
|
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_OUT);
|
2003-07-08 23:07:56 +08:00
|
|
|
|
2010-04-18 23:42:26 +08:00
|
|
|
widget = gimp_dockable_new_tab_widget_internal (dockable,
|
2010-01-05 07:30:10 +08:00
|
|
|
dockable->p->context,
|
2008-03-11 00:01:48 +08:00
|
|
|
GIMP_TAB_STYLE_ICON_BLURB,
|
|
|
|
GTK_ICON_SIZE_DND,
|
|
|
|
TRUE);
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (widget), 6);
|
|
|
|
gtk_container_add (GTK_CONTAINER (frame), widget);
|
|
|
|
gtk_widget_show (widget);
|
2002-05-10 22:50:27 +08:00
|
|
|
|
2008-03-11 00:01:48 +08:00
|
|
|
return frame;
|
2001-04-07 22:44:12 +08:00
|
|
|
}
|
2001-04-24 00:58:18 +08:00
|
|
|
|
2003-10-11 05:24:12 +08:00
|
|
|
void
|
|
|
|
gimp_dockable_set_context (GimpDockable *dockable,
|
|
|
|
GimpContext *context)
|
2001-04-24 00:58:18 +08:00
|
|
|
{
|
2003-10-11 05:24:12 +08:00
|
|
|
g_return_if_fail (GIMP_IS_DOCKABLE (dockable));
|
|
|
|
g_return_if_fail (context == NULL || GIMP_IS_CONTEXT (context));
|
|
|
|
|
2010-01-05 07:30:10 +08:00
|
|
|
if (context != dockable->p->context)
|
2003-10-11 05:24:12 +08:00
|
|
|
{
|
2008-03-13 00:58:28 +08:00
|
|
|
GtkWidget *child = gtk_bin_get_child (GTK_BIN (dockable));
|
|
|
|
|
|
|
|
if (child)
|
|
|
|
gimp_docked_set_context (GIMP_DOCKED (child), context);
|
2001-08-04 03:43:19 +08:00
|
|
|
|
2010-01-05 07:30:10 +08:00
|
|
|
dockable->p->context = context;
|
2004-05-23 18:04:41 +08:00
|
|
|
}
|
2001-04-24 00:58:18 +08:00
|
|
|
}
|
2003-09-22 03:35:54 +08:00
|
|
|
|
2004-04-29 20:52:29 +08:00
|
|
|
GimpUIManager *
|
|
|
|
gimp_dockable_get_menu (GimpDockable *dockable,
|
|
|
|
const gchar **ui_path,
|
|
|
|
gpointer *popup_data)
|
2003-09-22 03:35:54 +08:00
|
|
|
{
|
2008-03-13 00:58:28 +08:00
|
|
|
GtkWidget *child;
|
|
|
|
|
2003-10-11 05:24:12 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_DOCKABLE (dockable), NULL);
|
2004-04-29 20:52:29 +08:00
|
|
|
g_return_val_if_fail (ui_path != NULL, NULL);
|
2004-04-23 01:14:22 +08:00
|
|
|
g_return_val_if_fail (popup_data != NULL, NULL);
|
2003-10-11 05:24:12 +08:00
|
|
|
|
2008-03-13 00:58:28 +08:00
|
|
|
child = gtk_bin_get_child (GTK_BIN (dockable));
|
|
|
|
|
|
|
|
if (child)
|
|
|
|
return gimp_docked_get_menu (GIMP_DOCKED (child), ui_path, popup_data);
|
2003-09-22 03:35:54 +08:00
|
|
|
|
|
|
|
return 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_dockable_set_drag_handler:
|
|
|
|
* @dockable:
|
|
|
|
* @handler:
|
|
|
|
*
|
|
|
|
* Set a drag handler that will be asked if it will handle drag events
|
|
|
|
* before the dockable handles the event itself.
|
|
|
|
**/
|
|
|
|
void
|
|
|
|
gimp_dockable_set_drag_handler (GimpDockable *dockable,
|
|
|
|
GimpPanedBox *handler)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_DOCKABLE (dockable));
|
|
|
|
|
2010-01-05 07:30:10 +08:00
|
|
|
dockable->p->drag_handler = handler;
|
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
|
|
|
}
|
|
|
|
|
2003-10-11 05:24:12 +08:00
|
|
|
void
|
|
|
|
gimp_dockable_detach (GimpDockable *dockable)
|
|
|
|
{
|
2009-12-06 04:20:18 +08:00
|
|
|
GimpDockWindow *src_dock_window = NULL;
|
|
|
|
GimpDock *src_dock = NULL;
|
|
|
|
GtkWidget *dock = NULL;
|
|
|
|
GimpDockWindow *dock_window = NULL;
|
|
|
|
GtkWidget *dockbook = NULL;
|
2003-10-11 05:24:12 +08:00
|
|
|
|
|
|
|
g_return_if_fail (GIMP_IS_DOCKABLE (dockable));
|
2010-01-05 07:30:10 +08:00
|
|
|
g_return_if_fail (GIMP_IS_DOCKBOOK (dockable->p->dockbook));
|
2003-10-11 05:24:12 +08:00
|
|
|
|
2010-01-05 07:30:10 +08:00
|
|
|
src_dock = gimp_dockbook_get_dock (dockable->p->dockbook);
|
2009-12-06 04:20:18 +08:00
|
|
|
src_dock_window = gimp_dock_window_from_dock (src_dock);
|
2003-10-11 05:24:12 +08:00
|
|
|
|
2010-03-01 06:20:57 +08:00
|
|
|
dock = gimp_dock_with_window_new (gimp_dialog_factory_get_singleton (),
|
2010-02-20 23:55:35 +08:00
|
|
|
gtk_widget_get_screen (GTK_WIDGET (dockable)),
|
|
|
|
FALSE /*toolbox*/);
|
2009-09-26 22:21:10 +08:00
|
|
|
dock_window = gimp_dock_window_from_dock (GIMP_DOCK (dock));
|
|
|
|
gtk_window_set_position (GTK_WINDOW (dock_window), GTK_WIN_POS_MOUSE);
|
2009-12-11 02:26:23 +08:00
|
|
|
if (src_dock_window)
|
|
|
|
gimp_dock_window_setup (dock_window, src_dock_window);
|
2003-10-11 05:24:12 +08:00
|
|
|
|
2009-12-11 02:26:23 +08:00
|
|
|
dockbook = gimp_dockbook_new (global_menu_factory);
|
2003-10-11 05:24:12 +08:00
|
|
|
|
|
|
|
gimp_dock_add_book (GIMP_DOCK (dock), GIMP_DOCKBOOK (dockbook), 0);
|
|
|
|
|
|
|
|
g_object_ref (dockable);
|
|
|
|
|
2010-01-05 07:30:10 +08:00
|
|
|
gimp_dockbook_remove (dockable->p->dockbook, dockable);
|
2003-10-11 05:24:12 +08:00
|
|
|
gimp_dockbook_add (GIMP_DOCKBOOK (dockbook), dockable, 0);
|
|
|
|
|
|
|
|
g_object_unref (dockable);
|
|
|
|
|
2009-09-26 22:21:10 +08:00
|
|
|
gtk_widget_show (GTK_WIDGET (dock_window));
|
2003-10-11 05:24:12 +08:00
|
|
|
gtk_widget_show (dock);
|
|
|
|
}
|
|
|
|
|
2005-01-18 23:18:35 +08:00
|
|
|
void
|
|
|
|
gimp_dockable_blink (GimpDockable *dockable)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_DOCKABLE (dockable));
|
|
|
|
|
2010-01-05 07:30:10 +08:00
|
|
|
if (dockable->p->blink_timeout_id)
|
|
|
|
g_source_remove (dockable->p->blink_timeout_id);
|
2005-01-18 23:18:35 +08:00
|
|
|
|
2010-01-05 07:30:10 +08:00
|
|
|
dockable->p->blink_timeout_id =
|
2005-12-29 07:43:53 +08:00
|
|
|
g_timeout_add (150, (GSourceFunc) gimp_dockable_blink_timeout, dockable);
|
2005-01-18 23:18:35 +08:00
|
|
|
|
2010-05-27 00:10:31 +08:00
|
|
|
gimp_highlight_widget (GTK_WIDGET (dockable), TRUE);
|
2005-01-18 23:18:35 +08:00
|
|
|
}
|
|
|
|
|
2005-07-14 01:03:44 +08:00
|
|
|
void
|
|
|
|
gimp_dockable_blink_cancel (GimpDockable *dockable)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_DOCKABLE (dockable));
|
|
|
|
|
2010-01-05 07:30:10 +08:00
|
|
|
if (dockable->p->blink_timeout_id)
|
2005-07-14 01:03:44 +08:00
|
|
|
{
|
2010-01-05 07:30:10 +08:00
|
|
|
g_source_remove (dockable->p->blink_timeout_id);
|
2005-12-29 07:43:53 +08:00
|
|
|
|
2010-01-05 07:30:10 +08:00
|
|
|
dockable->p->blink_timeout_id = 0;
|
|
|
|
dockable->p->blink_counter = 0;
|
2005-12-29 07:43:53 +08:00
|
|
|
|
2010-05-27 00:10:31 +08:00
|
|
|
gimp_highlight_widget (GTK_WIDGET (dockable), FALSE);
|
2005-07-14 01:03:44 +08:00
|
|
|
}
|
|
|
|
}
|
2005-01-18 23:18:35 +08:00
|
|
|
|
2008-05-20 05:11:03 +08:00
|
|
|
|
2005-01-18 23:18:35 +08:00
|
|
|
/* private functions */
|
|
|
|
|
2010-05-23 02:11:43 +08:00
|
|
|
static GimpTabStyle
|
|
|
|
gimp_dockable_convert_tab_style (GimpDockable *dockable,
|
|
|
|
GimpTabStyle tab_style)
|
|
|
|
{
|
|
|
|
GtkWidget *child = gtk_bin_get_child (GTK_BIN (dockable));
|
|
|
|
|
|
|
|
if (child && ! GIMP_DOCKED_GET_INTERFACE (child)->get_preview)
|
2010-06-12 04:38:34 +08:00
|
|
|
tab_style = gimp_preview_tab_style_to_icon (tab_style);
|
2010-05-23 02:11:43 +08:00
|
|
|
|
|
|
|
return tab_style;
|
|
|
|
}
|
|
|
|
|
2005-01-18 23:18:35 +08:00
|
|
|
static gboolean
|
|
|
|
gimp_dockable_blink_timeout (GimpDockable *dockable)
|
|
|
|
{
|
2010-05-27 00:10:31 +08:00
|
|
|
gimp_highlight_widget (GTK_WIDGET (dockable),
|
|
|
|
dockable->p->blink_counter % 2 == 1);
|
|
|
|
dockable->p->blink_counter++;
|
|
|
|
|
|
|
|
if (dockable->p->blink_counter == 3)
|
2005-01-18 23:18:35 +08:00
|
|
|
{
|
2010-01-05 07:30:10 +08:00
|
|
|
dockable->p->blink_timeout_id = 0;
|
|
|
|
dockable->p->blink_counter = 0;
|
2005-01-18 23:18:35 +08:00
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|