chiark / gitweb /
where-vessels: factor out make-smashers
[ypp-sc-tools.db-test.git] / yarrg / where-vessels
index 57ab56a51a77d9a16971b584f5900532629112d7..97e5e6c0801a2119395f30a954610afa95e895cf 100755 (executable)
@@ -536,16 +536,31 @@ proc make-smasher {sma label ekind} {
     return [make-control .smash $sma $label $ekind]
 }
 
-proc make-radio-smasher {sma label variable descs} {
+proc make-radio-smasher {sma label variable descs rows inrow} {
     set w [make-smasher $sma $label frame]
+    begin-control-grid $w [llength $descs] $rows $inrow
     for {set i 0} {$i < [llength $descs]} {incr i} {
-       radiobutton $w.v$i \
+       make-control-grid-entry $w ix $i \
+           radiobutton \
            -variable $variable -value $i -command redraw-needed \
            -text [lindex $descs $i]
-       pack $w.v$i -side left
     }
 }
 
+proc make-smashers {} {
+    make-radio-smasher subclass Subclass smash_subclass \
+       {Show Normal/LE Hide} 1 0
+
+    make-radio-smasher owner Owner smash_owner \
+       {Show Yours? {For you} Lock Hide} 2 3
+
+    global vc_codes vc_code2abbrev
+
+    set cw [make-smasher size "Size\nround down" frame]
+    populate-control-grid-tickboxes $cw 2 0 smash_size $vc_codes \
+       image val { return 0 } { return $vc_code2abbrev($val) }
+}
+
 #---------- filtering ----------
 
 set filters {}
@@ -1144,7 +1159,7 @@ proc islandnames-handler {offset maxchars} {
 proc widgets-setup {} {
     global canvas debug pirate ocean filterstyle
 
-    wm geometry . 1024x600
+    wm geometry . 1200x800
     wm title . "where-vessels - $pirate on the $ocean ocean"
 
     #----- map -----
@@ -1163,15 +1178,9 @@ proc widgets-setup {} {
     frame .islands -pady 2
     pack .cp .filter .islands .smash -side top
 
-    label .smash.title -text Smash
+    label .smash.title -text {Display/combine details}
     grid .smash.title -row 0 -column 0 -columnspan 2
 
-    make-radio-smasher subclass Subclass smash_subclass \
-       {Show Normal/LE Hide}
-
-    make-radio-smasher owner Owner smash_owner \
-       {Show Yours? You Lock Hide}
-
     set filterstyle 1
     trace add variable filterstyle write filterstyle-changed
 
@@ -1354,6 +1363,7 @@ vesselclasses-init
 load-chart
 widgets-setup
 make-filters
+make-smashers
 
 set notes_data {}
 if {[catch { parse-clipboard } emsg]} {
@@ -1364,4 +1374,11 @@ after idle invoke_notes
 
 draw
 
+if {$debug} {
+    package require Tclx
+    commandloop -async \
+       -prompt1 { return "where-vessels% " } \
+       -prompt2 { return "> " }
+}
+
 # rsync -r --exclude=\*~ yarrg/icons/. ijackson@chiark.greenend.org.uk:/home/ftp/users/ijackson/yarrg/vessel-info/.