mirror of https://github.com/GNOME/gimp.git
fiddle with the color of the dock separator to make the drop area stand
2003-03-14 Sven Neumann <sven@gimp.org> * app/widgets/gimpdock.c: fiddle with the color of the dock separator to make the drop area stand out. Added a tooltip. * etc/gtkrc_user: document how the color can be customized.
This commit is contained in:
parent
0225506c43
commit
9589037bb5
|
@ -1,3 +1,10 @@
|
|||
2003-03-14 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/widgets/gimpdock.c: fiddle with the color of the dock
|
||||
separator to make the drop area stand out. Added a tooltip.
|
||||
|
||||
* etc/gtkrc_user: document how the color can be customized.
|
||||
|
||||
2003-03-14 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* libgimpwidgets/gimpcolorarea.[ch]: let GimpColorArea optionally
|
||||
|
|
|
@ -36,6 +36,8 @@
|
|||
#include "gimpdockable.h"
|
||||
#include "gimpdockbook.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
||||
#define DEFAULT_SEPARATOR_HEIGHT 6
|
||||
|
||||
|
@ -62,14 +64,22 @@ static void gimp_dock_real_book_added (GimpDock *dock,
|
|||
static void gimp_dock_real_book_removed (GimpDock *dock,
|
||||
GimpDockbook *dockbook);
|
||||
|
||||
static void gimp_dock_separator_realize (GtkWidget *widget,
|
||||
gpointer data);
|
||||
static gboolean gimp_dock_separator_drag_drop (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
gint x,
|
||||
gint y,
|
||||
guint time,
|
||||
gpointer data);
|
||||
|
||||
/*
|
||||
static gboolean gimp_dock_separator_button_press (GtkWidget *widget,
|
||||
GdkEventButton *bevent,
|
||||
gpointer data);
|
||||
static gboolean gimp_dock_separator_button_release (GtkWidget *widget,
|
||||
GdkEventButton *bevent,
|
||||
gpointer data);
|
||||
|
||||
/*
|
||||
static void gimp_dock_separator_drag_begin (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
gpointer data);
|
||||
|
@ -78,13 +88,6 @@ static void gimp_dock_separator_drag_end (GtkWidget *widget,
|
|||
gpointer data);
|
||||
*/
|
||||
|
||||
static gboolean gimp_dock_separator_drag_drop (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
gint x,
|
||||
gint y,
|
||||
guint time,
|
||||
gpointer data);
|
||||
|
||||
|
||||
static GtkWindowClass *parent_class = NULL;
|
||||
|
||||
|
@ -283,6 +286,13 @@ gimp_dock_separator_new (GimpDock *dock)
|
|||
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."), NULL);
|
||||
|
||||
g_signal_connect (event_box, "realize",
|
||||
G_CALLBACK (gimp_dock_separator_realize),
|
||||
frame);
|
||||
|
||||
gtk_drag_dest_set (GTK_WIDGET (event_box),
|
||||
GTK_DEST_DEFAULT_ALL,
|
||||
dialog_target_table, G_N_ELEMENTS (dialog_target_table),
|
||||
|
@ -291,13 +301,6 @@ gimp_dock_separator_new (GimpDock *dock)
|
|||
G_CALLBACK (gimp_dock_separator_drag_drop),
|
||||
dock);
|
||||
|
||||
g_signal_connect (event_box, "button_press_event",
|
||||
G_CALLBACK (gimp_dock_separator_button_press),
|
||||
dock);
|
||||
g_signal_connect (event_box, "button_release_event",
|
||||
G_CALLBACK (gimp_dock_separator_button_release),
|
||||
dock);
|
||||
|
||||
return event_box;
|
||||
}
|
||||
|
||||
|
@ -508,6 +511,81 @@ gimp_dock_remove_book (GimpDock *dock,
|
|||
g_object_unref (dockbook);
|
||||
}
|
||||
|
||||
|
||||
/* fiddle with the color to make the drop area stand out */
|
||||
static void
|
||||
gimp_dock_separator_realize (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GdkColor *color;
|
||||
|
||||
color = gtk_widget_get_style (widget)->bg + GTK_STATE_SELECTED;
|
||||
|
||||
gtk_widget_modify_bg (widget, GTK_STATE_NORMAL, color);
|
||||
gtk_widget_modify_bg (GTK_WIDGET (data), GTK_STATE_NORMAL, color);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gimp_dock_separator_drag_drop (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
gint x,
|
||||
gint y,
|
||||
guint time,
|
||||
gpointer data)
|
||||
{
|
||||
GimpDock *dock;
|
||||
GtkWidget *source;
|
||||
|
||||
dock = GIMP_DOCK (data);
|
||||
|
||||
source = gtk_drag_get_source_widget (context);
|
||||
|
||||
if (source)
|
||||
{
|
||||
GimpDockable *src_dockable;
|
||||
|
||||
src_dockable = (GimpDockable *) g_object_get_data (G_OBJECT (source),
|
||||
"gimp-dockable");
|
||||
|
||||
if (src_dockable)
|
||||
{
|
||||
GtkWidget *dockbook;
|
||||
GList *children;
|
||||
gint index;
|
||||
|
||||
g_object_set_data (G_OBJECT (src_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;
|
||||
|
||||
g_object_ref (src_dockable);
|
||||
|
||||
gimp_dockbook_remove (src_dockable->dockbook, src_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), src_dockable, -1);
|
||||
|
||||
g_object_unref (src_dockable);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
|
||||
static gboolean
|
||||
gimp_dock_separator_button_press (GtkWidget *widget,
|
||||
GdkEventButton *bevent,
|
||||
|
@ -537,7 +615,6 @@ gimp_dock_separator_button_release (GtkWidget *widget,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
static void
|
||||
gimp_dock_tab_drag_begin (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
|
@ -606,61 +683,3 @@ gimp_dock_tab_drag_end (GtkWidget *widget,
|
|||
}
|
||||
}
|
||||
*/
|
||||
|
||||
static gboolean
|
||||
gimp_dock_separator_drag_drop (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
gint x,
|
||||
gint y,
|
||||
guint time,
|
||||
gpointer data)
|
||||
{
|
||||
GimpDock *dock;
|
||||
GtkWidget *source;
|
||||
|
||||
dock = GIMP_DOCK (data);
|
||||
|
||||
source = gtk_drag_get_source_widget (context);
|
||||
|
||||
if (source)
|
||||
{
|
||||
GimpDockable *src_dockable;
|
||||
|
||||
src_dockable = (GimpDockable *) g_object_get_data (G_OBJECT (source),
|
||||
"gimp-dockable");
|
||||
|
||||
if (src_dockable)
|
||||
{
|
||||
GtkWidget *dockbook;
|
||||
GList *children;
|
||||
gint index;
|
||||
|
||||
g_object_set_data (G_OBJECT (src_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;
|
||||
|
||||
g_object_ref (src_dockable);
|
||||
|
||||
gimp_dockbook_remove (src_dockable->dockbook, src_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), src_dockable, -1);
|
||||
|
||||
g_object_unref (src_dockable);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
|
|
@ -51,11 +51,12 @@ binding "gimp-help-binding"
|
|||
# class "GtkWidget" binding "gimp-help-binding"
|
||||
|
||||
|
||||
# The dock separator is configurable using it's name:
|
||||
# The dock separator is configurable using it's name.
|
||||
# Note that it uses the bg color of the selected state.
|
||||
|
||||
style "gimp-blue-separator-style"
|
||||
style "gimp-red-separator-style"
|
||||
{
|
||||
bg[NORMAL] = "#8888aa"
|
||||
bg[SELECTED] = "#aa2448"
|
||||
}
|
||||
|
||||
# widget "*dock-separator*" style "gimp-blue-separator-style"
|
||||
# widget "*dock-separator*" style "gimp-red-separator-style"
|
||||
|
|
|
@ -239,6 +239,7 @@ app/widgets/gimpcolormapeditor.c
|
|||
app/widgets/gimpcontainergridview.c
|
||||
app/widgets/gimpdataeditor.c
|
||||
app/widgets/gimpdatafactoryview.c
|
||||
app/widgets/gimpdock.c
|
||||
app/widgets/gimpdocumentview.c
|
||||
app/widgets/gimpdnd.c
|
||||
app/widgets/gimpdrawablelistview.c
|
||||
|
|
Loading…
Reference in New Issue