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



commit 43dfe0120b2f3b32f892d3c27d97b78b375a67ae
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 |   78 +++++++++++++++++++++++++++++++++++++-------
 1 files changed, 66 insertions(+), 12 deletions(-)
---
diff --git a/app/display/gimptoolline.c b/app/display/gimptoolline.c
index 7eb44ef..a2267ac 100644
--- a/app/display/gimptoolline.c
+++ b/app/display/gimptoolline.c
@@ -1266,6 +1266,12 @@ gimp_tool_line_selection_motion (GimpToolLine *line,
 
             g_signal_emit (line, line_signals[PREPARE_TO_REMOVE_SLIDER], 0,
                            private->selection, remove_slider);
+
+            gimp_tool_line_update_status (line,
+                                          constrain ?
+                                            gimp_get_constrain_behavior_mask () :
+                                            0,
+                                          TRUE);
           }
 
         /* eek! */
@@ -1450,23 +1456,71 @@ 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 (private->grab == GRAB_SELECTION ||
+                  GIMP_TOOL_LINE_HANDLE_IS_SLIDER (private->hover))
+                {
+                  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");
+            }
+        }
+
+      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]