mirror of https://github.com/GNOME/gimp.git
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:
parent
affef350e7
commit
014cd08c5c
|
@ -103,6 +103,7 @@ static void gimp_curves_tool_export_setup (GimpSettingsBox *setting
|
||||||
GtkFileChooserDialog *dialog,
|
GtkFileChooserDialog *dialog,
|
||||||
gboolean export,
|
gboolean export,
|
||||||
GimpCurvesTool *tool);
|
GimpCurvesTool *tool);
|
||||||
|
static void gimp_curves_tool_update_channel (GimpCurvesTool *tool);
|
||||||
static void gimp_curves_tool_config_notify (GObject *object,
|
static void gimp_curves_tool_config_notify (GObject *object,
|
||||||
GParamSpec *pspec,
|
GParamSpec *pspec,
|
||||||
GimpCurvesTool *tool);
|
GimpCurvesTool *tool);
|
||||||
|
@ -493,9 +494,6 @@ gimp_curves_tool_dialog (GimpImageMapTool *image_map_tool)
|
||||||
"border-width", RADIUS,
|
"border-width", RADIUS,
|
||||||
"subdivisions", 1,
|
"subdivisions", 1,
|
||||||
NULL);
|
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_container_add (GTK_CONTAINER (frame), tool->graph);
|
||||||
gtk_widget_show (tool->graph);
|
gtk_widget_show (tool->graph);
|
||||||
|
|
||||||
|
@ -547,6 +545,8 @@ gimp_curves_tool_dialog (GimpImageMapTool *image_map_tool)
|
||||||
gtk_widget_show (combo);
|
gtk_widget_show (combo);
|
||||||
|
|
||||||
gtk_label_set_mnemonic_widget (GTK_LABEL (label), combo);
|
gtk_label_set_mnemonic_widget (GTK_LABEL (label), combo);
|
||||||
|
|
||||||
|
gimp_curves_tool_update_channel (tool);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -649,6 +649,77 @@ gimp_curves_tool_export_setup (GimpSettingsBox *settings_box,
|
||||||
&tool->export_old_format);
|
&tool->export_old_format);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_curves_tool_update_channel (GimpCurvesTool *tool)
|
||||||
|
{
|
||||||
|
GimpCurvesConfig *config = GIMP_CURVES_TOOL (tool)->config;
|
||||||
|
GimpCurve *curve = config->curve[config->channel];
|
||||||
|
GimpHistogramChannel channel;
|
||||||
|
|
||||||
|
gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (tool->channel_menu),
|
||||||
|
config->channel);
|
||||||
|
|
||||||
|
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_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_curve_view_remove_all_backgrounds (GIMP_CURVE_VIEW (tool->graph));
|
||||||
|
|
||||||
|
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
|
||||||
|
{
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gimp_curves_tool_config_notify (GObject *object,
|
gimp_curves_tool_config_notify (GObject *object,
|
||||||
GParamSpec *pspec,
|
GParamSpec *pspec,
|
||||||
|
@ -662,70 +733,7 @@ gimp_curves_tool_config_notify (GObject *object,
|
||||||
|
|
||||||
if (! strcmp (pspec->name, "channel"))
|
if (! strcmp (pspec->name, "channel"))
|
||||||
{
|
{
|
||||||
GimpHistogramChannel channel;
|
gimp_curves_tool_update_channel (GIMP_CURVES_TOOL (tool));
|
||||||
|
|
||||||
gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (tool->channel_menu),
|
|
||||||
config->channel);
|
|
||||||
|
|
||||||
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_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_curve_view_remove_all_backgrounds (GIMP_CURVE_VIEW (tool->graph));
|
|
||||||
|
|
||||||
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
|
|
||||||
{
|
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
else if (! strcmp (pspec->name, "curve"))
|
else if (! strcmp (pspec->name, "curve"))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue