Commit f8e5aa31 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

Never shrink the empty display when filling it, only grow:

2008-03-23  Michael Natterer  <mitch@gimp.org>

	Never shrink the empty display when filling it, only grow:

	* app/display/gimpdisplayshell.[ch]
	* app/display/gimpdisplayshell-scale.[ch]: add "gboolean
	grow_only" parameters to shrink_wrap() APIs which restricts
	resizing of the window to growing.

	* app/display/gimpdisplayshell-scale.[ch]
	(gimp_displaY_shell_scale_resize): remove boolean "redisplay"
	parameter because is was always passed as TRUE. Add boolean
	"grow_only" instead and pass it on to shrink_wrap()

	* app/actions/view-commands.c
	* app/display/gimpdisplayshell-handlers.c: pass grow_only = FALSE.

	* app/display/gimpdisplayshell.c (gimp_display_shell_idle_fill):
	pass grow_only = TRUE.


svn path=/trunk/; revision=25178
parent 54d306e8
2008-03-23 Michael Natterer <mitch@gimp.org>
Never shrink the empty display when filling it, only grow:
* app/display/gimpdisplayshell.[ch]
* app/display/gimpdisplayshell-scale.[ch]: add "gboolean
grow_only" parameters to shrink_wrap() APIs which restricts
resizing of the window to growing.
* app/display/gimpdisplayshell-scale.[ch]
(gimp_displaY_shell_scale_resize): remove boolean "redisplay"
parameter because is was always passed as TRUE. Add boolean
"grow_only" instead and pass it on to shrink_wrap()
* app/actions/view-commands.c
* app/display/gimpdisplayshell-handlers.c: pass grow_only = FALSE.
* app/display/gimpdisplayshell.c (gimp_display_shell_idle_fill):
pass grow_only = TRUE.
2008-03-23 Michael Natterer <mitch@gimp.org>
* app/dialogs/dialogs.[ch]: added a dialog factory for displays
......
......@@ -631,7 +631,8 @@ view_shrink_wrap_cmd_callback (GtkAction *action,
GimpDisplay *display;
return_if_no_display (display, data);
gimp_display_shell_scale_shrink_wrap (GIMP_DISPLAY_SHELL (display->shell));
gimp_display_shell_scale_shrink_wrap (GIMP_DISPLAY_SHELL (display->shell),
FALSE);
}
void
......
......@@ -423,7 +423,7 @@ gimp_display_shell_size_changed_handler (GimpImage *image,
{
gimp_display_shell_scale_resize (shell,
shell->display->config->resize_windows_on_resize,
TRUE);
FALSE);
}
static void
......
......@@ -305,7 +305,7 @@ gimp_display_shell_scale_set_dot_for_dot (GimpDisplayShell *shell,
gimp_display_shell_scale_resize (shell,
shell->display->config->resize_windows_on_zoom,
TRUE);
FALSE);
/* re-enable the active tool */
gimp_display_shell_resume (shell);
......@@ -544,7 +544,7 @@ gimp_display_shell_scale_by_values (GimpDisplayShell *shell,
shell->offset_x = offset_x;
shell->offset_y = offset_y;
gimp_display_shell_scale_resize (shell, resize_window, TRUE);
gimp_display_shell_scale_resize (shell, resize_window, FALSE);
/* re-enable the active tool */
gimp_display_shell_resume (shell);
......@@ -555,14 +555,15 @@ gimp_display_shell_scale_by_values (GimpDisplayShell *shell,
* @shell: the #GimpDisplayShell
*
* Convenience function with the same functionality as
* gimp_display_shell_scale_resize(@shell, TRUE, TRUE).
* gimp_display_shell_scale_resize(@shell, TRUE, grow_only).
**/
void
gimp_display_shell_scale_shrink_wrap (GimpDisplayShell *shell)
gimp_display_shell_scale_shrink_wrap (GimpDisplayShell *shell,
gboolean grow_only)
{
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
gimp_display_shell_scale_resize (shell, TRUE, TRUE);
gimp_display_shell_scale_resize (shell, TRUE, grow_only);
}
/**
......@@ -579,7 +580,7 @@ gimp_display_shell_scale_shrink_wrap (GimpDisplayShell *shell)
void
gimp_display_shell_scale_resize (GimpDisplayShell *shell,
gboolean resize_window,
gboolean redisplay)
gboolean grow_only)
{
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
......@@ -587,13 +588,13 @@ gimp_display_shell_scale_resize (GimpDisplayShell *shell,
gimp_display_shell_pause (shell);
if (resize_window)
gimp_display_shell_shrink_wrap (shell);
gimp_display_shell_shrink_wrap (shell, grow_only);
gimp_display_shell_scroll_clamp_offsets (shell);
gimp_display_shell_scale_setup (shell);
gimp_display_shell_scaled (shell);
if (resize_window || redisplay)
if (resize_window)
gimp_display_shell_expose_full (shell);
/* re-enable the active tool */
......
......@@ -43,11 +43,12 @@ void gimp_display_shell_scale_by_values (GimpDisplayShell *shell,
gint offset_x,
gint offset_y,
gboolean resize_window);
void gimp_display_shell_scale_shrink_wrap (GimpDisplayShell *shell);
void gimp_display_shell_scale_shrink_wrap (GimpDisplayShell *shell,
gboolean grow_only);
void gimp_display_shell_scale_resize (GimpDisplayShell *shell,
gboolean resize_window,
gboolean redisplay);
gboolean grow_only);
void gimp_display_shell_set_initial_scale (GimpDisplayShell *shell,
gdouble scale,
gint *display_width,
......
......@@ -1236,7 +1236,7 @@ gimp_display_shell_fill_idle (GimpDisplayShell *shell)
{
shell->fill_idle_id = 0;
gimp_display_shell_scale_shrink_wrap (shell);
gimp_display_shell_scale_shrink_wrap (shell, TRUE);
gtk_window_present (GTK_WINDOW (shell));
......@@ -1716,7 +1716,8 @@ gimp_display_shell_update_icon (GimpDisplayShell *shell)
}
void
gimp_display_shell_shrink_wrap (GimpDisplayShell *shell)
gimp_display_shell_shrink_wrap (GimpDisplayShell *shell,
gboolean grow_only)
{
GtkWidget *widget;
GdkScreen *screen;
......@@ -1780,9 +1781,19 @@ gimp_display_shell_shrink_wrap (GimpDisplayShell *shell)
if (width < shell->statusbar->requisition.width)
width = shell->statusbar->requisition.width;
gtk_window_resize (GTK_WINDOW (shell),
width + border_x,
height + border_y);
width = width + border_x;
height = height + border_y;
if (grow_only)
{
if (width < widget->allocation.width)
width = widget->allocation.width;
if (height < widget->allocation.height)
height = widget->allocation.height;
}
gtk_window_resize (GTK_WINDOW (shell), width, height);
}
}
......
......@@ -263,7 +263,8 @@ void gimp_display_shell_resume (GimpDisplayShell *shell);
void gimp_display_shell_update_icon (GimpDisplayShell *shell);
void gimp_display_shell_shrink_wrap (GimpDisplayShell *shell);
void gimp_display_shell_shrink_wrap (GimpDisplayShell *shell,
gboolean grow_only);
void gimp_display_shell_set_highlight (GimpDisplayShell *shell,
const GdkRectangle *highlight);
......
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