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 |
|
93
|
13 |
'From Smalltalk/X, Version:2.10.5 on 29-apr-1995 at 12:42:53 pm'!
|
90
|
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 |
"
|
96
|
40 |
$Header: /cvs/stx/stx/libtool/Launcher.st,v 1.9 1995-05-06 14:52:13 claus Exp $
|
88
|
41 |
"
|
|
42 |
! !
|
|
43 |
|
86
|
44 |
!NewLauncher class methodsFor:'defaults'!
|
|
45 |
|
93
|
46 |
smallAboutIcon
|
|
47 |
|image|
|
|
48 |
|
|
49 |
image := self aboutIcon.
|
|
50 |
image notNil ifTrue:[
|
|
51 |
image := image magnifiedBy:0.4.
|
|
52 |
].
|
|
53 |
^ image
|
|
54 |
|
|
55 |
"
|
|
56 |
CachedAboutIcon := nil.
|
|
57 |
NewLauncher aboutIcon.
|
|
58 |
NewLauncher smallAboutIcon.
|
|
59 |
"
|
|
60 |
!
|
|
61 |
|
86
|
62 |
aboutIcon
|
|
63 |
|image|
|
|
64 |
|
|
65 |
CachedAboutIcon notNil ifTrue:[^ CachedAboutIcon].
|
|
66 |
|
|
67 |
image := Image fromFile:'SmalltalkX.xbm'.
|
92
|
68 |
image notNil ifTrue:[
|
86
|
69 |
|green dark|
|
|
70 |
|
|
71 |
Display hasColors ifTrue:[
|
|
72 |
green := (Color red:0 green:80 blue:20) darkened.
|
|
73 |
] ifFalse:[
|
|
74 |
green := White.
|
|
75 |
].
|
|
76 |
Display hasGreyscales ifTrue:[
|
|
77 |
dark := Color grey:10.
|
|
78 |
] ifFalse:[
|
|
79 |
dark := Black.
|
|
80 |
].
|
|
81 |
image colorMap:(Array with:dark with:green); photometric:#palette.
|
|
82 |
Display depth > 2 ifTrue:[
|
|
83 |
image := (Image implementorForDepth:Display depth) fromImage:image.
|
|
84 |
]
|
|
85 |
].
|
|
86 |
CachedAboutIcon := image.
|
|
87 |
^ image
|
|
88 |
|
|
89 |
"
|
92
|
90 |
CachedAboutIcon := nil.
|
|
91 |
NewLauncher aboutIcon
|
|
92 |
"
|
86
|
93 |
! !
|
|
94 |
|
93
|
95 |
!NewLauncher methodsFor:'initialize / release'!
|
86
|
96 |
|
93
|
97 |
openInterface
|
|
98 |
"sent by my superclass top open up my interface"
|
|
99 |
|
|
100 |
|top icn w|
|
86
|
101 |
|
|
102 |
top := StandardSystemView new.
|
|
103 |
top label:'Smalltalk/X'.
|
|
104 |
top extent:(400@300 ).
|
|
105 |
|
92
|
106 |
"
|
|
107 |
temporary kludge for SGI;
|
|
108 |
this will be moved into StandardSystemView and be done
|
|
109 |
automatically soon ...
|
|
110 |
"
|
|
111 |
Display serverVendor = 'Silicon Graphics' ifTrue:[
|
93
|
112 |
icn := self class aboutIcon.
|
92
|
113 |
icn notNil ifTrue:[
|
93
|
114 |
icn := icn magnifiedTo:86@68.
|
92
|
115 |
w := View extent:86@68. "/ icn extent.
|
|
116 |
w viewBackground:icn.
|
|
117 |
top iconView:w
|
|
118 |
]
|
|
119 |
].
|
|
120 |
|
93
|
121 |
self setupViewsIn:top.
|
|
122 |
top application:self.
|
86
|
123 |
|
|
124 |
"
|
92
|
125 |
open with higher prio to allow interaction even while things
|
|
126 |
are running ...
|
86
|
127 |
"
|
92
|
128 |
top openWithPriority:(Processor userSchedulingPriority + 1).
|
93
|
129 |
!
|
86
|
130 |
|
93
|
131 |
addTopViewsToCurrentProject
|
|
132 |
"ignored here - the launcher is always global (i.e. not project private)."
|
86
|
133 |
|
93
|
134 |
^ self
|
86
|
135 |
!
|
|
136 |
|
|
137 |
setupMenu
|
|
138 |
"setup the pulldown menu"
|
|
139 |
|
92
|
140 |
|l s icon|
|
86
|
141 |
|
|
142 |
myMenu labels:(resources array:#(
|
88
|
143 |
'about'
|
|
144 |
'file'
|
|
145 |
'classes'
|
|
146 |
'tools'
|
|
147 |
'projects'
|
|
148 |
'settings'
|
|
149 |
'demos'
|
|
150 |
'help')).
|
92
|
151 |
"
|
|
152 |
if there is a bitmap, change 'about' to the ST/X icon
|
|
153 |
"
|
|
154 |
icon := self class smallAboutIcon.
|
|
155 |
icon notNil ifTrue:[
|
|
156 |
myMenu labels at:1 put:icon.
|
94
|
157 |
myMenu height:(myMenu height max:(icon height + (View viewSpacing * 2)))
|
92
|
158 |
].
|
86
|
159 |
|
|
160 |
myMenu selectors:#(
|
88
|
161 |
#about
|
|
162 |
#file
|
|
163 |
#classes
|
|
164 |
#tools
|
|
165 |
#projects
|
|
166 |
#settings
|
|
167 |
#demos
|
|
168 |
#help).
|
86
|
169 |
|
|
170 |
myMenu at:#about
|
88
|
171 |
putLabels:(resources array:#(
|
|
172 |
'about Smalltalk/X ...'
|
|
173 |
))
|
|
174 |
selectors:#(
|
|
175 |
#about
|
|
176 |
)
|
|
177 |
receiver:self.
|
86
|
178 |
|
|
179 |
myMenu at:#file
|
88
|
180 |
putLabels:(resources array:#(
|
|
181 |
'file browser'
|
|
182 |
'-'
|
|
183 |
'snapshot'
|
|
184 |
'snapshot & exit'
|
|
185 |
'exit'
|
|
186 |
))
|
|
187 |
selectors:#(
|
|
188 |
#startFileBrowser
|
|
189 |
nil
|
|
190 |
#snapshot
|
|
191 |
#snapshotAndExit
|
|
192 |
#exit
|
|
193 |
)
|
|
194 |
receiver:self.
|
86
|
195 |
|
|
196 |
myMenu at:#classes
|
88
|
197 |
putLabels:(resources array:#(
|
|
198 |
'system browser'
|
|
199 |
'class browser'
|
|
200 |
'full class browser'
|
|
201 |
'class hierarchy browser'
|
|
202 |
'class tree'
|
|
203 |
'-'
|
|
204 |
'implementors'
|
|
205 |
'senders'
|
|
206 |
'-'
|
|
207 |
'change browser'
|
|
208 |
))
|
|
209 |
selectors:#(
|
|
210 |
#startSystemBrowser
|
|
211 |
#startClassBrowser
|
|
212 |
#startFullClassBrowser
|
|
213 |
#startClassHierarchyBrowser
|
|
214 |
#startClassTreeView
|
|
215 |
nil
|
|
216 |
#browseImplementors
|
|
217 |
#browseSenders
|
|
218 |
nil
|
|
219 |
#startChangesBrowser
|
|
220 |
)
|
|
221 |
receiver:self.
|
86
|
222 |
|
|
223 |
myMenu at:#projects
|
88
|
224 |
putLabels:(resources array:#(
|
|
225 |
'new project'
|
|
226 |
'-'
|
|
227 |
'select project'
|
|
228 |
))
|
|
229 |
selectors:#(
|
|
230 |
#newProject
|
|
231 |
nil
|
|
232 |
#selectProject
|
|
233 |
)
|
|
234 |
receiver:self.
|
86
|
235 |
|
|
236 |
myMenu at:#settings
|
88
|
237 |
putLabels:(resources array:#(
|
|
238 |
'language'
|
|
239 |
'view style'
|
93
|
240 |
'compilation'
|
94
|
241 |
'misc'
|
88
|
242 |
))
|
|
243 |
selectors:#(
|
|
244 |
#languageSetting
|
|
245 |
#viewStyleSetting
|
94
|
246 |
#compilerSettings
|
|
247 |
#miscSettings
|
88
|
248 |
)
|
|
249 |
receiver:self.
|
86
|
250 |
|
93
|
251 |
self setupToolsMenu.
|
90
|
252 |
self setupDemoMenu.
|
86
|
253 |
|
|
254 |
ActiveHelp notNil ifTrue:[
|
88
|
255 |
l := #(
|
|
256 |
'\c active help'
|
|
257 |
'ST/X documentation'
|
|
258 |
).
|
|
259 |
s := #(
|
93
|
260 |
#toggleActiveHelp:
|
88
|
261 |
#startDocumentationTool
|
|
262 |
)
|
86
|
263 |
] ifFalse:[
|
88
|
264 |
l := #(
|
|
265 |
'ST/X documentation'
|
|
266 |
).
|
|
267 |
s := #(
|
|
268 |
#startDocumentationTool
|
|
269 |
)
|
86
|
270 |
].
|
|
271 |
|
|
272 |
myMenu at:#help
|
88
|
273 |
putLabels:(resources array:l)
|
|
274 |
selectors:s
|
|
275 |
receiver:self.
|
86
|
276 |
!
|
|
277 |
|
93
|
278 |
setupTranscriptIn:aView
|
|
279 |
|v|
|
|
280 |
|
|
281 |
(Transcript notNil and:[Transcript ~~ Stderr]) ifTrue:[
|
|
282 |
Transcript topView destroy.
|
|
283 |
].
|
|
284 |
|
|
285 |
v := HVScrollableView
|
|
286 |
for:TextCollector
|
|
287 |
miniScrollerH:true
|
|
288 |
miniScrollerV:false
|
|
289 |
in:aView.
|
|
290 |
|
|
291 |
v origin:(0.0 @ (buttonPanel corner y + View viewSpacing))
|
|
292 |
corner:(1.0 @ 1.0).
|
|
293 |
transcript := v scrolledView.
|
|
294 |
transcript beTranscript.
|
|
295 |
!
|
|
296 |
|
90
|
297 |
setupInfoViewIn:topView
|
93
|
298 |
|spc halfSpc|
|
86
|
299 |
|
90
|
300 |
spc := View viewSpacing.
|
|
301 |
infoView := Label label:'' in:topView.
|
|
302 |
infoView adjust:#left; borderWidth:0.
|
|
303 |
infoView level:-1.
|
|
304 |
transcript superView bottomInset:(infoView height + spc).
|
86
|
305 |
|
93
|
306 |
halfSpc := spc // 2.
|
90
|
307 |
infoView topInset:(infoView height negated - spc);
|
93
|
308 |
bottomInset:halfSpc;
|
|
309 |
leftInset:halfSpc;
|
|
310 |
rightInset:halfSpc.
|
|
311 |
infoView origin:0.0 @ 1.0 corner:1.0 @ 1.0.
|
|
312 |
infoView model:self; aspect:#info; labelMessage:#info.
|
86
|
313 |
|
93
|
314 |
Project notNil ifTrue:[
|
|
315 |
Project addDependent:self.
|
|
316 |
]
|
90
|
317 |
|
|
318 |
"
|
|
319 |
NewLauncher open
|
|
320 |
"
|
86
|
321 |
!
|
|
322 |
|
93
|
323 |
focusSequence
|
|
324 |
^ (Array with:myMenu) , buttonPanel subViews , (Array with:Transcript)
|
|
325 |
!
|
|
326 |
|
86
|
327 |
setupViewsIn:topView
|
|
328 |
"create the pulldown menu, buttonPanel and transcript view"
|
|
329 |
|
|
330 |
|frame|
|
|
331 |
|
|
332 |
topView model:self.
|
|
333 |
|
|
334 |
myMenu := PullDownMenu in:topView.
|
|
335 |
myMenu origin:0.0@0.0 corner:[1.0@nil].
|
|
336 |
|
|
337 |
self setupMenu.
|
|
338 |
self setupButtonPanelIn:topView.
|
|
339 |
self setupTranscriptIn:topView.
|
|
340 |
self setupInfoViewIn:topView.
|
|
341 |
|
|
342 |
topView extent:((transcript font widthOf:'3')*60)
|
|
343 |
@
|
|
344 |
((transcript font height) * 20).
|
|
345 |
|
|
346 |
"
|
|
347 |
NewLauncher open
|
|
348 |
"
|
|
349 |
!
|
|
350 |
|
|
351 |
setupButtonPanelIn:aTopView
|
|
352 |
"create the buttonPanel"
|
|
353 |
|
|
354 |
|sep spc|
|
|
355 |
|
|
356 |
spc := View viewSpacing // 2.
|
|
357 |
buttonPanel := HorizontalPanelView in:aTopView.
|
|
358 |
buttonPanel level:-1; borderWidth:0.
|
|
359 |
buttonPanel horizontalLayout:#leftSpace.
|
|
360 |
|
90
|
361 |
self buttonPanelSpec do:[:entry |
|
|
362 |
|sel b sep|
|
86
|
363 |
|
90
|
364 |
sel := entry at:1.
|
|
365 |
sel isNil ifTrue:[
|
|
366 |
sep := View in:buttonPanel.
|
|
367 |
sep extent:32@1; borderWidth:0.
|
|
368 |
] ifFalse:[
|
|
369 |
b := Button in:buttonPanel.
|
|
370 |
b form:(Image fromFile:(entry at:2)).
|
|
371 |
b model:self; change:sel
|
|
372 |
]
|
86
|
373 |
].
|
|
374 |
|
|
375 |
buttonPanel origin:0.0 @ myMenu height
|
|
376 |
corner:(1.0 @ (myMenu height + buttonPanel preferedExtent y)).
|
|
377 |
|
|
378 |
buttonPanel leftInset:spc; rightInset:spc.
|
|
379 |
!
|
|
380 |
|
90
|
381 |
setupDemoMenu
|
|
382 |
"setup the demo pulldown menu"
|
|
383 |
|
|
384 |
|m|
|
|
385 |
|
|
386 |
myMenu at:#demos
|
|
387 |
putLabels:(resources array:#(
|
91
|
388 |
'goodies'
|
90
|
389 |
'games'
|
|
390 |
'geometric designs'
|
|
391 |
'simple animations'
|
|
392 |
'3D graphics'
|
|
393 |
'graphic editors'
|
|
394 |
))
|
|
395 |
selectors:#(
|
91
|
396 |
goodies
|
90
|
397 |
games
|
|
398 |
geometricDesigns
|
|
399 |
simpleAnimations
|
|
400 |
#'3Dgraphics'
|
|
401 |
#graphicEditors
|
|
402 |
)
|
|
403 |
receiver:self.
|
|
404 |
|
|
405 |
"
|
|
406 |
only to show two different ways of defining a popUpMenu,
|
|
407 |
we use labels:selectors:receiver: here:
|
|
408 |
"
|
|
409 |
m := myMenu menuAt:#demos.
|
|
410 |
m subMenuAt:#games
|
|
411 |
put:(PopUpMenu
|
|
412 |
labels:(resources array:#(
|
|
413 |
'Tetris'
|
|
414 |
'Tic Tac Toe'
|
|
415 |
))
|
|
416 |
selectors:#(
|
|
417 |
startTetris
|
|
418 |
startTicTacToe
|
|
419 |
)
|
|
420 |
receiver:self).
|
|
421 |
|
|
422 |
"
|
|
423 |
and labels:selector:args:receiver: here:
|
|
424 |
"
|
|
425 |
m subMenuAt:#geometricDesigns
|
|
426 |
put:(PopUpMenu
|
|
427 |
labels:(resources array:#(
|
|
428 |
'Pen demo'
|
|
429 |
'Commander demo'
|
|
430 |
))
|
|
431 |
selector:#openDemo:
|
|
432 |
args:#(
|
|
433 |
PenDemo
|
|
434 |
CommanderDemo
|
91
|
435 |
)
|
90
|
436 |
receiver:self).
|
|
437 |
|
|
438 |
m subMenuAt:#simpleAnimations
|
|
439 |
put:(PopUpMenu
|
|
440 |
labels:(resources array:#(
|
|
441 |
'Animation'
|
|
442 |
'Globe demo'
|
|
443 |
))
|
|
444 |
selector:#openDemo:
|
|
445 |
args:#(
|
|
446 |
Animation
|
|
447 |
GlobeDemo
|
91
|
448 |
)
|
90
|
449 |
receiver:self).
|
|
450 |
|
|
451 |
m subMenuAt:#'3Dgraphics'
|
|
452 |
put:(PopUpMenu
|
|
453 |
labels:(resources
|
|
454 |
array:#(
|
|
455 |
'plane'
|
|
456 |
'tetra'
|
|
457 |
'cube (wireframe)'
|
|
458 |
'cube (solid)'
|
|
459 |
'cube (light)'
|
|
460 |
'cube (light & texture)'
|
|
461 |
'sphere (wireframe)'
|
|
462 |
'sphere (light)'
|
|
463 |
'planet'
|
|
464 |
'teapot'
|
|
465 |
'logo'
|
|
466 |
))
|
|
467 |
selector:#openDemo:
|
|
468 |
args:#(
|
|
469 |
GLPlaneDemoView2
|
|
470 |
GLTetraDemoView
|
|
471 |
GLWireCubeDemoView
|
|
472 |
GLCubeDemoView
|
|
473 |
GLCubeDemoView2
|
|
474 |
GLBrickCubeDemoView
|
|
475 |
GLWireSphereDemoView
|
|
476 |
GLSphereDemoView2
|
|
477 |
GLPlanetDemoView
|
|
478 |
GLTeapotDemo
|
|
479 |
Logo3DView1
|
91
|
480 |
)
|
90
|
481 |
receiver:self).
|
|
482 |
|
|
483 |
m subMenuAt:#graphicEditors
|
|
484 |
put:(PopUpMenu
|
|
485 |
labels:(resources array:#(
|
|
486 |
'DrawTool'
|
|
487 |
'LogicTool'
|
|
488 |
))
|
|
489 |
selector:#openDemo:
|
|
490 |
args:#(
|
|
491 |
DrawTool
|
|
492 |
LogicTool
|
91
|
493 |
)
|
90
|
494 |
receiver:self).
|
|
495 |
|
91
|
496 |
m subMenuAt:#goodies
|
|
497 |
put:(PopUpMenu
|
|
498 |
labels:(resources array:#(
|
|
499 |
'clock'
|
|
500 |
'calendar'
|
|
501 |
'-'
|
|
502 |
'mail tool'
|
|
503 |
'news tool'
|
|
504 |
))
|
|
505 |
selector:#openDemo:
|
|
506 |
args:#(
|
|
507 |
Clock
|
|
508 |
Calendar
|
|
509 |
nil
|
|
510 |
MailView
|
|
511 |
NewsView
|
|
512 |
)
|
|
513 |
receiver:self).
|
90
|
514 |
!
|
|
515 |
|
|
516 |
buttonPanelSpec
|
|
517 |
"return a spec for the buttons in the panel;
|
|
518 |
entries consists of selector and bitmap-filename.
|
|
519 |
nil selectors are taken as separators (see setupButtonPanel)"
|
|
520 |
|
|
521 |
^ #(
|
|
522 |
#(startSystemBrowser 'SBrowser32x32.xbm')
|
|
523 |
#(startFileBrowser 'FBrowser32x32.xbm')
|
|
524 |
#(nil nil)
|
|
525 |
#(startChangesBrowser 'CBrowser32x32.xbm')
|
|
526 |
)
|
93
|
527 |
!
|
|
528 |
|
|
529 |
release
|
|
530 |
infoProcess notNil ifTrue:[
|
|
531 |
infoProcess terminate.
|
|
532 |
infoProcess := nil.
|
|
533 |
].
|
|
534 |
super release
|
|
535 |
!
|
|
536 |
|
|
537 |
closeRequest
|
|
538 |
(self confirm:(resources string:'really close %1 ?' with:self class name)) ifTrue:[
|
|
539 |
super closeRequest
|
|
540 |
]
|
|
541 |
!
|
|
542 |
|
|
543 |
saveAndTerminate
|
|
544 |
"
|
|
545 |
some windowManagers can send this, to shutDown an application
|
|
546 |
but let it save its state before, for restart. We are already
|
|
547 |
prepared for this ;-)"
|
|
548 |
|
|
549 |
self snapshot.
|
|
550 |
super saveAndTerminate
|
|
551 |
!
|
|
552 |
|
|
553 |
setupToolsMenu
|
|
554 |
"setup the tools pulldown menu"
|
|
555 |
|
|
556 |
|m|
|
|
557 |
|
|
558 |
myMenu at:#tools
|
|
559 |
putLabels:(resources array:#(
|
|
560 |
'workspace'
|
|
561 |
'-'
|
|
562 |
'monitors'
|
|
563 |
'-'
|
|
564 |
'view tree (all views)'
|
|
565 |
'view tree'
|
|
566 |
'inspect view'
|
|
567 |
'destroy view'
|
|
568 |
'-'
|
|
569 |
'hardcopy'
|
|
570 |
))
|
|
571 |
selectors:#(
|
|
572 |
#startWorkspace
|
|
573 |
nil
|
|
574 |
#monitors
|
|
575 |
nil
|
|
576 |
#startFullWindowTreeView
|
|
577 |
#startWindowTreeView
|
|
578 |
#viewInspect
|
|
579 |
#viewDestroy
|
|
580 |
nil
|
|
581 |
#hardcopy
|
|
582 |
)
|
|
583 |
receiver:self.
|
|
584 |
|
|
585 |
|
|
586 |
m := myMenu menuAt:#tools.
|
|
587 |
m subMenuAt:#monitors
|
|
588 |
put:(PopUpMenu
|
|
589 |
labels:(resources array:#(
|
|
590 |
'process'
|
|
591 |
'memory'
|
|
592 |
'event'
|
|
593 |
'-'
|
|
594 |
'memory usage'
|
|
595 |
))
|
|
596 |
selectors:#(
|
|
597 |
#startProcessMonitor
|
|
598 |
#startMemoryMonitor
|
|
599 |
#startEventMonitor
|
|
600 |
nil
|
|
601 |
#startMemoryUsageView
|
|
602 |
)
|
|
603 |
receiver:self).
|
|
604 |
|
|
605 |
m subMenuAt:#hardcopy
|
|
606 |
put:(PopUpMenu
|
|
607 |
labels:(resources array:#(
|
|
608 |
'screen'
|
|
609 |
'area'
|
|
610 |
'view'
|
|
611 |
))
|
|
612 |
selectors:#(
|
|
613 |
#fullScreenHardcopy
|
|
614 |
#screenHardcopy
|
|
615 |
#viewHardcopy
|
|
616 |
)
|
|
617 |
receiver:self).
|
|
618 |
|
86
|
619 |
! !
|
|
620 |
|
|
621 |
!NewLauncher methodsFor:'actions - classes'!
|
|
622 |
|
|
623 |
startFileBrowser
|
|
624 |
FileBrowser open
|
|
625 |
!
|
|
626 |
|
90
|
627 |
startChangesBrowser
|
|
628 |
ChangesBrowser open
|
|
629 |
!
|
|
630 |
|
86
|
631 |
startSystemBrowser
|
|
632 |
SystemBrowser open
|
|
633 |
!
|
|
634 |
|
|
635 |
startWorkspace
|
|
636 |
Workspace open
|
|
637 |
!
|
|
638 |
|
|
639 |
startClassBrowser
|
90
|
640 |
SystemBrowser askThenBrowseClass
|
|
641 |
!
|
|
642 |
|
|
643 |
startFullClassBrowser
|
|
644 |
SystemBrowser askThenBrowseFullClassProtocol
|
86
|
645 |
!
|
|
646 |
|
|
647 |
startClassHierarchyBrowser
|
90
|
648 |
SystemBrowser askThenBrowseClassHierarchy
|
86
|
649 |
!
|
|
650 |
|
|
651 |
browseImplementors
|
|
652 |
|enterBox|
|
|
653 |
|
|
654 |
enterBox := EnterBox title:(resources at:'Browse implementors of:') withCRs.
|
|
655 |
enterBox okText:(resources at:'browse').
|
|
656 |
enterBox action:[:selectorName |
|
|
657 |
|cls|
|
|
658 |
|
|
659 |
SystemBrowser browseImplementorsOf:selectorName
|
|
660 |
].
|
|
661 |
enterBox showAtPointer
|
|
662 |
!
|
|
663 |
|
|
664 |
browseSenders
|
|
665 |
|enterBox|
|
|
666 |
|
|
667 |
enterBox := EnterBox title:(resources at:'Browse senders of:') withCRs.
|
|
668 |
enterBox okText:(resources at:'browse').
|
|
669 |
enterBox action:[:selectorName |
|
|
670 |
|cls|
|
|
671 |
|
|
672 |
SystemBrowser browseAllCallsOn:selectorName
|
|
673 |
].
|
|
674 |
enterBox showAtPointer
|
|
675 |
!
|
|
676 |
|
|
677 |
startClassTreeView
|
|
678 |
ClassTreeGraphView open
|
|
679 |
! !
|
|
680 |
|
90
|
681 |
!NewLauncher methodsFor:'actions - settings'!
|
|
682 |
|
|
683 |
viewStyleSetting
|
|
684 |
|listOfStyles resourceDir dir box|
|
|
685 |
|
|
686 |
"
|
|
687 |
search resources directory for a list of .style files ...
|
|
688 |
"
|
|
689 |
|
|
690 |
resourceDir := Smalltalk getSystemFileName:'resources'.
|
|
691 |
dir := FileDirectory directoryNamed:resourceDir.
|
|
692 |
|
|
693 |
listOfStyles := dir select:[:aFileName | aFileName endsWith:'.style'].
|
|
694 |
listOfStyles := listOfStyles collect:[:aFileName | aFileName copyWithoutLast:6].
|
|
695 |
|
94
|
696 |
box := ListSelectionBox title:(resources string:'STYLE_MSG') withCRs.
|
90
|
697 |
box label:(resources string:'Style selection').
|
|
698 |
box list:listOfStyles.
|
|
699 |
box initialText:View defaultStyle.
|
|
700 |
box action:[:newStyle |
|
|
701 |
transcript topView withCursor:Cursor wait do:[
|
|
702 |
Transcript showCr:'change style to ' , newStyle , ' ...'.
|
|
703 |
View defaultStyle:newStyle asSymbol.
|
|
704 |
]
|
|
705 |
].
|
|
706 |
box showAtPointer
|
|
707 |
!
|
|
708 |
|
|
709 |
languageSetting
|
|
710 |
|listOfLanguages box|
|
|
711 |
|
|
712 |
"
|
|
713 |
hardwiring here is stupid - need a resource file
|
|
714 |
which lists languagenames which have all texts available
|
|
715 |
in resource files ...
|
|
716 |
"
|
|
717 |
listOfLanguages := #('english'
|
|
718 |
'german'
|
|
719 |
'french'
|
|
720 |
'spanish'
|
|
721 |
'italian'
|
|
722 |
).
|
|
723 |
|
94
|
724 |
box := ListSelectionBox title:(resources string:'LANG_MSG') withCRs.
|
90
|
725 |
box label:(resources string:'Language selection').
|
|
726 |
box list:listOfLanguages.
|
|
727 |
box initialText:(Language).
|
|
728 |
box action:[:newLanguage |
|
|
729 |
transcript topView withCursor:Cursor wait do:[
|
|
730 |
Transcript showCr:'change language to ' , newLanguage , ' ...'.
|
|
731 |
Smalltalk at:#Language put:newLanguage asSymbol.
|
|
732 |
Smalltalk changed:#Language.
|
|
733 |
ResourcePack flushCachedResourcePacks
|
|
734 |
]
|
|
735 |
].
|
|
736 |
box showAtPointer
|
|
737 |
!
|
|
738 |
|
94
|
739 |
compilerSettings
|
96
|
740 |
|box warnSTX allowUnderscore immutableArrays|
|
93
|
741 |
|
|
742 |
warnSTX := Compiler warnSTXSpecials asValue.
|
|
743 |
allowUnderscore := Compiler allowUnderscoreInIdentifier asValue.
|
|
744 |
immutableArrays := Compiler arraysAreImmutable asValue.
|
|
745 |
|
|
746 |
box := DialogBox new.
|
|
747 |
box label:'Compiler settings'.
|
|
748 |
box extent:200@300.
|
|
749 |
|
|
750 |
box addCheckBox:'warn about ST/X language extensions' on:warnSTX.
|
|
751 |
box addCheckBox:'allow underscore in identifiers' on:allowUnderscore.
|
|
752 |
box addCheckBox:'literal arrays are immutable' on:immutableArrays.
|
|
753 |
|
96
|
754 |
box addAbortButton; addOkButton.
|
93
|
755 |
box showAtPointer.
|
|
756 |
|
96
|
757 |
box accepted ifTrue:[
|
93
|
758 |
Compiler warnSTXSpecials:warnSTX value.
|
|
759 |
Compiler allowUnderscoreInIdentifier:allowUnderscore value.
|
|
760 |
Compiler arraysAreImmutable:immutableArrays value.
|
|
761 |
]
|
94
|
762 |
!
|
|
763 |
|
|
764 |
miscSettings
|
96
|
765 |
|box logDoits|
|
94
|
766 |
|
|
767 |
logDoits := Smalltalk logDoits asValue.
|
|
768 |
|
|
769 |
box := DialogBox new.
|
|
770 |
box label:'Other settings'.
|
|
771 |
box extent:200@300.
|
|
772 |
|
|
773 |
box addCheckBox:'log doIts in changes file' on:logDoits.
|
|
774 |
|
96
|
775 |
box addAbortButton; addOkButton.
|
94
|
776 |
box showAtPointer.
|
|
777 |
|
96
|
778 |
box accepted ifTrue:[
|
94
|
779 |
Smalltalk logDoits:logDoits value.
|
|
780 |
]
|
90
|
781 |
! !
|
|
782 |
|
86
|
783 |
!NewLauncher methodsFor:'infoview update'!
|
|
784 |
|
|
785 |
info
|
|
786 |
|project projectName projectDir|
|
|
787 |
|
93
|
788 |
(Project isNil or:[(project := Project current) isNil]) ifTrue:[
|
88
|
789 |
projectName := '* none *'.
|
|
790 |
projectDir := '.'.
|
86
|
791 |
] ifFalse:[
|
88
|
792 |
projectName := project name.
|
|
793 |
projectDir := project directory.
|
86
|
794 |
].
|
|
795 |
|
|
796 |
^ resources
|
88
|
797 |
string:'project: ''%1'' fileOut to: ''%2'''
|
|
798 |
with:projectName
|
|
799 |
with:(projectDir contractTo:30)
|
86
|
800 |
! !
|
|
801 |
|
|
802 |
!NewLauncher methodsFor:'actions - about & help'!
|
|
803 |
|
93
|
804 |
toggleActiveHelp:aBoolean
|
|
805 |
ActiveHelp notNil ifTrue:[
|
|
806 |
helpIsOn := aBoolean.
|
|
807 |
helpIsOn ifTrue:[
|
|
808 |
ActiveHelp start
|
|
809 |
] ifFalse:[
|
|
810 |
ActiveHelp stop
|
|
811 |
]
|
|
812 |
].
|
|
813 |
!
|
|
814 |
|
86
|
815 |
about
|
|
816 |
|box|
|
|
817 |
|
|
818 |
box := AboutBox new.
|
|
819 |
box autoHideAfter:10 with:[].
|
|
820 |
box showAtCenter
|
|
821 |
!
|
|
822 |
|
89
|
823 |
startDocumentationTool
|
|
824 |
|box|
|
|
825 |
|
|
826 |
|
|
827 |
box := YesNoBox title:'Sorry, the ST/X HTML reader is not yet released
|
|
828 |
and therefore not included in this package.
|
|
829 |
|
|
830 |
Shall I try to open some other reader ?
|
|
831 |
'.
|
|
832 |
(box confirm) ifTrue:[
|
|
833 |
"look for a reader"
|
|
834 |
|
|
835 |
|s whereIsDoc|
|
|
836 |
|
|
837 |
s := Smalltalk systemFileStreamFor:'doc/online/english/TOP.html'.
|
|
838 |
s isNil ifTrue:[
|
|
839 |
self warn:'no documentation files available'.
|
|
840 |
^ self.
|
|
841 |
].
|
93
|
842 |
whereIsDoc := s pathName asFilename directoryName.
|
89
|
843 |
s close.
|
|
844 |
|
|
845 |
#('Mosaic' 'mosaic' 'netscape' 'chimera')
|
|
846 |
do:[:reader |
|
|
847 |
|cmd|
|
|
848 |
|
|
849 |
|
|
850 |
cmd := reader , ' ' , whereIsDoc , '/TOP.html &'.
|
|
851 |
(OperatingSystem executeCommand:cmd) ifTrue:[
|
|
852 |
^ self
|
|
853 |
]
|
|
854 |
].
|
|
855 |
self warn:'Sorry, no HTML reader seems to be available.
|
|
856 |
|
|
857 |
you should get one of Mosaic, netscape, chimera ...
|
94
|
858 |
... or wait till HTML support in ST/X is complete.
|
|
859 |
|
|
860 |
Alternatively, use the FileBrowser on *.doc-files
|
|
861 |
found in the documentation/online directory.'.
|
89
|
862 |
]
|
86
|
863 |
! !
|
|
864 |
|
|
865 |
!NewLauncher methodsFor:'actions - tools'!
|
|
866 |
|
|
867 |
startProcessMonitor
|
|
868 |
ProcessMonitor open
|
|
869 |
!
|
|
870 |
|
|
871 |
startMemoryMonitor
|
|
872 |
MemoryMonitor open
|
|
873 |
!
|
|
874 |
|
93
|
875 |
startEventMonitor
|
|
876 |
EventMonitor open
|
|
877 |
!
|
|
878 |
|
86
|
879 |
startMemoryUsageView
|
|
880 |
MemoryUsageView open
|
|
881 |
!
|
|
882 |
|
|
883 |
startWindowTreeView
|
|
884 |
|v|
|
|
885 |
|
|
886 |
v := self pickAView.
|
|
887 |
v notNil ifTrue:[
|
93
|
888 |
WindowTreeView openOn:v topView
|
86
|
889 |
]
|
|
890 |
!
|
|
891 |
|
93
|
892 |
fullScreenHardcopy
|
|
893 |
"after a second (to allow redraw of views under menu ...),
|
|
894 |
save the contents of the whole screen."
|
|
895 |
|
|
896 |
Processor addTimedBlock:[
|
|
897 |
self saveScreenImage:(Image fromScreen) defaultName:'screen'
|
|
898 |
] afterSeconds:1
|
|
899 |
!
|
|
900 |
|
|
901 |
startFullWindowTreeView
|
|
902 |
WindowTreeView open
|
|
903 |
!
|
|
904 |
|
|
905 |
viewInspect
|
86
|
906 |
|v|
|
|
907 |
|
|
908 |
v := self pickAView.
|
|
909 |
v notNil ifTrue:[
|
88
|
910 |
v topView inspect
|
86
|
911 |
]
|
|
912 |
|
|
913 |
!
|
|
914 |
|
|
915 |
viewDestroy
|
|
916 |
|v|
|
|
917 |
|
|
918 |
v := self pickAView.
|
|
919 |
v notNil ifTrue:[
|
88
|
920 |
v topView destroy
|
86
|
921 |
]
|
93
|
922 |
!
|
86
|
923 |
|
93
|
924 |
screenHardcopy
|
|
925 |
"after a second (to allow redraw of views under menu ...),
|
|
926 |
let user specify a rectangular area on the screen
|
|
927 |
and save its contents."
|
|
928 |
|
|
929 |
|area|
|
|
930 |
|
|
931 |
Processor addTimedBlock:[
|
|
932 |
area := Rectangle fromUser.
|
|
933 |
(area width > 0 and:[area height > 0]) ifTrue:[
|
|
934 |
self saveScreenImage:(Image fromScreen:area) defaultName:'hardcopy'
|
|
935 |
]
|
|
936 |
] afterSeconds:1
|
|
937 |
!
|
|
938 |
|
|
939 |
viewHardcopy
|
|
940 |
"after a second (to allow redraw of views under menu ...),
|
|
941 |
let user specify a view and save its contents."
|
|
942 |
|
|
943 |
Processor addTimedBlock:[
|
|
944 |
|v|
|
|
945 |
|
|
946 |
v := Display viewFromUser.
|
|
947 |
v notNil ifTrue:[
|
|
948 |
self saveScreenImage:(Image fromView:(v topView)) defaultName:'hardcopy'
|
|
949 |
]
|
|
950 |
] afterSeconds:1
|
86
|
951 |
! !
|
|
952 |
|
|
953 |
!NewLauncher methodsFor:'actions - goodies'!
|
|
954 |
|
|
955 |
startNewsTool
|
|
956 |
NewsView open
|
|
957 |
!
|
|
958 |
|
|
959 |
startMailTool
|
|
960 |
MailView open
|
|
961 |
!
|
|
962 |
|
|
963 |
startClock
|
|
964 |
RoundClock open
|
|
965 |
!
|
|
966 |
|
|
967 |
startCalendar
|
|
968 |
Calendar open
|
|
969 |
! !
|
|
970 |
|
|
971 |
!NewLauncher methodsFor:'change & update'!
|
|
972 |
|
|
973 |
update:something with:aParameter from:changedObject
|
|
974 |
((something == #currentProject)
|
|
975 |
or:[changedObject == Project]) ifTrue:[
|
|
976 |
self changed:#info.
|
|
977 |
^ self
|
|
978 |
].
|
|
979 |
! !
|
|
980 |
|
|
981 |
!NewLauncher methodsFor:'actions - file'!
|
|
982 |
|
|
983 |
snapshot
|
|
984 |
|saveBox|
|
|
985 |
|
|
986 |
saveBox := EnterBox title:(resources at:'filename for image:') withCRs.
|
|
987 |
saveBox okText:(resources at:'save').
|
|
988 |
saveBox action:[:fileName |
|
|
989 |
(ObjectMemory snapShotOn:fileName) ifFalse:[
|
|
990 |
"
|
|
991 |
snapshot failed for some reason (disk full, no permission etc.)
|
|
992 |
"
|
|
993 |
self warn:(resources string:'failed to save snapshot image (disk full or not writable)').
|
|
994 |
]
|
|
995 |
].
|
|
996 |
|
|
997 |
saveBox initialText:(ObjectMemory nameForSnapshot).
|
|
998 |
saveBox label:'save image'.
|
|
999 |
saveBox showAtPointer
|
|
1000 |
|
|
1001 |
!
|
|
1002 |
|
|
1003 |
exit
|
|
1004 |
(self confirm:(resources string:'Are you certain you want to exit without saving ?'))
|
|
1005 |
ifTrue:[
|
|
1006 |
self closeDownViews.
|
|
1007 |
Smalltalk exit
|
|
1008 |
]
|
|
1009 |
!
|
|
1010 |
|
|
1011 |
snapshotAndExit
|
|
1012 |
|saveBox|
|
|
1013 |
|
|
1014 |
saveBox := EnterBox title:(resources at:'filename for image:') withCRs.
|
|
1015 |
saveBox okText:(resources at:'save & exit').
|
|
1016 |
saveBox action:[:fileName |
|
|
1017 |
(ObjectMemory snapShotOn:fileName) ifFalse:[
|
|
1018 |
"
|
|
1019 |
snapshot failed for some reason (disk full, no permission etc.)
|
|
1020 |
Do NOT exit in this case.
|
|
1021 |
"
|
|
1022 |
self warn:(resources string:'failed to save snapshot image (disk full or not writable)').
|
|
1023 |
] ifTrue:[
|
|
1024 |
"
|
|
1025 |
closeDownViews tells all views to shutdown neatly
|
|
1026 |
(i.e. offer a chance to save the contents to a file).
|
|
1027 |
|
|
1028 |
This is NOT required - all data should be in the snapshot ...
|
|
1029 |
... however, if remote disks/mountable filesystems are involved,
|
|
1030 |
which may not be present the next time, it may make sense to
|
|
1031 |
uncomment it and query for saving - time will show which is better.
|
|
1032 |
"
|
|
1033 |
"
|
|
1034 |
self closeDownViews.
|
|
1035 |
"
|
|
1036 |
Smalltalk exit
|
|
1037 |
]
|
|
1038 |
].
|
|
1039 |
|
|
1040 |
saveBox initialText:(ObjectMemory nameForSnapshot).
|
|
1041 |
saveBox label:'save image & exit'.
|
|
1042 |
saveBox showAtPointer
|
|
1043 |
|
|
1044 |
! !
|
|
1045 |
|
|
1046 |
!NewLauncher methodsFor:'actions - projects'!
|
|
1047 |
|
|
1048 |
newProject
|
93
|
1049 |
Project notNil ifTrue:[
|
|
1050 |
(ProjectView for:(Project new)) open
|
|
1051 |
]
|
86
|
1052 |
!
|
|
1053 |
|
|
1054 |
selectProject
|
|
1055 |
|list box|
|
|
1056 |
|
93
|
1057 |
Project notNil ifTrue:[
|
|
1058 |
list := Project allInstances.
|
|
1059 |
box := ListSelectionBox new.
|
|
1060 |
box list:(list collect:[:p | p name]).
|
|
1061 |
box title:(resources string:'select a project').
|
|
1062 |
box action:[:selection |
|
|
1063 |
|project|
|
86
|
1064 |
|
93
|
1065 |
project := list detect:[:p | p name = selection] ifNone:[nil].
|
|
1066 |
project isNil ifTrue:[
|
|
1067 |
Transcript showCr:'no such project'
|
|
1068 |
] ifFalse:[
|
|
1069 |
project showViews.
|
|
1070 |
Project current:project
|
|
1071 |
]
|
|
1072 |
].
|
|
1073 |
box showAtPointer
|
|
1074 |
]
|
86
|
1075 |
! !
|
|
1076 |
|
|
1077 |
!NewLauncher methodsFor:'private'!
|
|
1078 |
|
|
1079 |
closeDownViews
|
|
1080 |
"tell each topview that we are going to terminate and give it chance
|
|
1081 |
to save its contents."
|
|
1082 |
|
|
1083 |
ObjectMemory changed:#aboutToExit
|
|
1084 |
!
|
|
1085 |
|
|
1086 |
pickAView
|
|
1087 |
|v|
|
|
1088 |
|
|
1089 |
(Delay forSeconds:1) wait.
|
|
1090 |
v := Display viewFromUser.
|
|
1091 |
v isNil ifTrue:[
|
88
|
1092 |
self warn:'sorry, this is not a smalltalk view'.
|
|
1093 |
^ nil
|
86
|
1094 |
].
|
|
1095 |
^ v
|
93
|
1096 |
!
|
|
1097 |
|
|
1098 |
saveScreenImage:anImage defaultName:defaultName
|
|
1099 |
"save an image into a file
|
|
1100 |
- ask user for filename using a fileSelectionBox."
|
|
1101 |
|
|
1102 |
|fileName|
|
|
1103 |
|
|
1104 |
fileName := Dialog
|
|
1105 |
requestFileName:'save image in:'
|
|
1106 |
default:(defaultName , '.tiff')
|
|
1107 |
ok:'save'
|
|
1108 |
abort:'abort'
|
|
1109 |
pattern:'*.tiff'.
|
|
1110 |
|
|
1111 |
fileName notNil ifTrue:[
|
|
1112 |
anImage saveOn:fileName
|
|
1113 |
].
|
86
|
1114 |
! !
|
|
1115 |
|
90
|
1116 |
!NewLauncher methodsFor:'actions - demos'!
|
|
1117 |
|
|
1118 |
openDemo:className
|
|
1119 |
(Smalltalk at:className) open
|
|
1120 |
|
|
1121 |
!
|
|
1122 |
|
|
1123 |
startTicTacToe
|
|
1124 |
TicTacToe open
|
|
1125 |
!
|
|
1126 |
|
|
1127 |
startTetris
|
|
1128 |
Tetris open
|
|
1129 |
! !
|
|
1130 |
|
86
|
1131 |
!NewLauncher methodsFor:'help'!
|
|
1132 |
|
|
1133 |
helpTextFor:aComponent
|
|
1134 |
|sel|
|
|
1135 |
|
|
1136 |
aComponent == transcript ifTrue:[
|
88
|
1137 |
^ resources string:'this is the Transcript.\It is used to send\messages to the user.'
|
|
1138 |
].
|
|
1139 |
|
|
1140 |
aComponent == infoView ifTrue:[
|
|
1141 |
^ resources string:'this shows the name of the current\project and the directory\where a fileOut operation writes the file.'
|
86
|
1142 |
].
|
|
1143 |
|
|
1144 |
(buttonPanel subViews includes:aComponent) ifTrue:[
|
88
|
1145 |
"kludge: look for its change selector"
|
94
|
1146 |
sel := aComponent changeMessage.
|
88
|
1147 |
sel == #startSystemBrowser ifTrue:[
|
|
1148 |
^ resources string:'opens a\SystemBrowser'
|
|
1149 |
].
|
|
1150 |
sel == #startFileBrowser ifTrue:[
|
|
1151 |
^ resources string:'opens a\FileBrowser'
|
|
1152 |
].
|
86
|
1153 |
].
|
|
1154 |
^ nil
|
|
1155 |
! !
|