Extend the interface with this function.

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

	* app/display/gimpdisplayshell-scroll.[ch]
	(gimp_display_shell_get_viewport): Extend the interface with this
	function.

	* app/display/gimpnavigationeditor.c
	(gimp_navigation_editor_update_marker): Use it here.

svn path=/trunk/; revision=26114
This commit is contained in:
Martin Nordholts 2008-07-11 03:20:17 +00:00 committed by Martin Nordholts
parent 7fee886d49
commit 06bd569012
4 changed files with 52 additions and 6 deletions

View file

@ -1,6 +1,15 @@
2008-07-11 Martin Nordholts <martinn@svn.gnome.org>
* app/display/gimpdisplayshell-scroll.[ch]
(gimp_display_shell_get_viewport): Extend the interface with this
function.
* app/display/gimpnavigationeditor.c
(gimp_navigation_editor_update_marker): Use it here.
2008-07-10 Martin Nordholts <martinn@svn.gnome.org>
* app/display/gimpdisplayshell-scroll.[ch]:
* app/display/gimpdisplayshell-scroll.[ch]
(gimp_display_shell_get_scaled_viewport): Extend the interface
with this function

View file

@ -144,6 +144,7 @@ gimp_display_shell_scroll_clamp_offsets (GimpDisplayShell *shell)
*
* Gets the viewport in screen coordinates, with origin at (0, 0) in
* the image
*
**/
void
gimp_display_shell_get_scaled_viewport (GimpDisplayShell *shell,
@ -157,3 +158,29 @@ gimp_display_shell_get_scaled_viewport (GimpDisplayShell *shell,
if (w) *w = shell->disp_width;
if (h) *h = shell->disp_height;
}
/**
* gimp_display_shell_get_viewport:
* @shell:
* @x:
* @y:
* @w:
* @h:
*
* Gets the viewport in image coordinates
*
* TODO: Handle when the viewport is zoomed out
*
**/
void
gimp_display_shell_get_viewport (GimpDisplayShell *shell,
gdouble *x,
gdouble *y,
gdouble *w,
gdouble *h)
{
if (x) *x = shell->offset_x / shell->scale_x;
if (y) *y = shell->offset_y / shell->scale_y;
if (w) *w = shell->disp_width / shell->scale_x;
if (h) *h = shell->disp_height / shell->scale_y;
}

View file

@ -32,5 +32,11 @@ void gimp_display_shell_get_scaled_viewport (GimpDisplayShell *shell,
gint *w,
gint *h);
void gimp_display_shell_get_viewport (GimpDisplayShell *shell,
gdouble *x,
gdouble *y,
gdouble *w,
gdouble *h);
#endif /* __GIMP_DISPLAY_SHELL_SCROLL_H__ */

View file

@ -640,9 +640,13 @@ gimp_navigation_editor_update_marker (GimpNavigationEditor *editor)
gimp_view_renderer_set_dot_for_dot (renderer, shell->dot_for_dot);
if (renderer->viewable)
gimp_navigation_view_set_marker (GIMP_NAVIGATION_VIEW (editor->view),
shell->offset_x / shell->scale_x,
shell->offset_y / shell->scale_y,
shell->disp_width / shell->scale_x,
shell->disp_height / shell->scale_y);
{
GimpNavigationView *view = GIMP_NAVIGATION_VIEW (editor->view);
gdouble x, y;
gdouble w, h;
gimp_display_shell_get_viewport (shell, &x, &y, &w, &h);
gimp_navigation_view_set_marker (view, x, y, w, h);
}
}