ToolApplicationModel.st
author tz
Tue, 27 Jan 1998 17:51:19 +0100
changeset 779 fef14d43d5e1
parent 778 251895a3f266
child 782 5b8c4cf62cb5
permissions -rw-r--r--
"self halt" forgotten

"
 COPYRIGHT (c) 1997 by eXept Software AG / Thomas Zwick
              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:'activeHelp timeBlock'
	classVariableNames:''
	poolDictionaries:''
	category:'Interface-Advanced-Tools'
!

ToolApplicationModel class instanceVariableNames:'history clipboard'

"
 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 / Thomas Zwick
              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,
    about menu, help menu etc.
    See concrete subclasses for examples.

    [author:]
        Thomas Zwick
"
!

history
    "Created: / 10.1.1998 / 11:01:21 / tz"
! !

!ToolApplicationModel class methodsFor:'accessing'!

author

    ^((((self class withAllSuperclasses detect: [:metacls| metacls implements:#documentation]))
        compiledMethodAt: #documentation) source readStream upToAll: '[author:]'; nextLine; nextLine) trimBlanks
  
!

label

    |label|
    label := ''.
    self name do:
    [:c|
        c isUppercase ifTrue: [label := label, $ ].
        label := label, c
    ].
    ^label trimBlanks
! !

!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:#(

#aboutSTX
'Opens an InfoBox about running ST/X.'

#aboutThisAppliaction
'Opens an InfoBox about release and author of current application.'

#fileExit
'Exits current application.'

#helpClassDocumentation
'Opens a HTML-browser with a class documentation for current application.'

#helpProgrammersGuide
'Opens a HTML-browser with a programmers guide.'

#helpShowHelp
'Toggles on/off displaying help texts.'

#helpTutorial
'Opens a HTML-browser with a tutorial for beginners.'

)
! !

!ToolApplicationModel class methodsFor:'history'!

getHistory

    history isNil ifTrue: [history := OrderedCollection new].
    ^history

!

historyMaxSize

    ^10

! !

!ToolApplicationModel class methodsFor:'interface specs'!

menuAbout
    "this window spec was automatically generated by the ST/X MenuEditor"

    "do not manually edit this - the builder may not be able to
     handle the specification if its corrupted."

    "
     MenuEditor new openOnClass:ToolApplicationModel andSelector:#menuAbout
     (Menu new fromLiteralArrayEncoding:(ToolApplicationModel menuAbout)) startUp
    "

    <resource: #menu>

    ^
     
       #(#Menu
          
           #(
             #(#MenuItem
                #'label:' 'About Smalltalk/X...'
                #'value:' #openAbout
                #'activeHelpKey:' #aboutSTX
            )
             #(#MenuItem
                #'label:' '-'
            )
             #(#MenuItem
                #'label:' 'About This Application...'
                #'value:' #openAboutThisApplication
                #'activeHelpKey:' #aboutThisAppliaction
            )
          ) nil
          nil
      )
!

menuHelp
    "this window spec was automatically generated by the ST/X MenuEditor"

    "do not manually edit this - the builder may not be able to
     handle the specification if its corrupted."

    "
     MenuEditor new openOnClass:ToolApplicationModel andSelector:#menuHelp
     (Menu new fromLiteralArrayEncoding:(ToolApplicationModel menuHelp)) startUp
    "

    <resource: #menu>

    ^
     
       #(#Menu
          
           #(
             #(#MenuItem
                #'label:' 'Tutorial'
                #'value:' #openTutorial
                #'activeHelpKey:' #helpTutorial
            )
             #(#MenuItem
                #'label:' 'Programmer''s Guide'
                #'value:' #openProgrammersGuide
                #'activeHelpKey:' #helpProgrammersGuide
            )
             #(#MenuItem
                #'label:' '-'
            )
             #(#MenuItem
                #'label:' 'Class Documentation'
                #'value:' #openClassDocumentation
                #'activeHelpKey:' #helpClassDocumentation
            )
             #(#MenuItem
                #'label:' '-'
            )
             #(#MenuItem
                #'label:' 'Show Help'
                #'value:' #'activeHelp:'
                #'activeHelpKey:' #helpShowHelp
                #'indication:' #activeHelp
            )
          ) nil
          nil
      )
!

menuSettings
    "this window spec was automatically generated by the ST/X MenuEditor"

    "do not manually edit this - the builder may not be able to
     handle the specification if its corrupted."

    "
     MenuEditor new openOnClass:ToolApplicationModel andSelector:#menuSettings
     (Menu new fromLiteralArrayEncoding:(ToolApplicationModel menuSettings)) startUp
    "

    <resource: #menu>

    ^
     
       #(#Menu
          
           #(
             #(#MenuItem
                #'label:' 'Language'
                #'value:' #languageSetting
            )
          ) nil
          nil
      )
!

windowSpecForCommit
    "this window spec was automatically generated by the ST/X UIPainter"

    "do not manually edit this - the painter/builder may not be able to
     handle the specification if its corrupted."

    "
     UIPainter new openOnClass:ToolApplicationModel andSelector:#windowSpecForCommit
     ToolApplicationModel new openInterface:#windowSpecForCommit
    "

    <resource: #canvas>

    ^
     
       #(#FullSpec
          #'window:' 
           #(#WindowSpec
              #'name:' 'unnamed canvas'
              #'layout:' #(#LayoutFrame 325 0 361 0 624 0 420 0)
              #'label:' 'unnamed canvas'
              #'min:' #(#Point 100 22)
              #'max:' #(#Point 1152 900)
              #'bounds:' #(#Rectangle 325 361 625 421)
              #'usePreferredExtent:' false
          )
          #'component:' 
           #(#SpecCollection
              #'collection:' 
               #(
                 #(#ActionButtonSpec
                    #'name:' 'cancelButton'
                    #'layout:' #(#LayoutFrame 5 0 0 0 -2 0.5 0 1)
                    #'label:' 'Cancel'
                    #'tabable:' true
                    #'model:' #cancel
                    #'enableChannel:' #valueOfEnablingCommitButtons
                )
                 #(#ActionButtonSpec
                    #'name:' 'okButton'
                    #'layout:' #(#LayoutFrame 2 0.5 0 0.0 -5 1 0 1.0)
                    #'label:' 'OK'
                    #'tabable:' true
                    #'model:' #accept
                    #'enableChannel:' #valueOfEnablingCommitButtons
                )
              )
          )
      )
!

windowSpecForCommitWithoutChannels
    "this window spec was automatically generated by the ST/X UIPainter"

    "do not manually edit this - the painter/builder may not be able to
     handle the specification if its corrupted."

    "
     UIPainter new openOnClass:ToolApplicationModel andSelector:#windowSpecForCommitWithoutChannels
     ToolApplicationModel new openInterface:#windowSpecForCommitWithoutChannels
    "

    <resource: #canvas>

    ^
     
       #(#FullSpec
          #'window:' 
           #(#WindowSpec
              #'name:' 'unnamed canvas'
              #'layout:' #(#LayoutFrame 418 0 386 0 717 0 445 0)
              #'label:' 'unnamed canvas'
              #'min:' #(#Point 100 22)
              #'max:' #(#Point 1152 900)
              #'bounds:' #(#Rectangle 418 386 718 446)
              #'usePreferredExtent:' false
          )
          #'component:' 
           #(#SpecCollection
              #'collection:' 
               #(
                 #(#ActionButtonSpec
                    #'name:' 'cancelButton'
                    #'layout:' #(#LayoutFrame 5 0 0 0 -2 0.5 0 1)
                    #'label:' 'Cancel'
                    #'tabable:' true
                    #'model:' #cancel
                )
                 #(#ActionButtonSpec
                    #'name:' 'okButton'
                    #'layout:' #(#LayoutFrame 2 0.5 0 0.0 -5 1 0 1.0)
                    #'label:' 'OK'
                    #'tabable:' true
                    #'model:' #accept
                )
              )
          )
      )
!

windowSpecForInfoBar
    "this window spec was automatically generated by the ST/X UIPainter"

    "do not manually edit this - the painter/builder may not be able to
     handle the specification if its corrupted."

    "
     UIPainter new openOnClass:ToolApplicationModel andSelector:#windowSpecForInfoBar
     ToolApplicationModel new openInterface:#windowSpecForInfoBar
    "

    <resource: #canvas>

    ^
     
       #(#FullSpec
          #'window:' 
           #(#WindowSpec
              #'name:' 'Image Editor'
              #'layout:' #(#LayoutFrame 173 0 418 0 672 0 763 0)
              #'label:' 'Image Editor'
              #'min:' #(#Point 400 320)
              #'max:' #(#Point 1152 900)
              #'bounds:' #(#Rectangle 173 418 673 764)
              #'menu:' #menu
              #'usePreferredExtent:' false
          )
          #'component:' 
           #(#SpecCollection
              #'collection:' 
               #(
                 #(#LabelSpec
                    #'name:' 'infoLabel'
                    #'layout:' #(#LayoutFrame 0 0 0 0.0 -80 1 0 1.0)
                    #'labelChannel:' #valueOfInfoLabel
                    #'level:' 1
                    #'adjust:' #left
                )
                 #(#LabelSpec
                    #'name:' 'timeLabel'
                    #'layout:' #(#LayoutFrame -80 1 0 0.0 0 1.0 0 1.0)
                    #'labelChannel:' #valueOfTimeLabel
                    #'level:' 1
                    #'adjust:' #right
                )
              )
          )
      )
! !

!ToolApplicationModel class methodsFor:'resources'!

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'); colorMap:((OrderedCollection new add:(Color white); add:(Color black); add:(Color red:0.0 green:49.9962 blue:0.0); add:(Color red:100.0 green:0.0 blue:0.0); yourself)); 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]!

downLeftIcon
    "Generated by the Image Editor"
    "
    ImageEditor openOnClass:self andSelector:#downLeftIcon
    "

    <resource: #image>

    ^Icon
        constantNamed:#'ToolApplicationModel downLeftIcon'
        ifAbsentPut:[(Depth2Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'UUUUUUUPUUUUU@@PUUUUUJ)PUUUUUJ)PUUUUUJ)PUUUUUJ)PUUUUUJ)PUUUUUJ)PUUUUUJ)PUUUUUJ)PUUAUUJ)PUT%UUJ)PUR%UUJ)PUJ$@@J)PT*****)PR*****)PV*****)PU*****)PUZ%UUUUPUV%UUUUPUU%UUUUPUUUUUUUP'); colorMap:((OrderedCollection new add:(Color white); add:(Color black); add:(Color red:0.0 green:49.9962 blue:0.0); add:(Color red:100.0 green:0.0 blue:0.0); yourself)); mask:((Depth1Image new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@G8@@G8@@G8@@G8@@G8@@G8@@G8@@G8@@G8@0G8A0G8C0G8G??8O??8_??8_??8O??8G??8C0@@A0@@@0@@'); 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'); colorMap:((OrderedCollection new add:(Color white); add:(Color black); add:(Color red:0.0 green:49.9962 blue:0.0); add:(Color red:100.0 green:0.0 blue:0.0); yourself)); 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]!

fileOutIcon
    "Generated by the Image Editor"
    "
    ImageEditor openOnClass:self andSelector:#fileOutIcon
    "

    <resource: #image>

    ^Icon
        constantNamed:#'ToolApplicationModel fileOutIcon'
        ifAbsentPut:[(Depth2Image new) width: 24; height: 24; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@B@@@@@@@B @@@@@@*(@@@@@BB @@@@@BB@@@@@@B@@@@@@@B@@@@@@@B@@@@@@@B@@@@@@@B@@@@@@@@@@@@@@@@@@@@@@@@@@@@D@@AQDEADQAAADDADQA@AD@ADQAAQDEADQAAADDADQAAA@@@PAAAAEE@@DA'); colorMap:((OrderedCollection new add:(Color black); add:(Color white); add:(Color red:0.0 green:49.9962 blue:0.0); add:(Color red:100.0 green:0.0 blue:0.0); yourself)); mask:((Depth1Image new) width: 24; height: 24; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@@@@@@@@A@A.A%BDG2ADI%@$I@SDH@@@H@@@H@@@H@@@H@@@@@@@@@@@Z&KW_7_;[6_;[6_;_7_;[6_;[6L+I[@Q'); yourself); yourself]!

icon

    ^self stxIcon
!

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'); colorMap:((OrderedCollection new add:(Color white); add:(Color black); add:(Color red:0.0 green:49.9962 blue:0.0); add:(Color red:100.0 green:0.0 blue:0.0); yourself)); 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'); colorMap:((OrderedCollection new add:(Color white); add:(Color black); add:(Color red:0.0 green:49.9962 blue:0.0); add:(Color red:100.0 green:0.0 blue:0.0); yourself)); 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]!

leftUpIcon
    "Generated by the Image Editor"
    "
    ImageEditor openOnClass:self andSelector:#leftUpIcon
    "

    <resource: #image>

    ^Icon
        constantNamed:#'ToolApplicationModel leftUpIcon'
        ifAbsentPut:[(Depth2Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'UUUUUUUPUTUUUUUPUR%UUUUPUJ)UUUUPT**UUUUPR**%UUUPJ**)UUUP%Z)UUUUPUJ)UUUUPUJ)UUUUPUJ)UUUUPUJ)UUUUPUJ)UUUUPUJ)UUUUPUJ)UUUUPUJ)@@@@PUJ****)PUJ****)PUJ****)PUJ****)PUEUUUUUPUUUUUUUP'); colorMap:((OrderedCollection new add:(Color white); add:(Color black); add:(Color red:0.0 green:49.9962 blue:0.0); add:(Color red:100.0 green:0.0 blue:0.0); yourself)); mask:((Depth1Image new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@A @@C0@@G8@@O<@@_>@@??@@??@@G8@@G8@@G8@@G8@@G8@@G8@@G8@@G??8G??8G??8G??8G??8G??8@@@@'); 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'); colorMap:(((Array new:4) at:1 put:((Color white)); at:2 put:((Color black)); at:3 put:((Color grey:49.9962)); at:4 put:((Color grey:66.9978)); yourself)); 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]!

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*****(@@@@@@@@@'); colorMap:(((Array new:4) at:1 put:((Color black)); at:2 put:((Color white)); at:3 put:((Color grey:49.9962)); at:4 put:((Color grey:66.9978)); yourself)); 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]!

removeIcon
    "Generated by the Image Editor"
    "
    ImageEditor openOnClass:self andSelector:#removeIcon
    "

    <resource: #image>

    ^Icon
        constantNamed:#'ToolApplicationModel removeIcon'
        ifAbsentPut:[(Depth2Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@BUUUUP@@B/???2@@B+???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*???:(@B+???>(@B/????(@B*****(@@@@@@@@@'); colorMap:(((Array new:4) at:1 put:((Color black)); at:2 put:((Color white)); at:3 put:((Color grey:49.9962)); at:4 put:((Color grey:66.9978)); yourself)); 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]!

reviseAllButtonIcon
    "Generated by the Image Editor"
    "
    ImageEditor openOnClass:self andSelector:#reviseAllButtonIcon
    "

    <resource: #image>

    ^Icon
        constantNamed:#'ToolApplicationModel reviseAllButtonIcon'
        ifAbsentPut:[(Depth2Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'EUUU@@@@UVUY@@@@UY?6@@@@UW0=@@@@UWO=AUUPUWO-@@@@UW>=AUUPEY?6A@@P@BUXUUTP@A @P@DP@IPEUUDP@F@D@ADP@%@DEADP@X@DPQDPBT@DPADPA @DDADPEP@DAADPFP@D@QEPAP@DPQD@@P@DEAT@@@@D@A@@@@@EUU@@'); colorMap:(((Array new:4) at:1 put:((Color white)); at:2 put:((Color black)); at:3 put:((Color grey:49.9962)); at:4 put:((Color grey:66.9978)); yourself)); mask:((Depth1Image new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@A>@@C?@@C?@@C?@@C?@@C?O<C?O<A>?<A ?<CC?<CC?<FC?<FC?<LC?<LC?<XC?<HC?<@C?0@C?0@C?@@C?@'); 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'); colorMap:((OrderedCollection new add:(Color white); add:(Color black); add:(Color red:0.0 green:49.9962 blue:0.0); add:(Color red:100.0 green:0.0 blue:0.0); yourself)); 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]!

runIcon
    "Generated by the Image Editor"
    "
    ImageEditor openOnClass:self andSelector:#runIcon
    "

    <resource: #image>

    ^Icon
        constantNamed:#'ToolApplicationModel runIcon'
        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'); colorMap:((OrderedCollection new add:(Color black); add:(Color white); add:(Color red:100.0 green:0.0 blue:0.0); add:(Color red:0.0 green:100.0 blue:0.0); add:(Color red:0.0 green:0.0 blue:100.0); add:(Color red:0.0 green:100.0 blue:100.0); add:(Color red:100.0 green:100.0 blue:0.0); add:(Color red:100.0 green:0.0 blue:100.0); add:(Color red:49.9962 green:0.0 blue:0.0); add:(Color red:0.0 green:49.9962 blue:0.0); add:(Color red:0.0 green:0.0 blue:49.9962); add:(Color red:0.0 green:49.9962 blue:49.9962); add:(Color red:49.9962 green:49.9962 blue:0.0); add:(Color red:49.9962 green:0.0 blue:49.9962); add:(Color grey:49.9962); add:(Color grey:66.9978); yourself)); mask:((Depth1Image new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@C@D@G D@G?<@G N@G N@G N@G?.@G N@G _@G _@G?_@G _@G _@G _@G?_@G ? G!!?0G!!?0G!!.PKQNPT(_@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@a'); 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'); colorMap:(((Array new:4) at:1 put:((Color white)); at:2 put:((Color black)); at:3 put:((Color grey:49.9962)); at:4 put:((Color grey:66.9978)); yourself)); mask:((Depth1Image new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'???<???<???<???<???<???<???<???<???<???<???<???<???<???<???<???<???<???<???<???<???<???8'); yourself); yourself]
!

searchIcon
    "Generated by the Image Editor"
    "
    ImageEditor openOnClass:self andSelector:#searchIcon
    "

    <resource: #image>

    ^Icon
        constantNamed:#'ToolApplicationModel searchIcon'
        ifAbsentPut:[(Depth2Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@@@@@@@@CV*@MZ(@@@@@@@@@CV*@MZ(@CV*@MZ(@CV*@MZ(@CV*@MZ(@CV*@MZ(@CV*@MZ(@CV*JMZ(@CV(@AZ(@CV(6!!Z(@CV(@AZ(@CV*@MZ(@@@@@@@@@@MZ 5Z@@@@@@@@@@@A(@A(@@@@@@@@@@@M*@M*@@@@@@@@@@'); colorMap:((OrderedCollection new add:(Color black); add:(Color grey:74.5083); add:(Color grey:49.9962); add:(Color white); yourself)); mask:((Depth1Image new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@_<?8_<?8_<?8_<?8_<?8_<?8_<?8_<?8_??8_??8_??8_??8_??8_??8_??8G?? G?? C8_@C8_@G<? G<? '); yourself); yourself]!

stxIcon
    "Generated by the Image Editor"
    "
    ImageEditor openOnClass:self andSelector:#stxIcon
    "

    <resource: #image>

    ^Icon
        constantNamed:#'ToolApplicationModel stxIcon'
        ifAbsentPut:[(Depth2Image new) width: 19; height: 19; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@L@@@@@@@@@@@@@@@T@@D@@AP@APP@AP@@@@@E@E@@@@EA@@@@@TT@C@@@U@@@@@AP@@@@@U@@@@@EA@@L@APA@@@@T@D@@@U@@@@@AT@@D@0@@@@@A@@@@@@@b'); colorMap:((OrderedCollection new add:(Color grey:9.41024); add:(Color red:0.0 green:80.7828 blue:18.8205); add:(Color black); add:(Color white); yourself)); 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*%UUPUUT*%UUPUUT*%UUPUUT*%UUPUUT*%UUPUUT*%UUPUUT*%UUPUUT*%UUPUUT*%UUPUUT*%UUPUUT*%UUPUUT*%UUPUUT*%UUPUUTUUUUP'); colorMap:((OrderedCollection new add:(Color white); add:(Color black); add:(Color red:0.0 green:49.9962 blue:0.0); add:(Color red:100.0 green:0.0 blue:0.0); yourself)); 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]!

upRightIcon
    "Generated by the Image Editor"
    "
    ImageEditor openOnClass:self andSelector:#upRightIcon
    "

    <resource: #image>

    ^Icon
        constantNamed:#'ToolApplicationModel upRightIcon'
        ifAbsentPut:[(Depth2Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'UUUUTUUPUUUUT%UPUUUUT)UPP@@@@*UPR*****%PR*****)PR*****)PR*****%PR*UUU*UPR*UUT)UPR*UUT%UPR*UUTUUPR*UUUUUPR*UUUUUPR*UUUUUPR*UUUUUPR*UUUUUPR*UUUUUPR*UUUUUPR*UUUUUPQUUUUUUPUUUUUUUP'); colorMap:((OrderedCollection new add:(Color white); add:(Color black); add:(Color red:0.0 green:49.9962 blue:0.0); add:(Color red:100.0 green:0.0 blue:0.0); yourself)); 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]! !

!ToolApplicationModel methodsFor:'accessing - views'!

menuToolbarView

    ^builder componentAt: #menuToolbarView
!

preferredExtent
    "preferred extent of my window; top menu and top toolbar (named by 'menuToolbar')
     will be considered"

    |window menuPanel menuToolbarView preferredExtentOfWindow|

    window          := self builder window. 
    menuPanel       := window subViews first.
    menuToolbarView := self menuToolbarView.

    preferredExtentOfWindow := window extent.
    menuPanel class = MenuPanel ifTrue: [preferredExtentOfWindow := preferredExtentOfWindow max: menuPanel preferredExtent].
    menuToolbarView notNil      ifTrue: [preferredExtentOfWindow := preferredExtentOfWindow max: menuToolbarView preferredExtent].

    ^window minExtent max: (preferredExtentOfWindow min: window maxExtent)
! !

!ToolApplicationModel methodsFor:'action - settings'!

languageSetting 
    "open a dialog on language related settings"

    |listOfLanguages translatedLanguages switch box languageList flags|

    "
     get list of supported languages from the launchers resources ...
    "
    listOfLanguages := resources at:'LIST_OF_OFFERED_LANGUAGES' default:#('default').
    listOfLanguages := listOfLanguages asOrderedCollection.
    translatedLanguages := listOfLanguages collect:[:lang | |item|
                                        item := resources at:lang.
                                        item isString ifTrue:[
                                            item
                                        ] ifFalse:[
                                            item at:1
                                        ]
                                ].
    flags := listOfLanguages collect:[:lang | |item|
                                        item := resources at:lang.
                                        item isArray ifTrue:[
                                            item at:2
                                        ] ifFalse:[
                                            nil
                                        ]
                                ].
    flags := flags collect:[:nm | nm notNil ifTrue:[Image fromFile:nm] ifFalse:[nil]].

    languageList := translatedLanguages with:flags collect:[:lang :flag |
                                LabelAndIcon icon:flag string:lang.
                        ].

    box := ListSelectionBox title:(resources string:'LANG_MSG') withCRs.
    box label:(resources string:'Language selection').
    box list:languageList.
    box initialText:(Language).
    box action:[:newLanguage |
        self withWaitCursorDo:[
            |fontPref idx language oldLanguage enc answer matchingFonts|

            idx := translatedLanguages indexOf:newLanguage withoutSeparators.
            idx ~~ 0 ifTrue:[
                language := listOfLanguages at:idx
            ] ifFalse:[
                language := newLanguage
            ].

            "/ check if the new language needs a differently encoded font;
            "/ ask user to switch font and allow cancellation.
            "/ Otherwise, you are left with unreadable menu & button items ...

            oldLanguage := Smalltalk language.
            Smalltalk language:language asSymbol.
            ResourcePack flushCachedResourcePacks.
            fontPref := self class classResources at:'PREFERRED_FONT_ENCODING'.
            Smalltalk language:oldLanguage.

            switch := true.
            enc := MenuView defaultFont encoding.
            (fontPref match:enc) ifFalse:[
                "/ look if there is one at all.
                matchingFonts := Screen current listOfAvailableFonts select:[:f | fontPref match:f encoding].
                matchingFonts size == 0 ifTrue:[
                    (Dialog 
                        confirm:(resources 
                                    string:'your display does not offer any %1-encoded font.\\Change the language anyway ?\ (texts will probably be unreadable then)'
                                      with:fontPref) withCRs)
                    ifFalse:[
                        switch := false
                    ]
                ] ifFalse:[
                    answer := Dialog 
                                confirmWithCancel:(resources 
                                                        string:'menu font is not %1-encoded.\\Change it ?'
                                                        with:fontPref) withCRs
                                           labels:(resources
                                                        array:#('cancel' 'no' 'yes'))
                                           default:3.
                    answer isNil ifTrue:[
                        switch := false
                    ] ifFalse:[
                        answer ifTrue:[
                            switch := (self fontBoxForEncoding:fontPref)
                        ]
                    ].
                ].
            ].

            switch ifTrue:[
                Smalltalk language:language asSymbol.
                ResourcePack flushCachedResourcePacks
            ].
        ].
        switch ifTrue:[
            self reOpen
        ]
    ].    
    box
        addHelpButtonFor:'Launcher/languageSetting.html'.
    box open.
    box destroy



! !

!ToolApplicationModel methodsFor:'active help'!

activeHelp
    "Answer whether active help is turned on/off"

    ^activeHelp
!

activeHelp: aValue
    "toggle active help"

    (activeHelp := aValue)
        ifTrue: [ActiveHelp startFor: self]
        ifFalse: [ActiveHelp stopFor: self]
!

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,
        (Text string: self class label emphasis: #bold), rev,
        '\\has been designed and implemented by \' withCRs,self class author,', eXept Software AG, Germany.  \\' withCRs.

     box   label:'About This Application'.
     box   autoHideAfter:10 with:[].
     box   showAtCenter.
!

openClassDocumentation

    Autoload autoloadFailedSignal handle:[:ex |
        self warn:'autoload failed.

Check your source directory and/or 
the abbreviation file for the classes (correct) shortened name.'.
        ex return.
    ] do:[
        |text v|

        text := self class htmlDocumentation.
        text notNil ifTrue:[
            v := HTMLDocumentView
                    openFullOnText:text 
                    inDirectory:(Smalltalk getSystemFileName:'doc/online/english/classDoc').
            v nameSpaceForExecution: self class nameSpace.
        ]
    ]


!

openProgrammersGuide

    |dir|
    ((dir := Smalltalk getSystemFileName: 'doc/online/english/programming/TOP.html') asFilename exists)
    ifTrue:
    [
        ^HTMLDocumentView openFullOnFile: dir
    ]
!

openTutorial

    |dir|
    ((dir := Smalltalk getSystemFileName: 'doc/online/english/getstart/tutorial.html') asFilename exists)
    ifTrue:
    [
        ^HTMLDocumentView openFullOnFile: dir
    ]
!

showHelp:aHelpText for:view
    "display aHelpText in the info label or if present detour to masterApplication."

    self masterApplication notNil
    ifTrue:
    [
        ^masterApplication showHelp: aHelpText for:view
    ]
    ifFalse:
    [
        aHelpText isNil 
            ifTrue:  [self valueOfInfoLabel value: self defaultInfoLabel] 
            ifFalse: [self valueOfInfoLabel value: (aHelpText asString printString upTo: Character cr)].

        ^true
    ]
! !

!ToolApplicationModel methodsFor:'aspects'!

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

!

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: anEditObject

    self class clipboard: anEditObject.

    self valueOfHavingClipboard value: anEditObject notNil
! !

!ToolApplicationModel methodsFor:'history'!

addToHistory: aHistoryEntry

    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
!

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]).
    ]. 
    menu addItem: (MenuItem new label: 'Empty History'; value: #emptyHistory).

    ^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:'startup / release'!

close

    self uninitialize.

    super close
!

closeRequest

    self uninitialize.

    super closeRequest
!

initialize

    self activeHelp: true.
    timeBlock := nil.
    timeBlock := [self showTime].
    self showTime
!

open

    super open.

    self class allInstances size = 1 
    ifTrue: 
    [
        self class classResources: nil.
        self clipboard: nil
    ].
    builder window label: self class label

!

openInterface

    super openInterface.

    self builder window extent: self preferredExtent
!

reOpen

    self close.

    self class open
!

removeAllTemporalViews

    self builder namedComponents keys copy do: 
    [:comp| 
        (comp includesString: '_Temporal') ifTrue: [self builder namedComponents removeKey: comp]
    ]
!

restarted

    self initialize
!

uninitialize

    self class allInstances size = 1 ifTrue: [self clipboard: nil].
    activeHelp ifTrue: [ActiveHelp stopFor: self].
    Processor removeTimedBlock:timeBlock.
    timeBlock := nil.
! !

!ToolApplicationModel methodsFor:'window events'!

showTime

    |hours minutes suffix|
    suffix := ' am '.  
    (hours := Time now hours) > 12 ifTrue: [hours := hours - 12].
    Time now hours >= 12 ifTrue: [suffix := ' pm '].
    (minutes := Time now minutes printString) size = 1 ifTrue: [minutes := '0', minutes printString].
    self valueOfTimeLabel value: hours printString, ':', minutes, suffix.
    Processor addTimedBlock: timeBlock afterSeconds: 1

! !

!ToolApplicationModel class methodsFor:'documentation'!

version
    ^ '$Header: /cvs/stx/stx/libview2/ToolApplicationModel.st,v 1.18 1998-01-27 16:51:19 tz Exp $'
! !