Commit 014cd08c authored by Michael Natterer's avatar Michael Natterer 😴

Bug 750953 - The Curves dialog should present per channel lines...

...when opened by the "Edit these settings as Curves" button on the
Levels dialog

The code to configure the entire GUI correctly was not even called
when initially creating the curves dialog (the color bars probably
looked right just because of default values of their own).

Factor out gimp_curves_tool_update_channel() which properly updates
the GUI. Call it after the dialog has been created, and when the
active channel changes.
parent affef350
......@@ -103,6 +103,7 @@ static void gimp_curves_tool_export_setup (GimpSettingsBox *setting
GtkFileChooserDialog *dialog,
gboolean export,
GimpCurvesTool *tool);
static void gimp_curves_tool_update_channel (GimpCurvesTool *tool);
static void gimp_curves_tool_config_notify (GObject *object,
GParamSpec *pspec,
GimpCurvesTool *tool);
......@@ -493,9 +494,6 @@ gimp_curves_tool_dialog (GimpImageMapTool *image_map_tool)
"border-width", RADIUS,
"subdivisions", 1,
NULL);
gimp_curve_view_set_curve (GIMP_CURVE_VIEW (tool->graph),
config->curve[config->channel],
curves_get_channel_color (config->channel));
gtk_container_add (GTK_CONTAINER (frame), tool->graph);
gtk_widget_show (tool->graph);
......@@ -547,6 +545,8 @@ gimp_curves_tool_dialog (GimpImageMapTool *image_map_tool)
gtk_widget_show (combo);
gtk_label_set_mnemonic_widget (GTK_LABEL (label), combo);
gimp_curves_tool_update_channel (tool);
}
static void
......@@ -650,82 +650,90 @@ gimp_curves_tool_export_setup (GimpSettingsBox *settings_box,
}
static void
gimp_curves_tool_config_notify (GObject *object,
GParamSpec *pspec,
GimpCurvesTool *tool)
gimp_curves_tool_update_channel (GimpCurvesTool *tool)
{
GimpCurvesConfig *config = GIMP_CURVES_CONFIG (object);
GimpCurve *curve = config->curve[config->channel];
GimpCurvesConfig *config = GIMP_CURVES_TOOL (tool)->config;
GimpCurve *curve = config->curve[config->channel];
GimpHistogramChannel channel;
if (! tool->xrange)
return;
gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (tool->channel_menu),
config->channel);
if (! strcmp (pspec->name, "channel"))
switch (config->channel)
{
GimpHistogramChannel channel;
guchar r[256];
guchar g[256];
guchar b[256];
gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (tool->channel_menu),
config->channel);
case GIMP_HISTOGRAM_VALUE:
case GIMP_HISTOGRAM_ALPHA:
case GIMP_HISTOGRAM_RGB:
gimp_curve_get_uchar (curve, sizeof (r), r);
switch (config->channel)
{
guchar r[256];
guchar g[256];
guchar b[256];
case GIMP_HISTOGRAM_VALUE:
case GIMP_HISTOGRAM_ALPHA:
case GIMP_HISTOGRAM_RGB:
gimp_curve_get_uchar (curve, sizeof (r), r);
gimp_color_bar_set_buffers (GIMP_COLOR_BAR (tool->xrange),
r, r, r);
break;
case GIMP_HISTOGRAM_RED:
case GIMP_HISTOGRAM_GREEN:
case GIMP_HISTOGRAM_BLUE:
gimp_curve_get_uchar (config->curve[GIMP_HISTOGRAM_RED],
sizeof (r), r);
gimp_curve_get_uchar (config->curve[GIMP_HISTOGRAM_GREEN],
sizeof (g), g);
gimp_curve_get_uchar (config->curve[GIMP_HISTOGRAM_BLUE],
sizeof (b), b);
gimp_color_bar_set_buffers (GIMP_COLOR_BAR (tool->xrange),
r, g, b);
break;
}
gimp_color_bar_set_buffers (GIMP_COLOR_BAR (tool->xrange),
r, r, r);
break;
case GIMP_HISTOGRAM_RED:
case GIMP_HISTOGRAM_GREEN:
case GIMP_HISTOGRAM_BLUE:
gimp_curve_get_uchar (config->curve[GIMP_HISTOGRAM_RED],
sizeof (r), r);
gimp_curve_get_uchar (config->curve[GIMP_HISTOGRAM_GREEN],
sizeof (g), g);
gimp_curve_get_uchar (config->curve[GIMP_HISTOGRAM_BLUE],
sizeof (b), b);
gimp_color_bar_set_buffers (GIMP_COLOR_BAR (tool->xrange),
r, g, b);
break;
}
gimp_histogram_view_set_channel (GIMP_HISTOGRAM_VIEW (tool->graph),
config->channel);
gimp_curve_view_set_xpos (GIMP_CURVE_VIEW (tool->graph),
tool->picked_color[config->channel]);
gimp_histogram_view_set_channel (GIMP_HISTOGRAM_VIEW (tool->graph),
config->channel);
gimp_curve_view_set_xpos (GIMP_CURVE_VIEW (tool->graph),
tool->picked_color[config->channel]);
gimp_color_bar_set_channel (GIMP_COLOR_BAR (tool->yrange),
config->channel);
gimp_color_bar_set_channel (GIMP_COLOR_BAR (tool->yrange),
config->channel);
gimp_curve_view_remove_all_backgrounds (GIMP_CURVE_VIEW (tool->graph));
gimp_curve_view_remove_all_backgrounds (GIMP_CURVE_VIEW (tool->graph));
for (channel = GIMP_HISTOGRAM_VALUE;
channel <= GIMP_HISTOGRAM_ALPHA;
channel++)
for (channel = GIMP_HISTOGRAM_VALUE;
channel <= GIMP_HISTOGRAM_ALPHA;
channel++)
{
if (channel == config->channel)
{
gimp_curve_view_set_curve (GIMP_CURVE_VIEW (tool->graph), curve,
curves_get_channel_color (channel));
}
else
{
if (channel == config->channel)
{
gimp_curve_view_set_curve (GIMP_CURVE_VIEW (tool->graph), curve,
curves_get_channel_color (channel));
}
else
{
gimp_curve_view_add_background (GIMP_CURVE_VIEW (tool->graph),
config->curve[channel],
curves_get_channel_color (channel));
}
gimp_curve_view_add_background (GIMP_CURVE_VIEW (tool->graph),
config->curve[channel],
curves_get_channel_color (channel));
}
}
gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (tool->curve_type),
curve->curve_type);
gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (tool->curve_type),
curve->curve_type);
}
static void
gimp_curves_tool_config_notify (GObject *object,
GParamSpec *pspec,
GimpCurvesTool *tool)
{
GimpCurvesConfig *config = GIMP_CURVES_CONFIG (object);
GimpCurve *curve = config->curve[config->channel];
if (! tool->xrange)
return;
if (! strcmp (pspec->name, "channel"))
{
gimp_curves_tool_update_channel (GIMP_CURVES_TOOL (tool));
}
else if (! strcmp (pspec->name, "curve"))
{
......
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