"
COPYRIGHT (c) 1997 by eXept Software AG
All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
inclusion of the above copyright notice. This software may not
be provided or otherwise made available to, or used by, any
other person. No title to or ownership of the software is
hereby transferred.
"
ApplicationModel subclass:#ToolApplicationModel
instanceVariableNames:'timeBlock'
classVariableNames:''
poolDictionaries:''
category:'Interface-Framework'
!
ToolApplicationModel class instanceVariableNames:'history clipboard settings showHelp'
"
The following class instance variables are inherited by this class:
ApplicationModel - ClassResources
Model -
Object -
"
!
!ToolApplicationModel class methodsFor:'documentation'!
copyright
"
COPYRIGHT (c) 1997 by eXept Software AG
All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
inclusion of the above copyright notice. This software may not
be provided or otherwise made available to, or used by, any
other person. No title to or ownership of the software is
hereby transferred.
"
!
documentation
"
Standard framework for tools; provides hooks for history management,
showing help texts, about menu, help menu etc.
See concrete subclasses for examples.
[author:]
Thomas Zwick
"
! !
!ToolApplicationModel class methodsFor:'accessing'!
authorLinesForAboutBox
"extract the author(s) from the documentation method."
|firstClassWithDocumentation src s line lines|
firstClassWithDocumentation := self class withAllSuperclasses detect:[:metacls| metacls implements:#documentation].
firstClassWithDocumentation notNil ifTrue:[
(firstClassWithDocumentation inheritsFrom:ToolApplicationModel class) ifTrue:[
src := (firstClassWithDocumentation compiledMethodAt:#documentation) source.
src notNil ifTrue:[
s := src readStream.
s upToAll:'[author:]'.
s nextLine. "/ skip to end
line := s nextLine. "/ line after [author:]
lines := OrderedCollection new.
[line notNil and:[line notEmpty]] whileTrue:[
line := line trimBlanks.
line size > 1 ifTrue:[
lines add:line trimBlanks.
line := s nextLine.
] ifFalse:[
line := nil
]
].
^ lines.
]
]
].
^ #('unnown')
"Created: / 1.2.1998 / 15:41:43 / cg"
"Modified: / 1.2.1998 / 15:59:10 / cg"
!
label
|label|
label := ''.
self name do:
[:c|
c isUppercase ifTrue: [label := label, $ ].
label := label, c
].
^label trimBlanks
!
settings
^settings ? (settings := IdentityDictionary new)
!
showHelp
^showHelp ? (showHelp := true)
!
showHelp: aBoolean
^showHelp := aBoolean
! !
!ToolApplicationModel class methodsFor:'clipboard'!
clipboard
^clipboard
!
clipboard: anEditObject
clipboard := anEditObject
! !
!ToolApplicationModel class methodsFor:'help specs'!
helpSpec
"return a dictionary filled with helpKey -> helptext associations.
These are used by the activeHelp tool."
"
UIHelpTool openOnClass:ToolApplicationModel
"
^ super helpSpec addPairsFrom:#(
#about
'About functions.'
#aboutSTX
'Opens an InfoBox about running ST/X.'
#aboutThisAppliaction
'Opens an InfoBox about release and author of current application.'
#add
'Add functions.'
#commitCancel
'Cancels last edit action.'
#commitOK
'Accepts last edit action.'
#edit
'Edit functions.'
#editCopy
'Copies the selected item(s) to the clipboard.'
#editCut
'Cuts the selected item(s) and places it to the clipboard.'
#editDelete
'Deletes the selected item(s).'
#editMoveDown
'Moves the selected item one step down.'
#editMoveIn
'Moves the selected item into next item as child item.'
#editMoveOut
'Moves the selected item out of parent item.'
#editMoveUp
'Moves the selected item one step up.'
#editPaste
'Pastes the contents of the clipboard.'
#editUndo
'Reverses the last action.'
#file
'File functions.'
#fileBrowseClass
'Opens a System Browser on current class and selector.'
#fileDefineClass
'Opens a dialog to define current class.'
#fileDefineClassAndSelector
'Opens a dialog to define current class and selector.'
#fileExit
'Exits current application.'
#help
'Help functions.'
#helpShowHelp
'Turns on/off displaying help texts.'
#helpTutorial
'Opens a HTML-Browser on the documentation file of the current application.'
#history
'History functions.'
#historyEmptyMenu
'Deletes all items of the history.'
#historyMenuItem
'Evaluates the text of the menu item for loading.'
#test
'Test functions.'
)
! !
!ToolApplicationModel class methodsFor:'history'!
getHistory
history isNil ifTrue: [history := OrderedCollection new].
^history
!
historyMaxSize
^10
! !
!ToolApplicationModel class methodsFor:'interface specs'!
windowSpecForCommit
<resource: #canvas>
^
#(#FullSpec
#'window:'
#(#WindowSpec
#'layout:' #(#LayoutFrame 343 0 328 0 642 0 387 0)
#'min:' #(#Point 100 22)
#'max:' #(#Point 1152 900)
#'bounds:' #(#Rectangle 343 328 643 388)
#'usePreferredExtent:' false
)
#'component:'
#(#SpecCollection
#'collection:'
#(
#(#ActionButtonSpec
#'name:' 'cancelButton'
#'layout:' #(#LayoutFrame 5 0 0 0 -2 0.5 0 1)
#'activeHelpKey:' #commitCancel
#'label:' 'Cancel'
#'tabable:' true
#'model:' #cancel
#'enableChannel:' #valueOfEnablingCommitButtons
)
#(#ActionButtonSpec
#'name:' 'okButton'
#'layout:' #(#LayoutFrame 2 0.5 0 0.0 -5 1 0 1.0)
#'activeHelpKey:' #commitOK
#'label:' 'OK'
#'tabable:' true
#'model:' #accept
#'enableChannel:' #valueOfEnablingCommitButtons
)
)
)
)
!
windowSpecForCommitWithoutChannels
<resource: #canvas>
^
#(#FullSpec
#'window:'
#(#WindowSpec
#'layout:' #(#LayoutFrame 343 0 328 0 642 0 387 0)
#'min:' #(#Point 100 22)
#'max:' #(#Point 1152 900)
#'bounds:' #(#Rectangle 343 328 643 388)
#'usePreferredExtent:' false
)
#'component:'
#(#SpecCollection
#'collection:'
#(
#(#ActionButtonSpec
#'name:' 'cancelButton'
#'layout:' #(#LayoutFrame 5 0 0 0 -2 0.5 0 1)
#'activeHelpKey:' #commitCancel
#'label:' 'Cancel'
#'tabable:' true
#'model:' #cancel
)
#(#ActionButtonSpec
#'name:' 'okButton'
#'layout:' #(#LayoutFrame 2 0.5 0 0.0 -5 1 0 1.0)
#'activeHelpKey:' #commitOK
#'label:' 'OK'
#'tabable:' true
#'model:' #accept
)
)
)
)
!
windowSpecForInfoBar
<resource: #canvas>
^
#(#FullSpec
#'window:'
#(#WindowSpec
#'layout:' #(#LayoutFrame 366 0 355 0 865 0 700 0)
#'min:' #(#Point 400 320)
#'max:' #(#Point 1152 900)
#'bounds:' #(#Rectangle 366 355 866 701)
#'menu:' #menu
#'usePreferredExtent:' false
)
#'component:'
#(#SpecCollection
#'collection:'
#(
#(#ViewSpec
#'name:' 'view'
#'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
#'component:'
#(#SpecCollection
#'collection:'
#(
#(#LabelSpec
#'name:' 'infoLabel'
#'layout:' #(#LayoutFrame 2 0.0 1 0.0 -1 1.0 -1 1.0)
#'labelChannel:' #valueOfInfoLabel
#'level:' -1
#'adjust:' #left
)
)
)
)
)
)
)
!
windowSpecForInfoBarWithClock
<resource: #canvas>
^
#(#FullSpec
#'window:'
#(#WindowSpec
#'layout:' #(#LayoutFrame 349 0 227 0 848 0 572 0)
#'min:' #(#Point 400 320)
#'max:' #(#Point 1152 900)
#'bounds:' #(#Rectangle 349 227 849 573)
#'menu:' #menu
#'usePreferredExtent:' false
)
#'component:'
#(#SpecCollection
#'collection:'
#(
#(#ViewSpec
#'name:' 'view'
#'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
#'component:'
#(#SpecCollection
#'collection:'
#(
#(#LabelSpec
#'name:' 'infoLabel'
#'layout:' #(#LayoutFrame 2 0 1 0.0 -81 1 -1 1.0)
#'labelChannel:' #valueOfInfoLabel
#'level:' -1
#'adjust:' #left
)
#(#LabelSpec
#'name:' 'timeLabel'
#'layout:' #(#LayoutFrame -79 1 1 0.0 -1 1.0 -1 1.0)
#'labelChannel:' #valueOfTimeLabel
#'level:' -1
#'adjust:' #right
)
)
)
)
)
)
)
! !
!ToolApplicationModel class methodsFor:'menu specs'!
menuAbout
<resource: #menu>
^
#(#Menu
#(
#(#MenuItem
#'label:' 'About Smalltalk/X...'
#'translateLabel:' true
#'value:' #openAbout
#'activeHelpKey:' #aboutSTX
)
#(#MenuItem
#'label:' '-'
)
#(#MenuItem
#'label:' 'About This Application...'
#'translateLabel:' true
#'value:' #openAboutThisApplication
#'activeHelpKey:' #aboutThisAppliaction
)
) nil
nil
)
"Modified: / 30.1.1998 / 00:03:11 / cg"
!
menuHelp
<resource: #menu>
^
#(#Menu
#(
#(#MenuItem
#'label:' 'Open Documentation'
#'translateLabel:' true
#'value:' #openTutorial
#'activeHelpKey:' #helpTutorial
#'enabled:' #valueOfHavingTutorial
)
#(#MenuItem
#'label:' '-'
)
#(#MenuItem
#'label:' 'Show Help Texts'
#'translateLabel:' true
#'activeHelpKey:' #helpShowHelp
#'indication:' #'showHelp:'
)
) nil
nil
)
! !
!ToolApplicationModel class methodsFor:'resources'!
copyIcon
"Generated by the Image Editor"
"
ImageEditor openOnClass:self andSelector:#copyIcon
"
<resource: #image>
^Icon
constantNamed:#'ToolApplicationModel copyIcon'
ifAbsentPut:[(Depth2Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@@AUUUW@@@A???>@@@A???>O@@A???>@@@A???>@@@@@@?>@EUUU\?>@G???8?>@G???8?>@G???8?>@G???8?>@G???8?>IG???8?>@G???8**MG???8@@@G???8@@KG???8@@@G???8@@@G???8@@HN***(@@@@@@@@@@@') ; colorMapFromArray:#[0 0 0 255 255 255 127 127 127 170 170 170]; mask:((Depth1Image new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@_?<@_?<@_?<@_?<@_?<@_?<???<???<???<???<???<???<???<???<???<???<??8@??8@??8@??8@??8@??8@') ; yourself); yourself]!
cutIcon
"Generated by the Image Editor"
"
ImageEditor openOnClass:self andSelector:#cutIcon
"
<resource: #image>
^Icon
constantNamed:#'ToolApplicationModel cutIcon'
ifAbsentPut:[(Depth4Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#(4 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@@@@@@@@DQDQDP0AL@@L@@@SL3L3CBL @B0@@AL3L3LL0B@@3@@@D3L3L0KB@@KB@@@SL3L3LL0@CL@@@AL3L3L0KB@,H@@@D3L3L3LL0L0@@@@SL3L3L0K@0 @@@AL3L3L3LL3@@@@@D3L3L3L03L@@@@@SL3L3L0CL0@@@@AL3L3L3@,CB@@@@D3L3L3@L0L0@@@@2H"H H"0 KBH @@@@@@KL3@@L3LH@@@@@CBCB@@K@K@@@@@@L@LH@@,@L@@@@@@0@0 @B0@0@@@@@CBC@@@C@K@@@@@@@3@@@@@3@@@@@@@@@@@@@@@@b') ; colorMapFromArray:#[0 0 0 255 255 255 127 127 127 170 170 170 255 0 0 0 255 0 0 0 255 0 255 255 255 255 0 255 0 255 127 0 0 0 127 0 0 0 127 0 127 127 127 127 0 127 0 127]; mask:((Depth1Image new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'_?<@_=\P_=<0_=,0_=50_>5 _>; _?[@_?[@_?.@_?.@_?N@_?[@_>[@_;;8_75<@F1,@D1$@D1$@F ,@C@X@@@@') ; yourself); yourself]!
deleteIcon
"Generated by the Image Editor"
"
ImageEditor openOnClass:self andSelector:#deleteIcon
"
<resource: #image>
^Icon
constantNamed:#'ToolApplicationModel deleteIcon'
ifAbsentPut:[(Depth4Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#(4 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@@@@@@@@DQDQDQDQL@@@@@@SL3L3L3L @@@@@AL3L3L3L2@@@@@@D3L3L3L3H@@@H@@SL3L3L3L @@H@@AL3L3L3L2@@@@@@D3L3L3L3@@@@@@@SL3L3L0@ @@@ @AL3L3L3@@@@@@@@D3L3L3L@D@@@H@@SL3L3L0@QL3H @AL3L3L3@A@3LB@@D3L3L3L@DC@0H@@2H"H"H @PLC@ @@@@@@@@@A@0LB@@@@@@@@@@DC@0H@@@@@@@@@@PLC@ @@@@@@@@@A@0LB@@@@@@@@@@DS@2H@@@@@@@@@HAL3HB@@@@@@@@@@@@@@@b') ; colorMapFromArray:#[0 0 0 255 255 255 127 127 127 170 170 170 255 0 0 0 255 0 0 0 255 0 255 255 255 255 0 255 0 255 127 0 0 0 127 0 0 0 127 0 127 127 127 127 0 127 0 127]; mask:((Depth1Image new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'_?<@_?<@_?<P_?<P_?<X_?<X_?<H_?0H_?O<_?XL_?_<_?_<_?_<_?_<_?_<_?_<@@_<@@_<@@_<@@_<@@_<@@G0') ; yourself); yourself]!
desktopIcon
^Icon
constantNamed:#'ToolApplicationModel desktopIcon'
ifAbsentPut:
[
|desktopIcon|
desktopIcon := self stxIcon.
desktopIcon magnifiedBy: Display preferredIconSize/desktopIcon extent
]
!
downIcon
"Generated by the Image Editor"
"
ImageEditor openOnClass:self andSelector:#downIcon
"
<resource: #image>
^Icon
constantNamed:#'ToolApplicationModel downIcon'
ifAbsentPut:[(Depth2Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'UUT@AUUPUUT*%UUPUUT*%UUPUUT*%UUPUUT*%UUPUUT*%UUPUUT*%UUPUUT*%UUPUUT*%UUPUUT*%UUPUUT*%UUPUUT*%UUPUUT*%UUPUUT*%UUPUUT*%UUPUT@*$AUPUT***%UPUU***UUPUUZ*)UUPUUV*%UUPUUU*UUUPUUUYUUUP') ; colorMapFromArray:#[255 255 255 0 0 0 0 127 0 255 0 0]; mask:((Depth1Image new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@O0@@O0@@O0@@O0@@O0@@O0@@O0@@O0@@O0@@O0@@O0@@O0@@O0@@O0@@O0@A?>@A?>@@?<@@_8@@O0@@G @@C@@') ; yourself); yourself]
!
downRightIcon
"Generated by the Image Editor"
"
ImageEditor openOnClass:self andSelector:#downRightIcon
"
<resource: #image>
^Icon
constantNamed:#'ToolApplicationModel downRightIcon'
ifAbsentPut:[(Depth2Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'UUUUUUUPP@EUUUUPR*UUUUUPR*UUUUUPR*UUUUUPR*UUUUUPR*UUUUUPR*UUUUUPR*UUUUUPR*UUUUUPR*UUTEUPR*UUT!!UPR*UUT(UPR*P@@*EPR*****!!PR*****(PR*****)PR*****%PQUUUU*UPUUUUT)UPUUUUT%UPUUUUTUUP') ; colorMapFromArray:#[255 255 255 0 0 0 0 127 0 255 0 0]; mask:((Depth1Image new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@_ @@_ @@_ @@_ @@_ @@_ @@_ @@_ @@_ @@_ L@_ N@_ O@_?? _??0_??8_??8_??0_?? @@O@@@N@@@L@') ; yourself); yourself]
!
leftDownIcon
"Generated by the Image Editor"
"
ImageEditor openOnClass:self andSelector:#leftDownIcon
"
<resource: #image>
^Icon
constantNamed:#'ToolApplicationModel leftDownIcon'
ifAbsentPut:[(Depth2Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'UUUUUUUPU@@@@@@PUJ****)PUJ****)PUJ****)PUJ****)PUJ)UUUUPUJ)UUUUPUJ)UUUUPUJ)UUUUPUJ)UUUUPUJ)UUUUPUJ)UUUUPUJ)UUUUP@J*@UUUPJ**)UUUPR**%UUUPT**UUUUPUJ)UUUUPUR%UUUUPUTUUUUUPUUUUUUUP') ; colorMapFromArray:#[255 255 255 0 0 0 0 127 0 255 0 0]; mask:((Depth1Image new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@G??8G??8G??8G??8G??8G??8G8@@G8@@G8@@G8@@G8@@G8@@G8@@??@@??@@_>@@O<@@G8@@C0@@A @@@@@@') ; yourself); yourself]
!
leftIcon
"Generated by the Image Editor"
"
ImageEditor openOnClass:self andSelector:#leftIcon
"
<resource: #image>
^Icon
constantNamed:#'ToolApplicationModel leftIcon'
ifAbsentPut:[(Depth2Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'UUUUUUUPUUUUUUUPUUUUUUUPUUUUUUUPUUUUUUUPUTUUUUUPURUUUUUPUJUUUUUPT*P@@@@PR******PJ******PZ******PV******PU*UUUUUPUZUUUUUPUVUUUUUPUUUUUUUPUUUUUUUPUUUUUUUPUUUUUUUPUUUUUUUPUUUUUUUP') ; colorMapFromArray:#[255 255 255 0 0 0 0 127 0 255 0 0]; mask:((Depth1Image new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@@@@@@@@@@@@A @@C @@G @@O??<_??<???<???<_??<O??<G @@C @@A @@@@@@@@@@@@@@@@@@@@@@') ; yourself); yourself]
!
loadIcon
"Generated by the Image Editor"
"
ImageEditor openOnClass:self andSelector:#loadIcon
"
<resource: #image>
^Icon
constantNamed:#'ToolApplicationModel loadIcon'
ifAbsentPut:[(Depth2Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'UUUUUUUPUUUUU?UPUUUUW*5PU???>*/PU:****)PUUUUUUZPP@@@@@EPS?????&PS?????%PS?????&PS?????%PT?????9PT?????9PT?????9PT?????9PT?????9PT?????9PUO????>PUO????>PUO????>PU:*****PUUUUUUUP') ; colorMapFromArray:#[255 255 255 0 0 0 127 127 127 170 170 170]; mask:((Depth1Image new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@G@@@O G??8O??<O??<_??<???<???<???<???<???<_??<_??<_??<_??<_??<_??<O??<O??<O??<O??<O??<') ; yourself); yourself]
!
menuIcon
^Icon
constantNamed:#'ToolApplicationModel menuIcon'
ifAbsentPut:
[
|menuIcon|
menuIcon := self stxIcon.
menuIcon magnifiedBy: MenuPanel defaultFont height/menuIcon height
]
!
newIcon
"Generated by the Image Editor"
"
ImageEditor openOnClass:self andSelector:#newIcon
"
<resource: #image>
^Icon
constantNamed:#'ToolApplicationModel newIcon'
ifAbsentPut:[(Depth2Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@AUUUUP@@A????2@@A????2 @A????0@@A?????8@A?????8@A?????8@A?????8@A?????8@A?????8@A?????8@A?????8@A?????8@A?????8@A?????8@A?????8@A?????8@A?????8@A?????8@C*****(@@@@@@@@@') ; colorMapFromArray:#[0 0 0 255 255 255 127 127 127 170 170 170]; mask:((Depth1Image new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'_?>@_??@_?? _??0_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8') ; yourself); yourself]
!
pasteIcon
"Generated by the Image Editor"
"
ImageEditor openOnClass:self andSelector:#pasteIcon
"
<resource: #image>
^Icon
constantNamed:#'ToolApplicationModel pasteIcon'
ifAbsentPut:[(Depth4Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#(4 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@KLH@@@@@@@@@@@CL3@@@@@@@@@@@CBH"0@@@@@@@@QD,3L3BDQ@@@@@ADQDQDQDQD@@@@@DQDQDQDQDP@@@@@@@@@@DQDQ@ADQDQDQDS@QDQD@D3L3L3L3HADQDP@SL3L3L3L DQDQ@AL3L3L3L2@QDQD@D3L3L3L3HADQDP@SL3L3L3L DQDQ@AL3L3L3L2@QDQD@D3L3L3L3HADQDP@SL3L3L3L DQDQ@AL3L3L3L2@QDQD@D3L3L3L3HADQDP@SL3L3L3L DQDQ@AL3L3L3L2@@@@@@L"H"H"H"H@@@@@@@@@@@@@@@@@@@@b') ; colorMapFromArray:#[0 0 0 255 255 255 127 127 127 170 170 170 255 0 0 0 255 0 0 0 255 0 255 255 255 255 0 255 0 255 127 0 0 0 127 0 0 0 127 0 127 127 127 127 0 127 0 127]; mask:((Depth1Image new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@<@@@<@@??<@??<@??<@??<???<???<???<???<???<???<???<???<???<???<???<???<???<???<??8@??8@') ; yourself); yourself]!
rightIcon
"Generated by the Image Editor"
"
ImageEditor openOnClass:self andSelector:#rightIcon
"
<resource: #image>
^Icon
constantNamed:#'ToolApplicationModel rightIcon'
ifAbsentPut:[(Depth2Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'UUUUUUUPUUUUUUUPUUUUUUUPUUUUUUUPUUUUUUUPUUUUUEUPUUUUUIUPUUUUUJUP@@@@@J%PJ*****)PJ******PJ******PJ*****)PEUUUUZ%PUUUUUJUPUUUUUIUPUUUUUEUPUUUUUUUPUUUUUUUPUUUUUUUPUUUUUUUPUUUUUUUP') ; colorMapFromArray:#[255 255 255 0 0 0 0 127 0 255 0 0]; mask:((Depth1Image new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@@@@@@@@@@@@@@F@@@G@@@G ???0???8???<???<???8???0@@G @@G@@@F@@@@@@@@@@@@@@@@@@@@@') ; yourself); yourself]
!
saveIcon
"Generated by the Image Editor"
"
ImageEditor openOnClass:self andSelector:#saveIcon
"
<resource: #image>
^Icon
constantNamed:#'ToolApplicationModel saveIcon'
ifAbsentPut:[(Depth2Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'AL3L3L@PM3L3L0?PML3L3L=PM3L3L0=PML3L3L?PM3L3L0?PML3L3L?PM3L3L0?PML3L3L?PM3L3L0?PML3L3L?PM@@@@@?PO??????PO??????PO??????PO=UUUU?PO=???[?PO=5O?Z?PO=6O?Z?PO=6O?Z?PO=0O?Z?P5U***U5P') ; colorMapFromArray:#[255 255 255 0 0 0 127 127 127 170 170 170]; mask:((Depth1Image new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'???<???<???<???<???<???<???<???<???<???<???<???<???<???<???<???<???<???<???<???<???<???8') ; yourself); yourself]
!
startIcon
"Generated by the Image Editor"
"
ImageEditor openOnClass:self andSelector:#startIcon
"
<resource: #image>
^Icon
constantNamed:#'ToolApplicationModel startIcon'
ifAbsentPut:[(Depth4Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#(4 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@@@@@@@@@N8@@@@@@@@@@@@N<^@@@@@@@@@@@@;.;.;.;.@@@@@@C/G @@@@8^@@@@@N<^@@@@@A@@@@@@;18@@@@@D@@@@@C.;.;.; @P@@@@@N<^@@@@@@@@@@@@;18@@@C!!G.@@@@C/G @@@@G>@@@@@N;.;.; @_8@@@@@;18@@@@A? @@@@C/G @@@@G>@@@@@N<^@@@@@_8@@@@@;.;.;.@A? @@@@C/G @@@@G>@@@@@N<^@@@@@_8@@@@@;18@@@@@@@@@@@C.; @@@@DQ@@@@C ; 8@@@A&X@@@C 8@8N@@@"H"@@@b') ; colorMapFromArray:#[0 0 0 255 255 255 255 0 0 0 255 0 0 0 255 0 255 255 255 255 0 255 0 255 127 0 0 0 127 0 0 0 127 0 127 127 127 127 0 127 0 127 127 127 127 170 170 170]; mask:((Depth1Image new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@AC@DAG DAG?<@G N@G N@G N@G?.@G N@G _@G _@G?_@G _@G _@G _@G?_@G ? G!!?0G!!?0G!!.PKQNPT(_@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@a') ; yourself); yourself]
!
stxIcon
"Generated by the Image Editor"
"
ImageEditor openOnClass:self andSelector:#stxIcon
"
<resource: #image>
^Icon
constantNamed:#'ToolApplicationModel stxIcon'
ifAbsentPut:[(Depth1Image new) width: 48; height: 48; photometric:(#palette); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@G@@@A @@O @@C@@@O @@F@@@O @@\@@@O @@T@@@OP@A8@@@G0@@0@@@G0@E @@@C8@G@@@@A8@J@@@@A4@<@@@@A<@(@@@@@>AP@@@@@MB @@@@@_E@@@@@@N.@@@@@@O4@@@@@@C$@@@@@@E8@@@@@@C8@@@@@@G0@@@@@@OX@@@@@@_8@@@@@@<\@@@@@A<N@@@@@CXO@@@@@K0C@@@@@O C @@@@?@A @@@A<@A0@@@C<@@0@@@O8@@X@@@_0@@T@@@? @@L@@@? @@F@@@?@@@C@@@^@@@A@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@') ; colorMapFromArray:#[25 25 25 0 204 51]; yourself]!
upIcon
"Generated by the Image Editor"
"
ImageEditor openOnClass:self andSelector:#upIcon
"
<resource: #image>
^Icon
constantNamed:#'ToolApplicationModel upIcon'
ifAbsentPut:[(Depth2Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'UUUQUUUPUUUJUUUPUUT*%UUPUUR*)UUPUUJ**UUPUT***%UPUTV*%UUPUUT*%UUPUUT*%UUP_UT*%UUP_UT*%UUP_5T*%UUPWUT*%UUPWWT*%UUPWUT*%UUPUUT*%UUPUUT*%UUPUUT*%UUPUUT*%UUPUUT*%UUPUUT*%UUPUUTUUUUP') ; colorMapFromArray:#[255 255 255 0 0 0 0 127 0 255 0 0]; mask:((Depth1Image new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@C@@@G @@O0@@_8@@?<@A?>@A?>@@O0@@O0@@O0@@O0@@O0@@O0@@O0@@O0@@O0@@O0@@O0@@O0@@O0@@O0@@O0@') ; yourself); yourself]
! !
!ToolApplicationModel class methodsFor:'startup / release'!
preSnapshot
clipboard := nil
!
uninitialize
showHelp := history := clipboard := nil
! !
!ToolApplicationModel methodsFor:'aspects'!
valueOfCanCopy
|holder|
(holder := builder bindingAt:#valueOfCanCopy) isNil ifTrue:[
builder aspectAt:#valueOfCanCopy put:(holder := false asValue).
].
^ holder
!
valueOfCanCut
|holder|
(holder := builder bindingAt:#valueOfCanCut) isNil ifTrue:[
builder aspectAt:#valueOfCanCut put:(holder := false asValue).
].
^ holder
!
valueOfCanPaste
|holder|
(holder := builder bindingAt:#valueOfCanPaste) isNil ifTrue:[
builder aspectAt:#valueOfCanPaste put:(holder := false asValue).
].
^ holder
!
valueOfCanUndo
|holder|
(holder := builder bindingAt:#valueOfCanUndo) isNil ifTrue:[
builder aspectAt:#valueOfCanUndo put:(holder := false asValue).
].
^ holder
!
valueOfEnablingCommitButtons
|holder|
(holder := builder bindingAt:#valueOfEnablingCommitButtons) isNil ifTrue:[
builder aspectAt:#valueOfEnablingCommitButtons put:(holder := false asValue).
].
^ holder
!
valueOfHavingClipboard
|holder|
(holder := builder bindingAt:#valueOfHavingClipboard) isNil ifTrue:[
builder aspectAt:#valueOfHavingClipboard put:(holder := self class clipboard notNil asValue).
].
^ holder
!
valueOfHavingTutorial
|holder|
(holder := builder bindingAt:#valueOfHavingTutorial) isNil ifTrue:[
builder aspectAt:#valueOfHavingTutorial put:(holder := (self class implements: #openTutorial) asValue).
].
^ holder
!
valueOfInfoLabel
|holder|
(holder := builder bindingAt:#valueOfInfoLabel) isNil ifTrue:[
builder aspectAt:#valueOfInfoLabel put:(holder := ValueHolder new).
].
^ holder
!
valueOfTimeLabel
|holder|
(holder := builder bindingAt:#valueOfTimeLabel) isNil ifTrue:[
builder aspectAt:#valueOfTimeLabel put:(holder := ValueHolder new).
].
^ holder
! !
!ToolApplicationModel methodsFor:'clipboard'!
clipboard
^self class clipboard
!
clipboard: anEditObject
self class clipboard: anEditObject.
self valueOfHavingClipboard value: anEditObject notNil
! !
!ToolApplicationModel methodsFor:'help'!
defaultInfoLabel
^''
!
openAbout
"show an about box"
|box|
box := AboutBox new.
box autoHideAfter:10 with:[].
box showAtCenter
!
openAboutThisApplication
"show an about this application box"
|rev box|
rev := ''.
self class revision notNil ifTrue: [rev := ' (rev: ', self class revision printString, ')'].
box := AboutBox title:
'\The application\\' withCRs
, self class name asBoldText, rev
, '\\has been designed and implemented by: \' withCRs
, ((self class authorLinesForAboutBox collect:[:l | '- ' , l]) asStringWith:$\) withCRs
, '\\' withCRs.
box label:'About This Application'.
box autoHideAfter:10 with:[].
box showAtCenter.
!
openTutorial: aHTMLFilename
HTMLDocumentView openFullOnDocumentationFile: aHTMLFilename
!
showHelp
"Answer whether showing help is turned on/off"
|currentActiveHelp|
currentActiveHelp := ActiveHelp currentHelpListener.
^self class showHelp
and: [currentActiveHelp notNil and: [currentActiveHelp interestedIn: self builder window]]
!
showHelp: aValue
"toggle showing help"
(self class showHelp: aValue)
ifTrue: [ActiveHelp startFor: self]
ifFalse: [ActiveHelp stopFor: self. self updateInfoLabel]
!
showHelp:aHelpText for:view
"display aHelpText in the info label or if present detour to masterApplication."
self showHelp ifFalse: [^true].
self masterApplication notNil
ifTrue:
[
^masterApplication showHelp: aHelpText for:view
]
ifFalse:
[
aHelpText isNil
ifTrue: [self updateInfoLabel]
ifFalse: [self valueOfInfoLabel value: (aHelpText asString printString upTo: Character cr)].
^true
]
!
updateInfoLabel
self valueOfInfoLabel value: self defaultInfoLabel
! !
!ToolApplicationModel methodsFor:'history'!
addToHistory: aHistoryEntry
aHistoryEntry key size = 0 ifTrue: [^nil].
self history remove: (self history detect: [:histEntry| histEntry key = aHistoryEntry key] ifNone: nil) ifAbsent: nil.
self history addFirst: aHistoryEntry.
[self history size > self class historyMaxSize] whileTrue: [self history removeLast]
!
emptyHistory
^self history removeAll
!
history
^self class getHistory
!
historyEntries
^self history collect: [:asso| asso key]
!
menuHistory
|menu a|
menu := Menu new receiver: self.
(self history collect: [:histEntry| histEntry value]) asSet asOrderedCollection do:
[:historyEntryType|
menu addItemGroup: ((a := self history select: [:histEntry| histEntry value = historyEntryType]) collect: [:histEntry| MenuItem new label: histEntry key printString; value: histEntry value; argument: histEntry key; activeHelpKey: #historyMenuItem]).
].
menu addItem: (MenuItem new label: 'Empty History'; value: #emptyHistory; activeHelpKey: #historyEmptyMenu).
^menu
!
removeFromHistory: aHistoryEntry
self history remove: (self history detect: [:histEntry| histEntry key = aHistoryEntry key] ifNone: nil) ifAbsent: nil.
[self history size > self class historyMaxSize] whileTrue: [self history removeLast]
! !
!ToolApplicationModel methodsFor:'queries'!
preferredExtent
"preferred extent of my window; top/main menu and top toolbar (named by 'menuToolbarView')
will be considered"
|window menu menuToolbarView preferredExtentOfWindow|
window := self builder window.
menu := window subViews first.
menuToolbarView := builder componentAt: #menuToolbarView.
preferredExtentOfWindow := window extent.
menu class = MenuPanel ifTrue: [preferredExtentOfWindow := preferredExtentOfWindow max: menu preferredExtent].
menuToolbarView notNil ifTrue: [preferredExtentOfWindow := preferredExtentOfWindow max: menuToolbarView preferredExtent].
^window minExtent max: (preferredExtentOfWindow min: window maxExtent)
! !
!ToolApplicationModel methodsFor:'startup / release'!
allButOpenInterface:aSymbol
super allButOpenInterface:aSymbol.
builder window extent: self preferredExtent.
builder window label: self class label.
^builder
!
close
self uninitialize.
super close
!
closeRequest
self uninitialize.
super closeRequest
!
postOpenWith:aBuilder
super postOpenWith:aBuilder.
self class showHelp ifTrue: [ActiveHelp startFor: self].
self updateInfoLabel.
!
reOpen
self close.
self class open
!
removeAllTemporalViews
self builder namedComponents keys copy do:
[:comp|
(comp includesString: '_Temporal') ifTrue: [self builder namedComponents removeKey: comp]
]
!
startClockOnTimedBlock: aBlock
timeBlock := aBlock.
aBlock value.
!
uninitialize
self showHelp ifTrue: [ActiveHelp stopFor: self].
Processor removeTimedBlock:timeBlock.
timeBlock := nil.
! !
!ToolApplicationModel class methodsFor:'documentation'!
version
^ '$Header: /cvs/stx/stx/libview2/ToolApplicationModel.st,v 1.44 1998-02-26 19:07:39 tz Exp $'
! !