author | Michael Beyl <mb@exept.de> |
Thu, 13 Mar 2003 16:04:59 +0100 | |
changeset 4660 | ac33e6486abb |
parent 4580 | 629ceb2e68d5 |
child 4661 | 83f70cf82282 |
permissions | -rw-r--r-- |
4580 | 1 |
"{ Package: 'stx:libtool' }" |
2 |
||
3 |
ApplicationModel subclass:#FileBrowserV2SettingsDialog |
|
4 |
instanceVariableNames:'appList requestor selectionInApplList subCanvasApplicationHolder |
|
5 |
help applList appIsCategory enableButtons doReload doSave |
|
6 |
settingsAppl' |
|
7 |
classVariableNames:'ApplicationList' |
|
8 |
poolDictionaries:'' |
|
9 |
category:'Interface-Tools-File' |
|
10 |
! |
|
11 |
||
12 |
||
13 |
!FileBrowserV2SettingsDialog class methodsFor:'interface specs'! |
|
14 |
||
15 |
mainMenu |
|
16 |
"This resource specification was automatically generated |
|
17 |
by the MenuEditor of ST/X." |
|
18 |
||
19 |
"Do not manually edit this!! If it is corrupted, |
|
20 |
the MenuEditor may not be able to read the specification." |
|
21 |
||
22 |
" |
|
23 |
MenuEditor new openOnClass:FileBrowserV2SettingsFrame andSelector:#mainMenu |
|
24 |
(Menu new fromLiteralArrayEncoding:(FileBrowserV2SettingsFrame mainMenu)) startUp |
|
25 |
" |
|
26 |
||
27 |
<resource: #menu> |
|
28 |
||
29 |
^ |
|
30 |
#(#Menu |
|
31 |
#( |
|
32 |
#(#MenuItem |
|
33 |
#label: 'File' |
|
34 |
#translateLabel: true |
|
35 |
#submenu: |
|
36 |
#(#Menu |
|
37 |
#( |
|
38 |
#(#MenuItem |
|
39 |
#label: 'Load Settings from...' |
|
40 |
#itemValue: #loadSettingsFromFile |
|
41 |
#translateLabel: true |
|
42 |
) |
|
43 |
#(#MenuItem |
|
44 |
#label: 'Save Settings to...' |
|
45 |
#itemValue: #saveSettingsIntoFile |
|
46 |
#translateLabel: true |
|
47 |
) |
|
48 |
#(#MenuItem |
|
49 |
#label: 'Exit' |
|
50 |
#itemValue: #closeRequest |
|
51 |
#translateLabel: true |
|
52 |
) |
|
53 |
) |
|
54 |
nil |
|
55 |
nil |
|
56 |
) |
|
57 |
) |
|
58 |
) |
|
59 |
nil |
|
60 |
nil |
|
61 |
) |
|
62 |
! |
|
63 |
||
64 |
windowSpec |
|
65 |
"This resource specification was automatically generated |
|
66 |
by the UIPainter of ST/X." |
|
67 |
||
68 |
"Do not manually edit this!! If it is corrupted, |
|
69 |
the UIPainter may not be able to read the specification." |
|
70 |
||
71 |
" |
|
72 |
UIPainter new openOnClass:FileBrowserV2SettingsFrame andSelector:#windowSpec |
|
73 |
FileBrowserV2SettingsFrame new openInterface:#windowSpec |
|
74 |
FileBrowserV2SettingsFrame open |
|
75 |
" |
|
76 |
||
77 |
<resource: #canvas> |
|
78 |
||
79 |
^ |
|
80 |
#(#FullSpec |
|
81 |
#name: #windowSpec |
|
82 |
#window: |
|
83 |
#(#WindowSpec |
|
84 |
#label: 'Settings Dialog' |
|
85 |
#name: 'Settings Dialog' |
|
86 |
#min: #(#Point 10 10) |
|
87 |
#max: #(#Point 1024 768) |
|
88 |
#bounds: #(#Rectangle 12 22 365 596) |
|
89 |
#menu: #mainMenu |
|
90 |
) |
|
91 |
#component: |
|
92 |
#(#SpecCollection |
|
93 |
#collection: #( |
|
94 |
#(#ViewSpec |
|
95 |
#name: 'Box2' |
|
96 |
#layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) |
|
97 |
#component: |
|
98 |
#(#SpecCollection |
|
99 |
#collection: #( |
|
100 |
#(#SubCanvasSpec |
|
101 |
#name: 'FileBrowserV2SettingsAppl' |
|
102 |
#layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 -34 1) |
|
103 |
#level: 0 |
|
104 |
#hasHorizontalScrollBar: false |
|
105 |
#hasVerticalScrollBar: false |
|
106 |
#majorKey: #FileBrowserV2SettingsAppl |
|
107 |
#createNewApplication: true |
|
108 |
#createNewBuilder: true |
|
109 |
#postBuildCallback: #postBuildSubCanvas: |
|
110 |
) |
|
111 |
#(#HorizontalPanelViewSpec |
|
112 |
#name: 'HorizontalPanel1' |
|
113 |
#layout: #(#LayoutFrame 0 0.0 -34 1 0 1.0 0 1) |
|
114 |
#horizontalLayout: #fitSpace |
|
115 |
#verticalLayout: #center |
|
116 |
#horizontalSpace: 3 |
|
117 |
#verticalSpace: 3 |
|
118 |
#component: |
|
119 |
#(#SpecCollection |
|
120 |
#collection: #( |
|
121 |
#(#ActionButtonSpec |
|
122 |
#label: 'OK' |
|
123 |
#name: 'OK' |
|
124 |
#translateLabel: true |
|
125 |
#model: #doSave |
|
126 |
#enableChannel: #enableButtons |
|
127 |
#extent: #(#Point 84 22) |
|
128 |
) |
|
129 |
#(#ActionButtonSpec |
|
130 |
#label: 'Reload' |
|
131 |
#name: 'Reload' |
|
132 |
#translateLabel: true |
|
133 |
#model: #doReload |
|
134 |
#enableChannel: #enableButtons |
|
135 |
#extent: #(#Point 85 22) |
|
136 |
) |
|
137 |
#(#ActionButtonSpec |
|
138 |
#label: 'Cancel' |
|
139 |
#name: 'Cancel' |
|
140 |
#translateLabel: true |
|
141 |
#model: #closeRequest |
|
142 |
#extent: #(#Point 84 22) |
|
143 |
) |
|
144 |
#(#ActionButtonSpec |
|
145 |
#label: 'Help' |
|
146 |
#name: 'Help' |
|
147 |
#translateLabel: true |
|
148 |
#model: #help |
|
149 |
#enableChannel: #enableButtons |
|
150 |
#extent: #(#Point 85 22) |
|
151 |
) |
|
152 |
) |
|
153 |
||
154 |
) |
|
155 |
) |
|
156 |
) |
|
157 |
||
158 |
) |
|
159 |
) |
|
160 |
) |
|
161 |
||
162 |
) |
|
163 |
) |
|
164 |
! ! |
|
165 |
||
166 |
!FileBrowserV2SettingsDialog methodsFor:'accessing'! |
|
167 |
||
168 |
requestor |
|
169 |
"return the value of the instance variable 'requestor' (automatically generated)" |
|
170 |
||
171 |
^ requestor |
|
172 |
! |
|
173 |
||
174 |
requestor:something |
|
175 |
"set the value of the instance variable 'requestor' (automatically generated)" |
|
176 |
||
177 |
requestor := something. |
|
178 |
! ! |
|
179 |
||
180 |
!FileBrowserV2SettingsDialog methodsFor:'actions'! |
|
181 |
||
182 |
doReload |
|
183 |
||
4660
ac33e6486abb
adapt the changed interface in AbstactSettingsApplication
Michael Beyl <mb@exept.de>
parents:
4580
diff
changeset
|
184 |
settingsAppl readSettings. |
4580 | 185 |
! |
186 |
||
187 |
doSave |
|
188 |
||
189 |
settingsAppl saveRequest. |
|
190 |
self closeRequest. |
|
191 |
! |
|
192 |
||
193 |
help |
|
194 |
||
195 |
settingsAppl help |
|
196 |
! ! |
|
197 |
||
198 |
!FileBrowserV2SettingsDialog methodsFor:'initialization & release'! |
|
199 |
||
200 |
closeRequest |
|
201 |
"This is a hook method generated by the Browser. |
|
202 |
It will be invoked when your app/dialog-window is about to be |
|
203 |
closed (this method has a chance to suppress the close). |
|
204 |
See also #closeDownViews, which is invoked when the close is really done." |
|
205 |
||
206 |
settingsAppl saveRequest ifFalse:[ |
|
207 |
^ self |
|
208 |
]. |
|
209 |
^ super closeRequest |
|
210 |
! |
|
211 |
||
212 |
initialize |
|
213 |
||
214 |
super initialize. |
|
215 |
! |
|
216 |
||
217 |
postBuildSubCanvas:aWidget |
|
218 |
||
219 |
settingsAppl := aWidget client. |
|
220 |
aWidget keepClientView:true. |
|
221 |
! ! |
|
222 |
||
223 |
!FileBrowserV2SettingsDialog methodsFor:'menu actions'! |
|
224 |
||
225 |
loadSettingsFromFile |
|
226 |
||
227 |
"restore settings from a settings-file." |
|
228 |
||
229 |
"a temporary kludge - we need a central systemSettings object for this, |
|
230 |
which can be saved/restored with a single store/read." |
|
231 |
||
232 |
|fileName| |
|
233 |
||
234 |
fileName := Dialog |
|
235 |
requestFileName:(resources string:'Load Settings From:') |
|
236 |
default:'settings.stx' |
|
237 |
ok:(resources string:'Load') |
|
238 |
abort:(resources string:'Cancel') |
|
239 |
pattern:'*.stx' |
|
240 |
fromDirectory:nil. |
|
241 |
||
242 |
(fileName size == 0) ifTrue:[ |
|
243 |
"/ canceled |
|
244 |
^ self |
|
245 |
]. |
|
246 |
||
247 |
self withWaitCursorDo:[ |
|
248 |
Smalltalk fileIn:fileName. |
|
249 |
Transcript current topView model reOpen. |
|
250 |
self doReload. |
|
251 |
]. |
|
252 |
! |
|
253 |
||
254 |
saveSettingsIntoFile |
|
255 |
||
256 |
|fileName resources| |
|
257 |
||
4660
ac33e6486abb
adapt the changed interface in AbstactSettingsApplication
Michael Beyl <mb@exept.de>
parents:
4580
diff
changeset
|
258 |
resources := self class classResources. |
4580 | 259 |
|
260 |
self doReload. |
|
261 |
||
262 |
fileName := Dialog |
|
263 |
requestFileName:(resources string:'Save settings in:') |
|
264 |
default:'settings.stx' |
|
265 |
ok:(resources string:'Save') |
|
266 |
abort:(resources string:'Cancel') |
|
267 |
pattern:'*.stx' |
|
268 |
fromDirectory:'.'. |
|
269 |
||
270 |
fileName size ~~ 0 ifTrue:[ |
|
271 |
"not canceled" |
|
4660
ac33e6486abb
adapt the changed interface in AbstactSettingsApplication
Michael Beyl <mb@exept.de>
parents:
4580
diff
changeset
|
272 |
UserPreferences current saveIn:fileName. |
4580 | 273 |
] |
274 |
! ! |
|
275 |
||
276 |
!FileBrowserV2SettingsDialog class methodsFor:'documentation'! |
|
277 |
||
278 |
version |
|
4660
ac33e6486abb
adapt the changed interface in AbstactSettingsApplication
Michael Beyl <mb@exept.de>
parents:
4580
diff
changeset
|
279 |
^ '$Header: /cvs/stx/stx/libtool/FileBrowserV2SettingsDialog.st,v 1.2 2003-03-13 15:04:59 mb Exp $' |
4580 | 280 |
! ! |