diff --git a/VERSION b/VERSION index 52d450f7..5173f581 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -8.3.595 +8.3.596 diff --git a/commands/CmdTZ.c b/commands/CmdTZ.c index fb7ded04..f14b6eab 100644 --- a/commands/CmdTZ.c +++ b/commands/CmdTZ.c @@ -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", diff --git a/tcltk/tools.tcl b/tcltk/tools.tcl index b646393f..20e271dc 100644 --- a/tcltk/tools.tcl +++ b/tcltk/tools.tcl @@ -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} [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} ] + bind ${window} [subst {$Opts(motion); *bypass wire show}] + if {$Opts(motion) == {}} {set Opts(motion) "null"} + cursor 21 } } else { if {$option != "cancel"} { diff --git a/windows/windCmdAM.c b/windows/windCmdAM.c index a4fa9747..a7d76dcb 100644 --- a/windows/windCmdAM.c +++ b/windows/windCmdAM.c @@ -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; + } } }