Commit 94cf84b2 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

app/tools/gimpcurvestool.c replaced lots of "gpointer data" parameters of

2002-12-18  Michael Natterer  <mitch@gimp.org>

	* app/tools/gimpcurvestool.c
	* app/tools/gimplevelstool.c: replaced lots of "gpointer data"
	parameters of local callbacks by GimpCurvesTool* and
	GimpLevelsTool* pointers. Makes the code shorter and more
	readable. Some random cleanup.

	* app/tools/gimphistogramtool.c: fixed type of "parent_class"
	pointer.
parent 1e73e219
2002-12-18 Michael Natterer <mitch@gimp.org>
* app/tools/gimpcurvestool.c
* app/tools/gimplevelstool.c: replaced lots of "gpointer data"
parameters of local callbacks by GimpCurvesTool* and
GimpLevelsTool* pointers. Makes the code shorter and more
readable. Some random cleanup.
* app/tools/gimphistogramtool.c: fixed type of "parent_class"
pointer.
2002-12-18 Michael Natterer <mitch@gimp.org>
* app/display/gimpdisplayshell.c (gimp_display_shell_new): fixed
......
......@@ -129,21 +129,21 @@ static void curves_update (GimpCurvesTool *c_tool,
gint update);
static void curves_channel_callback (GtkWidget *widget,
gpointer data);
GimpCurvesTool *c_tool);
static void curves_channel_reset_callback (GtkWidget *widget,
gpointer data);
GimpCurvesTool *c_tool);
static gboolean curves_set_sensitive_callback (gpointer item_data,
GimpCurvesTool *c_tool);
static void curves_smooth_callback (GtkWidget *widget,
gpointer data);
GimpCurvesTool *c_tool);
static void curves_free_callback (GtkWidget *widget,
gpointer data);
GimpCurvesTool *c_tool);
static void curves_load_callback (GtkWidget *widget,
gpointer data);
GimpCurvesTool *c_tool);
static void curves_save_callback (GtkWidget *widget,
gpointer data);
GimpCurvesTool *c_tool);
static gint curves_graph_events (GtkWidget *widget,
GdkEvent *event,
GimpCurvesTool *c_tool);
......@@ -243,7 +243,7 @@ gimp_curves_tool_init (GimpCurvesTool *c_tool)
image_map_tool = GIMP_IMAGE_MAP_TOOL (c_tool);
image_map_tool->shell_desc = _("Adjust Color Curves");
image_map_tool->shell_desc = _("Adjust Color Curves");
c_tool->curves = g_new0 (Curves, 1);
c_tool->lut = gimp_lut_new ();
......@@ -251,11 +251,8 @@ gimp_curves_tool_init (GimpCurvesTool *c_tool)
curves_init (c_tool->curves);
for (i = 0;
i < (sizeof (c_tool->col_value) / sizeof (c_tool->col_value[0]));
i++)
for (i = 0; i < G_N_ELEMENTS (c_tool->col_value); i++)
c_tool->col_value[i] = -1;
}
static void
......@@ -267,7 +264,7 @@ gimp_curves_tool_finalize (GObject *object)
if (c_tool->curves)
{
g_free(c_tool->curves);
g_free (c_tool->curves);
c_tool->curves = NULL;
}
......@@ -1029,13 +1026,9 @@ curves_update (GimpCurvesTool *c_tool,
}
static void
curves_channel_callback (GtkWidget *widget,
gpointer data)
curves_channel_callback (GtkWidget *widget,
GimpCurvesTool *c_tool)
{
GimpCurvesTool *c_tool;
c_tool = GIMP_CURVES_TOOL (data);
gimp_menu_item_update (widget, &c_tool->channel);
if (! c_tool->color)
......@@ -1053,13 +1046,9 @@ curves_channel_callback (GtkWidget *widget,
}
static void
curves_channel_reset_callback (GtkWidget *widget,
gpointer data)
curves_channel_reset_callback (GtkWidget *widget,
GimpCurvesTool *c_tool)
{
GimpCurvesTool *c_tool;
c_tool = GIMP_CURVES_TOOL (data);
c_tool->grab_point = -1;
curves_channel_reset (c_tool->curves, c_tool->channel);
......@@ -1091,17 +1080,14 @@ curves_set_sensitive_callback (gpointer item_data,
}
static void
curves_smooth_callback (GtkWidget *widget,
gpointer data)
curves_smooth_callback (GtkWidget *widget,
GimpCurvesTool *c_tool)
{
GimpCurvesTool *c_tool;
gint i;
gint32 index;
c_tool = GIMP_CURVES_TOOL (data);
if (c_tool->curves->curve_type[c_tool->channel] != CURVES_SMOOTH)
{
gint i;
gint32 index;
c_tool->curves->curve_type[c_tool->channel] = CURVES_SMOOTH;
/* pick representative points from the curve
......@@ -1123,13 +1109,9 @@ curves_smooth_callback (GtkWidget *widget,
}
static void
curves_free_callback (GtkWidget *widget,
gpointer data)
curves_free_callback (GtkWidget *widget,
GimpCurvesTool *c_tool)
{
GimpCurvesTool *c_tool;
c_tool = GIMP_CURVES_TOOL (data);
if (c_tool->curves->curve_type[c_tool->channel] != CURVES_FREE)
{
c_tool->curves->curve_type[c_tool->channel] = CURVES_FREE;
......@@ -1350,13 +1332,9 @@ curves_graph_events (GtkWidget *widget,
}
static void
curves_load_callback (GtkWidget *widget,
gpointer data)
curves_load_callback (GtkWidget *widget,
GimpCurvesTool *c_tool)
{
GimpCurvesTool *c_tool;
c_tool = GIMP_CURVES_TOOL (data);
if (! c_tool->file_dialog)
file_dialog_create (c_tool);
else if (GTK_WIDGET_VISIBLE (c_tool->file_dialog))
......@@ -1369,13 +1347,9 @@ curves_load_callback (GtkWidget *widget,
}
static void
curves_save_callback (GtkWidget *widget,
gpointer data)
curves_save_callback (GtkWidget *widget,
GimpCurvesTool *c_tool)
{
GimpCurvesTool *c_tool;
c_tool = GIMP_CURVES_TOOL (data);
if (! c_tool->file_dialog)
file_dialog_create (c_tool);
else if (GTK_WIDGET_VISIBLE (c_tool->file_dialog))
......
......@@ -104,7 +104,7 @@ static void histogram_tool_histogram_range (GimpHistogramView *view,
static HistogramToolDialog * histogram_dialog = NULL;
static GimpToolClass *parent_class = NULL;
static GimpImageMapToolClass *parent_class = NULL;
/* public functions */
......
......@@ -101,29 +101,29 @@ static void gimp_levels_tool_reset (GimpImageMapTool *image_map_tool);
static void levels_update (GimpLevelsTool *l_tool,
gint update);
static void levels_channel_callback (GtkWidget *widget,
gpointer data);
GimpLevelsTool *l_tool);
static void levels_channel_reset_callback (GtkWidget *widget,
gpointer data);
GimpLevelsTool *l_tool);
static gboolean levels_set_sensitive_callback (gpointer item_data,
GimpLevelsTool *l_tool);
static void levels_auto_callback (GtkWidget *widget,
gpointer data);
GimpLevelsTool *l_tool);
static void levels_load_callback (GtkWidget *widget,
gpointer data);
GimpLevelsTool *l_tool);
static void levels_save_callback (GtkWidget *widget,
gpointer data);
GimpLevelsTool *l_tool);
static void levels_low_input_adjustment_update (GtkAdjustment *adjustment,
gpointer data);
GimpLevelsTool *l_tool);
static void levels_gamma_adjustment_update (GtkAdjustment *adjustment,
gpointer data);
GimpLevelsTool *l_tool);
static void levels_high_input_adjustment_update (GtkAdjustment *adjustment,
gpointer data);
GimpLevelsTool *l_tool);
static void levels_low_output_adjustment_update (GtkAdjustment *adjustment,
gpointer data);
GimpLevelsTool *l_tool);
static void levels_high_output_adjustment_update (GtkAdjustment *adjustment,
gpointer data);
GimpLevelsTool *l_tool);
static void levels_input_picker_toggled (GtkWidget *widget,
gpointer data);
GimpLevelsTool *l_tool);
static gint levels_input_da_events (GtkWidget *widget,
GdkEvent *event,
GimpLevelsTool *l_tool);
......@@ -925,13 +925,9 @@ levels_update (GimpLevelsTool *l_tool,
}
static void
levels_channel_callback (GtkWidget *widget,
gpointer data)
levels_channel_callback (GtkWidget *widget,
GimpLevelsTool *l_tool)
{
GimpLevelsTool *l_tool;
l_tool = GIMP_LEVELS_TOOL (data);
gimp_menu_item_update (widget, &l_tool->channel);
if (l_tool->color)
......@@ -950,13 +946,9 @@ levels_channel_callback (GtkWidget *widget,
}
static void
levels_channel_reset_callback (GtkWidget *widget,
gpointer data)
levels_channel_reset_callback (GtkWidget *widget,
GimpLevelsTool *l_tool)
{
GimpLevelsTool *l_tool;
l_tool = GIMP_LEVELS_TOOL (data);
levels_channel_reset (l_tool->levels, l_tool->channel);
levels_update (l_tool, ALL);
......@@ -987,13 +979,9 @@ levels_set_sensitive_callback (gpointer item_data,
}
static void
levels_auto_callback (GtkWidget *widget,
gpointer data)
levels_auto_callback (GtkWidget *widget,
GimpLevelsTool *l_tool)
{
GimpLevelsTool *l_tool;
l_tool = GIMP_LEVELS_TOOL (data);
levels_auto (l_tool->levels, l_tool->hist, l_tool->color);
levels_update (l_tool, ALL);
......@@ -1001,13 +989,10 @@ levels_auto_callback (GtkWidget *widget,
}
static void
levels_low_input_adjustment_update (GtkAdjustment *adjustment,
gpointer data)
levels_low_input_adjustment_update (GtkAdjustment *adjustment,
GimpLevelsTool *l_tool)
{
GimpLevelsTool *l_tool;
gint value;
l_tool = GIMP_LEVELS_TOOL (data);
gint value;
value = (gint) (adjustment->value + 0.5);
value = CLAMP (value, 0, l_tool->levels->high_input[l_tool->channel]);
......@@ -1025,13 +1010,9 @@ levels_low_input_adjustment_update (GtkAdjustment *adjustment,
}
static void
levels_gamma_adjustment_update (GtkAdjustment *adjustment,
gpointer data)
levels_gamma_adjustment_update (GtkAdjustment *adjustment,
GimpLevelsTool *l_tool)
{
GimpLevelsTool *l_tool;
l_tool = GIMP_LEVELS_TOOL (data);
if (l_tool->levels->gamma[l_tool->channel] != adjustment->value)
{
l_tool->levels->gamma[l_tool->channel] = adjustment->value;
......@@ -1042,13 +1023,10 @@ levels_gamma_adjustment_update (GtkAdjustment *adjustment,
}
static void
levels_high_input_adjustment_update (GtkAdjustment *adjustment,
gpointer data)
levels_high_input_adjustment_update (GtkAdjustment *adjustment,
GimpLevelsTool *l_tool)
{
GimpLevelsTool *l_tool;
gint value;
l_tool = GIMP_LEVELS_TOOL (data);
gint value;
value = (gint) (adjustment->value + 0.5);
value = CLAMP (value, l_tool->levels->low_input[l_tool->channel], 255);
......@@ -1066,13 +1044,10 @@ levels_high_input_adjustment_update (GtkAdjustment *adjustment,
}
static void
levels_low_output_adjustment_update (GtkAdjustment *adjustment,
gpointer data)
levels_low_output_adjustment_update (GtkAdjustment *adjustment,
GimpLevelsTool *l_tool)
{
GimpLevelsTool *l_tool;
gint value;
l_tool = GIMP_LEVELS_TOOL (data);
gint value;
value = (gint) (adjustment->value + 0.5);
......@@ -1086,13 +1061,10 @@ levels_low_output_adjustment_update (GtkAdjustment *adjustment,
}
static void
levels_high_output_adjustment_update (GtkAdjustment *adjustment,
gpointer data)
levels_high_output_adjustment_update (GtkAdjustment *adjustment,
GimpLevelsTool *l_tool)
{
GimpLevelsTool *l_tool;
gint value;
l_tool = GIMP_LEVELS_TOOL (data);
gint value;
value = (gint) (adjustment->value + 0.5);
......@@ -1106,11 +1078,9 @@ levels_high_output_adjustment_update (GtkAdjustment *adjustment,
}
static void
levels_input_picker_toggled (GtkWidget *widget,
gpointer data)
levels_input_picker_toggled (GtkWidget *widget,
GimpLevelsTool *l_tool)
{
GimpLevelsTool *l_tool = GIMP_LEVELS_TOOL (data);
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)))
{
if (l_tool->active_picker == widget)
......@@ -1321,13 +1291,9 @@ levels_output_da_events (GtkWidget *widget,
}
static void
levels_load_callback (GtkWidget *widget,
gpointer data)
levels_load_callback (GtkWidget *widget,
GimpLevelsTool *l_tool)
{
GimpLevelsTool *l_tool;
l_tool = GIMP_LEVELS_TOOL (data);
if (! l_tool->file_dialog)
file_dialog_create (l_tool);
else if (GTK_WIDGET_VISIBLE (l_tool->file_dialog))
......@@ -1340,13 +1306,9 @@ levels_load_callback (GtkWidget *widget,
}
static void
levels_save_callback (GtkWidget *widget,
gpointer data)
levels_save_callback (GtkWidget *widget,
GimpLevelsTool *l_tool)
{
GimpLevelsTool *l_tool;
l_tool = GIMP_LEVELS_TOOL (data);
if (! l_tool->file_dialog)
file_dialog_create (l_tool);
else if (GTK_WIDGET_VISIBLE (l_tool->file_dialog))
......@@ -1498,7 +1460,7 @@ levels_write_to_file (GimpLevelsTool *l_tool,
l_tool->levels->high_input[i],
l_tool->levels->low_output[i],
l_tool->levels->high_output[i],
g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f",
g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f",
l_tool->levels->gamma[i]));
}
}
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