gimp r26485 - in trunk: . app/display
- From: martinn svn gnome org
- To: svn-commits-list gnome org
- Subject: gimp r26485 - in trunk: . app/display
- Date: Sun, 10 Aug 2008 13:06:06 +0000 (UTC)
Author: martinn
Date: Sun Aug 10 13:06:06 2008
New Revision: 26485
URL: http://svn.gnome.org/viewvc/gimp?rev=26485&view=rev
Log:
2008-08-10 Martin Nordholts <martinn svn gnome org>
* app/display/gimpdisplayshell-scale.c
(gimp_display_shell_scale_handle_zoom_revert): Move the
zoom-revert updating logic into this new helper function so that
we can update zoom-revert from other places.
Modified:
trunk/ChangeLog
trunk/app/display/gimpdisplayshell-scale.c
trunk/app/display/gimpdisplayshell-scale.h
Modified: trunk/app/display/gimpdisplayshell-scale.c
==============================================================================
--- trunk/app/display/gimpdisplayshell-scale.c (original)
+++ trunk/app/display/gimpdisplayshell-scale.c Sun Aug 10 13:06:06 2008
@@ -45,7 +45,7 @@
#include "gimp-intl.h"
-#define SCALE_TIMEOUT 1
+#define SCALE_TIMEOUT 2
#define SCALE_EPSILON 0.0001
@@ -485,6 +485,31 @@
}
/**
+ * gimp_display_shell_scale_handle_zoom_revert:
+ * @shell:
+ *
+ * Handle the updating of the Revert Zoom variables.
+ **/
+void
+gimp_display_shell_scale_handle_zoom_revert (GimpDisplayShell *shell)
+{
+ guint now;
+
+ g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
+
+ now = time (NULL);
+
+ if (now - shell->last_scale_time >= SCALE_TIMEOUT)
+ {
+ shell->last_scale = gimp_zoom_model_get_factor (shell->zoom);
+ shell->last_offset_x = shell->offset_x;
+ shell->last_offset_y = shell->offset_y;
+ }
+
+ shell->last_scale_time = now;
+}
+
+/**
* gimp_display_shell_scale_by_values:
* @shell: the #GimpDisplayShell
* @scale: the new scale
@@ -503,8 +528,6 @@
gint offset_y,
gboolean resize_window)
{
- guint now;
-
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
/* Abort early if the values are all setup already. We don't
@@ -515,18 +538,7 @@
shell->offset_y == offset_y)
return;
- /* remember the current scale and offsets to allow reverting the scaling */
-
- now = time (NULL);
-
- if (now - shell->last_scale_time > SCALE_TIMEOUT)
- {
- shell->last_scale = gimp_zoom_model_get_factor (shell->zoom);
- shell->last_offset_x = shell->offset_x;
- shell->last_offset_y = shell->offset_y;
- }
-
- shell->last_scale_time = now;
+ gimp_display_shell_scale_handle_zoom_revert (shell);
/* freeze the active tool */
gimp_display_shell_pause (shell);
Modified: trunk/app/display/gimpdisplayshell-scale.h
==============================================================================
--- trunk/app/display/gimpdisplayshell-scale.h (original)
+++ trunk/app/display/gimpdisplayshell-scale.h Sun Aug 10 13:06:06 2008
@@ -38,6 +38,7 @@
gdouble y);
void gimp_display_shell_scale_fit_in (GimpDisplayShell *shell);
void gimp_display_shell_scale_fill (GimpDisplayShell *shell);
+void gimp_display_shell_scale_handle_zoom_revert (GimpDisplayShell *shell);
void gimp_display_shell_scale_by_values (GimpDisplayShell *shell,
gdouble scale,
gint offset_x,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]