the Tool structure is now allocated by a common constructor which sets

1999-07-02  Michael Natterer  <mitschel@cs.tu-berlin.de>

	* app/[all tools]: the Tool structure is now allocated by a common
	constructor which sets default values and provides default tool
	action functions. To get rid of much code duplication there should
	be a object hierarchy of tools.

	* app/context_manager.c
	* app/tools.[ch]: create and destroy private contexts for the
	paint tools on startup and exit. They are not used yet.

	* app/interface.c
	* app/menus.c
	* app/tools.h: num_tools is now exported in tools.h

	* app/commands.c
	* app/gdisplay.c
	* app/menus.c: made "Toggle Selection" a toggleable menu item.
This commit is contained in:
Michael Natterer 1999-07-02 17:40:10 +00:00 committed by Michael Natterer
parent 4a99a0b1c2
commit a60b2c2f02
102 changed files with 1339 additions and 2973 deletions

View File

@ -1,3 +1,22 @@
1999-07-02 Michael Natterer <mitschel@cs.tu-berlin.de>
* app/[all tools]: the Tool structure is now allocated by a common
constructor which sets default values and provides default tool
action functions. To get rid of much code duplication there should
be a object hierarchy of tools.
* app/context_manager.c
* app/tools.[ch]: create and destroy private contexts for the
paint tools on startup and exit. They are not used yet.
* app/interface.c
* app/menus.c
* app/tools.h: num_tools is now exported in tools.h
* app/commands.c
* app/gdisplay.c
* app/menus.c: made "Toggle Selection" a toggleable menu item.
Thu Jul 1 23:37:38 1999 Owen Taylor <otaylor@redhat.com>
* ifscompose_storage.c: New file implementing saving

View File

@ -527,10 +527,18 @@ view_toggle_selection_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
GDisplay * gdisp;
int new_val;
return_if_no_display (gdisp);
selection_hide (gdisp->select, (void *) gdisp);
gdisplays_flush ();
new_val = GTK_CHECK_MENU_ITEM (widget)->active;
/* hidden == TRUE corresponds to the menu toggle being FALSE */
if (new_val == gdisp->select->hidden)
{
selection_hide (gdisp->select, (void *) gdisp);
gdisplays_flush ();
}
}
void

View File

@ -58,11 +58,7 @@ static ColorBalanceDialog *color_balance_dialog = NULL;
/* color balance action functions */
static void color_balance_button_press (Tool *, GdkEventButton *, gpointer);
static void color_balance_button_release (Tool *, GdkEventButton *, gpointer);
static void color_balance_motion (Tool *, GdkEventMotion *, gpointer);
static void color_balance_cursor_update (Tool *, GdkEventMotion *, gpointer);
static void color_balance_control (Tool *, ToolAction, gpointer);
static void color_balance_control (Tool *, ToolAction, gpointer);
static ColorBalanceDialog * color_balance_new_dialog (void);
@ -149,44 +145,6 @@ color_balance (PixelRegion *srcPR,
/* by_color select action functions */
static void
color_balance_button_press (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr)
{
GDisplay *gdisp;
gdisp = gdisp_ptr;
tool->gdisp_ptr = gdisp;
tool->drawable = gimage_active_drawable (gdisp->gimage);
}
static void
color_balance_button_release (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr)
{
}
static void
color_balance_motion (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
{
}
static void
color_balance_cursor_update (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
{
GDisplay *gdisp;
gdisp = (GDisplay *) gdisp_ptr;
gdisplay_install_tool_cursor (gdisp, GDK_TOP_LEFT_ARROW);
}
static void
color_balance_control (Tool *tool,
ToolAction action,
@ -227,25 +185,14 @@ tools_new_color_balance ()
tools_register (COLOR_BALANCE, color_balance_options);
}
tool = (Tool *) g_malloc (sizeof (Tool));
private = (ColorBalance *) g_malloc (sizeof (ColorBalance));
tool = tools_new_tool (COLOR_BALANCE);
private = g_new (ColorBalance, 1);
tool->scroll_lock = TRUE; /* Disallow scrolling */
tool->preserve = FALSE; /* Don't preserve on drawable change */
tool->type = COLOR_BALANCE;
tool->state = INACTIVE;
tool->scroll_lock = 1; /* Disallow scrolling */
tool->auto_snap_to = TRUE;
tool->private = (void *) private;
tool->preserve = FALSE;
tool->gdisp_ptr = NULL;
tool->drawable = NULL;
tool->button_press_func = color_balance_button_press;
tool->button_release_func = color_balance_button_release;
tool->motion_func = color_balance_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->modifier_key_func = standard_modifier_key_func;
tool->cursor_update_func = color_balance_cursor_update;
tool->control_func = color_balance_control;
return tool;

View File

@ -96,7 +96,6 @@ static CRMatrix CR_basis =
static void curves_button_press (Tool *, GdkEventButton *, gpointer);
static void curves_button_release (Tool *, GdkEventButton *, gpointer);
static void curves_motion (Tool *, GdkEventMotion *, gpointer);
static void curves_cursor_update (Tool *, GdkEventMotion *, gpointer);
static void curves_control (Tool *, ToolAction, gpointer);
static CurvesDialog * curves_new_dialog (void);
@ -164,38 +163,6 @@ curves_lut_func (CurvesDialog *cd,
return inten;
}
/* curves action functions */
static void
curves_button_press (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr)
{
GDisplay *gdisp;
GimpDrawable * drawable;
gdisp = gdisp_ptr;
drawable = gimage_active_drawable (gdisp->gimage);
tool->gdisp_ptr = gdisp;
if (drawable != tool->drawable)
{
active_tool->preserve = TRUE;
image_map_abort (curves_dialog->image_map);
active_tool->preserve = FALSE;
tool->drawable = drawable;
curves_dialog->drawable = drawable;
curves_dialog->color = drawable_color (drawable);
curves_dialog->image_map = image_map_create (gdisp, drawable);
}
if(tool)
tool->state = ACTIVE;
}
static void
curves_colour_update (Tool *tool,
GDisplay *gdisp,
@ -271,6 +238,43 @@ curves_add_point(GimpDrawable * drawable,gint x, gint y,gint cchan)
curves_dialog->points[cchan][closest_point][1] = curves_dialog->curve[cchan][curvex];
}
/* curves action functions */
static void
curves_button_press (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr)
{
GDisplay *gdisp;
gint x, y;
GimpDrawable * drawable;
gdisp = gdisp_ptr;
drawable = gimage_active_drawable (gdisp->gimage);
tool->gdisp_ptr = gdisp;
if (drawable != tool->drawable)
{
active_tool->preserve = TRUE;
image_map_abort (curves_dialog->image_map);
active_tool->preserve = FALSE;
tool->drawable = drawable;
curves_dialog->drawable = drawable;
curves_dialog->color = drawable_color (drawable);
curves_dialog->image_map = image_map_create (gdisp, drawable);
}
tool->state = ACTIVE;
gdisplay_untransform_coords (gdisp, bevent->x, bevent->y, &x, &y,
FALSE, FALSE);
curves_colour_update (tool, gdisp, drawable, x, y);
curves_update (curves_dialog, GRAPH | DRAW);
}
static void
curves_button_release (Tool *tool,
GdkEventButton *bevent,
@ -329,17 +333,6 @@ curves_motion (Tool *tool,
curves_update (curves_dialog, GRAPH | DRAW);
}
static void
curves_cursor_update (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
{
GDisplay *gdisp;
gdisp = (GDisplay *) gdisp_ptr;
gdisplay_install_tool_cursor (gdisp, GDK_TOP_LEFT_ARROW);
}
static void
curves_control (Tool *tool,
ToolAction action,
@ -376,26 +369,18 @@ tools_new_curves ()
tools_register (CURVES, curves_options);
}
tool = (Tool *) g_malloc (sizeof (Tool));
private = (Curves *) g_malloc (sizeof (Curves));
tool = tools_new_tool (CURVES);
private = g_new (Curves, 1);
tool->scroll_lock = TRUE; /* Disallow scrolling */
tool->preserve = FALSE; /* Don't preserve on drawable change */
tool->type = CURVES;
tool->state = INACTIVE;
tool->scroll_lock = 1; /* Disallow scrolling */
tool->auto_snap_to = TRUE;
tool->private = (void *) private;
tool->preserve = FALSE;
tool->gdisp_ptr = NULL;
tool->drawable = NULL;
tool->button_press_func = curves_button_press;
tool->button_press_func = curves_button_press;
tool->button_release_func = curves_button_release;
tool->motion_func = curves_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->modifier_key_func = standard_modifier_key_func;
tool->cursor_update_func = curves_cursor_update;
tool->control_func = curves_control;
tool->motion_func = curves_motion;
tool->control_func = curves_control;
return tool;
}
@ -507,9 +492,9 @@ curves_free ()
}
}
/**************************/
/* Select Curves dialog */
/**************************/
/*******************/
/* Curves dialog */
/*******************/
static CurvesDialog *
curves_new_dialog ()

View File

@ -79,13 +79,9 @@ static int default_colors[6][3] =
/* hue saturation action functions */
static void hue_saturation_button_press (Tool *, GdkEventButton *, gpointer);
static void hue_saturation_button_release (Tool *, GdkEventButton *, gpointer);
static void hue_saturation_motion (Tool *, GdkEventMotion *, gpointer);
static void hue_saturation_cursor_update (Tool *, GdkEventMotion *, gpointer);
static void hue_saturation_control (Tool *, ToolAction, gpointer);
static void hue_saturation_control (Tool *, ToolAction, gpointer);
static HueSaturationDialog * hue_saturation_new_dialog (void);
static HueSaturationDialog * hue_saturation_new_dialog (void);
static void hue_saturation_update (HueSaturationDialog *,
int);
@ -229,44 +225,6 @@ hue_saturation (PixelRegion *srcPR,
/* by_color select action functions */
static void
hue_saturation_button_press (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr)
{
GDisplay *gdisp;
gdisp = gdisp_ptr;
tool->gdisp_ptr = gdisp;
tool->drawable = gimage_active_drawable (gdisp->gimage);
}
static void
hue_saturation_button_release (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr)
{
}
static void
hue_saturation_motion (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
{
}
static void
hue_saturation_cursor_update (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
{
GDisplay *gdisp;
gdisp = (GDisplay *) gdisp_ptr;
gdisplay_install_tool_cursor (gdisp, GDK_TOP_LEFT_ARROW);
}
static void
hue_saturation_control (Tool *tool,
ToolAction action,
@ -303,25 +261,14 @@ tools_new_hue_saturation ()
tools_register (HUE_SATURATION, hue_saturation_options);
}
tool = (Tool *) g_malloc (sizeof (Tool));
private = (HueSaturation *) g_malloc (sizeof (HueSaturation));
tool = tools_new_tool (HUE_SATURATION);
private = g_new (HueSaturation, 1);
tool->scroll_lock = TRUE; /* Disallow scrolling */
tool->preserve = FALSE; /* Don't preserve on drawable change */
tool->type = HUE_SATURATION;
tool->state = INACTIVE;
tool->scroll_lock = 1; /* Disallow scrolling */
tool->auto_snap_to = TRUE;
tool->private = (void *) private;
tool->preserve = FALSE;
tool->gdisp_ptr = NULL;
tool->drawable = NULL;
tool->button_press_func = hue_saturation_button_press;
tool->button_release_func = hue_saturation_button_release;
tool->motion_func = hue_saturation_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->modifier_key_func = standard_modifier_key_func;
tool->cursor_update_func = hue_saturation_cursor_update;
tool->control_func = hue_saturation_control;
return tool;
@ -352,7 +299,7 @@ hue_saturation_initialize (GDisplay *gdisp)
return;
}
/* The "by color" dialog */
/* The "hue-saturation color" dialog */
if (!hue_saturation_dialog)
hue_saturation_dialog = hue_saturation_new_dialog ();
else

View File

@ -49,11 +49,7 @@ static ThresholdDialog *threshold_dialog = NULL;
/* threshold action functions */
static void threshold_button_press (Tool *, GdkEventButton *, gpointer);
static void threshold_button_release (Tool *, GdkEventButton *, gpointer);
static void threshold_motion (Tool *, GdkEventMotion *, gpointer);
static void threshold_cursor_update (Tool *, GdkEventMotion *, gpointer);
static void threshold_control (Tool *, ToolAction, gpointer);
static void threshold_control (Tool *, ToolAction, gpointer);
static ThresholdDialog * threshold_new_dialog (void);
@ -158,44 +154,6 @@ threshold_histogram_range (HistogramWidget *w,
/* threshold action functions */
static void
threshold_button_press (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr)
{
GDisplay *gdisp;
gdisp = gdisp_ptr;
tool->gdisp_ptr = gdisp;
tool->drawable = gimage_active_drawable (gdisp->gimage);
}
static void
threshold_button_release (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr)
{
}
static void
threshold_motion (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
{
}
static void
threshold_cursor_update (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
{
GDisplay *gdisp;
gdisp = (GDisplay *) gdisp_ptr;
gdisplay_install_tool_cursor (gdisp, GDK_TOP_LEFT_ARROW);
}
static void
threshold_control (Tool *tool,
ToolAction action,
@ -239,25 +197,14 @@ tools_new_threshold ()
if (!GTK_WIDGET_VISIBLE (threshold_dialog->shell))
gtk_widget_show (threshold_dialog->shell);
tool = (Tool *) g_malloc (sizeof (Tool));
private = (Threshold *) g_malloc (sizeof (Threshold));
tool = tools_new_tool (THRESHOLD);
private = g_new (Threshold, 1);
tool->scroll_lock = TRUE; /* Disallow scrolling */
tool->preserve = FALSE; /* Don't preserve on drawable change */
tool->type = THRESHOLD;
tool->state = INACTIVE;
tool->scroll_lock = 1; /* Disallow scrolling */
tool->auto_snap_to = TRUE;
tool->private = (void *) private;
tool->preserve = FALSE;
tool->gdisp_ptr = NULL;
tool->drawable = NULL;
tool->button_press_func = threshold_button_press;
tool->button_release_func = threshold_button_release;
tool->motion_func = threshold_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->modifier_key_func = standard_modifier_key_func;
tool->cursor_update_func = threshold_cursor_update;
tool->control_func = threshold_control;
return tool;

View File

@ -212,31 +212,25 @@ tools_new_bezier_select ()
tools_register (BEZIER_SELECT, (ToolOptions *) bezier_options);
}
tool = g_malloc (sizeof (Tool));
private = g_malloc (sizeof (BezierSelect));
tool = tools_new_tool (BEZIER_SELECT);
private = g_new (BezierSelect, 1);
private->num_points = 0;
private->mask = NULL;
private->core = draw_core_new (bezier_select_draw);
bezier_select_reset (private);
tool->type = BEZIER_SELECT;
tool->state = INACTIVE;
tool->scroll_lock = 1; /* Do not allow scrolling */
tool->auto_snap_to = TRUE;
tool->scroll_lock = TRUE; /* Disallow scrolling */
tool->preserve = FALSE; /* Don't preserve on drawable change */
tool->private = (void *) private;
tool->preserve = FALSE;
tool->gdisp_ptr = NULL;
tool->drawable = NULL;
tool->button_press_func = bezier_select_button_press;
tool->button_press_func = bezier_select_button_press;
tool->button_release_func = bezier_select_button_release;
tool->motion_func = bezier_select_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->modifier_key_func = standard_modifier_key_func;
tool->cursor_update_func = bezier_select_cursor_update;
tool->control_func = bezier_select_control;
tool->motion_func = bezier_select_motion;
tool->cursor_update_func = bezier_select_cursor_update;
tool->control_func = bezier_select_control;
curCore = private->core;
curSel = private;

View File

@ -1732,28 +1732,20 @@ tools_new_blend ()
tools_register (BLEND, (ToolOptions *) blend_options);
}
tool = (Tool *) g_malloc (sizeof (Tool));
private = (BlendTool *) g_malloc (sizeof (BlendTool));
tool = tools_new_tool (BLEND);
private = g_new (BlendTool, 1);
private->core = draw_core_new (blend_draw);
tool->type = BLEND;
tool->state = INACTIVE;
tool->scroll_lock = 1; /* Disallow scrolling */
tool->auto_snap_to = TRUE;
tool->scroll_lock = TRUE; /* Disallow scrolling */
tool->private = (void *) private;
tool->preserve = TRUE;
tool->gdisp_ptr = NULL;
tool->drawable = NULL;
tool->button_press_func = blend_button_press;
tool->button_press_func = blend_button_press;
tool->button_release_func = blend_button_release;
tool->motion_func = blend_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->modifier_key_func = standard_modifier_key_func;
tool->cursor_update_func = blend_cursor_update;
tool->control_func = blend_control;
tool->motion_func = blend_motion;
tool->cursor_update_func = blend_cursor_update;
tool->control_func = blend_control;
return tool;
}

View File

@ -82,13 +82,9 @@ static BrightnessContrastDialog *brightness_contrast_dialog = NULL;
/* brightness contrast action functions */
static void brightness_contrast_button_press (Tool *, GdkEventButton *, gpointer);
static void brightness_contrast_button_release (Tool *, GdkEventButton *, gpointer);
static void brightness_contrast_motion (Tool *, GdkEventMotion *, gpointer);
static void brightness_contrast_cursor_update (Tool *, GdkEventMotion *, gpointer);
static void brightness_contrast_control (Tool *, ToolAction, gpointer);
static void brightness_contrast_control (Tool *, ToolAction, gpointer);
static BrightnessContrastDialog * brightness_contrast_new_dialog (void);
static BrightnessContrastDialog * brightness_contrast_new_dialog (void);
static void brightness_contrast_update (BrightnessContrastDialog *, int);
static void brightness_contrast_preview (BrightnessContrastDialog *);
@ -102,45 +98,7 @@ static void brightness_contrast_brightness_text_update (GtkWidget *, gpointer
static void brightness_contrast_contrast_text_update (GtkWidget *, gpointer);
/* by_color select action functions */
static void
brightness_contrast_button_press (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr)
{
GDisplay *gdisp;
gdisp = gdisp_ptr;
tool->gdisp_ptr = gdisp;
tool->drawable = gimage_active_drawable (gdisp->gimage);
}
static void
brightness_contrast_button_release (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr)
{
}
static void
brightness_contrast_motion (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
{
}
static void
brightness_contrast_cursor_update (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
{
GDisplay *gdisp;
gdisp = (GDisplay *) gdisp_ptr;
gdisplay_install_tool_cursor (gdisp, GDK_TOP_LEFT_ARROW);
}
/* brightness-contrast select action functions */
static void
brightness_contrast_control (Tool *tool,
@ -179,25 +137,14 @@ tools_new_brightness_contrast ()
tools_register (BRIGHTNESS_CONTRAST, brightness_contrast_options);
}
tool = (Tool *) g_malloc (sizeof (Tool));
private = (BrightnessContrast *) g_malloc (sizeof (BrightnessContrast));
tool = tools_new_tool (BRIGHTNESS_CONTRAST);
private = g_new (BrightnessContrast, 1);
tool->scroll_lock = TRUE; /* Disallow scrolling */
tool->preserve = FALSE; /* Don't preserve on drawable change */
tool->type = BRIGHTNESS_CONTRAST;
tool->state = INACTIVE;
tool->scroll_lock = 1; /* Disallow scrolling */
tool->auto_snap_to = TRUE;
tool->private = (void *) private;
tool->preserve = FALSE;
tool->gdisp_ptr = NULL;
tool->drawable = NULL;
tool->button_press_func = brightness_contrast_button_press;
tool->button_release_func = brightness_contrast_button_release;
tool->motion_func = brightness_contrast_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->modifier_key_func = standard_modifier_key_func;
tool->cursor_update_func = brightness_contrast_cursor_update;
tool->control_func = brightness_contrast_control;
return tool;

View File

@ -73,9 +73,7 @@ static BucketOptions *bucket_options = NULL;
static void bucket_fill_button_press (Tool *, GdkEventButton *, gpointer);
static void bucket_fill_button_release (Tool *, GdkEventButton *, gpointer);
static void bucket_fill_motion (Tool *, GdkEventMotion *, gpointer);
static void bucket_fill_cursor_update (Tool *, GdkEventMotion *, gpointer);
static void bucket_fill_control (Tool *, ToolAction, gpointer);
static void bucket_fill_region (BucketFillMode, PixelRegion *,
PixelRegion *, unsigned char *,
@ -248,15 +246,6 @@ bucket_fill_button_release (Tool *tool,
tool->state = INACTIVE;
}
static void
bucket_fill_motion (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
{
}
static void
bucket_fill_cursor_update (Tool *tool,
GdkEventMotion *mevent,
@ -317,13 +306,6 @@ bucket_fill_modifier_key_func (Tool *tool,
}
}
static void
bucket_fill_control (Tool *tool,
ToolAction action,
gpointer gdisp_ptr)
{
}
void
bucket_fill (GimpImage *gimage,
GimpDrawable *drawable,
@ -584,9 +566,9 @@ bucket_fill_region (BucketFillMode fill_mode,
}
}
/*********************************/
/* Global bucket fill functions */
/*********************************/
/**********************************/
/* Global bucket fill functions */
/**********************************/
Tool *
tools_new_bucket_fill (void)
@ -604,26 +586,17 @@ tools_new_bucket_fill (void)
bucket_options_reset ();
}
tool = (Tool *) g_malloc (sizeof (Tool));
private = (BucketTool *) g_malloc (sizeof (BucketTool));
tool = tools_new_tool (BUCKET_FILL);
private = g_new (BucketTool, 1);
tool->scroll_lock = TRUE; /* Disallow scrolling */
tool->type = BUCKET_FILL;
tool->state = INACTIVE;
tool->scroll_lock = 1; /* Disallow scrolling */
tool->auto_snap_to = TRUE;
tool->private = (void *) private;
tool->preserve = TRUE;
tool->gdisp_ptr = NULL;
tool->drawable = NULL;
tool->button_press_func = bucket_fill_button_press;
tool->button_press_func = bucket_fill_button_press;
tool->button_release_func = bucket_fill_button_release;
tool->motion_func = bucket_fill_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->modifier_key_func = bucket_fill_modifier_key_func;
tool->cursor_update_func = bucket_fill_cursor_update;
tool->control_func = bucket_fill_control;
tool->modifier_key_func = bucket_fill_modifier_key_func;
tool->cursor_update_func = bucket_fill_cursor_update;
return tool;
}

View File

@ -75,7 +75,6 @@ static ByColorDialog * by_color_dialog = NULL;
static void by_color_select_button_press (Tool *, GdkEventButton *, gpointer);
static void by_color_select_button_release (Tool *, GdkEventButton *, gpointer);
static void by_color_select_motion (Tool *, GdkEventMotion *, gpointer);
static void by_color_select_cursor_update (Tool *, GdkEventMotion *, gpointer);
static void by_color_select_control (Tool *, ToolAction, gpointer);
@ -396,13 +395,6 @@ by_color_select_button_release (Tool *tool,
}
}
static void
by_color_select_motion (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
{
}
static void
by_color_select_cursor_update (Tool *tool,
GdkEventMotion *mevent,
@ -474,26 +466,17 @@ tools_new_by_color_select ()
if (!GTK_WIDGET_VISIBLE (by_color_dialog->shell))
gtk_widget_show (by_color_dialog->shell);
tool = (Tool *) g_malloc (sizeof (Tool));
private = (ByColorSelect *) g_malloc (sizeof (ByColorSelect));
tool = tools_new_tool (BY_COLOR_SELECT);
private = g_new (ByColorSelect, 1);
tool->scroll_lock = TRUE; /* Disallow scrolling */
tool->type = BY_COLOR_SELECT;
tool->state = INACTIVE;
tool->scroll_lock = 1; /* Disallow scrolling */
tool->auto_snap_to = TRUE;
tool->private = (void *) private;
tool->preserve = TRUE;
tool->gdisp_ptr = NULL;
tool->drawable = NULL;
tool->button_press_func = by_color_select_button_press;
tool->button_press_func = by_color_select_button_press;
tool->button_release_func = by_color_select_button_release;
tool->motion_func = by_color_select_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->modifier_key_func = standard_modifier_key_func;
tool->cursor_update_func = by_color_select_cursor_update;
tool->control_func = by_color_select_control;
tool->cursor_update_func = by_color_select_cursor_update;
tool->control_func = by_color_select_control;
return tool;
}

View File

@ -58,11 +58,7 @@ static ColorBalanceDialog *color_balance_dialog = NULL;
/* color balance action functions */
static void color_balance_button_press (Tool *, GdkEventButton *, gpointer);
static void color_balance_button_release (Tool *, GdkEventButton *, gpointer);
static void color_balance_motion (Tool *, GdkEventMotion *, gpointer);
static void color_balance_cursor_update (Tool *, GdkEventMotion *, gpointer);
static void color_balance_control (Tool *, ToolAction, gpointer);
static void color_balance_control (Tool *, ToolAction, gpointer);
static ColorBalanceDialog * color_balance_new_dialog (void);
@ -149,44 +145,6 @@ color_balance (PixelRegion *srcPR,
/* by_color select action functions */
static void
color_balance_button_press (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr)
{
GDisplay *gdisp;
gdisp = gdisp_ptr;
tool->gdisp_ptr = gdisp;
tool->drawable = gimage_active_drawable (gdisp->gimage);
}
static void
color_balance_button_release (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr)
{
}
static void
color_balance_motion (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
{
}
static void
color_balance_cursor_update (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
{
GDisplay *gdisp;
gdisp = (GDisplay *) gdisp_ptr;
gdisplay_install_tool_cursor (gdisp, GDK_TOP_LEFT_ARROW);
}
static void
color_balance_control (Tool *tool,
ToolAction action,
@ -227,25 +185,14 @@ tools_new_color_balance ()
tools_register (COLOR_BALANCE, color_balance_options);
}
tool = (Tool *) g_malloc (sizeof (Tool));
private = (ColorBalance *) g_malloc (sizeof (ColorBalance));
tool = tools_new_tool (COLOR_BALANCE);
private = g_new (ColorBalance, 1);
tool->scroll_lock = TRUE; /* Disallow scrolling */
tool->preserve = FALSE; /* Don't preserve on drawable change */
tool->type = COLOR_BALANCE;
tool->state = INACTIVE;
tool->scroll_lock = 1; /* Disallow scrolling */
tool->auto_snap_to = TRUE;
tool->private = (void *) private;
tool->preserve = FALSE;
tool->gdisp_ptr = NULL;
tool->drawable = NULL;
tool->button_press_func = color_balance_button_press;
tool->button_release_func = color_balance_button_release;
tool->motion_func = color_balance_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->modifier_key_func = standard_modifier_key_func;
tool->cursor_update_func = color_balance_cursor_update;
tool->control_func = color_balance_control;
return tool;

View File

@ -616,28 +616,18 @@ tools_new_color_picker ()
tools_register (COLOR_PICKER, (ToolOptions *) color_picker_options);
}
tool = (Tool *) g_malloc (sizeof (Tool));
tool = tools_new_tool (COLOR_PICKER);
private = (ColourPickerTool *) g_malloc(sizeof(ColourPickerTool));
private->core = draw_core_new (colourpicker_draw);
tool->type = COLOR_PICKER;
tool->state = INACTIVE;
tool->scroll_lock = 0; /* Allow scrolling */
tool->auto_snap_to = TRUE;
tool->private = (void *) private;
tool->preserve = TRUE;
tool->gdisp_ptr = NULL;
tool->drawable = NULL;
tool->button_press_func = color_picker_button_press;
tool->button_press_func = color_picker_button_press;
tool->button_release_func = color_picker_button_release;
tool->motion_func = color_picker_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->modifier_key_func = standard_modifier_key_func;
tool->cursor_update_func = color_picker_cursor_update;
tool->control_func = color_picker_control;
tool->motion_func = color_picker_motion;
tool->cursor_update_func = color_picker_cursor_update;
tool->control_func = color_picker_control;
return tool;
}

View File

@ -527,10 +527,18 @@ view_toggle_selection_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
GDisplay * gdisp;
int new_val;
return_if_no_display (gdisp);
selection_hide (gdisp->select, (void *) gdisp);
gdisplays_flush ();
new_val = GTK_CHECK_MENU_ITEM (widget)->active;
/* hidden == TRUE corresponds to the menu toggle being FALSE */
if (new_val == gdisp->select->hidden)
{
selection_hide (gdisp->select, (void *) gdisp);
gdisplays_flush ();
}
}
void

View File

@ -20,6 +20,7 @@
#include "appenv.h"
#include "gdisplay.h"
#include "tools.h"
static void
context_manager_display_changed (GimpContext *context,
@ -45,6 +46,7 @@ void
context_manager_init (void)
{
GimpContext *context;
gint i;
/* Implicitly create the standard context
*/
@ -62,6 +64,32 @@ context_manager_init (void)
gimp_context_set_user (context);
gimp_context_set_current (context);
/* Initialize the tools' contexts */
for (i = 0; i < num_tools; i++)
{
switch (tool_info->tool_id)
{
case BUCKET_FILL:
case BLEND:
case PENCIL:
case PAINTBRUSH:
case ERASER:
case AIRBRUSH:
case CLONE:
case CONVOLVE:
case INK:
case DODGEBURN:
case SMUDGE:
tool_info[i].tool_context =
gimp_context_new (tool_info[i].private_tip, NULL, NULL);
break;
default:
tool_info[i].tool_context = NULL;
break;
}
}
gtk_signal_connect (GTK_OBJECT (context), "display_changed",
GTK_SIGNAL_FUNC (context_manager_display_changed),
NULL);
@ -73,6 +101,17 @@ context_manager_init (void)
void
context_manager_free (void)
{
gint i;
for (i = 0; i < num_tools; i++)
{
if (tool_info[i].tool_context != NULL)
{
gtk_object_unref (GTK_OBJECT (tool_info[i].tool_context));
tool_info[i].tool_context = NULL;
}
}
gtk_object_unref (GTK_OBJECT (gimp_context_get_user ()));
gimp_context_set_user (NULL);
gimp_context_set_current (NULL);

View File

@ -1732,28 +1732,20 @@ tools_new_blend ()
tools_register (BLEND, (ToolOptions *) blend_options);
}
tool = (Tool *) g_malloc (sizeof (Tool));
private = (BlendTool *) g_malloc (sizeof (BlendTool));
tool = tools_new_tool (BLEND);
private = g_new (BlendTool, 1);
private->core = draw_core_new (blend_draw);
tool->type = BLEND;
tool->state = INACTIVE;
tool->scroll_lock = 1; /* Disallow scrolling */
tool->auto_snap_to = TRUE;
tool->scroll_lock = TRUE; /* Disallow scrolling */
tool->private = (void *) private;
tool->preserve = TRUE;
tool->gdisp_ptr = NULL;
tool->drawable = NULL;
tool->button_press_func = blend_button_press;
tool->button_press_func = blend_button_press;
tool->button_release_func = blend_button_release;
tool->motion_func = blend_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->modifier_key_func = standard_modifier_key_func;
tool->cursor_update_func = blend_cursor_update;
tool->control_func = blend_control;
tool->motion_func = blend_motion;
tool->cursor_update_func = blend_cursor_update;
tool->control_func = blend_control;
return tool;
}

View File

@ -1601,6 +1601,7 @@ gdisplay_set_menu_sensitivity (GDisplay *gdisp)
else
{
SET_SENSITIVE ("/View", TRUE);
SET_STATE ("/View/Toggle Selection", !gdisp->select->hidden);
SET_STATE ("/View/Toggle Rulers",
GTK_WIDGET_VISIBLE (gdisp->origin) ? 1 : 0);
SET_STATE ("/View/Toggle Guides", gdisp->draw_guides);

View File

@ -96,7 +96,6 @@ static CRMatrix CR_basis =
static void curves_button_press (Tool *, GdkEventButton *, gpointer);
static void curves_button_release (Tool *, GdkEventButton *, gpointer);
static void curves_motion (Tool *, GdkEventMotion *, gpointer);
static void curves_cursor_update (Tool *, GdkEventMotion *, gpointer);
static void curves_control (Tool *, ToolAction, gpointer);
static CurvesDialog * curves_new_dialog (void);
@ -164,38 +163,6 @@ curves_lut_func (CurvesDialog *cd,
return inten;
}
/* curves action functions */
static void
curves_button_press (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr)
{
GDisplay *gdisp;
GimpDrawable * drawable;
gdisp = gdisp_ptr;
drawable = gimage_active_drawable (gdisp->gimage);
tool->gdisp_ptr = gdisp;
if (drawable != tool->drawable)
{
active_tool->preserve = TRUE;
image_map_abort (curves_dialog->image_map);
active_tool->preserve = FALSE;
tool->drawable = drawable;
curves_dialog->drawable = drawable;
curves_dialog->color = drawable_color (drawable);
curves_dialog->image_map = image_map_create (gdisp, drawable);
}
if(tool)
tool->state = ACTIVE;
}
static void
curves_colour_update (Tool *tool,
GDisplay *gdisp,
@ -271,6 +238,43 @@ curves_add_point(GimpDrawable * drawable,gint x, gint y,gint cchan)
curves_dialog->points[cchan][closest_point][1] = curves_dialog->curve[cchan][curvex];
}
/* curves action functions */
static void
curves_button_press (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr)
{
GDisplay *gdisp;
gint x, y;
GimpDrawable * drawable;
gdisp = gdisp_ptr;
drawable = gimage_active_drawable (gdisp->gimage);
tool->gdisp_ptr = gdisp;
if (drawable != tool->drawable)
{
active_tool->preserve = TRUE;
image_map_abort (curves_dialog->image_map);
active_tool->preserve = FALSE;
tool->drawable = drawable;
curves_dialog->drawable = drawable;
curves_dialog->color = drawable_color (drawable);
curves_dialog->image_map = image_map_create (gdisp, drawable);
}
tool->state = ACTIVE;
gdisplay_untransform_coords (gdisp, bevent->x, bevent->y, &x, &y,
FALSE, FALSE);
curves_colour_update (tool, gdisp, drawable, x, y);
curves_update (curves_dialog, GRAPH | DRAW);
}
static void
curves_button_release (Tool *tool,
GdkEventButton *bevent,
@ -329,17 +333,6 @@ curves_motion (Tool *tool,
curves_update (curves_dialog, GRAPH | DRAW);
}
static void
curves_cursor_update (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
{
GDisplay *gdisp;
gdisp = (GDisplay *) gdisp_ptr;
gdisplay_install_tool_cursor (gdisp, GDK_TOP_LEFT_ARROW);
}
static void
curves_control (Tool *tool,
ToolAction action,
@ -376,26 +369,18 @@ tools_new_curves ()
tools_register (CURVES, curves_options);
}
tool = (Tool *) g_malloc (sizeof (Tool));
private = (Curves *) g_malloc (sizeof (Curves));
tool = tools_new_tool (CURVES);
private = g_new (Curves, 1);
tool->scroll_lock = TRUE; /* Disallow scrolling */
tool->preserve = FALSE; /* Don't preserve on drawable change */
tool->type = CURVES;
tool->state = INACTIVE;
tool->scroll_lock = 1; /* Disallow scrolling */
tool->auto_snap_to = TRUE;
tool->private = (void *) private;
tool->preserve = FALSE;
tool->gdisp_ptr = NULL;
tool->drawable = NULL;
tool->button_press_func = curves_button_press;
tool->button_press_func = curves_button_press;
tool->button_release_func = curves_button_release;
tool->motion_func = curves_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->modifier_key_func = standard_modifier_key_func;
tool->cursor_update_func = curves_cursor_update;
tool->control_func = curves_control;
tool->motion_func = curves_motion;
tool->control_func = curves_control;
return tool;
}
@ -507,9 +492,9 @@ curves_free ()
}
}
/**************************/
/* Select Curves dialog */
/**************************/
/*******************/
/* Curves dialog */
/*******************/
static CurvesDialog *
curves_new_dialog ()

View File

@ -1601,6 +1601,7 @@ gdisplay_set_menu_sensitivity (GDisplay *gdisp)
else
{
SET_SENSITIVE ("/View", TRUE);
SET_STATE ("/View/Toggle Selection", !gdisp->select->hidden);
SET_STATE ("/View/Toggle Rulers",
GTK_WIDGET_VISIBLE (gdisp->origin) ? 1 : 0);
SET_STATE ("/View/Toggle Guides", gdisp->draw_guides);

View File

@ -97,8 +97,6 @@ static int pixmap_colors[8][3] =
{ 0xFF, 0xFF, 0xFF }, /* h - 255 */
};
extern int num_tools;
#define COLUMNS 3
#define ROWS 8
#define MARGIN 2

View File

@ -97,8 +97,6 @@ static int pixmap_colors[8][3] =
{ 0xFF, 0xFF, 0xFF }, /* h - 255 */
};
extern int num_tools;
#define COLUMNS 3
#define ROWS 8
#define MARGIN 2

View File

@ -31,7 +31,7 @@
#include "libgimp/gimpintl.h"
#define EDIT_SELECT_SCROLL_LOCK 0
#define EDIT_SELECT_SCROLL_LOCK FALSE
#define ARROW_VELOCITY 25
#define STATUSBAR_SIZE 128
@ -53,8 +53,8 @@ struct _EditSelection
MotionFunc old_motion; /* old motion member function */
ToolCtlFunc old_control; /* old control member function */
CursorUpdateFunc old_cursor_update; /* old cursor update function */
int old_scroll_lock; /* old value of scroll lock */
int old_auto_snap_to; /* old value of auto snap to */
gboolean old_scroll_lock; /* old value of scroll lock */
gboolean old_auto_snap_to; /* old value of auto snap to */
guint context_id; /* for the statusbar */
};

View File

@ -109,7 +109,7 @@ ellipse_select_options_reset (void)
}
Tool *
tools_new_ellipse_select (void)
tools_new_ellipse_select (void)
{
Tool *tool;
EllipseSelect *private;
@ -122,31 +122,21 @@ tools_new_ellipse_select (void)
tools_register (ELLIPSE_SELECT, (ToolOptions *) ellipse_options);
}
tool = (Tool *) g_malloc (sizeof (Tool));
private = (EllipseSelect *) g_malloc (sizeof (EllipseSelect));
tool = tools_new_tool (ELLIPSE_SELECT);
private = g_new (EllipseSelect, 1);
private->core = draw_core_new (ellipse_select_draw);
/* Make the selection static, not blinking */
private->x = private->y = 0;
private->w = private->h = 0;
tool->type = ELLIPSE_SELECT;
tool->state = INACTIVE;
tool->scroll_lock = 0; /* Allow scrolling */
tool->auto_snap_to = TRUE;
tool->private = (void *) private;
tool->preserve = TRUE;
tool->gdisp_ptr = NULL;
tool->drawable = NULL;
tool->button_press_func = rect_select_button_press;
tool->button_press_func = rect_select_button_press;
tool->button_release_func = rect_select_button_release;
tool->motion_func = rect_select_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->modifier_key_func = standard_modifier_key_func;
tool->cursor_update_func = rect_select_cursor_update;
tool->control_func = rect_select_control;
tool->motion_func = rect_select_motion;
tool->cursor_update_func = rect_select_cursor_update;
tool->control_func = rect_select_control;
return tool;
}

View File

@ -463,30 +463,22 @@ tools_new_free_select (void)
tools_register (FREE_SELECT, (ToolOptions *) free_options);
}
tool = (Tool *) g_malloc (sizeof (Tool));
private = (FreeSelect *) g_malloc (sizeof (FreeSelect));
tool = tools_new_tool (FREE_SELECT);
private = g_new (FreeSelect, 1);
private->core = draw_core_new (free_select_draw);
private->num_pts = 0;
private->op = SELECTION_REPLACE;
tool->type = FREE_SELECT;
tool->state = INACTIVE;
tool->scroll_lock = 1; /* Do not allow scrolling */
tool->auto_snap_to = TRUE;
tool->private = (void *) private;
tool->preserve = TRUE;
tool->gdisp_ptr = NULL;
tool->drawable = NULL;
tool->scroll_lock = TRUE; /* Do not allow scrolling */
tool->button_press_func = free_select_button_press;
tool->private = (void *) private;
tool->button_press_func = free_select_button_press;
tool->button_release_func = free_select_button_release;
tool->motion_func = free_select_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->modifier_key_func = standard_modifier_key_func;
tool->cursor_update_func = rect_select_cursor_update;
tool->control_func = free_select_control;
tool->motion_func = free_select_motion;
tool->cursor_update_func = rect_select_cursor_update;
tool->control_func = free_select_control;
return tool;
}

View File

@ -63,9 +63,10 @@ Channel * fuzzy_mask = NULL;
static void fuzzy_select_button_press (Tool *, GdkEventButton *, gpointer);
static void fuzzy_select_button_release (Tool *, GdkEventButton *, gpointer);
static void fuzzy_select_motion (Tool *, GdkEventMotion *, gpointer);
static void fuzzy_select_draw (Tool *);
static void fuzzy_select_control (Tool *, ToolAction, gpointer);
static void fuzzy_select_draw (Tool *);
/* fuzzy select action functions */
static GdkSegment * fuzzy_select_calculate (Tool *, void *, int *);
@ -561,28 +562,20 @@ tools_new_fuzzy_select (void)
tools_register (FUZZY_SELECT, (ToolOptions *) fuzzy_options);
}
tool = (Tool *) g_malloc (sizeof (Tool));
private = (FuzzySelect *) g_malloc (sizeof (FuzzySelect));
tool = tools_new_tool (FUZZY_SELECT);
private = g_new (FuzzySelect, 1);
private->core = draw_core_new (fuzzy_select_draw);
tool->type = FUZZY_SELECT;
tool->state = INACTIVE;
tool->scroll_lock = 1; /* Disallow scrolling */
tool->auto_snap_to = TRUE;
tool->scroll_lock = TRUE; /* Disallow scrolling */
tool->private = (void *) private;
tool->preserve = TRUE;
tool->gdisp_ptr = NULL;
tool->drawable = NULL;
tool->button_press_func = fuzzy_select_button_press;
tool->button_press_func = fuzzy_select_button_press;
tool->button_release_func = fuzzy_select_button_release;
tool->motion_func = fuzzy_select_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->modifier_key_func = standard_modifier_key_func;
tool->cursor_update_func = rect_select_cursor_update;
tool->control_func = fuzzy_select_control;
tool->motion_func = fuzzy_select_motion;
tool->cursor_update_func = rect_select_cursor_update;
tool->control_func = fuzzy_select_control;
return tool;
}

View File

@ -1601,6 +1601,7 @@ gdisplay_set_menu_sensitivity (GDisplay *gdisp)
else
{
SET_SENSITIVE ("/View", TRUE);
SET_STATE ("/View/Toggle Selection", !gdisp->select->hidden);
SET_STATE ("/View/Toggle Rulers",
GTK_WIDGET_VISIBLE (gdisp->origin) ? 1 : 0);
SET_STATE ("/View/Toggle Guides", gdisp->draw_guides);

View File

@ -527,10 +527,18 @@ view_toggle_selection_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
GDisplay * gdisp;
int new_val;
return_if_no_display (gdisp);
selection_hide (gdisp->select, (void *) gdisp);
gdisplays_flush ();
new_val = GTK_CHECK_MENU_ITEM (widget)->active;
/* hidden == TRUE corresponds to the menu toggle being FALSE */
if (new_val == gdisp->select->hidden)
{
selection_hide (gdisp->select, (void *) gdisp);
gdisplays_flush ();
}
}
void

View File

@ -527,10 +527,18 @@ view_toggle_selection_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
GDisplay * gdisp;
int new_val;
return_if_no_display (gdisp);
selection_hide (gdisp->select, (void *) gdisp);
gdisplays_flush ();
new_val = GTK_CHECK_MENU_ITEM (widget)->active;
/* hidden == TRUE corresponds to the menu toggle being FALSE */
if (new_val == gdisp->select->hidden)
{
selection_hide (gdisp->select, (void *) gdisp);
gdisplays_flush ();
}
}
void

View File

@ -142,7 +142,7 @@ static GtkItemFactoryEntry image_entries[] =
{ N_("/View/Window Info..."), "<control><shift>I", view_window_info_cmd_callback, 0 },
{ N_("/View/---"), NULL, NULL, 0, "<Separator>" },
{ N_("/View/Toggle Selection"), "<control>T", view_toggle_selection_cmd_callback, 0 },
{ N_("/View/Toggle Selection"), "<control>T", view_toggle_selection_cmd_callback, 0, "<ToggleItem>" },
{ N_("/View/Toggle Rulers"), "<control><shift>R", view_toggle_rulers_cmd_callback, 0, "<ToggleItem>" },
{ N_("/View/Toggle Statusbar"), "<control><shift>S", view_toggle_statusbar_cmd_callback, 0, "<ToggleItem>" },
{ N_("/View/Toggle Guides"), "<control><shift>T", view_toggle_guides_cmd_callback, 0, "<ToggleItem>" },
@ -301,8 +301,6 @@ static GtkItemFactory *paths_factory = NULL;
static int initialize = TRUE;
extern int num_tools;
void
menus_get_toolbox_menubar (GtkWidget **menubar,
GtkAccelGroup **accel_group)

View File

@ -50,11 +50,7 @@ static HistogramToolDialog * histogram_tool_dialog = NULL;
/* histogram_tool action functions */
static void histogram_tool_button_press (Tool *, GdkEventButton *, gpointer);
static void histogram_tool_button_release (Tool *, GdkEventButton *, gpointer);
static void histogram_tool_motion (Tool *, GdkEventMotion *, gpointer);
static void histogram_tool_cursor_update (Tool *, GdkEventMotion *, gpointer);
static void histogram_tool_control (Tool *, ToolAction, gpointer);
static void histogram_tool_control (Tool *, ToolAction, gpointer);
static HistogramToolDialog * histogram_tool_new_dialog (void);
@ -142,44 +138,6 @@ histogram_tool_dialog_update (HistogramToolDialog *htd,
/* histogram_tool action functions */
static void
histogram_tool_button_press (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr)
{
GDisplay *gdisp;
gdisp = gdisp_ptr;
tool->gdisp_ptr = gdisp;
tool->drawable = gimage_active_drawable (gdisp->gimage);
}
static void
histogram_tool_button_release (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr)
{
}
static void
histogram_tool_motion (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
{
}
static void
histogram_tool_cursor_update (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
{
GDisplay *gdisp;
gdisp = (GDisplay *) gdisp_ptr;
gdisplay_install_tool_cursor (gdisp, GDK_TOP_LEFT_ARROW);
}
static void
histogram_tool_control (Tool *tool,
ToolAction action,
@ -216,25 +174,14 @@ tools_new_histogram_tool ()
tools_register (HISTOGRAM, histogram_tool_options);
}
tool = (Tool *) g_malloc (sizeof (Tool));
private = (HistogramTool *) g_malloc (sizeof (HistogramTool));
tool = tools_new_tool (HISTOGRAM);
private = g_new (HistogramTool, 1);
tool->scroll_lock = TRUE; /* Disallow scrolling */
tool->preserve = FALSE; /* Don't preserve on drawable change */
tool->type = HISTOGRAM;
tool->state = INACTIVE;
tool->scroll_lock = 1; /* Disallow scrolling */
tool->auto_snap_to = TRUE;
tool->private = (void *) private;
tool->preserve = FALSE;
tool->gdisp_ptr = NULL;
tool->drawable = NULL;
tool->button_press_func = histogram_tool_button_press;
tool->button_release_func = histogram_tool_button_release;
tool->motion_func = histogram_tool_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->modifier_key_func = standard_modifier_key_func;
tool->cursor_update_func = histogram_tool_cursor_update;
tool->control_func = histogram_tool_control;
return tool;

View File

@ -79,13 +79,9 @@ static int default_colors[6][3] =
/* hue saturation action functions */
static void hue_saturation_button_press (Tool *, GdkEventButton *, gpointer);
static void hue_saturation_button_release (Tool *, GdkEventButton *, gpointer);
static void hue_saturation_motion (Tool *, GdkEventMotion *, gpointer);
static void hue_saturation_cursor_update (Tool *, GdkEventMotion *, gpointer);
static void hue_saturation_control (Tool *, ToolAction, gpointer);
static void hue_saturation_control (Tool *, ToolAction, gpointer);
static HueSaturationDialog * hue_saturation_new_dialog (void);
static HueSaturationDialog * hue_saturation_new_dialog (void);
static void hue_saturation_update (HueSaturationDialog *,
int);
@ -229,44 +225,6 @@ hue_saturation (PixelRegion *srcPR,
/* by_color select action functions */
static void
hue_saturation_button_press (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr)
{
GDisplay *gdisp;
gdisp = gdisp_ptr;
tool->gdisp_ptr = gdisp;
tool->drawable = gimage_active_drawable (gdisp->gimage);
}
static void
hue_saturation_button_release (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr)
{
}
static void
hue_saturation_motion (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
{
}
static void
hue_saturation_cursor_update (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
{
GDisplay *gdisp;
gdisp = (GDisplay *) gdisp_ptr;
gdisplay_install_tool_cursor (gdisp, GDK_TOP_LEFT_ARROW);
}
static void
hue_saturation_control (Tool *tool,
ToolAction action,
@ -303,25 +261,14 @@ tools_new_hue_saturation ()
tools_register (HUE_SATURATION, hue_saturation_options);
}
tool = (Tool *) g_malloc (sizeof (Tool));
private = (HueSaturation *) g_malloc (sizeof (HueSaturation));
tool = tools_new_tool (HUE_SATURATION);
private = g_new (HueSaturation, 1);
tool->scroll_lock = TRUE; /* Disallow scrolling */
tool->preserve = FALSE; /* Don't preserve on drawable change */
tool->type = HUE_SATURATION;
tool->state = INACTIVE;
tool->scroll_lock = 1; /* Disallow scrolling */
tool->auto_snap_to = TRUE;
tool->private = (void *) private;
tool->preserve = FALSE;
tool->gdisp_ptr = NULL;
tool->drawable = NULL;
tool->button_press_func = hue_saturation_button_press;
tool->button_release_func = hue_saturation_button_release;
tool->motion_func = hue_saturation_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->modifier_key_func = standard_modifier_key_func;
tool->cursor_update_func = hue_saturation_cursor_update;
tool->control_func = hue_saturation_control;
return tool;
@ -352,7 +299,7 @@ hue_saturation_initialize (GDisplay *gdisp)
return;
}
/* The "by color" dialog */
/* The "hue-saturation color" dialog */
if (!hue_saturation_dialog)
hue_saturation_dialog = hue_saturation_new_dialog ();
else

View File

@ -881,7 +881,6 @@ ink_button_release (Tool *tool,
}
static void
dist_smoother_init (InkTool* ink_tool, gdouble initval)
{
@ -895,7 +894,6 @@ dist_smoother_init (InkTool* ink_tool, gdouble initval)
}
}
static gdouble
dist_smoother_result (InkTool* ink_tool)
{
@ -910,7 +908,6 @@ dist_smoother_result (InkTool* ink_tool)
return (result / (gdouble)DIST_SMOOTHER_BUFFER);
}
static void
dist_smoother_add (InkTool* ink_tool, gdouble value)
{
@ -921,7 +918,6 @@ dist_smoother_add (InkTool* ink_tool, gdouble value)
}
static void
time_smoother_init (InkTool* ink_tool, guint32 initval)
{
@ -935,7 +931,6 @@ time_smoother_init (InkTool* ink_tool, guint32 initval)
}
}
static gdouble
time_smoother_result (InkTool* ink_tool)
{
@ -954,7 +949,6 @@ time_smoother_result (InkTool* ink_tool)
#endif
}
static void
time_smoother_add (InkTool* ink_tool, guint32 value)
{
@ -965,7 +959,6 @@ time_smoother_add (InkTool* ink_tool, guint32 value)
}
static void
ink_motion (Tool *tool,
GdkEventMotion *mevent,
@ -1073,13 +1066,9 @@ ink_control (Tool *tool,
ToolAction action,
gpointer gdisp_ptr)
{
GDisplay *gdisp;
GimpDrawable *drawable;
InkTool *ink_tool;
gdisp = (GDisplay *) gdisp_ptr;
ink_tool = (InkTool *) tool->private;
drawable = gimage_active_drawable (gdisp->gimage);
switch (action)
{
@ -1102,7 +1091,7 @@ ink_control (Tool *tool,
static void
ink_init (InkTool *ink_tool, GimpDrawable *drawable,
double x, double y)
double x, double y)
{
/* free the block structures */
if (undo_tiles)
@ -1526,9 +1515,9 @@ ink_set_canvas_tiles (int x, int y, int w, int h)
}
}
/****************************/
/**************************/
/* Global ink functions */
/****************************/
/**************************/
void
ink_no_draw (Tool *tool)
@ -1552,30 +1541,19 @@ tools_new_ink (void)
ink_options_reset ();
}
tool = (Tool *) g_malloc (sizeof (Tool));
private = (InkTool *) g_malloc (sizeof (InkTool));
tool = tools_new_tool (INK);
private = g_new (InkTool, 1);
private->core = draw_core_new (ink_no_draw);
private->last_blob = NULL;
tool->type = INK;
tool->state = INACTIVE;
tool->scroll_lock = 0; /* Allow scrolling */
tool->auto_snap_to = TRUE;
tool->gdisp_ptr = NULL;
tool->private = private;
tool->preserve = TRUE;
tool->gdisp_ptr = NULL;
tool->drawable = NULL;
tool->button_press_func = ink_button_press;
tool->button_press_func = ink_button_press;
tool->button_release_func = ink_button_release;
tool->motion_func = ink_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->modifier_key_func = standard_modifier_key_func;
tool->cursor_update_func = ink_cursor_update;
tool->control_func = ink_control;
tool->motion_func = ink_motion;
tool->cursor_update_func = ink_cursor_update;
tool->control_func = ink_control;
return tool;
}

View File

@ -97,8 +97,6 @@ static int pixmap_colors[8][3] =
{ 0xFF, 0xFF, 0xFF }, /* h - 255 */
};
extern int num_tools;
#define COLUMNS 3
#define ROWS 8
#define MARGIN 2

View File

@ -420,36 +420,28 @@ tools_new_iscissors ()
tools_register (ISCISSORS, (ToolOptions *) iscissors_options);
}
tool = (Tool *) g_malloc (sizeof (Tool));
private = (Iscissors *) g_malloc (sizeof (Iscissors));
tool = tools_new_tool (ISCISSORS);
private = g_new (Iscissors, 1);
private->core = draw_core_new (iscissors_draw);
private->edge_buf = NULL;
private->kinks = NULL;
private->mask = NULL;
tool->type = ISCISSORS;
tool->state = INACTIVE;
tool->scroll_lock = 0; /* Allow scrolling */
tool->auto_snap_to = FALSE;
tool->auto_snap_to = FALSE; /* Dont't snap to guides */
tool->private = (void *) private;
tool->preserve = TRUE;
tool->gdisp_ptr = NULL;
tool->drawable = NULL;
tool->button_press_func = iscissors_button_press;
tool->button_press_func = iscissors_button_press;
tool->button_release_func = iscissors_button_release;
tool->motion_func = iscissors_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->modifier_key_func = standard_modifier_key_func;
tool->cursor_update_func = rect_select_cursor_update;
tool->control_func = iscissors_control;
tool->motion_func = iscissors_motion;
tool->cursor_update_func = rect_select_cursor_update;
tool->control_func = iscissors_control;
last_tool = tool;
iscissors_reset (private);
return tool;
}

View File

@ -117,11 +117,7 @@ static LevelsDialog *levels_dialog = NULL;
/* levels action functions */
static void levels_button_press (Tool *, GdkEventButton *, gpointer);
static void levels_button_release (Tool *, GdkEventButton *, gpointer);
static void levels_motion (Tool *, GdkEventMotion *, gpointer);
static void levels_cursor_update (Tool *, GdkEventMotion *, gpointer);
static void levels_control (Tool *, ToolAction, gpointer);
static void levels_control (Tool *, ToolAction, gpointer);
static LevelsDialog * levels_new_dialog (void);
@ -166,44 +162,6 @@ levels_histogram_range (HistogramWidget *h,
/* levels action functions */
static void
levels_button_press (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr)
{
GDisplay *gdisp;
gdisp = gdisp_ptr;
tool->gdisp_ptr = gdisp;
tool->drawable = gimage_active_drawable (gdisp->gimage);
}
static void
levels_button_release (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr)
{
}
static void
levels_motion (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
{
}
static void
levels_cursor_update (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
{
GDisplay *gdisp;
gdisp = (GDisplay *) gdisp_ptr;
gdisplay_install_tool_cursor (gdisp, GDK_TOP_LEFT_ARROW);
}
static void
levels_control (Tool *tool,
ToolAction action,
@ -240,25 +198,14 @@ tools_new_levels ()
tools_register (LEVELS, levels_options);
}
tool = (Tool *) g_malloc (sizeof (Tool));
private = (Levels *) g_malloc (sizeof (Levels));
tool = tools_new_tool (LEVELS);
private = g_new (Levels, 1);
tool->scroll_lock = TRUE; /* Disallow scrolling */
tool->preserve = FALSE; /* Don't preserve on drawable change */
tool->type = LEVELS;
tool->state = INACTIVE;
tool->scroll_lock = 1; /* Disallow scrolling */
tool->auto_snap_to = TRUE;
tool->private = (void *) private;
tool->preserve = FALSE;
tool->gdisp_ptr = NULL;
tool->drawable = NULL;
tool->button_press_func = levels_button_press;
tool->button_release_func = levels_button_release;
tool->motion_func = levels_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->modifier_key_func = standard_modifier_key_func;
tool->cursor_update_func = levels_cursor_update;
tool->control_func = levels_control;
return tool;

View File

@ -359,30 +359,23 @@ tools_new_magnify (void)
tools_register (MAGNIFY, (ToolOptions *) magnify_options);
}
tool = (Tool *) g_malloc (sizeof (Tool));
private = (Magnify *) g_malloc (sizeof (Magnify));
tool = tools_new_tool (MAGNIFY);
private = g_new (Magnify, 1);
private->core = draw_core_new (magnify_draw);
private->x = private->y = 0;
private->w = private->h = 0;
tool->type = MAGNIFY;
tool->state = INACTIVE;
tool->scroll_lock = 1; /* disallow scrolling */
tool->auto_snap_to = FALSE;
tool->scroll_lock = TRUE; /* Disallow scrolling */
tool->auto_snap_to = FALSE; /* Don't snap to guides */
tool->private = (void *) private;
tool->preserve = TRUE;
tool->gdisp_ptr = NULL;
tool->drawable = NULL;
tool->button_press_func = magnify_button_press;
tool->button_press_func = magnify_button_press;
tool->button_release_func = magnify_button_release;
tool->motion_func = magnify_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->modifier_key_func = standard_modifier_key_func;
tool->cursor_update_func = magnify_cursor_update;
tool->control_func = magnify_control;
tool->motion_func = magnify_motion;
tool->cursor_update_func = magnify_cursor_update;
tool->control_func = magnify_control;
return tool;
}

View File

@ -142,7 +142,7 @@ static GtkItemFactoryEntry image_entries[] =
{ N_("/View/Window Info..."), "<control><shift>I", view_window_info_cmd_callback, 0 },
{ N_("/View/---"), NULL, NULL, 0, "<Separator>" },
{ N_("/View/Toggle Selection"), "<control>T", view_toggle_selection_cmd_callback, 0 },
{ N_("/View/Toggle Selection"), "<control>T", view_toggle_selection_cmd_callback, 0, "<ToggleItem>" },
{ N_("/View/Toggle Rulers"), "<control><shift>R", view_toggle_rulers_cmd_callback, 0, "<ToggleItem>" },
{ N_("/View/Toggle Statusbar"), "<control><shift>S", view_toggle_statusbar_cmd_callback, 0, "<ToggleItem>" },
{ N_("/View/Toggle Guides"), "<control><shift>T", view_toggle_guides_cmd_callback, 0, "<ToggleItem>" },
@ -301,8 +301,6 @@ static GtkItemFactory *paths_factory = NULL;
static int initialize = TRUE;
extern int num_tools;
void
menus_get_toolbox_menubar (GtkWidget **menubar,
GtkAccelGroup **accel_group)

View File

@ -142,7 +142,7 @@ static GtkItemFactoryEntry image_entries[] =
{ N_("/View/Window Info..."), "<control><shift>I", view_window_info_cmd_callback, 0 },
{ N_("/View/---"), NULL, NULL, 0, "<Separator>" },
{ N_("/View/Toggle Selection"), "<control>T", view_toggle_selection_cmd_callback, 0 },
{ N_("/View/Toggle Selection"), "<control>T", view_toggle_selection_cmd_callback, 0, "<ToggleItem>" },
{ N_("/View/Toggle Rulers"), "<control><shift>R", view_toggle_rulers_cmd_callback, 0, "<ToggleItem>" },
{ N_("/View/Toggle Statusbar"), "<control><shift>S", view_toggle_statusbar_cmd_callback, 0, "<ToggleItem>" },
{ N_("/View/Toggle Guides"), "<control><shift>T", view_toggle_guides_cmd_callback, 0, "<ToggleItem>" },
@ -301,8 +301,6 @@ static GtkItemFactory *paths_factory = NULL;
static int initialize = TRUE;
extern int num_tools;
void
menus_get_toolbox_menubar (GtkWidget **menubar,
GtkAccelGroup **accel_group)

View File

@ -48,13 +48,13 @@ static GdkGC *move_gc = NULL;
/* move tool action functions */
static void move_tool_button_press (Tool *, GdkEventButton *, gpointer);
static void move_tool_button_release (Tool *, GdkEventButton *, gpointer);
static void move_tool_motion (Tool *, GdkEventMotion *, gpointer);
static void move_tool_cursor_update (Tool *, GdkEventMotion *, gpointer);
static void move_tool_control (Tool *, ToolAction, gpointer);
static void move_tool_button_press (Tool *, GdkEventButton *, gpointer);
static void move_tool_button_release (Tool *, GdkEventButton *, gpointer);
static void move_tool_motion (Tool *, GdkEventMotion *, gpointer);
static void move_tool_cursor_update (Tool *, GdkEventMotion *, gpointer);
static void move_tool_control (Tool *, ToolAction, gpointer);
static void move_create_gc (GDisplay *);
static void move_create_gc (GDisplay *);
/* move action functions */
@ -129,7 +129,8 @@ move_tool_button_press (Tool *tool,
/* if we've got an active tool grab the pointer */
if (tool->state == ACTIVE)
gdk_pointer_grab (gdisp->canvas->window, FALSE,
GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON1_MOTION_MASK | GDK_BUTTON_RELEASE_MASK,
GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON1_MOTION_MASK |
GDK_BUTTON_RELEASE_MASK,
NULL, NULL, bevent->time);
}
@ -444,30 +445,23 @@ tools_new_move_tool ()
tools_register (MOVE, (ToolOptions *) move_options);
}
tool = (Tool *) g_malloc (sizeof (Tool));
private = (MoveTool *) g_malloc (sizeof (MoveTool));
tool = tools_new_tool (MOVE);
private = g_new (MoveTool, 1);
private->layer = NULL;
private->guide = NULL;
private->disp = NULL;
tool->type = MOVE;
tool->state = INACTIVE;
tool->scroll_lock = 0; /* Allow scrolling */
tool->auto_snap_to = FALSE;
tool->auto_snap_to = FALSE; /* Don't snap to guides */
tool->private = (void *) private;
tool->preserve = TRUE;
tool->gdisp_ptr = NULL;
tool->drawable = NULL;
tool->button_press_func = move_tool_button_press;
tool->button_press_func = move_tool_button_press;
tool->button_release_func = move_tool_button_release;
tool->motion_func = move_tool_motion;
tool->arrow_keys_func = edit_sel_arrow_keys_func;
tool->modifier_key_func = standard_modifier_key_func;
tool->cursor_update_func = move_tool_cursor_update;
tool->control_func = move_tool_control;
tool->motion_func = move_tool_motion;
tool->arrow_keys_func = edit_sel_arrow_keys_func;
tool->cursor_update_func = move_tool_cursor_update;
tool->control_func = move_tool_control;
return tool;
}

View File

@ -881,7 +881,6 @@ ink_button_release (Tool *tool,
}
static void
dist_smoother_init (InkTool* ink_tool, gdouble initval)
{
@ -895,7 +894,6 @@ dist_smoother_init (InkTool* ink_tool, gdouble initval)
}
}
static gdouble
dist_smoother_result (InkTool* ink_tool)
{
@ -910,7 +908,6 @@ dist_smoother_result (InkTool* ink_tool)
return (result / (gdouble)DIST_SMOOTHER_BUFFER);
}
static void
dist_smoother_add (InkTool* ink_tool, gdouble value)
{
@ -921,7 +918,6 @@ dist_smoother_add (InkTool* ink_tool, gdouble value)
}
static void
time_smoother_init (InkTool* ink_tool, guint32 initval)
{
@ -935,7 +931,6 @@ time_smoother_init (InkTool* ink_tool, guint32 initval)
}
}
static gdouble
time_smoother_result (InkTool* ink_tool)
{
@ -954,7 +949,6 @@ time_smoother_result (InkTool* ink_tool)
#endif
}
static void
time_smoother_add (InkTool* ink_tool, guint32 value)
{
@ -965,7 +959,6 @@ time_smoother_add (InkTool* ink_tool, guint32 value)
}
static void
ink_motion (Tool *tool,
GdkEventMotion *mevent,
@ -1073,13 +1066,9 @@ ink_control (Tool *tool,
ToolAction action,
gpointer gdisp_ptr)
{
GDisplay *gdisp;
GimpDrawable *drawable;
InkTool *ink_tool;
gdisp = (GDisplay *) gdisp_ptr;
ink_tool = (InkTool *) tool->private;
drawable = gimage_active_drawable (gdisp->gimage);
switch (action)
{
@ -1102,7 +1091,7 @@ ink_control (Tool *tool,
static void
ink_init (InkTool *ink_tool, GimpDrawable *drawable,
double x, double y)
double x, double y)
{
/* free the block structures */
if (undo_tiles)
@ -1526,9 +1515,9 @@ ink_set_canvas_tiles (int x, int y, int w, int h)
}
}
/****************************/
/**************************/
/* Global ink functions */
/****************************/
/**************************/
void
ink_no_draw (Tool *tool)
@ -1552,30 +1541,19 @@ tools_new_ink (void)
ink_options_reset ();
}
tool = (Tool *) g_malloc (sizeof (Tool));
private = (InkTool *) g_malloc (sizeof (InkTool));
tool = tools_new_tool (INK);
private = g_new (InkTool, 1);
private->core = draw_core_new (ink_no_draw);
private->last_blob = NULL;
tool->type = INK;
tool->state = INACTIVE;
tool->scroll_lock = 0; /* Allow scrolling */
tool->auto_snap_to = TRUE;
tool->gdisp_ptr = NULL;
tool->private = private;
tool->preserve = TRUE;
tool->gdisp_ptr = NULL;
tool->drawable = NULL;
tool->button_press_func = ink_button_press;
tool->button_press_func = ink_button_press;
tool->button_release_func = ink_button_release;
tool->motion_func = ink_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->modifier_key_func = standard_modifier_key_func;
tool->cursor_update_func = ink_cursor_update;
tool->control_func = ink_control;
tool->motion_func = ink_motion;
tool->cursor_update_func = ink_cursor_update;
tool->control_func = ink_control;
return tool;
}

View File

@ -512,36 +512,25 @@ paint_core_draw (Tool *tool)
}
Tool *
paint_core_new (int type)
paint_core_new (ToolType type)
{
Tool * tool;
PaintCore * private;
tool = (Tool *) g_malloc (sizeof (Tool));
private = (PaintCore *) g_malloc (sizeof (PaintCore));
tool = tools_new_tool (type);
private = g_new (PaintCore, 1);
private->core = draw_core_new (paint_core_draw);
private->pick_colors = FALSE;
tool->type = type;
tool->state = INACTIVE;
tool->scroll_lock = 0; /* Allow scrolling */
tool->auto_snap_to = TRUE;
tool->gdisp_ptr = NULL;
tool->private = (void *) private;
tool->preserve = TRUE;
tool->gdisp_ptr = NULL;
tool->drawable = NULL;
tool->button_press_func = paint_core_button_press;
tool->button_press_func = paint_core_button_press;
tool->button_release_func = paint_core_button_release;
tool->motion_func = paint_core_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->modifier_key_func = standard_modifier_key_func;
tool->cursor_update_func = paint_core_cursor_update;
tool->control_func = paint_core_control;
tool->motion_func = paint_core_motion;
tool->cursor_update_func = paint_core_cursor_update;
tool->control_func = paint_core_control;
return tool;
}

View File

@ -118,7 +118,7 @@ void paint_core_control (Tool *, ToolAction, gpointer);
/* paint tool functions */
void paint_core_no_draw (Tool *);
Tool * paint_core_new (int);
Tool * paint_core_new (ToolType);
void paint_core_free (Tool *);
int paint_core_init (PaintCore *, GimpDrawable *, double, double);
void paint_core_interpolate (PaintCore *, GimpDrawable *);

View File

@ -72,11 +72,7 @@ static PosterizeDialog *posterize_dialog = NULL;
/* posterize action functions */
static void posterize_button_press (Tool *, GdkEventButton *, gpointer);
static void posterize_button_release (Tool *, GdkEventButton *, gpointer);
static void posterize_motion (Tool *, GdkEventMotion *, gpointer);
static void posterize_cursor_update (Tool *, GdkEventMotion *, gpointer);
static void posterize_control (Tool *, ToolAction, gpointer);
static void posterize_control (Tool *, ToolAction, gpointer);
static PosterizeDialog * posterize_new_dialog (void);
@ -90,44 +86,6 @@ static gint posterize_delete_callback (GtkWidget *, GdkEvent *, gpointer);
/* posterize select action functions */
static void
posterize_button_press (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr)
{
GDisplay *gdisp;
gdisp = gdisp_ptr;
tool->gdisp_ptr = gdisp;
tool->drawable = gimage_active_drawable (gdisp->gimage);
}
static void
posterize_button_release (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr)
{
}
static void
posterize_motion (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
{
}
static void
posterize_cursor_update (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
{
GDisplay *gdisp;
gdisp = (GDisplay *) gdisp_ptr;
gdisplay_install_tool_cursor (gdisp, GDK_TOP_LEFT_ARROW);
}
static void
posterize_control (Tool *tool,
ToolAction action,
@ -171,25 +129,14 @@ tools_new_posterize ()
if (!GTK_WIDGET_VISIBLE (posterize_dialog->shell))
gtk_widget_show (posterize_dialog->shell);
tool = (Tool *) g_malloc (sizeof (Tool));
private = (Posterize *) g_malloc (sizeof (Posterize));
tool = tools_new_tool (POSTERIZE);
private = g_new (Posterize, 1);
tool->scroll_lock = TRUE; /* Disallow scrolling */
tool->preserve = FALSE; /* Don't preserve on drawable change */
tool->type = POSTERIZE;
tool->state = INACTIVE;
tool->scroll_lock = 1; /* Disallow scrolling */
tool->auto_snap_to = TRUE;
tool->private = (void *) private;
tool->preserve = FALSE;
tool->gdisp_ptr = NULL;
tool->drawable = NULL;
tool->button_press_func = posterize_button_press;
tool->button_release_func = posterize_button_release;
tool->motion_func = posterize_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->modifier_key_func = standard_modifier_key_func;
tool->cursor_update_func = posterize_cursor_update;
tool->control_func = posterize_control;
return tool;

View File

@ -422,7 +422,6 @@ rect_select_motion (Tool *tool,
draw_core_resume (rect_sel->core, tool);
}
void
rect_select_draw (Tool *tool)
{
@ -446,12 +445,12 @@ rect_select_draw (Tool *tool)
x1, y1, (x2 - x1), (y2 - y1));
}
void
static selection_tool_update_op_state (RectSelect *rect_sel,
int x, int y,
int state,
GDisplay *gdisp)
static void
selection_tool_update_op_state (RectSelect *rect_sel,
int x,
int y,
int state,
GDisplay *gdisp)
{
if (active_tool->state == ACTIVE)
return;
@ -561,31 +560,21 @@ tools_new_rect_select ()
tools_register (RECT_SELECT, (ToolOptions *) rect_options);
}
tool = (Tool *) g_malloc (sizeof (Tool));
private = (RectSelect *) g_malloc (sizeof (RectSelect));
tool = tools_new_tool (RECT_SELECT);
private = g_new (RectSelect, 1);
private->core = draw_core_new (rect_select_draw);
private->x = private->y = 0;
private->w = private->h = 0;
private->op = SELECTION_REPLACE;
tool->type = RECT_SELECT;
tool->state = INACTIVE;
tool->scroll_lock = 0; /* Allow scrolling */
tool->auto_snap_to = TRUE;
tool->private = (void *) private;
tool->preserve = TRUE;
tool->gdisp_ptr = NULL;
tool->drawable = NULL;
tool->button_press_func = rect_select_button_press;
tool->button_press_func = rect_select_button_press;
tool->button_release_func = rect_select_button_release;
tool->motion_func = rect_select_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->modifier_key_func = standard_modifier_key_func;
tool->cursor_update_func = rect_select_cursor_update;
tool->control_func = rect_select_control;
tool->motion_func = rect_select_motion;
tool->cursor_update_func = rect_select_cursor_update;
tool->control_func = rect_select_control;
return tool;
}

View File

@ -108,7 +108,6 @@ static GtkWidget *text_tool_shell = NULL;
static void text_button_press (Tool *, GdkEventButton *, gpointer);
static void text_button_release (Tool *, GdkEventButton *, gpointer);
static void text_motion (Tool *, GdkEventMotion *, gpointer);
static void text_cursor_update (Tool *, GdkEventMotion *, gpointer);
static void text_control (Tool *, ToolAction, gpointer);
@ -242,26 +241,17 @@ tools_new_text ()
}
/* the new text tool structure */
tool = (Tool *) g_malloc (sizeof (Tool));
the_text_tool = (TextTool *) g_malloc (sizeof (TextTool));
tool = tools_new_tool (TEXT);
the_text_tool = g_new (TextTool, 1);
tool->scroll_lock = TRUE; /* Disallow scrolling */
tool->type = TEXT;
tool->state = INACTIVE;
tool->scroll_lock = 1; /* Do not allow scrolling */
tool->auto_snap_to = TRUE;
tool->private = (void *) the_text_tool;
tool->preserve = TRUE;
tool->gdisp_ptr = NULL;
tool->drawable = NULL;
tool->button_press_func = text_button_press;
tool->button_press_func = text_button_press;
tool->button_release_func = text_button_release;
tool->motion_func = text_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->modifier_key_func = standard_modifier_key_func;
tool->cursor_update_func = text_cursor_update;
tool->control_func = text_control;
tool->cursor_update_func = text_cursor_update;
tool->control_func = text_control;
return tool;
}
@ -355,13 +345,6 @@ text_button_release (Tool *tool,
tool->state = INACTIVE;
}
static void
text_motion (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
{
}
static void
text_cursor_update (Tool *tool,
GdkEventMotion *mevent,

View File

@ -49,11 +49,7 @@ static ThresholdDialog *threshold_dialog = NULL;
/* threshold action functions */
static void threshold_button_press (Tool *, GdkEventButton *, gpointer);
static void threshold_button_release (Tool *, GdkEventButton *, gpointer);
static void threshold_motion (Tool *, GdkEventMotion *, gpointer);
static void threshold_cursor_update (Tool *, GdkEventMotion *, gpointer);
static void threshold_control (Tool *, ToolAction, gpointer);
static void threshold_control (Tool *, ToolAction, gpointer);
static ThresholdDialog * threshold_new_dialog (void);
@ -158,44 +154,6 @@ threshold_histogram_range (HistogramWidget *w,
/* threshold action functions */
static void
threshold_button_press (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr)
{
GDisplay *gdisp;
gdisp = gdisp_ptr;
tool->gdisp_ptr = gdisp;
tool->drawable = gimage_active_drawable (gdisp->gimage);
}
static void
threshold_button_release (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr)
{
}
static void
threshold_motion (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
{
}
static void
threshold_cursor_update (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
{
GDisplay *gdisp;
gdisp = (GDisplay *) gdisp_ptr;
gdisplay_install_tool_cursor (gdisp, GDK_TOP_LEFT_ARROW);
}
static void
threshold_control (Tool *tool,
ToolAction action,
@ -239,25 +197,14 @@ tools_new_threshold ()
if (!GTK_WIDGET_VISIBLE (threshold_dialog->shell))
gtk_widget_show (threshold_dialog->shell);
tool = (Tool *) g_malloc (sizeof (Tool));
private = (Threshold *) g_malloc (sizeof (Threshold));
tool = tools_new_tool (THRESHOLD);
private = g_new (Threshold, 1);
tool->scroll_lock = TRUE; /* Disallow scrolling */
tool->preserve = FALSE; /* Don't preserve on drawable change */
tool->type = THRESHOLD;
tool->state = INACTIVE;
tool->scroll_lock = 1; /* Disallow scrolling */
tool->auto_snap_to = TRUE;
tool->private = (void *) private;
tool->preserve = FALSE;
tool->gdisp_ptr = NULL;
tool->drawable = NULL;
tool->button_press_func = threshold_button_press;
tool->button_release_func = threshold_button_release;
tool->motion_func = threshold_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->modifier_key_func = standard_modifier_key_func;
tool->cursor_update_func = threshold_cursor_update;
tool->control_func = threshold_control;
return tool;

View File

@ -71,7 +71,7 @@ static GtkWidget *options_vbox = NULL;
static GtkWidget *options_label = NULL;
static GtkWidget *options_reset_button = NULL;
static int global_tool_ID = 0;
static gint global_tool_ID = 0;
ToolInfo tool_info[] =
{
@ -617,7 +617,7 @@ ToolInfo tool_info[] =
}
};
gint num_tools = sizeof (tool_info) / sizeof (ToolInfo);
gint num_tools = sizeof (tool_info) / sizeof (tool_info[0]);
/* Local function declarations */
@ -654,12 +654,6 @@ tools_select (ToolType type)
tools_options_show (active_tool->type);
/* Set the paused count variable to 0 */
active_tool->paused_count = 0;
active_tool->gdisp_ptr = NULL;
active_tool->drawable = NULL;
active_tool->ID = global_tool_ID++;
/* Update the device-information dialog */
device_status_update (current_device);
}
@ -677,7 +671,14 @@ tools_initialize (ToolType type,
/* Activate the appropriate widget.
* Implicitly calls tools_select()
*/
tools_select (type);
if (active_tool->type == type)
{
tools_select (type);
}
else
{
gtk_widget_activate (tool_info[type].tool_widget);
}
if (tool_info[(int) type].init_func)
{
@ -686,84 +687,12 @@ tools_initialize (ToolType type,
active_tool->drawable = gimage_active_drawable (gdisp->gimage);
}
/* don't set gdisp_ptr here !!! (see commands.c) */
}
void
tools_options_dialog_new ()
{
GtkWidget *frame;
GtkWidget *vbox;
ActionAreaItem action_items[2] =
{
{ N_("Reset"), tools_options_reset_callback, NULL, NULL },
{ N_("Close"), tools_options_close_callback, NULL, NULL }
};
/* The shell and main vbox */
options_shell = gtk_dialog_new ();
/* Register dialog */
dialog_register (options_shell);
gtk_window_set_wmclass (GTK_WINDOW (options_shell), "tool_options", "Gimp");
gtk_window_set_title (GTK_WINDOW (options_shell), _("Tool Options"));
gtk_window_set_policy (GTK_WINDOW (options_shell), FALSE, TRUE, TRUE);
session_set_window_geometry (options_shell, &tool_options_session_info,
FALSE );
/* The outer frame */
frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (options_shell)->vbox), frame);
gtk_widget_show (frame);
/* The vbox containing the title frame and the options vbox */
vbox = gtk_vbox_new (FALSE, 0);
gtk_container_add (GTK_CONTAINER (frame), vbox);
gtk_widget_show (vbox);
/* The title frame */
frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_OUT);
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
gtk_widget_show (frame);
options_label = gtk_label_new ("");
gtk_misc_set_padding (GTK_MISC (options_label), 1, 0);
gtk_container_add (GTK_CONTAINER (frame), options_label);
gtk_widget_show (options_label);
options_vbox = gtk_vbox_new (FALSE, 0);
gtk_container_set_border_width (GTK_CONTAINER (options_vbox), 2);
gtk_box_pack_start (GTK_BOX (vbox), options_vbox, FALSE, FALSE, 0);
/* handle the window manager trying to close the window */
gtk_signal_connect (GTK_OBJECT (options_shell), "delete_event",
GTK_SIGNAL_FUNC (tools_options_delete_callback),
options_shell);
action_items[0].user_data = options_shell;
action_items[1].user_data = options_shell;
build_action_area (GTK_DIALOG (options_shell), action_items, 2, 1);
options_reset_button = action_items[0].widget;
gtk_widget_show (options_vbox);
/* hide the separator between the dialog's vbox and the action area */
gtk_widget_hide (GTK_WIDGET (g_list_nth_data (gtk_container_children (GTK_CONTAINER (GTK_BIN (options_shell)->child)), 1)));
/* don't set gdisp_ptr here! (see commands.c) */
}
void
tools_options_dialog_show ()
{
/* menus_activate_callback() will destroy the active tool in many
cases. if the user tries to bring up the options before
switching tools, the dialog will be empty. recreate the active
tool here if necessary to avoid this behavior */
if (!GTK_WIDGET_VISIBLE (options_shell))
{
gtk_widget_show (options_shell);
@ -774,34 +703,6 @@ tools_options_dialog_show ()
}
}
void
tools_options_dialog_free ()
{
session_get_window_info (options_shell, &tool_options_session_info);
gtk_widget_destroy (options_shell);
}
void
tools_register (ToolType tool_type,
ToolOptions *tool_options)
{
g_return_if_fail (tool_options != NULL);
tool_info [(int) tool_type].tool_options = tool_options;
/* need to check whether the widget is visible...this can happen
* because some tools share options such as the transformation tools
*/
if (! GTK_WIDGET_VISIBLE (tool_options->main_vbox))
{
gtk_box_pack_start (GTK_BOX (options_vbox), tool_options->main_vbox,
TRUE, TRUE, 0);
gtk_widget_show (tool_options->main_vbox);
}
gtk_label_set_text (GTK_LABEL (options_label), _(tool_options->title));
}
void
active_tool_control (ToolAction action,
void *gdisp_ptr)
@ -857,21 +758,200 @@ active_tool_control (ToolAction action,
}
}
void
/* standard member functions */
static void
standard_button_press_func (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr)
{
GDisplay *gdisp;
gdisp = gdisp_ptr;
tool->gdisp_ptr = gdisp;
tool->drawable = gimage_active_drawable (gdisp->gimage);
}
static void
standard_button_release_func (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr)
{
}
static void
standard_motion_func (Tool *tool,
GdkEventMotion *bevent,
gpointer gdisp_ptr)
{
}
static void
standard_arrow_keys_func (Tool *tool,
GdkEventKey *kevent,
gpointer gdisp_ptr)
{
}
void
static void
standard_modifier_key_func (Tool *tool,
GdkEventKey *kevent,
gpointer gdisp_ptr)
{
}
/* tool options function */
static void
standard_cursor_update_func (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
{
GDisplay *gdisp;
gdisp = (GDisplay *) gdisp_ptr;
gdisplay_install_tool_cursor (gdisp, GDK_TOP_LEFT_ARROW);
}
static void
standard_control_func (Tool *tool,
ToolAction action,
gpointer gdisp_ptr)
{
}
/* Create a default tool structure
*
* TODO: objectifying the tools will remove lots of code duplication
*/
Tool *
tools_new_tool (ToolType type)
{
Tool *tool;
tool = g_new (Tool, 1);
tool->type = type;
tool->ID = global_tool_ID++;
tool->state = INACTIVE;
tool->paused_count = 0;
tool->scroll_lock = FALSE; /* Allow scrolling */
tool->auto_snap_to = TRUE; /* Snap to guides */
tool->preserve = TRUE; /* Preserve tool across drawable changes */
tool->gdisp_ptr = NULL;
tool->drawable = NULL;
tool->private = NULL;
tool->button_press_func = standard_button_press_func;
tool->button_release_func = standard_button_release_func;
tool->motion_func = standard_motion_func;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->modifier_key_func = standard_modifier_key_func;
tool->cursor_update_func = standard_cursor_update_func;
tool->control_func = standard_control_func;
return tool;
}
/* Tool options function */
void
tools_options_dialog_new ()
{
GtkWidget *frame;
GtkWidget *vbox;
ActionAreaItem action_items[] =
{
{ N_("Reset"), tools_options_reset_callback, NULL, NULL },
{ N_("Close"), tools_options_close_callback, NULL, NULL }
};
/* The shell and main vbox */
options_shell = gtk_dialog_new ();
/* Register dialog */
dialog_register (options_shell);
gtk_window_set_wmclass (GTK_WINDOW (options_shell), "tool_options", "Gimp");
gtk_window_set_title (GTK_WINDOW (options_shell), _("Tool Options"));
gtk_window_set_policy (GTK_WINDOW (options_shell), FALSE, TRUE, TRUE);
session_set_window_geometry (options_shell, &tool_options_session_info,
FALSE );
/* The outer frame */
frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (options_shell)->vbox), frame);
gtk_widget_show (frame);
/* The vbox containing the title frame and the options vbox */
vbox = gtk_vbox_new (FALSE, 0);
gtk_container_add (GTK_CONTAINER (frame), vbox);
gtk_widget_show (vbox);
/* The title frame */
frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_OUT);
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
gtk_widget_show (frame);
options_label = gtk_label_new ("");
gtk_misc_set_padding (GTK_MISC (options_label), 1, 0);
gtk_container_add (GTK_CONTAINER (frame), options_label);
gtk_widget_show (options_label);
options_vbox = gtk_vbox_new (FALSE, 0);
gtk_container_set_border_width (GTK_CONTAINER (options_vbox), 2);
gtk_box_pack_start (GTK_BOX (vbox), options_vbox, FALSE, FALSE, 0);
/* handle the window manager trying to close the window */
gtk_signal_connect (GTK_OBJECT (options_shell), "delete_event",
GTK_SIGNAL_FUNC (tools_options_delete_callback),
options_shell);
action_items[0].user_data = options_shell;
action_items[1].user_data = options_shell;
build_action_area (GTK_DIALOG (options_shell), action_items, 2, 1);
options_reset_button = action_items[0].widget;
gtk_widget_show (options_vbox);
/* hide the separator between the dialog's vbox and the action area */
gtk_widget_hide (GTK_WIDGET (g_list_nth_data (gtk_container_children (GTK_CONTAINER (GTK_BIN (options_shell)->child)), 1)));
}
void
tools_options_dialog_free ()
{
session_get_window_info (options_shell, &tool_options_session_info);
gtk_widget_destroy (options_shell);
}
void
tools_register (ToolType tool_type,
ToolOptions *tool_options)
{
g_return_if_fail (tool_options != NULL);
tool_info [(int) tool_type].tool_options = tool_options;
/* need to check whether the widget is visible...this can happen
* because some tools share options such as the transformation tools
*/
if (! GTK_WIDGET_VISIBLE (tool_options->main_vbox))
{
gtk_box_pack_start (GTK_BOX (options_vbox), tool_options->main_vbox,
TRUE, TRUE, 0);
gtk_widget_show (tool_options->main_vbox);
}
gtk_label_set_text (GTK_LABEL (options_label), _(tool_options->title));
}
static void
tools_options_show (ToolType tooltype)
@ -896,6 +976,8 @@ tools_options_hide (ToolType tooltype)
gtk_widget_hide (tool_info[tooltype].tool_options->main_vbox);
}
/* Tool options callbacks */
static gint
tools_options_delete_callback (GtkWidget *w,
GdkEvent *e,

View File

@ -20,6 +20,7 @@
#include "layerF.h"
#include "gdisplayF.h"
#include "gimpcontext.h"
#include "tool_options.h"
#include "toolsF.h"
@ -43,19 +44,19 @@ typedef enum
struct _Tool
{
/* Data */
ToolType type; /* Tool type */
ToolState state; /* state of tool activity */
int paused_count; /* paused control count */
int scroll_lock; /* allow scrolling or not */
int auto_snap_to; /* should the mouse snap to guides automatically */
void * private; /* Tool-specific information */
void * gdisp_ptr; /* pointer to currently active gdisp */
void * drawable; /* pointer to the drawable that was
active when the tool was created */
int ID; /* unique tool ID */
ToolType type; /* Tool type */
gint ID; /* unique tool ID */
int preserve; /* Preserve this tool through the current
image changes */
ToolState state; /* state of tool activity */
gint paused_count; /* paused control count */
gboolean scroll_lock; /* allow scrolling or not */
gboolean auto_snap_to; /* snap to guides automatically */
gboolean preserve; /* Preserve this tool across drawable changes */
void * gdisp_ptr; /* pointer to currently active gdisp */
void * drawable; /* pointer to the tool's current drawable */
void * private; /* Tool-specific information */
/* Action functions */
ButtonPressFunc button_press_func;
@ -89,14 +90,19 @@ struct _ToolInfo
ToolInfoFreeFunc free_func;
ToolInfoInitFunc init_func;
GtkWidget *tool_widget;
GtkWidget *tool_widget;
GimpContext *tool_context;
};
/* Global Data Structure */
/* Global Data Structures */
extern Tool * active_tool;
extern ToolInfo tool_info[];
extern gint num_tools;
/* Function declarations */
Tool * tools_new_tool (ToolType tool_type);
void tools_select (ToolType tool_type);
void tools_initialize (ToolType tool_type,
GDisplay *gdisplay);
@ -111,8 +117,4 @@ void tools_register (ToolType tool_type,
void active_tool_control (ToolAction action,
void *gdisp_ptr);
/* Standard member functions */
void standard_arrow_keys_func (Tool *, GdkEventKey *, gpointer);
void standard_modifier_key_func (Tool *, GdkEventKey *, gpointer);
#endif /* __TOOLS_H__ */

View File

@ -212,31 +212,25 @@ tools_new_bezier_select ()
tools_register (BEZIER_SELECT, (ToolOptions *) bezier_options);
}
tool = g_malloc (sizeof (Tool));
private = g_malloc (sizeof (BezierSelect));
tool = tools_new_tool (BEZIER_SELECT);
private = g_new (BezierSelect, 1);
private->num_points = 0;
private->mask = NULL;
private->core = draw_core_new (bezier_select_draw);
bezier_select_reset (private);
tool->type = BEZIER_SELECT;
tool->state = INACTIVE;
tool->scroll_lock = 1; /* Do not allow scrolling */
tool->auto_snap_to = TRUE;
tool->scroll_lock = TRUE; /* Disallow scrolling */
tool->preserve = FALSE; /* Don't preserve on drawable change */
tool->private = (void *) private;
tool->preserve = FALSE;
tool->gdisp_ptr = NULL;
tool->drawable = NULL;
tool->button_press_func = bezier_select_button_press;
tool->button_press_func = bezier_select_button_press;
tool->button_release_func = bezier_select_button_release;
tool->motion_func = bezier_select_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->modifier_key_func = standard_modifier_key_func;
tool->cursor_update_func = bezier_select_cursor_update;
tool->control_func = bezier_select_control;
tool->motion_func = bezier_select_motion;
tool->cursor_update_func = bezier_select_cursor_update;
tool->control_func = bezier_select_control;
curCore = private->core;
curSel = private;

View File

@ -1732,28 +1732,20 @@ tools_new_blend ()
tools_register (BLEND, (ToolOptions *) blend_options);
}
tool = (Tool *) g_malloc (sizeof (Tool));
private = (BlendTool *) g_malloc (sizeof (BlendTool));
tool = tools_new_tool (BLEND);
private = g_new (BlendTool, 1);
private->core = draw_core_new (blend_draw);
tool->type = BLEND;
tool->state = INACTIVE;
tool->scroll_lock = 1; /* Disallow scrolling */
tool->auto_snap_to = TRUE;
tool->scroll_lock = TRUE; /* Disallow scrolling */
tool->private = (void *) private;
tool->preserve = TRUE;
tool->gdisp_ptr = NULL;
tool->drawable = NULL;
tool->button_press_func = blend_button_press;
tool->button_press_func = blend_button_press;
tool->button_release_func = blend_button_release;
tool->motion_func = blend_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->modifier_key_func = standard_modifier_key_func;
tool->cursor_update_func = blend_cursor_update;
tool->control_func = blend_control;
tool->motion_func = blend_motion;
tool->cursor_update_func = blend_cursor_update;
tool->control_func = blend_control;
return tool;
}

View File

@ -82,13 +82,9 @@ static BrightnessContrastDialog *brightness_contrast_dialog = NULL;
/* brightness contrast action functions */
static void brightness_contrast_button_press (Tool *, GdkEventButton *, gpointer);
static void brightness_contrast_button_release (Tool *, GdkEventButton *, gpointer);
static void brightness_contrast_motion (Tool *, GdkEventMotion *, gpointer);
static void brightness_contrast_cursor_update (Tool *, GdkEventMotion *, gpointer);
static void brightness_contrast_control (Tool *, ToolAction, gpointer);
static void brightness_contrast_control (Tool *, ToolAction, gpointer);
static BrightnessContrastDialog * brightness_contrast_new_dialog (void);
static BrightnessContrastDialog * brightness_contrast_new_dialog (void);
static void brightness_contrast_update (BrightnessContrastDialog *, int);
static void brightness_contrast_preview (BrightnessContrastDialog *);
@ -102,45 +98,7 @@ static void brightness_contrast_brightness_text_update (GtkWidget *, gpointer
static void brightness_contrast_contrast_text_update (GtkWidget *, gpointer);
/* by_color select action functions */
static void
brightness_contrast_button_press (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr)
{
GDisplay *gdisp;
gdisp = gdisp_ptr;
tool->gdisp_ptr = gdisp;
tool->drawable = gimage_active_drawable (gdisp->gimage);
}
static void
brightness_contrast_button_release (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr)
{
}
static void
brightness_contrast_motion (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
{
}
static void
brightness_contrast_cursor_update (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
{
GDisplay *gdisp;
gdisp = (GDisplay *) gdisp_ptr;
gdisplay_install_tool_cursor (gdisp, GDK_TOP_LEFT_ARROW);
}
/* brightness-contrast select action functions */
static void
brightness_contrast_control (Tool *tool,
@ -179,25 +137,14 @@ tools_new_brightness_contrast ()
tools_register (BRIGHTNESS_CONTRAST, brightness_contrast_options);
}
tool = (Tool *) g_malloc (sizeof (Tool));
private = (BrightnessContrast *) g_malloc (sizeof (BrightnessContrast));
tool = tools_new_tool (BRIGHTNESS_CONTRAST);
private = g_new (BrightnessContrast, 1);
tool->scroll_lock = TRUE; /* Disallow scrolling */
tool->preserve = FALSE; /* Don't preserve on drawable change */
tool->type = BRIGHTNESS_CONTRAST;
tool->state = INACTIVE;
tool->scroll_lock = 1; /* Disallow scrolling */
tool->auto_snap_to = TRUE;
tool->private = (void *) private;
tool->preserve = FALSE;
tool->gdisp_ptr = NULL;
tool->drawable = NULL;
tool->button_press_func = brightness_contrast_button_press;
tool->button_release_func = brightness_contrast_button_release;
tool->motion_func = brightness_contrast_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->modifier_key_func = standard_modifier_key_func;
tool->cursor_update_func = brightness_contrast_cursor_update;
tool->control_func = brightness_contrast_control;
return tool;

View File

@ -73,9 +73,7 @@ static BucketOptions *bucket_options = NULL;
static void bucket_fill_button_press (Tool *, GdkEventButton *, gpointer);
static void bucket_fill_button_release (Tool *, GdkEventButton *, gpointer);
static void bucket_fill_motion (Tool *, GdkEventMotion *, gpointer);
static void bucket_fill_cursor_update (Tool *, GdkEventMotion *, gpointer);
static void bucket_fill_control (Tool *, ToolAction, gpointer);
static void bucket_fill_region (BucketFillMode, PixelRegion *,
PixelRegion *, unsigned char *,
@ -248,15 +246,6 @@ bucket_fill_button_release (Tool *tool,
tool->state = INACTIVE;
}
static void
bucket_fill_motion (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
{
}
static void
bucket_fill_cursor_update (Tool *tool,
GdkEventMotion *mevent,
@ -317,13 +306,6 @@ bucket_fill_modifier_key_func (Tool *tool,
}
}
static void
bucket_fill_control (Tool *tool,
ToolAction action,
gpointer gdisp_ptr)
{
}
void
bucket_fill (GimpImage *gimage,
GimpDrawable *drawable,
@ -584,9 +566,9 @@ bucket_fill_region (BucketFillMode fill_mode,
}
}
/*********************************/
/* Global bucket fill functions */
/*********************************/
/**********************************/
/* Global bucket fill functions */
/**********************************/
Tool *
tools_new_bucket_fill (void)
@ -604,26 +586,17 @@ tools_new_bucket_fill (void)
bucket_options_reset ();
}
tool = (Tool *) g_malloc (sizeof (Tool));
private = (BucketTool *) g_malloc (sizeof (BucketTool));
tool = tools_new_tool (BUCKET_FILL);
private = g_new (BucketTool, 1);
tool->scroll_lock = TRUE; /* Disallow scrolling */
tool->type = BUCKET_FILL;
tool->state = INACTIVE;
tool->scroll_lock = 1; /* Disallow scrolling */
tool->auto_snap_to = TRUE;
tool->private = (void *) private;
tool->preserve = TRUE;
tool->gdisp_ptr = NULL;
tool->drawable = NULL;
tool->button_press_func = bucket_fill_button_press;
tool->button_press_func = bucket_fill_button_press;
tool->button_release_func = bucket_fill_button_release;
tool->motion_func = bucket_fill_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->modifier_key_func = bucket_fill_modifier_key_func;
tool->cursor_update_func = bucket_fill_cursor_update;
tool->control_func = bucket_fill_control;
tool->modifier_key_func = bucket_fill_modifier_key_func;
tool->cursor_update_func = bucket_fill_cursor_update;
return tool;
}

View File

@ -75,7 +75,6 @@ static ByColorDialog * by_color_dialog = NULL;
static void by_color_select_button_press (Tool *, GdkEventButton *, gpointer);
static void by_color_select_button_release (Tool *, GdkEventButton *, gpointer);
static void by_color_select_motion (Tool *, GdkEventMotion *, gpointer);
static void by_color_select_cursor_update (Tool *, GdkEventMotion *, gpointer);
static void by_color_select_control (Tool *, ToolAction, gpointer);
@ -396,13 +395,6 @@ by_color_select_button_release (Tool *tool,
}
}
static void
by_color_select_motion (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
{
}
static void
by_color_select_cursor_update (Tool *tool,
GdkEventMotion *mevent,
@ -474,26 +466,17 @@ tools_new_by_color_select ()
if (!GTK_WIDGET_VISIBLE (by_color_dialog->shell))
gtk_widget_show (by_color_dialog->shell);
tool = (Tool *) g_malloc (sizeof (Tool));
private = (ByColorSelect *) g_malloc (sizeof (ByColorSelect));
tool = tools_new_tool (BY_COLOR_SELECT);
private = g_new (ByColorSelect, 1);
tool->scroll_lock = TRUE; /* Disallow scrolling */
tool->type = BY_COLOR_SELECT;
tool->state = INACTIVE;
tool->scroll_lock = 1; /* Disallow scrolling */
tool->auto_snap_to = TRUE;
tool->private = (void *) private;
tool->preserve = TRUE;
tool->gdisp_ptr = NULL;
tool->drawable = NULL;
tool->button_press_func = by_color_select_button_press;
tool->button_press_func = by_color_select_button_press;
tool->button_release_func = by_color_select_button_release;
tool->motion_func = by_color_select_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->modifier_key_func = standard_modifier_key_func;
tool->cursor_update_func = by_color_select_cursor_update;
tool->control_func = by_color_select_control;
tool->cursor_update_func = by_color_select_cursor_update;
tool->control_func = by_color_select_control;
return tool;
}

View File

@ -58,11 +58,7 @@ static ColorBalanceDialog *color_balance_dialog = NULL;
/* color balance action functions */
static void color_balance_button_press (Tool *, GdkEventButton *, gpointer);
static void color_balance_button_release (Tool *, GdkEventButton *, gpointer);
static void color_balance_motion (Tool *, GdkEventMotion *, gpointer);
static void color_balance_cursor_update (Tool *, GdkEventMotion *, gpointer);
static void color_balance_control (Tool *, ToolAction, gpointer);
static void color_balance_control (Tool *, ToolAction, gpointer);
static ColorBalanceDialog * color_balance_new_dialog (void);
@ -149,44 +145,6 @@ color_balance (PixelRegion *srcPR,
/* by_color select action functions */
static void
color_balance_button_press (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr)
{
GDisplay *gdisp;
gdisp = gdisp_ptr;
tool->gdisp_ptr = gdisp;
tool->drawable = gimage_active_drawable (gdisp->gimage);
}
static void
color_balance_button_release (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr)
{
}
static void
color_balance_motion (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
{
}
static void
color_balance_cursor_update (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
{
GDisplay *gdisp;
gdisp = (GDisplay *) gdisp_ptr;
gdisplay_install_tool_cursor (gdisp, GDK_TOP_LEFT_ARROW);
}
static void
color_balance_control (Tool *tool,
ToolAction action,
@ -227,25 +185,14 @@ tools_new_color_balance ()
tools_register (COLOR_BALANCE, color_balance_options);
}
tool = (Tool *) g_malloc (sizeof (Tool));
private = (ColorBalance *) g_malloc (sizeof (ColorBalance));
tool = tools_new_tool (COLOR_BALANCE);
private = g_new (ColorBalance, 1);
tool->scroll_lock = TRUE; /* Disallow scrolling */
tool->preserve = FALSE; /* Don't preserve on drawable change */
tool->type = COLOR_BALANCE;
tool->state = INACTIVE;
tool->scroll_lock = 1; /* Disallow scrolling */
tool->auto_snap_to = TRUE;
tool->private = (void *) private;
tool->preserve = FALSE;
tool->gdisp_ptr = NULL;
tool->drawable = NULL;
tool->button_press_func = color_balance_button_press;
tool->button_release_func = color_balance_button_release;
tool->motion_func = color_balance_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->modifier_key_func = standard_modifier_key_func;
tool->cursor_update_func = color_balance_cursor_update;
tool->control_func = color_balance_control;
return tool;

View File

@ -616,28 +616,18 @@ tools_new_color_picker ()
tools_register (COLOR_PICKER, (ToolOptions *) color_picker_options);
}
tool = (Tool *) g_malloc (sizeof (Tool));
tool = tools_new_tool (COLOR_PICKER);
private = (ColourPickerTool *) g_malloc(sizeof(ColourPickerTool));
private->core = draw_core_new (colourpicker_draw);
tool->type = COLOR_PICKER;
tool->state = INACTIVE;
tool->scroll_lock = 0; /* Allow scrolling */
tool->auto_snap_to = TRUE;
tool->private = (void *) private;
tool->preserve = TRUE;
tool->gdisp_ptr = NULL;
tool->drawable = NULL;
tool->button_press_func = color_picker_button_press;
tool->button_press_func = color_picker_button_press;
tool->button_release_func = color_picker_button_release;
tool->motion_func = color_picker_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->modifier_key_func = standard_modifier_key_func;
tool->cursor_update_func = color_picker_cursor_update;
tool->control_func = color_picker_control;
tool->motion_func = color_picker_motion;
tool->cursor_update_func = color_picker_cursor_update;
tool->control_func = color_picker_control;
return tool;
}

View File

@ -96,7 +96,6 @@ static CRMatrix CR_basis =
static void curves_button_press (Tool *, GdkEventButton *, gpointer);
static void curves_button_release (Tool *, GdkEventButton *, gpointer);
static void curves_motion (Tool *, GdkEventMotion *, gpointer);
static void curves_cursor_update (Tool *, GdkEventMotion *, gpointer);
static void curves_control (Tool *, ToolAction, gpointer);
static CurvesDialog * curves_new_dialog (void);
@ -164,38 +163,6 @@ curves_lut_func (CurvesDialog *cd,
return inten;
}
/* curves action functions */
static void
curves_button_press (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr)
{
GDisplay *gdisp;
GimpDrawable * drawable;
gdisp = gdisp_ptr;
drawable = gimage_active_drawable (gdisp->gimage);
tool->gdisp_ptr = gdisp;
if (drawable != tool->drawable)
{
active_tool->preserve = TRUE;
image_map_abort (curves_dialog->image_map);
active_tool->preserve = FALSE;
tool->drawable = drawable;
curves_dialog->drawable = drawable;
curves_dialog->color = drawable_color (drawable);
curves_dialog->image_map = image_map_create (gdisp, drawable);
}
if(tool)
tool->state = ACTIVE;
}
static void
curves_colour_update (Tool *tool,
GDisplay *gdisp,
@ -271,6 +238,43 @@ curves_add_point(GimpDrawable * drawable,gint x, gint y,gint cchan)
curves_dialog->points[cchan][closest_point][1] = curves_dialog->curve[cchan][curvex];
}
/* curves action functions */
static void
curves_button_press (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr)
{
GDisplay *gdisp;
gint x, y;
GimpDrawable * drawable;
gdisp = gdisp_ptr;
drawable = gimage_active_drawable (gdisp->gimage);
tool->gdisp_ptr = gdisp;
if (drawable != tool->drawable)
{
active_tool->preserve = TRUE;
image_map_abort (curves_dialog->image_map);
active_tool->preserve = FALSE;
tool->drawable = drawable;
curves_dialog->drawable = drawable;
curves_dialog->color = drawable_color (drawable);
curves_dialog->image_map = image_map_create (gdisp, drawable);
}
tool->state = ACTIVE;
gdisplay_untransform_coords (gdisp, bevent->x, bevent->y, &x, &y,
FALSE, FALSE);
curves_colour_update (tool, gdisp, drawable, x, y);
curves_update (curves_dialog, GRAPH | DRAW);
}
static void
curves_button_release (Tool *tool,
GdkEventButton *bevent,
@ -329,17 +333,6 @@ curves_motion (Tool *tool,
curves_update (curves_dialog, GRAPH | DRAW);
}
static void
curves_cursor_update (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
{
GDisplay *gdisp;
gdisp = (GDisplay *) gdisp_ptr;
gdisplay_install_tool_cursor (gdisp, GDK_TOP_LEFT_ARROW);
}
static void
curves_control (Tool *tool,
ToolAction action,
@ -376,26 +369,18 @@ tools_new_curves ()
tools_register (CURVES, curves_options);
}
tool = (Tool *) g_malloc (sizeof (Tool));
private = (Curves *) g_malloc (sizeof (Curves));
tool = tools_new_tool (CURVES);
private = g_new (Curves, 1);
tool->scroll_lock = TRUE; /* Disallow scrolling */
tool->preserve = FALSE; /* Don't preserve on drawable change */
tool->type = CURVES;
tool->state = INACTIVE;
tool->scroll_lock = 1; /* Disallow scrolling */
tool->auto_snap_to = TRUE;
tool->private = (void *) private;
tool->preserve = FALSE;
tool->gdisp_ptr = NULL;
tool->drawable = NULL;
tool->button_press_func = curves_button_press;
tool->button_press_func = curves_button_press;
tool->button_release_func = curves_button_release;
tool->motion_func = curves_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->modifier_key_func = standard_modifier_key_func;
tool->cursor_update_func = curves_cursor_update;
tool->control_func = curves_control;
tool->motion_func = curves_motion;
tool->control_func = curves_control;
return tool;
}
@ -507,9 +492,9 @@ curves_free ()
}
}
/**************************/
/* Select Curves dialog */
/**************************/
/*******************/
/* Curves dialog */
/*******************/
static CurvesDialog *
curves_new_dialog ()

View File

@ -31,7 +31,7 @@
#include "libgimp/gimpintl.h"
#define EDIT_SELECT_SCROLL_LOCK 0
#define EDIT_SELECT_SCROLL_LOCK FALSE
#define ARROW_VELOCITY 25
#define STATUSBAR_SIZE 128
@ -53,8 +53,8 @@ struct _EditSelection
MotionFunc old_motion; /* old motion member function */
ToolCtlFunc old_control; /* old control member function */
CursorUpdateFunc old_cursor_update; /* old cursor update function */
int old_scroll_lock; /* old value of scroll lock */
int old_auto_snap_to; /* old value of auto snap to */
gboolean old_scroll_lock; /* old value of scroll lock */
gboolean old_auto_snap_to; /* old value of auto snap to */
guint context_id; /* for the statusbar */
};

View File

@ -109,7 +109,7 @@ ellipse_select_options_reset (void)
}
Tool *
tools_new_ellipse_select (void)
tools_new_ellipse_select (void)
{
Tool *tool;
EllipseSelect *private;
@ -122,31 +122,21 @@ tools_new_ellipse_select (void)
tools_register (ELLIPSE_SELECT, (ToolOptions *) ellipse_options);
}
tool = (Tool *) g_malloc (sizeof (Tool));
private = (EllipseSelect *) g_malloc (sizeof (EllipseSelect));
tool = tools_new_tool (ELLIPSE_SELECT);
private = g_new (EllipseSelect, 1);
private->core = draw_core_new (ellipse_select_draw);
/* Make the selection static, not blinking */
private->x = private->y = 0;
private->w = private->h = 0;
tool->type = ELLIPSE_SELECT;
tool->state = INACTIVE;
tool->scroll_lock = 0; /* Allow scrolling */
tool->auto_snap_to = TRUE;
tool->private = (void *) private;
tool->preserve = TRUE;
tool->gdisp_ptr = NULL;
tool->drawable = NULL;
tool->button_press_func = rect_select_button_press;
tool->button_press_func = rect_select_button_press;
tool->button_release_func = rect_select_button_release;
tool->motion_func = rect_select_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->modifier_key_func = standard_modifier_key_func;
tool->cursor_update_func = rect_select_cursor_update;
tool->control_func = rect_select_control;
tool->motion_func = rect_select_motion;
tool->cursor_update_func = rect_select_cursor_update;
tool->control_func = rect_select_control;
return tool;
}

View File

@ -463,30 +463,22 @@ tools_new_free_select (void)
tools_register (FREE_SELECT, (ToolOptions *) free_options);
}
tool = (Tool *) g_malloc (sizeof (Tool));
private = (FreeSelect *) g_malloc (sizeof (FreeSelect));
tool = tools_new_tool (FREE_SELECT);
private = g_new (FreeSelect, 1);
private->core = draw_core_new (free_select_draw);
private->num_pts = 0;
private->op = SELECTION_REPLACE;
tool->type = FREE_SELECT;
tool->state = INACTIVE;
tool->scroll_lock = 1; /* Do not allow scrolling */
tool->auto_snap_to = TRUE;
tool->private = (void *) private;
tool->preserve = TRUE;
tool->gdisp_ptr = NULL;
tool->drawable = NULL;
tool->scroll_lock = TRUE; /* Do not allow scrolling */
tool->button_press_func = free_select_button_press;
tool->private = (void *) private;
tool->button_press_func = free_select_button_press;
tool->button_release_func = free_select_button_release;
tool->motion_func = free_select_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->modifier_key_func = standard_modifier_key_func;
tool->cursor_update_func = rect_select_cursor_update;
tool->control_func = free_select_control;
tool->motion_func = free_select_motion;
tool->cursor_update_func = rect_select_cursor_update;
tool->control_func = free_select_control;
return tool;
}

View File

@ -63,9 +63,10 @@ Channel * fuzzy_mask = NULL;
static void fuzzy_select_button_press (Tool *, GdkEventButton *, gpointer);
static void fuzzy_select_button_release (Tool *, GdkEventButton *, gpointer);
static void fuzzy_select_motion (Tool *, GdkEventMotion *, gpointer);
static void fuzzy_select_draw (Tool *);
static void fuzzy_select_control (Tool *, ToolAction, gpointer);
static void fuzzy_select_draw (Tool *);
/* fuzzy select action functions */
static GdkSegment * fuzzy_select_calculate (Tool *, void *, int *);
@ -561,28 +562,20 @@ tools_new_fuzzy_select (void)
tools_register (FUZZY_SELECT, (ToolOptions *) fuzzy_options);
}
tool = (Tool *) g_malloc (sizeof (Tool));
private = (FuzzySelect *) g_malloc (sizeof (FuzzySelect));
tool = tools_new_tool (FUZZY_SELECT);
private = g_new (FuzzySelect, 1);
private->core = draw_core_new (fuzzy_select_draw);
tool->type = FUZZY_SELECT;
tool->state = INACTIVE;
tool->scroll_lock = 1; /* Disallow scrolling */
tool->auto_snap_to = TRUE;
tool->scroll_lock = TRUE; /* Disallow scrolling */
tool->private = (void *) private;
tool->preserve = TRUE;
tool->gdisp_ptr = NULL;
tool->drawable = NULL;
tool->button_press_func = fuzzy_select_button_press;
tool->button_press_func = fuzzy_select_button_press;
tool->button_release_func = fuzzy_select_button_release;
tool->motion_func = fuzzy_select_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->modifier_key_func = standard_modifier_key_func;
tool->cursor_update_func = rect_select_cursor_update;
tool->control_func = fuzzy_select_control;
tool->motion_func = fuzzy_select_motion;
tool->cursor_update_func = rect_select_cursor_update;
tool->control_func = fuzzy_select_control;
return tool;
}

View File

@ -1732,28 +1732,20 @@ tools_new_blend ()
tools_register (BLEND, (ToolOptions *) blend_options);
}
tool = (Tool *) g_malloc (sizeof (Tool));
private = (BlendTool *) g_malloc (sizeof (BlendTool));
tool = tools_new_tool (BLEND);
private = g_new (BlendTool, 1);
private->core = draw_core_new (blend_draw);
tool->type = BLEND;
tool->state = INACTIVE;
tool->scroll_lock = 1; /* Disallow scrolling */
tool->auto_snap_to = TRUE;
tool->scroll_lock = TRUE; /* Disallow scrolling */
tool->private = (void *) private;
tool->preserve = TRUE;
tool->gdisp_ptr = NULL;
tool->drawable = NULL;
tool->button_press_func = blend_button_press;
tool->button_press_func = blend_button_press;
tool->button_release_func = blend_button_release;
tool->motion_func = blend_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->modifier_key_func = standard_modifier_key_func;
tool->cursor_update_func = blend_cursor_update;
tool->control_func = blend_control;
tool->motion_func = blend_motion;
tool->cursor_update_func = blend_cursor_update;
tool->control_func = blend_control;
return tool;
}

View File

@ -82,13 +82,9 @@ static BrightnessContrastDialog *brightness_contrast_dialog = NULL;
/* brightness contrast action functions */
static void brightness_contrast_button_press (Tool *, GdkEventButton *, gpointer);
static void brightness_contrast_button_release (Tool *, GdkEventButton *, gpointer);
static void brightness_contrast_motion (Tool *, GdkEventMotion *, gpointer);
static void brightness_contrast_cursor_update (Tool *, GdkEventMotion *, gpointer);
static void brightness_contrast_control (Tool *, ToolAction, gpointer);
static void brightness_contrast_control (Tool *, ToolAction, gpointer);
static BrightnessContrastDialog * brightness_contrast_new_dialog (void);
static BrightnessContrastDialog * brightness_contrast_new_dialog (void);
static void brightness_contrast_update (BrightnessContrastDialog *, int);
static void brightness_contrast_preview (BrightnessContrastDialog *);
@ -102,45 +98,7 @@ static void brightness_contrast_brightness_text_update (GtkWidget *, gpointer
static void brightness_contrast_contrast_text_update (GtkWidget *, gpointer);
/* by_color select action functions */
static void
brightness_contrast_button_press (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr)
{
GDisplay *gdisp;
gdisp = gdisp_ptr;
tool->gdisp_ptr = gdisp;
tool->drawable = gimage_active_drawable (gdisp->gimage);
}
static void
brightness_contrast_button_release (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr)
{
}
static void
brightness_contrast_motion (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
{
}
static void
brightness_contrast_cursor_update (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
{
GDisplay *gdisp;
gdisp = (GDisplay *) gdisp_ptr;
gdisplay_install_tool_cursor (gdisp, GDK_TOP_LEFT_ARROW);
}
/* brightness-contrast select action functions */
static void
brightness_contrast_control (Tool *tool,
@ -179,25 +137,14 @@ tools_new_brightness_contrast ()
tools_register (BRIGHTNESS_CONTRAST, brightness_contrast_options);
}
tool = (Tool *) g_malloc (sizeof (Tool));
private = (BrightnessContrast *) g_malloc (sizeof (BrightnessContrast));
tool = tools_new_tool (BRIGHTNESS_CONTRAST);
private = g_new (BrightnessContrast, 1);
tool->scroll_lock = TRUE; /* Disallow scrolling */
tool->preserve = FALSE; /* Don't preserve on drawable change */
tool->type = BRIGHTNESS_CONTRAST;
tool->state = INACTIVE;
tool->scroll_lock = 1; /* Disallow scrolling */
tool->auto_snap_to = TRUE;
tool->private = (void *) private;
tool->preserve = FALSE;
tool->gdisp_ptr = NULL;
tool->drawable = NULL;
tool->button_press_func = brightness_contrast_button_press;
tool->button_release_func = brightness_contrast_button_release;
tool->motion_func = brightness_contrast_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->modifier_key_func = standard_modifier_key_func;
tool->cursor_update_func = brightness_contrast_cursor_update;
tool->control_func = brightness_contrast_control;
return tool;

View File

@ -73,9 +73,7 @@ static BucketOptions *bucket_options = NULL;
static void bucket_fill_button_press (Tool *, GdkEventButton *, gpointer);
static void bucket_fill_button_release (Tool *, GdkEventButton *, gpointer);
static void bucket_fill_motion (Tool *, GdkEventMotion *, gpointer);
static void bucket_fill_cursor_update (Tool *, GdkEventMotion *, gpointer);
static void bucket_fill_control (Tool *, ToolAction, gpointer);
static void bucket_fill_region (BucketFillMode, PixelRegion *,
PixelRegion *, unsigned char *,
@ -248,15 +246,6 @@ bucket_fill_button_release (Tool *tool,
tool->state = INACTIVE;
}
static void
bucket_fill_motion (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
{
}
static void
bucket_fill_cursor_update (Tool *tool,
GdkEventMotion *mevent,
@ -317,13 +306,6 @@ bucket_fill_modifier_key_func (Tool *tool,
}
}
static void
bucket_fill_control (Tool *tool,
ToolAction action,
gpointer gdisp_ptr)
{
}
void
bucket_fill (GimpImage *gimage,
GimpDrawable *drawable,
@ -584,9 +566,9 @@ bucket_fill_region (BucketFillMode fill_mode,
}
}
/*********************************/
/* Global bucket fill functions */
/*********************************/
/**********************************/
/* Global bucket fill functions */
/**********************************/
Tool *
tools_new_bucket_fill (void)
@ -604,26 +586,17 @@ tools_new_bucket_fill (void)
bucket_options_reset ();
}
tool = (Tool *) g_malloc (sizeof (Tool));
private = (BucketTool *) g_malloc (sizeof (BucketTool));
tool = tools_new_tool (BUCKET_FILL);
private = g_new (BucketTool, 1);
tool->scroll_lock = TRUE; /* Disallow scrolling */
tool->type = BUCKET_FILL;
tool->state = INACTIVE;
tool->scroll_lock = 1; /* Disallow scrolling */
tool->auto_snap_to = TRUE;
tool->private = (void *) private;
tool->preserve = TRUE;
tool->gdisp_ptr = NULL;
tool->drawable = NULL;
tool->button_press_func = bucket_fill_button_press;
tool->button_press_func = bucket_fill_button_press;
tool->button_release_func = bucket_fill_button_release;
tool->motion_func = bucket_fill_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->modifier_key_func = bucket_fill_modifier_key_func;
tool->cursor_update_func = bucket_fill_cursor_update;
tool->control_func = bucket_fill_control;
tool->modifier_key_func = bucket_fill_modifier_key_func;
tool->cursor_update_func = bucket_fill_cursor_update;
return tool;
}

View File

@ -75,7 +75,6 @@ static ByColorDialog * by_color_dialog = NULL;
static void by_color_select_button_press (Tool *, GdkEventButton *, gpointer);
static void by_color_select_button_release (Tool *, GdkEventButton *, gpointer);
static void by_color_select_motion (Tool *, GdkEventMotion *, gpointer);
static void by_color_select_cursor_update (Tool *, GdkEventMotion *, gpointer);
static void by_color_select_control (Tool *, ToolAction, gpointer);
@ -396,13 +395,6 @@ by_color_select_button_release (Tool *tool,
}
}
static void
by_color_select_motion (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
{
}
static void
by_color_select_cursor_update (Tool *tool,
GdkEventMotion *mevent,
@ -474,26 +466,17 @@ tools_new_by_color_select ()
if (!GTK_WIDGET_VISIBLE (by_color_dialog->shell))
gtk_widget_show (by_color_dialog->shell);
tool = (Tool *) g_malloc (sizeof (Tool));
private = (ByColorSelect *) g_malloc (sizeof (ByColorSelect));
tool = tools_new_tool (BY_COLOR_SELECT);
private = g_new (ByColorSelect, 1);
tool->scroll_lock = TRUE; /* Disallow scrolling */
tool->type = BY_COLOR_SELECT;
tool->state = INACTIVE;
tool->scroll_lock = 1; /* Disallow scrolling */
tool->auto_snap_to = TRUE;
tool->private = (void *) private;
tool->preserve = TRUE;
tool->gdisp_ptr = NULL;
tool->drawable = NULL;
tool->button_press_func = by_color_select_button_press;
tool->button_press_func = by_color_select_button_press;
tool->button_release_func = by_color_select_button_release;
tool->motion_func = by_color_select_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->modifier_key_func = standard_modifier_key_func;
tool->cursor_update_func = by_color_select_cursor_update;
tool->control_func = by_color_select_control;
tool->cursor_update_func = by_color_select_cursor_update;
tool->control_func = by_color_select_control;
return tool;
}

View File

@ -58,11 +58,7 @@ static ColorBalanceDialog *color_balance_dialog = NULL;
/* color balance action functions */
static void color_balance_button_press (Tool *, GdkEventButton *, gpointer);
static void color_balance_button_release (Tool *, GdkEventButton *, gpointer);
static void color_balance_motion (Tool *, GdkEventMotion *, gpointer);
static void color_balance_cursor_update (Tool *, GdkEventMotion *, gpointer);
static void color_balance_control (Tool *, ToolAction, gpointer);
static void color_balance_control (Tool *, ToolAction, gpointer);
static ColorBalanceDialog * color_balance_new_dialog (void);
@ -149,44 +145,6 @@ color_balance (PixelRegion *srcPR,
/* by_color select action functions */
static void
color_balance_button_press (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr)
{
GDisplay *gdisp;
gdisp = gdisp_ptr;
tool->gdisp_ptr = gdisp;
tool->drawable = gimage_active_drawable (gdisp->gimage);
}
static void
color_balance_button_release (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr)
{
}
static void
color_balance_motion (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
{
}
static void
color_balance_cursor_update (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
{
GDisplay *gdisp;
gdisp = (GDisplay *) gdisp_ptr;
gdisplay_install_tool_cursor (gdisp, GDK_TOP_LEFT_ARROW);
}
static void
color_balance_control (Tool *tool,
ToolAction action,
@ -227,25 +185,14 @@ tools_new_color_balance ()
tools_register (COLOR_BALANCE, color_balance_options);
}
tool = (Tool *) g_malloc (sizeof (Tool));
private = (ColorBalance *) g_malloc (sizeof (ColorBalance));
tool = tools_new_tool (COLOR_BALANCE);
private = g_new (ColorBalance, 1);
tool->scroll_lock = TRUE; /* Disallow scrolling */
tool->preserve = FALSE; /* Don't preserve on drawable change */
tool->type = COLOR_BALANCE;
tool->state = INACTIVE;
tool->scroll_lock = 1; /* Disallow scrolling */
tool->auto_snap_to = TRUE;
tool->private = (void *) private;
tool->preserve = FALSE;
tool->gdisp_ptr = NULL;
tool->drawable = NULL;
tool->button_press_func = color_balance_button_press;
tool->button_release_func = color_balance_button_release;
tool->motion_func = color_balance_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->modifier_key_func = standard_modifier_key_func;
tool->cursor_update_func = color_balance_cursor_update;
tool->control_func = color_balance_control;
return tool;

View File

@ -96,7 +96,6 @@ static CRMatrix CR_basis =
static void curves_button_press (Tool *, GdkEventButton *, gpointer);
static void curves_button_release (Tool *, GdkEventButton *, gpointer);
static void curves_motion (Tool *, GdkEventMotion *, gpointer);
static void curves_cursor_update (Tool *, GdkEventMotion *, gpointer);
static void curves_control (Tool *, ToolAction, gpointer);
static CurvesDialog * curves_new_dialog (void);
@ -164,38 +163,6 @@ curves_lut_func (CurvesDialog *cd,
return inten;
}
/* curves action functions */
static void
curves_button_press (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr)
{
GDisplay *gdisp;
GimpDrawable * drawable;
gdisp = gdisp_ptr;
drawable = gimage_active_drawable (gdisp->gimage);
tool->gdisp_ptr = gdisp;
if (drawable != tool->drawable)
{
active_tool->preserve = TRUE;
image_map_abort (curves_dialog->image_map);
active_tool->preserve = FALSE;
tool->drawable = drawable;
curves_dialog->drawable = drawable;
curves_dialog->color = drawable_color (drawable);
curves_dialog->image_map = image_map_create (gdisp, drawable);
}
if(tool)
tool->state = ACTIVE;
}
static void
curves_colour_update (Tool *tool,
GDisplay *gdisp,
@ -271,6 +238,43 @@ curves_add_point(GimpDrawable * drawable,gint x, gint y,gint cchan)
curves_dialog->points[cchan][closest_point][1] = curves_dialog->curve[cchan][curvex];
}
/* curves action functions */
static void
curves_button_press (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr)
{
GDisplay *gdisp;
gint x, y;
GimpDrawable * drawable;
gdisp = gdisp_ptr;
drawable = gimage_active_drawable (gdisp->gimage);
tool->gdisp_ptr = gdisp;
if (drawable != tool->drawable)
{
active_tool->preserve = TRUE;
image_map_abort (curves_dialog->image_map);
active_tool->preserve = FALSE;
tool->drawable = drawable;
curves_dialog->drawable = drawable;
curves_dialog->color = drawable_color (drawable);
curves_dialog->image_map = image_map_create (gdisp, drawable);
}
tool->state = ACTIVE;
gdisplay_untransform_coords (gdisp, bevent->x, bevent->y, &x, &y,
FALSE, FALSE);
curves_colour_update (tool, gdisp, drawable, x, y);
curves_update (curves_dialog, GRAPH | DRAW);
}
static void
curves_button_release (Tool *tool,
GdkEventButton *bevent,
@ -329,17 +333,6 @@ curves_motion (Tool *tool,
curves_update (curves_dialog, GRAPH | DRAW);
}
static void
curves_cursor_update (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
{
GDisplay *gdisp;
gdisp = (GDisplay *) gdisp_ptr;
gdisplay_install_tool_cursor (gdisp, GDK_TOP_LEFT_ARROW);
}
static void
curves_control (Tool *tool,
ToolAction action,
@ -376,26 +369,18 @@ tools_new_curves ()
tools_register (CURVES, curves_options);
}
tool = (Tool *) g_malloc (sizeof (Tool));
private = (Curves *) g_malloc (sizeof (Curves));
tool = tools_new_tool (CURVES);
private = g_new (Curves, 1);
tool->scroll_lock = TRUE; /* Disallow scrolling */
tool->preserve = FALSE; /* Don't preserve on drawable change */
tool->type = CURVES;
tool->state = INACTIVE;
tool->scroll_lock = 1; /* Disallow scrolling */
tool->auto_snap_to = TRUE;
tool->private = (void *) private;
tool->preserve = FALSE;
tool->gdisp_ptr = NULL;
tool->drawable = NULL;
tool->button_press_func = curves_button_press;
tool->button_press_func = curves_button_press;
tool->button_release_func = curves_button_release;
tool->motion_func = curves_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->modifier_key_func = standard_modifier_key_func;
tool->cursor_update_func = curves_cursor_update;
tool->control_func = curves_control;
tool->motion_func = curves_motion;
tool->control_func = curves_control;
return tool;
}
@ -507,9 +492,9 @@ curves_free ()
}
}
/**************************/
/* Select Curves dialog */
/**************************/
/*******************/
/* Curves dialog */
/*******************/
static CurvesDialog *
curves_new_dialog ()

View File

@ -31,7 +31,7 @@
#include "libgimp/gimpintl.h"
#define EDIT_SELECT_SCROLL_LOCK 0
#define EDIT_SELECT_SCROLL_LOCK FALSE
#define ARROW_VELOCITY 25
#define STATUSBAR_SIZE 128
@ -53,8 +53,8 @@ struct _EditSelection
MotionFunc old_motion; /* old motion member function */
ToolCtlFunc old_control; /* old control member function */
CursorUpdateFunc old_cursor_update; /* old cursor update function */
int old_scroll_lock; /* old value of scroll lock */
int old_auto_snap_to; /* old value of auto snap to */
gboolean old_scroll_lock; /* old value of scroll lock */
gboolean old_auto_snap_to; /* old value of auto snap to */
guint context_id; /* for the statusbar */
};

View File

@ -109,7 +109,7 @@ ellipse_select_options_reset (void)
}
Tool *
tools_new_ellipse_select (void)
tools_new_ellipse_select (void)
{
Tool *tool;
EllipseSelect *private;
@ -122,31 +122,21 @@ tools_new_ellipse_select (void)
tools_register (ELLIPSE_SELECT, (ToolOptions *) ellipse_options);
}
tool = (Tool *) g_malloc (sizeof (Tool));
private = (EllipseSelect *) g_malloc (sizeof (EllipseSelect));
tool = tools_new_tool (ELLIPSE_SELECT);
private = g_new (EllipseSelect, 1);
private->core = draw_core_new (ellipse_select_draw);
/* Make the selection static, not blinking */
private->x = private->y = 0;
private->w = private->h = 0;
tool->type = ELLIPSE_SELECT;
tool->state = INACTIVE;
tool->scroll_lock = 0; /* Allow scrolling */
tool->auto_snap_to = TRUE;
tool->private = (void *) private;
tool->preserve = TRUE;
tool->gdisp_ptr = NULL;
tool->drawable = NULL;
tool->button_press_func = rect_select_button_press;
tool->button_press_func = rect_select_button_press;
tool->button_release_func = rect_select_button_release;
tool->motion_func = rect_select_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->modifier_key_func = standard_modifier_key_func;
tool->cursor_update_func = rect_select_cursor_update;
tool->control_func = rect_select_control;
tool->motion_func = rect_select_motion;
tool->cursor_update_func = rect_select_cursor_update;
tool->control_func = rect_select_control;
return tool;
}

View File

@ -463,30 +463,22 @@ tools_new_free_select (void)
tools_register (FREE_SELECT, (ToolOptions *) free_options);
}
tool = (Tool *) g_malloc (sizeof (Tool));
private = (FreeSelect *) g_malloc (sizeof (FreeSelect));
tool = tools_new_tool (FREE_SELECT);
private = g_new (FreeSelect, 1);
private->core = draw_core_new (free_select_draw);
private->num_pts = 0;
private->op = SELECTION_REPLACE;
tool->type = FREE_SELECT;
tool->state = INACTIVE;
tool->scroll_lock = 1; /* Do not allow scrolling */
tool->auto_snap_to = TRUE;
tool->private = (void *) private;
tool->preserve = TRUE;
tool->gdisp_ptr = NULL;
tool->drawable = NULL;
tool->scroll_lock = TRUE; /* Do not allow scrolling */
tool->button_press_func = free_select_button_press;
tool->private = (void *) private;
tool->button_press_func = free_select_button_press;
tool->button_release_func = free_select_button_release;
tool->motion_func = free_select_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->modifier_key_func = standard_modifier_key_func;
tool->cursor_update_func = rect_select_cursor_update;
tool->control_func = free_select_control;
tool->motion_func = free_select_motion;
tool->cursor_update_func = rect_select_cursor_update;
tool->control_func = free_select_control;
return tool;
}

View File

@ -63,9 +63,10 @@ Channel * fuzzy_mask = NULL;
static void fuzzy_select_button_press (Tool *, GdkEventButton *, gpointer);
static void fuzzy_select_button_release (Tool *, GdkEventButton *, gpointer);
static void fuzzy_select_motion (Tool *, GdkEventMotion *, gpointer);
static void fuzzy_select_draw (Tool *);
static void fuzzy_select_control (Tool *, ToolAction, gpointer);
static void fuzzy_select_draw (Tool *);
/* fuzzy select action functions */
static GdkSegment * fuzzy_select_calculate (Tool *, void *, int *);
@ -561,28 +562,20 @@ tools_new_fuzzy_select (void)
tools_register (FUZZY_SELECT, (ToolOptions *) fuzzy_options);
}
tool = (Tool *) g_malloc (sizeof (Tool));
private = (FuzzySelect *) g_malloc (sizeof (FuzzySelect));
tool = tools_new_tool (FUZZY_SELECT);
private = g_new (FuzzySelect, 1);
private->core = draw_core_new (fuzzy_select_draw);
tool->type = FUZZY_SELECT;
tool->state = INACTIVE;
tool->scroll_lock = 1; /* Disallow scrolling */
tool->auto_snap_to = TRUE;
tool->scroll_lock = TRUE; /* Disallow scrolling */
tool->private = (void *) private;
tool->preserve = TRUE;
tool->gdisp_ptr = NULL;
tool->drawable = NULL;
tool->button_press_func = fuzzy_select_button_press;
tool->button_press_func = fuzzy_select_button_press;
tool->button_release_func = fuzzy_select_button_release;
tool->motion_func = fuzzy_select_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->modifier_key_func = standard_modifier_key_func;
tool->cursor_update_func = rect_select_cursor_update;
tool->control_func = fuzzy_select_control;
tool->motion_func = fuzzy_select_motion;
tool->cursor_update_func = rect_select_cursor_update;
tool->control_func = fuzzy_select_control;
return tool;
}

View File

@ -50,11 +50,7 @@ static HistogramToolDialog * histogram_tool_dialog = NULL;
/* histogram_tool action functions */
static void histogram_tool_button_press (Tool *, GdkEventButton *, gpointer);
static void histogram_tool_button_release (Tool *, GdkEventButton *, gpointer);
static void histogram_tool_motion (Tool *, GdkEventMotion *, gpointer);
static void histogram_tool_cursor_update (Tool *, GdkEventMotion *, gpointer);
static void histogram_tool_control (Tool *, ToolAction, gpointer);
static void histogram_tool_control (Tool *, ToolAction, gpointer);
static HistogramToolDialog * histogram_tool_new_dialog (void);
@ -142,44 +138,6 @@ histogram_tool_dialog_update (HistogramToolDialog *htd,
/* histogram_tool action functions */
static void
histogram_tool_button_press (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr)
{
GDisplay *gdisp;
gdisp = gdisp_ptr;
tool->gdisp_ptr = gdisp;
tool->drawable = gimage_active_drawable (gdisp->gimage);
}
static void
histogram_tool_button_release (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr)
{
}
static void
histogram_tool_motion (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
{
}
static void
histogram_tool_cursor_update (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
{
GDisplay *gdisp;
gdisp = (GDisplay *) gdisp_ptr;
gdisplay_install_tool_cursor (gdisp, GDK_TOP_LEFT_ARROW);
}
static void
histogram_tool_control (Tool *tool,
ToolAction action,
@ -216,25 +174,14 @@ tools_new_histogram_tool ()
tools_register (HISTOGRAM, histogram_tool_options);
}
tool = (Tool *) g_malloc (sizeof (Tool));
private = (HistogramTool *) g_malloc (sizeof (HistogramTool));
tool = tools_new_tool (HISTOGRAM);
private = g_new (HistogramTool, 1);
tool->scroll_lock = TRUE; /* Disallow scrolling */
tool->preserve = FALSE; /* Don't preserve on drawable change */
tool->type = HISTOGRAM;
tool->state = INACTIVE;
tool->scroll_lock = 1; /* Disallow scrolling */
tool->auto_snap_to = TRUE;
tool->private = (void *) private;
tool->preserve = FALSE;
tool->gdisp_ptr = NULL;
tool->drawable = NULL;
tool->button_press_func = histogram_tool_button_press;
tool->button_release_func = histogram_tool_button_release;
tool->motion_func = histogram_tool_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->modifier_key_func = standard_modifier_key_func;
tool->cursor_update_func = histogram_tool_cursor_update;
tool->control_func = histogram_tool_control;
return tool;

View File

@ -79,13 +79,9 @@ static int default_colors[6][3] =
/* hue saturation action functions */
static void hue_saturation_button_press (Tool *, GdkEventButton *, gpointer);
static void hue_saturation_button_release (Tool *, GdkEventButton *, gpointer);
static void hue_saturation_motion (Tool *, GdkEventMotion *, gpointer);
static void hue_saturation_cursor_update (Tool *, GdkEventMotion *, gpointer);
static void hue_saturation_control (Tool *, ToolAction, gpointer);
static void hue_saturation_control (Tool *, ToolAction, gpointer);
static HueSaturationDialog * hue_saturation_new_dialog (void);
static HueSaturationDialog * hue_saturation_new_dialog (void);
static void hue_saturation_update (HueSaturationDialog *,
int);
@ -229,44 +225,6 @@ hue_saturation (PixelRegion *srcPR,
/* by_color select action functions */
static void
hue_saturation_button_press (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr)
{
GDisplay *gdisp;
gdisp = gdisp_ptr;
tool->gdisp_ptr = gdisp;
tool->drawable = gimage_active_drawable (gdisp->gimage);
}
static void
hue_saturation_button_release (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr)
{
}
static void
hue_saturation_motion (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
{
}
static void
hue_saturation_cursor_update (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
{
GDisplay *gdisp;
gdisp = (GDisplay *) gdisp_ptr;
gdisplay_install_tool_cursor (gdisp, GDK_TOP_LEFT_ARROW);
}
static void
hue_saturation_control (Tool *tool,
ToolAction action,
@ -303,25 +261,14 @@ tools_new_hue_saturation ()
tools_register (HUE_SATURATION, hue_saturation_options);
}
tool = (Tool *) g_malloc (sizeof (Tool));
private = (HueSaturation *) g_malloc (sizeof (HueSaturation));
tool = tools_new_tool (HUE_SATURATION);
private = g_new (HueSaturation, 1);
tool->scroll_lock = TRUE; /* Disallow scrolling */
tool->preserve = FALSE; /* Don't preserve on drawable change */
tool->type = HUE_SATURATION;
tool->state = INACTIVE;
tool->scroll_lock = 1; /* Disallow scrolling */
tool->auto_snap_to = TRUE;
tool->private = (void *) private;
tool->preserve = FALSE;
tool->gdisp_ptr = NULL;
tool->drawable = NULL;
tool->button_press_func = hue_saturation_button_press;
tool->button_release_func = hue_saturation_button_release;
tool->motion_func = hue_saturation_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->modifier_key_func = standard_modifier_key_func;
tool->cursor_update_func = hue_saturation_cursor_update;
tool->control_func = hue_saturation_control;
return tool;
@ -352,7 +299,7 @@ hue_saturation_initialize (GDisplay *gdisp)
return;
}
/* The "by color" dialog */
/* The "hue-saturation color" dialog */
if (!hue_saturation_dialog)
hue_saturation_dialog = hue_saturation_new_dialog ();
else

View File

@ -881,7 +881,6 @@ ink_button_release (Tool *tool,
}
static void
dist_smoother_init (InkTool* ink_tool, gdouble initval)
{
@ -895,7 +894,6 @@ dist_smoother_init (InkTool* ink_tool, gdouble initval)
}
}
static gdouble
dist_smoother_result (InkTool* ink_tool)
{
@ -910,7 +908,6 @@ dist_smoother_result (InkTool* ink_tool)
return (result / (gdouble)DIST_SMOOTHER_BUFFER);
}
static void
dist_smoother_add (InkTool* ink_tool, gdouble value)
{
@ -921,7 +918,6 @@ dist_smoother_add (InkTool* ink_tool, gdouble value)
}
static void
time_smoother_init (InkTool* ink_tool, guint32 initval)
{
@ -935,7 +931,6 @@ time_smoother_init (InkTool* ink_tool, guint32 initval)
}
}
static gdouble
time_smoother_result (InkTool* ink_tool)
{
@ -954,7 +949,6 @@ time_smoother_result (InkTool* ink_tool)
#endif
}
static void
time_smoother_add (InkTool* ink_tool, guint32 value)
{
@ -965,7 +959,6 @@ time_smoother_add (InkTool* ink_tool, guint32 value)
}
static void
ink_motion (Tool *tool,
GdkEventMotion *mevent,
@ -1073,13 +1066,9 @@ ink_control (Tool *tool,
ToolAction action,
gpointer gdisp_ptr)
{
GDisplay *gdisp;
GimpDrawable *drawable;
InkTool *ink_tool;
gdisp = (GDisplay *) gdisp_ptr;
ink_tool = (InkTool *) tool->private;
drawable = gimage_active_drawable (gdisp->gimage);
switch (action)
{
@ -1102,7 +1091,7 @@ ink_control (Tool *tool,
static void
ink_init (InkTool *ink_tool, GimpDrawable *drawable,
double x, double y)
double x, double y)
{
/* free the block structures */
if (undo_tiles)
@ -1526,9 +1515,9 @@ ink_set_canvas_tiles (int x, int y, int w, int h)
}
}
/****************************/
/**************************/
/* Global ink functions */
/****************************/
/**************************/
void
ink_no_draw (Tool *tool)
@ -1552,30 +1541,19 @@ tools_new_ink (void)
ink_options_reset ();
}
tool = (Tool *) g_malloc (sizeof (Tool));
private = (InkTool *) g_malloc (sizeof (InkTool));
tool = tools_new_tool (INK);
private = g_new (InkTool, 1);
private->core = draw_core_new (ink_no_draw);
private->last_blob = NULL;
tool->type = INK;
tool->state = INACTIVE;
tool->scroll_lock = 0; /* Allow scrolling */
tool->auto_snap_to = TRUE;
tool->gdisp_ptr = NULL;
tool->private = private;
tool->preserve = TRUE;
tool->gdisp_ptr = NULL;
tool->drawable = NULL;
tool->button_press_func = ink_button_press;
tool->button_press_func = ink_button_press;
tool->button_release_func = ink_button_release;
tool->motion_func = ink_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->modifier_key_func = standard_modifier_key_func;
tool->cursor_update_func = ink_cursor_update;
tool->control_func = ink_control;
tool->motion_func = ink_motion;
tool->cursor_update_func = ink_cursor_update;
tool->control_func = ink_control;
return tool;
}

View File

@ -420,36 +420,28 @@ tools_new_iscissors ()
tools_register (ISCISSORS, (ToolOptions *) iscissors_options);
}
tool = (Tool *) g_malloc (sizeof (Tool));
private = (Iscissors *) g_malloc (sizeof (Iscissors));
tool = tools_new_tool (ISCISSORS);
private = g_new (Iscissors, 1);
private->core = draw_core_new (iscissors_draw);
private->edge_buf = NULL;
private->kinks = NULL;
private->mask = NULL;
tool->type = ISCISSORS;
tool->state = INACTIVE;
tool->scroll_lock = 0; /* Allow scrolling */
tool->auto_snap_to = FALSE;
tool->auto_snap_to = FALSE; /* Dont't snap to guides */
tool->private = (void *) private;
tool->preserve = TRUE;
tool->gdisp_ptr = NULL;
tool->drawable = NULL;
tool->button_press_func = iscissors_button_press;
tool->button_press_func = iscissors_button_press;
tool->button_release_func = iscissors_button_release;
tool->motion_func = iscissors_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->modifier_key_func = standard_modifier_key_func;
tool->cursor_update_func = rect_select_cursor_update;
tool->control_func = iscissors_control;
tool->motion_func = iscissors_motion;
tool->cursor_update_func = rect_select_cursor_update;
tool->control_func = iscissors_control;
last_tool = tool;
iscissors_reset (private);
return tool;
}

View File

@ -117,11 +117,7 @@ static LevelsDialog *levels_dialog = NULL;
/* levels action functions */
static void levels_button_press (Tool *, GdkEventButton *, gpointer);
static void levels_button_release (Tool *, GdkEventButton *, gpointer);
static void levels_motion (Tool *, GdkEventMotion *, gpointer);
static void levels_cursor_update (Tool *, GdkEventMotion *, gpointer);
static void levels_control (Tool *, ToolAction, gpointer);
static void levels_control (Tool *, ToolAction, gpointer);
static LevelsDialog * levels_new_dialog (void);
@ -166,44 +162,6 @@ levels_histogram_range (HistogramWidget *h,
/* levels action functions */
static void
levels_button_press (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr)
{
GDisplay *gdisp;
gdisp = gdisp_ptr;
tool->gdisp_ptr = gdisp;
tool->drawable = gimage_active_drawable (gdisp->gimage);
}
static void
levels_button_release (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr)
{
}
static void
levels_motion (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
{
}
static void
levels_cursor_update (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
{
GDisplay *gdisp;
gdisp = (GDisplay *) gdisp_ptr;
gdisplay_install_tool_cursor (gdisp, GDK_TOP_LEFT_ARROW);
}
static void
levels_control (Tool *tool,
ToolAction action,
@ -240,25 +198,14 @@ tools_new_levels ()
tools_register (LEVELS, levels_options);
}
tool = (Tool *) g_malloc (sizeof (Tool));
private = (Levels *) g_malloc (sizeof (Levels));
tool = tools_new_tool (LEVELS);
private = g_new (Levels, 1);
tool->scroll_lock = TRUE; /* Disallow scrolling */
tool->preserve = FALSE; /* Don't preserve on drawable change */
tool->type = LEVELS;
tool->state = INACTIVE;
tool->scroll_lock = 1; /* Disallow scrolling */
tool->auto_snap_to = TRUE;
tool->private = (void *) private;
tool->preserve = FALSE;
tool->gdisp_ptr = NULL;
tool->drawable = NULL;
tool->button_press_func = levels_button_press;
tool->button_release_func = levels_button_release;
tool->motion_func = levels_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->modifier_key_func = standard_modifier_key_func;
tool->cursor_update_func = levels_cursor_update;
tool->control_func = levels_control;
return tool;

View File

@ -359,30 +359,23 @@ tools_new_magnify (void)
tools_register (MAGNIFY, (ToolOptions *) magnify_options);
}
tool = (Tool *) g_malloc (sizeof (Tool));
private = (Magnify *) g_malloc (sizeof (Magnify));
tool = tools_new_tool (MAGNIFY);
private = g_new (Magnify, 1);
private->core = draw_core_new (magnify_draw);
private->x = private->y = 0;
private->w = private->h = 0;
tool->type = MAGNIFY;
tool->state = INACTIVE;
tool->scroll_lock = 1; /* disallow scrolling */
tool->auto_snap_to = FALSE;
tool->scroll_lock = TRUE; /* Disallow scrolling */
tool->auto_snap_to = FALSE; /* Don't snap to guides */
tool->private = (void *) private;
tool->preserve = TRUE;
tool->gdisp_ptr = NULL;
tool->drawable = NULL;
tool->button_press_func = magnify_button_press;
tool->button_press_func = magnify_button_press;
tool->button_release_func = magnify_button_release;
tool->motion_func = magnify_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->modifier_key_func = standard_modifier_key_func;
tool->cursor_update_func = magnify_cursor_update;
tool->control_func = magnify_control;
tool->motion_func = magnify_motion;
tool->cursor_update_func = magnify_cursor_update;
tool->control_func = magnify_control;
return tool;
}

View File

@ -48,13 +48,13 @@ static GdkGC *move_gc = NULL;
/* move tool action functions */
static void move_tool_button_press (Tool *, GdkEventButton *, gpointer);
static void move_tool_button_release (Tool *, GdkEventButton *, gpointer);
static void move_tool_motion (Tool *, GdkEventMotion *, gpointer);
static void move_tool_cursor_update (Tool *, GdkEventMotion *, gpointer);
static void move_tool_control (Tool *, ToolAction, gpointer);
static void move_tool_button_press (Tool *, GdkEventButton *, gpointer);
static void move_tool_button_release (Tool *, GdkEventButton *, gpointer);
static void move_tool_motion (Tool *, GdkEventMotion *, gpointer);
static void move_tool_cursor_update (Tool *, GdkEventMotion *, gpointer);
static void move_tool_control (Tool *, ToolAction, gpointer);
static void move_create_gc (GDisplay *);
static void move_create_gc (GDisplay *);
/* move action functions */
@ -129,7 +129,8 @@ move_tool_button_press (Tool *tool,
/* if we've got an active tool grab the pointer */
if (tool->state == ACTIVE)
gdk_pointer_grab (gdisp->canvas->window, FALSE,
GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON1_MOTION_MASK | GDK_BUTTON_RELEASE_MASK,
GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON1_MOTION_MASK |
GDK_BUTTON_RELEASE_MASK,
NULL, NULL, bevent->time);
}
@ -444,30 +445,23 @@ tools_new_move_tool ()
tools_register (MOVE, (ToolOptions *) move_options);
}
tool = (Tool *) g_malloc (sizeof (Tool));
private = (MoveTool *) g_malloc (sizeof (MoveTool));
tool = tools_new_tool (MOVE);
private = g_new (MoveTool, 1);
private->layer = NULL;
private->guide = NULL;
private->disp = NULL;
tool->type = MOVE;
tool->state = INACTIVE;
tool->scroll_lock = 0; /* Allow scrolling */
tool->auto_snap_to = FALSE;
tool->auto_snap_to = FALSE; /* Don't snap to guides */
tool->private = (void *) private;
tool->preserve = TRUE;
tool->gdisp_ptr = NULL;
tool->drawable = NULL;
tool->button_press_func = move_tool_button_press;
tool->button_press_func = move_tool_button_press;
tool->button_release_func = move_tool_button_release;
tool->motion_func = move_tool_motion;
tool->arrow_keys_func = edit_sel_arrow_keys_func;
tool->modifier_key_func = standard_modifier_key_func;
tool->cursor_update_func = move_tool_cursor_update;
tool->control_func = move_tool_control;
tool->motion_func = move_tool_motion;
tool->arrow_keys_func = edit_sel_arrow_keys_func;
tool->cursor_update_func = move_tool_cursor_update;
tool->control_func = move_tool_control;
return tool;
}

View File

@ -72,11 +72,7 @@ static PosterizeDialog *posterize_dialog = NULL;
/* posterize action functions */
static void posterize_button_press (Tool *, GdkEventButton *, gpointer);
static void posterize_button_release (Tool *, GdkEventButton *, gpointer);
static void posterize_motion (Tool *, GdkEventMotion *, gpointer);
static void posterize_cursor_update (Tool *, GdkEventMotion *, gpointer);
static void posterize_control (Tool *, ToolAction, gpointer);
static void posterize_control (Tool *, ToolAction, gpointer);
static PosterizeDialog * posterize_new_dialog (void);
@ -90,44 +86,6 @@ static gint posterize_delete_callback (GtkWidget *, GdkEvent *, gpointer);
/* posterize select action functions */
static void
posterize_button_press (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr)
{
GDisplay *gdisp;
gdisp = gdisp_ptr;
tool->gdisp_ptr = gdisp;
tool->drawable = gimage_active_drawable (gdisp->gimage);
}
static void
posterize_button_release (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr)
{
}
static void
posterize_motion (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
{
}
static void
posterize_cursor_update (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
{
GDisplay *gdisp;
gdisp = (GDisplay *) gdisp_ptr;
gdisplay_install_tool_cursor (gdisp, GDK_TOP_LEFT_ARROW);
}
static void
posterize_control (Tool *tool,
ToolAction action,
@ -171,25 +129,14 @@ tools_new_posterize ()
if (!GTK_WIDGET_VISIBLE (posterize_dialog->shell))
gtk_widget_show (posterize_dialog->shell);
tool = (Tool *) g_malloc (sizeof (Tool));
private = (Posterize *) g_malloc (sizeof (Posterize));
tool = tools_new_tool (POSTERIZE);
private = g_new (Posterize, 1);
tool->scroll_lock = TRUE; /* Disallow scrolling */
tool->preserve = FALSE; /* Don't preserve on drawable change */
tool->type = POSTERIZE;
tool->state = INACTIVE;
tool->scroll_lock = 1; /* Disallow scrolling */
tool->auto_snap_to = TRUE;
tool->private = (void *) private;
tool->preserve = FALSE;
tool->gdisp_ptr = NULL;
tool->drawable = NULL;
tool->button_press_func = posterize_button_press;
tool->button_release_func = posterize_button_release;
tool->motion_func = posterize_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->modifier_key_func = standard_modifier_key_func;
tool->cursor_update_func = posterize_cursor_update;
tool->control_func = posterize_control;
return tool;

View File

@ -422,7 +422,6 @@ rect_select_motion (Tool *tool,
draw_core_resume (rect_sel->core, tool);
}
void
rect_select_draw (Tool *tool)
{
@ -446,12 +445,12 @@ rect_select_draw (Tool *tool)
x1, y1, (x2 - x1), (y2 - y1));
}
void
static selection_tool_update_op_state (RectSelect *rect_sel,
int x, int y,
int state,
GDisplay *gdisp)
static void
selection_tool_update_op_state (RectSelect *rect_sel,
int x,
int y,
int state,
GDisplay *gdisp)
{
if (active_tool->state == ACTIVE)
return;
@ -561,31 +560,21 @@ tools_new_rect_select ()
tools_register (RECT_SELECT, (ToolOptions *) rect_options);
}
tool = (Tool *) g_malloc (sizeof (Tool));
private = (RectSelect *) g_malloc (sizeof (RectSelect));
tool = tools_new_tool (RECT_SELECT);
private = g_new (RectSelect, 1);
private->core = draw_core_new (rect_select_draw);
private->x = private->y = 0;
private->w = private->h = 0;
private->op = SELECTION_REPLACE;
tool->type = RECT_SELECT;
tool->state = INACTIVE;
tool->scroll_lock = 0; /* Allow scrolling */
tool->auto_snap_to = TRUE;
tool->private = (void *) private;
tool->preserve = TRUE;
tool->gdisp_ptr = NULL;
tool->drawable = NULL;
tool->button_press_func = rect_select_button_press;
tool->button_press_func = rect_select_button_press;
tool->button_release_func = rect_select_button_release;
tool->motion_func = rect_select_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->modifier_key_func = standard_modifier_key_func;
tool->cursor_update_func = rect_select_cursor_update;
tool->control_func = rect_select_control;
tool->motion_func = rect_select_motion;
tool->cursor_update_func = rect_select_cursor_update;
tool->control_func = rect_select_control;
return tool;
}

View File

@ -63,9 +63,10 @@ Channel * fuzzy_mask = NULL;
static void fuzzy_select_button_press (Tool *, GdkEventButton *, gpointer);
static void fuzzy_select_button_release (Tool *, GdkEventButton *, gpointer);
static void fuzzy_select_motion (Tool *, GdkEventMotion *, gpointer);
static void fuzzy_select_draw (Tool *);
static void fuzzy_select_control (Tool *, ToolAction, gpointer);
static void fuzzy_select_draw (Tool *);
/* fuzzy select action functions */
static GdkSegment * fuzzy_select_calculate (Tool *, void *, int *);
@ -561,28 +562,20 @@ tools_new_fuzzy_select (void)
tools_register (FUZZY_SELECT, (ToolOptions *) fuzzy_options);
}
tool = (Tool *) g_malloc (sizeof (Tool));
private = (FuzzySelect *) g_malloc (sizeof (FuzzySelect));
tool = tools_new_tool (FUZZY_SELECT);
private = g_new (FuzzySelect, 1);
private->core = draw_core_new (fuzzy_select_draw);
tool->type = FUZZY_SELECT;
tool->state = INACTIVE;
tool->scroll_lock = 1; /* Disallow scrolling */
tool->auto_snap_to = TRUE;
tool->scroll_lock = TRUE; /* Disallow scrolling */
tool->private = (void *) private;
tool->preserve = TRUE;
tool->gdisp_ptr = NULL;
tool->drawable = NULL;
tool->button_press_func = fuzzy_select_button_press;
tool->button_press_func = fuzzy_select_button_press;
tool->button_release_func = fuzzy_select_button_release;
tool->motion_func = fuzzy_select_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->modifier_key_func = standard_modifier_key_func;
tool->cursor_update_func = rect_select_cursor_update;
tool->control_func = fuzzy_select_control;
tool->motion_func = fuzzy_select_motion;
tool->cursor_update_func = rect_select_cursor_update;
tool->control_func = fuzzy_select_control;
return tool;
}

View File

@ -108,7 +108,6 @@ static GtkWidget *text_tool_shell = NULL;
static void text_button_press (Tool *, GdkEventButton *, gpointer);
static void text_button_release (Tool *, GdkEventButton *, gpointer);
static void text_motion (Tool *, GdkEventMotion *, gpointer);
static void text_cursor_update (Tool *, GdkEventMotion *, gpointer);
static void text_control (Tool *, ToolAction, gpointer);
@ -242,26 +241,17 @@ tools_new_text ()
}
/* the new text tool structure */
tool = (Tool *) g_malloc (sizeof (Tool));
the_text_tool = (TextTool *) g_malloc (sizeof (TextTool));
tool = tools_new_tool (TEXT);
the_text_tool = g_new (TextTool, 1);
tool->scroll_lock = TRUE; /* Disallow scrolling */
tool->type = TEXT;
tool->state = INACTIVE;
tool->scroll_lock = 1; /* Do not allow scrolling */
tool->auto_snap_to = TRUE;
tool->private = (void *) the_text_tool;
tool->preserve = TRUE;
tool->gdisp_ptr = NULL;
tool->drawable = NULL;
tool->button_press_func = text_button_press;
tool->button_press_func = text_button_press;
tool->button_release_func = text_button_release;
tool->motion_func = text_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->modifier_key_func = standard_modifier_key_func;
tool->cursor_update_func = text_cursor_update;
tool->control_func = text_control;
tool->cursor_update_func = text_cursor_update;
tool->control_func = text_control;
return tool;
}
@ -355,13 +345,6 @@ text_button_release (Tool *tool,
tool->state = INACTIVE;
}
static void
text_motion (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
{
}
static void
text_cursor_update (Tool *tool,
GdkEventMotion *mevent,

View File

@ -49,11 +49,7 @@ static ThresholdDialog *threshold_dialog = NULL;
/* threshold action functions */
static void threshold_button_press (Tool *, GdkEventButton *, gpointer);
static void threshold_button_release (Tool *, GdkEventButton *, gpointer);
static void threshold_motion (Tool *, GdkEventMotion *, gpointer);
static void threshold_cursor_update (Tool *, GdkEventMotion *, gpointer);
static void threshold_control (Tool *, ToolAction, gpointer);
static void threshold_control (Tool *, ToolAction, gpointer);
static ThresholdDialog * threshold_new_dialog (void);
@ -158,44 +154,6 @@ threshold_histogram_range (HistogramWidget *w,
/* threshold action functions */
static void
threshold_button_press (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr)
{
GDisplay *gdisp;
gdisp = gdisp_ptr;
tool->gdisp_ptr = gdisp;
tool->drawable = gimage_active_drawable (gdisp->gimage);
}
static void
threshold_button_release (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr)
{
}
static void
threshold_motion (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
{
}
static void
threshold_cursor_update (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
{
GDisplay *gdisp;
gdisp = (GDisplay *) gdisp_ptr;
gdisplay_install_tool_cursor (gdisp, GDK_TOP_LEFT_ARROW);
}
static void
threshold_control (Tool *tool,
ToolAction action,
@ -239,25 +197,14 @@ tools_new_threshold ()
if (!GTK_WIDGET_VISIBLE (threshold_dialog->shell))
gtk_widget_show (threshold_dialog->shell);
tool = (Tool *) g_malloc (sizeof (Tool));
private = (Threshold *) g_malloc (sizeof (Threshold));
tool = tools_new_tool (THRESHOLD);
private = g_new (Threshold, 1);
tool->scroll_lock = TRUE; /* Disallow scrolling */
tool->preserve = FALSE; /* Don't preserve on drawable change */
tool->type = THRESHOLD;
tool->state = INACTIVE;
tool->scroll_lock = 1; /* Disallow scrolling */
tool->auto_snap_to = TRUE;
tool->private = (void *) private;
tool->preserve = FALSE;
tool->gdisp_ptr = NULL;
tool->drawable = NULL;
tool->button_press_func = threshold_button_press;
tool->button_release_func = threshold_button_release;
tool->motion_func = threshold_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->modifier_key_func = standard_modifier_key_func;
tool->cursor_update_func = threshold_cursor_update;
tool->control_func = threshold_control;
return tool;

View File

@ -50,11 +50,7 @@ static HistogramToolDialog * histogram_tool_dialog = NULL;
/* histogram_tool action functions */
static void histogram_tool_button_press (Tool *, GdkEventButton *, gpointer);
static void histogram_tool_button_release (Tool *, GdkEventButton *, gpointer);
static void histogram_tool_motion (Tool *, GdkEventMotion *, gpointer);
static void histogram_tool_cursor_update (Tool *, GdkEventMotion *, gpointer);
static void histogram_tool_control (Tool *, ToolAction, gpointer);
static void histogram_tool_control (Tool *, ToolAction, gpointer);
static HistogramToolDialog * histogram_tool_new_dialog (void);
@ -142,44 +138,6 @@ histogram_tool_dialog_update (HistogramToolDialog *htd,
/* histogram_tool action functions */
static void
histogram_tool_button_press (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr)
{
GDisplay *gdisp;
gdisp = gdisp_ptr;
tool->gdisp_ptr = gdisp;
tool->drawable = gimage_active_drawable (gdisp->gimage);
}
static void
histogram_tool_button_release (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr)
{
}
static void
histogram_tool_motion (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
{
}
static void
histogram_tool_cursor_update (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
{
GDisplay *gdisp;
gdisp = (GDisplay *) gdisp_ptr;
gdisplay_install_tool_cursor (gdisp, GDK_TOP_LEFT_ARROW);
}
static void
histogram_tool_control (Tool *tool,
ToolAction action,
@ -216,25 +174,14 @@ tools_new_histogram_tool ()
tools_register (HISTOGRAM, histogram_tool_options);
}
tool = (Tool *) g_malloc (sizeof (Tool));
private = (HistogramTool *) g_malloc (sizeof (HistogramTool));
tool = tools_new_tool (HISTOGRAM);
private = g_new (HistogramTool, 1);
tool->scroll_lock = TRUE; /* Disallow scrolling */
tool->preserve = FALSE; /* Don't preserve on drawable change */
tool->type = HISTOGRAM;
tool->state = INACTIVE;
tool->scroll_lock = 1; /* Disallow scrolling */
tool->auto_snap_to = TRUE;
tool->private = (void *) private;
tool->preserve = FALSE;
tool->gdisp_ptr = NULL;
tool->drawable = NULL;
tool->button_press_func = histogram_tool_button_press;
tool->button_release_func = histogram_tool_button_release;
tool->motion_func = histogram_tool_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->modifier_key_func = standard_modifier_key_func;
tool->cursor_update_func = histogram_tool_cursor_update;
tool->control_func = histogram_tool_control;
return tool;

View File

@ -79,13 +79,9 @@ static int default_colors[6][3] =
/* hue saturation action functions */
static void hue_saturation_button_press (Tool *, GdkEventButton *, gpointer);
static void hue_saturation_button_release (Tool *, GdkEventButton *, gpointer);
static void hue_saturation_motion (Tool *, GdkEventMotion *, gpointer);
static void hue_saturation_cursor_update (Tool *, GdkEventMotion *, gpointer);
static void hue_saturation_control (Tool *, ToolAction, gpointer);
static void hue_saturation_control (Tool *, ToolAction, gpointer);
static HueSaturationDialog * hue_saturation_new_dialog (void);
static HueSaturationDialog * hue_saturation_new_dialog (void);
static void hue_saturation_update (HueSaturationDialog *,
int);
@ -229,44 +225,6 @@ hue_saturation (PixelRegion *srcPR,
/* by_color select action functions */
static void
hue_saturation_button_press (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr)
{
GDisplay *gdisp;
gdisp = gdisp_ptr;
tool->gdisp_ptr = gdisp;
tool->drawable = gimage_active_drawable (gdisp->gimage);
}
static void
hue_saturation_button_release (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr)
{
}
static void
hue_saturation_motion (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
{
}
static void
hue_saturation_cursor_update (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
{
GDisplay *gdisp;
gdisp = (GDisplay *) gdisp_ptr;
gdisplay_install_tool_cursor (gdisp, GDK_TOP_LEFT_ARROW);
}
static void
hue_saturation_control (Tool *tool,
ToolAction action,
@ -303,25 +261,14 @@ tools_new_hue_saturation ()
tools_register (HUE_SATURATION, hue_saturation_options);
}
tool = (Tool *) g_malloc (sizeof (Tool));
private = (HueSaturation *) g_malloc (sizeof (HueSaturation));
tool = tools_new_tool (HUE_SATURATION);
private = g_new (HueSaturation, 1);
tool->scroll_lock = TRUE; /* Disallow scrolling */
tool->preserve = FALSE; /* Don't preserve on drawable change */
tool->type = HUE_SATURATION;
tool->state = INACTIVE;
tool->scroll_lock = 1; /* Disallow scrolling */
tool->auto_snap_to = TRUE;
tool->private = (void *) private;
tool->preserve = FALSE;
tool->gdisp_ptr = NULL;
tool->drawable = NULL;
tool->button_press_func = hue_saturation_button_press;
tool->button_release_func = hue_saturation_button_release;
tool->motion_func = hue_saturation_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->modifier_key_func = standard_modifier_key_func;
tool->cursor_update_func = hue_saturation_cursor_update;
tool->control_func = hue_saturation_control;
return tool;
@ -352,7 +299,7 @@ hue_saturation_initialize (GDisplay *gdisp)
return;
}
/* The "by color" dialog */
/* The "hue-saturation color" dialog */
if (!hue_saturation_dialog)
hue_saturation_dialog = hue_saturation_new_dialog ();
else

View File

@ -881,7 +881,6 @@ ink_button_release (Tool *tool,
}
static void
dist_smoother_init (InkTool* ink_tool, gdouble initval)
{
@ -895,7 +894,6 @@ dist_smoother_init (InkTool* ink_tool, gdouble initval)
}
}
static gdouble
dist_smoother_result (InkTool* ink_tool)
{
@ -910,7 +908,6 @@ dist_smoother_result (InkTool* ink_tool)
return (result / (gdouble)DIST_SMOOTHER_BUFFER);
}
static void
dist_smoother_add (InkTool* ink_tool, gdouble value)
{
@ -921,7 +918,6 @@ dist_smoother_add (InkTool* ink_tool, gdouble value)
}
static void
time_smoother_init (InkTool* ink_tool, guint32 initval)
{
@ -935,7 +931,6 @@ time_smoother_init (InkTool* ink_tool, guint32 initval)
}
}
static gdouble
time_smoother_result (InkTool* ink_tool)
{
@ -954,7 +949,6 @@ time_smoother_result (InkTool* ink_tool)
#endif
}
static void
time_smoother_add (InkTool* ink_tool, guint32 value)
{
@ -965,7 +959,6 @@ time_smoother_add (InkTool* ink_tool, guint32 value)
}
static void
ink_motion (Tool *tool,
GdkEventMotion *mevent,
@ -1073,13 +1066,9 @@ ink_control (Tool *tool,
ToolAction action,
gpointer gdisp_ptr)
{
GDisplay *gdisp;
GimpDrawable *drawable;
InkTool *ink_tool;
gdisp = (GDisplay *) gdisp_ptr;
ink_tool = (InkTool *) tool->private;
drawable = gimage_active_drawable (gdisp->gimage);
switch (action)
{
@ -1102,7 +1091,7 @@ ink_control (Tool *tool,
static void
ink_init (InkTool *ink_tool, GimpDrawable *drawable,
double x, double y)
double x, double y)
{
/* free the block structures */
if (undo_tiles)
@ -1526,9 +1515,9 @@ ink_set_canvas_tiles (int x, int y, int w, int h)
}
}
/****************************/
/**************************/
/* Global ink functions */
/****************************/
/**************************/
void
ink_no_draw (Tool *tool)
@ -1552,30 +1541,19 @@ tools_new_ink (void)
ink_options_reset ();
}
tool = (Tool *) g_malloc (sizeof (Tool));
private = (InkTool *) g_malloc (sizeof (InkTool));
tool = tools_new_tool (INK);
private = g_new (InkTool, 1);
private->core = draw_core_new (ink_no_draw);
private->last_blob = NULL;
tool->type = INK;
tool->state = INACTIVE;
tool->scroll_lock = 0; /* Allow scrolling */
tool->auto_snap_to = TRUE;
tool->gdisp_ptr = NULL;
tool->private = private;
tool->preserve = TRUE;
tool->gdisp_ptr = NULL;
tool->drawable = NULL;
tool->button_press_func = ink_button_press;
tool->button_press_func = ink_button_press;
tool->button_release_func = ink_button_release;
tool->motion_func = ink_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->modifier_key_func = standard_modifier_key_func;
tool->cursor_update_func = ink_cursor_update;
tool->control_func = ink_control;
tool->motion_func = ink_motion;
tool->cursor_update_func = ink_cursor_update;
tool->control_func = ink_control;
return tool;
}

View File

@ -420,36 +420,28 @@ tools_new_iscissors ()
tools_register (ISCISSORS, (ToolOptions *) iscissors_options);
}
tool = (Tool *) g_malloc (sizeof (Tool));
private = (Iscissors *) g_malloc (sizeof (Iscissors));
tool = tools_new_tool (ISCISSORS);
private = g_new (Iscissors, 1);
private->core = draw_core_new (iscissors_draw);
private->edge_buf = NULL;
private->kinks = NULL;
private->mask = NULL;
tool->type = ISCISSORS;
tool->state = INACTIVE;
tool->scroll_lock = 0; /* Allow scrolling */
tool->auto_snap_to = FALSE;
tool->auto_snap_to = FALSE; /* Dont't snap to guides */
tool->private = (void *) private;
tool->preserve = TRUE;
tool->gdisp_ptr = NULL;
tool->drawable = NULL;
tool->button_press_func = iscissors_button_press;
tool->button_press_func = iscissors_button_press;
tool->button_release_func = iscissors_button_release;
tool->motion_func = iscissors_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->modifier_key_func = standard_modifier_key_func;
tool->cursor_update_func = rect_select_cursor_update;
tool->control_func = iscissors_control;
tool->motion_func = iscissors_motion;
tool->cursor_update_func = rect_select_cursor_update;
tool->control_func = iscissors_control;
last_tool = tool;
iscissors_reset (private);
return tool;
}

View File

@ -117,11 +117,7 @@ static LevelsDialog *levels_dialog = NULL;
/* levels action functions */
static void levels_button_press (Tool *, GdkEventButton *, gpointer);
static void levels_button_release (Tool *, GdkEventButton *, gpointer);
static void levels_motion (Tool *, GdkEventMotion *, gpointer);
static void levels_cursor_update (Tool *, GdkEventMotion *, gpointer);
static void levels_control (Tool *, ToolAction, gpointer);
static void levels_control (Tool *, ToolAction, gpointer);
static LevelsDialog * levels_new_dialog (void);
@ -166,44 +162,6 @@ levels_histogram_range (HistogramWidget *h,
/* levels action functions */
static void
levels_button_press (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr)
{
GDisplay *gdisp;
gdisp = gdisp_ptr;
tool->gdisp_ptr = gdisp;
tool->drawable = gimage_active_drawable (gdisp->gimage);
}
static void
levels_button_release (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr)
{
}
static void
levels_motion (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
{
}
static void
levels_cursor_update (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
{
GDisplay *gdisp;
gdisp = (GDisplay *) gdisp_ptr;
gdisplay_install_tool_cursor (gdisp, GDK_TOP_LEFT_ARROW);
}
static void
levels_control (Tool *tool,
ToolAction action,
@ -240,25 +198,14 @@ tools_new_levels ()
tools_register (LEVELS, levels_options);
}
tool = (Tool *) g_malloc (sizeof (Tool));
private = (Levels *) g_malloc (sizeof (Levels));
tool = tools_new_tool (LEVELS);
private = g_new (Levels, 1);
tool->scroll_lock = TRUE; /* Disallow scrolling */
tool->preserve = FALSE; /* Don't preserve on drawable change */
tool->type = LEVELS;
tool->state = INACTIVE;
tool->scroll_lock = 1; /* Disallow scrolling */
tool->auto_snap_to = TRUE;
tool->private = (void *) private;
tool->preserve = FALSE;
tool->gdisp_ptr = NULL;
tool->drawable = NULL;
tool->button_press_func = levels_button_press;
tool->button_release_func = levels_button_release;
tool->motion_func = levels_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->modifier_key_func = standard_modifier_key_func;
tool->cursor_update_func = levels_cursor_update;
tool->control_func = levels_control;
return tool;

View File

@ -359,30 +359,23 @@ tools_new_magnify (void)
tools_register (MAGNIFY, (ToolOptions *) magnify_options);
}
tool = (Tool *) g_malloc (sizeof (Tool));
private = (Magnify *) g_malloc (sizeof (Magnify));
tool = tools_new_tool (MAGNIFY);
private = g_new (Magnify, 1);
private->core = draw_core_new (magnify_draw);
private->x = private->y = 0;
private->w = private->h = 0;
tool->type = MAGNIFY;
tool->state = INACTIVE;
tool->scroll_lock = 1; /* disallow scrolling */
tool->auto_snap_to = FALSE;
tool->scroll_lock = TRUE; /* Disallow scrolling */
tool->auto_snap_to = FALSE; /* Don't snap to guides */
tool->private = (void *) private;
tool->preserve = TRUE;
tool->gdisp_ptr = NULL;
tool->drawable = NULL;
tool->button_press_func = magnify_button_press;
tool->button_press_func = magnify_button_press;
tool->button_release_func = magnify_button_release;
tool->motion_func = magnify_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->modifier_key_func = standard_modifier_key_func;
tool->cursor_update_func = magnify_cursor_update;
tool->control_func = magnify_control;
tool->motion_func = magnify_motion;
tool->cursor_update_func = magnify_cursor_update;
tool->control_func = magnify_control;
return tool;
}

View File

@ -48,13 +48,13 @@ static GdkGC *move_gc = NULL;
/* move tool action functions */
static void move_tool_button_press (Tool *, GdkEventButton *, gpointer);
static void move_tool_button_release (Tool *, GdkEventButton *, gpointer);
static void move_tool_motion (Tool *, GdkEventMotion *, gpointer);
static void move_tool_cursor_update (Tool *, GdkEventMotion *, gpointer);
static void move_tool_control (Tool *, ToolAction, gpointer);
static void move_tool_button_press (Tool *, GdkEventButton *, gpointer);
static void move_tool_button_release (Tool *, GdkEventButton *, gpointer);
static void move_tool_motion (Tool *, GdkEventMotion *, gpointer);
static void move_tool_cursor_update (Tool *, GdkEventMotion *, gpointer);
static void move_tool_control (Tool *, ToolAction, gpointer);
static void move_create_gc (GDisplay *);
static void move_create_gc (GDisplay *);
/* move action functions */
@ -129,7 +129,8 @@ move_tool_button_press (Tool *tool,
/* if we've got an active tool grab the pointer */
if (tool->state == ACTIVE)
gdk_pointer_grab (gdisp->canvas->window, FALSE,
GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON1_MOTION_MASK | GDK_BUTTON_RELEASE_MASK,
GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON1_MOTION_MASK |
GDK_BUTTON_RELEASE_MASK,
NULL, NULL, bevent->time);
}
@ -444,30 +445,23 @@ tools_new_move_tool ()
tools_register (MOVE, (ToolOptions *) move_options);
}
tool = (Tool *) g_malloc (sizeof (Tool));
private = (MoveTool *) g_malloc (sizeof (MoveTool));
tool = tools_new_tool (MOVE);
private = g_new (MoveTool, 1);
private->layer = NULL;
private->guide = NULL;
private->disp = NULL;
tool->type = MOVE;
tool->state = INACTIVE;
tool->scroll_lock = 0; /* Allow scrolling */
tool->auto_snap_to = FALSE;
tool->auto_snap_to = FALSE; /* Don't snap to guides */
tool->private = (void *) private;
tool->preserve = TRUE;
tool->gdisp_ptr = NULL;
tool->drawable = NULL;
tool->button_press_func = move_tool_button_press;
tool->button_press_func = move_tool_button_press;
tool->button_release_func = move_tool_button_release;
tool->motion_func = move_tool_motion;
tool->arrow_keys_func = edit_sel_arrow_keys_func;
tool->modifier_key_func = standard_modifier_key_func;
tool->cursor_update_func = move_tool_cursor_update;
tool->control_func = move_tool_control;
tool->motion_func = move_tool_motion;
tool->arrow_keys_func = edit_sel_arrow_keys_func;
tool->cursor_update_func = move_tool_cursor_update;
tool->control_func = move_tool_control;
return tool;
}

View File

@ -512,36 +512,25 @@ paint_core_draw (Tool *tool)
}
Tool *
paint_core_new (int type)
paint_core_new (ToolType type)
{
Tool * tool;
PaintCore * private;
tool = (Tool *) g_malloc (sizeof (Tool));
private = (PaintCore *) g_malloc (sizeof (PaintCore));
tool = tools_new_tool (type);
private = g_new (PaintCore, 1);
private->core = draw_core_new (paint_core_draw);
private->pick_colors = FALSE;
tool->type = type;
tool->state = INACTIVE;
tool->scroll_lock = 0; /* Allow scrolling */
tool->auto_snap_to = TRUE;
tool->gdisp_ptr = NULL;
tool->private = (void *) private;
tool->preserve = TRUE;
tool->gdisp_ptr = NULL;
tool->drawable = NULL;
tool->button_press_func = paint_core_button_press;
tool->button_press_func = paint_core_button_press;
tool->button_release_func = paint_core_button_release;
tool->motion_func = paint_core_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->modifier_key_func = standard_modifier_key_func;
tool->cursor_update_func = paint_core_cursor_update;
tool->control_func = paint_core_control;
tool->motion_func = paint_core_motion;
tool->cursor_update_func = paint_core_cursor_update;
tool->control_func = paint_core_control;
return tool;
}

View File

@ -118,7 +118,7 @@ void paint_core_control (Tool *, ToolAction, gpointer);
/* paint tool functions */
void paint_core_no_draw (Tool *);
Tool * paint_core_new (int);
Tool * paint_core_new (ToolType);
void paint_core_free (Tool *);
int paint_core_init (PaintCore *, GimpDrawable *, double, double);
void paint_core_interpolate (PaintCore *, GimpDrawable *);

View File

@ -72,11 +72,7 @@ static PosterizeDialog *posterize_dialog = NULL;
/* posterize action functions */
static void posterize_button_press (Tool *, GdkEventButton *, gpointer);
static void posterize_button_release (Tool *, GdkEventButton *, gpointer);
static void posterize_motion (Tool *, GdkEventMotion *, gpointer);
static void posterize_cursor_update (Tool *, GdkEventMotion *, gpointer);
static void posterize_control (Tool *, ToolAction, gpointer);
static void posterize_control (Tool *, ToolAction, gpointer);
static PosterizeDialog * posterize_new_dialog (void);
@ -90,44 +86,6 @@ static gint posterize_delete_callback (GtkWidget *, GdkEvent *, gpointer);
/* posterize select action functions */
static void
posterize_button_press (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr)
{
GDisplay *gdisp;
gdisp = gdisp_ptr;
tool->gdisp_ptr = gdisp;
tool->drawable = gimage_active_drawable (gdisp->gimage);
}
static void
posterize_button_release (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr)
{
}
static void
posterize_motion (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
{
}
static void
posterize_cursor_update (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
{
GDisplay *gdisp;
gdisp = (GDisplay *) gdisp_ptr;
gdisplay_install_tool_cursor (gdisp, GDK_TOP_LEFT_ARROW);
}
static void
posterize_control (Tool *tool,
ToolAction action,
@ -171,25 +129,14 @@ tools_new_posterize ()
if (!GTK_WIDGET_VISIBLE (posterize_dialog->shell))
gtk_widget_show (posterize_dialog->shell);
tool = (Tool *) g_malloc (sizeof (Tool));
private = (Posterize *) g_malloc (sizeof (Posterize));
tool = tools_new_tool (POSTERIZE);
private = g_new (Posterize, 1);
tool->scroll_lock = TRUE; /* Disallow scrolling */
tool->preserve = FALSE; /* Don't preserve on drawable change */
tool->type = POSTERIZE;
tool->state = INACTIVE;
tool->scroll_lock = 1; /* Disallow scrolling */
tool->auto_snap_to = TRUE;
tool->private = (void *) private;
tool->preserve = FALSE;
tool->gdisp_ptr = NULL;
tool->drawable = NULL;
tool->button_press_func = posterize_button_press;
tool->button_release_func = posterize_button_release;
tool->motion_func = posterize_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->modifier_key_func = standard_modifier_key_func;
tool->cursor_update_func = posterize_cursor_update;
tool->control_func = posterize_control;
return tool;

View File

@ -422,7 +422,6 @@ rect_select_motion (Tool *tool,
draw_core_resume (rect_sel->core, tool);
}
void
rect_select_draw (Tool *tool)
{
@ -446,12 +445,12 @@ rect_select_draw (Tool *tool)
x1, y1, (x2 - x1), (y2 - y1));
}
void
static selection_tool_update_op_state (RectSelect *rect_sel,
int x, int y,
int state,
GDisplay *gdisp)
static void
selection_tool_update_op_state (RectSelect *rect_sel,
int x,
int y,
int state,
GDisplay *gdisp)
{
if (active_tool->state == ACTIVE)
return;
@ -561,31 +560,21 @@ tools_new_rect_select ()
tools_register (RECT_SELECT, (ToolOptions *) rect_options);
}
tool = (Tool *) g_malloc (sizeof (Tool));
private = (RectSelect *) g_malloc (sizeof (RectSelect));
tool = tools_new_tool (RECT_SELECT);
private = g_new (RectSelect, 1);
private->core = draw_core_new (rect_select_draw);
private->x = private->y = 0;
private->w = private->h = 0;
private->op = SELECTION_REPLACE;
tool->type = RECT_SELECT;
tool->state = INACTIVE;
tool->scroll_lock = 0; /* Allow scrolling */
tool->auto_snap_to = TRUE;
tool->private = (void *) private;
tool->preserve = TRUE;
tool->gdisp_ptr = NULL;
tool->drawable = NULL;
tool->button_press_func = rect_select_button_press;
tool->button_press_func = rect_select_button_press;
tool->button_release_func = rect_select_button_release;
tool->motion_func = rect_select_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->modifier_key_func = standard_modifier_key_func;
tool->cursor_update_func = rect_select_cursor_update;
tool->control_func = rect_select_control;
tool->motion_func = rect_select_motion;
tool->cursor_update_func = rect_select_cursor_update;
tool->control_func = rect_select_control;
return tool;
}

View File

@ -108,7 +108,6 @@ static GtkWidget *text_tool_shell = NULL;
static void text_button_press (Tool *, GdkEventButton *, gpointer);
static void text_button_release (Tool *, GdkEventButton *, gpointer);
static void text_motion (Tool *, GdkEventMotion *, gpointer);
static void text_cursor_update (Tool *, GdkEventMotion *, gpointer);
static void text_control (Tool *, ToolAction, gpointer);
@ -242,26 +241,17 @@ tools_new_text ()
}
/* the new text tool structure */
tool = (Tool *) g_malloc (sizeof (Tool));
the_text_tool = (TextTool *) g_malloc (sizeof (TextTool));
tool = tools_new_tool (TEXT);
the_text_tool = g_new (TextTool, 1);
tool->scroll_lock = TRUE; /* Disallow scrolling */
tool->type = TEXT;
tool->state = INACTIVE;
tool->scroll_lock = 1; /* Do not allow scrolling */
tool->auto_snap_to = TRUE;
tool->private = (void *) the_text_tool;
tool->preserve = TRUE;
tool->gdisp_ptr = NULL;
tool->drawable = NULL;
tool->button_press_func = text_button_press;
tool->button_press_func = text_button_press;
tool->button_release_func = text_button_release;
tool->motion_func = text_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->modifier_key_func = standard_modifier_key_func;
tool->cursor_update_func = text_cursor_update;
tool->control_func = text_control;
tool->cursor_update_func = text_cursor_update;
tool->control_func = text_control;
return tool;
}
@ -355,13 +345,6 @@ text_button_release (Tool *tool,
tool->state = INACTIVE;
}
static void
text_motion (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
{
}
static void
text_cursor_update (Tool *tool,
GdkEventMotion *mevent,

View File

@ -49,11 +49,7 @@ static ThresholdDialog *threshold_dialog = NULL;
/* threshold action functions */
static void threshold_button_press (Tool *, GdkEventButton *, gpointer);
static void threshold_button_release (Tool *, GdkEventButton *, gpointer);
static void threshold_motion (Tool *, GdkEventMotion *, gpointer);
static void threshold_cursor_update (Tool *, GdkEventMotion *, gpointer);
static void threshold_control (Tool *, ToolAction, gpointer);
static void threshold_control (Tool *, ToolAction, gpointer);
static ThresholdDialog * threshold_new_dialog (void);
@ -158,44 +154,6 @@ threshold_histogram_range (HistogramWidget *w,
/* threshold action functions */
static void
threshold_button_press (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr)
{
GDisplay *gdisp;
gdisp = gdisp_ptr;
tool->gdisp_ptr = gdisp;
tool->drawable = gimage_active_drawable (gdisp->gimage);
}
static void
threshold_button_release (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr)
{
}
static void
threshold_motion (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
{
}
static void
threshold_cursor_update (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
{
GDisplay *gdisp;
gdisp = (GDisplay *) gdisp_ptr;
gdisplay_install_tool_cursor (gdisp, GDK_TOP_LEFT_ARROW);
}
static void
threshold_control (Tool *tool,
ToolAction action,
@ -239,25 +197,14 @@ tools_new_threshold ()
if (!GTK_WIDGET_VISIBLE (threshold_dialog->shell))
gtk_widget_show (threshold_dialog->shell);
tool = (Tool *) g_malloc (sizeof (Tool));
private = (Threshold *) g_malloc (sizeof (Threshold));
tool = tools_new_tool (THRESHOLD);
private = g_new (Threshold, 1);
tool->scroll_lock = TRUE; /* Disallow scrolling */
tool->preserve = FALSE; /* Don't preserve on drawable change */
tool->type = THRESHOLD;
tool->state = INACTIVE;
tool->scroll_lock = 1; /* Disallow scrolling */
tool->auto_snap_to = TRUE;
tool->private = (void *) private;
tool->preserve = FALSE;
tool->gdisp_ptr = NULL;
tool->drawable = NULL;
tool->button_press_func = threshold_button_press;
tool->button_release_func = threshold_button_release;
tool->motion_func = threshold_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->modifier_key_func = standard_modifier_key_func;
tool->cursor_update_func = threshold_cursor_update;
tool->control_func = threshold_control;
return tool;

View File

@ -71,7 +71,7 @@ static GtkWidget *options_vbox = NULL;
static GtkWidget *options_label = NULL;
static GtkWidget *options_reset_button = NULL;
static int global_tool_ID = 0;
static gint global_tool_ID = 0;
ToolInfo tool_info[] =
{
@ -617,7 +617,7 @@ ToolInfo tool_info[] =
}
};
gint num_tools = sizeof (tool_info) / sizeof (ToolInfo);
gint num_tools = sizeof (tool_info) / sizeof (tool_info[0]);
/* Local function declarations */
@ -654,12 +654,6 @@ tools_select (ToolType type)
tools_options_show (active_tool->type);
/* Set the paused count variable to 0 */
active_tool->paused_count = 0;
active_tool->gdisp_ptr = NULL;
active_tool->drawable = NULL;
active_tool->ID = global_tool_ID++;
/* Update the device-information dialog */
device_status_update (current_device);
}
@ -677,7 +671,14 @@ tools_initialize (ToolType type,
/* Activate the appropriate widget.
* Implicitly calls tools_select()
*/
tools_select (type);
if (active_tool->type == type)
{
tools_select (type);
}
else
{
gtk_widget_activate (tool_info[type].tool_widget);
}
if (tool_info[(int) type].init_func)
{
@ -686,84 +687,12 @@ tools_initialize (ToolType type,
active_tool->drawable = gimage_active_drawable (gdisp->gimage);
}
/* don't set gdisp_ptr here !!! (see commands.c) */
}
void
tools_options_dialog_new ()
{
GtkWidget *frame;
GtkWidget *vbox;
ActionAreaItem action_items[2] =
{
{ N_("Reset"), tools_options_reset_callback, NULL, NULL },
{ N_("Close"), tools_options_close_callback, NULL, NULL }
};
/* The shell and main vbox */
options_shell = gtk_dialog_new ();
/* Register dialog */
dialog_register (options_shell);
gtk_window_set_wmclass (GTK_WINDOW (options_shell), "tool_options", "Gimp");
gtk_window_set_title (GTK_WINDOW (options_shell), _("Tool Options"));
gtk_window_set_policy (GTK_WINDOW (options_shell), FALSE, TRUE, TRUE);
session_set_window_geometry (options_shell, &tool_options_session_info,
FALSE );
/* The outer frame */
frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (options_shell)->vbox), frame);
gtk_widget_show (frame);
/* The vbox containing the title frame and the options vbox */
vbox = gtk_vbox_new (FALSE, 0);
gtk_container_add (GTK_CONTAINER (frame), vbox);
gtk_widget_show (vbox);
/* The title frame */
frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_OUT);
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
gtk_widget_show (frame);
options_label = gtk_label_new ("");
gtk_misc_set_padding (GTK_MISC (options_label), 1, 0);
gtk_container_add (GTK_CONTAINER (frame), options_label);
gtk_widget_show (options_label);
options_vbox = gtk_vbox_new (FALSE, 0);
gtk_container_set_border_width (GTK_CONTAINER (options_vbox), 2);
gtk_box_pack_start (GTK_BOX (vbox), options_vbox, FALSE, FALSE, 0);
/* handle the window manager trying to close the window */
gtk_signal_connect (GTK_OBJECT (options_shell), "delete_event",
GTK_SIGNAL_FUNC (tools_options_delete_callback),
options_shell);
action_items[0].user_data = options_shell;
action_items[1].user_data = options_shell;
build_action_area (GTK_DIALOG (options_shell), action_items, 2, 1);
options_reset_button = action_items[0].widget;
gtk_widget_show (options_vbox);
/* hide the separator between the dialog's vbox and the action area */
gtk_widget_hide (GTK_WIDGET (g_list_nth_data (gtk_container_children (GTK_CONTAINER (GTK_BIN (options_shell)->child)), 1)));
/* don't set gdisp_ptr here! (see commands.c) */
}
void
tools_options_dialog_show ()
{
/* menus_activate_callback() will destroy the active tool in many
cases. if the user tries to bring up the options before
switching tools, the dialog will be empty. recreate the active
tool here if necessary to avoid this behavior */
if (!GTK_WIDGET_VISIBLE (options_shell))
{
gtk_widget_show (options_shell);
@ -774,34 +703,6 @@ tools_options_dialog_show ()
}
}
void
tools_options_dialog_free ()
{
session_get_window_info (options_shell, &tool_options_session_info);
gtk_widget_destroy (options_shell);
}
void
tools_register (ToolType tool_type,
ToolOptions *tool_options)
{
g_return_if_fail (tool_options != NULL);
tool_info [(int) tool_type].tool_options = tool_options;
/* need to check whether the widget is visible...this can happen
* because some tools share options such as the transformation tools
*/
if (! GTK_WIDGET_VISIBLE (tool_options->main_vbox))
{
gtk_box_pack_start (GTK_BOX (options_vbox), tool_options->main_vbox,
TRUE, TRUE, 0);
gtk_widget_show (tool_options->main_vbox);
}
gtk_label_set_text (GTK_LABEL (options_label), _(tool_options->title));
}
void
active_tool_control (ToolAction action,
void *gdisp_ptr)
@ -857,21 +758,200 @@ active_tool_control (ToolAction action,
}
}
void
/* standard member functions */
static void
standard_button_press_func (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr)
{
GDisplay *gdisp;
gdisp = gdisp_ptr;
tool->gdisp_ptr = gdisp;
tool->drawable = gimage_active_drawable (gdisp->gimage);
}
static void
standard_button_release_func (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr)
{
}
static void
standard_motion_func (Tool *tool,
GdkEventMotion *bevent,
gpointer gdisp_ptr)
{
}
static void
standard_arrow_keys_func (Tool *tool,
GdkEventKey *kevent,
gpointer gdisp_ptr)
{
}
void
static void
standard_modifier_key_func (Tool *tool,
GdkEventKey *kevent,
gpointer gdisp_ptr)
{
}
/* tool options function */
static void
standard_cursor_update_func (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
{
GDisplay *gdisp;
gdisp = (GDisplay *) gdisp_ptr;
gdisplay_install_tool_cursor (gdisp, GDK_TOP_LEFT_ARROW);
}
static void
standard_control_func (Tool *tool,
ToolAction action,
gpointer gdisp_ptr)
{
}
/* Create a default tool structure
*
* TODO: objectifying the tools will remove lots of code duplication
*/
Tool *
tools_new_tool (ToolType type)
{
Tool *tool;
tool = g_new (Tool, 1);
tool->type = type;
tool->ID = global_tool_ID++;
tool->state = INACTIVE;
tool->paused_count = 0;
tool->scroll_lock = FALSE; /* Allow scrolling */
tool->auto_snap_to = TRUE; /* Snap to guides */
tool->preserve = TRUE; /* Preserve tool across drawable changes */
tool->gdisp_ptr = NULL;
tool->drawable = NULL;
tool->private = NULL;
tool->button_press_func = standard_button_press_func;
tool->button_release_func = standard_button_release_func;
tool->motion_func = standard_motion_func;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->modifier_key_func = standard_modifier_key_func;
tool->cursor_update_func = standard_cursor_update_func;
tool->control_func = standard_control_func;
return tool;
}
/* Tool options function */
void
tools_options_dialog_new ()
{
GtkWidget *frame;
GtkWidget *vbox;
ActionAreaItem action_items[] =
{
{ N_("Reset"), tools_options_reset_callback, NULL, NULL },
{ N_("Close"), tools_options_close_callback, NULL, NULL }
};
/* The shell and main vbox */
options_shell = gtk_dialog_new ();
/* Register dialog */
dialog_register (options_shell);
gtk_window_set_wmclass (GTK_WINDOW (options_shell), "tool_options", "Gimp");
gtk_window_set_title (GTK_WINDOW (options_shell), _("Tool Options"));
gtk_window_set_policy (GTK_WINDOW (options_shell), FALSE, TRUE, TRUE);
session_set_window_geometry (options_shell, &tool_options_session_info,
FALSE );
/* The outer frame */
frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (options_shell)->vbox), frame);
gtk_widget_show (frame);
/* The vbox containing the title frame and the options vbox */
vbox = gtk_vbox_new (FALSE, 0);
gtk_container_add (GTK_CONTAINER (frame), vbox);
gtk_widget_show (vbox);
/* The title frame */
frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_OUT);
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
gtk_widget_show (frame);
options_label = gtk_label_new ("");
gtk_misc_set_padding (GTK_MISC (options_label), 1, 0);
gtk_container_add (GTK_CONTAINER (frame), options_label);
gtk_widget_show (options_label);
options_vbox = gtk_vbox_new (FALSE, 0);
gtk_container_set_border_width (GTK_CONTAINER (options_vbox), 2);
gtk_box_pack_start (GTK_BOX (vbox), options_vbox, FALSE, FALSE, 0);
/* handle the window manager trying to close the window */
gtk_signal_connect (GTK_OBJECT (options_shell), "delete_event",
GTK_SIGNAL_FUNC (tools_options_delete_callback),
options_shell);
action_items[0].user_data = options_shell;
action_items[1].user_data = options_shell;
build_action_area (GTK_DIALOG (options_shell), action_items, 2, 1);
options_reset_button = action_items[0].widget;
gtk_widget_show (options_vbox);
/* hide the separator between the dialog's vbox and the action area */
gtk_widget_hide (GTK_WIDGET (g_list_nth_data (gtk_container_children (GTK_CONTAINER (GTK_BIN (options_shell)->child)), 1)));
}
void
tools_options_dialog_free ()
{
session_get_window_info (options_shell, &tool_options_session_info);
gtk_widget_destroy (options_shell);
}
void
tools_register (ToolType tool_type,
ToolOptions *tool_options)
{
g_return_if_fail (tool_options != NULL);
tool_info [(int) tool_type].tool_options = tool_options;
/* need to check whether the widget is visible...this can happen
* because some tools share options such as the transformation tools
*/
if (! GTK_WIDGET_VISIBLE (tool_options->main_vbox))
{
gtk_box_pack_start (GTK_BOX (options_vbox), tool_options->main_vbox,
TRUE, TRUE, 0);
gtk_widget_show (tool_options->main_vbox);
}
gtk_label_set_text (GTK_LABEL (options_label), _(tool_options->title));
}
static void
tools_options_show (ToolType tooltype)
@ -896,6 +976,8 @@ tools_options_hide (ToolType tooltype)
gtk_widget_hide (tool_info[tooltype].tool_options->main_vbox);
}
/* Tool options callbacks */
static gint
tools_options_delete_callback (GtkWidget *w,
GdkEvent *e,

View File

@ -20,6 +20,7 @@
#include "layerF.h"
#include "gdisplayF.h"
#include "gimpcontext.h"
#include "tool_options.h"
#include "toolsF.h"
@ -43,19 +44,19 @@ typedef enum
struct _Tool
{
/* Data */
ToolType type; /* Tool type */
ToolState state; /* state of tool activity */
int paused_count; /* paused control count */
int scroll_lock; /* allow scrolling or not */
int auto_snap_to; /* should the mouse snap to guides automatically */
void * private; /* Tool-specific information */
void * gdisp_ptr; /* pointer to currently active gdisp */
void * drawable; /* pointer to the drawable that was
active when the tool was created */
int ID; /* unique tool ID */
ToolType type; /* Tool type */
gint ID; /* unique tool ID */
int preserve; /* Preserve this tool through the current
image changes */
ToolState state; /* state of tool activity */
gint paused_count; /* paused control count */
gboolean scroll_lock; /* allow scrolling or not */
gboolean auto_snap_to; /* snap to guides automatically */
gboolean preserve; /* Preserve this tool across drawable changes */
void * gdisp_ptr; /* pointer to currently active gdisp */
void * drawable; /* pointer to the tool's current drawable */
void * private; /* Tool-specific information */
/* Action functions */
ButtonPressFunc button_press_func;
@ -89,14 +90,19 @@ struct _ToolInfo
ToolInfoFreeFunc free_func;
ToolInfoInitFunc init_func;
GtkWidget *tool_widget;
GtkWidget *tool_widget;
GimpContext *tool_context;
};
/* Global Data Structure */
/* Global Data Structures */
extern Tool * active_tool;
extern ToolInfo tool_info[];
extern gint num_tools;
/* Function declarations */
Tool * tools_new_tool (ToolType tool_type);
void tools_select (ToolType tool_type);
void tools_initialize (ToolType tool_type,
GDisplay *gdisplay);
@ -111,8 +117,4 @@ void tools_register (ToolType tool_type,
void active_tool_control (ToolAction action,
void *gdisp_ptr);
/* Standard member functions */
void standard_arrow_keys_func (Tool *, GdkEventKey *, gpointer);
void standard_modifier_key_func (Tool *, GdkEventKey *, gpointer);
#endif /* __TOOLS_H__ */

View File

@ -685,15 +685,15 @@ transform_core_draw (Tool *tool)
}
Tool *
transform_core_new (int type,
int interactive)
transform_core_new (ToolType type,
int interactive)
{
Tool * tool;
TransformCore * private;
int i;
tool = (Tool *) g_malloc (sizeof (Tool));
private = (TransformCore *) g_malloc (sizeof (TransformCore));
tool = tools_new_tool (type);
private = g_new (TransformCore, 1);
private->interactive = interactive;
@ -712,23 +712,16 @@ transform_core_new (int type,
private->grid_coords = private->tgrid_coords = NULL;
tool->type = type;
tool->state = INACTIVE;
tool->scroll_lock = 1; /* Do not allow scrolling */
tool->auto_snap_to = TRUE;
tool->scroll_lock = TRUE; /* Disallow scrolling */
tool->preserve = FALSE; /* Don't preserve on drawable change */
tool->private = (void *) private;
tool->preserve = FALSE; /* Destroy when the image is dirtied */
tool->gdisp_ptr = NULL;
tool->drawable = NULL;
tool->button_press_func = transform_core_button_press;
tool->button_press_func = transform_core_button_press;
tool->button_release_func = transform_core_button_release;
tool->motion_func = transform_core_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->modifier_key_func = standard_modifier_key_func;
tool->cursor_update_func = transform_core_cursor_update;
tool->control_func = transform_core_control;
tool->motion_func = transform_core_motion;
tool->cursor_update_func = transform_core_cursor_update;
tool->control_func = transform_core_control;
return tool;
}

View File

@ -135,7 +135,7 @@ void transform_core_control (Tool *, ToolAction, gpointer)
/* transform tool functions */
void transform_core_draw (Tool *);
void transform_core_no_draw (Tool *);
Tool * transform_core_new (int, int);
Tool * transform_core_new (ToolType, int);
void transform_core_free (Tool *);
void transform_core_reset (Tool *, void *);
void transform_core_grid_density_changed (void);

View File

@ -685,15 +685,15 @@ transform_core_draw (Tool *tool)
}
Tool *
transform_core_new (int type,
int interactive)
transform_core_new (ToolType type,
int interactive)
{
Tool * tool;
TransformCore * private;
int i;
tool = (Tool *) g_malloc (sizeof (Tool));
private = (TransformCore *) g_malloc (sizeof (TransformCore));
tool = tools_new_tool (type);
private = g_new (TransformCore, 1);
private->interactive = interactive;
@ -712,23 +712,16 @@ transform_core_new (int type,
private->grid_coords = private->tgrid_coords = NULL;
tool->type = type;
tool->state = INACTIVE;
tool->scroll_lock = 1; /* Do not allow scrolling */
tool->auto_snap_to = TRUE;
tool->scroll_lock = TRUE; /* Disallow scrolling */
tool->preserve = FALSE; /* Don't preserve on drawable change */
tool->private = (void *) private;
tool->preserve = FALSE; /* Destroy when the image is dirtied */
tool->gdisp_ptr = NULL;
tool->drawable = NULL;
tool->button_press_func = transform_core_button_press;
tool->button_press_func = transform_core_button_press;
tool->button_release_func = transform_core_button_release;
tool->motion_func = transform_core_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->modifier_key_func = standard_modifier_key_func;
tool->cursor_update_func = transform_core_cursor_update;
tool->control_func = transform_core_control;
tool->motion_func = transform_core_motion;
tool->cursor_update_func = transform_core_cursor_update;
tool->control_func = transform_core_control;
return tool;
}

Some files were not shown because too many files have changed in this diff Show More