Fixed a couple of bugs with translating the selection mask (move tool,

Fri Dec 17 20:29:12 GMT 1999  Adam D. Moss <adam@gimp.org>

	* app/edit_selection.c: Fixed a couple of bugs with translating
	the selection mask (move tool, alt-drag):

	- Selection mask was being clipped whilst moved around, not just
	  at its final resting place.
        - Selection mask translation was being performed 'live' like the
          opaque moves even though there's simply nothing exciting to see.
	  Now the process is much faster.

	Will remove the edit_selection.c dead-code later if this change
	does not cause new trouble.
This commit is contained in:
GMT 1999 Adam D. Moss
1999-12-17 20:59:37 +00:00
committed by Adam D. Moss
parent 19963ce12a
commit c4d032140a
4 changed files with 101 additions and 15 deletions

View File

@ -1,3 +1,17 @@
Fri Dec 17 20:29:12 GMT 1999 Adam D. Moss <adam@gimp.org>
* app/edit_selection.c: Fixed a couple of bugs with translating
the selection mask (move tool, alt-drag):
- Selection mask was being clipped whilst moved around, not just
at its final resting place.
- Selection mask translation was being performed 'live' like the
opaque moves even though there's simply nothing exciting to see.
Now the process is much faster.
Will remove the edit_selection.c dead-code later if this change
does not cause new trouble.
1999-12-17 Michael Natterer <mitch@gimp.org> 1999-12-17 Michael Natterer <mitch@gimp.org>
* app/gimphelp.c * app/gimphelp.c

View File

@ -210,12 +210,35 @@ edit_selection_button_release (Tool *tool,
tool->scroll_lock = edit_select.old_scroll_lock; tool->scroll_lock = edit_select.old_scroll_lock;
tool->auto_snap_to = edit_select.old_auto_snap_to; tool->auto_snap_to = edit_select.old_auto_snap_to;
/* MaskTranslate is performed here at movement end, not 'live' like
* the other translation types.
*/
if (edit_select.edit_type == MaskTranslate)
{
edit_selection_snap (gdisp, bevent->x, bevent->y);
x = edit_select.x;
y = edit_select.y;
/* move the selection -- whether there has been net movement or not!
* (to ensure that there's something on the undo stack)
*/
gimage_mask_translate (gdisp->gimage,
edit_select.cumlx,
edit_select.cumly);
if (edit_select.first_move)
{
gimp_image_undo_freeze (gdisp->gimage);
edit_select.first_move = FALSE;
}
}
#if 0 #if 0
/****************************************************************************/ /********************************************************************a.d.m.**/
/****************************************************************************/ /****************************************************************************/
/* This work is all done in the motion handler now - will be removed soon */ /* This work is all done in the motion handler now - will be removed soon */
/****************************************************************************/ /****************************************************************************/
/****************************************************************************/ /************************************************* & this time I mean it. ***/
/* If the cancel button is down...Do nothing */ /* If the cancel button is down...Do nothing */
if (! (bevent->state & GDK_BUTTON3_MASK)) if (! (bevent->state & GDK_BUTTON3_MASK))
{ {
@ -301,7 +324,6 @@ edit_selection_button_release (Tool *tool,
/* The user either didn't actually move the selection, /* The user either didn't actually move the selection,
or moved it around and eventually just put it back in or moved it around and eventually just put it back in
exactly the same spot. */ exactly the same spot. */
if ((edit_select.edit_type == MaskTranslate) || if ((edit_select.edit_type == MaskTranslate) ||
(edit_select.edit_type == MaskToLayerTranslate)) (edit_select.edit_type == MaskToLayerTranslate))
gimage_mask_clear (gdisp->gimage); gimage_mask_clear (gdisp->gimage);
@ -382,19 +404,21 @@ edit_selection_motion (Tool *tool,
{ {
case MaskTranslate: case MaskTranslate:
/* translate the selection */ /* translate the selection */
gimage_mask_translate (gdisp->gimage, xoffset, yoffset); /* gimage_mask_translate (gdisp->gimage, xoffset, yoffset);
/*g_warning("%d,%d %d,%d %d,%d %d,%d %d,%d %d,%d", g_warning("%d,%d %d,%d %d,%d %d,%d %d,%d %d,%d",
edit_select.origx,edit_select.origy, edit_select.origx,edit_select.origy,
edit_select.cumlx,edit_select.cumly, edit_select.cumlx,edit_select.cumly,
xoffset,yoffset, xoffset,yoffset,
x,y, x,y,
edit_select.x1,edit_select.y1, edit_select.x1,edit_select.y1,
edit_select.x2,edit_select.y2);*/ edit_select.x2,edit_select.y2);*/
/*
if (edit_select.first_move) if (edit_select.first_move)
{ {
gimp_image_undo_freeze (gdisp->gimage); gimp_image_undo_freeze (gdisp->gimage);
edit_select.first_move = FALSE; edit_select.first_move = FALSE;
} }
*/
edit_select.origx = x; edit_select.origx = x;
edit_select.origy = y; edit_select.origy = y;
break; break;

View File

@ -210,12 +210,35 @@ edit_selection_button_release (Tool *tool,
tool->scroll_lock = edit_select.old_scroll_lock; tool->scroll_lock = edit_select.old_scroll_lock;
tool->auto_snap_to = edit_select.old_auto_snap_to; tool->auto_snap_to = edit_select.old_auto_snap_to;
/* MaskTranslate is performed here at movement end, not 'live' like
* the other translation types.
*/
if (edit_select.edit_type == MaskTranslate)
{
edit_selection_snap (gdisp, bevent->x, bevent->y);
x = edit_select.x;
y = edit_select.y;
/* move the selection -- whether there has been net movement or not!
* (to ensure that there's something on the undo stack)
*/
gimage_mask_translate (gdisp->gimage,
edit_select.cumlx,
edit_select.cumly);
if (edit_select.first_move)
{
gimp_image_undo_freeze (gdisp->gimage);
edit_select.first_move = FALSE;
}
}
#if 0 #if 0
/****************************************************************************/ /********************************************************************a.d.m.**/
/****************************************************************************/ /****************************************************************************/
/* This work is all done in the motion handler now - will be removed soon */ /* This work is all done in the motion handler now - will be removed soon */
/****************************************************************************/ /****************************************************************************/
/****************************************************************************/ /************************************************* & this time I mean it. ***/
/* If the cancel button is down...Do nothing */ /* If the cancel button is down...Do nothing */
if (! (bevent->state & GDK_BUTTON3_MASK)) if (! (bevent->state & GDK_BUTTON3_MASK))
{ {
@ -301,7 +324,6 @@ edit_selection_button_release (Tool *tool,
/* The user either didn't actually move the selection, /* The user either didn't actually move the selection,
or moved it around and eventually just put it back in or moved it around and eventually just put it back in
exactly the same spot. */ exactly the same spot. */
if ((edit_select.edit_type == MaskTranslate) || if ((edit_select.edit_type == MaskTranslate) ||
(edit_select.edit_type == MaskToLayerTranslate)) (edit_select.edit_type == MaskToLayerTranslate))
gimage_mask_clear (gdisp->gimage); gimage_mask_clear (gdisp->gimage);
@ -382,19 +404,21 @@ edit_selection_motion (Tool *tool,
{ {
case MaskTranslate: case MaskTranslate:
/* translate the selection */ /* translate the selection */
gimage_mask_translate (gdisp->gimage, xoffset, yoffset); /* gimage_mask_translate (gdisp->gimage, xoffset, yoffset);
/*g_warning("%d,%d %d,%d %d,%d %d,%d %d,%d %d,%d", g_warning("%d,%d %d,%d %d,%d %d,%d %d,%d %d,%d",
edit_select.origx,edit_select.origy, edit_select.origx,edit_select.origy,
edit_select.cumlx,edit_select.cumly, edit_select.cumlx,edit_select.cumly,
xoffset,yoffset, xoffset,yoffset,
x,y, x,y,
edit_select.x1,edit_select.y1, edit_select.x1,edit_select.y1,
edit_select.x2,edit_select.y2);*/ edit_select.x2,edit_select.y2);*/
/*
if (edit_select.first_move) if (edit_select.first_move)
{ {
gimp_image_undo_freeze (gdisp->gimage); gimp_image_undo_freeze (gdisp->gimage);
edit_select.first_move = FALSE; edit_select.first_move = FALSE;
} }
*/
edit_select.origx = x; edit_select.origx = x;
edit_select.origy = y; edit_select.origy = y;
break; break;

View File

@ -210,12 +210,35 @@ edit_selection_button_release (Tool *tool,
tool->scroll_lock = edit_select.old_scroll_lock; tool->scroll_lock = edit_select.old_scroll_lock;
tool->auto_snap_to = edit_select.old_auto_snap_to; tool->auto_snap_to = edit_select.old_auto_snap_to;
/* MaskTranslate is performed here at movement end, not 'live' like
* the other translation types.
*/
if (edit_select.edit_type == MaskTranslate)
{
edit_selection_snap (gdisp, bevent->x, bevent->y);
x = edit_select.x;
y = edit_select.y;
/* move the selection -- whether there has been net movement or not!
* (to ensure that there's something on the undo stack)
*/
gimage_mask_translate (gdisp->gimage,
edit_select.cumlx,
edit_select.cumly);
if (edit_select.first_move)
{
gimp_image_undo_freeze (gdisp->gimage);
edit_select.first_move = FALSE;
}
}
#if 0 #if 0
/****************************************************************************/ /********************************************************************a.d.m.**/
/****************************************************************************/ /****************************************************************************/
/* This work is all done in the motion handler now - will be removed soon */ /* This work is all done in the motion handler now - will be removed soon */
/****************************************************************************/ /****************************************************************************/
/****************************************************************************/ /************************************************* & this time I mean it. ***/
/* If the cancel button is down...Do nothing */ /* If the cancel button is down...Do nothing */
if (! (bevent->state & GDK_BUTTON3_MASK)) if (! (bevent->state & GDK_BUTTON3_MASK))
{ {
@ -301,7 +324,6 @@ edit_selection_button_release (Tool *tool,
/* The user either didn't actually move the selection, /* The user either didn't actually move the selection,
or moved it around and eventually just put it back in or moved it around and eventually just put it back in
exactly the same spot. */ exactly the same spot. */
if ((edit_select.edit_type == MaskTranslate) || if ((edit_select.edit_type == MaskTranslate) ||
(edit_select.edit_type == MaskToLayerTranslate)) (edit_select.edit_type == MaskToLayerTranslate))
gimage_mask_clear (gdisp->gimage); gimage_mask_clear (gdisp->gimage);
@ -382,19 +404,21 @@ edit_selection_motion (Tool *tool,
{ {
case MaskTranslate: case MaskTranslate:
/* translate the selection */ /* translate the selection */
gimage_mask_translate (gdisp->gimage, xoffset, yoffset); /* gimage_mask_translate (gdisp->gimage, xoffset, yoffset);
/*g_warning("%d,%d %d,%d %d,%d %d,%d %d,%d %d,%d", g_warning("%d,%d %d,%d %d,%d %d,%d %d,%d %d,%d",
edit_select.origx,edit_select.origy, edit_select.origx,edit_select.origy,
edit_select.cumlx,edit_select.cumly, edit_select.cumlx,edit_select.cumly,
xoffset,yoffset, xoffset,yoffset,
x,y, x,y,
edit_select.x1,edit_select.y1, edit_select.x1,edit_select.y1,
edit_select.x2,edit_select.y2);*/ edit_select.x2,edit_select.y2);*/
/*
if (edit_select.first_move) if (edit_select.first_move)
{ {
gimp_image_undo_freeze (gdisp->gimage); gimp_image_undo_freeze (gdisp->gimage);
edit_select.first_move = FALSE; edit_select.first_move = FALSE;
} }
*/
edit_select.origx = x; edit_select.origx = x;
edit_select.origy = y; edit_select.origy = y;
break; break;