summaryrefslogtreecommitdiff
path: root/lib/tcl/symbol.tcl
diff options
context:
space:
mode:
authorRuben Undheim <ruben.undheim@gmail.com>2018-10-20 17:54:32 +0200
committerRuben Undheim <ruben.undheim@gmail.com>2018-10-20 17:54:32 +0200
commitca2442640f4394296d9d6b0c42d41d399dbf9667 (patch)
tree879c0a6065d6982d5a82b35dc3ff67299e2ea7d9 /lib/tcl/symbol.tcl
parent04d5d0ea0f65a434e568fe031f6396caec9b3a8d (diff)
New upstream version 3.9.73+dfsg.1
Diffstat (limited to 'lib/tcl/symbol.tcl')
-rw-r--r--lib/tcl/symbol.tcl126
1 files changed, 60 insertions, 66 deletions
diff --git a/lib/tcl/symbol.tcl b/lib/tcl/symbol.tcl
index 8197978..9198205 100644
--- a/lib/tcl/symbol.tcl
+++ b/lib/tcl/symbol.tcl
@@ -34,6 +34,7 @@ proc xcircuit::getsubckttext {name} {
}
}
}
+ deselect selected
return ""
}
@@ -57,8 +58,8 @@ proc xcircuit::makesymbol {{filename ""} {orderedpins ""}} {
config suspend true ;# suspend graphics and change count
- set techname [.dialog.techself.techselect cget -text]
- set symbolname [.dialog.textent.txt get]
+ set techname [.makesymbol.techself.techselect cget -text]
+ set symbolname [.makesymbol.textent.txt get]
if {[string length $symbolname] == 0} {
set symbolname [page label]
if {[string length $symbolname] == 0 || [string first "Page " $symbolname] >= 0} {
@@ -80,6 +81,7 @@ proc xcircuit::makesymbol {{filename ""} {orderedpins ""}} {
# Therefore, create an object but don't use xcircuit::symbol
if {$filename == ""} {
+ deselect selected
xcircuit::symbol make ${techname}${symbolname} $XCOps(library);
set schematicname [schematic get]
set noschem 0
@@ -98,10 +100,10 @@ proc xcircuit::makesymbol {{filename ""} {orderedpins ""}} {
foreach j $oldpinlabels {
delete $j
}
- set leftpins [.dialog.pinself.left.list index end]
- set toppins [.dialog.pinself.top.list index end]
- set rightpins [.dialog.pinself.right.list index end]
- set botpins [.dialog.pinself.bottom.list index end]
+ set leftpins [.makesymbol.pinself.left.list index end]
+ set toppins [.makesymbol.pinself.top.list index end]
+ set rightpins [.makesymbol.pinself.right.list index end]
+ set botpins [.makesymbol.pinself.bottom.list index end]
set hpins $leftpins
if {$rightpins > $leftpins} {set hpins $rightpins}
@@ -135,14 +137,14 @@ proc xcircuit::makesymbol {{filename ""} {orderedpins ""}} {
for {set j 0} {$j < $rightpins} {incr j} {
set tabx [expr $x - $qtrspace]
polygon make 2 "$x $y" "$tabx $y"
- set pintext [.dialog.pinself.right.list get $j]
+ set pintext [.makesymbol.pinself.right.list get $j]
lappend pinlabels $pintext
set tlab [label make pin "$pintext" "$x $y"]
- label $tlab justify left
- label $tlab justify middle
+ label $tlab anchor left
+ label $tlab anchor middle
set nlab [element $tlab copy relative "-$halfspace 0"]
label $nlab type normal
- label $nlab justify right
+ label $nlab anchor right
incr y $pinspace
deselect selected
}
@@ -151,14 +153,14 @@ proc xcircuit::makesymbol {{filename ""} {orderedpins ""}} {
for {set j 0} {$j < $leftpins} {incr j} {
set tabx [expr $x + $qtrspace]
polygon make 2 "$x $y" "$tabx $y"
- set pintext [.dialog.pinself.left.list get $j]
+ set pintext [.makesymbol.pinself.left.list get $j]
lappend pinlabels $pintext
set tlab [label make pin "$pintext" "$x $y"]
- label $tlab justify right
- label $tlab justify middle
+ label $tlab anchor right
+ label $tlab anchor middle
set nlab [element $tlab copy relative "$halfspace 0"]
label $nlab type normal
- label $nlab justify left
+ label $nlab anchor left
incr y $pinspace
deselect selected
}
@@ -167,15 +169,15 @@ proc xcircuit::makesymbol {{filename ""} {orderedpins ""}} {
for {set j 0} {$j < $botpins} {incr j} {
set taby [expr $y + $qtrspace]
polygon make 2 "$x $y" "$x $taby"
- set pintext [.dialog.pinself.bottom.list get $j]
+ set pintext [.makesymbol.pinself.bottom.list get $j]
lappend pinlabels $pintext
set tlab [label make pin "$pintext" "$x $y"]
rotate $tlab 270
- label $tlab justify right
- label $tlab justify middle
+ label $tlab anchor right
+ label $tlab anchor middle
set nlab [element $tlab copy relative "0 $halfspace"]
label $nlab type normal
- label $nlab justify left
+ label $nlab anchor left
incr x $pinspace
deselect selected
}
@@ -184,23 +186,23 @@ proc xcircuit::makesymbol {{filename ""} {orderedpins ""}} {
for {set j 0} {$j < $toppins} {incr j} {
set taby [expr $y - $qtrspace]
polygon make 2 "$x $y" "$x $taby"
- set pintext [.dialog.pinself.top.list get $j]
+ set pintext [.makesymbol.pinself.top.list get $j]
lappend pinlabels $pintext
set tlab [label make pin "$pintext" "$x $y"]
rotate $tlab 90
- label $tlab justify right
- label $tlab justify middle
+ label $tlab anchor right
+ label $tlab anchor middle
set nlab [element $tlab copy relative "0 -$halfspace"]
label $nlab type normal
- label $nlab justify left
+ label $nlab anchor left
incr x $pinspace
deselect selected
}
deselect selected
set nlab [label make "$symbolname" {0 0}]
- label $nlab justify middle
- label $nlab justify center
+ label $nlab anchor middle
+ label $nlab anchor center
element $nlab color set blue
deselect selected
@@ -213,7 +215,7 @@ proc xcircuit::makesymbol {{filename ""} {orderedpins ""}} {
}
set nlab [label make "{Parameter class} {Parameter index}" "0 -$pinspace"]
- label $nlab justify center
+ label $nlab anchor center
element $nlab color set blue
deselect selected
@@ -245,7 +247,7 @@ proc xcircuit::makesymbol {{filename ""} {orderedpins ""}} {
set x [expr ([lindex $bbox 2] + [lindex $bbox 0]) / 2]
set y [expr [lindex $bbox 1] - $pinspace]
set nlab [label make info "$subckttext" "$x $y"]
- label $nlab justify center
+ label $nlab anchor center
deselect selected
set y [expr $y - $pinspace]
set nlab [label make info "spice-1:.ends" "$x $y"]
@@ -283,7 +285,7 @@ proc xcircuit::makesymbol {{filename ""} {orderedpins ""}} {
deselect selected
set nlab [label make info "$itext" "0 $y"]
- label $nlab justify center
+ label $nlab anchor center
if {$noschem == 1} {
deselect selected
@@ -294,7 +296,7 @@ proc xcircuit::makesymbol {{filename ""} {orderedpins ""}} {
set itext [list {Text "spice@1:%F"}]
lappend itext [subst {Text "$filename"}]
set nlab [label make info "$itext" "0 $y"]
- label $nlab justify center
+ label $nlab anchor center
deselect selected
pop
} else {
@@ -353,19 +355,19 @@ proc xcircuit::getpinlist {schematicname} {
#---------------------------------------------------------------------------
proc xcircuit::getselectedpinwidget {} {
- set w .dialog.pinself.left.list
+ set w .makesymbol.pinself.left.list
set result [$w curselection]
if {$result != {}} {return $w}
- set w .dialog.pinself.top.list
+ set w .makesymbol.pinself.top.list
set result [$w curselection]
if {$result != {}} {return $w}
- set w .dialog.pinself.right.list
+ set w .makesymbol.pinself.right.list
set result [$w curselection]
if {$result != {}} {return $w}
- set w .dialog.pinself.bottom.list
+ set w .makesymbol.pinself.bottom.list
set result [$w curselection]
if {$result != {}} {return $w}
}
@@ -392,7 +394,7 @@ proc xcircuit::movepinleft {} {
set idx [$w curselection]
set pinname [$w get $idx]
$w delete $idx
- .dialog.pinself.left.list insert end $pinname
+ .makesymbol.pinself.left.list insert end $pinname
$w selection set $idx
}
}
@@ -407,7 +409,7 @@ proc xcircuit::movepintop {} {
set idx [$w curselection]
set pinname [$w get $idx]
$w delete $idx
- .dialog.pinself.top.list insert end $pinname
+ .makesymbol.pinself.top.list insert end $pinname
$w selection set $idx
}
@@ -423,7 +425,7 @@ proc xcircuit::movepinright {} {
set idx [$w curselection]
set pinname [$w get $idx]
$w delete $idx
- .dialog.pinself.right.list insert end $pinname
+ .makesymbol.pinself.right.list insert end $pinname
$w selection set $idx
}
}
@@ -438,7 +440,7 @@ proc xcircuit::movepinbottom {} {
set idx [$w curselection]
set pinname [$w get $idx]
$w delete $idx
- .dialog.pinself.bottom.list insert end $pinname
+ .makesymbol.pinself.bottom.list insert end $pinname
$w selection set $idx
}
}
@@ -491,6 +493,8 @@ proc xcircuit::addpinarranger {w {pinlist {}}} {
# If so, we pass the ordered list to the symbol construction routine, and
# we also prevent symbol pins from being deleted.
+ config suspend true ;# suspend graphics and change count
+
if {$pinlist == {}} {
set pinlist [xcircuit::getpinlist [page label]]
if {[xcircuit::getsubckttext [page label]] != {}} {
@@ -543,6 +547,7 @@ proc xcircuit::addpinarranger {w {pinlist {}}} {
button ${w}.bbar.movebottom -text "Move Bottom" -bg beige -command \
{xcircuit::movepinbottom}
}
+ config suspend false
if {$orderedpins == 0} {
pack ${w}.bbar.remove -side left -ipadx 10
@@ -570,37 +575,26 @@ proc xcircuit::removepinarranger {w} {
}
#---------------------------------------------------------------------------
-# Redefine popupdialog to remove the pin arranger any time it is invoked.
-#---------------------------------------------------------------------------
-
-proc xcircuit::popupdialog {} {
- xcircuit::removepinarranger .dialog
- xcircuit::removelists .dialog
- wm deiconify .dialog
- focus .dialog.textent.txt
-}
-
-#---------------------------------------------------------------------------
# Redefine the procedure for the "Make Matching Symbol" menu button.
#---------------------------------------------------------------------------
proc xcircuit::promptmakesymbol {{name ""}} {
global XCOps
- .dialog.bbar.okay configure -command \
+ .makesymbol.bbar.okay configure -command \
{if {[string first "Page " [page label]] >= 0} { \
- page label [.dialog.textent.txt get]}; \
+ page label [.makesymbol.textent.txt get]}; \
xcircuit::makesymbol; \
- wm withdraw .dialog}
- .dialog.textent.title.field configure -text "Confirm symbol name:"
- .dialog.textent.txt delete 0 end
+ wm withdraw .makesymbol}
+ .makesymbol.textent.title.field configure -text "Confirm symbol name:"
+ .makesymbol.textent.txt delete 0 end
if {[string length $name] == 0 && [string first "Page " [page label]] < 0} {
set name [page label]}
- .dialog.textent.txt insert 0 $name
+ .makesymbol.textent.txt insert 0 $name
- xcircuit::popupdialog
- xcircuit::addtechlist .dialog "Technology: "
- xcircuit::addliblist .dialog "Place in: "
- xcircuit::addpinarranger .dialog
+ xcircuit::popupdialog .makesymbol
+ xcircuit::addtechlist .makesymbol "Technology: "
+ xcircuit::addliblist .makesymbol "Place in: "
+ xcircuit::addpinarranger .makesymbol
}
#---------------------------------------------------------------------------
@@ -631,17 +625,17 @@ proc xcircuit::spice2symbol {filename {subcktname ""}} {
if {[string length $infolabel] == 0} {return}
set pinlabels [lrange $infolabel 2 end]
- .dialog.bbar.okay configure -command \
+ .makesymbol.bbar.okay configure -command \
"if {[string first {Page } [page label]] >= 0} { \
- page label [.dialog.textent.txt get]}; \
+ page label [.makesymbol.textent.txt get]}; \
xcircuit::makesymbol $filename [list $pinlabels]; \
- wm withdraw .dialog"
- .dialog.textent.title.field configure -text "Confirm symbol name:"
- .dialog.textent.txt delete 0 end
- .dialog.textent.txt insert 0 [lindex $infolabel 1]
- xcircuit::popupdialog
- xcircuit::addliblist .dialog "Place in: "
- xcircuit::addpinarranger .dialog $pinlabels
+ wm withdraw .makesymbol"
+ .makesymbol.textent.title.field configure -text "Confirm symbol name:"
+ .makesymbol.textent.txt delete 0 end
+ .makesymbol.textent.txt insert 0 [lindex $infolabel 1]
+ xcircuit::popupdialog .makesymbol
+ xcircuit::addliblist .makesymbol "Place in: "
+ xcircuit::addpinarranger .makesymbol $pinlabels
}
#---------------------------------------------------------------------------