]> cvs.zerfleddert.de Git - micropolis/blob - res/wmap.tcl
src/tclx/ucbsrc/makefile: Micropolis build fixes for recent macOS
[micropolis] / res / wmap.tcl
1 # Windows: Maps, for Unix Micropolis.
2 #
3 # Micropolis, Unix Version. This game was released for the Unix platform
4 # in or about 1990 and has been modified for inclusion in the One Laptop
5 # Per Child program. Copyright (C) 1989 - 2007 Electronic Arts Inc. If
6 # you need assistance with this program, you may contact:
7 # http://wiki.laptop.org/go/Micropolis or email micropolis@laptop.org.
8 #
9 # This program is free software: you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation, either version 3 of the License, or (at
12 # your option) any later version.
13 #
14 # This program is distributed in the hope that it will be useful, but
15 # WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 # General Public License for more details. You should have received a
18 # copy of the GNU General Public License along with this program. If
19 # not, see <http://www.gnu.org/licenses/>.
20 #
21 # ADDITIONAL TERMS per GNU GPL Section 7
22 #
23 # No trademark or publicity rights are granted. This license does NOT
24 # give you any right, title or interest in the trademark SimCity or any
25 # other Electronic Arts trademark. You may not distribute any
26 # modification of this program using the trademark SimCity or claim any
27 # affliation or association with Electronic Arts Inc. or its employees.
28 #
29 # Any propagation or conveyance of this program must include this
30 # copyright notice and these terms.
31 #
32 # If you convey this program (or any modifications of it) and assume
33 # contractual liability for the program to recipients of it, you agree
34 # to indemnify Electronic Arts for any liability that those contractual
35 # assumptions impose on Electronic Arts.
36 #
37 # You may not misrepresent the origins of this program; modified
38 # versions of the program must be marked as such and not identified as
39 # the original program.
40 #
41 # This disclaimer supplements the one included in the General Public
42 # License. TO THE FULLEST EXTENT PERMISSIBLE UNDER APPLICABLE LAW, THIS
43 # PROGRAM IS PROVIDED TO YOU "AS IS," WITH ALL FAULTS, WITHOUT WARRANTY
44 # OF ANY KIND, AND YOUR USE IS AT YOUR SOLE RISK. THE ENTIRE RISK OF
45 # SATISFACTORY QUALITY AND PERFORMANCE RESIDES WITH YOU. ELECTRONIC ARTS
46 # DISCLAIMS ANY AND ALL EXPRESS, IMPLIED OR STATUTORY WARRANTIES,
47 # INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY, SATISFACTORY QUALITY,
48 # FITNESS FOR A PARTICULAR PURPOSE, NONINFRINGEMENT OF THIRD PARTY
49 # RIGHTS, AND WARRANTIES (IF ANY) ARISING FROM A COURSE OF DEALING,
50 # USAGE, OR TRADE PRACTICE. ELECTRONIC ARTS DOES NOT WARRANT AGAINST
51 # INTERFERENCE WITH YOUR ENJOYMENT OF THE PROGRAM; THAT THE PROGRAM WILL
52 # MEET YOUR REQUIREMENTS; THAT OPERATION OF THE PROGRAM WILL BE
53 # UNINTERRUPTED OR ERROR-FREE, OR THAT THE PROGRAM WILL BE COMPATIBLE
54 # WITH THIRD PARTY SOFTWARE OR THAT ANY ERRORS IN THE PROGRAM WILL BE
55 # CORRECTED. NO ORAL OR WRITTEN ADVICE PROVIDED BY ELECTRONIC ARTS OR
56 # ANY AUTHORIZED REPRESENTATIVE SHALL CREATE A WARRANTY. SOME
57 # JURISDICTIONS DO NOT ALLOW THE EXCLUSION OF OR LIMITATIONS ON IMPLIED
58 # WARRANTIES OR THE LIMITATIONS ON THE APPLICABLE STATUTORY RIGHTS OF A
59 # CONSUMER, SO SOME OR ALL OF THE ABOVE EXCLUSIONS AND LIMITATIONS MAY
60 # NOT APPLY TO YOU.
61 global MapWindows
62 set n [Unique]
63 set parent [WindowLink $head.w2]
64 set win $parent.map$n
65 set MapWindows [linsert $MapWindows 0 $win]
66
67 global MapState.$win
68 set MapState.$win 0
69
70 LinkWindow $head.map $win
71 LinkWindow $win.head $head
72 LinkWindow $win.parent $parent
73 LinkWindow $win.top $win
74
75 catch "destroy $win"
76 frame $win
77
78 SetHelp $win Map
79
80 bind $win <Visibility> {[WindowLink %W.view] Visible [string compare %s FullyObscured]}
81 bind $win <Map> {[WindowLink %W.view] Visible 1}
82 bind $win <Unmap> {[WindowLink %W.view] Visible 0}
83
84 frame $win.centerframe\
85 -borderwidth 1\
86 -relief sunken
87
88 SetHelp $win.centerframe Map.View
89
90 mapview $win.centerframe.view\
91 -font [Font $win Large]
92 $win.centerframe.view size [expr "[sim WorldX] * 3"] [expr "[sim WorldY] * 3"]
93
94 LinkWindow $win.view $win.centerframe.view
95 LinkWindow $win.centerframe.view.pallet $win.topframe
96 LinkWindow $win.centerframe.view.win $win
97
98 bind $win.centerframe.view <1> {MapPanDown %W %x %y}
99 bind $win.centerframe.view <B1-Motion> {MapPanDrag %W %x %y}
100 bind $win.centerframe.view <ButtonRelease-1> {MapPanUp %W %x %y}
101
102 bind $win.centerframe.view <2> {MapPanDown %W %x %y}
103 bind $win.centerframe.view <B2-Motion> {MapPanDrag %W %x %y}
104 bind $win.centerframe.view <ButtonRelease-2> {MapPanUp %W %x %y}
105
106 bind $win.centerframe.view <3> {MapPanDown %W %x %y}
107 bind $win.centerframe.view <B3-Motion> {MapPanDrag %W %x %y}
108 bind $win.centerframe.view <ButtonRelease-3> {MapPanUp %W %x %y}
109
110 pack append $win.centerframe\
111 $win.centerframe.view {top frame center expand}
112
113 frame $win.topframe\
114 -borderwidth 1\
115 -relief raised
116
117 menubutton $win.topframe.zones\
118 -menu $win.topframe.zones.m\
119 -text {Zones}\
120 -font [Font $win Medium]\
121 -variable $win.postedMenu\
122 -borderwidth 1\
123 -relief flat
124 LinkWindow $win.zones $win.topframe.zones
125 tk_bindForTraversal $win.topframe.zones
126 bind $win.topframe.zones <F10> {tk_firstMenu %W}
127 bind $win.topframe.zones <Alt-Key> {tk_traverseToMenu %W %A}
128 tk_menus $win $win.topframe.zones
129
130 SetHelp $win.topframe.zones Map.Zones
131
132 menu $win.topframe.zones.m\
133 -font [Font $win Medium]
134 tk_bindForTraversal $win.topframe.zones.m
135 bind $win.topframe.zones.m <F10> {tk_firstMenu %W}
136 bind $win.topframe.zones.m <Alt-Key> {tk_traverseToMenu %W %A}
137 $win.topframe.zones.m add radiobutton\
138 -label {All}\
139 -variable MapState.$win\
140 -value 0\
141 -command "SetMapState $win 0"
142 $win.topframe.zones.m add radiobutton\
143 -label {Residential}\
144 -variable MapState.$win\
145 -value 1\
146 -command "SetMapState $win 1"
147 $win.topframe.zones.m add radiobutton\
148 -label {Commercial}\
149 -variable MapState.$win\
150 -value 2\
151 -command "SetMapState $win 2"
152 $win.topframe.zones.m add radiobutton\
153 -label {Industrial}\
154 -variable MapState.$win\
155 -value 3\
156 -command "SetMapState $win 3"
157 $win.topframe.zones.m add radiobutton\
158 -label {Transportation}\
159 -variable MapState.$win\
160 -value 5\
161 -command "SetMapState $win 5"
162 # Disabled dynamic filter for now.
163 #$win.topframe.zones.m add radiobutton\
164 # -label {Dynamic}\
165 # -variable MapState.$win\
166 # -value 14\
167 # -command "SetMapState $win 14"
168
169 menubutton $win.topframe.overlays\
170 -menu $win.topframe.overlays.m\
171 -text {Overlays}\
172 -font [Font $win Medium]\
173 -variable $win.postedMenu\
174 -borderwidth 1\
175 -relief flat
176 LinkWindow $win.overlays $win.topframe.overlays
177 tk_bindForTraversal $win.topframe.overlays
178 bind $win.topframe.overlays <F10> {tk_firstMenu %W}
179 bind $win.topframe.overlays <Alt-Key> {tk_traverseToMenu %W %A}
180 tk_menus $win $win.topframe.overlays
181
182 SetHelp $win.topframe.overlays Map.Overlays
183
184 menu $win.topframe.overlays.m\
185 -font [Font $win Medium]
186 tk_bindForTraversal $win.topframe.overlays.m
187 bind $win.topframe.overlays.m <F10> {tk_firstMenu %W}
188 bind $win.topframe.overlays.m <Alt-Key> {tk_traverseToMenu %W %A}
189 $win.topframe.overlays.m add radiobutton\
190 -label {Population Density}\
191 -variable MapState.$win\
192 -value 6\
193 -command "SetMapState $win 6"
194 $win.topframe.overlays.m add radiobutton\
195 -label {Rate of Growth}\
196 -variable MapState.$win\
197 -value 7\
198 -command "SetMapState $win 7"
199 $win.topframe.overlays.m add radiobutton\
200 -label {Land Value}\
201 -variable MapState.$win\
202 -value 11\
203 -command "SetMapState $win 11"
204 $win.topframe.overlays.m add radiobutton\
205 -label {Crime Rate}\
206 -variable MapState.$win\
207 -value 10\
208 -command "SetMapState $win 10"
209 $win.topframe.overlays.m add radiobutton\
210 -label {Pollution Density}\
211 -variable MapState.$win\
212 -value 9\
213 -command "SetMapState $win 9"
214 $win.topframe.overlays.m add radiobutton\
215 -label {Traffic Density}\
216 -variable MapState.$win\
217 -value 8\
218 -command "SetMapState $win 8"
219 $win.topframe.overlays.m add radiobutton\
220 -label {Power Grid}\
221 -variable MapState.$win\
222 -value 4\
223 -command "SetMapState $win 4"
224 $win.topframe.overlays.m add radiobutton\
225 -label {Fire Coverage}\
226 -variable MapState.$win\
227 -value 12\
228 -command "SetMapState $win 12"
229 $win.topframe.overlays.m add radiobutton\
230 -label {Police Coverage}\
231 -variable MapState.$win\
232 -value 13\
233 -command "SetMapState $win 13"
234
235 button $win.topframe.hide\
236 -text {Hide Map}\
237 -font [Font $win Medium]\
238 -borderwidth 1\
239 -command "HideMap $win" \
240 -relief flat
241 LinkWindow $win.hide $win.topframe.hide
242 tk_bindForTraversal $win.topframe.hide
243
244 proc HideMap {win} {
245 pack unpack $win.centerframe
246 $win.topframe.hide configure \
247 -text {Show Map}\
248 -command "ShowMap $win"
249 }
250
251 proc ShowMap {win} {
252 pack append $win\
253 $win.centerframe {top frame center fill}
254 $win.topframe.hide configure \
255 -text {Hide Map}\
256 -command "HideMap $win"
257 }
258
259 label $win.topframe.legend\
260 -bitmap "@images/legendn.xpm" \
261 -font [Font $win Medium]
262 LinkWindow $win.legend $win.topframe.legend
263
264 pack append $win.topframe\
265 $win.topframe.zones {left frame nw} \
266 $win.topframe.overlays {left frame nw} \
267 $win.topframe.hide {left frame nw} \
268 $win.topframe.legend {right frame ne}
269
270 pack append $win\
271 $win.topframe {top frame center fillx} \
272 $win.centerframe {top frame center fill}
273
274 pack append $parent\
275 $win {top frame nw expand fill}
276
277 InitMap $win
278
279 update idletasks
Impressum, Datenschutz