[gimp] app: in the transform tools, blink type box when there's no item to transform



commit 17412aa234f87b0236ae8692fa856deaf6e8a14f
Author: Ell <ell_se yahoo com>
Date:   Mon Dec 10 07:39:32 2018 -0500

    app: in the transform tools, blink type box when there's no item to transform
    
    In the transform tools, when there is no item of the selected type
    to transform, blink the move-type 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/gimptransformoptions.c | 17 ++++++++++-------
 app/tools/gimptransformoptions.h | 13 ++++++++-----
 app/tools/gimptransformtool.c    |  3 +++
 3 files changed, 21 insertions(+), 12 deletions(-)
---
diff --git a/app/tools/gimptransformoptions.c b/app/tools/gimptransformoptions.c
index 4342318707..a9311c98f7 100644
--- a/app/tools/gimptransformoptions.c
+++ b/app/tools/gimptransformoptions.c
@@ -214,18 +214,21 @@ gimp_transform_options_gui (GimpToolOptions *tool_options,
                             gboolean         interpolation,
                             gboolean         clipping)
 {
-  GObject         *config = G_OBJECT (tool_options);
-  GtkWidget       *vbox   = gimp_tool_options_gui (tool_options);
-  GtkWidget       *hbox;
-  GtkWidget       *box;
-  GtkWidget       *label;
-  GtkWidget       *frame;
-  GtkWidget       *combo;
+  GObject              *config  = G_OBJECT (tool_options);
+  GimpTransformOptions *options = GIMP_TRANSFORM_OPTIONS (tool_options);
+  GtkWidget            *vbox    = gimp_tool_options_gui (tool_options);
+  GtkWidget            *hbox;
+  GtkWidget            *box;
+  GtkWidget            *label;
+  GtkWidget            *frame;
+  GtkWidget            *combo;
 
   hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2);
   gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
   gtk_widget_show (hbox);
 
+  options->type_box = hbox;
+
   label = gtk_label_new (_("Transform:"));
   gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
   gtk_widget_show (label);
diff --git a/app/tools/gimptransformoptions.h b/app/tools/gimptransformoptions.h
index 621087ed1b..e5a42acd96 100644
--- a/app/tools/gimptransformoptions.h
+++ b/app/tools/gimptransformoptions.h
@@ -35,12 +35,15 @@ typedef struct _GimpTransformOptionsClass GimpTransformOptionsClass;
 
 struct _GimpTransformOptions
 {
-  GimpToolOptions        parent_instance;
+  GimpToolOptions         parent_instance;
 
-  GimpTransformType      type;
-  GimpTransformDirection direction;
-  GimpInterpolationType  interpolation;
-  GimpTransformResize    clip;
+  GimpTransformType       type;
+  GimpTransformDirection  direction;
+  GimpInterpolationType   interpolation;
+  GimpTransformResize     clip;
+
+  /*  options gui  */
+  GtkWidget              *type_box;
 };
 
 struct _GimpTransformOptionsClass
diff --git a/app/tools/gimptransformtool.c b/app/tools/gimptransformtool.c
index 5ce737e2ea..01237bad69 100644
--- a/app/tools/gimptransformtool.c
+++ b/app/tools/gimptransformtool.c
@@ -43,6 +43,7 @@
 
 #include "widgets/gimpmessagedialog.h"
 #include "widgets/gimpmessagebox.h"
+#include "widgets/gimpwidgets-utils.h"
 
 #include "gimptoolcontrol.h"
 #include "gimptransformoptions.h"
@@ -563,6 +564,8 @@ gimp_transform_tool_check_active_item (GimpTransformTool  *tr_tool,
   if (! item)
     {
       g_set_error_literal (error, GIMP_ERROR, GIMP_FAILED, null_message);
+      if (error)
+        gimp_widget_blink (options->type_box);
       return NULL;
     }
 


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