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