From: mdw Date: Mon, 3 Mar 2003 10:38:08 +0000 (+0000) Subject: Allow C-u to erase an entry box. Disallow coinicident planet choice in X-Git-Tag: 1.0.2~1 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~mdw/git/rocl/commitdiff_plain/1c647046e8e8ffaead06413834cfa3a9fc57a3dc?hp=b328fdbfdbd5acf9b90c4c1987b355ef95ef0440 Allow C-u to erase an entry box. Disallow coinicident planet choice in commander editor. Allow C-Return to bring up world info. --- diff --git a/elite-editor b/elite-editor index e92578e..46c689d 100755 --- a/elite-editor +++ b/elite-editor @@ -1,6 +1,6 @@ #! /usr/bin/wish # -# $Id: elite-editor,v 1.6 2003/03/02 12:28:14 mdw Exp $ +# $Id: elite-editor,v 1.7 2003/03/03 10:38:08 mdw Exp $ package require "elite" "1.0.0" @@ -272,11 +272,11 @@ proc show-shortest-path {seq weight} { # --- Planet information box --- -proc do-getinfo {tag seq x y} { +proc show-worldinfo {tag p} { global economy government upvar \#0 info-$tag info set tl .world-info-$tag - elite-worldinfo info [find-click $seq $x $y] + elite-worldinfo info $p if {[winfo exists $tl]} { # raise $tl } else { @@ -323,6 +323,10 @@ proc do-getinfo {tag seq x y} { $tl.desc configure -state disabled } +proc do-getinfo {tag seq x y} { + show-worldinfo $tag [find-click $seq $x $y] +} + # --- Messing with selections --- proc to-ly {seq x} { @@ -407,17 +411,30 @@ proc select-byname {seq name seed proc} { set p [parse-planet-spec $map(galaxy) $map($name)] if {![string equal $p ""] && [in-galaxy-p $map(galaxy) $p]} { $proc $seq $p + return 1 } elseif {[info exists map($seed)]} { bell set map($name) [worldname $map($seed)] + return 0 } else { bell set map($name) "" + return 0 + } +} + +proc info-byname {seq name seed proc} { + upvar \#0 map-$seq map + if {[select-byname $seq $name $seed $proc]} { + show-worldinfo $seed $map($seed) } } proc set-selection {seq p} { upvar \#0 map-$seq map + if {[info exists map(cmdr)]} { + set p [cmdr-set-world $map(cmdr) $p] + } set map(select) $p elite-worldinfo pp $p select-world $seq @@ -427,9 +444,6 @@ proc set-selection {seq p} { } else { set-destination $seq $map(dest) } - if {[info exists map(cmdr)]} { - cmdr-set-world $map(cmdr) $p - } } proc do-select {seq x y} { @@ -660,13 +674,17 @@ proc map-new {ng g} { bind $tl.map <3> [list do-select $seq %x %y] bind $tl.map <1> [list do-destination $seq %x %y] bind $tl.map [list do-getinfo dest $seq %x %y] - bind $tl.map [list do-getinfo home $seq %x %y] + bind $tl.map [list do-getinfo select $seq %x %y] map-set-title $seq entry-on-change $tl.info.home \ [list select-byname $seq sel-name select set-selection] entry-on-change $tl.info.dest \ [list select-byname $seq dest-name dest set-destination] + bind $tl.info.home \ + [list info-byname $seq sel-name select set-selection] + bind $tl.info.dest \ + [list info-byname $seq dest-name dest set-destination] map-setscale $seq $sc return $seq } @@ -804,12 +822,20 @@ proc cmdrdb-custom {seq tag} { proc cmdr-set-world {seq p} { upvar \#0 cmdr-$seq cmdr + upvar \#0 ww-$cmdr(gal-seed) ww elite-worldinfo i $p - set cmdr(world-seed) $p + set pp [nearest-planet $ww $i(x) $i(y)] + if {![string equal $p $pp]} { + set n $i(name) + elite-worldinfo i $pp + moan "world $n is coincident with $i(name); substituting" + } + set cmdr(world-seed) $i(seed) set cmdr(world-name) $i(name) set cmdr(world-x) [expr {$i(x)/4}] set cmdr(world-y) [expr {$i(y)/2}] cmdr-set-fluc $seq + return $i(seed) } proc cmdr-update-world {seq} { @@ -1164,6 +1190,8 @@ proc cmdr-new {} { wm withdraw . +bind Entry { %W delete 0 end } + if {[llength $argv]} { foreach a $argv { switch -glob -- $a {