author | tz |
Sun, 19 Jul 1998 20:55:35 +0200 | |
changeset 1002 | a237e5fd2be9 |
parent 990 | 13f2fe627628 |
child 1004 | 6dc621535e26 |
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 |
|
910 | 246 |
'Delete all items in the history.' |
803 | 247 |
|
823 | 248 |
#historyMenuItem |
910 | 249 |
'Evaluate the text of the menu item for loading.' |
762 | 250 |
|
893 | 251 |
#settings |
252 |
'Settings functions.' |
|
253 |
||
823 | 254 |
#test |
834 | 255 |
'Test functions.' |
762 | 256 |
|
257 |
) |
|
922 | 258 |
|
259 |
"Modified: / 19.5.1998 / 21:32:01 / 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 |
907 | 775 |
"returns whether there is a documentation method for this tool as value holder" |
803 | 776 |
|
936 | 777 |
^ builder booleanValueAspectFor:#valueOfHavingDocumentation |
803 | 778 |
|
936 | 779 |
"Modified: / 21.5.1998 / 03:39:56 / cg" |
803 | 780 |
! |
781 |
||
782 | 782 |
valueOfInfoLabel |
907 | 783 |
"returns the info label as value holder" |
782 | 784 |
|
936 | 785 |
^ builder nilValueAspectFor:#valueOfInfoLabel |
753 | 786 |
|
936 | 787 |
"Modified: / 21.5.1998 / 03:40:34 / cg" |
782 | 788 |
! |
789 |
||
790 |
valueOfTimeLabel |
|
907 | 791 |
"returns the time label as value holder" |
753 | 792 |
|
936 | 793 |
^ builder nilValueAspectFor:#valueOfTimeLabel |
753 | 794 |
|
936 | 795 |
"Modified: / 21.5.1998 / 03:40:42 / cg" |
753 | 796 |
! ! |
797 |
||
782 | 798 |
!ToolApplicationModel methodsFor:'clipboard'! |
753 | 799 |
|
838 | 800 |
clipboard |
907 | 801 |
"returns the clipboard" |
838 | 802 |
|
803 |
^self class clipboard |
|
804 |
! |
|
805 |
||
782 | 806 |
clipboard: anEditObject |
907 | 807 |
"sets the clipboard and the value holder for can pasting" |
753 | 808 |
|
782 | 809 |
self class clipboard: anEditObject. |
753 | 810 |
|
869 | 811 |
self valueOfCanPaste value: anEditObject notNil |
782 | 812 |
! ! |
813 |
||
814 |
!ToolApplicationModel methodsFor:'help'! |
|
753 | 815 |
|
762 | 816 |
defaultInfoLabel |
907 | 817 |
"returns the default info label; here an empty string" |
762 | 818 |
|
819 |
^'' |
|
820 |
! |
|
821 |
||
984 | 822 |
doShowHelp:aHelpText |
823 |
"displays aHelpText in the info label or if present detours it to its masterApplication" |
|
824 |
||
825 |
aHelpText isNil |
|
826 |
ifTrue: [self updateInfoLabel] |
|
827 |
ifFalse: [self valueOfInfoLabel value: (aHelpText asString printString readStream through: $.)]. |
|
828 |
||
829 |
"Created: / 20.6.1998 / 16:37:23 / cg" |
|
830 |
! |
|
831 |
||
753 | 832 |
openAbout |
907 | 833 |
"opens an about box" |
753 | 834 |
|
835 |
|box| |
|
836 |
||
837 |
box := AboutBox new. |
|
838 |
box autoHideAfter:10 with:[]. |
|
839 |
box showAtCenter |
|
840 |
||
841 |
! |
|
842 |
||
843 |
openAboutThisApplication |
|
907 | 844 |
"opens an about this application box" |
753 | 845 |
|
936 | 846 |
|rev box myClass clsRev| |
847 |
||
753 | 848 |
rev := ''. |
936 | 849 |
myClass := self class. |
850 |
||
851 |
(clsRev := myClass revision) notNil ifTrue: [rev := ' (rev: ', clsRev printString, ')']. |
|
753 | 852 |
box := AboutBox title: |
800 | 853 |
'\The application\\' withCRs |
936 | 854 |
, myClass name asBoldText, rev |
850 | 855 |
, '\\has been designed and implemented by: \' withCRs |
856 |
, ((self class authorLinesForAboutBox collect:[:l | '- ' , l]) asStringWith:$\) withCRs |
|
800 | 857 |
, '\\' withCRs. |
753 | 858 |
|
859 |
box label:'About This Application'. |
|
860 |
box autoHideAfter:10 with:[]. |
|
861 |
box showAtCenter. |
|
936 | 862 |
|
863 |
"Modified: / 21.5.1998 / 03:34:32 / cg" |
|
753 | 864 |
! |
865 |
||
858 | 866 |
openHTMLDocument: aHTMLFilename |
907 | 867 |
"opens a HTML browser on aHTMLFilename" |
858 | 868 |
|
869 |
HTMLDocumentView openFullOnDocumentationFile: aHTMLFilename |
|
870 |
! |
|
871 |
||
782 | 872 |
showHelp |
907 | 873 |
"returns whether showing help is turned on/off" |
782 | 874 |
|
783 | 875 |
|currentActiveHelp| |
858 | 876 |
|
783 | 877 |
currentActiveHelp := ActiveHelp currentHelpListener. |
878 |
||
879 |
^self class showHelp |
|
858 | 880 |
and: [currentActiveHelp notNil and: [masterApplication notNil |
881 |
ifFalse: [currentActiveHelp interestedIn: self window] |
|
882 |
ifTrue: [currentActiveHelp interestedIn: masterApplication window]]] |
|
782 | 883 |
! |
884 |
||
885 |
showHelp: aValue |
|
907 | 886 |
"toggles showing help" |
782 | 887 |
|
888 |
(self class showHelp: aValue) |
|
889 |
ifTrue: [ActiveHelp startFor: self] |
|
822 | 890 |
ifFalse: [ActiveHelp stopFor: self. self updateInfoLabel] |
782 | 891 |
! |
892 |
||
762 | 893 |
showHelp:aHelpText for:view |
984 | 894 |
"displays aHelpText in the info label or if present detours it to its masterApplication. |
895 |
Here, an event is pushed for myself to synchronize the helpDisplay |
|
896 |
with event handling." |
|
897 |
||
898 |
|wg mySensor| |
|
762 | 899 |
|
782 | 900 |
self showHelp ifFalse: [^true]. |
876 | 901 |
masterApplication notNil ifTrue: [masterApplication showHelp: aHelpText for:view]. |
984 | 902 |
|
903 |
"/ OLD: show it right here ... |
|
904 |
"/ aHelpText isNil |
|
905 |
"/ ifTrue: [self updateInfoLabel] |
|
906 |
"/ ifFalse: [self valueOfInfoLabel value: (aHelpText asString printString readStream through: $.)]. |
|
907 |
"/ the nil-tests should not be req'd - but thats a last-minute |
|
908 |
"/ change and I dont want to breaks the delivery ... |
|
909 |
||
910 |
"/ NEW: push it into the event queue, to have it displayed |
|
911 |
"/ syncronously with other events. |
|
912 |
"/ (also any errors are reported as occurring in my context; |
|
913 |
"/ instead of occurring in the activeHelp context). |
|
914 |
||
915 |
(wg := self windowGroup) notNil ifTrue:[ |
|
916 |
mySensor := wg sensor. |
|
917 |
mySensor notNil ifTrue:[ |
|
918 |
mySensor flushEventsFor:self withType:#doShowHelp:. |
|
919 |
mySensor pushUserEvent:#doShowHelp: for:self withArguments:(Array with:aHelpText). |
|
920 |
]. |
|
921 |
]. |
|
922 |
||
876 | 923 |
^true |
984 | 924 |
|
925 |
"Modified: / 20.6.1998 / 16:47:37 / cg" |
|
822 | 926 |
! |
927 |
||
928 |
updateInfoLabel |
|
907 | 929 |
"updates the info label at the bottom" |
822 | 930 |
|
931 |
self valueOfInfoLabel value: self defaultInfoLabel |
|
762 | 932 |
! ! |
933 |
||
753 | 934 |
!ToolApplicationModel methodsFor:'history'! |
935 |
||
936 |
addToHistory: aHistoryEntry |
|
907 | 937 |
"adds aHistoryEntry (format: loadMessage -> evalString) at the top of the history, |
938 |
and checks for maximum size of the history" |
|
753 | 939 |
|
782 | 940 |
aHistoryEntry key size = 0 ifTrue: [^nil]. |
753 | 941 |
self history remove: (self history detect: [:histEntry| histEntry key = aHistoryEntry key] ifNone: nil) ifAbsent: nil. |
942 |
self history addFirst: aHistoryEntry. |
|
943 |
[self history size > self class historyMaxSize] whileTrue: [self history removeLast] |
|
944 |
! |
|
945 |
||
946 |
emptyHistory |
|
907 | 947 |
"removes all history entries" |
753 | 948 |
|
949 |
^self history removeAll |
|
950 |
! |
|
951 |
||
952 |
history |
|
907 | 953 |
"returns the history from tool class" |
753 | 954 |
|
955 |
^self class getHistory |
|
956 |
! |
|
957 |
||
844 | 958 |
historyEntries |
907 | 959 |
"returns the history entries, i.e. the evaluatable values containing the information" |
844 | 960 |
|
961 |
^self history collect: [:asso| asso key] |
|
962 |
! |
|
963 |
||
753 | 964 |
menuHistory |
907 | 965 |
"returns a history submenu" |
753 | 966 |
|
893 | 967 |
|menu| |
920
6b72e4ce4406
must find gui resources (xlations in in history menu)
Claus Gittinger <cg@exept.de>
parents:
910
diff
changeset
|
968 |
|
753 | 969 |
menu := Menu new receiver: self. |
970 |
(self history collect: [:histEntry| histEntry value]) asSet asOrderedCollection do: |
|
971 |
[:historyEntryType| |
|
893 | 972 |
menu addItemGroup: ((self history select: [:histEntry| histEntry value = historyEntryType]) collect: [:histEntry| MenuItem new label: histEntry key printString; value: histEntry value; argument: histEntry key; activeHelpKey: #historyMenuItem]). |
753 | 973 |
]. |
974 |
||
920
6b72e4ce4406
must find gui resources (xlations in in history menu)
Claus Gittinger <cg@exept.de>
parents:
910
diff
changeset
|
975 |
menu addItem: (MenuItem new |
6b72e4ce4406
must find gui resources (xlations in in history menu)
Claus Gittinger <cg@exept.de>
parents:
910
diff
changeset
|
976 |
label: 'Empty History'; |
6b72e4ce4406
must find gui resources (xlations in in history menu)
Claus Gittinger <cg@exept.de>
parents:
910
diff
changeset
|
977 |
value: #emptyHistory; |
6b72e4ce4406
must find gui resources (xlations in in history menu)
Claus Gittinger <cg@exept.de>
parents:
910
diff
changeset
|
978 |
activeHelpKey: #historyEmptyMenu; |
6b72e4ce4406
must find gui resources (xlations in in history menu)
Claus Gittinger <cg@exept.de>
parents:
910
diff
changeset
|
979 |
translateLabel:true). |
6b72e4ce4406
must find gui resources (xlations in in history menu)
Claus Gittinger <cg@exept.de>
parents:
910
diff
changeset
|
980 |
|
6b72e4ce4406
must find gui resources (xlations in in history menu)
Claus Gittinger <cg@exept.de>
parents:
910
diff
changeset
|
981 |
menu findGuiResourcesIn:self. |
753 | 982 |
^menu |
920
6b72e4ce4406
must find gui resources (xlations in in history menu)
Claus Gittinger <cg@exept.de>
parents:
910
diff
changeset
|
983 |
|
6b72e4ce4406
must find gui resources (xlations in in history menu)
Claus Gittinger <cg@exept.de>
parents:
910
diff
changeset
|
984 |
"Modified: / 19.5.1998 / 19:17:34 / cg" |
753 | 985 |
! |
986 |
||
987 |
removeFromHistory: aHistoryEntry |
|
907 | 988 |
"removes aHistoryEntry from the history" |
753 | 989 |
|
990 |
self history remove: (self history detect: [:histEntry| histEntry key = aHistoryEntry key] ifNone: nil) ifAbsent: nil. |
|
991 |
[self history size > self class historyMaxSize] whileTrue: [self history removeLast] |
|
992 |
! ! |
|
993 |
||
982
807f440e0df7
bw. compatibility - needs builder early.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
994 |
!ToolApplicationModel methodsFor:'initialization'! |
807f440e0df7
bw. compatibility - needs builder early.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
995 |
|
807f440e0df7
bw. compatibility - needs builder early.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
996 |
initialize |
807f440e0df7
bw. compatibility - needs builder early.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
997 |
super initialize. |
807f440e0df7
bw. compatibility - needs builder early.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
998 |
self createBuilder |
807f440e0df7
bw. compatibility - needs builder early.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
999 |
|
807f440e0df7
bw. compatibility - needs builder early.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
1000 |
"Created: / 20.6.1998 / 14:51:29 / cg" |
807f440e0df7
bw. compatibility - needs builder early.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
1001 |
! ! |
807f440e0df7
bw. compatibility - needs builder early.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
1002 |
|
782 | 1003 |
!ToolApplicationModel methodsFor:'queries'! |
1004 |
||
876 | 1005 |
allToolInstances |
907 | 1006 |
"returns all instances of this tool class" |
876 | 1007 |
|
1008 |
^self class settings at: #Instances ifAbsent: [^#()] |
|
1009 |
! |
|
1010 |
||
782 | 1011 |
preferredExtent |
1012 |
"preferred extent of my window; top/main menu and top toolbar (named by 'menuToolbarView') |
|
1013 |
will be considered" |
|
1014 |
||
1015 |
|window menu menuToolbarView preferredExtentOfWindow| |
|
1016 |
||
1017 |
window := self builder window. |
|
1018 |
menu := window subViews first. |
|
1019 |
menuToolbarView := builder componentAt: #menuToolbarView. |
|
1020 |
||
1021 |
preferredExtentOfWindow := window extent. |
|
1022 |
menu class = MenuPanel ifTrue: [preferredExtentOfWindow := preferredExtentOfWindow max: menu preferredExtent]. |
|
1023 |
menuToolbarView notNil ifTrue: [preferredExtentOfWindow := preferredExtentOfWindow max: menuToolbarView preferredExtent]. |
|
1024 |
||
1025 |
^window minExtent max: (preferredExtentOfWindow min: window maxExtent) |
|
1026 |
! ! |
|
1027 |
||
869 | 1028 |
!ToolApplicationModel methodsFor:'settings'! |
1029 |
||
872 | 1030 |
allFontViewsDo: aBlock |
892 | 1031 |
"evaluates aBlock for all views with fonts" |
872 | 1032 |
|
1033 |
|fontViews| |
|
1034 |
||
1035 |
fontViews := OrderedCollection new. |
|
1036 |
||
1037 |
self builder windowGroup views do: [:v| v class = MenuPanel ifTrue: [fontViews add: v]]. |
|
1038 |
||
1039 |
builder namedComponents do: |
|
1040 |
[:aView| |
|
1041 |
aView allSubViewsDo: |
|
1042 |
[:v| |
|
1043 |
v font notNil ifTrue: [fontViews add: v] |
|
1044 |
] |
|
1045 |
]. |
|
1046 |
fontViews do: aBlock |
|
1047 |
! |
|
1048 |
||
869 | 1049 |
chooseFont: viewFont |
892 | 1050 |
"chooses a font for viewFont and puts it into the settings dictionary; |
869 | 1051 |
finally update all my views" |
1052 |
||
1053 |
|defaultFont font| |
|
1054 |
||
872 | 1055 |
viewFont = 'Label Font' ifTrue: [defaultFont := Label defaultFont]. |
1056 |
viewFont = 'Button Font' ifTrue: [defaultFont := Button defaultFont]. |
|
1057 |
viewFont = 'Edit Font' ifTrue: [defaultFont := TextView defaultFont]. |
|
1058 |
viewFont = 'List Font' ifTrue: [defaultFont := ListView defaultFont]. |
|
1059 |
viewFont = 'Tree List Font' ifTrue: [defaultFont := SelectionInTreeView defaultFont]. |
|
892 | 1060 |
viewFont = 'Note Book Font' ifTrue: [defaultFont := NoteBookView defaultFont]. |
872 | 1061 |
viewFont = 'Framed Box Font' ifTrue: [defaultFont := FramedBox defaultFont]. |
869 | 1062 |
|
1063 |
(font := FontPanel |
|
1064 |
fontFromUserInitial: (self class settings at: viewFont asSymbol ifAbsent: nil) ? defaultFont |
|
1065 |
title: 'Choose ', viewFont) notNil |
|
1066 |
ifTrue: |
|
872 | 1067 |
[ |
869 | 1068 |
self class settings at: viewFont asSymbol put: (font on: device). |
1069 |
self updateFonts |
|
1070 |
]. |
|
1071 |
^font |
|
1072 |
! |
|
1073 |
||
1074 |
resetFonts |
|
892 | 1075 |
"sets the fonts in the settings to nil and resets the views to its default font" |
869 | 1076 |
|
872 | 1077 |
(self class settings) |
892 | 1078 |
at: #'Label Font' put: Label defaultFont; |
1079 |
at: #'Button Font' put: Button defaultFont; |
|
1080 |
at: #'Edit Font' put: TextView defaultFont; |
|
1081 |
at: #'List Font' put: ListView defaultFont; |
|
1082 |
at: #'Tree List Font' put: SelectionInTreeView defaultFont; |
|
1083 |
at: #'Note Book Font' put: NoteBookView defaultFont; |
|
1084 |
at: #'Framed Box Font' put: FramedBox defaultFont. |
|
1085 |
||
1086 |
self updateFonts. |
|
1087 |
||
1088 |
(self class settings) |
|
872 | 1089 |
removeKey: #'Label Font' ifAbsent: nil; |
1090 |
removeKey: #'Button Font' ifAbsent: nil; |
|
1091 |
removeKey: #'Edit Font' ifAbsent: nil; |
|
1092 |
removeKey: #'List Font' ifAbsent: nil; |
|
1093 |
removeKey: #'Tree List Font' ifAbsent: nil; |
|
1094 |
removeKey: #'Note Book Font' ifAbsent: nil; |
|
1095 |
removeKey: #'Framed Box Font' ifAbsent: nil. |
|
869 | 1096 |
|
1097 |
! |
|
1098 |
||
1099 |
updateFonts |
|
892 | 1100 |
"takes defined fonts from the settings and set them to the corresponding views" |
869 | 1101 |
|
892 | 1102 |
|settings labelFont buttonFont editFont listFont treeListFont noteBookFont framedBoxFont updateFontsBlock| |
871 | 1103 |
|
1104 |
settings := self class settings. |
|
869 | 1105 |
|
872 | 1106 |
labelFont := settings at: #'Label Font' ifAbsent: nil. |
1107 |
buttonFont := settings at: #'Button Font' ifAbsent: nil. |
|
1108 |
editFont := settings at: #'Edit Font' ifAbsent: nil. |
|
1109 |
listFont := settings at: #'List Font' ifAbsent: nil. |
|
1110 |
treeListFont := settings at: #'Tree List Font' ifAbsent: nil. |
|
1111 |
noteBookFont := settings at: #'Note Book Font' ifAbsent: nil. |
|
1112 |
framedBoxFont := settings at: #'Framed Box Font' ifAbsent: nil. |
|
869 | 1113 |
|
872 | 1114 |
updateFontsBlock := |
1115 |
[:v| |
|
1116 |
(labelFont notNil and: [v font ~= labelFont and: [(v class == Label) or: [v isKindOf: Toggle]]]) |
|
1117 |
ifTrue: [v font: labelFont; fixSize; sizeChanged:nil; invalidate]. |
|
1118 |
(buttonFont notNil and: [v font ~= buttonFont and: [v class == Button or: [v class == PopUpList]]]) |
|
876 | 1119 |
ifTrue: [v label isString ifTrue: [|e|e := v extent. v font: buttonFont; extent: e; invalidate]]. |
872 | 1120 |
(editFont notNil and: [v font ~= editFont and: [v isKindOf: TextView]]) |
1121 |
ifTrue: [v font: editFont; invalidate]. |
|
1122 |
(listFont notNil and: [v font ~= listFont and: [v class = SelectionInListView or: [v class = DataSetView]]]) |
|
1123 |
ifTrue: [v font: listFont. v invalidate]. |
|
1124 |
(treeListFont notNil and: [v font ~= treeListFont and: [v isKindOf: SelectionInTreeView]]) |
|
1125 |
ifTrue: [v font: treeListFont; invalidate]. |
|
1126 |
(noteBookFont notNil and: [v font ~= noteBookFont and: [v class == NoteBookView]]) |
|
1127 |
ifTrue: [v font: noteBookFont; invalidate]. |
|
1128 |
(framedBoxFont notNil and: [v font ~= framedBoxFont and: [v class == FramedBox]]) |
|
1129 |
ifTrue: [v font: framedBoxFont; invalidate] |
|
1130 |
]. |
|
1131 |
||
1132 |
self allFontViewsDo: [:v| updateFontsBlock value: v] |
|
1133 |
||
869 | 1134 |
! ! |
1135 |
||
753 | 1136 |
!ToolApplicationModel methodsFor:'startup / release'! |
1137 |
||
1138 |
close |
|
907 | 1139 |
"uninitializes and closes this tool" |
753 | 1140 |
|
756 | 1141 |
self uninitialize. |
1142 |
||
753 | 1143 |
super close |
1144 |
! |
|
1145 |
||
1146 |
closeRequest |
|
907 | 1147 |
"uninitializes this tool before requesting close" |
753 | 1148 |
|
756 | 1149 |
self uninitialize. |
1150 |
||
753 | 1151 |
super closeRequest |
1152 |
! |
|
1153 |
||
936 | 1154 |
postBuildWith:aBuilder |
1155 |
"sets the preferred extent and the label of the tool window before opening that" |
|
1156 |
||
971
a9d2fc9ebec9
handle the case of being postOpened as a subCanvas
Claus Gittinger <cg@exept.de>
parents:
936
diff
changeset
|
1157 |
|win| |
a9d2fc9ebec9
handle the case of being postOpened as a subCanvas
Claus Gittinger <cg@exept.de>
parents:
936
diff
changeset
|
1158 |
|
936 | 1159 |
super postBuildWith:aBuilder. |
1160 |
||
971
a9d2fc9ebec9
handle the case of being postOpened as a subCanvas
Claus Gittinger <cg@exept.de>
parents:
936
diff
changeset
|
1161 |
(win := aBuilder window) isTopView ifTrue:[ |
a9d2fc9ebec9
handle the case of being postOpened as a subCanvas
Claus Gittinger <cg@exept.de>
parents:
936
diff
changeset
|
1162 |
win |
a9d2fc9ebec9
handle the case of being postOpened as a subCanvas
Claus Gittinger <cg@exept.de>
parents:
936
diff
changeset
|
1163 |
extent: self preferredExtent; |
a9d2fc9ebec9
handle the case of being postOpened as a subCanvas
Claus Gittinger <cg@exept.de>
parents:
936
diff
changeset
|
1164 |
label: self class label. |
a9d2fc9ebec9
handle the case of being postOpened as a subCanvas
Claus Gittinger <cg@exept.de>
parents:
936
diff
changeset
|
1165 |
]. |
936 | 1166 |
|
1167 |
"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
|
1168 |
"Modified: / 18.6.1998 / 20:16:25 / cg" |
936 | 1169 |
! |
1170 |
||
790 | 1171 |
postOpenWith:aBuilder |
907 | 1172 |
"starts the active help for this tool (if turned on in the settings) |
1173 |
and updates the info label and the fonts (from the settings)" |
|
790 | 1174 |
|
1175 |
super postOpenWith:aBuilder. |
|
1176 |
||
791 | 1177 |
self class showHelp ifTrue: [ActiveHelp startFor: self]. |
822 | 1178 |
self updateInfoLabel. |
876 | 1179 |
self updateFonts. |
1180 |
||
790 | 1181 |
! |
1182 |
||
853 | 1183 |
startClockOnTimedBlock: aBlock |
907 | 1184 |
"sets and starts the time block" |
853 | 1185 |
|
1186 |
timeBlock := aBlock. |
|
1187 |
aBlock value. |
|
1188 |
||
1189 |
! |
|
1190 |
||
756 | 1191 |
uninitialize |
907 | 1192 |
"stops the active help this tool and (if defined) removes the time block" |
756 | 1193 |
|
782 | 1194 |
self showHelp ifTrue: [ActiveHelp stopFor: self]. |
876 | 1195 |
timeBlock notNil ifTrue: [Processor removeTimedBlock:timeBlock. timeBlock := nil]. |
1196 |
||
753 | 1197 |
! ! |
1198 |
||
1199 |
!ToolApplicationModel class methodsFor:'documentation'! |
|
1200 |
||
1201 |
version |
|
990 | 1202 |
^ '$Header: /cvs/stx/stx/libview2/ToolApplicationModel.st,v 1.63 1998-06-29 14:55:19 tz Exp $' |
753 | 1203 |
! ! |