gimp r26531 - in trunk: . app/display
- From: martinn svn gnome org
- To: svn-commits-list gnome org
- Subject: gimp r26531 - in trunk: . app/display
- Date: Wed, 13 Aug 2008 17:58:25 +0000 (UTC)
Author: martinn
Date: Wed Aug 13 17:58:25 2008
New Revision: 26531
URL: http://svn.gnome.org/viewvc/gimp?rev=26531&view=rev
Log:
2008-08-13 Martin Nordholts <martinn svn gnome org>
* app/display/gimpdisplayshell-scale.[ch]
(gimp_display_shell_scale_to): Make this a private function
because we want to be in full control over what pixel to focus on
when zooming in and out.
* app/display/gimpdisplayshell-callbacks.c
(gimp_display_shell_canvas_tool_events): Use
gimp_display_shell_scale() here instead of
gimp_display_shell_scale_to(). We figure out (and can override if
we wish) the coordinates that were previously passed explicitly.
Modified:
trunk/ChangeLog
trunk/app/display/gimpdisplayshell-callbacks.c
trunk/app/display/gimpdisplayshell-scale.c
trunk/app/display/gimpdisplayshell-scale.h
Modified: trunk/app/display/gimpdisplayshell-callbacks.c
==============================================================================
--- trunk/app/display/gimpdisplayshell-callbacks.c (original)
+++ trunk/app/display/gimpdisplayshell-callbacks.c Wed Aug 13 17:58:25 2008
@@ -979,13 +979,11 @@
switch (direction)
{
case GDK_SCROLL_UP:
- gimp_display_shell_scale_to (shell, GIMP_ZOOM_IN, 0.0,
- sevent->x, sevent->y);
+ gimp_display_shell_scale (shell, GIMP_ZOOM_IN, 0.0);
break;
case GDK_SCROLL_DOWN:
- gimp_display_shell_scale_to (shell, GIMP_ZOOM_OUT, 0.0,
- sevent->x, sevent->y);
+ gimp_display_shell_scale (shell, GIMP_ZOOM_OUT, 0.0);
break;
default:
Modified: trunk/app/display/gimpdisplayshell-scale.c
==============================================================================
--- trunk/app/display/gimpdisplayshell-scale.c (original)
+++ trunk/app/display/gimpdisplayshell-scale.c Wed Aug 13 17:58:25 2008
@@ -69,6 +69,11 @@
gint response_id,
ScaleDialogData *dialog);
static void gimp_display_shell_scale_dialog_free (ScaleDialogData *dialog);
+static void gimp_display_shell_scale_to (GimpDisplayShell *shell,
+ GimpZoomType zoom_type,
+ gdouble scale,
+ gdouble x,
+ gdouble y);
static void update_zoom_values (GtkAdjustment *adj,
ScaleDialogData *dialog);
@@ -356,58 +361,6 @@
}
/**
- * gimp_display_shell_scale_to:
- * @shell: the #GimpDisplayShell
- * @zoom_type: whether to zoom in, out or to a specified scale
- * @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.
- **/
-void
-gimp_display_shell_scale_to (GimpDisplayShell *shell,
- GimpZoomType zoom_type,
- 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;
-
- if (zoom_type != GIMP_ZOOM_TO)
- scale = gimp_zoom_model_zoom_step (zoom_type, 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_fit_in:
* @shell: the #GimpDisplayShell
*
@@ -877,6 +830,58 @@
g_slice_free (ScaleDialogData, dialog);
}
+/**
+ * gimp_display_shell_scale_to:
+ * @shell: the #GimpDisplayShell
+ * @zoom_type: whether to zoom in, out or to a specified scale
+ * @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,
+ GimpZoomType zoom_type,
+ 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;
+
+ if (zoom_type != GIMP_ZOOM_TO)
+ scale = gimp_zoom_model_zoom_step (zoom_type, 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);
+}
+
static void
update_zoom_values (GtkAdjustment *adj,
ScaleDialogData *dialog)
Modified: trunk/app/display/gimpdisplayshell-scale.h
==============================================================================
--- trunk/app/display/gimpdisplayshell-scale.h (original)
+++ trunk/app/display/gimpdisplayshell-scale.h Wed Aug 13 17:58:25 2008
@@ -31,11 +31,6 @@
void gimp_display_shell_scale (GimpDisplayShell *shell,
GimpZoomType zoom_type,
gdouble scale);
-void gimp_display_shell_scale_to (GimpDisplayShell *shell,
- GimpZoomType zoom_type,
- gdouble scale,
- gdouble x,
- gdouble y);
void gimp_display_shell_scale_fit_in (GimpDisplayShell *shell);
gboolean gimp_display_shell_scale_image_is_within_viewport (GimpDisplayShell *shell);
void gimp_display_shell_scale_fill (GimpDisplayShell *shell);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]