chiark / gitweb /
where-vessels: Use grid for smashing too
authorIan Jackson <ian@liberator.relativity.greenend.org.uk>
Sun, 8 Aug 2010 11:51:10 +0000 (12:51 +0100)
committerIan Jackson <ian@liberator.relativity.greenend.org.uk>
Sun, 8 Aug 2010 11:52:26 +0000 (12:52 +0100)
yarrg/where-vessels

index d6ce007785919ea21f67911f8d1532ac9bcc018f..b6ca822e59688b54c74eee3145790d2a8c08c6e5 100755 (executable)
@@ -453,10 +453,12 @@ proc smash-code {code} {
     return [join [list $inport $class $subclass $lockown $xabbrev] _]
 }
 
-proc make-radio-smasher {w label variable descs} {
-    frame $w
-    label $w.label -text $label
-    pack $w.label -side left
+proc make-smasher {sma label ekind} {
+    return [make-gridded-control .smash $sma $label $ekind]
+}
+
+proc make-radio-smasher {sma label variable descs} {
+    set w [make-smasher $sma $label frame]
     for {set i 0} {$i < [llength $descs]} {incr i} {
        radiobutton $w.v$i \
            -variable $variable -value $i -command redraw-needed \
@@ -526,7 +528,7 @@ proc filter-tickbox-flip {fil} {
 
 proc make-tickbox-filter {fil label rows inrow} {
     upvar #0 filter_$fil vars
-    set fw [make-filter tickbox $fil $label frame]
+    set fw [make-filter $fil $label frame]
     set values [filter-values/$fil]
     set nvalues [llength $values]
     if {!$inrow} {
@@ -578,7 +580,7 @@ proc make-entry-filter {fil label def} {
     global filterentered_$fil
     upvar #0 filter_$fil realvar
     set realvar $def
-    set fw [make-filter entry $fil $label frame]
+    set fw [make-filter $fil $label frame]
     entry $fw.entry -textvariable filterentered_$fil
     label $fw.error
     glset def_background [$fw.error cget -background]
@@ -587,15 +589,21 @@ proc make-entry-filter {fil label def} {
     pack $fw.entry $fw.error -side top -anchor w
 }
 
-proc make-filter {kind fil label ekind} {
+proc make-gridded-control {parent name label ekind} {
+    debug "MAKE-GRIDDED-CONTROL [list $parent $name $label $ekind]"
+    label $parent.lab_$name -text $label -justify left
+    $ekind $parent.$name
+    manyset [grid size $parent] dummy row
+    incr row
+    grid configure $parent.lab_$name -row $row -column 0 -sticky nw -pady 4
+    grid configure $parent.$name -row $row -column 1 -sticky w -pady 3
+    return $parent.$name
+}
+
+proc make-filter {fil label ekind} {
     global filters
-    label .filter.lab_$fil -text $label -justify left
-    $ekind .filter.$fil
     lappend filters $fil
-    set nfilters [llength $filters]
-    grid configure .filter.lab_$fil -row $nfilters -column 0 -sticky nw -pady 4
-    grid configure .filter.$fil -row $nfilters -column 1 -sticky w -pady 3
-    return .filter.$fil
+    return [make-gridded-control .filter $fil $label $ekind]
 }
 
 proc make-filters {} {
@@ -1068,11 +1076,10 @@ proc widgets-setup {} {
     pack .cp .filter .islands .smash -side top
 
     label .smash.title -text Smash
-    pack .smash.title -side top
+    grid .smash.title -row 0 -column 0 -columnspan 2
 
-    make-radio-smasher .smash.subclass Subclass smash_subclass \
+    make-radio-smasher subclass Subclass smash_subclass \
        {Show Normal/LE Hide}
-    pack .smash.subclass -side top
 
     set filterstyle 1
     trace add variable filterstyle write filterstyle-changed