ToolApplicationModel.st
author Claus Gittinger <cg@exept.de>
Mon, 01 Dec 1997 19:51:00 +0100
changeset 744 363d53be9eb0
parent 741 59bf61da6319
child 745 9a306f58ea68
permissions -rw-r--r--
packbits decompression.

ApplicationModel subclass:#ToolApplicationModel
	instanceVariableNames:'activeHelp'
	classVariableNames:''
	poolDictionaries:''
	category:'Interface-Framework'
!

!ToolApplicationModel class methodsFor:'documentation'!

documentation
"
    standard framework for tools; provides hooks for about menu,
    help menu etc.
    See concrete subclasses for examples.

    [see also:]
        ApplicationModel
        ImageEditor

    [author:]
        Thomas Zwick
"
! !

!ToolApplicationModel class methodsFor:'accessing'!

author

    ^'unknown'
!

defaultIcon

    ^Launcher aboutIcon
!

label

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

!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:MyApplicationModel andSelector:#menuAbout
     (Menu new fromLiteralArrayEncoding:(MyApplicationModel menuAbout)) startUp
    "

    <resource: #menu>

    ^
     
       #(#Menu
          
           #(
             #(#MenuItem
                #'label:' 'about Smalltalk/X...'
                #'value:' #openAbout
            )
             #(#MenuItem
                #'label:' '-'
            )
             #(#MenuItem
                #'label:' 'about this application...'
                #'value:' #openAboutThisApplication
            )
          ) 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:MyApplicationModel andSelector:#menuHelp
     (Menu new fromLiteralArrayEncoding:(MyApplicationModel menuHelp)) startUp
    "

    <resource: #menu>

    ^
     
       #(#Menu
          
           #(
             #(#MenuItem
                #'label:' 'tutorial'
                #'value:' #openTutorial
            )
             #(#MenuItem
                #'label:' 'programmer''s guide'
                #'value:' #openProgrammersGuide
            )
             #(#MenuItem
                #'label:' '-'
            )
             #(#MenuItem
                #'label:' 'class documentation'
                #'value:' #openClassDocumentation
            )
             #(#MenuItem
                #'label:' '-'
            )
             #(#MenuItem
                #'label:' 'active help'
            )
          ) nil
          nil
      )
! !

!ToolApplicationModel methodsFor:'accessing menu'!

menuAbout
    "this window spec was automatically generated by the UI Builder"

    ^ self class menuAbout


!

menuHelp
    "this window spec was automatically generated by the UI Builder"

    ^ self class menuHelp


! !

!ToolApplicationModel methodsFor:'help'!

openAbout
    "show an about box"

    |box|

    box := AboutBox new.
    box autoHideAfter:10 with:[].
    box showAtCenter

!

openAboutThisApplication
    "show an about this application box"

    (AboutBox title:
        'The application\\' withCRs,
        (Text string: self class label emphasis: #bold),
        '\\has been designed and implemented by \' withCRs,self class author,', eXept Software AG, Germany.  \\' withCRs)
        label:'About this application...';
        autoHideAfter:10 with:[];
        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
    ]
! !

!ToolApplicationModel class methodsFor:'documentation'!

version
    ^ '$Header: /cvs/stx/stx/libview2/ToolApplicationModel.st,v 1.1 1997-11-25 13:35:39 tz Exp $'
! !