Commit 949fa77a authored by Simon Budig's avatar Simon Budig Committed by Simon Budig

gimp_vectors_[gs]et_locked renamed to _linked for consistency.

2005-12-29  Simon Budig  <simon@gimp.org>

	* tools/pdbgen/pdb/vectors.pdb:
	   gimp_vectors_[gs]et_locked  renamed to _linked for consistency.

	   gimp_vectors_[gs]et_tattoo, gimp_vectors_get_image: new.

	* app/pdb/internal_procs.c
	* app/pdb/vectors_cmds.c
	* libgimp/gimpvectors_pdb.[ch]: regenerated
parent 7c440def
2005-12-29 Simon Budig <simon@gimp.org>
* tools/pdbgen/pdb/vectors.pdb:
gimp_vectors_[gs]et_locked renamed to _linked for consistency.
gimp_vectors_[gs]et_tattoo, gimp_vectors_get_image: new.
* app/pdb/internal_procs.c
* app/pdb/vectors_cmds.c
* libgimp/gimpvectors_pdb.[ch]: regenerated
2005-12-29 Sven Neumann <sven@gimp.org>
* app/widgets/gimpcolormapeditor.c: code cleanup, use alloca in
......
......@@ -75,7 +75,7 @@ void register_undo_procs (Gimp *gimp);
void register_unit_procs (Gimp *gimp);
void register_vectors_procs (Gimp *gimp);
/* 509 procedures registered total */
/* 512 procedures registered total */
void
internal_procs_init (Gimp *gimp)
......
......@@ -38,12 +38,15 @@
#include "vectors/gimpvectors.h"
static ProcRecord vectors_get_strokes_proc;
static ProcRecord vectors_get_locked_proc;
static ProcRecord vectors_set_locked_proc;
static ProcRecord vectors_get_image_proc;
static ProcRecord vectors_get_linked_proc;
static ProcRecord vectors_set_linked_proc;
static ProcRecord vectors_get_visible_proc;
static ProcRecord vectors_set_visible_proc;
static ProcRecord vectors_get_name_proc;
static ProcRecord vectors_set_name_proc;
static ProcRecord vectors_get_tattoo_proc;
static ProcRecord vectors_set_tattoo_proc;
static ProcRecord vectors_stroke_get_length_proc;
static ProcRecord vectors_stroke_remove_proc;
static ProcRecord vectors_stroke_translate_proc;
......@@ -54,12 +57,15 @@ void
register_vectors_procs (Gimp *gimp)
{
procedural_db_register (gimp, &vectors_get_strokes_proc);
procedural_db_register (gimp, &vectors_get_locked_proc);
procedural_db_register (gimp, &vectors_set_locked_proc);
procedural_db_register (gimp, &vectors_get_image_proc);
procedural_db_register (gimp, &vectors_get_linked_proc);
procedural_db_register (gimp, &vectors_set_linked_proc);
procedural_db_register (gimp, &vectors_get_visible_proc);
procedural_db_register (gimp, &vectors_set_visible_proc);
procedural_db_register (gimp, &vectors_get_name_proc);
procedural_db_register (gimp, &vectors_set_name_proc);
procedural_db_register (gimp, &vectors_get_tattoo_proc);
procedural_db_register (gimp, &vectors_set_tattoo_proc);
procedural_db_register (gimp, &vectors_stroke_get_length_proc);
procedural_db_register (gimp, &vectors_stroke_remove_proc);
procedural_db_register (gimp, &vectors_stroke_translate_proc);
......@@ -156,7 +162,71 @@ static ProcRecord vectors_get_strokes_proc =
};
static Argument *
vectors_get_locked_invoker (Gimp *gimp,
vectors_get_image_invoker (Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
Argument *args)
{
gboolean success = TRUE;
Argument *return_args;
GimpVectors *vectors;
GimpImage *image = NULL;
vectors = (GimpVectors *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int);
if (! (GIMP_IS_VECTORS (vectors) && ! gimp_item_is_removed (GIMP_ITEM (vectors))))
success = FALSE;
if (success)
{
image = gimp_item_get_image (GIMP_ITEM (vectors));
}
return_args = procedural_db_return_args (&vectors_get_image_proc, success);
if (success)
return_args[1].value.pdb_int = gimp_image_get_ID (image);
return return_args;
}
static ProcArg vectors_get_image_inargs[] =
{
{
GIMP_PDB_PATH,
"vectors",
"The vectors object"
}
};
static ProcArg vectors_get_image_outargs[] =
{
{
GIMP_PDB_IMAGE,
"image",
"The vectors image"
}
};
static ProcRecord vectors_get_image_proc =
{
"gimp-vectors-get-image",
"gimp-vectors-get-image",
"Returns the vectors objects image.",
"Returns the vectors objects image.",
"Simon Budig",
"Simon Budig",
"2005",
NULL,
GIMP_INTERNAL,
1,
vectors_get_image_inargs,
1,
vectors_get_image_outargs,
{ { vectors_get_image_invoker } }
};
static Argument *
vectors_get_linked_invoker (Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
Argument *args)
......@@ -164,7 +234,7 @@ vectors_get_locked_invoker (Gimp *gimp,
gboolean success = TRUE;
Argument *return_args;
GimpVectors *vectors;
gboolean locked = FALSE;
gboolean linked = FALSE;
vectors = (GimpVectors *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int);
if (! (GIMP_IS_VECTORS (vectors) && ! gimp_item_is_removed (GIMP_ITEM (vectors))))
......@@ -172,18 +242,18 @@ vectors_get_locked_invoker (Gimp *gimp,
if (success)
{
locked = gimp_item_get_linked (GIMP_ITEM (vectors));
linked = gimp_item_get_linked (GIMP_ITEM (vectors));
}
return_args = procedural_db_return_args (&vectors_get_locked_proc, success);
return_args = procedural_db_return_args (&vectors_get_linked_proc, success);
if (success)
return_args[1].value.pdb_int = locked;
return_args[1].value.pdb_int = linked;
return return_args;
}
static ProcArg vectors_get_locked_inargs[] =
static ProcArg vectors_get_linked_inargs[] =
{
{
GIMP_PDB_PATH,
......@@ -192,58 +262,58 @@ static ProcArg vectors_get_locked_inargs[] =
}
};
static ProcArg vectors_get_locked_outargs[] =
static ProcArg vectors_get_linked_outargs[] =
{
{
GIMP_PDB_INT32,
"locked",
"TRUE if the path is locked, FALSE otherwise"
"linked",
"TRUE if the path is linked, FALSE otherwise"
}
};
static ProcRecord vectors_get_locked_proc =
static ProcRecord vectors_get_linked_proc =
{
"gimp-vectors-get-locked",
"gimp-vectors-get-locked",
"Gets the locking state of the vectors object.",
"Gets the locking state of the vectors object.",
"gimp-vectors-get-linked",
"gimp-vectors-get-linked",
"Gets the linked state of the vectors object.",
"Gets the linked state of the vectors object.",
"Simon Budig",
"Simon Budig",
"2005",
NULL,
GIMP_INTERNAL,
1,
vectors_get_locked_inargs,
vectors_get_linked_inargs,
1,
vectors_get_locked_outargs,
{ { vectors_get_locked_invoker } }
vectors_get_linked_outargs,
{ { vectors_get_linked_invoker } }
};
static Argument *
vectors_set_locked_invoker (Gimp *gimp,
vectors_set_linked_invoker (Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
Argument *args)
{
gboolean success = TRUE;
GimpVectors *vectors;
gboolean locked = FALSE;
gboolean linked = FALSE;
vectors = (GimpVectors *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int);
if (! (GIMP_IS_VECTORS (vectors) && ! gimp_item_is_removed (GIMP_ITEM (vectors))))
success = FALSE;
locked = args[1].value.pdb_int ? TRUE : FALSE;
linked = args[1].value.pdb_int ? TRUE : FALSE;
if (success)
{
gimp_item_set_linked (GIMP_ITEM (vectors), locked, TRUE);
gimp_item_set_linked (GIMP_ITEM (vectors), linked, TRUE);
}
return procedural_db_return_args (&vectors_set_locked_proc, success);
return procedural_db_return_args (&vectors_set_linked_proc, success);
}
static ProcArg vectors_set_locked_inargs[] =
static ProcArg vectors_set_linked_inargs[] =
{
{
GIMP_PDB_PATH,
......@@ -252,27 +322,27 @@ static ProcArg vectors_set_locked_inargs[] =
},
{
GIMP_PDB_INT32,
"locked",
"Whether the path is locked"
"linked",
"Whether the path is linked"
}
};
static ProcRecord vectors_set_locked_proc =
static ProcRecord vectors_set_linked_proc =
{
"gimp-vectors-set-locked",
"gimp-vectors-set-locked",
"Sets the locking state of the vectors object.",
"Sets the locking state of the vectors object.",
"gimp-vectors-set-linked",
"gimp-vectors-set-linked",
"Sets the linked state of the vectors object.",
"Sets the linked state of the vectors object.",
"Simon Budig",
"Simon Budig",
"2005",
NULL,
GIMP_INTERNAL,
2,
vectors_set_locked_inargs,
vectors_set_linked_inargs,
0,
NULL,
{ { vectors_set_locked_invoker } }
{ { vectors_set_linked_invoker } }
};
static Argument *
......@@ -518,6 +588,126 @@ static ProcRecord vectors_set_name_proc =
{ { vectors_set_name_invoker } }
};
static Argument *
vectors_get_tattoo_invoker (Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
Argument *args)
{
gboolean success = TRUE;
Argument *return_args;
GimpVectors *vectors;
gint32 tattoo = 0;
vectors = (GimpVectors *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int);
if (! (GIMP_IS_VECTORS (vectors) && ! gimp_item_is_removed (GIMP_ITEM (vectors))))
success = FALSE;
if (success)
{
tattoo = gimp_item_get_tattoo (GIMP_ITEM (vectors));
}
return_args = procedural_db_return_args (&vectors_get_tattoo_proc, success);
if (success)
return_args[1].value.pdb_int = tattoo;
return return_args;
}
static ProcArg vectors_get_tattoo_inargs[] =
{
{
GIMP_PDB_PATH,
"vectors",
"The vectors object"
}
};
static ProcArg vectors_get_tattoo_outargs[] =
{
{
GIMP_PDB_INT32,
"tattoo",
"The vectors tattoo"
}
};
static ProcRecord vectors_get_tattoo_proc =
{
"gimp-vectors-get-tattoo",
"gimp-vectors-get-tattoo",
"Get the tattoo of the vectors object.",
"Get the tattoo state of the vectors object.",
"Simon Budig",
"Simon Budig",
"2005",
NULL,
GIMP_INTERNAL,
1,
vectors_get_tattoo_inargs,
1,
vectors_get_tattoo_outargs,
{ { vectors_get_tattoo_invoker } }
};
static Argument *
vectors_set_tattoo_invoker (Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
Argument *args)
{
gboolean success = TRUE;
GimpVectors *vectors;
gint32 tattoo = 0;
vectors = (GimpVectors *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int);
if (! (GIMP_IS_VECTORS (vectors) && ! gimp_item_is_removed (GIMP_ITEM (vectors))))
success = FALSE;
tattoo = args[1].value.pdb_int;
if (success)
{
gimp_item_set_tattoo (GIMP_ITEM (vectors), tattoo);
}
return procedural_db_return_args (&vectors_set_tattoo_proc, success);
}
static ProcArg vectors_set_tattoo_inargs[] =
{
{
GIMP_PDB_PATH,
"vectors",
"The vectors object"
},
{
GIMP_PDB_INT32,
"tattoo",
"the new tattoo"
}
};
static ProcRecord vectors_set_tattoo_proc =
{
"gimp-vectors-set-tattoo",
"gimp-vectors-set-tattoo",
"Set the tattoo of the vectors object.",
"Set the tattoo of the vectors object.",
"Simon Budig",
"Simon Budig",
"2005",
NULL,
GIMP_INTERNAL,
2,
vectors_set_tattoo_inargs,
0,
NULL,
{ { vectors_set_tattoo_invoker } }
};
static Argument *
vectors_stroke_get_length_invoker (Gimp *gimp,
GimpContext *context,
......
......@@ -70,62 +70,94 @@ gimp_vectors_get_strokes (gint32 vectors_ID,
}
/**
* gimp_vectors_get_locked:
* gimp_vectors_get_image:
* @vectors_ID: The vectors object.
*
* Gets the locking state of the vectors object.
* Returns the vectors objects image.
*
* Gets the locking state of the vectors object.
* Returns the vectors objects image.
*
* Returns: TRUE if the path is locked, FALSE otherwise.
* Returns: The vectors image.
*
* Since: GIMP 2.4
*/
gint32
gimp_vectors_get_image (gint32 vectors_ID)
{
GimpParam *return_vals;
gint nreturn_vals;
gint32 image_ID = -1;
return_vals = gimp_run_procedure ("gimp-vectors-get-image",
&nreturn_vals,
GIMP_PDB_PATH, vectors_ID,
GIMP_PDB_END);
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
image_ID = return_vals[1].data.d_image;
gimp_destroy_params (return_vals, nreturn_vals);
return image_ID;
}
/**
* gimp_vectors_get_linked:
* @vectors_ID: The vectors object.
*
* Gets the linked state of the vectors object.
*
* Gets the linked state of the vectors object.
*
* Returns: TRUE if the path is linked, FALSE otherwise.
*
* Since: GIMP 2.4
*/
gboolean
gimp_vectors_get_locked (gint32 vectors_ID)
gimp_vectors_get_linked (gint32 vectors_ID)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean locked = FALSE;
gboolean linked = FALSE;
return_vals = gimp_run_procedure ("gimp-vectors-get-locked",
return_vals = gimp_run_procedure ("gimp-vectors-get-linked",
&nreturn_vals,
GIMP_PDB_PATH, vectors_ID,
GIMP_PDB_END);
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
locked = return_vals[1].data.d_int32;
linked = return_vals[1].data.d_int32;
gimp_destroy_params (return_vals, nreturn_vals);
return locked;
return linked;
}
/**
* gimp_vectors_set_locked:
* gimp_vectors_set_linked:
* @vectors_ID: The vectors object.
* @locked: Whether the path is locked.
* @linked: Whether the path is linked.
*
* Sets the locking state of the vectors object.
* Sets the linked state of the vectors object.
*
* Sets the locking state of the vectors object.
* Sets the linked state of the vectors object.
*
* Returns: TRUE on success.
*
* Since: GIMP 2.4
*/
gboolean
gimp_vectors_set_locked (gint32 vectors_ID,
gboolean locked)
gimp_vectors_set_linked (gint32 vectors_ID,
gboolean linked)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean success = TRUE;
return_vals = gimp_run_procedure ("gimp-vectors-set-locked",
return_vals = gimp_run_procedure ("gimp-vectors-set-linked",
&nreturn_vals,
GIMP_PDB_PATH, vectors_ID,
GIMP_PDB_INT32, locked,
GIMP_PDB_INT32, linked,
GIMP_PDB_END);
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
......@@ -267,6 +299,72 @@ gimp_vectors_set_name (gint32 vectors_ID,
return success;
}
/**
* gimp_vectors_get_tattoo:
* @vectors_ID: The vectors object.
*
* Get the tattoo of the vectors object.
*
* Get the tattoo state of the vectors object.
*
* Returns: The vectors tattoo.
*
* Since: GIMP 2.4
*/
gint
gimp_vectors_get_tattoo (gint32 vectors_ID)
{
GimpParam *return_vals;
gint nreturn_vals;
gint tattoo = 0;
return_vals = gimp_run_procedure ("gimp-vectors-get-tattoo",
&nreturn_vals,
GIMP_PDB_PATH, vectors_ID,
GIMP_PDB_END);
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
tattoo = return_vals[1].data.d_int32;
gimp_destroy_params (return_vals, nreturn_vals);
return tattoo;
}
/**
* gimp_vectors_set_tattoo:
* @vectors_ID: The vectors object.
* @tattoo: the new tattoo.
*
* Set the tattoo of the vectors object.
*
* Set the tattoo of the vectors object.
*
* Returns: TRUE on success.
*
* Since: GIMP 2.4
*/
gboolean
gimp_vectors_set_tattoo (gint32 vectors_ID,
gint tattoo)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean success = TRUE;
return_vals = gimp_run_procedure ("gimp-vectors-set-tattoo",
&nreturn_vals,
GIMP_PDB_PATH, vectors_ID,
GIMP_PDB_INT32, tattoo,
GIMP_PDB_END);
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
gimp_destroy_params (return_vals, nreturn_vals);
return success;
}
/**
* gimp_vectors_stroke_get_length:
* @vectors_ID: The vectors object.
......
......@@ -31,15 +31,19 @@ G_BEGIN_DECLS
gint* gimp_vectors_get_strokes (gint32 vectors_ID,
gint *num_strokes);
gboolean gimp_vectors_get_locked (gint32 vectors_ID);
gboolean gimp_vectors_set_locked (gint32 vectors_ID,
gboolean locked);
gint32 gimp_vectors_get_image (gint32 vectors_ID);
gboolean gimp_vectors_get_linked (gint32 vectors_ID);
gboolean gimp_vectors_set_linked (gint32 vectors_ID,
gboolean linked);
gboolean gimp_vectors_get_visible (gint32 vectors_ID);
gboolean gimp_vectors_set_visible (gint32 vectors_ID,
gboolean visible);
gchar* gimp_vectors_get_name (gint32 vectors_ID);
gboolean gimp_vectors_set_name (gint32 vectors_ID,
const gchar *name);
gint gimp_vectors_get_tattoo (gint32 vectors_ID);
gboolean gimp_vectors_set_tattoo (gint32 vectors_ID,
gint tattoo);
gdouble gimp_vectors_stroke_get_length (gint32 vectors_ID,
gint stroke_id,
gdouble prescision);
......
......@@ -66,11 +66,11 @@ CODE
}
sub vectors_get_locked {
$blurb = 'Gets the locking state of the vectors object.';
sub vectors_get_image {
$blurb = 'Returns the vectors objects image.';
$help = <<'HELP';
Gets the locking state of the vectors object.
Returns the vectors objects image.
HELP
&pdb_misc;
......@@ -78,38 +78,117 @@ HELP
@inargs = ( &vectors_arg );
@outargs = (
{ name => 'locked', type => 'boolean',
desc => 'TRUE if the path is locked, FALSE otherwise', init => 1 }
{ name => 'image', type => 'image',
desc => 'The vectors image',
init => 1 }
);
%invoke = (
code => <<"CODE"
{
locked = gimp_item_get_linked (GIMP_ITEM (vectors));
image = gimp_item_get_image (GIMP_ITEM (vectors));
}
CODE
);
}
sub vectors_set_locked {
$blurb = 'Sets the locking state of the vectors object.';
sub vectors_get_linked {
$blurb = 'Gets the linked state of the vectors object.';
$help = <<'HELP';
Sets the locking state of the vectors object.
Gets the linked state of the vectors object.
HELP
&pdb_misc;
@inargs = ( &vectors_arg );