app/core/gimpimage-guides.c fixed to accept guide->position ==

2003-03-30  Michael Natterer  <mitch@gimp.org>

	* app/core/gimpimage-guides.c
	* tools/pdbgen/pdb/guides.pdb: fixed to accept guide->position ==
	image->width/height. Guides live *between* pixels, so they must be
	able to exist right of/below the image's rightmost/bottom pixel.

	* app/core/gimpimage-crop.c (gimp_image_crop_adjust_guides):
	fixed guide iteration to not crash when the current guide is
	removed from the image (fixes bug #109533).

	* app/pdb/guides_cmds.c: regenerated.
This commit is contained in:
Michael Natterer
2003-03-30 13:09:57 +00:00
committed by Michael Natterer
parent bbb3172db1
commit c736836f9c
5 changed files with 41 additions and 20 deletions

View File

@ -1,3 +1,16 @@
2003-03-30 Michael Natterer <mitch@gimp.org>
* app/core/gimpimage-guides.c
* tools/pdbgen/pdb/guides.pdb: fixed to accept guide->position ==
image->width/height. Guides live *between* pixels, so they must be
able to exist right of/below the image's rightmost/bottom pixel.
* app/core/gimpimage-crop.c (gimp_image_crop_adjust_guides):
fixed guide iteration to not crash when the current guide is
removed from the image (fixes bug #109533).
* app/pdb/guides_cmds.c: regenerated.
2003-03-29 Manish Singh <yosh@gimp.org>
* plug-ins/script-fu/interp_slib.c

View File

@ -395,15 +395,15 @@ gimp_image_crop_adjust_guides (GimpImage *gimage,
gint y2)
{
GList *glist;
GimpGuide *guide;
gboolean remove_guide;
GList *list;
for (glist = gimage->guides; glist; glist = g_list_next (glist))
list = gimage->guides;
while (list)
{
guide = (GimpGuide *) glist->data;
GimpGuide *guide = list->data;
gboolean remove_guide = FALSE;
remove_guide = FALSE;
list = g_list_next (list);
switch (guide->orientation)
{
@ -424,14 +424,22 @@ gimp_image_crop_adjust_guides (GimpImage *gimage,
if (remove_guide)
{
gimp_image_remove_guide (gimage, guide, TRUE);
guide = NULL;
}
else
{
if (guide->orientation == GIMP_ORIENTATION_HORIZONTAL)
gimp_image_move_guide (gimage, guide, guide->position - y1, TRUE);
else
gimp_image_move_guide (gimage, guide, guide->position - x1, TRUE);
switch (guide->orientation)
{
case GIMP_ORIENTATION_HORIZONTAL:
gimp_image_move_guide (gimage, guide, guide->position - y1, TRUE);
break;
case GIMP_ORIENTATION_VERTICAL:
gimp_image_move_guide (gimage, guide, guide->position - x1, TRUE);
break;
default:
break;
}
}
}
}

View File

@ -43,7 +43,7 @@ gimp_image_add_hguide (GimpImage *gimage,
GimpGuide *guide;
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
g_return_val_if_fail (position >= 0 && position < gimage->height, NULL);
g_return_val_if_fail (position >= 0 && position <= gimage->height, NULL);
guide = g_new0 (GimpGuide, 1);
@ -70,7 +70,7 @@ gimp_image_add_vguide (GimpImage *gimage,
GimpGuide *guide;
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
g_return_val_if_fail (position >= 0 && position < gimage->width, NULL);
g_return_val_if_fail (position >= 0 && position <= gimage->width, NULL);
guide = g_new0 (GimpGuide, 1);
@ -120,9 +120,9 @@ gimp_image_add_guide (GimpImage *gimage,
g_return_if_fail (position >= 0);
if (guide->orientation == GIMP_ORIENTATION_HORIZONTAL)
g_return_if_fail (position < gimage->height);
g_return_if_fail (position <= gimage->height);
else
g_return_if_fail (position < gimage->width);
g_return_if_fail (position <= gimage->width);
gimage->guides = g_list_prepend (gimage->guides, guide);
@ -162,9 +162,9 @@ gimp_image_move_guide (GimpImage *gimage,
g_return_if_fail (position >= 0);
if (guide->orientation == GIMP_ORIENTATION_HORIZONTAL)
g_return_if_fail (position < gimage->height);
g_return_if_fail (position <= gimage->height);
else
g_return_if_fail (position < gimage->width);
g_return_if_fail (position <= gimage->width);
if (push_undo)
gimp_image_undo_push_image_guide (gimage, _("Move Guide"), guide);

View File

@ -73,7 +73,7 @@ image_add_hguide_invoker (Gimp *gimp,
if (success)
{
if (offset < gimage->height)
if (offset <= gimage->height)
{
guide = gimp_image_add_hguide (gimage, offset, TRUE);
guide_ID = guide->guide_ID;
@ -150,7 +150,7 @@ image_add_vguide_invoker (Gimp *gimp,
if (success)
{
if (offset < gimage->width)
if (offset <= gimage->width)
{
guide = gimp_image_add_vguide (gimage, offset, TRUE);
guide_ID = guide->guide_ID;

View File

@ -52,7 +52,7 @@ HELP
vars => [ 'GimpGuide *guide' ],
code => <<CODE
{
if (offset < gimage->$max)
if (offset <= gimage->$max)
{
guide = gimp_image_add_${func}guide (gimage, offset, TRUE);
guide_ID = guide->guide_ID;