[gimp] app: use gimp_prop_boolean_icon_box_new() instead of the "Linear" toggle



commit 28bb108e1b69131a14867f8d4a3e0db894fa7fb1
Author: Michael Natterer <mitch gimp org>
Date:   Sat Jan 6 03:12:23 2018 +0100

    app: use gimp_prop_boolean_icon_box_new() instead of the "Linear" toggle
    
    in the curves and levels tools and in the histogram dockable.

 app/tools/gimpcurvestool.c        |   16 +++++++++++-----
 app/tools/gimplevelstool.c        |   14 ++++++++++----
 app/widgets/gimphistogrameditor.c |   21 +++++++++------------
 3 files changed, 30 insertions(+), 21 deletions(-)
---
diff --git a/app/tools/gimpcurvestool.c b/app/tools/gimpcurvestool.c
index b71f266..d80177c 100644
--- a/app/tools/gimpcurvestool.c
+++ b/app/tools/gimpcurvestool.c
@@ -43,8 +43,9 @@
 #include "core/gimpimage.h"
 
 #include "widgets/gimpcolorbar.h"
-#include "widgets/gimphelp-ids.h"
 #include "widgets/gimpcurveview.h"
+#include "widgets/gimphelp-ids.h"
+#include "widgets/gimppropwidgets.h"
 #include "widgets/gimpwidgets-utils.h"
 
 #include "display/gimpdisplay.h"
@@ -443,10 +444,15 @@ gimp_curves_tool_dialog (GimpFilterTool *filter_tool)
   gtk_box_pack_end (GTK_BOX (hbox), hbox2, FALSE, FALSE, 0);
   gtk_widget_show (hbox2);
 
-  button = gimp_prop_check_button_new (G_OBJECT (config), "linear", NULL);
-  gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (button), FALSE);
-  gtk_box_pack_end (GTK_BOX (hbox), button, FALSE, FALSE, 0);
-  gtk_widget_show (button);
+  /*  The linear/perceptual radio buttons  */
+  hbox2 = gimp_prop_boolean_icon_box_new (G_OBJECT (config),
+                                          "linear",
+                                          GIMP_ICON_COLOR_SPACE_LINEAR,
+                                          GIMP_ICON_COLOR_SPACE_PERCEPTUAL,
+                                          _("Adjust curves in linear light"),
+                                          _("Adjust curves perceptually"));
+  gtk_box_pack_end (GTK_BOX (hbox), hbox2, FALSE, FALSE, 0);
+  gtk_widget_show (hbox2);
 
   frame_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 4);
   gtk_container_add (GTK_CONTAINER (main_frame), frame_vbox);
diff --git a/app/tools/gimplevelstool.c b/app/tools/gimplevelstool.c
index e93a25f..751ba2f 100644
--- a/app/tools/gimplevelstool.c
+++ b/app/tools/gimplevelstool.c
@@ -380,16 +380,22 @@ gimp_levels_tool_dialog (GimpFilterTool *filter_tool)
                     G_CALLBACK (levels_channel_reset_callback),
                     tool);
 
+  /*  The histogram scale radio buttons  */
   hbox2 = gimp_prop_enum_icon_box_new (G_OBJECT (tool_options),
                                        "histogram-scale", "gimp-histogram",
                                        0, 0);
   gtk_box_pack_end (GTK_BOX (hbox), hbox2, FALSE, FALSE, 0);
   gtk_widget_show (hbox2);
 
-  button = gimp_prop_check_button_new (G_OBJECT (config), "linear", NULL);
-  gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (button), FALSE);
-  gtk_box_pack_end (GTK_BOX (hbox), button, FALSE, FALSE, 0);
-  gtk_widget_show (button);
+  /*  The linear/perceptual radio buttons  */
+  hbox2 = gimp_prop_boolean_icon_box_new (G_OBJECT (config),
+                                          "linear",
+                                          GIMP_ICON_COLOR_SPACE_LINEAR,
+                                          GIMP_ICON_COLOR_SPACE_PERCEPTUAL,
+                                          _("Adjust levels in linear light"),
+                                          _("Adjust levels perceptually"));
+  gtk_box_pack_end (GTK_BOX (hbox), hbox2, FALSE, FALSE, 0);
+  gtk_widget_show (hbox2);
 
   frame_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 4);
   gtk_container_add (GTK_CONTAINER (main_frame), frame_vbox);
diff --git a/app/widgets/gimphistogrameditor.c b/app/widgets/gimphistogrameditor.c
index 99fb255..277c1bc 100644
--- a/app/widgets/gimphistogrameditor.c
+++ b/app/widgets/gimphistogrameditor.c
@@ -35,6 +35,7 @@
 #include "gimphistogrambox.h"
 #include "gimphistogrameditor.h"
 #include "gimphistogramview.h"
+#include "gimppropwidgets.h"
 #include "gimpsessioninfo-aux.h"
 #include "gimpwidgets-utils.h"
 
@@ -119,7 +120,6 @@ gimp_histogram_editor_init (GimpHistogramEditor *editor)
   GtkWidget         *hbox;
   GtkWidget         *label;
   GtkWidget         *menu;
-  GtkWidget         *button;
   GtkWidget         *table;
   gint               i;
 
@@ -139,7 +139,7 @@ gimp_histogram_editor_init (GimpHistogramEditor *editor)
 
   view = GIMP_HISTOGRAM_BOX (editor->box)->view;
 
-  hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
+  hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
   gtk_box_pack_start (GTK_BOX (editor), hbox, FALSE, FALSE, 0);
   gtk_widget_show (hbox);
 
@@ -165,16 +165,13 @@ gimp_histogram_editor_init (GimpHistogramEditor *editor)
   gtk_box_pack_end (GTK_BOX (hbox), menu, FALSE, FALSE, 0);
   gtk_widget_show (menu);
 
-  button = gimp_prop_check_button_new (G_OBJECT (editor), "linear", NULL);
-  gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (button), FALSE);
-  gtk_box_pack_end (GTK_BOX (hbox), button, FALSE, FALSE, 0);
-  gtk_widget_show (button);
-
-  gimp_help_set_help_data (button,
-                           "This button switches between a histogram in "
-                           "sRGB (gamma corrected) space and a histogram "
-                           "in linear space. Also, it's horrible UI and "
-                           "needs to be changed.", NULL);
+  menu = gimp_prop_boolean_icon_box_new (G_OBJECT (editor), "linear",
+                                         GIMP_ICON_COLOR_SPACE_LINEAR,
+                                         GIMP_ICON_COLOR_SPACE_PERCEPTUAL,
+                                         _("Show values in linear space"),
+                                         _("Show values in perceptual space"));
+  gtk_box_pack_end (GTK_BOX (hbox), menu, FALSE, FALSE, 0);
+  gtk_widget_show (menu);
 
   gtk_box_pack_start (GTK_BOX (editor), editor->box, TRUE, TRUE, 0);
   gtk_widget_show (GTK_WIDGET (editor->box));


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