gimp r27651 - in trunk: . app/display
- From: martinn svn gnome org
- To: svn-commits-list gnome org
- Subject: gimp r27651 - in trunk: . app/display
- Date: Sat, 15 Nov 2008 08:04:07 +0000 (UTC)
Author: martinn
Date: Sat Nov 15 08:04:06 2008
New Revision: 27651
URL: http://svn.gnome.org/viewvc/gimp?rev=27651&view=rev
Log:
Bug 560245 â Zoom selection always centered in the Navigation tab
* app/display/gimpdisplayshell-scale.c (gimp_display_shell_scale):
Also take the image center and not only the zoom focus point into
account when deciding whether or not to center the image after
zoom.
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 Nov 15 08:04:06 2008
@@ -68,6 +68,12 @@
gboolean *horizontally,
gboolean *vertically);
+static void gimp_display_shell_scale_get_image_center_viewport
+ (GimpDisplayShell *shell,
+ gint *image_center_x,
+ gint *image_center_y);
+
+
static void gimp_display_shell_scale_get_zoom_focus (GimpDisplayShell *shell,
gdouble new_scale,
gdouble current_scale,
@@ -371,10 +377,14 @@
}
else
{
- gboolean starts_fitting_horizontally;
- gboolean starts_fitting_vertically;
- gboolean almost_centered_horizontally;
- gboolean almost_centered_vertically;
+ gboolean starts_fitting_horiz;
+ gboolean starts_fitting_vert;
+ gboolean zoom_focus_almost_centered_horiz;
+ gboolean zoom_focus_almost_centered_vert;
+ gboolean image_center_almost_centered_horiz;
+ gboolean image_center_almost_centered_vert;
+ gint image_center_x;
+ gint image_center_y;
gimp_display_shell_scale_get_zoom_focus (shell,
real_new_scale,
@@ -382,6 +392,9 @@
&x,
&y,
zoom_focus);
+ gimp_display_shell_scale_get_image_center_viewport (shell,
+ &image_center_x,
+ &image_center_y);
gimp_display_shell_scale_to (shell, real_new_scale, x, y);
@@ -393,18 +406,27 @@
gimp_display_shell_scale_image_starts_to_fit (shell,
real_new_scale,
current_scale,
- &starts_fitting_horizontally,
- &starts_fitting_vertically);
+ &starts_fitting_horiz,
+ &starts_fitting_vert);
+
gimp_display_shell_scale_viewport_coord_almost_centered (shell,
x,
y,
- &almost_centered_horizontally,
- &almost_centered_vertically);
+ &zoom_focus_almost_centered_horiz,
+ &zoom_focus_almost_centered_vert);
+ gimp_display_shell_scale_viewport_coord_almost_centered (shell,
+ image_center_x,
+ image_center_y,
+ &image_center_almost_centered_horiz,
+ &image_center_almost_centered_vert);
+
gimp_display_shell_scroll_center_image (shell,
- starts_fitting_horizontally ||
- almost_centered_horizontally,
- starts_fitting_vertically ||
- almost_centered_vertically);
+ starts_fitting_horiz ||
+ (zoom_focus_almost_centered_horiz &&
+ image_center_almost_centered_horiz),
+ starts_fitting_vert ||
+ (zoom_focus_almost_centered_vert &&
+ image_center_almost_centered_vert));
}
}
}
@@ -882,6 +904,21 @@
y < center_y + ALMOST_CENTERED_THRESHOLD;
}
+static void
+gimp_display_shell_scale_get_image_center_viewport (GimpDisplayShell *shell,
+ gint *image_center_x,
+ gint *image_center_y)
+{
+ gint sw, sh;
+
+ gimp_display_shell_draw_get_scaled_image_size (shell,
+ &sw,
+ &sh);
+
+ if (image_center_x) *image_center_x = -shell->offset_x + sw / 2;
+ if (image_center_y) *image_center_y = -shell->offset_y + sh / 2;
+}
+
/**
* gimp_display_shell_scale_get_zoom_focus:
* @shell:
@@ -904,15 +941,9 @@
gint other_x, other_y;
/* Calculate stops-to-fit focus point */
- {
- gint sw, sh;
-
- gimp_display_shell_draw_get_scaled_image_size (shell,
- &sw,
- &sh);
- image_center_x = -shell->offset_x + sw / 2;
- image_center_y = -shell->offset_y + sh / 2;
- }
+ gimp_display_shell_scale_get_image_center_viewport (shell,
+ &image_center_x,
+ &image_center_y);
/* Calculate other focus point */
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]