88
|
1 |
"
|
|
2 |
COPYRIGHT (c) 1995 by Claus Gittinger
|
|
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 |
"
|
86
|
12 |
|
90
|
13 |
'From Smalltalk/X, Version:2.10.5 on 31-mar-1995 at 12:35:15 pm'!
|
|
14 |
|
86
|
15 |
ApplicationModel subclass:#NewLauncher
|
|
16 |
instanceVariableNames:'myMenu buttonPanel transcript infoView infoProcess helpIsOn'
|
|
17 |
classVariableNames:'CachedAboutIcon'
|
|
18 |
poolDictionaries:''
|
|
19 |
category:'Interface-Smalltalk'
|
|
20 |
!
|
|
21 |
|
88
|
22 |
!NewLauncher class methodsFor:'documentation'!
|
|
23 |
|
|
24 |
copyright
|
|
25 |
"
|
|
26 |
COPYRIGHT (c) 1995 by Claus Gittinger
|
|
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 |
!
|
|
37 |
|
|
38 |
version
|
|
39 |
"
|
90
|
40 |
$Header: /cvs/stx/stx/libtool/Launcher.st,v 1.4 1995-03-31 03:07:27 claus Exp $
|
88
|
41 |
"
|
|
42 |
! !
|
|
43 |
|
86
|
44 |
!NewLauncher class methodsFor:'defaults'!
|
|
45 |
|
|
46 |
aboutIcon
|
|
47 |
|image|
|
|
48 |
|
|
49 |
CachedAboutIcon notNil ifTrue:[^ CachedAboutIcon].
|
|
50 |
|
|
51 |
image := Image fromFile:'SmalltalkX.xbm'.
|
|
52 |
image isNil ifTrue:[
|
|
53 |
^ 'about'
|
|
54 |
] ifFalse:[
|
|
55 |
|green dark|
|
|
56 |
|
|
57 |
Display hasColors ifTrue:[
|
|
58 |
green := (Color red:0 green:80 blue:20) darkened.
|
|
59 |
] ifFalse:[
|
|
60 |
green := White.
|
|
61 |
].
|
|
62 |
Display hasGreyscales ifTrue:[
|
|
63 |
dark := Color grey:10.
|
|
64 |
] ifFalse:[
|
|
65 |
dark := Black.
|
|
66 |
].
|
|
67 |
image colorMap:(Array with:dark with:green); photometric:#palette.
|
|
68 |
image := image magnifyBy:0.4.
|
|
69 |
Display depth > 2 ifTrue:[
|
|
70 |
image := (Image implementorForDepth:Display depth) fromImage:image.
|
|
71 |
]
|
|
72 |
].
|
|
73 |
CachedAboutIcon := image.
|
|
74 |
^ image
|
|
75 |
|
|
76 |
"
|
|
77 |
CachedAboutIcon := nil
|
|
78 |
"
|
|
79 |
! !
|
|
80 |
|
|
81 |
!NewLauncher class methodsFor:'startup'!
|
|
82 |
|
|
83 |
open
|
|
84 |
|top launcher|
|
|
85 |
|
|
86 |
top := StandardSystemView new.
|
|
87 |
top label:'Smalltalk/X'.
|
|
88 |
top extent:(400@300 ).
|
|
89 |
|
|
90 |
launcher := self new setupViewsIn:top.
|
|
91 |
|
|
92 |
top open.
|
|
93 |
"
|
|
94 |
raise its prio ...
|
|
95 |
"
|
|
96 |
top windowGroup process priority:(Processor userSchedulingPriority + 1).
|
|
97 |
|
|
98 |
"
|
|
99 |
self open
|
|
100 |
"
|
|
101 |
! !
|
|
102 |
|
90
|
103 |
!NewLauncher methodsFor:'initialize / release'!
|
86
|
104 |
|
90
|
105 |
setupTranscriptIn:aView
|
|
106 |
|v|
|
86
|
107 |
|
90
|
108 |
(Transcript notNil and:[Transcript ~~ Stderr]) ifTrue:[
|
|
109 |
Transcript topView destroy.
|
|
110 |
].
|
86
|
111 |
|
90
|
112 |
v := HVScrollableView
|
|
113 |
for:TextCollector
|
|
114 |
miniScrollerH:true
|
|
115 |
miniScrollerV:false
|
|
116 |
in:aView.
|
86
|
117 |
|
90
|
118 |
v origin:(0.0 @ (buttonPanel corner y + View viewSpacing))
|
|
119 |
corner:(1.0 @ 1.0).
|
|
120 |
transcript := v scrolledView.
|
|
121 |
transcript beTranscript.
|
86
|
122 |
!
|
|
123 |
|
|
124 |
setupMenu
|
|
125 |
"setup the pulldown menu"
|
|
126 |
|
|
127 |
|l s|
|
|
128 |
|
|
129 |
myMenu labels:(resources array:#(
|
88
|
130 |
'about'
|
|
131 |
'file'
|
|
132 |
'classes'
|
|
133 |
'tools'
|
|
134 |
'projects'
|
|
135 |
'settings'
|
|
136 |
'goodies'
|
|
137 |
'demos'
|
|
138 |
'help')).
|
86
|
139 |
myMenu labels at:1 put:(self class aboutIcon).
|
|
140 |
|
|
141 |
myMenu selectors:#(
|
88
|
142 |
#about
|
|
143 |
#file
|
|
144 |
#classes
|
|
145 |
#tools
|
|
146 |
#projects
|
|
147 |
#settings
|
|
148 |
#goodies
|
|
149 |
#demos
|
|
150 |
#help).
|
86
|
151 |
|
|
152 |
myMenu at:#about
|
88
|
153 |
putLabels:(resources array:#(
|
|
154 |
'about Smalltalk/X ...'
|
|
155 |
))
|
|
156 |
selectors:#(
|
|
157 |
#about
|
|
158 |
)
|
|
159 |
receiver:self.
|
86
|
160 |
|
|
161 |
myMenu at:#file
|
88
|
162 |
putLabels:(resources array:#(
|
|
163 |
'file browser'
|
|
164 |
'-'
|
|
165 |
'snapshot'
|
|
166 |
'snapshot & exit'
|
|
167 |
'exit'
|
|
168 |
))
|
|
169 |
selectors:#(
|
|
170 |
#startFileBrowser
|
|
171 |
nil
|
|
172 |
#snapshot
|
|
173 |
#snapshotAndExit
|
|
174 |
#exit
|
|
175 |
)
|
|
176 |
receiver:self.
|
86
|
177 |
|
|
178 |
myMenu at:#classes
|
88
|
179 |
putLabels:(resources array:#(
|
|
180 |
'system browser'
|
|
181 |
'class browser'
|
|
182 |
'full class browser'
|
|
183 |
'class hierarchy browser'
|
|
184 |
'class tree'
|
|
185 |
'-'
|
|
186 |
'implementors'
|
|
187 |
'senders'
|
|
188 |
'-'
|
|
189 |
'change browser'
|
|
190 |
))
|
|
191 |
selectors:#(
|
|
192 |
#startSystemBrowser
|
|
193 |
#startClassBrowser
|
|
194 |
#startFullClassBrowser
|
|
195 |
#startClassHierarchyBrowser
|
|
196 |
#startClassTreeView
|
|
197 |
nil
|
|
198 |
#browseImplementors
|
|
199 |
#browseSenders
|
|
200 |
nil
|
|
201 |
#startChangesBrowser
|
|
202 |
)
|
|
203 |
receiver:self.
|
86
|
204 |
|
|
205 |
myMenu at:#tools
|
88
|
206 |
putLabels:(resources array:#(
|
|
207 |
'workspace'
|
|
208 |
'-'
|
|
209 |
'process monitor'
|
|
210 |
'memory monitor'
|
|
211 |
'-'
|
|
212 |
'memory usage'
|
|
213 |
'-'
|
|
214 |
'window tree'
|
|
215 |
'inspect view'
|
|
216 |
'destroy view'
|
|
217 |
))
|
|
218 |
selectors:#(
|
|
219 |
#startWorkspace
|
|
220 |
nil
|
|
221 |
#startProcessMonitor
|
|
222 |
#startMemoryMonitor
|
|
223 |
nil
|
|
224 |
#startMemoryUsageView
|
|
225 |
nil
|
|
226 |
#startWindowTreeView
|
|
227 |
#viewInspect
|
|
228 |
#viewDestroy
|
|
229 |
)
|
|
230 |
receiver:self.
|
86
|
231 |
|
|
232 |
myMenu at:#projects
|
88
|
233 |
putLabels:(resources array:#(
|
|
234 |
'new project'
|
|
235 |
'-'
|
|
236 |
'select project'
|
|
237 |
))
|
|
238 |
selectors:#(
|
|
239 |
#newProject
|
|
240 |
nil
|
|
241 |
#selectProject
|
|
242 |
)
|
|
243 |
receiver:self.
|
86
|
244 |
|
|
245 |
myMenu at:#settings
|
88
|
246 |
putLabels:(resources array:#(
|
|
247 |
'language'
|
|
248 |
'view style'
|
89
|
249 |
"/ 'compilation'
|
88
|
250 |
))
|
|
251 |
selectors:#(
|
|
252 |
#languageSetting
|
|
253 |
#viewStyleSetting
|
89
|
254 |
"/ #compilerSetting
|
88
|
255 |
)
|
|
256 |
receiver:self.
|
86
|
257 |
|
|
258 |
myMenu at:#goodies
|
88
|
259 |
putLabels:(resources array:#(
|
|
260 |
'clock'
|
|
261 |
'calendar'
|
|
262 |
'-'
|
|
263 |
'mail tool'
|
|
264 |
'news tool'
|
|
265 |
))
|
|
266 |
selectors:#(
|
|
267 |
#startClock
|
|
268 |
#startCalendar
|
|
269 |
nil
|
|
270 |
#startMailTool
|
|
271 |
#startNewsTool
|
|
272 |
)
|
|
273 |
receiver:self.
|
86
|
274 |
|
90
|
275 |
self setupDemoMenu.
|
86
|
276 |
|
|
277 |
ActiveHelp notNil ifTrue:[
|
88
|
278 |
l := #(
|
|
279 |
'\c active help'
|
|
280 |
'ST/X documentation'
|
|
281 |
).
|
|
282 |
s := #(
|
|
283 |
#toggleActiveHelp
|
|
284 |
#startDocumentationTool
|
|
285 |
)
|
86
|
286 |
] ifFalse:[
|
88
|
287 |
l := #(
|
|
288 |
'ST/X documentation'
|
|
289 |
).
|
|
290 |
s := #(
|
|
291 |
#startDocumentationTool
|
|
292 |
)
|
86
|
293 |
].
|
|
294 |
|
|
295 |
myMenu at:#help
|
88
|
296 |
putLabels:(resources array:l)
|
|
297 |
selectors:s
|
|
298 |
receiver:self.
|
86
|
299 |
!
|
|
300 |
|
90
|
301 |
setupInfoViewIn:topView
|
|
302 |
|spc|
|
86
|
303 |
|
90
|
304 |
spc := View viewSpacing.
|
|
305 |
infoView := Label label:'' in:topView.
|
|
306 |
infoView adjust:#left; borderWidth:0.
|
|
307 |
infoView level:-1.
|
|
308 |
transcript superView bottomInset:(infoView height + spc).
|
86
|
309 |
|
90
|
310 |
infoView topInset:(infoView height negated - spc);
|
|
311 |
bottomInset:spc // 2;
|
|
312 |
leftInset:spc//2;
|
|
313 |
rightInset:spc//2.
|
|
314 |
infoView origin:0.0 @ 1.0 corner:1.0@1.0.
|
|
315 |
infoView model:self; aspect:#info.
|
86
|
316 |
|
90
|
317 |
Project addDependent:self.
|
|
318 |
|
|
319 |
"
|
|
320 |
NewLauncher open
|
|
321 |
"
|
86
|
322 |
!
|
|
323 |
|
|
324 |
setupViewsIn:topView
|
|
325 |
"create the pulldown menu, buttonPanel and transcript view"
|
|
326 |
|
|
327 |
|frame|
|
|
328 |
|
|
329 |
topView model:self.
|
|
330 |
|
|
331 |
myMenu := PullDownMenu in:topView.
|
|
332 |
myMenu origin:0.0@0.0 corner:[1.0@nil].
|
|
333 |
|
|
334 |
self setupMenu.
|
|
335 |
self setupButtonPanelIn:topView.
|
|
336 |
self setupTranscriptIn:topView.
|
|
337 |
self setupInfoViewIn:topView.
|
|
338 |
|
|
339 |
topView extent:((transcript font widthOf:'3')*60)
|
|
340 |
@
|
|
341 |
((transcript font height) * 20).
|
|
342 |
|
|
343 |
"
|
|
344 |
NewLauncher open
|
|
345 |
"
|
|
346 |
!
|
|
347 |
|
90
|
348 |
focusSequence
|
|
349 |
^ (Array with:myMenu) , buttonPanel subViews , (Array with:Transcript)
|
86
|
350 |
!
|
|
351 |
|
|
352 |
setupButtonPanelIn:aTopView
|
|
353 |
"create the buttonPanel"
|
|
354 |
|
|
355 |
|sep spc|
|
|
356 |
|
|
357 |
spc := View viewSpacing // 2.
|
|
358 |
buttonPanel := HorizontalPanelView in:aTopView.
|
|
359 |
buttonPanel level:-1; borderWidth:0.
|
|
360 |
buttonPanel horizontalLayout:#leftSpace.
|
|
361 |
|
90
|
362 |
self buttonPanelSpec do:[:entry |
|
|
363 |
|sel b sep|
|
86
|
364 |
|
90
|
365 |
sel := entry at:1.
|
|
366 |
sel isNil ifTrue:[
|
|
367 |
sep := View in:buttonPanel.
|
|
368 |
sep extent:32@1; borderWidth:0.
|
|
369 |
] ifFalse:[
|
|
370 |
b := Button in:buttonPanel.
|
|
371 |
b form:(Image fromFile:(entry at:2)).
|
|
372 |
b model:self; change:sel
|
|
373 |
]
|
86
|
374 |
].
|
|
375 |
|
|
376 |
buttonPanel origin:0.0 @ myMenu height
|
|
377 |
corner:(1.0 @ (myMenu height + buttonPanel preferedExtent y)).
|
|
378 |
|
|
379 |
buttonPanel leftInset:spc; rightInset:spc.
|
|
380 |
!
|
|
381 |
|
|
382 |
release
|
|
383 |
infoProcess notNil ifTrue:[
|
|
384 |
infoProcess terminate.
|
|
385 |
infoProcess := nil.
|
|
386 |
].
|
|
387 |
super release
|
88
|
388 |
!
|
|
389 |
|
90
|
390 |
setupDemoMenu
|
|
391 |
"setup the demo pulldown menu"
|
|
392 |
|
|
393 |
|m|
|
|
394 |
|
|
395 |
myMenu at:#demos
|
|
396 |
putLabels:(resources array:#(
|
|
397 |
'games'
|
|
398 |
'geometric designs'
|
|
399 |
'simple animations'
|
|
400 |
'3D graphics'
|
|
401 |
'graphic editors'
|
|
402 |
))
|
|
403 |
selectors:#(
|
|
404 |
games
|
|
405 |
geometricDesigns
|
|
406 |
simpleAnimations
|
|
407 |
#'3Dgraphics'
|
|
408 |
#graphicEditors
|
|
409 |
)
|
|
410 |
receiver:self.
|
|
411 |
|
|
412 |
"
|
|
413 |
only to show two different ways of defining a popUpMenu,
|
|
414 |
we use labels:selectors:receiver: here:
|
|
415 |
"
|
|
416 |
m := myMenu menuAt:#demos.
|
|
417 |
m subMenuAt:#games
|
|
418 |
put:(PopUpMenu
|
|
419 |
labels:(resources array:#(
|
|
420 |
'Tetris'
|
|
421 |
'Tic Tac Toe'
|
|
422 |
))
|
|
423 |
selectors:#(
|
|
424 |
startTetris
|
|
425 |
startTicTacToe
|
|
426 |
)
|
|
427 |
receiver:self).
|
|
428 |
|
|
429 |
"
|
|
430 |
and labels:selector:args:receiver: here:
|
|
431 |
"
|
|
432 |
m subMenuAt:#geometricDesigns
|
|
433 |
put:(PopUpMenu
|
|
434 |
labels:(resources array:#(
|
|
435 |
'Pen demo'
|
|
436 |
'Commander demo'
|
|
437 |
))
|
|
438 |
selector:#openDemo:
|
|
439 |
args:#(
|
|
440 |
PenDemo
|
|
441 |
CommanderDemo
|
|
442 |
)
|
|
443 |
receiver:self).
|
|
444 |
|
|
445 |
m subMenuAt:#simpleAnimations
|
|
446 |
put:(PopUpMenu
|
|
447 |
labels:(resources array:#(
|
|
448 |
'Animation'
|
|
449 |
'Globe demo'
|
|
450 |
))
|
|
451 |
selector:#openDemo:
|
|
452 |
args:#(
|
|
453 |
Animation
|
|
454 |
GlobeDemo
|
|
455 |
)
|
|
456 |
receiver:self).
|
|
457 |
|
|
458 |
m subMenuAt:#'3Dgraphics'
|
|
459 |
put:(PopUpMenu
|
|
460 |
labels:(resources
|
|
461 |
array:#(
|
|
462 |
'plane'
|
|
463 |
'tetra'
|
|
464 |
'cube (wireframe)'
|
|
465 |
'cube (solid)'
|
|
466 |
'cube (light)'
|
|
467 |
'cube (light & texture)'
|
|
468 |
'sphere (wireframe)'
|
|
469 |
'sphere (light)'
|
|
470 |
'planet'
|
|
471 |
'teapot'
|
|
472 |
'logo'
|
|
473 |
))
|
|
474 |
selector:#openDemo:
|
|
475 |
args:#(
|
|
476 |
GLPlaneDemoView2
|
|
477 |
GLTetraDemoView
|
|
478 |
GLWireCubeDemoView
|
|
479 |
GLCubeDemoView
|
|
480 |
GLCubeDemoView2
|
|
481 |
GLBrickCubeDemoView
|
|
482 |
GLWireSphereDemoView
|
|
483 |
GLSphereDemoView2
|
|
484 |
GLPlanetDemoView
|
|
485 |
GLTeapotDemo
|
|
486 |
Logo3DView1
|
|
487 |
)
|
|
488 |
receiver:self).
|
|
489 |
|
|
490 |
m subMenuAt:#graphicEditors
|
|
491 |
put:(PopUpMenu
|
|
492 |
labels:(resources array:#(
|
|
493 |
'DrawTool'
|
|
494 |
'LogicTool'
|
|
495 |
))
|
|
496 |
selector:#openDemo:
|
|
497 |
args:#(
|
|
498 |
DrawTool
|
|
499 |
LogicTool
|
|
500 |
)
|
|
501 |
receiver:self).
|
|
502 |
|
|
503 |
|
|
504 |
!
|
|
505 |
|
|
506 |
buttonPanelSpec
|
|
507 |
"return a spec for the buttons in the panel;
|
|
508 |
entries consists of selector and bitmap-filename.
|
|
509 |
nil selectors are taken as separators (see setupButtonPanel)"
|
|
510 |
|
|
511 |
^ #(
|
|
512 |
#(startSystemBrowser 'SBrowser32x32.xbm')
|
|
513 |
#(startFileBrowser 'FBrowser32x32.xbm')
|
|
514 |
#(nil nil)
|
|
515 |
#(startChangesBrowser 'CBrowser32x32.xbm')
|
|
516 |
)
|
86
|
517 |
! !
|
|
518 |
|
|
519 |
!NewLauncher methodsFor:'actions - classes'!
|
|
520 |
|
|
521 |
startFileBrowser
|
|
522 |
FileBrowser open
|
|
523 |
!
|
|
524 |
|
90
|
525 |
startChangesBrowser
|
|
526 |
ChangesBrowser open
|
|
527 |
!
|
|
528 |
|
86
|
529 |
startSystemBrowser
|
|
530 |
SystemBrowser open
|
|
531 |
!
|
|
532 |
|
|
533 |
startWorkspace
|
|
534 |
Workspace open
|
|
535 |
!
|
|
536 |
|
|
537 |
startClassBrowser
|
90
|
538 |
SystemBrowser askThenBrowseClass
|
|
539 |
!
|
|
540 |
|
|
541 |
startFullClassBrowser
|
|
542 |
SystemBrowser askThenBrowseFullClassProtocol
|
86
|
543 |
!
|
|
544 |
|
|
545 |
startClassHierarchyBrowser
|
90
|
546 |
SystemBrowser askThenBrowseClassHierarchy
|
86
|
547 |
!
|
|
548 |
|
|
549 |
browseImplementors
|
|
550 |
|enterBox|
|
|
551 |
|
|
552 |
enterBox := EnterBox title:(resources at:'Browse implementors of:') withCRs.
|
|
553 |
enterBox okText:(resources at:'browse').
|
|
554 |
enterBox action:[:selectorName |
|
|
555 |
|cls|
|
|
556 |
|
|
557 |
SystemBrowser browseImplementorsOf:selectorName
|
|
558 |
].
|
|
559 |
enterBox showAtPointer
|
|
560 |
!
|
|
561 |
|
|
562 |
browseSenders
|
|
563 |
|enterBox|
|
|
564 |
|
|
565 |
enterBox := EnterBox title:(resources at:'Browse senders of:') withCRs.
|
|
566 |
enterBox okText:(resources at:'browse').
|
|
567 |
enterBox action:[:selectorName |
|
|
568 |
|cls|
|
|
569 |
|
|
570 |
SystemBrowser browseAllCallsOn:selectorName
|
|
571 |
].
|
|
572 |
enterBox showAtPointer
|
|
573 |
!
|
|
574 |
|
|
575 |
startClassTreeView
|
|
576 |
ClassTreeGraphView open
|
|
577 |
! !
|
|
578 |
|
90
|
579 |
!NewLauncher methodsFor:'actions - settings'!
|
|
580 |
|
|
581 |
viewStyleSetting
|
|
582 |
|listOfStyles resourceDir dir box|
|
|
583 |
|
|
584 |
"
|
|
585 |
search resources directory for a list of .style files ...
|
|
586 |
"
|
|
587 |
|
|
588 |
resourceDir := Smalltalk getSystemFileName:'resources'.
|
|
589 |
dir := FileDirectory directoryNamed:resourceDir.
|
|
590 |
|
|
591 |
listOfStyles := dir select:[:aFileName | aFileName endsWith:'.style'].
|
|
592 |
listOfStyles := listOfStyles collect:[:aFileName | aFileName copyWithoutLast:6].
|
|
593 |
|
|
594 |
box := ListSelectionBox new.
|
|
595 |
box title:(resources string:'STYLE_MSG') withCRs.
|
|
596 |
box label:(resources string:'Style selection').
|
|
597 |
box list:listOfStyles.
|
|
598 |
box initialText:View defaultStyle.
|
|
599 |
box action:[:newStyle |
|
|
600 |
transcript topView withCursor:Cursor wait do:[
|
|
601 |
Transcript showCr:'change style to ' , newStyle , ' ...'.
|
|
602 |
View defaultStyle:newStyle asSymbol.
|
|
603 |
]
|
|
604 |
].
|
|
605 |
box showAtPointer
|
|
606 |
!
|
|
607 |
|
|
608 |
languageSetting
|
|
609 |
|listOfLanguages box|
|
|
610 |
|
|
611 |
"
|
|
612 |
hardwiring here is stupid - need a resource file
|
|
613 |
which lists languagenames which have all texts available
|
|
614 |
in resource files ...
|
|
615 |
"
|
|
616 |
listOfLanguages := #('english'
|
|
617 |
'german'
|
|
618 |
'french'
|
|
619 |
'spanish'
|
|
620 |
'italian'
|
|
621 |
).
|
|
622 |
|
|
623 |
box := ListSelectionBox new.
|
|
624 |
box title:(resources string:'LANG_MSG') withCRs.
|
|
625 |
box label:(resources string:'Language selection').
|
|
626 |
box list:listOfLanguages.
|
|
627 |
box initialText:(Language).
|
|
628 |
box action:[:newLanguage |
|
|
629 |
transcript topView withCursor:Cursor wait do:[
|
|
630 |
Transcript showCr:'change language to ' , newLanguage , ' ...'.
|
|
631 |
Smalltalk at:#Language put:newLanguage asSymbol.
|
|
632 |
Smalltalk changed:#Language.
|
|
633 |
ResourcePack flushCachedResourcePacks
|
|
634 |
]
|
|
635 |
].
|
|
636 |
box showAtPointer
|
|
637 |
!
|
|
638 |
|
|
639 |
compilerSetting
|
|
640 |
! !
|
|
641 |
|
86
|
642 |
!NewLauncher methodsFor:'infoview update'!
|
|
643 |
|
|
644 |
info
|
|
645 |
|project projectName projectDir|
|
|
646 |
|
|
647 |
(project := Project current) isNil ifTrue:[
|
88
|
648 |
projectName := '* none *'.
|
|
649 |
projectDir := '.'.
|
86
|
650 |
] ifFalse:[
|
88
|
651 |
projectName := project name.
|
|
652 |
projectDir := project directory.
|
86
|
653 |
].
|
|
654 |
|
|
655 |
^ resources
|
88
|
656 |
string:'project: ''%1'' fileOut to: ''%2'''
|
|
657 |
with:projectName
|
|
658 |
with:(projectDir contractTo:30)
|
86
|
659 |
! !
|
|
660 |
|
|
661 |
!NewLauncher methodsFor:'actions - about & help'!
|
|
662 |
|
|
663 |
about
|
|
664 |
|box|
|
|
665 |
|
|
666 |
box := AboutBox new.
|
|
667 |
box autoHideAfter:10 with:[].
|
|
668 |
box showAtCenter
|
|
669 |
!
|
|
670 |
|
89
|
671 |
startDocumentationTool
|
|
672 |
|box|
|
|
673 |
|
|
674 |
|
|
675 |
box := YesNoBox title:'Sorry, the ST/X HTML reader is not yet released
|
|
676 |
and therefore not included in this package.
|
|
677 |
|
|
678 |
Shall I try to open some other reader ?
|
|
679 |
'.
|
|
680 |
(box confirm) ifTrue:[
|
|
681 |
"look for a reader"
|
|
682 |
|
|
683 |
|s whereIsDoc|
|
|
684 |
|
|
685 |
s := Smalltalk systemFileStreamFor:'doc/online/english/TOP.html'.
|
|
686 |
s isNil ifTrue:[
|
|
687 |
self warn:'no documentation files available'.
|
|
688 |
^ self.
|
|
689 |
].
|
|
690 |
whereIsDoc := s pathName asFilename directory asString.
|
|
691 |
s close.
|
|
692 |
|
|
693 |
#('Mosaic' 'mosaic' 'netscape' 'chimera')
|
|
694 |
do:[:reader |
|
|
695 |
|cmd|
|
|
696 |
|
|
697 |
|
|
698 |
cmd := reader , ' ' , whereIsDoc , '/TOP.html &'.
|
|
699 |
(OperatingSystem executeCommand:cmd) ifTrue:[
|
|
700 |
^ self
|
|
701 |
]
|
|
702 |
].
|
|
703 |
self warn:'Sorry, no HTML reader seems to be available.
|
|
704 |
|
|
705 |
you should get one of Mosaic, netscape, chimera ...
|
|
706 |
... or wait till HTML support in ST/X is complete.'.
|
|
707 |
]
|
|
708 |
!
|
|
709 |
|
86
|
710 |
toggleActiveHelp
|
|
711 |
ActiveHelp notNil ifTrue:[
|
88
|
712 |
helpIsOn isNil ifTrue:[helpIsOn := false].
|
|
713 |
helpIsOn := helpIsOn not.
|
|
714 |
helpIsOn ifTrue:[
|
|
715 |
ActiveHelp start
|
|
716 |
] ifFalse:[
|
|
717 |
ActiveHelp stop
|
|
718 |
]
|
86
|
719 |
].
|
|
720 |
! !
|
|
721 |
|
|
722 |
!NewLauncher methodsFor:'actions - tools'!
|
|
723 |
|
|
724 |
startProcessMonitor
|
|
725 |
ProcessMonitor open
|
|
726 |
!
|
|
727 |
|
|
728 |
startMemoryMonitor
|
|
729 |
MemoryMonitor open
|
|
730 |
!
|
|
731 |
|
|
732 |
startMemoryUsageView
|
|
733 |
MemoryUsageView open
|
|
734 |
!
|
|
735 |
|
|
736 |
startWindowTreeView
|
|
737 |
WindowTreeView open
|
|
738 |
|
|
739 |
!
|
|
740 |
|
|
741 |
viewInspect
|
|
742 |
|v|
|
|
743 |
|
|
744 |
v := self pickAView.
|
|
745 |
v notNil ifTrue:[
|
88
|
746 |
v topView inspect
|
86
|
747 |
]
|
|
748 |
|
|
749 |
!
|
|
750 |
|
|
751 |
viewInspector
|
|
752 |
|v|
|
|
753 |
|
|
754 |
v := self pickAView.
|
|
755 |
v notNil ifTrue:[
|
88
|
756 |
v topView inspect
|
86
|
757 |
]
|
|
758 |
|
|
759 |
!
|
|
760 |
|
|
761 |
viewDestroy
|
|
762 |
|v|
|
|
763 |
|
|
764 |
v := self pickAView.
|
|
765 |
v notNil ifTrue:[
|
88
|
766 |
v topView destroy
|
86
|
767 |
]
|
|
768 |
|
|
769 |
! !
|
|
770 |
|
|
771 |
!NewLauncher methodsFor:'actions - goodies'!
|
|
772 |
|
|
773 |
startNewsTool
|
|
774 |
NewsView open
|
|
775 |
!
|
|
776 |
|
|
777 |
startMailTool
|
|
778 |
MailView open
|
|
779 |
!
|
|
780 |
|
|
781 |
startClock
|
|
782 |
RoundClock open
|
|
783 |
!
|
|
784 |
|
|
785 |
startCalendar
|
|
786 |
Calendar open
|
|
787 |
! !
|
|
788 |
|
|
789 |
!NewLauncher methodsFor:'change & update'!
|
|
790 |
|
|
791 |
update:something with:aParameter from:changedObject
|
|
792 |
((something == #currentProject)
|
|
793 |
or:[changedObject == Project]) ifTrue:[
|
|
794 |
self changed:#info.
|
|
795 |
^ self
|
|
796 |
].
|
|
797 |
! !
|
|
798 |
|
|
799 |
!NewLauncher methodsFor:'actions - file'!
|
|
800 |
|
|
801 |
snapshot
|
|
802 |
|saveBox|
|
|
803 |
|
|
804 |
saveBox := EnterBox title:(resources at:'filename for image:') withCRs.
|
|
805 |
saveBox okText:(resources at:'save').
|
|
806 |
saveBox action:[:fileName |
|
|
807 |
(ObjectMemory snapShotOn:fileName) ifFalse:[
|
|
808 |
"
|
|
809 |
snapshot failed for some reason (disk full, no permission etc.)
|
|
810 |
"
|
|
811 |
self warn:(resources string:'failed to save snapshot image (disk full or not writable)').
|
|
812 |
]
|
|
813 |
].
|
|
814 |
|
|
815 |
saveBox initialText:(ObjectMemory nameForSnapshot).
|
|
816 |
saveBox label:'save image'.
|
|
817 |
saveBox showAtPointer
|
|
818 |
|
|
819 |
!
|
|
820 |
|
|
821 |
exit
|
|
822 |
(self confirm:(resources string:'Are you certain you want to exit without saving ?'))
|
|
823 |
ifTrue:[
|
|
824 |
self closeDownViews.
|
|
825 |
Smalltalk exit
|
|
826 |
]
|
|
827 |
!
|
|
828 |
|
|
829 |
snapshotAndExit
|
|
830 |
|saveBox|
|
|
831 |
|
|
832 |
saveBox := EnterBox title:(resources at:'filename for image:') withCRs.
|
|
833 |
saveBox okText:(resources at:'save & exit').
|
|
834 |
saveBox action:[:fileName |
|
|
835 |
(ObjectMemory snapShotOn:fileName) ifFalse:[
|
|
836 |
"
|
|
837 |
snapshot failed for some reason (disk full, no permission etc.)
|
|
838 |
Do NOT exit in this case.
|
|
839 |
"
|
|
840 |
self warn:(resources string:'failed to save snapshot image (disk full or not writable)').
|
|
841 |
] ifTrue:[
|
|
842 |
"
|
|
843 |
closeDownViews tells all views to shutdown neatly
|
|
844 |
(i.e. offer a chance to save the contents to a file).
|
|
845 |
|
|
846 |
This is NOT required - all data should be in the snapshot ...
|
|
847 |
... however, if remote disks/mountable filesystems are involved,
|
|
848 |
which may not be present the next time, it may make sense to
|
|
849 |
uncomment it and query for saving - time will show which is better.
|
|
850 |
"
|
|
851 |
"
|
|
852 |
self closeDownViews.
|
|
853 |
"
|
|
854 |
Smalltalk exit
|
|
855 |
]
|
|
856 |
].
|
|
857 |
|
|
858 |
saveBox initialText:(ObjectMemory nameForSnapshot).
|
|
859 |
saveBox label:'save image & exit'.
|
|
860 |
saveBox showAtPointer
|
|
861 |
|
|
862 |
! !
|
|
863 |
|
|
864 |
!NewLauncher methodsFor:'actions - projects'!
|
|
865 |
|
|
866 |
newProject
|
|
867 |
(ProjectView for:(Project new)) open
|
|
868 |
|
|
869 |
!
|
|
870 |
|
|
871 |
selectProject
|
|
872 |
|list box|
|
|
873 |
|
|
874 |
list := Project allInstances.
|
|
875 |
box := ListSelectionBox new.
|
|
876 |
box list:(list collect:[:p | p name]).
|
|
877 |
box title:(resources string:'select a project').
|
|
878 |
box action:[:selection |
|
|
879 |
|project|
|
|
880 |
|
|
881 |
project := list detect:[:p | p name = selection] ifNone:[nil].
|
|
882 |
project isNil ifTrue:[
|
|
883 |
Transcript showCr:'no such project'
|
|
884 |
] ifFalse:[
|
|
885 |
project showViews.
|
|
886 |
Project current:project
|
|
887 |
]
|
|
888 |
].
|
|
889 |
box showAtPointer
|
|
890 |
|
|
891 |
! !
|
|
892 |
|
|
893 |
!NewLauncher methodsFor:'private'!
|
|
894 |
|
|
895 |
closeDownViews
|
|
896 |
"tell each topview that we are going to terminate and give it chance
|
|
897 |
to save its contents."
|
|
898 |
|
|
899 |
ObjectMemory changed:#aboutToExit
|
|
900 |
!
|
|
901 |
|
|
902 |
pickAView
|
|
903 |
|v|
|
|
904 |
|
|
905 |
(Delay forSeconds:1) wait.
|
|
906 |
v := Display viewFromUser.
|
|
907 |
v isNil ifTrue:[
|
88
|
908 |
self warn:'sorry, this is not a smalltalk view'.
|
|
909 |
^ nil
|
86
|
910 |
].
|
|
911 |
^ v
|
|
912 |
! !
|
|
913 |
|
90
|
914 |
!NewLauncher methodsFor:'actions - demos'!
|
|
915 |
|
|
916 |
openDemo:className
|
|
917 |
(Smalltalk at:className) open
|
|
918 |
|
|
919 |
!
|
|
920 |
|
|
921 |
startTicTacToe
|
|
922 |
TicTacToe open
|
|
923 |
!
|
|
924 |
|
|
925 |
startTetris
|
|
926 |
Tetris open
|
|
927 |
! !
|
|
928 |
|
86
|
929 |
!NewLauncher methodsFor:'help'!
|
|
930 |
|
|
931 |
helpTextFor:aComponent
|
|
932 |
|sel|
|
|
933 |
|
|
934 |
aComponent == transcript ifTrue:[
|
88
|
935 |
^ resources string:'this is the Transcript.\It is used to send\messages to the user.'
|
|
936 |
].
|
|
937 |
|
|
938 |
aComponent == infoView ifTrue:[
|
|
939 |
^ resources string:'this shows the name of the current\project and the directory\where a fileOut operation writes the file.'
|
86
|
940 |
].
|
|
941 |
|
|
942 |
(buttonPanel subViews includes:aComponent) ifTrue:[
|
88
|
943 |
"kludge: look for its change selector"
|
|
944 |
sel := aComponent changeSymbol.
|
|
945 |
sel == #startSystemBrowser ifTrue:[
|
|
946 |
^ resources string:'opens a\SystemBrowser'
|
|
947 |
].
|
|
948 |
sel == #startFileBrowser ifTrue:[
|
|
949 |
^ resources string:'opens a\FileBrowser'
|
|
950 |
].
|
86
|
951 |
].
|
|
952 |
^ nil
|
|
953 |
! !
|
90
|
954 |
|