1 # Window: File Chooser, 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
64 set FileWindows
[linsert $FileWindows 0 $win]
66 LinkWindow
$head.
file $win
67 LinkWindow
$win.head
$head
70 toplevel $win -screen $display
74 wm title
$win {File Chooser
}
75 wm iconname
$win {File Chooser
}
76 wm geometry
$win 350x480
+5+5
77 wm positionfrom
$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
84 # Based on xf file selection box code by:
85 # garfield@cs.tu-berlin.de
86 # svoboda@transam.ece.cmu.edu (David Svoboda)
88 message $win.message1
\
93 -font [Font
$win Large
] \
99 button $win.frame1.ok
-text {OK
} -font [Font
$win Large
]
101 SetHelp
$win.frame1.ok File.OK
103 button $win.frame1.rescan
-text {Rescan
} -font [Font
$win Large
]
105 SetHelp
$win.frame1.rescan File.Rescan
107 button $win.frame1.cancel
-text {Cancel
} -font [Font
$win Large
]
109 SetHelp
$win.frame1.cancel File.Cancel
115 SetHelp
$win.path File.Directory
117 label $win.path.pathlabel
-text {Directory
:} -font [Font
$win Large
]
118 entry $win.path.path
-relief sunken
-font [Font
$win Large
]
124 SetHelp
$win.files File.List
126 scrollbar $win.files.vscroll
\
127 -command "$win.files.files yview"
129 scrollbar $win.files.hscroll
\
131 -command "$win.files.files xview"
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"
139 pack append $win.files
\
140 $win.files.vscroll
{left filly
} \
141 $win.files.hscroll
{bottom fillx
} \
142 $win.files.files
{left fill expand
}
148 SetHelp
$win.
file File.File
150 label $win.
file.labelfile
\
152 -font [Font
$win Large
] \
155 entry $win.
file.
file \
156 -font [Font
$win Large
] \
159 pack append $win.
file \
160 $win.
file.labelfile
{left
} \
161 $win.
file.
file {left fill expand
}
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"
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> {}"
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
}
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
}