[gimp/gimp-2-10] Issue #1740: Move tool has two identical options for selection mode.



commit de5b6b2a81a916a2c6329fbc1b549b4542537fdf
Author: Jehan <jehan girinstud io>
Date:   Thu Jun 28 18:42:05 2018 +0200

    Issue #1740: Move tool has two identical options for selection mode.
    
    The "move-current" flag does not apply to selection mode and our current
    code was simply setting the radio buttons insensitive while showing the
    same labels on both buttons. This was not wrong per-se, yet very
    confusing.
    
    Instead let's just hide the radio buttons in selection mode, and update
    the option title to "Move selection" (old label of both buttons) to keep
    this mode as understandable as possible.
    
    (cherry picked from commit 7cbbb8cba8f1739a1366e656259e39b75180b0f0)

 app/tools/gimpmoveoptions.c | 72 ++++++++++++++++++++++++++-------------------
 1 file changed, 42 insertions(+), 30 deletions(-)
---
diff --git a/app/tools/gimpmoveoptions.c b/app/tools/gimpmoveoptions.c
index b225e395cc..430b8678a9 100644
--- a/app/tools/gimpmoveoptions.c
+++ b/app/tools/gimpmoveoptions.c
@@ -130,38 +130,50 @@ gimp_move_options_notify_type (GimpMoveOptions *move_options,
                                GParamSpec      *pspec,
                                GtkWidget       *frame)
 {
-  const gchar *false_label = NULL;
-  const gchar *true_label  = NULL;
-  GtkWidget   *button;
-  GSList      *group;
-
-  button = g_object_get_data (G_OBJECT (frame), "radio-button");
-
-  switch (move_options->move_type)
+  if (move_options->move_type == GIMP_TRANSFORM_TYPE_SELECTION)
     {
-    case GIMP_TRANSFORM_TYPE_LAYER:
-      false_label = _("Pick a layer or guide");
-      true_label  = _("Move the active layer");
-      break;
-
-    case GIMP_TRANSFORM_TYPE_SELECTION:
-      false_label = true_label = _("Move selection");
-      break;
-
-    case GIMP_TRANSFORM_TYPE_PATH:
-      false_label = _("Pick a path");
-      true_label  = _("Move the active path");
-     break;
+      gtk_widget_hide (gtk_bin_get_child (GTK_BIN (frame)));
+      gtk_frame_set_label (GTK_FRAME (frame), _("Move selection"));
+    }
+  else
+    {
+      const gchar *false_label = NULL;
+      const gchar *true_label  = NULL;
+      GtkWidget   *button;
+      GSList      *group;
+      gchar       *title;
+
+      title = g_strdup_printf (_("Tool Toggle  (%s)"),
+                               gimp_get_mod_string (gimp_get_extend_selection_mask ()));
+      gtk_frame_set_label (GTK_FRAME (frame), title);
+      g_free (title);
+
+      switch (move_options->move_type)
+        {
+        case GIMP_TRANSFORM_TYPE_LAYER:
+          false_label = _("Pick a layer or guide");
+          true_label  = _("Move the active layer");
+          break;
+
+        case GIMP_TRANSFORM_TYPE_PATH:
+          false_label = _("Pick a path");
+          true_label  = _("Move the active path");
+          break;
+
+        default: /* GIMP_TRANSFORM_TYPE_SELECTION */
+          g_return_if_reached ();
+        }
+
+      button = g_object_get_data (G_OBJECT (frame), "radio-button");
+
+      group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (button));
+      gtk_button_set_label (GTK_BUTTON (group->data), true_label);
+
+      group = g_slist_next (group);
+      gtk_button_set_label (GTK_BUTTON (group->data), false_label);
+
+      gtk_widget_show (gtk_bin_get_child (GTK_BIN (frame)));
     }
-
-  group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (button));
-  gtk_button_set_label (GTK_BUTTON (group->data), true_label);
-
-  group = g_slist_next (group);
-  gtk_button_set_label (GTK_BUTTON (group->data), false_label);
-
-  gtk_widget_set_sensitive (frame,
-                            move_options->move_type != GIMP_TRANSFORM_TYPE_SELECTION);
 }
 
 GtkWidget *


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