Commit 4ccb6504 authored by Martin Nordholts's avatar Martin Nordholts

Exterminate GimpDockSeparator

Remove all GimpDockSeparator-related code. Seems pointless to keep
even the stuff in gtkrc.
parent c08c6e21
......@@ -134,8 +134,6 @@ libappwidgets_a_sources = \
gimpdockbook.h \
gimpdocked.c \
gimpdocked.h \
gimpdockseparator.c \
gimpdockseparator.h \
gimpdockwindow.c \
gimpdockwindow.h \
gimpdocumentview.c \
......
......@@ -34,7 +34,6 @@
#include "gimpdock.h"
#include "gimpdockable.h"
#include "gimpdockbook.h"
#include "gimpdockseparator.h"
#include "gimppanedbox.h"
#include "gimpuimanager.h"
#include "gimpwidgets-utils.h"
......
......@@ -35,7 +35,6 @@
#include "gimpdockable.h"
#include "gimpdockbook.h"
#include "gimpdockcolumns.h"
#include "gimpdockseparator.h"
#include "gimpmenudock.h"
#include "gimppanedbox.h"
......
/* GIMP - The GNU 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 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"
#undef GSEAL_ENABLE
#include <gtk/gtk.h>
#include "libgimpwidgets/gimpwidgets.h"
#include "widgets-types.h"
#include "gimpdialogfactory.h"
#include "gimpdnd.h"
#include "gimphelp-ids.h"
#include "gimpdockseparator.h"
#include "gimp-intl.h"
#define DEFAULT_HEIGHT 6
#define LABEL_PADDING 4
#define HELP_TEXT _("You can drop dockable dialogs here")
struct _GimpDockSeparatorPrivate
{
GimpPanedBoxDroppedFunc dropped_cb;
gpointer *dropped_cb_data;
GtkWidget *frame;
GtkWidget *label;
GtkAnchorType anchor;
};
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);
G_DEFINE_TYPE (GimpDockSeparator, gimp_dock_separator, GTK_TYPE_EVENT_BOX)
#define parent_class gimp_dock_separator_parent_class
static const GtkTargetEntry dialog_target_table[] = { GIMP_TARGET_DIALOG };
static void
gimp_dock_separator_class_init (GimpDockSeparatorClass *klass)
{
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (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,
GIMP_PARAM_READABLE));
g_type_class_add_private (klass, sizeof (GimpDockSeparatorPrivate));
}
static void
gimp_dock_separator_init (GimpDockSeparator *separator)
{
separator->p = G_TYPE_INSTANCE_GET_PRIVATE (separator,
GIMP_TYPE_DOCK_SEPARATOR,
GimpDockSeparatorPrivate);
separator->p->frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (separator->p->frame), GTK_SHADOW_OUT);
gtk_container_add (GTK_CONTAINER (separator), separator->p->frame);
gtk_widget_show (separator->p->frame);
gimp_help_set_help_data (GTK_WIDGET (separator),
HELP_TEXT, 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;
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->p->label)
{
gint width = separator->p->frame->allocation.width - 2 * LABEL_PADDING;
gtk_widget_set_size_request (separator->p->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);
if (! separator->p->dropped_cb)
return FALSE;
source = gtk_drag_get_source_widget (context);
if (source)
{
return separator->p->dropped_cb (source,
gimp_dock_separator_get_insert_pos (separator),
separator->p->dropped_cb_data);
}
return FALSE;
}
/* public functions */
GtkWidget *
gimp_dock_separator_new (GtkAnchorType anchor)
{
GimpDockSeparator *separator;
separator = g_object_new (GIMP_TYPE_DOCK_SEPARATOR, NULL);
separator->p->anchor = anchor;
return GTK_WIDGET (separator);
}
void
gimp_dock_separator_set_dropped_cb (GimpDockSeparator *separator,
GimpPanedBoxDroppedFunc dropped_cb,
gpointer dropped_cb_data)
{
g_return_if_fail (GIMP_IS_DOCK_SEPARATOR (separator));
separator->p->dropped_cb = dropped_cb;
separator->p->dropped_cb_data = dropped_cb_data;
}
/**
* gimp_dock_separator_get_index_pos:
* @separator:
*
* Returns: The insert position the separator represents.
**/
gint
gimp_dock_separator_get_insert_pos (GimpDockSeparator *separator)
{
g_return_val_if_fail (GIMP_IS_DOCK_SEPARATOR (separator), GTK_ANCHOR_CENTER);
switch (separator->p->anchor)
{
case GTK_ANCHOR_NORTH:
case GTK_ANCHOR_WEST:
return 0;
case GTK_ANCHOR_SOUTH:
case GTK_ANCHOR_EAST:
return -1;
default:
g_assert_not_reached ();
}
}
void
gimp_dock_separator_set_show_label (GimpDockSeparator *separator,
gboolean show)
{
g_return_if_fail (GIMP_IS_DOCK_SEPARATOR (separator));
if (show && ! separator->p->label)
{
separator->p->label = gtk_label_new (HELP_TEXT);
gtk_misc_set_padding (GTK_MISC (separator->p->label),
LABEL_PADDING, LABEL_PADDING);
gtk_label_set_line_wrap (GTK_LABEL (separator->p->label), TRUE);
gtk_label_set_justify (GTK_LABEL (separator->p->label), GTK_JUSTIFY_CENTER);
gimp_label_set_attributes (GTK_LABEL (separator->p->label),
PANGO_ATTR_STYLE, PANGO_STYLE_ITALIC,
-1);
gtk_container_add (GTK_CONTAINER (separator->p->frame), separator->p->label);
gtk_widget_show (separator->p->label);
gimp_help_set_help_data (GTK_WIDGET (separator),
NULL, GIMP_HELP_DOCK_SEPARATOR);
}
else if (! show && separator->p->label)
{
gtk_container_remove (GTK_CONTAINER (separator->p->frame), separator->p->label);
separator->p->label = NULL;
gimp_help_set_help_data (GTK_WIDGET (separator),
HELP_TEXT, GIMP_HELP_DOCK_SEPARATOR);
}
}
/* GIMP - The GNU 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 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/>.
*/
#ifndef __GIMP_DOCK_SEPARATOR_H__
#define __GIMP_DOCK_SEPARATOR_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 _GimpDockSeparatorPrivate GimpDockSeparatorPrivate;
typedef struct _GimpDockSeparatorClass GimpDockSeparatorClass;
/**
* GimpDockSeparator:
*
* Separates dockable and acts as drop-targets to allow rearrangements
* of them.
*/
struct _GimpDockSeparator
{
GtkEventBox parent_instance;
GimpDockSeparatorPrivate *p;
};
struct _GimpDockSeparatorClass
{
GtkEventBoxClass parent_class;
};
GType gimp_dock_separator_get_type (void) G_GNUC_CONST;
GtkWidget * gimp_dock_separator_new (GtkAnchorType anchor);
void gimp_dock_separator_set_dropped_cb (GimpDockSeparator *separator,
GimpPanedBoxDroppedFunc dropped_cb,
gpointer dropped_cb_data);
gint gimp_dock_separator_get_insert_pos (GimpDockSeparator *separator);
void gimp_dock_separator_set_show_label (GimpDockSeparator *separator,
gboolean show);
#endif /* __GIMP_DOCK_SEPARATOR_H__ */
......@@ -40,7 +40,6 @@
#include "gimpcairo-wilber.h"
#include "gimpdevices.h"
#include "gimpdialogfactory.h"
#include "gimpdockseparator.h"
#include "gimpdockwindow.h"
#include "gimphelp-ids.h"
#include "gimptoolbox.h"
......@@ -105,8 +104,6 @@ static void gimp_toolbox_book_added (GimpDock *dock,
static void gimp_toolbox_book_removed (GimpDock *dock,
GimpDockbook *dockbook);
static void toolbox_separator_expand (GimpToolbox *toolbox);
static void toolbox_separator_collapse (GimpToolbox *toolbox);
static void toolbox_create_tools (GimpToolbox *toolbox,
GimpContext *context);
static GtkWidget * toolbox_create_color_area (GimpToolbox *toolbox,
......@@ -330,8 +327,6 @@ gimp_toolbox_constructor (GType type,
gimp_toolbox_style_set (GTK_WIDGET (toolbox),
gtk_widget_get_style (GTK_WIDGET (toolbox)));
toolbox_separator_expand (toolbox);
return object;
}
......@@ -571,7 +566,6 @@ gimp_toolbox_book_added (GimpDock *dock,
if (g_list_length (gimp_dock_get_dockbooks (dock)) == 1)
{
gimp_dock_invalidate_geometry (dock);
toolbox_separator_collapse (GIMP_TOOLBOX (dock));
}
}
......@@ -583,7 +577,6 @@ gimp_toolbox_book_removed (GimpDock *dock,
! (GTK_OBJECT_FLAGS (dock) & GTK_IN_DESTRUCTION))
{
gimp_dock_invalidate_geometry (dock);
toolbox_separator_expand (GIMP_TOOLBOX (dock));
}
}
......@@ -665,16 +658,6 @@ gimp_toolbox_get_vbox (GimpToolbox *toolbox)
/* private functions */
static void
toolbox_separator_expand (GimpToolbox *toolbox)
{
}
static void
toolbox_separator_collapse (GimpToolbox *toolbox)
{
}
static void
toolbox_create_tools (GimpToolbox *toolbox,
GimpContext *context)
......
......@@ -38,7 +38,6 @@ typedef struct _GimpControllerWheel GimpControllerWheel;
typedef struct _GimpDock GimpDock;
typedef struct _GimpDockColumns GimpDockColumns;
typedef struct _GimpDockSeparator GimpDockSeparator; /* not a dock */
typedef struct _GimpDockWindow GimpDockWindow;
typedef struct _GimpMenuDock GimpMenuDock;
typedef struct _GimpToolbox GimpToolbox;
......
......@@ -22,14 +22,3 @@ style "gimp-large-preview"
}
# class "GimpPreview" style "gimp-large-preview"
#
# Change the dock separator DND highlight color:
#
style "gimp-red-separator-style"
{
bg[SELECTED] = "#aa2448"
}
# widget "*gimp-dock-separator*" style "gimp-red-separator-style"
......@@ -39,7 +39,6 @@ style "gimp-default-style"
GtkPaned::handle-size = 6
GimpDockWindow::default-height = 300
GimpDockWindow::font-scale = 0.8333
GimpDockSeparator::height = 6
GimpMenuDock::minimal-width = 200
GimpMenuDock::menu-preview-size = button
GimpToolbox::tool-icon-size = button
......
......@@ -46,7 +46,6 @@ style "gimp-default-style"
GtkPaned::handle-size = 5
GimpDockWindow::default-height = 240
GimpDockWindow::font-scale = 0.8333
GimpDockSeparator::height = 5
GimpMenuDock::minimal-width = 200
GimpMenuDock::menu-preview-size = small-toolbar
GimpToolbox::tool-icon-size = menu
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment