--- a/UIHelpTool.st Mon Mar 06 09:30:18 2006 +0100
+++ b/UIHelpTool.st Mon Mar 06 09:30:37 2006 +0100
@@ -550,12 +550,9 @@
!
modified
- "true if any items are added, deleted or modified
- "
- classItemList do:[:aClassItem|
- aClassItem modified ifTrue:[^ true].
- ].
- ^ false
+ "true if any items are added, deleted or modified"
+
+ ^ classItemList contains:[:aClassItem | aClassItem modified ].
!
modified:aBoolean
@@ -650,6 +647,7 @@
"returns the info label as value holder"
masterApplication notNil ifTrue:[
+ builder aspectAt:#useAlienInfoLabelHolder put:true.
^ masterApplication infoLabelHolder
].
^ super infoLabelHolder
@@ -1113,23 +1111,7 @@
].
!
-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
@@ -1149,7 +1131,7 @@
^ theClass
! !
-!UIHelpTool::ClassItem methodsFor:'change & update'!
+!UIHelpTool::ClassIte
helpTextChangedFor:anItem
"called if an helpKey changed its contents
@@ -1168,6 +1150,17 @@
(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:
@@ -1199,31 +1192,7 @@
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
@@ -1245,6 +1214,9 @@
!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.
@@ -1258,9 +1230,7 @@
"
self modified:true.
- aList do:[:el| el modified:true ].
- ^ super basicAddAll:aList beforeIndex:anIndex.
-!
+ aList
basicRemoveFromIndex:startIndex toIndex:stopIndex
"catch low-level remove to update the modification flag
@@ -1280,10 +1250,7 @@
!
modified
- "true, if any item is modified, created or deleted
- "
- ^ modified
-!
+ "true, if any
modified:aBoolean
"true, if any item is modified, created or deleted
@@ -1308,23 +1275,21 @@
key := aKey asSymbol.
self do:[:anItem|
- anItem helpKey == key ifTrue:[ ^ 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 ].
+ ].
].
- ^ nil
! !
-!UIHelpTool::KeyItem class methodsFor:'instance creation'!
-
-helpKey:aKey helpText:aText
- |key|
+!UIHelpTool::ClassItem methodsFor:'searching'!
- key := self new.
- key helpKey:aKey helpText:aText.
- ^ key
-! !
-!UIHelpTool::KeyItem methodsFor:'accessing'!
helpKey
"returns the helpKey, a symbol
@@ -1350,38 +1315,33 @@
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
"
@@ -1400,6 +1360,9 @@
!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|
@@ -1411,19 +1374,7 @@
result := text first.
text from:2 do:[:t| result := result, ' ', t ].
- ^ result
- ].
- ].
- ^ nil
-! !
-
-!UIHelpTool::KeyItem methodsFor:'queries'!
-
-modified
- "returns true if the helpText is modified
- "
- ^ modified
-!
+ ^ resu
modified:aBoolean
"set the modification flag
@@ -1439,3 +1390,22 @@
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$'
+! !