[gimp] libgimpwidgets: arrange color models in tabs in GimpColorScales.
- From: Jehan Pagès <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] libgimpwidgets: arrange color models in tabs in GimpColorScales.
- Date: Sun, 21 Jan 2018 18:03:08 +0000 (UTC)
commit 37e9be3a4f07da1b1410749fec309bd040a8941c
Author: Jehan <jehan girinstud io>
Date: Sun Jan 21 00:35:32 2018 +0100
libgimpwidgets: arrange color models in tabs in GimpColorScales.
This allows to have a smaller and cleaner color dock instead of just
listing all possible channels (which may only grow up as we may add more
color spaces).
The API gimp_color_scales_(set|get)_show_hsv() are removed in favor of
more generic gimp_color_selector_(set|get)_model(). I assume this is
ok since they have only been available in the dev version (commit
6258d525ae, a month ago).
libgimpwidgets/gimpcolorscales.c | 230 ++++++++++++++++--------------------
libgimpwidgets/gimpcolorscales.h | 4 -
libgimpwidgets/gimpcolorselector.c | 120 +++++++++++++++++++-
libgimpwidgets/gimpcolorselector.h | 9 ++
libgimpwidgets/gimpwidgets.def | 4 +-
libgimpwidgets/gimpwidgetsenums.c | 32 +++++
libgimpwidgets/gimpwidgetsenums.h | 19 +++
7 files changed, 284 insertions(+), 134 deletions(-)
---
diff --git a/libgimpwidgets/gimpcolorscales.c b/libgimpwidgets/gimpcolorscales.c
index ea8a1f9..2c94f14 100644
--- a/libgimpwidgets/gimpcolorscales.c
+++ b/libgimpwidgets/gimpcolorscales.c
@@ -56,7 +56,6 @@
enum
{
PROP_0,
- PROP_SHOW_HSV,
PROP_SHOW_RGB_U8
};
@@ -103,11 +102,8 @@ struct _GimpColorScales
{
GimpColorSelector parent_instance;
- gboolean show_hsv;
gboolean show_rgb_u8;
- GtkWidget *lch_group;
- GtkWidget *hsv_group;
GtkWidget *rgb_percent_group;
GtkWidget *rgb_u8_group;
GtkWidget *alpha_percent_group;
@@ -157,6 +153,13 @@ 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,
+ 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)
@@ -208,14 +211,6 @@ gimp_color_scales_class_init (GimpColorScalesClass *klass)
selector_class->set_channel = gimp_color_scales_set_channel;
selector_class->set_config = gimp_color_scales_set_config;
- g_object_class_install_property (object_class, PROP_SHOW_HSV,
- g_param_spec_boolean ("show-hsv",
- "Show HSV",
- "Show HSV scales",
- FALSE,
- GIMP_PARAM_READWRITE |
- G_PARAM_CONSTRUCT));
-
g_object_class_install_property (object_class, PROP_SHOW_RGB_U8,
g_param_spec_boolean ("show-rgb-u8",
"Show RGB 0..255",
@@ -359,24 +354,33 @@ 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;
- GSList *group;
+ GSList *main_group;
GSList *u8_group;
+ GSList *radio_group;
gtk_box_set_spacing (GTK_BOX (scales), 5);
/* don't needs the toggles for our own operation */
selector->toggles_visible = FALSE;
- hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
- gtk_box_pack_start (GTK_BOX (scales), hbox, 0, 0, FALSE);
- gtk_widget_show (hbox);
+ notebook = gtk_notebook_new ();
+ gtk_widget_show (notebook);
+ gtk_box_pack_start (GTK_BOX (scales), notebook, 0, 0, FALSE);
- group = NULL;
- u8_group = NULL;
+ 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);
@@ -387,58 +391,31 @@ gimp_color_scales_init (GimpColorScales *scales)
size_group2 = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
scales->rgb_percent_group =
- table = create_group (scales, &group,
+ table = create_group (scales, &main_group,
size_group0, size_group1, size_group2,
GIMP_COLOR_SELECTOR_RED,
GIMP_COLOR_SELECTOR_BLUE);
- gtk_box_pack_start (GTK_BOX (scales), table, FALSE, FALSE, 0);
+ gtk_widget_show (table);
+ gtk_box_pack_start (GTK_BOX (vbox), 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_box_pack_start (GTK_BOX (scales), table, FALSE, FALSE, 0);
-
- scales->lch_group =
- table = create_group (scales, &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);
+ gtk_widget_show (table);
+ gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
- scales->hsv_group =
- table = create_group (scales, &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, &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);
+ /* 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);
- group = NULL;
+ radio_group = NULL;
- radio1 = gtk_radio_button_new_with_label (NULL, _("0..100"));
- group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio1));
- radio2 = gtk_radio_button_new_with_label (group, _("0..255"));
+ radio1 = gtk_radio_button_new_with_label (NULL, _("0..100"));
+ radio_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio1));
+ radio2 = gtk_radio_button_new_with_label (radio_group, _("0..255"));
gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (radio1), FALSE);
gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (radio2), FALSE);
@@ -457,28 +434,55 @@ gimp_color_scales_init (GimpColorScales *scales)
G_BINDING_SYNC_CREATE |
G_BINDING_BIDIRECTIONAL);
- group = NULL;
-
- radio1 = gtk_radio_button_new_with_label (NULL, _("LCH"));
- group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio1));
- radio2 = gtk_radio_button_new_with_label (group, _("HSV"));
+ /* 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"));
- gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (radio1), FALSE);
- gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (radio2), FALSE);
+ 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);
- gtk_box_pack_end (GTK_BOX (hbox), radio2, FALSE, FALSE, 0);
- gtk_box_pack_end (GTK_BOX (hbox), radio1, 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);
- gtk_widget_show (radio1);
- gtk_widget_show (radio2);
+ g_object_unref (size_group0);
+ g_object_unref (size_group1);
+ g_object_unref (size_group2);
- if (scales->show_hsv)
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio2), TRUE);
+ /* 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);
- g_object_bind_property (G_OBJECT (radio2), "active",
- G_OBJECT (scales), "show-hsv",
- G_BINDING_SYNC_CREATE |
- G_BINDING_BIDIRECTIONAL);
+ gimp_color_scales_update_visible (scales);
}
static void
@@ -501,9 +505,6 @@ gimp_color_scales_get_property (GObject *object,
switch (property_id)
{
- case PROP_SHOW_HSV:
- g_value_set_boolean (value, scales->show_hsv);
- break;
case PROP_SHOW_RGB_U8:
g_value_set_boolean (value, scales->show_rgb_u8);
break;
@@ -524,9 +525,6 @@ gimp_color_scales_set_property (GObject *object,
switch (property_id)
{
- case PROP_SHOW_HSV:
- gimp_color_scales_set_show_hsv (scales, g_value_get_boolean (value));
- break;
case PROP_SHOW_RGB_U8:
gimp_color_scales_set_show_rgb_u8 (scales, g_value_get_boolean (value));
break;
@@ -617,49 +615,6 @@ gimp_color_scales_set_config (GimpColorSelector *selector,
/* public functions */
-void
-gimp_color_scales_set_show_hsv (GimpColorScales *scales,
- gboolean show_hsv)
-{
- g_return_if_fail (GIMP_IS_COLOR_SCALES (scales));
-
- show_hsv = show_hsv ? TRUE : FALSE;
-
- if (show_hsv != scales->show_hsv)
- {
- GimpColorSelector *selector = GIMP_COLOR_SELECTOR (scales);
- GimpColorSelectorChannel channel;
-
- channel = gimp_color_selector_get_channel (selector);
-
- if (show_hsv &&
- channel >= GIMP_COLOR_SELECTOR_LCH_LIGHTNESS &&
- channel <= GIMP_COLOR_SELECTOR_LCH_HUE)
- {
- gimp_color_selector_set_channel (selector, channel - 7);
- }
- else if (! show_hsv &&
- channel >= GIMP_COLOR_SELECTOR_HUE &&
- channel <= GIMP_COLOR_SELECTOR_VALUE)
- {
- gimp_color_selector_set_channel (selector, channel + 7);
- }
-
- scales->show_hsv = show_hsv;
-
- g_object_notify (G_OBJECT (scales), "show-hsv");
-
- gimp_color_scales_update_visible (scales);
- }
-}
-
-gboolean
-gimp_color_scales_get_show_hsv (GimpColorScales *scales)
-{
- g_return_val_if_fail (GIMP_IS_COLOR_SCALES (scales), FALSE);
-
- return scales->show_hsv;
-}
void
gimp_color_scales_set_show_rgb_u8 (GimpColorScales *scales,
@@ -698,9 +653,6 @@ gimp_color_scales_update_visible (GimpColorScales *scales)
show_alpha = gimp_color_selector_get_show_alpha (selector);
- gtk_widget_set_visible (scales->lch_group, ! scales->show_hsv);
- gtk_widget_set_visible (scales->hsv_group, scales->show_hsv);
-
gtk_widget_set_visible (scales->rgb_percent_group, ! scales->show_rgb_u8);
gtk_widget_set_visible (scales->rgb_u8_group, scales->show_rgb_u8);
@@ -889,3 +841,27 @@ gimp_color_scales_scale_changed (GtkAdjustment *adjustment,
gimp_color_selector_color_changed (selector);
}
+
+static void
+gimp_color_scales_switch_page (GtkNotebook *notebook,
+ GtkWidget *page,
+ gint num,
+ 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);
+}
+
+static void
+gimp_color_scales_model_changed (GimpColorSelector *selector,
+ GimpColorSelectorModel model,
+ GtkNotebook *notebook)
+{
+ if (gtk_notebook_get_current_page (notebook) != (gint) model)
+ {
+ gtk_notebook_set_current_page (notebook, (gint) model);
+ }
+}
diff --git a/libgimpwidgets/gimpcolorscales.h b/libgimpwidgets/gimpcolorscales.h
index a1afbe5..1af1e51 100644
--- a/libgimpwidgets/gimpcolorscales.h
+++ b/libgimpwidgets/gimpcolorscales.h
@@ -39,10 +39,6 @@ G_BEGIN_DECLS
GType gimp_color_scales_get_type (void) G_GNUC_CONST;
-void gimp_color_scales_set_show_hsv (GimpColorScales *scales,
- gboolean show_hsv);
-gboolean gimp_color_scales_get_show_hsv (GimpColorScales *scales);
-
void gimp_color_scales_set_show_rgb_u8 (GimpColorScales *scales,
gboolean show_rgb_u8);
gboolean gimp_color_scales_get_show_rgb_u8 (GimpColorScales *scales);
diff --git a/libgimpwidgets/gimpcolorselector.c b/libgimpwidgets/gimpcolorselector.c
index 99f5b9f..60bc5e5 100644
--- a/libgimpwidgets/gimpcolorselector.c
+++ b/libgimpwidgets/gimpcolorselector.c
@@ -53,6 +53,7 @@ enum
{
COLOR_CHANGED,
CHANNEL_CHANGED,
+ MODEL_CHANGED,
LAST_SIGNAL
};
@@ -95,6 +96,16 @@ gimp_color_selector_class_init (GimpColorSelectorClass *klass)
G_TYPE_NONE, 1,
G_TYPE_INT);
+ selector_signals[MODEL_CHANGED] =
+ g_signal_new ("model-changed",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (GimpColorSelectorClass, model_changed),
+ NULL, NULL,
+ _gimp_widgets_marshal_VOID__INT,
+ G_TYPE_NONE, 1,
+ G_TYPE_INT);
+
klass->name = "Unnamed";
klass->help_id = NULL;
klass->icon_name = GIMP_ICON_PALETTE;
@@ -103,6 +114,7 @@ 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->color_changed = NULL;
klass->channel_changed = NULL;
@@ -123,6 +135,7 @@ 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;
}
static void
@@ -373,6 +386,7 @@ gimp_color_selector_get_color (GimpColorSelector *selector,
*
* Changes between displayed channels if this @selector instance has
* the ability to show different channels.
+ * This will also update the color model if needed.
**/
void
gimp_color_selector_set_channel (GimpColorSelector *selector,
@@ -383,15 +397,50 @@ gimp_color_selector_set_channel (GimpColorSelector *selector,
if (channel != selector->channel)
{
GimpColorSelectorClass *selector_class;
+ GimpColorSelectorModel model = selector->channel;
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;
+ break;
+ case GIMP_COLOR_SELECTOR_HUE:
+ case GIMP_COLOR_SELECTOR_SATURATION:
+ case GIMP_COLOR_SELECTOR_VALUE:
+ model = GIMP_COLOR_SELECTOR_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;
+ break;
+ case GIMP_COLOR_SELECTOR_ALPHA:
+ /* Alpha channel does not change the color model. */
+ default:
+ /* Should not happen. */
+ break;
+ }
+
if (selector_class->set_channel)
selector_class->set_channel (selector, channel);
gimp_color_selector_channel_changed (selector);
+
+ if (model != selector->model)
+ {
+ 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);
+ }
}
}
@@ -416,6 +465,75 @@ gimp_color_selector_get_channel (GimpColorSelector *selector)
}
/**
+ * gimp_color_selector_set_model:
+ * @selector: A #GimpColorSelector widget.
+ * @model: The new #GimpColorSelectorModel setting.
+ *
+ * Sets the @model property of 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.
+ *
+ **/
+void
+gimp_color_selector_set_model (GimpColorSelector *selector,
+ GimpColorSelectorModel model)
+{
+ g_return_if_fail (GIMP_IS_COLOR_SELECTOR (selector));
+
+ if (model != selector->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. */
+ break;
+ }
+ }
+}
+
+/**
+ * gimp_color_selector_get_model:
+ * @selector: A #GimpColorSelector widget.
+ *
+ * Returns the @selector's current color model.
+ *
+ * Return value: The #GimpColorSelectorModel currently shown by the
+ * @selector.
+ *
+ * Since: 2.10
+ **/
+GimpColorSelectorModel
+gimp_color_selector_get_model (GimpColorSelector *selector)
+{
+ g_return_val_if_fail (GIMP_IS_COLOR_SELECTOR (selector),
+ GIMP_COLOR_SELECTOR_RGB);
+
+ return selector->model;
+}
+
+/**
* gimp_color_selector_color_changed:
* @selector: A #GimpColorSelector widget.
*
diff --git a/libgimpwidgets/gimpcolorselector.h b/libgimpwidgets/gimpcolorselector.h
index f1450ed..cc2f829 100644
--- a/libgimpwidgets/gimpcolorselector.h
+++ b/libgimpwidgets/gimpcolorselector.h
@@ -73,6 +73,7 @@ struct _GimpColorSelector
GimpRGB rgb;
GimpHSV hsv;
+ GimpColorSelectorModel model;
GimpColorSelectorChannel channel;
};
@@ -98,6 +99,8 @@ struct _GimpColorSelectorClass
void (* set_color) (GimpColorSelector *selector,
const GimpRGB *rgb,
const GimpHSV *hsv);
+ void (* set_model) (GimpColorSelector *selector,
+ GimpColorSelectorModel model);
void (* set_channel) (GimpColorSelector *selector,
GimpColorSelectorChannel channel);
@@ -105,6 +108,8 @@ struct _GimpColorSelectorClass
void (* color_changed) (GimpColorSelector *selector,
const GimpRGB *rgb,
const GimpHSV *hsv);
+ void (* model_changed) (GimpColorSelector *selector,
+ GimpColorSelectorModel model);
void (* channel_changed) (GimpColorSelector *selector,
GimpColorSelectorChannel channel);
@@ -150,6 +155,10 @@ 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_color_changed (GimpColorSelector *selector);
void gimp_color_selector_channel_changed (GimpColorSelector *selector);
diff --git a/libgimpwidgets/gimpwidgets.def b/libgimpwidgets/gimpwidgets.def
index b512df1..6a62c78 100644
--- a/libgimpwidgets/gimpwidgets.def
+++ b/libgimpwidgets/gimpwidgets.def
@@ -103,10 +103,8 @@ EXPORTS
gimp_color_scale_set_channel
gimp_color_scale_set_color
gimp_color_scale_set_color_config
- gimp_color_scales_get_show_hsv
gimp_color_scales_get_show_rgb_u8
gimp_color_scales_get_type
- gimp_color_scales_set_show_hsv
gimp_color_scales_set_show_rgb_u8
gimp_color_select_get_type
gimp_color_selection_color_changed
@@ -125,6 +123,7 @@ 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_show_alpha
gimp_color_selector_get_toggles_sensitive
gimp_color_selector_get_toggles_visible
@@ -133,6 +132,7 @@ EXPORTS
gimp_color_selector_set_channel
gimp_color_selector_set_color
gimp_color_selector_set_config
+ gimp_color_selector_set_model
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 0269275..1cef587 100644
--- a/libgimpwidgets/gimpwidgetsenums.c
+++ b/libgimpwidgets/gimpwidgetsenums.c
@@ -153,6 +153,38 @@ gimp_color_selector_channel_get_type (void)
}
GType
+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" },
+ { 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") },
+ { 0, NULL, NULL }
+ };
+
+ static GType type = 0;
+
+ if (G_UNLIKELY (! type))
+ {
+ type = g_enum_register_static ("GimpColorSelectorModel", values);
+ gimp_type_set_translation_domain (type, GETTEXT_PACKAGE "-libgimp");
+ gimp_type_set_translation_context (type, "color-selector-model");
+ gimp_enum_set_value_descriptions (type, descs);
+ }
+
+ return type;
+}
+
+GType
gimp_page_selector_target_get_type (void)
{
static const GEnumValue values[] =
diff --git a/libgimpwidgets/gimpwidgetsenums.h b/libgimpwidgets/gimpwidgetsenums.h
index 84b679d..55c0384 100644
--- a/libgimpwidgets/gimpwidgetsenums.h
+++ b/libgimpwidgets/gimpwidgetsenums.h
@@ -121,6 +121,25 @@ typedef enum
GIMP_COLOR_SELECTOR_LCH_HUE /*< desc="_H", help="LCH Hue" >*/
} GimpColorSelectorChannel;
+/**
+ * GimpColorSelectorModel:
+ * @GIMP_COLOR_SELECTOR_RGB: RGB color model
+ * @GIMP_COLOR_SELECTOR_LCH: CIELCh color model
+ * @GIMP_COLOR_SELECTOR_HSV: HSV color model
+ *
+ * An enum to specify the types of color spaces edited in
+ * #GimpColorSelector widgets.
+ **/
+#define GIMP_TYPE_COLOR_SELECTOR_MODEL (gimp_color_selector_model_get_type ())
+
+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" >*/
+} GimpColorSelectorModel;
/**
* GimpPageSelectorTarget:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]