set scraper {./yppedia-ocean-scraper --chart}
set info_cache _vessel-info-cache
set info_source rsync.yarrg.chiark.net::yarrg/vessel-info
-set no_owners 0
+set filter_lockown_separate 0
proc parseargs {} {
global ai argv
--local-html-dir { lappend scraper --local-html-dir=[nextarg] }
--notes { glset notes_loc [nextarg] }
--vessel-info-source { glset info_source [nextarg] }
+ --filter-separate-lock-owner { glset filter_lockown_separate 1 }
--debug { incr debug }
default { badusage "unknown option $arg" }
}
if {[llength $argv]} { badusage "non-option args not allowed" }
}
+proc have-notes {} {
+ global notes_loc
+ return [string length $notes_loc]
+}
+
proc argdefaults {} {
global ocean notes_loc pirate scraper
if {![info exists ocean] ||
error "$ocean $pirate ?"
}
}
- if {![info exists pirate]} { set pirate {}; glset no_owners 1 }
- if {![string length $notes_loc]} { glset no_owners 1 }
+ if {![info exists pirate]} {
+ set pirate {}
+ glset filter_lockown_separate 1
+ }
+ if {![have-notes]} {
+ glset filter_lockown_separate 1
+ }
lappend scraper $ocean
}
{(All lock states)} {(Not battle ready)}
} $lock]
- global no_owners notes_loc
- if {!$no_owners} {
+ if {[have-notes]} {
switch -exact $notown {
0 { report-set own "Yours" }
1 { report-set own "Other pirate's" }
}
global smash_xabbrev_map
- if {![string length $notes_loc]} {
+ if {![have-notes]} {
} elseif {[llength $smash_xabbrev_map]} {
if {[string length $xabbrev]} {
report-set xabbrev "(Flags: $xabbrev)"
make-radio-smasher subclass Class smash_subclass \
{Show Normal/LE Hide} 1 0
- global no_owners
- glset smash_owner [expr {$no_owners ? 3 : 0}]
+ glset smash_owner [expr {[have-notes] ? 0 : 3}]
make-radio-smasher owner Owner smash_owner \
{Show Yours? {For you} Lock Hide} 2 3
return $yes
}
+proc filter-values/lock {} { return {0 1 2} }
+proc filter-icon/lock {lock} { return [code-lockown2icon ${lock}3] }
+proc filter-default/lock {lock} { return 1 }
+proc filter-says-yes/lock {codel} {
+ regexp {^.} [lindex $codel 3] lock
+ upvar #0 filter_lock($lock) yes
+ debug "FILTER-SAYS-YES/LOCK $codel $lock $yes"
+ return $yes
+}
+
+proc filter-values/own {} { return {0 1 2} }
+proc filter-icon/own {own} { return [code-lockown2icon 3${own}] }
+proc filter-default/own {own} { return 1 }
+proc filter-says-yes/own {codel} {
+ regexp {.$} [lindex $codel 3] own
+ upvar #0 filter_own($own) yes
+ debug "FILTER-SAYS-YES/OWN $codel $own $yes"
+ return $yes
+}
+
proc filter-values/lockown {} {
foreach lv {0 1 2} {
foreach ov {0 1 2} {
}
proc make-filters {} {
+ global filter_lockown_separate
make-tickbox-filter size Size 2 0
- make-tickbox-filter lockown "Lock/\nowner" 2 6
+ if {!$filter_lockown_separate} {
+ make-tickbox-filter lockown "Lock/\nowner" 2 6
+ } else {
+ make-tickbox-filter lock "Lock" 1 0
+ if {[have-notes]} {
+ make-tickbox-filter own "Owner" 1 0
+ }
+ }
make-entry-filter xabbre "Flags\n regexp" {}
}
#---------- main user interface ----------
proc widgets-setup {} {
- global canvas debug pirate ocean filterstyle notes_loc
+ global canvas debug pirate ocean filterstyle
wm geometry . 1200x800
if {[string length $pirate]} {
pack .cp.ctrl.notes -side top -pady 2
- if {![string length $notes_loc]} {
+ if {![have-notes]} {
.cp.ctrl.notes.do configure -state disabled
}
proc report-set {sw val} { .cp.report.details.$sw configure -text $val }
proc show-report {islandname code} {
- global no_owners
-
.cp.report.island configure -text $islandname
.cp.report.abbrev delete all
} else {
set owndesc "Owner unknown"
}
- if {!$no_owners} {
+ if {[have-notes]} {
.cp.report.list insert end "$owndesc:"
}
foreach name $owned($owner) {
puts stderr "$emsg\n$errorInfo"
exit 1
}
-if {[string length $notes_loc]} {
+if {[have-notes]} {
after idle invoke_notes
}