gimp r24656 - in branches/weskaggs: . app/display app/gui



Author: weskaggs
Date: Sat Jan 19 17:43:17 2008
New Revision: 24656
URL: http://svn.gnome.org/viewvc/gimp?rev=24656&view=rev

Log:
Bill Skaggs  <weskaggs primate ucdavis edu>

	Set up appearance of scratch display before showing
	it, to reduce flashing.
	
	* app/gui/gui-vtable.c
	* app/display/gimpdisplayshell.[ch]
	* app/display/gimpdisplay.[ch]


Modified:
   branches/weskaggs/ChangeLog
   branches/weskaggs/app/display/gimpdisplay.c
   branches/weskaggs/app/display/gimpdisplay.h
   branches/weskaggs/app/display/gimpdisplayshell.c
   branches/weskaggs/app/display/gimpdisplayshell.h
   branches/weskaggs/app/gui/gui-vtable.c

Modified: branches/weskaggs/app/display/gimpdisplay.c
==============================================================================
--- branches/weskaggs/app/display/gimpdisplay.c	(original)
+++ branches/weskaggs/app/display/gimpdisplay.c	Sat Jan 19 17:43:17 2008
@@ -39,6 +39,7 @@
 #include "gimpdisplay.h"
 #include "gimpdisplay-handlers.h"
 #include "gimpdisplayshell.h"
+#include "gimpdisplayshell-appearance.h"
 #include "gimpdisplayshell-handlers.h"
 #include "gimpdisplayshell-transform.h"
 
@@ -388,6 +389,69 @@
   return display;
 }
 
+GimpDisplay *
+gimp_scratch_display_new (GimpImage       *image,
+                          GimpUnit         unit,
+                          gdouble          scale,
+                          GimpMenuFactory *menu_factory,
+                          GimpUIManager   *popup_manager)
+{
+  GimpDisplay      *display;
+  Gimp             *gimp;
+  gint              ID;
+  GimpDisplayShell *shell;
+  gint              width, height;
+
+  g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
+
+  gimp = image->gimp;
+
+  /*  If there isn't an interface, never create a display  */
+  if (gimp->no_interface)
+    return NULL;
+
+  do
+    {
+      ID = gimp->next_display_ID++;
+
+      if (gimp->next_display_ID == G_MAXINT)
+        gimp->next_display_ID = 1;
+    }
+  while (gimp_display_get_by_ID (gimp, ID));
+
+  display = g_object_new (GIMP_TYPE_DISPLAY,
+                          "id", ID,
+                          NULL);
+
+  /*  refs the image  */
+  gimp_display_connect (display, image);
+
+  /*  create the shell for the image  */
+  display->shell = gimp_display_shell_new (display, unit, scale,
+                                  menu_factory, popup_manager);
+  shell = GIMP_DISPLAY_SHELL (display->shell);
+
+  gimp_display_shell_set_show_layer      (shell, FALSE);
+  gimp_display_shell_set_show_rulers     (shell, FALSE);
+  gimp_display_shell_set_show_scrollbars (shell, FALSE);
+  gimp_display_shell_set_show_statusbar  (shell, FALSE);
+
+  width  = SCALEX (shell, gimp_image_get_width  (shell->display->image));
+  height = SCALEY (shell, gimp_image_get_height (shell->display->image));
+  gtk_widget_set_size_request (display->shell, width, height);
+
+  gtk_widget_show (display->shell);
+
+  g_signal_connect (GIMP_DISPLAY_SHELL (display->shell)->statusbar, "cancel",
+                    G_CALLBACK (gimp_display_progress_canceled),
+                    display);
+
+  /* add the display to the list */
+  gimp_container_add (gimp->displays, GIMP_OBJECT (display));
+
+  return display;
+}
+
 void
 gimp_display_delete (GimpDisplay *display)
 {

Modified: branches/weskaggs/app/display/gimpdisplay.h
==============================================================================
--- branches/weskaggs/app/display/gimpdisplay.h	(original)
+++ branches/weskaggs/app/display/gimpdisplay.h	Sat Jan 19 17:43:17 2008
@@ -61,6 +61,11 @@
                                         gdouble          scale,
                                         GimpMenuFactory *menu_factory,
                                         GimpUIManager   *popup_manager);
+GimpDisplay * gimp_scratch_display_new (GimpImage       *image,
+                                        GimpUnit         unit,
+                                        gdouble          scale,
+                                        GimpMenuFactory *menu_factory,
+                                        GimpUIManager   *popup_manager);
 void          gimp_display_delete      (GimpDisplay     *display);
 
 gint          gimp_display_get_ID      (GimpDisplay     *display);

Modified: branches/weskaggs/app/display/gimpdisplayshell.c
==============================================================================
--- branches/weskaggs/app/display/gimpdisplayshell.c	(original)
+++ branches/weskaggs/app/display/gimpdisplayshell.c	Sat Jan 19 17:43:17 2008
@@ -1645,22 +1645,6 @@
     }
 }
 
-void
-gimp_display_shell_shrink_wrap_strict (GimpDisplayShell *shell)
-{
-  gint          width, height;
-
-  g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
-
-  if (! GTK_WIDGET_REALIZED (shell))
-    return;
-
-  width  = SCALEX (shell, gimp_image_get_width  (shell->display->image));
-  height = SCALEY (shell, gimp_image_get_height (shell->display->image));
-
-  gtk_window_resize (GTK_WINDOW (shell), width, height);
-}
-
 /**
  * gimp_display_shell_set_highlight:
  * @shell:     a #GimpDisplayShell

Modified: branches/weskaggs/app/display/gimpdisplayshell.h
==============================================================================
--- branches/weskaggs/app/display/gimpdisplayshell.h	(original)
+++ branches/weskaggs/app/display/gimpdisplayshell.h	Sat Jan 19 17:43:17 2008
@@ -253,7 +253,6 @@
 void        gimp_display_shell_update_icon         (GimpDisplayShell   *shell);
 
 void        gimp_display_shell_shrink_wrap         (GimpDisplayShell   *shell);
-void        gimp_display_shell_shrink_wrap_strict  (GimpDisplayShell   *shell);
 
 void        gimp_display_shell_set_highlight       (GimpDisplayShell   *shell,
                                                     const GdkRectangle *highlight);

Modified: branches/weskaggs/app/gui/gui-vtable.c
==============================================================================
--- branches/weskaggs/app/gui/gui-vtable.c	(original)
+++ branches/weskaggs/app/gui/gui-vtable.c	Sat Jan 19 17:43:17 2008
@@ -313,23 +313,15 @@
 
   image_managers = gimp_ui_managers_from_name ("<Image>");
 
-  display = gimp_display_new (image, unit, scale,
-                              global_menu_factory,
-                              image_managers->data);
+  display = gimp_scratch_display_new (image, unit, scale,
+                                      global_menu_factory,
+                                      image_managers->data);
 
   shell = GIMP_DISPLAY_SHELL (display->shell);
 
-  gimp_context_set_display (gimp_get_user_context (image->gimp), display);
-
-  gimp_display_shell_set_show_layer      (shell, FALSE);
-  gimp_display_shell_set_show_rulers     (shell, FALSE);
-  gimp_display_shell_set_show_scrollbars (shell, FALSE);
-  gimp_display_shell_set_show_statusbar  (shell, FALSE);
-
-  gimp_display_shell_shrink_wrap_strict (shell);
-
   gimp_ui_manager_update (shell->menubar_manager, display);
 
+  gimp_context_set_display (gimp_get_user_context (image->gimp), display);
 
   return GIMP_OBJECT (display);
 }



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