chiark / gitweb /
where-vessels: a few more disablements in the ui if cannot down "is ours?"
authorIan Jackson <ian@liberator.relativity.greenend.org.uk>
Sun, 8 Aug 2010 19:43:31 +0000 (20:43 +0100)
committerIan Jackson <ian@liberator.relativity.greenend.org.uk>
Sun, 8 Aug 2010 19:59:57 +0000 (20:59 +0100)
yarrg/where-vessels

index 9005a7f9032c9dadd15e5d1da71d39e6ad140634..6b46b89cce62924a89150bcd2aa746e7e71c8dab 100755 (executable)
@@ -135,6 +135,9 @@ proc have-notes {} {
     global notes_loc
     return [string length $notes_loc]
 }
     global notes_loc
     return [string length $notes_loc]
 }
+proc have-ownership {} {
+    return [expr {[have-notes] && [string length $pirate]}]
+}
 
 proc argdefaults {} {
     global ocean notes_loc pirate scraper
 
 proc argdefaults {} {
     global ocean notes_loc pirate scraper
@@ -150,7 +153,6 @@ proc argdefaults {} {
     }
     if {![info exists pirate]} {
        set pirate {}
     }
     if {![info exists pirate]} {
        set pirate {}
-       glset filter_lockown_separate 1
     }
     if {![have-notes]} {
        glset filter_lockown_separate 1
     }
     if {![have-notes]} {
        glset filter_lockown_separate 1
@@ -654,6 +656,7 @@ proc make-radio-smasher {sma label variable descs rows inrow} {
            -command [list redraw-needed radio-smasher $sma] \
            -text [lindex $descs $i]
     }
            -command [list redraw-needed radio-smasher $sma] \
            -text [lindex $descs $i]
     }
+    return $w
 }
 
 proc make-smashers {} {
 }
 
 proc make-smashers {} {
@@ -669,9 +672,12 @@ proc make-smashers {} {
     make-radio-smasher subclass Class smash_subclass \
        {Show Normal/LE Hide} 1 0
 
     make-radio-smasher subclass Class smash_subclass \
        {Show Normal/LE Hide} 1 0
 
-    glset smash_owner [expr {[have-notes] ? 0 : 3}]
-    make-radio-smasher owner "Lock/\nowner" smash_owner \
-       {Show Yours? {For you} Lock Hide} 2 3
+    glset smash_owner [expr {[have-ownership] ? 0 : 3}]
+    set cw [make-radio-smasher owner "Lock/\nowner" smash_owner \
+               {Show Yours? {For you} Lock Hide} 2 3]
+    if {![have-ownership]} {
+       foreach ix {1 2} { $cw.$ix configure -state disabled }
+    }
 
     set cw [make-smasher xabbrev "Flags" frame]
     foreach ix {1 3} ab {a b} width {14 12} {
 
     set cw [make-smasher xabbrev "Flags" frame]
     foreach ix {1 3} ab {a b} width {14 12} {
@@ -1339,18 +1345,21 @@ proc widgets-setup {} {
     label .smash.title -text {Display/combine details}
     grid .smash.title -row 0 -column 0 -columnspan 2
 
     label .smash.title -text {Display/combine details}
     grid .smash.title -row 0 -column 0 -columnspan 2
 
-    set filterstyle 1
+    set filterstyle [expr {[have-ownership] ? 1 : 3}]
     trace add variable filterstyle write filterstyle-changed
 
     frame .filter.title
     label .filter.title.title -text Show
     pack .filter.title.title -side left
     trace add variable filterstyle write filterstyle-changed
 
     frame .filter.title
     label .filter.title.title -text Show
     pack .filter.title.title -side left
-    for {set fing 0} {$fing < 4} {incr fing} {
+    foreach fing {0 1 2 3} {
        radiobutton .filter.title.f$fing \
            -variable filterstyle -value $fing \
            -text [lindex {All Useable Mine These:} $fing]
        pack .filter.title.f$fing -side left
     }
        radiobutton .filter.title.f$fing \
            -variable filterstyle -value $fing \
            -text [lindex {All Useable Mine These:} $fing]
        pack .filter.title.f$fing -side left
     }
+    if {![have-ownership]} {
+       foreach fing {1 2} { .filter.title.f$fing configure -state disabled }
+    }
 
     grid configure .filter.title -row 0 -column 0 -columnspan 2
 
 
     grid configure .filter.title -row 0 -column 0 -columnspan 2