[gimp/gimp-2-10] app: in the warp tool, blink behavior combo when the current behavior is invalid



commit fd297f943b7590655dddffa2eb27ac6c42853c28
Author: Ell <ell_se yahoo com>
Date:   Wed Dec 12 11:17:49 2018 -0500

    app: in the warp tool, blink behavior combo when the current behavior is invalid
    
    In the warp tool, when the warp is empty and the current behavior
    has no effect as a result (i.e., when it's ERASE or SMOOTH), show
    an error message in the status bar, and blink the behavior combo
    widget in the tool options, to hint at the source of the error.
    
    (cherry picked from commit 7958387d54c41bad17ed373adf510717c830248a)

 app/tools/gimpwarpoptions.c |  2 ++
 app/tools/gimpwarpoptions.h |  1 +
 app/tools/gimpwarptool.c    | 35 +++++++++++++++++++++++++++++++++++
 3 files changed, 38 insertions(+)
---
diff --git a/app/tools/gimpwarpoptions.c b/app/tools/gimpwarpoptions.c
index 1a585b56e4..de0cbe67b1 100644
--- a/app/tools/gimpwarpoptions.c
+++ b/app/tools/gimpwarpoptions.c
@@ -294,6 +294,8 @@ gimp_warp_options_gui (GimpToolOptions *tool_options)
   gtk_box_pack_start (GTK_BOX (vbox), combo, FALSE, FALSE, 0);
   gtk_widget_show (combo);
 
+  options->behavior_combo = combo;
+
   scale = gimp_prop_spin_scale_new (config, "effect-size", NULL,
                                     0.01, 1.0, 2);
   gimp_spin_scale_set_scale_limits (GIMP_SPIN_SCALE (scale), 1.0, 1000.0);
diff --git a/app/tools/gimpwarpoptions.h b/app/tools/gimpwarpoptions.h
index c81894255e..d7e14fe714 100644
--- a/app/tools/gimpwarpoptions.h
+++ b/app/tools/gimpwarpoptions.h
@@ -55,6 +55,7 @@ struct _GimpWarpOptions
   gint                   n_animation_frames;
 
   /*  options gui  */
+  GtkWidget             *behavior_combo;
   GtkWidget             *stroke_frame;
   GtkWidget             *animate_button;
 };
diff --git a/app/tools/gimpwarptool.c b/app/tools/gimpwarptool.c
index c092f43297..0251b89979 100644
--- a/app/tools/gimpwarptool.c
+++ b/app/tools/gimpwarptool.c
@@ -662,6 +662,41 @@ gimp_warp_tool_can_stroke (GimpWarpTool *wt,
       return FALSE;
     }
 
+  if (! wt->filter || ! gimp_tool_can_undo (tool, display))
+    {
+      const gchar *message = NULL;
+
+      switch (options->behavior)
+        {
+        case GIMP_WARP_BEHAVIOR_MOVE:
+        case GIMP_WARP_BEHAVIOR_GROW:
+        case GIMP_WARP_BEHAVIOR_SHRINK:
+        case GIMP_WARP_BEHAVIOR_SWIRL_CW:
+        case GIMP_WARP_BEHAVIOR_SWIRL_CCW:
+          break;
+
+        case GIMP_WARP_BEHAVIOR_ERASE:
+          message = _("No warp to erase.");
+          break;
+
+        case GIMP_WARP_BEHAVIOR_SMOOTH:
+          message = _("No warp to smooth.");
+          break;
+        }
+
+      if (message)
+        {
+          if (show_message)
+            {
+              gimp_tool_message_literal (tool, display, message);
+
+              gimp_widget_blink (options->behavior_combo);
+            }
+
+          return FALSE;
+        }
+    }
+
   return TRUE;
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]