gimp r26489 - in trunk: . app/display



Author: martinn
Date: Sun Aug 10 15:19:24 2008
New Revision: 26489
URL: http://svn.gnome.org/viewvc/gimp?rev=26489&view=rev

Log:
2008-08-10  Martin Nordholts  <martinn svn gnome org>

	* app/display/gimpdisplayshell-callbacks.c
	(gimp_display_shell_canvas_size_allocate): If the image fits
	within the display shell canvas on a given axis, center the image
	on that axis. This behaviour will certainly require a few tweaks
	but let's see how this feels. Feedback welcome.


Modified:
   trunk/ChangeLog
   trunk/app/display/gimpdisplayshell-callbacks.c

Modified: trunk/app/display/gimpdisplayshell-callbacks.c
==============================================================================
--- trunk/app/display/gimpdisplayshell-callbacks.c	(original)
+++ trunk/app/display/gimpdisplayshell-callbacks.c	Sun Aug 10 15:19:24 2008
@@ -302,6 +302,26 @@
       shell->disp_width  = allocation->width;
       shell->disp_height = allocation->height;
 
+      if (shell->display && shell->display->image)
+        {
+          gint sw;
+          gint sh;
+          gboolean center_horizontally;
+          gboolean center_vertically;
+
+          gimp_display_shell_draw_get_scaled_image_size (shell, &sw, &sh);
+
+          center_horizontally = sw < shell->disp_width;
+          center_vertically   = sh < shell->disp_height;
+
+          /* If the image fits within the display shell canvas on a
+           * given axis, center the image on that axis.
+           */
+          gimp_display_shell_scroll_center_image (shell,
+                                                  center_horizontally,
+                                                  center_vertically);
+        }
+
       gimp_display_shell_scroll_clamp_offsets (shell);
       gimp_display_shell_update_scrollbars_and_rulers (shell);
       gimp_display_shell_scaled (shell);



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