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