[gimp/gimp-2-10] app: avoid pushing undo while updating colormap entries
- From: Ell <ell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gimp-2-10] app: avoid pushing undo while updating colormap entries
- Date: Wed, 13 Mar 2019 14:57:38 +0000 (UTC)
commit f8aec23e336e88f88b1d7dbee0305f7ab2182887
Author: Ell <ell_se yahoo com>
Date: Wed Mar 13 10:53:56 2019 -0400
app: avoid pushing undo while updating colormap entries
In GimpColormapEditor, while updating a colormap entry, only push
an undo step when confirming the new color.
(cherry picked from commit 506f412a05a76c5c16a24cf32c90f3b680b96da8)
app/widgets/gimpcolormapeditor.c | 37 ++++++++++++++++++++++++++++++-------
1 file changed, 30 insertions(+), 7 deletions(-)
---
diff --git a/app/widgets/gimpcolormapeditor.c b/app/widgets/gimpcolormapeditor.c
index e6c6c00bb5..14fce58083 100644
--- a/app/widgets/gimpcolormapeditor.c
+++ b/app/widgets/gimpcolormapeditor.c
@@ -33,6 +33,7 @@
#include "core/gimpimage-colormap.h"
#include "core/gimpmarshal.h"
#include "core/gimppalette.h"
+#include "core/gimpprojection.h"
#include "gimpcolordialog.h"
#include "gimpcolormapeditor.h"
@@ -772,25 +773,47 @@ gimp_colormap_editor_edit_color_update (GimpColorDialog *dialog,
{
GimpImageEditor *image_editor = GIMP_IMAGE_EDITOR (editor);
GimpImage *image = image_editor->image;
-
- if (image)
- {
- gimp_image_set_colormap_entry (image, editor->col_index, color, TRUE);
- gimp_image_flush (image);
- }
+ gboolean push_undo = FALSE;
switch (state)
{
case GIMP_COLOR_DIALOG_OK:
+ push_undo = TRUE;
+
if (state & gimp_get_toggle_behavior_mask ())
gimp_context_set_background (image_editor->context, color);
else
gimp_context_set_foreground (image_editor->context, color);
- /* Pass through */
+ /* Fall through */
+
case GIMP_COLOR_DIALOG_CANCEL:
gtk_widget_hide (editor->color_dialog);
break;
+
case GIMP_COLOR_DIALOG_UPDATE:
break;
}
+
+ if (image)
+ {
+ if (push_undo)
+ {
+ GimpRGB old_color;
+
+ gimp_color_selection_get_old_color (
+ GIMP_COLOR_SELECTION (dialog->selection), &old_color);
+
+ /* Restore old color for undo */
+ gimp_image_set_colormap_entry (image, editor->col_index, &old_color,
+ FALSE);
+ }
+
+ gimp_image_set_colormap_entry (image, editor->col_index, color,
+ push_undo);
+
+ if (push_undo)
+ gimp_image_flush (image);
+ else
+ gimp_projection_flush (gimp_image_get_projection (image));
+ }
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]