Split this up in gimp_display_shell_scale_update_scrollbars() and
2008-08-14 Martin Nordholts <martinn@svn.gnome.org> * app/display/gimpdisplayshell-scale.c (gimp_display_shell_update_scrollbars_and_rulers): Split this up in gimp_display_shell_scale_update_scrollbars() and gimp_display_shell_scale_update_rulers(). svn path=/trunk/; revision=26555
This commit is contained in:

committed by
Martin Nordholts

parent
2f52791b2b
commit
ecd95dcf76
@ -1,3 +1,10 @@
|
|||||||
|
2008-08-14 Martin Nordholts <martinn@svn.gnome.org>
|
||||||
|
|
||||||
|
* app/display/gimpdisplayshell-scale.c
|
||||||
|
(gimp_display_shell_update_scrollbars_and_rulers): Split this up
|
||||||
|
in gimp_display_shell_scale_update_scrollbars() and
|
||||||
|
gimp_display_shell_scale_update_rulers().
|
||||||
|
|
||||||
2008-08-14 Martin Nordholts <martinn@svn.gnome.org>
|
2008-08-14 Martin Nordholts <martinn@svn.gnome.org>
|
||||||
|
|
||||||
* app/display/gimpdisplayshell-scroll.c
|
* app/display/gimpdisplayshell-scroll.c
|
||||||
|
@ -95,15 +95,27 @@ static gdouble img2real (GimpDisplayShell *shell,
|
|||||||
void
|
void
|
||||||
gimp_display_shell_update_scrollbars_and_rulers (GimpDisplayShell *shell)
|
gimp_display_shell_update_scrollbars_and_rulers (GimpDisplayShell *shell)
|
||||||
{
|
{
|
||||||
GimpImage *image;
|
|
||||||
gint image_width;
|
|
||||||
gint image_height;
|
|
||||||
|
|
||||||
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
|
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
|
||||||
|
|
||||||
if (! shell->display)
|
if (! shell->display)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
gimp_display_shell_scale_update_scrollbars (shell);
|
||||||
|
gimp_display_shell_scale_update_rulers (shell);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gimp_display_shell_scale_update_scrollbars:
|
||||||
|
* @shell:
|
||||||
|
*
|
||||||
|
**/
|
||||||
|
void
|
||||||
|
gimp_display_shell_scale_update_scrollbars (GimpDisplayShell *shell)
|
||||||
|
{
|
||||||
|
GimpImage *image;
|
||||||
|
gint image_width;
|
||||||
|
gint image_height;
|
||||||
|
|
||||||
image = shell->display->image;
|
image = shell->display->image;
|
||||||
|
|
||||||
if (image)
|
if (image)
|
||||||
@ -138,86 +150,107 @@ gimp_display_shell_update_scrollbars_and_rulers (GimpDisplayShell *shell)
|
|||||||
gimp_display_shell_scroll_setup_vscrollbar (shell, shell->offset_y);
|
gimp_display_shell_scroll_setup_vscrollbar (shell, shell->offset_y);
|
||||||
|
|
||||||
gtk_adjustment_changed (shell->vsbdata);
|
gtk_adjustment_changed (shell->vsbdata);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gimp_display_shell_scale_update_rulers:
|
||||||
|
* @shell:
|
||||||
|
*
|
||||||
|
**/
|
||||||
|
void
|
||||||
|
gimp_display_shell_scale_update_rulers (GimpDisplayShell *shell)
|
||||||
|
{
|
||||||
|
GimpImage *image;
|
||||||
|
gint image_width;
|
||||||
|
gint image_height;
|
||||||
|
gdouble horizontal_lower;
|
||||||
|
gdouble horizontal_upper;
|
||||||
|
gdouble horizontal_max_size;
|
||||||
|
gdouble vertical_lower;
|
||||||
|
gdouble vertical_upper;
|
||||||
|
gdouble vertical_max_size;
|
||||||
|
gint scaled_viewport_offset_x;
|
||||||
|
gint scaled_viewport_offset_y;
|
||||||
|
|
||||||
|
image = shell->display->image;
|
||||||
|
|
||||||
|
if (image)
|
||||||
|
{
|
||||||
|
image_width = gimp_image_get_width (image);
|
||||||
|
image_height = gimp_image_get_height (image);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
image_width = shell->disp_width;
|
||||||
|
image_height = shell->disp_height;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Setup rulers */
|
/* Initialize values */
|
||||||
{
|
|
||||||
gdouble horizontal_lower;
|
horizontal_lower = 0;
|
||||||
gdouble horizontal_upper;
|
vertical_lower = 0;
|
||||||
gdouble horizontal_max_size;
|
|
||||||
gdouble vertical_lower;
|
if (image)
|
||||||
gdouble vertical_upper;
|
{
|
||||||
gdouble vertical_max_size;
|
horizontal_upper = img2real (shell, TRUE,
|
||||||
gint scaled_viewport_offset_x;
|
FUNSCALEX (shell, shell->disp_width));
|
||||||
gint scaled_viewport_offset_y;
|
horizontal_max_size = img2real (shell, TRUE,
|
||||||
|
MAX (image_width, image_height));
|
||||||
|
|
||||||
|
vertical_upper = img2real (shell, FALSE,
|
||||||
|
FUNSCALEY (shell, shell->disp_height));
|
||||||
|
vertical_max_size = img2real (shell, FALSE,
|
||||||
|
MAX (image_width, image_height));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
horizontal_upper = image_width;
|
||||||
|
horizontal_max_size = MAX (image_width, image_height);
|
||||||
|
|
||||||
|
vertical_upper = image_height;
|
||||||
|
vertical_max_size = MAX (image_width, image_height);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Initialize values */
|
/* Adjust due to scrolling */
|
||||||
|
|
||||||
horizontal_lower = 0;
|
gimp_display_shell_scroll_get_scaled_viewport_offset (shell,
|
||||||
vertical_lower = 0;
|
&scaled_viewport_offset_x,
|
||||||
|
&scaled_viewport_offset_y);
|
||||||
|
|
||||||
if (image)
|
horizontal_lower -= img2real (shell, TRUE,
|
||||||
{
|
FUNSCALEX (shell,
|
||||||
horizontal_upper = img2real (shell, TRUE,
|
(gdouble) scaled_viewport_offset_x));
|
||||||
FUNSCALEX (shell, shell->disp_width));
|
horizontal_upper -= img2real (shell, TRUE,
|
||||||
horizontal_max_size = img2real (shell, TRUE,
|
FUNSCALEX (shell,
|
||||||
MAX (image_width, image_height));
|
(gdouble) scaled_viewport_offset_x));
|
||||||
|
|
||||||
vertical_upper = img2real (shell, FALSE,
|
vertical_lower -= img2real (shell, FALSE,
|
||||||
FUNSCALEY (shell, shell->disp_height));
|
FUNSCALEY (shell,
|
||||||
vertical_max_size = img2real (shell, FALSE,
|
(gdouble) scaled_viewport_offset_y));
|
||||||
MAX (image_width, image_height));
|
vertical_upper -= img2real (shell, FALSE,
|
||||||
}
|
FUNSCALEY (shell,
|
||||||
else
|
(gdouble) scaled_viewport_offset_y));
|
||||||
{
|
|
||||||
horizontal_upper = image_width;
|
|
||||||
horizontal_max_size = MAX (image_width, image_height);
|
|
||||||
|
|
||||||
vertical_upper = image_height;
|
|
||||||
vertical_max_size = MAX (image_width, image_height);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* Adjust due to scrolling */
|
/* Finally setup the actual rulers */
|
||||||
|
|
||||||
gimp_display_shell_scroll_get_scaled_viewport_offset (shell,
|
gimp_ruler_set_range (GIMP_RULER (shell->hrule),
|
||||||
&scaled_viewport_offset_x,
|
horizontal_lower,
|
||||||
&scaled_viewport_offset_y);
|
horizontal_upper,
|
||||||
|
horizontal_max_size);
|
||||||
|
|
||||||
horizontal_lower -= img2real (shell, TRUE,
|
gimp_ruler_set_unit (GIMP_RULER (shell->hrule),
|
||||||
FUNSCALEX (shell,
|
shell->unit);
|
||||||
(gdouble) scaled_viewport_offset_x));
|
|
||||||
horizontal_upper -= img2real (shell, TRUE,
|
|
||||||
FUNSCALEX (shell,
|
|
||||||
(gdouble) scaled_viewport_offset_x));
|
|
||||||
|
|
||||||
vertical_lower -= img2real (shell, FALSE,
|
gimp_ruler_set_range (GIMP_RULER (shell->vrule),
|
||||||
FUNSCALEY (shell,
|
vertical_lower,
|
||||||
(gdouble) scaled_viewport_offset_y));
|
vertical_upper,
|
||||||
vertical_upper -= img2real (shell, FALSE,
|
vertical_max_size);
|
||||||
FUNSCALEY (shell,
|
|
||||||
(gdouble) scaled_viewport_offset_y));
|
|
||||||
|
|
||||||
|
gimp_ruler_set_unit (GIMP_RULER (shell->vrule),
|
||||||
/* Finally setup the actual rulers */
|
shell->unit);
|
||||||
|
|
||||||
gimp_ruler_set_range (GIMP_RULER (shell->hrule),
|
|
||||||
horizontal_lower,
|
|
||||||
horizontal_upper,
|
|
||||||
horizontal_max_size);
|
|
||||||
|
|
||||||
gimp_ruler_set_unit (GIMP_RULER (shell->hrule),
|
|
||||||
shell->unit);
|
|
||||||
|
|
||||||
gimp_ruler_set_range (GIMP_RULER (shell->vrule),
|
|
||||||
vertical_lower,
|
|
||||||
vertical_upper,
|
|
||||||
vertical_max_size);
|
|
||||||
|
|
||||||
gimp_ruler_set_unit (GIMP_RULER (shell->vrule),
|
|
||||||
shell->unit);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -21,6 +21,8 @@
|
|||||||
|
|
||||||
|
|
||||||
void gimp_display_shell_update_scrollbars_and_rulers (GimpDisplayShell *shell);
|
void gimp_display_shell_update_scrollbars_and_rulers (GimpDisplayShell *shell);
|
||||||
|
void gimp_display_shell_scale_update_scrollbars (GimpDisplayShell *shell);
|
||||||
|
void gimp_display_shell_scale_update_rulers (GimpDisplayShell *shell);
|
||||||
|
|
||||||
gboolean gimp_display_shell_scale_revert (GimpDisplayShell *shell);
|
gboolean gimp_display_shell_scale_revert (GimpDisplayShell *shell);
|
||||||
gboolean gimp_display_shell_scale_can_revert (GimpDisplayShell *shell);
|
gboolean gimp_display_shell_scale_can_revert (GimpDisplayShell *shell);
|
||||||
|
Reference in New Issue
Block a user