Commit 6d0e5c34 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

forgot a "return".

2001-12-01  Michael Natterer  <mitch@gimp.org>

	* app/errors.c: forgot a "return".

	* app/gui/error-console-dialog.c: the menu item signals were
	connected "swapped", which is wrong.

	* app/tools/gimperasertool.c: added a cursor_update_func(), update
	the "toggled" state there and chain up. Fixes wrong cursor
	updating.

	Made brush_pipe slection work again, removed the #warnings:

	* app/core/gimpbrush.[ch]
	* app/core/gimpbrushpipe.c: changed brush_class->select_brush()
	and brush_class->want_null_motion() to be proper virtual
	functions. Pass last_coords and cur_coords to them.

	* app/tools/gimppainttool.c: call the functions again.
parent f77c7ade
2001-12-01 Michael Natterer <mitch@gimp.org>
* app/errors.c: forgot a "return".
* app/gui/error-console-dialog.c: the menu item signals were
connected "swapped", which is wrong.
* app/tools/gimperasertool.c: added a cursor_update_func(), update
the "toggled" state there and chain up. Fixes wrong cursor
updating.
Made brush_pipe slection work again, removed the #warnings:
* app/core/gimpbrush.[ch]
* app/core/gimpbrushpipe.c: changed brush_class->select_brush()
and brush_class->want_null_motion() to be proper virtual
functions. Pass last_coords and cur_coords to them.
* app/tools/gimppainttool.c: call the functions again.
2001-12-01 Michael Natterer <mitch@gimp.org>
* app/main.c
......
......@@ -62,20 +62,22 @@ enum
};
static void gimp_brush_class_init (GimpBrushClass *klass);
static void gimp_brush_init (GimpBrush *brush);
static void gimp_brush_class_init (GimpBrushClass *klass);
static void gimp_brush_init (GimpBrush *brush);
static void gimp_brush_finalize (GObject *object);
static void gimp_brush_finalize (GObject *object);
static TempBuf * gimp_brush_get_new_preview (GimpViewable *viewable,
gint width,
gint height);
static gchar * gimp_brush_get_extension (GimpData *data);
static TempBuf * gimp_brush_get_new_preview (GimpViewable *viewable,
gint width,
gint height);
static gchar * gimp_brush_get_extension (GimpData *data);
#if 0
static GimpBrush * gimp_brush_select_brush (GimpPaintTool *paint_tool);
static gboolean gimp_brush_want_null_motion (GimpPaintTool *paint_tool);
#endif
static GimpBrush * gimp_brush_real_select_brush (GimpBrush *brush,
GimpCoords *last_coords,
GimpCoords *cur_coords);
static gboolean gimp_brush_real_want_null_motion (GimpBrush *brush,
GimpCoords *last_coords,
GimpCoords *cur_coords);
static guint brush_signals[LAST_SIGNAL] = { 0 };
......@@ -139,10 +141,8 @@ gimp_brush_class_init (GimpBrushClass *klass)
data_class->get_extension = gimp_brush_get_extension;
#if 0
klass->select_brush = gimp_brush_select_brush;
klass->want_null_motion = gimp_brush_want_null_motion;
#endif
klass->select_brush = gimp_brush_real_select_brush;
klass->want_null_motion = gimp_brush_real_want_null_motion;
}
static void
......@@ -361,19 +361,49 @@ gimp_brush_load (const gchar *filename)
return GIMP_DATA (brush);
}
#if 0
GimpBrush *
gimp_brush_select_brush (GimpBrush *brush,
GimpCoords *last_coords,
GimpCoords *cur_coords)
{
g_return_val_if_fail (GIMP_IS_BRUSH (brush), NULL);
g_return_val_if_fail (last_coords != NULL, NULL);
g_return_val_if_fail (cur_coords != NULL, NULL);
return GIMP_BRUSH_GET_CLASS (brush)->select_brush (brush,
last_coords,
cur_coords);
}
gboolean
gimp_brush_want_null_motion (GimpBrush *brush,
GimpCoords *last_coords,
GimpCoords *cur_coords)
{
g_return_val_if_fail (GIMP_IS_BRUSH (brush), FALSE);
g_return_val_if_fail (last_coords != NULL, FALSE);
g_return_val_if_fail (cur_coords != NULL, FALSE);
return GIMP_BRUSH_GET_CLASS (brush)->want_null_motion (brush,
last_coords,
cur_coords);
}
static GimpBrush *
gimp_brush_select_brush (GimpPaintTool *paint_core)
gimp_brush_real_select_brush (GimpBrush *brush,
GimpCoords *last_coords,
GimpCoords *cur_coords)
{
return paint_core->brush;
return brush;
}
static gboolean
gimp_brush_want_null_motion (GimpPaintTool *paint_core)
gimp_brush_real_want_null_motion (GimpBrush *brush,
GimpCoords *last_coords,
GimpCoords *cur_coords)
{
return TRUE;
}
#endif
TempBuf *
gimp_brush_get_mask (const GimpBrush *brush)
......
......@@ -62,20 +62,22 @@ enum
};
static void gimp_brush_class_init (GimpBrushClass *klass);
static void gimp_brush_init (GimpBrush *brush);
static void gimp_brush_class_init (GimpBrushClass *klass);
static void gimp_brush_init (GimpBrush *brush);
static void gimp_brush_finalize (GObject *object);
static void gimp_brush_finalize (GObject *object);
static TempBuf * gimp_brush_get_new_preview (GimpViewable *viewable,
gint width,
gint height);
static gchar * gimp_brush_get_extension (GimpData *data);
static TempBuf * gimp_brush_get_new_preview (GimpViewable *viewable,
gint width,
gint height);
static gchar * gimp_brush_get_extension (GimpData *data);
#if 0
static GimpBrush * gimp_brush_select_brush (GimpPaintTool *paint_tool);
static gboolean gimp_brush_want_null_motion (GimpPaintTool *paint_tool);
#endif
static GimpBrush * gimp_brush_real_select_brush (GimpBrush *brush,
GimpCoords *last_coords,
GimpCoords *cur_coords);
static gboolean gimp_brush_real_want_null_motion (GimpBrush *brush,
GimpCoords *last_coords,
GimpCoords *cur_coords);
static guint brush_signals[LAST_SIGNAL] = { 0 };
......@@ -139,10 +141,8 @@ gimp_brush_class_init (GimpBrushClass *klass)
data_class->get_extension = gimp_brush_get_extension;
#if 0
klass->select_brush = gimp_brush_select_brush;
klass->want_null_motion = gimp_brush_want_null_motion;
#endif
klass->select_brush = gimp_brush_real_select_brush;
klass->want_null_motion = gimp_brush_real_want_null_motion;
}
static void
......@@ -361,19 +361,49 @@ gimp_brush_load (const gchar *filename)
return GIMP_DATA (brush);
}
#if 0
GimpBrush *
gimp_brush_select_brush (GimpBrush *brush,
GimpCoords *last_coords,
GimpCoords *cur_coords)
{
g_return_val_if_fail (GIMP_IS_BRUSH (brush), NULL);
g_return_val_if_fail (last_coords != NULL, NULL);
g_return_val_if_fail (cur_coords != NULL, NULL);
return GIMP_BRUSH_GET_CLASS (brush)->select_brush (brush,
last_coords,
cur_coords);
}
gboolean
gimp_brush_want_null_motion (GimpBrush *brush,
GimpCoords *last_coords,
GimpCoords *cur_coords)
{
g_return_val_if_fail (GIMP_IS_BRUSH (brush), FALSE);
g_return_val_if_fail (last_coords != NULL, FALSE);
g_return_val_if_fail (cur_coords != NULL, FALSE);
return GIMP_BRUSH_GET_CLASS (brush)->want_null_motion (brush,
last_coords,
cur_coords);
}
static GimpBrush *
gimp_brush_select_brush (GimpPaintTool *paint_core)
gimp_brush_real_select_brush (GimpBrush *brush,
GimpCoords *last_coords,
GimpCoords *cur_coords)
{
return paint_core->brush;
return brush;
}
static gboolean
gimp_brush_want_null_motion (GimpPaintTool *paint_core)
gimp_brush_real_want_null_motion (GimpBrush *brush,
GimpCoords *last_coords,
GimpCoords *cur_coords)
{
return TRUE;
}
#endif
TempBuf *
gimp_brush_get_mask (const GimpBrush *brush)
......
......@@ -55,36 +55,38 @@ struct _GimpBrushClass
void (* spacing_changed) (GimpBrush *brush);
#if 0
/* FIXME: these are no virtual function pointers but bad hacks: */
GimpBrush * (* select_brush) (GimpPaintTool *paint_tool);
gboolean (* want_null_motion) (GimpPaintTool *paint_tool);
maybe:
GimpBrush * (* select_brush) (GimpBrush *brush,
GimpValuators *current,
GimpValuators *new);
#endif
GimpBrush * (* select_brush) (GimpBrush *brush,
GimpCoords *last_coords,
GimpCoords *cur_coords);
gboolean (* want_null_motion) (GimpBrush *brush,
GimpCoords *last_coords,
GimpCoords *cur_coords);
};
GType gimp_brush_get_type (void) G_GNUC_CONST;
GType gimp_brush_get_type (void) G_GNUC_CONST;
GimpData * gimp_brush_new (const gchar *name);
GimpData * gimp_brush_get_standard (void);
GimpData * gimp_brush_load (const gchar *filename);
GimpData * gimp_brush_new (const gchar *name);
GimpData * gimp_brush_get_standard (void);
GimpData * gimp_brush_load (const gchar *filename);
GimpBrush * gimp_brush_load_brush (gint fd,
const gchar *filename);
GimpBrush * gimp_brush_load_brush (gint fd,
const gchar *filename);
GimpBrush * gimp_brush_select_brush (GimpBrush *brush,
GimpCoords *last_coords,
GimpCoords *cur_coords);
gboolean gimp_brush_want_null_motion (GimpBrush *brush,
GimpCoords *last_coords,
GimpCoords *cur_coords);
TempBuf * gimp_brush_get_mask (const GimpBrush *brush);
TempBuf * gimp_brush_get_pixmap (const GimpBrush *brush);
TempBuf * gimp_brush_get_mask (const GimpBrush *brush);
TempBuf * gimp_brush_get_pixmap (const GimpBrush *brush);
gint gimp_brush_get_spacing (const GimpBrush *brush);
void gimp_brush_set_spacing (GimpBrush *brush,
gint spacing);
void gimp_brush_spacing_changed (GimpBrush *brush);
gint gimp_brush_get_spacing (const GimpBrush *brush);
void gimp_brush_set_spacing (GimpBrush *brush,
gint spacing);
void gimp_brush_spacing_changed (GimpBrush *brush);
#endif /* __GIMP_BRUSH_H__ */
......@@ -57,12 +57,14 @@
static void gimp_brush_pipe_class_init (GimpBrushPipeClass *klass);
static void gimp_brush_pipe_init (GimpBrushPipe *pipe);
static void gimp_brush_pipe_finalize (GObject *object);
static void gimp_brush_pipe_finalize (GObject *object);
#if 0
static GimpBrush * gimp_brush_pipe_select_brush (GimpPaintTool *paint_tool);
static gboolean gimp_brush_pipe_want_null_motion (GimpPaintTool *paint_tool);
#endif
static GimpBrush * gimp_brush_pipe_select_brush (GimpBrush *brush,
GimpCoords *last_coords,
GimpCoords *cur_coords);
static gboolean gimp_brush_pipe_want_null_motion (GimpBrush *brush,
GimpCoords *last_coords,
GimpCoords *cur_coords);
static GimpBrushClass *parent_class = NULL;
......@@ -109,13 +111,8 @@ gimp_brush_pipe_class_init (GimpBrushPipeClass *klass)
object_class->finalize = gimp_brush_pipe_finalize;
#ifdef __GNUC__
#warning: FIXME brush_class->select_brush etc.
#endif
#if 0
brush_class->select_brush = gimp_brush_pipe_select_brush;
brush_class->want_null_motion = gimp_brush_pipe_want_null_motion;
#endif
}
static void
......@@ -180,18 +177,16 @@ gimp_brush_pipe_finalize (GObject *object)
G_OBJECT_CLASS (parent_class)->finalize (object);
}
#if 0
static GimpBrush *
gimp_brush_pipe_select_brush (GimpPaintTool *paint_tool)
gimp_brush_pipe_select_brush (GimpBrush *brush,
GimpCoords *last_coords,
GimpCoords *cur_coords)
{
GimpBrushPipe *pipe;
gint i, brushix, ix;
gdouble angle;
g_return_val_if_fail (paint_tool != NULL, NULL);
g_return_val_if_fail (GIMP_IS_BRUSH_PIPE (paint_tool->brush), NULL);
pipe = GIMP_BRUSH_PIPE (paint_tool->brush);
pipe = GIMP_BRUSH_PIPE (brush);
if (pipe->nbrushes == 1)
return GIMP_BRUSH (pipe->current);
......@@ -205,8 +200,8 @@ gimp_brush_pipe_select_brush (GimpPaintTool *paint_tool)
ix = (pipe->index[i] + 1) % pipe->rank[i];
break;
case PIPE_SELECT_ANGULAR:
angle = atan2 (paint_tool->cury - paint_tool->lasty,
paint_tool->curx - paint_tool->lastx);
angle = atan2 (cur_coords->y - last_coords->y,
cur_coords->x - last_coords->x);
/* Offset angle to be compatible with PSP tubes */
angle += G_PI_2;
/* Map it to the [0..2*G_PI) interval */
......@@ -221,13 +216,13 @@ gimp_brush_pipe_select_brush (GimpPaintTool *paint_tool)
ix = rand () % pipe->rank[i];
break;
case PIPE_SELECT_PRESSURE:
ix = RINT (paint_tool->curpressure * (pipe->rank[i] - 1));
ix = RINT (cur_coords->pressure * (pipe->rank[i] - 1));
break;
case PIPE_SELECT_TILT_X:
ix = RINT (paint_tool->curxtilt / 2.0 * pipe->rank[i]) + pipe->rank[i]/2;
ix = RINT (cur_coords->xtilt / 2.0 * pipe->rank[i]) + pipe->rank[i]/2;
break;
case PIPE_SELECT_TILT_Y:
ix = RINT (paint_tool->curytilt / 2.0 * pipe->rank[i]) + pipe->rank[i]/2;
ix = RINT (cur_coords->ytilt / 2.0 * pipe->rank[i]) + pipe->rank[i]/2;
break;
case PIPE_SELECT_CONSTANT:
default:
......@@ -247,15 +242,14 @@ gimp_brush_pipe_select_brush (GimpPaintTool *paint_tool)
}
static gboolean
gimp_brush_pipe_want_null_motion (GimpPaintTool *paint_tool)
gimp_brush_pipe_want_null_motion (GimpBrush *brush,
GimpCoords *last_coords,
GimpCoords *cur_coords)
{
GimpBrushPipe *pipe;
gint i;
g_return_val_if_fail (paint_tool != NULL, TRUE);
g_return_val_if_fail (GIMP_IS_BRUSH_PIPE (paint_tool->brush), TRUE);
pipe = GIMP_BRUSH_PIPE (paint_tool->brush);
pipe = GIMP_BRUSH_PIPE (brush);
if (pipe->nbrushes == 1)
return TRUE;
......@@ -266,7 +260,6 @@ gimp_brush_pipe_want_null_motion (GimpPaintTool *paint_tool)
return TRUE;
}
#endif
GimpData *
gimp_brush_pipe_load (const gchar *filename)
......
......@@ -57,12 +57,14 @@
static void gimp_brush_pipe_class_init (GimpBrushPipeClass *klass);
static void gimp_brush_pipe_init (GimpBrushPipe *pipe);
static void gimp_brush_pipe_finalize (GObject *object);
static void gimp_brush_pipe_finalize (GObject *object);
#if 0
static GimpBrush * gimp_brush_pipe_select_brush (GimpPaintTool *paint_tool);
static gboolean gimp_brush_pipe_want_null_motion (GimpPaintTool *paint_tool);
#endif
static GimpBrush * gimp_brush_pipe_select_brush (GimpBrush *brush,
GimpCoords *last_coords,
GimpCoords *cur_coords);
static gboolean gimp_brush_pipe_want_null_motion (GimpBrush *brush,
GimpCoords *last_coords,
GimpCoords *cur_coords);
static GimpBrushClass *parent_class = NULL;
......@@ -109,13 +111,8 @@ gimp_brush_pipe_class_init (GimpBrushPipeClass *klass)
object_class->finalize = gimp_brush_pipe_finalize;
#ifdef __GNUC__
#warning: FIXME brush_class->select_brush etc.
#endif
#if 0
brush_class->select_brush = gimp_brush_pipe_select_brush;
brush_class->want_null_motion = gimp_brush_pipe_want_null_motion;
#endif
}
static void
......@@ -180,18 +177,16 @@ gimp_brush_pipe_finalize (GObject *object)
G_OBJECT_CLASS (parent_class)->finalize (object);
}
#if 0
static GimpBrush *
gimp_brush_pipe_select_brush (GimpPaintTool *paint_tool)
gimp_brush_pipe_select_brush (GimpBrush *brush,
GimpCoords *last_coords,
GimpCoords *cur_coords)
{
GimpBrushPipe *pipe;
gint i, brushix, ix;
gdouble angle;
g_return_val_if_fail (paint_tool != NULL, NULL);
g_return_val_if_fail (GIMP_IS_BRUSH_PIPE (paint_tool->brush), NULL);
pipe = GIMP_BRUSH_PIPE (paint_tool->brush);
pipe = GIMP_BRUSH_PIPE (brush);
if (pipe->nbrushes == 1)
return GIMP_BRUSH (pipe->current);
......@@ -205,8 +200,8 @@ gimp_brush_pipe_select_brush (GimpPaintTool *paint_tool)
ix = (pipe->index[i] + 1) % pipe->rank[i];
break;
case PIPE_SELECT_ANGULAR:
angle = atan2 (paint_tool->cury - paint_tool->lasty,
paint_tool->curx - paint_tool->lastx);
angle = atan2 (cur_coords->y - last_coords->y,
cur_coords->x - last_coords->x);
/* Offset angle to be compatible with PSP tubes */
angle += G_PI_2;
/* Map it to the [0..2*G_PI) interval */
......@@ -221,13 +216,13 @@ gimp_brush_pipe_select_brush (GimpPaintTool *paint_tool)
ix = rand () % pipe->rank[i];
break;
case PIPE_SELECT_PRESSURE:
ix = RINT (paint_tool->curpressure * (pipe->rank[i] - 1));
ix = RINT (cur_coords->pressure * (pipe->rank[i] - 1));
break;
case PIPE_SELECT_TILT_X:
ix = RINT (paint_tool->curxtilt / 2.0 * pipe->rank[i]) + pipe->rank[i]/2;
ix = RINT (cur_coords->xtilt / 2.0 * pipe->rank[i]) + pipe->rank[i]/2;
break;
case PIPE_SELECT_TILT_Y:
ix = RINT (paint_tool->curytilt / 2.0 * pipe->rank[i]) + pipe->rank[i]/2;
ix = RINT (cur_coords->ytilt / 2.0 * pipe->rank[i]) + pipe->rank[i]/2;
break;
case PIPE_SELECT_CONSTANT:
default:
......@@ -247,15 +242,14 @@ gimp_brush_pipe_select_brush (GimpPaintTool *paint_tool)
}
static gboolean
gimp_brush_pipe_want_null_motion (GimpPaintTool *paint_tool)
gimp_brush_pipe_want_null_motion (GimpBrush *brush,
GimpCoords *last_coords,
GimpCoords *cur_coords)
{
GimpBrushPipe *pipe;
gint i;
g_return_val_if_fail (paint_tool != NULL, TRUE);
g_return_val_if_fail (GIMP_IS_BRUSH_PIPE (paint_tool->brush), TRUE);
pipe = GIMP_BRUSH_PIPE (paint_tool->brush);
pipe = GIMP_BRUSH_PIPE (brush);
if (pipe->nbrushes == 1)
return TRUE;
......@@ -266,7 +260,6 @@ gimp_brush_pipe_want_null_motion (GimpPaintTool *paint_tool)
return TRUE;
}
#endif
GimpData *
gimp_brush_pipe_load (const gchar *filename)
......
......@@ -60,6 +60,7 @@ gimp_message_log_func (const gchar *log_domain,
if (! console_messages && GIMP_IS_GIMP (the_gimp))
{
gimp_message (the_gimp, message);
return;
}
g_printerr ("%s: %s\n", prog_name, message);
......
......@@ -143,17 +143,17 @@ error_console_create (Gimp *gimp)
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
gtk_widget_show (menuitem);
g_signal_connect_swapped (G_OBJECT (menuitem), "activate",
G_CALLBACK (error_console_write_all_callback),
text_buffer);
g_signal_connect (G_OBJECT (menuitem), "activate",
G_CALLBACK (error_console_write_all_callback),
text_buffer);
menuitem = gtk_menu_item_new_with_label (_("Write selection to file..."));
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
gtk_widget_show (menuitem);
g_signal_connect_swapped (G_OBJECT (menuitem), "activate",
G_CALLBACK (error_console_write_selection_callback),
text_buffer);
g_signal_connect (G_OBJECT (menuitem), "activate",
G_CALLBACK (error_console_write_selection_callback),
text_buffer);
/* The output text widget */
text_view = gtk_text_view_new_with_buffer (text_buffer);
......
......@@ -64,25 +64,29 @@ struct _EraserOptions
};
static void gimp_eraser_tool_class_init (GimpEraserToolClass *klass);
static void gimp_eraser_tool_init (GimpEraserTool *eraser);
static void gimp_eraser_tool_modifier_key (GimpTool *tool,
GdkModifierType key,
gboolean press,
GdkModifierType state,
GimpDisplay *gdisp);
static void gimp_eraser_tool_paint (GimpPaintTool *paint_tool,
GimpDrawable *drawable,
PaintState state);
static void gimp_eraser_tool_motion (GimpPaintTool *paint_tool,
GimpDrawable *drawable,
PaintPressureOptions *pressure_options,
gboolean hard,
gboolean incremental,
gboolean anti_erase);
static void gimp_eraser_tool_class_init (GimpEraserToolClass *klass);
static void gimp_eraser_tool_init (GimpEraserTool *eraser);
static void gimp_eraser_tool_modifier_key (GimpTool *tool,
GdkModifierType key,
gboolean press,
GdkModifierType state,
GimpDisplay *gdisp);
static void gimp_eraser_tool_cursor_update (GimpTool *tool,
GimpCoords *coords,
GdkModifierType state,
GimpDisplay *gdisp);
static void gimp_eraser_tool_paint (GimpPaintTool *paint_tool,
GimpDrawable *drawable,
PaintState state);
static void gimp_eraser_tool_motion (GimpPaintTool *paint_tool,
GimpDrawable *drawable,
PaintPressureOptions *pressure_options,
gboolean hard,
gboolean incremental,
gboolean anti_erase);
static GimpToolOptions * gimp_eraser_tool_options_new (GimpToolInfo *tool_info);
static void gimp_eraser_tool_options_reset (GimpToolOptions *tool_options);
......@@ -153,9 +157,10 @@ gimp_eraser_tool_class_init (GimpEraserToolClass *klass)
parent_class = g_type_class_peek_parent (klass);
tool_class->modifier_key = gimp_eraser_tool_modifier_key;
tool_class->modifier_key = gimp_eraser_tool_modifier_key;
tool_class->cursor_update = gimp_eraser_tool_cursor_update;
paint_tool_class->paint = gimp_eraser_tool_paint;
paint_tool_class->paint = gimp_eraser_tool_paint;
}
static void
......@@ -193,6 +198,21 @@ gimp_eraser_tool_modifier_key (GimpTool *tool,
tool->toggled = options->anti_erase;
}
static void
gimp_eraser_tool_cursor_update (GimpTool *tool,
GimpCoords *coords,
GdkModifierType state,
GimpDisplay *gdisp)
{
EraserOptions *options;
options = (EraserOptions *) tool->tool_info->tool_options;
tool->toggled = options->anti_erase;
GIMP_TOOL_CLASS (parent_class)->cursor_update (tool, coords, state, gdisp);
}
static void
gimp_eraser_tool_paint (GimpPaintTool *paint_tool,
GimpDrawable *drawable,
......
......@@ -294,8 +294,7 @@ gimp_paint_tool_control (GimpTool *tool,
break;
}
if (GIMP_TOOL_CLASS (parent_class)->control)
GIMP_TOOL_CLASS (parent_class)->control (tool, action, gdisp);
GIMP_TOOL_CLASS (parent_class)->control (tool, action, gdisp);
}
static void
......@@ -367,7 +366,7 @@ gimp_paint_tool_button_press (GimpTool *tool,
{
draw_line = TRUE;
paint_tool->start_coords =paint_tool->last_coords;
paint_tool->start_coords = paint_tool->last_coords;
/* Restrict to multiples of 15 degrees if ctrl is pressed */
if (state & GDK_CONTROL_MASK)
......@@ -457,24 +456,17 @@ gimp_paint_tool_button_press (GimpTool *tool,
* pixmap to select.)
*/
if (paint_tool->last_coords.x != paint_tool->cur_coords.x ||
paint_tool->last_coords.y != paint_tool->cur_coords.y
#ifdef __GNUC__
#warning FIXME: GIMP_BRUSH_GET_CLASS (paint_tool->brush)->want_null_motion
#endif
#if 0
|| GIMP_BRUSH_GET_CLASS (paint_tool->brush)->want_null_motion (paint_tool)
#endif
)
paint_tool->last_coords.y != paint_tool->cur_coords.y ||
gimp_brush_want_null_motion (paint_tool->brush,
&paint_tool->last_coords,
&paint_tool->cur_coords))
{
if (paint_tool->flags & TOOL_CAN_HANDLE_CHANGING_BRUSH)
{
#ifdef __GNUC__
#warning FIXME: GIMP_BRUSH_GET_CLASS (paint_tool->brush)->select_brush
#endif
#if 0
paint_tool->brush =
GIMP_BRUSH_GET_CLASS (paint_tool->brush)->select_brush (paint_tool);
#endif
gimp_brush_select_brush (paint_tool->brush,
&paint_tool->last_coords,
&paint_tool->cur_coords);
}
gimp_paint_tool_paint (paint_tool, drawable, MOTION_PAINT);
......@@ -500,12 +492,13 @@ gimp_paint_tool_button_release (GimpTool *tool,
GdkModifierType state,
GimpDisplay *gdisp)
{
GimpImage *gimage;
GimpPaintTool *paint_tool;
GimpDrawable *drawable;
gimage = gdisp->gimage;
paint_tool = GIMP_PAINT_TOOL (tool);
drawable = gimp_image_active_drawable (gdisp->gimage);
/* resume the current selection and ungrab the pointer */
gimp_image_selection_control (gdisp->gimage, GIMP_SELECTION_RESUME);
......@@ -513,18 +506,16 @@ gimp_paint_tool_button_release (GimpTool *tool,
gdk_flush ();
/* Let the specific painting function finish up */
gimp_paint_tool_paint (paint_tool,
gimp_image_active_drawable (gdisp->gimage),
FINISH_PAINT);
gimp_paint_tool_paint (paint_tool, drawable, FINISH_PAINT);
/* Set tool state to inactive -- no longer painting */
gimp_draw_tool_stop (GIMP_DRAW_TOOL (paint_tool));
/* Set tool state to inactive -- no longer painting */
tool->state = INACTIVE;
paint_tool->pick_state = FALSE;
gimp_paint_tool_finish (paint_tool,
gimp_image_active_drawable (gdisp->gimage));
gimp_paint_tool_finish (paint_tool, drawable);
gdisplays_flush ();
}
......@@ -537,12 +528,14 @@ gimp_paint_tool_motion (GimpTool *tool,
GimpDisplay *gdisp)
{
GimpPaintTool *paint_tool;
GimpDrawable *drawable;
gint off_x, off_y;
paint_tool = GIMP_PAINT_TOOL (tool);
gimp_drawable_offsets (gimp_image_active_drawable (gdisp->gimage),
&off_x, &off_y);
drawable = gimp_image_active_drawable (gdisp->gimage);
gimp_drawable_offsets (drawable, &off_x, &off_y);
paint_tool->cur_coords = *coords;
paint_tool->state = state;
......@@ -552,31 +545,22 @@ gimp_paint_tool_motion (GimpTool *tool,
if (paint_tool->pick_state)
{
gimp_paint_tool_sample_color (gimp_image_active_drawable (gdisp->gimage),
gimp_paint_tool_sample_color (drawable,
paint_tool->cur_coords.x,
paint_tool->cur_coords.y,
state);
return;
}