Commit 00c525ab authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

fiddle with the passed channel index only for GRAYA drawables, not for all

2004-01-24  Michael Natterer  <mitch@gimp.org>

	* tools/pdbgen/pdb/color.pdb (levels, curves): fiddle with the
	passed channel index only for GRAYA drawables, not for all GRAY
	drawables. Fixes bug #132322.

	* tools/pdbgen/pdb/color.pdb: regenerated.

	* app/tools/gimpcurvestool.[ch]
	* app/tools/gimplevelstool.[ch]: fixed the same bug here. It never
	occured because the "channel" field was accidentially initialized
	with the correct value and never changed after.
parent 8c622bcd
2004-01-24 Michael Natterer <mitch@gimp.org>
* tools/pdbgen/pdb/color.pdb (levels, curves): fiddle with the
passed channel index only for GRAYA drawables, not for all GRAY
drawables. Fixes bug #132322.
* tools/pdbgen/pdb/color.pdb: regenerated.
* app/tools/gimpcurvestool.[ch]
* app/tools/gimplevelstool.[ch]: fixed the same bug here. It never
occured because the "channel" field was accidentially initialized
with the correct value and never changed after.
2004-01-23 Simon Budig <simon@gimp.org>
* plug-ins/common/mosaic.c: properly use src_rgn.rowstride when
......@@ -231,7 +231,7 @@ levels_invoker (Gimp *gimp,
if (success)
{
/* FIXME: hack */
if (gimp_drawable_is_gray (drawable))
if (gimp_drawable_is_gray (drawable) && gimp_drawable_has_alpha (drawable))
channel = (channel > 1) ? 2 : 1;
lut = gimp_lut_new ();
......@@ -686,7 +686,7 @@ curves_spline_invoker (Gimp *gimp,
if (success)
{
/* FIXME: hack */
if (gimp_drawable_is_gray (drawable))
if (gimp_drawable_is_gray (drawable) && gimp_drawable_has_alpha (drawable))
channel = (channel > 1) ? 2 : 1;
lut = gimp_lut_new ();
......@@ -808,7 +808,7 @@ curves_explicit_invoker (Gimp *gimp,
if (success)
{
/* FIXME: hack */
if (gimp_drawable_is_gray (drawable))
if (gimp_drawable_is_gray (drawable) && gimp_drawable_has_alpha (drawable))
channel = (channel > 1) ? 2 : 1;
lut = gimp_lut_new ();
......
......@@ -312,8 +312,9 @@ gimp_curves_tool_initialize (GimpTool *tool,
curves_init (c_tool->curves);
c_tool->color = gimp_drawable_is_rgb (drawable);
c_tool->channel = GIMP_HISTOGRAM_VALUE;
c_tool->color = gimp_drawable_is_rgb (drawable);
c_tool->alpha = gimp_drawable_has_alpha (drawable);
c_tool->grab_point = -1;
c_tool->last = 0;
......@@ -333,6 +334,9 @@ gimp_curves_tool_initialize (GimpTool *tool,
gimp_int_option_menu_set_history (GTK_OPTION_MENU (c_tool->channel_menu),
c_tool->channel);
if (! c_tool->color && c_tool->alpha)
c_tool->channel = 1;
curves_update (c_tool, ALL);
gimp_drawable_calculate_histogram (drawable, c_tool->hist);
......@@ -797,7 +801,7 @@ curves_channel_callback (GtkWidget *widget,
c_tool->channel);
/* FIXME: hack */
if (! c_tool->color)
if (! c_tool->color && c_tool->alpha)
c_tool->channel = (c_tool->channel > 1) ? 2 : 1;
gimp_int_radio_group_set_active (GTK_RADIO_BUTTON (c_tool->curve_type),
......@@ -828,10 +832,12 @@ curves_set_sensitive_callback (GimpHistogramChannel channel,
{
case GIMP_HISTOGRAM_VALUE:
return TRUE;
case GIMP_HISTOGRAM_RED:
case GIMP_HISTOGRAM_GREEN:
case GIMP_HISTOGRAM_BLUE:
return c_tool->color;
case GIMP_HISTOGRAM_ALPHA:
return gimp_drawable_has_alpha (GIMP_IMAGE_MAP_TOOL (c_tool)->drawable);
}
......
......@@ -42,6 +42,7 @@ struct _GimpCurvesTool
/* dialog */
gboolean color;
gboolean alpha;
GimpHistogramChannel channel;
gint grab_point;
......
......@@ -305,6 +305,7 @@ gimp_levels_tool_initialize (GimpTool *tool,
l_tool->channel = GIMP_HISTOGRAM_VALUE;
l_tool->color = gimp_drawable_is_rgb (drawable);
l_tool->alpha = gimp_drawable_has_alpha (drawable);
if (l_tool->active_picker)
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (l_tool->active_picker),
......@@ -319,7 +320,10 @@ gimp_levels_tool_initialize (GimpTool *tool,
/* set the current selection */
gtk_option_menu_set_history (GTK_OPTION_MENU (l_tool->channel_menu),
l_tool->channel);
l_tool->channel);
if (! l_tool->color && l_tool->alpha)
l_tool->channel = 1;
levels_update (l_tool, ALL);
......@@ -939,7 +943,7 @@ levels_channel_callback (GtkWidget *widget,
l_tool->channel);
/* FIXME: hack */
if (! l_tool->color)
if (! l_tool->color && l_tool->alpha)
l_tool->channel = (l_tool->channel > 1) ? 2 : 1;
levels_update (l_tool, ALL);
......
......@@ -40,6 +40,7 @@ struct _GimpLevelsTool
GimpLut *lut;
gboolean color;
gboolean alpha;
Levels *levels;
/* dialog */
......
......@@ -134,7 +134,7 @@ HELP
if (success)
{
/* FIXME: hack */
if (gimp_drawable_is_gray (drawable))
if (gimp_drawable_is_gray (drawable) && gimp_drawable_has_alpha (drawable))
channel = (channel > 1) ? 2 : 1;
lut = gimp_lut_new ();
......@@ -425,7 +425,7 @@ HELP
if (success)
{
/* FIXME: hack */
if (gimp_drawable_is_gray (drawable))
if (gimp_drawable_is_gray (drawable) && gimp_drawable_has_alpha (drawable))
channel = (channel > 1) ? 2 : 1;
lut = gimp_lut_new ();
......@@ -506,7 +506,7 @@ HELP
if (success)
{
/* FIXME: hack */
if (gimp_drawable_is_gray (drawable))
if (gimp_drawable_is_gray (drawable) && gimp_drawable_has_alpha (drawable))
channel = (channel > 1) ? 2 : 1;
lut = gimp_lut_new ();
......
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