app/gdisplay.c app/image_map.c

2000-08-16  Garry R. Osgood <gosgood@idt.net>
* app/gdisplay.c
* app/image_map.c

Addresses Bug Report #14704, and an
undisclosed undo system bug. Freezes
undo stack before interactive tools
commence idle rendering; thaws stack
on cleanup and immediately sets menu
sensitivity.

Not an image lock, but Yet Another UI
Lock. Oh well; merrilly we patch along...
See http://bugs.gnome.org/db/14/14704.html
for gory details. Closes #14704.
This commit is contained in:
Garry R. Osgood 2000-08-17 01:33:44 +00:00 committed by Garry R. Osgood
parent 0e0832289b
commit 43ff0cdfee
6 changed files with 104 additions and 6 deletions

View File

@ -1,3 +1,32 @@
2000-08-16 Garry R. Osgood <gosgood@idt.net>
* app/gdisplay.c
* app/image_map.c
Addresses Bug Report #14704, and an undisclosed undo system bug.
(1) image_map_create() freezes the undo stack and invokes
gdisplay_set_menu_sensitivity (_image_map->gdisp) to ghost
Edit/Undo|Edit/Redo and disables associated accelerator keys.
This routine sets up idle renderers for interactive tools
(a) Color Balance... (b) Hue-Saturation... (c) Brightness-Contrast...
(d) Threshold... (e) Levels... (f) Curves... and (g) Posterize.
The change prevents disturbance of the Undo system via the GUI
when idle renderers are active.
(2) gdisplay_set_menu_sensitivity () tests if the undo facility
is frozen, via gboolean gimage_get_active_layer (gdisp->gimage).
It does not set menu sensitivity for Edit/Undo and Edit/Redo
if the undo/redo stacks are frozen. Otherwise (old behaviour)
it sets sensitivity of these menu items only if the undo/redo
stacks are populated.
(3) image_map_commit(), image_map_clear(), and image_map_abort() each
thaw the undo system and invoke gdisplay_set_menu_sensitivity().
when idle rendering completes or is aborted. This causes Control-Z
Control-R and the Edit/Undo|Edit/Redo menu selections to be sensitive
immediately after the Undo stack is populated with one item, addressing
#14704. Formerly, gdisplay_set_menu_sensitivity() was lazily called.
during the next gdisplay_flush(), invariably requiring prompting via
a second edit before sensitivity was set.
Not an image lock, but Yet Another UI Lock. Oh well; merrilly we patch along...
See http://bugs.gnome.org/db/14/14704.html for gory details. Closes #14704.
2000-08-17 Daniel Egger <egger@suse.de>
* help/C/dialogs/color_selectors/*.html: Checking proofread

View File

@ -109,6 +109,11 @@ image_map_create (void *gdisp_ptr,
_image_map->undo_tiles = NULL;
_image_map->state = WAITING;
/* Interactive tools based on image_map disable the undo stack */
/* to avert any unintented undo interaction through the UI */
gimp_image_undo_freeze(_image_map->gdisp->gimage);
gdisplay_set_menu_sensitivity (_image_map->gdisp);
return (ImageMap) _image_map;
}
@ -226,6 +231,9 @@ image_map_commit (ImageMap image_map)
if (! drawable_gimage ( (_image_map->drawable)))
return;
/* Interactive phase ends: we can commit an undo frame now */
gimp_image_undo_thaw(_image_map->gdisp->gimage);
/* Register an undo step */
if (_image_map->undo_tiles)
{
@ -236,6 +244,7 @@ image_map_commit (ImageMap image_map)
drawable_apply_image ( (_image_map->drawable), x1, y1, x2, y2, _image_map->undo_tiles, FALSE);
}
gdisplay_set_menu_sensitivity (_image_map->gdisp);
g_free (_image_map);
}
@ -278,6 +287,8 @@ image_map_clear (ImageMap image_map)
{
g_message ("image depth change, unable to restore original image");
tile_manager_destroy (_image_map->undo_tiles);
gimp_image_undo_thaw(_image_map->gdisp->gimage);
gdisplay_set_menu_sensitivity (_image_map->gdisp);
g_free (_image_map);
return;
}
@ -299,7 +310,11 @@ image_map_clear (ImageMap image_map)
void
image_map_abort (ImageMap image_map)
{
_ImageMap *_image_map = (_ImageMap *) image_map;
image_map_clear(image_map);
gimp_image_undo_thaw(_image_map->gdisp->gimage);
gdisplay_set_menu_sensitivity (_image_map->gdisp);
g_free (image_map);
}

View File

@ -1725,8 +1725,21 @@ gdisplay_set_menu_sensitivity (GDisplay *gdisp)
SET_SENSITIVE ("Edit/Buffer", gdisp);
if (gdisp)
{
SET_SENSITIVE ("Edit/Undo", undo_get_undo_name (gdisp->gimage));
SET_SENSITIVE ("Edit/Redo", undo_get_redo_name (gdisp->gimage));
/* Interactive tools such as CURVES, COLOR_BALANCE, LEVELS disable */
/* undo to fake some kind of atomic behaviour. G. R. Osgood #14072 */
if (gimp_image_undo_is_enabled (gdisp->gimage))
{
/* If undo/redo stacks are empty, disable respective menu */
SET_SENSITIVE ("Edit/Undo", undo_get_undo_name (gdisp->gimage));
SET_SENSITIVE ("Edit/Redo", undo_get_redo_name (gdisp->gimage));
}
else
{
SET_SENSITIVE ("Edit/Undo", FALSE);
SET_SENSITIVE ("Edit/Redo", FALSE);
}
SET_SENSITIVE ("Edit/Cut", lp);
SET_SENSITIVE ("Edit/Copy", lp);
SET_SENSITIVE ("Edit/Buffer/Cut Named...", lp);

View File

@ -1725,8 +1725,21 @@ gdisplay_set_menu_sensitivity (GDisplay *gdisp)
SET_SENSITIVE ("Edit/Buffer", gdisp);
if (gdisp)
{
SET_SENSITIVE ("Edit/Undo", undo_get_undo_name (gdisp->gimage));
SET_SENSITIVE ("Edit/Redo", undo_get_redo_name (gdisp->gimage));
/* Interactive tools such as CURVES, COLOR_BALANCE, LEVELS disable */
/* undo to fake some kind of atomic behaviour. G. R. Osgood #14072 */
if (gimp_image_undo_is_enabled (gdisp->gimage))
{
/* If undo/redo stacks are empty, disable respective menu */
SET_SENSITIVE ("Edit/Undo", undo_get_undo_name (gdisp->gimage));
SET_SENSITIVE ("Edit/Redo", undo_get_redo_name (gdisp->gimage));
}
else
{
SET_SENSITIVE ("Edit/Undo", FALSE);
SET_SENSITIVE ("Edit/Redo", FALSE);
}
SET_SENSITIVE ("Edit/Cut", lp);
SET_SENSITIVE ("Edit/Copy", lp);
SET_SENSITIVE ("Edit/Buffer/Cut Named...", lp);

View File

@ -1725,8 +1725,21 @@ gdisplay_set_menu_sensitivity (GDisplay *gdisp)
SET_SENSITIVE ("Edit/Buffer", gdisp);
if (gdisp)
{
SET_SENSITIVE ("Edit/Undo", undo_get_undo_name (gdisp->gimage));
SET_SENSITIVE ("Edit/Redo", undo_get_redo_name (gdisp->gimage));
/* Interactive tools such as CURVES, COLOR_BALANCE, LEVELS disable */
/* undo to fake some kind of atomic behaviour. G. R. Osgood #14072 */
if (gimp_image_undo_is_enabled (gdisp->gimage))
{
/* If undo/redo stacks are empty, disable respective menu */
SET_SENSITIVE ("Edit/Undo", undo_get_undo_name (gdisp->gimage));
SET_SENSITIVE ("Edit/Redo", undo_get_redo_name (gdisp->gimage));
}
else
{
SET_SENSITIVE ("Edit/Undo", FALSE);
SET_SENSITIVE ("Edit/Redo", FALSE);
}
SET_SENSITIVE ("Edit/Cut", lp);
SET_SENSITIVE ("Edit/Copy", lp);
SET_SENSITIVE ("Edit/Buffer/Cut Named...", lp);

View File

@ -109,6 +109,11 @@ image_map_create (void *gdisp_ptr,
_image_map->undo_tiles = NULL;
_image_map->state = WAITING;
/* Interactive tools based on image_map disable the undo stack */
/* to avert any unintented undo interaction through the UI */
gimp_image_undo_freeze(_image_map->gdisp->gimage);
gdisplay_set_menu_sensitivity (_image_map->gdisp);
return (ImageMap) _image_map;
}
@ -226,6 +231,9 @@ image_map_commit (ImageMap image_map)
if (! drawable_gimage ( (_image_map->drawable)))
return;
/* Interactive phase ends: we can commit an undo frame now */
gimp_image_undo_thaw(_image_map->gdisp->gimage);
/* Register an undo step */
if (_image_map->undo_tiles)
{
@ -236,6 +244,7 @@ image_map_commit (ImageMap image_map)
drawable_apply_image ( (_image_map->drawable), x1, y1, x2, y2, _image_map->undo_tiles, FALSE);
}
gdisplay_set_menu_sensitivity (_image_map->gdisp);
g_free (_image_map);
}
@ -278,6 +287,8 @@ image_map_clear (ImageMap image_map)
{
g_message ("image depth change, unable to restore original image");
tile_manager_destroy (_image_map->undo_tiles);
gimp_image_undo_thaw(_image_map->gdisp->gimage);
gdisplay_set_menu_sensitivity (_image_map->gdisp);
g_free (_image_map);
return;
}
@ -299,7 +310,11 @@ image_map_clear (ImageMap image_map)
void
image_map_abort (ImageMap image_map)
{
_ImageMap *_image_map = (_ImageMap *) image_map;
image_map_clear(image_map);
gimp_image_undo_thaw(_image_map->gdisp->gimage);
gdisplay_set_menu_sensitivity (_image_map->gdisp);
g_free (image_map);
}