Commit db79dc64 authored by CDT 1998 Larry Ewing's avatar CDT 1998 Larry Ewing Committed by Larry Ewing
Browse files

app/bezier_select.c app/commands.[ch] app/devices.c app/disp_callbacks.c

Sun Jun 21 15:16:46 CDT 1998 Larry Ewing <lewing@gimp.org>

	* app/bezier_select.c
	* app/commands.[ch]
	* app/devices.c
	* app/disp_callbacks.c
	* app/interface.c
	* app/menus.c
	* app/pixmaps.h
	* app/tools.[ch]
	* app/undo.c: Lots of changes to the way tools are intialized and
	accessed.  All information about a tool type is now contained in a
	single ToolInfo array.  There are still some small issues to
	adress about tool groups and we need some way of getting menu
	ordering/grouping to work better (plug-ins need this too).  There
	is still much to be done, but this is the next in cleaning up the
	tools.

	* app/posterize.[ch]
	* app/threshold.[ch]
	* app/histogram_tool.[ch]
	* app/hue_saturation.[ch]
	* app/levels.[ch]
	* app/brightness_contrast.[ch]
	* app/by_color_select.[ch]
	* app/color_balance.[ch]
	* app/curves.[ch]: Changed the *_initalize function prototypes from
	gpointer to GDisplay, to allow better type chacking and provide a
	uniform interface for all the dialog tools.
parent 2d46c61b
Sun Jun 21 15:16:46 CDT 1998 Larry Ewing <lewing@gimp.org>
* app/bezier_select.c
* app/commands.[ch]
* app/devices.c
* app/disp_callbacks.c
* app/interface.c
* app/menus.c
* app/pixmaps.h
* app/tools.[ch]
* app/undo.c: Lots of changes to the way tools are intialized and
accessed. All information about a tool type is now contained in a
single ToolInfo array. There are still some small issues to
adress about tool groups and we need some way of getting menu
ordering/grouping to work better (plug-ins need this too). There
is still much to be done, but this is the next in cleaning up the
tools.
* app/posterize.[ch]
* app/threshold.[ch]
* app/histogram_tool.[ch]
* app/hue_saturation.[ch]
* app/levels.[ch]
* app/brightness_contrast.[ch]
* app/by_color_select.[ch]
* app/color_balance.[ch]
* app/curves.[ch]: Changed the *_initalize function prototypes from
gpointer to GDisplay, to allow better type chacking and provide a
uniform interface for all the dialog tools.
Sun Jun 21 15:49:43 1998 Owen Taylor <otaylor@gtk.org>
* app/tools.c (tools_select): Set active_tool before
......
......@@ -403,21 +403,6 @@ select_shrink_cmd_callback (GtkWidget *widget,
gimage_mask_shrink_callback, (gpointer) gdisp->gimage->ID);
}
void
select_by_color_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
GDisplay * gdisp;
gdisp = gdisplay_active ();
gtk_widget_activate (tool_widgets[tool_info[(int) BY_COLOR_SELECT].toolbar_position]);
by_color_select_initialize ((void *) gdisp->gimage);
gdisp = gdisplay_active ();
active_tool->drawable = gimage_active_drawable (gdisp->gimage);
}
void
select_save_cmd_callback (GtkWidget *widget,
gpointer client_data)
......@@ -661,112 +646,6 @@ image_invert_cmd_callback (GtkWidget *widget,
gdisplays_flush ();
}
void
image_posterize_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
GDisplay * gdisp;
gdisp = gdisplay_active ();
gtk_widget_activate (tool_widgets[tool_info[(int) POSTERIZE].toolbar_position]);
posterize_initialize ((void *) gdisp);
gdisp = gdisplay_active ();
active_tool->drawable = gimage_active_drawable (gdisp->gimage);
}
void
image_threshold_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
GDisplay * gdisp;
gdisp = gdisplay_active ();
gtk_widget_activate (tool_widgets[tool_info[(int) THRESHOLD].toolbar_position]);
threshold_initialize ((void *) gdisp);
gdisp = gdisplay_active ();
active_tool->drawable = gimage_active_drawable (gdisp->gimage);
}
void
image_color_balance_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
GDisplay * gdisp;
gdisp = gdisplay_active ();
gtk_widget_activate (tool_widgets[tool_info[(int) COLOR_BALANCE].toolbar_position]);
color_balance_initialize ((void *) gdisp);
gdisp = gdisplay_active ();
active_tool->drawable = gimage_active_drawable (gdisp->gimage);
}
void
image_brightness_contrast_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
GDisplay * gdisp;
gdisp = gdisplay_active ();
gtk_widget_activate (tool_widgets[tool_info[(int) BRIGHTNESS_CONTRAST].toolbar_position]);
brightness_contrast_initialize ((void *) gdisp);
gdisp = gdisplay_active ();
active_tool->drawable = gimage_active_drawable (gdisp->gimage);
}
void
image_hue_saturation_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
GDisplay * gdisp;
gdisp = gdisplay_active ();
gtk_widget_activate (tool_widgets[tool_info[(int) HUE_SATURATION].toolbar_position]);
hue_saturation_initialize ((void *) gdisp);
gdisp = gdisplay_active ();
active_tool->drawable = gimage_active_drawable (gdisp->gimage);
}
void
image_curves_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
GDisplay * gdisp;
gdisp = gdisplay_active ();
gtk_widget_activate (tool_widgets[tool_info[(int) CURVES].toolbar_position]);
curves_initialize ((void *) gdisp);
gdisp = gdisplay_active ();
active_tool->drawable = gimage_active_drawable (gdisp->gimage);
}
void
image_levels_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
GDisplay * gdisp;
gdisp = gdisplay_active ();
gtk_widget_activate (tool_widgets[tool_info[(int) LEVELS].toolbar_position]);
levels_initialize ((void *) gdisp);
gdisp = gdisplay_active ();
active_tool->drawable = gimage_active_drawable (gdisp->gimage);
}
void
image_desaturate_cmd_callback (GtkWidget *widget,
gpointer client_data)
......@@ -922,21 +801,6 @@ image_scale_cmd_callback (GtkWidget *widget,
gtk_widget_show (image_scale->shell);
}
void
image_histogram_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
GDisplay * gdisp;
gdisp = gdisplay_active ();
gtk_widget_activate (tool_widgets[tool_info[(int) HISTOGRAM].toolbar_position]);
histogram_tool_initialize ((void *) gdisp);
gdisp = gdisplay_active ();
active_tool->drawable = gimage_active_drawable (gdisp->gimage);
}
void
layers_raise_cmd_callback (GtkWidget *widget,
gpointer client_data)
......@@ -1054,9 +918,21 @@ tools_select_cmd_callback (GtkWidget *widget,
{
GDisplay * gdisp;
/* Activate the approriate widget */
gtk_widget_activate (tool_widgets[tool_info[callback_action].toolbar_position]);
if (!tool_info[callback_action].init_func)
{
/* Activate the approriate widget */
gtk_widget_activate (tool_info[callback_action].tool_widget);
}
else
{
/* if the tool_info has an init_func */
gdisp = gdisplay_active ();
gtk_widget_activate (tool_info[callback_action].tool_widget);
(* tool_info[callback_action].init_func) (gdisp);
}
gdisp = gdisplay_active ();
active_tool->drawable = gimage_active_drawable (gdisp->gimage);
......
......@@ -56,20 +56,12 @@ void view_new_view_cmd_callback (GtkWidget *, gpointer);
void view_shrink_wrap_cmd_callback (GtkWidget *, gpointer);
void image_equalize_cmd_callback (GtkWidget *, gpointer);
void image_invert_cmd_callback (GtkWidget *, gpointer);
void image_posterize_cmd_callback (GtkWidget *, gpointer);
void image_threshold_cmd_callback (GtkWidget *, gpointer);
void image_color_balance_cmd_callback (GtkWidget *, gpointer);
void image_brightness_contrast_cmd_callback (GtkWidget *, gpointer);
void image_hue_saturation_cmd_callback (GtkWidget *, gpointer);
void image_curves_cmd_callback (GtkWidget *, gpointer);
void image_levels_cmd_callback (GtkWidget *, gpointer);
void image_desaturate_cmd_callback (GtkWidget *, gpointer);
void image_convert_rgb_cmd_callback (GtkWidget *, gpointer);
void image_convert_grayscale_cmd_callback (GtkWidget *, gpointer);
void image_convert_indexed_cmd_callback (GtkWidget *, gpointer);
void image_resize_cmd_callback (GtkWidget *, gpointer);
void image_scale_cmd_callback (GtkWidget *, gpointer);
void image_histogram_cmd_callback (GtkWidget *, gpointer);
void channel_ops_duplicate_cmd_callback (GtkWidget *, gpointer);
void channel_ops_offset_cmd_callback (GtkWidget *, gpointer);
void layers_raise_cmd_callback (GtkWidget *, gpointer);
......
......@@ -311,13 +311,10 @@ tools_free_color_balance (Tool *tool)
}
void
color_balance_initialize (void *gdisp_ptr)
color_balance_initialize (GDisplay *gdisp)
{
GDisplay *gdisp;
int i;
gdisp = (GDisplay *) gdisp_ptr;
if (! drawable_color (gimage_active_drawable (gdisp->gimage)))
{
g_message ("Color balance operates only on RGB color drawables.");
......@@ -340,7 +337,7 @@ color_balance_initialize (void *gdisp_ptr)
color_balance_dialog->yellow_blue[i] = 0.0;
}
color_balance_dialog->drawable = gimage_active_drawable (gdisp->gimage);
color_balance_dialog->image_map = image_map_create (gdisp_ptr, color_balance_dialog->drawable);
color_balance_dialog->image_map = image_map_create (gdisp, color_balance_dialog->drawable);
color_balance_update (color_balance_dialog, ALL);
}
......
......@@ -25,7 +25,7 @@
Tool * tools_new_color_balance (void);
void tools_free_color_balance (Tool *);
void color_balance_initialize (void *);
void color_balance_initialize (GDisplay *);
/* Procedure definition and marshalling function */
extern ProcRecord color_balance_proc;
......
......@@ -337,13 +337,10 @@ static MenuItem curve_type_items[] =
};
void
curves_initialize (void *gdisp_ptr)
curves_initialize (GDisplay *gdisp)
{
GDisplay *gdisp;
int i, j;
gdisp = (GDisplay *) gdisp_ptr;
if (drawable_indexed (gimage_active_drawable (gdisp->gimage)))
{
g_message ("Curves for indexed drawables cannot be adjusted.");
......@@ -376,7 +373,7 @@ curves_initialize (void *gdisp_ptr)
curves_dialog->drawable = gimage_active_drawable (gdisp->gimage);
curves_dialog->color = drawable_color ( (curves_dialog->drawable));
curves_dialog->image_map = image_map_create (gdisp_ptr, curves_dialog->drawable);
curves_dialog->image_map = image_map_create (gdisp, curves_dialog->drawable);
/* check for alpha channel */
if (drawable_has_alpha ( (curves_dialog->drawable)))
......
......@@ -25,7 +25,7 @@
Tool * tools_new_curves (void);
void tools_free_curves (Tool *);
void curves_initialize (void *);
void curves_initialize (GDisplay *);
void curves_free (void);
/* Procedure definition and marshalling function */
......
......@@ -355,13 +355,10 @@ tools_free_hue_saturation (Tool *tool)
}
void
hue_saturation_initialize (void *gdisp_ptr)
hue_saturation_initialize (GDisplay *gdisp)
{
GDisplay *gdisp;
int i;
gdisp = (GDisplay *) gdisp_ptr;
if (! drawable_color (gimage_active_drawable (gdisp->gimage)))
{
g_message ("Hue-Saturation operates only on RGB color drawables.");
......@@ -383,7 +380,7 @@ hue_saturation_initialize (void *gdisp_ptr)
}
hue_saturation_dialog->drawable = gimage_active_drawable (gdisp->gimage);
hue_saturation_dialog->image_map = image_map_create (gdisp_ptr, hue_saturation_dialog->drawable);
hue_saturation_dialog->image_map = image_map_create (gdisp, hue_saturation_dialog->drawable);
hue_saturation_update (hue_saturation_dialog, ALL);
}
......
......@@ -25,7 +25,7 @@
Tool * tools_new_hue_saturation (void);
void tools_free_hue_saturation (Tool *);
void hue_saturation_initialize (void *);
void hue_saturation_initialize (GDisplay *);
void hue_saturation_free (void);
/* Procedure definition and marshalling function */
......
......@@ -335,12 +335,8 @@ tools_free_threshold (Tool *tool)
}
void
threshold_initialize (void *gdisp_ptr)
threshold_initialize (GDisplay *gdisp)
{
GDisplay *gdisp;
gdisp = (GDisplay *) gdisp_ptr;
if (drawable_indexed (gimage_active_drawable (gdisp->gimage)))
{
g_message ("Threshold does not operate on indexed drawables.");
......@@ -356,7 +352,7 @@ threshold_initialize (void *gdisp_ptr)
threshold_dialog->drawable = gimage_active_drawable (gdisp->gimage);
threshold_dialog->color = drawable_color (threshold_dialog->drawable);
threshold_dialog->image_map = image_map_create (gdisp_ptr, threshold_dialog->drawable);
threshold_dialog->image_map = image_map_create (gdisp, threshold_dialog->drawable);
histogram_update (threshold_dialog->histogram,
threshold_dialog->drawable,
threshold_histogram_info,
......
......@@ -25,7 +25,7 @@
Tool * tools_new_threshold (void);
void tools_free_threshold (Tool *);
void threshold_initialize (void *);
void threshold_initialize (GDisplay *);
/* Procedure definition and marshalling function */
extern ProcRecord threshold_proc;
......
......@@ -173,7 +173,7 @@ bezier_select_load (void *gdisp_ptr,
gdisp = (GDisplay *) gdisp_ptr;
/* select the bezier tool */
gtk_widget_activate (tool_widgets[tool_info[BEZIER_SELECT].toolbar_position]);
gtk_widget_activate (tool_info[BEZIER_SELECT].tool_widget);
tool = active_tool;
tool->state = ACTIVE;
tool->gdisp_ptr = gdisp_ptr;
......
......@@ -278,12 +278,8 @@ tools_free_brightness_contrast (Tool *tool)
}
void
brightness_contrast_initialize (void *gdisp_ptr)
brightness_contrast_initialize (GDisplay *gdisp)
{
GDisplay *gdisp;
gdisp = (GDisplay *) gdisp_ptr;
if (drawable_indexed (gimage_active_drawable (gdisp->gimage)))
{
g_message ("Brightness-Contrast does not operate on indexed drawables.");
......@@ -303,7 +299,7 @@ brightness_contrast_initialize (void *gdisp_ptr)
brightness_contrast_dialog->contrast = 0.0;
brightness_contrast_dialog->drawable = gimage_active_drawable (gdisp->gimage);
brightness_contrast_dialog->image_map = image_map_create (gdisp_ptr,
brightness_contrast_dialog->image_map = image_map_create (gdisp,
brightness_contrast_dialog->drawable);
brightness_contrast_update (brightness_contrast_dialog, ALL);
......
......@@ -25,7 +25,7 @@
Tool * tools_new_brightness_contrast (void);
void tools_free_brightness_contrast (Tool *);
void brightness_contrast_initialize (void *);
void brightness_contrast_initialize (GDisplay *);
/* Procedure definition and marshalling function */
extern ProcRecord brightness_contrast_proc;
......
......@@ -505,12 +505,8 @@ tools_free_by_color_select (Tool *tool)
}
void
by_color_select_initialize (void *gimage_ptr)
by_color_select_initialize_by_image (GImage *gimage)
{
GImage *gimage;
gimage = (GImage *) gimage_ptr;
/* update the preview window */
if (by_color_dialog)
{
......@@ -521,6 +517,12 @@ by_color_select_initialize (void *gimage_ptr)
}
}
void
by_color_select_initialize (GDisplay *gdisp)
{
/* wrap this call so the tool_info->init_func works */
by_color_select_initialize_by_image (gdisp->gimage);
}
/****************************/
/* Select by Color dialog */
......
......@@ -25,7 +25,8 @@
Tool * tools_new_by_color_select (void);
void tools_free_by_color_select (Tool *);
void by_color_select_initialize (void *);
void by_color_select_initialize (GDisplay *);
void by_color_select_initialize_by_image (GImage *);
/* Procedure definition and marshalling function */
extern ProcRecord by_color_select_proc;
......
......@@ -311,13 +311,10 @@ tools_free_color_balance (Tool *tool)
}
void
color_balance_initialize (void *gdisp_ptr)
color_balance_initialize (GDisplay *gdisp)
{
GDisplay *gdisp;
int i;
gdisp = (GDisplay *) gdisp_ptr;
if (! drawable_color (gimage_active_drawable (gdisp->gimage)))
{
g_message ("Color balance operates only on RGB color drawables.");
......@@ -340,7 +337,7 @@ color_balance_initialize (void *gdisp_ptr)
color_balance_dialog->yellow_blue[i] = 0.0;
}
color_balance_dialog->drawable = gimage_active_drawable (gdisp->gimage);
color_balance_dialog->image_map = image_map_create (gdisp_ptr, color_balance_dialog->drawable);
color_balance_dialog->image_map = image_map_create (gdisp, color_balance_dialog->drawable);
color_balance_update (color_balance_dialog, ALL);
}
......
......@@ -25,7 +25,7 @@
Tool * tools_new_color_balance (void);
void tools_free_color_balance (Tool *);
void color_balance_initialize (void *);
void color_balance_initialize (GDisplay *);
/* Procedure definition and marshalling function */
extern ProcRecord color_balance_proc;
......
......@@ -403,21 +403,6 @@ select_shrink_cmd_callback (GtkWidget *widget,
gimage_mask_shrink_callback, (gpointer) gdisp->gimage->ID);
}
void
select_by_color_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
GDisplay * gdisp;
gdisp = gdisplay_active ();
gtk_widget_activate (tool_widgets[tool_info[(int) BY_COLOR_SELECT].toolbar_position]);
by_color_select_initialize ((void *) gdisp->gimage);
gdisp = gdisplay_active ();
active_tool->drawable = gimage_active_drawable (gdisp->gimage);
}
void
select_save_cmd_callback (GtkWidget *widget,
gpointer client_data)
......@@ -661,112 +646,6 @@ image_invert_cmd_callback (GtkWidget *widget,
gdisplays_flush ();
}
void
image_posterize_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
GDisplay * gdisp;
gdisp = gdisplay_active ();
gtk_widget_activate (tool_widgets[tool_info[(int) POSTERIZE].toolbar_position]);
posterize_initialize ((void *) gdisp);
gdisp = gdisplay_active ();
active_tool->drawable = gimage_active_drawable (gdisp->gimage);
}
void
image_threshold_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
GDisplay * gdisp;
gdisp = gdisplay_active ();
gtk_widget_activate (tool_widgets[tool_info[(int) THRESHOLD].toolbar_position]);
threshold_initialize ((void *) gdisp);
gdisp = gdisplay_active ();
active_tool->drawable = gimage_active_drawable (gdisp->gimage);
}
void
image_color_balance_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
GDisplay * gdisp;
gdisp = gdisplay_active ();
gtk_widget_activate (tool_widgets[tool_info[(int) COLOR_BALANCE].toolbar_position]);
color_balance_initialize ((void *) gdisp);
gdisp = gdisplay_active ();
active_tool->drawable = gimage_active_drawable (gdisp->gimage);
}
void
image_brightness_contrast_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
GDisplay * gdisp;
gdisp = gdisplay_active ();
gtk_widget_activate (tool_widgets[tool_info[(int) BRIGHTNESS_CONTRAST].toolbar_position]);
brightness_contrast_initialize ((void *) gdisp);
gdisp = gdisplay_active ();
active_tool->drawable = gimage_active_drawable (gdisp->gimage);
}
void
image_hue_saturation_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
GDisplay * gdisp;
gdisp = gdisplay_active ();
gtk_widget_activate (tool_widgets[tool_info[(int) HUE_SATURATION].toolbar_position]);
hue_saturation_initialize ((void *) gdisp);
gdisp = gdisplay_active ();
active_tool->drawable = gimage_active_drawable (gdisp->gimage);
}
void
image_curves_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
GDisplay * gdisp;
gdisp = gdisplay_active ();
gtk_widget_activate (tool_widgets[tool_info[(int) CURVES].toolbar_position]);
curves_initialize ((void *) gdisp);
gdisp = gdisplay_active ();
active_tool->drawable = gimage_active_drawable (gdisp->gimage);
}
void
image_levels_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
GDisplay * gdisp;
gdisp = gdisplay_active ();
gtk_widget_activate (tool_widgets[tool_info[(int) LEVELS].toolbar_position]);
levels_initialize ((void *) gdisp);
gdisp = gdisplay_active ();
active_tool->drawable = gimage_active_drawable (gdisp->gimage);
}
void