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.
This commit is contained in:
Michael Natterer 2015-06-15 00:11:13 +02:00
parent affef350e7
commit 014cd08c5c
1 changed files with 75 additions and 67 deletions

View File

@ -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,18 +650,10 @@ 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);
GimpCurvesConfig *config = GIMP_CURVES_TOOL (tool)->config;
GimpCurve *curve = config->curve[config->channel];
if (! tool->xrange)
return;
if (! strcmp (pspec->name, "channel"))
{
GimpHistogramChannel channel;
gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (tool->channel_menu),
@ -727,6 +719,22 @@ gimp_curves_tool_config_notify (GObject *object,
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"))
{
gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (tool->curve_type),