app/tools/gimplevelstool.[ch] remove boolean "color" and "alpha" members
2008-02-04 Michael Natterer <mitch@gimp.org> * app/tools/gimplevelstool.[ch] * app/tools/gimpcurvestool.[ch]: remove boolean "color" and "alpha" members from the tool structs and ask the drawable instead when needed. svn path=/trunk/; revision=24779
This commit is contained in:

committed by
Michael Natterer

parent
96fd65ed40
commit
743dac7d36
@ -1,3 +1,10 @@
|
||||
2008-02-04 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/tools/gimplevelstool.[ch]
|
||||
* app/tools/gimpcurvestool.[ch]: remove boolean "color" and "alpha"
|
||||
members from the tool structs and ask the drawable instead when
|
||||
needed.
|
||||
|
||||
2008-02-04 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/gegl/gimpthresholdconfig.[ch]: add "gboolean color"
|
||||
|
@ -224,9 +224,6 @@ gimp_curves_tool_initialize (GimpTool *tool,
|
||||
if (! c_tool->hist)
|
||||
c_tool->hist = gimp_histogram_new ();
|
||||
|
||||
c_tool->color = gimp_drawable_is_rgb (drawable);
|
||||
c_tool->alpha = gimp_drawable_has_alpha (drawable);
|
||||
|
||||
GIMP_TOOL_CLASS (parent_class)->initialize (tool, display, error);
|
||||
|
||||
/* always pick colors */
|
||||
@ -234,7 +231,7 @@ gimp_curves_tool_initialize (GimpTool *tool,
|
||||
GIMP_COLOR_TOOL_GET_OPTIONS (tool));
|
||||
|
||||
gimp_int_combo_box_set_sensitivity (GIMP_INT_COMBO_BOX (c_tool->channel_menu),
|
||||
curves_menu_sensitivity, c_tool, NULL);
|
||||
curves_menu_sensitivity, drawable, NULL);
|
||||
|
||||
gimp_drawable_calculate_histogram (drawable, c_tool->hist);
|
||||
gimp_histogram_view_set_background (GIMP_HISTOGRAM_VIEW (c_tool->graph),
|
||||
@ -401,15 +398,17 @@ gimp_curves_tool_get_operation (GimpImageMapTool *image_map_tool,
|
||||
static void
|
||||
gimp_curves_tool_map (GimpImageMapTool *image_map_tool)
|
||||
{
|
||||
GimpCurvesTool *tool = GIMP_CURVES_TOOL (image_map_tool);
|
||||
GimpCurvesTool *tool = GIMP_CURVES_TOOL (image_map_tool);
|
||||
GimpDrawable *drawable = image_map_tool->drawable;
|
||||
Curves curves;
|
||||
|
||||
gimp_curves_config_to_cruft (tool->config, &curves, tool->color);
|
||||
gimp_curves_config_to_cruft (tool->config, &curves,
|
||||
gimp_drawable_is_rgb (drawable));
|
||||
|
||||
gimp_lut_setup (tool->lut,
|
||||
(GimpLutFunc) curves_lut_func,
|
||||
&curves,
|
||||
gimp_drawable_bytes (image_map_tool->drawable));
|
||||
gimp_drawable_bytes (drawable));
|
||||
}
|
||||
|
||||
|
||||
@ -716,8 +715,8 @@ static gboolean
|
||||
curves_menu_sensitivity (gint value,
|
||||
gpointer data)
|
||||
{
|
||||
GimpCurvesTool *tool = GIMP_CURVES_TOOL (data);
|
||||
GimpHistogramChannel channel = value;
|
||||
GimpDrawable *drawable = GIMP_DRAWABLE (data);
|
||||
GimpHistogramChannel channel = value;
|
||||
|
||||
switch (channel)
|
||||
{
|
||||
@ -727,10 +726,10 @@ curves_menu_sensitivity (gint value,
|
||||
case GIMP_HISTOGRAM_RED:
|
||||
case GIMP_HISTOGRAM_GREEN:
|
||||
case GIMP_HISTOGRAM_BLUE:
|
||||
return tool->color;
|
||||
return gimp_drawable_is_rgb (drawable);
|
||||
|
||||
case GIMP_HISTOGRAM_ALPHA:
|
||||
return tool->alpha;
|
||||
return gimp_drawable_has_alpha (drawable);
|
||||
|
||||
case GIMP_HISTOGRAM_RGB:
|
||||
return FALSE;
|
||||
|
@ -41,13 +41,10 @@ struct _GimpCurvesTool
|
||||
GimpLut *lut;
|
||||
|
||||
/* dialog */
|
||||
gboolean color;
|
||||
gboolean alpha;
|
||||
GimpHistogram *hist;
|
||||
|
||||
gint col_value[5];
|
||||
|
||||
GimpHistogram *hist;
|
||||
|
||||
GtkWidget *channel_menu;
|
||||
GtkWidget *xrange;
|
||||
GtkWidget *yrange;
|
||||
|
@ -223,9 +223,6 @@ gimp_levels_tool_initialize (GimpTool *tool,
|
||||
if (! l_tool->hist)
|
||||
l_tool->hist = gimp_histogram_new ();
|
||||
|
||||
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),
|
||||
FALSE);
|
||||
@ -233,7 +230,7 @@ gimp_levels_tool_initialize (GimpTool *tool,
|
||||
GIMP_TOOL_CLASS (parent_class)->initialize (tool, display, error);
|
||||
|
||||
gimp_int_combo_box_set_sensitivity (GIMP_INT_COMBO_BOX (l_tool->channel_menu),
|
||||
levels_menu_sensitivity, l_tool, NULL);
|
||||
levels_menu_sensitivity, drawable, NULL);
|
||||
|
||||
gimp_drawable_calculate_histogram (drawable, l_tool->hist);
|
||||
gimp_histogram_view_set_histogram (GIMP_HISTOGRAM_VIEW (l_tool->hist_view),
|
||||
@ -271,15 +268,17 @@ gimp_levels_tool_get_operation (GimpImageMapTool *im_tool,
|
||||
static void
|
||||
gimp_levels_tool_map (GimpImageMapTool *image_map_tool)
|
||||
{
|
||||
GimpLevelsTool *tool = GIMP_LEVELS_TOOL (image_map_tool);
|
||||
GimpLevelsTool *tool = GIMP_LEVELS_TOOL (image_map_tool);
|
||||
GimpDrawable *drawable = image_map_tool->drawable;
|
||||
Levels levels;
|
||||
|
||||
gimp_levels_config_to_cruft (tool->config, &levels, tool->color);
|
||||
gimp_levels_config_to_cruft (tool->config, &levels,
|
||||
gimp_drawable_is_rgb (drawable));
|
||||
|
||||
gimp_lut_setup (tool->lut,
|
||||
(GimpLutFunc) levels_lut_func,
|
||||
&levels,
|
||||
gimp_drawable_bytes (image_map_tool->drawable));
|
||||
gimp_drawable_bytes (drawable));
|
||||
}
|
||||
|
||||
|
||||
@ -865,8 +864,8 @@ static gboolean
|
||||
levels_menu_sensitivity (gint value,
|
||||
gpointer data)
|
||||
{
|
||||
GimpLevelsTool *tool = GIMP_LEVELS_TOOL (data);
|
||||
GimpHistogramChannel channel = value;
|
||||
GimpDrawable *drawable = GIMP_DRAWABLE (data);
|
||||
GimpHistogramChannel channel = value;
|
||||
|
||||
switch (channel)
|
||||
{
|
||||
@ -876,10 +875,10 @@ levels_menu_sensitivity (gint value,
|
||||
case GIMP_HISTOGRAM_RED:
|
||||
case GIMP_HISTOGRAM_GREEN:
|
||||
case GIMP_HISTOGRAM_BLUE:
|
||||
return tool->color;
|
||||
return gimp_drawable_is_rgb (drawable);
|
||||
|
||||
case GIMP_HISTOGRAM_ALPHA:
|
||||
return tool->alpha;
|
||||
return gimp_drawable_has_alpha (drawable);
|
||||
|
||||
case GIMP_HISTOGRAM_RGB:
|
||||
return FALSE;
|
||||
@ -892,7 +891,10 @@ static void
|
||||
levels_stretch_callback (GtkWidget *widget,
|
||||
GimpLevelsTool *tool)
|
||||
{
|
||||
gimp_levels_config_stretch (tool->config, tool->hist, tool->color);
|
||||
GimpDrawable *drawable = GIMP_IMAGE_MAP_TOOL (tool)->drawable;
|
||||
|
||||
gimp_levels_config_stretch (tool->config, tool->hist,
|
||||
gimp_drawable_is_rgb (drawable));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -42,9 +42,6 @@ struct _GimpLevelsTool
|
||||
GimpLut *lut;
|
||||
|
||||
/* dialog */
|
||||
gboolean color;
|
||||
gboolean alpha;
|
||||
|
||||
GimpHistogram *hist;
|
||||
|
||||
GtkWidget *channel_menu;
|
||||
|
Reference in New Issue
Block a user