author | Claus Gittinger <cg@exept.de> |
Fri, 29 Aug 2003 21:29:24 +0200 | |
changeset 5140 | 36c7da05d814 |
parent 5051 | fa30af9dfd10 |
child 5159 | 0aaf83422846 |
permissions | -rw-r--r-- |
5140 | 1 |
" |
2 |
COPYRIGHT (c) 2003 by eXept Software AG |
|
3 |
All Rights Reserved |
|
4 |
||
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
12 |
||
4580 | 13 |
"{ Package: 'stx:libtool' }" |
14 |
||
15 |
ApplicationModel subclass:#FileBrowserV2SettingsDialog |
|
5051 | 16 |
instanceVariableNames:'settingsDialog settingsAppl' |
4580 | 17 |
classVariableNames:'ApplicationList' |
18 |
poolDictionaries:'' |
|
19 |
category:'Interface-Tools-File' |
|
20 |
! |
|
21 |
||
5140 | 22 |
!FileBrowserV2SettingsDialog class methodsFor:'documentation'! |
23 |
||
24 |
copyright |
|
25 |
" |
|
26 |
COPYRIGHT (c) 2003 by eXept Software AG |
|
27 |
All Rights Reserved |
|
28 |
||
29 |
This software is furnished under a license and may be used |
|
30 |
only in accordance with the terms of that license and with the |
|
31 |
inclusion of the above copyright notice. This software may not |
|
32 |
be provided or otherwise made available to, or used by, any |
|
33 |
other person. No title to or ownership of the software is |
|
34 |
hereby transferred. |
|
35 |
" |
|
36 |
! ! |
|
4580 | 37 |
|
38 |
!FileBrowserV2SettingsDialog class methodsFor:'interface specs'! |
|
39 |
||
40 |
mainMenu |
|
41 |
"This resource specification was automatically generated |
|
42 |
by the MenuEditor of ST/X." |
|
43 |
||
44 |
"Do not manually edit this!! If it is corrupted, |
|
45 |
the MenuEditor may not be able to read the specification." |
|
46 |
||
47 |
" |
|
4939
101cc4d46184
fixes to allow settings dialog to be opened from browser
Claus Gittinger <cg@exept.de>
parents:
4661
diff
changeset
|
48 |
MenuEditor new openOnClass:FileBrowserV2SettingsDialog andSelector:#mainMenu |
101cc4d46184
fixes to allow settings dialog to be opened from browser
Claus Gittinger <cg@exept.de>
parents:
4661
diff
changeset
|
49 |
(Menu new fromLiteralArrayEncoding:(FileBrowserV2SettingsDialog mainMenu)) startUp |
4580 | 50 |
" |
51 |
||
52 |
<resource: #menu> |
|
53 |
||
54 |
^ |
|
55 |
#(#Menu |
|
56 |
#( |
|
57 |
#(#MenuItem |
|
58 |
#label: 'File' |
|
59 |
#translateLabel: true |
|
60 |
#submenu: |
|
61 |
#(#Menu |
|
62 |
#( |
|
63 |
#(#MenuItem |
|
64 |
#label: 'Load Settings from...' |
|
65 |
#itemValue: #loadSettingsFromFile |
|
66 |
#translateLabel: true |
|
67 |
) |
|
68 |
#(#MenuItem |
|
69 |
#label: 'Save Settings to...' |
|
70 |
#itemValue: #saveSettingsIntoFile |
|
71 |
#translateLabel: true |
|
72 |
) |
|
73 |
#(#MenuItem |
|
4939
101cc4d46184
fixes to allow settings dialog to be opened from browser
Claus Gittinger <cg@exept.de>
parents:
4661
diff
changeset
|
74 |
#label: '-' |
101cc4d46184
fixes to allow settings dialog to be opened from browser
Claus Gittinger <cg@exept.de>
parents:
4661
diff
changeset
|
75 |
) |
101cc4d46184
fixes to allow settings dialog to be opened from browser
Claus Gittinger <cg@exept.de>
parents:
4661
diff
changeset
|
76 |
#(#MenuItem |
4580 | 77 |
#label: 'Exit' |
78 |
#itemValue: #closeRequest |
|
79 |
#translateLabel: true |
|
80 |
) |
|
81 |
) |
|
82 |
nil |
|
83 |
nil |
|
84 |
) |
|
85 |
) |
|
86 |
) |
|
87 |
nil |
|
88 |
nil |
|
89 |
) |
|
90 |
! |
|
91 |
||
92 |
windowSpec |
|
93 |
"This resource specification was automatically generated |
|
94 |
by the UIPainter of ST/X." |
|
95 |
||
96 |
"Do not manually edit this!! If it is corrupted, |
|
97 |
the UIPainter may not be able to read the specification." |
|
98 |
||
99 |
" |
|
4939
101cc4d46184
fixes to allow settings dialog to be opened from browser
Claus Gittinger <cg@exept.de>
parents:
4661
diff
changeset
|
100 |
UIPainter new openOnClass:FileBrowserV2SettingsDialog andSelector:#windowSpec |
101cc4d46184
fixes to allow settings dialog to be opened from browser
Claus Gittinger <cg@exept.de>
parents:
4661
diff
changeset
|
101 |
FileBrowserV2SettingsDialog new openInterface:#windowSpec |
101cc4d46184
fixes to allow settings dialog to be opened from browser
Claus Gittinger <cg@exept.de>
parents:
4661
diff
changeset
|
102 |
FileBrowserV2SettingsDialog open |
4580 | 103 |
" |
104 |
||
105 |
<resource: #canvas> |
|
106 |
||
107 |
^ |
|
108 |
#(#FullSpec |
|
109 |
#name: #windowSpec |
|
110 |
#window: |
|
111 |
#(#WindowSpec |
|
112 |
#label: 'Settings Dialog' |
|
113 |
#name: 'Settings Dialog' |
|
114 |
#min: #(#Point 10 10) |
|
115 |
#max: #(#Point 1024 768) |
|
4939
101cc4d46184
fixes to allow settings dialog to be opened from browser
Claus Gittinger <cg@exept.de>
parents:
4661
diff
changeset
|
116 |
#bounds: #(#Rectangle 16 46 369 620) |
4580 | 117 |
#menu: #mainMenu |
118 |
) |
|
119 |
#component: |
|
120 |
#(#SpecCollection |
|
121 |
#collection: #( |
|
122 |
#(#ViewSpec |
|
123 |
#name: 'Box2' |
|
124 |
#layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) |
|
125 |
#component: |
|
126 |
#(#SpecCollection |
|
127 |
#collection: #( |
|
128 |
#(#SubCanvasSpec |
|
129 |
#name: 'FileBrowserV2SettingsAppl' |
|
130 |
#layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 -34 1) |
|
131 |
#level: 0 |
|
132 |
#hasHorizontalScrollBar: false |
|
133 |
#hasVerticalScrollBar: false |
|
134 |
#majorKey: #FileBrowserV2SettingsAppl |
|
135 |
#createNewApplication: true |
|
136 |
#createNewBuilder: true |
|
137 |
#postBuildCallback: #postBuildSubCanvas: |
|
138 |
) |
|
139 |
#(#HorizontalPanelViewSpec |
|
140 |
#name: 'HorizontalPanel1' |
|
141 |
#layout: #(#LayoutFrame 0 0.0 -34 1 0 1.0 0 1) |
|
142 |
#horizontalLayout: #fitSpace |
|
143 |
#verticalLayout: #center |
|
144 |
#horizontalSpace: 3 |
|
145 |
#verticalSpace: 3 |
|
146 |
#component: |
|
147 |
#(#SpecCollection |
|
148 |
#collection: #( |
|
149 |
#(#ActionButtonSpec |
|
150 |
#label: 'OK' |
|
151 |
#name: 'OK' |
|
152 |
#translateLabel: true |
|
153 |
#model: #doSave |
|
154 |
#enableChannel: #enableButtons |
|
4939
101cc4d46184
fixes to allow settings dialog to be opened from browser
Claus Gittinger <cg@exept.de>
parents:
4661
diff
changeset
|
155 |
#extent: #(#Point 67 22) |
101cc4d46184
fixes to allow settings dialog to be opened from browser
Claus Gittinger <cg@exept.de>
parents:
4661
diff
changeset
|
156 |
) |
101cc4d46184
fixes to allow settings dialog to be opened from browser
Claus Gittinger <cg@exept.de>
parents:
4661
diff
changeset
|
157 |
#(#ActionButtonSpec |
101cc4d46184
fixes to allow settings dialog to be opened from browser
Claus Gittinger <cg@exept.de>
parents:
4661
diff
changeset
|
158 |
#label: 'Apply' |
101cc4d46184
fixes to allow settings dialog to be opened from browser
Claus Gittinger <cg@exept.de>
parents:
4661
diff
changeset
|
159 |
#name: 'Apply' |
101cc4d46184
fixes to allow settings dialog to be opened from browser
Claus Gittinger <cg@exept.de>
parents:
4661
diff
changeset
|
160 |
#translateLabel: true |
101cc4d46184
fixes to allow settings dialog to be opened from browser
Claus Gittinger <cg@exept.de>
parents:
4661
diff
changeset
|
161 |
#model: #doApply |
101cc4d46184
fixes to allow settings dialog to be opened from browser
Claus Gittinger <cg@exept.de>
parents:
4661
diff
changeset
|
162 |
#enableChannel: #enableButtons |
101cc4d46184
fixes to allow settings dialog to be opened from browser
Claus Gittinger <cg@exept.de>
parents:
4661
diff
changeset
|
163 |
#extent: #(#Point 67 22) |
4580 | 164 |
) |
165 |
#(#ActionButtonSpec |
|
166 |
#label: 'Reload' |
|
167 |
#name: 'Reload' |
|
168 |
#translateLabel: true |
|
169 |
#model: #doReload |
|
170 |
#enableChannel: #enableButtons |
|
4939
101cc4d46184
fixes to allow settings dialog to be opened from browser
Claus Gittinger <cg@exept.de>
parents:
4661
diff
changeset
|
171 |
#extent: #(#Point 67 22) |
4580 | 172 |
) |
173 |
#(#ActionButtonSpec |
|
174 |
#label: 'Cancel' |
|
175 |
#name: 'Cancel' |
|
176 |
#translateLabel: true |
|
4939
101cc4d46184
fixes to allow settings dialog to be opened from browser
Claus Gittinger <cg@exept.de>
parents:
4661
diff
changeset
|
177 |
#model: #doCancel |
101cc4d46184
fixes to allow settings dialog to be opened from browser
Claus Gittinger <cg@exept.de>
parents:
4661
diff
changeset
|
178 |
#extent: #(#Point 67 22) |
4580 | 179 |
) |
180 |
#(#ActionButtonSpec |
|
181 |
#label: 'Help' |
|
182 |
#name: 'Help' |
|
183 |
#translateLabel: true |
|
184 |
#model: #help |
|
185 |
#enableChannel: #enableButtons |
|
4939
101cc4d46184
fixes to allow settings dialog to be opened from browser
Claus Gittinger <cg@exept.de>
parents:
4661
diff
changeset
|
186 |
#extent: #(#Point 67 22) |
4580 | 187 |
) |
188 |
) |
|
189 |
||
190 |
) |
|
191 |
) |
|
192 |
) |
|
193 |
||
194 |
) |
|
195 |
) |
|
196 |
) |
|
197 |
||
198 |
) |
|
199 |
) |
|
200 |
! ! |
|
201 |
||
202 |
!FileBrowserV2SettingsDialog methodsFor:'accessing'! |
|
203 |
||
5051 | 204 |
settingsDialog |
205 |
^ settingsDialog |
|
4580 | 206 |
! |
207 |
||
5051 | 208 |
settingsDialog:something |
209 |
settingsDialog := something. |
|
4580 | 210 |
! ! |
211 |
||
212 |
!FileBrowserV2SettingsDialog methodsFor:'actions'! |
|
213 |
||
4939
101cc4d46184
fixes to allow settings dialog to be opened from browser
Claus Gittinger <cg@exept.de>
parents:
4661
diff
changeset
|
214 |
doApply |
101cc4d46184
fixes to allow settings dialog to be opened from browser
Claus Gittinger <cg@exept.de>
parents:
4661
diff
changeset
|
215 |
(settingsAppl saveRequestAsking:false) ifFalse:[ |
101cc4d46184
fixes to allow settings dialog to be opened from browser
Claus Gittinger <cg@exept.de>
parents:
4661
diff
changeset
|
216 |
^ self |
101cc4d46184
fixes to allow settings dialog to be opened from browser
Claus Gittinger <cg@exept.de>
parents:
4661
diff
changeset
|
217 |
]. |
101cc4d46184
fixes to allow settings dialog to be opened from browser
Claus Gittinger <cg@exept.de>
parents:
4661
diff
changeset
|
218 |
! |
101cc4d46184
fixes to allow settings dialog to be opened from browser
Claus Gittinger <cg@exept.de>
parents:
4661
diff
changeset
|
219 |
|
101cc4d46184
fixes to allow settings dialog to be opened from browser
Claus Gittinger <cg@exept.de>
parents:
4661
diff
changeset
|
220 |
doCancel |
101cc4d46184
fixes to allow settings dialog to be opened from browser
Claus Gittinger <cg@exept.de>
parents:
4661
diff
changeset
|
221 |
super closeRequest. |
101cc4d46184
fixes to allow settings dialog to be opened from browser
Claus Gittinger <cg@exept.de>
parents:
4661
diff
changeset
|
222 |
! |
101cc4d46184
fixes to allow settings dialog to be opened from browser
Claus Gittinger <cg@exept.de>
parents:
4661
diff
changeset
|
223 |
|
4580 | 224 |
doReload |
225 |
||
4660
ac33e6486abb
adapt the changed interface in AbstactSettingsApplication
Michael Beyl <mb@exept.de>
parents:
4580
diff
changeset
|
226 |
settingsAppl readSettings. |
4580 | 227 |
! |
228 |
||
229 |
doSave |
|
230 |
||
4939
101cc4d46184
fixes to allow settings dialog to be opened from browser
Claus Gittinger <cg@exept.de>
parents:
4661
diff
changeset
|
231 |
"/ settingsAppl saveRequest. -- already done in closeRequest. |
101cc4d46184
fixes to allow settings dialog to be opened from browser
Claus Gittinger <cg@exept.de>
parents:
4661
diff
changeset
|
232 |
(settingsAppl saveRequestAsking:false) ifFalse:[ |
101cc4d46184
fixes to allow settings dialog to be opened from browser
Claus Gittinger <cg@exept.de>
parents:
4661
diff
changeset
|
233 |
^ self |
101cc4d46184
fixes to allow settings dialog to be opened from browser
Claus Gittinger <cg@exept.de>
parents:
4661
diff
changeset
|
234 |
]. |
101cc4d46184
fixes to allow settings dialog to be opened from browser
Claus Gittinger <cg@exept.de>
parents:
4661
diff
changeset
|
235 |
^ super closeRequest |
4580 | 236 |
! |
237 |
||
238 |
help |
|
239 |
||
240 |
settingsAppl help |
|
241 |
! ! |
|
242 |
||
243 |
!FileBrowserV2SettingsDialog methodsFor:'initialization & release'! |
|
244 |
||
245 |
closeRequest |
|
246 |
"This is a hook method generated by the Browser. |
|
247 |
It will be invoked when your app/dialog-window is about to be |
|
248 |
closed (this method has a chance to suppress the close). |
|
249 |
See also #closeDownViews, which is invoked when the close is really done." |
|
250 |
||
4939
101cc4d46184
fixes to allow settings dialog to be opened from browser
Claus Gittinger <cg@exept.de>
parents:
4661
diff
changeset
|
251 |
(settingsAppl saveRequestAsking:true) ifFalse:[ |
4580 | 252 |
^ self |
253 |
]. |
|
254 |
^ super closeRequest |
|
255 |
! |
|
256 |
||
257 |
postBuildSubCanvas:aWidget |
|
258 |
||
259 |
settingsAppl := aWidget client. |
|
260 |
aWidget keepClientView:true. |
|
4980 | 261 |
! |
262 |
||
263 |
postOpenWith:aWidget |
|
264 |
||
265 |
settingsAppl readSettings. |
|
266 |
super postOpenWith:aWidget. |
|
4580 | 267 |
! ! |
268 |
||
269 |
!FileBrowserV2SettingsDialog methodsFor:'menu actions'! |
|
270 |
||
271 |
loadSettingsFromFile |
|
272 |
||
273 |
"restore settings from a settings-file." |
|
274 |
||
275 |
"a temporary kludge - we need a central systemSettings object for this, |
|
276 |
which can be saved/restored with a single store/read." |
|
277 |
||
278 |
|fileName| |
|
279 |
||
280 |
fileName := Dialog |
|
281 |
requestFileName:(resources string:'Load Settings From:') |
|
282 |
default:'settings.stx' |
|
283 |
ok:(resources string:'Load') |
|
284 |
abort:(resources string:'Cancel') |
|
285 |
pattern:'*.stx' |
|
286 |
fromDirectory:nil. |
|
287 |
||
288 |
(fileName size == 0) ifTrue:[ |
|
289 |
"/ canceled |
|
290 |
^ self |
|
291 |
]. |
|
292 |
||
293 |
self withWaitCursorDo:[ |
|
294 |
Smalltalk fileIn:fileName. |
|
295 |
Transcript current topView model reOpen. |
|
296 |
self doReload. |
|
297 |
]. |
|
298 |
! |
|
299 |
||
300 |
saveSettingsIntoFile |
|
301 |
||
302 |
|fileName resources| |
|
303 |
||
4660
ac33e6486abb
adapt the changed interface in AbstactSettingsApplication
Michael Beyl <mb@exept.de>
parents:
4580
diff
changeset
|
304 |
resources := self class classResources. |
4580 | 305 |
|
306 |
self doReload. |
|
307 |
||
308 |
fileName := Dialog |
|
309 |
requestFileName:(resources string:'Save settings in:') |
|
310 |
default:'settings.stx' |
|
311 |
ok:(resources string:'Save') |
|
312 |
abort:(resources string:'Cancel') |
|
313 |
pattern:'*.stx' |
|
314 |
fromDirectory:'.'. |
|
315 |
||
316 |
fileName size ~~ 0 ifTrue:[ |
|
317 |
"not canceled" |
|
4660
ac33e6486abb
adapt the changed interface in AbstactSettingsApplication
Michael Beyl <mb@exept.de>
parents:
4580
diff
changeset
|
318 |
UserPreferences current saveIn:fileName. |
4580 | 319 |
] |
320 |
! ! |
|
321 |
||
322 |
!FileBrowserV2SettingsDialog class methodsFor:'documentation'! |
|
323 |
||
324 |
version |
|
5140 | 325 |
^ '$Header: /cvs/stx/stx/libtool/FileBrowserV2SettingsDialog.st,v 1.7 2003-08-29 19:27:47 cg Exp $' |
4580 | 326 |
! ! |