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