gimp r26712 - in trunk: . app/display



Author: mitch
Date: Fri Aug 22 15:57:41 2008
New Revision: 26712
URL: http://svn.gnome.org/viewvc/gimp?rev=26712&view=rev

Log:
2008-08-22  Michael Natterer  <mitch gimp org>

	* app/display/gimpcanvas.[ch]: add gimp_canvas_scroll() which
	scrolls the canvas and makes the result visible immediately.

	* app/display/gimpdisplayshell-scroll.c
	(gimp_display_shell_scroll): use the new function.



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

Modified: trunk/app/display/gimpcanvas.c
==============================================================================
--- trunk/app/display/gimpcanvas.c	(original)
+++ trunk/app/display/gimpcanvas.c	Fri Aug 22 15:57:41 2008
@@ -556,6 +556,32 @@
 }
 
 /**
+ * gimp_canvas_scroll:
+ * @canvas: the #GimpCanvas widget to scroll.
+ * @offset_x: the x scroll amount.
+ * @offset_y: the y scroll amount.
+ *
+ * Scrolls the canvas using gdk_window_scroll() and makes sure the result
+ * is displayed immediately by calling gdk_window_process_updates().
+ **/
+void
+gimp_canvas_scroll (GimpCanvas *canvas,
+                    gint        offset_x,
+                    gint        offset_y)
+{
+  GtkWidget *widget;
+
+  g_return_if_fail (GIMP_IS_CANVAS (canvas));
+
+  widget = GTK_WIDGET (canvas);
+
+  gdk_window_scroll (widget->window, offset_x, offset_y);
+
+  /*  Make sure expose events are processed before scrolling again  */
+  gdk_window_process_updates (widget->window, FALSE);
+}
+
+/**
  * gimp_canvas_draw_cursor:
  * @canvas: the #GimpCanvas widget to draw on.
  * @x: x coordinate

Modified: trunk/app/display/gimpcanvas.h
==============================================================================
--- trunk/app/display/gimpcanvas.h	(original)
+++ trunk/app/display/gimpcanvas.h	Fri Aug 22 15:57:41 2008
@@ -75,6 +75,10 @@
 
 GtkWidget  * gimp_canvas_new               (GimpDisplayConfig *config);
 
+void         gimp_canvas_scroll            (GimpCanvas        *canvas,
+                                            gint               offset_x,
+                                            gint               offset_y);
+
 void         gimp_canvas_draw_cursor       (GimpCanvas        *canvas,
                                             gint               x,
                                             gint               y);

Modified: trunk/app/display/gimpdisplayshell-scroll.c
==============================================================================
--- trunk/app/display/gimpdisplayshell-scroll.c	(original)
+++ trunk/app/display/gimpdisplayshell-scroll.c	Fri Aug 22 15:57:41 2008
@@ -33,6 +33,7 @@
 #include "core/gimpimage.h"
 #include "core/gimpprojection.h"
 
+#include "gimpcanvas.h"
 #include "gimpdisplay.h"
 #include "gimpdisplay-foreach.h"
 #include "gimpdisplayshell.h"
@@ -117,10 +118,7 @@
       shell->offset_x += x_offset;
       shell->offset_y += y_offset;
 
-      gdk_window_scroll (shell->canvas->window, -x_offset, -y_offset);
-
-      /*  Make sure expose events are processed before scrolling again  */
-      gdk_window_process_updates (shell->canvas->window, FALSE);
+      gimp_canvas_scroll (GIMP_CANVAS (shell->canvas), -x_offset, -y_offset);
 
       /*  Update scrollbars and rulers  */
       gimp_display_shell_update_scrollbars_and_rulers (shell);



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