tools/pdbgen/pdb/fileops.pdb applied the patch from Wolfgang Hofer that

* tools/pdbgen/pdb/fileops.pdb
        * app/fileops_cmds.c: applied the patch from Wolfgang Hofer that
        should fix the problems saving jpeg with GAP.

        * app/paint_core.[ch]: preview length of brush-stroke in statusbar
        when drawing a line using <Shift>. Do we need the angle here too??


--Sven
This commit is contained in:
Sven Neumann 1999-09-01 18:46:25 +00:00
parent a5154a861b
commit 1cf2e5c12b
7 changed files with 173 additions and 73 deletions

View file

@ -1,3 +1,12 @@
Wed Sep 1 20:45:56 MEST 1999 Sven Neumann <sven@gimp.org>
* tools/pdbgen/pdb/fileops.pdb
* app/fileops_cmds.c: applied the patch from Wolfgang Hofer that
should fix the problems saving jpeg with GAP.
* app/paint_core.[ch]: preview length of brush-stroke in statusbar
when drawing a line using <Shift>. Do we need the angle here too??
Wed Sep 1 14:12:17 CEST 1999 Pablo Saratxaga <pablo@mandrakesoft.com>
* po/da.po, configure.in: added danish file from
Henrik Hansen <hh@mailserver.dk>

View file

@ -118,6 +118,7 @@ file_save_invoker (Argument *args)
Argument *return_vals;
PlugInProcDef *file_proc;
ProcRecord *proc;
gint i;
file_proc = file_proc_find (save_procs, (gchar *) args[4].value.pdb_pointer);
if (!file_proc)
@ -129,6 +130,13 @@ file_save_invoker (Argument *args)
memset (new_args, 0, sizeof (Argument) * proc->num_args);
memcpy (new_args, args, sizeof (Argument) * 5);
for (i=5; i<proc->num_args; i++)
{
new_args[i].arg_type = proc->args[i].arg_type;
if (proc->args[i].arg_type == PDB_STRING)
new_args[i].value.pdb_pointer = g_strdup("\0");
}
return_vals = procedural_db_execute (proc->name, new_args);
g_free (new_args);

View file

@ -43,7 +43,9 @@
#define TARGET_HEIGHT 15
#define TARGET_WIDTH 15
#define EPSILON 0.00001
#define EPSILON 0.00001
#define STATUSBAR_SIZE 128
/* global variables--for use in the various paint tools */
PaintCore non_gui_paint_core;
@ -65,7 +67,7 @@ static void canvas_tiles_to_canvas_buf (PaintCore *);
static void brush_to_canvas_buf (PaintCore *, MaskBuf *, int);
static void set_undo_tiles (GimpDrawable *, int, int, int, int);
static void set_canvas_tiles (int, int, int, int);
static int paint_core_invalidate_cache (GimpBrush *brush, gpointer *blah);
static int paint_core_invalidate_cache (GimpBrush *brush, gpointer *blah);
/***********************************************************************/
@ -183,8 +185,14 @@ paint_core_button_press (Tool *tool,
paint_core->curxtilt = bevent->xtilt;
paint_core->curytilt = bevent->ytilt;
paint_core->state = bevent->state;
/* if this is a new image, reinit the core vals */
if (gdisp_ptr != tool->gdisp_ptr)
{
/* initialize the statusbar display */
paint_core->context_id =
gtk_statusbar_get_context_id (GTK_STATUSBAR (gdisp->statusbar), "paint");
}
/* if this is a new image, reinit the core vals */
if ((gdisp_ptr != tool->gdisp_ptr) || ! (bevent->state & GDK_SHIFT_MASK))
{
/* initialize some values */
@ -373,21 +381,24 @@ paint_core_cursor_update (Tool *tool,
PaintCore * paint_core;
GdkCursorType ctype = GDK_TOP_LEFT_ARROW;
int x, y;
gchar status_str[STATUSBAR_SIZE];
gdisp = (GDisplay *) gdisp_ptr;
paint_core = (PaintCore *) tool->private;
/* undraw the current tool */
draw_core_pause (paint_core->core, tool);
if (paint_core->context_id)
gtk_statusbar_pop (GTK_STATUSBAR (gdisp->statusbar), paint_core->context_id);
if ((layer = gimage_get_active_layer (gdisp->gimage)))
{
/* If shift is down and this is not the first paint stroke, draw a line */
if (gdisp_ptr == tool->gdisp_ptr && (mevent->state & GDK_SHIFT_MASK))
{
ctype = GDK_PENCIL;
{
gdouble dx, dy, d;
ctype = GDK_PENCIL;
/* Get the current coordinates */
gdisplay_untransform_coords_f (gdisp,
(double) mevent->x,
@ -395,16 +406,17 @@ paint_core_cursor_update (Tool *tool,
&paint_core->curx,
&paint_core->cury, TRUE);
dx = paint_core->curx - paint_core->lastx;
dy = paint_core->cury - paint_core->lasty;
/* restrict to horizontal/vertical lines, if modifiers are pressed */
if (mevent->state & GDK_MOD1_MASK)
{
if (mevent->state & GDK_CONTROL_MASK)
{
double dx, dy, d;
dx = paint_core->curx - paint_core->lastx;
dy = paint_core->cury - paint_core->lasty;
d = (fabs(dx) + fabs(dy)) / 2;
d = (fabs(dx) + fabs(dy)) / 2;
paint_core->curx = paint_core->lastx + ((dx < 0) ? -d : d);
paint_core->cury = paint_core->lasty + ((dy < 0) ? -d : d);
@ -415,6 +427,29 @@ paint_core_cursor_update (Tool *tool,
else if (mevent->state & GDK_CONTROL_MASK)
paint_core->cury = paint_core->lasty;
/* show distance in statusbar */
dx = paint_core->curx - paint_core->lastx;
dy = paint_core->cury - paint_core->lasty;
if (gdisp->dot_for_dot)
{
d = sqrt (SQR (dx) + SQR (dy));
g_snprintf (status_str, STATUSBAR_SIZE, "%.1f %s", d, _("pixels"));
}
else
{
gchar *format_str = g_strdup_printf ("%%.%df %s",
gimp_unit_get_digits (gdisp->gimage->unit),
gimp_unit_get_symbol (gdisp->gimage->unit));
d = gimp_unit_get_factor (gdisp->gimage->unit) *
sqrt (SQR (dx / gdisp->gimage->xresolution) + SQR (dy / gdisp->gimage->yresolution));
g_snprintf (status_str, STATUSBAR_SIZE, format_str, d);
g_free (format_str);
}
gtk_statusbar_push (GTK_STATUSBAR (gdisp->statusbar), paint_core->context_id,
status_str);
if (paint_core->core->gc == NULL)
draw_core_start (paint_core->core, gdisp->canvas->window, tool);
else
@ -545,7 +580,8 @@ paint_core_new (ToolType type)
private->pick_colors = FALSE;
private->flags = 0;
private->context_id = 0;
tool->private = (void *) private;
tool->button_press_func = paint_core_button_press;

View file

@ -42,41 +42,43 @@ typedef enum
typedef void * (* PaintFunc) (PaintCore *, GimpDrawable *, int);
struct _paint_core
{
DrawCore * core; /* Core select object */
DrawCore * core; /* Core select object */
double startx; /* starting x coord */
double starty; /* starting y coord */
double startpressure; /* starting pressure */
double startx; /* starting x coord */
double starty; /* starting y coord */
double startpressure; /* starting pressure */
double startxtilt; /* starting xtilt */
double startytilt; /* starting ytilt */
double startytilt; /* starting ytilt */
double curx; /* current x coord */
double cury; /* current y coord */
double curpressure; /* current pressure */
double curxtilt; /* current xtilt */
double curytilt; /* current ytilt */
double curx; /* current x coord */
double cury; /* current y coord */
double curpressure; /* current pressure */
double curxtilt; /* current xtilt */
double curytilt; /* current ytilt */
double lastx; /* last x coord */
double lasty; /* last y coord */
double lastpressure; /* last pressure */
double lastxtilt; /* last xtilt */
double lastytilt; /* last ytilt */
double lastx; /* last x coord */
double lasty; /* last y coord */
double lastpressure; /* last pressure */
double lastxtilt; /* last xtilt */
double lastytilt; /* last ytilt */
int state; /* state of buttons and keys */
int state; /* state of buttons and keys */
double distance; /* distance traveled by brush */
double spacing; /* distance traveled by brush */
double distance; /* distance traveled by brush */
double spacing; /* distance traveled by brush */
int x1, y1; /* image space coordinate */
int x2, y2; /* image space coords */
int x1, y1; /* image space coordinate */
int x2, y2; /* image space coords */
GimpBrush * brush; /* current brush */
GimpBrush * brush; /* current brush */
PaintFunc paint_func; /* painting function */
PaintFunc paint_func; /* painting function */
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 */
int pick_colors; /* pick color if ctrl or alt is pressed */
int pick_state; /* was ctrl or alt pressed when clicked? */
int flags; /* tool flags, see ToolFlags above */
guint context_id; /* for the statusbar */
};
extern PaintCore non_gui_paint_core;

View file

@ -43,7 +43,9 @@
#define TARGET_HEIGHT 15
#define TARGET_WIDTH 15
#define EPSILON 0.00001
#define EPSILON 0.00001
#define STATUSBAR_SIZE 128
/* global variables--for use in the various paint tools */
PaintCore non_gui_paint_core;
@ -65,7 +67,7 @@ static void canvas_tiles_to_canvas_buf (PaintCore *);
static void brush_to_canvas_buf (PaintCore *, MaskBuf *, int);
static void set_undo_tiles (GimpDrawable *, int, int, int, int);
static void set_canvas_tiles (int, int, int, int);
static int paint_core_invalidate_cache (GimpBrush *brush, gpointer *blah);
static int paint_core_invalidate_cache (GimpBrush *brush, gpointer *blah);
/***********************************************************************/
@ -183,8 +185,14 @@ paint_core_button_press (Tool *tool,
paint_core->curxtilt = bevent->xtilt;
paint_core->curytilt = bevent->ytilt;
paint_core->state = bevent->state;
/* if this is a new image, reinit the core vals */
if (gdisp_ptr != tool->gdisp_ptr)
{
/* initialize the statusbar display */
paint_core->context_id =
gtk_statusbar_get_context_id (GTK_STATUSBAR (gdisp->statusbar), "paint");
}
/* if this is a new image, reinit the core vals */
if ((gdisp_ptr != tool->gdisp_ptr) || ! (bevent->state & GDK_SHIFT_MASK))
{
/* initialize some values */
@ -373,21 +381,24 @@ paint_core_cursor_update (Tool *tool,
PaintCore * paint_core;
GdkCursorType ctype = GDK_TOP_LEFT_ARROW;
int x, y;
gchar status_str[STATUSBAR_SIZE];
gdisp = (GDisplay *) gdisp_ptr;
paint_core = (PaintCore *) tool->private;
/* undraw the current tool */
draw_core_pause (paint_core->core, tool);
if (paint_core->context_id)
gtk_statusbar_pop (GTK_STATUSBAR (gdisp->statusbar), paint_core->context_id);
if ((layer = gimage_get_active_layer (gdisp->gimage)))
{
/* If shift is down and this is not the first paint stroke, draw a line */
if (gdisp_ptr == tool->gdisp_ptr && (mevent->state & GDK_SHIFT_MASK))
{
ctype = GDK_PENCIL;
{
gdouble dx, dy, d;
ctype = GDK_PENCIL;
/* Get the current coordinates */
gdisplay_untransform_coords_f (gdisp,
(double) mevent->x,
@ -395,16 +406,17 @@ paint_core_cursor_update (Tool *tool,
&paint_core->curx,
&paint_core->cury, TRUE);
dx = paint_core->curx - paint_core->lastx;
dy = paint_core->cury - paint_core->lasty;
/* restrict to horizontal/vertical lines, if modifiers are pressed */
if (mevent->state & GDK_MOD1_MASK)
{
if (mevent->state & GDK_CONTROL_MASK)
{
double dx, dy, d;
dx = paint_core->curx - paint_core->lastx;
dy = paint_core->cury - paint_core->lasty;
d = (fabs(dx) + fabs(dy)) / 2;
d = (fabs(dx) + fabs(dy)) / 2;
paint_core->curx = paint_core->lastx + ((dx < 0) ? -d : d);
paint_core->cury = paint_core->lasty + ((dy < 0) ? -d : d);
@ -415,6 +427,29 @@ paint_core_cursor_update (Tool *tool,
else if (mevent->state & GDK_CONTROL_MASK)
paint_core->cury = paint_core->lasty;
/* show distance in statusbar */
dx = paint_core->curx - paint_core->lastx;
dy = paint_core->cury - paint_core->lasty;
if (gdisp->dot_for_dot)
{
d = sqrt (SQR (dx) + SQR (dy));
g_snprintf (status_str, STATUSBAR_SIZE, "%.1f %s", d, _("pixels"));
}
else
{
gchar *format_str = g_strdup_printf ("%%.%df %s",
gimp_unit_get_digits (gdisp->gimage->unit),
gimp_unit_get_symbol (gdisp->gimage->unit));
d = gimp_unit_get_factor (gdisp->gimage->unit) *
sqrt (SQR (dx / gdisp->gimage->xresolution) + SQR (dy / gdisp->gimage->yresolution));
g_snprintf (status_str, STATUSBAR_SIZE, format_str, d);
g_free (format_str);
}
gtk_statusbar_push (GTK_STATUSBAR (gdisp->statusbar), paint_core->context_id,
status_str);
if (paint_core->core->gc == NULL)
draw_core_start (paint_core->core, gdisp->canvas->window, tool);
else
@ -545,7 +580,8 @@ paint_core_new (ToolType type)
private->pick_colors = FALSE;
private->flags = 0;
private->context_id = 0;
tool->private = (void *) private;
tool->button_press_func = paint_core_button_press;

View file

@ -42,41 +42,43 @@ typedef enum
typedef void * (* PaintFunc) (PaintCore *, GimpDrawable *, int);
struct _paint_core
{
DrawCore * core; /* Core select object */
DrawCore * core; /* Core select object */
double startx; /* starting x coord */
double starty; /* starting y coord */
double startpressure; /* starting pressure */
double startx; /* starting x coord */
double starty; /* starting y coord */
double startpressure; /* starting pressure */
double startxtilt; /* starting xtilt */
double startytilt; /* starting ytilt */
double startytilt; /* starting ytilt */
double curx; /* current x coord */
double cury; /* current y coord */
double curpressure; /* current pressure */
double curxtilt; /* current xtilt */
double curytilt; /* current ytilt */
double curx; /* current x coord */
double cury; /* current y coord */
double curpressure; /* current pressure */
double curxtilt; /* current xtilt */
double curytilt; /* current ytilt */
double lastx; /* last x coord */
double lasty; /* last y coord */
double lastpressure; /* last pressure */
double lastxtilt; /* last xtilt */
double lastytilt; /* last ytilt */
double lastx; /* last x coord */
double lasty; /* last y coord */
double lastpressure; /* last pressure */
double lastxtilt; /* last xtilt */
double lastytilt; /* last ytilt */
int state; /* state of buttons and keys */
int state; /* state of buttons and keys */
double distance; /* distance traveled by brush */
double spacing; /* distance traveled by brush */
double distance; /* distance traveled by brush */
double spacing; /* distance traveled by brush */
int x1, y1; /* image space coordinate */
int x2, y2; /* image space coords */
int x1, y1; /* image space coordinate */
int x2, y2; /* image space coords */
GimpBrush * brush; /* current brush */
GimpBrush * brush; /* current brush */
PaintFunc paint_func; /* painting function */
PaintFunc paint_func; /* painting function */
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 */
int pick_colors; /* pick color if ctrl or alt is pressed */
int pick_state; /* was ctrl or alt pressed when clicked? */
int flags; /* tool flags, see ToolFlags above */
guint context_id; /* for the statusbar */
};
extern PaintCore non_gui_paint_core;

View file

@ -125,7 +125,7 @@ HELP
headers => [ qw(<string.h>) ],
proc => [ 'proc->name', 'new_args' ],
args => [ 'new_args', 'return_vals' ],
vars => [ 'PlugInProcDef *file_proc', 'ProcRecord *proc' ],
vars => [ 'PlugInProcDef *file_proc', 'ProcRecord *proc', 'gint i' ],
code => <<'CODE'
{
file_proc = file_proc_find (save_procs, %%raw_filename%%);
@ -138,6 +138,13 @@ HELP
memset (new_args, 0, sizeof (%%argtype%%) * proc->num_args);
memcpy (new_args, args, sizeof (%%argtype%%) * 5);
for (i=5; i<proc->num_args; i++)
{
new_args[i].arg_type = proc->args[i].arg_type;
if (proc->args[i].arg_type == PDB_STRING)
new_args[i].value.pdb_pointer = g_strdup("\0");
}
return_vals = %%exec%%;
g_free (new_args);