ToolApplicationModel.st
changeset 907 f4087882555a
parent 893 8a142b17a0c8
child 910 670bffab7041
--- a/ToolApplicationModel.st	Wed Apr 22 18:48:18 1998 +0200
+++ b/ToolApplicationModel.st	Wed Apr 22 19:33:35 1998 +0200
@@ -62,7 +62,7 @@
 !ToolApplicationModel class methodsFor:'accessing'!
 
 authorLinesForAboutBox
-    "extract the author(s) from the documentation method."
+    "extracts the author(s) from the documentation method."
 
     |firstClassWithDocumentation src s line lines|
 
@@ -96,6 +96,9 @@
 !
 
 label
+    "returns the label for the tools of this class;
+     extracted from the class name;
+     can be redefined in subclasses"
 
     |label|
     label := ''.
@@ -108,18 +111,21 @@
 !
 
 settings
+    "returns the settings dictionary"
 
     settings isNil ifTrue: [settings := IdentityDictionary new].
     ^settings
 !
 
 showHelp
+    "returns whether the active help is turned on"
 
     showHelp isNil ifTrue: [showHelp := true].
     ^showHelp
 !
 
 showHelp: aBoolean
+    "sets the active help on aBoolean"
 
     ^showHelp := aBoolean
 ! !
@@ -127,11 +133,13 @@
 !ToolApplicationModel class methodsFor:'clipboard'!
 
 clipboard
+    "returns the clipboard of this tool class"
 
     ^clipboard
 !
 
 clipboard: anEditObject
+    "sets the clipboard for this tool class"
 
     clipboard := anEditObject
 ! !
@@ -249,6 +257,7 @@
 !ToolApplicationModel class methodsFor:'history'!
 
 getHistory
+    "returns the history for this tool class"
 
     history isNil ifTrue: [history := OrderedCollection new].
     ^history
@@ -256,6 +265,7 @@
 !
 
 historyMaxSize
+    "returns the maximum size for the history of this tool class"
 
     ^10
 
@@ -315,6 +325,7 @@
         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
+    "returns the icon used for the desktop"
 
     ^Icon
         constantNamed:#'ToolApplicationModel desktopIcon'
@@ -433,6 +444,7 @@
         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
+    "returns the icon used for the menu bar"
 
     ^Icon
         constantNamed:#'ToolApplicationModel menuIcon'
@@ -920,7 +932,7 @@
                 #translateLabel: true
                 #value: #openDocumentation
                 #activeHelpKey: #helpTutorial
-                #enabled: #valueOfHavingTutorial
+                #enabled: #valueOfHavingDocumentation
             )
              #(#MenuItem
                 #label: '-'
@@ -936,14 +948,26 @@
       )
 ! !
 
+!ToolApplicationModel class methodsFor:'queries'!
+
+isVisualStartable
+    "returns whether this application class can be started via #open"
+
+    self == ToolApplicationModel ifTrue:[^false].
+    ^super isVisualStartable
+
+! !
+
 !ToolApplicationModel class methodsFor:'startup / release'!
 
 preSnapshot
+    "removes the clipboard before snap shoting"
 
     clipboard := nil
 !
 
 uninitialize
+    "resets the class instance variables"
 
     settings := showHelp := history := clipboard := nil
 ! !
@@ -951,6 +975,7 @@
 !ToolApplicationModel methodsFor:'aspects'!
 
 valueOfCanCopy
+    "returns whether can copy as value holder"
 
     |holder|
     (holder := builder bindingAt:#valueOfCanCopy) isNil ifTrue:[
@@ -961,6 +986,7 @@
 !
 
 valueOfCanCut
+    "returns whether can paste as value holder"
 
     |holder|
     (holder := builder bindingAt:#valueOfCanCut) isNil ifTrue:[
@@ -971,6 +997,7 @@
 !
 
 valueOfCanPaste
+    "returns whether can paste as value holder"
 
     |holder|
     (holder := builder bindingAt:#valueOfCanPaste) isNil ifTrue:[
@@ -981,6 +1008,7 @@
 !
 
 valueOfCanUndo
+    "returns whether can undo as value holder"
 
     |holder|
     (holder := builder bindingAt:#valueOfCanUndo) isNil ifTrue:[
@@ -991,6 +1019,7 @@
 !
 
 valueOfEnablingCommitButtons
+    "returns the enabling of the commit of this tool as value holder"
 
     |holder|
     (holder := builder bindingAt:#valueOfEnablingCommitButtons) isNil ifTrue:[
@@ -1001,6 +1030,7 @@
 !
 
 valueOfHavingDocumentation
+    "returns whether there is a documentation method for this tool as value holder"
 
     |holder|
     (holder := builder bindingAt:#valueOfHavingDocumentation) isNil ifTrue:[
@@ -1010,23 +1040,8 @@
 
 !
 
-valueOfHavingExamples
-
-    |holder|
-    (holder := builder bindingAt:#valueOfHavingExamples) isNil ifTrue:[
-        builder aspectAt:#valueOfHavingExamples put:(holder :=  (self class implements: #openExamples) asValue).
-    ].
-    ^ holder
-
-!
-
-valueOfHavingTutorial
-
-    ^self valueOfHavingDocumentation
-
-!
-
 valueOfInfoLabel
+    "returns the info label as value holder"
 
     |holder|
     (holder := builder bindingAt:#valueOfInfoLabel) isNil ifTrue:[
@@ -1037,6 +1052,7 @@
 !
 
 valueOfTimeLabel
+    "returns the time label as value holder"
 
     |holder|
     (holder := builder bindingAt:#valueOfTimeLabel) isNil ifTrue:[
@@ -1049,11 +1065,13 @@
 !ToolApplicationModel methodsFor:'clipboard'!
 
 clipboard
+    "returns the clipboard"
 
     ^self class clipboard
 !
 
 clipboard: anEditObject
+    "sets the clipboard and the value holder for can pasting"
 
     self class clipboard: anEditObject.
 
@@ -1063,12 +1081,13 @@
 !ToolApplicationModel methodsFor:'help'!
 
 defaultInfoLabel
+    "returns the default info label; here an empty string"
 
     ^''
 !
 
 openAbout
-    "show an about box"
+    "opens an about box"
 
     |box|
 
@@ -1079,7 +1098,7 @@
 !
 
 openAboutThisApplication
-    "show an about this application box"
+    "opens an about this application box"
 
     |rev box|
     rev := ''.
@@ -1097,17 +1116,13 @@
 !
 
 openHTMLDocument: aHTMLFilename
+    "opens a HTML browser on aHTMLFilename"
 
     HTMLDocumentView openFullOnDocumentationFile: aHTMLFilename
 !
 
-openTutorial: aHTMLFilename
-
-    self openHTMLDocument: aHTMLFilename
-!
-
 showHelp
-    "answer whether showing help is turned on/off"
+    "returns whether showing help is turned on/off"
 
     |currentActiveHelp|
 
@@ -1120,7 +1135,7 @@
 !
 
 showHelp: aValue
-    "toggle showing help"
+    "toggles showing help"
 
     (self class showHelp: aValue)
         ifTrue: [ActiveHelp startFor: self]
@@ -1128,7 +1143,7 @@
 !
 
 showHelp:aHelpText for:view
-    "display aHelpText in the info label or if present detour to masterApplication."
+    "displays aHelpText in the info label or if present detours it to its masterApplication"
 
     self showHelp ifFalse: [^true].
     masterApplication notNil ifTrue: [masterApplication showHelp: aHelpText for:view].
@@ -1139,6 +1154,7 @@
 !
 
 updateInfoLabel
+    "updates the info label at the bottom"
 
     self valueOfInfoLabel value: self defaultInfoLabel
 ! !
@@ -1146,6 +1162,8 @@
 !ToolApplicationModel methodsFor:'history'!
 
 addToHistory: aHistoryEntry
+    "adds aHistoryEntry (format: loadMessage -> evalString) at the top of the history,
+     and checks for maximum size of the history"
 
     aHistoryEntry key size = 0 ifTrue: [^nil].
     self history remove: (self history detect: [:histEntry| histEntry key = aHistoryEntry key] ifNone: nil) ifAbsent: nil.
@@ -1154,21 +1172,25 @@
 !
 
 emptyHistory
+    "removes all history entries"
 
     ^self history removeAll
 !
 
 history
+    "returns the history from tool class"
 
     ^self class getHistory
 !
 
 historyEntries
+    "returns the history entries, i.e. the evaluatable values containing the information"
 
     ^self history collect: [:asso| asso key]
 !
 
 menuHistory
+    "returns a history submenu"
 
     |menu|
     menu := Menu new receiver: self.
@@ -1182,6 +1204,7 @@
 !
 
 removeFromHistory: aHistoryEntry
+    "removes aHistoryEntry from the history"
 
     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]
@@ -1190,6 +1213,7 @@
 !ToolApplicationModel methodsFor:'queries'!
 
 allToolInstances
+    "returns all instances of this tool class"
 
     ^self class settings at: #Instances ifAbsent: [^#()]
 !
@@ -1322,6 +1346,7 @@
 !ToolApplicationModel methodsFor:'startup / release'!
 
 allButOpenInterface:aSymbol
+    "sets the preferred extent and the label of the tool window before opening that"
 
     super allButOpenInterface:aSymbol.
 
@@ -1332,6 +1357,7 @@
 !
 
 close
+    "uninitializes and closes this tool"
 
     self uninitialize.
 
@@ -1339,6 +1365,7 @@
 !
 
 closeRequest
+    "uninitializes this tool before requesting close"
 
     self uninitialize.
 
@@ -1346,6 +1373,8 @@
 !
 
 postOpenWith:aBuilder
+    "starts the active help for this tool (if turned on in the settings)
+     and updates the info label and the fonts (from the settings)"
 
     super postOpenWith:aBuilder.
 
@@ -1355,22 +1384,8 @@
 
 !
 
-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
+    "sets and starts the time block"
 
     timeBlock := aBlock.
     aBlock value.
@@ -1378,6 +1393,7 @@
 !
 
 uninitialize
+    "stops the active help this tool and (if defined) removes the time block"
 
     self showHelp ifTrue: [ActiveHelp stopFor: self].
     timeBlock notNil ifTrue: [Processor removeTimedBlock:timeBlock. timeBlock := nil].
@@ -1387,5 +1403,5 @@
 !ToolApplicationModel class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview2/ToolApplicationModel.st,v 1.52 1998-04-04 17:08:16 tz Exp $'
+    ^ '$Header: /cvs/stx/stx/libview2/ToolApplicationModel.st,v 1.53 1998-04-22 17:33:35 tz Exp $'
 ! !