Add a flags field and corresponding type ToolFlags to PaintCore. The only

1999-08-27  Tor Lillqvist  <tml@iki.fi>

* app/paint_core.h: Add a flags field and corresponding type
ToolFlags to PaintCore. The only flag bit defined so far is
TOOL_CAN_HANDLE_CHANGING_BRUSH, which those tools who don't mind
if the brush changes while painting (as in the case of pixmap pipe
brushes).

* app/paint_core.c: Test above flag before calling the brush's
select_brush method.

* app/airbrush.c
* app/paintbrush.c
* app/pencil.c: Set above flag.

* app/makefile.{cygwin,msc}: Add latest additions.
This commit is contained in:
Tor Lillqvist 1999-08-26 21:33:58 +00:00 committed by Tor Lillqvist
parent f70e9a6aab
commit 387002c04b
18 changed files with 70 additions and 15 deletions

View File

@ -1,3 +1,20 @@
1999-08-27 Tor Lillqvist <tml@iki.fi>
* app/paint_core.h: Add a flags field and corresponding type
ToolFlags to PaintCore. The only flag bit defined so far is
TOOL_CAN_HANDLE_CHANGING_BRUSH, which those tools who don't mind
if the brush changes while painting (as in the case of pixmap pipe
brushes).
* app/paint_core.c: Test above flag before calling the brush's
select_brush method.
* app/airbrush.c
* app/paintbrush.c
* app/pencil.c: Set above flag.
* app/makefile.{cygwin,msc}: Add latest additions.
Thu Aug 26 14:16:12 PDT 1999 Manish Singh <yosh@gimp.org>
* app/gimpbrushpreview.c: #include gimpbrushpipe.h and gimpbrushpipeP.h

View File

@ -184,6 +184,7 @@ tools_new_airbrush ()
private = (PaintCore *) tool->private;
private->paint_func = airbrush_paint_func;
private->pick_colors = TRUE;
private->flags |= TOOL_CAN_HANDLE_CHANGING_BRUSH;
return tool;
}

View File

@ -136,12 +136,14 @@ gimp_OBJECTS = \
gimpbrushgenerated.o \
gimpbrushlist.o \
gimpbrushpipe.o \
gimpbrushpreview.o \
gimpcontext.o \
gimpdnd.o \
gimphistogram.o \
gimplist.o \
gimplut.o \
gimpparasite.o \
gimppatternpreview.o \
gimpprogress.o \
gimprc.o \
gimprc_cmds.o \
@ -157,6 +159,7 @@ gimp_OBJECTS = \
histogram_tool.o \
hue_saturation.o \
image_map.o \
image_new.o \
image_render.o \
indicator_area.o \
info_dialog.o \

View File

@ -143,12 +143,14 @@ gimp_OBJECTS = \
gimpbrushgenerated.obj \
gimpbrushlist.obj \
gimpbrushpipe.obj \
gimpbrushpreview.obj \
gimpcontext.obj \
gimpdnd.obj \
gimphistogram.obj \
gimplist.obj \
gimplut.obj \
gimpparasite.obj \
gimppatternpreview.obj \
gimpprogress.obj \
gimprc.obj \
gimprc_cmds.obj \
@ -164,6 +166,7 @@ gimp_OBJECTS = \
histogram_tool.obj \
hue_saturation.obj \
image_map.obj \
image_new.obj \
image_render.obj \
indicator_area.obj \
info_dialog.obj \

View File

@ -184,6 +184,7 @@ tools_new_airbrush ()
private = (PaintCore *) tool->private;
private->paint_func = airbrush_paint_func;
private->pick_colors = TRUE;
private->flags |= TOOL_CAN_HANDLE_CHANGING_BRUSH;
return tool;
}

View File

@ -94,6 +94,7 @@ tools_new_pencil (void)
private = (PaintCore *) tool->private;
private->paint_func = pencil_paint_func;
private->pick_colors = TRUE;
private->flags |= TOOL_CAN_HANDLE_CHANGING_BRUSH;
return tool;
}

View File

@ -273,9 +273,10 @@ paint_core_button_press (Tool *tool,
}
else
{
paint_core->brush =
(* GIMP_BRUSH_CLASS (GTK_OBJECT (paint_core->brush)
->klass)->select_brush) (paint_core);
if (paint_core->flags & TOOL_CAN_HANDLE_CHANGING_BRUSH)
paint_core->brush =
(* GIMP_BRUSH_CLASS (GTK_OBJECT (paint_core->brush)
->klass)->select_brush) (paint_core);
(* paint_core->paint_func) (paint_core, drawable, MOTION_PAINT);
}
@ -532,7 +533,8 @@ paint_core_new (ToolType type)
private->core = draw_core_new (paint_core_draw);
private->pick_colors = FALSE;
private->flags = 0;
tool->private = (void *) private;
tool->button_press_func = paint_core_button_press;
@ -755,9 +757,10 @@ paint_core_interpolate (PaintCore *paint_core,
paint_core->curpressure = paint_core->lastpressure + dpressure * t;
paint_core->curxtilt = paint_core->lastxtilt + dxtilt * t;
paint_core->curytilt = paint_core->lastytilt + dytilt * t;
paint_core->brush =
(* GIMP_BRUSH_CLASS (GTK_OBJECT (paint_core->brush)
->klass)->select_brush) (paint_core);
if (paint_core->flags & TOOL_CAN_HANDLE_CHANGING_BRUSH)
paint_core->brush =
(* GIMP_BRUSH_CLASS (GTK_OBJECT (paint_core->brush)
->klass)->select_brush) (paint_core);
(* paint_core->paint_func) (paint_core, drawable, MOTION_PAINT);
}
}

View File

@ -31,6 +31,13 @@
#define RESUME_PAINT 3
#define FINISH_PAINT 4
typedef enum
{
TOOL_CAN_HANDLE_CHANGING_BRUSH = 0x0001 /* Set for tools that don't mind
* if the brush changes while
* painting.
*/
} ToolFlags;
typedef void * (* PaintFunc) (PaintCore *, GimpDrawable *, int);
struct _paint_core
@ -69,6 +76,7 @@ struct _paint_core
int pick_colors; /* pick color if ctl or alt is pressed */
int pick_state; /* was ctl or alt pressed when clicked? */
int flags; /* tool flags, see ToolFlags above */
};
extern PaintCore non_gui_paint_core;

View File

@ -350,6 +350,7 @@ tools_new_paintbrush ()
private = (PaintCore *) tool->private;
private->paint_func = paintbrush_paint_func;
private->pick_colors = TRUE;
private->flags |= TOOL_CAN_HANDLE_CHANGING_BRUSH;
return tool;
}

View File

@ -94,6 +94,7 @@ tools_new_pencil (void)
private = (PaintCore *) tool->private;
private->paint_func = pencil_paint_func;
private->pick_colors = TRUE;
private->flags |= TOOL_CAN_HANDLE_CHANGING_BRUSH;
return tool;
}

View File

@ -184,6 +184,7 @@ tools_new_airbrush ()
private = (PaintCore *) tool->private;
private->paint_func = airbrush_paint_func;
private->pick_colors = TRUE;
private->flags |= TOOL_CAN_HANDLE_CHANGING_BRUSH;
return tool;
}

View File

@ -184,6 +184,7 @@ tools_new_airbrush ()
private = (PaintCore *) tool->private;
private->paint_func = airbrush_paint_func;
private->pick_colors = TRUE;
private->flags |= TOOL_CAN_HANDLE_CHANGING_BRUSH;
return tool;
}

View File

@ -94,6 +94,7 @@ tools_new_pencil (void)
private = (PaintCore *) tool->private;
private->paint_func = pencil_paint_func;
private->pick_colors = TRUE;
private->flags |= TOOL_CAN_HANDLE_CHANGING_BRUSH;
return tool;
}

View File

@ -273,9 +273,10 @@ paint_core_button_press (Tool *tool,
}
else
{
paint_core->brush =
(* GIMP_BRUSH_CLASS (GTK_OBJECT (paint_core->brush)
->klass)->select_brush) (paint_core);
if (paint_core->flags & TOOL_CAN_HANDLE_CHANGING_BRUSH)
paint_core->brush =
(* GIMP_BRUSH_CLASS (GTK_OBJECT (paint_core->brush)
->klass)->select_brush) (paint_core);
(* paint_core->paint_func) (paint_core, drawable, MOTION_PAINT);
}
@ -532,7 +533,8 @@ paint_core_new (ToolType type)
private->core = draw_core_new (paint_core_draw);
private->pick_colors = FALSE;
private->flags = 0;
tool->private = (void *) private;
tool->button_press_func = paint_core_button_press;
@ -755,9 +757,10 @@ paint_core_interpolate (PaintCore *paint_core,
paint_core->curpressure = paint_core->lastpressure + dpressure * t;
paint_core->curxtilt = paint_core->lastxtilt + dxtilt * t;
paint_core->curytilt = paint_core->lastytilt + dytilt * t;
paint_core->brush =
(* GIMP_BRUSH_CLASS (GTK_OBJECT (paint_core->brush)
->klass)->select_brush) (paint_core);
if (paint_core->flags & TOOL_CAN_HANDLE_CHANGING_BRUSH)
paint_core->brush =
(* GIMP_BRUSH_CLASS (GTK_OBJECT (paint_core->brush)
->klass)->select_brush) (paint_core);
(* paint_core->paint_func) (paint_core, drawable, MOTION_PAINT);
}
}

View File

@ -31,6 +31,13 @@
#define RESUME_PAINT 3
#define FINISH_PAINT 4
typedef enum
{
TOOL_CAN_HANDLE_CHANGING_BRUSH = 0x0001 /* Set for tools that don't mind
* if the brush changes while
* painting.
*/
} ToolFlags;
typedef void * (* PaintFunc) (PaintCore *, GimpDrawable *, int);
struct _paint_core
@ -69,6 +76,7 @@ struct _paint_core
int pick_colors; /* pick color if ctl or alt is pressed */
int pick_state; /* was ctl or alt pressed when clicked? */
int flags; /* tool flags, see ToolFlags above */
};
extern PaintCore non_gui_paint_core;

View File

@ -350,6 +350,7 @@ tools_new_paintbrush ()
private = (PaintCore *) tool->private;
private->paint_func = paintbrush_paint_func;
private->pick_colors = TRUE;
private->flags |= TOOL_CAN_HANDLE_CHANGING_BRUSH;
return tool;
}

View File

@ -94,6 +94,7 @@ tools_new_pencil (void)
private = (PaintCore *) tool->private;
private->paint_func = pencil_paint_func;
private->pick_colors = TRUE;
private->flags |= TOOL_CAN_HANDLE_CHANGING_BRUSH;
return tool;
}

View File

@ -1501,7 +1501,7 @@ read_tube_block (FILE *f,
g_strdup_printf ("ncells:%d step:%d dim:%d cols:%d rows:%d "
"rank0:%d rank1:%d "
"placement:%s selection:%s",
cell_count, step_size, 2, column_count, row_count,
cell_count, step_size, 1, column_count, row_count,
column_count, row_count,
(placement_mode == tpmRandom ? "random" :
(placement_mode == tpmConstant ? "constant" :