gimp r26114 - in trunk: . app/display



Author: martinn
Date: Fri Jul 11 03:20:17 2008
New Revision: 26114
URL: http://svn.gnome.org/viewvc/gimp?rev=26114&view=rev

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

	* app/display/gimpdisplayshell-scroll.[ch]
	(gimp_display_shell_get_viewport): Extend the interface with this
	function.

	* app/display/gimpnavigationeditor.c
	(gimp_navigation_editor_update_marker): Use it here.


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	Fri Jul 11 03:20:17 2008
@@ -144,6 +144,7 @@
  *
  * Gets the viewport in screen coordinates, with origin at (0, 0) in
  * the image
+ *
  **/
 void
 gimp_display_shell_get_scaled_viewport (GimpDisplayShell *shell,
@@ -157,3 +158,29 @@
   if (w) *w =  shell->disp_width;
   if (h) *h =  shell->disp_height;
 }
+
+/**
+ * gimp_display_shell_get_viewport:
+ * @shell:
+ * @x:
+ * @y:
+ * @w:
+ * @h:
+ *
+ * Gets the viewport in image coordinates
+ *
+ * TODO: Handle when the viewport is zoomed out
+ *
+ **/
+void
+gimp_display_shell_get_viewport (GimpDisplayShell *shell,
+                                 gdouble          *x,
+                                 gdouble          *y,
+                                 gdouble          *w,
+                                 gdouble          *h)
+{
+  if (x) *x = shell->offset_x    / shell->scale_x;
+  if (y) *y = shell->offset_y    / shell->scale_y;
+  if (w) *w = shell->disp_width  / shell->scale_x;
+  if (h) *h = shell->disp_height / shell->scale_y;
+}

Modified: trunk/app/display/gimpdisplayshell-scroll.h
==============================================================================
--- trunk/app/display/gimpdisplayshell-scroll.h	(original)
+++ trunk/app/display/gimpdisplayshell-scroll.h	Fri Jul 11 03:20:17 2008
@@ -32,5 +32,11 @@
                                                     gint             *w,
                                                     gint             *h);
 
+void       gimp_display_shell_get_viewport         (GimpDisplayShell *shell,
+                                                    gdouble          *x,
+                                                    gdouble          *y,
+                                                    gdouble          *w,
+                                                    gdouble          *h);
+
 
 #endif  /*  __GIMP_DISPLAY_SHELL_SCROLL_H__  */

Modified: trunk/app/display/gimpnavigationeditor.c
==============================================================================
--- trunk/app/display/gimpnavigationeditor.c	(original)
+++ trunk/app/display/gimpnavigationeditor.c	Fri Jul 11 03:20:17 2008
@@ -640,9 +640,13 @@
     gimp_view_renderer_set_dot_for_dot (renderer, shell->dot_for_dot);
 
   if (renderer->viewable)
-    gimp_navigation_view_set_marker (GIMP_NAVIGATION_VIEW (editor->view),
-                                     shell->offset_x    / shell->scale_x,
-                                     shell->offset_y    / shell->scale_y,
-                                     shell->disp_width  / shell->scale_x,
-                                     shell->disp_height / shell->scale_y);
+    {
+      GimpNavigationView *view = GIMP_NAVIGATION_VIEW (editor->view);
+      gdouble             x, y;
+      gdouble             w, h;
+
+      gimp_display_shell_get_viewport (shell, &x, &y, &w, &h);
+
+      gimp_navigation_view_set_marker (view, x, y, w, h);
+    }
 }



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