Commit 890c6fde authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann

app/config/gimpdisplayconfig.[ch] app/config/gimprc-blurbs.h

2003-02-25  Sven Neumann  <sven@gimp.org>

	* app/config/gimpdisplayconfig.[ch]
	* app/config/gimprc-blurbs.h
	* app/display/gimpdisplayshell.c
	* app/gui/preferences-dialog.c: applied a modified version of a
	patch from Toralf Lund <toralf@kscanners.no> that adds a new
	preferences option to choose the inital zoom ratio. Fixes bug
	#106730 and in my opinion also #103547.
parent a7aae312
2003-02-25 Sven Neumann <sven@gimp.org>
* app/config/gimpdisplayconfig.[ch]
* app/config/gimprc-blurbs.h
* app/display/gimpdisplayshell.c
* app/gui/preferences-dialog.c: applied a modified version of a
patch from Toralf Lund <toralf@kscanners.no> that adds a new
preferences option to choose the inital zoom ratio. Fixes bug
#106730 and in my opinion also #103547.
2003-02-25 Sven Neumann <sven@gimp.org>
* plug-ins/common/spheredesigner.c: replaced the GtkList with a
......@@ -61,6 +61,7 @@ enum
PROP_RESIZE_WINDOWS_ON_ZOOM,
PROP_RESIZE_WINDOWS_ON_RESIZE,
PROP_DEFAULT_DOT_FOR_DOT,
PROP_INITIAL_ZOOM_TO_FIT,
PROP_PERFECT_MOUSE,
PROP_CURSOR_MODE,
PROP_CURSOR_UPDATING,
......@@ -149,6 +150,11 @@ gimp_display_config_class_init (GimpDisplayConfigClass *klass)
DEFAULT_DOT_FOR_DOT_BLURB,
TRUE,
0);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_INITIAL_ZOOM_TO_FIT,
"initial_zoom_to_fit",
INITIAL_ZOOM_TO_FIT_BLURB,
TRUE,
0);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_PERFECT_MOUSE,
"perfect-mouse", PERFECT_MOUSE_BLURB,
FALSE,
......@@ -262,6 +268,9 @@ gimp_display_config_set_property (GObject *object,
case PROP_DEFAULT_DOT_FOR_DOT:
display_config->default_dot_for_dot = g_value_get_boolean (value);
break;
case PROP_INITIAL_ZOOM_TO_FIT:
display_config->initial_zoom_to_fit = g_value_get_boolean (value);
break;
case PROP_PERFECT_MOUSE:
display_config->perfect_mouse = g_value_get_boolean (value);
break;
......@@ -343,6 +352,9 @@ gimp_display_config_get_property (GObject *object,
case PROP_DEFAULT_DOT_FOR_DOT:
g_value_set_boolean (value, display_config->default_dot_for_dot);
break;
case PROP_INITIAL_ZOOM_TO_FIT:
g_value_set_boolean (value, display_config->initial_zoom_to_fit);
break;
case PROP_PERFECT_MOUSE:
g_value_set_boolean (value, display_config->perfect_mouse);
break;
......
......@@ -45,6 +45,7 @@ struct _GimpDisplayConfig
gboolean resize_windows_on_zoom;
gboolean resize_windows_on_resize;
gboolean default_dot_for_dot;
gboolean initial_zoom_to_fit;
gboolean perfect_mouse;
GimpCursorMode cursor_mode;
gboolean cursor_updating;
......
......@@ -133,6 +133,10 @@ N_("Sets the text to appear in image window titles.")
N_("When set to yes, the GIMP will use a different info window per image " \
"view.")
#define INITIAL_ZOOM_TO_FIT_BLURB \
N_("When set to yes, this will ensure that the full image is visible after " \
"a file is opened, otherwise it will be displayed with a scale of 1:1.")
#define INSTALL_COLORMAP_BLURB \
N_("Install a private colormap; might be useful on pseudocolor visuals.")
......
......@@ -1312,11 +1312,16 @@ prefs_dialog_new (Gimp *gimp,
_("Show S_tatusbar"),
GTK_BOX (vbox2));
table = prefs_table_new (1, GTK_CONTAINER (vbox2), FALSE);
table = prefs_table_new (2, GTK_CONTAINER (vbox2), FALSE);
prefs_boolean_option_menu_add (config, "initial-zoom-to-fit",
_("Fit to Window"),
"1:1",
_("Inital Zoom Ratio:"),
GTK_TABLE (table), 0);
prefs_spin_button_add (config, "marching-ants-speed", 10.0, 100.0, 0,
_("Marching _Ants Speed:"),
GTK_TABLE (table), 0);
GTK_TABLE (table), 1);
/* Canvas Padding Color */
vbox2 = prefs_frame_new (_("Canvas Padding Color"),
......
......@@ -432,25 +432,39 @@ gimp_display_shell_new (GimpDisplay *gdisp,
n_width = SCALEX (shell, image_width);
n_height = SCALEX (shell, image_height);
/* Limit to the size of the screen... */
while (n_width > s_width || n_height > s_height)
if (config->initial_zoom_to_fit)
{
if (scaledest > 1)
scaledest--;
else
if (scalesrc < 0xFF)
scalesrc++;
n_width = (image_width *
(scaledest * SCREEN_XRES (shell)) /
(scalesrc * gdisp->gimage->xresolution));
n_height = (image_height *
(scaledest * SCREEN_XRES (shell)) /
(scalesrc * gdisp->gimage->xresolution));
if (scaledest == 1 && scalesrc == 0xFF)
break;
/* Limit to the size of the screen... */
while (n_width > s_width || n_height > s_height)
{
if (scaledest > 1)
scaledest--;
else
if (scalesrc < 0xFF)
scalesrc++;
n_width = (image_width *
(scaledest * SCREEN_XRES (shell)) /
(scalesrc * gdisp->gimage->xresolution));
n_height = (image_height *
(scaledest * SCREEN_XRES (shell)) /
(scalesrc * gdisp->gimage->xresolution));
if (scaledest == 1 && scalesrc == 0xFF)
break;
}
}
else
{
/* Set up size like above, but do not zoom to fit.
Useful when working on large images. */
if (n_width > s_width)
n_width = s_width;
if (n_height > s_height)
n_height = s_height;
}
shell->scale = (scaledest << 8) + scalesrc;
......
......@@ -432,25 +432,39 @@ gimp_display_shell_new (GimpDisplay *gdisp,
n_width = SCALEX (shell, image_width);
n_height = SCALEX (shell, image_height);
/* Limit to the size of the screen... */
while (n_width > s_width || n_height > s_height)
if (config->initial_zoom_to_fit)
{
if (scaledest > 1)
scaledest--;
else
if (scalesrc < 0xFF)
scalesrc++;
n_width = (image_width *
(scaledest * SCREEN_XRES (shell)) /
(scalesrc * gdisp->gimage->xresolution));
n_height = (image_height *
(scaledest * SCREEN_XRES (shell)) /
(scalesrc * gdisp->gimage->xresolution));
if (scaledest == 1 && scalesrc == 0xFF)
break;
/* Limit to the size of the screen... */
while (n_width > s_width || n_height > s_height)
{
if (scaledest > 1)
scaledest--;
else
if (scalesrc < 0xFF)
scalesrc++;
n_width = (image_width *
(scaledest * SCREEN_XRES (shell)) /
(scalesrc * gdisp->gimage->xresolution));
n_height = (image_height *
(scaledest * SCREEN_XRES (shell)) /
(scalesrc * gdisp->gimage->xresolution));
if (scaledest == 1 && scalesrc == 0xFF)
break;
}
}
else
{
/* Set up size like above, but do not zoom to fit.
Useful when working on large images. */
if (n_width > s_width)
n_width = s_width;
if (n_height > s_height)
n_height = s_height;
}
shell->scale = (scaledest << 8) + scalesrc;
......
......@@ -1312,11 +1312,16 @@ prefs_dialog_new (Gimp *gimp,
_("Show S_tatusbar"),
GTK_BOX (vbox2));
table = prefs_table_new (1, GTK_CONTAINER (vbox2), FALSE);
table = prefs_table_new (2, GTK_CONTAINER (vbox2), FALSE);
prefs_boolean_option_menu_add (config, "initial-zoom-to-fit",
_("Fit to Window"),
"1:1",
_("Inital Zoom Ratio:"),
GTK_TABLE (table), 0);
prefs_spin_button_add (config, "marching-ants-speed", 10.0, 100.0, 0,
_("Marching _Ants Speed:"),
GTK_TABLE (table), 0);
GTK_TABLE (table), 1);
/* Canvas Padding Color */
vbox2 = prefs_frame_new (_("Canvas Padding Color"),
......
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