Added a feature to the wiring tool so that "Control_Button1"

(Ctrl key + left mouse button) will start a wire at the current
cursor position with the wire values set by "wire type" and
reported by "wire values".  So "wire type metal1 0.28um" will
always start a 0.28um wide wire of metal1 regardless of what is
present at the cursor location.
This commit is contained in:
R. Timothy Edwards 2026-01-27 11:49:33 -05:00
parent 0cbed6078a
commit 512400e39f
4 changed files with 64 additions and 33 deletions

View File

@ -1 +1 @@
8.3.595
8.3.596

View File

@ -1887,10 +1887,10 @@ CmdWire(
wdisp = DBWPrintValue(width, w, TRUE);
#ifdef MAGIC_WRAPPER
lobj = Tcl_NewListObj(0, NULL);
Tcl_ListObjAppendElement(magicinterp, lobj,
Tcl_NewStringObj(wdisp, -1));
Tcl_ListObjAppendElement(magicinterp, lobj,
Tcl_NewStringObj(DBTypeLongNameTbl[type], -1));
Tcl_ListObjAppendElement(magicinterp, lobj,
Tcl_NewStringObj(wdisp, -1));
Tcl_SetObjResult(magicinterp, lobj);
#else
TxPrintf("Wire layer %s, width %s\n",

View File

@ -534,6 +534,7 @@ proc magic::enable_tools {} {
magic::macro copy pick
magic::tool wiring
macro Control_Button1 "magic::trackwire %W current"
macro Button1 "magic::trackwire %W pick"
macro Button2 "magic::trackwire %W done"
macro Button3 "magic::trackwire %W cancel"
@ -587,6 +588,19 @@ proc magic::trackwire {window {option {}}} {
bind ${window} <Motion> [subst {$Opts(motion); *bypass wire show}]
if {$Opts(motion) == {}} {set Opts(motion) "null"}
cursor 21
} elseif {$option == "current"} {
puts stdout $window
set curunits [units]
units internal
wire type {*}[wire values]
set wiresize [lindex [wire values] 1]
box size $wiresize $wiresize
box move bl cursor
units {*}$curunits
set Opts(motion) [bind ${window} <Motion>]
bind ${window} <Motion> [subst {$Opts(motion); *bypass wire show}]
if {$Opts(motion) == {}} {set Opts(motion) "null"}
cursor 21
}
} else {
if {$option != "cancel"} {

View File

@ -440,16 +440,29 @@ windCrashCmd(w, cmd)
* Side effects:
* Prints coordinates (non-Tcl version)
* Return value set to the cursor position as a list (Tcl version)
*
* NOTE: "box position {*}[cursor]" will produce the wrong result if
* "units" have been left as default, because "cursor" will generate
* internal values and "box position" will expect lambda values. Use
* "box move bl cursor" instead.
* ----------------------------------------------------------------------------
*/
#define CURSOR_INTERNAL 0
#define CURSOR_LAMBDA 1
#define CURSOR_USER 2
#define CURSOR_GRID 3
#define CURSOR_MICRONS 4
#define CURSOR_WINDOW 5
#define CURSOR_SCREEN 6
void
windCursorCmd(w, cmd)
MagWindow *w;
TxCommand *cmd;
{
Point p_in, p_out;
int resulttype, saveunits;
int resulttype, saveunits, idx;
double cursx, cursy, oscale;
char *dispx, *dispy;
DBWclientRec *crec;
@ -458,6 +471,10 @@ windCursorCmd(w, cmd)
Tcl_Obj *listxy;
#endif
static const char * const cmdCursorOption[] =
{ "internal", "lambda", "user", "grid", "microns", "window", "screen",
"units", 0 };
/* The original behavior was to use internal
* units by default. This remains the case
* unless units are set with the "units"
@ -477,35 +494,35 @@ windCursorCmd(w, cmd)
(*GrSetCursorPtr)(atoi(cmd->tx_argv[1]));
return;
}
else if (*cmd->tx_argv[1] == 'i')
{
resulttype = DBW_UNITS_INTERNAL;
}
else if (*cmd->tx_argv[1] == 'l')
{
resulttype = DBW_UNITS_LAMBDA;
}
else if (*cmd->tx_argv[1] == 'u')
{
resulttype = DBW_UNITS_USER;
}
else if (*cmd->tx_argv[1] == 'm')
{
resulttype = DBW_UNITS_MICRONS;
}
else if (*cmd->tx_argv[1] == 'w')
{
resulttype = -1; // Use this value for "window"
}
else if (*cmd->tx_argv[1] == 's')
{
resulttype = -2; // Use this value for "screen"
}
else
{
TxError("Usage: cursor glyphnum\n");
TxError(" (or): cursor [internal | lambda | microns | user | window]\n");
return;
else {
idx = Lookup(cmd->tx_argv[1], cmdCursorOption);
switch (idx)
{
case CURSOR_INTERNAL:
resulttype = DBW_UNITS_INTERNAL;
break;
case CURSOR_LAMBDA:
resulttype = DBW_UNITS_LAMBDA;
break;
case CURSOR_USER:
case CURSOR_GRID:
resulttype = DBW_UNITS_USER;
break;
case CURSOR_MICRONS:
resulttype = DBW_UNITS_MICRONS;
break;
case CURSOR_WINDOW:
resulttype = -1; // Use this value for "window"
break;
case CURSOR_SCREEN:
resulttype = -2; // Use this value for "screen"
break;
default:
TxError("Usage: cursor glyphnum\n");
TxError(" (or): cursor [internal | lambda | microns | user"
" | window | units]\n");
return;
}
}
}