UIHelpTool.st
changeset 2020 9de675480091
parent 2018 635babad51d3
child 2037 35576ff838ca
--- a/UIHelpTool.st	Mon Mar 06 09:33:21 2006 +0100
+++ b/UIHelpTool.st	Mon Mar 06 09:35:02 2006 +0100
@@ -550,9 +550,12 @@
 !
 
 modified
-    "true if any items are added, deleted or modified"
-
-    ^ classItemList contains:[:aClassItem | aClassItem modified ].
+    "true if any items are added, deleted or modified
+    "
+    classItemList do:[:aClassItem|
+	aClassItem modified ifTrue:[^ true].
+    ].
+    ^ false
 !
 
 modified:aBoolean
@@ -647,7 +650,6 @@
     "returns the info label as value holder"
 
     masterApplication notNil ifTrue:[
-        builder aspectAt:#useAlienInfoLabelHolder put:true.
         ^ masterApplication infoLabelHolder
     ].
     ^ super infoLabelHolder
@@ -1111,7 +1113,23 @@
     ].
 !
 
+openDocumentation
+    "opens the documentation file of the Help Tool
+    "
+    self openHTMLDocument: 'tools/uipainter/HelpTool.html'
+! !
 
+!UIHelpTool::ClassItem class methodsFor:'instance creation'!
+
+onClass:aClass
+    |root|
+
+    root := self new.
+    root onClass:aClass.
+    ^ root
+! !
+
+!UIHelpTool::ClassItem methodsFor:'accessing'!
 
 list
     "returns the hierarchical list assigned to the classItem; the
@@ -1131,7 +1149,7 @@
     ^ theClass
 ! !
 
-!UIHelpTool::ClassIte
+!UIHelpTool::ClassItem methodsFor:'change & update'!
 
 helpTextChangedFor:anItem
     "called if an helpKey changed its contents
@@ -1150,17 +1168,6 @@
     (modified and:[theClass notNil]) ifFalse:[
         ^ self
     ].
-    KeyItem| |helpText|
-        helpText := aKeyItem helpText.
-        helpText isNil ifTrue:[ helpText := '' ].
-
-        stream nextPutLine:(aKeyItem helpKey storeString).
-        stream nextPutLine:(helpText storeString); ccreateHelpMethodNamed:aMethodName
-    |stream|
-
-    (modified and:[theClass notNil]) ifFalse:[
-        ^ self
-    ].
     stream := '' writeStream.
 
     stream nextPutAll:
@@ -1192,7 +1199,31 @@
         inCategory:'help specs'.
 
     self modified:false.
+! !
 
+!UIHelpTool::ClassItem methodsFor:'displaying'!
+
+icon
+    "returns the display icon (always nil)
+    "
+    ^ nil
+!
+
+label
+    "returns the display label
+    "
+    |label|
+
+    theClass notNil ifTrue:[ label := theClass name ]
+		   ifFalse:[ label := '** not yet defined **' ].
+
+    modified ifTrue:[
+	label := Text string:label color:(Color red).
+    ].
+    ^ label
+! !
+
+!UIHelpTool::ClassItem methodsFor:'instance creation'!
 
 initialize
     "setup defaults
@@ -1214,9 +1245,6 @@
 !UIHelpTool::ClassItem methodsFor:'private'!
 
 basicAdd:aChild sortBlock:aBlock
-    "catch low-level add to update the 
-
-basicAdd:aChild sortBlock:aBlock
     "catch low-level add to update the modification flag
     "
     self   modified:true.
@@ -1230,7 +1258,9 @@
     "
     self modified:true.
 
-    aList 
+    aList do:[:el| el modified:true ].
+    ^ super basicAddAll:aList beforeIndex:anIndex.
+!
 
 basicRemoveFromIndex:startIndex toIndex:stopIndex
     "catch low-level remove to update the modification flag
@@ -1250,7 +1280,10 @@
 !
 
 modified
-    "true, if any 
+    "true, if any item is modified, created or deleted
+    "
+    ^ modified
+!
 
 modified:aBoolean
     "true, if any item is modified, created or deleted
@@ -1275,21 +1308,23 @@
 	key := aKey asSymbol.
 
 	self do:[:anItem|
-	    anItem helpKemodified:aBoolean
-    "true, if any item is modified, created or deleted
-    "
-    modified ~~ aBoolean ifTrue:[
-	modified := aBoolean.
-
-	modified ifFalse:[
-	    self do:[:el| el modified:false ].
-	].
+	    anItem helpKey == key ifTrue:[ ^ anItem ].
+	]
     ].
+    ^ nil
 ! !
 
-!UIHelpTool::ClassItem methodsFor:'searching'!
+!UIHelpTool::KeyItem class methodsFor:'instance creation'!
+
+helpKey:aKey helpText:aText 
+    |key|
 
+    key := self new.
+    key helpKey:aKey helpText:aText.
+    ^ key
+! !
 
+!UIHelpTool::KeyItem methodsFor:'accessing'!
 
 helpKey
     "returns the helpKey, a symbol
@@ -1315,33 +1350,38 @@
         helpText := text.
 
         (modified or:[parent isNil]) ifFalse:[
-            parent h
-
-helpText:aText
-    "set the contents assigned to the helpKey; if the contents changes,
-     a notification is raised.
-    "
-    |text|
-
-    text := sehelpText:aText
-    "set the contents assigned to the helpKey; if the contents changes,
-     a notification is raised.
-    "
-    |text|
-
-    text := self formatText:aText.
-
-    text ~= helpText ifTrue:[
-        helpText := text.
-
-        (modified or:[parent isNil]) ifFalse:[
             parent helpTextChangedFor:self.
         ]
     ].
 ! !
 
+!UIHelpTool::KeyItem methodsFor:'displaying'!
+
+icon
+    "returns the display icon (always nil)
+    "
+    ^ icon
 !
 
+icon:anIcon
+
+    icon ~= anIcon ifTrue:[
+        icon := anIcon.
+        self changed:#icon.
+    ].
+!
+
+label
+    "returns the display label
+    "
+    modified ifTrue:[
+	^ Text string:helpKey color:(Color red)
+    ].
+    ^ helpKey
+! !
+
+!UIHelpTool::KeyItem methodsFor:'instance creation'!
+
 helpKey:aKey helpText:aText
     "set the key and contents without a change notification
     "
@@ -1360,9 +1400,6 @@
 !UIHelpTool::KeyItem methodsFor:'private'!
 
 formatText:aText
-    "format the text, replace carriage return by spaces
-
-formatText:aText
     "format the text, replace carriage return by spaces and compress spaces
     "
     |text result|
@@ -1374,7 +1411,19 @@
 	    result := text first.
 
 	    text from:2 do:[:t| result := result, ' ', t ].
-	    ^ resu
+	    ^ result
+       ].
+    ].
+    ^ nil
+! !
+
+!UIHelpTool::KeyItem methodsFor:'queries'!
+
+modified
+    "returns true if the helpText is modified
+    "
+    ^ modified
+!
 
 modified:aBoolean
     "set the modification flag
@@ -1390,22 +1439,3 @@
 version
     ^ '$Header$'
 ! !
-ader: /cvs/stx/stx/libtool2/UIHelpTool.st,v 1.77 2006/02/15 21:55:10 cg Exp $'modified
-    "returns true if the helpText is modified
-    "
-    ^ modified
-!
-
-modified:aBoolean
-    "set the modification flag
-    "
-    aBoolean == modified ifFalse:[
-	modified := aBoolean.
-	self changed:#redraw.
-  Vý Vý!
-
-!UIHelpTool class methodsFor:'documentation'!
-
-version
-    ^ '$Header$'
-! !