]>
cvs.zerfleddert.de Git - micropolis/blob - res/wscen.tcl
1 # Window: Scenarios, for Unix Micropolis.
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.
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.
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/>.
21 # ADDITIONAL TERMS per GNU GPL Section 7
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.
29 # Any propagation or conveyance of this program must include this
30 # copyright notice and these terms.
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.
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.
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
62 global ScenarioWindows
66 LinkWindow
$head.scenario
$win
67 LinkWindow
$win.head
$head
68 LinkWindow
$win.scenarioTarget
-1
69 LinkWindow
$win.scenarioTargetDown
-1
72 if {[catch "toplevel $win -screen $display"]} {
73 puts stderr
"Couldn't open X11 display \"$display\"."
78 global ScenarioPanelWidth
79 global ScenarioPanelHeight
81 wm title
$win "Micropolis Scenarios"
82 wm iconname
$win {Micropolis Scenarios
}
83 wm geometry
$win ${ScenarioPanelWidth
}x
${ScenarioPanelHeight
}+0+0
85 wm protocol
$win delete
"DeleteScenarioWindow $win ;"
88 set ScenarioWindows
[linsert $ScenarioWindows 0 $win]
96 -width $ScenarioPanelWidth -height $ScenarioPanelHeight
97 LinkWindow
$win.
canvas $win.
canvas
98 LinkWindow
$win.
canvas.w
$win
100 global ScenarioBackground
102 $win.
canvas create
bitmap 0 0 \
104 -bitmap $ScenarioBackground \
107 $win.
canvas bind background
<ButtonPress
> {HandleScenarioDown
%W
%x
%y
}
108 $win.
canvas bind background
<ButtonRelease-1
> {HandleScenarioUp
%W
%x
%y
}
109 $win.
canvas bind background
<ButtonRelease-2
> {HandleScenarioUp
%W
%x
%y
}
110 $win.
canvas bind background
<ButtonRelease-3
> {HandleScenarioUp
%W
%x
%y
}
111 $win.
canvas bind background
<Motion
> {HandleScenarioMove
%W
%x
%y
}
112 $win.
canvas bind background
<Button1-Motion
> {HandleScenarioMove
%W
%x
%y
}
113 $win.
canvas bind background
<Button2-Motion
> {HandleScenarioMove
%W
%x
%y
}
114 $win.
canvas bind background
<Button3-Motion
> {HandleScenarioMove
%W
%x
%y
}
116 global ScenarioButtons
118 set len
[llength $ScenarioButtons]
120 set data
[lindex $ScenarioButtons $i]
121 set type
[lindex $data 0]
122 set id
[lindex $data 1]
123 set xx
[lindex $data 5]
124 set yy
[lindex $data 6]
125 set ww
[lindex $data 7]
126 set hh
[lindex $data 8]
128 $win.
canvas create
bitmap $xx $yy \
132 $win.
canvas bind $id <ButtonPress
> {HandleScenarioDown
%W
%x
%y
}
133 $win.
canvas bind $id <ButtonRelease-1
> {HandleScenarioUp
%W
%x
%y
}
134 $win.
canvas bind $id <ButtonRelease-2
> {HandleScenarioUp
%W
%x
%y
}
135 $win.
canvas bind $id <ButtonRelease-3
> {HandleScenarioUp
%W
%x
%y
}
136 $win.
canvas bind $id <Motion
> {HandleScenarioMove
%W
%x
%y
}
137 $win.
canvas bind $id <Button1-Motion
> {HandleScenarioMove
%W
%x
%y
}
138 $win.
canvas bind $id <Button2-Motion
> {HandleScenarioMove
%W
%x
%y
}
139 $win.
canvas bind $id <Button3-Motion
> {HandleScenarioMove
%W
%x
%y
}
141 set i
[expr "$i + 1"]
144 mapview
$win.
canvas.view
\
145 -font [Font
$win Large
]
146 LinkWindow
$win.view
$win.
canvas.view
147 $win.
canvas.view size
[expr "[sim WorldX] * 3"] [expr "[sim WorldY] * 3"]
149 # Hide the editor rectangles.
150 $win.
canvas.view ShowEditors
0
152 frame $win.
canvas.name
\
156 SetHelp
$win.name Scenario.Name
158 label $win.
canvas.name.namelabel
\
160 -font [Font
$win Text
]
162 entry $win.
canvas.name.cityname
\
164 -textvariable CityName
\
165 -font [Font
$win Text
] \
167 bind $win.
canvas.name.cityname
<Return
> "DoEnterCityName $win"
168 bind $win.
canvas.name.cityname
<Any-Enter
> {focus %W
}
169 LinkWindow
$win.cityname
$win.
canvas.name.cityname
171 pack append $win.
canvas.name
\
172 $win.
canvas.name.namelabel
{left
frame e
}\
173 $win.
canvas.name.cityname
{left
frame e
}
175 place $win.
canvas -x 0 -y 0
179 if {$ScenarioMapX != -1} {
180 place $win.
canvas.view
-x $ScenarioMapX -y $ScenarioMapY
183 global ScenarioCityNameX
184 global ScenarioCityNameY
185 place $win.
canvas.name
-x $ScenarioCityNameX -y $ScenarioCityNameY