gimp r26586 - in trunk: . app/display
- From: martinn svn gnome org
- To: svn-commits-list gnome org
- Subject: gimp r26586 - in trunk: . app/display
- Date: Sat, 16 Aug 2008 07:15:33 +0000 (UTC)
Author: martinn
Date: Sat Aug 16 07:15:33 2008
New Revision: 26586
URL: http://svn.gnome.org/viewvc/gimp?rev=26586&view=rev
Log:
2008-08-16 Martin Nordholts <martinn svn gnome org>
* app/display/gimpdisplayshell-scale.c
(gimp_display_shell_scale_to): Nice-ify.
Modified:
trunk/ChangeLog
trunk/app/display/gimpdisplayshell-scale.c
Modified: trunk/app/display/gimpdisplayshell-scale.c
==============================================================================
--- trunk/app/display/gimpdisplayshell-scale.c (original)
+++ trunk/app/display/gimpdisplayshell-scale.c Sat Aug 16 07:15:33 2008
@@ -69,10 +69,6 @@
gint response_id,
ScaleDialogData *dialog);
static void gimp_display_shell_scale_dialog_free (ScaleDialogData *dialog);
-static void gimp_display_shell_scale_to (GimpDisplayShell *shell,
- gdouble scale,
- gdouble x,
- gdouble y);
static void gimp_display_shell_scale_get_zoom_focus (GimpDisplayShell *shell,
gdouble new_scale,
gdouble current_scale,
@@ -392,6 +388,47 @@
}
/**
+ * gimp_display_shell_scale_to:
+ * @shell:
+ * @scale:
+ * @viewport_x:
+ * @viewport_y:
+ *
+ * Zooms. The display offsets are adjusted so that the point specified
+ * by @x and @y doesn't change it's position on screen.
+ **/
+static void
+gimp_display_shell_scale_to (GimpDisplayShell *shell,
+ gdouble scale,
+ gint viewport_x,
+ gint viewport_y)
+{
+ gdouble current;
+ gdouble offset_x;
+ gdouble offset_y;
+
+ g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
+
+ if (! shell->display)
+ return;
+
+ current = gimp_zoom_model_get_factor (shell->zoom);
+
+ offset_x = shell->offset_x + viewport_x;
+ offset_y = shell->offset_y + viewport_y;
+
+ offset_x /= current;
+ offset_y /= current;
+
+ offset_x *= scale;
+ offset_y *= scale;
+
+ gimp_display_shell_scale_by_values (shell, scale,
+ offset_x - viewport_x, offset_y - viewport_y,
+ shell->display->config->resize_windows_on_zoom);
+}
+
+/**
* gimp_display_shell_scale:
* @shell: the #GimpDisplayShell
* @zoom_type: whether to zoom in, our or to a specific scale
@@ -965,53 +1002,6 @@
}
/**
- * gimp_display_shell_scale_to:
- * @shell: the #GimpDisplayShell
- * @scale: ignored unless @zoom_type == %GIMP_ZOOM_TO
- * @x: x screen coordinate
- * @y: y screen coordinate
- *
- * This function changes the scale (zoom ratio) of the display shell.
- * It either zooms in / out one step (%GIMP_ZOOM_IN / %GIMP_ZOOM_OUT)
- * or sets the scale to the zoom ratio passed as @scale (%GIMP_ZOOM_TO).
- *
- * The display offsets are adjusted so that the point specified by @x
- * and @y doesn't change it's position on screen (if possible). You
- * would typically pass either the display center or the mouse
- * position here.
- **/
-static void
-gimp_display_shell_scale_to (GimpDisplayShell *shell,
- gdouble scale,
- gdouble x,
- gdouble y)
-{
- gdouble current;
- gdouble offset_x;
- gdouble offset_y;
-
- g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
-
- if (! shell->display)
- return;
-
- current = gimp_zoom_model_get_factor (shell->zoom);
-
- offset_x = shell->offset_x + x;
- offset_y = shell->offset_y + y;
-
- offset_x /= current;
- offset_y /= current;
-
- offset_x *= scale;
- offset_y *= scale;
-
- gimp_display_shell_scale_by_values (shell, scale,
- offset_x - x, offset_y - y,
- shell->display->config->resize_windows_on_zoom);
-}
-
-/**
* gimp_display_shell_scale_get_zoom_focus:
* @shell:
* @new_scale:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]