gimp r25178 - in trunk: . app/actions app/display



Author: mitch
Date: Sun Mar 23 15:16:44 2008
New Revision: 25178
URL: http://svn.gnome.org/viewvc/gimp?rev=25178&view=rev

Log:
2008-03-23  Michael Natterer  <mitch gimp org>

	Never shrink the empty display when filling it, only grow:

	* app/display/gimpdisplayshell.[ch]
	* app/display/gimpdisplayshell-scale.[ch]: add "gboolean
	grow_only" parameters to shrink_wrap() APIs which restricts
	resizing of the window to growing.

	* app/display/gimpdisplayshell-scale.[ch]
	(gimp_displaY_shell_scale_resize): remove boolean "redisplay"
	parameter because is was always passed as TRUE. Add boolean
	"grow_only" instead and pass it on to shrink_wrap()

	* app/actions/view-commands.c
	* app/display/gimpdisplayshell-handlers.c: pass grow_only = FALSE.

	* app/display/gimpdisplayshell.c (gimp_display_shell_idle_fill):
	pass grow_only = TRUE.



Modified:
   trunk/ChangeLog
   trunk/app/actions/view-commands.c
   trunk/app/display/gimpdisplayshell-handlers.c
   trunk/app/display/gimpdisplayshell-scale.c
   trunk/app/display/gimpdisplayshell-scale.h
   trunk/app/display/gimpdisplayshell.c
   trunk/app/display/gimpdisplayshell.h

Modified: trunk/app/actions/view-commands.c
==============================================================================
--- trunk/app/actions/view-commands.c	(original)
+++ trunk/app/actions/view-commands.c	Sun Mar 23 15:16:44 2008
@@ -631,7 +631,8 @@
   GimpDisplay *display;
   return_if_no_display (display, data);
 
-  gimp_display_shell_scale_shrink_wrap (GIMP_DISPLAY_SHELL (display->shell));
+  gimp_display_shell_scale_shrink_wrap (GIMP_DISPLAY_SHELL (display->shell),
+                                        FALSE);
 }
 
 void

Modified: trunk/app/display/gimpdisplayshell-handlers.c
==============================================================================
--- trunk/app/display/gimpdisplayshell-handlers.c	(original)
+++ trunk/app/display/gimpdisplayshell-handlers.c	Sun Mar 23 15:16:44 2008
@@ -423,7 +423,7 @@
 {
   gimp_display_shell_scale_resize (shell,
                                    shell->display->config->resize_windows_on_resize,
-                                   TRUE);
+                                   FALSE);
 }
 
 static void

Modified: trunk/app/display/gimpdisplayshell-scale.c
==============================================================================
--- trunk/app/display/gimpdisplayshell-scale.c	(original)
+++ trunk/app/display/gimpdisplayshell-scale.c	Sun Mar 23 15:16:44 2008
@@ -305,7 +305,7 @@
 
       gimp_display_shell_scale_resize (shell,
                                        shell->display->config->resize_windows_on_zoom,
-                                       TRUE);
+                                       FALSE);
 
       /* re-enable the active tool */
       gimp_display_shell_resume (shell);
@@ -544,7 +544,7 @@
   shell->offset_x = offset_x;
   shell->offset_y = offset_y;
 
-  gimp_display_shell_scale_resize (shell, resize_window, TRUE);
+  gimp_display_shell_scale_resize (shell, resize_window, FALSE);
 
   /* re-enable the active tool */
   gimp_display_shell_resume (shell);
@@ -555,14 +555,15 @@
  * @shell: the #GimpDisplayShell
  *
  * Convenience function with the same functionality as
- * gimp_display_shell_scale_resize(@shell, TRUE, TRUE).
+ * gimp_display_shell_scale_resize(@shell, TRUE, grow_only).
  **/
 void
-gimp_display_shell_scale_shrink_wrap (GimpDisplayShell *shell)
+gimp_display_shell_scale_shrink_wrap (GimpDisplayShell *shell,
+                                      gboolean          grow_only)
 {
   g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
 
-  gimp_display_shell_scale_resize (shell, TRUE, TRUE);
+  gimp_display_shell_scale_resize (shell, TRUE, grow_only);
 }
 
 /**
@@ -579,7 +580,7 @@
 void
 gimp_display_shell_scale_resize (GimpDisplayShell *shell,
                                  gboolean          resize_window,
-                                 gboolean          redisplay)
+                                 gboolean          grow_only)
 {
   g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
 
@@ -587,13 +588,13 @@
   gimp_display_shell_pause (shell);
 
   if (resize_window)
-    gimp_display_shell_shrink_wrap (shell);
+    gimp_display_shell_shrink_wrap (shell, grow_only);
 
   gimp_display_shell_scroll_clamp_offsets (shell);
   gimp_display_shell_scale_setup (shell);
   gimp_display_shell_scaled (shell);
 
-  if (resize_window || redisplay)
+  if (resize_window)
     gimp_display_shell_expose_full (shell);
 
   /* re-enable the active tool */

Modified: trunk/app/display/gimpdisplayshell-scale.h
==============================================================================
--- trunk/app/display/gimpdisplayshell-scale.h	(original)
+++ trunk/app/display/gimpdisplayshell-scale.h	Sun Mar 23 15:16:44 2008
@@ -43,11 +43,12 @@
                                                  gint              offset_x,
                                                  gint              offset_y,
                                                  gboolean          resize_window);
-void   gimp_display_shell_scale_shrink_wrap     (GimpDisplayShell *shell);
+void   gimp_display_shell_scale_shrink_wrap     (GimpDisplayShell *shell,
+                                                 gboolean          grow_only);
 
 void   gimp_display_shell_scale_resize          (GimpDisplayShell *shell,
                                                  gboolean          resize_window,
-                                                 gboolean          redisplay);
+                                                 gboolean          grow_only);
 void   gimp_display_shell_set_initial_scale     (GimpDisplayShell *shell,
                                                  gdouble           scale,
                                                  gint             *display_width,

Modified: trunk/app/display/gimpdisplayshell.c
==============================================================================
--- trunk/app/display/gimpdisplayshell.c	(original)
+++ trunk/app/display/gimpdisplayshell.c	Sun Mar 23 15:16:44 2008
@@ -1236,7 +1236,7 @@
 {
   shell->fill_idle_id = 0;
 
-  gimp_display_shell_scale_shrink_wrap (shell);
+  gimp_display_shell_scale_shrink_wrap (shell, TRUE);
 
   gtk_window_present (GTK_WINDOW (shell));
 
@@ -1716,7 +1716,8 @@
 }
 
 void
-gimp_display_shell_shrink_wrap (GimpDisplayShell *shell)
+gimp_display_shell_shrink_wrap (GimpDisplayShell *shell,
+                                gboolean          grow_only)
 {
   GtkWidget    *widget;
   GdkScreen    *screen;
@@ -1780,9 +1781,19 @@
       if (width < shell->statusbar->requisition.width)
         width = shell->statusbar->requisition.width;
 
-      gtk_window_resize (GTK_WINDOW (shell),
-                         width  + border_x,
-                         height + border_y);
+      width  = width  + border_x;
+      height = height + border_y;
+
+      if (grow_only)
+        {
+          if (width < widget->allocation.width)
+            width = widget->allocation.width;
+
+          if (height < widget->allocation.height)
+            height = widget->allocation.height;
+        }
+
+      gtk_window_resize (GTK_WINDOW (shell), width, height);
     }
 }
 

Modified: trunk/app/display/gimpdisplayshell.h
==============================================================================
--- trunk/app/display/gimpdisplayshell.h	(original)
+++ trunk/app/display/gimpdisplayshell.h	Sun Mar 23 15:16:44 2008
@@ -263,7 +263,8 @@
 
 void        gimp_display_shell_update_icon         (GimpDisplayShell   *shell);
 
-void        gimp_display_shell_shrink_wrap         (GimpDisplayShell   *shell);
+void        gimp_display_shell_shrink_wrap         (GimpDisplayShell   *shell,
+                                                    gboolean            grow_only);
 
 void        gimp_display_shell_set_highlight       (GimpDisplayShell   *shell,
                                                     const GdkRectangle *highlight);



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