Commit bc5aa054 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

add gimp_pdb_get_vectors_stroke() which is a replacement for

2008-03-06  Michael Natterer  <mitch@gimp.org>

	* app/pdb/gimppdb-utils.[ch]: add gimp_pdb_get_vectors_stroke()
	which is a replacement for gimp_vectors_stroke_get_by_ID() and
	sets an error message if the stroke doesn't exist.

	* tools/pdbgen/pdb/vectors.pdb: use it.

	* app/pdb/vectors_cmds.c: regenerated.


svn path=/trunk/; revision=25051
parent 32d8cb9a
2008-03-06 Michael Natterer <mitch@gimp.org>
* app/pdb/gimppdb-utils.[ch]: add gimp_pdb_get_vectors_stroke()
which is a replacement for gimp_vectors_stroke_get_by_ID() and
sets an error message if the stroke doesn't exist.
* tools/pdbgen/pdb/vectors.pdb: use it.
* app/pdb/vectors_cmds.c: regenerated.
2008-03-06 Sven Neumann <sven@gimp.org>
* app/actions/tools-actions.c
......
......@@ -30,6 +30,8 @@
#include "core/gimpdatafactory.h"
#include "core/gimpitem.h"
#include "vectors/gimpvectors.h"
#include "gimppdb-utils.h"
#include "gimppdberror.h"
......@@ -306,3 +308,26 @@ gimp_pdb_item_is_attached (GimpItem *item,
return TRUE;
}
GimpStroke *
gimp_pdb_get_vectors_stroke (GimpVectors *vectors,
gint stroke_ID,
GError **error)
{
GimpStroke *stroke;
g_return_val_if_fail (GIMP_IS_VECTORS (vectors), NULL);
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
stroke = gimp_vectors_stroke_get_by_ID (vectors, stroke_ID);
if (! stroke)
{
g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_CALLING_ERROR,
_("Vectors object %d does not contain stroke with ID %d"),
gimp_item_get_ID (GIMP_ITEM (vectors)), stroke_ID);
}
return stroke;
}
......@@ -52,5 +52,9 @@ GimpPaintInfo * gimp_pdb_get_paint_info (Gimp *gimp,
gboolean gimp_pdb_item_is_attached (GimpItem *item,
GError **error);
GimpStroke * gimp_pdb_get_vectors_stroke (GimpVectors *vectors,
gint stroke_ID,
GError **error);
#endif /* __GIMP_PDB_UTILS_H__ */
......@@ -38,6 +38,7 @@
#include "vectors/gimpvectors.h"
#include "gimppdb.h"
#include "gimppdb-utils.h"
#include "gimpprocedure.h"
#include "internal_procs.h"
......@@ -398,7 +399,7 @@ vectors_stroke_get_length_invoker (GimpProcedure *procedure,
if (success)
{
GimpStroke *stroke = gimp_vectors_stroke_get_by_ID (vectors, stroke_id);
GimpStroke *stroke = gimp_pdb_get_vectors_stroke (vectors, stroke_id, error);
if (stroke)
length = gimp_stroke_get_length (stroke, precision);
......@@ -440,7 +441,7 @@ vectors_stroke_get_point_at_dist_invoker (GimpProcedure *procedure,
if (success)
{
GimpStroke *stroke = gimp_vectors_stroke_get_by_ID (vectors, stroke_id);
GimpStroke *stroke = gimp_pdb_get_vectors_stroke (vectors, stroke_id, error);
if (stroke)
{
......@@ -485,7 +486,7 @@ vectors_remove_stroke_invoker (GimpProcedure *procedure,
if (success)
{
GimpStroke *stroke = gimp_vectors_stroke_get_by_ID (vectors, stroke_id);
GimpStroke *stroke = gimp_pdb_get_vectors_stroke (vectors, stroke_id, error);
if (stroke)
gimp_vectors_stroke_remove (vectors, stroke);
......@@ -513,7 +514,7 @@ vectors_stroke_close_invoker (GimpProcedure *procedure,
if (success)
{
GimpStroke *stroke = gimp_vectors_stroke_get_by_ID (vectors, stroke_id);
GimpStroke *stroke = gimp_pdb_get_vectors_stroke (vectors, stroke_id, error);
if (stroke)
gimp_stroke_close (stroke);
......@@ -545,7 +546,7 @@ vectors_stroke_translate_invoker (GimpProcedure *procedure,
if (success)
{
GimpStroke *stroke = gimp_vectors_stroke_get_by_ID (vectors, stroke_id);
GimpStroke *stroke = gimp_pdb_get_vectors_stroke (vectors, stroke_id, error);
if (stroke)
gimp_stroke_translate (stroke, off_x, off_y);
......@@ -577,7 +578,7 @@ vectors_stroke_scale_invoker (GimpProcedure *procedure,
if (success)
{
GimpStroke *stroke = gimp_vectors_stroke_get_by_ID (vectors, stroke_id);
GimpStroke *stroke = gimp_pdb_get_vectors_stroke (vectors, stroke_id, error);
if (stroke)
gimp_stroke_scale (stroke, scale_x, scale_y);
......@@ -611,7 +612,7 @@ vectors_stroke_rotate_invoker (GimpProcedure *procedure,
if (success)
{
GimpStroke *stroke = gimp_vectors_stroke_get_by_ID (vectors, stroke_id);
GimpStroke *stroke = gimp_pdb_get_vectors_stroke (vectors, stroke_id, error);
if (stroke)
gimp_stroke_rotate (stroke, center_x, center_y, angle);
......@@ -643,7 +644,7 @@ vectors_stroke_flip_invoker (GimpProcedure *procedure,
if (success)
{
GimpStroke *stroke = gimp_vectors_stroke_get_by_ID (vectors, stroke_id);
GimpStroke *stroke = gimp_pdb_get_vectors_stroke (vectors, stroke_id, error);
if (stroke)
gimp_stroke_flip (stroke, flip_type, axis);
......@@ -679,7 +680,7 @@ vectors_stroke_flip_free_invoker (GimpProcedure *procedure,
if (success)
{
GimpStroke *stroke = gimp_vectors_stroke_get_by_ID (vectors, stroke_id);
GimpStroke *stroke = gimp_pdb_get_vectors_stroke (vectors, stroke_id, error);
if (stroke)
gimp_stroke_flip_free (stroke, x1, y1, x2, y2);
......@@ -712,9 +713,9 @@ vectors_stroke_get_points_invoker (GimpProcedure *procedure,
if (success)
{
GimpStroke *stroke = gimp_vectors_stroke_get_by_ID (vectors, stroke_id);
GimpStroke *stroke = gimp_pdb_get_vectors_stroke (vectors, stroke_id, error);
if (stroke && GIMP_IS_BEZIER_STROKE (stroke))
if (GIMP_IS_BEZIER_STROKE (stroke))
{
GArray *points_array;
gint i;
......@@ -844,7 +845,7 @@ vectors_stroke_interpolate_invoker (GimpProcedure *procedure,
if (success)
{
GimpStroke *stroke = gimp_vectors_stroke_get_by_ID (vectors, stroke_id);
GimpStroke *stroke = gimp_pdb_get_vectors_stroke (vectors, stroke_id, error);
if (stroke)
{
......@@ -946,7 +947,7 @@ vectors_bezier_stroke_lineto_invoker (GimpProcedure *procedure,
if (success)
{
GimpStroke *stroke = gimp_vectors_stroke_get_by_ID (vectors, stroke_id);
GimpStroke *stroke = gimp_pdb_get_vectors_stroke (vectors, stroke_id, error);
if (stroke)
{
......@@ -989,7 +990,7 @@ vectors_bezier_stroke_conicto_invoker (GimpProcedure *procedure,
if (success)
{
GimpStroke *stroke = gimp_vectors_stroke_get_by_ID (vectors, stroke_id);
GimpStroke *stroke = gimp_pdb_get_vectors_stroke (vectors, stroke_id, error);
if (stroke)
{
......@@ -1040,7 +1041,7 @@ vectors_bezier_stroke_cubicto_invoker (GimpProcedure *procedure,
if (success)
{
GimpStroke *stroke = gimp_vectors_stroke_get_by_ID (vectors, stroke_id);
GimpStroke *stroke = gimp_pdb_get_vectors_stroke (vectors, stroke_id, error);
if (stroke)
{
......@@ -1137,9 +1138,7 @@ vectors_to_selection_invoker (GimpProcedure *procedure,
if (success)
{
GimpImage *image;
image = gimp_item_get_image (GIMP_ITEM (vectors));
GimpImage *image = gimp_item_get_image (GIMP_ITEM (vectors));
if (image)
gimp_channel_select_vectors (gimp_image_get_mask (image),
......
......@@ -359,7 +359,7 @@ sub vectors_stroke_get_length {
%invoke = (
code => <<"CODE"
{
GimpStroke *stroke = gimp_vectors_stroke_get_by_ID (vectors, stroke_id);
GimpStroke *stroke = gimp_pdb_get_vectors_stroke (vectors, stroke_id, error);
if (stroke)
length = gimp_stroke_get_length (stroke, precision);
......@@ -408,7 +408,7 @@ HELP
%invoke = (
code => <<"CODE"
{
GimpStroke *stroke = gimp_vectors_stroke_get_by_ID (vectors, stroke_id);
GimpStroke *stroke = gimp_pdb_get_vectors_stroke (vectors, stroke_id, error);
if (stroke)
{
......@@ -445,7 +445,7 @@ HELP
%invoke = (
code => <<"CODE"
{
GimpStroke *stroke = gimp_vectors_stroke_get_by_ID (vectors, stroke_id);
GimpStroke *stroke = gimp_pdb_get_vectors_stroke (vectors, stroke_id, error);
if (stroke)
gimp_vectors_stroke_remove (vectors, stroke);
......@@ -475,7 +475,7 @@ HELP
%invoke = (
code => <<"CODE"
{
GimpStroke *stroke = gimp_vectors_stroke_get_by_ID (vectors, stroke_id);
GimpStroke *stroke = gimp_pdb_get_vectors_stroke (vectors, stroke_id, error);
if (stroke)
gimp_stroke_close (stroke);
......@@ -510,7 +510,7 @@ HELP
%invoke = (
code => <<"CODE"
{
GimpStroke *stroke = gimp_vectors_stroke_get_by_ID (vectors, stroke_id);
GimpStroke *stroke = gimp_pdb_get_vectors_stroke (vectors, stroke_id, error);
if (stroke)
gimp_stroke_translate (stroke, off_x, off_y);
......@@ -544,7 +544,7 @@ HELP
%invoke = (
code => <<"CODE"
{
GimpStroke *stroke = gimp_vectors_stroke_get_by_ID (vectors, stroke_id);
GimpStroke *stroke = gimp_pdb_get_vectors_stroke (vectors, stroke_id, error);
if (stroke)
gimp_stroke_scale (stroke, scale_x, scale_y);
......@@ -579,7 +579,7 @@ HELP
%invoke = (
code => <<"CODE"
{
GimpStroke *stroke = gimp_vectors_stroke_get_by_ID (vectors, stroke_id);
GimpStroke *stroke = gimp_pdb_get_vectors_stroke (vectors, stroke_id, error);
if (stroke)
gimp_stroke_rotate (stroke, center_x, center_y, angle);
......@@ -613,7 +613,7 @@ HELP
%invoke = (
code => <<"CODE"
{
GimpStroke *stroke = gimp_vectors_stroke_get_by_ID (vectors, stroke_id);
GimpStroke *stroke = gimp_pdb_get_vectors_stroke (vectors, stroke_id, error);
if (stroke)
gimp_stroke_flip (stroke, flip_type, axis);
......@@ -652,7 +652,7 @@ HELP
%invoke = (
code => <<"CODE"
{
GimpStroke *stroke = gimp_vectors_stroke_get_by_ID (vectors, stroke_id);
GimpStroke *stroke = gimp_pdb_get_vectors_stroke (vectors, stroke_id, error);
if (stroke)
gimp_stroke_flip_free (stroke, x1, y1, x2, y2);
......@@ -695,9 +695,9 @@ HELP
%invoke = (
code => <<"CODE"
{
GimpStroke *stroke = gimp_vectors_stroke_get_by_ID (vectors, stroke_id);
GimpStroke *stroke = gimp_pdb_get_vectors_stroke (vectors, stroke_id, error);
if (stroke && GIMP_IS_BEZIER_STROKE (stroke))
if (GIMP_IS_BEZIER_STROKE (stroke))
{
GArray *points_array;
gint i;
......@@ -761,7 +761,7 @@ HELP
%invoke = (
code => <<"CODE"
{
GimpStroke *stroke = gimp_vectors_stroke_get_by_ID (vectors, stroke_id);
GimpStroke *stroke = gimp_pdb_get_vectors_stroke (vectors, stroke_id, error);
if (stroke)
{
......@@ -930,7 +930,7 @@ HELP
%invoke = (
code => <<"CODE"
{
GimpStroke *stroke = gimp_vectors_stroke_get_by_ID (vectors, stroke_id);
GimpStroke *stroke = gimp_pdb_get_vectors_stroke (vectors, stroke_id, error);
if (stroke)
{
......@@ -977,7 +977,7 @@ HELP
%invoke = (
code => <<"CODE"
{
GimpStroke *stroke = gimp_vectors_stroke_get_by_ID (vectors, stroke_id);
GimpStroke *stroke = gimp_pdb_get_vectors_stroke (vectors, stroke_id, error);
if (stroke)
{
......@@ -1030,7 +1030,7 @@ HELP
%invoke = (
code => <<"CODE"
{
GimpStroke *stroke = gimp_vectors_stroke_get_by_ID (vectors, stroke_id);
GimpStroke *stroke = gimp_pdb_get_vectors_stroke (vectors, stroke_id, error);
if (stroke)
{
......@@ -1131,9 +1131,7 @@ HELP
%invoke = (
code => <<'CODE'
{
GimpImage *image;
image = gimp_item_get_image (GIMP_ITEM (vectors));
GimpImage *image = gimp_item_get_image (GIMP_ITEM (vectors));
if (image)
gimp_channel_select_vectors (gimp_image_get_mask (image),
......@@ -1353,6 +1351,7 @@ CODE
"vectors/gimpstroke-new.h"
"vectors/gimpbezierstroke.h"
"vectors/gimpvectors.h"
"gimppdb-utils.h"
"gimp-intl.h");
@procs = qw(vectors_is_valid
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment