app/paths_dialog.c

Wed Feb  2 22:12:48 GMT 2000 Andy Thomas <alt@gimp.org>

	* app/paths_dialog.c

	Fixed bug number #5727 "PDB-call gimp_path_set_points is buggy"

	* tools/pdbgen/pdb/paths.pdb

	Added missing paths pdb functions

 		path_get_locked
 		path_set_locked
		path_set_tattoo
This commit is contained in:
GMT 2000 Andy Thomas 2000-02-02 00:41:11 +00:00 committed by Andy Thomas
parent 56831639dc
commit 209c50fe84
4 changed files with 305 additions and 5 deletions

View File

@ -1,3 +1,17 @@
Wed Feb 2 22:12:48 GMT 2000 Andy Thomas <alt@gimp.org>
* app/paths_dialog.c
Fixed bug number #5727 "PDB-call gimp_path_set_points is buggy"
* tools/pdbgen/pdb/paths.pdb
Added missing paths pdb functions
path_get_locked
path_set_locked
path_set_tattoo
Wed Feb 2 11:02:44 CET 2000 Sven Neumann <sven@gimp.org>
* po/POTFILES.in: accidentally removed the files in the modules dir

View File

@ -1044,7 +1044,7 @@ paths_select_row (GtkWidget *widget,
paths_dialog->gimage);
if (!gdisp)
{
g_warning("Lost image which bezier curve belonged to");
/*g_warning("Lost image which bezier curve belonged to");*/
return;
}
bezier_paste_bezierselect_to_current (gdisp, bsel);
@ -3008,7 +3008,10 @@ paths_set_path_points (GimpImage *gimage,
/* Mark this path as selected */
plist->last_selected_row = 0;
bezier_paste_bezierselect_to_current(gdisp,bezier_sel);
/* Only paste if we have an image to paste to! */
if(gdisp)
bezier_paste_bezierselect_to_current(gdisp,bezier_sel);
}
beziersel_free(bezier_sel);

View File

@ -1044,7 +1044,7 @@ paths_select_row (GtkWidget *widget,
paths_dialog->gimage);
if (!gdisp)
{
g_warning("Lost image which bezier curve belonged to");
/*g_warning("Lost image which bezier curve belonged to");*/
return;
}
bezier_paste_bezierselect_to_current (gdisp, bsel);
@ -3008,7 +3008,10 @@ paths_set_path_points (GimpImage *gimage,
/* Mark this path as selected */
plist->last_selected_row = 0;
bezier_paste_bezierselect_to_current(gdisp,bezier_sel);
/* Only paste if we have an image to paste to! */
if(gdisp)
bezier_paste_bezierselect_to_current(gdisp,bezier_sel);
}
beziersel_free(bezier_sel);

View File

@ -422,6 +422,58 @@ CODE
);
}
sub path_set_tattoo {
$blurb = 'Sets the tattoo associated with the name path.';
$help = <<'HELP';
This procedure sets the tattoo associated with the specified path. A tattoo is a unique and permenant identifier attached to a path that can be used to uniquely identify a path within an image even between sessions. Note that the value passed to this function must have been obtained from a previous call to path_get_tattoo.
HELP
&pdb_misc;
@inargs = (
&std_image_arg,
{ name => 'pathname', type => 'string',
desc => 'the name of the path whose tattoo should be set',
alias => 'pname' },
{ name => 'tattovalue', type => 'int32',
desc => 'The tattoo associated with the name path. Only values returned from \'path_get_tattoo\' should be used here', init => 1 }
);
%invoke = (
vars => [ 'PathsList *plist', 'PATHP pptr = NULL' ],
code => <<'CODE'
{
/* Get the path with the given name */
plist = gimage->paths;
if (plist && plist->bz_paths)
{
GSList *pl = plist->bz_paths;
while (pl)
{
pptr = pl->data;
if (!strcmp (pname, pptr->name->str))
break; /* Found the path */
pl = pl->next;
pptr = NULL;
}
if (pl && pptr)
pptr->tattoo = tattovalue ;
else
success = FALSE;
}
else
success = FALSE;
}
CODE
);
}
sub get_path_by_tattoo {
$blurb = 'Return the name of the path with the given tattoo.';
@ -482,12 +534,240 @@ HELP
%invoke = ( code => 'success = paths_delete_path (gimage, pname);' );
}
sub path_get_locked {
$blurb = 'Returns the locked status associated with the name path.';
$help = <<'HELP';
This procedure returns the lock status associated with the specified path. A path can be "locked" which means that the transformation tool operations will also apply to the path.
HELP
&pdb_misc;
@inargs = (
&std_image_arg,
{ name => 'pathname', type => 'string',
desc => 'the name of the path whose locked status should be obtained',
alias => 'pname' }
);
@outargs = (
{ name => 'lockstatus', type => 'int32',
desc => 'The lock status associated with the name path. 0 returned if the path is not locked. 1 is returned if the path is locked', init => 1 }
);
%invoke = (
vars => [ 'PathsList *plist', 'PATHP pptr = NULL' ],
code => <<'CODE'
{
/* Get the path with the given name */
plist = gimage->paths;
if (plist && plist->bz_paths)
{
GSList *pl = plist->bz_paths;
while (pl)
{
pptr = pl->data;
if (!strcmp (pname, pptr->name->str))
break; /* Found the path */
pl = pl->next;
pptr = NULL;
}
if (pl && pptr)
lockstatus = pptr->locked;
else
success = FALSE;
}
else
success = FALSE;
}
CODE
);
}
sub path_set_locked {
$blurb = 'Set the locked status associated with the name path.';
$help = <<'HELP';
This procedure sets the lock status associated with the specified path. A path can be "locked" which means that the transformation tool operations will also apply to the path.
HELP
&pdb_misc;
@inargs = (
&std_image_arg,
{ name => 'pathname', type => 'string',
desc => 'the name of the path whose locked status should be set',
alias => 'pname' },
{ name => 'lockstatus', type => 'int32',
desc => 'The lock status associated with the name path. 0 if the path is not locked. 1 if the path is to be locked', init => 1 }
);
%invoke = (
vars => [ 'PathsList *plist', 'PATHP pptr = NULL' ],
code => <<'CODE'
{
/* Get the path with the given name */
plist = gimage->paths;
if (plist && plist->bz_paths)
{
GSList *pl = plist->bz_paths;
while (pl)
{
pptr = pl->data;
if (!strcmp (pname, pptr->name->str))
break; /* Found the path */
pl = pl->next;
pptr = NULL;
}
if (pl && pptr && lockstatus >=0 && lockstatus <= 1)
pptr->locked = lockstatus;
else
success = FALSE;
}
else
success = FALSE;
}
CODE
);
}
# This PDB function (path_get_status) should not be generated.
# Currently it can easily introduce instability into the gimp if used
# with wrong values.
# I 'think' that path_set_points sets the status cirrectly for the path
# anyways.
sub path_get_status {
$blurb = 'Returns the edit status associated with the name path.';
$help = <<'HELP';
This procedure returns the edit status associated with the specified path. The value returned here should only be used in a corresponding 'path_set_status' call.
HELP
&pdb_misc;
@inargs = (
&std_image_arg,
{ name => 'pathname', type => 'string',
desc => 'the name of the path whose edit status should be obtained',
alias => 'pname' }
);
@outargs = (
{ name => 'editstatus', type => 'int32',
desc => 'The edit status associated with the name path.', init => 1 }
);
%invoke = (
vars => [ 'PathsList *plist', 'PATHP pptr = NULL' ],
code => <<'CODE'
{
/* Get the path with the given name */
plist = gimage->paths;
if (plist && plist->bz_paths)
{
GSList *pl = plist->bz_paths;
while (pl)
{
pptr = pl->data;
if (!strcmp (pname, pptr->name->str))
break; /* Found the path */
pl = pl->next;
pptr = NULL;
}
if (pl && pptr)
editstatus = pptr->state;
else
success = FALSE;
}
else
success = FALSE;
}
CODE
);
}
# This PDB function (path_set_status) should not be generated.
# Currently it can easily introduce instability into the gimp if used
# with wrong values.
# I 'think' that path_set_points sets the status cirrectly for the path
# anyways.
sub path_set_status {
$blurb = 'Set the edit status associated with the name path.';
$help = <<'HELP';
This procedure sets the edit status associated with the specified path. Caution must be exercised when using this function since an incorrect internal state of a path could result in undefined behaviour in the path tool. This method should only be used after a new path has been added (for example from a saved file) and then only values returned from 'path_get_status' called before the path was saved should be used.
HELP
&pdb_misc;
@inargs = (
&std_image_arg,
{ name => 'pathname', type => 'string',
desc => 'the name of the path whose locked status should be set',
alias => 'pname' },
{ name => 'editstatus', type => 'int32',
desc => 'The edit status associated with the name path. Only values returned from \'path_get_status\' should be used here', init => 1 }
);
%invoke = (
vars => [ 'PathsList *plist', 'PATHP pptr = NULL' ],
code => <<'CODE'
{
/* Get the path with the given name */
plist = gimage->paths;
if (plist && plist->bz_paths)
{
GSList *pl = plist->bz_paths;
while (pl)
{
pptr = pl->data;
if (!strcmp (pname, pptr->name->str))
break; /* Found the path */
pl = pl->next;
pptr = NULL;
}
if (pl && pptr)
pptr->state = editstatus;
else
success = FALSE;
}
else
success = FALSE;
}
CODE
);
}
@headers = qw(<string.h> "gimage.h" "pathsP.h");
@procs = qw(path_list path_get_points path_get_current path_set_current
path_set_points path_stroke_current path_get_point_at_dist
path_get_tattoo get_path_by_tattoo path_delete);
path_get_tattoo get_path_by_tattoo path_delete path_get_locked
path_set_locked path_set_tattoo);
%exports = (app => [@procs]);
$desc = 'Paths';