Replace gimp_display_shell_scroll() with

2008-07-12  Martin Nordholts  <martinn@svn.gnome.org>

	* app/display/gimpdisplayshell-scroll.c:
	Replace gimp_display_shell_scroll() with
	gimp_display_shell_center_around_image_coordinate() since that is
	easier to map to something sensible when we allow to scroll beyond
	image border.

	* app/display/gimpnavigationeditor.c
	(gimp_navigation_editor_marker_changed): Adapt to the new
	interface.

svn path=/trunk/; revision=26162
This commit is contained in:
Martin Nordholts 2008-07-12 14:20:54 +00:00 committed by Martin Nordholts
parent 1fb0f1d82d
commit 9f5c347d4e
4 changed files with 34 additions and 24 deletions

View File

@ -1,3 +1,15 @@
2008-07-12 Martin Nordholts <martinn@svn.gnome.org>
* app/display/gimpdisplayshell-scroll.c:
Replace gimp_display_shell_scroll() with
gimp_display_shell_center_around_image_coordinate() since that is
easier to map to something sensible when we allow to scroll beyond
image border.
* app/display/gimpnavigationeditor.c
(gimp_navigation_editor_marker_changed): Adapt to the new
interface.
2008-07-12 Martin Nordholts <martinn@svn.gnome.org>
* app/display/gimpdisplayshell-scroll.c

View File

@ -36,29 +36,25 @@
#include "gimpdisplayshell-scroll.h"
/**
* gimp_display_shell_scroll:
* @shell:
* @x_offset_into_image: In image coordinates.
* @y_offset_into_image:
*
* When the viewport is smaller than the image, offset the viewport to
* the specified amount into the image.
*
* TODO: Behave in a sane way when zoomed out.
*
**/
void gimp_display_shell_scroll (GimpDisplayShell *shell,
gdouble x_offset_into_image,
gdouble y_offset_into_image)
void
gimp_display_shell_center_around_image_coordinate (GimpDisplayShell *shell,
gdouble image_x,
gdouble image_y)
{
gint x_offset;
gint y_offset;
gint scaled_image_x;
gint scaled_image_y;
gint offset_to_apply_x;
gint offset_to_apply_y;
x_offset = RINT (x_offset_into_image * shell->scale_x - shell->offset_x);
y_offset = RINT (y_offset_into_image * shell->scale_y - shell->offset_y);
scaled_image_x = RINT (image_x * shell->scale_x);
scaled_image_y = RINT (image_y * shell->scale_y);
gimp_display_shell_scroll_private (shell, x_offset, y_offset);
offset_to_apply_x = scaled_image_x - shell->disp_width / 2 - shell->offset_x;
offset_to_apply_y = scaled_image_y - shell->disp_height / 2 - shell->offset_y;
gimp_display_shell_scroll_private (shell,
offset_to_apply_x,
offset_to_apply_y);
}
void

View File

@ -20,9 +20,9 @@
#define __GIMP_DISPLAY_SHELL_SCROLL_H__
void gimp_display_shell_scroll (GimpDisplayShell *shell,
gdouble x_offset_into_image,
gdouble y_offset_into_image);
void gimp_display_shell_center_around_image_coordinate (GimpDisplayShell *shell,
gdouble image_x,
gdouble image_y);
void gimp_display_shell_scroll_clamp_offsets (GimpDisplayShell *shell);

View File

@ -501,7 +501,9 @@ gimp_navigation_editor_marker_changed (GimpNavigationView *view,
{
GimpDisplayShell *shell = editor->shell;
gimp_display_shell_scroll (shell, x, y);
gimp_display_shell_center_around_image_coordinate (shell,
x + width / 2,
y + height / 2);
}
}