gimp r26775 - in trunk: . app/display
- From: martinn svn gnome org
- To: svn-commits-list gnome org
- Subject: gimp r26775 - in trunk: . app/display
- Date: Tue, 26 Aug 2008 18:50:55 +0000 (UTC)
Author: martinn
Date: Tue Aug 26 18:50:54 2008
New Revision: 26775
URL: http://svn.gnome.org/viewvc/gimp?rev=26775&view=rev
Log:
2008-08-26 Martin Nordholts <martinn svn gnome org>
* app/display/gimpdisplayshell-scroll.c
(gimp_display_shell_scroll_unoverscrollify): New function.
* app/display/gimpdisplayshell-autoscroll.c
(gimp_display_shell_autoscroll_timeout): Make sure the autoscroll
does not result in overscroll. This more or less finalizes the
implementation of the enhancement request in bug #362915.
Modified:
trunk/ChangeLog
trunk/app/display/gimpdisplayshell-autoscroll.c
trunk/app/display/gimpdisplayshell-scroll.c
trunk/app/display/gimpdisplayshell-scroll.h
Modified: trunk/app/display/gimpdisplayshell-autoscroll.c
==============================================================================
--- trunk/app/display/gimpdisplayshell-autoscroll.c (original)
+++ trunk/app/display/gimpdisplayshell-autoscroll.c Tue Aug 26 18:50:54 2008
@@ -137,6 +137,12 @@
info->time += AUTOSCROLL_DT;
+ gimp_display_shell_scroll_unoverscrollify (shell,
+ scroll_amount_x,
+ scroll_amount_y,
+ &scroll_amount_x,
+ &scroll_amount_y);
+
gimp_display_shell_scroll (shell,
scroll_amount_x,
scroll_amount_y);
Modified: trunk/app/display/gimpdisplayshell-scroll.c
==============================================================================
--- trunk/app/display/gimpdisplayshell-scroll.c (original)
+++ trunk/app/display/gimpdisplayshell-scroll.c Tue Aug 26 18:50:54 2008
@@ -258,6 +258,66 @@
}
/**
+ * gimp_display_shell_scroll_unoverscrollify:
+ * @shell:
+ * @in_offset_x:
+ * @in_offset_y:
+ * @out_offset_x:
+ * @out_offset_y:
+ *
+ * Takes a scroll offset and returns the offset that will not result
+ * in a scroll beyond the image border. If the image is already
+ * overscrolled, the return value is 0 for that given axis.
+ *
+ **/
+void
+gimp_display_shell_scroll_unoverscrollify (GimpDisplayShell *shell,
+ gint in_offset_x,
+ gint in_offset_y,
+ gint *out_offset_x,
+ gint *out_offset_y)
+{
+ gint sw, sh;
+ gint out_offset_x_dummy, out_offset_y_dummy;
+
+ g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
+
+ if (! out_offset_x) out_offset_x = &out_offset_x_dummy;
+ if (! out_offset_y) out_offset_y = &out_offset_y_dummy;
+
+ *out_offset_x = in_offset_x;
+ *out_offset_y = in_offset_y;
+
+ gimp_display_shell_draw_get_scaled_image_size (shell, &sw, &sh);
+
+ if (in_offset_x < 0)
+ {
+ *out_offset_x = MAX (in_offset_x,
+ MIN (0, 0 - shell->offset_x));
+ }
+ else if (in_offset_x > 0)
+ {
+ gint min_offset = sw - shell->disp_width;
+
+ *out_offset_x = MIN (in_offset_x,
+ MAX (0, min_offset - shell->offset_x));
+ }
+
+ if (in_offset_y < 0)
+ {
+ *out_offset_y = MAX (in_offset_y,
+ MIN (0, 0 - shell->offset_y));
+ }
+ else if (in_offset_y > 0)
+ {
+ gint min_offset = sh - shell->disp_width;
+
+ *out_offset_y = MIN (in_offset_y,
+ MAX (0, min_offset - shell->offset_y));
+ }
+}
+
+/**
* gimp_display_shell_scroll_center_image:
* @shell:
* @horizontally:
Modified: trunk/app/display/gimpdisplayshell-scroll.h
==============================================================================
--- trunk/app/display/gimpdisplayshell-scroll.h (original)
+++ trunk/app/display/gimpdisplayshell-scroll.h Tue Aug 26 18:50:54 2008
@@ -31,6 +31,11 @@
gint offset_y);
void gimp_display_shell_scroll_clamp_offsets (GimpDisplayShell *shell);
void gimp_display_shell_scroll_clamp_and_update (GimpDisplayShell *shell);
+void gimp_display_shell_scroll_unoverscrollify (GimpDisplayShell *shell,
+ gint in_offset_x,
+ gint in_offset_y,
+ gint *out_offset_x,
+ gint *out_offset_y);
void gimp_display_shell_scroll_center_image (GimpDisplayShell *shell,
gboolean horizontally,
gboolean vertically);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]