removed PRETRACE_PAINT and POSTTRACE_PAINT from the GimpPaintCoreState
2004-06-14 Michael Natterer <mitch@gimp.org> * app/paint/gimppaintcore.[ch]: removed PRETRACE_PAINT and POSTTRACE_PAINT from the GimpPaintCoreState enum. Removed "gboolean traces_on_window" from GimpPaintCoreClass. * app/paint/gimpclone.[ch] * app/paint/gimpink.c * app/tools/gimpclonetool.c: changed accordingly. * app/tools/gimppainttool.c: ditto. Show the brush outline while painting. Fixes bug #118348.
This commit is contained in:
parent
4b9a4db275
commit
587e070ff4
12 changed files with 112 additions and 342 deletions
13
ChangeLog
13
ChangeLog
|
|
@ -1,3 +1,16 @@
|
|||
2004-06-14 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/paint/gimppaintcore.[ch]: removed PRETRACE_PAINT and
|
||||
POSTTRACE_PAINT from the GimpPaintCoreState enum. Removed
|
||||
"gboolean traces_on_window" from GimpPaintCoreClass.
|
||||
|
||||
* app/paint/gimpclone.[ch]
|
||||
* app/paint/gimpink.c
|
||||
* app/tools/gimpclonetool.c: changed accordingly.
|
||||
|
||||
* app/tools/gimppainttool.c: ditto. Show the brush outline
|
||||
while painting. Fixes bug #118348.
|
||||
|
||||
2004-06-14 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/tools/gimptransformtool.c: use gimp_draw_tool_is_active()
|
||||
|
|
|
|||
|
|
@ -125,8 +125,7 @@ gimp_clone_class_init (GimpCloneClass *klass)
|
|||
|
||||
parent_class = g_type_class_peek_parent (klass);
|
||||
|
||||
paint_core_class->traces_on_window = TRUE;
|
||||
paint_core_class->paint = gimp_clone_paint;
|
||||
paint_core_class->paint = gimp_clone_paint;
|
||||
|
||||
brush_core_class->handles_changing_brush = TRUE;
|
||||
}
|
||||
|
|
@ -134,24 +133,18 @@ gimp_clone_class_init (GimpCloneClass *klass)
|
|||
static void
|
||||
gimp_clone_init (GimpClone *clone)
|
||||
{
|
||||
clone->set_source = FALSE;
|
||||
clone->set_source = FALSE;
|
||||
|
||||
clone->src_drawable = NULL;
|
||||
clone->src_x = 0.0;
|
||||
clone->src_y = 0.0;
|
||||
clone->src_drawable = NULL;
|
||||
clone->src_x = 0.0;
|
||||
clone->src_y = 0.0;
|
||||
|
||||
clone->orig_src_x = 0;
|
||||
clone->orig_src_y = 0;
|
||||
clone->orig_src_x = 0;
|
||||
clone->orig_src_y = 0;
|
||||
|
||||
clone->offset_x = 0;
|
||||
clone->offset_y = 0;
|
||||
clone->first_stroke = TRUE;
|
||||
|
||||
clone->init_callback = NULL;
|
||||
clone->finish_callback = NULL;
|
||||
clone->pretrace_callback = NULL;
|
||||
clone->posttrace_callback = NULL;
|
||||
clone->callback_data = NULL;
|
||||
clone->offset_x = 0;
|
||||
clone->offset_y = 0;
|
||||
clone->first_stroke = TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -167,16 +160,6 @@ gimp_clone_paint (GimpPaintCore *paint_core,
|
|||
|
||||
switch (paint_state)
|
||||
{
|
||||
case PRETRACE_PAINT:
|
||||
if (clone->pretrace_callback)
|
||||
clone->pretrace_callback (clone, clone->callback_data);
|
||||
break;
|
||||
|
||||
case POSTTRACE_PAINT:
|
||||
if (clone->posttrace_callback)
|
||||
clone->posttrace_callback (clone, clone->callback_data);
|
||||
break;
|
||||
|
||||
case INIT_PAINT:
|
||||
if (clone->set_source)
|
||||
{
|
||||
|
|
@ -195,9 +178,6 @@ gimp_clone_paint (GimpPaintCore *paint_core,
|
|||
clone->first_stroke = TRUE;
|
||||
}
|
||||
|
||||
if (clone->init_callback)
|
||||
clone->init_callback (clone, clone->callback_data);
|
||||
|
||||
if (options->clone_type == GIMP_PATTERN_CLONE)
|
||||
if (! gimp_context_get_pattern (context))
|
||||
g_message (_("No patterns available for this operation."));
|
||||
|
|
@ -244,9 +224,6 @@ gimp_clone_paint (GimpPaintCore *paint_core,
|
|||
break;
|
||||
|
||||
case FINISH_PAINT:
|
||||
if (clone->finish_callback)
|
||||
clone->finish_callback (clone, clone->callback_data);
|
||||
|
||||
if (options->align_mode == GIMP_CLONE_ALIGN_NO && ! clone->first_stroke)
|
||||
{
|
||||
clone->src_x = clone->orig_src_x;
|
||||
|
|
|
|||
|
|
@ -50,17 +50,6 @@ struct _GimpClone
|
|||
gint offset_x;
|
||||
gint offset_y;
|
||||
gboolean first_stroke;
|
||||
|
||||
void (* init_callback) (GimpClone *clone,
|
||||
gpointer data);
|
||||
void (* finish_callback) (GimpClone *clone,
|
||||
gpointer data);
|
||||
void (* pretrace_callback) (GimpClone *clone,
|
||||
gpointer data);
|
||||
void (* posttrace_callback) (GimpClone *clone,
|
||||
gpointer data);
|
||||
|
||||
gpointer callback_data;
|
||||
};
|
||||
|
||||
struct _GimpCloneClass
|
||||
|
|
|
|||
|
|
@ -173,12 +173,6 @@ gimp_ink_paint (GimpPaintCore *paint_core,
|
|||
|
||||
switch (paint_state)
|
||||
{
|
||||
case PRETRACE_PAINT:
|
||||
break;
|
||||
|
||||
case POSTTRACE_PAINT:
|
||||
break;
|
||||
|
||||
case INIT_PAINT:
|
||||
if (ink->last_blob &&
|
||||
paint_core->cur_coords.x == paint_core->last_coords.x &&
|
||||
|
|
|
|||
|
|
@ -131,7 +131,6 @@ gimp_paint_core_class_init (GimpPaintCoreClass *klass)
|
|||
|
||||
object_class->finalize = gimp_paint_core_finalize;
|
||||
|
||||
klass->traces_on_window = FALSE;
|
||||
klass->start = gimp_paint_core_real_start;
|
||||
klass->pre_paint = gimp_paint_core_real_pre_paint;
|
||||
klass->paint = gimp_paint_core_real_paint;
|
||||
|
|
|
|||
|
|
@ -27,15 +27,9 @@
|
|||
|
||||
typedef enum
|
||||
{
|
||||
INIT_PAINT, /* Setup PaintFunc internals */
|
||||
MOTION_PAINT, /* PaintFunc performs motion-related rendering */
|
||||
FINISH_PAINT, /* Cleanup and/or reset PaintFunc operation */
|
||||
PRETRACE_PAINT, /* PaintFunc performs window tracing activity
|
||||
* prior to rendering
|
||||
*/
|
||||
POSTTRACE_PAINT /* PaintFunc performs window tracing activity
|
||||
* following rendering
|
||||
*/
|
||||
INIT_PAINT, /* Setup PaintFunc internals */
|
||||
MOTION_PAINT, /* PaintFunc performs motion-related rendering */
|
||||
FINISH_PAINT /* Cleanup and/or reset PaintFunc operation */
|
||||
} GimpPaintCoreState;
|
||||
|
||||
|
||||
|
|
@ -82,12 +76,6 @@ struct _GimpPaintCoreClass
|
|||
{
|
||||
GimpObjectClass parent_class;
|
||||
|
||||
/* Set for tools that perform temporary rendering directly to the
|
||||
* window. These require sequencing with gimp_display_flush().
|
||||
* See gimpclone.c for example.
|
||||
*/
|
||||
gboolean traces_on_window;
|
||||
|
||||
/* virtual functions */
|
||||
gboolean (* start) (GimpPaintCore *core,
|
||||
GimpDrawable *drawable,
|
||||
|
|
|
|||
|
|
@ -125,8 +125,7 @@ gimp_clone_class_init (GimpCloneClass *klass)
|
|||
|
||||
parent_class = g_type_class_peek_parent (klass);
|
||||
|
||||
paint_core_class->traces_on_window = TRUE;
|
||||
paint_core_class->paint = gimp_clone_paint;
|
||||
paint_core_class->paint = gimp_clone_paint;
|
||||
|
||||
brush_core_class->handles_changing_brush = TRUE;
|
||||
}
|
||||
|
|
@ -134,24 +133,18 @@ gimp_clone_class_init (GimpCloneClass *klass)
|
|||
static void
|
||||
gimp_clone_init (GimpClone *clone)
|
||||
{
|
||||
clone->set_source = FALSE;
|
||||
clone->set_source = FALSE;
|
||||
|
||||
clone->src_drawable = NULL;
|
||||
clone->src_x = 0.0;
|
||||
clone->src_y = 0.0;
|
||||
clone->src_drawable = NULL;
|
||||
clone->src_x = 0.0;
|
||||
clone->src_y = 0.0;
|
||||
|
||||
clone->orig_src_x = 0;
|
||||
clone->orig_src_y = 0;
|
||||
clone->orig_src_x = 0;
|
||||
clone->orig_src_y = 0;
|
||||
|
||||
clone->offset_x = 0;
|
||||
clone->offset_y = 0;
|
||||
clone->first_stroke = TRUE;
|
||||
|
||||
clone->init_callback = NULL;
|
||||
clone->finish_callback = NULL;
|
||||
clone->pretrace_callback = NULL;
|
||||
clone->posttrace_callback = NULL;
|
||||
clone->callback_data = NULL;
|
||||
clone->offset_x = 0;
|
||||
clone->offset_y = 0;
|
||||
clone->first_stroke = TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -167,16 +160,6 @@ gimp_clone_paint (GimpPaintCore *paint_core,
|
|||
|
||||
switch (paint_state)
|
||||
{
|
||||
case PRETRACE_PAINT:
|
||||
if (clone->pretrace_callback)
|
||||
clone->pretrace_callback (clone, clone->callback_data);
|
||||
break;
|
||||
|
||||
case POSTTRACE_PAINT:
|
||||
if (clone->posttrace_callback)
|
||||
clone->posttrace_callback (clone, clone->callback_data);
|
||||
break;
|
||||
|
||||
case INIT_PAINT:
|
||||
if (clone->set_source)
|
||||
{
|
||||
|
|
@ -195,9 +178,6 @@ gimp_clone_paint (GimpPaintCore *paint_core,
|
|||
clone->first_stroke = TRUE;
|
||||
}
|
||||
|
||||
if (clone->init_callback)
|
||||
clone->init_callback (clone, clone->callback_data);
|
||||
|
||||
if (options->clone_type == GIMP_PATTERN_CLONE)
|
||||
if (! gimp_context_get_pattern (context))
|
||||
g_message (_("No patterns available for this operation."));
|
||||
|
|
@ -244,9 +224,6 @@ gimp_clone_paint (GimpPaintCore *paint_core,
|
|||
break;
|
||||
|
||||
case FINISH_PAINT:
|
||||
if (clone->finish_callback)
|
||||
clone->finish_callback (clone, clone->callback_data);
|
||||
|
||||
if (options->align_mode == GIMP_CLONE_ALIGN_NO && ! clone->first_stroke)
|
||||
{
|
||||
clone->src_x = clone->orig_src_x;
|
||||
|
|
|
|||
|
|
@ -50,17 +50,6 @@ struct _GimpClone
|
|||
gint offset_x;
|
||||
gint offset_y;
|
||||
gboolean first_stroke;
|
||||
|
||||
void (* init_callback) (GimpClone *clone,
|
||||
gpointer data);
|
||||
void (* finish_callback) (GimpClone *clone,
|
||||
gpointer data);
|
||||
void (* pretrace_callback) (GimpClone *clone,
|
||||
gpointer data);
|
||||
void (* posttrace_callback) (GimpClone *clone,
|
||||
gpointer data);
|
||||
|
||||
gpointer callback_data;
|
||||
};
|
||||
|
||||
struct _GimpCloneClass
|
||||
|
|
|
|||
|
|
@ -377,9 +377,6 @@ gimp_paint_tool_button_press (GimpTool *tool,
|
|||
curr_coords.x -= off_x;
|
||||
curr_coords.y -= off_y;
|
||||
|
||||
if (gimp_draw_tool_is_active (draw_tool))
|
||||
gimp_draw_tool_stop (draw_tool);
|
||||
|
||||
if (tool->gdisp &&
|
||||
tool->gdisp != gdisp &&
|
||||
tool->gdisp->gimage == gdisp->gimage)
|
||||
|
|
@ -435,12 +432,11 @@ gimp_paint_tool_button_press (GimpTool *tool,
|
|||
/* pause the current selection */
|
||||
gimp_image_selection_control (gdisp->gimage, GIMP_SELECTION_PAUSE);
|
||||
|
||||
gimp_draw_tool_pause (draw_tool);
|
||||
|
||||
/* Let the specific painting function initialize itself */
|
||||
gimp_paint_core_paint (core, drawable, paint_options, INIT_PAINT, time);
|
||||
|
||||
if (GIMP_PAINT_CORE_GET_CLASS (core)->traces_on_window)
|
||||
gimp_paint_core_paint (core, drawable, paint_options, PRETRACE_PAINT, time);
|
||||
|
||||
/* Paint to the image */
|
||||
if (paint_tool->draw_line)
|
||||
{
|
||||
|
|
@ -453,8 +449,7 @@ gimp_paint_tool_button_press (GimpTool *tool,
|
|||
|
||||
gimp_display_flush_now (gdisp);
|
||||
|
||||
if (GIMP_PAINT_CORE_GET_CLASS (core)->traces_on_window)
|
||||
gimp_paint_core_paint (core, drawable, paint_options, POSTTRACE_PAINT, time);
|
||||
gimp_draw_tool_resume (draw_tool);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -464,12 +459,11 @@ gimp_paint_tool_button_release (GimpTool *tool,
|
|||
GdkModifierType state,
|
||||
GimpDisplay *gdisp)
|
||||
{
|
||||
GimpPaintTool *paint_tool;
|
||||
GimpPaintTool *paint_tool = GIMP_PAINT_TOOL (tool);
|
||||
GimpPaintOptions *paint_options;
|
||||
GimpPaintCore *core;
|
||||
GimpDrawable *drawable;
|
||||
|
||||
paint_tool = GIMP_PAINT_TOOL (tool);
|
||||
paint_options = GIMP_PAINT_OPTIONS (tool->tool_info->tool_options);
|
||||
|
||||
core = paint_tool->core;
|
||||
|
|
@ -525,15 +519,16 @@ gimp_paint_tool_motion (GimpTool *tool,
|
|||
if (gimp_color_tool_is_enabled (GIMP_COLOR_TOOL (tool)))
|
||||
return;
|
||||
|
||||
if (GIMP_PAINT_CORE_GET_CLASS (core)->traces_on_window)
|
||||
gimp_paint_core_paint (core, drawable, paint_options, PRETRACE_PAINT, time);
|
||||
gimp_draw_tool_pause (GIMP_DRAW_TOOL (tool));
|
||||
|
||||
gimp_paint_core_interpolate (core, drawable, paint_options, time);
|
||||
|
||||
gimp_display_flush_now (gdisp);
|
||||
|
||||
if (GIMP_PAINT_CORE_GET_CLASS (core)->traces_on_window)
|
||||
gimp_paint_core_paint (core, drawable, paint_options, POSTTRACE_PAINT, time);
|
||||
paint_tool->brush_x = coords->x;
|
||||
paint_tool->brush_y = coords->y;
|
||||
|
||||
gimp_draw_tool_resume (GIMP_DRAW_TOOL (tool));
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -543,28 +538,29 @@ gimp_paint_tool_key_press (GimpTool *tool,
|
|||
{
|
||||
if (tool->gdisp)
|
||||
{
|
||||
GimpContext *context;
|
||||
gdouble opacity;
|
||||
GimpContext *context = GIMP_CONTEXT (tool->tool_info->tool_options);
|
||||
gdouble opacity;
|
||||
|
||||
context = gimp_get_user_context (tool->gdisp->gimage->gimp);
|
||||
opacity = gimp_context_get_opacity (context);
|
||||
|
||||
switch (kevent->keyval)
|
||||
{
|
||||
case GDK_Left:
|
||||
opacity = CLAMP (opacity - 0.01, 0, 1);
|
||||
break;
|
||||
case GDK_Right:
|
||||
opacity = CLAMP (opacity + 0.01, 0, 1);
|
||||
break;
|
||||
case GDK_Up:
|
||||
opacity = CLAMP (opacity + 0.1, 0, 1);
|
||||
break;
|
||||
case GDK_Down:
|
||||
opacity = CLAMP (opacity - 0.1, 0, 1);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
case GDK_Left:
|
||||
opacity = CLAMP (opacity - 0.01, 0, 1);
|
||||
break;
|
||||
case GDK_Right:
|
||||
opacity = CLAMP (opacity + 0.01, 0, 1);
|
||||
break;
|
||||
case GDK_Up:
|
||||
opacity = CLAMP (opacity + 0.1, 0, 1);
|
||||
break;
|
||||
case GDK_Down:
|
||||
opacity = CLAMP (opacity - 0.1, 0, 1);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
gimp_context_set_opacity (context, opacity);
|
||||
}
|
||||
}
|
||||
|
|
@ -576,11 +572,8 @@ gimp_paint_tool_modifier_key (GimpTool *tool,
|
|||
GdkModifierType state,
|
||||
GimpDisplay *gdisp)
|
||||
{
|
||||
GimpPaintTool *paint_tool;
|
||||
GimpDrawTool *draw_tool;
|
||||
|
||||
paint_tool = GIMP_PAINT_TOOL (tool);
|
||||
draw_tool = GIMP_DRAW_TOOL (tool);
|
||||
GimpPaintTool *paint_tool = GIMP_PAINT_TOOL (tool);
|
||||
GimpDrawTool *draw_tool = GIMP_DRAW_TOOL (tool);
|
||||
|
||||
if (key != GDK_CONTROL_MASK)
|
||||
return;
|
||||
|
|
@ -621,15 +614,13 @@ gimp_paint_tool_oper_update (GimpTool *tool,
|
|||
GdkModifierType state,
|
||||
GimpDisplay *gdisp)
|
||||
{
|
||||
GimpPaintTool *paint_tool;
|
||||
GimpPaintTool *paint_tool = GIMP_PAINT_TOOL (tool);
|
||||
GimpDrawTool *draw_tool = GIMP_DRAW_TOOL (tool);
|
||||
GimpPaintOptions *paint_options;
|
||||
GimpDrawTool *draw_tool;
|
||||
GimpPaintCore *core;
|
||||
GimpDisplayShell *shell;
|
||||
GimpDrawable *drawable;
|
||||
|
||||
paint_tool = GIMP_PAINT_TOOL (tool);
|
||||
draw_tool = GIMP_DRAW_TOOL (tool);
|
||||
paint_options = GIMP_PAINT_OPTIONS (tool->tool_info->tool_options);
|
||||
|
||||
if (gimp_color_tool_is_enabled (GIMP_COLOR_TOOL (draw_tool)))
|
||||
|
|
@ -718,19 +709,16 @@ gimp_paint_tool_oper_update (GimpTool *tool,
|
|||
g_type_name (G_TYPE_FROM_INSTANCE (tool)),
|
||||
status_str);
|
||||
|
||||
paint_tool->brush_x = core->cur_coords.x + off_x;
|
||||
paint_tool->brush_y = core->cur_coords.y + off_y;
|
||||
|
||||
paint_tool->draw_line = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
paint_tool->brush_x = coords->x;
|
||||
paint_tool->brush_y = coords->y;
|
||||
|
||||
paint_tool->draw_line = FALSE;
|
||||
}
|
||||
|
||||
paint_tool->brush_x = coords->x;
|
||||
paint_tool->brush_y = coords->y;
|
||||
|
||||
gimp_draw_tool_start (draw_tool, gdisp);
|
||||
}
|
||||
|
||||
|
|
@ -745,7 +733,8 @@ gimp_paint_tool_draw (GimpDrawTool *draw_tool)
|
|||
GimpPaintTool *paint_tool = GIMP_PAINT_TOOL (draw_tool);
|
||||
GimpPaintCore *core = paint_tool->core;
|
||||
|
||||
if (paint_tool->draw_line)
|
||||
if (paint_tool->draw_line &&
|
||||
! gimp_tool_control_is_active (GIMP_TOOL (draw_tool)->control))
|
||||
{
|
||||
/* Draw start target */
|
||||
gimp_draw_tool_draw_handle (draw_tool,
|
||||
|
|
|
|||
|
|
@ -50,9 +50,6 @@
|
|||
static void gimp_clone_tool_class_init (GimpCloneToolClass *klass);
|
||||
static void gimp_clone_tool_init (GimpCloneTool *tool);
|
||||
|
||||
static GObject * gimp_clone_tool_constructor (GType type,
|
||||
guint n_params,
|
||||
GObjectConstructParam *params);
|
||||
static void gimp_clone_tool_button_press (GimpTool *tool,
|
||||
GimpCoords *coords,
|
||||
guint32 time,
|
||||
|
|
@ -71,15 +68,6 @@ static void gimp_clone_tool_cursor_update (GimpTool *tool,
|
|||
|
||||
static void gimp_clone_tool_draw (GimpDrawTool *draw_tool);
|
||||
|
||||
static void gimp_clone_init_callback (GimpClone *clone,
|
||||
gpointer data);
|
||||
static void gimp_clone_finish_callback (GimpClone *clone,
|
||||
gpointer data);
|
||||
static void gimp_clone_pretrace_callback (GimpClone *clone,
|
||||
gpointer data);
|
||||
static void gimp_clone_posttrace_callback (GimpClone *clone,
|
||||
gpointer data);
|
||||
|
||||
static GtkWidget * gimp_clone_options_gui (GimpToolOptions *tool_options);
|
||||
|
||||
|
||||
|
|
@ -135,14 +123,11 @@ gimp_clone_tool_get_type (void)
|
|||
static void
|
||||
gimp_clone_tool_class_init (GimpCloneToolClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
GimpToolClass *tool_class = GIMP_TOOL_CLASS (klass);
|
||||
GimpDrawToolClass *draw_tool_class = GIMP_DRAW_TOOL_CLASS (klass);
|
||||
|
||||
parent_class = g_type_class_peek_parent (klass);
|
||||
|
||||
object_class->constructor = gimp_clone_tool_constructor;
|
||||
|
||||
tool_class->button_press = gimp_clone_tool_button_press;
|
||||
tool_class->motion = gimp_clone_tool_motion;
|
||||
tool_class->cursor_update = gimp_clone_tool_cursor_update;
|
||||
|
|
@ -158,30 +143,6 @@ gimp_clone_tool_init (GimpCloneTool *clone)
|
|||
gimp_tool_control_set_tool_cursor (tool->control, GIMP_TOOL_CURSOR_CLONE);
|
||||
}
|
||||
|
||||
static GObject *
|
||||
gimp_clone_tool_constructor (GType type,
|
||||
guint n_params,
|
||||
GObjectConstructParam *params)
|
||||
{
|
||||
GObject *object;
|
||||
GimpPaintTool *paint_tool;
|
||||
GimpClone *clone_core;
|
||||
|
||||
object = G_OBJECT_CLASS (parent_class)->constructor (type, n_params, params);
|
||||
|
||||
paint_tool = GIMP_PAINT_TOOL (object);
|
||||
|
||||
clone_core = GIMP_CLONE (paint_tool->core);
|
||||
|
||||
clone_core->init_callback = gimp_clone_init_callback;
|
||||
clone_core->finish_callback = gimp_clone_finish_callback;
|
||||
clone_core->pretrace_callback = gimp_clone_pretrace_callback;
|
||||
clone_core->posttrace_callback = gimp_clone_posttrace_callback;
|
||||
clone_core->callback_data = object;
|
||||
|
||||
return object;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_clone_tool_button_press (GimpTool *tool,
|
||||
GimpCoords *coords,
|
||||
|
|
@ -265,7 +226,8 @@ gimp_clone_tool_draw (GimpDrawTool *draw_tool)
|
|||
|
||||
options = (GimpCloneOptions *) tool->tool_info->tool_options;
|
||||
|
||||
if (draw_tool->gdisp && options->clone_type == GIMP_IMAGE_CLONE)
|
||||
if (gimp_draw_tool_is_active (draw_tool) &&
|
||||
options->clone_type == GIMP_IMAGE_CLONE)
|
||||
{
|
||||
GimpClone *clone = GIMP_CLONE (GIMP_PAINT_TOOL (draw_tool)->core);
|
||||
|
||||
|
|
@ -293,35 +255,6 @@ gimp_clone_tool_draw (GimpDrawTool *draw_tool)
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_clone_init_callback (GimpClone *clone,
|
||||
gpointer data)
|
||||
{
|
||||
gimp_draw_tool_start (GIMP_DRAW_TOOL (data),
|
||||
GIMP_TOOL (data)->gdisp);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_clone_finish_callback (GimpClone *clone,
|
||||
gpointer data)
|
||||
{
|
||||
gimp_draw_tool_stop (GIMP_DRAW_TOOL (data));
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_clone_pretrace_callback (GimpClone *clone,
|
||||
gpointer data)
|
||||
{
|
||||
gimp_draw_tool_pause (GIMP_DRAW_TOOL (data));
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_clone_posttrace_callback (GimpClone *clone,
|
||||
gpointer data)
|
||||
{
|
||||
gimp_draw_tool_resume (GIMP_DRAW_TOOL (data));
|
||||
}
|
||||
|
||||
|
||||
/* tool options stuff */
|
||||
|
||||
|
|
|
|||
|
|
@ -377,9 +377,6 @@ gimp_paint_tool_button_press (GimpTool *tool,
|
|||
curr_coords.x -= off_x;
|
||||
curr_coords.y -= off_y;
|
||||
|
||||
if (gimp_draw_tool_is_active (draw_tool))
|
||||
gimp_draw_tool_stop (draw_tool);
|
||||
|
||||
if (tool->gdisp &&
|
||||
tool->gdisp != gdisp &&
|
||||
tool->gdisp->gimage == gdisp->gimage)
|
||||
|
|
@ -435,12 +432,11 @@ gimp_paint_tool_button_press (GimpTool *tool,
|
|||
/* pause the current selection */
|
||||
gimp_image_selection_control (gdisp->gimage, GIMP_SELECTION_PAUSE);
|
||||
|
||||
gimp_draw_tool_pause (draw_tool);
|
||||
|
||||
/* Let the specific painting function initialize itself */
|
||||
gimp_paint_core_paint (core, drawable, paint_options, INIT_PAINT, time);
|
||||
|
||||
if (GIMP_PAINT_CORE_GET_CLASS (core)->traces_on_window)
|
||||
gimp_paint_core_paint (core, drawable, paint_options, PRETRACE_PAINT, time);
|
||||
|
||||
/* Paint to the image */
|
||||
if (paint_tool->draw_line)
|
||||
{
|
||||
|
|
@ -453,8 +449,7 @@ gimp_paint_tool_button_press (GimpTool *tool,
|
|||
|
||||
gimp_display_flush_now (gdisp);
|
||||
|
||||
if (GIMP_PAINT_CORE_GET_CLASS (core)->traces_on_window)
|
||||
gimp_paint_core_paint (core, drawable, paint_options, POSTTRACE_PAINT, time);
|
||||
gimp_draw_tool_resume (draw_tool);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -464,12 +459,11 @@ gimp_paint_tool_button_release (GimpTool *tool,
|
|||
GdkModifierType state,
|
||||
GimpDisplay *gdisp)
|
||||
{
|
||||
GimpPaintTool *paint_tool;
|
||||
GimpPaintTool *paint_tool = GIMP_PAINT_TOOL (tool);
|
||||
GimpPaintOptions *paint_options;
|
||||
GimpPaintCore *core;
|
||||
GimpDrawable *drawable;
|
||||
|
||||
paint_tool = GIMP_PAINT_TOOL (tool);
|
||||
paint_options = GIMP_PAINT_OPTIONS (tool->tool_info->tool_options);
|
||||
|
||||
core = paint_tool->core;
|
||||
|
|
@ -525,15 +519,16 @@ gimp_paint_tool_motion (GimpTool *tool,
|
|||
if (gimp_color_tool_is_enabled (GIMP_COLOR_TOOL (tool)))
|
||||
return;
|
||||
|
||||
if (GIMP_PAINT_CORE_GET_CLASS (core)->traces_on_window)
|
||||
gimp_paint_core_paint (core, drawable, paint_options, PRETRACE_PAINT, time);
|
||||
gimp_draw_tool_pause (GIMP_DRAW_TOOL (tool));
|
||||
|
||||
gimp_paint_core_interpolate (core, drawable, paint_options, time);
|
||||
|
||||
gimp_display_flush_now (gdisp);
|
||||
|
||||
if (GIMP_PAINT_CORE_GET_CLASS (core)->traces_on_window)
|
||||
gimp_paint_core_paint (core, drawable, paint_options, POSTTRACE_PAINT, time);
|
||||
paint_tool->brush_x = coords->x;
|
||||
paint_tool->brush_y = coords->y;
|
||||
|
||||
gimp_draw_tool_resume (GIMP_DRAW_TOOL (tool));
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -543,28 +538,29 @@ gimp_paint_tool_key_press (GimpTool *tool,
|
|||
{
|
||||
if (tool->gdisp)
|
||||
{
|
||||
GimpContext *context;
|
||||
gdouble opacity;
|
||||
GimpContext *context = GIMP_CONTEXT (tool->tool_info->tool_options);
|
||||
gdouble opacity;
|
||||
|
||||
context = gimp_get_user_context (tool->gdisp->gimage->gimp);
|
||||
opacity = gimp_context_get_opacity (context);
|
||||
|
||||
switch (kevent->keyval)
|
||||
{
|
||||
case GDK_Left:
|
||||
opacity = CLAMP (opacity - 0.01, 0, 1);
|
||||
break;
|
||||
case GDK_Right:
|
||||
opacity = CLAMP (opacity + 0.01, 0, 1);
|
||||
break;
|
||||
case GDK_Up:
|
||||
opacity = CLAMP (opacity + 0.1, 0, 1);
|
||||
break;
|
||||
case GDK_Down:
|
||||
opacity = CLAMP (opacity - 0.1, 0, 1);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
case GDK_Left:
|
||||
opacity = CLAMP (opacity - 0.01, 0, 1);
|
||||
break;
|
||||
case GDK_Right:
|
||||
opacity = CLAMP (opacity + 0.01, 0, 1);
|
||||
break;
|
||||
case GDK_Up:
|
||||
opacity = CLAMP (opacity + 0.1, 0, 1);
|
||||
break;
|
||||
case GDK_Down:
|
||||
opacity = CLAMP (opacity - 0.1, 0, 1);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
gimp_context_set_opacity (context, opacity);
|
||||
}
|
||||
}
|
||||
|
|
@ -576,11 +572,8 @@ gimp_paint_tool_modifier_key (GimpTool *tool,
|
|||
GdkModifierType state,
|
||||
GimpDisplay *gdisp)
|
||||
{
|
||||
GimpPaintTool *paint_tool;
|
||||
GimpDrawTool *draw_tool;
|
||||
|
||||
paint_tool = GIMP_PAINT_TOOL (tool);
|
||||
draw_tool = GIMP_DRAW_TOOL (tool);
|
||||
GimpPaintTool *paint_tool = GIMP_PAINT_TOOL (tool);
|
||||
GimpDrawTool *draw_tool = GIMP_DRAW_TOOL (tool);
|
||||
|
||||
if (key != GDK_CONTROL_MASK)
|
||||
return;
|
||||
|
|
@ -621,15 +614,13 @@ gimp_paint_tool_oper_update (GimpTool *tool,
|
|||
GdkModifierType state,
|
||||
GimpDisplay *gdisp)
|
||||
{
|
||||
GimpPaintTool *paint_tool;
|
||||
GimpPaintTool *paint_tool = GIMP_PAINT_TOOL (tool);
|
||||
GimpDrawTool *draw_tool = GIMP_DRAW_TOOL (tool);
|
||||
GimpPaintOptions *paint_options;
|
||||
GimpDrawTool *draw_tool;
|
||||
GimpPaintCore *core;
|
||||
GimpDisplayShell *shell;
|
||||
GimpDrawable *drawable;
|
||||
|
||||
paint_tool = GIMP_PAINT_TOOL (tool);
|
||||
draw_tool = GIMP_DRAW_TOOL (tool);
|
||||
paint_options = GIMP_PAINT_OPTIONS (tool->tool_info->tool_options);
|
||||
|
||||
if (gimp_color_tool_is_enabled (GIMP_COLOR_TOOL (draw_tool)))
|
||||
|
|
@ -718,19 +709,16 @@ gimp_paint_tool_oper_update (GimpTool *tool,
|
|||
g_type_name (G_TYPE_FROM_INSTANCE (tool)),
|
||||
status_str);
|
||||
|
||||
paint_tool->brush_x = core->cur_coords.x + off_x;
|
||||
paint_tool->brush_y = core->cur_coords.y + off_y;
|
||||
|
||||
paint_tool->draw_line = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
paint_tool->brush_x = coords->x;
|
||||
paint_tool->brush_y = coords->y;
|
||||
|
||||
paint_tool->draw_line = FALSE;
|
||||
}
|
||||
|
||||
paint_tool->brush_x = coords->x;
|
||||
paint_tool->brush_y = coords->y;
|
||||
|
||||
gimp_draw_tool_start (draw_tool, gdisp);
|
||||
}
|
||||
|
||||
|
|
@ -745,7 +733,8 @@ gimp_paint_tool_draw (GimpDrawTool *draw_tool)
|
|||
GimpPaintTool *paint_tool = GIMP_PAINT_TOOL (draw_tool);
|
||||
GimpPaintCore *core = paint_tool->core;
|
||||
|
||||
if (paint_tool->draw_line)
|
||||
if (paint_tool->draw_line &&
|
||||
! gimp_tool_control_is_active (GIMP_TOOL (draw_tool)->control))
|
||||
{
|
||||
/* Draw start target */
|
||||
gimp_draw_tool_draw_handle (draw_tool,
|
||||
|
|
|
|||
|
|
@ -50,9 +50,6 @@
|
|||
static void gimp_clone_tool_class_init (GimpCloneToolClass *klass);
|
||||
static void gimp_clone_tool_init (GimpCloneTool *tool);
|
||||
|
||||
static GObject * gimp_clone_tool_constructor (GType type,
|
||||
guint n_params,
|
||||
GObjectConstructParam *params);
|
||||
static void gimp_clone_tool_button_press (GimpTool *tool,
|
||||
GimpCoords *coords,
|
||||
guint32 time,
|
||||
|
|
@ -71,15 +68,6 @@ static void gimp_clone_tool_cursor_update (GimpTool *tool,
|
|||
|
||||
static void gimp_clone_tool_draw (GimpDrawTool *draw_tool);
|
||||
|
||||
static void gimp_clone_init_callback (GimpClone *clone,
|
||||
gpointer data);
|
||||
static void gimp_clone_finish_callback (GimpClone *clone,
|
||||
gpointer data);
|
||||
static void gimp_clone_pretrace_callback (GimpClone *clone,
|
||||
gpointer data);
|
||||
static void gimp_clone_posttrace_callback (GimpClone *clone,
|
||||
gpointer data);
|
||||
|
||||
static GtkWidget * gimp_clone_options_gui (GimpToolOptions *tool_options);
|
||||
|
||||
|
||||
|
|
@ -135,14 +123,11 @@ gimp_clone_tool_get_type (void)
|
|||
static void
|
||||
gimp_clone_tool_class_init (GimpCloneToolClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
GimpToolClass *tool_class = GIMP_TOOL_CLASS (klass);
|
||||
GimpDrawToolClass *draw_tool_class = GIMP_DRAW_TOOL_CLASS (klass);
|
||||
|
||||
parent_class = g_type_class_peek_parent (klass);
|
||||
|
||||
object_class->constructor = gimp_clone_tool_constructor;
|
||||
|
||||
tool_class->button_press = gimp_clone_tool_button_press;
|
||||
tool_class->motion = gimp_clone_tool_motion;
|
||||
tool_class->cursor_update = gimp_clone_tool_cursor_update;
|
||||
|
|
@ -158,30 +143,6 @@ gimp_clone_tool_init (GimpCloneTool *clone)
|
|||
gimp_tool_control_set_tool_cursor (tool->control, GIMP_TOOL_CURSOR_CLONE);
|
||||
}
|
||||
|
||||
static GObject *
|
||||
gimp_clone_tool_constructor (GType type,
|
||||
guint n_params,
|
||||
GObjectConstructParam *params)
|
||||
{
|
||||
GObject *object;
|
||||
GimpPaintTool *paint_tool;
|
||||
GimpClone *clone_core;
|
||||
|
||||
object = G_OBJECT_CLASS (parent_class)->constructor (type, n_params, params);
|
||||
|
||||
paint_tool = GIMP_PAINT_TOOL (object);
|
||||
|
||||
clone_core = GIMP_CLONE (paint_tool->core);
|
||||
|
||||
clone_core->init_callback = gimp_clone_init_callback;
|
||||
clone_core->finish_callback = gimp_clone_finish_callback;
|
||||
clone_core->pretrace_callback = gimp_clone_pretrace_callback;
|
||||
clone_core->posttrace_callback = gimp_clone_posttrace_callback;
|
||||
clone_core->callback_data = object;
|
||||
|
||||
return object;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_clone_tool_button_press (GimpTool *tool,
|
||||
GimpCoords *coords,
|
||||
|
|
@ -265,7 +226,8 @@ gimp_clone_tool_draw (GimpDrawTool *draw_tool)
|
|||
|
||||
options = (GimpCloneOptions *) tool->tool_info->tool_options;
|
||||
|
||||
if (draw_tool->gdisp && options->clone_type == GIMP_IMAGE_CLONE)
|
||||
if (gimp_draw_tool_is_active (draw_tool) &&
|
||||
options->clone_type == GIMP_IMAGE_CLONE)
|
||||
{
|
||||
GimpClone *clone = GIMP_CLONE (GIMP_PAINT_TOOL (draw_tool)->core);
|
||||
|
||||
|
|
@ -293,35 +255,6 @@ gimp_clone_tool_draw (GimpDrawTool *draw_tool)
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_clone_init_callback (GimpClone *clone,
|
||||
gpointer data)
|
||||
{
|
||||
gimp_draw_tool_start (GIMP_DRAW_TOOL (data),
|
||||
GIMP_TOOL (data)->gdisp);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_clone_finish_callback (GimpClone *clone,
|
||||
gpointer data)
|
||||
{
|
||||
gimp_draw_tool_stop (GIMP_DRAW_TOOL (data));
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_clone_pretrace_callback (GimpClone *clone,
|
||||
gpointer data)
|
||||
{
|
||||
gimp_draw_tool_pause (GIMP_DRAW_TOOL (data));
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_clone_posttrace_callback (GimpClone *clone,
|
||||
gpointer data)
|
||||
{
|
||||
gimp_draw_tool_resume (GIMP_DRAW_TOOL (data));
|
||||
}
|
||||
|
||||
|
||||
/* tool options stuff */
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue