Commit 2afd3ffb authored by Manish Singh's avatar Manish Singh

From the Changelog:

        * Makefile.am: don't do docs generation by default

        * configure.in: -lXt for webbrowser plugin

        * libgimp/gimp.c
        * libgimp/gimpprotocol.c
        * libgimp/gimptile.c
        * libgimp/gimpwire.c
        * app/plug_in.c: applied memory leak patch from Mattias Gronlund

        * app/eraser.c
        * app/eraser.h
        * app/internal_procs.c
        * app/paintbrush.c
        * app/paintbrush.h: incremental modes for eraser and paintbrush,
        as well as a "hard eraser"

        * plug-ins/ifscompose/ifscompose.c: pixmap visual fixups

-Yosh
parent 65c81c94
Sat Feb 28 16:57:49 PST 1998 Manish Singh <yosh@gimp.org>
* Makefile.am: don't do docs generation by default
* configure.in: -lXt for webbrowser plugin
* libgimp/gimp.c
* libgimp/gimpprotocol.c
* libgimp/gimptile.c
* libgimp/gimpwire.c
* app/plug_in.c: applied memory leak patch from Mattias Gronlund
* app/eraser.c
* app/eraser.h
* app/internal_procs.c
* app/paintbrush.c
* app/paintbrush.h: incremental modes for eraser and paintbrush,
as well as a "hard eraser"
* plug-ins/ifscompose/ifscompose.c: pixmap visual fixups
Sat Feb 28 00:09:46 1998 Scott Goehring <scott@poverty.bloomington.in.us>
* app/gimage_cmds.c (duplicate): Duplicate image wasn't copying
......
## Process this file with automake to produce Makefile.in
SUBDIRS = libgimp plug-ins app docs
SUBDIRS = libgimp plug-ins app
EXTRA_DIST = TODO TODO-DIST NOTES gtkrc gimp_logo.ppm gimp_splash.ppm rmshm user_install gimp_tips.txt ps-menurc
......
......@@ -492,12 +492,3 @@ about_dialog_timer (gpointer data)
return return_val;
}
......@@ -1539,7 +1539,7 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
break;
case PDB_TEMPORARY:
prog = g_strdup ("none");
prog = "none";
tmp = current_plug_in->temp_proc_defs;
break;
......@@ -1631,7 +1631,7 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
/* If there is a menu path specified, create a menu entry */
if (proc_install->menu_path)
{
entry.path = g_strdup (proc_install->menu_path);
entry.path = proc_install->menu_path;
entry.accelerator = NULL;
entry.callback = plug_in_callback;
entry.callback_data = proc;
......
......@@ -492,12 +492,3 @@ about_dialog_timer (gpointer data)
return return_val;
}
......@@ -29,11 +29,81 @@
#include "tools.h"
/* forward function declarations */
static void eraser_motion (PaintCore *, GimpDrawable *);
static void eraser_motion (PaintCore *, GimpDrawable *, gboolean, gboolean);
static Argument * eraser_invoker (Argument *);
static Argument * eraser_extended_invoker (Argument *);
static void * eraser_options = NULL;
static gboolean non_gui_hard, non_gui_incremental;
typedef struct _EraserOptions EraserOptions;
struct _EraserOptions
{
gboolean hard;
gboolean incremental;
};
static EraserOptions *eraser_options = NULL;
static void
eraser_toggle_update (GtkWidget *w,
gpointer data)
{
gboolean *toggle_val;
toggle_val = (gboolean *) data;
if (GTK_TOGGLE_BUTTON (w)->active)
*toggle_val = TRUE;
else
*toggle_val = FALSE;
}
static EraserOptions *
create_eraser_options (void)
{
EraserOptions *options;
GtkWidget *vbox;
GtkWidget *label;
GtkWidget *hard_toggle;
GtkWidget *incremental_toggle;
options = (EraserOptions *) g_malloc (sizeof (EraserOptions));
options->hard = FALSE;
options->incremental = FALSE;
/* the main vbox */
vbox = gtk_vbox_new (FALSE, 1);
/* the main label */
label = gtk_label_new ("Eraser Options");
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
gtk_widget_show (label);
/* the hard toggle */
hard_toggle = gtk_check_button_new_with_label ("Hard edge");
gtk_box_pack_start (GTK_BOX (vbox), hard_toggle, FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT (hard_toggle), "toggled",
(GtkSignalFunc) eraser_toggle_update,
&options->hard);
gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (hard_toggle), options->hard);
gtk_widget_show (hard_toggle);
/* the incremental toggle */
incremental_toggle = gtk_check_button_new_with_label ("Incremental");
gtk_box_pack_start (GTK_BOX (vbox), incremental_toggle, FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT (incremental_toggle), "toggled",
(GtkSignalFunc) eraser_toggle_update,
&options->incremental);
gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (incremental_toggle), options->incremental);
gtk_widget_show (incremental_toggle);
/* Register this eraser options widget with the main tools options dialog */
tools_register_options (ERASER, vbox);
return options;
}
void *
eraser_paint_func (paint_core, drawable, state)
PaintCore *paint_core;
......@@ -46,7 +116,7 @@ eraser_paint_func (paint_core, drawable, state)
break;
case MOTION_PAINT :
eraser_motion (paint_core, drawable);
eraser_motion (paint_core, drawable, eraser_options->hard, eraser_options->incremental);
break;
case FINISH_PAINT :
......@@ -67,7 +137,7 @@ tools_new_eraser ()
PaintCore * private;
if (! eraser_options)
eraser_options = tools_register_no_options (ERASER, "Eraser Options");
eraser_options = create_eraser_options ();
tool = paint_core_new (ERASER);
......@@ -87,9 +157,11 @@ tools_free_eraser (tool)
void
eraser_motion (paint_core, drawable)
eraser_motion (paint_core, drawable, hard, incremental)
PaintCore *paint_core;
GimpDrawable *drawable;
gboolean hard;
gboolean incremental;
{
GImage *gimage;
TempBuf * area;
......@@ -114,20 +186,48 @@ eraser_motion (paint_core, drawable)
/* paste the newly painted canvas to the gimage which is being worked on */
paint_core_paste_canvas (paint_core, drawable, OPAQUE_OPACITY,
(int) (get_brush_opacity () * 255),
ERASE_MODE, SOFT, CONSTANT);
ERASE_MODE, hard? HARD : SOFT, incremental ? INCREMENTAL : CONSTANT);
}
static void *
eraser_non_gui_paint_func (PaintCore *paint_core, GimpDrawable *drawable, int state)
{
eraser_motion (paint_core, drawable);
eraser_motion (paint_core, drawable, non_gui_hard, non_gui_incremental);
return NULL;
}
/* The eraser procedure definition */
ProcArg eraser_extended_args[] =
{
{ PDB_IMAGE,
"image",
"the image"
},
{ PDB_DRAWABLE,
"drawable",
"the drawable"
},
{ PDB_INT32,
"num_strokes",
"number of stroke control points (count each coordinate as 2 points)"
},
{ PDB_FLOATARRAY,
"strokes",
"array of stroke coordinates: {s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y}"
},
{ PDB_INT32,
"hardness",
"SOFT(0) or HARD(1)"
},
{ PDB_INT32,
"method",
"CONTINUOUS(0) or INCREMENTAL(1)"
}
};
ProcArg eraser_args[] =
{
{ PDB_IMAGE,
......@@ -171,6 +271,27 @@ ProcRecord eraser_proc =
{ { eraser_invoker } },
};
ProcRecord eraser_extended_proc =
{
"gimp_eraser_extended",
"Erase using the current brush",
"This tool erases using the current brush mask. If the specified drawable contains an alpha channel, then the erased pixels will become transparent. Otherwise, the eraser tool replaces the contents of the drawable with the background color. Like paintbrush, this tool linearly interpolates between the specified stroke coordinates.",
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996",
PDB_INTERNAL,
/* Input arguments */
6,
eraser_extended_args,
/* Output arguments */
0,
NULL,
/* Exec method */
{ { eraser_extended_invoker } },
};
static Argument *
eraser_invoker (args)
......@@ -221,6 +342,94 @@ eraser_invoker (args)
success = paint_core_init (&non_gui_paint_core, drawable,
stroke_array[0], stroke_array[1]);
if (success)
{
non_gui_hard=0; non_gui_incremental = 0;
/* set the paint core's paint func */
non_gui_paint_core.paint_func = eraser_non_gui_paint_func;
non_gui_paint_core.startx = non_gui_paint_core.lastx = stroke_array[0];
non_gui_paint_core.starty = non_gui_paint_core.lasty = stroke_array[1];
if (num_strokes == 1)
eraser_non_gui_paint_func (&non_gui_paint_core, drawable, 0);
for (i = 1; i < num_strokes; i++)
{
non_gui_paint_core.curx = stroke_array[i * 2 + 0];
non_gui_paint_core.cury = stroke_array[i * 2 + 1];
paint_core_interpolate (&non_gui_paint_core, drawable);
non_gui_paint_core.lastx = non_gui_paint_core.curx;
non_gui_paint_core.lasty = non_gui_paint_core.cury;
}
/* finish the painting */
paint_core_finish (&non_gui_paint_core, drawable, -1);
/* cleanup */
paint_core_cleanup ();
}
return procedural_db_return_args (&eraser_proc, success);
}
static Argument *
eraser_extended_invoker (args)
Argument *args;
{
int success = TRUE;
GImage *gimage;
GimpDrawable *drawable;
int num_strokes;
double *stroke_array;
int int_value;
int i;
drawable = NULL;
num_strokes = 0;
/* the gimage */
if (success)
{
int_value = args[0].value.pdb_int;
if (! (gimage = gimage_get_ID (int_value)))
success = FALSE;
}
/* the drawable */
if (success)
{
int_value = args[1].value.pdb_int;
drawable = drawable_get_ID (int_value);
if (drawable == NULL || gimage != drawable_gimage (drawable))
success = FALSE;
}
/* num strokes */
if (success)
{
int_value = args[2].value.pdb_int;
if (int_value > 0)
num_strokes = int_value / 2;
else
success = FALSE;
}
/* point array */
if (success)
stroke_array = (double *) args[3].value.pdb_pointer;
if (success)
/* init the paint core */
success = paint_core_init (&non_gui_paint_core, drawable,
stroke_array[0], stroke_array[1]);
if (success)
{
non_gui_hard = args[4].value.pdb_int;
non_gui_incremental = args[5].value.pdb_int;
}
if (success)
{
/* set the paint core's paint func */
......
......@@ -28,5 +28,6 @@ void tools_free_eraser (Tool *);
/* Procedure definition and marshalling function */
extern ProcRecord eraser_proc;
extern ProcRecord eraser_extended_proc;
#endif /* __ERASER_H__ */
......@@ -492,12 +492,3 @@ about_dialog_timer (gpointer data)
return return_val;
}
......@@ -1539,7 +1539,7 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
break;
case PDB_TEMPORARY:
prog = g_strdup ("none");
prog = "none";
tmp = current_plug_in->temp_proc_defs;
break;
......@@ -1631,7 +1631,7 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
/* If there is a menu path specified, create a menu entry */
if (proc_install->menu_path)
{
entry.path = g_strdup (proc_install->menu_path);
entry.path = proc_install->menu_path;
entry.accelerator = NULL;
entry.callback = plug_in_callback;
entry.callback_data = proc;
......
......@@ -1539,7 +1539,7 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
break;
case PDB_TEMPORARY:
prog = g_strdup ("none");
prog = "none";
tmp = current_plug_in->temp_proc_defs;
break;
......@@ -1631,7 +1631,7 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
/* If there is a menu path specified, create a menu entry */
if (proc_install->menu_path)
{
entry.path = g_strdup (proc_install->menu_path);
entry.path = proc_install->menu_path;
entry.accelerator = NULL;
entry.callback = plug_in_callback;
entry.callback_data = proc;
......
......@@ -92,10 +92,12 @@ internal_procs_init ()
procedural_db_register (&crop_proc); pcount++;
procedural_db_register (&ellipse_select_proc); pcount++;
procedural_db_register (&eraser_proc); pcount++;
procedural_db_register (&eraser_extended_proc); pcount++;
procedural_db_register (&flip_proc); pcount++;
procedural_db_register (&free_select_proc); pcount++;
procedural_db_register (&fuzzy_select_proc); pcount++;
procedural_db_register (&paintbrush_proc); pcount++;
procedural_db_register (&paintbrush_extended_proc); pcount++;
procedural_db_register (&pencil_proc); pcount++;
procedural_db_register (&perspective_proc); pcount++;
procedural_db_register (&rect_select_proc); pcount++;
......
......@@ -1539,7 +1539,7 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
break;
case PDB_TEMPORARY:
prog = g_strdup ("none");
prog = "none";
tmp = current_plug_in->temp_proc_defs;
break;
......@@ -1631,7 +1631,7 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
/* If there is a menu path specified, create a menu entry */
if (proc_install->menu_path)
{
entry.path = g_strdup (proc_install->menu_path);
entry.path = proc_install->menu_path;
entry.accelerator = NULL;
entry.callback = plug_in_callback;
entry.callback_data = proc;
......
......@@ -29,11 +29,81 @@
#include "tools.h"
/* forward function declarations */
static void eraser_motion (PaintCore *, GimpDrawable *);
static void eraser_motion (PaintCore *, GimpDrawable *, gboolean, gboolean);
static Argument * eraser_invoker (Argument *);
static Argument * eraser_extended_invoker (Argument *);
static void * eraser_options = NULL;
static gboolean non_gui_hard, non_gui_incremental;
typedef struct _EraserOptions EraserOptions;
struct _EraserOptions
{
gboolean hard;
gboolean incremental;
};
static EraserOptions *eraser_options = NULL;
static void
eraser_toggle_update (GtkWidget *w,
gpointer data)
{
gboolean *toggle_val;
toggle_val = (gboolean *) data;
if (GTK_TOGGLE_BUTTON (w)->active)
*toggle_val = TRUE;
else
*toggle_val = FALSE;
}
static EraserOptions *
create_eraser_options (void)
{
EraserOptions *options;
GtkWidget *vbox;
GtkWidget *label;
GtkWidget *hard_toggle;
GtkWidget *incremental_toggle;
options = (EraserOptions *) g_malloc (sizeof (EraserOptions));
options->hard = FALSE;
options->incremental = FALSE;
/* the main vbox */
vbox = gtk_vbox_new (FALSE, 1);
/* the main label */
label = gtk_label_new ("Eraser Options");
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
gtk_widget_show (label);
/* the hard toggle */
hard_toggle = gtk_check_button_new_with_label ("Hard edge");
gtk_box_pack_start (GTK_BOX (vbox), hard_toggle, FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT (hard_toggle), "toggled",
(GtkSignalFunc) eraser_toggle_update,
&options->hard);
gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (hard_toggle), options->hard);
gtk_widget_show (hard_toggle);
/* the incremental toggle */
incremental_toggle = gtk_check_button_new_with_label ("Incremental");
gtk_box_pack_start (GTK_BOX (vbox), incremental_toggle, FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT (incremental_toggle), "toggled",
(GtkSignalFunc) eraser_toggle_update,
&options->incremental);
gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (incremental_toggle), options->incremental);
gtk_widget_show (incremental_toggle);
/* Register this eraser options widget with the main tools options dialog */
tools_register_options (ERASER, vbox);
return options;
}
void *
eraser_paint_func (paint_core, drawable, state)
PaintCore *paint_core;
......@@ -46,7 +116,7 @@ eraser_paint_func (paint_core, drawable, state)
break;
case MOTION_PAINT :
eraser_motion (paint_core, drawable);
eraser_motion (paint_core, drawable, eraser_options->hard, eraser_options->incremental);
break;
case FINISH_PAINT :
......@@ -67,7 +137,7 @@ tools_new_eraser ()
PaintCore * private;
if (! eraser_options)
eraser_options = tools_register_no_options (ERASER, "Eraser Options");
eraser_options = create_eraser_options ();
tool = paint_core_new (ERASER);
......@@ -87,9 +157,11 @@ tools_free_eraser (tool)
void
eraser_motion (paint_core, drawable)
eraser_motion (paint_core, drawable, hard, incremental)
PaintCore *paint_core;
GimpDrawable *drawable;
gboolean hard;
gboolean incremental;
{
GImage *gimage;
TempBuf * area;
......@@ -114,20 +186,48 @@ eraser_motion (paint_core, drawable)
/* paste the newly painted canvas to the gimage which is being worked on */
paint_core_paste_canvas (paint_core, drawable, OPAQUE_OPACITY,
(int) (get_brush_opacity () * 255),
ERASE_MODE, SOFT, CONSTANT);
ERASE_MODE, hard? HARD : SOFT, incremental ? INCREMENTAL : CONSTANT);
}
static void *
eraser_non_gui_paint_func (PaintCore *paint_core, GimpDrawable *drawable, int state)
{
eraser_motion (paint_core, drawable);
eraser_motion (paint_core, drawable, non_gui_hard, non_gui_incremental);
return NULL;
}
/* The eraser procedure definition */
ProcArg eraser_extended_args[] =
{
{ PDB_IMAGE,
"image",
"the image"
},
{ PDB_DRAWABLE,
"drawable",
"the drawable"
},
{ PDB_INT32,
"num_strokes",
"number of stroke control points (count each coordinate as 2 points)"
},
{ PDB_FLOATARRAY,
"strokes",
"array of stroke coordinates: {s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y}"
},
{ PDB_INT32,
"hardness",
"SOFT(0) or HARD(1)"
},
{ PDB_INT32,
"method",
"CONTINUOUS(0) or INCREMENTAL(1)"
}
};
ProcArg eraser_args[] =
{
{ PDB_IMAGE,
......@@ -171,6 +271,27 @@ ProcRecord eraser_proc =