--- a/UIHelpTool.st Tue Oct 28 21:25:16 1997 +0100
+++ b/UIHelpTool.st Tue Oct 28 21:26:16 1997 +0100
@@ -88,6 +88,42 @@
!UIHelpTool class methodsFor:'interface specs'!
+keyMenu
+ "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:UIHelpTool andSelector:#keyMenu
+ (Menu new fromLiteralArrayEncoding:(UIHelpTool keyMenu)) startUp
+ "
+
+ <resource: #menu>
+
+ ^
+
+ #(#Menu
+
+ #(
+ #(#MenuItem
+ #'label:' 'new key ...'
+ #'value:' #newKey
+ )
+ #(#MenuItem
+ #'label:' '-'
+ )
+ #(#MenuItem
+ #'label:' 'remove'
+ #'value:' #removeKey
+ )
+ ) nil
+ nil
+ )
+
+ "Created: / 27.10.1997 / 00:55:20 / cg"
+!
+
menuPanelStandAlone
"this window spec was automatically generated by the ST/X MenuEditor"
@@ -172,11 +208,11 @@
#'window:'
#(#WindowSpec
#'name:' 'HelpTool'
- #'layout:' #(#LayoutFrame 136 0 718 0 731 0 1215 0)
+ #'layout:' #(#LayoutFrame 176 0 150 0 771 0 647 0)
#'label:' 'HelpTool'
#'min:' #(#Point 10 10)
#'max:' #(#Point 1160 870)
- #'bounds:' #(#Rectangle 136 718 732 1216)
+ #'bounds:' #(#Rectangle 176 150 772 648)
)
#'component:'
#(#SpecCollection
@@ -204,6 +240,7 @@
#(#SequenceViewSpec
#'name:' 'selectionList'
#'model:' #listModel
+ #'menu:' #keyMenu
#'hasHorizontalScrollBar:' true
#'hasVerticalScrollBar:' true
#'miniScrollerHorizontal:' true
@@ -218,6 +255,8 @@
)
)
)
+
+ "Modified: / 27.10.1997 / 00:55:35 / cg"
!
windowSpec
@@ -346,6 +385,16 @@
self listChannel value:(dictionary keys asSortedCollection)
! !
+!UIHelpTool methodsFor:'accessing menu'!
+
+keyMenu
+ "this window spec was automatically generated by the UI Builder"
+
+ ^ self class keyMenu
+
+ "Created: / 27.10.1997 / 00:55:20 / cg"
+! !
+
!UIHelpTool methodsFor:'actions'!
accept
@@ -368,7 +417,7 @@
installHelpSpecInto:aClass
"install help text
"
- |cls src|
+ |cls src order|
cls := self applicationClassAssociatedWith:aClass.
@@ -394,8 +443,11 @@
'.
- dictionary keysAndValuesDo:[:key :txt|
- |t|
+ order := dictionary keys asSortedCollection.
+ order do:[:key |
+ |txt t|
+
+ txt := dictionary at:key.
src nextPutLine:key storeString.
t := txt asString replaceAll:(Character cr) with:(Character space).
@@ -411,6 +463,7 @@
forClass:cls class
inCategory:'help specs'
+ "Modified: / 26.10.1997 / 23:01:44 / cg"
! !
!UIHelpTool methodsFor:'aspects'!
@@ -421,10 +474,11 @@
|holder|
(holder := builder bindingAt:#listChannel) isNil ifTrue:[
- builder aspectAt:#listChannel put:(holder := ValueHolder new).
- holder value:(OrderedCollection new).
+ builder aspectAt:#listChannel put:(holder := OrderedCollection new asValue).
].
^ holder
+
+ "Modified: / 27.10.1997 / 01:50:33 / cg"
!
listModel
@@ -448,6 +502,49 @@
dictionary := IdentityDictionary new.
! !
+!UIHelpTool methodsFor:'menu actions'!
+
+newKey
+ |k sym|
+
+ k := Dialog request:'name of new:'.
+ k size > 0 ifTrue:[
+ ((dictionary includesKey:k)
+ or:[(sym := k asSymbolIfInterned) notNil
+ and:[dictionary includesKey:sym]])
+ ifTrue:[
+ ^ self warn:'key is already present.'.
+ ].
+ dictionary at:k asSymbol put:''.
+ self updateList
+ ].
+
+ "Created: / 27.10.1997 / 01:48:48 / cg"
+ "Modified: / 27.10.1997 / 02:24:30 / cg"
+!
+
+removeKey
+ |k sym|
+
+ k := Dialog request:'name of key to remove:' initialAnswer:listSelection.
+ k size > 0 ifTrue:[
+ ((dictionary includesKey:k)
+ or:[(sym := k asSymbolIfInterned) notNil
+ and:[dictionary includesKey:sym]])
+ ifFalse:[
+ ^ self warn:'key is not present.'.
+ ].
+ sym notNil ifTrue:[
+ dictionary removeKey:sym ifAbsent:nil.
+ ].
+ dictionary removeKey:k ifAbsent:nil.
+ self updateList
+ ].
+
+ "Created: / 27.10.1997 / 01:48:48 / cg"
+ "Modified: / 27.10.1997 / 02:25:30 / cg"
+! !
+
!UIHelpTool methodsFor:'private'!
editTextView