Added the ability to translate pointer-based "wire" commands from

interactive wiring into coordinate-based commands.  Added new
command extensions for "wire leg", "wire vertical", "wire type",
and "wire horizontal".  Modified the command logging such that
"wire show" (which does not modify layout) does not get logged,
which avoids unnecessary logging of mouse movement.
This commit is contained in:
Tim Edwards 2025-02-22 17:06:06 -05:00
parent c4a2a54cb7
commit 144c22f579
4 changed files with 134 additions and 42 deletions

View File

@ -1 +1 @@
8.3.520 8.3.521

View File

@ -1431,6 +1431,8 @@ CmdWire(
char *lastargv; char *lastargv;
TileType type; TileType type;
int width; int width;
Point point, rootPoint;
bool needCoord = FALSE;
#ifdef MAGIC_WRAPPER #ifdef MAGIC_WRAPPER
Tcl_Obj *lobj; Tcl_Obj *lobj;
@ -1508,11 +1510,11 @@ CmdWire(
int value = 1; int value = 1;
if (cmd->tx_argc == 4) if (cmd->tx_argc == 4)
value = cmdParseCoord(w, cmd->tx_argv[3], TRUE, TRUE); value = cmdParseCoord(w, cmd->tx_argv[3], TRUE, TRUE);
WirePickType(WireType, WireWidth - value); WirePickType(WireType, (Point *)NULL, WireWidth - value);
} }
else else
goto badargs; goto badargs;
return; break;
case INCREMENT: case INCREMENT:
if (cmd->tx_argc != 3 && cmd->tx_argc != 4) if (cmd->tx_argc != 3 && cmd->tx_argc != 4)
@ -1548,11 +1550,11 @@ CmdWire(
int value = 1; int value = 1;
if (cmd->tx_argc == 4) if (cmd->tx_argc == 4)
value = cmdParseCoord(w, cmd->tx_argv[3], TRUE, TRUE); value = cmdParseCoord(w, cmd->tx_argv[3], TRUE, TRUE);
WirePickType(WireType, WireWidth + value); WirePickType(WireType, (Point *)NULL, WireWidth + value);
} }
else else
goto badargs; goto badargs;
return; break;
case HELP: case HELP:
@ -1562,15 +1564,41 @@ CmdWire(
{ {
TxPrintf(" %s\n", *msg); TxPrintf(" %s\n", *msg);
} }
return; break;
case HORIZONTAL: case HORIZONTAL:
if ((cmd->tx_argc > 2) && strcmp(cmd->tx_argv[2], "to") == 0)
{
if (cmd->tx_argc != 5)
goto badargs;
point.p_x = cmdParseCoord(w, cmd->tx_argv[3], FALSE, TRUE);
point.p_y = cmdParseCoord(w, cmd->tx_argv[4], FALSE, FALSE);
GeoTransPoint(&EditToRootTransform, &point, &rootPoint);
WireAddLeg((Rect *)NULL, &rootPoint, WIRE_HORIZONTAL);
}
else
{
WireAddLeg((Rect *) NULL, (Point *) NULL, WIRE_HORIZONTAL); WireAddLeg((Rect *) NULL, (Point *) NULL, WIRE_HORIZONTAL);
return; needCoord = TRUE;
}
break;
case LEG: case LEG:
if ((cmd->tx_argc > 2) && strcmp(cmd->tx_argv[2], "to") == 0)
{
if (cmd->tx_argc != 5)
goto badargs;
point.p_x = cmdParseCoord(w, cmd->tx_argv[3], FALSE, TRUE);
point.p_y = cmdParseCoord(w, cmd->tx_argv[4], FALSE, FALSE);
GeoTransPoint(&EditToRootTransform, &point, &rootPoint);
WireAddLeg((Rect *)NULL, &rootPoint, WIRE_CHOOSE);
}
else
{
WireAddLeg((Rect *)NULL, (Point *)NULL, WIRE_CHOOSE); WireAddLeg((Rect *)NULL, (Point *)NULL, WIRE_CHOOSE);
return; needCoord = TRUE;
}
break;
case SHOW: case SHOW:
WireShowLeg(); WireShowLeg();
@ -1604,7 +1632,17 @@ CmdWire(
case TYPE: case TYPE:
if (locargc == 2) if (locargc == 2)
WirePickType(-1, 0); {
WirePickType(-1, (Point *)NULL, 0);
needCoord = TRUE;
}
else if ((locargc == 5) && !strcmp(cmd->tx_argv[2], "at"))
{
point.p_x = cmdParseCoord(w, cmd->tx_argv[3], FALSE, TRUE);
point.p_y = cmdParseCoord(w, cmd->tx_argv[4], FALSE, FALSE);
GeoTransPoint(&EditToRootTransform, &point, &rootPoint);
WirePickType(-1, &rootPoint, 0);
}
else if (locargc != 3 && locargc != 4) else if (locargc != 3 && locargc != 4)
{ {
badargs: badargs:
@ -1635,7 +1673,7 @@ CmdWire(
} }
else else
width = cmdParseCoord(w, cmd->tx_argv[3], TRUE, TRUE); width = cmdParseCoord(w, cmd->tx_argv[3], TRUE, TRUE);
WirePickType(type, width); WirePickType(type, (Point *)NULL, width);
return; return;
} }
break; break;
@ -1657,11 +1695,24 @@ CmdWire(
DBTypeLongNameTbl[type], width); DBTypeLongNameTbl[type], width);
#endif #endif
} }
return; break;
case VERTICAL: case VERTICAL:
if ((cmd->tx_argc > 2) && strcmp(cmd->tx_argv[2], "to") == 0)
{
if (cmd->tx_argc != 5)
goto badargs;
point.p_x = cmdParseCoord(w, cmd->tx_argv[3], FALSE, TRUE);
point.p_y = cmdParseCoord(w, cmd->tx_argv[4], FALSE, FALSE);
GeoTransPoint(&EditToRootTransform, &point, &rootPoint);
WireAddLeg((Rect *)NULL, &rootPoint, WIRE_VERTICAL);
}
else
{
WireAddLeg((Rect *) NULL, (Point *) NULL, WIRE_VERTICAL); WireAddLeg((Rect *) NULL, (Point *) NULL, WIRE_VERTICAL);
return; needCoord = TRUE;
}
break;
case WIDTH: case WIDTH:
if (locargc == 2) if (locargc == 2)
@ -1680,7 +1731,7 @@ CmdWire(
{ {
width = cmdParseCoord(w, cmd->tx_argv[2], TRUE, TRUE); width = cmdParseCoord(w, cmd->tx_argv[2], TRUE, TRUE);
type = WireGetType(); type = WireGetType();
WirePickType(type, width); WirePickType(type, (Point *)NULL, width);
return; return;
} }
break; break;
@ -1829,6 +1880,22 @@ CmdWire(
} }
break; break;
} }
/* Recast the command as "wire <option> to <x> <y>" so that it no longer
* depends on the pointer position, for command logging.
*/
if (needCoord)
{
if (ToolGetPoint(&rootPoint, (Rect *)NULL) != NULL)
{
GeoTransPoint(&RootToEditTransform, &rootPoint, &point);
sprintf(cmd->tx_argstring, "wire %s %s %di %di",
cmd->tx_argv[1],
(option == TYPE) ? "at" : "to",
point.p_x, point.p_y);
TxRebuildCommand(cmd);
}
}
} }
/* /*

View File

@ -845,6 +845,8 @@ txLogCommand(cmd)
/* Do not output "logcommand" commands to the log file. /* Do not output "logcommand" commands to the log file.
* Do not output "*bypass" commands to the log file. * Do not output "*bypass" commands to the log file.
* Do not output "setpoint" commands to the log file.
* Do not output "wire show" commands to the log file (excessive output).
*/ */
postns = strstr(cmd->tx_argv[0], "::"); postns = strstr(cmd->tx_argv[0], "::");
if (postns == NULL) if (postns == NULL)
@ -856,7 +858,10 @@ txLogCommand(cmd)
return; return;
else if (!strcmp(postns, "*bypass")) else if (!strcmp(postns, "*bypass"))
return; return;
else if (!strcmp(postns, "setpoint")) return; else if (!strcmp(postns, "setpoint"))
return;
else if (!strcmp(postns, "wire") && !strcmp(cmd->tx_argv[1], "show"))
return;
fprintf(txLogFile, "%s%s", pfix, cmd->tx_argv[0]); fprintf(txLogFile, "%s%s", pfix, cmd->tx_argv[0]);
for (i = 1; i < cmd->tx_argc; i++) for (i = 1; i < cmd->tx_argc; i++)

View File

@ -52,42 +52,42 @@ int WireWidth; /* Thickness of material to use for wiring. */
int WireLastDir; /* Last direction in which a wire was run. */ int WireLastDir; /* Last direction in which a wire was run. */
/* The following variable is used to communicate the desired root cellDef /* The following variable is used to communicate the desired root cellDef
* between wireFindRootUse and wireFindRootFunc. * between wireFindRootWindow and wireFindRootFunc.
*/ */
static CellDef *wireDesiredDef; static CellDef *wireDesiredDef;
/* /*
* ---------------------------------------------------------------------------- * ----------------------------------------------------------------------------
* wireFindRootUse -- * wireFindRootWindow --
* *
* This is a utility procedure to find a window containing a particular * This is a utility procedure to find a window containing a particular
* definition as its root. * definition as its root.
* *
* Results: * Results:
* The return value is the root use of a window, such that the * The return value is a pointer to a window for which the
* use is an instance of rootDef. If the definition isn't the * window is an instance of rootDef. If no window is an instance
* root of any window then NULL is returned. * of rootDef, then NULL is returned.
* *
* Side effects: * Side effects:
* None. * None.
* ---------------------------------------------------------------------------- * ----------------------------------------------------------------------------
*/ */
CellUse * MagWindow *
wireFindRootUse(rootDef) wireFindRootWindow(rootDef)
CellDef *rootDef; /* Root definition for which a root use CellDef *rootDef; /* Root definition for which a root use
* is desired. * is desired.
*/ */
{ {
CellUse *result; MagWindow *mw;
extern int wireFindRootFunc(); extern int wireFindRootFunc();
result = NULL; mw = NULL;
wireDesiredDef = rootDef; wireDesiredDef = rootDef;
(void) WindSearch(DBWclientID, (ClientData) NULL, (Rect *) NULL, (void) WindSearch(DBWclientID, (ClientData) NULL, (Rect *) NULL,
wireFindRootFunc, (ClientData) &result); wireFindRootFunc, (ClientData) &mw);
return result; return mw;
} }
/* The following search function is called for each window. If the /* The following search function is called for each window. If the
@ -96,15 +96,15 @@ wireFindRootUse(rootDef)
*/ */
int int
wireFindRootFunc(window, cellUsePtr) wireFindRootFunc(window, mwPtr)
MagWindow *window; /* A layout window. */ MagWindow *window; /* A layout window. */
CellUse **cellUsePtr; /* Pointer to cellUse pointer. */ MagWindow **mwPtr; /* Copy layout window pointer to this */
{ {
CellUse *use; CellUse *use;
use = (CellUse *) window->w_surfaceID; use = (CellUse *) window->w_surfaceID;
if (use->cu_def != wireDesiredDef) return 0; if (use->cu_def != wireDesiredDef) return 0;
*cellUsePtr = use; *mwPtr = window;
return 1; return 1;
} }
@ -128,11 +128,14 @@ wireFindRootFunc(window, cellUsePtr)
*/ */
void void
WirePickType(type, width) WirePickType(type, ppoint, width)
TileType type; /* New type of material to use for wiring. TileType type; /* New type of material to use for wiring.
* If less than zero, then pick a new type * If less than zero, then pick a new type
* based on what's underneath the cursor. * based on what's underneath the cursor.
*/ */
Point *ppoint; /* If non-NULL, contains a point position
* from which to get the wire type.
*/
int width; /* Width to use for future wiring. If type int width; /* Width to use for future wiring. If type
* is less than zero then this parameter is * is less than zero then this parameter is
* ignored and the width of the material * ignored and the width of the material
@ -162,6 +165,18 @@ WirePickType(type, width)
* so each type gets a chance. * so each type gets a chance.
*/ */
if (ppoint)
{
point.p_x = ppoint->p_x;
point.p_y = ppoint->p_y;
w = wireFindRootWindow(EditRootDef);
scx.scx_area.r_xbot = point.p_x;
scx.scx_area.r_ybot = point.p_y;
scx.scx_area.r_xtop = scx.scx_area.r_xbot + 1;
scx.scx_area.r_ytop = scx.scx_area.r_ybot + 1;
}
else
{
w = ToolGetPoint(&point, &scx.scx_area); w = ToolGetPoint(&point, &scx.scx_area);
if (w == NULL) if (w == NULL)
{ {
@ -169,6 +184,7 @@ WirePickType(type, width)
TxError(" cursor is in a layout window.\n"); TxError(" cursor is in a layout window.\n");
return; return;
} }
}
scx.scx_use = (CellUse *) w->w_surfaceID; scx.scx_use = (CellUse *) w->w_surfaceID;
scx.scx_trans = GeoIdentityTransform; scx.scx_trans = GeoIdentityTransform;
crec = (DBWclientRec *) w->w_clientData; crec = (DBWclientRec *) w->w_clientData;
@ -299,6 +315,7 @@ WireAddLeg(rect, point, direction)
* the indicated direction. * the indicated direction.
*/ */
{ {
MagWindow *w;
Rect current, new, leg, editArea; Rect current, new, leg, editArea;
CellDef *boxRootDef; CellDef *boxRootDef;
SearchContext scx; SearchContext scx;
@ -476,7 +493,8 @@ WireAddLeg(rect, point, direction)
* windows. * windows.
*/ */
scx.scx_use = wireFindRootUse(EditRootDef); w = wireFindRootWindow(EditRootDef);
scx.scx_use = w->w_surfaceID;
if (scx.scx_use != NULL) if (scx.scx_use != NULL)
{ {
SelectClear(); SelectClear();
@ -725,6 +743,7 @@ WireAddContact(newType, newWidth)
* used. * used.
*/ */
{ {
MagWindow *w;
Rect oldLeg, contactArea, tmp, tmp2, editArea; Rect oldLeg, contactArea, tmp, tmp2, editArea;
CellDef *boxRootDef; CellDef *boxRootDef;
TileType oldType; TileType oldType;
@ -760,7 +779,7 @@ WireAddContact(newType, newWidth)
* there's no need to add a contact. * there's no need to add a contact.
*/ */
WirePickType(newType, newWidth); WirePickType(newType, (Point *)NULL, newWidth);
if (WireType == oldType) if (WireType == oldType)
{ {
TxError("The new wiring layer is the same as the old one, so\n"); TxError("The new wiring layer is the same as the old one, so\n");
@ -1001,7 +1020,8 @@ WireAddContact(newType, newWidth)
*/ */
SelectClear(); SelectClear();
scx.scx_use = wireFindRootUse(EditRootDef); w = wireFindRootWindow(EditRootDef);
scx.scx_use = w->w_surfaceID;
if (scx.scx_use != NULL) if (scx.scx_use != NULL)
{ {
scx.scx_trans = GeoIdentityTransform; scx.scx_trans = GeoIdentityTransform;
@ -1063,7 +1083,7 @@ WireButtonProc(w, cmd)
switch (cmd->tx_button) switch (cmd->tx_button)
{ {
case TX_LEFT_BUTTON: case TX_LEFT_BUTTON:
WirePickType(-1, 0); WirePickType(-1, (Point *)NULL, 0);
break; break;
case TX_RIGHT_BUTTON: case TX_RIGHT_BUTTON:
WireAddLeg((Rect *) NULL, (Point *) NULL, WIRE_CHOOSE); WireAddLeg((Rect *) NULL, (Point *) NULL, WIRE_CHOOSE);