Commit 90c967a3 authored by Michael Natterer's avatar Michael Natterer 😴

Bug 737008 - Curve color always black

Don't hardcode "black" for the "Value" curve in GimpCurvesTool.
Instead, pass a NULL color to GimpCurveView, which is then interpreted
as the theme's text color (the curve's background is the theme's text
background color). We still hardcode pure red, green and blue for the
other curves.
parent c491b4f6
......@@ -118,20 +118,13 @@ static gboolean curves_menu_sensitivity (gint value,
static void curves_curve_type_callback (GtkWidget *widget,
GimpCurvesTool *tool);
static const GimpRGB * curves_get_channel_color (GimpHistogramChannel channel);
G_DEFINE_TYPE (GimpCurvesTool, gimp_curves_tool, GIMP_TYPE_IMAGE_MAP_TOOL)
#define parent_class gimp_curves_tool_parent_class
static GimpRGB channel_colors[GIMP_HISTOGRAM_RGB] =
{
{ 0.0, 0.0, 0.0, 1.0 },
{ 1.0, 0.0, 0.0, 1.0 },
{ 0.0, 1.0, 0.0, 1.0 },
{ 0.0, 0.0, 1.0, 1.0 },
{ 0.5, 0.5, 0.5, 1.0 }
};
/* public functions */
......@@ -502,7 +495,7 @@ gimp_curves_tool_dialog (GimpImageMapTool *image_map_tool)
NULL);
gimp_curve_view_set_curve (GIMP_CURVE_VIEW (tool->graph),
config->curve[config->channel],
&channel_colors[config->channel]);
curves_get_channel_color (config->channel));
gtk_container_add (GTK_CONTAINER (frame), tool->graph);
gtk_widget_show (tool->graph);
......@@ -721,13 +714,13 @@ gimp_curves_tool_config_notify (GObject *object,
if (channel == config->channel)
{
gimp_curve_view_set_curve (GIMP_CURVE_VIEW (tool->graph), curve,
&channel_colors[channel]);
curves_get_channel_color (channel));
}
else
{
gimp_curve_view_add_background (GIMP_CURVE_VIEW (tool->graph),
config->curve[channel],
&channel_colors[channel]);
curves_get_channel_color (channel));
}
}
......@@ -806,3 +799,21 @@ curves_curve_type_callback (GtkWidget *widget,
gimp_curve_set_curve_type (config->curve[config->channel], curve_type);
}
}
static const GimpRGB *
curves_get_channel_color (GimpHistogramChannel channel)
{
static const GimpRGB channel_colors[GIMP_HISTOGRAM_RGB] =
{
{ 0.0, 0.0, 0.0, 1.0 },
{ 1.0, 0.0, 0.0, 1.0 },
{ 0.0, 1.0, 0.0, 1.0 },
{ 0.0, 0.0, 1.0, 1.0 },
{ 0.5, 0.5, 0.5, 1.0 }
};
if (channel == GIMP_HISTOGRAM_VALUE)
return NULL;
return &channel_colors[channel];
}
......@@ -63,6 +63,7 @@ typedef struct
{
GimpCurve *curve;
GimpRGB color;
gboolean color_set;
} BGCurve;
......@@ -586,11 +587,22 @@ gimp_curve_view_expose (GtkWidget *widget,
{
BGCurve *bg = list->data;
cairo_set_source_rgba (cr,
bg->color.r,
bg->color.g,
bg->color.b,
0.5);
if (bg->color_set)
{
cairo_set_source_rgba (cr,
bg->color.r,
bg->color.g,
bg->color.b,
0.5);
}
else
{
cairo_set_source_rgba (cr,
style->text[GTK_STATE_NORMAL].red / 65535.0,
style->text[GTK_STATE_NORMAL].green / 65535.0,
style->text[GTK_STATE_NORMAL].blue / 65535.0,
0.5);
}
gimp_curve_view_draw_curve (view, cr, bg->curve,
width, height, border);
......@@ -1255,7 +1267,6 @@ gimp_curve_view_add_background (GimpCurveView *view,
g_return_if_fail (GIMP_IS_CURVE_VIEW (view));
g_return_if_fail (GIMP_IS_CURVE (curve));
g_return_if_fail (color != NULL);
for (list = view->bg_curves; list; list = g_list_next (list))
{
......@@ -1267,7 +1278,12 @@ gimp_curve_view_add_background (GimpCurveView *view,
bg = g_slice_new0 (BGCurve);
bg->curve = g_object_ref (curve);
bg->color = *color;
if (color)
{
bg->color = *color;
bg->color_set = TRUE;
}
g_signal_connect (bg->curve, "dirty",
G_CALLBACK (gimp_curve_view_curve_dirty),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment