added gimp_image_get_guide() and gimp_image_get_next_guide(), which take a

2006-03-13  Michael Natterer  <mitch@gimp.org>

	* app/core/gimpimage-guides.[ch]: added gimp_image_get_guide() and
	gimp_image_get_next_guide(), which take a guide_ID and return the
	image's GimpGuide with that ID (the one after that for next_guide())

	* tools/pdbgen/pdb/guides.pdb: use them instead of having this
	code here.

	* app/pdb/guides_cmds.c: regenerated.
This commit is contained in:
Michael Natterer
2006-03-13 19:13:08 +00:00
committed by Michael Natterer
parent 68ea81c382
commit 4d973a0805
5 changed files with 121 additions and 167 deletions

View File

@ -171,6 +171,57 @@ gimp_image_move_guide (GimpImage *gimage,
gimp_image_update_guide (gimage, guide);
}
GimpGuide *
gimp_image_get_guide (GimpImage *gimage,
guint32 id)
{
GList *guides;
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
for (guides = gimage->guides; guides; guides = g_list_next (guides))
{
GimpGuide *guide = guides->data;
if (guide->guide_ID == id && guide->position >= 0)
return guide;
}
return NULL;
}
GimpGuide *
gimp_image_get_next_guide (GimpImage *gimage,
guint32 id,
gboolean *guide_found)
{
GList *guides;
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
g_return_val_if_fail (guide_found != NULL, NULL);
if (id == 0)
*guide_found = TRUE;
else
*guide_found = FALSE;
for (guides = gimage->guides; guides; guides = g_list_next (guides))
{
GimpGuide *guide = guides->data;
if (guide->position < 0)
continue;
if (*guide_found) /* this is the first guide after the found one */
return guide;
if (guide->guide_ID == id) /* found it, next one will be returned */
*guide_found = TRUE;
}
return NULL;
}
GimpGuide *
gimp_image_find_guide (GimpImage *gimage,
gdouble x,