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

in the curves and levels tools and in the histogram dockable.
This commit is contained in:
Michael Natterer 2018-01-06 03:12:23 +01:00
parent 6374218408
commit 28bb108e1b
3 changed files with 30 additions and 21 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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));