[gimp] Use large image previews as tab widgets



commit b9b7cadbb029e918e75d6383e76a7851d345d87a
Author: Michael Natterer <mitch gimp org>
Date:   Wed Sep 30 19:25:38 2009 +0200

    Use large image previews as tab widgets

 app/display/gimpimagewindow.c |   22 ++++++++++++++++++++--
 1 files changed, 20 insertions(+), 2 deletions(-)
---
diff --git a/app/display/gimpimagewindow.c b/app/display/gimpimagewindow.c
index bd5ba4f..b796057 100644
--- a/app/display/gimpimagewindow.c
+++ b/app/display/gimpimagewindow.c
@@ -25,6 +25,7 @@
 
 #include "display-types.h"
 
+#include "core/gimp.h"
 #include "core/gimpimage.h"
 #include "core/gimpprogress.h"
 
@@ -34,6 +35,8 @@
 #include "widgets/gimpmenufactory.h"
 #include "widgets/gimpsessioninfo.h"
 #include "widgets/gimpuimanager.h"
+#include "widgets/gimpview.h"
+#include "widgets/gimpviewrenderer-utils.h"
 
 #include "gimpdisplay.h"
 #include "gimpdisplay-foreach.h"
@@ -549,6 +552,7 @@ gimp_image_window_add_shell (GimpImageWindow  *window,
                              GimpDisplayShell *shell)
 {
   GimpImageWindowPrivate *private;
+  GtkWidget              *view;
 
   g_return_if_fail (GIMP_IS_IMAGE_WINDOW (window));
   g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
@@ -559,9 +563,16 @@ gimp_image_window_add_shell (GimpImageWindow  *window,
 
   private->shells = g_list_append (private->shells, shell);
 
+  view = gimp_view_new_by_types (gimp_get_user_context (shell->display->gimp),
+                                 GIMP_TYPE_VIEW, GIMP_TYPE_IMAGE,
+                                 GIMP_VIEW_SIZE_LARGE, 0, FALSE);
+
+  if (shell->display->image)
+    gimp_view_set_viewable (GIMP_VIEW (view),
+                            GIMP_VIEWABLE (shell->display->image));
+
   gtk_notebook_append_page (GTK_NOTEBOOK (private->notebook),
-                            GTK_WIDGET (shell),
-                            gtk_label_new ("foo"));
+                            GTK_WIDGET (shell), view);
 
   if (g_list_length (private->shells) > 1)
     gtk_notebook_set_show_tabs (GTK_NOTEBOOK (private->notebook), TRUE);
@@ -960,6 +971,7 @@ gimp_image_window_image_notify (GimpDisplay      *display,
                                 GimpImageWindow  *window)
 {
   GimpImageWindowPrivate *private = GIMP_IMAGE_WINDOW_GET_PRIVATE (window);
+  GtkWidget              *view;
 
   if (display->image)
     {
@@ -1008,6 +1020,12 @@ gimp_image_window_image_notify (GimpDisplay      *display,
 
     }
 
+  view = gtk_notebook_get_tab_label (GTK_NOTEBOOK (private->notebook),
+                                     display->shell);
+
+  gimp_view_set_viewable (GIMP_VIEW (view),
+                          GIMP_VIEWABLE (display->image));
+
   gimp_ui_manager_update (private->menubar_manager, display);
 }
 



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