gimp r26486 - in trunk: . app/display



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

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

	* app/display/gimpdisplayshell-scroll.[ch]
	(gimp_display_shell_scroll_set_offset): New low level function for
	setting display shell offset.

	(gimp_display_shell_scroll_center_image)

	* app/display/gimpdisplayshell-handlers.c
	(gimp_display_shell_size_changed_detailed_handler): Use it instead
	of gimp_display_shell_scale_by_values().


Modified:
   trunk/ChangeLog
   trunk/app/display/gimpdisplayshell-handlers.c
   trunk/app/display/gimpdisplayshell-scroll.c
   trunk/app/display/gimpdisplayshell-scroll.h

Modified: trunk/app/display/gimpdisplayshell-handlers.c
==============================================================================
--- trunk/app/display/gimpdisplayshell-handlers.c	(original)
+++ trunk/app/display/gimpdisplayshell-handlers.c	Sun Aug 10 13:09:24 2008
@@ -499,14 +499,9 @@
       gint scaled_previous_origin_x = SCALEX (shell, previous_origin_x);
       gint scaled_previous_origin_y = SCALEY (shell, previous_origin_y);
 
-      /* Note that we can't use gimp_display_shell_scroll() here
-       * because that would expose the image twice, causing unwanted
-       * flicker.
-       */
-      gimp_display_shell_scale_by_values (shell, gimp_zoom_model_get_factor (shell->zoom),
-                                          shell->offset_x + scaled_previous_origin_x,
-                                          shell->offset_y + scaled_previous_origin_y,
-                                          FALSE);
+      gimp_display_shell_scroll_set_offset (shell,
+                                            shell->offset_x + scaled_previous_origin_x,
+                                            shell->offset_y + scaled_previous_origin_y);
     }
 }
 

Modified: trunk/app/display/gimpdisplayshell-scroll.c
==============================================================================
--- trunk/app/display/gimpdisplayshell-scroll.c	(original)
+++ trunk/app/display/gimpdisplayshell-scroll.c	Sun Aug 10 13:09:24 2008
@@ -123,6 +123,35 @@
 }
 
 void
+gimp_display_shell_scroll_set_offset (GimpDisplayShell *shell,
+                                      gint              offset_x,
+                                      gint              offset_y)
+{
+  g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
+
+  if (shell->offset_x == offset_x &&
+      shell->offset_y == offset_y)
+    return;
+
+  gimp_display_shell_scale_handle_zoom_revert (shell);
+
+  /* freeze the active tool */
+  gimp_display_shell_pause (shell);
+
+  shell->offset_x = offset_x;
+  shell->offset_y = offset_y;
+
+  gimp_display_shell_scroll_clamp_offsets (shell);
+  gimp_display_shell_update_scrollbars_and_rulers (shell);
+  gimp_display_shell_scrolled (shell);
+
+  gimp_display_shell_expose_full (shell);
+
+  /* re-enable the active tool */
+  gimp_display_shell_resume (shell);
+}
+
+void
 gimp_display_shell_scroll_clamp_offsets (GimpDisplayShell *shell)
 {
   g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
@@ -241,13 +270,9 @@
       target_offset_y = (sh - shell->disp_height) / 2;
     }
 
-  /* Note that we can't use gimp_display_shell_scroll() here
-   * because that would expose the image twice, causing unwanted
-   * flicker.
-   */
-  gimp_display_shell_scale_by_values (shell, gimp_zoom_model_get_factor (shell->zoom),
-                                      target_offset_x, target_offset_y,
-                                      FALSE);
+  gimp_display_shell_scroll_set_offset (shell,
+                                        target_offset_x,
+                                        target_offset_y);
 }
 
 static void

Modified: trunk/app/display/gimpdisplayshell-scroll.h
==============================================================================
--- trunk/app/display/gimpdisplayshell-scroll.h	(original)
+++ trunk/app/display/gimpdisplayshell-scroll.h	Sun Aug 10 13:09:24 2008
@@ -26,6 +26,9 @@
 void   gimp_display_shell_scroll                            (GimpDisplayShell       *shell,
                                                              gint                    x_offset,
                                                              gint                    y_offset);
+void   gimp_display_shell_scroll_set_offset                 (GimpDisplayShell       *shell,
+                                                             gint                    offset_x,
+                                                             gint                    offset_y);
 void   gimp_display_shell_scroll_clamp_offsets              (GimpDisplayShell       *shell);
 void   gimp_display_shell_scroll_center_image               (GimpDisplayShell       *shell,
                                                              gboolean                horizontally,



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