Added a command option for "select move" without specifying the

X and Y values, in which case the selection is moved to the
current pointer position.  This allows a different implementation
of the "copy" command as "select move; select keep", which avoids
the problem that "copy" has of modifying the selection with layer
interactions with the existing layout.
This commit is contained in:
R. Timothy Edwards 2025-08-27 09:57:22 -04:00
parent e9f2628f41
commit b1095b323c
3 changed files with 31 additions and 6 deletions

View File

@ -1 +1 @@
8.3.546
8.3.547

View File

@ -1121,14 +1121,36 @@ CmdSelect(
/*--------------------------------------------------------------------
* Move the selection relative to the cell def
* With two additional arguments: Arguments are X and Y position
* With no additional arugments: X and Y position taken from pointer.
*--------------------------------------------------------------------
*/
case SEL_MOVE:
if ((more) || (less) || (primargs != 4)) goto usageError;
if ((more) || (less) || ((primargs != 4) && (primargs != 2)))
goto usageError;
p.p_x = cmdParseCoord(w, cmd->tx_argv[2], FALSE, TRUE);
p.p_y = cmdParseCoord(w, cmd->tx_argv[3], FALSE, FALSE);
if (primargs == 2)
{
MagWindow *window;
Rect rootBox;
window = ToolGetPoint(&p, (Rect *)NULL);
if ((window == NULL) ||
!ToolGetBox(&SelectRootDef, &rootBox) ||
(EditRootDef != ((CellUse *) window->w_surfaceID)->cu_def))
{
TxError("Error: Pointer is not in the edit cell.\n");
return;
}
p.p_x -= rootBox.r_xbot;
p.p_y -= rootBox.r_ybot;
}
else
{
p.p_x = cmdParseCoord(w, cmd->tx_argv[2], FALSE, TRUE);
p.p_y = cmdParseCoord(w, cmd->tx_argv[3], FALSE, FALSE);
}
/* Erase first, then recompute the transform */
GeoTransRect(&SelectUse->cu_transform, &SelectDef->cd_bbox, &selarea);

View File

@ -99,9 +99,12 @@ create a new cell definition from a selection.
<DD> Copy the selection from the layout into the selection
buffer, and keep the selection buffer for interactive
processing.
<DT> <B>move</B> <I>x y</I>
<DT> <B>move</B> [ <I>x y</I> ]
<DD> Move the selection buffer to position <I>x y</I>,
relative to the cell definition origin.
relative to the cell definition origin. If <I>x</I> and
<I>y</I> are not given, the move the selection buffer so
that its lower left corner is at the current pointer
position.
<DT> <B>bbox</B>
<DD> Return the bounding box of the selection.
<DT> <B>feedback</B> [ <I>style</I> [ <I>text</I> ]]