From 5b5e4e039afbed713a7cdd867bd964c35042bba2 Mon Sep 17 00:00:00 2001 From: Michael Natterer Date: Fri, 25 Sep 2009 18:35:58 +0200 Subject: [PATCH] Add gimp_image_window_add_display() and use it This API is most likely not final, but enables adding the vbox of shell widgets to the image window's vbox *after* the shell constructor returns. Seems to work nicely :-) --- app/display/gimpdisplay.c | 4 ++++ app/display/gimpdisplayshell.c | 10 ++++++---- app/display/gimpdisplayshell.h | 2 ++ app/display/gimpimagewindow.c | 20 ++++++++++++++++++++ app/display/gimpimagewindow.h | 4 ++++ 5 files changed, 36 insertions(+), 4 deletions(-) diff --git a/app/display/gimpdisplay.c b/app/display/gimpdisplay.c index d900702f04..2640189ccd 100644 --- a/app/display/gimpdisplay.c +++ b/app/display/gimpdisplay.c @@ -385,6 +385,10 @@ gimp_display_new (Gimp *gimp, menu_factory, popup_manager, display_factory); + /* FIXME image window */ + gimp_image_window_add_display (GIMP_IMAGE_WINDOW (display->shell), + display); + /* FIXME image window */ gimp_image_window_set_active_display (GIMP_IMAGE_WINDOW (display->shell), display); diff --git a/app/display/gimpdisplayshell.c b/app/display/gimpdisplayshell.c index 1eccd2140b..7745c20841 100644 --- a/app/display/gimpdisplayshell.c +++ b/app/display/gimpdisplayshell.c @@ -771,7 +771,6 @@ gimp_display_shell_new (GimpDisplay *display, GimpDisplayShell *shell; GimpDisplayOptions *options; GimpColorDisplayStack *filter; - GtkWidget *disp_vbox; GtkWidget *upper_hbox; GtkWidget *right_vbox; GtkWidget *lower_hbox; @@ -911,14 +910,17 @@ gimp_display_shell_new (GimpDisplay *display, } /* another vbox for everything except the statusbar */ - disp_vbox = gtk_vbox_new (FALSE, 1); + shell->disp_vbox = gtk_vbox_new (FALSE, 1); + +#if 0 gtk_box_pack_start (GTK_BOX (GIMP_IMAGE_WINDOW (shell)->main_vbox), disp_vbox, TRUE, TRUE, 0); gtk_widget_show (disp_vbox); +#endif /* a hbox for the inner_table and the vertical scrollbar */ upper_hbox = gtk_hbox_new (FALSE, 1); - gtk_box_pack_start (GTK_BOX (disp_vbox), upper_hbox, TRUE, TRUE, 0); + gtk_box_pack_start (GTK_BOX (shell->disp_vbox), upper_hbox, TRUE, TRUE, 0); gtk_widget_show (upper_hbox); /* the table containing origin, rulers and the canvas */ @@ -936,7 +938,7 @@ gimp_display_shell_new (GimpDisplay *display, /* the hbox containing the quickmask button, vertical scrollbar and the navigation button */ lower_hbox = gtk_hbox_new (FALSE, 1); - gtk_box_pack_start (GTK_BOX (disp_vbox), lower_hbox, FALSE, FALSE, 0); + gtk_box_pack_start (GTK_BOX (shell->disp_vbox), lower_hbox, FALSE, FALSE, 0); gtk_widget_show (lower_hbox); /* create the scrollbars *************************************************/ diff --git a/app/display/gimpdisplayshell.h b/app/display/gimpdisplayshell.h index 1a9d3efb3a..70c0c3556c 100644 --- a/app/display/gimpdisplayshell.h +++ b/app/display/gimpdisplayshell.h @@ -64,6 +64,8 @@ struct _GimpDisplayShell /* --- cacheline 2 boundary (128 bytes) was 20 bytes ago --- */ + GtkWidget *disp_vbox; /* FIXME temp hack */ + GimpDisplay *display; GimpUIManager *popup_manager; diff --git a/app/display/gimpimagewindow.c b/app/display/gimpimagewindow.c index 83f6293e49..2e53c7ace1 100644 --- a/app/display/gimpimagewindow.c +++ b/app/display/gimpimagewindow.c @@ -446,6 +446,26 @@ gimp_image_window_style_set (GtkWidget *widget, /* public functions */ +void +gimp_image_window_add_display (GimpImageWindow *window, + GimpDisplay *display) +{ + g_return_if_fail (GIMP_IS_IMAGE_WINDOW (window)); + g_return_if_fail (GIMP_IS_DISPLAY (display)); + g_return_if_fail (g_list_find (window->displays, display) == NULL); + + /* FIXME multiple shells */ + g_assert (window->displays == NULL); + + window->displays = g_list_append (window->displays, display); + + /* FIXME multiple shells */ + gtk_box_pack_start (GTK_BOX (window->main_vbox), + GIMP_DISPLAY_SHELL (display->shell)->disp_vbox, + TRUE, TRUE, 0); + gtk_widget_show (GIMP_DISPLAY_SHELL (display->shell)->disp_vbox); +} + void gimp_image_window_set_active_display (GimpImageWindow *window, GimpDisplay *display) diff --git a/app/display/gimpimagewindow.h b/app/display/gimpimagewindow.h index 136e4b5eaf..9a0a6ff3dc 100644 --- a/app/display/gimpimagewindow.h +++ b/app/display/gimpimagewindow.h @@ -36,6 +36,7 @@ struct _GimpImageWindow { GimpWindow parent_instance; + GList *displays; GimpDisplay *active_display; GimpUIManager *menubar_manager; @@ -56,6 +57,9 @@ struct _GimpImageWindowClass GType gimp_image_window_get_type (void) G_GNUC_CONST; +void gimp_image_window_add_display (GimpImageWindow *window, + GimpDisplay *display); + void gimp_image_window_set_active_display (GimpImageWindow *window, GimpDisplay *display); GimpDisplay * gimp_image_window_get_active_display (GimpImageWindow *window);