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