set vc_game2code($game) $code
set vc_code2abbrev($code) $abbrev
set vc_code2full($code) $full
- image create bitmap ship-icon/$abbrev -file icons/$abbrev.xbm
+ load-icon $abbrev
}
+
+ load-icon unlocked
+ load-icon locked
+ load-icon battle
+ load-icon borrow
+ load-icon query
+ load-icon ours
+ load-icon dot
+}
+
+proc load-icon {icon} {
+ image create bitmap icon/$icon -file icons/$icon.xbm
}
proc code2abbrev-lock {lockown} {
append abbrev [lindex {= - ?} [regsub {\D} $notown 2]]
}
-proc canvas-horiz-stack {xvar y bind type args} {
+proc canvas-horiz-stack {xvar xoff y bind type args} {
upvar 1 $xvar x
upvar 1 canvas canvas
- set id [eval $canvas create $type $x $y $args]
+ set id [eval $canvas create $type [expr {$x+$xoff}] $y $args]
set bbox [$canvas bbox $id]
set x [lindex $bbox 2]
$canvas bind $id <ButtonPress> $bind
set stackx $x
incr stackx 2
+ set imy [expr {$y+2}]
append qty [lindex {? {}} $inport]
set qty [format "%${qtylen}s" $qty]
- set qtyid [canvas-horiz-stack stackx $y $bind \
+ set qtyid [canvas-horiz-stack stackx 0 $y $bind \
text -anchor nw -font fixed -text $qty]
- incr stackx -1
- canvas-horiz-stack stackx [expr {$y+2}] $bind \
- image -anchor nw -image ship-icon/$vc_code2abbrev($class)
- incr stackx
+ canvas-horiz-stack stackx -1 $imy $bind \
+ image -anchor nw -image icon/$vc_code2abbrev($class)
- canvas-horiz-stack stackx $y $bind \
- text -anchor nw -font fixed -text \
- "$subclass[code2abbrev-lock $lockown]$xabbrev"
+ if {[string length $subclass]} {
+ canvas-horiz-stack stackx 0 $y $bind \
+ text -anchor nw -font fixed -text \
+ $subclass
+ }
+
+ manyset [split $lockown ""] lock notown
+ incr stackx
+ canvas-horiz-stack stackx 0 $imy $bind \
+ image -anchor nw -image icon/[lindex {battle dot locked} $lock]
+ incr stackx
+ canvas-horiz-stack stackx 0 $imy $bind \
+ image -anchor nw -image icon/[lindex {ours dot query} \
+ [regsub {\D} $notown 2]]
+ incr stackx
+
+ if {[string length $xabbrev]} {
+ canvas-horiz-stack stackx 0 $y $bind \
+ text -anchor nw -font fixed -text \
+ $xabbrev
+ }
+
set bbox [$canvas bbox $qtyid]
set ny [lindex $bbox 3]
set bid [$canvas create rectangle \
proc filter-values/size {} { global vc_codes; return $vc_codes }
proc filter-icon/size {code} {
upvar #0 vc_code2abbrev($code) abb
- return ship-icon/$abb
+ return icon/$abb
}
proc filter-default/size {code} { return 1 }
proc filter-says-yes/size {codel} {