[gimp] Bug 783680 - Allow to hide color models in GimpColorScales
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] Bug 783680 - Allow to hide color models in GimpColorScales
- Date: Mon, 19 Mar 2018 22:12:25 +0000 (UTC)
commit 8447e775ab5165e1bce87addbb48f332bde349f7
Author: Michael Natterer <mitch gimp org>
Date: Mon Mar 19 22:58:03 2018 +0100
Bug 783680 - Allow to hide color models in GimpColorScales
Redo the entire thing again:
- Rename the values of enum GimpColorSelectorModel to include "MODEL"
- Change GimpColorSelector API from set_model() to set_model_visible()
so visibility of each model can be toggled individually and is not
exclusive any longer
- The GUI is back to what it was before, except that the "GIMP" page
now honors the model visibility and has a resonable minimum height
libgimpwidgets/gimpcolornotebook.c | 64 ++++++++++-
libgimpwidgets/gimpcolorscales.c | 209 +++++++++++++++++---------------
libgimpwidgets/gimpcolorselect.c | 190 ++++++++++++-----------------
libgimpwidgets/gimpcolorselection.c | 2 +-
libgimpwidgets/gimpcolorselector.c | 190 ++++++++++++++++++-----------
libgimpwidgets/gimpcolorselector.h | 23 ++--
libgimpwidgets/gimpwidgets.def | 5 +-
libgimpwidgets/gimpwidgetsenums.c | 12 +-
libgimpwidgets/gimpwidgetsenums.h | 8 +-
libgimpwidgets/gimpwidgetsmarshal.list | 3 +-
10 files changed, 403 insertions(+), 303 deletions(-)
---
diff --git a/libgimpwidgets/gimpcolornotebook.c b/libgimpwidgets/gimpcolornotebook.c
index 74823b1..e7bee86 100644
--- a/libgimpwidgets/gimpcolornotebook.c
+++ b/libgimpwidgets/gimpcolornotebook.c
@@ -68,6 +68,10 @@ static void gimp_color_notebook_set_color (GimpColorSelector *selector,
const GimpHSV *hsv);
static void gimp_color_notebook_set_channel (GimpColorSelector *selector,
GimpColorSelectorChannel channel);
+static void gimp_color_notebook_set_model_visible
+ (GimpColorSelector *selector,
+ GimpColorSelectorModel model,
+ gboolean gboolean);
static void gimp_color_notebook_set_config (GimpColorSelector *selector,
GimpColorConfig *config);
@@ -84,6 +88,11 @@ static void gimp_color_notebook_color_changed (GimpColorSelector *page,
static void gimp_color_notebook_channel_changed (GimpColorSelector *page,
GimpColorSelectorChannel channel,
GimpColorNotebook *notebook);
+static void gimp_color_notebook_model_visible_changed
+ (GimpColorSelector *page,
+ GimpColorSelectorModel model,
+ gboolean visible,
+ GimpColorNotebook *notebook);
static GtkWidget * gimp_color_notebook_add_page (GimpColorNotebook *notebook,
GType page_type);
@@ -113,6 +122,7 @@ gimp_color_notebook_class_init (GimpColorNotebookClass *klass)
selector_class->set_show_alpha = gimp_color_notebook_set_show_alpha;
selector_class->set_color = gimp_color_notebook_set_color;
selector_class->set_channel = gimp_color_notebook_set_channel;
+ selector_class->set_model_visible = gimp_color_notebook_set_model_visible;
selector_class->set_config = gimp_color_notebook_set_config;
gtk_widget_class_install_style_property (widget_class,
@@ -122,6 +132,7 @@ gimp_color_notebook_class_init (GimpColorNotebookClass *klass)
0, G_MAXINT,
DEFAULT_TAB_BORDER,
G_PARAM_READABLE));
+
gtk_widget_class_install_style_property (widget_class,
g_param_spec_enum ("tab-icon-size",
NULL,
@@ -293,6 +304,24 @@ gimp_color_notebook_set_channel (GimpColorSelector *selector,
}
static void
+gimp_color_notebook_set_model_visible (GimpColorSelector *selector,
+ GimpColorSelectorModel model,
+ gboolean visible)
+{
+ GimpColorNotebook *notebook = GIMP_COLOR_NOTEBOOK (selector);
+
+ g_signal_handlers_block_by_func (notebook->cur_page,
+ gimp_color_notebook_model_visible_changed,
+ notebook);
+
+ gimp_color_selector_set_model_visible (notebook->cur_page, model, visible);
+
+ g_signal_handlers_unblock_by_func (notebook->cur_page,
+ gimp_color_notebook_model_visible_changed,
+ notebook);
+}
+
+static void
gimp_color_notebook_set_config (GimpColorSelector *selector,
GimpColorConfig *config)
{
@@ -313,8 +342,9 @@ gimp_color_notebook_switch_page (GtkNotebook *gtk_notebook,
guint page_num,
GimpColorNotebook *notebook)
{
- GimpColorSelector *selector = GIMP_COLOR_SELECTOR (notebook);
- GtkWidget *page_widget;
+ GimpColorSelector *selector = GIMP_COLOR_SELECTOR (notebook);
+ GtkWidget *page_widget;
+ GimpColorSelectorModel model;
page_widget = gtk_notebook_get_nth_page (gtk_notebook, page_num);
@@ -326,6 +356,9 @@ gimp_color_notebook_switch_page (GtkNotebook *gtk_notebook,
g_signal_handlers_block_by_func (notebook->cur_page,
gimp_color_notebook_channel_changed,
notebook);
+ g_signal_handlers_block_by_func (notebook->cur_page,
+ gimp_color_notebook_model_visible_changed,
+ notebook);
gimp_color_selector_set_color (notebook->cur_page,
&selector->rgb,
@@ -333,12 +366,25 @@ gimp_color_notebook_switch_page (GtkNotebook *gtk_notebook,
gimp_color_selector_set_channel (notebook->cur_page,
gimp_color_selector_get_channel (selector));
+ for (model = GIMP_COLOR_SELECTOR_MODEL_RGB;
+ model <= GIMP_COLOR_SELECTOR_MODEL_HSV;
+ model++)
+ {
+ gboolean visible = gimp_color_selector_get_model_visible (selector, model);
+
+ gimp_color_selector_set_model_visible (notebook->cur_page, model,
+ visible);
+ }
+
g_signal_handlers_unblock_by_func (notebook->cur_page,
gimp_color_notebook_color_changed,
notebook);
g_signal_handlers_unblock_by_func (notebook->cur_page,
gimp_color_notebook_channel_changed,
notebook);
+ g_signal_handlers_unblock_by_func (notebook->cur_page,
+ gimp_color_notebook_model_visible_changed,
+ notebook);
}
static void
@@ -365,6 +411,17 @@ gimp_color_notebook_channel_changed (GimpColorSelector *page,
gimp_color_selector_set_channel (selector, channel);
}
+static void
+gimp_color_notebook_model_visible_changed (GimpColorSelector *page,
+ GimpColorSelectorModel model,
+ gboolean visible,
+ GimpColorNotebook *notebook)
+{
+ GimpColorSelector *selector = GIMP_COLOR_SELECTOR (notebook);
+
+ gimp_color_selector_set_model_visible (selector, model, visible);
+}
+
static GtkWidget *
gimp_color_notebook_add_page (GimpColorNotebook *notebook,
GType page_type)
@@ -420,6 +477,9 @@ gimp_color_notebook_add_page (GimpColorNotebook *notebook,
g_signal_connect (page, "channel-changed",
G_CALLBACK (gimp_color_notebook_channel_changed),
notebook);
+ g_signal_connect (page, "model-visible-changed",
+ G_CALLBACK (gimp_color_notebook_model_visible_changed),
+ notebook);
return page;
}
diff --git a/libgimpwidgets/gimpcolorscales.c b/libgimpwidgets/gimpcolorscales.c
index 2c94f14..0d08792 100644
--- a/libgimpwidgets/gimpcolorscales.c
+++ b/libgimpwidgets/gimpcolorscales.c
@@ -104,6 +104,8 @@ struct _GimpColorScales
gboolean show_rgb_u8;
+ GtkWidget *lch_group;
+ GtkWidget *hsv_group;
GtkWidget *rgb_percent_group;
GtkWidget *rgb_u8_group;
GtkWidget *alpha_percent_group;
@@ -143,6 +145,10 @@ static void gimp_color_scales_set_color (GimpColorSelector *selector,
const GimpHSV *hsv);
static void gimp_color_scales_set_channel (GimpColorSelector *selector,
GimpColorSelectorChannel channel);
+static void gimp_color_scales_set_model_visible
+ (GimpColorSelector *selector,
+ GimpColorSelectorModel model,
+ gboolean visible);
static void gimp_color_scales_set_config (GimpColorSelector *selector,
GimpColorConfig *config);
@@ -153,13 +159,8 @@ static void gimp_color_scales_toggle_changed (GtkWidget *widget,
GimpColorScales *scales);
static void gimp_color_scales_scale_changed (GtkAdjustment *adjustment,
GimpColorScales *scales);
-static void gimp_color_scales_switch_page (GtkNotebook *notebook,
- GtkWidget *page,
- gint num,
+static void gimp_color_scales_toggle_lch_hsv (GtkToggleButton *toggle,
GimpColorScales *scales);
-static void gimp_color_scales_model_changed (GimpColorSelector *selector,
- GimpColorSelectorModel model,
- GtkNotebook *notebook);
G_DEFINE_TYPE (GimpColorScales, gimp_color_scales, GIMP_TYPE_COLOR_SELECTOR)
@@ -209,6 +210,7 @@ gimp_color_scales_class_init (GimpColorScalesClass *klass)
selector_class->set_show_alpha = gimp_color_scales_set_show_alpha;
selector_class->set_color = gimp_color_scales_set_color;
selector_class->set_channel = gimp_color_scales_set_channel;
+ selector_class->set_model_visible = gimp_color_scales_set_model_visible;
selector_class->set_config = gimp_color_scales_set_config;
g_object_class_install_property (object_class, PROP_SHOW_RGB_U8,
@@ -220,9 +222,9 @@ gimp_color_scales_class_init (GimpColorScalesClass *klass)
G_PARAM_CONSTRUCT));
fish_rgb_to_lch = babl_fish (babl_format ("R'G'B'A double"),
- babl_format ("CIE LCH(ab) double"));
- fish_lch_to_rgb = babl_fish (babl_format ("CIE LCH(ab) double"),
- babl_format ("R'G'B' double"));
+ babl_format ("CIE LCH(ab) alpha double"));
+ fish_lch_to_rgb = babl_fish (babl_format ("CIE LCH(ab) alpha double"),
+ babl_format ("R'G'B'A double"));
}
static GtkWidget *
@@ -354,9 +356,7 @@ gimp_color_scales_init (GimpColorScales *scales)
GtkSizeGroup *size_group0;
GtkSizeGroup *size_group1;
GtkSizeGroup *size_group2;
- GtkWidget *notebook;
GtkWidget *hbox;
- GtkWidget *vbox;
GtkWidget *radio1;
GtkWidget *radio2;
GtkWidget *table;
@@ -366,22 +366,16 @@ gimp_color_scales_init (GimpColorScales *scales)
gtk_box_set_spacing (GTK_BOX (scales), 5);
- /* don't needs the toggles for our own operation */
+ /* don't need the toggles for our own operation */
selector->toggles_visible = FALSE;
- notebook = gtk_notebook_new ();
- gtk_widget_show (notebook);
- gtk_box_pack_start (GTK_BOX (scales), notebook, 0, 0, FALSE);
+ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
+ gtk_box_pack_start (GTK_BOX (scales), hbox, 0, 0, FALSE);
+ gtk_widget_show (hbox);
main_group = NULL;
u8_group = NULL;
- /* RGB page. */
- vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
- gtk_widget_show (vbox);
- gtk_notebook_append_page (GTK_NOTEBOOK (notebook), vbox, NULL);
- gtk_notebook_set_tab_label_text (GTK_NOTEBOOK (notebook), vbox, _("RGB"));
-
scales->dummy_u8_toggle = gtk_radio_button_new (NULL);
g_object_ref_sink (scales->dummy_u8_toggle);
u8_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (scales->dummy_u8_toggle));
@@ -395,21 +389,48 @@ gimp_color_scales_init (GimpColorScales *scales)
size_group0, size_group1, size_group2,
GIMP_COLOR_SELECTOR_RED,
GIMP_COLOR_SELECTOR_BLUE);
- gtk_widget_show (table);
- gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (scales), table, FALSE, FALSE, 0);
scales->rgb_u8_group =
table = create_group (scales, &u8_group,
size_group0, size_group1, size_group2,
GIMP_COLOR_SELECTOR_RED_U8,
GIMP_COLOR_SELECTOR_BLUE_U8);
- gtk_widget_show (table);
- gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (scales), table, FALSE, FALSE, 0);
- /* U8/percent buttons. */
- hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
- gtk_box_pack_start (GTK_BOX (vbox), hbox, 0, 0, FALSE);
- gtk_widget_show (hbox);
+ scales->lch_group =
+ table = create_group (scales, &main_group,
+ size_group0, size_group1, size_group2,
+ GIMP_COLOR_SELECTOR_LCH_LIGHTNESS,
+ GIMP_COLOR_SELECTOR_LCH_HUE);
+ gtk_box_pack_start (GTK_BOX (scales), table, FALSE, FALSE, 0);
+
+ scales->hsv_group =
+ table = create_group (scales, &main_group,
+ size_group0, size_group1, size_group2,
+ GIMP_COLOR_SELECTOR_HUE,
+ GIMP_COLOR_SELECTOR_VALUE);
+ gtk_box_pack_start (GTK_BOX (scales), table, FALSE, FALSE, 0);
+
+ scales->alpha_percent_group =
+ table = create_group (scales, &main_group,
+ size_group0, size_group1, size_group2,
+ GIMP_COLOR_SELECTOR_ALPHA,
+ GIMP_COLOR_SELECTOR_ALPHA);
+ gtk_box_pack_start (GTK_BOX (scales), table, FALSE, FALSE, 0);
+
+ scales->alpha_u8_group =
+ table = create_group (scales, &u8_group,
+ size_group0, size_group1, size_group2,
+ GIMP_COLOR_SELECTOR_ALPHA_U8,
+ GIMP_COLOR_SELECTOR_ALPHA_U8);
+ gtk_box_pack_start (GTK_BOX (scales), table, FALSE, FALSE, 0);
+
+ g_object_unref (size_group0);
+ g_object_unref (size_group1);
+ g_object_unref (size_group2);
+
+ gimp_color_scales_update_visible (scales);
radio_group = NULL;
@@ -434,55 +455,28 @@ gimp_color_scales_init (GimpColorScales *scales)
G_BINDING_SYNC_CREATE |
G_BINDING_BIDIRECTIONAL);
- /* LCH page. */
- table = create_group (scales, &main_group,
- size_group0, size_group1, size_group2,
- GIMP_COLOR_SELECTOR_LCH_LIGHTNESS,
- GIMP_COLOR_SELECTOR_LCH_HUE);
- gtk_widget_show (table);
- gtk_notebook_append_page (GTK_NOTEBOOK (notebook), table, NULL);
- gtk_notebook_set_tab_label_text (GTK_NOTEBOOK (notebook), table, _("LCH"));
-
- /* HSV page. */
- table = create_group (scales, &main_group,
- size_group0, size_group1, size_group2,
- GIMP_COLOR_SELECTOR_HUE,
- GIMP_COLOR_SELECTOR_VALUE);
- gtk_widget_show (table);
- gtk_notebook_append_page (GTK_NOTEBOOK (notebook), table, NULL);
- gtk_notebook_set_tab_label_text (GTK_NOTEBOOK (notebook), table, _("HSV"));
+ radio_group = NULL;
- scales->alpha_percent_group =
- table = create_group (scales, &main_group,
- size_group0, size_group1, size_group2,
- GIMP_COLOR_SELECTOR_ALPHA,
- GIMP_COLOR_SELECTOR_ALPHA);
- gtk_box_pack_start (GTK_BOX (scales), table, FALSE, FALSE, 0);
+ radio1 = gtk_radio_button_new_with_label (NULL, _("LCH"));
+ radio_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio1));
+ radio2 = gtk_radio_button_new_with_label (radio_group, _("HSV"));
- scales->alpha_u8_group =
- table = create_group (scales, &u8_group,
- size_group0, size_group1, size_group2,
- GIMP_COLOR_SELECTOR_ALPHA_U8,
- GIMP_COLOR_SELECTOR_ALPHA_U8);
- gtk_box_pack_start (GTK_BOX (scales), table, FALSE, FALSE, 0);
+ gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (radio1), FALSE);
+ gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (radio2), FALSE);
- g_object_unref (size_group0);
- g_object_unref (size_group1);
- g_object_unref (size_group2);
+ gtk_box_pack_end (GTK_BOX (hbox), radio2, FALSE, FALSE, 0);
+ gtk_box_pack_end (GTK_BOX (hbox), radio1, FALSE, FALSE, 0);
- /* This works because we ordered the notebook tabs in the same order
- * as the GimpColorSelectorModel enum.
- */
- gtk_notebook_set_current_page (GTK_NOTEBOOK (notebook),
- (gint) gimp_color_selector_get_model (selector));
- g_signal_connect (notebook, "switch-page",
- G_CALLBACK (gimp_color_scales_switch_page),
- scales);
- g_signal_connect (scales, "model-changed",
- G_CALLBACK (gimp_color_scales_model_changed),
- notebook);
+ gtk_widget_show (radio1);
+ gtk_widget_show (radio2);
- gimp_color_scales_update_visible (scales);
+ if (gimp_color_selector_get_model_visible (selector,
+ GIMP_COLOR_SELECTOR_MODEL_HSV))
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio2), TRUE);
+
+ g_signal_connect (radio1, "toggled",
+ G_CALLBACK (gimp_color_scales_toggle_lch_hsv),
+ scales);
}
static void
@@ -598,6 +592,14 @@ gimp_color_scales_set_channel (GimpColorSelector *selector,
}
static void
+gimp_color_scales_set_model_visible (GimpColorSelector *selector,
+ GimpColorSelectorModel model,
+ gboolean visible)
+{
+ gimp_color_scales_update_visible (GIMP_COLOR_SCALES (selector));
+}
+
+static void
gimp_color_scales_set_config (GimpColorSelector *selector,
GimpColorConfig *config)
{
@@ -615,7 +617,6 @@ gimp_color_scales_set_config (GimpColorSelector *selector,
/* public functions */
-
void
gimp_color_scales_set_show_rgb_u8 (GimpColorScales *scales,
gboolean show_rgb_u8)
@@ -650,11 +651,25 @@ gimp_color_scales_update_visible (GimpColorScales *scales)
{
GimpColorSelector *selector = GIMP_COLOR_SELECTOR (scales);
gboolean show_alpha;
-
- show_alpha = gimp_color_selector_get_show_alpha (selector);
-
- gtk_widget_set_visible (scales->rgb_percent_group, ! scales->show_rgb_u8);
- gtk_widget_set_visible (scales->rgb_u8_group, scales->show_rgb_u8);
+ gboolean rgb_visible;
+ gboolean lch_visible;
+ gboolean hsv_visible;
+
+ show_alpha = gimp_color_selector_get_show_alpha (selector);
+ rgb_visible = gimp_color_selector_get_model_visible (selector,
+ GIMP_COLOR_SELECTOR_MODEL_RGB);
+ lch_visible = gimp_color_selector_get_model_visible (selector,
+ GIMP_COLOR_SELECTOR_MODEL_LCH);
+ hsv_visible = gimp_color_selector_get_model_visible (selector,
+ GIMP_COLOR_SELECTOR_MODEL_HSV);
+
+ gtk_widget_set_visible (scales->rgb_percent_group,
+ rgb_visible && ! scales->show_rgb_u8);
+ gtk_widget_set_visible (scales->rgb_u8_group,
+ rgb_visible && scales->show_rgb_u8);
+
+ gtk_widget_set_visible (scales->lch_group, lch_visible);
+ gtk_widget_set_visible (scales->hsv_group, hsv_visible);
gtk_widget_set_visible (scales->alpha_percent_group,
show_alpha && ! scales->show_rgb_u8);
@@ -843,25 +858,27 @@ gimp_color_scales_scale_changed (GtkAdjustment *adjustment,
}
static void
-gimp_color_scales_switch_page (GtkNotebook *notebook,
- GtkWidget *page,
- gint num,
- GimpColorScales *scales)
+gimp_color_scales_toggle_lch_hsv (GtkToggleButton *toggle,
+ GimpColorScales *scales)
{
- /* This works because we ordered the notebook tabs in the same order
- * as the GimpColorSelectorModel enum.
- */
- gimp_color_selector_set_model (GIMP_COLOR_SELECTOR (scales),
- (GimpColorSelectorModel) num);
-}
+ GimpColorSelector *selector = GIMP_COLOR_SELECTOR (scales);
-static void
-gimp_color_scales_model_changed (GimpColorSelector *selector,
- GimpColorSelectorModel model,
- GtkNotebook *notebook)
-{
- if (gtk_notebook_get_current_page (notebook) != (gint) model)
+ if (gtk_toggle_button_get_active (toggle))
+ {
+ gimp_color_selector_set_model_visible (selector,
+ GIMP_COLOR_SELECTOR_MODEL_LCH,
+ TRUE);
+ gimp_color_selector_set_model_visible (selector,
+ GIMP_COLOR_SELECTOR_MODEL_HSV,
+ FALSE);
+ }
+ else
{
- gtk_notebook_set_current_page (notebook, (gint) model);
+ gimp_color_selector_set_model_visible (selector,
+ GIMP_COLOR_SELECTOR_MODEL_LCH,
+ FALSE);
+ gimp_color_selector_set_model_visible (selector,
+ GIMP_COLOR_SELECTOR_MODEL_HSV,
+ TRUE);
}
}
diff --git a/libgimpwidgets/gimpcolorselect.c b/libgimpwidgets/gimpcolorselect.c
index be76efe..e45b76c 100644
--- a/libgimpwidgets/gimpcolorselect.c
+++ b/libgimpwidgets/gimpcolorselect.c
@@ -192,6 +192,10 @@ static void gimp_color_select_set_color (GimpColorSelector *selector,
const GimpHSV *hsv);
static void gimp_color_select_set_channel (GimpColorSelector *selector,
GimpColorSelectorChannel channel);
+static void gimp_color_select_set_model_visible
+ (GimpColorSelector *selector,
+ GimpColorSelectorModel model,
+ gboolean visible);
static void gimp_color_select_set_config (GimpColorSelector *selector,
GimpColorConfig *config);
@@ -270,13 +274,6 @@ static void gimp_color_select_notify_config (GimpColorConfig *config,
const GParamSpec *pspec,
GimpColorSelect *select);
-static void gimp_color_select_switch_page (GtkNotebook *notebook,
- GtkWidget *page,
- gint num,
- GimpColorSelect *select);
-static void gimp_color_select_model_changed (GimpColorSelector *selector,
- GimpColorSelectorModel model,
- GtkNotebook *color_model_notebook);
G_DEFINE_TYPE (GimpColorSelect, gimp_color_select, GIMP_TYPE_COLOR_SELECTOR)
@@ -330,6 +327,7 @@ gimp_color_select_class_init (GimpColorSelectClass *klass)
selector_class->set_toggles_sensitive = gimp_color_select_togg_sensitive;
selector_class->set_color = gimp_color_select_set_color;
selector_class->set_channel = gimp_color_select_set_channel;
+ selector_class->set_model_visible = gimp_color_select_set_model_visible;
selector_class->set_config = gimp_color_select_set_config;
fish_rgb_to_lch = babl_fish (babl_format ("R'G'B'A double"),
@@ -346,11 +344,12 @@ gimp_color_select_init (GimpColorSelect *select)
GimpColorSelector *selector = GIMP_COLOR_SELECTOR (select);
GtkWidget *hbox;
GtkWidget *frame;
- GtkWidget *notebook;
+ GtkWidget *vbox;
GEnumClass *model_class;
GEnumClass *channel_class;
GimpEnumDesc *enum_desc;
GimpColorSelectorModel model;
+ GSList *group = NULL;
/* Default values. */
select->z_color_fill = COLOR_SELECT_HUE;
@@ -419,99 +418,82 @@ gimp_color_select_init (GimpColorSelect *select)
G_CALLBACK (gimp_color_select_z_events),
select);
- notebook = gtk_notebook_new ();
- gtk_notebook_set_tab_pos (GTK_NOTEBOOK (notebook), GTK_POS_RIGHT);
- gtk_widget_show (notebook);
- gtk_box_pack_start (GTK_BOX (hbox), notebook, FALSE, FALSE, 0);
+ vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
+ gtk_box_pack_start (GTK_BOX (hbox), vbox, FALSE, FALSE, 0);
+ gtk_widget_show (vbox);
model_class = g_type_class_ref (GIMP_TYPE_COLOR_SELECTOR_MODEL);
channel_class = g_type_class_ref (GIMP_TYPE_COLOR_SELECTOR_CHANNEL);
- for (model = GIMP_COLOR_SELECTOR_RGB;
- model <= GIMP_COLOR_SELECTOR_HSV;
+ for (model = GIMP_COLOR_SELECTOR_MODEL_RGB;
+ model <= GIMP_COLOR_SELECTOR_MODEL_HSV;
model++)
{
- GtkWidget *label;
-
enum_desc = gimp_enum_get_desc (model_class, model);
select->toggle_box[model] = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2);
- gtk_widget_show (select->toggle_box[model]);
+ gtk_box_pack_start (GTK_BOX (vbox), select->toggle_box[model],
+ FALSE, FALSE, 0);
- label = gtk_label_new (gettext (enum_desc->value_desc));
- gtk_label_set_angle (GTK_LABEL (label), 270.0);
- gtk_notebook_append_page (GTK_NOTEBOOK (notebook),
- select->toggle_box[model],
- label);
- gimp_help_set_help_data (gtk_notebook_get_tab_label (GTK_NOTEBOOK (notebook),
- select->toggle_box[model]),
- gettext (enum_desc->value_help), NULL);
+ if (gimp_color_selector_get_model_visible (selector, model))
+ gtk_widget_show (select->toggle_box[model]);
/* channel toggles */
- {
- GimpColorSelectorChannel channel = GIMP_COLOR_SELECTOR_RED;
- GimpColorSelectorChannel end_channel;
- GSList *group = NULL;
-
- switch (model)
- {
- case GIMP_COLOR_SELECTOR_RGB:
- channel = GIMP_COLOR_SELECTOR_RED;
- break;
- case GIMP_COLOR_SELECTOR_LCH:
- channel = GIMP_COLOR_SELECTOR_LCH_LIGHTNESS;
- break;
- case GIMP_COLOR_SELECTOR_HSV:
- channel = GIMP_COLOR_SELECTOR_HUE;
- break;
- default:
- /* Should not happen. */
- g_return_if_reached ();
- break;
- }
- end_channel = channel + 3;
-
- for (; channel < end_channel; channel++)
- {
- GtkWidget *button;
-
- enum_desc = gimp_enum_get_desc (channel_class, channel);
-
- button = gtk_radio_button_new_with_mnemonic (group,
- gettext (enum_desc->value_desc));
- group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (button));
- gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (button), FALSE);
- gtk_box_pack_start (GTK_BOX (select->toggle_box[model]), button,
- TRUE, TRUE, 0);
- gtk_widget_show (button);
-
- g_object_set_data (G_OBJECT (button), "channel",
- GINT_TO_POINTER (channel));
-
- if (channel == gimp_color_selector_get_channel (selector))
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
-
- gimp_help_set_help_data (button, gettext (enum_desc->value_help), NULL);
-
- g_signal_connect (button, "toggled",
- G_CALLBACK (gimp_color_select_channel_toggled),
- select);
- }
-
- }
+ {
+ GimpColorSelectorChannel channel = GIMP_COLOR_SELECTOR_RED;
+ GimpColorSelectorChannel end_channel;
+
+ switch (model)
+ {
+ case GIMP_COLOR_SELECTOR_MODEL_RGB:
+ channel = GIMP_COLOR_SELECTOR_RED;
+ break;
+ case GIMP_COLOR_SELECTOR_MODEL_LCH:
+ channel = GIMP_COLOR_SELECTOR_LCH_LIGHTNESS;
+ break;
+ case GIMP_COLOR_SELECTOR_MODEL_HSV:
+ channel = GIMP_COLOR_SELECTOR_HUE;
+ break;
+ default:
+ /* Should not happen. */
+ g_return_if_reached ();
+ break;
+ }
+
+ end_channel = channel + 3;
+
+ for (; channel < end_channel; channel++)
+ {
+ GtkWidget *button;
+
+ enum_desc = gimp_enum_get_desc (channel_class, channel);
+
+ button = gtk_radio_button_new_with_mnemonic (group,
+ gettext (enum_desc->value_desc));
+ group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (button));
+ gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (button), FALSE);
+ gtk_box_pack_start (GTK_BOX (select->toggle_box[model]), button,
+ TRUE, TRUE, 0);
+ gtk_widget_show (button);
+
+ g_object_set_data (G_OBJECT (button), "channel",
+ GINT_TO_POINTER (channel));
+
+ if (channel == gimp_color_selector_get_channel (selector))
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
+
+ gimp_help_set_help_data (button, gettext (enum_desc->value_help),
+ NULL);
+
+ g_signal_connect (button, "toggled",
+ G_CALLBACK (gimp_color_select_channel_toggled),
+ select);
+ }
+ }
}
g_type_class_unref (model_class);
g_type_class_unref (channel_class);
-
- gtk_notebook_set_current_page (GTK_NOTEBOOK (notebook),
- (gint) gimp_color_selector_get_model (selector));
- g_signal_connect (notebook, "switch-page",
- G_CALLBACK (gimp_color_select_switch_page),
- select);
- g_signal_connect (select, "model-changed",
- G_CALLBACK (gimp_color_select_model_changed),
- notebook);
}
static void
@@ -631,6 +613,16 @@ gimp_color_select_set_channel (GimpColorSelector *selector,
}
static void
+gimp_color_select_set_model_visible (GimpColorSelector *selector,
+ GimpColorSelectorModel model,
+ gboolean visible)
+{
+ GimpColorSelect *select = GIMP_COLOR_SELECT (selector);
+
+ gtk_widget_set_visible (select->toggle_box[model], visible);
+}
+
+static void
gimp_color_select_set_config (GimpColorSelector *selector,
GimpColorConfig *config)
{
@@ -2015,31 +2007,3 @@ gimp_color_select_notify_config (GimpColorConfig *config,
select->xy_needs_render = TRUE;
select->z_needs_render = TRUE;
}
-
-static void
-gimp_color_select_switch_page (GtkNotebook *notebook,
- GtkWidget *page,
- gint num,
- GimpColorSelect *select)
-{
- gimp_color_selector_set_model (GIMP_COLOR_SELECTOR (select),
- (GimpColorSelectorModel) num);
-}
-
-static void
-gimp_color_select_model_changed (GimpColorSelector *selector,
- GimpColorSelectorModel model,
- GtkNotebook *color_model_notebook)
-{
- GimpColorSelect *select = GIMP_COLOR_SELECT (selector);
- GList *children;
- GtkButton *button;
-
- /* Select the first channel. */
- children = gtk_container_get_children (GTK_CONTAINER (select->toggle_box[model]));
- button = children->data;
- g_list_free (children);
-
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
- gtk_notebook_set_current_page (color_model_notebook, (gint) model);
-}
diff --git a/libgimpwidgets/gimpcolorselection.c b/libgimpwidgets/gimpcolorselection.c
index 4de60a9..0678dda 100644
--- a/libgimpwidgets/gimpcolorselection.c
+++ b/libgimpwidgets/gimpcolorselection.c
@@ -118,7 +118,7 @@ G_DEFINE_TYPE (GimpColorSelection, gimp_color_selection, GTK_TYPE_BOX)
#define parent_class gimp_color_selection_parent_class
-static guint selection_signals[LAST_SIGNAL] = { 0 };
+static guint selection_signals[LAST_SIGNAL] = { 0, };
static void
diff --git a/libgimpwidgets/gimpcolorselector.c b/libgimpwidgets/gimpcolorselector.c
index e98d077..2dd9115 100644
--- a/libgimpwidgets/gimpcolorselector.c
+++ b/libgimpwidgets/gimpcolorselector.c
@@ -53,11 +53,24 @@ enum
{
COLOR_CHANGED,
CHANNEL_CHANGED,
- MODEL_CHANGED,
+ MODEL_VISIBLE_CHANGED,
LAST_SIGNAL
};
+typedef struct _GimpColorSelectorPrivate GimpColorSelectorPrivate;
+
+struct _GimpColorSelectorPrivate
+{
+ gboolean model_visible[3];
+};
+
+#define GET_PRIVATE(obj) \
+ G_TYPE_INSTANCE_GET_PRIVATE (obj, \
+ GIMP_TYPE_COLOR_SELECTOR, \
+ GimpColorSelectorPrivate)
+
+
static void gimp_color_selector_dispose (GObject *object);
@@ -92,19 +105,20 @@ gimp_color_selector_class_init (GimpColorSelectorClass *klass)
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GimpColorSelectorClass, channel_changed),
NULL, NULL,
- _gimp_widgets_marshal_VOID__INT,
+ _gimp_widgets_marshal_VOID__ENUM,
G_TYPE_NONE, 1,
- G_TYPE_INT);
+ GIMP_TYPE_COLOR_SELECTOR_CHANNEL);
- selector_signals[MODEL_CHANGED] =
- g_signal_new ("model-changed",
+ selector_signals[MODEL_VISIBLE_CHANGED] =
+ g_signal_new ("model-visible-changed",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (GimpColorSelectorClass, model_changed),
+ G_STRUCT_OFFSET (GimpColorSelectorClass, model_visible_changed),
NULL, NULL,
- _gimp_widgets_marshal_VOID__INT,
- G_TYPE_NONE, 1,
- G_TYPE_INT);
+ _gimp_widgets_marshal_VOID__ENUM_BOOLEAN,
+ G_TYPE_NONE, 2,
+ GIMP_TYPE_COLOR_SELECTOR_MODEL,
+ G_TYPE_BOOLEAN);
klass->name = "Unnamed";
klass->help_id = NULL;
@@ -114,16 +128,21 @@ gimp_color_selector_class_init (GimpColorSelectorClass *klass)
klass->set_toggles_sensitive = NULL;
klass->set_show_alpha = NULL;
klass->set_color = NULL;
- klass->set_model = NULL;
klass->set_channel = NULL;
+ klass->set_model_visible = NULL;
klass->color_changed = NULL;
klass->channel_changed = NULL;
+ klass->model_visible_changed = NULL;
klass->set_config = NULL;
+
+ g_type_class_add_private (object_class, sizeof (GimpColorSelectorPrivate));
}
static void
gimp_color_selector_init (GimpColorSelector *selector)
{
+ GimpColorSelectorPrivate *priv = GET_PRIVATE (selector);
+
selector->toggles_visible = TRUE;
selector->toggles_sensitive = TRUE;
selector->show_alpha = TRUE;
@@ -135,7 +154,10 @@ gimp_color_selector_init (GimpColorSelector *selector)
gimp_rgb_to_hsv (&selector->rgb, &selector->hsv);
selector->channel = GIMP_COLOR_SELECTOR_RED;
- selector->model = GIMP_COLOR_SELECTOR_RGB;
+
+ priv->model_visible[GIMP_COLOR_SELECTOR_MODEL_RGB] = TRUE;
+ priv->model_visible[GIMP_COLOR_SELECTOR_MODEL_LCH] = TRUE;
+ priv->model_visible[GIMP_COLOR_SELECTOR_MODEL_HSV] = FALSE;
}
static void
@@ -397,51 +419,64 @@ gimp_color_selector_set_channel (GimpColorSelector *selector,
if (channel != selector->channel)
{
GimpColorSelectorClass *selector_class;
- GimpColorSelectorModel model = selector->model;
+ GimpColorSelectorModel model = -1;
selector->channel = channel;
- selector_class = GIMP_COLOR_SELECTOR_GET_CLASS (selector);
switch (channel)
{
case GIMP_COLOR_SELECTOR_RED:
case GIMP_COLOR_SELECTOR_GREEN:
case GIMP_COLOR_SELECTOR_BLUE:
- model = GIMP_COLOR_SELECTOR_RGB;
+ model = GIMP_COLOR_SELECTOR_MODEL_RGB;
break;
+
case GIMP_COLOR_SELECTOR_HUE:
case GIMP_COLOR_SELECTOR_SATURATION:
case GIMP_COLOR_SELECTOR_VALUE:
- model = GIMP_COLOR_SELECTOR_HSV;
+ model = GIMP_COLOR_SELECTOR_MODEL_HSV;
break;
+
case GIMP_COLOR_SELECTOR_LCH_LIGHTNESS:
case GIMP_COLOR_SELECTOR_LCH_CHROMA:
case GIMP_COLOR_SELECTOR_LCH_HUE:
- model = GIMP_COLOR_SELECTOR_LCH;
+ model = GIMP_COLOR_SELECTOR_MODEL_LCH;
break;
+
case GIMP_COLOR_SELECTOR_ALPHA:
/* Alpha channel does not change the color model. */
break;
+
default:
/* Should not happen. */
g_return_if_reached ();
break;
}
+ selector_class = GIMP_COLOR_SELECTOR_GET_CLASS (selector);
+
if (selector_class->set_channel)
selector_class->set_channel (selector, channel);
gimp_color_selector_channel_changed (selector);
- if (model != selector->model)
+ if (model != -1)
{
- selector->model = model;
-
- if (selector_class->set_model)
- selector_class->set_model (selector, model);
-
- g_signal_emit (selector, selector_signals[MODEL_CHANGED], 0,
- selector->model);
+ /* make visibility of LCH and HSV mutuallky exclusive */
+ if (model == GIMP_COLOR_SELECTOR_MODEL_HSV)
+ {
+ gimp_color_selector_set_model_visible (selector,
+ GIMP_COLOR_SELECTOR_MODEL_LCH,
+ FALSE);
+ }
+ else if (model == GIMP_COLOR_SELECTOR_MODEL_LCH)
+ {
+ gimp_color_selector_set_model_visible (selector,
+ GIMP_COLOR_SELECTOR_MODEL_HSV,
+ FALSE);
+ }
+
+ gimp_color_selector_set_model_visible (selector, model, TRUE);
}
}
}
@@ -467,73 +502,66 @@ gimp_color_selector_get_channel (GimpColorSelector *selector)
}
/**
- * gimp_color_selector_set_model:
+ * gimp_color_selector_set_model_visible:
* @selector: A #GimpColorSelector widget.
- * @model: The new #GimpColorSelectorModel setting.
+ * @model: The affected #GimpColorSelectorModel.
+ * @visible: The new visible setting.
*
- * Sets the @model property of the @selector widget.
+ * Sets the @model visible/invisible on the @selector widget.
*
- * Changes between displayed models if this @selector instance has
- * the ability to show different color models.
- * If the model actually changes, the channel will also be updated
- * automatically to an arbitrary channel within this color model.
- * If you want to control exactly which channel is selected, use
- * gimp_color_selector_set_channel() instead, which will also change
- * to the adequate model.
+ * Toggles visibility of displayed models if this @selector instance
+ * has the ability to show different color models.
*
+ * Since: 2.10
**/
void
-gimp_color_selector_set_model (GimpColorSelector *selector,
- GimpColorSelectorModel model)
+gimp_color_selector_set_model_visible (GimpColorSelector *selector,
+ GimpColorSelectorModel model,
+ gboolean visible)
{
+ GimpColorSelectorPrivate *priv;
+
g_return_if_fail (GIMP_IS_COLOR_SELECTOR (selector));
- if (model != selector->model)
+ priv = GET_PRIVATE (selector);
+
+ visible = visible ? TRUE : FALSE;
+
+ if (visible != priv->model_visible[model])
{
- /* Don't change the model here. Simply redirect to
- * gimp_color_selector_set_channel() with appropriate default
- * channel.
- */
- switch (model)
- {
- case GIMP_COLOR_SELECTOR_RGB:
- gimp_color_selector_set_channel (selector,
- GIMP_COLOR_SELECTOR_RED);
- break;
- case GIMP_COLOR_SELECTOR_HSV:
- gimp_color_selector_set_channel (selector,
- GIMP_COLOR_SELECTOR_HUE);
- break;
- case GIMP_COLOR_SELECTOR_LCH:
- gimp_color_selector_set_channel (selector,
- GIMP_COLOR_SELECTOR_LCH_LIGHTNESS);
- break;
- default:
- /* Should not happen. */
- g_return_if_reached ();
- break;
- }
+ GimpColorSelectorClass *selector_class;
+
+ priv->model_visible[model] = visible;
+
+ selector_class = GIMP_COLOR_SELECTOR_GET_CLASS (selector);
+
+ if (selector_class->set_model_visible)
+ selector_class->set_model_visible (selector, model, visible);
+
+ gimp_color_selector_model_visible_changed (selector, model);
}
}
/**
- * gimp_color_selector_get_model:
+ * gimp_color_selector_get_model_visible:
* @selector: A #GimpColorSelector widget.
+ * @model: The #GimpColorSelectorModel.
*
- * Returns the @selector's current color model.
- *
- * Return value: The #GimpColorSelectorModel currently shown by the
- * @selector.
+ * Return value: whether @model is visible in @selector.
*
* Since: 2.10
**/
-GimpColorSelectorModel
-gimp_color_selector_get_model (GimpColorSelector *selector)
+gboolean
+gimp_color_selector_get_model_visible (GimpColorSelector *selector,
+ GimpColorSelectorModel model)
{
- g_return_val_if_fail (GIMP_IS_COLOR_SELECTOR (selector),
- GIMP_COLOR_SELECTOR_RGB);
+ GimpColorSelectorPrivate *priv;
+
+ g_return_val_if_fail (GIMP_IS_COLOR_SELECTOR (selector), FALSE);
- return selector->model;
+ priv = GET_PRIVATE (selector);
+
+ return priv->model_visible[model];
}
/**
@@ -567,6 +595,28 @@ gimp_color_selector_channel_changed (GimpColorSelector *selector)
}
/**
+ * gimp_color_selector_model_visible_changed:
+ * @selector: A #GimpColorSelector widget.
+ *
+ * Emits the "model-visible-changed" signal.
+ *
+ * Since: 2.10
+ **/
+void
+gimp_color_selector_model_visible_changed (GimpColorSelector *selector,
+ GimpColorSelectorModel model)
+{
+ GimpColorSelectorPrivate *priv;
+
+ g_return_if_fail (GIMP_IS_COLOR_SELECTOR (selector));
+
+ priv = GET_PRIVATE (selector);
+
+ g_signal_emit (selector, selector_signals[MODEL_VISIBLE_CHANGED], 0,
+ model, priv->model_visible[model]);
+}
+
+/**
* gimp_color_selector_set_config:
* @selector: a #GimpColorSelector widget.
* @config: a #GimpColorConfig object.
diff --git a/libgimpwidgets/gimpcolorselector.h b/libgimpwidgets/gimpcolorselector.h
index 2370f76..7c6b31f 100644
--- a/libgimpwidgets/gimpcolorselector.h
+++ b/libgimpwidgets/gimpcolorselector.h
@@ -73,7 +73,6 @@ struct _GimpColorSelector
GimpRGB rgb;
GimpHSV hsv;
- GimpColorSelectorModel model;
GimpColorSelectorChannel channel;
};
@@ -117,12 +116,14 @@ struct _GimpColorSelectorClass
const gchar *icon_name;
/* another virtual function */
- void (* set_model) (GimpColorSelector *selector,
- GimpColorSelectorModel model);
+ void (* set_model_visible) (GimpColorSelector *selector,
+ GimpColorSelectorModel model,
+ gboolean visible);
/* another signal */
- void (* model_changed) (GimpColorSelector *selector,
- GimpColorSelectorModel model);
+ void (* model_visible_changed) (GimpColorSelector *selector,
+ GimpColorSelectorModel model,
+ gboolean visible);
};
@@ -155,13 +156,17 @@ void gimp_color_selector_set_channel (GimpColorSelector *selector,
GimpColorSelectorChannel channel);
GimpColorSelectorChannel
gimp_color_selector_get_channel (GimpColorSelector *selector);
-void gimp_color_selector_set_model (GimpColorSelector *selector,
- GimpColorSelectorModel model);
-GimpColorSelectorModel
- gimp_color_selector_get_model (GimpColorSelector *selector);
+
+void gimp_color_selector_set_model_visible (GimpColorSelector *selector,
+ GimpColorSelectorModel model,
+ gboolean visible);
+gboolean gimp_color_selector_get_model_visible (GimpColorSelector *selector,
+ GimpColorSelectorModel model);
void gimp_color_selector_color_changed (GimpColorSelector *selector);
void gimp_color_selector_channel_changed (GimpColorSelector *selector);
+void gimp_color_selector_model_visible_changed (GimpColorSelector *selector,
+ GimpColorSelectorModel model);
void gimp_color_selector_set_config (GimpColorSelector *selector,
GimpColorConfig *config);
diff --git a/libgimpwidgets/gimpwidgets.def b/libgimpwidgets/gimpwidgets.def
index a8745be..b53cc7d 100644
--- a/libgimpwidgets/gimpwidgets.def
+++ b/libgimpwidgets/gimpwidgets.def
@@ -123,17 +123,18 @@ EXPORTS
gimp_color_selector_color_changed
gimp_color_selector_get_channel
gimp_color_selector_get_color
- gimp_color_selector_get_model
+ gimp_color_selector_get_model_visible
gimp_color_selector_get_show_alpha
gimp_color_selector_get_toggles_sensitive
gimp_color_selector_get_toggles_visible
gimp_color_selector_get_type
gimp_color_selector_model_get_type
+ gimp_color_selector_model_visible_changed
gimp_color_selector_new
gimp_color_selector_set_channel
gimp_color_selector_set_color
gimp_color_selector_set_config
- gimp_color_selector_set_model
+ gimp_color_selector_set_model_visible
gimp_color_selector_set_show_alpha
gimp_color_selector_set_toggles_sensitive
gimp_color_selector_set_toggles_visible
diff --git a/libgimpwidgets/gimpwidgetsenums.c b/libgimpwidgets/gimpwidgetsenums.c
index 1cef587..d726105 100644
--- a/libgimpwidgets/gimpwidgetsenums.c
+++ b/libgimpwidgets/gimpwidgetsenums.c
@@ -157,17 +157,17 @@ gimp_color_selector_model_get_type (void)
{
static const GEnumValue values[] =
{
- { GIMP_COLOR_SELECTOR_RGB, "GIMP_COLOR_SELECTOR_RGB", "rgb" },
- { GIMP_COLOR_SELECTOR_LCH, "GIMP_COLOR_SELECTOR_LCH", "lch" },
- { GIMP_COLOR_SELECTOR_HSV, "GIMP_COLOR_SELECTOR_HSV", "hsv" },
+ { GIMP_COLOR_SELECTOR_MODEL_RGB, "GIMP_COLOR_SELECTOR_MODEL_RGB", "rgb" },
+ { GIMP_COLOR_SELECTOR_MODEL_LCH, "GIMP_COLOR_SELECTOR_MODEL_LCH", "lch" },
+ { GIMP_COLOR_SELECTOR_MODEL_HSV, "GIMP_COLOR_SELECTOR_MODEL_HSV", "hsv" },
{ 0, NULL, NULL }
};
static const GimpEnumDesc descs[] =
{
- { GIMP_COLOR_SELECTOR_RGB, NC_("color-selector-model", "RGB"), N_("RGB color model") },
- { GIMP_COLOR_SELECTOR_LCH, NC_("color-selector-model", "LCH"), N_("CIELCh color model") },
- { GIMP_COLOR_SELECTOR_HSV, NC_("color-selector-model", "HSV"), N_("HSV color model") },
+ { GIMP_COLOR_SELECTOR_MODEL_RGB, NC_("color-selector-model", "RGB"), N_("RGB color model") },
+ { GIMP_COLOR_SELECTOR_MODEL_LCH, NC_("color-selector-model", "LCH"), N_("CIELCh color model") },
+ { GIMP_COLOR_SELECTOR_MODEL_HSV, NC_("color-selector-model", "HSV"), N_("HSV color model") },
{ 0, NULL, NULL }
};
diff --git a/libgimpwidgets/gimpwidgetsenums.h b/libgimpwidgets/gimpwidgetsenums.h
index 55c0384..4876e18 100644
--- a/libgimpwidgets/gimpwidgetsenums.h
+++ b/libgimpwidgets/gimpwidgetsenums.h
@@ -121,6 +121,7 @@ typedef enum
GIMP_COLOR_SELECTOR_LCH_HUE /*< desc="_H", help="LCH Hue" >*/
} GimpColorSelectorChannel;
+
/**
* GimpColorSelectorModel:
* @GIMP_COLOR_SELECTOR_RGB: RGB color model
@@ -136,11 +137,12 @@ GType gimp_color_selector_model_get_type (void) G_GNUC_CONST;
typedef enum
{
- GIMP_COLOR_SELECTOR_RGB, /*< desc="RGB", help="RGB color model" >*/
- GIMP_COLOR_SELECTOR_LCH, /*< desc="LCH", help="CIELCh color model" >*/
- GIMP_COLOR_SELECTOR_HSV /*< desc="HSV", help="HSV color model" >*/
+ GIMP_COLOR_SELECTOR_MODEL_RGB, /*< desc="RGB", help="RGB color model" >*/
+ GIMP_COLOR_SELECTOR_MODEL_LCH, /*< desc="LCH", help="CIELCh color model" >*/
+ GIMP_COLOR_SELECTOR_MODEL_HSV /*< desc="HSV", help="HSV color model" >*/
} GimpColorSelectorModel;
+
/**
* GimpPageSelectorTarget:
* @GIMP_PAGE_SELECTOR_TARGET_LAYERS: import as layers of one image
diff --git a/libgimpwidgets/gimpwidgetsmarshal.list b/libgimpwidgets/gimpwidgetsmarshal.list
index 947322f..8983fa8 100644
--- a/libgimpwidgets/gimpwidgetsmarshal.list
+++ b/libgimpwidgets/gimpwidgetsmarshal.list
@@ -22,7 +22,8 @@
# NONE deprecated alias for VOID
# BOOL deprecated alias for BOOLEAN
-VOID: INT
+VOID: ENUM
+VOID: ENUM, BOOLEAN
VOID: INT, INT
VOID: OBJECT
VOID: OBJECT, INT
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]