[gimp/wip/gradient-edit: 42/42] app: improve status messages of GimpToolLine



commit 4634beddf807b141d7166131c2d60ee9b02b69aa
Author: Ell <ell_se yahoo com>
Date:   Fri Oct 6 12:58:39 2017 -0400

    app: improve status messages of GimpToolLine
    
    ... to cover all the new stuff.

 app/display/gimptoolline.c |   95 ++++++++++++++++++++++++++++++++++++++------
 1 files changed, 83 insertions(+), 12 deletions(-)
---
diff --git a/app/display/gimptoolline.c b/app/display/gimptoolline.c
index 35b6ade..b85f371 100644
--- a/app/display/gimptoolline.c
+++ b/app/display/gimptoolline.c
@@ -1283,6 +1283,11 @@ gimp_tool_line_selection_motion (GimpToolLine *line,
 
             gimp_tool_line_update_handles (line);
             gimp_tool_line_update_circle (line);
+            gimp_tool_line_update_status (line,
+                                          constrain ?
+                                            gimp_get_constrain_behavior_mask () :
+                                            0,
+                                          TRUE);
           }
 
         return TRUE;
@@ -1449,23 +1454,89 @@ gimp_tool_line_update_status (GimpToolLine    *line,
 
   if (proximity)
     {
-      gchar *status_help =
-        gimp_suggest_modifiers ("",
-                                (gimp_get_constrain_behavior_mask () |
-                                 GDK_MOD1_MASK) &
+      gint             handle;
+      const gchar     *message                = NULL;
+      const gchar     *toggle_behavior_format = NULL;
+      gchar           *status;
+
+      if (private->grab == GRAB_SELECTION)
+        handle = private->selection;
+      else
+        handle = private->hover;
+
+      if (handle == GIMP_TOOL_LINE_HANDLE_START ||
+          handle == GIMP_TOOL_LINE_HANDLE_END)
+        {
+          message                = _("Click-Drag to move the endpoint");
+          toggle_behavior_format = _("%s for constrained angles");
+        }
+      else if (GIMP_TOOL_LINE_HANDLE_IS_SLIDER (handle) ||
+               handle == HOVER_NEW_SLIDER)
+        {
+          if (private->grab == GRAB_SELECTION && private->remove_slider)
+            {
+              message = _("Release to remove the slider");
+            }
+          else
+            {
+              if (GIMP_TOOL_LINE_HANDLE_IS_SLIDER (handle))
+                {
+                  if (gimp_tool_line_get_slider (line, handle)->removable)
+                    {
+                      if (private->grab == GRAB_SELECTION)
+                        {
+                          message = _("Click-Drag to move the slider; "
+                                      "drag away to remove the slider");
+                        }
+                      else
+                        {
+                          message = _("Click-Drag to move or remove the slider");
+                        }
+                    }
+                  else
+                    {
+                      message = _("Click-Drag to move the slider");
+                    }
+                }
+              else
+                {
+                  message = _("Click or Click-Drag to add a new slider");
+                }
+
+              toggle_behavior_format = _("%s for constrained values");
+            }
+        }
+      else if (state & GDK_MOD1_MASK)
+        {
+          message = _("Click-Drag to move the line");
+        }
+
+      status =
+        gimp_suggest_modifiers (message ? message : "",
+                                ((toggle_behavior_format ?
+                                   gimp_get_constrain_behavior_mask () : 0) |
+                                 (private->grab == GRAB_NONE ?
+                                   GDK_MOD1_MASK : 0)) &
                                 ~state,
                                 NULL,
-                                _("%s for constrained angles"),
+                                toggle_behavior_format,
                                 _("%s to move the whole line"));
 
-      gimp_tool_widget_set_status_coords (GIMP_TOOL_WIDGET (line),
-                                          private->status_title,
-                                          private->x2 - private->x1,
-                                          ", ",
-                                          private->y2 - private->y1,
-                                          status_help);
+      if (message)
+        {
+          gimp_tool_widget_set_status (GIMP_TOOL_WIDGET (line), status);
+        }
+      else
+        {
+          gimp_tool_widget_set_status_coords (GIMP_TOOL_WIDGET (line),
+                                              private->status_title,
+                                              private->x2 - private->x1,
+                                              ", ",
+                                              private->y2 - private->y1,
+                                              status);
+        }
 
-      g_free (status_help);
+      g_free (status);
     }
   else
     {


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