author | Claus Gittinger <cg@exept.de> |
Thu, 30 Jul 1998 11:19:09 +0200 | |
changeset 1016 | 57892160f78e |
parent 1015 | ce491c3f9903 |
child 1018 | 7222534cb3dc |
permissions | -rw-r--r-- |
756 | 1 |
" |
784 | 2 |
COPYRIGHT (c) 1997 by eXept Software AG |
756 | 3 |
All Rights Reserved |
4 |
||
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
12 |
||
13 |
||
14 |
||
753 | 15 |
ApplicationModel subclass:#ToolApplicationModel |
782 | 16 |
instanceVariableNames:'timeBlock' |
753 | 17 |
classVariableNames:'' |
18 |
poolDictionaries:'' |
|
834 | 19 |
category:'Interface-Framework' |
753 | 20 |
! |
21 |
||
850 | 22 |
ToolApplicationModel class instanceVariableNames:'history clipboard settings showHelp' |
753 | 23 |
|
24 |
" |
|
25 |
The following class instance variables are inherited by this class: |
|
26 |
||
27 |
ApplicationModel - ClassResources |
|
28 |
Model - |
|
29 |
Object - |
|
30 |
" |
|
31 |
! |
|
32 |
||
33 |
!ToolApplicationModel class methodsFor:'documentation'! |
|
34 |
||
756 | 35 |
copyright |
36 |
" |
|
784 | 37 |
COPYRIGHT (c) 1997 by eXept Software AG |
756 | 38 |
All Rights Reserved |
39 |
||
40 |
This software is furnished under a license and may be used |
|
41 |
only in accordance with the terms of that license and with the |
|
42 |
inclusion of the above copyright notice. This software may not |
|
43 |
be provided or otherwise made available to, or used by, any |
|
44 |
other person. No title to or ownership of the software is |
|
45 |
hereby transferred. |
|
46 |
" |
|
47 |
||
48 |
||
49 |
! |
|
50 |
||
753 | 51 |
documentation |
52 |
" |
|
869 | 53 |
Framework class for tool applications. |
54 |
Provides hooks for history management, |
|
782 | 55 |
showing help texts, about menu, help menu etc. |
753 | 56 |
|
57 |
[author:] |
|
876 | 58 |
Thomas Zwick, eXept Software AG |
753 | 59 |
" |
60 |
! ! |
|
61 |
||
62 |
!ToolApplicationModel class methodsFor:'accessing'! |
|
63 |
||
800 | 64 |
authorLinesForAboutBox |
907 | 65 |
"extracts the author(s) from the documentation method." |
800 | 66 |
|
67 |
|firstClassWithDocumentation src s line lines| |
|
753 | 68 |
|
800 | 69 |
firstClassWithDocumentation := self class withAllSuperclasses detect:[:metacls| metacls implements:#documentation]. |
70 |
firstClassWithDocumentation notNil ifTrue:[ |
|
71 |
(firstClassWithDocumentation inheritsFrom:ToolApplicationModel class) ifTrue:[ |
|
72 |
src := (firstClassWithDocumentation compiledMethodAt:#documentation) source. |
|
73 |
src notNil ifTrue:[ |
|
74 |
s := src readStream. |
|
75 |
s upToAll:'[author:]'. |
|
76 |
s nextLine. "/ skip to end |
|
77 |
line := s nextLine. "/ line after [author:] |
|
78 |
lines := OrderedCollection new. |
|
79 |
[line notNil and:[line notEmpty]] whileTrue:[ |
|
80 |
line := line trimBlanks. |
|
81 |
line size > 1 ifTrue:[ |
|
82 |
lines add:line trimBlanks. |
|
83 |
line := s nextLine. |
|
84 |
] ifFalse:[ |
|
85 |
line := nil |
|
86 |
] |
|
87 |
]. |
|
88 |
^ lines. |
|
89 |
] |
|
90 |
] |
|
91 |
]. |
|
92 |
^ #('unnown') |
|
93 |
||
94 |
"Created: / 1.2.1998 / 15:41:43 / cg" |
|
95 |
"Modified: / 1.2.1998 / 15:59:10 / cg" |
|
753 | 96 |
! |
97 |
||
98 |
label |
|
907 | 99 |
"returns the label for the tools of this class; |
100 |
extracted from the class name; |
|
101 |
can be redefined in subclasses" |
|
753 | 102 |
|
103 |
|label| |
|
104 |
label := ''. |
|
105 |
self name do: |
|
106 |
[:c| |
|
107 |
c isUppercase ifTrue: [label := label, $ ]. |
|
108 |
label := label, c |
|
109 |
]. |
|
110 |
^label trimBlanks |
|
782 | 111 |
! |
112 |
||
850 | 113 |
settings |
907 | 114 |
"returns the settings dictionary" |
850 | 115 |
|
872 | 116 |
settings isNil ifTrue: [settings := IdentityDictionary new]. |
117 |
^settings |
|
850 | 118 |
! |
119 |
||
782 | 120 |
showHelp |
907 | 121 |
"returns whether the active help is turned on" |
782 | 122 |
|
872 | 123 |
showHelp isNil ifTrue: [showHelp := true]. |
124 |
^showHelp |
|
782 | 125 |
! |
126 |
||
127 |
showHelp: aBoolean |
|
907 | 128 |
"sets the active help on aBoolean" |
782 | 129 |
|
130 |
^showHelp := aBoolean |
|
753 | 131 |
! ! |
132 |
||
756 | 133 |
!ToolApplicationModel class methodsFor:'clipboard'! |
134 |
||
135 |
clipboard |
|
907 | 136 |
"returns the clipboard of this tool class" |
756 | 137 |
|
138 |
^clipboard |
|
139 |
! |
|
140 |
||
141 |
clipboard: anEditObject |
|
907 | 142 |
"sets the clipboard for this tool class" |
756 | 143 |
|
144 |
clipboard := anEditObject |
|
145 |
! ! |
|
146 |
||
762 | 147 |
!ToolApplicationModel class methodsFor:'help specs'! |
148 |
||
149 |
helpSpec |
|
869 | 150 |
"This resource specification was automatically generated |
151 |
by the UIHelpTool of ST/X." |
|
152 |
||
153 |
"Do not manually edit this!! If it is corrupted, |
|
154 |
the UIHelpTool may not be able to read the specification." |
|
762 | 155 |
|
156 |
" |
|
869 | 157 |
UIHelpTool openOnClass:ToolApplicationModel |
762 | 158 |
" |
159 |
||
869 | 160 |
<resource: #help> |
161 |
||
162 |
^super helpSpec addPairsFrom:#( |
|
762 | 163 |
|
823 | 164 |
#about |
834 | 165 |
'About functions.' |
823 | 166 |
|
762 | 167 |
#aboutSTX |
910 | 168 |
'Open an InfoBox showing details of the running ST/X.' |
762 | 169 |
|
170 |
#aboutThisAppliaction |
|
910 | 171 |
'Open an InfoBox about that applications release and its author.' |
762 | 172 |
|
823 | 173 |
#add |
834 | 174 |
'Add functions.' |
823 | 175 |
|
176 |
#commitCancel |
|
910 | 177 |
'Cancels changes.' |
823 | 178 |
|
179 |
#commitOK |
|
910 | 180 |
'Commit changes.' |
823 | 181 |
|
182 |
#edit |
|
834 | 183 |
'Edit functions.' |
823 | 184 |
|
185 |
#editCopy |
|
910 | 186 |
'Copy the selected item(s) to the clipboard.' |
762 | 187 |
|
782 | 188 |
#editCut |
910 | 189 |
'Move the selected item(s) to the clipboard.' |
853 | 190 |
|
191 |
#editDelete |
|
910 | 192 |
'Delete the selected item(s).' |
782 | 193 |
|
823 | 194 |
#editMoveDown |
910 | 195 |
'Moves the selected item one step down in the order list.' |
823 | 196 |
|
197 |
#editMoveIn |
|
834 | 198 |
'Moves the selected item into next item as child item.' |
823 | 199 |
|
200 |
#editMoveOut |
|
910 | 201 |
'Moves the selected item out of its parent item.' |
823 | 202 |
|
203 |
#editMoveUp |
|
910 | 204 |
'Moves the selected item one step up in the order list.' |
782 | 205 |
|
206 |
#editPaste |
|
910 | 207 |
'Paste from the clipboard.' |
782 | 208 |
|
209 |
#editUndo |
|
910 | 210 |
'Undo the last action.' |
782 | 211 |
|
823 | 212 |
#file |
834 | 213 |
'File functions.' |
805 | 214 |
|
823 | 215 |
#fileBrowseClass |
910 | 216 |
'Open a System Browser on the current class and selector.' |
805 | 217 |
|
823 | 218 |
#fileDefineClass |
910 | 219 |
'Open a dialog to define the current class.' |
805 | 220 |
|
221 |
#fileDefineClassAndSelector |
|
910 | 222 |
'Open a dialog to define the current class and selector.' |
805 | 223 |
|
823 | 224 |
#fileExit |
910 | 225 |
'Exit this application.' |
823 | 226 |
|
922 | 227 |
#generate |
228 |
'Code generation.' |
|
229 |
||
823 | 230 |
#help |
834 | 231 |
'Help functions.' |
823 | 232 |
|
876 | 233 |
#helpHelpTool |
910 | 234 |
'Open an HTML-Browser showing the Help Tools documentation.' |
876 | 235 |
|
823 | 236 |
#helpShowHelp |
910 | 237 |
'Toggle display of help texts.' |
823 | 238 |
|
239 |
#helpTutorial |
|
910 | 240 |
'Open an HTML-Browser showing this applications documentation.' |
823 | 241 |
|
242 |
#history |
|
834 | 243 |
'History functions.' |
803 | 244 |
|
245 |
#historyEmptyMenu |
|
1016 | 246 |
'Clear the history.' |
803 | 247 |
|
823 | 248 |
#historyMenuItem |
1016 | 249 |
'Switch to that item.' |
762 | 250 |
|
893 | 251 |
#settings |
252 |
'Settings functions.' |
|
253 |
||
823 | 254 |
#test |
834 | 255 |
'Test functions.' |
762 | 256 |
|
257 |
) |
|
1015 | 258 |
|
1016 | 259 |
"Modified: / 29.7.1998 / 22:29:16 / cg" |
762 | 260 |
! ! |
261 |
||
753 | 262 |
!ToolApplicationModel class methodsFor:'history'! |
263 |
||
264 |
getHistory |
|
907 | 265 |
"returns the history for this tool class" |
753 | 266 |
|
761
cc0404f8aec6
#getHistory changed because here #? doesn't work correctly
tz
parents:
760
diff
changeset
|
267 |
history isNil ifTrue: [history := OrderedCollection new]. |
cc0404f8aec6
#getHistory changed because here #? doesn't work correctly
tz
parents:
760
diff
changeset
|
268 |
^history |
753 | 269 |
|
270 |
! |
|
271 |
||
272 |
historyMaxSize |
|
907 | 273 |
"returns the maximum size for the history of this tool class" |
753 | 274 |
|
275 |
^10 |
|
276 |
||
277 |
! ! |
|
278 |
||
869 | 279 |
!ToolApplicationModel class methodsFor:'image specs'! |
280 |
||
281 |
desktopIcon |
|
907 | 282 |
"returns the icon used for the desktop" |
869 | 283 |
|
284 |
^Icon |
|
285 |
constantNamed:#'ToolApplicationModel desktopIcon' |
|
286 |
ifAbsentPut: |
|
287 |
[ |
|
288 |
|desktopIcon| |
|
990 | 289 |
desktopIcon := Icon stxIcon. |
869 | 290 |
desktopIcon magnifiedBy: Display preferredIconSize/desktopIcon extent |
291 |
] |
|
292 |
||
293 |
||
294 |
||
295 |
||
296 |
! |
|
297 |
||
298 |
menuIcon |
|
907 | 299 |
"returns the icon used for the menu bar" |
869 | 300 |
|
301 |
^Icon |
|
302 |
constantNamed:#'ToolApplicationModel menuIcon' |
|
303 |
ifAbsentPut: |
|
304 |
[ |
|
305 |
|menuIcon| |
|
990 | 306 |
menuIcon := Icon stxIcon. |
869 | 307 |
menuIcon magnifiedBy: MenuPanel defaultFont height/menuIcon height |
308 |
] |
|
987 | 309 |
! ! |
869 | 310 |
|
753 | 311 |
!ToolApplicationModel class methodsFor:'interface specs'! |
312 |
||
797 | 313 |
windowSpecForCommit |
869 | 314 |
"This resource specification was automatically generated |
315 |
by the UIPainter of ST/X." |
|
316 |
||
317 |
"Do not manually edit this!! If it is corrupted, |
|
318 |
the UIPainter may not be able to read the specification." |
|
319 |
||
320 |
" |
|
321 |
UIPainter new openOnClass:ToolApplicationModel andSelector:#windowSpecForCommit |
|
322 |
ToolApplicationModel new openInterface:#windowSpecForCommit |
|
323 |
" |
|
797 | 324 |
|
325 |
<resource: #canvas> |
|
326 |
||
327 |
^ |
|
859 | 328 |
|
797 | 329 |
#(#FullSpec |
859 | 330 |
#window: |
797 | 331 |
#(#WindowSpec |
859 | 332 |
#name: 'Commit Buttons' |
869 | 333 |
#layout: #(#LayoutFrame 344 0 371 0 643 0 430 0) |
859 | 334 |
#label: 'Commit Buttons' |
335 |
#min: #(#Point 100 22) |
|
336 |
#max: #(#Point 1152 900) |
|
869 | 337 |
#bounds: #(#Rectangle 344 371 644 431) |
859 | 338 |
#usePreferredExtent: false |
797 | 339 |
) |
859 | 340 |
#component: |
797 | 341 |
#(#SpecCollection |
859 | 342 |
#collection: |
797 | 343 |
#( |
344 |
#(#ActionButtonSpec |
|
859 | 345 |
#name: 'cancelButton' |
346 |
#layout: #(#LayoutFrame 5 0 0 0 -2 0.5 0 1) |
|
347 |
#activeHelpKey: #commitCancel |
|
348 |
#label: 'Cancel' |
|
927 | 349 |
#translateLabel: true |
859 | 350 |
#tabable: true |
351 |
#model: #cancel |
|
352 |
#enableChannel: #valueOfEnablingCommitButtons |
|
797 | 353 |
) |
354 |
#(#ActionButtonSpec |
|
859 | 355 |
#name: 'okButton' |
356 |
#layout: #(#LayoutFrame 2 0.5 0 0.0 -5 1 0 1.0) |
|
357 |
#activeHelpKey: #commitOK |
|
358 |
#label: 'OK' |
|
927 | 359 |
#translateLabel: true |
859 | 360 |
#tabable: true |
361 |
#model: #accept |
|
362 |
#enableChannel: #valueOfEnablingCommitButtons |
|
797 | 363 |
) |
364 |
) |
|
365 |
) |
|
366 |
) |
|
927 | 367 |
|
368 |
"Modified: / 20.5.1998 / 03:31:54 / cg" |
|
797 | 369 |
! |
370 |
||
371 |
windowSpecForCommitWithoutChannels |
|
869 | 372 |
"This resource specification was automatically generated |
373 |
by the UIPainter of ST/X." |
|
374 |
||
375 |
"Do not manually edit this!! If it is corrupted, |
|
376 |
the UIPainter may not be able to read the specification." |
|
377 |
||
378 |
" |
|
379 |
UIPainter new openOnClass:ToolApplicationModel andSelector:#windowSpecForCommitWithoutChannels |
|
380 |
ToolApplicationModel new openInterface:#windowSpecForCommitWithoutChannels |
|
381 |
" |
|
797 | 382 |
|
383 |
<resource: #canvas> |
|
384 |
||
385 |
^ |
|
859 | 386 |
|
797 | 387 |
#(#FullSpec |
859 | 388 |
#window: |
797 | 389 |
#(#WindowSpec |
859 | 390 |
#name: 'Commit Buttons Without Channels' |
869 | 391 |
#layout: #(#LayoutFrame 500 0 326 0 799 0 385 0) |
859 | 392 |
#label: 'Commit Buttons Without Channels' |
393 |
#min: #(#Point 100 22) |
|
394 |
#max: #(#Point 1152 900) |
|
869 | 395 |
#bounds: #(#Rectangle 500 326 800 386) |
859 | 396 |
#usePreferredExtent: false |
797 | 397 |
) |
859 | 398 |
#component: |
797 | 399 |
#(#SpecCollection |
859 | 400 |
#collection: |
797 | 401 |
#( |
402 |
#(#ActionButtonSpec |
|
859 | 403 |
#name: 'cancelButton' |
404 |
#layout: #(#LayoutFrame 5 0 0 0 -2 0.5 0 1) |
|
405 |
#activeHelpKey: #commitCancel |
|
406 |
#label: 'Cancel' |
|
927 | 407 |
#translateLabel: true |
859 | 408 |
#tabable: true |
409 |
#model: #cancel |
|
797 | 410 |
) |
411 |
#(#ActionButtonSpec |
|
859 | 412 |
#name: 'okButton' |
413 |
#layout: #(#LayoutFrame 2 0.5 0 0.0 -5 1 0 1.0) |
|
414 |
#activeHelpKey: #commitOK |
|
415 |
#label: 'OK' |
|
927 | 416 |
#translateLabel: true |
859 | 417 |
#tabable: true |
418 |
#model: #accept |
|
797 | 419 |
) |
420 |
) |
|
421 |
) |
|
422 |
) |
|
927 | 423 |
|
424 |
"Modified: / 20.5.1998 / 03:30:09 / cg" |
|
797 | 425 |
! |
426 |
||
427 |
windowSpecForInfoBar |
|
869 | 428 |
"This resource specification was automatically generated |
429 |
by the UIPainter of ST/X." |
|
430 |
||
431 |
"Do not manually edit this!! If it is corrupted, |
|
432 |
the UIPainter may not be able to read the specification." |
|
433 |
||
434 |
" |
|
435 |
UIPainter new openOnClass:ToolApplicationModel andSelector:#windowSpecForInfoBar |
|
436 |
ToolApplicationModel new openInterface:#windowSpecForInfoBar |
|
437 |
" |
|
797 | 438 |
|
439 |
<resource: #canvas> |
|
440 |
||
441 |
^ |
|
859 | 442 |
|
797 | 443 |
#(#FullSpec |
859 | 444 |
#window: |
797 | 445 |
#(#WindowSpec |
859 | 446 |
#name: 'Info Bar' |
869 | 447 |
#layout: #(#LayoutFrame 233 0 218 0 732 0 563 0) |
859 | 448 |
#label: 'Info Bar' |
449 |
#min: #(#Point 400 320) |
|
450 |
#max: #(#Point 1152 900) |
|
869 | 451 |
#bounds: #(#Rectangle 233 218 733 564) |
859 | 452 |
#menu: #menu |
453 |
#usePreferredExtent: false |
|
797 | 454 |
) |
859 | 455 |
#component: |
797 | 456 |
#(#SpecCollection |
859 | 457 |
#collection: |
797 | 458 |
#( |
820 | 459 |
#(#ViewSpec |
859 | 460 |
#name: 'view' |
461 |
#layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) |
|
462 |
#component: |
|
820 | 463 |
#(#SpecCollection |
859 | 464 |
#collection: |
820 | 465 |
#( |
466 |
#(#LabelSpec |
|
859 | 467 |
#name: 'infoLabel' |
468 |
#layout: #(#LayoutFrame 2 0.0 1 0.0 -1 1.0 -1 1.0) |
|
469 |
#labelChannel: #valueOfInfoLabel |
|
470 |
#level: -1 |
|
471 |
#adjust: #left |
|
869 | 472 |
#resizeForLabel: false |
820 | 473 |
) |
474 |
) |
|
475 |
) |
|
797 | 476 |
) |
477 |
) |
|
478 |
) |
|
479 |
) |
|
480 |
! |
|
481 |
||
482 |
windowSpecForInfoBarWithClock |
|
869 | 483 |
"This resource specification was automatically generated |
484 |
by the UIPainter of ST/X." |
|
485 |
||
486 |
"Do not manually edit this!! If it is corrupted, |
|
487 |
the UIPainter may not be able to read the specification." |
|
488 |
||
489 |
" |
|
490 |
UIPainter new openOnClass:ToolApplicationModel andSelector:#windowSpecForInfoBarWithClock |
|
491 |
ToolApplicationModel new openInterface:#windowSpecForInfoBarWithClock |
|
492 |
" |
|
797 | 493 |
|
494 |
<resource: #canvas> |
|
495 |
||
496 |
^ |
|
859 | 497 |
|
797 | 498 |
#(#FullSpec |
859 | 499 |
#window: |
797 | 500 |
#(#WindowSpec |
859 | 501 |
#name: 'Info Bar' |
872 | 502 |
#layout: #(#LayoutFrame 160 0 423 0 659 0 453 0) |
859 | 503 |
#label: 'Info Bar' |
504 |
#min: #(#Point 400 320) |
|
505 |
#max: #(#Point 1152 900) |
|
872 | 506 |
#bounds: #(#Rectangle 160 423 660 454) |
859 | 507 |
#menu: #menu |
508 |
#usePreferredExtent: false |
|
797 | 509 |
) |
859 | 510 |
#component: |
797 | 511 |
#(#SpecCollection |
859 | 512 |
#collection: |
797 | 513 |
#( |
820 | 514 |
#(#ViewSpec |
859 | 515 |
#name: 'view' |
516 |
#layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) |
|
517 |
#component: |
|
820 | 518 |
#(#SpecCollection |
859 | 519 |
#collection: |
820 | 520 |
#( |
521 |
#(#LabelSpec |
|
859 | 522 |
#name: 'infoLabel' |
523 |
#layout: #(#LayoutFrame 2 0 1 0.0 -81 1 -1 1.0) |
|
524 |
#labelChannel: #valueOfInfoLabel |
|
525 |
#level: -1 |
|
526 |
#adjust: #left |
|
872 | 527 |
#resizeForLabel: false |
820 | 528 |
) |
529 |
#(#LabelSpec |
|
859 | 530 |
#name: 'timeLabel' |
531 |
#layout: #(#LayoutFrame -79 1 1 0.0 -1 1.0 -1 1.0) |
|
532 |
#labelChannel: #valueOfTimeLabel |
|
533 |
#level: -1 |
|
534 |
#adjust: #right |
|
872 | 535 |
#resizeForLabel: false |
820 | 536 |
) |
537 |
) |
|
538 |
) |
|
797 | 539 |
) |
540 |
) |
|
541 |
) |
|
542 |
) |
|
543 |
! ! |
|
544 |
||
545 |
!ToolApplicationModel class methodsFor:'menu specs'! |
|
546 |
||
753 | 547 |
menuAbout |
869 | 548 |
"This resource specification was automatically generated |
549 |
by the MenuEditor of ST/X." |
|
550 |
||
551 |
"Do not manually edit this!! If it is corrupted, |
|
552 |
the MenuEditor may not be able to read the specification." |
|
553 |
||
554 |
" |
|
555 |
MenuEditor new openOnClass:ToolApplicationModel andSelector:#menuAbout |
|
556 |
(Menu new fromLiteralArrayEncoding:(ToolApplicationModel menuAbout)) startUp |
|
557 |
" |
|
753 | 558 |
|
559 |
<resource: #menu> |
|
560 |
||
561 |
^ |
|
859 | 562 |
|
753 | 563 |
#(#Menu |
564 |
||
565 |
#( |
|
566 |
#(#MenuItem |
|
859 | 567 |
#label: 'About Smalltalk/X...' |
568 |
#translateLabel: true |
|
569 |
#value: #openAbout |
|
570 |
#activeHelpKey: #aboutSTX |
|
753 | 571 |
) |
572 |
#(#MenuItem |
|
859 | 573 |
#label: '-' |
753 | 574 |
) |
575 |
#(#MenuItem |
|
922 | 576 |
#label: 'About this Application...' |
859 | 577 |
#translateLabel: true |
578 |
#value: #openAboutThisApplication |
|
579 |
#activeHelpKey: #aboutThisAppliaction |
|
753 | 580 |
) |
581 |
) nil |
|
582 |
nil |
|
583 |
) |
|
922 | 584 |
|
585 |
"Modified: / 19.5.1998 / 21:44:09 / cg" |
|
753 | 586 |
! |
587 |
||
869 | 588 |
menuFont |
589 |
"This resource specification was automatically generated |
|
590 |
by the MenuEditor of ST/X." |
|
591 |
||
592 |
"Do not manually edit this!! If it is corrupted, |
|
593 |
the MenuEditor may not be able to read the specification." |
|
594 |
||
595 |
" |
|
596 |
MenuEditor new openOnClass:ToolApplicationModel andSelector:#menuFont |
|
597 |
(Menu new fromLiteralArrayEncoding:(ToolApplicationModel menuFont)) startUp |
|
598 |
" |
|
599 |
||
600 |
<resource: #menu> |
|
601 |
||
602 |
^ |
|
603 |
||
604 |
#(#Menu |
|
605 |
||
606 |
#( |
|
607 |
#(#MenuItem |
|
872 | 608 |
#label: 'Label...' |
869 | 609 |
#value: #chooseFont: |
610 |
#argument: 'Label Font' |
|
611 |
) |
|
612 |
#(#MenuItem |
|
872 | 613 |
#label: 'Button...' |
869 | 614 |
#value: #chooseFont: |
615 |
#argument: 'Button Font' |
|
616 |
) |
|
617 |
#(#MenuItem |
|
872 | 618 |
#label: 'Edit...' |
869 | 619 |
#value: #chooseFont: |
620 |
#argument: 'Edit Font' |
|
621 |
) |
|
622 |
#(#MenuItem |
|
872 | 623 |
#label: 'List...' |
869 | 624 |
#value: #chooseFont: |
625 |
#argument: 'List Font' |
|
626 |
) |
|
627 |
#(#MenuItem |
|
872 | 628 |
#label: 'Tree List...' |
869 | 629 |
#value: #chooseFont: |
630 |
#argument: 'Tree List Font' |
|
631 |
) |
|
632 |
#(#MenuItem |
|
872 | 633 |
#label: 'Note Book...' |
634 |
#value: #chooseFont: |
|
635 |
#argument: 'Note Book Font' |
|
636 |
) |
|
637 |
#(#MenuItem |
|
638 |
#label: 'Framed Box...' |
|
639 |
#value: #chooseFont: |
|
640 |
#argument: 'Framed Box Font' |
|
641 |
) |
|
642 |
#(#MenuItem |
|
869 | 643 |
#label: '-' |
644 |
) |
|
645 |
#(#MenuItem |
|
872 | 646 |
#label: 'Reset' |
869 | 647 |
#value: #resetFonts |
648 |
) |
|
649 |
) nil |
|
650 |
nil |
|
651 |
) |
|
652 |
! |
|
653 |
||
753 | 654 |
menuHelp |
869 | 655 |
"This resource specification was automatically generated |
656 |
by the MenuEditor of ST/X." |
|
657 |
||
658 |
"Do not manually edit this!! If it is corrupted, |
|
659 |
the MenuEditor may not be able to read the specification." |
|
660 |
||
661 |
" |
|
662 |
MenuEditor new openOnClass:ToolApplicationModel andSelector:#menuHelp |
|
663 |
(Menu new fromLiteralArrayEncoding:(ToolApplicationModel menuHelp)) startUp |
|
664 |
" |
|
753 | 665 |
|
666 |
<resource: #menu> |
|
667 |
||
668 |
^ |
|
859 | 669 |
|
753 | 670 |
#(#Menu |
671 |
||
672 |
#( |
|
673 |
#(#MenuItem |
|
876 | 674 |
#label: 'Documentation' |
859 | 675 |
#translateLabel: true |
676 |
#value: #openDocumentation |
|
677 |
#activeHelpKey: #helpTutorial |
|
907 | 678 |
#enabled: #valueOfHavingDocumentation |
753 | 679 |
) |
680 |
#(#MenuItem |
|
859 | 681 |
#label: '-' |
753 | 682 |
) |
683 |
#(#MenuItem |
|
859 | 684 |
#label: 'Show Help Texts' |
685 |
#translateLabel: true |
|
686 |
#activeHelpKey: #helpShowHelp |
|
687 |
#indication: #showHelp: |
|
753 | 688 |
) |
689 |
) nil |
|
690 |
nil |
|
691 |
) |
|
692 |
! ! |
|
693 |
||
907 | 694 |
!ToolApplicationModel class methodsFor:'queries'! |
695 |
||
987 | 696 |
getAllImageSelectorsFrom: aClass |
697 |
"returns all image selectors implementing an image spec in class aClass" |
|
698 |
||
699 |
|iconClass| |
|
700 |
||
701 |
aClass isSymbol |
|
702 |
ifTrue: [iconClass := Smalltalk at: aClass] |
|
703 |
ifFalse: [iconClass := aClass]. |
|
704 |
||
705 |
^((iconClass class methodDictionary values select: [:m| m category = 'image specs']) |
|
706 |
collect: [:m| m selector]) asSortedCollection asOrderedCollection |
|
707 |
||
708 |
! |
|
709 |
||
907 | 710 |
isVisualStartable |
711 |
"returns whether this application class can be started via #open" |
|
712 |
||
713 |
self == ToolApplicationModel ifTrue:[^false]. |
|
714 |
^super isVisualStartable |
|
715 |
||
716 |
! ! |
|
717 |
||
782 | 718 |
!ToolApplicationModel class methodsFor:'startup / release'! |
753 | 719 |
|
782 | 720 |
preSnapshot |
907 | 721 |
"removes the clipboard before snap shoting" |
753 | 722 |
|
782 | 723 |
clipboard := nil |
753 | 724 |
! |
725 |
||
782 | 726 |
uninitialize |
907 | 727 |
"resets the class instance variables" |
760 | 728 |
|
869 | 729 |
settings := showHelp := history := clipboard := nil |
753 | 730 |
! ! |
731 |
||
782 | 732 |
!ToolApplicationModel methodsFor:'aspects'! |
733 |
||
822 | 734 |
valueOfCanCopy |
907 | 735 |
"returns whether can copy as value holder" |
822 | 736 |
|
936 | 737 |
^ builder booleanValueAspectFor:#valueOfCanCopy |
822 | 738 |
|
936 | 739 |
"Modified: / 21.5.1998 / 03:39:05 / cg" |
822 | 740 |
! |
741 |
||
742 |
valueOfCanCut |
|
907 | 743 |
"returns whether can paste as value holder" |
822 | 744 |
|
936 | 745 |
^ builder booleanValueAspectFor:#valueOfCanCut |
822 | 746 |
|
936 | 747 |
"Modified: / 21.5.1998 / 03:39:13 / cg" |
822 | 748 |
! |
749 |
||
750 |
valueOfCanPaste |
|
907 | 751 |
"returns whether can paste as value holder" |
822 | 752 |
|
936 | 753 |
^ builder booleanValueAspectFor:#valueOfCanPaste |
822 | 754 |
|
936 | 755 |
"Modified: / 21.5.1998 / 03:39:22 / cg" |
822 | 756 |
! |
757 |
||
758 |
valueOfCanUndo |
|
907 | 759 |
"returns whether can undo as value holder" |
822 | 760 |
|
936 | 761 |
^ builder booleanValueAspectFor:#valueOfCanUndo |
822 | 762 |
|
936 | 763 |
"Modified: / 21.5.1998 / 03:39:31 / cg" |
822 | 764 |
! |
765 |
||
782 | 766 |
valueOfEnablingCommitButtons |
907 | 767 |
"returns the enabling of the commit of this tool as value holder" |
753 | 768 |
|
936 | 769 |
^ builder booleanValueAspectFor:#valueOfEnablingCommitButtons |
753 | 770 |
|
936 | 771 |
"Modified: / 21.5.1998 / 03:39:49 / cg" |
782 | 772 |
! |
773 |
||
858 | 774 |
valueOfHavingDocumentation |
1004 | 775 |
"returns the enabling of having documentation for this tool as value holder" |
803 | 776 |
|
1004 | 777 |
^ (builder booleanValueAspectFor:#valueOfEnablingCommitButtons) value: (self class implements: #openDocumentation) |
803 | 778 |
! |
779 |
||
782 | 780 |
valueOfInfoLabel |
907 | 781 |
"returns the info label as value holder" |
782 | 782 |
|
936 | 783 |
^ builder nilValueAspectFor:#valueOfInfoLabel |
753 | 784 |
|
936 | 785 |
"Modified: / 21.5.1998 / 03:40:34 / cg" |
782 | 786 |
! |
787 |
||
788 |
valueOfTimeLabel |
|
907 | 789 |
"returns the time label as value holder" |
753 | 790 |
|
936 | 791 |
^ builder nilValueAspectFor:#valueOfTimeLabel |
753 | 792 |
|
936 | 793 |
"Modified: / 21.5.1998 / 03:40:42 / cg" |
753 | 794 |
! ! |
795 |
||
782 | 796 |
!ToolApplicationModel methodsFor:'clipboard'! |
753 | 797 |
|
838 | 798 |
clipboard |
907 | 799 |
"returns the clipboard" |
838 | 800 |
|
801 |
^self class clipboard |
|
802 |
! |
|
803 |
||
782 | 804 |
clipboard: anEditObject |
907 | 805 |
"sets the clipboard and the value holder for can pasting" |
753 | 806 |
|
782 | 807 |
self class clipboard: anEditObject. |
753 | 808 |
|
869 | 809 |
self valueOfCanPaste value: anEditObject notNil |
782 | 810 |
! ! |
811 |
||
1006
786de97d72f9
allow redefinition of the about-boxes image.
Claus Gittinger <cg@exept.de>
parents:
1004
diff
changeset
|
812 |
!ToolApplicationModel methodsFor:'defaults'! |
786de97d72f9
allow redefinition of the about-boxes image.
Claus Gittinger <cg@exept.de>
parents:
1004
diff
changeset
|
813 |
|
786de97d72f9
allow redefinition of the about-boxes image.
Claus Gittinger <cg@exept.de>
parents:
1004
diff
changeset
|
814 |
aboutImage |
786de97d72f9
allow redefinition of the about-boxes image.
Claus Gittinger <cg@exept.de>
parents:
1004
diff
changeset
|
815 |
"the image to be displayed in my about-box; |
786de97d72f9
allow redefinition of the about-boxes image.
Claus Gittinger <cg@exept.de>
parents:
1004
diff
changeset
|
816 |
If nil is returned, thhe ST/X default image is used." |
786de97d72f9
allow redefinition of the about-boxes image.
Claus Gittinger <cg@exept.de>
parents:
1004
diff
changeset
|
817 |
|
786de97d72f9
allow redefinition of the about-boxes image.
Claus Gittinger <cg@exept.de>
parents:
1004
diff
changeset
|
818 |
^ nil |
786de97d72f9
allow redefinition of the about-boxes image.
Claus Gittinger <cg@exept.de>
parents:
1004
diff
changeset
|
819 |
|
786de97d72f9
allow redefinition of the about-boxes image.
Claus Gittinger <cg@exept.de>
parents:
1004
diff
changeset
|
820 |
"Created: / 25.7.1998 / 20:33:50 / cg" |
786de97d72f9
allow redefinition of the about-boxes image.
Claus Gittinger <cg@exept.de>
parents:
1004
diff
changeset
|
821 |
! ! |
786de97d72f9
allow redefinition of the about-boxes image.
Claus Gittinger <cg@exept.de>
parents:
1004
diff
changeset
|
822 |
|
782 | 823 |
!ToolApplicationModel methodsFor:'help'! |
753 | 824 |
|
762 | 825 |
defaultInfoLabel |
907 | 826 |
"returns the default info label; here an empty string" |
762 | 827 |
|
828 |
^'' |
|
829 |
! |
|
830 |
||
984 | 831 |
doShowHelp:aHelpText |
832 |
"displays aHelpText in the info label or if present detours it to its masterApplication" |
|
833 |
||
834 |
aHelpText isNil |
|
835 |
ifTrue: [self updateInfoLabel] |
|
836 |
ifFalse: [self valueOfInfoLabel value: (aHelpText asString printString readStream through: $.)]. |
|
837 |
||
838 |
"Created: / 20.6.1998 / 16:37:23 / cg" |
|
839 |
! |
|
840 |
||
753 | 841 |
openAbout |
907 | 842 |
"opens an about box" |
753 | 843 |
|
844 |
|box| |
|
845 |
||
846 |
box := AboutBox new. |
|
847 |
box autoHideAfter:10 with:[]. |
|
848 |
box showAtCenter |
|
849 |
||
1006
786de97d72f9
allow redefinition of the about-boxes image.
Claus Gittinger <cg@exept.de>
parents:
1004
diff
changeset
|
850 |
"Modified: / 25.7.1998 / 20:36:46 / cg" |
753 | 851 |
! |
852 |
||
853 |
openAboutThisApplication |
|
907 | 854 |
"opens an about this application box" |
753 | 855 |
|
1006
786de97d72f9
allow redefinition of the about-boxes image.
Claus Gittinger <cg@exept.de>
parents:
1004
diff
changeset
|
856 |
|rev box myClass clsRev image| |
936 | 857 |
|
753 | 858 |
rev := ''. |
936 | 859 |
myClass := self class. |
860 |
||
861 |
(clsRev := myClass revision) notNil ifTrue: [rev := ' (rev: ', clsRev printString, ')']. |
|
753 | 862 |
box := AboutBox title: |
800 | 863 |
'\The application\\' withCRs |
936 | 864 |
, myClass name asBoldText, rev |
850 | 865 |
, '\\has been designed and implemented by: \' withCRs |
866 |
, ((self class authorLinesForAboutBox collect:[:l | '- ' , l]) asStringWith:$\) withCRs |
|
800 | 867 |
, '\\' withCRs. |
753 | 868 |
|
1006
786de97d72f9
allow redefinition of the about-boxes image.
Claus Gittinger <cg@exept.de>
parents:
1004
diff
changeset
|
869 |
image := self aboutImage. |
786de97d72f9
allow redefinition of the about-boxes image.
Claus Gittinger <cg@exept.de>
parents:
1004
diff
changeset
|
870 |
image notNil ifTrue:[ |
786de97d72f9
allow redefinition of the about-boxes image.
Claus Gittinger <cg@exept.de>
parents:
1004
diff
changeset
|
871 |
box image:image |
786de97d72f9
allow redefinition of the about-boxes image.
Claus Gittinger <cg@exept.de>
parents:
1004
diff
changeset
|
872 |
]. |
786de97d72f9
allow redefinition of the about-boxes image.
Claus Gittinger <cg@exept.de>
parents:
1004
diff
changeset
|
873 |
box label:'About This Application'. |
786de97d72f9
allow redefinition of the about-boxes image.
Claus Gittinger <cg@exept.de>
parents:
1004
diff
changeset
|
874 |
box autoHideAfter:10 with:[]. |
786de97d72f9
allow redefinition of the about-boxes image.
Claus Gittinger <cg@exept.de>
parents:
1004
diff
changeset
|
875 |
box showAtCenter. |
936 | 876 |
|
1006
786de97d72f9
allow redefinition of the about-boxes image.
Claus Gittinger <cg@exept.de>
parents:
1004
diff
changeset
|
877 |
"Modified: / 25.7.1998 / 20:37:18 / cg" |
753 | 878 |
! |
879 |
||
858 | 880 |
openHTMLDocument: aHTMLFilename |
907 | 881 |
"opens a HTML browser on aHTMLFilename" |
858 | 882 |
|
883 |
HTMLDocumentView openFullOnDocumentationFile: aHTMLFilename |
|
884 |
! |
|
885 |
||
782 | 886 |
showHelp |
907 | 887 |
"returns whether showing help is turned on/off" |
782 | 888 |
|
783 | 889 |
|currentActiveHelp| |
858 | 890 |
|
783 | 891 |
currentActiveHelp := ActiveHelp currentHelpListener. |
892 |
||
893 |
^self class showHelp |
|
858 | 894 |
and: [currentActiveHelp notNil and: [masterApplication notNil |
895 |
ifFalse: [currentActiveHelp interestedIn: self window] |
|
896 |
ifTrue: [currentActiveHelp interestedIn: masterApplication window]]] |
|
782 | 897 |
! |
898 |
||
899 |
showHelp: aValue |
|
907 | 900 |
"toggles showing help" |
782 | 901 |
|
902 |
(self class showHelp: aValue) |
|
903 |
ifTrue: [ActiveHelp startFor: self] |
|
822 | 904 |
ifFalse: [ActiveHelp stopFor: self. self updateInfoLabel] |
782 | 905 |
! |
906 |
||
762 | 907 |
showHelp:aHelpText for:view |
984 | 908 |
"displays aHelpText in the info label or if present detours it to its masterApplication. |
909 |
Here, an event is pushed for myself to synchronize the helpDisplay |
|
910 |
with event handling." |
|
911 |
||
912 |
|wg mySensor| |
|
762 | 913 |
|
782 | 914 |
self showHelp ifFalse: [^true]. |
876 | 915 |
masterApplication notNil ifTrue: [masterApplication showHelp: aHelpText for:view]. |
984 | 916 |
|
917 |
"/ OLD: show it right here ... |
|
918 |
"/ aHelpText isNil |
|
919 |
"/ ifTrue: [self updateInfoLabel] |
|
920 |
"/ ifFalse: [self valueOfInfoLabel value: (aHelpText asString printString readStream through: $.)]. |
|
921 |
"/ the nil-tests should not be req'd - but thats a last-minute |
|
922 |
"/ change and I dont want to breaks the delivery ... |
|
923 |
||
924 |
"/ NEW: push it into the event queue, to have it displayed |
|
925 |
"/ syncronously with other events. |
|
926 |
"/ (also any errors are reported as occurring in my context; |
|
927 |
"/ instead of occurring in the activeHelp context). |
|
928 |
||
929 |
(wg := self windowGroup) notNil ifTrue:[ |
|
930 |
mySensor := wg sensor. |
|
931 |
mySensor notNil ifTrue:[ |
|
932 |
mySensor flushEventsFor:self withType:#doShowHelp:. |
|
933 |
mySensor pushUserEvent:#doShowHelp: for:self withArguments:(Array with:aHelpText). |
|
934 |
]. |
|
935 |
]. |
|
936 |
||
876 | 937 |
^true |
984 | 938 |
|
939 |
"Modified: / 20.6.1998 / 16:47:37 / cg" |
|
822 | 940 |
! |
941 |
||
942 |
updateInfoLabel |
|
907 | 943 |
"updates the info label at the bottom" |
822 | 944 |
|
945 |
self valueOfInfoLabel value: self defaultInfoLabel |
|
762 | 946 |
! ! |
947 |
||
753 | 948 |
!ToolApplicationModel methodsFor:'history'! |
949 |
||
950 |
addToHistory: aHistoryEntry |
|
907 | 951 |
"adds aHistoryEntry (format: loadMessage -> evalString) at the top of the history, |
952 |
and checks for maximum size of the history" |
|
753 | 953 |
|
782 | 954 |
aHistoryEntry key size = 0 ifTrue: [^nil]. |
753 | 955 |
self history remove: (self history detect: [:histEntry| histEntry key = aHistoryEntry key] ifNone: nil) ifAbsent: nil. |
956 |
self history addFirst: aHistoryEntry. |
|
957 |
[self history size > self class historyMaxSize] whileTrue: [self history removeLast] |
|
958 |
! |
|
959 |
||
960 |
emptyHistory |
|
907 | 961 |
"removes all history entries" |
753 | 962 |
|
963 |
^self history removeAll |
|
964 |
! |
|
965 |
||
966 |
history |
|
907 | 967 |
"returns the history from tool class" |
753 | 968 |
|
969 |
^self class getHistory |
|
970 |
! |
|
971 |
||
844 | 972 |
historyEntries |
907 | 973 |
"returns the history entries, i.e. the evaluatable values containing the information" |
844 | 974 |
|
975 |
^self history collect: [:asso| asso key] |
|
976 |
! |
|
977 |
||
753 | 978 |
menuHistory |
907 | 979 |
"returns a history submenu" |
753 | 980 |
|
893 | 981 |
|menu| |
920
6b72e4ce4406
must find gui resources (xlations in in history menu)
Claus Gittinger <cg@exept.de>
parents:
910
diff
changeset
|
982 |
|
753 | 983 |
menu := Menu new receiver: self. |
984 |
(self history collect: [:histEntry| histEntry value]) asSet asOrderedCollection do: |
|
985 |
[:historyEntryType| |
|
1013 | 986 |
menu addItemGroup: |
987 |
((self history |
|
988 |
select: [:histEntry| |
|
989 |
histEntry value = historyEntryType]) |
|
990 |
collect: [:histEntry| |
|
991 |
MenuItem new |
|
992 |
label: histEntry key printString; |
|
993 |
value: histEntry value; |
|
994 |
argument: histEntry key; |
|
995 |
activeHelpKey: #historyMenuItem]). |
|
753 | 996 |
]. |
997 |
||
920
6b72e4ce4406
must find gui resources (xlations in in history menu)
Claus Gittinger <cg@exept.de>
parents:
910
diff
changeset
|
998 |
menu addItem: (MenuItem new |
6b72e4ce4406
must find gui resources (xlations in in history menu)
Claus Gittinger <cg@exept.de>
parents:
910
diff
changeset
|
999 |
label: 'Empty History'; |
6b72e4ce4406
must find gui resources (xlations in in history menu)
Claus Gittinger <cg@exept.de>
parents:
910
diff
changeset
|
1000 |
value: #emptyHistory; |
6b72e4ce4406
must find gui resources (xlations in in history menu)
Claus Gittinger <cg@exept.de>
parents:
910
diff
changeset
|
1001 |
activeHelpKey: #historyEmptyMenu; |
6b72e4ce4406
must find gui resources (xlations in in history menu)
Claus Gittinger <cg@exept.de>
parents:
910
diff
changeset
|
1002 |
translateLabel:true). |
6b72e4ce4406
must find gui resources (xlations in in history menu)
Claus Gittinger <cg@exept.de>
parents:
910
diff
changeset
|
1003 |
|
6b72e4ce4406
must find gui resources (xlations in in history menu)
Claus Gittinger <cg@exept.de>
parents:
910
diff
changeset
|
1004 |
menu findGuiResourcesIn:self. |
753 | 1005 |
^menu |
920
6b72e4ce4406
must find gui resources (xlations in in history menu)
Claus Gittinger <cg@exept.de>
parents:
910
diff
changeset
|
1006 |
|
1013 | 1007 |
"Modified: / 29.7.1998 / 11:40:11 / cg" |
753 | 1008 |
! |
1009 |
||
1010 |
removeFromHistory: aHistoryEntry |
|
907 | 1011 |
"removes aHistoryEntry from the history" |
753 | 1012 |
|
1013 |
self history remove: (self history detect: [:histEntry| histEntry key = aHistoryEntry key] ifNone: nil) ifAbsent: nil. |
|
1014 |
[self history size > self class historyMaxSize] whileTrue: [self history removeLast] |
|
1015 |
! ! |
|
1016 |
||
982
807f440e0df7
bw. compatibility - needs builder early.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
1017 |
!ToolApplicationModel methodsFor:'initialization'! |
807f440e0df7
bw. compatibility - needs builder early.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
1018 |
|
807f440e0df7
bw. compatibility - needs builder early.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
1019 |
initialize |
807f440e0df7
bw. compatibility - needs builder early.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
1020 |
super initialize. |
807f440e0df7
bw. compatibility - needs builder early.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
1021 |
self createBuilder |
807f440e0df7
bw. compatibility - needs builder early.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
1022 |
|
807f440e0df7
bw. compatibility - needs builder early.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
1023 |
"Created: / 20.6.1998 / 14:51:29 / cg" |
807f440e0df7
bw. compatibility - needs builder early.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
1024 |
! ! |
807f440e0df7
bw. compatibility - needs builder early.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
1025 |
|
782 | 1026 |
!ToolApplicationModel methodsFor:'queries'! |
1027 |
||
876 | 1028 |
allToolInstances |
907 | 1029 |
"returns all instances of this tool class" |
876 | 1030 |
|
1031 |
^self class settings at: #Instances ifAbsent: [^#()] |
|
1032 |
! |
|
1033 |
||
782 | 1034 |
preferredExtent |
1035 |
"preferred extent of my window; top/main menu and top toolbar (named by 'menuToolbarView') |
|
1036 |
will be considered" |
|
1037 |
||
1038 |
|window menu menuToolbarView preferredExtentOfWindow| |
|
1039 |
||
1040 |
window := self builder window. |
|
1041 |
menu := window subViews first. |
|
1042 |
menuToolbarView := builder componentAt: #menuToolbarView. |
|
1043 |
||
1044 |
preferredExtentOfWindow := window extent. |
|
1045 |
menu class = MenuPanel ifTrue: [preferredExtentOfWindow := preferredExtentOfWindow max: menu preferredExtent]. |
|
1046 |
menuToolbarView notNil ifTrue: [preferredExtentOfWindow := preferredExtentOfWindow max: menuToolbarView preferredExtent]. |
|
1047 |
||
1048 |
^window minExtent max: (preferredExtentOfWindow min: window maxExtent) |
|
1049 |
! ! |
|
1050 |
||
869 | 1051 |
!ToolApplicationModel methodsFor:'settings'! |
1052 |
||
872 | 1053 |
allFontViewsDo: aBlock |
892 | 1054 |
"evaluates aBlock for all views with fonts" |
872 | 1055 |
|
1056 |
|fontViews| |
|
1057 |
||
1058 |
fontViews := OrderedCollection new. |
|
1059 |
||
1060 |
self builder windowGroup views do: [:v| v class = MenuPanel ifTrue: [fontViews add: v]]. |
|
1061 |
||
1062 |
builder namedComponents do: |
|
1063 |
[:aView| |
|
1064 |
aView allSubViewsDo: |
|
1065 |
[:v| |
|
1066 |
v font notNil ifTrue: [fontViews add: v] |
|
1067 |
] |
|
1068 |
]. |
|
1069 |
fontViews do: aBlock |
|
1070 |
! |
|
1071 |
||
869 | 1072 |
chooseFont: viewFont |
892 | 1073 |
"chooses a font for viewFont and puts it into the settings dictionary; |
869 | 1074 |
finally update all my views" |
1075 |
||
1076 |
|defaultFont font| |
|
1077 |
||
872 | 1078 |
viewFont = 'Label Font' ifTrue: [defaultFont := Label defaultFont]. |
1079 |
viewFont = 'Button Font' ifTrue: [defaultFont := Button defaultFont]. |
|
1080 |
viewFont = 'Edit Font' ifTrue: [defaultFont := TextView defaultFont]. |
|
1081 |
viewFont = 'List Font' ifTrue: [defaultFont := ListView defaultFont]. |
|
1082 |
viewFont = 'Tree List Font' ifTrue: [defaultFont := SelectionInTreeView defaultFont]. |
|
892 | 1083 |
viewFont = 'Note Book Font' ifTrue: [defaultFont := NoteBookView defaultFont]. |
872 | 1084 |
viewFont = 'Framed Box Font' ifTrue: [defaultFont := FramedBox defaultFont]. |
869 | 1085 |
|
1086 |
(font := FontPanel |
|
1087 |
fontFromUserInitial: (self class settings at: viewFont asSymbol ifAbsent: nil) ? defaultFont |
|
1088 |
title: 'Choose ', viewFont) notNil |
|
1089 |
ifTrue: |
|
872 | 1090 |
[ |
869 | 1091 |
self class settings at: viewFont asSymbol put: (font on: device). |
1092 |
self updateFonts |
|
1093 |
]. |
|
1094 |
^font |
|
1095 |
! |
|
1096 |
||
1097 |
resetFonts |
|
892 | 1098 |
"sets the fonts in the settings to nil and resets the views to its default font" |
869 | 1099 |
|
872 | 1100 |
(self class settings) |
892 | 1101 |
at: #'Label Font' put: Label defaultFont; |
1102 |
at: #'Button Font' put: Button defaultFont; |
|
1103 |
at: #'Edit Font' put: TextView defaultFont; |
|
1104 |
at: #'List Font' put: ListView defaultFont; |
|
1105 |
at: #'Tree List Font' put: SelectionInTreeView defaultFont; |
|
1106 |
at: #'Note Book Font' put: NoteBookView defaultFont; |
|
1107 |
at: #'Framed Box Font' put: FramedBox defaultFont. |
|
1108 |
||
1109 |
self updateFonts. |
|
1110 |
||
1111 |
(self class settings) |
|
872 | 1112 |
removeKey: #'Label Font' ifAbsent: nil; |
1113 |
removeKey: #'Button Font' ifAbsent: nil; |
|
1114 |
removeKey: #'Edit Font' ifAbsent: nil; |
|
1115 |
removeKey: #'List Font' ifAbsent: nil; |
|
1116 |
removeKey: #'Tree List Font' ifAbsent: nil; |
|
1117 |
removeKey: #'Note Book Font' ifAbsent: nil; |
|
1118 |
removeKey: #'Framed Box Font' ifAbsent: nil. |
|
869 | 1119 |
|
1120 |
! |
|
1121 |
||
1122 |
updateFonts |
|
892 | 1123 |
"takes defined fonts from the settings and set them to the corresponding views" |
869 | 1124 |
|
892 | 1125 |
|settings labelFont buttonFont editFont listFont treeListFont noteBookFont framedBoxFont updateFontsBlock| |
871 | 1126 |
|
1127 |
settings := self class settings. |
|
869 | 1128 |
|
872 | 1129 |
labelFont := settings at: #'Label Font' ifAbsent: nil. |
1130 |
buttonFont := settings at: #'Button Font' ifAbsent: nil. |
|
1131 |
editFont := settings at: #'Edit Font' ifAbsent: nil. |
|
1132 |
listFont := settings at: #'List Font' ifAbsent: nil. |
|
1133 |
treeListFont := settings at: #'Tree List Font' ifAbsent: nil. |
|
1134 |
noteBookFont := settings at: #'Note Book Font' ifAbsent: nil. |
|
1135 |
framedBoxFont := settings at: #'Framed Box Font' ifAbsent: nil. |
|
869 | 1136 |
|
872 | 1137 |
updateFontsBlock := |
1138 |
[:v| |
|
1139 |
(labelFont notNil and: [v font ~= labelFont and: [(v class == Label) or: [v isKindOf: Toggle]]]) |
|
1140 |
ifTrue: [v font: labelFont; fixSize; sizeChanged:nil; invalidate]. |
|
1141 |
(buttonFont notNil and: [v font ~= buttonFont and: [v class == Button or: [v class == PopUpList]]]) |
|
876 | 1142 |
ifTrue: [v label isString ifTrue: [|e|e := v extent. v font: buttonFont; extent: e; invalidate]]. |
872 | 1143 |
(editFont notNil and: [v font ~= editFont and: [v isKindOf: TextView]]) |
1144 |
ifTrue: [v font: editFont; invalidate]. |
|
1145 |
(listFont notNil and: [v font ~= listFont and: [v class = SelectionInListView or: [v class = DataSetView]]]) |
|
1146 |
ifTrue: [v font: listFont. v invalidate]. |
|
1147 |
(treeListFont notNil and: [v font ~= treeListFont and: [v isKindOf: SelectionInTreeView]]) |
|
1148 |
ifTrue: [v font: treeListFont; invalidate]. |
|
1149 |
(noteBookFont notNil and: [v font ~= noteBookFont and: [v class == NoteBookView]]) |
|
1150 |
ifTrue: [v font: noteBookFont; invalidate]. |
|
1151 |
(framedBoxFont notNil and: [v font ~= framedBoxFont and: [v class == FramedBox]]) |
|
1152 |
ifTrue: [v font: framedBoxFont; invalidate] |
|
1153 |
]. |
|
1154 |
||
1155 |
self allFontViewsDo: [:v| updateFontsBlock value: v] |
|
1156 |
||
869 | 1157 |
! ! |
1158 |
||
753 | 1159 |
!ToolApplicationModel methodsFor:'startup / release'! |
1160 |
||
1161 |
close |
|
907 | 1162 |
"uninitializes and closes this tool" |
753 | 1163 |
|
756 | 1164 |
self uninitialize. |
1165 |
||
753 | 1166 |
super close |
1167 |
! |
|
1168 |
||
1169 |
closeRequest |
|
907 | 1170 |
"uninitializes this tool before requesting close" |
753 | 1171 |
|
756 | 1172 |
self uninitialize. |
1173 |
||
753 | 1174 |
super closeRequest |
1175 |
! |
|
1176 |
||
936 | 1177 |
postBuildWith:aBuilder |
1178 |
"sets the preferred extent and the label of the tool window before opening that" |
|
1179 |
||
971
a9d2fc9ebec9
handle the case of being postOpened as a subCanvas
Claus Gittinger <cg@exept.de>
parents:
936
diff
changeset
|
1180 |
|win| |
a9d2fc9ebec9
handle the case of being postOpened as a subCanvas
Claus Gittinger <cg@exept.de>
parents:
936
diff
changeset
|
1181 |
|
936 | 1182 |
super postBuildWith:aBuilder. |
1183 |
||
971
a9d2fc9ebec9
handle the case of being postOpened as a subCanvas
Claus Gittinger <cg@exept.de>
parents:
936
diff
changeset
|
1184 |
(win := aBuilder window) isTopView ifTrue:[ |
a9d2fc9ebec9
handle the case of being postOpened as a subCanvas
Claus Gittinger <cg@exept.de>
parents:
936
diff
changeset
|
1185 |
win |
a9d2fc9ebec9
handle the case of being postOpened as a subCanvas
Claus Gittinger <cg@exept.de>
parents:
936
diff
changeset
|
1186 |
extent: self preferredExtent; |
a9d2fc9ebec9
handle the case of being postOpened as a subCanvas
Claus Gittinger <cg@exept.de>
parents:
936
diff
changeset
|
1187 |
label: self class label. |
a9d2fc9ebec9
handle the case of being postOpened as a subCanvas
Claus Gittinger <cg@exept.de>
parents:
936
diff
changeset
|
1188 |
]. |
936 | 1189 |
|
1190 |
"Created: / 21.5.1998 / 02:49:09 / cg" |
|
971
a9d2fc9ebec9
handle the case of being postOpened as a subCanvas
Claus Gittinger <cg@exept.de>
parents:
936
diff
changeset
|
1191 |
"Modified: / 18.6.1998 / 20:16:25 / cg" |
936 | 1192 |
! |
1193 |
||
790 | 1194 |
postOpenWith:aBuilder |
907 | 1195 |
"starts the active help for this tool (if turned on in the settings) |
1196 |
and updates the info label and the fonts (from the settings)" |
|
790 | 1197 |
|
1198 |
super postOpenWith:aBuilder. |
|
1199 |
||
791 | 1200 |
self class showHelp ifTrue: [ActiveHelp startFor: self]. |
822 | 1201 |
self updateInfoLabel. |
876 | 1202 |
self updateFonts. |
1203 |
||
790 | 1204 |
! |
1205 |
||
853 | 1206 |
startClockOnTimedBlock: aBlock |
907 | 1207 |
"sets and starts the time block" |
853 | 1208 |
|
1209 |
timeBlock := aBlock. |
|
1210 |
aBlock value. |
|
1211 |
||
1212 |
! |
|
1213 |
||
756 | 1214 |
uninitialize |
907 | 1215 |
"stops the active help this tool and (if defined) removes the time block" |
756 | 1216 |
|
782 | 1217 |
self showHelp ifTrue: [ActiveHelp stopFor: self]. |
876 | 1218 |
timeBlock notNil ifTrue: [Processor removeTimedBlock:timeBlock. timeBlock := nil]. |
1219 |
||
753 | 1220 |
! ! |
1221 |
||
1222 |
!ToolApplicationModel class methodsFor:'documentation'! |
|
1223 |
||
1224 |
version |
|
1016 | 1225 |
^ '$Header: /cvs/stx/stx/libview2/ToolApplicationModel.st,v 1.68 1998-07-30 09:19:09 cg Exp $' |
753 | 1226 |
! ! |