]>
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 wm title 
$win "Micropolis Scenarios" 
  79 wm iconname 
$win {Micropolis Scenarios
} 
  80 wm geometry 
$win 1200x900
+0+0 
  82 wm protocol 
$win delete 
"DeleteScenarioWindow $win ;" 
  85 set ScenarioWindows 
[linsert $ScenarioWindows 0 $win] 
  93   -width 1200 -height 900 
  94 LinkWindow 
$win.
canvas $win.
canvas 
  95 LinkWindow 
$win.
canvas.w 
$win 
  97 $win.
canvas create 
bitmap 0 0 \ 
  99   -bitmap "@images/background-micropolis.xpm" \ 
 102 $win.
canvas bind background 
<ButtonPress
> {HandleScenarioDown 
%W 
%x 
%y
} 
 103 $win.
canvas bind background 
<ButtonRelease-1
> {HandleScenarioUp 
%W 
%x 
%y
} 
 104 $win.
canvas bind background 
<ButtonRelease-2
> {HandleScenarioUp 
%W 
%x 
%y
} 
 105 $win.
canvas bind background 
<ButtonRelease-3
> {HandleScenarioUp 
%W 
%x 
%y
} 
 106 $win.
canvas bind background 
<Motion
> {HandleScenarioMove 
%W 
%x 
%y
} 
 107 $win.
canvas bind background 
<Button1-Motion
> {HandleScenarioMove 
%W 
%x 
%y
} 
 108 $win.
canvas bind background 
<Button2-Motion
> {HandleScenarioMove 
%W 
%x 
%y
} 
 109 $win.
canvas bind background 
<Button3-Motion
> {HandleScenarioMove 
%W 
%x 
%y
} 
 111 global ScenarioButtons
 
 113 set len 
[llength $ScenarioButtons] 
 115   set data 
[lindex $ScenarioButtons $i] 
 116   set type 
[lindex $data 0] 
 117   set id 
[lindex $data 1] 
 118   set xx 
[lindex $data 5] 
 119   set yy 
[lindex $data 6] 
 120   set ww 
[lindex $data 7] 
 121   set hh 
[lindex $data 8] 
 123   $win.
canvas create 
bitmap $xx $yy \ 
 127   $win.
canvas bind $id <ButtonPress
> {HandleScenarioDown 
%W 
%x 
%y
} 
 128   $win.
canvas bind $id <ButtonRelease-1
> {HandleScenarioUp 
%W 
%x 
%y
} 
 129   $win.
canvas bind $id <ButtonRelease-2
> {HandleScenarioUp 
%W 
%x 
%y
} 
 130   $win.
canvas bind $id <ButtonRelease-3
> {HandleScenarioUp 
%W 
%x 
%y
} 
 131   $win.
canvas bind $id <Motion
> {HandleScenarioMove 
%W 
%x 
%y
} 
 132   $win.
canvas bind $id <Button1-Motion
> {HandleScenarioMove 
%W 
%x 
%y
} 
 133   $win.
canvas bind $id <Button2-Motion
> {HandleScenarioMove 
%W 
%x 
%y
} 
 134   $win.
canvas bind $id <Button3-Motion
> {HandleScenarioMove 
%W 
%x 
%y
} 
 136   set i 
[expr "$i + 1"] 
 139 mapview 
$win.
canvas.view 
\ 
 140   -font [Font 
$win Large
] 
 141 LinkWindow 
$win.view 
$win.
canvas.view
 
 142 $win.
canvas.view size 
[expr "[sim WorldX] * 3"] [expr "[sim WorldY] * 3"] 
 144 # Hide the editor rectangles. 
 145 $win.
canvas.view ShowEditors 
0 
 147 frame $win.
canvas.name 
\ 
 151 SetHelp 
$win.name Scenario.Name
 
 153 label $win.
canvas.name.namelabel 
\ 
 155   -font [Font 
$win Text
] 
 157 entry $win.
canvas.name.cityname 
\ 
 159   -textvariable CityName 
\ 
 160   -font [Font 
$win Text
] \ 
 162 bind $win.
canvas.name.cityname 
<Return
> "DoEnterCityName $win" 
 163 bind $win.
canvas.name.cityname 
<Any-Enter
> {focus %W
} 
 164 LinkWindow 
$win.cityname 
$win.
canvas.name.cityname
 
 166 pack append $win.
canvas.name 
\ 
 167   $win.
canvas.name.namelabel    
{left 
frame e
}\ 
 168   $win.
canvas.name.cityname     
{left 
frame e
} 
 170 place $win.
canvas -x 0 -y 0 
 171 place $win.
canvas.view 
-x 534 -y 48 
 172 place $win.
canvas.name 
-x 530 -y 0