[gimp] Add gimp_image_window_add_display() and use it



commit 5b5e4e039afbed713a7cdd867bd964c35042bba2
Author: Michael Natterer <mitch gimp org>
Date:   Fri Sep 25 18:35:58 2009 +0200

    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 d900702..2640189 100644
--- a/app/display/gimpdisplay.c
+++ b/app/display/gimpdisplay.c
@@ -386,6 +386,10 @@ gimp_display_new (Gimp              *gimp,
                                            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 1eccd21..7745c20 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 1a9d3ef..70c0c35 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 83f6293..2e53c7a 100644
--- a/app/display/gimpimagewindow.c
+++ b/app/display/gimpimagewindow.c
@@ -447,6 +447,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 136e4b5..9a0a6ff 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);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]