Commit 8f212645 authored by Martin Nordholts's avatar Martin Nordholts Committed by Martin Nordholts
Browse files

Make gimp_display_shell_scroll() a sane public interface for scrolling and

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

	* app/display/gimpdisplayshell-scroll.[ch]: Make
	gimp_display_shell_scroll() a sane public interface for scrolling
	and call the old version gimp_display_shell_scroll_private()

	* app/display/gimpnavigationeditor.c: Adapt to the saner version
	of gimp_display_shell_scroll()

	* app/display/gimpdisplayshell-callbacks.c: 
	* app/display/gimpdisplayshell-autoscroll.c: Use the private
	version of gimp_display_shell_scroll()

	* app/display/Makefile.am: Added gimpdisplayshell-private.h

svn path=/trunk/; revision=26110
parent abd52cc4
2008-07-10 Martin Nordholts <martinn@svn.gnome.org>
* app/display/gimpdisplayshell-scroll.[ch]: Make
gimp_display_shell_scroll() a sane public interface for scrolling
and call the old version gimp_display_shell_scroll_private()
* app/display/gimpnavigationeditor.c: Adapt to the saner version
of gimp_display_shell_scroll()
* app/display/gimpdisplayshell-callbacks.c:
* app/display/gimpdisplayshell-autoscroll.c: Use the private
version of gimp_display_shell_scroll()
* app/display/Makefile.am: Added gimpdisplayshell-private.h
2008-07-10 Martin Nordholts <martinn@svn.gnome.org>
* app/display/gimpdisplayshell-scroll.[ch]: The return value of
......
......@@ -45,6 +45,7 @@ libappdisplay_a_sources = \
gimpdisplayshell-icon.h \
gimpdisplayshell-preview.c \
gimpdisplayshell-preview.h \
gimpdisplayshell-private.h \
gimpdisplayshell-progress.c \
gimpdisplayshell-progress.h \
gimpdisplayshell-render.c \
......
......@@ -26,6 +26,7 @@
#include "gimpdisplayshell.h"
#include "gimpdisplayshell-autoscroll.h"
#include "gimpdisplayshell-coords.h"
#include "gimpdisplayshell-private.h"
#include "gimpdisplayshell-scroll.h"
#include "gimpdisplayshell-transform.h"
......@@ -135,9 +136,9 @@ gimp_display_shell_autoscroll_timeout (gpointer data)
info->time += AUTOSCROLL_DT;
gimp_display_shell_scroll (shell,
AUTOSCROLL_DX * (gdouble) dx,
AUTOSCROLL_DX * (gdouble) dy);
gimp_display_shell_scroll_private (shell,
AUTOSCROLL_DX * (gdouble) dx,
AUTOSCROLL_DX * (gdouble) dy);
gimp_display_shell_untransform_coordinate (shell,
&device_coords,
......
......@@ -67,6 +67,7 @@
#include "gimpdisplayshell-draw.h"
#include "gimpdisplayshell-layer-select.h"
#include "gimpdisplayshell-preview.h"
#include "gimpdisplayshell-private.h"
#include "gimpdisplayshell-scale.h"
#include "gimpdisplayshell-scroll.h"
#include "gimpdisplayshell-selection.h"
......@@ -1093,11 +1094,11 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas,
if (shell->scrolling)
{
gimp_display_shell_scroll (shell,
(shell->scroll_start_x - mevent->x -
shell->offset_x),
(shell->scroll_start_y - mevent->y -
shell->offset_y));
gimp_display_shell_scroll_private (shell,
(shell->scroll_start_x - mevent->x -
shell->offset_x),
(shell->scroll_start_y - mevent->y -
shell->offset_y));
}
else if (state & GDK_BUTTON1_MASK)
{
......@@ -1648,20 +1649,20 @@ static void
gimp_display_shell_vscrollbar_update (GtkAdjustment *adjustment,
GimpDisplayShell *shell)
{
gimp_display_shell_scroll (shell,
0,
gtk_adjustment_get_value (adjustment) -
shell->offset_y);
gimp_display_shell_scroll_private (shell,
0,
gtk_adjustment_get_value (adjustment) -
shell->offset_y);
}
static void
gimp_display_shell_hscrollbar_update (GtkAdjustment *adjustment,
GimpDisplayShell *shell)
{
gimp_display_shell_scroll (shell,
gtk_adjustment_get_value (adjustment) -
shell->offset_x,
0);
gimp_display_shell_scroll_private (shell,
gtk_adjustment_get_value (adjustment) -
shell->offset_x,
0);
}
static GdkModifierType
......
......@@ -31,14 +31,40 @@
#include "gimpdisplay.h"
#include "gimpdisplay-foreach.h"
#include "gimpdisplayshell.h"
#include "gimpdisplayshell-private.h"
#include "gimpdisplayshell-scale.h"
#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)
{
gint x_offset;
gint y_offset;
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);
gimp_display_shell_scroll_private (shell, x_offset, y_offset);
}
void
gimp_display_shell_scroll (GimpDisplayShell *shell,
gint x_offset,
gint y_offset)
gimp_display_shell_scroll_private (GimpDisplayShell *shell,
gint x_offset,
gint y_offset)
{
gint old_x;
gint old_y;
......
......@@ -21,8 +21,8 @@
void gimp_display_shell_scroll (GimpDisplayShell *shell,
gint x_offset,
gint y_offset);
gdouble x_offset_into_image,
gdouble y_offset_into_image);
void gimp_display_shell_scroll_clamp_offsets (GimpDisplayShell *shell);
......
......@@ -497,9 +497,7 @@ gimp_navigation_editor_marker_changed (GimpNavigationView *view,
{
GimpDisplayShell *shell = editor->shell;
gimp_display_shell_scroll (shell,
RINT (x * shell->scale_x - shell->offset_x),
RINT (y * shell->scale_y - shell->offset_y));
gimp_display_shell_scroll (shell, x, y);
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment