[gimp] Bug 772541 - change Quick Mask Attributes mask opacity slider



commit 46b73bb1fadc470b066cc95ac0a8f4dfb17ec35f
Author: Michael Natterer <mitch gimp org>
Date:   Sat Oct 8 17:00:38 2016 +0200

    Bug 772541 - change Quick Mask Attributes mask opacity slider
    
    Use a GimpSpinScale in channel-options-dialog.c and clean up the
    dialog layout. Affects the "Quick Mask Attributes", "New Channel" and
    "Channel Attributes" dialogs.

 app/actions/channels-commands.c      |    4 +-
 app/actions/quick-mask-commands.c    |    2 +-
 app/dialogs/channel-options-dialog.c |   50 +++++++++++++++++++--------------
 3 files changed, 32 insertions(+), 24 deletions(-)
---
diff --git a/app/actions/channels-commands.c b/app/actions/channels-commands.c
index 3fe1551..c3cc0d8 100644
--- a/app/actions/channels-commands.c
+++ b/app/actions/channels-commands.c
@@ -103,7 +103,7 @@ channels_edit_attributes_cmd_callback (GtkAction *action,
                                            gimp_object_get_name (channel),
                                            &channel->color,
                                            _("Edit Channel Color"),
-                                           _("_Fill opacity:"),
+                                           _("_Fill opacity"),
                                            FALSE,
                                            channels_edit_attributes_callback,
                                            NULL);
@@ -143,7 +143,7 @@ channels_new_cmd_callback (GtkAction *action,
                                            config->channel_new_name,
                                            &config->channel_new_color,
                                            _("New Channel Color"),
-                                           _("_Fill opacity:"),
+                                           _("_Fill opacity"),
                                            TRUE,
                                            channels_new_callback,
                                            NULL);
diff --git a/app/actions/quick-mask-commands.c b/app/actions/quick-mask-commands.c
index 910372b..d2dab27 100644
--- a/app/actions/quick-mask-commands.c
+++ b/app/actions/quick-mask-commands.c
@@ -121,7 +121,7 @@ quick_mask_configure_cmd_callback (GtkAction *action,
                                            NULL,
                                            &color,
                                            _("Edit Quick Mask Color"),
-                                           _("_Mask opacity:"),
+                                           _("_Mask opacity"),
                                            FALSE,
                                            quick_mask_configure_callback,
                                            NULL);
diff --git a/app/dialogs/channel-options-dialog.c b/app/dialogs/channel-options-dialog.c
index 96c653a..b8474cc 100644
--- a/app/dialogs/channel-options-dialog.c
+++ b/app/dialogs/channel-options-dialog.c
@@ -30,6 +30,7 @@
 #include "core/gimpimage.h"
 
 #include "widgets/gimpcolorpanel.h"
+#include "widgets/gimpspinscale.h"
 #include "widgets/gimpviewabledialog.h"
 
 #include "channel-options-dialog.h"
@@ -90,8 +91,8 @@ channel_options_dialog_new (GimpImage                  *image,
   GimpViewable         *viewable;
   GtkWidget            *hbox;
   GtkWidget            *vbox;
-  GtkWidget            *table;
-  GtkObject            *opacity_adj;
+  GtkAdjustment        *opacity_adj;
+  GtkWidget            *scale;
 
   g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
   g_return_val_if_fail (channel == NULL || GIMP_IS_CHANNEL (channel), NULL);
@@ -152,35 +153,42 @@ channel_options_dialog_new (GimpImage                  *image,
   gtk_box_pack_start (GTK_BOX (hbox), vbox, TRUE, TRUE, 0);
   gtk_widget_show (vbox);
 
-  table = gtk_table_new (channel_name ? 2 : 1, 3, FALSE);
-  gtk_table_set_col_spacings (GTK_TABLE (table), 6);
-  gtk_table_set_row_spacings (GTK_TABLE (table), 6);
-  gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
-  gtk_widget_show (table);
-
   if (channel_name)
     {
+      GtkWidget *vbox2;
+      GtkWidget *label;
+
+      vbox2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2);
+      gtk_box_pack_start (GTK_BOX (vbox), vbox2, FALSE, FALSE, 0);
+      gtk_widget_show (vbox2);
+
+      label = gtk_label_new_with_mnemonic (_("Channel _name:"));
+      gtk_label_set_xalign (GTK_LABEL (label), 0.0);
+      gtk_box_pack_start (GTK_BOX (vbox2), label, FALSE, FALSE, 0);
+      gtk_widget_show (label);
+
       private->name_entry = gtk_entry_new ();
+      gtk_entry_set_text (GTK_ENTRY (private->name_entry), channel_name);
       gtk_entry_set_activates_default (GTK_ENTRY (private->name_entry), TRUE);
-      gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
-                                 _("Channel _name:"), 0.0, 0.5,
-                                 private->name_entry, 2, FALSE);
+      gtk_box_pack_start (GTK_BOX (vbox2), private->name_entry,
+                          FALSE, FALSE, 0);
+      gtk_widget_show (private->name_entry);
 
-      gtk_entry_set_text (GTK_ENTRY (private->name_entry), channel_name);
+      gtk_label_set_mnemonic_widget (GTK_LABEL (label), private->name_entry);
     }
 
-  opacity_adj = gimp_scale_entry_new (GTK_TABLE (table),
-                                      0, channel_name ? 1 : 0,
-                                      opacity_label, 100, -1,
-                                      channel_color->a * 100.0,
-                                      0.0, 100.0, 1.0, 10.0, 1,
-                                      TRUE, 0.0, 0.0,
-                                      NULL, NULL);
+  opacity_adj = (GtkAdjustment *)
+                gtk_adjustment_new (channel_color->a * 100.0,
+                                    0.0, 100.0, 1.0, 10.0, 0);
+  scale = gimp_spin_scale_new (opacity_adj, opacity_label, 1);
+  gtk_widget_set_size_request (scale, 200, -1);
+  gtk_box_pack_start (GTK_BOX (vbox), scale, FALSE, FALSE, 0);
+  gtk_widget_show (scale);
 
   private->color_panel = gimp_color_panel_new (color_label,
                                                channel_color,
                                                GIMP_COLOR_AREA_LARGE_CHECKS,
-                                               48, 64);
+                                               48, 48);
   gimp_color_panel_set_context (GIMP_COLOR_PANEL (private->color_panel),
                                 context);
 
@@ -189,7 +197,7 @@ channel_options_dialog_new (GimpImage                  *image,
                     private->color_panel);
 
   gtk_box_pack_start (GTK_BOX (hbox), private->color_panel,
-                      TRUE, TRUE, 0);
+                      FALSE, FALSE, 0);
   gtk_widget_show (private->color_panel);
 
   g_signal_connect (private->color_panel, "color-changed",


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