]>
Commit | Line | Data |
---|---|---|
1 | # Window: File Chooser, 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 FileWindows | |
62 | set n [Unique] | |
63 | set win .file$n | |
64 | set FileWindows [linsert $FileWindows 0 $win] | |
65 | ||
66 | LinkWindow $head.file $win | |
67 | LinkWindow $win.head $head | |
68 | ||
69 | catch "destroy $win" | |
70 | toplevel $win -screen $display | |
71 | ||
72 | SetHelp $win File | |
73 | ||
74 | wm title $win {File Chooser} | |
75 | wm iconname $win {File Chooser} | |
76 | wm geometry $win 350x480+5+5 | |
77 | wm positionfrom $win user | |
78 | wm sizefrom $win user | |
79 | wm maxsize $win 700 700 | |
80 | wm minsize $win 100 100 | |
81 | wm protocol $win delete "DeleteWindow file FileWindows" | |
82 | wm transient $win $head | |
83 | ||
84 | # Based on xf file selection box code by: | |
85 | # garfield@cs.tu-berlin.de | |
86 | # svoboda@transam.ece.cmu.edu (David Svoboda) | |
87 | ||
88 | message $win.message1 \ | |
89 | -aspect 1500 \ | |
90 | -anchor n \ | |
91 | -justify center \ | |
92 | -relief flat \ | |
93 | -font [Font $win Large] \ | |
94 | -text "" | |
95 | ||
96 | frame $win.frame1 \ | |
97 | -borderwidth 0 | |
98 | ||
99 | button $win.frame1.ok -text {OK} -font [Font $win Large] | |
100 | ||
101 | SetHelp $win.frame1.ok File.OK | |
102 | ||
103 | button $win.frame1.rescan -text {Rescan} -font [Font $win Large] | |
104 | ||
105 | SetHelp $win.frame1.rescan File.Rescan | |
106 | ||
107 | button $win.frame1.cancel -text {Cancel} -font [Font $win Large] | |
108 | ||
109 | SetHelp $win.frame1.cancel File.Cancel | |
110 | ||
111 | frame $win.path \ | |
112 | -borderwidth 2 \ | |
113 | -relief flat | |
114 | ||
115 | SetHelp $win.path File.Directory | |
116 | ||
117 | label $win.path.pathlabel -text {Directory:} -font [Font $win Large] | |
118 | entry $win.path.path -relief sunken -font [Font $win Large] | |
119 | ||
120 | frame $win.files \ | |
121 | -borderwidth 2 \ | |
122 | -relief flat | |
123 | ||
124 | SetHelp $win.files File.List | |
125 | ||
126 | scrollbar $win.files.vscroll \ | |
127 | -command "$win.files.files yview" | |
128 | ||
129 | scrollbar $win.files.hscroll \ | |
130 | -orient horizontal \ | |
131 | -command "$win.files.files xview" | |
132 | ||
133 | listbox $win.files.files \ | |
134 | -exportselection false \ | |
135 | -font [Font $win Large] \ | |
136 | -xscrollcommand "$win.files.hscroll set" \ | |
137 | -yscrollcommand "$win.files.vscroll set" | |
138 | ||
139 | pack append $win.files \ | |
140 | $win.files.vscroll {left filly} \ | |
141 | $win.files.hscroll {bottom fillx} \ | |
142 | $win.files.files {left fill expand} | |
143 | ||
144 | frame $win.file \ | |
145 | -borderwidth 2 \ | |
146 | -relief flat | |
147 | ||
148 | SetHelp $win.file File.File | |
149 | ||
150 | label $win.file.labelfile \ | |
151 | -relief flat \ | |
152 | -font [Font $win Large] \ | |
153 | -text "File:" | |
154 | ||
155 | entry $win.file.file \ | |
156 | -font [Font $win Large] \ | |
157 | -relief sunken | |
158 | ||
159 | pack append $win.file \ | |
160 | $win.file.labelfile {left} \ | |
161 | $win.file.file {left fill expand} | |
162 | ||
163 | bind $win.files.files <ButtonPress-1> "FileSelect $win %W %y" | |
164 | bind $win.files.files <Button1-Motion> "FileSelect $win %W %y" | |
165 | bind $win.files.files <Shift-Button1-Motion> "FileSelect $win %W %y" | |
166 | bind $win.files.files <Shift-ButtonPress-1> "FileSelect $win %W %y" | |
167 | bind $win.path.path <Tab> "NameComplete $win path" | |
168 | catch "bind $win.path.path <Up> {}" | |
169 | bind $win.path.path <Down> " | |
170 | $win.file.file cursor 0 | |
171 | focus $win.file.file" | |
172 | ||
173 | bind $win.file.file <Tab> "NameComplete $win file" | |
174 | bind $win.file.file <Up> " | |
175 | $win.path.path cursor 0 | |
176 | focus $win.path.path" | |
177 | catch "bind $win.path.path <Down> {}" | |
178 | ||
179 | pack append $win.frame1 \ | |
180 | $win.frame1.ok {left fill expand} \ | |
181 | $win.frame1.rescan {left fill expand} \ | |
182 | $win.frame1.cancel {left fill expand} | |
183 | pack append $win.path \ | |
184 | $win.path.pathlabel {left} \ | |
185 | $win.path.path {left fill expand} | |
186 | pack append $win \ | |
187 | $win.message1 {top fill} \ | |
188 | $win.frame1 {bottom fill} \ | |
189 | $win.file {bottom fill} \ | |
190 | $win.path {bottom fill} \ | |
191 | $win.files {left fill expand} | |
192 | ||
193 | update idletasks |