mirror of https://github.com/GNOME/gimp.git
Bill Skaggs <weskaggs@primate.ucdavis.edu>
Initial implementation of two-column docks. Needs some fixes and a lot of cleanup. Docks are made to contain a GtkHPaned instead of just a VBox. * app/widgets/gimpviewrenderer.c * app/widgets/gimptoolbox.[ch] * app/widgets/gimpsessioninfo.h * app/widgeapp/widgets/gimpsessioninfo-dock.c * app/widgets/gimpsessioninfo-dock.c * app/widgets/gimpdock.[ch] * app/widgets/gimpdockseparator.[ch] * app/widgets/gimpdockbook.[ch] * app/widgets/gimpviewrenderer.c * app/widgets/gimpviewrendererimage.c: Kludged workaround for missing context whose cause I couldn't figure out; needs fixing. * etc/sessionrc: New default setup with all important dockables in a single dock. svn path=/branches/weskaggs/; revision=24840
This commit is contained in:
parent
a4d97bb525
commit
d6d8f88498
23
ChangeLog
23
ChangeLog
|
@ -1,3 +1,26 @@
|
||||||
|
2008-02-09 Bill Skaggs <weskaggs@primate.ucdavis.edu>
|
||||||
|
|
||||||
|
Initial implementation of two-column docks. Needs
|
||||||
|
some fixes and a lot of cleanup. Docks are made
|
||||||
|
to contain a GtkHPaned instead of just a VBox.
|
||||||
|
|
||||||
|
* app/widgets/gimpviewrenderer.c
|
||||||
|
* app/widgets/gimptoolbox.[ch]
|
||||||
|
* app/widgets/gimpsessioninfo.h
|
||||||
|
* app/widgeapp/widgets/gimpsessioninfo-dock.c
|
||||||
|
* app/widgets/gimpsessioninfo-dock.c
|
||||||
|
* app/widgets/gimpdock.[ch]
|
||||||
|
* app/widgets/gimpdockseparator.[ch]
|
||||||
|
* app/widgets/gimpdockbook.[ch]
|
||||||
|
|
||||||
|
* app/widgets/gimpviewrenderer.c
|
||||||
|
* app/widgets/gimpviewrendererimage.c: Kludged workaround
|
||||||
|
for missing context whose cause I couldn't figure out;
|
||||||
|
needs fixing.
|
||||||
|
|
||||||
|
* etc/sessionrc: New default setup with all important
|
||||||
|
dockables in a single dock.
|
||||||
|
|
||||||
2008-02-06 Bill Skaggs <weskaggs@primate.ucdavis.edu>
|
2008-02-06 Bill Skaggs <weskaggs@primate.ucdavis.edu>
|
||||||
|
|
||||||
Merged 24759:24821 from trunk.
|
Merged 24759:24821 from trunk.
|
||||||
|
|
|
@ -168,12 +168,17 @@ gimp_dock_init (GimpDock *dock)
|
||||||
dock->context = NULL;
|
dock->context = NULL;
|
||||||
dock->dialog_factory = NULL;
|
dock->dialog_factory = NULL;
|
||||||
dock->dockbooks = NULL;
|
dock->dockbooks = NULL;
|
||||||
|
dock->dockbooks2 = NULL;
|
||||||
|
|
||||||
gtk_window_set_role (GTK_WINDOW (dock), "gimp-dock");
|
gtk_window_set_role (GTK_WINDOW (dock), "gimp-dock");
|
||||||
gtk_window_set_resizable (GTK_WINDOW (dock), TRUE);
|
gtk_window_set_resizable (GTK_WINDOW (dock), TRUE);
|
||||||
|
|
||||||
|
dock->paned = gtk_hpaned_new ();
|
||||||
|
gtk_container_add (GTK_CONTAINER (dock), dock->paned);
|
||||||
|
gtk_widget_show (dock->paned);
|
||||||
|
|
||||||
dock->main_vbox = gtk_vbox_new (FALSE, 0);
|
dock->main_vbox = gtk_vbox_new (FALSE, 0);
|
||||||
gtk_container_add (GTK_CONTAINER (dock), dock->main_vbox);
|
gtk_paned_add1 (GTK_PANED (dock->paned), dock->main_vbox);
|
||||||
gtk_widget_show (dock->main_vbox);
|
gtk_widget_show (dock->main_vbox);
|
||||||
|
|
||||||
dock->vbox = gtk_vbox_new (FALSE, 0);
|
dock->vbox = gtk_vbox_new (FALSE, 0);
|
||||||
|
@ -260,6 +265,9 @@ gimp_dock_destroy (GtkObject *object)
|
||||||
while (dock->dockbooks)
|
while (dock->dockbooks)
|
||||||
gimp_dock_remove_book (dock, GIMP_DOCKBOOK (dock->dockbooks->data));
|
gimp_dock_remove_book (dock, GIMP_DOCKBOOK (dock->dockbooks->data));
|
||||||
|
|
||||||
|
while (dock->dockbooks2)
|
||||||
|
gimp_dock_remove_book (dock, GIMP_DOCKBOOK (dock->dockbooks2->data));
|
||||||
|
|
||||||
if (dock->context)
|
if (dock->context)
|
||||||
{
|
{
|
||||||
g_object_unref (dock->context);
|
g_object_unref (dock->context);
|
||||||
|
@ -276,9 +284,12 @@ gimp_dock_delete_event (GtkWidget *widget,
|
||||||
GimpDock *dock = GIMP_DOCK (widget);
|
GimpDock *dock = GIMP_DOCK (widget);
|
||||||
gboolean retval = FALSE;
|
gboolean retval = FALSE;
|
||||||
GList *list;
|
GList *list;
|
||||||
gint n;
|
gint n = 0;
|
||||||
|
|
||||||
for (list = dock->dockbooks, n = 0; list; list = list->next)
|
for (list = dock->dockbooks; list; list = list->next)
|
||||||
|
n += gtk_notebook_get_n_pages (GTK_NOTEBOOK (list->data));
|
||||||
|
|
||||||
|
for (list = dock->dockbooks2; list; list = list->next)
|
||||||
n += gtk_notebook_get_n_pages (GTK_NOTEBOOK (list->data));
|
n += gtk_notebook_get_n_pages (GTK_NOTEBOOK (list->data));
|
||||||
|
|
||||||
if (n > 1)
|
if (n > 1)
|
||||||
|
@ -378,7 +389,7 @@ static void
|
||||||
gimp_dock_real_book_removed (GimpDock *dock,
|
gimp_dock_real_book_removed (GimpDock *dock,
|
||||||
GimpDockbook *dockbook)
|
GimpDockbook *dockbook)
|
||||||
{
|
{
|
||||||
if (dock->dockbooks == NULL)
|
if (dock->dockbooks == NULL && dock->dockbooks2 == NULL )
|
||||||
gtk_widget_destroy (GTK_WIDGET (dock));
|
gtk_widget_destroy (GTK_WIDGET (dock));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -434,6 +445,23 @@ gimp_dock_add (GimpDock *dock,
|
||||||
gimp_dockbook_add (dockbook, dockable, position);
|
gimp_dockbook_add (dockbook, dockable, position);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
gimp_dock_add2 (GimpDock *dock,
|
||||||
|
GimpDockable *dockable,
|
||||||
|
gint section,
|
||||||
|
gint position)
|
||||||
|
{
|
||||||
|
GimpDockbook *dockbook;
|
||||||
|
|
||||||
|
g_return_if_fail (GIMP_IS_DOCK (dock));
|
||||||
|
g_return_if_fail (GIMP_IS_DOCKABLE (dockable));
|
||||||
|
g_return_if_fail (dockable->dockbook == NULL);
|
||||||
|
|
||||||
|
dockbook = GIMP_DOCKBOOK (dock->dockbooks2->data);
|
||||||
|
|
||||||
|
gimp_dockbook_add (dockbook, dockable, position);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
gimp_dock_remove (GimpDock *dock,
|
gimp_dock_remove (GimpDock *dock,
|
||||||
GimpDockable *dockable)
|
GimpDockable *dockable)
|
||||||
|
@ -463,6 +491,7 @@ gimp_dock_add_book (GimpDock *dock,
|
||||||
index = old_length;
|
index = old_length;
|
||||||
|
|
||||||
dockbook->dock = dock;
|
dockbook->dock = dock;
|
||||||
|
dockbook->pane = 1;
|
||||||
dock->dockbooks = g_list_insert (dock->dockbooks, dockbook, index);
|
dock->dockbooks = g_list_insert (dock->dockbooks, dockbook, index);
|
||||||
|
|
||||||
if (old_length == 0)
|
if (old_length == 0)
|
||||||
|
@ -535,6 +564,97 @@ gimp_dock_add_book (GimpDock *dock,
|
||||||
g_signal_emit (dock, dock_signals[BOOK_ADDED], 0, dockbook);
|
g_signal_emit (dock, dock_signals[BOOK_ADDED], 0, dockbook);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* add a book to the right pane */
|
||||||
|
void
|
||||||
|
gimp_dock_add2_book (GimpDock *dock,
|
||||||
|
GimpDockbook *dockbook,
|
||||||
|
gint index)
|
||||||
|
{
|
||||||
|
gint old_length;
|
||||||
|
|
||||||
|
g_return_if_fail (GIMP_IS_DOCK (dock));
|
||||||
|
g_return_if_fail (GIMP_IS_DOCKBOOK (dockbook));
|
||||||
|
g_return_if_fail (dockbook->dock == NULL);
|
||||||
|
|
||||||
|
old_length = g_list_length (dock->dockbooks2);
|
||||||
|
|
||||||
|
if (index >= old_length || index < 0)
|
||||||
|
index = old_length;
|
||||||
|
|
||||||
|
dockbook->dock = dock;
|
||||||
|
dockbook->pane = 2;
|
||||||
|
dock->dockbooks2 = g_list_insert (dock->dockbooks2, dockbook, index);
|
||||||
|
|
||||||
|
if (old_length == 0)
|
||||||
|
{
|
||||||
|
GtkWidget *separator;
|
||||||
|
|
||||||
|
gtk_box_pack_start (GTK_BOX (dock->vbox2), GTK_WIDGET (dockbook),
|
||||||
|
TRUE, TRUE, 0);
|
||||||
|
|
||||||
|
separator = gimp_dock_separator_new (dock);
|
||||||
|
gtk_box_pack_end (GTK_BOX (dock->vbox2), separator, FALSE, FALSE, 0);
|
||||||
|
gtk_widget_show (separator);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
GtkWidget *old_book;
|
||||||
|
GtkWidget *parent;
|
||||||
|
GtkWidget *paned;
|
||||||
|
|
||||||
|
if (index == 0)
|
||||||
|
old_book = g_list_nth_data (dock->dockbooks2, index + 1);
|
||||||
|
else
|
||||||
|
old_book = g_list_nth_data (dock->dockbooks2, index - 1);
|
||||||
|
|
||||||
|
parent = old_book->parent;
|
||||||
|
|
||||||
|
if ((old_length > 1) && (index > 0))
|
||||||
|
{
|
||||||
|
GtkWidget *grandparent;
|
||||||
|
|
||||||
|
grandparent = parent->parent;
|
||||||
|
|
||||||
|
old_book = parent;
|
||||||
|
parent = grandparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
g_object_ref (old_book);
|
||||||
|
|
||||||
|
gtk_container_remove (GTK_CONTAINER (parent), old_book);
|
||||||
|
|
||||||
|
paned = gtk_vpaned_new ();
|
||||||
|
|
||||||
|
if (GTK_IS_VPANED (parent))
|
||||||
|
gtk_paned_pack1 (GTK_PANED (parent), paned, TRUE, FALSE);
|
||||||
|
else
|
||||||
|
gtk_box_pack_start (GTK_BOX (parent), paned, TRUE, TRUE, 0);
|
||||||
|
|
||||||
|
gtk_widget_show (paned);
|
||||||
|
|
||||||
|
if (index == 0)
|
||||||
|
{
|
||||||
|
gtk_paned_pack1 (GTK_PANED (paned), GTK_WIDGET (dockbook),
|
||||||
|
TRUE, FALSE);
|
||||||
|
gtk_paned_pack2 (GTK_PANED (paned), old_book,
|
||||||
|
TRUE, FALSE);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gtk_paned_pack1 (GTK_PANED (paned), old_book,
|
||||||
|
TRUE, FALSE);
|
||||||
|
gtk_paned_pack2 (GTK_PANED (paned), GTK_WIDGET (dockbook),
|
||||||
|
TRUE, FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
g_object_unref (old_book);
|
||||||
|
}
|
||||||
|
|
||||||
|
gtk_widget_show (GTK_WIDGET (dockbook));
|
||||||
|
|
||||||
|
g_signal_emit (dock, dock_signals[BOOK_ADDED], 0, dockbook);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
gimp_dock_remove_book (GimpDock *dock,
|
gimp_dock_remove_book (GimpDock *dock,
|
||||||
GimpDockbook *dockbook)
|
GimpDockbook *dockbook)
|
||||||
|
@ -550,52 +670,108 @@ gimp_dock_remove_book (GimpDock *dock,
|
||||||
old_length = g_list_length (dock->dockbooks);
|
old_length = g_list_length (dock->dockbooks);
|
||||||
index = g_list_index (dock->dockbooks, dockbook);
|
index = g_list_index (dock->dockbooks, dockbook);
|
||||||
|
|
||||||
dockbook->dock = NULL;
|
if (index == -1) /* book is in the right pane */
|
||||||
dock->dockbooks = g_list_remove (dock->dockbooks, dockbook);
|
|
||||||
|
|
||||||
g_object_ref (dockbook);
|
|
||||||
|
|
||||||
if (old_length == 1)
|
|
||||||
{
|
{
|
||||||
GtkWidget *separator;
|
old_length = g_list_length (dock->dockbooks2);
|
||||||
GList *children;
|
index = g_list_index (dock->dockbooks2, dockbook);
|
||||||
|
|
||||||
children = gtk_container_get_children (GTK_CONTAINER (dock->vbox));
|
dockbook->dock = NULL;
|
||||||
|
dock->dockbooks2 = g_list_remove (dock->dockbooks2, dockbook);
|
||||||
|
|
||||||
separator = g_list_nth_data (children, 2);
|
g_object_ref (dockbook);
|
||||||
|
|
||||||
gtk_container_remove (GTK_CONTAINER (dock->vbox), separator);
|
if (old_length == 1)
|
||||||
gtk_container_remove (GTK_CONTAINER (dock->vbox), GTK_WIDGET (dockbook));
|
{
|
||||||
|
GtkWidget *separator;
|
||||||
|
GList *children;
|
||||||
|
|
||||||
g_list_free (children);
|
children = gtk_container_get_children (GTK_CONTAINER (dock->vbox2));
|
||||||
|
|
||||||
|
separator = g_list_nth_data (children, 2);
|
||||||
|
|
||||||
|
gtk_container_remove (GTK_CONTAINER (dock->vbox2), separator);
|
||||||
|
gtk_container_remove (GTK_CONTAINER (dock->vbox2), GTK_WIDGET (dockbook));
|
||||||
|
|
||||||
|
g_list_free (children);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
GtkWidget *other_book;
|
||||||
|
GtkWidget *parent;
|
||||||
|
GtkWidget *grandparent;
|
||||||
|
|
||||||
|
parent = GTK_WIDGET (dockbook)->parent;
|
||||||
|
grandparent = parent->parent;
|
||||||
|
|
||||||
|
if (index == 0)
|
||||||
|
other_book = GTK_PANED (parent)->child2;
|
||||||
|
else
|
||||||
|
other_book = GTK_PANED (parent)->child1;
|
||||||
|
|
||||||
|
g_object_ref (other_book);
|
||||||
|
|
||||||
|
gtk_container_remove (GTK_CONTAINER (parent), other_book);
|
||||||
|
gtk_container_remove (GTK_CONTAINER (parent), GTK_WIDGET (dockbook));
|
||||||
|
|
||||||
|
gtk_container_remove (GTK_CONTAINER (grandparent), parent);
|
||||||
|
|
||||||
|
if (GTK_IS_VPANED (grandparent))
|
||||||
|
gtk_paned_pack1 (GTK_PANED (grandparent), other_book, TRUE, FALSE);
|
||||||
|
else
|
||||||
|
gtk_box_pack_start (GTK_BOX (dock->vbox2), other_book, TRUE, TRUE, 0);
|
||||||
|
|
||||||
|
g_object_unref (other_book);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
GtkWidget *other_book;
|
dockbook->dock = NULL;
|
||||||
GtkWidget *parent;
|
dock->dockbooks = g_list_remove (dock->dockbooks, dockbook);
|
||||||
GtkWidget *grandparent;
|
|
||||||
|
|
||||||
parent = GTK_WIDGET (dockbook)->parent;
|
g_object_ref (dockbook);
|
||||||
grandparent = parent->parent;
|
|
||||||
|
|
||||||
if (index == 0)
|
if (old_length == 1)
|
||||||
other_book = GTK_PANED (parent)->child2;
|
{
|
||||||
|
GtkWidget *separator;
|
||||||
|
GList *children;
|
||||||
|
|
||||||
|
children = gtk_container_get_children (GTK_CONTAINER (dock->vbox));
|
||||||
|
|
||||||
|
separator = g_list_nth_data (children, 2);
|
||||||
|
|
||||||
|
gtk_container_remove (GTK_CONTAINER (dock->vbox), separator);
|
||||||
|
gtk_container_remove (GTK_CONTAINER (dock->vbox), GTK_WIDGET (dockbook));
|
||||||
|
|
||||||
|
g_list_free (children);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
other_book = GTK_PANED (parent)->child1;
|
{
|
||||||
|
GtkWidget *other_book;
|
||||||
|
GtkWidget *parent;
|
||||||
|
GtkWidget *grandparent;
|
||||||
|
|
||||||
g_object_ref (other_book);
|
parent = GTK_WIDGET (dockbook)->parent;
|
||||||
|
grandparent = parent->parent;
|
||||||
|
|
||||||
gtk_container_remove (GTK_CONTAINER (parent), other_book);
|
if (index == 0)
|
||||||
gtk_container_remove (GTK_CONTAINER (parent), GTK_WIDGET (dockbook));
|
other_book = GTK_PANED (parent)->child2;
|
||||||
|
else
|
||||||
|
other_book = GTK_PANED (parent)->child1;
|
||||||
|
|
||||||
gtk_container_remove (GTK_CONTAINER (grandparent), parent);
|
g_object_ref (other_book);
|
||||||
|
|
||||||
if (GTK_IS_VPANED (grandparent))
|
gtk_container_remove (GTK_CONTAINER (parent), other_book);
|
||||||
gtk_paned_pack1 (GTK_PANED (grandparent), other_book, TRUE, FALSE);
|
gtk_container_remove (GTK_CONTAINER (parent), GTK_WIDGET (dockbook));
|
||||||
else
|
|
||||||
gtk_box_pack_start (GTK_BOX (dock->vbox), other_book, TRUE, TRUE, 0);
|
|
||||||
|
|
||||||
g_object_unref (other_book);
|
gtk_container_remove (GTK_CONTAINER (grandparent), parent);
|
||||||
|
|
||||||
|
if (GTK_IS_VPANED (grandparent))
|
||||||
|
gtk_paned_pack1 (GTK_PANED (grandparent), other_book, TRUE, FALSE);
|
||||||
|
else
|
||||||
|
gtk_box_pack_start (GTK_BOX (dock->vbox), other_book, TRUE, TRUE, 0);
|
||||||
|
|
||||||
|
g_object_unref (other_book);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
g_signal_emit (dock, dock_signals[BOOK_REMOVED], 0, dockbook);
|
g_signal_emit (dock, dock_signals[BOOK_REMOVED], 0, dockbook);
|
||||||
|
|
|
@ -43,10 +43,13 @@ struct _GimpDock
|
||||||
GimpDialogFactory *dialog_factory;
|
GimpDialogFactory *dialog_factory;
|
||||||
GimpContext *context;
|
GimpContext *context;
|
||||||
|
|
||||||
|
GtkWidget *paned;
|
||||||
GtkWidget *main_vbox;
|
GtkWidget *main_vbox;
|
||||||
GtkWidget *vbox;
|
GtkWidget *vbox;
|
||||||
|
GtkWidget *vbox2;
|
||||||
|
|
||||||
GList *dockbooks;
|
GList *dockbooks;
|
||||||
|
GList *dockbooks2;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GimpDockClass
|
struct _GimpDockClass
|
||||||
|
@ -80,12 +83,19 @@ void gimp_dock_add (GimpDock *dock,
|
||||||
GimpDockable *dockable,
|
GimpDockable *dockable,
|
||||||
gint book,
|
gint book,
|
||||||
gint index);
|
gint index);
|
||||||
|
void gimp_dock_add2 (GimpDock *dock,
|
||||||
|
GimpDockable *dockable,
|
||||||
|
gint book,
|
||||||
|
gint index);
|
||||||
void gimp_dock_remove (GimpDock *dock,
|
void gimp_dock_remove (GimpDock *dock,
|
||||||
GimpDockable *dockable);
|
GimpDockable *dockable);
|
||||||
|
|
||||||
void gimp_dock_add_book (GimpDock *dock,
|
void gimp_dock_add_book (GimpDock *dock,
|
||||||
GimpDockbook *dockbook,
|
GimpDockbook *dockbook,
|
||||||
gint index);
|
gint index);
|
||||||
|
void gimp_dock_add2_book (GimpDock *dock,
|
||||||
|
GimpDockbook *dockbook,
|
||||||
|
gint index);
|
||||||
void gimp_dock_remove_book (GimpDock *dock,
|
void gimp_dock_remove_book (GimpDock *dock,
|
||||||
GimpDockbook *dockbook);
|
GimpDockbook *dockbook);
|
||||||
|
|
||||||
|
|
|
@ -188,6 +188,7 @@ gimp_dockbook_init (GimpDockbook *dockbook)
|
||||||
{
|
{
|
||||||
dockbook->dock = NULL;
|
dockbook->dock = NULL;
|
||||||
dockbook->ui_manager = NULL;
|
dockbook->ui_manager = NULL;
|
||||||
|
dockbook->pane = 0;
|
||||||
|
|
||||||
gtk_notebook_popup_enable (GTK_NOTEBOOK (dockbook));
|
gtk_notebook_popup_enable (GTK_NOTEBOOK (dockbook));
|
||||||
gtk_notebook_set_scrollable (GTK_NOTEBOOK (dockbook), TRUE);
|
gtk_notebook_set_scrollable (GTK_NOTEBOOK (dockbook), TRUE);
|
||||||
|
|
|
@ -45,6 +45,8 @@ struct _GimpDockbook
|
||||||
|
|
||||||
guint tab_hover_timeout;
|
guint tab_hover_timeout;
|
||||||
GimpDockable *tab_hover_dockable;
|
GimpDockable *tab_hover_dockable;
|
||||||
|
|
||||||
|
gint pane;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GimpDockbookClass
|
struct _GimpDockbookClass
|
||||||
|
|
|
@ -95,6 +95,8 @@ gimp_dock_separator_init (GimpDockSeparator *separator)
|
||||||
separator->dock = NULL;
|
separator->dock = NULL;
|
||||||
separator->label = NULL;
|
separator->label = NULL;
|
||||||
|
|
||||||
|
separator->pane = 1;
|
||||||
|
|
||||||
separator->frame = gtk_frame_new (NULL);
|
separator->frame = gtk_frame_new (NULL);
|
||||||
gtk_frame_set_shadow_type (GTK_FRAME (separator->frame), GTK_SHADOW_OUT);
|
gtk_frame_set_shadow_type (GTK_FRAME (separator->frame), GTK_SHADOW_OUT);
|
||||||
gtk_container_add (GTK_CONTAINER (separator), separator->frame);
|
gtk_container_add (GTK_CONTAINER (separator), separator->frame);
|
||||||
|
@ -236,7 +238,12 @@ gimp_dock_separator_drag_drop (GtkWidget *widget,
|
||||||
gimp_dockbook_remove (dockable->dockbook, dockable);
|
gimp_dockbook_remove (dockable->dockbook, dockable);
|
||||||
|
|
||||||
dockbook = gimp_dockbook_new (dock->dialog_factory->menu_factory);
|
dockbook = gimp_dockbook_new (dock->dialog_factory->menu_factory);
|
||||||
gimp_dock_add_book (dock, GIMP_DOCKBOOK (dockbook), index);
|
|
||||||
|
if (separator->pane == 2)
|
||||||
|
gimp_dock_add2_book (dock, GIMP_DOCKBOOK (dockbook), index);
|
||||||
|
else
|
||||||
|
gimp_dock_add_book (dock, GIMP_DOCKBOOK (dockbook), index);
|
||||||
|
|
||||||
|
|
||||||
gimp_dockbook_add (GIMP_DOCKBOOK (dockbook), dockable, -1);
|
gimp_dockbook_add (GIMP_DOCKBOOK (dockbook), dockable, -1);
|
||||||
|
|
||||||
|
|
|
@ -44,6 +44,8 @@ struct _GimpDockSeparator
|
||||||
|
|
||||||
GtkWidget *frame;
|
GtkWidget *frame;
|
||||||
GtkWidget *label;
|
GtkWidget *label;
|
||||||
|
|
||||||
|
gint pane;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GimpDockSeparatorClass
|
struct _GimpDockSeparatorClass
|
||||||
|
|
|
@ -38,6 +38,7 @@
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
SESSION_INFO_BOOK_POSITION,
|
SESSION_INFO_BOOK_POSITION,
|
||||||
|
SESSION_INFO_BOOK_PANE,
|
||||||
SESSION_INFO_BOOK_CURRENT_PAGE,
|
SESSION_INFO_BOOK_CURRENT_PAGE,
|
||||||
SESSION_INFO_BOOK_DOCKABLE
|
SESSION_INFO_BOOK_DOCKABLE
|
||||||
};
|
};
|
||||||
|
@ -98,6 +99,10 @@ gimp_session_info_book_serialize (GimpConfigWriter *writer,
|
||||||
gimp_config_writer_printf (writer, "%d", current_page);
|
gimp_config_writer_printf (writer, "%d", current_page);
|
||||||
gimp_config_writer_close (writer);
|
gimp_config_writer_close (writer);
|
||||||
|
|
||||||
|
gimp_config_writer_open (writer, "pane");
|
||||||
|
gimp_config_writer_printf (writer, "%d", dockbook->pane);
|
||||||
|
gimp_config_writer_close (writer);
|
||||||
|
|
||||||
children = gtk_container_get_children (GTK_CONTAINER (dockbook));
|
children = gtk_container_get_children (GTK_CONTAINER (dockbook));
|
||||||
|
|
||||||
for (pages = children; pages; pages = g_list_next (pages))
|
for (pages = children; pages; pages = g_list_next (pages))
|
||||||
|
@ -121,6 +126,8 @@ gimp_session_info_book_deserialize (GScanner *scanner,
|
||||||
|
|
||||||
g_scanner_scope_add_symbol (scanner, scope, "position",
|
g_scanner_scope_add_symbol (scanner, scope, "position",
|
||||||
GINT_TO_POINTER (SESSION_INFO_BOOK_POSITION));
|
GINT_TO_POINTER (SESSION_INFO_BOOK_POSITION));
|
||||||
|
g_scanner_scope_add_symbol (scanner, scope, "pane",
|
||||||
|
GINT_TO_POINTER (SESSION_INFO_BOOK_PANE));
|
||||||
g_scanner_scope_add_symbol (scanner, scope, "current-page",
|
g_scanner_scope_add_symbol (scanner, scope, "current-page",
|
||||||
GINT_TO_POINTER (SESSION_INFO_BOOK_CURRENT_PAGE));
|
GINT_TO_POINTER (SESSION_INFO_BOOK_CURRENT_PAGE));
|
||||||
g_scanner_scope_add_symbol (scanner, scope, "dockable",
|
g_scanner_scope_add_symbol (scanner, scope, "dockable",
|
||||||
|
@ -128,6 +135,9 @@ gimp_session_info_book_deserialize (GScanner *scanner,
|
||||||
|
|
||||||
book = gimp_session_info_book_new ();
|
book = gimp_session_info_book_new ();
|
||||||
|
|
||||||
|
/* FIXME */
|
||||||
|
book->pane = 1;
|
||||||
|
|
||||||
token = G_TOKEN_LEFT_PAREN;
|
token = G_TOKEN_LEFT_PAREN;
|
||||||
|
|
||||||
while (g_scanner_peek_next_token (scanner) == token)
|
while (g_scanner_peek_next_token (scanner) == token)
|
||||||
|
@ -149,6 +159,12 @@ gimp_session_info_book_deserialize (GScanner *scanner,
|
||||||
goto error;
|
goto error;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case SESSION_INFO_BOOK_PANE:
|
||||||
|
token = G_TOKEN_INT;
|
||||||
|
if (! gimp_scanner_parse_int (scanner, &book->pane))
|
||||||
|
goto error;
|
||||||
|
break;
|
||||||
|
|
||||||
case SESSION_INFO_BOOK_CURRENT_PAGE:
|
case SESSION_INFO_BOOK_CURRENT_PAGE:
|
||||||
token = G_TOKEN_INT;
|
token = G_TOKEN_INT;
|
||||||
if (! gimp_scanner_parse_int (scanner, &book->current_page))
|
if (! gimp_scanner_parse_int (scanner, &book->current_page))
|
||||||
|
@ -186,6 +202,7 @@ gimp_session_info_book_deserialize (GScanner *scanner,
|
||||||
info->books = g_list_append (info->books, book);
|
info->books = g_list_append (info->books, book);
|
||||||
|
|
||||||
g_scanner_scope_remove_symbol (scanner, scope, "position");
|
g_scanner_scope_remove_symbol (scanner, scope, "position");
|
||||||
|
g_scanner_scope_remove_symbol (scanner, scope, "pane");
|
||||||
g_scanner_scope_remove_symbol (scanner, scope, "current-page");
|
g_scanner_scope_remove_symbol (scanner, scope, "current-page");
|
||||||
g_scanner_scope_remove_symbol (scanner, scope, "dockable");
|
g_scanner_scope_remove_symbol (scanner, scope, "dockable");
|
||||||
|
|
||||||
|
@ -209,7 +226,11 @@ gimp_session_info_book_restore (GimpSessionInfoBook *info,
|
||||||
|
|
||||||
dockbook = gimp_dockbook_new (dock->dialog_factory->menu_factory);
|
dockbook = gimp_dockbook_new (dock->dialog_factory->menu_factory);
|
||||||
|
|
||||||
gimp_dock_add_book (dock, GIMP_DOCKBOOK (dockbook), -1);
|
if (info->pane == 1)
|
||||||
|
gimp_dock_add_book (dock, GIMP_DOCKBOOK (dockbook), -1);
|
||||||
|
else
|
||||||
|
gimp_dock_add2_book (dock, GIMP_DOCKBOOK (dockbook), -1);
|
||||||
|
|
||||||
|
|
||||||
info->widget = dockbook;
|
info->widget = dockbook;
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,8 @@ struct _GimpSessionInfoBook
|
||||||
gint position;
|
gint position;
|
||||||
gint current_page;
|
gint current_page;
|
||||||
|
|
||||||
|
gint pane;
|
||||||
|
|
||||||
GtkWidget *widget;
|
GtkWidget *widget;
|
||||||
|
|
||||||
/* list of GimpSessionInfoDockable */
|
/* list of GimpSessionInfoDockable */
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
|
|
||||||
#include "gimpdialogfactory.h"
|
#include "gimpdialogfactory.h"
|
||||||
#include "gimpdock.h"
|
#include "gimpdock.h"
|
||||||
|
#include "gimptoolbox.h"
|
||||||
#include "gimpsessioninfo.h"
|
#include "gimpsessioninfo.h"
|
||||||
#include "gimpsessioninfo-aux.h"
|
#include "gimpsessioninfo-aux.h"
|
||||||
#include "gimpsessioninfo-book.h"
|
#include "gimpsessioninfo-book.h"
|
||||||
|
@ -37,7 +38,8 @@
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
SESSION_INFO_BOOK
|
SESSION_INFO_BOOK,
|
||||||
|
SESSION_INFO_GUTTER_POSITION
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -54,9 +56,21 @@ gimp_session_info_dock_serialize (GimpConfigWriter *writer,
|
||||||
|
|
||||||
gimp_config_writer_open (writer, "dock");
|
gimp_config_writer_open (writer, "dock");
|
||||||
|
|
||||||
|
if (GIMP_IS_TOOLBOX (dock))
|
||||||
|
{
|
||||||
|
gint pos = gtk_paned_get_position (GTK_PANED (dock->paned));
|
||||||
|
|
||||||
|
gimp_config_writer_open (writer, "gutter-position");
|
||||||
|
gimp_config_writer_printf (writer, "%d", pos);
|
||||||
|
gimp_config_writer_close (writer);
|
||||||
|
}
|
||||||
|
|
||||||
for (books = dock->dockbooks; books; books = g_list_next (books))
|
for (books = dock->dockbooks; books; books = g_list_next (books))
|
||||||
gimp_session_info_book_serialize (writer, books->data);
|
gimp_session_info_book_serialize (writer, books->data);
|
||||||
|
|
||||||
|
for (books = dock->dockbooks2; books; books = g_list_next (books))
|
||||||
|
gimp_session_info_book_serialize (writer, books->data);
|
||||||
|
|
||||||
gimp_config_writer_close (writer);
|
gimp_config_writer_close (writer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,6 +86,8 @@ gimp_session_info_dock_deserialize (GScanner *scanner,
|
||||||
|
|
||||||
g_scanner_scope_add_symbol (scanner, scope, "book",
|
g_scanner_scope_add_symbol (scanner, scope, "book",
|
||||||
GINT_TO_POINTER (SESSION_INFO_BOOK));
|
GINT_TO_POINTER (SESSION_INFO_BOOK));
|
||||||
|
g_scanner_scope_add_symbol (scanner, scope, "gutter-position",
|
||||||
|
GINT_TO_POINTER (SESSION_INFO_GUTTER_POSITION));
|
||||||
|
|
||||||
token = G_TOKEN_LEFT_PAREN;
|
token = G_TOKEN_LEFT_PAREN;
|
||||||
|
|
||||||
|
@ -100,6 +116,12 @@ gimp_session_info_dock_deserialize (GScanner *scanner,
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case SESSION_INFO_GUTTER_POSITION:
|
||||||
|
token = G_TOKEN_INT;
|
||||||
|
/* FIXME: check for errors */
|
||||||
|
gimp_scanner_parse_int (scanner, &info->gutter_position);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return token;
|
return token;
|
||||||
}
|
}
|
||||||
|
@ -116,6 +138,7 @@ gimp_session_info_dock_deserialize (GScanner *scanner,
|
||||||
}
|
}
|
||||||
|
|
||||||
g_scanner_scope_remove_symbol (scanner, scope, "book");
|
g_scanner_scope_remove_symbol (scanner, scope, "book");
|
||||||
|
g_scanner_scope_remove_symbol (scanner, scope, "gutter-position");
|
||||||
|
|
||||||
return token;
|
return token;
|
||||||
}
|
}
|
||||||
|
@ -162,6 +185,9 @@ gimp_session_info_dock_restore (GimpSessionInfo *info,
|
||||||
if (dock && info->aux_info)
|
if (dock && info->aux_info)
|
||||||
gimp_session_info_aux_set_list (GTK_WIDGET (dock), info->aux_info);
|
gimp_session_info_aux_set_list (GTK_WIDGET (dock), info->aux_info);
|
||||||
|
|
||||||
|
if (GIMP_IS_TOOLBOX (dock) && info->gutter_position > 0)
|
||||||
|
gtk_paned_set_position (GTK_PANED (dock->paned), info->gutter_position);
|
||||||
|
|
||||||
for (books = info->books; books; books = g_list_next (books))
|
for (books = info->books; books; books = g_list_next (books))
|
||||||
gimp_session_info_book_restore (books->data, dock);
|
gimp_session_info_book_restore (books->data, dock);
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,9 @@ struct _GimpSessionInfo
|
||||||
gint width;
|
gint width;
|
||||||
gint height;
|
gint height;
|
||||||
|
|
||||||
|
/* only applies to docks */
|
||||||
|
gint gutter_position;
|
||||||
|
|
||||||
/* only valid while restoring and saving the session */
|
/* only valid while restoring and saving the session */
|
||||||
gboolean open;
|
gboolean open;
|
||||||
gint screen;
|
gint screen;
|
||||||
|
|
|
@ -121,7 +121,7 @@ static void toolbox_paste_received (GtkClipboard *clipboard,
|
||||||
gpointer data);
|
gpointer data);
|
||||||
|
|
||||||
|
|
||||||
G_DEFINE_TYPE (GimpToolbox, gimp_toolbox, GIMP_TYPE_IMAGE_DOCK)
|
G_DEFINE_TYPE (GimpToolbox, gimp_toolbox, GIMP_TYPE_MENU_DOCK)
|
||||||
|
|
||||||
#define parent_class gimp_toolbox_parent_class
|
#define parent_class gimp_toolbox_parent_class
|
||||||
|
|
||||||
|
@ -163,6 +163,18 @@ gimp_toolbox_class_init (GimpToolboxClass *klass)
|
||||||
static void
|
static void
|
||||||
gimp_toolbox_init (GimpToolbox *toolbox)
|
gimp_toolbox_init (GimpToolbox *toolbox)
|
||||||
{
|
{
|
||||||
|
GimpDock *dock = GIMP_DOCK (toolbox);
|
||||||
|
GtkWidget *separator;
|
||||||
|
|
||||||
|
dock->vbox2 = gtk_vbox_new (FALSE, 0);
|
||||||
|
gtk_paned_add2 (GTK_PANED (dock->paned), dock->vbox2);
|
||||||
|
gtk_widget_show (dock->vbox2);
|
||||||
|
|
||||||
|
separator = gimp_dock_separator_new (dock);
|
||||||
|
gtk_box_pack_start (GTK_BOX (dock->vbox2), separator, FALSE, FALSE, 0);
|
||||||
|
gtk_widget_show (separator);
|
||||||
|
GIMP_DOCK_SEPARATOR (separator)->pane = 2;
|
||||||
|
|
||||||
gtk_window_set_role (GTK_WINDOW (toolbox), "gimp-toolbox");
|
gtk_window_set_role (GTK_WINDOW (toolbox), "gimp-toolbox");
|
||||||
|
|
||||||
gimp_help_connect (GTK_WIDGET (toolbox), gimp_standard_help_func,
|
gimp_help_connect (GTK_WIDGET (toolbox), gimp_standard_help_func,
|
||||||
|
@ -348,6 +360,7 @@ gimp_toolbox_size_allocate (GtkWidget *widget,
|
||||||
if (tool_button)
|
if (tool_button)
|
||||||
{
|
{
|
||||||
GtkRequisition button_requisition;
|
GtkRequisition button_requisition;
|
||||||
|
GtkAllocation *alloc2;
|
||||||
GList *list;
|
GList *list;
|
||||||
gint n_tools;
|
gint n_tools;
|
||||||
gint tool_rows;
|
gint tool_rows;
|
||||||
|
@ -365,7 +378,9 @@ gimp_toolbox_size_allocate (GtkWidget *widget,
|
||||||
n_tools++;
|
n_tools++;
|
||||||
}
|
}
|
||||||
|
|
||||||
tool_columns = MAX (1, (allocation->width / button_requisition.width));
|
alloc2 = &GIMP_DOCK (toolbox)->vbox->allocation;
|
||||||
|
|
||||||
|
tool_columns = MAX (1, (alloc2->width / button_requisition.width));
|
||||||
tool_rows = n_tools / tool_columns;
|
tool_rows = n_tools / tool_columns;
|
||||||
|
|
||||||
if (n_tools % tool_columns)
|
if (n_tools % tool_columns)
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
#define __GIMP_TOOLBOX_H__
|
#define __GIMP_TOOLBOX_H__
|
||||||
|
|
||||||
|
|
||||||
#include "gimpimagedock.h"
|
#include "gimpmenudock.h"
|
||||||
|
|
||||||
|
|
||||||
#define GIMP_TYPE_TOOLBOX (gimp_toolbox_get_type ())
|
#define GIMP_TYPE_TOOLBOX (gimp_toolbox_get_type ())
|
||||||
|
@ -35,7 +35,7 @@ typedef struct _GimpToolboxClass GimpToolboxClass;
|
||||||
|
|
||||||
struct _GimpToolbox
|
struct _GimpToolbox
|
||||||
{
|
{
|
||||||
GimpImageDock parent_instance;
|
GimpMenuDock parent_instance;
|
||||||
|
|
||||||
GtkWidget *menu_bar;
|
GtkWidget *menu_bar;
|
||||||
GtkWidget *tool_wbox;
|
GtkWidget *tool_wbox;
|
||||||
|
@ -52,7 +52,7 @@ struct _GimpToolbox
|
||||||
|
|
||||||
struct _GimpToolboxClass
|
struct _GimpToolboxClass
|
||||||
{
|
{
|
||||||
GimpImageDockClass parent_class;
|
GimpMenuDockClass parent_class;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -588,7 +588,7 @@ gimp_view_renderer_draw (GimpViewRenderer *renderer,
|
||||||
g_return_if_fail (expose_area != NULL);
|
g_return_if_fail (expose_area != NULL);
|
||||||
|
|
||||||
if (G_UNLIKELY (renderer->context == NULL))
|
if (G_UNLIKELY (renderer->context == NULL))
|
||||||
g_warning ("%s: renderer->context is NULL", G_STRFUNC);
|
g_print ("gimp_view_renderer_draw: renderer->context is NULL\n");
|
||||||
|
|
||||||
if (! GTK_WIDGET_DRAWABLE (widget))
|
if (! GTK_WIDGET_DRAWABLE (widget))
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
|
|
||||||
#include "base/temp-buf.h"
|
#include "base/temp-buf.h"
|
||||||
|
|
||||||
|
#include "core/gimp.h"
|
||||||
#include "core/gimpimage.h"
|
#include "core/gimpimage.h"
|
||||||
|
|
||||||
#include "gimpviewrendererimage.h"
|
#include "gimpviewrendererimage.h"
|
||||||
|
@ -66,6 +67,10 @@ gimp_view_renderer_image_render (GimpViewRenderer *renderer,
|
||||||
GimpImage *image = GIMP_IMAGE (renderer->viewable);
|
GimpImage *image = GIMP_IMAGE (renderer->viewable);
|
||||||
const gchar *stock_id;
|
const gchar *stock_id;
|
||||||
|
|
||||||
|
/* XXXX FIXME FIXME XXXX */
|
||||||
|
if (! renderer->context)
|
||||||
|
renderer->context = gimp_get_user_context (image->gimp);
|
||||||
|
|
||||||
/* The conditions checked here are mostly a hack to hide the fact that
|
/* The conditions checked here are mostly a hack to hide the fact that
|
||||||
* we are creating the channel preview from the image preview and turning
|
* we are creating the channel preview from the image preview and turning
|
||||||
* off visibility of a channel has the side-effect of painting the channel
|
* off visibility of a channel has the side-effect of painting the channel
|
||||||
|
|
|
@ -1,35 +1,35 @@
|
||||||
# GIMP sessionrc
|
# GIMP sessionrc
|
||||||
#
|
#
|
||||||
# This file takes session-specific info (that is info, you want to keep
|
# This file takes session-specific info (that is info, you want to keep
|
||||||
# between two GIMP sessions). You are not supposed to edit it manually, but
|
# between two GIMP sessions). You are not supposed to edit it manually, but
|
||||||
# of course you can do. The sessionrc will be entirely rewritten every time
|
# of course you can do. The sessionrc will be entirely rewritten every time
|
||||||
# you quit GIMP. If this file isn't found, defaults are used.
|
# you quit GIMP. If this file isn't found, defaults are used.
|
||||||
|
|
||||||
(session-info "toolbox" "dock"
|
(session-info "toolbox" "dock"
|
||||||
(position 48 48)
|
(position 48 48)
|
||||||
(size 204 720)
|
(size 444 720)
|
||||||
(open-on-exit)
|
|
||||||
(dock
|
|
||||||
(book
|
|
||||||
(dockable "gimp-tool-options"))))
|
|
||||||
(session-info "dock" "dock"
|
|
||||||
(position 300 48)
|
|
||||||
(size 240 720)
|
|
||||||
(open-on-exit)
|
(open-on-exit)
|
||||||
(aux-info
|
(aux-info
|
||||||
(show-image-menu "true")
|
(show-image-menu "false")
|
||||||
(follow-active-image "true"))
|
(follow-active-image "true"))
|
||||||
(dock
|
(dock
|
||||||
|
(gutter-position 204)
|
||||||
(book
|
(book
|
||||||
|
(pane 1)
|
||||||
|
(dockable "gimp-tool-options"
|
||||||
|
(tab-style icon)))
|
||||||
|
(book
|
||||||
|
(pane 2)
|
||||||
(dockable "gimp-layer-list"
|
(dockable "gimp-layer-list"
|
||||||
(tab-style icon))
|
(tab-style icon))
|
||||||
(dockable "gimp-channel-list"
|
(dockable "gimp-channel-list"
|
||||||
(tab-style icon))
|
(tab-style icon))
|
||||||
(dockable "gimp-vectors-list"
|
(dockable "gimp-vectors-list"
|
||||||
(tab-style icon))
|
(tab-style icon))
|
||||||
(dockable "gimp-undo-history"
|
(dockable "gimp-undo-history"
|
||||||
(tab-style icon)))
|
(tab-style icon)))
|
||||||
(book
|
(book
|
||||||
|
(pane 2)
|
||||||
(position 360)
|
(position 360)
|
||||||
(dockable "gimp-color-editor"
|
(dockable "gimp-color-editor"
|
||||||
(tab-style preview))
|
(tab-style preview))
|
||||||
|
|
Loading…
Reference in New Issue