diff --git a/commands/CmdCD.c b/commands/CmdCD.c index 85f4aa69..39602714 100644 --- a/commands/CmdCD.c +++ b/commands/CmdCD.c @@ -3773,7 +3773,7 @@ CmdDelete(w, cmd) * new edit cell into the window containing the point tool. * * Usage: - * down + * down [] * * Results: * None. @@ -3795,11 +3795,23 @@ CmdDown(w, cmd) MagWindow *w; TxCommand *cmd; { + CellUse *use = NULL; Rect area, pointArea; int cmdEditRedisplayFunc(); /* External declaration. */ int cmdDownEnumFunc(); /* Forward declaration. */ - if (cmd->tx_argc > 1) + if ((w != NULL) && (cmd->tx_argc == 2)) + { + CellUse *rootUse; + SearchContext scx; + + rootUse = (CellUse *)w->w_surfaceID; + bzero(&scx, sizeof(SearchContext)); + DBTreeFindUse(cmd->tx_argv[1], rootUse, &scx); + use = scx.scx_use; + } + + if ((use == NULL) && (cmd->tx_argc > 1)) { TxError("Usage: edit\nMaybe you want the \"load\" command\n"); return; @@ -3822,8 +3834,18 @@ CmdDown(w, cmd) (void) ToolGetPoint((Point *) NULL, &pointArea); cmdFoundNewDown = FALSE; - (void) SelEnumCells(FALSE, (bool *) NULL, (SearchContext *) NULL, - cmdDownEnumFunc, (ClientData) &pointArea); + + if (use == NULL) + { + SelEnumCells(FALSE, (bool *) NULL, (SearchContext *) NULL, + cmdDownEnumFunc, (ClientData) &pointArea); + } + else + { + EditCellUse = use; + EditRootDef = use->cu_def; + cmdFoundNewDown = TRUE; + } if (!cmdFoundNewDown) TxError("You haven't selected a new cell to edit.\n"); diff --git a/commands/CmdRS.c b/commands/CmdRS.c index 961b701e..81646113 100644 --- a/commands/CmdRS.c +++ b/commands/CmdRS.c @@ -786,7 +786,7 @@ CmdSelect(w, cmd) }; static char *cmdSelectMsg[] = { - "[more | less | nocycle] [layers]\n" + "[more | less | nocycle] [layers] [at x y]\n" " [de]select paint chunk/region/net under\n" " cursor, or [de]select subcell if cursor\n" " over space", @@ -845,13 +845,14 @@ CmdSelect(w, cmd) CellUse *use; CellDef *rootBoxDef; Transform trans, rootTrans, tmp1; - Point p, rootPoint; + Point p, rootPoint, atPoint; Rect r, selarea; ExtRectList *rlist; int option; int feedstyle; bool layerspec; bool degenerate; + bool doat = FALSE; bool more = FALSE, less = FALSE, samePlace = TRUE; unsigned char labelpolicy = SEL_DO_LABELS; #ifdef MAGIC_WRAPPER @@ -939,6 +940,20 @@ CmdSelect(w, cmd) "cell", strlen(cmd->tx_argv[2]))) optionArgs = &cmd->tx_argv[2]; } + + doat = FALSE; + if ((cmd->tx_argc > 3) && !strcmp(cmd->tx_argv[cmd->tx_argc - 3], "at")) + { + Point editPoint; + + doat = TRUE; + editPoint.p_x = cmdParseCoord(w, cmd->tx_argv[cmd->tx_argc - 2], + FALSE, TRUE); + editPoint.p_y = cmdParseCoord(w, cmd->tx_argv[cmd->tx_argc - 1], + FALSE, FALSE); + GeoTransPoint(&EditToRootTransform, &editPoint, &atPoint); + cmd->tx_argc -= 3; + } } /* Check the option for validity. */ @@ -1247,11 +1262,12 @@ CmdSelect(w, cmd) */ case SEL_DEFAULT: - if (cmd->tx_argc > 2) goto usageError; + if (cmd->tx_argc == 2) layerspec = TRUE; else layerspec = FALSE; + goto Okay; case SEL_CELL: layerspec = FALSE; @@ -1284,6 +1300,15 @@ Okay: scx.scx_area.r_ytop = scx.scx_area.r_ybot + 1; degenerate = TRUE; } + else if (doat) + { + scx.scx_area.r_xbot = atPoint.p_x; + scx.scx_area.r_ybot = atPoint.p_y; + scx.scx_area.r_xtop = atPoint.p_x + 1; + scx.scx_area.r_ytop = atPoint.p_y + 1; + windCheckOnlyWindow(&w, DBWclientID); + window = w; + } else { window = CmdGetRootPoint((Point *) NULL, &scx.scx_area); @@ -1305,17 +1330,34 @@ Okay: * same space WILL cause a crash). */ - if (!GEO_ENCLOSE(&cmd->tx_p, &lastArea) - || ((lastCommand + 1) != TxCommandNumber)) + if (doat) { - samePlace = FALSE; - lastUse = NULL; - } + if (!GEO_ENCLOSE(&scx.scx_area.r_ll, &lastArea) + || ((lastCommand + 1) != TxCommandNumber)) + { + samePlace = FALSE; + lastUse = NULL; + } - lastArea.r_xbot = cmd->tx_p.p_x - MARGIN; - lastArea.r_ybot = cmd->tx_p.p_y - MARGIN; - lastArea.r_xtop = cmd->tx_p.p_x + MARGIN; - lastArea.r_ytop = cmd->tx_p.p_y + MARGIN; + lastArea.r_xbot = scx.scx_area.r_xbot - MARGIN; + lastArea.r_ybot = scx.scx_area.r_ybot - MARGIN; + lastArea.r_xtop = scx.scx_area.r_xbot + MARGIN; + lastArea.r_ytop = scx.scx_area.r_ybot + MARGIN; + } + else + { + if (!GEO_ENCLOSE(&cmd->tx_p, &lastArea) + || ((lastCommand + 1) != TxCommandNumber)) + { + samePlace = FALSE; + lastUse = NULL; + } + + lastArea.r_xbot = cmd->tx_p.p_x - MARGIN; + lastArea.r_ybot = cmd->tx_p.p_y - MARGIN; + lastArea.r_xtop = cmd->tx_p.p_x + MARGIN; + lastArea.r_ytop = cmd->tx_p.p_y + MARGIN; + } lastCommand = TxCommandNumber; /* If there's material under the cursor, select some paint. diff --git a/doc/html/down.html b/doc/html/down.html index 3f289348..743670c0 100644 --- a/doc/html/down.html +++ b/doc/html/down.html @@ -20,20 +20,22 @@

down


-Load selected cell into a window +Load selected or indicated cell into a window

Usage:

- down + down [instance]

Summary:

- The down command loads the currently selected cell into the - window. If more than one cell is selected, the one closest to the - cursor (pointer) position will be used, or at worst, one will be - selected arbitrarily. + With no arguments, the down command loads the currently + selected cell into the window. If more than one cell is selected, + the one closest to the cursor (pointer) position will be used, or at + worst, one will be selected arbitrarily.

+ With one argument instance, the cell of the instance named + instance will be loaded into the window.

Implementation Notes:

diff --git a/doc/html/select.html b/doc/html/select.html index 7b132487..bbf32adc 100644 --- a/doc/html/select.html +++ b/doc/html/select.html @@ -47,13 +47,14 @@ create a new cell definition from a selection.
where option may be one of the following:
-
[more | less] [layers] -
[De]select material under cursor, or - [de]select a subcell if the cursor is over space. -
nocycle [layers] +
[more | less] [layers] [at x y] +
[De]select material under cursor or indicated position, or + [de]select a subcell if the cursor or indicated position is over + space. +
nocycle [layers] [at x y]
Select material without cycling through different tile types when "select" is called from the same cursor position - more than once. + or indicated coordinate more than once.
[do | no | simple] labels
Set policy for copying labels during a network selection.
[more | less] area [layers] [pattern]