0
|
1 |
"
|
5
|
2 |
COPYRIGHT (c) 1991 by Claus Gittinger
|
0
|
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 |
|
|
13 |
StandardSystemView subclass:#Launcher
|
|
14 |
instanceVariableNames:'myMenu exitBox saveBox'
|
|
15 |
classVariableNames:''
|
|
16 |
poolDictionaries:''
|
|
17 |
category:'Interface-Smalltalk'
|
|
18 |
!
|
|
19 |
|
|
20 |
Launcher comment:'
|
|
21 |
|
5
|
22 |
COPYRIGHT (c) 1991 by Claus Gittinger
|
0
|
23 |
All Rights Reserved
|
|
24 |
|
|
25 |
allows startup of smalltalk applications
|
|
26 |
|
5
|
27 |
$Header: /cvs/stx/stx/libtool/OldLauncher.st,v 1.3 1993-10-13 02:48:23 claus Exp $
|
0
|
28 |
written spring 91 by claus
|
|
29 |
'!
|
|
30 |
|
|
31 |
!Launcher class methodsFor:'instance creation'!
|
|
32 |
|
|
33 |
new
|
|
34 |
^ super
|
|
35 |
extent:(100 @ 100)
|
|
36 |
label:'Smalltalk'
|
|
37 |
icon:(Form fromFile:'Smalltalk.xbm' resolution:100)
|
|
38 |
|
|
39 |
"Launcher start"
|
|
40 |
! !
|
|
41 |
|
3
|
42 |
!Launcher methodsFor:'initialize / release'!
|
0
|
43 |
|
|
44 |
initialize
|
|
45 |
super initialize.
|
|
46 |
|
|
47 |
myMenu := ClickMenuView
|
3
|
48 |
labels:(resources array:#(
|
|
49 |
'System Browser'
|
|
50 |
'Changes Browser'
|
|
51 |
'File Browser'
|
|
52 |
'Directory Browser'
|
|
53 |
'Workspace'
|
|
54 |
'Transcript'
|
|
55 |
'Project'
|
|
56 |
'-'
|
|
57 |
'Utilities'
|
|
58 |
'Goodies'
|
|
59 |
'Games & Demos'
|
|
60 |
'-'
|
|
61 |
'info & help'
|
|
62 |
'-'
|
|
63 |
'snapshot'
|
|
64 |
'-'
|
|
65 |
'exit'
|
|
66 |
))
|
0
|
67 |
selectors:#(startSystemBrowser
|
|
68 |
startChangesBrowser
|
|
69 |
startFileBrowser
|
|
70 |
startDirectoryBrowser
|
|
71 |
startWorkspace
|
|
72 |
startTranscript
|
|
73 |
newProject
|
|
74 |
nil
|
|
75 |
utilityMenu
|
|
76 |
goodyMenu
|
|
77 |
gamesMenu
|
|
78 |
nil
|
|
79 |
helpMenu
|
|
80 |
nil
|
|
81 |
saveImage
|
|
82 |
nil
|
|
83 |
exitSmalltalk
|
|
84 |
)
|
|
85 |
receiver:self
|
|
86 |
in:self.
|
|
87 |
|
|
88 |
myMenu subMenuAt:#utilityMenu put:(
|
3
|
89 |
PopUpMenu labels:(resources array:#(
|
0
|
90 |
'Window tree'
|
|
91 |
'Class tree'
|
|
92 |
'-'
|
|
93 |
'Event monitor'
|
|
94 |
'Memory monitor'
|
|
95 |
'Memory usage'
|
|
96 |
'-'
|
|
97 |
'collect Garbage'
|
|
98 |
'ScreenSaver'
|
3
|
99 |
))
|
0
|
100 |
selectors:#(
|
|
101 |
startWindowTreeView
|
|
102 |
startClassTreeView
|
|
103 |
nil
|
|
104 |
startEventMonitor
|
|
105 |
startMemoryMonitor
|
|
106 |
startMemoryUsage
|
|
107 |
nil
|
|
108 |
garbageCollect
|
|
109 |
startScreenSaver
|
|
110 |
)
|
|
111 |
receiver:self
|
|
112 |
for:self
|
|
113 |
|
|
114 |
).
|
|
115 |
|
|
116 |
myMenu subMenuAt:#gamesMenu put:(
|
3
|
117 |
PopUpMenu labels:(resources array:#(
|
0
|
118 |
'Tetris'
|
|
119 |
'TicTacToe'
|
|
120 |
'-'
|
|
121 |
'Animation'
|
|
122 |
'Globe'
|
|
123 |
'-'
|
|
124 |
'LogicTool'
|
3
|
125 |
))
|
0
|
126 |
selectors:#(
|
|
127 |
startTetris
|
|
128 |
startTicTacToe
|
|
129 |
nil
|
|
130 |
startAnimation
|
|
131 |
startGlobeDemo
|
|
132 |
nil
|
|
133 |
startLogicTool
|
|
134 |
)
|
|
135 |
receiver:self
|
|
136 |
for:self
|
|
137 |
|
|
138 |
).
|
|
139 |
|
|
140 |
myMenu subMenuAt:#goodyMenu put:(
|
3
|
141 |
PopUpMenu labels:(resources array:#(
|
0
|
142 |
'Clock'
|
|
143 |
'Address Book'
|
|
144 |
'-'
|
|
145 |
'Directory View'
|
|
146 |
'MailTool'
|
|
147 |
'NewsTool'
|
|
148 |
'-'
|
|
149 |
'DrawTool'
|
3
|
150 |
))
|
0
|
151 |
selectors:#(
|
|
152 |
startClock
|
|
153 |
startAddressBook
|
|
154 |
nil
|
|
155 |
startDirectoryView
|
|
156 |
startMailTool
|
|
157 |
startNewsTool
|
|
158 |
nil
|
|
159 |
startDrawTool
|
|
160 |
)
|
|
161 |
receiver:self
|
|
162 |
for:self
|
|
163 |
|
|
164 |
).
|
|
165 |
|
|
166 |
myMenu subMenuAt:#helpMenu put:(
|
3
|
167 |
PopUpMenu labels:(resources array:#(
|
0
|
168 |
'Overview'
|
|
169 |
'Getting started'
|
|
170 |
'-'
|
|
171 |
'Help Browser'
|
3
|
172 |
))
|
0
|
173 |
selectors:#(
|
|
174 |
showOverview
|
|
175 |
showGettingStarted
|
|
176 |
nil
|
|
177 |
startHelpView
|
|
178 |
)
|
|
179 |
receiver:self
|
|
180 |
for:self
|
|
181 |
|
|
182 |
).
|
|
183 |
|
|
184 |
myMenu borderWidth:0.
|
|
185 |
myMenu origin:(0 @ 0).
|
|
186 |
myMenu font:(self font).
|
3
|
187 |
self extent:(myMenu extent).
|
|
188 |
|
|
189 |
exitBox := EnterBox2 new.
|
|
190 |
exitBox title:(resources at:'save state before exiting ?\\filename for image:') withCRs.
|
|
191 |
exitBox abortText:(resources at:'abort').
|
|
192 |
exitBox okText:(resources at:'exit').
|
|
193 |
exitBox okText2:(resources at:'save & exit').
|
|
194 |
|
|
195 |
saveBox := EnterBox new.
|
|
196 |
saveBox title:(resources at:'filename for image:') withCRs.
|
|
197 |
saveBox abortText:(resources at:'abort').
|
|
198 |
saveBox okText:(resources at:'save').
|
0
|
199 |
!
|
|
200 |
|
|
201 |
realize
|
|
202 |
self extent:(myMenu extent).
|
|
203 |
self minExtent:(myMenu extent).
|
|
204 |
self maxExtent:(myMenu extent).
|
|
205 |
super realize
|
|
206 |
!
|
|
207 |
|
|
208 |
reinitialize
|
|
209 |
"sent after snapin - first reinit menuview,
|
|
210 |
then adjust my size"
|
|
211 |
|
|
212 |
super reinitialize.
|
|
213 |
myMenu reinitialize.
|
|
214 |
self extent:(myMenu extent).
|
|
215 |
!
|
|
216 |
|
3
|
217 |
destroy
|
|
218 |
exitBox notNil ifTrue:[
|
|
219 |
exitBox destroy.
|
|
220 |
exitBox := nil
|
|
221 |
].
|
|
222 |
saveBox notNil ifTrue:[
|
|
223 |
exitBox destroy.
|
|
224 |
saveBox := nil
|
|
225 |
].
|
|
226 |
super destroy
|
|
227 |
!
|
|
228 |
|
0
|
229 |
addToCurrentProject
|
|
230 |
"ignored here"
|
|
231 |
|
|
232 |
^ self
|
|
233 |
! !
|
|
234 |
|
|
235 |
!Launcher methodsFor:'events'!
|
|
236 |
|
|
237 |
saveAndTerminate
|
|
238 |
ObjectMemory snapShotOn:name
|
|
239 |
! !
|
|
240 |
|
|
241 |
!Launcher methodsFor:'user interaction'!
|
|
242 |
|
|
243 |
startScreenSaver
|
|
244 |
ScreenSaver start
|
|
245 |
!
|
|
246 |
|
|
247 |
startSystemBrowser
|
|
248 |
SystemBrowser start
|
|
249 |
!
|
|
250 |
|
|
251 |
startChangesBrowser
|
|
252 |
ChangesBrowser start
|
|
253 |
!
|
|
254 |
|
|
255 |
startFileBrowser
|
|
256 |
FileBrowser start
|
|
257 |
!
|
|
258 |
|
|
259 |
startDirectoryBrowser
|
|
260 |
DirectoryBrowser start
|
|
261 |
!
|
|
262 |
|
|
263 |
startDirectoryView
|
|
264 |
DirectoryView start
|
|
265 |
!
|
|
266 |
|
|
267 |
startWorkspace
|
|
268 |
Workspace start
|
|
269 |
!
|
|
270 |
|
|
271 |
startWindowTreeView
|
|
272 |
WindowTreeView start
|
|
273 |
!
|
|
274 |
|
|
275 |
startClassTreeView
|
|
276 |
ClassTreeGraphView start
|
|
277 |
!
|
|
278 |
|
|
279 |
startEventMonitor
|
|
280 |
EventMonitor start
|
|
281 |
!
|
|
282 |
|
|
283 |
startMemoryUsage
|
|
284 |
MemoryDebugger start
|
|
285 |
!
|
|
286 |
|
|
287 |
startMemoryMonitor
|
|
288 |
Monitor start
|
|
289 |
!
|
|
290 |
|
|
291 |
startTranscript
|
|
292 |
((Smalltalk at:#Transcript) isKindOf:TextCollector) ifTrue:[
|
|
293 |
"there is only one transcript !!"
|
|
294 |
Transcript realize. "maybe it was iconified"
|
|
295 |
Transcript raise
|
|
296 |
] ifFalse:[
|
|
297 |
Smalltalk at:#Transcript put:(TextCollector newTranscript)
|
|
298 |
]
|
|
299 |
!
|
|
300 |
|
|
301 |
newProject
|
|
302 |
(ProjectView for:(Project new)) realize
|
|
303 |
!
|
|
304 |
|
|
305 |
startXterm
|
|
306 |
OperatingSystem executeCommand:'xterm &'
|
|
307 |
!
|
|
308 |
|
|
309 |
startAddressBook
|
|
310 |
AddressBook start
|
|
311 |
!
|
|
312 |
|
|
313 |
startNewsTool
|
|
314 |
NewsView start
|
|
315 |
!
|
|
316 |
|
|
317 |
startMailTool
|
|
318 |
MailView start
|
|
319 |
!
|
|
320 |
|
|
321 |
startClock
|
|
322 |
Clock start
|
|
323 |
!
|
|
324 |
|
|
325 |
startRoundClock
|
|
326 |
RoundClock start
|
|
327 |
!
|
|
328 |
|
|
329 |
startAnimation
|
|
330 |
Animation start
|
|
331 |
!
|
|
332 |
|
|
333 |
startGlobeDemo
|
|
334 |
GlobeDemo start
|
|
335 |
!
|
|
336 |
|
|
337 |
startRoundGlobeDemo
|
|
338 |
RoundGlobeDemo start
|
|
339 |
!
|
|
340 |
|
|
341 |
startTetris
|
|
342 |
Tetris start
|
|
343 |
!
|
|
344 |
|
|
345 |
startTicTacToe
|
|
346 |
TicTacToe start
|
|
347 |
!
|
|
348 |
|
|
349 |
startDrawTool
|
|
350 |
DrawTool start
|
|
351 |
!
|
|
352 |
|
|
353 |
startLogicTool
|
|
354 |
LogicTool start
|
|
355 |
!
|
|
356 |
|
|
357 |
garbageCollect
|
|
358 |
|nBytesBefore nReclaimed|
|
|
359 |
|
|
360 |
nBytesBefore := ObjectMemory oldSpaceUsed.
|
|
361 |
ObjectMemory garbageCollect.
|
|
362 |
nReclaimed := nBytesBefore - ObjectMemory oldSpaceUsed.
|
|
363 |
nReclaimed > 0 ifTrue:[
|
|
364 |
Transcript show:'reclaimed '.
|
|
365 |
nReclaimed > 1024 ifTrue:[
|
|
366 |
nReclaimed > (1024 * 1024) ifTrue:[
|
|
367 |
Transcript show:(nReclaimed // (1024 * 1024)) printString.
|
|
368 |
Transcript showCr:' Mb.'
|
|
369 |
] ifFalse:[
|
|
370 |
Transcript show:(nReclaimed // 1024) printString.
|
|
371 |
Transcript showCr:' Kb.'
|
|
372 |
]
|
|
373 |
] ifFalse:[
|
|
374 |
Transcript show:nReclaimed printString.
|
|
375 |
Transcript showCr:' bytes.'
|
|
376 |
]
|
|
377 |
]
|
|
378 |
!
|
|
379 |
|
3
|
380 |
warnIfAbsent:aPath
|
|
381 |
|s|
|
0
|
382 |
|
3
|
383 |
s := Smalltalk systemFileStreamFor:aPath.
|
|
384 |
s isNil ifTrue:[
|
|
385 |
self warn:('document ' , aPath , ' not available').
|
|
386 |
^ nil
|
|
387 |
].
|
|
388 |
^ s pathName
|
|
389 |
!
|
|
390 |
|
|
391 |
showOverview
|
|
392 |
|f|
|
|
393 |
|
|
394 |
f := self warnIfAbsent:'doc/overview.doc'.
|
|
395 |
f notNil ifTrue:[
|
|
396 |
(EditTextView startOn:f) readOnly
|
|
397 |
]
|
0
|
398 |
!
|
|
399 |
|
|
400 |
showGettingStarted
|
3
|
401 |
|f|
|
0
|
402 |
|
3
|
403 |
f := self warnIfAbsent:'doc/manuals/gettingStarted.rtf'.
|
|
404 |
f notNil ifTrue:[
|
|
405 |
DocumentView startOn:f
|
|
406 |
]
|
0
|
407 |
!
|
|
408 |
|
|
409 |
startHelpView
|
|
410 |
self warn:'The HelpSystem is still under construction.
|
|
411 |
|
|
412 |
You will see a pre-pre release.'.
|
|
413 |
HelpView start
|
|
414 |
!
|
|
415 |
|
|
416 |
saveImage
|
|
417 |
saveBox isNil ifTrue:[
|
|
418 |
saveBox := EnterBox new.
|
|
419 |
saveBox title:(resources at:'filename for image:') withCRs.
|
|
420 |
saveBox abortText:(resources at:'abort').
|
|
421 |
saveBox okText:(resources at:'save')
|
|
422 |
].
|
|
423 |
"this is a kludge - put into above if when
|
|
424 |
stack contexts survive a snapout/snapin"
|
|
425 |
|
|
426 |
saveBox action:[:name |
|
|
427 |
ObjectMemory snapShotOn:name.
|
|
428 |
Class addChangeRecordForSnapshot
|
|
429 |
].
|
|
430 |
|
|
431 |
(ImageName isNil or:[ImageName isBlank]) ifTrue:[
|
|
432 |
saveBox initialText:'st.img'
|
|
433 |
] ifFalse:[
|
|
434 |
saveBox initialText:ImageName
|
|
435 |
].
|
|
436 |
saveBox showAtPointer
|
|
437 |
!
|
|
438 |
|
|
439 |
exitSmalltalk
|
|
440 |
exitBox isNil ifTrue:[
|
|
441 |
exitBox := EnterBox2 new.
|
|
442 |
exitBox title:(resources at:'save state before exiting ?\\filename for image:') withCRs.
|
|
443 |
exitBox abortText:(resources at:'abort').
|
|
444 |
exitBox okText:(resources at:'exit').
|
|
445 |
exitBox okText2:(resources at:'save & exit').
|
|
446 |
].
|
|
447 |
|
|
448 |
exitBox action:[:name | Smalltalk exit].
|
|
449 |
exitBox action2:[:name |
|
|
450 |
ObjectMemory snapShotOn:name.
|
|
451 |
Class addChangeRecordForSnapshot.
|
|
452 |
Smalltalk exit
|
|
453 |
].
|
|
454 |
|
|
455 |
(ImageName isNil or:[ImageName isBlank]) ifTrue:[
|
|
456 |
exitBox initialText:'st.img'
|
|
457 |
] ifFalse:[
|
|
458 |
exitBox initialText:ImageName
|
|
459 |
].
|
|
460 |
exitBox showAtPointer
|
|
461 |
! !
|