gimp r26162 - in trunk: . app/display



Author: martinn
Date: Sat Jul 12 14:20:54 2008
New Revision: 26162
URL: http://svn.gnome.org/viewvc/gimp?rev=26162&view=rev

Log:
2008-07-12  Martin Nordholts  <martinn svn gnome org>

	* app/display/gimpdisplayshell-scroll.c:
	Replace gimp_display_shell_scroll() with
	gimp_display_shell_center_around_image_coordinate() since that is
	easier to map to something sensible when we allow to scroll beyond
	image border.

	* app/display/gimpnavigationeditor.c
	(gimp_navigation_editor_marker_changed): Adapt to the new
	interface.


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

Modified: trunk/app/display/gimpdisplayshell-scroll.c
==============================================================================
--- trunk/app/display/gimpdisplayshell-scroll.c	(original)
+++ trunk/app/display/gimpdisplayshell-scroll.c	Sat Jul 12 14:20:54 2008
@@ -36,29 +36,25 @@
 #include "gimpdisplayshell-scroll.h"
 
 
-/**
- * gimp_display_shell_scroll:
- * @shell:
- * @x_offset_into_image: In image coordinates.
- * @y_offset_into_image:
- *
- * When the viewport is smaller than the image, offset the viewport to
- * the specified amount into the image.
- *
- * TODO: Behave in a sane way when zoomed out.
- *
- **/
-void gimp_display_shell_scroll (GimpDisplayShell *shell,
-                                gdouble           x_offset_into_image,
-                                gdouble           y_offset_into_image)
+void
+gimp_display_shell_center_around_image_coordinate (GimpDisplayShell       *shell,
+                                                   gdouble                 image_x,
+                                                   gdouble                 image_y)
 {
-  gint x_offset;
-  gint y_offset;
-
-  x_offset = RINT (x_offset_into_image * shell->scale_x - shell->offset_x);
-  y_offset = RINT (y_offset_into_image * shell->scale_y - shell->offset_y);
-
-  gimp_display_shell_scroll_private (shell, x_offset, y_offset);
+  gint scaled_image_x;
+  gint scaled_image_y;
+  gint offset_to_apply_x;
+  gint offset_to_apply_y;
+
+  scaled_image_x = RINT (image_x * shell->scale_x);
+  scaled_image_y = RINT (image_y * shell->scale_y);
+
+  offset_to_apply_x = scaled_image_x - shell->disp_width  / 2 - shell->offset_x;
+  offset_to_apply_y = scaled_image_y - shell->disp_height / 2 - shell->offset_y;
+
+  gimp_display_shell_scroll_private (shell,
+                                     offset_to_apply_x,
+                                     offset_to_apply_y);
 }
 
 void

Modified: trunk/app/display/gimpdisplayshell-scroll.h
==============================================================================
--- trunk/app/display/gimpdisplayshell-scroll.h	(original)
+++ trunk/app/display/gimpdisplayshell-scroll.h	Sat Jul 12 14:20:54 2008
@@ -20,9 +20,9 @@
 #define __GIMP_DISPLAY_SHELL_SCROLL_H__
 
 
-void       gimp_display_shell_scroll                           (GimpDisplayShell       *shell,
-                                                                gdouble                 x_offset_into_image,
-                                                                gdouble                 y_offset_into_image);
+void       gimp_display_shell_center_around_image_coordinate   (GimpDisplayShell       *shell,
+                                                                gdouble                 image_x,
+                                                                gdouble                 image_y);
 
 void       gimp_display_shell_scroll_clamp_offsets             (GimpDisplayShell       *shell);
 

Modified: trunk/app/display/gimpnavigationeditor.c
==============================================================================
--- trunk/app/display/gimpnavigationeditor.c	(original)
+++ trunk/app/display/gimpnavigationeditor.c	Sat Jul 12 14:20:54 2008
@@ -501,7 +501,9 @@
     {
       GimpDisplayShell *shell = editor->shell;
 
-      gimp_display_shell_scroll (shell, x, y);
+      gimp_display_shell_center_around_image_coordinate (shell,
+                                                         x + width / 2,
+                                                         y + height / 2);
     }
 }
 



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