lookup the vectors by name instead of always using the active path (bug

2003-09-04  Sven Neumann  <sven@gimp.org>

	* tools/pdbgen/pdb/paths.pdb (path_get_points): lookup the vectors
	by name instead of always using the active path (bug #121401).
	Made all functions use the convenience function
	gimp_image_get_vectors_by_name() instead of the GimpContainer API.

	* app/pdb/paths_cmds.c: regenerated.

	* app/core/gimpimage.c: simplified the gimp_image_get_foo_by_name
	functions by making use of gimp_container_get_child_by_name().
This commit is contained in:
Sven Neumann 2003-09-04 10:42:21 +00:00 committed by Sven Neumann
parent 12344cc314
commit 2f6b6b5886
4 changed files with 38 additions and 68 deletions

View File

@ -1,3 +1,15 @@
2003-09-04 Sven Neumann <sven@gimp.org>
* tools/pdbgen/pdb/paths.pdb (path_get_points): lookup the vectors
by name instead of always using the active path (bug #121401).
Made all functions use the convenience function
gimp_image_get_vectors_by_name() instead of the GimpContainer API.
* app/pdb/paths_cmds.c: regenerated.
* app/core/gimpimage.c: simplified the gimp_image_get_foo_by_name
functions by making use of gimp_container_get_child_by_name().
2003-09-04 Simon Budig <simon@gimp.org>
* app/tools/gimpvectortool.c: Cleanup. Properly freeze/thaw
@ -64,6 +76,12 @@
* app/tools/gimptransformtool.c
* app/xcf/xcf-save.c: changed accordingly.
2003-09-03 Sven Neumann <sven@gimp.org>
* HACKING
* autogen.sh: require libtool version 1.5.0 or newer when building
on Win32. Completely untested but it should fix bug #120953.
2003-09-03 Sven Neumann <sven@gimp.org>
* devel-docs/gbr.txt

View File

@ -2439,66 +2439,30 @@ GimpLayer *
gimp_image_get_layer_by_name (const GimpImage *gimage,
const gchar *name)
{
GimpLayer *layer;
GList *list;
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
for (list = GIMP_LIST (gimage->layers)->list;
list;
list = g_list_next (list))
{
layer = (GimpLayer *) list->data;
if (! strcmp (gimp_object_get_name (GIMP_OBJECT (layer)), name))
return layer;
}
return NULL;
return (GimpLayer *) gimp_container_get_child_by_name (gimage->layers,
name);
}
GimpChannel *
gimp_image_get_channel_by_name (const GimpImage *gimage,
const gchar *name)
{
GimpChannel *channel;
GList *list;
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
for (list = GIMP_LIST (gimage->channels)->list;
list;
list = g_list_next (list))
{
channel = (GimpChannel *) list->data;
if (! strcmp (gimp_object_get_name (GIMP_OBJECT (channel)), name))
return channel;
}
return NULL;
return (GimpChannel *) gimp_container_get_child_by_name (gimage->channels,
name);
}
GimpVectors *
gimp_image_get_vectors_by_name (const GimpImage *gimage,
const gchar *name)
{
GimpVectors *vectors;
GList *list;
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
for (list = GIMP_LIST (gimage->vectors)->list;
list;
list = g_list_next (list))
{
vectors = (GimpVectors *) list->data;
if (! strcmp (gimp_object_get_name (GIMP_OBJECT (vectors)), name))
return vectors;
}
return NULL;
return (GimpVectors *) gimp_container_get_child_by_name (gimage->vectors,
name);
}
gboolean

View File

@ -305,8 +305,7 @@ path_delete_invoker (Gimp *gimp,
if (success)
{
vectors = (GimpVectors *)
gimp_container_get_child_by_name (gimage->vectors, name);
vectors = gimp_image_get_vectors_by_name (gimage, name);
if (vectors)
gimp_image_remove_vectors (gimage, vectors);
@ -371,7 +370,7 @@ path_get_points_invoker (Gimp *gimp,
if (success)
{
vectors = gimp_image_get_active_vectors (gimage);
vectors = gimp_image_get_vectors_by_name (gimage, name);
if (vectors)
{
@ -763,8 +762,7 @@ path_get_tattoo_invoker (Gimp *gimp,
if (success)
{
vectors = (GimpVectors *)
gimp_container_get_child_by_name (gimage->vectors, name);
vectors = gimp_image_get_vectors_by_name (gimage, name);
if (vectors)
tattoo = gimp_item_get_tattoo (GIMP_ITEM (vectors));
@ -841,8 +839,7 @@ path_set_tattoo_invoker (Gimp *gimp,
if (success)
{
vectors = (GimpVectors *)
gimp_container_get_child_by_name (gimage->vectors, name);
vectors = gimp_image_get_vectors_by_name (gimage, name);
if (vectors)
gimp_item_set_tattoo (GIMP_ITEM (vectors), tattovalue);
@ -983,8 +980,7 @@ path_get_locked_invoker (Gimp *gimp,
if (success)
{
vectors = (GimpVectors *)
gimp_container_get_child_by_name (gimage->vectors, name);
vectors = gimp_image_get_vectors_by_name (gimage, name);
if (vectors)
lockstatus = gimp_item_get_linked (GIMP_ITEM (vectors));
@ -1061,8 +1057,7 @@ path_set_locked_invoker (Gimp *gimp,
if (success)
{
vectors = (GimpVectors *)
gimp_container_get_child_by_name (gimage->vectors, name);
vectors = gimp_image_get_vectors_by_name (gimage, name);
if (vectors)
gimp_item_set_linked (GIMP_ITEM (vectors), lockstatus, TRUE);
@ -1144,8 +1139,7 @@ path_to_selection_invoker (Gimp *gimp,
if (success)
{
vectors = (GimpVectors *)
gimp_container_get_child_by_name (gimage->vectors, name);
vectors = gimp_image_get_vectors_by_name (gimage, name);
if (vectors)
gimp_image_mask_select_vectors (gimage,

View File

@ -109,7 +109,7 @@ HELP
vars => [ 'GimpVectors *vectors' ],
code => <<'CODE'
{
vectors = gimp_image_get_active_vectors (gimage);
vectors = gimp_image_get_vectors_by_name (gimage, name);
if (vectors)
{
@ -409,8 +409,7 @@ HELP
vars => [ 'GimpVectors *vectors' ],
code => <<'CODE'
{
vectors = (GimpVectors *)
gimp_container_get_child_by_name (gimage->vectors, name);
vectors = gimp_image_get_vectors_by_name (gimage, name);
if (vectors)
tattoo = gimp_item_get_tattoo (GIMP_ITEM (vectors));
@ -442,8 +441,7 @@ HELP
vars => [ 'GimpVectors *vectors' ],
code => <<'CODE'
{
vectors = (GimpVectors *)
gimp_container_get_child_by_name (gimage->vectors, name);
vectors = gimp_image_get_vectors_by_name (gimage, name);
if (vectors)
gimp_item_set_tattoo (GIMP_ITEM (vectors), tattovalue);
@ -510,8 +508,7 @@ HELP
vars => [ 'GimpVectors *vectors' ],
code => <<'CODE'
{
vectors = (GimpVectors *)
gimp_container_get_child_by_name (gimage->vectors, name);
vectors = gimp_image_get_vectors_by_name (gimage, name);
if (vectors)
gimp_image_remove_vectors (gimage, vectors);
@ -547,8 +544,7 @@ HELP
vars => [ 'GimpVectors *vectors' ],
code => <<'CODE'
{
vectors = (GimpVectors *)
gimp_container_get_child_by_name (gimage->vectors, name);
vectors = gimp_image_get_vectors_by_name (gimage, name);
if (vectors)
lockstatus = gimp_item_get_linked (GIMP_ITEM (vectors));
@ -582,8 +578,7 @@ HELP
vars => [ 'GimpVectors *vectors' ],
code => <<'CODE'
{
vectors = (GimpVectors *)
gimp_container_get_child_by_name (gimage->vectors, name);
vectors = gimp_image_get_vectors_by_name (gimage, name);
if (vectors)
gimp_item_set_linked (GIMP_ITEM (vectors), lockstatus, TRUE);
@ -625,8 +620,7 @@ HELP
vars => [ 'GimpVectors *vectors' ],
code => <<'CODE'
{
vectors = (GimpVectors *)
gimp_container_get_child_by_name (gimage->vectors, name);
vectors = gimp_image_get_vectors_by_name (gimage, name);
if (vectors)
gimp_image_mask_select_vectors (gimage,