From 05c73c41467b60658910f29d59ff9b584c5f6be8 Mon Sep 17 00:00:00 2001 From: Gnome CVS User Date: Wed, 26 Nov 1997 19:30:17 +0000 Subject: [PATCH] Several fixes, most notably a bug in undo when drawing outside an image, and the "out of paint bug". --- app/channels_dialog.c | 6 ++++++ app/core/gimpimage-undo-push.c | 10 ++++++++++ app/core/gimpprojection.c | 5 +++++ app/display/gimpdisplay-scale.c | 4 ---- app/display/gimpdisplay.c | 5 +++++ app/display/gimpdisplayshell-scale.c | 4 ---- app/gdisplay.c | 5 +++++ app/gui/channels-dialog.c | 6 ++++++ app/gui/layers-dialog.c | 2 +- app/layers_dialog.c | 2 +- app/magnify.c | 4 ---- app/scale.c | 4 ---- app/tools/gimpmagnifytool.c | 4 ---- app/tools/magnify.c | 4 ---- app/undo.c | 10 ++++++++++ 15 files changed, 49 insertions(+), 26 deletions(-) diff --git a/app/channels_dialog.c b/app/channels_dialog.c index 060f64e7ec..8206f9fc4e 100644 --- a/app/channels_dialog.c +++ b/app/channels_dialog.c @@ -334,8 +334,10 @@ channels_dialog_update (int gimage_id) channelsD->gimage_id = gimage_id; + suspend_gimage_notify++; /* Free all elements in the channels listbox */ gtk_list_clear_items (GTK_LIST (channelsD->channel_list), 0, -1); + suspend_gimage_notify--; list = channelsD->channel_widgets; while (list) @@ -419,7 +421,9 @@ channels_dialog_update (int gimage_id) void channels_dialog_clear () { + suspend_gimage_notify++; gtk_list_clear_items (GTK_LIST (channelsD->channel_list), 0, -1); + suspend_gimage_notify--; } void @@ -431,8 +435,10 @@ channels_dialog_free () if (channelsD == NULL) return; + suspend_gimage_notify++; /* Free all elements in the channels listbox */ gtk_list_clear_items (GTK_LIST (channelsD->channel_list), 0, -1); + suspend_gimage_notify--; list = channelsD->channel_widgets; while (list) diff --git a/app/core/gimpimage-undo-push.c b/app/core/gimpimage-undo-push.c index 2a9fe6d72f..daf0bd9d02 100644 --- a/app/core/gimpimage-undo-push.c +++ b/app/core/gimpimage-undo-push.c @@ -433,6 +433,11 @@ undo_push_image (GImage *gimage, gimage_dirty (gimage); drawable_dirty (drawable_ID); + x1 = BOUNDS (x1, 0, drawable_width (drawable_ID)); + y1 = BOUNDS (y1, 0, drawable_height (drawable_ID)); + x2 = BOUNDS (x2, 0, drawable_width (drawable_ID)); + y2 = BOUNDS (y2, 0, drawable_height (drawable_ID)); + size = (x2 - x1) * (y2 - y1) * drawable_bytes (drawable_ID) + sizeof (void *) * 2; if ((new = undo_push (gimage, size, IMAGE_UNDO))) @@ -489,6 +494,11 @@ undo_push_image_mod (GImage *gimage, if (! tiles_ptr) return FALSE; + x1 = BOUNDS (x1, 0, drawable_width (drawable_ID)); + y1 = BOUNDS (y1, 0, drawable_height (drawable_ID)); + x2 = BOUNDS (x2, 0, drawable_width (drawable_ID)); + y2 = BOUNDS (y2, 0, drawable_height (drawable_ID)); + tiles = (TileManager *) tiles_ptr; size = tiles->levels[0].width * tiles->levels[0].height * tiles->levels[0].bpp + sizeof (void *) * 2; diff --git a/app/core/gimpprojection.c b/app/core/gimpprojection.c index c74e600ea9..e9e3884220 100644 --- a/app/core/gimpprojection.c +++ b/app/core/gimpprojection.c @@ -330,6 +330,11 @@ gdisplay_flush (GDisplay *gdisp) /* start the currently active tool */ active_tool_control (RESUME, (void *) gdisp); } + + /* update the gdisplay's info dialog */ + if (gdisp->window_info_dialog) + info_window_update (gdisp->window_info_dialog, + (void *) gdisp); } diff --git a/app/display/gimpdisplay-scale.c b/app/display/gimpdisplay-scale.c index d27f5bbd8c..cb35764cde 100644 --- a/app/display/gimpdisplay-scale.c +++ b/app/display/gimpdisplay-scale.c @@ -153,10 +153,6 @@ change_scale (GDisplay *gdisp, /* resize the image */ resize_display (gdisp, allow_resize_windows, TRUE); - /* update the gdisplay's info dialog */ - if (gdisp->window_info_dialog) - info_window_update (gdisp->window_info_dialog, - (void *) gdisp); } } diff --git a/app/display/gimpdisplay.c b/app/display/gimpdisplay.c index c74e600ea9..e9e3884220 100644 --- a/app/display/gimpdisplay.c +++ b/app/display/gimpdisplay.c @@ -330,6 +330,11 @@ gdisplay_flush (GDisplay *gdisp) /* start the currently active tool */ active_tool_control (RESUME, (void *) gdisp); } + + /* update the gdisplay's info dialog */ + if (gdisp->window_info_dialog) + info_window_update (gdisp->window_info_dialog, + (void *) gdisp); } diff --git a/app/display/gimpdisplayshell-scale.c b/app/display/gimpdisplayshell-scale.c index d27f5bbd8c..cb35764cde 100644 --- a/app/display/gimpdisplayshell-scale.c +++ b/app/display/gimpdisplayshell-scale.c @@ -153,10 +153,6 @@ change_scale (GDisplay *gdisp, /* resize the image */ resize_display (gdisp, allow_resize_windows, TRUE); - /* update the gdisplay's info dialog */ - if (gdisp->window_info_dialog) - info_window_update (gdisp->window_info_dialog, - (void *) gdisp); } } diff --git a/app/gdisplay.c b/app/gdisplay.c index c74e600ea9..e9e3884220 100644 --- a/app/gdisplay.c +++ b/app/gdisplay.c @@ -330,6 +330,11 @@ gdisplay_flush (GDisplay *gdisp) /* start the currently active tool */ active_tool_control (RESUME, (void *) gdisp); } + + /* update the gdisplay's info dialog */ + if (gdisp->window_info_dialog) + info_window_update (gdisp->window_info_dialog, + (void *) gdisp); } diff --git a/app/gui/channels-dialog.c b/app/gui/channels-dialog.c index 060f64e7ec..8206f9fc4e 100644 --- a/app/gui/channels-dialog.c +++ b/app/gui/channels-dialog.c @@ -334,8 +334,10 @@ channels_dialog_update (int gimage_id) channelsD->gimage_id = gimage_id; + suspend_gimage_notify++; /* Free all elements in the channels listbox */ gtk_list_clear_items (GTK_LIST (channelsD->channel_list), 0, -1); + suspend_gimage_notify--; list = channelsD->channel_widgets; while (list) @@ -419,7 +421,9 @@ channels_dialog_update (int gimage_id) void channels_dialog_clear () { + suspend_gimage_notify++; gtk_list_clear_items (GTK_LIST (channelsD->channel_list), 0, -1); + suspend_gimage_notify--; } void @@ -431,8 +435,10 @@ channels_dialog_free () if (channelsD == NULL) return; + suspend_gimage_notify++; /* Free all elements in the channels listbox */ gtk_list_clear_items (GTK_LIST (channelsD->channel_list), 0, -1); + suspend_gimage_notify--; list = channelsD->channel_widgets; while (list) diff --git a/app/gui/layers-dialog.c b/app/gui/layers-dialog.c index fd87ba294b..6e033ff32e 100644 --- a/app/gui/layers-dialog.c +++ b/app/gui/layers-dialog.c @@ -1136,7 +1136,7 @@ layers_dialog_set_menu_sensitivity () /* resize layer */ gtk_widget_set_sensitive (layers_ops[6].widget, ac && gimage && lp); /* add layer mask */ - gtk_widget_set_sensitive (layers_ops[7].widget, fs && ac && gimage && !lm && lp); + gtk_widget_set_sensitive (layers_ops[7].widget, fs && ac && gimage && !lm && lp && alpha); /* apply layer mask */ gtk_widget_set_sensitive (layers_ops[8].widget, fs && ac && gimage && lm && lp); /* anchor layer */ diff --git a/app/layers_dialog.c b/app/layers_dialog.c index fd87ba294b..6e033ff32e 100644 --- a/app/layers_dialog.c +++ b/app/layers_dialog.c @@ -1136,7 +1136,7 @@ layers_dialog_set_menu_sensitivity () /* resize layer */ gtk_widget_set_sensitive (layers_ops[6].widget, ac && gimage && lp); /* add layer mask */ - gtk_widget_set_sensitive (layers_ops[7].widget, fs && ac && gimage && !lm && lp); + gtk_widget_set_sensitive (layers_ops[7].widget, fs && ac && gimage && !lm && lp && alpha); /* apply layer mask */ gtk_widget_set_sensitive (layers_ops[8].widget, fs && ac && gimage && lm && lp); /* anchor layer */ diff --git a/app/magnify.c b/app/magnify.c index ad6b029d75..7a127c6622 100644 --- a/app/magnify.c +++ b/app/magnify.c @@ -254,10 +254,6 @@ magnify_button_release (Tool *tool, /* resize the image */ resize_display (gdisp, allow_resize_windows, TRUE); - /* update the window info */ - if (gdisp->window_info_dialog) - info_window_update (gdisp->window_info_dialog, - (void *) gdisp); } } diff --git a/app/scale.c b/app/scale.c index d27f5bbd8c..cb35764cde 100644 --- a/app/scale.c +++ b/app/scale.c @@ -153,10 +153,6 @@ change_scale (GDisplay *gdisp, /* resize the image */ resize_display (gdisp, allow_resize_windows, TRUE); - /* update the gdisplay's info dialog */ - if (gdisp->window_info_dialog) - info_window_update (gdisp->window_info_dialog, - (void *) gdisp); } } diff --git a/app/tools/gimpmagnifytool.c b/app/tools/gimpmagnifytool.c index ad6b029d75..7a127c6622 100644 --- a/app/tools/gimpmagnifytool.c +++ b/app/tools/gimpmagnifytool.c @@ -254,10 +254,6 @@ magnify_button_release (Tool *tool, /* resize the image */ resize_display (gdisp, allow_resize_windows, TRUE); - /* update the window info */ - if (gdisp->window_info_dialog) - info_window_update (gdisp->window_info_dialog, - (void *) gdisp); } } diff --git a/app/tools/magnify.c b/app/tools/magnify.c index ad6b029d75..7a127c6622 100644 --- a/app/tools/magnify.c +++ b/app/tools/magnify.c @@ -254,10 +254,6 @@ magnify_button_release (Tool *tool, /* resize the image */ resize_display (gdisp, allow_resize_windows, TRUE); - /* update the window info */ - if (gdisp->window_info_dialog) - info_window_update (gdisp->window_info_dialog, - (void *) gdisp); } } diff --git a/app/undo.c b/app/undo.c index 2a9fe6d72f..daf0bd9d02 100644 --- a/app/undo.c +++ b/app/undo.c @@ -433,6 +433,11 @@ undo_push_image (GImage *gimage, gimage_dirty (gimage); drawable_dirty (drawable_ID); + x1 = BOUNDS (x1, 0, drawable_width (drawable_ID)); + y1 = BOUNDS (y1, 0, drawable_height (drawable_ID)); + x2 = BOUNDS (x2, 0, drawable_width (drawable_ID)); + y2 = BOUNDS (y2, 0, drawable_height (drawable_ID)); + size = (x2 - x1) * (y2 - y1) * drawable_bytes (drawable_ID) + sizeof (void *) * 2; if ((new = undo_push (gimage, size, IMAGE_UNDO))) @@ -489,6 +494,11 @@ undo_push_image_mod (GImage *gimage, if (! tiles_ptr) return FALSE; + x1 = BOUNDS (x1, 0, drawable_width (drawable_ID)); + y1 = BOUNDS (y1, 0, drawable_height (drawable_ID)); + x2 = BOUNDS (x2, 0, drawable_width (drawable_ID)); + y2 = BOUNDS (y2, 0, drawable_height (drawable_ID)); + tiles = (TileManager *) tiles_ptr; size = tiles->levels[0].width * tiles->levels[0].height * tiles->levels[0].bpp + sizeof (void *) * 2;