gimp/app/widgets/gimpdockable.c

960 lines
27 KiB
C
Raw Normal View History

/* GIMP - The GNU Image Manipulation Program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* gimpdockable.c
* Copyright (C) 2001-2003 Michael Natterer <mitch@gimp.org>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include <string.h>
#include <gtk/gtk.h>
#include "libgimpwidgets/gimpwidgets.h"
#include "widgets-types.h"
#include "menus/menus.h"
#include "core/gimpcontext.h"
#include "gimpdialogfactory.h"
#include "gimpdnd.h"
#include "gimpdock.h"
#include "gimpdockable.h"
#include "gimpdockbook.h"
#include "gimpdocked.h"
#include "gimpdockwindow.h"
#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"
#include "gimpsessioninfo-aux.h"
#include "gimpuimanager.h"
#include "gimpwidgets-utils.h"
#include "gimp-intl.h"
enum
{
PROP_0,
PROP_LOCKED
};
struct _GimpDockablePrivate
{
gchar *name;
gchar *blurb;
gchar *stock_id;
gchar *help_id;
GimpTabStyle tab_style;
GimpTabStyle actual_tab_style;
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;
};
static void gimp_dockable_dispose (GObject *object);
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);
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);
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
static void gimp_dockable_style_set (GtkWidget *widget,
GtkStyle *prev_style);
static void gimp_dockable_add (GtkContainer *container,
GtkWidget *widget);
static GType gimp_dockable_child_type (GtkContainer *container);
static GimpTabStyle
gimp_dockable_convert_tab_style (GimpDockable *dockable,
GimpTabStyle tab_style);
static gboolean gimp_dockable_blink_timeout (GimpDockable *dockable);
set style properties for dockables. 2001-08-03 Michael Natterer <mitch@gimp.org> * gtkrc: set style properties for dockables. * app/main.c: some #if 0'ed code for mem profiling. * app/gui/commands.[ch] * app/gui/menus.c: added a mem profiling menu entry + callback. * app/gui/palette-editor.c: added a #warning as reminder, use gtk_dialog_set_has_separator(). * app/widgets/gimpcontainereditor.[ch] * app/widgets/gimpcontainerview.[ch] * app/widgets/gimpdockable.[ch] * app/widgets/gimpdrawablelistview.[ch]: added some style properties to set GimpDockable and friends' borders and spacings. * libgimpwidgets/gimppixmap.[ch] * libgimpwidgets/gimpsizeentry.[ch] * libgimpwidgets/gimpunitmenu.[ch]: GObject stuff, cleanup. * app/docindex.c * app/errorconsole.c * app/gdisplay_color_ui.c * app/gimpprogress.c * app/module_db.c * app/undo_history.c * app/user_install.c * app/gui/channels-commands.c * app/gui/gradient-editor.c * app/gui/info-window.c * app/gui/tips-dialog.c * app/tools/gimpbrightnesscontrasttool.c * app/tools/gimpbycolorselecttool.c * app/tools/gimpcolorbalancetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.c * app/tools/gimpcurvestool.c * app/tools/gimphistogramtool.c * app/tools/gimphuesaturationtool.c * app/tools/gimplevelstool.c * app/tools/gimpmeasuretool.c * app/tools/gimpposterizetool.c * app/tools/gimpthresholdtool.c * app/widgets/gimpdatafactoryview.c * libgimp/gimpexport.c * modules/cdisplay_gamma.c * modules/cdisplay_highcontrast.c * plug-ins/[lots of files]: Some perl mass processing applying s/_("Foo")/GTK_STOCK_FOO/g, minor manual cleanup in some files.
2001-08-04 03:43:19 +08:00
G_DEFINE_TYPE (GimpDockable, gimp_dockable, GTK_TYPE_BIN)
#define parent_class gimp_dockable_parent_class
static const GtkTargetEntry dialog_target_table[] = { GIMP_TARGET_DIALOG };
static void
gimp_dockable_class_init (GimpDockableClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
GtkContainerClass *container_class = GTK_CONTAINER_CLASS (klass);
object_class->dispose = gimp_dockable_dispose;
object_class->set_property = gimp_dockable_set_property;
object_class->get_property = gimp_dockable_get_property;
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;
widget_class->drag_drop = gimp_dockable_drag_drop;
container_class->add = gimp_dockable_add;
container_class->child_type = gimp_dockable_child_type;
set style properties for dockables. 2001-08-03 Michael Natterer <mitch@gimp.org> * gtkrc: set style properties for dockables. * app/main.c: some #if 0'ed code for mem profiling. * app/gui/commands.[ch] * app/gui/menus.c: added a mem profiling menu entry + callback. * app/gui/palette-editor.c: added a #warning as reminder, use gtk_dialog_set_has_separator(). * app/widgets/gimpcontainereditor.[ch] * app/widgets/gimpcontainerview.[ch] * app/widgets/gimpdockable.[ch] * app/widgets/gimpdrawablelistview.[ch]: added some style properties to set GimpDockable and friends' borders and spacings. * libgimpwidgets/gimppixmap.[ch] * libgimpwidgets/gimpsizeentry.[ch] * libgimpwidgets/gimpunitmenu.[ch]: GObject stuff, cleanup. * app/docindex.c * app/errorconsole.c * app/gdisplay_color_ui.c * app/gimpprogress.c * app/module_db.c * app/undo_history.c * app/user_install.c * app/gui/channels-commands.c * app/gui/gradient-editor.c * app/gui/info-window.c * app/gui/tips-dialog.c * app/tools/gimpbrightnesscontrasttool.c * app/tools/gimpbycolorselecttool.c * app/tools/gimpcolorbalancetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.c * app/tools/gimpcurvestool.c * app/tools/gimphistogramtool.c * app/tools/gimphuesaturationtool.c * app/tools/gimplevelstool.c * app/tools/gimpmeasuretool.c * app/tools/gimpposterizetool.c * app/tools/gimpthresholdtool.c * app/widgets/gimpdatafactoryview.c * libgimp/gimpexport.c * modules/cdisplay_gamma.c * modules/cdisplay_highcontrast.c * plug-ins/[lots of files]: Some perl mass processing applying s/_("Foo")/GTK_STOCK_FOO/g, minor manual cleanup in some files.
2001-08-04 03:43:19 +08:00
g_object_class_install_property (object_class, PROP_LOCKED,
g_param_spec_boolean ("locked", NULL, NULL,
FALSE,
GIMP_PARAM_READWRITE));
set style properties for dockables. 2001-08-03 Michael Natterer <mitch@gimp.org> * gtkrc: set style properties for dockables. * app/main.c: some #if 0'ed code for mem profiling. * app/gui/commands.[ch] * app/gui/menus.c: added a mem profiling menu entry + callback. * app/gui/palette-editor.c: added a #warning as reminder, use gtk_dialog_set_has_separator(). * app/widgets/gimpcontainereditor.[ch] * app/widgets/gimpcontainerview.[ch] * app/widgets/gimpdockable.[ch] * app/widgets/gimpdrawablelistview.[ch]: added some style properties to set GimpDockable and friends' borders and spacings. * libgimpwidgets/gimppixmap.[ch] * libgimpwidgets/gimpsizeentry.[ch] * libgimpwidgets/gimpunitmenu.[ch]: GObject stuff, cleanup. * app/docindex.c * app/errorconsole.c * app/gdisplay_color_ui.c * app/gimpprogress.c * app/module_db.c * app/undo_history.c * app/user_install.c * app/gui/channels-commands.c * app/gui/gradient-editor.c * app/gui/info-window.c * app/gui/tips-dialog.c * app/tools/gimpbrightnesscontrasttool.c * app/tools/gimpbycolorselecttool.c * app/tools/gimpcolorbalancetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.c * app/tools/gimpcurvestool.c * app/tools/gimphistogramtool.c * app/tools/gimphuesaturationtool.c * app/tools/gimplevelstool.c * app/tools/gimpmeasuretool.c * app/tools/gimpposterizetool.c * app/tools/gimpthresholdtool.c * app/widgets/gimpdatafactoryview.c * libgimp/gimpexport.c * modules/cdisplay_gamma.c * modules/cdisplay_highcontrast.c * plug-ins/[lots of files]: Some perl mass processing applying s/_("Foo")/GTK_STOCK_FOO/g, minor manual cleanup in some files.
2001-08-04 03:43:19 +08:00
gtk_widget_class_install_style_property (widget_class,
g_param_spec_int ("content-border",
set style properties for dockables. 2001-08-03 Michael Natterer <mitch@gimp.org> * gtkrc: set style properties for dockables. * app/main.c: some #if 0'ed code for mem profiling. * app/gui/commands.[ch] * app/gui/menus.c: added a mem profiling menu entry + callback. * app/gui/palette-editor.c: added a #warning as reminder, use gtk_dialog_set_has_separator(). * app/widgets/gimpcontainereditor.[ch] * app/widgets/gimpcontainerview.[ch] * app/widgets/gimpdockable.[ch] * app/widgets/gimpdrawablelistview.[ch]: added some style properties to set GimpDockable and friends' borders and spacings. * libgimpwidgets/gimppixmap.[ch] * libgimpwidgets/gimpsizeentry.[ch] * libgimpwidgets/gimpunitmenu.[ch]: GObject stuff, cleanup. * app/docindex.c * app/errorconsole.c * app/gdisplay_color_ui.c * app/gimpprogress.c * app/module_db.c * app/undo_history.c * app/user_install.c * app/gui/channels-commands.c * app/gui/gradient-editor.c * app/gui/info-window.c * app/gui/tips-dialog.c * app/tools/gimpbrightnesscontrasttool.c * app/tools/gimpbycolorselecttool.c * app/tools/gimpcolorbalancetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.c * app/tools/gimpcurvestool.c * app/tools/gimphistogramtool.c * app/tools/gimphuesaturationtool.c * app/tools/gimplevelstool.c * app/tools/gimpmeasuretool.c * app/tools/gimpposterizetool.c * app/tools/gimpthresholdtool.c * app/widgets/gimpdatafactoryview.c * libgimp/gimpexport.c * modules/cdisplay_gamma.c * modules/cdisplay_highcontrast.c * plug-ins/[lots of files]: Some perl mass processing applying s/_("Foo")/GTK_STOCK_FOO/g, minor manual cleanup in some files.
2001-08-04 03:43:19 +08:00
NULL, NULL,
0,
G_MAXINT,
0,
GIMP_PARAM_READABLE));
g_type_class_add_private (klass, sizeof (GimpDockablePrivate));
}
static void
gimp_dockable_init (GimpDockable *dockable)
{
dockable->p = G_TYPE_INSTANCE_GET_PRIVATE (dockable,
GIMP_TYPE_DOCKABLE,
GimpDockablePrivate);
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;
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,
dialog_target_table, G_N_ELEMENTS (dialog_target_table),
GDK_ACTION_MOVE);
}
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);
}
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:
g_value_set_boolean (value, dockable->p->locked);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
}
}
static void
gimp_dockable_size_request (GtkWidget *widget,
GtkRequisition *requisition)
{
GtkContainer *container = GTK_CONTAINER (widget);
GtkWidget *child = gtk_bin_get_child (GTK_BIN (widget));
GtkRequisition child_requisition;
app/widgets/gimpactionview.c app/widgets/gimpblobeditor.c 2008-06-28 Michael Natterer <mitch@gimp.org> * app/widgets/gimpactionview.c * app/widgets/gimpblobeditor.c * app/widgets/gimpbrushfactoryview.c * app/widgets/gimpbrushselect.c * app/widgets/gimpcellrendererdashes.c * app/widgets/gimpcellrendererviewable.c * app/widgets/gimpcolorbar.c * app/widgets/gimpcoloreditor.c * app/widgets/gimpcolorframe.c * app/widgets/gimpcomponenteditor.c * app/widgets/gimpcontainerbox.c * app/widgets/gimpcontainergridview.c * app/widgets/gimpcontainerpopup.c * app/widgets/gimpcontainertreeview.c * app/widgets/gimpcurveview.c * app/widgets/gimpdasheditor.c * app/widgets/gimpdatafactoryview.c * app/widgets/gimpdock.c * app/widgets/gimpdockable.c * app/widgets/gimpdockseparator.c * app/widgets/gimpfgbgeditor.c * app/widgets/gimpfgbgview.c * app/widgets/gimpgradienteditor.c * app/widgets/gimphandlebar.c * app/widgets/gimphistogrambox.c * app/widgets/gimphistogramview.c * app/widgets/gimpitemtreeview.c * app/widgets/gimpmenudock.c * app/widgets/gimpmessagebox.c * app/widgets/gimppaletteview.c * app/widgets/gimpscalebutton.c * app/widgets/gimpsessioninfo-book.c * app/widgets/gimpsessioninfo-dock.c * app/widgets/gimpsettingseditor.c * app/widgets/gimpstrokeeditor.c * app/widgets/gimptemplateeditor.c * app/widgets/gimptemplateview.c * app/widgets/gimpthumbbox.c * app/widgets/gimptoolbox.c * app/widgets/gimptooloptionseditor.c * app/widgets/gimptoolview.c * app/widgets/gimpuimanager.c * app/widgets/gimpviewabledialog.c * app/widgets/gimpviewrenderervectors.c * app/widgets/gimpwidgets-utils.c: use accessors instead of accessing members of GTK+ widgets directly. svn path=/trunk/; revision=26008
2008-06-28 23:50:27 +08:00
gint border_width;
app/widgets/gimpactionview.c app/widgets/gimpblobeditor.c 2008-06-28 Michael Natterer <mitch@gimp.org> * app/widgets/gimpactionview.c * app/widgets/gimpblobeditor.c * app/widgets/gimpbrushfactoryview.c * app/widgets/gimpbrushselect.c * app/widgets/gimpcellrendererdashes.c * app/widgets/gimpcellrendererviewable.c * app/widgets/gimpcolorbar.c * app/widgets/gimpcoloreditor.c * app/widgets/gimpcolorframe.c * app/widgets/gimpcomponenteditor.c * app/widgets/gimpcontainerbox.c * app/widgets/gimpcontainergridview.c * app/widgets/gimpcontainerpopup.c * app/widgets/gimpcontainertreeview.c * app/widgets/gimpcurveview.c * app/widgets/gimpdasheditor.c * app/widgets/gimpdatafactoryview.c * app/widgets/gimpdock.c * app/widgets/gimpdockable.c * app/widgets/gimpdockseparator.c * app/widgets/gimpfgbgeditor.c * app/widgets/gimpfgbgview.c * app/widgets/gimpgradienteditor.c * app/widgets/gimphandlebar.c * app/widgets/gimphistogrambox.c * app/widgets/gimphistogramview.c * app/widgets/gimpitemtreeview.c * app/widgets/gimpmenudock.c * app/widgets/gimpmessagebox.c * app/widgets/gimppaletteview.c * app/widgets/gimpscalebutton.c * app/widgets/gimpsessioninfo-book.c * app/widgets/gimpsessioninfo-dock.c * app/widgets/gimpsettingseditor.c * app/widgets/gimpstrokeeditor.c * app/widgets/gimptemplateeditor.c * app/widgets/gimptemplateview.c * app/widgets/gimpthumbbox.c * app/widgets/gimptoolbox.c * app/widgets/gimptooloptionseditor.c * app/widgets/gimptoolview.c * app/widgets/gimpuimanager.c * app/widgets/gimpviewabledialog.c * app/widgets/gimpviewrenderervectors.c * app/widgets/gimpwidgets-utils.c: use accessors instead of accessing members of GTK+ widgets directly. svn path=/trunk/; revision=26008
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;
if (child && gtk_widget_get_visible (child))
{
gtk_widget_size_request (child, &child_requisition);
requisition->width += child_requisition.width;
requisition->height += child_requisition.height;
}
}
static void
gimp_dockable_size_allocate (GtkWidget *widget,
GtkAllocation *allocation)
{
GtkContainer *container = GTK_CONTAINER (widget);
GtkWidget *child = gtk_bin_get_child (GTK_BIN (widget));
GtkRequisition button_requisition = { 0, };
GtkAllocation child_allocation;
app/widgets/gimpactionview.c app/widgets/gimpblobeditor.c 2008-06-28 Michael Natterer <mitch@gimp.org> * app/widgets/gimpactionview.c * app/widgets/gimpblobeditor.c * app/widgets/gimpbrushfactoryview.c * app/widgets/gimpbrushselect.c * app/widgets/gimpcellrendererdashes.c * app/widgets/gimpcellrendererviewable.c * app/widgets/gimpcolorbar.c * app/widgets/gimpcoloreditor.c * app/widgets/gimpcolorframe.c * app/widgets/gimpcomponenteditor.c * app/widgets/gimpcontainerbox.c * app/widgets/gimpcontainergridview.c * app/widgets/gimpcontainerpopup.c * app/widgets/gimpcontainertreeview.c * app/widgets/gimpcurveview.c * app/widgets/gimpdasheditor.c * app/widgets/gimpdatafactoryview.c * app/widgets/gimpdock.c * app/widgets/gimpdockable.c * app/widgets/gimpdockseparator.c * app/widgets/gimpfgbgeditor.c * app/widgets/gimpfgbgview.c * app/widgets/gimpgradienteditor.c * app/widgets/gimphandlebar.c * app/widgets/gimphistogrambox.c * app/widgets/gimphistogramview.c * app/widgets/gimpitemtreeview.c * app/widgets/gimpmenudock.c * app/widgets/gimpmessagebox.c * app/widgets/gimppaletteview.c * app/widgets/gimpscalebutton.c * app/widgets/gimpsessioninfo-book.c * app/widgets/gimpsessioninfo-dock.c * app/widgets/gimpsettingseditor.c * app/widgets/gimpstrokeeditor.c * app/widgets/gimptemplateeditor.c * app/widgets/gimptemplateview.c * app/widgets/gimpthumbbox.c * app/widgets/gimptoolbox.c * app/widgets/gimptooloptionseditor.c * app/widgets/gimptoolview.c * app/widgets/gimpuimanager.c * app/widgets/gimpviewabledialog.c * app/widgets/gimpviewrenderervectors.c * app/widgets/gimpwidgets-utils.c: use accessors instead of accessing members of GTK+ widgets directly. svn path=/trunk/; revision=26008
2008-06-28 23:50:27 +08:00
gint border_width;
gtk_widget_set_allocation (widget, allocation);
app/widgets/gimpactionview.c app/widgets/gimpblobeditor.c 2008-06-28 Michael Natterer <mitch@gimp.org> * app/widgets/gimpactionview.c * app/widgets/gimpblobeditor.c * app/widgets/gimpbrushfactoryview.c * app/widgets/gimpbrushselect.c * app/widgets/gimpcellrendererdashes.c * app/widgets/gimpcellrendererviewable.c * app/widgets/gimpcolorbar.c * app/widgets/gimpcoloreditor.c * app/widgets/gimpcolorframe.c * app/widgets/gimpcomponenteditor.c * app/widgets/gimpcontainerbox.c * app/widgets/gimpcontainergridview.c * app/widgets/gimpcontainerpopup.c * app/widgets/gimpcontainertreeview.c * app/widgets/gimpcurveview.c * app/widgets/gimpdasheditor.c * app/widgets/gimpdatafactoryview.c * app/widgets/gimpdock.c * app/widgets/gimpdockable.c * app/widgets/gimpdockseparator.c * app/widgets/gimpfgbgeditor.c * app/widgets/gimpfgbgview.c * app/widgets/gimpgradienteditor.c * app/widgets/gimphandlebar.c * app/widgets/gimphistogrambox.c * app/widgets/gimphistogramview.c * app/widgets/gimpitemtreeview.c * app/widgets/gimpmenudock.c * app/widgets/gimpmessagebox.c * app/widgets/gimppaletteview.c * app/widgets/gimpscalebutton.c * app/widgets/gimpsessioninfo-book.c * app/widgets/gimpsessioninfo-dock.c * app/widgets/gimpsettingseditor.c * app/widgets/gimpstrokeeditor.c * app/widgets/gimptemplateeditor.c * app/widgets/gimptemplateview.c * app/widgets/gimpthumbbox.c * app/widgets/gimptoolbox.c * app/widgets/gimptooloptionseditor.c * app/widgets/gimptoolview.c * app/widgets/gimpuimanager.c * app/widgets/gimpviewabledialog.c * app/widgets/gimpviewrenderervectors.c * app/widgets/gimpwidgets-utils.c: use accessors instead of accessing members of GTK+ widgets directly. svn path=/trunk/; revision=26008
2008-06-28 23:50:27 +08:00
border_width = gtk_container_get_border_width (container);
if (child && gtk_widget_get_visible (child))
{
app/widgets/gimpactionview.c app/widgets/gimpblobeditor.c 2008-06-28 Michael Natterer <mitch@gimp.org> * app/widgets/gimpactionview.c * app/widgets/gimpblobeditor.c * app/widgets/gimpbrushfactoryview.c * app/widgets/gimpbrushselect.c * app/widgets/gimpcellrendererdashes.c * app/widgets/gimpcellrendererviewable.c * app/widgets/gimpcolorbar.c * app/widgets/gimpcoloreditor.c * app/widgets/gimpcolorframe.c * app/widgets/gimpcomponenteditor.c * app/widgets/gimpcontainerbox.c * app/widgets/gimpcontainergridview.c * app/widgets/gimpcontainerpopup.c * app/widgets/gimpcontainertreeview.c * app/widgets/gimpcurveview.c * app/widgets/gimpdasheditor.c * app/widgets/gimpdatafactoryview.c * app/widgets/gimpdock.c * app/widgets/gimpdockable.c * app/widgets/gimpdockseparator.c * app/widgets/gimpfgbgeditor.c * app/widgets/gimpfgbgview.c * app/widgets/gimpgradienteditor.c * app/widgets/gimphandlebar.c * app/widgets/gimphistogrambox.c * app/widgets/gimphistogramview.c * app/widgets/gimpitemtreeview.c * app/widgets/gimpmenudock.c * app/widgets/gimpmessagebox.c * app/widgets/gimppaletteview.c * app/widgets/gimpscalebutton.c * app/widgets/gimpsessioninfo-book.c * app/widgets/gimpsessioninfo-dock.c * app/widgets/gimpsettingseditor.c * app/widgets/gimpstrokeeditor.c * app/widgets/gimptemplateeditor.c * app/widgets/gimptemplateview.c * app/widgets/gimpthumbbox.c * app/widgets/gimptoolbox.c * app/widgets/gimptooloptionseditor.c * app/widgets/gimptoolview.c * app/widgets/gimpuimanager.c * app/widgets/gimpviewabledialog.c * app/widgets/gimpviewrenderervectors.c * app/widgets/gimpwidgets-utils.c: use accessors instead of accessing members of GTK+ widgets directly. svn path=/trunk/; revision=26008
2008-06-28 23:50:27 +08:00
child_allocation.x = allocation->x + border_width;
child_allocation.y = allocation->y + border_width;
child_allocation.width = MAX (allocation->width -
app/widgets/gimpactionview.c app/widgets/gimpblobeditor.c 2008-06-28 Michael Natterer <mitch@gimp.org> * app/widgets/gimpactionview.c * app/widgets/gimpblobeditor.c * app/widgets/gimpbrushfactoryview.c * app/widgets/gimpbrushselect.c * app/widgets/gimpcellrendererdashes.c * app/widgets/gimpcellrendererviewable.c * app/widgets/gimpcolorbar.c * app/widgets/gimpcoloreditor.c * app/widgets/gimpcolorframe.c * app/widgets/gimpcomponenteditor.c * app/widgets/gimpcontainerbox.c * app/widgets/gimpcontainergridview.c * app/widgets/gimpcontainerpopup.c * app/widgets/gimpcontainertreeview.c * app/widgets/gimpcurveview.c * app/widgets/gimpdasheditor.c * app/widgets/gimpdatafactoryview.c * app/widgets/gimpdock.c * app/widgets/gimpdockable.c * app/widgets/gimpdockseparator.c * app/widgets/gimpfgbgeditor.c * app/widgets/gimpfgbgview.c * app/widgets/gimpgradienteditor.c * app/widgets/gimphandlebar.c * app/widgets/gimphistogrambox.c * app/widgets/gimphistogramview.c * app/widgets/gimpitemtreeview.c * app/widgets/gimpmenudock.c * app/widgets/gimpmessagebox.c * app/widgets/gimppaletteview.c * app/widgets/gimpscalebutton.c * app/widgets/gimpsessioninfo-book.c * app/widgets/gimpsessioninfo-dock.c * app/widgets/gimpsettingseditor.c * app/widgets/gimpstrokeeditor.c * app/widgets/gimptemplateeditor.c * app/widgets/gimptemplateview.c * app/widgets/gimpthumbbox.c * app/widgets/gimptoolbox.c * app/widgets/gimptooloptionseditor.c * app/widgets/gimptoolview.c * app/widgets/gimpuimanager.c * app/widgets/gimpviewabledialog.c * app/widgets/gimpviewrenderervectors.c * app/widgets/gimpwidgets-utils.c: use accessors instead of accessing members of GTK+ widgets directly. svn path=/trunk/; revision=26008
2008-06-28 23:50:27 +08:00
border_width * 2,
0);
child_allocation.height = MAX (allocation->height -
app/widgets/gimpactionview.c app/widgets/gimpblobeditor.c 2008-06-28 Michael Natterer <mitch@gimp.org> * app/widgets/gimpactionview.c * app/widgets/gimpblobeditor.c * app/widgets/gimpbrushfactoryview.c * app/widgets/gimpbrushselect.c * app/widgets/gimpcellrendererdashes.c * app/widgets/gimpcellrendererviewable.c * app/widgets/gimpcolorbar.c * app/widgets/gimpcoloreditor.c * app/widgets/gimpcolorframe.c * app/widgets/gimpcomponenteditor.c * app/widgets/gimpcontainerbox.c * app/widgets/gimpcontainergridview.c * app/widgets/gimpcontainerpopup.c * app/widgets/gimpcontainertreeview.c * app/widgets/gimpcurveview.c * app/widgets/gimpdasheditor.c * app/widgets/gimpdatafactoryview.c * app/widgets/gimpdock.c * app/widgets/gimpdockable.c * app/widgets/gimpdockseparator.c * app/widgets/gimpfgbgeditor.c * app/widgets/gimpfgbgview.c * app/widgets/gimpgradienteditor.c * app/widgets/gimphandlebar.c * app/widgets/gimphistogrambox.c * app/widgets/gimphistogramview.c * app/widgets/gimpitemtreeview.c * app/widgets/gimpmenudock.c * app/widgets/gimpmessagebox.c * app/widgets/gimppaletteview.c * app/widgets/gimpscalebutton.c * app/widgets/gimpsessioninfo-book.c * app/widgets/gimpsessioninfo-dock.c * app/widgets/gimpsettingseditor.c * app/widgets/gimpstrokeeditor.c * app/widgets/gimptemplateeditor.c * app/widgets/gimptemplateview.c * app/widgets/gimpthumbbox.c * app/widgets/gimptoolbox.c * app/widgets/gimptooloptionseditor.c * app/widgets/gimptoolview.c * app/widgets/gimpuimanager.c * app/widgets/gimpviewabledialog.c * app/widgets/gimpviewrenderervectors.c * app/widgets/gimpwidgets-utils.c: use accessors instead of accessing members of GTK+ widgets directly. svn path=/trunk/; revision=26008
2008-06-28 23:50:27 +08:00
border_width * 2 -
button_requisition.height,
0);
child_allocation.y += button_requisition.height;
gtk_widget_size_allocate (child, &child_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)
{
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;
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;
}
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;
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 =
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;
}
set style properties for dockables. 2001-08-03 Michael Natterer <mitch@gimp.org> * gtkrc: set style properties for dockables. * app/main.c: some #if 0'ed code for mem profiling. * app/gui/commands.[ch] * app/gui/menus.c: added a mem profiling menu entry + callback. * app/gui/palette-editor.c: added a #warning as reminder, use gtk_dialog_set_has_separator(). * app/widgets/gimpcontainereditor.[ch] * app/widgets/gimpcontainerview.[ch] * app/widgets/gimpdockable.[ch] * app/widgets/gimpdrawablelistview.[ch]: added some style properties to set GimpDockable and friends' borders and spacings. * libgimpwidgets/gimppixmap.[ch] * libgimpwidgets/gimpsizeentry.[ch] * libgimpwidgets/gimpunitmenu.[ch]: GObject stuff, cleanup. * app/docindex.c * app/errorconsole.c * app/gdisplay_color_ui.c * app/gimpprogress.c * app/module_db.c * app/undo_history.c * app/user_install.c * app/gui/channels-commands.c * app/gui/gradient-editor.c * app/gui/info-window.c * app/gui/tips-dialog.c * app/tools/gimpbrightnesscontrasttool.c * app/tools/gimpbycolorselecttool.c * app/tools/gimpcolorbalancetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.c * app/tools/gimpcurvestool.c * app/tools/gimphistogramtool.c * app/tools/gimphuesaturationtool.c * app/tools/gimplevelstool.c * app/tools/gimpmeasuretool.c * app/tools/gimpposterizetool.c * app/tools/gimpthresholdtool.c * app/widgets/gimpdatafactoryview.c * libgimp/gimpexport.c * modules/cdisplay_gamma.c * modules/cdisplay_highcontrast.c * plug-ins/[lots of files]: Some perl mass processing applying s/_("Foo")/GTK_STOCK_FOO/g, minor manual cleanup in some files.
2001-08-04 03:43:19 +08:00
static void
gimp_dockable_style_set (GtkWidget *widget,
GtkStyle *prev_style)
set style properties for dockables. 2001-08-03 Michael Natterer <mitch@gimp.org> * gtkrc: set style properties for dockables. * app/main.c: some #if 0'ed code for mem profiling. * app/gui/commands.[ch] * app/gui/menus.c: added a mem profiling menu entry + callback. * app/gui/palette-editor.c: added a #warning as reminder, use gtk_dialog_set_has_separator(). * app/widgets/gimpcontainereditor.[ch] * app/widgets/gimpcontainerview.[ch] * app/widgets/gimpdockable.[ch] * app/widgets/gimpdrawablelistview.[ch]: added some style properties to set GimpDockable and friends' borders and spacings. * libgimpwidgets/gimppixmap.[ch] * libgimpwidgets/gimpsizeentry.[ch] * libgimpwidgets/gimpunitmenu.[ch]: GObject stuff, cleanup. * app/docindex.c * app/errorconsole.c * app/gdisplay_color_ui.c * app/gimpprogress.c * app/module_db.c * app/undo_history.c * app/user_install.c * app/gui/channels-commands.c * app/gui/gradient-editor.c * app/gui/info-window.c * app/gui/tips-dialog.c * app/tools/gimpbrightnesscontrasttool.c * app/tools/gimpbycolorselecttool.c * app/tools/gimpcolorbalancetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.c * app/tools/gimpcurvestool.c * app/tools/gimphistogramtool.c * app/tools/gimphuesaturationtool.c * app/tools/gimplevelstool.c * app/tools/gimpmeasuretool.c * app/tools/gimpposterizetool.c * app/tools/gimpthresholdtool.c * app/widgets/gimpdatafactoryview.c * libgimp/gimpexport.c * modules/cdisplay_gamma.c * modules/cdisplay_highcontrast.c * plug-ins/[lots of files]: Some perl mass processing applying s/_("Foo")/GTK_STOCK_FOO/g, minor manual cleanup in some files.
2001-08-04 03:43:19 +08:00
{
gint content_border;
set style properties for dockables. 2001-08-03 Michael Natterer <mitch@gimp.org> * gtkrc: set style properties for dockables. * app/main.c: some #if 0'ed code for mem profiling. * app/gui/commands.[ch] * app/gui/menus.c: added a mem profiling menu entry + callback. * app/gui/palette-editor.c: added a #warning as reminder, use gtk_dialog_set_has_separator(). * app/widgets/gimpcontainereditor.[ch] * app/widgets/gimpcontainerview.[ch] * app/widgets/gimpdockable.[ch] * app/widgets/gimpdrawablelistview.[ch]: added some style properties to set GimpDockable and friends' borders and spacings. * libgimpwidgets/gimppixmap.[ch] * libgimpwidgets/gimpsizeentry.[ch] * libgimpwidgets/gimpunitmenu.[ch]: GObject stuff, cleanup. * app/docindex.c * app/errorconsole.c * app/gdisplay_color_ui.c * app/gimpprogress.c * app/module_db.c * app/undo_history.c * app/user_install.c * app/gui/channels-commands.c * app/gui/gradient-editor.c * app/gui/info-window.c * app/gui/tips-dialog.c * app/tools/gimpbrightnesscontrasttool.c * app/tools/gimpbycolorselecttool.c * app/tools/gimpcolorbalancetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.c * app/tools/gimpcurvestool.c * app/tools/gimphistogramtool.c * app/tools/gimphuesaturationtool.c * app/tools/gimplevelstool.c * app/tools/gimpmeasuretool.c * app/tools/gimpposterizetool.c * app/tools/gimpthresholdtool.c * app/widgets/gimpdatafactoryview.c * libgimp/gimpexport.c * modules/cdisplay_gamma.c * modules/cdisplay_highcontrast.c * plug-ins/[lots of files]: Some perl mass processing applying s/_("Foo")/GTK_STOCK_FOO/g, minor manual cleanup in some files.
2001-08-04 03:43:19 +08:00
GTK_WIDGET_CLASS (parent_class)->style_set (widget, prev_style);
set style properties for dockables. 2001-08-03 Michael Natterer <mitch@gimp.org> * gtkrc: set style properties for dockables. * app/main.c: some #if 0'ed code for mem profiling. * app/gui/commands.[ch] * app/gui/menus.c: added a mem profiling menu entry + callback. * app/gui/palette-editor.c: added a #warning as reminder, use gtk_dialog_set_has_separator(). * app/widgets/gimpcontainereditor.[ch] * app/widgets/gimpcontainerview.[ch] * app/widgets/gimpdockable.[ch] * app/widgets/gimpdrawablelistview.[ch]: added some style properties to set GimpDockable and friends' borders and spacings. * libgimpwidgets/gimppixmap.[ch] * libgimpwidgets/gimpsizeentry.[ch] * libgimpwidgets/gimpunitmenu.[ch]: GObject stuff, cleanup. * app/docindex.c * app/errorconsole.c * app/gdisplay_color_ui.c * app/gimpprogress.c * app/module_db.c * app/undo_history.c * app/user_install.c * app/gui/channels-commands.c * app/gui/gradient-editor.c * app/gui/info-window.c * app/gui/tips-dialog.c * app/tools/gimpbrightnesscontrasttool.c * app/tools/gimpbycolorselecttool.c * app/tools/gimpcolorbalancetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.c * app/tools/gimpcurvestool.c * app/tools/gimphistogramtool.c * app/tools/gimphuesaturationtool.c * app/tools/gimplevelstool.c * app/tools/gimpmeasuretool.c * app/tools/gimpposterizetool.c * app/tools/gimpthresholdtool.c * app/widgets/gimpdatafactoryview.c * libgimp/gimpexport.c * modules/cdisplay_gamma.c * modules/cdisplay_highcontrast.c * plug-ins/[lots of files]: Some perl mass processing applying s/_("Foo")/GTK_STOCK_FOO/g, minor manual cleanup in some files.
2001-08-04 03:43:19 +08:00
gtk_widget_style_get (widget,
"content-border", &content_border,
NULL);
set style properties for dockables. 2001-08-03 Michael Natterer <mitch@gimp.org> * gtkrc: set style properties for dockables. * app/main.c: some #if 0'ed code for mem profiling. * app/gui/commands.[ch] * app/gui/menus.c: added a mem profiling menu entry + callback. * app/gui/palette-editor.c: added a #warning as reminder, use gtk_dialog_set_has_separator(). * app/widgets/gimpcontainereditor.[ch] * app/widgets/gimpcontainerview.[ch] * app/widgets/gimpdockable.[ch] * app/widgets/gimpdrawablelistview.[ch]: added some style properties to set GimpDockable and friends' borders and spacings. * libgimpwidgets/gimppixmap.[ch] * libgimpwidgets/gimpsizeentry.[ch] * libgimpwidgets/gimpunitmenu.[ch]: GObject stuff, cleanup. * app/docindex.c * app/errorconsole.c * app/gdisplay_color_ui.c * app/gimpprogress.c * app/module_db.c * app/undo_history.c * app/user_install.c * app/gui/channels-commands.c * app/gui/gradient-editor.c * app/gui/info-window.c * app/gui/tips-dialog.c * app/tools/gimpbrightnesscontrasttool.c * app/tools/gimpbycolorselecttool.c * app/tools/gimpcolorbalancetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.c * app/tools/gimpcurvestool.c * app/tools/gimphistogramtool.c * app/tools/gimphuesaturationtool.c * app/tools/gimplevelstool.c * app/tools/gimpmeasuretool.c * app/tools/gimpposterizetool.c * app/tools/gimpthresholdtool.c * app/widgets/gimpdatafactoryview.c * libgimp/gimpexport.c * modules/cdisplay_gamma.c * modules/cdisplay_highcontrast.c * plug-ins/[lots of files]: Some perl mass processing applying s/_("Foo")/GTK_STOCK_FOO/g, minor manual cleanup in some files.
2001-08-04 03:43:19 +08:00
gtk_container_set_border_width (GTK_CONTAINER (widget), content_border);
}
added a "menu_title" which is registered with each menu. 2003-09-23 Michael Natterer <mitch@gimp.org> * app/widgets/gimpmenufactory.[ch]: added a "menu_title" which is registered with each menu. * app/widgets/gimpitemfactory.[ch]: added the title to the constructor and to the GimpItemFactory struct. * app/gui/menus.c: register titles with all menus. * app/widgets/gimpdockable.[ch]: show the tab menu, not the contained dialog's menu when clicking on the menu button. Embed the dialog's menu as submenu. Use the item_factory's title and the dockable's stock_id for the submenu entry. * app/widgets/gimpeditor.c: removed GtkWidget:popup_menu() implementation since that's done by GimpDockable now. * app/widgets/gimpdockbook.c: set the new menu item invisible when showing the menu as tab menu. * app/widgets/gimphelp-ids.h: added GIMP_HELP_DOCK_TAB_DETACH and renamed _TAB_REMOVE to _TAB_CLOSE. * app/gui/dialogs-menu.c: added the new menu entry for showing the dialog's sub-menu. Added a "Detach" menu item, renamed "Remove" to "Close". Accept both a GimpDockbook and a GimpDockable pointer as "data" in dialogs_menu_update(). * app/gui/dialogs-commands.[ch]: changed accordingly. Never use gtk_item_factory_popup_data_from_widget() but always the "data" passed to the callbacks. Take care to not set the already active preview_size, tab_style and list/grid type in the resp. callbacks to avoid being called from dialogs_menu_update(). * app/gui/dialogs-constructors.c: removed separate set_context_funcs and get_menu_funcs for GimpContainerView and GimpContainerEditor widgets and simply use gimp_container_view_get_by_dockable() to find the right widget.
2003-09-24 00:17:25 +08:00
static void
gimp_dockable_add (GtkContainer *container,
GtkWidget *widget)
{
GimpDockable *dockable;
g_return_if_fail (gtk_bin_get_child (GTK_BIN (container)) == NULL);
GTK_CONTAINER_CLASS (parent_class)->add (container, widget);
/* not all tab styles are supported by all children */
dockable = GIMP_DOCKABLE (container);
gimp_dockable_set_tab_style (dockable, dockable->p->tab_style);
}
static GType
gimp_dockable_child_type (GtkContainer *container)
{
if (gtk_bin_get_child (GTK_BIN (container)))
return G_TYPE_NONE;
return GIMP_TYPE_DOCKED;
}
static GtkWidget *
gimp_dockable_new_tab_widget_internal (GimpDockable *dockable,
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:
label = gtk_label_new (dockable->p->name);
break;
case GIMP_TAB_STYLE_BLURB:
case GIMP_TAB_STYLE_ICON_BLURB:
case GIMP_TAB_STYLE_PREVIEW_BLURB:
label = gtk_label_new (dockable->p->blurb);
break;
default:
break;
}
switch (tab_style)
{
case GIMP_TAB_STYLE_ICON:
case GIMP_TAB_STYLE_ICON_NAME:
case GIMP_TAB_STYLE_ICON_BLURB:
icon = gimp_dockable_get_icon (dockable, size);
break;
case GIMP_TAB_STYLE_PREVIEW:
case GIMP_TAB_STYLE_PREVIEW_NAME:
case GIMP_TAB_STYLE_PREVIEW_BLURB:
{
GtkWidget *child = gtk_bin_get_child (GTK_BIN (dockable));
if (child)
icon = gimp_docked_get_preview (GIMP_DOCKED (child),
context, size);
if (! icon)
icon = gimp_dockable_get_icon (dockable, size);
}
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;
case GIMP_TAB_STYLE_UNDEFINED:
case GIMP_TAB_STYLE_AUTOMATIC:
g_warning ("Tab style error, unexpected code path taken, fix!");
break;
}
return tab_widget;
}
/* public functions */
GtkWidget *
gimp_dockable_new (const gchar *name,
const gchar *blurb,
const gchar *stock_id,
const gchar *help_id)
{
GimpDockable *dockable;
g_return_val_if_fail (name != NULL, NULL);
Added configurable styles for dockable tabs (fixes bug #87376): 2003-07-08 Michael Natterer <mitch@gimp.org> Added configurable styles for dockable tabs (fixes bug #87376): * app/widgets/widgets-enums.[ch]: added new enum GimpTabStyle which can be one on { ICON, NAME, ICON_NAME, ICON_BLURB }. * app/widgets/gimpdockable.[ch]: added a GimpTabStyle member to the GimpDockable struct which defaults to GIMP_TAB_STYLE_ICON. Renamed "short_name" to "name" and "name" to "blurb". Renamed GimpDockableGetTabFunc to GimpDockableGetIconFunc. Implemented all tab styles in gimp_dockable_real_get_tab_widget() and use the "get_icon_func" only for creating the tab's icon, not the entire tab widget. * app/widgets/gimpdockbook.[ch]: changed accordingly. Create the menu widgets and the DND icon using gimp_dockable_get_tab_widget() with tab_style == GIMP_TAB_STYLE_ICON_BLURB instead of duplicating tons of code. Made gimp_dockbook_get_tab_widget() public because it's needed for exchanging tabs on-the-fly. * app/widgets/gimpimagedock.c: changed accordingly. * app/widgets/gimpdialogfactory.c: remember the dockables' tab style in sessionrc. * app/gui/dialogs-menu.c: added a submenu to select the tab style for each dockable. * app/gui/dialogs-commands.[ch]: new callback dialogs_tab_style_cmd_callback(). * app/gui/dialogs-constructors.[ch]: added stock_ids to all dockables, swapped the "name" and "blurb" parameters, reordered functions, cleanup. * app/gui/dialogs-menu.c * app/gui/image-menu.c * app/gui/toolbox-menu.c: use GIMP_STOCK_DEFAULT_COLORS for the color editor dockable and renamed it to "FG/BG Color".
2003-07-08 23:07:56 +08:00
g_return_val_if_fail (stock_id != NULL, NULL);
g_return_val_if_fail (help_id != NULL, NULL);
dockable = g_object_new (GIMP_TYPE_DOCKABLE, NULL);
dockable->p->name = g_strdup (name);
dockable->p->stock_id = g_strdup (stock_id);
dockable->p->help_id = g_strdup (help_id);
if (blurb)
dockable->p->blurb = g_strdup (blurb);
else
dockable->p->blurb = dockable->p->name;
gimp_help_set_help_data (GTK_WIDGET (dockable), NULL, help_id);
return GTK_WIDGET (dockable);
}
void
gimp_dockable_set_dockbook (GimpDockable *dockable,
GimpDockbook *dockbook)
{
g_return_if_fail (GIMP_IS_DOCKABLE (dockable));
g_return_if_fail (dockbook == NULL ||
GIMP_IS_DOCKBOOK (dockbook));
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;
}
/**
* 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;
}
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;
}
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);
}
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;
}
void
gimp_dockable_set_aux_info (GimpDockable *dockable,
GList *aux_info)
{
GtkWidget *child;
g_return_if_fail (GIMP_IS_DOCKABLE (dockable));
child = gtk_bin_get_child (GTK_BIN (dockable));
if (child)
gimp_docked_set_aux_info (GIMP_DOCKED (child), aux_info);
}
GList *
gimp_dockable_get_aux_info (GimpDockable *dockable)
{
GtkWidget *child;
g_return_val_if_fail (GIMP_IS_DOCKABLE (dockable), NULL);
child = gtk_bin_get_child (GTK_BIN (dockable));
if (child)
return gimp_docked_get_aux_info (GIMP_DOCKED (child));
return NULL;
}
void
gimp_dockable_set_locked (GimpDockable *dockable,
gboolean lock)
{
g_return_if_fail (GIMP_IS_DOCKABLE (dockable));
if (dockable->p->locked != lock)
{
dockable->p->locked = lock ? TRUE : FALSE;
g_object_notify (G_OBJECT (dockable), "locked");
}
}
gboolean
gimp_dockable_is_locked (GimpDockable *dockable)
{
g_return_val_if_fail (GIMP_IS_DOCKABLE (dockable), FALSE);
return dockable->p->locked;
}
void
gimp_dockable_set_tab_style (GimpDockable *dockable,
GimpTabStyle tab_style)
{
g_return_if_fail (GIMP_IS_DOCKABLE (dockable));
dockable->p->tab_style = gimp_dockable_convert_tab_style (dockable, tab_style);
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;
}
GtkWidget *
gimp_dockable_create_tab_widget (GimpDockable *dockable,
GimpContext *context,
GimpTabStyle tab_style,
GtkIconSize size)
set style properties for dockables. 2001-08-03 Michael Natterer <mitch@gimp.org> * gtkrc: set style properties for dockables. * app/main.c: some #if 0'ed code for mem profiling. * app/gui/commands.[ch] * app/gui/menus.c: added a mem profiling menu entry + callback. * app/gui/palette-editor.c: added a #warning as reminder, use gtk_dialog_set_has_separator(). * app/widgets/gimpcontainereditor.[ch] * app/widgets/gimpcontainerview.[ch] * app/widgets/gimpdockable.[ch] * app/widgets/gimpdrawablelistview.[ch]: added some style properties to set GimpDockable and friends' borders and spacings. * libgimpwidgets/gimppixmap.[ch] * libgimpwidgets/gimpsizeentry.[ch] * libgimpwidgets/gimpunitmenu.[ch]: GObject stuff, cleanup. * app/docindex.c * app/errorconsole.c * app/gdisplay_color_ui.c * app/gimpprogress.c * app/module_db.c * app/undo_history.c * app/user_install.c * app/gui/channels-commands.c * app/gui/gradient-editor.c * app/gui/info-window.c * app/gui/tips-dialog.c * app/tools/gimpbrightnesscontrasttool.c * app/tools/gimpbycolorselecttool.c * app/tools/gimpcolorbalancetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.c * app/tools/gimpcurvestool.c * app/tools/gimphistogramtool.c * app/tools/gimphuesaturationtool.c * app/tools/gimplevelstool.c * app/tools/gimpmeasuretool.c * app/tools/gimpposterizetool.c * app/tools/gimpthresholdtool.c * app/widgets/gimpdatafactoryview.c * libgimp/gimpexport.c * modules/cdisplay_gamma.c * modules/cdisplay_highcontrast.c * plug-ins/[lots of files]: Some perl mass processing applying s/_("Foo")/GTK_STOCK_FOO/g, minor manual cleanup in some files.
2001-08-04 03:43:19 +08:00
{
g_return_val_if_fail (GIMP_IS_DOCKABLE (dockable), NULL);
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
return gimp_dockable_new_tab_widget_internal (dockable, context,
tab_style, size, FALSE);
}
Added configurable styles for dockable tabs (fixes bug #87376): 2003-07-08 Michael Natterer <mitch@gimp.org> Added configurable styles for dockable tabs (fixes bug #87376): * app/widgets/widgets-enums.[ch]: added new enum GimpTabStyle which can be one on { ICON, NAME, ICON_NAME, ICON_BLURB }. * app/widgets/gimpdockable.[ch]: added a GimpTabStyle member to the GimpDockable struct which defaults to GIMP_TAB_STYLE_ICON. Renamed "short_name" to "name" and "name" to "blurb". Renamed GimpDockableGetTabFunc to GimpDockableGetIconFunc. Implemented all tab styles in gimp_dockable_real_get_tab_widget() and use the "get_icon_func" only for creating the tab's icon, not the entire tab widget. * app/widgets/gimpdockbook.[ch]: changed accordingly. Create the menu widgets and the DND icon using gimp_dockable_get_tab_widget() with tab_style == GIMP_TAB_STYLE_ICON_BLURB instead of duplicating tons of code. Made gimp_dockbook_get_tab_widget() public because it's needed for exchanging tabs on-the-fly. * app/widgets/gimpimagedock.c: changed accordingly. * app/widgets/gimpdialogfactory.c: remember the dockables' tab style in sessionrc. * app/gui/dialogs-menu.c: added a submenu to select the tab style for each dockable. * app/gui/dialogs-commands.[ch]: new callback dialogs_tab_style_cmd_callback(). * app/gui/dialogs-constructors.[ch]: added stock_ids to all dockables, swapped the "name" and "blurb" parameters, reordered functions, cleanup. * app/gui/dialogs-menu.c * app/gui/image-menu.c * app/gui/toolbox-menu.c: use GIMP_STOCK_DEFAULT_COLORS for the color editor dockable and renamed it to "FG/BG Color".
2003-07-08 23:07:56 +08:00
GtkWidget *
gimp_dockable_create_drag_widget (GimpDockable *dockable)
{
GtkWidget *frame;
GtkWidget *widget;
Added configurable styles for dockable tabs (fixes bug #87376): 2003-07-08 Michael Natterer <mitch@gimp.org> Added configurable styles for dockable tabs (fixes bug #87376): * app/widgets/widgets-enums.[ch]: added new enum GimpTabStyle which can be one on { ICON, NAME, ICON_NAME, ICON_BLURB }. * app/widgets/gimpdockable.[ch]: added a GimpTabStyle member to the GimpDockable struct which defaults to GIMP_TAB_STYLE_ICON. Renamed "short_name" to "name" and "name" to "blurb". Renamed GimpDockableGetTabFunc to GimpDockableGetIconFunc. Implemented all tab styles in gimp_dockable_real_get_tab_widget() and use the "get_icon_func" only for creating the tab's icon, not the entire tab widget. * app/widgets/gimpdockbook.[ch]: changed accordingly. Create the menu widgets and the DND icon using gimp_dockable_get_tab_widget() with tab_style == GIMP_TAB_STYLE_ICON_BLURB instead of duplicating tons of code. Made gimp_dockbook_get_tab_widget() public because it's needed for exchanging tabs on-the-fly. * app/widgets/gimpimagedock.c: changed accordingly. * app/widgets/gimpdialogfactory.c: remember the dockables' tab style in sessionrc. * app/gui/dialogs-menu.c: added a submenu to select the tab style for each dockable. * app/gui/dialogs-commands.[ch]: new callback dialogs_tab_style_cmd_callback(). * app/gui/dialogs-constructors.[ch]: added stock_ids to all dockables, swapped the "name" and "blurb" parameters, reordered functions, cleanup. * app/gui/dialogs-menu.c * app/gui/image-menu.c * app/gui/toolbox-menu.c: use GIMP_STOCK_DEFAULT_COLORS for the color editor dockable and renamed it to "FG/BG Color".
2003-07-08 23:07:56 +08:00
g_return_val_if_fail (GIMP_IS_DOCKABLE (dockable), NULL);
Added configurable styles for dockable tabs (fixes bug #87376): 2003-07-08 Michael Natterer <mitch@gimp.org> Added configurable styles for dockable tabs (fixes bug #87376): * app/widgets/widgets-enums.[ch]: added new enum GimpTabStyle which can be one on { ICON, NAME, ICON_NAME, ICON_BLURB }. * app/widgets/gimpdockable.[ch]: added a GimpTabStyle member to the GimpDockable struct which defaults to GIMP_TAB_STYLE_ICON. Renamed "short_name" to "name" and "name" to "blurb". Renamed GimpDockableGetTabFunc to GimpDockableGetIconFunc. Implemented all tab styles in gimp_dockable_real_get_tab_widget() and use the "get_icon_func" only for creating the tab's icon, not the entire tab widget. * app/widgets/gimpdockbook.[ch]: changed accordingly. Create the menu widgets and the DND icon using gimp_dockable_get_tab_widget() with tab_style == GIMP_TAB_STYLE_ICON_BLURB instead of duplicating tons of code. Made gimp_dockbook_get_tab_widget() public because it's needed for exchanging tabs on-the-fly. * app/widgets/gimpimagedock.c: changed accordingly. * app/widgets/gimpdialogfactory.c: remember the dockables' tab style in sessionrc. * app/gui/dialogs-menu.c: added a submenu to select the tab style for each dockable. * app/gui/dialogs-commands.[ch]: new callback dialogs_tab_style_cmd_callback(). * app/gui/dialogs-constructors.[ch]: added stock_ids to all dockables, swapped the "name" and "blurb" parameters, reordered functions, cleanup. * app/gui/dialogs-menu.c * app/gui/image-menu.c * app/gui/toolbox-menu.c: use GIMP_STOCK_DEFAULT_COLORS for the color editor dockable and renamed it to "FG/BG Color".
2003-07-08 23:07:56 +08:00
frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_OUT);
Added configurable styles for dockable tabs (fixes bug #87376): 2003-07-08 Michael Natterer <mitch@gimp.org> Added configurable styles for dockable tabs (fixes bug #87376): * app/widgets/widgets-enums.[ch]: added new enum GimpTabStyle which can be one on { ICON, NAME, ICON_NAME, ICON_BLURB }. * app/widgets/gimpdockable.[ch]: added a GimpTabStyle member to the GimpDockable struct which defaults to GIMP_TAB_STYLE_ICON. Renamed "short_name" to "name" and "name" to "blurb". Renamed GimpDockableGetTabFunc to GimpDockableGetIconFunc. Implemented all tab styles in gimp_dockable_real_get_tab_widget() and use the "get_icon_func" only for creating the tab's icon, not the entire tab widget. * app/widgets/gimpdockbook.[ch]: changed accordingly. Create the menu widgets and the DND icon using gimp_dockable_get_tab_widget() with tab_style == GIMP_TAB_STYLE_ICON_BLURB instead of duplicating tons of code. Made gimp_dockbook_get_tab_widget() public because it's needed for exchanging tabs on-the-fly. * app/widgets/gimpimagedock.c: changed accordingly. * app/widgets/gimpdialogfactory.c: remember the dockables' tab style in sessionrc. * app/gui/dialogs-menu.c: added a submenu to select the tab style for each dockable. * app/gui/dialogs-commands.[ch]: new callback dialogs_tab_style_cmd_callback(). * app/gui/dialogs-constructors.[ch]: added stock_ids to all dockables, swapped the "name" and "blurb" parameters, reordered functions, cleanup. * app/gui/dialogs-menu.c * app/gui/image-menu.c * app/gui/toolbox-menu.c: use GIMP_STOCK_DEFAULT_COLORS for the color editor dockable and renamed it to "FG/BG Color".
2003-07-08 23:07:56 +08:00
widget = gimp_dockable_new_tab_widget_internal (dockable,
dockable->p->context,
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);
return frame;
}
void
gimp_dockable_set_context (GimpDockable *dockable,
GimpContext *context)
{
g_return_if_fail (GIMP_IS_DOCKABLE (dockable));
g_return_if_fail (context == NULL || GIMP_IS_CONTEXT (context));
if (context != dockable->p->context)
{
GtkWidget *child = gtk_bin_get_child (GTK_BIN (dockable));
if (child)
gimp_docked_set_context (GIMP_DOCKED (child), context);
set style properties for dockables. 2001-08-03 Michael Natterer <mitch@gimp.org> * gtkrc: set style properties for dockables. * app/main.c: some #if 0'ed code for mem profiling. * app/gui/commands.[ch] * app/gui/menus.c: added a mem profiling menu entry + callback. * app/gui/palette-editor.c: added a #warning as reminder, use gtk_dialog_set_has_separator(). * app/widgets/gimpcontainereditor.[ch] * app/widgets/gimpcontainerview.[ch] * app/widgets/gimpdockable.[ch] * app/widgets/gimpdrawablelistview.[ch]: added some style properties to set GimpDockable and friends' borders and spacings. * libgimpwidgets/gimppixmap.[ch] * libgimpwidgets/gimpsizeentry.[ch] * libgimpwidgets/gimpunitmenu.[ch]: GObject stuff, cleanup. * app/docindex.c * app/errorconsole.c * app/gdisplay_color_ui.c * app/gimpprogress.c * app/module_db.c * app/undo_history.c * app/user_install.c * app/gui/channels-commands.c * app/gui/gradient-editor.c * app/gui/info-window.c * app/gui/tips-dialog.c * app/tools/gimpbrightnesscontrasttool.c * app/tools/gimpbycolorselecttool.c * app/tools/gimpcolorbalancetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.c * app/tools/gimpcurvestool.c * app/tools/gimphistogramtool.c * app/tools/gimphuesaturationtool.c * app/tools/gimplevelstool.c * app/tools/gimpmeasuretool.c * app/tools/gimpposterizetool.c * app/tools/gimpthresholdtool.c * app/widgets/gimpdatafactoryview.c * libgimp/gimpexport.c * modules/cdisplay_gamma.c * modules/cdisplay_highcontrast.c * plug-ins/[lots of files]: Some perl mass processing applying s/_("Foo")/GTK_STOCK_FOO/g, minor manual cleanup in some files.
2001-08-04 03:43:19 +08:00
dockable->p->context = context;
reoedered to somehow reflect the class hierarchy. 2004-05-23 Michael Natterer <mitch@gimp.org> * app/widgets/widgets-types.h: reoedered to somehow reflect the class hierarchy. Some dockable context handling cleanup: * app/widgets/gimpdocked.[ch]: removed "prev_context" parameter from GimpDocked::set_context(). Widgets which need the old context to disconnect from should remember it themselves. * app/widgets/gimpdockable.c (gimp_dockable_set_context): don't pass the old context to gimp_docked_set_context(). Some cleanup. * app/widgets/gimpcontainerbox.c * app/widgets/gimpcontainereditor.c: changed accordingly. * app/display/gimpnavigationview.[ch] * app/widgets/gimpimageeditor.[ch] * app/widgets/gimpitemtreeview.[ch]: added a "context" member which holds the context set by GimpDocked::set_context(). * app/widgets/gimpdrawabletreeview.c: use the view's context instead of gimp_get_user_context(). * app/widgets/gimpcoloreditor.[ch]: removed separate API to set the context because it implements the GimpDockedInterface. * app/widgets/gimpcomponenteditor.c * app/widgets/gimperrorconsole.c: pass "menu-factory", "menu-identifier" and "ui-path" to g_object_new() instead of calling gimp_editor_create_menu() later. Action cleanup partly related to the context stuff above: * app/actions/actions.c (action_data_get_gimp): get the Gimp from context->gimp, not gimage->gimp because gimage may be NULL. (action_data_get_context): changed to use the new context members added above. * app/actions/channels-actions.c (channels_actions_update): cleanup. * app/actions/edit-actions.c (edit_actions_update): fixed sensitivity of "edit-undo-clear". * app/actions/vectors-actions.c (vectors_actions_update): make "vectors-merge-visible" sensitive only if there is more than one GimpVectors in the image. * app/actions/colormap-editor-actions.c * app/actions/gradient-editor-actions.c * app/actions/palette-editor-actions.c: added FG/BG color previews to actions which take colors from them. Changed code to be safe against "context" being NULL. * app/actions/drawable-commands.c: s/active_drawable/drawable/g. Makes the code more readable. * app/actions/select-commands.[ch] * app/actions/vectors-commands.[ch]: removed public stroke utility functions and other stuff which is not needed any more because dialog buttons invoke the correct actions now. Moved the functions' code to the resp. action callbacks.
2004-05-23 18:04:41 +08:00
}
}
Switch from GtkItemFactory to GtkUIManager. The migration is almost 2004-04-29 Michael Natterer <mitch@gimp.org> Switch from GtkItemFactory to GtkUIManager. The migration is almost complete, still stuff missing/incomplete, definitely added a bunch of new bugs... * app/actions/*-commands.[ch]: converted all callback from GtkItemFactory callbacks to GtkAction callbacks. * app/actions/debug-actions.c * app/actions/gradient-editor-actions.c * app/actions/help-actions.c * app/actions/plug-in-actions.c * app/actions/qmask-actions.c * app/actions/tool-options-actions.c: various fixes. * app/display/gimpdisplay.[ch] * app/display/gimpdisplayshell-appearance.[ch] * app/display/gimpdisplayshell-callbacks.c * app/display/gimpdisplayshell.[ch]: move everything from GtkItemFactory to GtkUIManager. * app/gui/dialogs.[ch]: added new function dialogs_get_toolbox(). Needed because the action callbacks don't have a widget parameter and sometimes we need a parent window for showing dialogs. * app/gui/Makefile.am * app/gui/brushes-menu.[ch] * app/gui/buffers-menu.[ch] * app/gui/channels-menu.[ch] * app/gui/colormap-editor-menu.[ch] * app/gui/dialogs-menu.[ch] * app/gui/documents-menu.[ch] * app/gui/error-console-menu.[ch] * app/gui/fonts-menu.[ch] * app/gui/gradient-editor-menu.[ch] * app/gui/gradients-menu.[ch] * app/gui/images-menu.[ch] * app/gui/layers-menu.[ch] * app/gui/palette-editor-menu.[ch] * app/gui/palettes-menu.[ch] * app/gui/patterns-menu.[ch] * app/gui/qmask-menu.[ch] * app/gui/templates-menu.[ch] * app/gui/vectors-menu.[ch]: removed these files. * app/gui/gui.c: create a global UI manager for the image popup menu and the toolbox menubar. * app/gui/menus.[ch]: removed all GtkItemFactory code. * app/gui/image-menu.[ch] * app/gui/toolbox-menu.[ch]: removed everything except the trivial setup_funcs. * app/gui/file-open-menu.c * app/gui/file-save-menu.c * app/gui/tool-options-menu.c: don't use the macros from menus.h any more, they are gone. * app/gui/gui-vtable.c * app/gui/plug-in-menus.[ch]: create/destroy the dynamic plug-in menu entries. * app/tools/gimpimagemaptool.c: s/gimp_item_factory_update/ gimp_ui_manager_update/g * app/widgets/gimpuimanager.[ch]: added API to get an action group by name. * app/widgets/gimpmenufactory.c: don't choke on the item_factory entries being NULL. * app/widgets/gimpactiongroup.c: make sure booleans set using g_object_set() only have TRUE or FALSE values. * app/widgets/gimpcolormapeditor.c * app/widgets/gimpcomponenteditor.c * app/widgets/gimpcontainereditor.[ch] * app/widgets/gimpcontainergridview.c * app/widgets/gimpcontainertreeview.c * app/widgets/gimpdockable.[ch] * app/widgets/gimpdocked.[ch] * app/widgets/gimpeditor.[ch] * app/widgets/gimperrorconsole.c * app/widgets/gimpgradienteditor.c * app/widgets/gimpitemtreeview.c * app/widgets/gimppaletteeditor.c * app/widgets/gimptoolbox.c * app/widgets/gimptooloptionseditor.c: removed all GtkItemFactory code and enable the #if 0'ed UI manager stuff. * menus/gradient-editor-menu.xml: fixed typos. * menus/image-menu.xml: duplicate everything so we have both an image menubar and an image popup menu. Badly cries for an XSL processor. * menus/toolbox-menu.xml: added an "Extensions" placeholder.
2004-04-29 20:52:29 +08:00
GimpUIManager *
gimp_dockable_get_menu (GimpDockable *dockable,
const gchar **ui_path,
gpointer *popup_data)
{
GtkWidget *child;
g_return_val_if_fail (GIMP_IS_DOCKABLE (dockable), NULL);
Switch from GtkItemFactory to GtkUIManager. The migration is almost 2004-04-29 Michael Natterer <mitch@gimp.org> Switch from GtkItemFactory to GtkUIManager. The migration is almost complete, still stuff missing/incomplete, definitely added a bunch of new bugs... * app/actions/*-commands.[ch]: converted all callback from GtkItemFactory callbacks to GtkAction callbacks. * app/actions/debug-actions.c * app/actions/gradient-editor-actions.c * app/actions/help-actions.c * app/actions/plug-in-actions.c * app/actions/qmask-actions.c * app/actions/tool-options-actions.c: various fixes. * app/display/gimpdisplay.[ch] * app/display/gimpdisplayshell-appearance.[ch] * app/display/gimpdisplayshell-callbacks.c * app/display/gimpdisplayshell.[ch]: move everything from GtkItemFactory to GtkUIManager. * app/gui/dialogs.[ch]: added new function dialogs_get_toolbox(). Needed because the action callbacks don't have a widget parameter and sometimes we need a parent window for showing dialogs. * app/gui/Makefile.am * app/gui/brushes-menu.[ch] * app/gui/buffers-menu.[ch] * app/gui/channels-menu.[ch] * app/gui/colormap-editor-menu.[ch] * app/gui/dialogs-menu.[ch] * app/gui/documents-menu.[ch] * app/gui/error-console-menu.[ch] * app/gui/fonts-menu.[ch] * app/gui/gradient-editor-menu.[ch] * app/gui/gradients-menu.[ch] * app/gui/images-menu.[ch] * app/gui/layers-menu.[ch] * app/gui/palette-editor-menu.[ch] * app/gui/palettes-menu.[ch] * app/gui/patterns-menu.[ch] * app/gui/qmask-menu.[ch] * app/gui/templates-menu.[ch] * app/gui/vectors-menu.[ch]: removed these files. * app/gui/gui.c: create a global UI manager for the image popup menu and the toolbox menubar. * app/gui/menus.[ch]: removed all GtkItemFactory code. * app/gui/image-menu.[ch] * app/gui/toolbox-menu.[ch]: removed everything except the trivial setup_funcs. * app/gui/file-open-menu.c * app/gui/file-save-menu.c * app/gui/tool-options-menu.c: don't use the macros from menus.h any more, they are gone. * app/gui/gui-vtable.c * app/gui/plug-in-menus.[ch]: create/destroy the dynamic plug-in menu entries. * app/tools/gimpimagemaptool.c: s/gimp_item_factory_update/ gimp_ui_manager_update/g * app/widgets/gimpuimanager.[ch]: added API to get an action group by name. * app/widgets/gimpmenufactory.c: don't choke on the item_factory entries being NULL. * app/widgets/gimpactiongroup.c: make sure booleans set using g_object_set() only have TRUE or FALSE values. * app/widgets/gimpcolormapeditor.c * app/widgets/gimpcomponenteditor.c * app/widgets/gimpcontainereditor.[ch] * app/widgets/gimpcontainergridview.c * app/widgets/gimpcontainertreeview.c * app/widgets/gimpdockable.[ch] * app/widgets/gimpdocked.[ch] * app/widgets/gimpeditor.[ch] * app/widgets/gimperrorconsole.c * app/widgets/gimpgradienteditor.c * app/widgets/gimpitemtreeview.c * app/widgets/gimppaletteeditor.c * app/widgets/gimptoolbox.c * app/widgets/gimptooloptionseditor.c: removed all GtkItemFactory code and enable the #if 0'ed UI manager stuff. * menus/gradient-editor-menu.xml: fixed typos. * menus/image-menu.xml: duplicate everything so we have both an image menubar and an image popup menu. Badly cries for an XSL processor. * menus/toolbox-menu.xml: added an "Extensions" placeholder.
2004-04-29 20:52:29 +08:00
g_return_val_if_fail (ui_path != NULL, NULL);
g_return_val_if_fail (popup_data != NULL, NULL);
child = gtk_bin_get_child (GTK_BIN (dockable));
if (child)
return gimp_docked_get_menu (GIMP_DOCKED (child), ui_path, popup_data);
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));
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
}
void
gimp_dockable_detach (GimpDockable *dockable)
{
GimpDockWindow *src_dock_window = NULL;
GimpDock *src_dock = NULL;
GtkWidget *dock = NULL;
GimpDockWindow *dock_window = NULL;
GtkWidget *dockbook = NULL;
g_return_if_fail (GIMP_IS_DOCKABLE (dockable));
g_return_if_fail (GIMP_IS_DOCKBOOK (dockable->p->dockbook));
src_dock = gimp_dockbook_get_dock (dockable->p->dockbook);
src_dock_window = gimp_dock_window_from_dock (src_dock);
dock = gimp_dock_with_window_new (gimp_dialog_factory_get_singleton (),
gtk_widget_get_screen (GTK_WIDGET (dockable)),
FALSE /*toolbox*/);
dock_window = gimp_dock_window_from_dock (GIMP_DOCK (dock));
gtk_window_set_position (GTK_WINDOW (dock_window), GTK_WIN_POS_MOUSE);
if (src_dock_window)
gimp_dock_window_setup (dock_window, src_dock_window);
dockbook = gimp_dockbook_new (global_menu_factory);
gimp_dock_add_book (GIMP_DOCK (dock), GIMP_DOCKBOOK (dockbook), 0);
g_object_ref (dockable);
gimp_dockbook_remove (dockable->p->dockbook, dockable);
gimp_dockbook_add (GIMP_DOCKBOOK (dockbook), dockable, 0);
g_object_unref (dockable);
gtk_widget_show (GTK_WIDGET (dock_window));
gtk_widget_show (dock);
}
void
gimp_dockable_blink (GimpDockable *dockable)
{
g_return_if_fail (GIMP_IS_DOCKABLE (dockable));
if (dockable->p->blink_timeout_id)
g_source_remove (dockable->p->blink_timeout_id);
dockable->p->blink_timeout_id =
g_timeout_add (150, (GSourceFunc) gimp_dockable_blink_timeout, dockable);
gimp_highlight_widget (GTK_WIDGET (dockable), TRUE);
}
void
gimp_dockable_blink_cancel (GimpDockable *dockable)
{
g_return_if_fail (GIMP_IS_DOCKABLE (dockable));
if (dockable->p->blink_timeout_id)
{
g_source_remove (dockable->p->blink_timeout_id);
dockable->p->blink_timeout_id = 0;
dockable->p->blink_counter = 0;
gimp_highlight_widget (GTK_WIDGET (dockable), FALSE);
}
}
/* private functions */
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)
tab_style = gimp_preview_tab_style_to_icon (tab_style);
return tab_style;
}
static gboolean
gimp_dockable_blink_timeout (GimpDockable *dockable)
{
gimp_highlight_widget (GTK_WIDGET (dockable),
dockable->p->blink_counter % 2 == 1);
dockable->p->blink_counter++;
if (dockable->p->blink_counter == 3)
{
dockable->p->blink_timeout_id = 0;
dockable->p->blink_counter = 0;
return FALSE;
}
return TRUE;
}