mirror of https://github.com/GNOME/gimp.git
app: swapping gimp_prop_color_button_new() and gimp_prop_gegl_color_button_new().
Color propwidgets now use GeglColor only.
This commit is contained in:
parent
80334f0eba
commit
252f991cfb
|
@ -241,13 +241,13 @@ prefs_color_button_add (GObject *config,
|
|||
*/
|
||||
/*has_alpha = gimp_param_spec_rgb_has_alpha (pspec);*/
|
||||
|
||||
button = gimp_prop_gegl_color_button_new (config, property_name,
|
||||
title,
|
||||
PREFS_COLOR_BUTTON_WIDTH,
|
||||
PREFS_COLOR_BUTTON_HEIGHT,
|
||||
has_alpha ?
|
||||
GIMP_COLOR_AREA_SMALL_CHECKS :
|
||||
GIMP_COLOR_AREA_FLAT);
|
||||
button = gimp_prop_color_button_new (config, property_name,
|
||||
title,
|
||||
PREFS_COLOR_BUTTON_WIDTH,
|
||||
PREFS_COLOR_BUTTON_HEIGHT,
|
||||
has_alpha ?
|
||||
GIMP_COLOR_AREA_SMALL_CHECKS :
|
||||
GIMP_COLOR_AREA_FLAT);
|
||||
|
||||
if (button)
|
||||
{
|
||||
|
|
|
@ -1346,11 +1346,11 @@ prefs_dialog_new (Gimp *gimp,
|
|||
_("Mar_k out of gamut colors"));
|
||||
gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);
|
||||
|
||||
button = gimp_prop_gegl_color_button_new (color_config, "out-of-gamut-color",
|
||||
_("Select Warning Color"),
|
||||
PREFS_COLOR_BUTTON_WIDTH,
|
||||
PREFS_COLOR_BUTTON_HEIGHT,
|
||||
GIMP_COLOR_AREA_FLAT);
|
||||
button = gimp_prop_color_button_new (color_config, "out-of-gamut-color",
|
||||
_("Select Warning Color"),
|
||||
PREFS_COLOR_BUTTON_WIDTH,
|
||||
PREFS_COLOR_BUTTON_HEIGHT,
|
||||
GIMP_COLOR_AREA_FLAT);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
|
||||
|
||||
gimp_color_panel_set_context (GIMP_COLOR_PANEL (button),
|
||||
|
|
|
@ -372,12 +372,12 @@ gimp_prop_widget_new_from_pspec (GObject *config,
|
|||
|
||||
widget = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
|
||||
|
||||
button = gimp_prop_gegl_color_button_new (config, pspec->name,
|
||||
g_param_spec_get_nick (pspec),
|
||||
128, 24,
|
||||
has_alpha ?
|
||||
GIMP_COLOR_AREA_SMALL_CHECKS :
|
||||
GIMP_COLOR_AREA_FLAT);
|
||||
button = gimp_prop_color_button_new (config, pspec->name,
|
||||
g_param_spec_get_nick (pspec),
|
||||
128, 24,
|
||||
has_alpha ?
|
||||
GIMP_COLOR_AREA_SMALL_CHECKS :
|
||||
GIMP_COLOR_AREA_FLAT);
|
||||
gimp_color_button_set_update (GIMP_COLOR_BUTTON (button), TRUE);
|
||||
gimp_color_panel_set_context (GIMP_COLOR_PANEL (button), context);
|
||||
gtk_box_pack_start (GTK_BOX (widget), button, TRUE, TRUE, 0);
|
||||
|
|
|
@ -338,10 +338,10 @@ gimp_foreground_select_options_gui (GimpToolOptions *tool_options)
|
|||
gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, TRUE, 0);
|
||||
|
||||
/* mask color */
|
||||
button = gimp_prop_gegl_color_button_new (config, "mask-color",
|
||||
NULL,
|
||||
128, 24,
|
||||
GIMP_COLOR_AREA_SMALL_CHECKS);
|
||||
button = gimp_prop_color_button_new (config, "mask-color",
|
||||
NULL,
|
||||
128, 24,
|
||||
GIMP_COLOR_AREA_SMALL_CHECKS);
|
||||
gimp_color_panel_set_context (GIMP_COLOR_PANEL (button),
|
||||
GIMP_CONTEXT (config));
|
||||
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
|
||||
|
|
|
@ -842,8 +842,8 @@ gimp_text_options_gui (GimpToolOptions *tool_options)
|
|||
button, 1);
|
||||
gtk_size_group_add_widget (size_group, button);
|
||||
|
||||
button = gimp_prop_gegl_color_button_new (config, "foreground", _("Text Color"),
|
||||
40, 24, GIMP_COLOR_AREA_FLAT);
|
||||
button = gimp_prop_color_button_new (config, "foreground", _("Text Color"),
|
||||
40, 24, GIMP_COLOR_AREA_FLAT);
|
||||
gimp_color_button_set_update (GIMP_COLOR_BUTTON (button), TRUE);
|
||||
gimp_color_panel_set_context (GIMP_COLOR_PANEL (button),
|
||||
GIMP_CONTEXT (options));
|
||||
|
|
|
@ -137,11 +137,11 @@ gimp_fill_editor_constructed (GObject *object)
|
|||
|
||||
if (editor->use_custom_style)
|
||||
{
|
||||
color_button = gimp_prop_gegl_color_button_new (G_OBJECT (editor->options),
|
||||
"foreground",
|
||||
_("Fill Color"),
|
||||
1, 24,
|
||||
GIMP_COLOR_AREA_SMALL_CHECKS);
|
||||
color_button = gimp_prop_color_button_new (G_OBJECT (editor->options),
|
||||
"foreground",
|
||||
_("Fill Color"),
|
||||
1, 24,
|
||||
GIMP_COLOR_AREA_SMALL_CHECKS);
|
||||
gimp_color_panel_set_context (GIMP_COLOR_PANEL (color_button),
|
||||
GIMP_CONTEXT (editor->options));
|
||||
gimp_enum_radio_box_add (GTK_BOX (box), color_button,
|
||||
|
@ -149,21 +149,21 @@ gimp_fill_editor_constructed (GObject *object)
|
|||
}
|
||||
else
|
||||
{
|
||||
color_button = gimp_prop_gegl_color_button_new (G_OBJECT (editor->options),
|
||||
"foreground",
|
||||
_("Fill Color"),
|
||||
1, 24,
|
||||
GIMP_COLOR_AREA_SMALL_CHECKS);
|
||||
color_button = gimp_prop_color_button_new (G_OBJECT (editor->options),
|
||||
"foreground",
|
||||
_("Fill Color"),
|
||||
1, 24,
|
||||
GIMP_COLOR_AREA_SMALL_CHECKS);
|
||||
gimp_color_panel_set_context (GIMP_COLOR_PANEL (color_button),
|
||||
GIMP_CONTEXT (editor->options));
|
||||
gimp_enum_radio_box_add (GTK_BOX (box), color_button,
|
||||
GIMP_FILL_STYLE_FG_COLOR, FALSE);
|
||||
|
||||
color_button = gimp_prop_gegl_color_button_new (G_OBJECT (editor->options),
|
||||
"background",
|
||||
_("Fill BG Color"),
|
||||
1, 24,
|
||||
GIMP_COLOR_AREA_SMALL_CHECKS);
|
||||
color_button = gimp_prop_color_button_new (G_OBJECT (editor->options),
|
||||
"background",
|
||||
_("Fill BG Color"),
|
||||
1, 24,
|
||||
GIMP_COLOR_AREA_SMALL_CHECKS);
|
||||
gimp_color_panel_set_context (GIMP_COLOR_PANEL (color_button),
|
||||
GIMP_CONTEXT (editor->options));
|
||||
gimp_enum_radio_box_add (GTK_BOX (box), color_button,
|
||||
|
|
|
@ -146,11 +146,11 @@ gimp_grid_editor_constructed (GObject *object)
|
|||
_("Line _style:"), 0.0, 0.5,
|
||||
style, 1);
|
||||
|
||||
color_button = gimp_prop_gegl_color_button_new (G_OBJECT (editor->grid), "fgcolor",
|
||||
_("Change grid foreground color"),
|
||||
GRID_EDITOR_COLOR_BUTTON_WIDTH,
|
||||
GRID_EDITOR_COLOR_BUTTON_HEIGHT,
|
||||
GIMP_COLOR_AREA_FLAT);
|
||||
color_button = gimp_prop_color_button_new (G_OBJECT (editor->grid), "fgcolor",
|
||||
_("Change grid foreground color"),
|
||||
GRID_EDITOR_COLOR_BUTTON_WIDTH,
|
||||
GRID_EDITOR_COLOR_BUTTON_HEIGHT,
|
||||
GIMP_COLOR_AREA_FLAT);
|
||||
gtk_widget_set_halign (color_button, GTK_ALIGN_START);
|
||||
gimp_color_panel_set_context (GIMP_COLOR_PANEL (color_button),
|
||||
editor->context);
|
||||
|
@ -158,11 +158,11 @@ gimp_grid_editor_constructed (GObject *object)
|
|||
_("_Foreground color:"), 0.0, 0.5,
|
||||
color_button, 1);
|
||||
|
||||
color_button = gimp_prop_gegl_color_button_new (G_OBJECT (editor->grid), "bgcolor",
|
||||
_("Change grid background color"),
|
||||
GRID_EDITOR_COLOR_BUTTON_WIDTH,
|
||||
GRID_EDITOR_COLOR_BUTTON_HEIGHT,
|
||||
GIMP_COLOR_AREA_FLAT);
|
||||
color_button = gimp_prop_color_button_new (G_OBJECT (editor->grid), "bgcolor",
|
||||
_("Change grid background color"),
|
||||
GRID_EDITOR_COLOR_BUTTON_WIDTH,
|
||||
GRID_EDITOR_COLOR_BUTTON_HEIGHT,
|
||||
GIMP_COLOR_AREA_FLAT);
|
||||
gtk_widget_set_halign (color_button, GTK_ALIGN_START);
|
||||
gimp_color_panel_set_context (GIMP_COLOR_PANEL (color_button),
|
||||
editor->context);
|
||||
|
|
|
@ -337,11 +337,6 @@ gimp_prop_layer_mode_box_new (GObject *config,
|
|||
/* color button */
|
||||
/******************/
|
||||
|
||||
static void gimp_prop_color_button_callback (GtkWidget *widget,
|
||||
GObject *config);
|
||||
static void gimp_prop_color_button_notify (GObject *config,
|
||||
GParamSpec *param_spec,
|
||||
GtkWidget *button);
|
||||
static void gimp_prop_gegl_color_button_callback (GtkWidget *widget,
|
||||
GObject *config);
|
||||
static void gimp_prop_gegl_color_button_notify (GObject *config,
|
||||
|
@ -351,13 +346,13 @@ static void gimp_prop_gegl_color_button_notify (GObject *config,
|
|||
/**
|
||||
* gimp_prop_color_button_new:
|
||||
* @config: #GimpConfig object to which property is attached.
|
||||
* @property_name: Name of #GimpRGB property.
|
||||
* @property_name: Name of #GeglColor property.
|
||||
* @title: Title of the #GimpColorPanel that is to be created
|
||||
* @width: Width of color button.
|
||||
* @height: Height of color button.
|
||||
* @type: How transparency is represented.
|
||||
*
|
||||
* Creates a #GimpColorPanel to set and display the value of a #GimpRGB
|
||||
* Creates a #GimpColorPanel to set and display the value of a #GeglColor
|
||||
* property. Pressing the button brings up a color selector dialog.
|
||||
* If @title is %NULL, the @property_name's nick will be used as label
|
||||
* of the returned widget.
|
||||
|
@ -373,73 +368,6 @@ gimp_prop_color_button_new (GObject *config,
|
|||
gint width,
|
||||
gint height,
|
||||
GimpColorAreaType type)
|
||||
{
|
||||
GParamSpec *param_spec;
|
||||
GtkWidget *button;
|
||||
GeglColor *color;
|
||||
GimpRGB *value;
|
||||
|
||||
param_spec = check_param_spec_w (config, property_name,
|
||||
GIMP_TYPE_PARAM_RGB, G_STRFUNC);
|
||||
if (! param_spec)
|
||||
return NULL;
|
||||
|
||||
if (! title)
|
||||
title = g_param_spec_get_nick (param_spec);
|
||||
|
||||
g_object_get (config,
|
||||
property_name, &value,
|
||||
NULL);
|
||||
|
||||
color = gegl_color_new (NULL);
|
||||
gegl_color_set_pixel (color, babl_format ("R'G'B'A double"), value);
|
||||
button = gimp_color_panel_new (title, color, type, width, height);
|
||||
g_free (value);
|
||||
g_object_unref (color);
|
||||
|
||||
set_param_spec (G_OBJECT (button), button, param_spec);
|
||||
|
||||
g_signal_connect (button, "color-changed",
|
||||
G_CALLBACK (gimp_prop_color_button_callback),
|
||||
config);
|
||||
|
||||
connect_notify (config, property_name,
|
||||
G_CALLBACK (gimp_prop_color_button_notify),
|
||||
button);
|
||||
|
||||
gimp_widget_set_bound_property (button, config, property_name);
|
||||
gtk_widget_show (button);
|
||||
|
||||
return button;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_prop_gegl_color_button_new:
|
||||
* @config: #GimpConfig object to which property is attached.
|
||||
* @property_name: Name of #GeglColor property.
|
||||
* @title: Title of the #GimpColorPanel that is to be created
|
||||
* @width: Width of color button.
|
||||
* @height: Height of color button.
|
||||
* @type: How transparency is represented.
|
||||
*
|
||||
* Creates a #GimpColorPanel to set and display the value of a #GeglColor
|
||||
* property. Pressing the button brings up a color selector dialog.
|
||||
* If @title is %NULL, the @property_name's nick will be used as label
|
||||
* of the returned widget.
|
||||
*
|
||||
* TODO: this is meant to replace completely gimp_prop_color_button_new().
|
||||
*
|
||||
* Returns: A new #GimpColorPanel widget.
|
||||
*
|
||||
* Since GIMP 2.4
|
||||
*/
|
||||
GtkWidget *
|
||||
gimp_prop_gegl_color_button_new (GObject *config,
|
||||
const gchar *property_name,
|
||||
const gchar *title,
|
||||
gint width,
|
||||
gint height,
|
||||
GimpColorAreaType type)
|
||||
{
|
||||
GParamSpec *param_spec;
|
||||
GtkWidget *button;
|
||||
|
@ -476,64 +404,6 @@ gimp_prop_gegl_color_button_new (GObject *config,
|
|||
return button;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_prop_color_button_callback (GtkWidget *button,
|
||||
GObject *config)
|
||||
{
|
||||
GParamSpec *param_spec;
|
||||
GeglColor *color;
|
||||
GimpRGB rgb;
|
||||
|
||||
param_spec = get_param_spec (G_OBJECT (button));
|
||||
if (! param_spec)
|
||||
return;
|
||||
|
||||
color = gimp_color_button_get_color (GIMP_COLOR_BUTTON (button));
|
||||
gegl_color_get_pixel (color, babl_format ("R'G'B'A double"), &rgb);
|
||||
|
||||
g_signal_handlers_block_by_func (config,
|
||||
gimp_prop_color_button_notify,
|
||||
button);
|
||||
|
||||
g_object_set (config,
|
||||
param_spec->name, &rgb,
|
||||
NULL);
|
||||
|
||||
g_signal_handlers_unblock_by_func (config,
|
||||
gimp_prop_color_button_notify,
|
||||
button);
|
||||
|
||||
g_object_unref (color);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_prop_color_button_notify (GObject *config,
|
||||
GParamSpec *param_spec,
|
||||
GtkWidget *button)
|
||||
{
|
||||
GeglColor *color;
|
||||
GimpRGB *rgb;
|
||||
|
||||
g_object_get (config,
|
||||
param_spec->name, &rgb,
|
||||
NULL);
|
||||
|
||||
g_signal_handlers_block_by_func (button,
|
||||
gimp_prop_color_button_callback,
|
||||
config);
|
||||
|
||||
color = gegl_color_new (NULL);
|
||||
gegl_color_set_pixel (color, babl_format ("R'G'B'A double"), rgb);
|
||||
gimp_color_button_set_color (GIMP_COLOR_BUTTON (button), color);
|
||||
|
||||
g_object_unref (color);
|
||||
g_free (rgb);
|
||||
|
||||
g_signal_handlers_unblock_by_func (button,
|
||||
gimp_prop_color_button_callback,
|
||||
config);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_prop_gegl_color_button_callback (GtkWidget *button,
|
||||
GObject *config)
|
||||
|
@ -572,14 +442,14 @@ gimp_prop_gegl_color_button_notify (GObject *config,
|
|||
NULL);
|
||||
|
||||
g_signal_handlers_block_by_func (button,
|
||||
gimp_prop_color_button_callback,
|
||||
gimp_prop_gegl_color_button_callback,
|
||||
config);
|
||||
|
||||
gimp_color_button_set_color (GIMP_COLOR_BUTTON (button), color);
|
||||
g_clear_object (&color);
|
||||
|
||||
g_signal_handlers_unblock_by_func (button,
|
||||
gimp_prop_color_button_callback,
|
||||
gimp_prop_gegl_color_button_callback,
|
||||
config);
|
||||
}
|
||||
|
||||
|
|
|
@ -45,18 +45,9 @@ GtkWidget * gimp_prop_layer_mode_box_new (GObject *config,
|
|||
GimpLayerModeContext context);
|
||||
|
||||
|
||||
/* GimpParamColor */
|
||||
|
||||
GtkWidget * gimp_prop_color_button_new (GObject *config,
|
||||
const gchar *property_name,
|
||||
const gchar *title,
|
||||
gint width,
|
||||
gint height,
|
||||
GimpColorAreaType type);
|
||||
|
||||
/* GeglParamColor */
|
||||
|
||||
GtkWidget * gimp_prop_gegl_color_button_new (GObject *config,
|
||||
GtkWidget * gimp_prop_color_button_new (GObject *config,
|
||||
const gchar *property_name,
|
||||
const gchar *title,
|
||||
gint width,
|
||||
|
|
Loading…
Reference in New Issue