author | Claus Gittinger <cg@exept.de> |
Thu, 07 Dec 1995 12:59:59 +0100 | |
changeset 245 | 87fc74d6ea91 |
parent 244 | 94e45bedcdf0 |
child 249 | cc5c4a442f49 |
permissions | -rw-r--r-- |
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 |
||
105 | 36 |
customization |
37 |
" |
|
38 |
Of course, it is possible to change the NewLauncher class itself |
|
39 |
as appropriate, however, we suggest you create a subclass (say MyLauncher), |
|
40 |
define it as autoloaded in the patches file, and redefined some methods |
|
41 |
there. That way, your changes are easier to reintroduce in case of |
|
42 |
an ST/X upgrade. |
|
43 |
||
44 |
||
45 |
adding more buttons to the button-panel: |
|
46 |
||
47 |
see the method #buttonPanelSpec; |
|
48 |
it defines a list of selectors and icons, which is used by |
|
49 |
#setupButtonPanelIn:. |
|
50 |
There, for each entry, a button with that icon is created, |
|
51 |
which sends a selector-message to the launcher. |
|
52 |
||
53 |
Add entries to that list, and define appropriate methods. |
|
54 |
For example, to add a button which opens a drawTool, |
|
55 |
change #buttonPanelSpec to: |
|
56 |
||
57 |
buttonPanelSpec |
|
58 |
^ #( |
|
59 |
#(startSystemBrowser 'SBrowser32x32.xbm') |
|
60 |
#(startFileBrowser 'FBrowser32x32.xbm') |
|
61 |
#(nil nil) |
|
62 |
#(startChangesBrowser 'CBrowser32x32.xbm') |
|
63 |
#(nil nil) |
|
64 |
#(nil nil) |
|
65 |
#(startDrawTool 'DrawTool.xbm') |
|
66 |
) |
|
67 |
||
68 |
the panel adjusts its height as appropriate - you may want to |
|
69 |
create new (small) icons for a good look. |
|
70 |
||
71 |
adding an entry to a menu: |
|
72 |
||
73 |
see the #setupMenu method; either add another top-menu, or |
|
74 |
add entries to an existing menu. |
|
88 | 75 |
" |
219 | 76 |
! |
77 |
||
78 |
documentation |
|
79 |
" |
|
80 |
a new launcher, combining old Launchers menu and transcript into |
|
81 |
one view. (you no longer have to move two views around all the time ...). |
|
82 |
||
83 |
Also, this app makes first use of the new compatibility framework; |
|
84 |
you will notice, that this is a subclass of ApplicationModel. |
|
85 |
New applications will no longer be built as subclasses of standardSystemView. |
|
86 |
" |
|
88 | 87 |
! ! |
88 |
||
86 | 89 |
!NewLauncher class methodsFor:'defaults'! |
90 |
||
91 |
aboutIcon |
|
92 |
|image| |
|
93 |
||
94 |
CachedAboutIcon notNil ifTrue:[^ CachedAboutIcon]. |
|
95 |
||
96 |
image := Image fromFile:'SmalltalkX.xbm'. |
|
92 | 97 |
image notNil ifTrue:[ |
86 | 98 |
|green dark| |
99 |
||
100 |
Display hasColors ifTrue:[ |
|
105 | 101 |
green := (Color red:0 green:80 blue:20) "darkened". |
86 | 102 |
dark := Color grey:10. |
102 | 103 |
image photometric:#palette. |
86 | 104 |
] ifFalse:[ |
100 | 105 |
dark := Color black. |
106 |
green := Color white. |
|
102 | 107 |
image photometric:#blackIs0. |
86 | 108 |
]. |
102 | 109 |
image colorMap:(Array with:dark with:green). |
144 | 110 |
"/ Display depth > 2 ifTrue:[ |
111 |
"/ image := (Image implementorForDepth:Display depth) fromImage:image. |
|
112 |
"/ ] |
|
86 | 113 |
]. |
114 |
CachedAboutIcon := image. |
|
115 |
^ image |
|
116 |
||
117 |
" |
|
92 | 118 |
CachedAboutIcon := nil. |
119 |
NewLauncher aboutIcon |
|
120 |
" |
|
144 | 121 |
|
122 |
"Modified: 20.10.1995 / 21:54:58 / cg" |
|
219 | 123 |
! |
124 |
||
125 |
smallAboutIcon |
|
126 |
|image| |
|
127 |
||
128 |
image := self aboutIcon. |
|
129 |
image notNil ifTrue:[ |
|
130 |
image := image magnifiedBy:0.4. |
|
131 |
]. |
|
132 |
^ image |
|
133 |
||
134 |
" |
|
135 |
CachedAboutIcon := nil. |
|
136 |
NewLauncher aboutIcon. |
|
137 |
NewLauncher smallAboutIcon. |
|
138 |
" |
|
139 |
! ! |
|
140 |
||
141 |
!NewLauncher methodsFor:'actions - about & help'! |
|
142 |
||
143 |
about |
|
144 |
|box| |
|
145 |
||
146 |
box := AboutBox new. |
|
147 |
box autoHideAfter:10 with:[]. |
|
148 |
box showAtCenter |
|
149 |
! |
|
150 |
||
151 |
showDocumentation:aRelativeDocFilePath |
|
152 |
" |
|
153 |
although that one is not yet finished, |
|
154 |
its better than nothing ... |
|
155 |
" |
|
156 |
XtHTML notNil ifTrue:[ |
|
157 |
" |
|
158 |
temporary kludge; |
|
159 |
not all machines can autoload binaries; |
|
160 |
however, on my SGI (which can) we want it |
|
161 |
to load automatically. |
|
162 |
" |
|
163 |
XtHTML isLoaded ifFalse:[ |
|
164 |
(OperatingSystem getSystemType = 'iris') ifTrue:[ |
|
165 |
ErrorSignal catch:[XtHTML autoload] |
|
166 |
] |
|
167 |
]. |
|
168 |
XtHTML isLoaded ifTrue:[ |
|
169 |
XtHTML openFullOnDocumentationFile:aRelativeDocFilePath. |
|
170 |
^ self |
|
171 |
]. |
|
172 |
]. |
|
173 |
||
174 |
self warn:'Sorry, the ST/X HTML reader is not (yet) |
|
175 |
included in this architectures release. |
|
176 |
||
177 |
Please use Mosaic, netscape, chimera or any |
|
178 |
other HTML viewer to see the documentation. |
|
179 |
||
180 |
The documentation is found in the ''doc/online'' directory.'. |
|
181 |
||
182 |
"Modified: 31.8.1995 / 13:11:08 / claus" |
|
183 |
! |
|
184 |
||
185 |
startDocumentationTool |
|
186 |
self showDocumentation:'TOP.html' |
|
187 |
||
188 |
"Modified: 31.8.1995 / 13:11:28 / claus" |
|
189 |
! |
|
190 |
||
191 |
toggleActiveHelp:aBoolean |
|
192 |
ActiveHelp notNil ifTrue:[ |
|
193 |
helpIsOn := aBoolean. |
|
194 |
helpIsOn ifTrue:[ |
|
195 |
ActiveHelp start |
|
196 |
] ifFalse:[ |
|
197 |
ActiveHelp stop |
|
198 |
] |
|
199 |
]. |
|
200 |
! ! |
|
201 |
||
202 |
!NewLauncher methodsFor:'actions - classes'! |
|
203 |
||
204 |
browseImplementors |
|
205 |
|enterBox| |
|
206 |
||
207 |
enterBox := EnterBox title:(resources at:'Browse implementors of:') withCRs. |
|
208 |
enterBox okText:(resources at:'browse'). |
|
209 |
enterBox action:[:selectorName | |
|
210 |
|cls| |
|
211 |
||
212 |
self withWaitCursorDo:[SystemBrowser browseImplementorsOf:selectorName] |
|
213 |
]. |
|
214 |
enterBox showAtPointer |
|
215 |
! |
|
216 |
||
217 |
browseSenders |
|
218 |
|enterBox| |
|
219 |
||
220 |
enterBox := EnterBox title:(resources at:'Browse senders of:') withCRs. |
|
221 |
enterBox okText:(resources at:'browse'). |
|
222 |
enterBox action:[:selectorName | |
|
223 |
|cls| |
|
224 |
||
225 |
self withWaitCursorDo:[SystemBrowser browseAllCallsOn:selectorName] |
|
226 |
]. |
|
227 |
enterBox showAtPointer |
|
228 |
! |
|
229 |
||
230 |
startChangesBrowser |
|
231 |
self withWaitCursorDo:[ChangesBrowser open] |
|
232 |
! |
|
233 |
||
234 |
startClassBrowser |
|
235 |
SystemBrowser askThenBrowseClass |
|
236 |
! |
|
237 |
||
238 |
startClassHierarchyBrowser |
|
239 |
SystemBrowser askThenBrowseClassHierarchy |
|
240 |
! |
|
241 |
||
242 |
startClassTreeView |
|
243 |
self withWaitCursorDo:[ClassTreeGraphView open] |
|
244 |
! |
|
245 |
||
246 |
startFileBrowser |
|
247 |
self withWaitCursorDo:[FileBrowser open] |
|
248 |
! |
|
249 |
||
250 |
startFullClassBrowser |
|
251 |
SystemBrowser askThenBrowseFullClassProtocol |
|
252 |
! |
|
253 |
||
254 |
startSystemBrowser |
|
255 |
self withWaitCursorDo:[SystemBrowser open] |
|
256 |
! |
|
257 |
||
258 |
startWorkspace |
|
259 |
Workspace open |
|
260 |
! ! |
|
261 |
||
262 |
!NewLauncher methodsFor:'actions - demos'! |
|
263 |
||
264 |
openDemo:className |
|
265 |
(Smalltalk at:className) open |
|
266 |
||
267 |
! |
|
268 |
||
269 |
startTetris |
|
270 |
Tetris open |
|
271 |
! |
|
272 |
||
273 |
startTicTacToe |
|
274 |
TicTacToeGame open |
|
275 |
! |
|
276 |
||
277 |
startTicTacToe2 |
|
278 |
TicTacToeGame open2UserGame |
|
279 |
! ! |
|
280 |
||
281 |
!NewLauncher methodsFor:'actions - file'! |
|
282 |
||
283 |
exit |
|
284 |
(self confirm:(resources string:'Are you certain you want to exit without saving ?')) |
|
285 |
ifTrue:[ |
|
286 |
self saveAllViews. |
|
287 |
Smalltalk exit |
|
288 |
] |
|
289 |
! |
|
290 |
||
291 |
objectModuleDialog |
|
292 |
|allModules moduleNames |
|
293 |
allObjects methodObjects methodNames |
|
294 |
box l unloadButton |
|
295 |
list1 list2 listView1 listView2 |
|
296 |
y panel showBuiltIn showModules showMethods moduleListUpdater check| |
|
297 |
||
298 |
showBuiltIn := true asValue. |
|
299 |
showModules := ObjectFileLoader notNil asValue. |
|
300 |
showMethods := ObjectFileLoader notNil asValue. |
|
301 |
||
302 |
moduleListUpdater := Plug new. |
|
303 |
moduleListUpdater |
|
245 | 304 |
respondTo:#getModules |
305 |
with:[ |
|
306 |
|l| |
|
219 | 307 |
|
245 | 308 |
l := Array new. |
309 |
(showModules value or:[showBuiltIn value]) ifTrue:[ |
|
310 |
allModules := ObjectMemory binaryModuleInfo asOrderedCollection. |
|
311 |
(showBuiltIn value and:[showModules value]) ifFalse:[ |
|
312 |
allModules := allModules select:[:i | |
|
313 |
|wantToSee| |
|
219 | 314 |
|
245 | 315 |
wantToSee := (i at:#dynamic). |
316 |
showBuiltIn value ifTrue:[ |
|
317 |
wantToSee := wantToSee not |
|
318 |
]. |
|
319 |
wantToSee |
|
320 |
] |
|
321 |
]. |
|
322 |
"/ sorting by reverse id brings newest ones to the top (a side effect) |
|
323 |
allModules sort:[:a :b | (a at:#id) > (b at:#id)]. |
|
324 |
moduleNames := allModules collect:[:entry | (entry at:#name)]. |
|
325 |
l := l , moduleNames. |
|
326 |
]. |
|
327 |
showMethods value ifTrue:[ |
|
328 |
allObjects := ObjectFileLoader loadedObjectHandles. |
|
329 |
methodObjects := (allObjects select:[:h | h isMethodHandle]) asArray. |
|
330 |
methodNames := methodObjects collect:[:mH | mH method isNil ifTrue:[ |
|
331 |
'compiled method - removed' , ' (in ' , mH pathName , ')' |
|
332 |
] ifFalse:[ |
|
333 |
'compiled method ' , mH method whoString , ' (in ' , mH pathName , ')' |
|
334 |
]. |
|
335 |
]. |
|
336 |
l := l , methodNames. |
|
337 |
]. |
|
338 |
list1 list:l. |
|
339 |
unloadButton disable. |
|
340 |
]. |
|
219 | 341 |
|
342 |
list1 := SelectionInList new. |
|
343 |
list2 := SelectionInList new. |
|
344 |
||
345 |
showBuiltIn onChangeSend:#getModules to:moduleListUpdater. |
|
346 |
showModules onChangeSend:#getModules to:moduleListUpdater. |
|
347 |
showMethods onChangeSend:#getModules to:moduleListUpdater. |
|
348 |
||
349 |
box := Dialog new. |
|
350 |
box label:(resources string:'Module dialog'). |
|
351 |
||
352 |
listView1 := HVScrollableView for:SelectionInListView miniScrollerH:true. |
|
353 |
listView1 model:list1. |
|
354 |
listView1 origin:0.0@0.0 corner:1.0@0.4. "/ ; inset:2. |
|
355 |
listView1 action:[:sel | |
|
245 | 356 |
|info classNames tabs| |
219 | 357 |
|
245 | 358 |
(showModules value or:[showBuiltIn value]) ifTrue:[ |
359 |
info := allModules at:sel ifAbsent:nil. |
|
360 |
]. |
|
361 |
info isNil ifTrue:[ |
|
362 |
"/ selected a method |
|
363 |
list2 list:#(). |
|
364 |
unloadButton enable. |
|
365 |
] ifFalse:[ |
|
366 |
"/ selected a package |
|
219 | 367 |
|
245 | 368 |
tabs := TabulatorSpecification unit:#inch positions:#(0 3). |
219 | 369 |
|
245 | 370 |
"/ fill bottom list with class-info |
219 | 371 |
|
245 | 372 |
classNames := (info at:#classNames) asSortedCollection. |
373 |
classNames := classNames collect:[:cName | |
|
374 |
|cls entry rev listEntry| |
|
219 | 375 |
|
245 | 376 |
listEntry := MultiColListEntry new:2 tabulatorSpecification:tabs. |
377 |
listEntry colAt:1 put:cName. |
|
219 | 378 |
|
245 | 379 |
cls := Smalltalk classNamed:cName. |
380 |
cls isNil ifTrue:[ |
|
381 |
listEntry colAt:2 put:'(class removed)'. |
|
382 |
] ifFalse:[ |
|
383 |
rev := cls binaryRevision. |
|
384 |
rev notNil ifTrue:[ |
|
385 |
entry :='(bin: ' , rev. |
|
386 |
cls revision ~= rev ifTrue:[ |
|
387 |
entry := entry , ' / src: ' , cls revision |
|
388 |
]. |
|
389 |
listEntry colAt:2 put:entry , ')' |
|
390 |
]. |
|
391 |
]. |
|
392 |
listEntry |
|
393 |
]. |
|
394 |
list2 list:classNames. |
|
395 |
(info at:#dynamic) ifTrue:[ |
|
396 |
unloadButton enable. |
|
397 |
] ifFalse:[ |
|
398 |
unloadButton disable. |
|
399 |
]. |
|
400 |
] |
|
219 | 401 |
]. |
402 |
||
403 |
panel := HorizontalPanelView new. |
|
404 |
||
245 | 405 |
panel add:(l := Label label:'modules shown:'). |
219 | 406 |
l adjust:#left; borderWidth:0. |
407 |
panel add:(CheckBox label:'builtin' model:showBuiltIn). |
|
408 |
panel add:(check := CheckBox label:'modules' model:showModules). |
|
409 |
ObjectFileLoader isNil ifTrue:[check disable]. |
|
410 |
panel add:(check := CheckBox label:'methods' model:showMethods). |
|
411 |
ObjectFileLoader isNil ifTrue:[check disable]. |
|
412 |
||
413 |
panel horizontalLayout:#fitSpace. |
|
414 |
||
415 |
box addComponent:panel tabable:true. |
|
416 |
||
417 |
box addComponent:listView1 tabable:true. |
|
418 |
listView1 topInset:(View viewSpacing + panel preferredExtent y). |
|
419 |
listView1 origin:0.0@0.0 corner:1.0@0.4. "/ ; inset:2. |
|
420 |
||
421 |
l := box addTextLabel:(resources string:'contained classes/subsets:'). |
|
422 |
l adjust:#left; borderWidth:0. |
|
423 |
l origin:0.0@0.4 corner:1.0@0.4. |
|
424 |
l topInset:(View viewSpacing). |
|
425 |
l bottomInset:((l preferredExtent y) negated - View viewSpacing). |
|
426 |
||
427 |
listView2 := HVScrollableView for:SelectionInListView miniScrollerH:true. |
|
428 |
listView2 model:list2; printItems:false. |
|
429 |
box addComponent:listView2 tabable:true. |
|
430 |
listView2 origin:0.0@0.4 corner:1.0@1.0. "/ ; inset:2. |
|
431 |
listView2 disable. |
|
432 |
||
433 |
unloadButton := Button label:(resources string:'unload'). |
|
434 |
unloadButton action:[ |
|
245 | 435 |
self withWaitCursorDo:[ |
436 |
box withWaitCursorDo:[ |
|
437 |
|info idx pathName| |
|
219 | 438 |
|
245 | 439 |
idx := list1 selectionIndex. |
440 |
info := allModules at:idx ifAbsent:nil. |
|
219 | 441 |
|
245 | 442 |
info isNil ifTrue:[ |
443 |
"/ selected a method |
|
444 |
idx := idx - allModules size. |
|
445 |
pathName := (methodObjects at:idx) pathName. |
|
219 | 446 |
|
245 | 447 |
] ifFalse:[ |
448 |
"/ selected a package |
|
449 |
pathName := (info at:#pathName). |
|
450 |
]. |
|
451 |
ObjectFileLoader unloadObjectFile:pathName. |
|
452 |
moduleListUpdater getModules. |
|
453 |
unloadButton disable. |
|
454 |
] |
|
455 |
] |
|
219 | 456 |
]. |
457 |
moduleListUpdater getModules. |
|
458 |
||
459 |
box addButton:unloadButton. |
|
460 |
box addAbortButtonLabelled:(resources string:'close'). |
|
461 |
||
462 |
y := box yPosition. |
|
463 |
listView2 topInset:(l preferredExtent y + 5). |
|
464 |
listView2 bottomInset:(box preferredExtent y - y). |
|
465 |
||
466 |
box width:(350 min:(box device width * 2 // 3)); |
|
245 | 467 |
height:(450 min:(box device height - 50)); |
468 |
sizeFixed:true. |
|
219 | 469 |
box showAtPointer. |
238
523cc1f36b1d
release boxes - no Workspace button (its ugly)
Claus Gittinger <cg@exept.de>
parents:
233
diff
changeset
|
470 |
box destroy. |
219 | 471 |
|
472 |
"Modified: 17.9.1995 / 16:47:50 / claus" |
|
245 | 473 |
"Modified: 7.12.1995 / 12:59:24 / cg" |
219 | 474 |
! |
475 |
||
476 |
snapshot |
|
477 |
|saveBox| |
|
478 |
||
479 |
saveBox := EnterBox title:(resources at:'filename for image:') withCRs. |
|
480 |
saveBox okText:(resources at:'save'). |
|
481 |
saveBox action:[:fileName | |
|
482 |
(ObjectMemory snapShotOn:fileName) ifFalse:[ |
|
483 |
" |
|
484 |
snapshot failed for some reason (disk full, no permission etc.) |
|
485 |
" |
|
486 |
self warn:(resources string:'failed to save snapshot image (disk full or not writable)'). |
|
487 |
] |
|
488 |
]. |
|
489 |
||
490 |
saveBox initialText:(ObjectMemory nameForSnapshot). |
|
491 |
saveBox label:'save image'. |
|
492 |
saveBox showAtPointer |
|
493 |
||
494 |
! |
|
495 |
||
496 |
snapshotAndExit |
|
497 |
|saveBox| |
|
498 |
||
499 |
saveBox := EnterBox title:(resources at:'filename for image:') withCRs. |
|
500 |
saveBox okText:(resources at:'save & exit'). |
|
501 |
saveBox action:[:fileName | |
|
502 |
(ObjectMemory snapShotOn:fileName) ifFalse:[ |
|
503 |
" |
|
504 |
snapshot failed for some reason (disk full, no permission etc.) |
|
505 |
Do NOT exit in this case. |
|
506 |
" |
|
507 |
self warn:(resources string:'failed to save snapshot image (disk full or not writable)'). |
|
508 |
] ifTrue:[ |
|
509 |
" |
|
510 |
saveAllViews tells all views to shutdown neatly |
|
511 |
(i.e. offer a chance to save the contents to a file). |
|
512 |
||
513 |
This is NOT required - all data should be in the snapshot ... |
|
514 |
... however, if remote disks/mountable filesystems are involved, |
|
515 |
which may not be present the next time, it may make sense to |
|
516 |
uncomment it and query for saving - time will show which is better. |
|
517 |
" |
|
518 |
" |
|
519 |
self saveAllViews. |
|
520 |
" |
|
521 |
Smalltalk exit |
|
522 |
] |
|
523 |
]. |
|
524 |
||
525 |
saveBox initialText:(ObjectMemory nameForSnapshot). |
|
526 |
saveBox label:'save image & exit'. |
|
527 |
saveBox showAtPointer |
|
528 |
||
529 |
! ! |
|
530 |
||
531 |
!NewLauncher methodsFor:'actions - goodies'! |
|
532 |
||
533 |
startCalendar |
|
534 |
Calendar open |
|
535 |
! |
|
536 |
||
537 |
startClock |
|
538 |
RoundClock open |
|
539 |
! |
|
540 |
||
541 |
startMailTool |
|
542 |
MailView open |
|
543 |
! |
|
544 |
||
545 |
startNewsTool |
|
546 |
NewsView open |
|
547 |
! ! |
|
548 |
||
549 |
!NewLauncher methodsFor:'actions - projects'! |
|
550 |
||
551 |
newProject |
|
552 |
Project notNil ifTrue:[ |
|
553 |
(ProjectView for:(Project new)) open |
|
554 |
] |
|
555 |
! |
|
556 |
||
557 |
selectProject |
|
558 |
|list box| |
|
559 |
||
560 |
Project notNil ifTrue:[ |
|
561 |
list := Project allInstances. |
|
562 |
box := ListSelectionBox new. |
|
563 |
box list:(list collect:[:p | p name]). |
|
564 |
box title:(resources string:'select a project'). |
|
565 |
box action:[:selection | |
|
566 |
|project| |
|
567 |
||
568 |
project := list detect:[:p | p name = selection] ifNone:[nil]. |
|
569 |
project isNil ifTrue:[ |
|
570 |
Transcript showCr:'no such project.' |
|
571 |
] ifFalse:[ |
|
572 |
project showViews. |
|
573 |
Project current:project |
|
574 |
] |
|
575 |
]. |
|
238
523cc1f36b1d
release boxes - no Workspace button (its ugly)
Claus Gittinger <cg@exept.de>
parents:
233
diff
changeset
|
576 |
box showAtPointer. |
523cc1f36b1d
release boxes - no Workspace button (its ugly)
Claus Gittinger <cg@exept.de>
parents:
233
diff
changeset
|
577 |
box destroy |
219 | 578 |
] |
86 | 579 |
! ! |
580 |
||
219 | 581 |
!NewLauncher methodsFor:'actions - settings'! |
582 |
||
583 |
compilerSettings |
|
584 |
|box warnings warnSTX warnUnderscore warnOldStyle allowUnderscore immutableArrays |
|
585 |
warnSTXBox warnUnderscoreBox warnOldStyleBox |
|
586 |
stcCompilation compilationList stcCompilationOptions stcIncludes stcDefines stcOptions |
|
587 |
stcLibraries historyLines catchRedefs |
|
588 |
warnEnabler check y component| |
|
589 |
||
590 |
warnings := Compiler warnings asValue. |
|
591 |
||
592 |
warnSTX := Compiler warnSTXSpecials asValue. |
|
593 |
warnUnderscore := Compiler warnUnderscoreInIdentifier asValue. |
|
594 |
warnOldStyle := Compiler warnOldStyleAssignment asValue. |
|
595 |
allowUnderscore := Compiler allowUnderscoreInIdentifier asValue. |
|
596 |
immutableArrays := Compiler arraysAreImmutable asValue. |
|
597 |
stcCompilationOptions := #( always default never). |
|
598 |
stcCompilation := SelectionInList new list:(resources array:#('always' 'primitive code only' 'never')). |
|
599 |
stcCompilation selectionIndex:2. |
|
600 |
stcIncludes := Compiler stcCompilationIncludes asValue. |
|
601 |
stcDefines := Compiler stcCompilationDefines asValue. |
|
602 |
stcOptions := Compiler stcCompilationOptions asValue. |
|
232 | 603 |
ObjectFileLoader notNil ifTrue:[ |
604 |
stcLibraries := (String fromStringCollection:ObjectFileLoader searchedLibraries separatedBy:' ') asValue. |
|
605 |
]. |
|
219 | 606 |
|
607 |
catchRedefs := Class catchMethodRedefinitions asValue. |
|
608 |
historyLines := (HistoryManager notNil and:[HistoryManager isActive]) asValue. |
|
609 |
||
610 |
warnEnabler := Plug new. |
|
611 |
warnEnabler |
|
232 | 612 |
respondTo:#check |
613 |
with:[warnings value ifTrue:[ |
|
614 |
warnSTXBox enable. |
|
615 |
warnOldStyleBox enable. |
|
616 |
allowUnderscore value ifTrue:[ |
|
617 |
warnUnderscoreBox enable. |
|
618 |
] ifFalse:[ |
|
619 |
warnUnderscoreBox disable. |
|
620 |
]. |
|
621 |
] ifFalse:[ |
|
622 |
warnSTXBox disable. |
|
623 |
warnUnderscoreBox disable. |
|
624 |
warnOldStyleBox disable. |
|
625 |
]]. |
|
219 | 626 |
|
627 |
warnings onChangeSend:#check to:warnEnabler. |
|
628 |
allowUnderscore onChangeSend:#check to:warnEnabler. |
|
629 |
||
630 |
box := DialogBox new. |
|
631 |
box label:(resources string:'Compiler settings'). |
|
632 |
||
633 |
box addCheckBox:(resources string:'catch method redefinitions') on:catchRedefs. |
|
634 |
check := box addCheckBox:(resources string:'keep history line in methods') on:historyLines. |
|
635 |
HistoryManager isNil ifTrue:[check disable]. |
|
636 |
||
637 |
box addHorizontalLine. |
|
638 |
||
232 | 639 |
ObjectFileLoader notNil ifTrue:[ |
640 |
compilationList := box addPopUpList:(resources string:'compilation to machine code') on:stcCompilation. |
|
641 |
stcCompilation selectionIndex:( stcCompilationOptions indexOf:(Compiler stcCompilation) ifAbsent:2). |
|
219 | 642 |
|
232 | 643 |
y := box yPosition. |
644 |
component := box addTextLabel:(resources string:'stc include directories:'). |
|
645 |
component width:0.5; adjust:#right; borderWidth:0. |
|
646 |
box yPosition:y. |
|
647 |
component := box addInputFieldOn:stcIncludes tabable:true. |
|
648 |
component width:0.5; left:0.5; immediateAccept:true; acceptOnLeave:false; cursorMovementWhenUpdating:#beginOfLine. |
|
219 | 649 |
|
232 | 650 |
box addVerticalSpace. |
651 |
y := box yPosition. |
|
652 |
component := box addTextLabel:'stc defines:'. |
|
653 |
component width:0.5; adjust:#right; borderWidth:0. |
|
654 |
box yPosition:y. |
|
655 |
component := box addInputFieldOn:stcDefines tabable:true. |
|
656 |
component width:0.5; left:0.5; immediateAccept:true; acceptOnLeave:false; cursorMovementWhenUpdating:#beginOfLine. |
|
219 | 657 |
|
232 | 658 |
box addVerticalSpace. |
659 |
y := box yPosition. |
|
660 |
component := box addTextLabel:'stc options:'. |
|
661 |
component width:0.5; adjust:#right; borderWidth:0. |
|
662 |
box yPosition:y. |
|
663 |
component := box addInputFieldOn:stcOptions tabable:true. |
|
664 |
component width:0.5; left:0.5; immediateAccept:true; acceptOnLeave:false; cursorMovementWhenUpdating:#beginOfLine. |
|
219 | 665 |
|
232 | 666 |
box addVerticalSpace. |
667 |
y := box yPosition. |
|
668 |
component := box addTextLabel:'stc C-libraries:'. |
|
669 |
component width:0.5; adjust:#right; borderWidth:0. |
|
670 |
box yPosition:y. |
|
671 |
component := box addInputFieldOn:stcLibraries tabable:true. |
|
672 |
component width:0.5; left:0.5; immediateAccept:true; acceptOnLeave:false; cursorMovementWhenUpdating:#beginOfLine. |
|
219 | 673 |
|
232 | 674 |
box addVerticalSpace. |
675 |
box addHorizontalLine. |
|
219 | 676 |
|
232 | 677 |
"/ if there is no compiler around, |
678 |
"/ change to compile nothing, and disable the checkBoxes |
|
679 |
Compiler canCreateMachineCode ifFalse:[ |
|
680 |
stcCompilation selectionIndex:3. |
|
681 |
compilationList disable. |
|
682 |
]. |
|
219 | 683 |
]. |
684 |
||
685 |
box addCheckBox:(resources string:'allow underscore in identifiers') on:allowUnderscore. |
|
686 |
box addVerticalSpace. |
|
687 |
box addCheckBox:(resources string:'literal arrays are immutable') on:immutableArrays. |
|
688 |
box addHorizontalLine. |
|
689 |
||
690 |
box addCheckBox:(resources string:'warnings') on:warnings. |
|
691 |
box addVerticalSpace. |
|
692 |
box leftIndent:30. |
|
693 |
warnSTXBox := box addCheckBox:(resources string:'ST/X language extensions') on:warnSTX. |
|
694 |
box addVerticalSpace. |
|
695 |
warnUnderscoreBox := box addCheckBox:(resources string:'underscores in identifiers') on:warnUnderscore. |
|
696 |
box addVerticalSpace. |
|
697 |
warnOldStyleBox := box addCheckBox:(resources string:'oldStyle assignment') on:warnOldStyle. |
|
698 |
box addVerticalSpace. |
|
699 |
box leftIndent:0. |
|
700 |
||
701 |
box addAbortButton; addOkButton. |
|
702 |
||
703 |
warnEnabler check. |
|
704 |
box showAtPointer. |
|
705 |
||
706 |
box accepted ifTrue:[ |
|
232 | 707 |
HistoryManager notNil ifTrue:[ |
708 |
historyLines value ifTrue:[ |
|
709 |
HistoryManager activate |
|
710 |
] ifFalse:[ |
|
711 |
HistoryManager deactivate |
|
712 |
]. |
|
713 |
]. |
|
714 |
Class catchMethodRedefinitions:catchRedefs value. |
|
715 |
Compiler warnings:warnings value. |
|
716 |
Compiler warnSTXSpecials:warnSTX value. |
|
717 |
Compiler warnOldStyleAssignment:warnOldStyle value. |
|
718 |
Compiler warnUnderscoreInIdentifier:warnUnderscore value. |
|
719 |
Compiler allowUnderscoreInIdentifier:allowUnderscore value. |
|
720 |
Compiler arraysAreImmutable:immutableArrays value. |
|
721 |
Compiler stcCompilation:(stcCompilationOptions at:stcCompilation selectionIndex). |
|
722 |
Compiler stcCompilationIncludes:stcIncludes value. |
|
723 |
Compiler stcCompilationDefines:stcDefines value. |
|
724 |
Compiler stcCompilationOptions:stcOptions value. |
|
238
523cc1f36b1d
release boxes - no Workspace button (its ugly)
Claus Gittinger <cg@exept.de>
parents:
233
diff
changeset
|
725 |
ObjectFileLoader notNil ifTrue:[ |
233 | 726 |
ObjectFileLoader searchedLibraries:(stcLibraries value asCollectionOfWords). |
727 |
] |
|
238
523cc1f36b1d
release boxes - no Workspace button (its ugly)
Claus Gittinger <cg@exept.de>
parents:
233
diff
changeset
|
728 |
]. |
523cc1f36b1d
release boxes - no Workspace button (its ugly)
Claus Gittinger <cg@exept.de>
parents:
233
diff
changeset
|
729 |
box destroy |
219 | 730 |
|
731 |
"Modified: 10.9.1995 / 19:19:18 / claus" |
|
228 | 732 |
"Modified: 4.12.1995 / 01:11:23 / cg" |
219 | 733 |
! |
734 |
||
735 |
keyboardSetting |
|
736 |
|mappings listOfRawKeys listOfFunctions |
|
737 |
box l |
|
738 |
list1 list2 listView1 listView2 |
|
739 |
frame selectionForwarder macroForwarder macroTextView y| |
|
740 |
||
741 |
mappings := Screen current keyboardMap. |
|
742 |
||
743 |
listOfRawKeys := (mappings keys asArray collect:[:key | key asString]) sort. |
|
744 |
listOfFunctions := (mappings values asSet asArray collect:[:key | key asString]) sort. |
|
745 |
||
746 |
selectionForwarder := Plug new. |
|
747 |
selectionForwarder respondTo:#showFunction |
|
748 |
with:[ |
|
749 |
|raw| |
|
750 |
raw := list1 selection. |
|
751 |
list2 retractInterrestFor:selectionForwarder. |
|
752 |
list2 selection:(mappings at:raw asSymbol) asString. |
|
753 |
list2 onChangeSend:#showRawKey to:selectionForwarder. |
|
754 |
]. |
|
755 |
selectionForwarder respondTo:#showRawKey |
|
756 |
with:[ |
|
757 |
|f raw| |
|
758 |
||
759 |
f := list2 selection. |
|
760 |
list1 retractInterrestFor:selectionForwarder. |
|
761 |
raw := mappings keyAtValue:f asString. |
|
762 |
raw isNil ifTrue:[ |
|
763 |
raw := mappings keyAtValue:f first. |
|
764 |
raw isNil ifTrue:[ |
|
765 |
raw := mappings keyAtValue:f asSymbol. |
|
766 |
] |
|
767 |
]. |
|
768 |
list1 selection:raw. |
|
769 |
list1 onChangeSend:#showFunction to:selectionForwarder. |
|
770 |
]. |
|
771 |
||
772 |
macroForwarder := Plug new. |
|
773 |
macroForwarder respondTo:#showMacro |
|
774 |
with:[ |
|
775 |
|f macro indent| |
|
776 |
f := list2 selection. |
|
777 |
(f startsWith:'Cmd') ifTrue:[ |
|
778 |
f := f copyFrom:4 |
|
779 |
]. |
|
780 |
macro := FunctionKeySequences at:(f asSymbol) ifAbsent:nil. |
|
781 |
macro notNil ifTrue:[ |
|
782 |
macro := macro asStringCollection. |
|
783 |
indent := macro |
|
784 |
inject:99999 into:[:min :element | |
|
785 |
|stripped| |
|
786 |
||
787 |
stripped := element withoutLeadingSeparators. |
|
788 |
stripped size == 0 ifTrue:[ |
|
789 |
min |
|
790 |
] ifFalse:[ |
|
791 |
min min:(element size - stripped size) |
|
792 |
] |
|
793 |
]. |
|
794 |
indent ~~ 0 ifTrue:[ |
|
795 |
macro := macro collect:[:line | |
|
796 |
line size > indent ifTrue:[ |
|
797 |
line copyFrom:indent+1 |
|
798 |
] ifFalse:[ |
|
799 |
line |
|
800 |
]. |
|
801 |
] |
|
802 |
]. |
|
803 |
]. |
|
804 |
macroTextView contents:macro. |
|
805 |
]. |
|
806 |
||
807 |
list1 := SelectionInList with:listOfRawKeys. |
|
808 |
list1 onChangeSend:#showFunction to:selectionForwarder. |
|
809 |
list2 := SelectionInList with:listOfFunctions. |
|
810 |
list2 onChangeSend:#showRawKey to:selectionForwarder. |
|
811 |
list2 onChangeSend:#showMacro to:macroForwarder. |
|
812 |
||
813 |
box := Dialog new. |
|
814 |
box label:(resources string:'Keyboard mappings'). |
|
815 |
||
816 |
l := box addTextLabel:(resources string:'KEY_MSG') withCRs. |
|
817 |
l adjust:#left; borderWidth:0. |
|
818 |
||
819 |
frame := View new. |
|
820 |
frame extent:300 @ 300. |
|
821 |
frame borderWidth:0. |
|
822 |
||
823 |
listView1 := ScrollableView for:SelectionInListView in:frame. |
|
824 |
listView1 model:list1. |
|
825 |
listView1 origin:0.0@0.0 corner:0.5@1.0; inset:2. |
|
826 |
||
827 |
listView2 := ScrollableView for:SelectionInListView in:frame. |
|
828 |
listView2 model:list2. |
|
829 |
listView2 origin:0.5@0.0 corner:1.0@1.0; inset:2. |
|
830 |
||
831 |
frame topInset:box yPosition. |
|
832 |
box addComponent:frame withExtent:350@200. |
|
833 |
box makeTabable:listView1. |
|
834 |
box makeTabable:listView2. |
|
835 |
frame origin:0.0@0.0 corner:1.0@0.6. |
|
836 |
||
837 |
box addVerticalSpace. |
|
838 |
||
839 |
l := box addTextLabel:(resources string:'Macro text (if any):') withCRs. |
|
840 |
l adjust:#left; borderWidth:0. |
|
841 |
l origin:0.0@0.6 corner:1.0@0.6. |
|
842 |
l topInset:(View viewSpacing). |
|
843 |
l bottomInset:(l preferredExtent y negated - View viewSpacing). |
|
844 |
||
845 |
macroTextView := HVScrollableView for:TextView miniScroller:true. |
|
846 |
box addComponent:macroTextView tabable:true. |
|
847 |
macroTextView origin:0.0@0.6 corner:1.0@1.0. |
|
848 |
y := box yPosition. |
|
849 |
||
850 |
box "addAbortButton;" addOkButton. |
|
851 |
macroTextView topInset:(l preferredExtent y + 5). |
|
852 |
macroTextView bottomInset:(box preferredExtent y - y). |
|
853 |
||
854 |
box showAtPointer. |
|
855 |
||
856 |
box accepted ifTrue:[ |
|
857 |
"no action yet ..." |
|
238
523cc1f36b1d
release boxes - no Workspace button (its ugly)
Claus Gittinger <cg@exept.de>
parents:
233
diff
changeset
|
858 |
]. |
523cc1f36b1d
release boxes - no Workspace button (its ugly)
Claus Gittinger <cg@exept.de>
parents:
233
diff
changeset
|
859 |
box destroy |
219 | 860 |
! |
861 |
||
862 |
languageSetting |
|
863 |
|listOfLanguages box| |
|
864 |
||
865 |
" |
|
866 |
hardwiring here is stupid - need a resource file |
|
867 |
which lists languagenames which have all texts available |
|
868 |
in resource files ... |
|
869 |
" |
|
870 |
listOfLanguages := #('english' |
|
871 |
'german' |
|
872 |
'french' |
|
873 |
'spanish' |
|
874 |
'italian' |
|
875 |
). |
|
876 |
||
877 |
box := ListSelectionBox title:(resources string:'LANG_MSG') withCRs. |
|
878 |
box label:(resources string:'Language selection'). |
|
879 |
box list:listOfLanguages. |
|
880 |
box initialText:(Language). |
|
881 |
box action:[:newLanguage | |
|
882 |
self withWaitCursorDo:[ |
|
883 |
Transcript showCr:'change language to ' , newLanguage , ' ...'. |
|
884 |
Smalltalk at:#Language put:newLanguage asSymbol. |
|
885 |
Smalltalk changed:#Language. |
|
886 |
ResourcePack flushCachedResourcePacks |
|
887 |
]. |
|
888 |
self reopenLauncher. |
|
889 |
]. |
|
238
523cc1f36b1d
release boxes - no Workspace button (its ugly)
Claus Gittinger <cg@exept.de>
parents:
233
diff
changeset
|
890 |
box showAtPointer. |
523cc1f36b1d
release boxes - no Workspace button (its ugly)
Claus Gittinger <cg@exept.de>
parents:
233
diff
changeset
|
891 |
box destroy |
219 | 892 |
! |
893 |
||
894 |
messageSettings |
|
895 |
|box vmInfo vmErrors displayErrors classInfos| |
|
896 |
||
897 |
vmInfo := ObjectMemory infoPrinting asValue. |
|
898 |
vmErrors := ObjectMemory debugPrinting asValue. |
|
899 |
classInfos := Object infoPrinting asValue. |
|
900 |
displayErrors := DeviceWorkstation errorPrinting asValue. |
|
901 |
||
902 |
box := DialogBox new. |
|
903 |
box label:(resources string:'Messages'). |
|
904 |
"/ box extent:200@300. |
|
905 |
||
906 |
box addCheckBox:(resources string:'VM info messages') on:vmInfo. |
|
907 |
box addCheckBox:(resources string:'VM error messages') on:vmErrors. |
|
908 |
box addHorizontalLine. |
|
909 |
||
910 |
box addCheckBox:(resources string:'Display error messages (Xlib, Xtlib ...)') on:displayErrors. |
|
911 |
box addCheckBox:(resources string:'Other info messages') on:classInfos. |
|
99 | 912 |
|
219 | 913 |
box addAbortButton; addOkButton. |
914 |
box showAtPointer. |
|
915 |
||
916 |
box accepted ifTrue:[ |
|
917 |
ObjectMemory infoPrinting:vmInfo value. |
|
918 |
ObjectMemory debugPrinting:vmErrors value. |
|
919 |
Object infoPrinting:classInfos value. |
|
920 |
DeviceWorkstation errorPrinting:displayErrors value. |
|
238
523cc1f36b1d
release boxes - no Workspace button (its ugly)
Claus Gittinger <cg@exept.de>
parents:
233
diff
changeset
|
921 |
]. |
523cc1f36b1d
release boxes - no Workspace button (its ugly)
Claus Gittinger <cg@exept.de>
parents:
233
diff
changeset
|
922 |
box destroy |
219 | 923 |
! |
924 |
||
925 |
miscSettings |
|
926 |
|box check logDoits shadows updChanges changeFileName |
|
927 |
loadBinaries compileLazy hostNameInLabel y component| |
|
928 |
||
929 |
logDoits := Smalltalk logDoits asValue. |
|
930 |
shadows := PopUpView shadows asValue. |
|
931 |
hostNameInLabel := StandardSystemView includeHostNameInLabel asValue. |
|
932 |
updChanges := Class updatingChanges asValue. |
|
933 |
changeFileName := ObjectMemory nameForChanges asValue. |
|
934 |
||
935 |
loadBinaries := Smalltalk loadBinaries asValue. |
|
936 |
compileLazy := Autoload compileLazy asValue. |
|
937 |
||
938 |
box := DialogBox new. |
|
939 |
box label:(resources string:'Other settings'). |
|
940 |
"/ box extent:200@300. |
|
941 |
||
942 |
box addCheckBox:(resources string:'log compiles in changes file') on:updChanges. |
|
943 |
box addCheckBox:(resources string:'log doIts in changes file') on:logDoits. |
|
944 |
y := box yPosition. |
|
945 |
component := box addTextLabel:(resources string:'change file:'). |
|
228 | 946 |
component width:0.5; adjust:#right; borderWidth:0. |
219 | 947 |
box yPosition:y. |
948 |
component := box addInputFieldOn:changeFileName tabable:true. |
|
949 |
component width:0.5; left:0.5; immediateAccept:true; acceptOnLeave:false. |
|
950 |
||
951 |
box addHorizontalLine. |
|
952 |
||
953 |
box addCheckBox:(resources string:'lazy compilation when autoloading') on:compileLazy. |
|
954 |
check := box addCheckBox:(resources string:'if present, load binary objects when autoloading') on:loadBinaries. |
|
955 |
ObjectFileLoader isNil ifTrue:[ |
|
232 | 956 |
loadBinaries value:false. |
957 |
check disable |
|
219 | 958 |
]. |
959 |
box addHorizontalLine. |
|
960 |
||
961 |
box addCheckBox:(resources string:'shadows under popup views') on:shadows. |
|
962 |
box addCheckBox:(resources string:'hostname in window labels') on:hostNameInLabel. |
|
963 |
||
964 |
box addAbortButton; addOkButton. |
|
965 |
box showAtPointer. |
|
966 |
||
967 |
box accepted ifTrue:[ |
|
232 | 968 |
Smalltalk logDoits:logDoits value. |
969 |
PopUpView shadows:shadows value. |
|
970 |
Class updateChanges:updChanges value. |
|
971 |
Autoload compileLazy:compileLazy value. |
|
972 |
Smalltalk loadBinaries:loadBinaries value. |
|
973 |
StandardSystemView includeHostNameInLabel:hostNameInLabel value. |
|
974 |
ObjectMemory nameForChanges:changeFileName value. |
|
238
523cc1f36b1d
release boxes - no Workspace button (its ugly)
Claus Gittinger <cg@exept.de>
parents:
233
diff
changeset
|
975 |
]. |
523cc1f36b1d
release boxes - no Workspace button (its ugly)
Claus Gittinger <cg@exept.de>
parents:
233
diff
changeset
|
976 |
box destroy |
219 | 977 |
|
228 | 978 |
"Modified: 4.12.1995 / 01:10:49 / cg" |
219 | 979 |
! |
980 |
||
981 |
viewStyleSetting |
|
982 |
|listOfStyles resourceDir dir box |
|
983 |
list listView infoLabel infoForwarder newStyle| |
|
984 |
||
985 |
" |
|
986 |
search resources directory for a list of .style files ... |
|
987 |
" |
|
988 |
||
989 |
resourceDir := Smalltalk getSystemFileName:'resources'. |
|
990 |
resourceDir isNil ifTrue:[ |
|
991 |
self warn:'no styles found (missing ''resources'' directory)'. |
|
992 |
^ self |
|
993 |
]. |
|
994 |
dir := FileDirectory directoryNamed:resourceDir. |
|
995 |
||
996 |
listOfStyles := dir select:[:aFileName | aFileName endsWith:'.style']. |
|
997 |
listOfStyles := listOfStyles collect:[:aFileName | aFileName copyWithoutLast:6]. |
|
998 |
listOfStyles sort. |
|
999 |
||
1000 |
"/ old code: used a standard ListSelectionBox |
|
1001 |
"/ changed to intercept selection and add info-output. |
|
1002 |
||
1003 |
"/ box := ListSelectionBox title:(resources string:'STYLE_MSG') withCRs. |
|
1004 |
"/ box label:(resources string:'Style selection'). |
|
1005 |
"/ box list:listOfStyles. |
|
1006 |
"/ box initialText:View defaultStyle. |
|
1007 |
"/ box selectAction:[:newStyle | |
|
1008 |
"/ ]. |
|
1009 |
"/ box action:[:newStyle | |
|
1010 |
"/ transcript topView withCursor:Cursor wait do:[ |
|
1011 |
"/ Transcript showCr:'change style to ' , newStyle , ' ...'. |
|
1012 |
"/ View defaultStyle:newStyle asSymbol. |
|
1013 |
"/ ] |
|
1014 |
"/ ]. |
|
1015 |
"/ box showAtPointer |
|
1016 |
||
1017 |
"/ new code: build box 'by 'hand' |
|
1018 |
"/ |
|
1019 |
infoForwarder := Plug new. |
|
1020 |
infoForwarder respondTo:#showInfo |
|
1021 |
with:[ |
|
1022 |
|nm sheet comment| |
|
1023 |
nm := list selection. |
|
1024 |
sheet := ViewStyle fromFile:(nm , '.style'). |
|
1025 |
comment := sheet at:#comment ifAbsent:''. |
|
1026 |
infoLabel label:comment withCRs asStringCollection |
|
1027 |
]. |
|
1028 |
||
1029 |
list := SelectionInList with:listOfStyles. |
|
1030 |
list onChangeSend:#showInfo to:infoForwarder. |
|
1031 |
||
1032 |
box := Dialog new. |
|
1033 |
box label:(resources string:'Style selection'). |
|
1034 |
||
1035 |
(box addTextLabel:(resources string:'STYLE_MSG') withCRs) borderWidth:0. |
|
1036 |
listView := SelectionInListView on:list. |
|
1037 |
listView doubleClickAction:[:sel | box accept value:true. box hide]. |
|
1038 |
listView height:200. |
|
1039 |
box addComponent:(ScrollableView forView:listView) tabable:true. |
|
1040 |
box addVerticalSpace. |
|
1041 |
||
227 | 1042 |
(infoLabel := box addTextLabel:'\\' withCRs) adjust:#centerLeft; borderWidth:0. |
219 | 1043 |
|
1044 |
box addAbortButton; addOkButton. |
|
1045 |
list selection:(View defaultStyle). |
|
1046 |
box extent:(box preferredExtent). |
|
1047 |
box minExtent:box extent. |
|
1048 |
box maxExtent:box extent. |
|
1049 |
||
1050 |
box showAtPointer. |
|
1051 |
||
1052 |
box accepted ifTrue:[ |
|
1053 |
newStyle := list selection. |
|
1054 |
newStyle notNil ifTrue:[ |
|
1055 |
self withWaitCursorDo:[ |
|
1056 |
Transcript showCr:'change style to ' , newStyle , ' ...'. |
|
1057 |
View defaultStyle:newStyle asSymbol. |
|
1058 |
]. |
|
1059 |
self reopenLauncher. |
|
1060 |
] |
|
238
523cc1f36b1d
release boxes - no Workspace button (its ugly)
Claus Gittinger <cg@exept.de>
parents:
233
diff
changeset
|
1061 |
]. |
523cc1f36b1d
release boxes - no Workspace button (its ugly)
Claus Gittinger <cg@exept.de>
parents:
233
diff
changeset
|
1062 |
box destroy |
219 | 1063 |
! ! |
1064 |
||
1065 |
!NewLauncher methodsFor:'actions - tools'! |
|
1066 |
||
1067 |
fullScreenHardcopy |
|
1068 |
"after a second (to allow redraw of views under menu ...), |
|
1069 |
save the contents of the whole screen." |
|
1070 |
||
1071 |
Processor addTimedBlock:[ |
|
1072 |
self saveScreenImage:(Image fromScreen) defaultName:'screen' |
|
1073 |
] afterSeconds:1 |
|
1074 |
! |
|
99 | 1075 |
|
219 | 1076 |
removeAllBreakAndTracePoints |
1077 |
MessageTracer cleanup |
|
1078 |
! |
|
1079 |
||
1080 |
screenHardcopy |
|
1081 |
"after a second (to allow redraw of views under menu ...), |
|
1082 |
let user specify a rectangular area on the screen |
|
1083 |
and save its contents." |
|
1084 |
||
1085 |
|area| |
|
1086 |
||
1087 |
Processor addTimedBlock:[ |
|
1088 |
area := Rectangle fromUser. |
|
1089 |
(area width > 0 and:[area height > 0]) ifTrue:[ |
|
1090 |
self saveScreenImage:(Image fromScreen:area) defaultName:'hardcopy' |
|
1091 |
] |
|
1092 |
] afterSeconds:1 |
|
1093 |
! |
|
1094 |
||
1095 |
startEventMonitor |
|
1096 |
EventMonitor open |
|
1097 |
! |
|
1098 |
||
1099 |
startFullWindowTreeView |
|
1100 |
WindowTreeView open |
|
1101 |
! |
|
1102 |
||
1103 |
startMemoryMonitor |
|
1104 |
MemoryMonitor open |
|
1105 |
! |
|
1106 |
||
1107 |
startMemoryUsageView |
|
1108 |
MemoryUsageView open |
|
1109 |
! |
|
1110 |
||
1111 |
startProcessMonitor |
|
1112 |
ProcessMonitor open |
|
1113 |
! |
|
1114 |
||
1115 |
startWindowTreeView |
|
1116 |
|v| |
|
1117 |
||
1118 |
v := self pickAView. |
|
1119 |
v notNil ifTrue:[ |
|
1120 |
WindowTreeView openOn:v topView |
|
1121 |
] |
|
1122 |
! |
|
1123 |
||
1124 |
viewDestroy |
|
1125 |
"let user pick a view and destroy it. |
|
1126 |
Even allow destroying non-smalltalk views |
|
1127 |
(also for views which I forgot due to some error)" |
|
1128 |
||
1129 |
|device p v id| |
|
1130 |
||
1131 |
(Delay forSeconds:1) wait. |
|
1132 |
||
1133 |
device := Screen current. |
|
1134 |
p := device pointFromUser. |
|
1135 |
id := device viewIdFromPoint:p. |
|
1136 |
v := device viewFromId:id. |
|
1137 |
v notNil ifTrue:[ |
|
1138 |
v topView destroy. |
|
1139 |
^ self |
|
1140 |
]. |
|
1141 |
id = device rootView id ifTrue:[ |
|
1142 |
^ self |
|
1143 |
]. |
|
1144 |
(Dialog confirm:'mhmh, this may not a be smalltalk view.\Destroy anyway ?' withCRs) |
|
1145 |
ifTrue:[ |
|
1146 |
device destroyView:nil withId:id |
|
1147 |
]. |
|
1148 |
||
1149 |
"Modified: 18.9.1995 / 23:13:32 / claus" |
|
1150 |
! |
|
1151 |
||
1152 |
viewHardcopy |
|
1153 |
"after a second (to allow redraw of views under menu ...), |
|
1154 |
let user specify a view and save its contents." |
|
1155 |
||
1156 |
Processor addTimedBlock:[ |
|
1157 |
|v| |
|
1158 |
||
1159 |
v := Screen current viewFromUser. |
|
1160 |
v notNil ifTrue:[ |
|
1161 |
self saveScreenImage:(Image fromView:(v topView)) defaultName:'hardcopy' |
|
1162 |
] |
|
1163 |
] afterSeconds:1 |
|
1164 |
! |
|
1165 |
||
1166 |
viewInspect |
|
1167 |
"let user pick a view and inspect it. Only smalltalk views are allowed" |
|
1168 |
||
1169 |
|v| |
|
1170 |
||
1171 |
v := self pickAView. |
|
1172 |
v notNil ifTrue:[ |
|
226 | 1173 |
"/ v topView inspect |
1174 |
v inspect |
|
219 | 1175 |
] |
1176 |
||
1177 |
! ! |
|
1178 |
||
1179 |
!NewLauncher methodsFor:'change & update'! |
|
1180 |
||
1181 |
update:something with:aParameter from:changedObject |
|
1182 |
((something == #currentProject) |
|
1183 |
or:[changedObject == Project]) ifTrue:[ |
|
1184 |
self changed:#info. |
|
1185 |
^ self |
|
1186 |
]. |
|
1187 |
! ! |
|
1188 |
||
1189 |
!NewLauncher methodsFor:'help'! |
|
1190 |
||
1191 |
helpTextFor:aComponent |
|
1192 |
|sel s| |
|
1193 |
||
1194 |
aComponent == transcript ifTrue:[ |
|
1195 |
s := 'TRANSCRIPT_HELP' |
|
1196 |
]. |
|
1197 |
||
1198 |
aComponent == infoView ifTrue:[ |
|
1199 |
s := 'INFOVIEW_HELP' |
|
1200 |
]. |
|
1201 |
||
1202 |
(buttonPanel subViews includes:aComponent) ifTrue:[ |
|
1203 |
"kludge: look for its change selector" |
|
1204 |
sel := aComponent changeMessage. |
|
1205 |
sel == #startSystemBrowser ifTrue:[ |
|
1206 |
s := 'SBROWSER_BUTTON_HELP' |
|
1207 |
]. |
|
1208 |
sel == #startFileBrowser ifTrue:[ |
|
1209 |
s := 'FBROWSER_BUTTON_HELP' |
|
1210 |
]. |
|
1211 |
sel == #startChangesBrowser ifTrue:[ |
|
1212 |
s := 'CBROWSER_BUTTON_HELP' |
|
1213 |
]. |
|
1214 |
]. |
|
1215 |
s notNil ifTrue:[ |
|
1216 |
^ resources string:s |
|
1217 |
]. |
|
1218 |
^ nil |
|
1219 |
! ! |
|
1220 |
||
1221 |
!NewLauncher methodsFor:'infoview update'! |
|
1222 |
||
1223 |
info |
|
1224 |
|project projectName projectDir packageName| |
|
1225 |
||
1226 |
(Project isNil or:[(project := Project current) isNil]) ifTrue:[ |
|
1227 |
projectName := '* none *'. |
|
1228 |
projectDir := '.'. |
|
1229 |
packageName := '* none *'. |
|
1230 |
] ifFalse:[ |
|
1231 |
projectName := project name. |
|
1232 |
projectDir := project directory. |
|
1233 |
packageName := project packageName. |
|
1234 |
]. |
|
1235 |
||
1236 |
^ resources |
|
1237 |
string:'project: ''%1'' fileOut to: ''%3'' package: ''%2''' |
|
1238 |
withArgs:(Array |
|
1239 |
with:projectName |
|
1240 |
with:packageName |
|
1241 |
with:(projectDir contractTo:30)) |
|
99 | 1242 |
! ! |
1243 |
||
93 | 1244 |
!NewLauncher methodsFor:'initialize / release'! |
86 | 1245 |
|
219 | 1246 |
addTopViewsToCurrentProject |
1247 |
"ignored here - the launcher is always global (i.e. not project private)." |
|
1248 |
||
1249 |
^ self |
|
1250 |
! |
|
1251 |
||
1252 |
buttonPanelSpec |
|
1253 |
"return a spec for the buttons in the panel; |
|
1254 |
entries consists of selector and bitmap-filename. |
|
1255 |
nil selectors are taken as separators (see setupButtonPanel)" |
|
98 | 1256 |
|
219 | 1257 |
^ #( |
238
523cc1f36b1d
release boxes - no Workspace button (its ugly)
Claus Gittinger <cg@exept.de>
parents:
233
diff
changeset
|
1258 |
#(startSystemBrowser 'SBrowser32x32.xbm') |
523cc1f36b1d
release boxes - no Workspace button (its ugly)
Claus Gittinger <cg@exept.de>
parents:
233
diff
changeset
|
1259 |
#(startFileBrowser 'FBrowser32x32.xbm') |
523cc1f36b1d
release boxes - no Workspace button (its ugly)
Claus Gittinger <cg@exept.de>
parents:
233
diff
changeset
|
1260 |
"/ #(startWorkspace 'Workspace32x32.xbm') |
523cc1f36b1d
release boxes - no Workspace button (its ugly)
Claus Gittinger <cg@exept.de>
parents:
233
diff
changeset
|
1261 |
#(nil nil) |
523cc1f36b1d
release boxes - no Workspace button (its ugly)
Claus Gittinger <cg@exept.de>
parents:
233
diff
changeset
|
1262 |
#(startChangesBrowser 'CBrowser32x32.xbm') |
219 | 1263 |
"/ #(nil nil) |
1264 |
"/ #(nil nil) |
|
1265 |
"/ #(startDocumentationTool 'book11.ico') |
|
1266 |
) |
|
230 | 1267 |
|
1268 |
"Created: 4.12.1995 / 20:16:18 / cg" |
|
219 | 1269 |
! |
1270 |
||
1271 |
closeRequest |
|
1272 |
(self confirm:(resources string:'really close %1 ?' with:self class name)) ifTrue:[ |
|
1273 |
super closeRequest |
|
1274 |
] |
|
1275 |
! |
|
1276 |
||
1277 |
focusSequence |
|
1278 |
^ (Array with:myMenu) |
|
1279 |
, |
|
1280 |
(buttonPanel subViews select:[:element | element isKindOf:Button]) |
|
1281 |
"/ , (Array with:Transcript) |
|
98 | 1282 |
! |
1283 |
||
93 | 1284 |
openInterface |
98 | 1285 |
"sent by my superclass to open up my interface" |
93 | 1286 |
|
1287 |
|top icn w| |
|
86 | 1288 |
|
1289 |
top := StandardSystemView new. |
|
205 | 1290 |
top label:'Smalltalk/X'; iconLabel:'ST/X Launcher'. |
86 | 1291 |
top extent:(400@300 ). |
1292 |
||
92 | 1293 |
" |
1294 |
temporary kludge for SGI; |
|
1295 |
this will be moved into StandardSystemView and be done |
|
1296 |
automatically soon ... |
|
1297 |
" |
|
106 | 1298 |
Screen current serverVendor = 'Silicon Graphics' ifTrue:[ |
93 | 1299 |
icn := self class aboutIcon. |
92 | 1300 |
icn notNil ifTrue:[ |
93 | 1301 |
icn := icn magnifiedTo:86@68. |
92 | 1302 |
w := View extent:86@68. "/ icn extent. |
1303 |
w viewBackground:icn. |
|
1304 |
top iconView:w |
|
1305 |
] |
|
1306 |
]. |
|
1307 |
||
93 | 1308 |
self setupViewsIn:top. |
98 | 1309 |
|
1310 |
top application:self. |
|
1311 |
builder window:top. |
|
86 | 1312 |
|
1313 |
" |
|
92 | 1314 |
open with higher prio to allow interaction even while things |
1315 |
are running ... |
|
86 | 1316 |
" |
92 | 1317 |
top openWithPriority:(Processor userSchedulingPriority + 1). |
93 | 1318 |
! |
86 | 1319 |
|
219 | 1320 |
release |
1321 |
infoProcess notNil ifTrue:[ |
|
1322 |
infoProcess terminate. |
|
1323 |
infoProcess := nil. |
|
1324 |
]. |
|
1325 |
super release |
|
86 | 1326 |
! |
1327 |
||
219 | 1328 |
restarted |
1329 |
"image restart - since WindowGroup recreates the process with |
|
1330 |
default prio, we have to raise the prio again. |
|
1331 |
Mhmh - this looks like a bug to me ..." |
|
86 | 1332 |
|
219 | 1333 |
Processor activeProcess priority:(Processor userSchedulingPriority + 1). |
1334 |
super restarted |
|
86 | 1335 |
! |
1336 |
||
219 | 1337 |
saveAndTerminate |
90 | 1338 |
" |
219 | 1339 |
some windowManagers can send this, to shutDown an application |
1340 |
but let it save its state before, for restart. We are already |
|
1341 |
prepared for this ;-)" |
|
86 | 1342 |
|
219 | 1343 |
self snapshot. |
1344 |
super saveAndTerminate |
|
103 | 1345 |
! |
1346 |
||
86 | 1347 |
setupButtonPanelIn:aTopView |
1348 |
"create the buttonPanel" |
|
1349 |
||
107 | 1350 |
|spc mh| |
86 | 1351 |
|
1352 |
spc := View viewSpacing // 2. |
|
1353 |
buttonPanel := HorizontalPanelView in:aTopView. |
|
1354 |
buttonPanel level:-1; borderWidth:0. |
|
1355 |
buttonPanel horizontalLayout:#leftSpace. |
|
1356 |
||
90 | 1357 |
self buttonPanelSpec do:[:entry | |
1358 |
|sel b sep| |
|
86 | 1359 |
|
90 | 1360 |
sel := entry at:1. |
1361 |
sel isNil ifTrue:[ |
|
1362 |
sep := View in:buttonPanel. |
|
1363 |
sep extent:32@1; borderWidth:0. |
|
1364 |
] ifFalse:[ |
|
1365 |
b := Button in:buttonPanel. |
|
1366 |
b form:(Image fromFile:(entry at:2)). |
|
100 | 1367 |
b model:self; changeMessage:sel |
90 | 1368 |
] |
86 | 1369 |
]. |
1370 |
||
100 | 1371 |
mh := myMenu height. |
1372 |
buttonPanel origin:0.0 @ (mh + spc) |
|
105 | 1373 |
corner:(1.0 @ (mh + spc + buttonPanel preferredExtent y)). |
86 | 1374 |
|
1375 |
buttonPanel leftInset:spc; rightInset:spc. |
|
1376 |
! |
|
1377 |
||
90 | 1378 |
setupDemoMenu |
1379 |
"setup the demo pulldown menu" |
|
1380 |
||
1381 |
|m| |
|
1382 |
||
1383 |
myMenu at:#demos |
|
1384 |
putLabels:(resources array:#( |
|
91 | 1385 |
'goodies' |
90 | 1386 |
'games' |
1387 |
'geometric designs' |
|
1388 |
'simple animations' |
|
1389 |
'3D graphics' |
|
1390 |
'graphic editors' |
|
1391 |
)) |
|
1392 |
selectors:#( |
|
91 | 1393 |
goodies |
90 | 1394 |
games |
1395 |
geometricDesigns |
|
1396 |
simpleAnimations |
|
1397 |
#'3Dgraphics' |
|
1398 |
#graphicEditors |
|
1399 |
) |
|
1400 |
receiver:self. |
|
1401 |
||
1402 |
" |
|
1403 |
only to show two different ways of defining a popUpMenu, |
|
1404 |
we use labels:selectors:receiver: here: |
|
1405 |
" |
|
1406 |
m := myMenu menuAt:#demos. |
|
1407 |
m subMenuAt:#games |
|
1408 |
put:(PopUpMenu |
|
1409 |
labels:(resources array:#( |
|
1410 |
'Tetris' |
|
1411 |
'Tic Tac Toe' |
|
142 | 1412 |
'Tic Tac Toe (2 players)' |
90 | 1413 |
)) |
1414 |
selectors:#( |
|
1415 |
startTetris |
|
1416 |
startTicTacToe |
|
142 | 1417 |
startTicTacToe2 |
90 | 1418 |
) |
1419 |
receiver:self). |
|
1420 |
||
1421 |
" |
|
1422 |
and labels:selector:args:receiver: here: |
|
1423 |
" |
|
1424 |
m subMenuAt:#geometricDesigns |
|
1425 |
put:(PopUpMenu |
|
1426 |
labels:(resources array:#( |
|
1427 |
'Pen demo' |
|
1428 |
'Commander demo' |
|
116 | 1429 |
'-' |
115 | 1430 |
'Fractal plants demo' |
116 | 1431 |
'Fractal patterns demo' |
90 | 1432 |
)) |
1433 |
selector:#openDemo: |
|
1434 |
args:#( |
|
1435 |
PenDemo |
|
1436 |
CommanderDemo |
|
116 | 1437 |
nil |
115 | 1438 |
FractalPlantsDemo |
116 | 1439 |
FractalPatternsDemo |
91 | 1440 |
) |
90 | 1441 |
receiver:self). |
1442 |
||
1443 |
m subMenuAt:#simpleAnimations |
|
1444 |
put:(PopUpMenu |
|
1445 |
labels:(resources array:#( |
|
1446 |
'Animation' |
|
1447 |
'Globe demo' |
|
1448 |
)) |
|
1449 |
selector:#openDemo: |
|
1450 |
args:#( |
|
1451 |
Animation |
|
1452 |
GlobeDemo |
|
91 | 1453 |
) |
90 | 1454 |
receiver:self). |
1455 |
||
1456 |
m subMenuAt:#'3Dgraphics' |
|
1457 |
put:(PopUpMenu |
|
1458 |
labels:(resources |
|
1459 |
array:#( |
|
1460 |
'plane' |
|
1461 |
'tetra' |
|
1462 |
'cube (wireframe)' |
|
1463 |
'cube (solid)' |
|
1464 |
'sphere (wireframe)' |
|
140 | 1465 |
'doughnut (wireframe)' |
90 | 1466 |
'planet' |
1467 |
'teapot' |
|
1468 |
'logo' |
|
108 | 1469 |
'x/y graph' |
140 | 1470 |
'-' |
1471 |
'cube (light)' |
|
1472 |
'cube (light & texture)' |
|
1473 |
'sphere (light)' |
|
190 | 1474 |
'colored octahedron' |
90 | 1475 |
)) |
1476 |
selector:#openDemo: |
|
1477 |
args:#( |
|
1478 |
GLPlaneDemoView2 |
|
1479 |
GLTetraDemoView |
|
1480 |
GLWireCubeDemoView |
|
1481 |
GLCubeDemoView |
|
1482 |
GLWireSphereDemoView |
|
140 | 1483 |
GLDoughnutDemoView |
90 | 1484 |
GLPlanetDemoView |
1485 |
GLTeapotDemo |
|
1486 |
Logo3DView1 |
|
108 | 1487 |
GLXYGraph |
140 | 1488 |
nil |
1489 |
GLCubeDemoView2 |
|
1490 |
GLBrickCubeDemoView |
|
1491 |
GLSphereDemoView2 |
|
1492 |
GLOctaHedronDemoView |
|
91 | 1493 |
) |
90 | 1494 |
receiver:self). |
1495 |
||
1496 |
m subMenuAt:#graphicEditors |
|
1497 |
put:(PopUpMenu |
|
1498 |
labels:(resources array:#( |
|
1499 |
'DrawTool' |
|
1500 |
'LogicTool' |
|
1501 |
)) |
|
1502 |
selector:#openDemo: |
|
1503 |
args:#( |
|
1504 |
DrawTool |
|
1505 |
LogicTool |
|
91 | 1506 |
) |
90 | 1507 |
receiver:self). |
1508 |
||
91 | 1509 |
m subMenuAt:#goodies |
1510 |
put:(PopUpMenu |
|
1511 |
labels:(resources array:#( |
|
1512 |
'clock' |
|
1513 |
'calendar' |
|
1514 |
'-' |
|
1515 |
'mail tool' |
|
1516 |
'news tool' |
|
1517 |
)) |
|
1518 |
selector:#openDemo: |
|
1519 |
args:#( |
|
1520 |
Clock |
|
1521 |
Calendar |
|
1522 |
nil |
|
1523 |
MailView |
|
1524 |
NewsView |
|
1525 |
) |
|
1526 |
receiver:self). |
|
90 | 1527 |
! |
1528 |
||
219 | 1529 |
setupInfoViewIn:topView |
1530 |
|spc halfSpc| |
|
1531 |
||
1532 |
spc := View viewSpacing. |
|
1533 |
infoView := Label label:'' in:topView. |
|
1534 |
infoView adjust:#left; borderWidth:0. |
|
1535 |
infoView level:-1. |
|
1536 |
transcript superView bottomInset:(infoView height + spc). |
|
90 | 1537 |
|
219 | 1538 |
infoView is3D ifTrue:[ |
1539 |
halfSpc := spc // 2. |
|
1540 |
] ifFalse:[ |
|
1541 |
halfSpc := 0 |
|
1542 |
]. |
|
1543 |
infoView topInset:(infoView height negated - spc + transcript borderWidth); |
|
1544 |
bottomInset:halfSpc; |
|
1545 |
leftInset:halfSpc; |
|
1546 |
rightInset:halfSpc. |
|
1547 |
infoView origin:0.0 @ 1.0 corner:1.0 @ 1.0. |
|
1548 |
infoView model:self; aspect:#info; labelMessage:#info. |
|
1549 |
||
1550 |
Project notNil ifTrue:[ |
|
1551 |
Project addDependent:self. |
|
1552 |
] |
|
1553 |
||
1554 |
" |
|
1555 |
NewLauncher open |
|
1556 |
" |
|
93 | 1557 |
! |
1558 |
||
219 | 1559 |
setupMenu |
1560 |
"setup the pulldown menu" |
|
1561 |
||
1562 |
|l s icon| |
|
1563 |
||
1564 |
myMenu labels:(resources array:#( |
|
1565 |
'about' |
|
1566 |
'file' |
|
1567 |
'classes' |
|
1568 |
'tools' |
|
1569 |
'projects' |
|
1570 |
'settings' |
|
1571 |
'demos' |
|
1572 |
'help')). |
|
1573 |
" |
|
1574 |
if there is a bitmap, change 'about' to the ST/X icon |
|
1575 |
" |
|
1576 |
icon := self class smallAboutIcon. |
|
1577 |
icon notNil ifTrue:[ |
|
1578 |
myMenu labels at:1 put:icon. |
|
1579 |
myMenu height:(myMenu height max:(icon height + (View viewSpacing * 2))) |
|
93 | 1580 |
]. |
219 | 1581 |
|
1582 |
myMenu selectors:#( |
|
1583 |
#about |
|
1584 |
#file |
|
1585 |
#classes |
|
1586 |
#tools |
|
1587 |
#projects |
|
1588 |
#settings |
|
1589 |
#demos |
|
1590 |
#help). |
|
1591 |
||
1592 |
myMenu at:#about |
|
1593 |
putLabels:(resources array:#( |
|
1594 |
'about Smalltalk/X ...' |
|
1595 |
)) |
|
1596 |
selectors:#( |
|
1597 |
#about |
|
1598 |
) |
|
1599 |
receiver:self. |
|
1600 |
||
1601 |
l := #( |
|
1602 |
'file browser' |
|
1603 |
'-' |
|
1604 |
'modules' |
|
1605 |
'-' |
|
1606 |
'snapshot' |
|
1607 |
'snapshot & exit' |
|
1608 |
'exit smalltalk' |
|
1609 |
). |
|
1610 |
s := #( |
|
1611 |
#startFileBrowser |
|
1612 |
nil |
|
1613 |
#objectModuleDialog |
|
1614 |
nil |
|
1615 |
#snapshot |
|
1616 |
#snapshotAndExit |
|
1617 |
#exit |
|
1618 |
). |
|
1619 |
||
1620 |
myMenu at:#file |
|
1621 |
putLabels:(resources array:l) |
|
1622 |
selectors:s |
|
1623 |
receiver:self. |
|
1624 |
||
1625 |
myMenu at:#classes |
|
1626 |
putLabels:(resources array:#( |
|
1627 |
'system browser' |
|
1628 |
'class browser' |
|
1629 |
'full class browser' |
|
1630 |
'class hierarchy browser' |
|
1631 |
'class tree' |
|
1632 |
'-' |
|
1633 |
'implementors' |
|
1634 |
'senders' |
|
1635 |
'-' |
|
1636 |
'change browser' |
|
1637 |
)) |
|
1638 |
selectors:#( |
|
1639 |
#startSystemBrowser |
|
1640 |
#startClassBrowser |
|
1641 |
#startFullClassBrowser |
|
1642 |
#startClassHierarchyBrowser |
|
1643 |
#startClassTreeView |
|
1644 |
nil |
|
1645 |
#browseImplementors |
|
1646 |
#browseSenders |
|
1647 |
nil |
|
1648 |
#startChangesBrowser |
|
1649 |
) |
|
1650 |
receiver:self. |
|
1651 |
||
1652 |
myMenu at:#projects |
|
1653 |
putLabels:(resources array:#( |
|
1654 |
'new project' |
|
1655 |
'-' |
|
1656 |
'select project ...' |
|
1657 |
)) |
|
1658 |
selectors:#( |
|
1659 |
#newProject |
|
1660 |
nil |
|
1661 |
#selectProject |
|
1662 |
) |
|
1663 |
receiver:self. |
|
1664 |
||
1665 |
myMenu at:#settings |
|
1666 |
putLabels:(resources array:#( |
|
1667 |
'language' |
|
1668 |
'show keyboard mappings' |
|
1669 |
'view style' |
|
1670 |
'messages' |
|
1671 |
'compilation' |
|
1672 |
'misc' |
|
1673 |
)) |
|
1674 |
selectors:#( |
|
1675 |
#languageSetting |
|
1676 |
#keyboardSetting |
|
1677 |
#viewStyleSetting |
|
1678 |
#messageSettings |
|
1679 |
#compilerSettings |
|
1680 |
#miscSettings |
|
1681 |
) |
|
1682 |
receiver:self. |
|
1683 |
||
1684 |
self setupToolsMenu. |
|
1685 |
self setupDemoMenu. |
|
1686 |
||
1687 |
ActiveHelp notNil ifTrue:[ |
|
1688 |
l := #( |
|
1689 |
'\c active help' |
|
1690 |
'ST/X documentation' |
|
1691 |
). |
|
1692 |
s := #( |
|
1693 |
#toggleActiveHelp: |
|
1694 |
#startDocumentationTool |
|
1695 |
) |
|
1696 |
] ifFalse:[ |
|
1697 |
l := #( |
|
1698 |
'ST/X documentation' |
|
1699 |
). |
|
1700 |
s := #( |
|
1701 |
#startDocumentationTool |
|
1702 |
) |
|
1703 |
]. |
|
1704 |
||
1705 |
myMenu at:#help |
|
1706 |
putLabels:(resources array:l) |
|
1707 |
selectors:s |
|
1708 |
receiver:self. |
|
1709 |
||
1710 |
(ActiveHelp notNil |
|
1711 |
and:[ActiveHelp isActive]) ifTrue:[ |
|
1712 |
(myMenu menuAt:#help) checkToggleAt:#toggleActiveHelp: put:true |
|
1713 |
]. |
|
93 | 1714 |
! |
1715 |
||
219 | 1716 |
setupOtherViewsIn:aTopView |
1717 |
"a hook - allows redefinition in your personal subclass. |
|
1718 |
For example, add a clock:" |
|
1719 |
||
1720 |
" |
|
1721 |
|sz clock space halfSpace| |
|
1722 |
||
1723 |
sz := buttonPanel innerHeight - (buttonPanel level abs*2). |
|
1724 |
space := View viewSpacing. |
|
1725 |
halfSpace := space // 2. |
|
93 | 1726 |
|
219 | 1727 |
buttonPanel rightInset:sz+(space * 2). |
93 | 1728 |
|
219 | 1729 |
clock := ClockView in:buttonPanel topView. |
1730 |
clock borderWidth:1. |
|
1731 |
clock showSeconds:false. |
|
1732 |
clock extent:(sz @ sz). |
|
1733 |
clock origin:(1.0 @ (buttonPanel origin y + halfSpace)). |
|
1734 |
clock leftInset:sz negated - 2 - halfSpace. |
|
1735 |
clock rightInset:halfSpace. |
|
1736 |
clock level:1. |
|
1737 |
" |
|
93 | 1738 |
! |
1739 |
||
1740 |
setupToolsMenu |
|
1741 |
"setup the tools pulldown menu" |
|
1742 |
||
1743 |
|m| |
|
1744 |
||
1745 |
myMenu at:#tools |
|
1746 |
putLabels:(resources array:#( |
|
1747 |
'workspace' |
|
1748 |
'-' |
|
1749 |
'monitors' |
|
1750 |
'-' |
|
1751 |
'view tree (all views)' |
|
1752 |
'view tree' |
|
1753 |
'inspect view' |
|
1754 |
'destroy view' |
|
1755 |
'-' |
|
1756 |
'hardcopy' |
|
120 | 1757 |
'-' |
1758 |
'misc' |
|
93 | 1759 |
)) |
1760 |
selectors:#( |
|
1761 |
#startWorkspace |
|
1762 |
nil |
|
1763 |
#monitors |
|
1764 |
nil |
|
1765 |
#startFullWindowTreeView |
|
1766 |
#startWindowTreeView |
|
1767 |
#viewInspect |
|
1768 |
#viewDestroy |
|
1769 |
nil |
|
1770 |
#hardcopy |
|
120 | 1771 |
nil |
1772 |
#misc |
|
93 | 1773 |
) |
1774 |
receiver:self. |
|
1775 |
||
1776 |
||
1777 |
m := myMenu menuAt:#tools. |
|
1778 |
m subMenuAt:#monitors |
|
1779 |
put:(PopUpMenu |
|
1780 |
labels:(resources array:#( |
|
1781 |
'process' |
|
1782 |
'memory' |
|
1783 |
'event' |
|
1784 |
'-' |
|
1785 |
'memory usage' |
|
1786 |
)) |
|
1787 |
selectors:#( |
|
1788 |
#startProcessMonitor |
|
1789 |
#startMemoryMonitor |
|
1790 |
#startEventMonitor |
|
1791 |
nil |
|
1792 |
#startMemoryUsageView |
|
1793 |
) |
|
1794 |
receiver:self). |
|
1795 |
||
120 | 1796 |
m subMenuAt:#misc |
1797 |
put:(PopUpMenu |
|
1798 |
labels:(resources array:#( |
|
1799 |
'remove all break/trace points' |
|
1800 |
)) |
|
1801 |
selectors:#( |
|
1802 |
#removeAllBreakAndTracePoints |
|
1803 |
) |
|
1804 |
receiver:self). |
|
1805 |
||
93 | 1806 |
m subMenuAt:#hardcopy |
1807 |
put:(PopUpMenu |
|
1808 |
labels:(resources array:#( |
|
1809 |
'screen' |
|
1810 |
'area' |
|
1811 |
'view' |
|
1812 |
)) |
|
1813 |
selectors:#( |
|
1814 |
#fullScreenHardcopy |
|
1815 |
#screenHardcopy |
|
1816 |
#viewHardcopy |
|
1817 |
) |
|
1818 |
receiver:self). |
|
1819 |
||
90 | 1820 |
! |
1821 |
||
219 | 1822 |
setupTranscriptIn:aView |
1823 |
|v| |
|
107 | 1824 |
|
219 | 1825 |
(Transcript notNil and:[Transcript ~~ Stderr]) ifTrue:[ |
1826 |
Transcript topView destroy. |
|
110 | 1827 |
]. |
1828 |
||
219 | 1829 |
v := HVScrollableView |
1830 |
for:TextCollector |
|
1831 |
miniScrollerH:true |
|
1832 |
miniScrollerV:false |
|
1833 |
in:aView. |
|
93 | 1834 |
|
219 | 1835 |
v origin:(0.0 @ (buttonPanel corner y + View viewSpacing)) |
1836 |
corner:(1.0 @ 1.0). |
|
1837 |
transcript := v scrolledView. |
|
1838 |
transcript beTranscript. |
|
94 | 1839 |
! |
1840 |
||
219 | 1841 |
setupViewsIn:topView |
1842 |
"create the pulldown menu, buttonPanel and transcript view" |
|
86 | 1843 |
|
219 | 1844 |
|tFont| |
131 | 1845 |
|
219 | 1846 |
topView model:self. |
86 | 1847 |
|
219 | 1848 |
myMenu := PullDownMenu in:topView. |
1849 |
myMenu origin:0.0 @ 0.0 corner:(1.0 @ myMenu height). |
|
86 | 1850 |
|
219 | 1851 |
self setupMenu. |
1852 |
self setupButtonPanelIn:topView. |
|
1853 |
self setupTranscriptIn:topView. |
|
1854 |
self setupInfoViewIn:topView. |
|
1855 |
self setupOtherViewsIn:topView. |
|
118 | 1856 |
|
219 | 1857 |
tFont := transcript font. |
1858 |
topView extent:(((tFont widthOf:'3')*60) max:myMenu preferredExtent x) |
|
1859 |
@ |
|
1860 |
((tFont height) * 20). |
|
118 | 1861 |
|
219 | 1862 |
" |
1863 |
NewLauncher open |
|
1864 |
" |
|
86 | 1865 |
! ! |
1866 |
||
1867 |
!NewLauncher methodsFor:'private'! |
|
1868 |
||
219 | 1869 |
pickAView |
1870 |
|v| |
|
1871 |
||
1872 |
(Delay forSeconds:1) wait. |
|
1873 |
v := Screen current viewFromUser. |
|
1874 |
v isNil ifTrue:[ |
|
1875 |
self warn:'sorry, this is not a smalltalk view'. |
|
1876 |
^ nil |
|
1877 |
]. |
|
1878 |
^ v |
|
1879 |
! |
|
1880 |
||
106 | 1881 |
reopenLauncher |
1882 |
"for now (since style & language settings currently do |
|
1883 |
not affect living views ...)" |
|
1884 |
||
1885 |
|contents| |
|
1886 |
||
1887 |
contents := Transcript endEntry; contents. |
|
1888 |
self class open. |
|
1889 |
Transcript contents:contents; hideCursor; scrollToBottom; cursorToEnd; showCursor |
|
1890 |
! |
|
1891 |
||
100 | 1892 |
saveAllViews |
86 | 1893 |
"tell each topview that we are going to terminate and give it chance |
1894 |
to save its contents." |
|
1895 |
||
1896 |
ObjectMemory changed:#aboutToExit |
|
1897 |
! |
|
1898 |
||
93 | 1899 |
saveScreenImage:anImage defaultName:defaultName |
1900 |
"save an image into a file |
|
1901 |
- ask user for filename using a fileSelectionBox." |
|
1902 |
||
1903 |
|fileName| |
|
1904 |
||
1905 |
fileName := Dialog |
|
1906 |
requestFileName:'save image in:' |
|
1907 |
default:(defaultName , '.tiff') |
|
1908 |
ok:'save' |
|
1909 |
abort:'abort' |
|
1910 |
pattern:'*.tiff'. |
|
1911 |
||
1912 |
fileName notNil ifTrue:[ |
|
1913 |
anImage saveOn:fileName |
|
1914 |
]. |
|
86 | 1915 |
! ! |
1916 |
||
219 | 1917 |
!NewLauncher methodsFor:'queries'! |
90 | 1918 |
|
219 | 1919 |
processName |
1920 |
"for monitors only - my name" |
|
142 | 1921 |
|
219 | 1922 |
^ 'ST/X Launcher' |
90 | 1923 |
! ! |
1924 |
||
219 | 1925 |
!NewLauncher class methodsFor:'documentation'! |
86 | 1926 |
|
219 | 1927 |
version |
245 | 1928 |
^ '$Header: /cvs/stx/stx/libtool/Launcher.st,v 1.63 1995-12-07 11:59:59 cg Exp $' |
86 | 1929 |
! ! |