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:
parent
c4a2a54cb7
commit
144c22f579
|
|
@ -1431,6 +1431,8 @@ CmdWire(
|
|||
char *lastargv;
|
||||
TileType type;
|
||||
int width;
|
||||
Point point, rootPoint;
|
||||
bool needCoord = FALSE;
|
||||
|
||||
#ifdef MAGIC_WRAPPER
|
||||
Tcl_Obj *lobj;
|
||||
|
|
@ -1508,11 +1510,11 @@ CmdWire(
|
|||
int value = 1;
|
||||
if (cmd->tx_argc == 4)
|
||||
value = cmdParseCoord(w, cmd->tx_argv[3], TRUE, TRUE);
|
||||
WirePickType(WireType, WireWidth - value);
|
||||
WirePickType(WireType, (Point *)NULL, WireWidth - value);
|
||||
}
|
||||
else
|
||||
goto badargs;
|
||||
return;
|
||||
break;
|
||||
|
||||
case INCREMENT:
|
||||
if (cmd->tx_argc != 3 && cmd->tx_argc != 4)
|
||||
|
|
@ -1548,11 +1550,11 @@ CmdWire(
|
|||
int value = 1;
|
||||
if (cmd->tx_argc == 4)
|
||||
value = cmdParseCoord(w, cmd->tx_argv[3], TRUE, TRUE);
|
||||
WirePickType(WireType, WireWidth + value);
|
||||
WirePickType(WireType, (Point *)NULL, WireWidth + value);
|
||||
}
|
||||
else
|
||||
goto badargs;
|
||||
return;
|
||||
break;
|
||||
|
||||
|
||||
case HELP:
|
||||
|
|
@ -1562,15 +1564,41 @@ CmdWire(
|
|||
{
|
||||
TxPrintf(" %s\n", *msg);
|
||||
}
|
||||
return;
|
||||
break;
|
||||
|
||||
case HORIZONTAL:
|
||||
WireAddLeg((Rect *) NULL, (Point *) NULL, WIRE_HORIZONTAL);
|
||||
return;
|
||||
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);
|
||||
needCoord = TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
case LEG:
|
||||
WireAddLeg((Rect *) NULL, (Point *) NULL, WIRE_CHOOSE);
|
||||
return;
|
||||
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);
|
||||
needCoord = TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
case SHOW:
|
||||
WireShowLeg();
|
||||
|
|
@ -1604,7 +1632,17 @@ CmdWire(
|
|||
|
||||
case TYPE:
|
||||
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)
|
||||
{
|
||||
badargs:
|
||||
|
|
@ -1635,7 +1673,7 @@ CmdWire(
|
|||
}
|
||||
else
|
||||
width = cmdParseCoord(w, cmd->tx_argv[3], TRUE, TRUE);
|
||||
WirePickType(type, width);
|
||||
WirePickType(type, (Point *)NULL, width);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
|
@ -1657,11 +1695,24 @@ CmdWire(
|
|||
DBTypeLongNameTbl[type], width);
|
||||
#endif
|
||||
}
|
||||
return;
|
||||
break;
|
||||
|
||||
case VERTICAL:
|
||||
WireAddLeg((Rect *) NULL, (Point *) NULL, WIRE_VERTICAL);
|
||||
return;
|
||||
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);
|
||||
needCoord = TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
case WIDTH:
|
||||
if (locargc == 2)
|
||||
|
|
@ -1680,7 +1731,7 @@ CmdWire(
|
|||
{
|
||||
width = cmdParseCoord(w, cmd->tx_argv[2], TRUE, TRUE);
|
||||
type = WireGetType();
|
||||
WirePickType(type, width);
|
||||
WirePickType(type, (Point *)NULL, width);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
|
@ -1829,6 +1880,22 @@ CmdWire(
|
|||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -845,6 +845,8 @@ txLogCommand(cmd)
|
|||
|
||||
/* Do not output "logcommand" 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], "::");
|
||||
if (postns == NULL)
|
||||
|
|
@ -856,7 +858,10 @@ txLogCommand(cmd)
|
|||
return;
|
||||
else if (!strcmp(postns, "*bypass"))
|
||||
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]);
|
||||
for (i = 1; i < cmd->tx_argc; i++)
|
||||
|
|
|
|||
|
|
@ -52,42 +52,42 @@ int WireWidth; /* Thickness of material to use for wiring. */
|
|||
int WireLastDir; /* Last direction in which a wire was run. */
|
||||
|
||||
/* The following variable is used to communicate the desired root cellDef
|
||||
* between wireFindRootUse and wireFindRootFunc.
|
||||
* between wireFindRootWindow and wireFindRootFunc.
|
||||
*/
|
||||
|
||||
static CellDef *wireDesiredDef;
|
||||
|
||||
/*
|
||||
* ----------------------------------------------------------------------------
|
||||
* wireFindRootUse --
|
||||
* wireFindRootWindow --
|
||||
*
|
||||
* This is a utility procedure to find a window containing a particular
|
||||
* definition as its root.
|
||||
*
|
||||
* Results:
|
||||
* The return value is the root use of a window, such that the
|
||||
* use is an instance of rootDef. If the definition isn't the
|
||||
* root of any window then NULL is returned.
|
||||
* The return value is a pointer to a window for which the
|
||||
* window is an instance of rootDef. If no window is an instance
|
||||
* of rootDef, then NULL is returned.
|
||||
*
|
||||
* Side effects:
|
||||
* None.
|
||||
* ----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
CellUse *
|
||||
wireFindRootUse(rootDef)
|
||||
MagWindow *
|
||||
wireFindRootWindow(rootDef)
|
||||
CellDef *rootDef; /* Root definition for which a root use
|
||||
* is desired.
|
||||
*/
|
||||
{
|
||||
CellUse *result;
|
||||
MagWindow *mw;
|
||||
extern int wireFindRootFunc();
|
||||
|
||||
result = NULL;
|
||||
mw = NULL;
|
||||
wireDesiredDef = rootDef;
|
||||
(void) WindSearch(DBWclientID, (ClientData) NULL, (Rect *) NULL,
|
||||
wireFindRootFunc, (ClientData) &result);
|
||||
return result;
|
||||
wireFindRootFunc, (ClientData) &mw);
|
||||
return mw;
|
||||
}
|
||||
|
||||
/* The following search function is called for each window. If the
|
||||
|
|
@ -96,15 +96,15 @@ wireFindRootUse(rootDef)
|
|||
*/
|
||||
|
||||
int
|
||||
wireFindRootFunc(window, cellUsePtr)
|
||||
MagWindow *window; /* A layout window. */
|
||||
CellUse **cellUsePtr; /* Pointer to cellUse pointer. */
|
||||
wireFindRootFunc(window, mwPtr)
|
||||
MagWindow *window; /* A layout window. */
|
||||
MagWindow **mwPtr; /* Copy layout window pointer to this */
|
||||
{
|
||||
CellUse *use;
|
||||
|
||||
use = (CellUse *) window->w_surfaceID;
|
||||
if (use->cu_def != wireDesiredDef) return 0;
|
||||
*cellUsePtr = use;
|
||||
*mwPtr = window;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
@ -128,11 +128,14 @@ wireFindRootFunc(window, cellUsePtr)
|
|||
*/
|
||||
|
||||
void
|
||||
WirePickType(type, width)
|
||||
WirePickType(type, ppoint, width)
|
||||
TileType type; /* New type of material to use for wiring.
|
||||
* If less than zero, then pick a new type
|
||||
* 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
|
||||
* is less than zero then this parameter is
|
||||
* ignored and the width of the material
|
||||
|
|
@ -162,12 +165,25 @@ WirePickType(type, width)
|
|||
* so each type gets a chance.
|
||||
*/
|
||||
|
||||
w = ToolGetPoint(&point, &scx.scx_area);
|
||||
if (w == NULL)
|
||||
if (ppoint)
|
||||
{
|
||||
TxError("Can't use cursor to select wiring material unless\n");
|
||||
TxError(" cursor is in a layout window.\n");
|
||||
return;
|
||||
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);
|
||||
if (w == NULL)
|
||||
{
|
||||
TxError("Can't use cursor to select wiring material unless\n");
|
||||
TxError(" cursor is in a layout window.\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
scx.scx_use = (CellUse *) w->w_surfaceID;
|
||||
scx.scx_trans = GeoIdentityTransform;
|
||||
|
|
@ -299,6 +315,7 @@ WireAddLeg(rect, point, direction)
|
|||
* the indicated direction.
|
||||
*/
|
||||
{
|
||||
MagWindow *w;
|
||||
Rect current, new, leg, editArea;
|
||||
CellDef *boxRootDef;
|
||||
SearchContext scx;
|
||||
|
|
@ -476,7 +493,8 @@ WireAddLeg(rect, point, direction)
|
|||
* windows.
|
||||
*/
|
||||
|
||||
scx.scx_use = wireFindRootUse(EditRootDef);
|
||||
w = wireFindRootWindow(EditRootDef);
|
||||
scx.scx_use = w->w_surfaceID;
|
||||
if (scx.scx_use != NULL)
|
||||
{
|
||||
SelectClear();
|
||||
|
|
@ -725,6 +743,7 @@ WireAddContact(newType, newWidth)
|
|||
* used.
|
||||
*/
|
||||
{
|
||||
MagWindow *w;
|
||||
Rect oldLeg, contactArea, tmp, tmp2, editArea;
|
||||
CellDef *boxRootDef;
|
||||
TileType oldType;
|
||||
|
|
@ -760,7 +779,7 @@ WireAddContact(newType, newWidth)
|
|||
* there's no need to add a contact.
|
||||
*/
|
||||
|
||||
WirePickType(newType, newWidth);
|
||||
WirePickType(newType, (Point *)NULL, newWidth);
|
||||
if (WireType == oldType)
|
||||
{
|
||||
TxError("The new wiring layer is the same as the old one, so\n");
|
||||
|
|
@ -1001,7 +1020,8 @@ WireAddContact(newType, newWidth)
|
|||
*/
|
||||
|
||||
SelectClear();
|
||||
scx.scx_use = wireFindRootUse(EditRootDef);
|
||||
w = wireFindRootWindow(EditRootDef);
|
||||
scx.scx_use = w->w_surfaceID;
|
||||
if (scx.scx_use != NULL)
|
||||
{
|
||||
scx.scx_trans = GeoIdentityTransform;
|
||||
|
|
@ -1063,7 +1083,7 @@ WireButtonProc(w, cmd)
|
|||
switch (cmd->tx_button)
|
||||
{
|
||||
case TX_LEFT_BUTTON:
|
||||
WirePickType(-1, 0);
|
||||
WirePickType(-1, (Point *)NULL, 0);
|
||||
break;
|
||||
case TX_RIGHT_BUTTON:
|
||||
WireAddLeg((Rect *) NULL, (Point *) NULL, WIRE_CHOOSE);
|
||||
|
|
|
|||
Loading…
Reference in New Issue