app/app_procs.c (app_init) delayed the activation of gimprc-autosave so we

2003-01-10  Sven Neumann  <sven@gimp.org>

	* app/app_procs.c (app_init)
	* app/core/gimp.c (gimp_set_config): delayed the activation of
	gimprc-autosave so we don't write the monitor resolution obtained
	from GDK back to the gimprc on each startup.

	* app/gui/gui.c (gui_get_screen_resolution): round values to get
	rid of rounding errors introduced earlier. Looks better in the
	prefs dialog.

	* app/display/gimpdisplayshell-scale.c (gimp_display_shell_scale):
	merged fix for bug #94979 from stable branch. Go even further and
	don't limit the zoom ratio between 1:16 and 16:1.

	* app/display/gimpdisplayshell.c (gimp_display_shell_new): merged
	fix for bug #103030 from stable branch.
This commit is contained in:
Sven Neumann 2003-01-10 21:15:41 +00:00 committed by Sven Neumann
parent 891520c407
commit ed312c95ab
8 changed files with 109 additions and 76 deletions

View File

@ -1,3 +1,21 @@
2003-01-10 Sven Neumann <sven@gimp.org>
* app/app_procs.c (app_init)
* app/core/gimp.c (gimp_set_config): delayed the activation of
gimprc-autosave so we don't write the monitor resolution obtained
from GDK back to the gimprc on each startup.
* app/gui/gui.c (gui_get_screen_resolution): round values to get
rid of rounding errors introduced earlier. Looks better in the
prefs dialog.
* app/display/gimpdisplayshell-scale.c (gimp_display_shell_scale):
merged fix for bug #94979 from stable branch. Go even further and
don't limit the zoom ratio between 1:16 and 16:1.
* app/display/gimpdisplayshell.c (gimp_display_shell_new): merged
fix for bug #103030 from stable branch.
2003-01-10 Maurits Rijk <lpeek.mrijk@consunet.nl>
* plug-ins/common/tiff.c (load_image): improved fix for #96611

4
NEWS
View File

@ -14,11 +14,11 @@ Overview of Changes in GIMP 1.3.12
- Portability fixes for 64bit platforms [Yosh, Sven]
- Handle large swap files (>2GB) [Sven]
- Updates to the Win32 build system [Tor Lillqvist, Hans Breuer]
- More work on the vectors tool [Simon]
- More work on the vectors tool [Simon, Mitch]
- Lots of bug fixes
Other contributors:
Maurits Rijk, Garry R. Osgood
Maurits Rijk, Garry R. Osgood, Jakub Steiner
Overview of Changes in GIMP 1.3.11

View File

@ -200,6 +200,11 @@ app_init (gint gimp_argc,
G_CALLBACK (app_exit_finish_callback),
NULL);
/* enable autosave late so we don't autosave when the
* monitor resolution is set in gui_init()
*/
gimp_rc_set_autosave (GIMP_RC (the_gimp->edit_config), TRUE);
/* Parse the rest of the command line arguments as images to load
*/
if (gimp_argc > 0)

View File

@ -589,8 +589,6 @@ gimp_set_config (Gimp *gimp,
gimp->edit_config =
GIMP_CORE_CONFIG (gimp_config_duplicate (G_OBJECT (gimp->config)));
gimp_rc_set_autosave (GIMP_RC (gimp->edit_config), TRUE);
g_signal_connect_object (gimp->config, "notify",
G_CALLBACK (gimp_global_config_notify),
gimp->edit_config, 0);

View File

@ -463,13 +463,19 @@ gimp_display_shell_new (GimpDisplay *gdisp,
if (scaledest > 1)
scaledest--;
else
if (scalesrc < 0xff)
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);
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;
}
shell->scale = (scaledest << 8) + scalesrc;

View File

@ -172,21 +172,21 @@ gimp_display_shell_scale_set_dot_for_dot (GimpDisplayShell *shell,
if (dot_for_dot != shell->dot_for_dot)
{
Gimp *gimp = shell->gdisp->gimage->gimp;
/* freeze the active tool */
tool_manager_control_active (shell->gdisp->gimage->gimp, PAUSE,
shell->gdisp);
tool_manager_control_active (gimp, PAUSE, shell->gdisp);
shell->dot_for_dot = dot_for_dot;
gimp_statusbar_resize_cursor (GIMP_STATUSBAR (shell->statusbar));
gimp_display_shell_scale_resize (shell,
GIMP_DISPLAY_CONFIG (shell->gdisp->gimage->gimp->config)->resize_windows_on_zoom,
GIMP_DISPLAY_CONFIG (gimp->config)->resize_windows_on_zoom,
TRUE);
/* re-enable the active tool */
tool_manager_control_active (shell->gdisp->gimage->gimp, RESUME,
shell->gdisp);
tool_manager_control_active (gimp, RESUME, shell->gdisp);
}
}
@ -194,9 +194,10 @@ void
gimp_display_shell_scale (GimpDisplayShell *shell,
GimpZoomType zoom_type)
{
GimpDisplayConfig *config;
guchar scalesrc, scaledest;
gdouble offset_x, offset_y;
glong sx, sy;
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
@ -207,8 +208,8 @@ gimp_display_shell_scale (GimpDisplayShell *shell,
offset_x = shell->offset_x + (shell->disp_width / 2.0);
offset_y = shell->offset_y + (shell->disp_height / 2.0);
offset_x *= ((double) scalesrc / (double) scaledest);
offset_y *= ((double) scalesrc / (double) scaledest);
offset_x *= ((gdouble) scalesrc / (gdouble) scaledest);
offset_y *= ((gdouble) scalesrc / (gdouble) scaledest);
switch (zoom_type)
{
@ -216,7 +217,7 @@ gimp_display_shell_scale (GimpDisplayShell *shell,
if (scalesrc > 1)
scalesrc--;
else
if (scaledest < 0x10)
if (scaledest < 0xFF)
scaledest++;
else
return;
@ -226,44 +227,35 @@ gimp_display_shell_scale (GimpDisplayShell *shell,
if (scaledest > 1)
scaledest--;
else
if (scalesrc < 0x10)
if (scalesrc < 0xFF)
scalesrc++;
else
return;
break;
default:
scalesrc = CLAMP (zoom_type % 100, 1, 0x10);
scaledest = CLAMP (zoom_type / 100, 1, 0x10);
scalesrc = CLAMP (zoom_type % 100, 1, 0xFF);
scaledest = CLAMP (zoom_type / 100, 1, 0xFF);
break;
}
sx = (shell->gdisp->gimage->width * scaledest) / scalesrc;
sy = (shell->gdisp->gimage->height * scaledest) / scalesrc;
/* The slider value is a short, so make sure we are within its
* range. If we are trying to scale past it, then stop the scale
*/
if (sx < 0xffff && sy < 0xffff)
{
/* set the offsets */
offset_x *= ((gdouble) scaledest / (gdouble) scalesrc);
offset_y *= ((gdouble) scaledest / (gdouble) scalesrc);
config = GIMP_DISPLAY_CONFIG (shell->gdisp->gimage->gimp->config);
gimp_display_shell_scale_by_values (shell,
(scaledest << 8) + scalesrc,
(offset_x - (shell->disp_width / 2)),
(offset_y - (shell->disp_height / 2)),
GIMP_DISPLAY_CONFIG (shell->gdisp->gimage->gimp->config)->resize_windows_on_zoom);
}
config->resize_windows_on_zoom);
}
void
gimp_display_shell_scale_fit (GimpDisplayShell *shell)
{
GimpDisplayConfig *config;
GimpImage *gimage;
gint image_width;
gint image_height;
gdouble zoom_x;
@ -283,10 +275,10 @@ gimp_display_shell_scale_fit (GimpDisplayShell *shell)
image_width = gimage->width;
image_height = gimage->height;
config = GIMP_DISPLAY_CONFIG (gimage->gimp->config);
if (! shell->dot_for_dot)
{
GimpDisplayConfig *config = GIMP_DISPLAY_CONFIG (gimage->gimp->config);
image_width = ROUND (image_width *
config->monitor_xres / gimage->xresolution);
image_height = ROUND (image_height *
@ -380,11 +372,14 @@ gimp_display_shell_scale_by_values (GimpDisplayShell *shell,
gint offset_y,
gboolean resize_window)
{
Gimp *gimp;
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
gimp = shell->gdisp->gimage->gimp;
/* freeze the active tool */
tool_manager_control_active (shell->gdisp->gimage->gimp, PAUSE,
shell->gdisp);
tool_manager_control_active (gimp, PAUSE, shell->gdisp);
shell->scale = scale;
shell->offset_x = offset_x;
@ -393,8 +388,7 @@ gimp_display_shell_scale_by_values (GimpDisplayShell *shell,
gimp_display_shell_scale_resize (shell, resize_window, TRUE);
/* re-enable the active tool */
tool_manager_control_active (shell->gdisp->gimage->gimp, RESUME,
shell->gdisp);
tool_manager_control_active (gimp, RESUME, shell->gdisp);
}
void
@ -410,11 +404,14 @@ gimp_display_shell_scale_resize (GimpDisplayShell *shell,
gboolean resize_window,
gboolean redisplay)
{
Gimp *gimp;
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
gimp = shell->gdisp->gimage->gimp;
/* freeze the active tool */
tool_manager_control_active (shell->gdisp->gimage->gimp, PAUSE,
shell->gdisp);
tool_manager_control_active (gimp, PAUSE, shell->gdisp);
if (resize_window)
gimp_display_shell_shrink_wrap (shell);
@ -433,8 +430,7 @@ gimp_display_shell_scale_resize (GimpDisplayShell *shell,
}
/* re-enable the active tool */
tool_manager_control_active (shell->gdisp->gimage->gimp, RESUME,
shell->gdisp);
tool_manager_control_active (gimp, RESUME, shell->gdisp);
}
@ -450,15 +446,18 @@ img2real (GimpDisplayShell *shell,
gboolean xdir,
gdouble a)
{
GimpImage *gimage;
gdouble res;
if (shell->dot_for_dot)
return a;
if (xdir)
res = shell->gdisp->gimage->xresolution;
else
res = shell->gdisp->gimage->yresolution;
gimage = shell->gdisp->gimage;
return a * gimp_unit_get_factor (shell->gdisp->gimage->unit) / res;
if (xdir)
res = gimage->xresolution;
else
res = gimage->yresolution;
return a * gimp_unit_get_factor (gimage->unit) / res;
}

View File

@ -463,13 +463,19 @@ gimp_display_shell_new (GimpDisplay *gdisp,
if (scaledest > 1)
scaledest--;
else
if (scalesrc < 0xff)
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);
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;
}
shell->scale = (scaledest << 8) + scalesrc;

View File

@ -377,8 +377,9 @@ gui_get_screen_resolution (gdouble *xres,
y = 75.0;
}
*xres = x;
*yres = y;
/* round the value to full integers to give more pleasant results */
*xres = RINT (x);
*yres = RINT (y);
}