mirror of https://github.com/GNOME/gimp.git
Really fix bug #150593:
2005-09-12 Michael Natterer <mitch@gimp.org> Really fix bug #150593: * app/widgets/Makefile.am * app/widgets/widgets-types.h * app/widgets/gimpdockseparator.[ch]: new widget implementing the droppable separator bar in docks. * app/widgets/gimpdock.c: use it and removed local separator utility functions. * app/widgets/gimptoolbox.c: use GimpDockSeparator API to show/hide the label. Expand the separator initially. * themes/Default/gtkrc * themes/Small/gtkrc: the separator height style property moved from GimpDock to GimpDockSeparator.
This commit is contained in:
parent
35ea9d1f8d
commit
7d08450cbc
19
ChangeLog
19
ChangeLog
|
@ -1,3 +1,22 @@
|
|||
2005-09-12 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
Really fix bug #150593:
|
||||
|
||||
* app/widgets/Makefile.am
|
||||
* app/widgets/widgets-types.h
|
||||
* app/widgets/gimpdockseparator.[ch]: new widget implementing the
|
||||
droppable separator bar in docks.
|
||||
|
||||
* app/widgets/gimpdock.c: use it and removed local separator
|
||||
utility functions.
|
||||
|
||||
* app/widgets/gimptoolbox.c: use GimpDockSeparator API to show/hide
|
||||
the label. Expand the separator initially.
|
||||
|
||||
* themes/Default/gtkrc
|
||||
* themes/Small/gtkrc: the separator height style property moved
|
||||
from GimpDock to GimpDockSeparator.
|
||||
|
||||
2005-09-12 Akkana Peck <akkana@cvs.gnome.org>
|
||||
|
||||
* menus/image-menu.xml.in
|
||||
|
|
|
@ -124,6 +124,8 @@ libappwidgets_a_sources = \
|
|||
gimpdockbook.h \
|
||||
gimpdocked.c \
|
||||
gimpdocked.h \
|
||||
gimpdockseparator.c \
|
||||
gimpdockseparator.h \
|
||||
gimpdocumentview.c \
|
||||
gimpdocumentview.h \
|
||||
gimpdrawabletreeview.c \
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include "gimpdock.h"
|
||||
#include "gimpdockable.h"
|
||||
#include "gimpdockbook.h"
|
||||
#include "gimpdockseparator.h"
|
||||
#include "gimphelp-ids.h"
|
||||
#include "gimpmessagebox.h"
|
||||
#include "gimpmessagedialog.h"
|
||||
|
@ -46,8 +47,8 @@
|
|||
#include "gimp-intl.h"
|
||||
|
||||
|
||||
#define DEFAULT_DOCK_HEIGHT 300
|
||||
#define DEFAULT_SEPARATOR_HEIGHT 6
|
||||
#define DEFAULT_DOCK_HEIGHT 300
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
|
@ -94,28 +95,9 @@ static void gimp_dock_real_book_added (GimpDock *dock,
|
|||
static void gimp_dock_real_book_removed (GimpDock *dock,
|
||||
GimpDockbook *dockbook);
|
||||
|
||||
static GtkWidget * gimp_dock_separator_new (GimpDock *dock);
|
||||
static void gimp_dock_separator_drag_leave (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
guint time,
|
||||
gpointer data);
|
||||
static gboolean gimp_dock_separator_drag_motion (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
gint x,
|
||||
gint y,
|
||||
guint time,
|
||||
gpointer data);
|
||||
static gboolean gimp_dock_separator_drag_drop (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
gint x,
|
||||
gint y,
|
||||
guint time,
|
||||
GimpDock *dock);
|
||||
|
||||
|
||||
static GtkWindowClass *parent_class = NULL;
|
||||
static guint dock_signals[LAST_SIGNAL] = { 0 };
|
||||
static GtkTargetEntry dialog_target_table[] = { GIMP_TARGET_DIALOG };
|
||||
|
||||
|
||||
GType
|
||||
|
@ -207,13 +189,6 @@ gimp_dock_class_init (GimpDockClass *klass)
|
|||
G_MAXINT,
|
||||
DEFAULT_DOCK_HEIGHT,
|
||||
G_PARAM_READABLE));
|
||||
gtk_widget_class_install_style_property (widget_class,
|
||||
g_param_spec_int ("separator-height",
|
||||
NULL, NULL,
|
||||
0,
|
||||
G_MAXINT,
|
||||
DEFAULT_SEPARATOR_HEIGHT,
|
||||
G_PARAM_READABLE));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -403,32 +378,14 @@ static void
|
|||
gimp_dock_style_set (GtkWidget *widget,
|
||||
GtkStyle *prev_style)
|
||||
{
|
||||
GimpDock *dock = GIMP_DOCK (widget);
|
||||
GList *children;
|
||||
GList *list;
|
||||
gint default_height;
|
||||
gint separator_height;
|
||||
gint default_height;
|
||||
|
||||
if (GTK_WIDGET_CLASS (parent_class)->style_set)
|
||||
GTK_WIDGET_CLASS (parent_class)->style_set (widget, prev_style);
|
||||
|
||||
gtk_widget_style_get (widget,
|
||||
"default-height", &default_height,
|
||||
"separator-height", &separator_height,
|
||||
NULL);
|
||||
gtk_widget_style_get (widget, "default-height", &default_height, NULL);
|
||||
|
||||
gtk_window_set_default_size (GTK_WINDOW (widget), -1, default_height);
|
||||
|
||||
children = gtk_container_get_children (GTK_CONTAINER (dock->vbox));
|
||||
|
||||
for (list = children; list; list = g_list_next (list))
|
||||
{
|
||||
if (GTK_IS_EVENT_BOX (list->data))
|
||||
gtk_widget_set_size_request (GTK_WIDGET (list->data),
|
||||
-1, separator_height);
|
||||
}
|
||||
|
||||
g_list_free (children);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -665,149 +622,3 @@ gimp_dock_remove_book (GimpDock *dock,
|
|||
|
||||
g_object_unref (dockbook);
|
||||
}
|
||||
|
||||
|
||||
/* private functions */
|
||||
|
||||
static GtkWidget *
|
||||
gimp_dock_separator_new (GimpDock *dock)
|
||||
{
|
||||
GtkWidget *event_box;
|
||||
GtkWidget *frame;
|
||||
gint separator_height;
|
||||
|
||||
event_box = gtk_event_box_new ();
|
||||
|
||||
gtk_widget_set_name (event_box, "gimp-dock-separator");
|
||||
|
||||
gtk_widget_style_get (GTK_WIDGET (dock),
|
||||
"separator-height", &separator_height,
|
||||
NULL);
|
||||
|
||||
gtk_widget_set_size_request (event_box, -1, separator_height);
|
||||
|
||||
frame = gtk_frame_new (NULL);
|
||||
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_OUT);
|
||||
gtk_container_add (GTK_CONTAINER (event_box), frame);
|
||||
gtk_widget_show (frame);
|
||||
|
||||
gimp_help_set_help_data (event_box,
|
||||
_("You can drop dockable dialogs here."),
|
||||
GIMP_HELP_DOCK_SEPARATOR);
|
||||
|
||||
gtk_drag_dest_set (GTK_WIDGET (event_box),
|
||||
GTK_DEST_DEFAULT_ALL,
|
||||
dialog_target_table, G_N_ELEMENTS (dialog_target_table),
|
||||
GDK_ACTION_MOVE);
|
||||
|
||||
g_signal_connect (event_box, "drag-leave",
|
||||
G_CALLBACK (gimp_dock_separator_drag_leave),
|
||||
NULL);
|
||||
g_signal_connect (event_box, "drag-motion",
|
||||
G_CALLBACK (gimp_dock_separator_drag_motion),
|
||||
NULL);
|
||||
g_signal_connect (event_box, "drag-drop",
|
||||
G_CALLBACK (gimp_dock_separator_drag_drop),
|
||||
dock);
|
||||
|
||||
return event_box;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_dock_separator_drag_leave (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
guint time,
|
||||
gpointer data)
|
||||
{
|
||||
gtk_widget_modify_bg (widget, GTK_STATE_NORMAL, NULL);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gimp_dock_separator_drag_motion (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
gint x,
|
||||
gint y,
|
||||
guint time,
|
||||
gpointer data)
|
||||
{
|
||||
GdkColor *color = gtk_widget_get_style (widget)->bg + GTK_STATE_SELECTED;
|
||||
|
||||
gtk_widget_modify_bg (widget, GTK_STATE_NORMAL, color);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gimp_dock_separator_drag_drop (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
gint x,
|
||||
gint y,
|
||||
guint time,
|
||||
GimpDock *dock)
|
||||
{
|
||||
GtkWidget *source = gtk_drag_get_source_widget (context);
|
||||
|
||||
if (source)
|
||||
{
|
||||
GimpDockable *dockable;
|
||||
|
||||
if (GIMP_IS_DOCKABLE (source))
|
||||
dockable = GIMP_DOCKABLE (source);
|
||||
else
|
||||
dockable = (GimpDockable *) g_object_get_data (G_OBJECT (source),
|
||||
"gimp-dockable");
|
||||
|
||||
if (dockable)
|
||||
{
|
||||
GtkWidget *dockbook;
|
||||
GList *children;
|
||||
gint index;
|
||||
|
||||
g_object_set_data (G_OBJECT (dockable),
|
||||
"gimp-dock-drag-widget", NULL);
|
||||
|
||||
children = gtk_container_get_children (GTK_CONTAINER (widget->parent));
|
||||
index = g_list_index (children, widget);
|
||||
g_list_free (children);
|
||||
|
||||
if (index == 0)
|
||||
index = 0;
|
||||
else if (index == 2)
|
||||
index = -1;
|
||||
|
||||
/* if dropping to the same dock, take care that we don't try
|
||||
* to reorder the *only* dockable in the dock
|
||||
*/
|
||||
if (dockable->dockbook->dock == dock)
|
||||
{
|
||||
gint n_books;
|
||||
gint n_dockables;
|
||||
|
||||
n_books = g_list_length (dock->dockbooks);
|
||||
|
||||
children =
|
||||
gtk_container_get_children (GTK_CONTAINER (dockable->dockbook));
|
||||
n_dockables = g_list_length (children);
|
||||
g_list_free (children);
|
||||
|
||||
if (n_books == 1 && n_dockables == 1)
|
||||
return TRUE; /* successfully do nothing */
|
||||
}
|
||||
|
||||
g_object_ref (dockable);
|
||||
|
||||
gimp_dockbook_remove (dockable->dockbook, dockable);
|
||||
|
||||
dockbook = gimp_dockbook_new (dock->dialog_factory->menu_factory);
|
||||
gimp_dock_add_book (dock, GIMP_DOCKBOOK (dockbook), index);
|
||||
|
||||
gimp_dockbook_add (GIMP_DOCKBOOK (dockbook), dockable, -1);
|
||||
|
||||
g_object_unref (dockable);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,327 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* gimpdockseparator.c
|
||||
* Copyright (C) 2005 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 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "libgimpwidgets/gimpwidgets.h"
|
||||
|
||||
#include "widgets-types.h"
|
||||
|
||||
#include "gimpdialogfactory.h"
|
||||
#include "gimpdnd.h"
|
||||
#include "gimphelp-ids.h"
|
||||
#include "gimpdock.h"
|
||||
#include "gimpdockable.h"
|
||||
#include "gimpdockbook.h"
|
||||
#include "gimpdockseparator.h"
|
||||
|
||||
#include "gimp-intl.h"
|
||||
|
||||
|
||||
#define DEFAULT_HEIGHT 6
|
||||
#define LABEL_PADDING 4
|
||||
|
||||
|
||||
static void gimp_dock_separator_class_init (GimpDockSeparatorClass *klass);
|
||||
static void gimp_dock_separator_init (GimpDockSeparator *separator);
|
||||
|
||||
static void gimp_dock_separator_style_set (GtkWidget *widget,
|
||||
GtkStyle *prev_style);
|
||||
static void gimp_dock_separator_size_allocate (GtkWidget *widget,
|
||||
GtkAllocation *allocation);
|
||||
static void gimp_dock_separator_drag_leave (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
guint time);
|
||||
static gboolean gimp_dock_separator_drag_motion (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
gint x,
|
||||
gint y,
|
||||
guint time);
|
||||
static gboolean gimp_dock_separator_drag_drop (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
gint x,
|
||||
gint y,
|
||||
guint time);
|
||||
|
||||
|
||||
static GtkEventBoxClass *parent_class = NULL;
|
||||
static GtkTargetEntry dialog_target_table[] = { GIMP_TARGET_DIALOG };
|
||||
|
||||
|
||||
GType
|
||||
gimp_dock_separator_get_type (void)
|
||||
{
|
||||
static GType type = 0;
|
||||
|
||||
if (! type)
|
||||
{
|
||||
static const GTypeInfo info =
|
||||
{
|
||||
sizeof (GimpDockSeparatorClass),
|
||||
NULL, /* base_init */
|
||||
NULL, /* base_finalize */
|
||||
(GClassInitFunc) gimp_dock_separator_class_init,
|
||||
NULL, /* class_finalize */
|
||||
NULL, /* class_data */
|
||||
sizeof (GimpDockSeparator),
|
||||
0, /* n_preallocs */
|
||||
(GInstanceInitFunc) gimp_dock_separator_init,
|
||||
};
|
||||
|
||||
type = g_type_register_static (GTK_TYPE_EVENT_BOX,
|
||||
"GimpDockSeparator",
|
||||
&info, 0);
|
||||
}
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_dock_separator_class_init (GimpDockSeparatorClass *klass)
|
||||
{
|
||||
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
|
||||
|
||||
parent_class = g_type_class_peek_parent (klass);
|
||||
|
||||
widget_class->style_set = gimp_dock_separator_style_set;
|
||||
widget_class->size_allocate = gimp_dock_separator_size_allocate;
|
||||
widget_class->drag_leave = gimp_dock_separator_drag_leave;
|
||||
widget_class->drag_motion = gimp_dock_separator_drag_motion;
|
||||
widget_class->drag_drop = gimp_dock_separator_drag_drop;
|
||||
|
||||
gtk_widget_class_install_style_property (widget_class,
|
||||
g_param_spec_int ("height",
|
||||
NULL, NULL,
|
||||
0,
|
||||
G_MAXINT,
|
||||
DEFAULT_HEIGHT,
|
||||
G_PARAM_READABLE));
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_dock_separator_init (GimpDockSeparator *separator)
|
||||
{
|
||||
GtkWidget *frame;
|
||||
|
||||
frame = gtk_frame_new (NULL);
|
||||
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_OUT);
|
||||
gtk_container_add (GTK_CONTAINER (separator), frame);
|
||||
gtk_widget_show (frame);
|
||||
|
||||
gimp_help_set_help_data (GTK_WIDGET (separator),
|
||||
_("You can drop dockable dialogs here."),
|
||||
GIMP_HELP_DOCK_SEPARATOR);
|
||||
|
||||
gtk_drag_dest_set (GTK_WIDGET (separator),
|
||||
GTK_DEST_DEFAULT_ALL,
|
||||
dialog_target_table, G_N_ELEMENTS (dialog_target_table),
|
||||
GDK_ACTION_MOVE);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_dock_separator_style_set (GtkWidget *widget,
|
||||
GtkStyle *prev_style)
|
||||
{
|
||||
gint height;
|
||||
|
||||
if (GTK_WIDGET_CLASS (parent_class)->style_set)
|
||||
GTK_WIDGET_CLASS (parent_class)->style_set (widget, prev_style);
|
||||
|
||||
gtk_widget_style_get (widget, "height", &height, NULL);
|
||||
|
||||
gtk_widget_set_size_request (widget, -1, height);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_dock_separator_size_allocate (GtkWidget *widget,
|
||||
GtkAllocation *allocation)
|
||||
{
|
||||
GimpDockSeparator *separator = GIMP_DOCK_SEPARATOR (widget);
|
||||
|
||||
GTK_WIDGET_CLASS (parent_class)->size_allocate (widget, allocation);
|
||||
|
||||
if (separator->label)
|
||||
{
|
||||
GtkWidget *frame = GTK_BIN (separator)->child;
|
||||
gint width = frame->allocation.width - 2 * LABEL_PADDING;
|
||||
|
||||
gtk_widget_set_size_request (separator->label, width, -1);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_dock_separator_drag_leave (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
guint time)
|
||||
{
|
||||
if (GTK_WIDGET_CLASS (parent_class)->drag_leave)
|
||||
GTK_WIDGET_CLASS (parent_class)->drag_leave (widget, context, time);
|
||||
|
||||
gtk_widget_modify_bg (widget, GTK_STATE_NORMAL, NULL);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gimp_dock_separator_drag_motion (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
gint x,
|
||||
gint y,
|
||||
guint time)
|
||||
{
|
||||
GdkColor *color;
|
||||
|
||||
if (GTK_WIDGET_CLASS (parent_class)->drag_motion)
|
||||
GTK_WIDGET_CLASS (parent_class)->drag_motion (widget, context, x, y, time);
|
||||
|
||||
color = gtk_widget_get_style (widget)->bg + GTK_STATE_SELECTED;
|
||||
|
||||
gtk_widget_modify_bg (widget, GTK_STATE_NORMAL, color);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gimp_dock_separator_drag_drop (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
gint x,
|
||||
gint y,
|
||||
guint time)
|
||||
{
|
||||
GimpDockSeparator *separator = GIMP_DOCK_SEPARATOR (widget);
|
||||
GtkWidget *source;
|
||||
|
||||
if (GTK_WIDGET_CLASS (parent_class)->drag_drop)
|
||||
GTK_WIDGET_CLASS (parent_class)->drag_drop (widget, context, x, y, time);
|
||||
|
||||
source = gtk_drag_get_source_widget (context);
|
||||
|
||||
if (source)
|
||||
{
|
||||
GimpDock *dock = separator->dock;
|
||||
GimpDockable *dockable;
|
||||
|
||||
if (GIMP_IS_DOCKABLE (source))
|
||||
dockable = GIMP_DOCKABLE (source);
|
||||
else
|
||||
dockable = (GimpDockable *) g_object_get_data (G_OBJECT (source),
|
||||
"gimp-dockable");
|
||||
|
||||
if (dockable)
|
||||
{
|
||||
GtkWidget *dockbook;
|
||||
GList *children;
|
||||
gint index;
|
||||
|
||||
g_object_set_data (G_OBJECT (dockable),
|
||||
"gimp-dock-drag-widget", NULL);
|
||||
|
||||
children = gtk_container_get_children (GTK_CONTAINER (widget->parent));
|
||||
index = g_list_index (children, widget);
|
||||
g_list_free (children);
|
||||
|
||||
if (index == 0)
|
||||
index = 0;
|
||||
else if (index == 2)
|
||||
index = -1;
|
||||
|
||||
/* if dropping to the same dock, take care that we don't try
|
||||
* to reorder the *only* dockable in the dock
|
||||
*/
|
||||
if (dockable->dockbook->dock == dock)
|
||||
{
|
||||
gint n_books;
|
||||
gint n_dockables;
|
||||
|
||||
n_books = g_list_length (dock->dockbooks);
|
||||
|
||||
children =
|
||||
gtk_container_get_children (GTK_CONTAINER (dockable->dockbook));
|
||||
n_dockables = g_list_length (children);
|
||||
g_list_free (children);
|
||||
|
||||
if (n_books == 1 && n_dockables == 1)
|
||||
return TRUE; /* successfully do nothing */
|
||||
}
|
||||
|
||||
g_object_ref (dockable);
|
||||
|
||||
gimp_dockbook_remove (dockable->dockbook, dockable);
|
||||
|
||||
dockbook = gimp_dockbook_new (dock->dialog_factory->menu_factory);
|
||||
gimp_dock_add_book (dock, GIMP_DOCKBOOK (dockbook), index);
|
||||
|
||||
gimp_dockbook_add (GIMP_DOCKBOOK (dockbook), dockable, -1);
|
||||
|
||||
g_object_unref (dockable);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
/* public functions */
|
||||
|
||||
GtkWidget *
|
||||
gimp_dock_separator_new (GimpDock *dock)
|
||||
{
|
||||
GimpDockSeparator *separator;
|
||||
|
||||
separator = g_object_new (GIMP_TYPE_DOCK_SEPARATOR, NULL);
|
||||
|
||||
separator->dock = dock;
|
||||
|
||||
return GTK_WIDGET (separator);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_dock_separator_set_show_label (GimpDockSeparator *separator,
|
||||
gboolean show)
|
||||
{
|
||||
GtkWidget *frame;
|
||||
|
||||
g_return_if_fail (GIMP_IS_DOCK_SEPARATOR (separator));
|
||||
|
||||
frame = GTK_BIN (separator)->child;
|
||||
|
||||
if (show && ! separator->label)
|
||||
{
|
||||
separator->label =
|
||||
gtk_label_new (_("You can drop dockable dialogs here."));
|
||||
gtk_misc_set_padding (GTK_MISC (separator->label),
|
||||
LABEL_PADDING, LABEL_PADDING);
|
||||
gtk_label_set_line_wrap (GTK_LABEL (separator->label), TRUE);
|
||||
gtk_label_set_justify (GTK_LABEL (separator->label), GTK_JUSTIFY_CENTER);
|
||||
gimp_label_set_attributes (GTK_LABEL (separator->label),
|
||||
PANGO_ATTR_STYLE, PANGO_STYLE_ITALIC,
|
||||
-1);
|
||||
gtk_container_add (GTK_CONTAINER (frame), separator->label);
|
||||
gtk_widget_show (separator->label);
|
||||
}
|
||||
else if (! show && separator->label)
|
||||
{
|
||||
gtk_container_remove (GTK_CONTAINER (frame), separator->label);
|
||||
separator->label = NULL;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* gimpdockseparator.h
|
||||
* Copyright (C) 2005 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 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef __GIMP_DOCK_SEPARATOR_H__
|
||||
#define __GIMP_DOCK_SEPARATOR_H__
|
||||
|
||||
|
||||
#include <gtk/gtkeventbox.h>
|
||||
|
||||
|
||||
#define GIMP_TYPE_DOCK_SEPARATOR (gimp_dock_separator_get_type ())
|
||||
#define GIMP_DOCK_SEPARATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_DOCK_SEPARATOR, GimpDockSeparator))
|
||||
#define GIMP_DOCK_SEPARATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_DOCK_SEPARATOR, GimpDockSeparatorClass))
|
||||
#define GIMP_IS_DOCK_SEPARATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_DOCK_SEPARATOR))
|
||||
#define GIMP_IS_DOCK_SEPARATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_DOCK_SEPARATOR))
|
||||
#define GIMP_DOCK_SEPARATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_DOCK_SEPARATOR, GimpDockSeparatorClass))
|
||||
|
||||
|
||||
typedef struct _GimpDockSeparatorClass GimpDockSeparatorClass;
|
||||
|
||||
struct _GimpDockSeparator
|
||||
{
|
||||
GtkEventBox parent_instance;
|
||||
|
||||
GimpDock *dock;
|
||||
GtkWidget *label;
|
||||
};
|
||||
|
||||
struct _GimpDockSeparatorClass
|
||||
{
|
||||
GtkEventBoxClass parent_class;
|
||||
};
|
||||
|
||||
|
||||
GType gimp_dock_separator_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GtkWidget * gimp_dock_separator_new (GimpDock *dock);
|
||||
|
||||
void gimp_dock_separator_set_show_label (GimpDockSeparator *separator,
|
||||
gboolean show);
|
||||
|
||||
|
||||
#endif /* __GIMP_DOCK_SEPARATOR_H__ */
|
|
@ -39,6 +39,7 @@
|
|||
|
||||
#include "gimpdevices.h"
|
||||
#include "gimpdialogfactory.h"
|
||||
#include "gimpdockseparator.h"
|
||||
#include "gimphelp-ids.h"
|
||||
#include "gimptoolbox.h"
|
||||
#include "gimptoolbox-color-area.h"
|
||||
|
@ -325,6 +326,8 @@ gimp_toolbox_constructor (GType type,
|
|||
|
||||
gimp_toolbox_style_set (GTK_WIDGET (toolbox), GTK_WIDGET (toolbox)->style);
|
||||
|
||||
toolbox_separator_expand (toolbox);
|
||||
|
||||
return object;
|
||||
}
|
||||
|
||||
|
@ -497,6 +500,7 @@ gimp_toolbox_book_added (GimpDock *dock,
|
|||
{
|
||||
if (g_list_length (dock->dockbooks) == 1)
|
||||
{
|
||||
gimp_toolbox_set_geometry (GIMP_TOOLBOX (dock));
|
||||
toolbox_separator_collapse (GIMP_TOOLBOX (dock));
|
||||
}
|
||||
}
|
||||
|
@ -508,6 +512,7 @@ gimp_toolbox_book_removed (GimpDock *dock,
|
|||
if (g_list_length (dock->dockbooks) == 0 &&
|
||||
! (GTK_OBJECT_FLAGS (dock) & GTK_IN_DESTRUCTION))
|
||||
{
|
||||
gimp_toolbox_set_geometry (GIMP_TOOLBOX (dock));
|
||||
toolbox_separator_expand (GIMP_TOOLBOX (dock));
|
||||
}
|
||||
}
|
||||
|
@ -708,10 +713,6 @@ toolbox_separator_expand (GimpToolbox *toolbox)
|
|||
GimpDock *dock = GIMP_DOCK (toolbox);
|
||||
GList *children;
|
||||
GtkWidget *separator;
|
||||
GtkWidget *frame;
|
||||
GtkWidget *label;
|
||||
|
||||
gimp_toolbox_set_geometry (toolbox);
|
||||
|
||||
children = gtk_container_get_children (GTK_CONTAINER (dock->vbox));
|
||||
separator = children->data;
|
||||
|
@ -719,15 +720,7 @@ toolbox_separator_expand (GimpToolbox *toolbox)
|
|||
|
||||
gtk_box_set_child_packing (GTK_BOX (dock->vbox), separator,
|
||||
TRUE, TRUE, 0, GTK_PACK_START);
|
||||
|
||||
label = gtk_label_new (_("You can drop dockable dialogs here."));
|
||||
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
|
||||
gimp_label_set_attributes (GTK_LABEL (label),
|
||||
PANGO_ATTR_STYLE, PANGO_STYLE_ITALIC,
|
||||
-1);
|
||||
frame = GTK_BIN (separator)->child;
|
||||
gtk_container_add (GTK_CONTAINER (frame), label);
|
||||
gtk_widget_show (label);
|
||||
gimp_dock_separator_set_show_label (GIMP_DOCK_SEPARATOR (separator), TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -736,9 +729,6 @@ toolbox_separator_collapse (GimpToolbox *toolbox)
|
|||
GimpDock *dock = GIMP_DOCK (toolbox);
|
||||
GList *children;
|
||||
GtkWidget *separator;
|
||||
GtkWidget *frame;
|
||||
|
||||
gimp_toolbox_set_geometry (GIMP_TOOLBOX (dock));
|
||||
|
||||
children = gtk_container_get_children (GTK_CONTAINER (dock->vbox));
|
||||
separator = children->data;
|
||||
|
@ -746,10 +736,7 @@ toolbox_separator_collapse (GimpToolbox *toolbox)
|
|||
|
||||
gtk_box_set_child_packing (GTK_BOX (dock->vbox), separator,
|
||||
FALSE, FALSE, 0, GTK_PACK_START);
|
||||
|
||||
frame = GTK_BIN (separator)->child;
|
||||
if (GTK_BIN (frame)->child)
|
||||
gtk_container_remove (GTK_CONTAINER (frame), GTK_BIN (frame)->child);
|
||||
gimp_dock_separator_set_show_label (GIMP_DOCK_SEPARATOR (separator), FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -38,6 +38,7 @@ typedef struct _GimpControllerWheel GimpControllerWheel;
|
|||
/* docks */
|
||||
|
||||
typedef struct _GimpDock GimpDock;
|
||||
typedef struct _GimpDockSeparator GimpDockSeparator; /* not a dock */
|
||||
typedef struct _GimpImageDock GimpImageDock;
|
||||
typedef struct _GimpMenuDock GimpMenuDock;
|
||||
typedef struct _GimpToolbox GimpToolbox;
|
||||
|
|
|
@ -37,8 +37,8 @@ style "gimp-default-style"
|
|||
}
|
||||
|
||||
GtkPaned::handle_size = 6
|
||||
GimpDock::separator_height = 6
|
||||
GimpDock::default_height = 300
|
||||
GimpDockSeparator::height = 6
|
||||
GimpMenuDock::minimal_width = 250
|
||||
GimpMenuDock::menu_preview_size = button
|
||||
GimpToolbox::tool_icon_size = button
|
||||
|
|
|
@ -42,8 +42,8 @@ style "gimp-default-style"
|
|||
GtkOptionMenu::indicator_spacing = { 4, 3, 1, 1 }
|
||||
|
||||
GtkPaned::handle_size = 5
|
||||
GimpDock::separator_height = 5
|
||||
GimpDock::default_height = 240
|
||||
GimpDockSeparator::height = 5
|
||||
GimpMenuDock::minimal_width = 200
|
||||
GimpMenuDock::menu_preview_size = small-toolbar
|
||||
GimpToolbox::tool_icon_size = menu
|
||||
|
|
Loading…
Reference in New Issue