X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/micropolis/blobdiff_plain/2b8964762fece215b12e606abfb75c325f93e27e..2647c123bd2f34f4147f06bed6f936cc122636e3:/res/whead.tcl?ds=sidebyside diff --git a/res/whead.tcl b/res/whead.tcl index f9b689e..2f568f1 100644 --- a/res/whead.tcl +++ b/res/whead.tcl @@ -80,8 +80,17 @@ set visual [winfo screenvisual $win] set depth [winfo screendepth $win] set screenwidth [winfo screenwidth $win] set screenheight [winfo screenheight $win] -#set screenwidth 1200 -#set screenheight 900 +set initialwidth 1200 +set initialheight 900 + +if {$screenwidth < $initialwidth} { + set initialwidth $screenwidth +} + +if {$screenheight < $initialheight} { + set initialheight $screenheight +} + if {!(("$visual" == "pseudocolor") || ("$visual" == "truecolor") || @@ -112,11 +121,11 @@ LinkWindow $win.ask {} tk_bindForTraversal $win bind $win {tk_firstMenu %W} -bind $win {tk_traverseToMenu %W %A} +bind $win {tk_traverseToMenu %W %A} wm title $win "Micropolis Controls" wm iconname $win {Micropolis Controls} -wm geometry $win 1200x900+0+0 +wm geometry $win ${initialwidth}x${initialheight}+0+0 #wm positionfrom $win user wm withdraw $win wm maxsize $win $screenwidth $screenheight @@ -142,7 +151,7 @@ frame $win.col1.w1.f1\ -relief raised tk_bindForTraversal $win.col1.w1.f1 bind $win.col1.w1.f1 {tk_firstMenu %W} -bind $win.col1.w1.f1 {tk_traverseToMenu %W %A} +bind $win.col1.w1.f1 {tk_traverseToMenu %W %A} SetHelp $win.col1.w1.f1.micropolis Head.MicropolisMenu @@ -153,7 +162,7 @@ menubutton $win.col1.w1.f1.micropolis\ -variable $win.postedMenu tk_bindForTraversal $win.col1.w1.f1.micropolis bind $win.col1.w1.f1.micropolis {tk_firstMenu %W} -bind $win.col1.w1.f1.micropolis {tk_traverseToMenu %W %A} +bind $win.col1.w1.f1.micropolis {tk_traverseToMenu %W %A} tk_menus $win $win.col1.w1.f1.micropolis @@ -161,7 +170,7 @@ menu $win.col1.w1.f1.micropolis.m\ -font [Font $win Medium] tk_bindForTraversal $win.col1.w1.f1.micropolis.m bind $win.col1.w1.f1.micropolis.m {tk_firstMenu %W} -bind $win.col1.w1.f1.micropolis.m {tk_traverseToMenu %W %A} +bind $win.col1.w1.f1.micropolis.m {tk_traverseToMenu %W %A} $win.col1.w1.f1.micropolis.m add command\ -label {About...}\ -command "UIShowPicture 300" @@ -192,7 +201,7 @@ menubutton $win.col1.w1.f1.options\ -variable $win.postedMenu tk_bindForTraversal $win.col1.w1.f1.options bind $win.col1.w1.f1.options {tk_firstMenu %W} -bind $win.col1.w1.f1.options {tk_traverseToMenu %W %A} +bind $win.col1.w1.f1.options {tk_traverseToMenu %W %A} tk_menus $win $win.col1.w1.f1.options @@ -200,7 +209,7 @@ menu $win.col1.w1.f1.options.m\ -font [Font $win Medium] tk_bindForTraversal $win.col1.w1.f1.options.m bind $win.col1.w1.f1.options.m {tk_firstMenu %W} -bind $win.col1.w1.f1.options.m {tk_traverseToMenu %W %A} +bind $win.col1.w1.f1.options.m {tk_traverseToMenu %W %A} $win.col1.w1.f1.options.m add checkbutton\ -label {Auto Budget}\ -variable AutoBudget\ @@ -239,7 +248,7 @@ menubutton $win.col1.w1.f1.disasters\ -variable $win.postedMenu tk_bindForTraversal $win.col1.w1.f1.disasters bind $win.col1.w1.f1.disasters {tk_firstMenu %W} -bind $win.col1.w1.f1.disasters {tk_traverseToMenu %W %A} +bind $win.col1.w1.f1.disasters {tk_traverseToMenu %W %A} tk_menus $win $win.col1.w1.f1.disasters @@ -247,7 +256,7 @@ menu $win.col1.w1.f1.disasters.m\ -font [Font $win Medium] tk_bindForTraversal $win.col1.w1.f1.disasters.m bind $win.col1.w1.f1.disasters.m {tk_firstMenu %W} -bind $win.col1.w1.f1.disasters.m {tk_traverseToMenu %W %A} +bind $win.col1.w1.f1.disasters.m {tk_traverseToMenu %W %A} $win.col1.w1.f1.disasters.m add command\ -label {Monster}\ -command "UIDisaster $win \"UIMakeMonster\" \"release a monster?\"" @@ -260,6 +269,11 @@ bind $win.col1.w1.f1.disasters.m {tk_traverseToMenu %W %A} $win.col1.w1.f1.disasters.m add command\ -label {Meltdown}\ -command "UIDisaster $win \"sim MakeMeltdown\" \"have a nuclear meltdown?\"" + if {[sim HasAirCrash]} { + $win.col1.w1.f1.disasters.m add command\ + -label {Air Crash}\ + -command "UIDisaster $win \"sim MakeAirCrash\" \"crash an airplane?\"" + } $win.col1.w1.f1.disasters.m add command\ -label {Tornado}\ -command "UIDisaster $win \"sim MakeTornado\" \"spin up a tornado?\"" @@ -276,7 +290,7 @@ menubutton $win.col1.w1.f1.priority\ -variable $win.postedMenu tk_bindForTraversal $win.col1.w1.f1.priority bind $win.col1.w1.f1.priority {tk_firstMenu %W} -bind $win.col1.w1.f1.priority {tk_traverseToMenu %W %A} +bind $win.col1.w1.f1.priority {tk_traverseToMenu %W %A} tk_menus $win $win.col1.w1.f1.priority @@ -284,7 +298,7 @@ menu $win.col1.w1.f1.priority.m\ -font [Font $win Medium] tk_bindForTraversal $win.col1.w1.f1.priority.m bind $win.col1.w1.f1.priority.m {tk_firstMenu %W} -bind $win.col1.w1.f1.priority.m {tk_traverseToMenu %W %A} +bind $win.col1.w1.f1.priority.m {tk_traverseToMenu %W %A} $win.col1.w1.f1.priority.m add radiobutton\ -label {Super Fast}\ -command {SetPriority 4}\ @@ -310,6 +324,10 @@ bind $win.col1.w1.f1.priority.m {tk_traverseToMenu %W %A} -command {SetPriority 0}\ -value {0}\ -variable Priority + $win.col1.w1.f1.priority.m add checkbutton\ + -label {Pause}\ + -command {TogglePause}\ + -variable Pause SetHelp $win.col1.w1.f1.windows Head.WindowsMenu @@ -320,7 +338,7 @@ menubutton $win.col1.w1.f1.windows\ -variable $win.postedMenu tk_bindForTraversal $win.col1.w1.f1.windows bind $win.col1.w1.f1.windows {tk_firstMenu %W} -bind $win.col1.w1.f1.windows {tk_traverseToMenu %W %A} +bind $win.col1.w1.f1.windows {tk_traverseToMenu %W %A} tk_menus $win $win.col1.w1.f1.windows @@ -328,7 +346,7 @@ menu $win.col1.w1.f1.windows.m\ -font [Font $win Medium] tk_bindForTraversal $win.col1.w1.f1.windows.m bind $win.col1.w1.f1.windows.m {tk_firstMenu %W} -bind $win.col1.w1.f1.windows.m {tk_traverseToMenu %W %A} +bind $win.col1.w1.f1.windows.m {tk_traverseToMenu %W %A} $win.col1.w1.f1.windows.m add command\ -label {Budget}\ -command "UIShowBudgetAndWait" @@ -516,7 +534,7 @@ frame $win.col1.w1.f2.f2\ -relief flat tk_bindForTraversal $win.col1.w1.f2.f2 bind $win.col1.w1.f2.f2 {tk_firstMenu %W} -bind $win.col1.w1.f2.f2 {tk_traverseToMenu %W %A} +bind $win.col1.w1.f2.f2 {tk_traverseToMenu %W %A} SetHelp $win.col1.w1.f2.f2 Head.Log @@ -526,13 +544,15 @@ scrollbar $win.col1.w1.f2.f2.scroll\ SetHelp $win.col1.w1.f2.f2.scroll Head.Scrollbar +global EventLines + text $win.col1.w1.f2.f2.text \ -yscroll "$win.col1.w1.f2.f2.scroll set" \ -borderwidth 1 \ -relief sunken \ -wrap word \ -state disabled \ - -height 5 \ + -height $EventLines \ -font [Font $win Text] LinkWindow $win.text $win.col1.w1.f2.f2.text @@ -558,7 +578,7 @@ if {[sim MultiPlayerMode]} { -relief flat tk_bindForTraversal $win.col1.w1.f2.f3 bind $win.col1.w1.f2.f3 {tk_firstMenu %W} - bind $win.col1.w1.f2.f3 {tk_traverseToMenu %W %A} + bind $win.col1.w1.f2.f3 {tk_traverseToMenu %W %A} button $win.col1.w1.f2.f3.chat \ -font [Font $win Large] \ @@ -581,7 +601,7 @@ if {[sim MultiPlayerMode]} { set $win.col1.w1.f2.f3.entry.value "" tk_bindForTraversal $win.col1.w1.f2.f3.entry bind $win.col1.w1.f2.f3.entry {tk_firstMenu %W} - bind $win.col1.w1.f2.f3.entry {tk_traverseToMenu %W %A} + bind $win.col1.w1.f2.f3.entry {tk_traverseToMenu %W %A} bind $win.col1.w1.f2.f3.entry "DoEnterMessage %W %W.value" bind $win.col1.w1.f2.f3.entry "DoEvalMessage %W %W.value" bind $win.col1.w1.f2.f3.entry {focus %W} @@ -656,7 +676,7 @@ place configure $win.col1\ -x 0\ -y 0\ -width $HeadPanelWidth\ - -height $screenheight + -relheight 1.0 pack append $win.col1\ $win.col1.w1 {top frame nw fillx} \ @@ -685,7 +705,16 @@ place configure $win.col2\ -x [expr "$HeadPanelWidth + 5"]\ -y 0\ -relheight 1.0\ - -relwidth 1.0 + -width [expr "($screenwidth - $HeadPanelWidth) - 5"] + +proc resizeeditor {win width} { + global HeadPanelWidth + + place configure $win.col2\ + -width [expr "($width - $HeadPanelWidth) - 5"] +} + +bind $win "resizeeditor $win %w" #pack append $win.col2\ # $win.col2.x1 {top frame nw fillx} \