If the image fits within the display shell canvas on a given axis, center
2008-08-10 Martin Nordholts <martinn@svn.gnome.org> * app/display/gimpdisplayshell-callbacks.c (gimp_display_shell_canvas_size_allocate): If the image fits within the display shell canvas on a given axis, center the image on that axis. This behaviour will certainly require a few tweaks but let's see how this feels. Feedback welcome. svn path=/trunk/; revision=26489
This commit is contained in:
committed by
Martin Nordholts
parent
5148ff2c9f
commit
73e303590c
@ -1,3 +1,11 @@
|
||||
2008-08-10 Martin Nordholts <martinn@svn.gnome.org>
|
||||
|
||||
* app/display/gimpdisplayshell-callbacks.c
|
||||
(gimp_display_shell_canvas_size_allocate): If the image fits
|
||||
within the display shell canvas on a given axis, center the image
|
||||
on that axis. This behaviour will certainly require a few tweaks
|
||||
but let's see how this feels. Feedback welcome.
|
||||
|
||||
2008-08-10 Martin Nordholts <martinn@svn.gnome.org>
|
||||
|
||||
* app/display/gimpdisplayshell.c (gimp_display_shell_fill): Recent
|
||||
|
||||
@ -302,6 +302,26 @@ gimp_display_shell_canvas_size_allocate (GtkWidget *widget,
|
||||
shell->disp_width = allocation->width;
|
||||
shell->disp_height = allocation->height;
|
||||
|
||||
if (shell->display && shell->display->image)
|
||||
{
|
||||
gint sw;
|
||||
gint sh;
|
||||
gboolean center_horizontally;
|
||||
gboolean center_vertically;
|
||||
|
||||
gimp_display_shell_draw_get_scaled_image_size (shell, &sw, &sh);
|
||||
|
||||
center_horizontally = sw < shell->disp_width;
|
||||
center_vertically = sh < shell->disp_height;
|
||||
|
||||
/* If the image fits within the display shell canvas on a
|
||||
* given axis, center the image on that axis.
|
||||
*/
|
||||
gimp_display_shell_scroll_center_image (shell,
|
||||
center_horizontally,
|
||||
center_vertically);
|
||||
}
|
||||
|
||||
gimp_display_shell_scroll_clamp_offsets (shell);
|
||||
gimp_display_shell_update_scrollbars_and_rulers (shell);
|
||||
gimp_display_shell_scaled (shell);
|
||||
|
||||
Reference in New Issue
Block a user