gimp r26607 - in trunk: . app/actions app/display
- From: martinn svn gnome org
- To: svn-commits-list gnome org
- Subject: gimp r26607 - in trunk: . app/actions app/display
- Date: Sat, 16 Aug 2008 18:25:32 +0000 (UTC)
Author: martinn
Date: Sat Aug 16 18:25:32 2008
New Revision: 26607
URL: http://svn.gnome.org/viewvc/gimp?rev=26607&view=rev
Log:
2008-08-16 Martin Nordholts <martinn svn gnome org>
* app/display/gimpdisplayshell-scroll.c
(gimp_display_shell_scroll_center_image_on_next_size_allocate):
Explain that this function needs to be used with care since it is
risky.
* app/display/gimpdisplayshell.c
(gimp_display_shell_new)
(gimp_display_shell_fill): Clarify that it is safe to use the
risky function.
(gimp_display_shell_configure_event): Make proper comparisions (<=
not =) and explain that usage of the risky function is safe.
(gimp_display_shell_shrink_wrap): Always call
gimp_display_shell_scroll_center_image() and let size-requests be
handled by GimpDisplayShell::configure_event().
* app/actions/view-commands.c (view_shrink_wrap_cmd_callback): No
need to center anything explicitly any longer.
Modified:
trunk/ChangeLog
trunk/app/actions/view-commands.c
trunk/app/display/gimpdisplayshell-scroll.c
trunk/app/display/gimpdisplayshell.c
Modified: trunk/app/actions/view-commands.c
==============================================================================
--- trunk/app/actions/view-commands.c (original)
+++ trunk/app/actions/view-commands.c Sat Aug 16 18:25:32 2008
@@ -640,12 +640,6 @@
gimp_display_shell_scale_shrink_wrap (shell,
FALSE);
-
- /* Handle if only the offset of wrong */
- gimp_display_shell_scroll_center_image (shell, TRUE, TRUE);
-
- /* Handle if the display shell canvas is wrong */
- gimp_display_shell_scroll_center_image_on_next_size_allocate (shell);
}
void
Modified: trunk/app/display/gimpdisplayshell-scroll.c
==============================================================================
--- trunk/app/display/gimpdisplayshell-scroll.c (original)
+++ trunk/app/display/gimpdisplayshell-scroll.c Sat Aug 16 18:25:32 2008
@@ -308,7 +308,11 @@
* @shell:
*
* Centers the image in the display as soon as the canvas has got its
- * new size
+ * new size.
+ *
+ * Only call this if you are sure the canvas size will change.
+ * (Otherwise the signal connection and centering will lurk until the
+ * canvas size is changed e.g. by toggling the rulers.)
*
**/
void
Modified: trunk/app/display/gimpdisplayshell.c
==============================================================================
--- trunk/app/display/gimpdisplayshell.c (original)
+++ trunk/app/display/gimpdisplayshell.c Sat Aug 16 18:25:32 2008
@@ -607,11 +607,12 @@
gimp_display_shell_draw_get_scaled_image_size (shell, &sw, &sh);
- center_horizontally = sw < shell->disp_width;
- center_vertically = sh < shell->disp_height;
+ 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.
+ /* If the image fits within the display shell canvas on a given
+ * axis, center the image on that axis. We know that the canvas
+ * will get a size-allocate if we get here.
*/
gimp_display_shell_scroll_center_image_on_next_size_allocate (shell);
}
@@ -1265,7 +1266,10 @@
{
gimp_display_shell_connect (shell);
- /* after connecting to the image we want to center it */
+ /* After connecting to the image we want to center it. Since we
+ * not even finnished creating the display shell, we can safely
+ * assume we will get a size-allocate later.
+ */
gimp_display_shell_scroll_center_image_on_next_size_allocate (shell);
}
else
@@ -1416,6 +1420,9 @@
gimp_help_set_help_data (shell->canvas, NULL, NULL);
+ /* A size-allocate will always occur because the scrollbars will
+ * become visible forcing the canvas to become smaller
+ */
gimp_display_shell_scroll_center_image_on_next_size_allocate (shell);
shell->fill_idle_id = g_idle_add_full (G_PRIORITY_LOW,
@@ -1898,10 +1905,13 @@
}
gtk_window_resize (GTK_WINDOW (shell), width, height);
-
- /* A wrap always means that we should center the image too */
- gimp_display_shell_scroll_center_image_on_next_size_allocate (shell);
}
+
+ /* A wrap always means that we should center the image too. If the
+ * window changes size another center will be done in
+ * GimpDisplayShell::configure_event().
+ */
+ gimp_display_shell_scroll_center_image (shell, TRUE, TRUE);
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]