[gimp] app: in the selection tools, blink mode box when the current operation is invalid



commit f990e416097becee782e711e0933f1d3ee40e2fe
Author: Ell <ell_se yahoo com>
Date:   Mon Dec 10 07:42:52 2018 -0500

    app: in the selection tools, blink mode box when the current operation is invalid
    
    In the selection tools, when the selected operation is invalid,
    i.e., when trying to subtract-from or intersect-with an empty
    selection, blink the selection-mode box widget in the tool options,
    in addition to showing an error message in the status bar, to hint
    at the source of the error.

 app/tools/gimpselectionoptions.c |  2 ++
 app/tools/gimpselectionoptions.h |  1 +
 app/tools/gimpselectiontool.c    | 10 +++++++---
 3 files changed, 10 insertions(+), 3 deletions(-)
---
diff --git a/app/tools/gimpselectionoptions.c b/app/tools/gimpselectionoptions.c
index 1fb932e9a5..45993864a5 100644
--- a/app/tools/gimpselectionoptions.c
+++ b/app/tools/gimpselectionoptions.c
@@ -219,6 +219,8 @@ gimp_selection_options_gui (GimpToolOptions *tool_options)
     gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
     gtk_widget_show (hbox);
 
+    options->mode_box = hbox;
+
     label = gtk_label_new (_("Mode:"));
     gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
     gtk_widget_show (label);
diff --git a/app/tools/gimpselectionoptions.h b/app/tools/gimpselectionoptions.h
index db3958fd33..9a2107dd7d 100644
--- a/app/tools/gimpselectionoptions.h
+++ b/app/tools/gimpselectionoptions.h
@@ -43,6 +43,7 @@ struct _GimpSelectionOptions
   gdouble          feather_radius;
 
   /*  options gui  */
+  GtkWidget       *mode_box;
   GtkWidget       *antialias_toggle;
 };
 
diff --git a/app/tools/gimpselectiontool.c b/app/tools/gimpselectiontool.c
index 968df6d6f9..bf75d9769f 100644
--- a/app/tools/gimpselectiontool.c
+++ b/app/tools/gimpselectiontool.c
@@ -470,14 +470,16 @@ gimp_selection_tool_start_edit (GimpSelectionTool *sel_tool,
                                 GimpDisplay       *display,
                                 const GimpCoords  *coords)
 {
-  GimpTool *tool;
-  GError   *error = NULL;
+  GimpTool             *tool;
+  GimpSelectionOptions *options;
+  GError               *error = NULL;
 
   g_return_val_if_fail (GIMP_IS_SELECTION_TOOL (sel_tool), FALSE);
   g_return_val_if_fail (GIMP_IS_DISPLAY (display), FALSE);
   g_return_val_if_fail (coords != NULL, FALSE);
 
-  tool = GIMP_TOOL (sel_tool);
+  tool    = GIMP_TOOL (sel_tool);
+  options = GIMP_SELECTION_TOOL_GET_OPTIONS (sel_tool);
 
   g_return_val_if_fail (gimp_tool_control_is_active (tool->control) == FALSE,
                         FALSE);
@@ -486,6 +488,8 @@ gimp_selection_tool_start_edit (GimpSelectionTool *sel_tool,
     {
       gimp_tool_message_literal (tool, display, error->message);
 
+      gimp_widget_blink (options->mode_box);
+
       g_clear_error (&error);
 
       return TRUE;


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