--- a/MenuEditor.st Tue Feb 08 10:29:46 2000 +0100
+++ b/MenuEditor.st Tue Feb 08 17:10:58 2000 +0100
@@ -20,13 +20,6 @@
category:'Interface-UIPainter'
!
-SelectionInTreeView subclass:#TreeView
- instanceVariableNames:''
- classVariableNames:''
- poolDictionaries:''
- privateIn:MenuEditor
-!
-
Object subclass:#Item
instanceVariableNames:'activeHelpKey enabled label value nameKey indication shortcutKey
accessCharacterPos retriever icon iconAndLabel submenuChannel
@@ -37,6 +30,13 @@
privateIn:MenuEditor
!
+SelectionInTreeView subclass:#TreeView
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ privateIn:MenuEditor
+!
+
!MenuEditor class methodsFor:'documentation'!
copyright
@@ -2284,8 +2284,9 @@
helpTool := UIHelpTool new createBuilder.
helpTool masterApplication:self.
helpTool modifiedHolder: self valueOfEnablingCommitButtons.
- helpView := View new client:helpTool.
+ helpView := ApplicationSubView new client:helpTool.
helpTool builder window:helpView.
+ helpTool masterApplication:self.
listOfCanvas at:#help put:helpTool.
].
^ helpTool
@@ -2699,6 +2700,345 @@
modified := true.
! !
+!MenuEditor::Item class methodsFor:'constants'!
+
+separatorList
+ "get the list of available separator types"
+
+ ^#('blank' 'single line' 'double line')
+!
+
+separatorSlices
+ "get the list of menu spec values of the corresponding separator types"
+
+ ^ #(
+ ( #blank '' )
+ ( #single '-' )
+ ( #double '=' )
+ )
+! !
+
+!MenuEditor::Item class methodsFor:'documentation'!
+
+documentation
+"
+ implements the contents assigned to a TreeItem. An instance
+ is associated with one item and keeps all its information
+
+ [see also:]
+ TreeItem
+ MenuEditor
+
+ [author:]
+ Claus Atzkern
+"
+
+
+! !
+
+!MenuEditor::Item methodsFor:'accessing'!
+
+activeHelpKey
+ "get the help key of the menu item"
+
+ ^activeHelpKey
+!
+
+activeHelpKey:aKey
+ "set the help key of the menu item"
+
+ activeHelpKey := aKey
+!
+
+label
+ "get the value of the menu item"
+
+ ^label
+!
+
+label:something
+ "set the value of the menu item"
+
+ label := something ? '-'
+!
+
+separatorType
+ "get the separator type assigned to item or nil"
+
+ label size > 1
+ ifFalse:
+ [
+ label size == 0 ifTrue:[^#blank].
+ label first == $- ifTrue:[^#single].
+ label first == $= ifTrue:[^#double].
+ ].
+ ^nil
+
+!
+
+startGroup:aSymbolOrNil
+ "set the startGroup attribute"
+
+ startGroup := aSymbolOrNil
+
+ "Created: / 23.8.1998 / 15:56:03 / cg"
+!
+
+submenuChannel
+ "return the value of the instance variable 'submenuChannel' (automatically generated)"
+
+ ^submenuChannel
+!
+
+submenuChannel:aChannel
+ "get the submenuChannel"
+
+ submenuChannel := aChannel
+!
+
+translateLabel:aBoolean
+ "set/clear the translate to national-language flag"
+
+ translateLabel := aBoolean
+
+ "Created: / 6.6.1998 / 17:23:33 / cg"
+!
+
+value:aSymbol
+ "set the value attribute"
+
+ value := aSymbol
+
+ "Created: / 23.8.1998 / 16:02:10 / cg"
+! !
+
+!MenuEditor::Item methodsFor:'building'!
+
+buildFromAspects:aspects
+ "read the values of the aspects into my values"
+
+ |name|
+ self isSeparator
+ ifFalse:
+ [
+ name := label.
+ label := (aspects at:#label) value.
+
+ (label isNil or:[self isSeparator]) ifTrue:[
+ (aspects at:#label) value:(label := name)
+ ].
+
+ enabled := (aspects at:#enabled) value.
+ value := (aspects at:#value) value.
+ nameKey := (aspects at:#nameKey) value.
+ indication := (aspects at:#indication) value.
+ choice := (aspects at:#choice) value.
+ choiceValue := (aspects at:#choiceValue) value.
+ shortcutKey := (aspects at:#shortcutKey) value.
+ startGroup := (aspects at:#startGroup) value.
+ accessCharacterPos := (aspects at:#accessCharacterPos) value.
+ argument := (aspects at:#argument) value.
+ translateLabel := (aspects at:#translateLabel) value.
+ isButton := (aspects at:#isButton) value.
+ auxValue := (aspects at:#auxValue) value.
+
+ argument isString ifTrue:[
+ argument size > 1 ifTrue:[
+ (argument at:1) == $# ifTrue:[
+ argument := (argument copyFrom:2) asSymbol
+ ]
+ ]
+ ].
+ submenuChannel := (aspects at:#submenuChannel) value.
+ retriever := (aspects at:#retriever) value.
+ icon := (aspects at:#icon) value.
+ iconAndLabel := (aspects at:#iconAndLabel) value.
+ ]
+ ifTrue:
+ [
+ name := (aspects at:#seperatorSelection) selectionIndex.
+ label := (self class separatorSlices at:name) last.
+ ].
+ isVisible := (aspects at:#isVisible) value.
+ hideMenuOnActivated := (aspects at:#hideMenuOnActivated) value.
+
+ "Modified: / 14.8.1998 / 15:36:38 / cg"
+!
+
+buildFromMenuItem:anItem
+ "read the attributes of anItem into my values"
+
+ |rtv|
+
+ self label:(anItem rawLabel).
+ activeHelpKey := anItem activeHelpKey.
+
+ (enabled := anItem enabled) isSymbol ifFalse:[
+ enabled := nil
+ ].
+ (value := anItem value) isSymbol ifFalse:[
+ value := nil.
+ ].
+ (indication := anItem indication) isSymbol ifFalse:[
+ indication := nil
+ ].
+ (choice := anItem choice) isSymbol ifFalse:[
+ choice := nil
+ ].
+ choiceValue := anItem choiceValue.
+ nameKey := anItem nameKey.
+ shortcutKey := anItem shortcutKeyCharacter.
+ startGroup := anItem startGroup.
+ accessCharacterPos := anItem accessCharacterPosition.
+ argument := anItem argument.
+
+ submenuChannel := anItem submenuChannel.
+ translateLabel := anItem translateLabel.
+ isButton := anItem isButton.
+ isVisible := anItem isVisible.
+ hideMenuOnActivated := anItem hideMenuOnActivated.
+ auxValue := anItem auxValue.
+
+ (((rtv := anItem adornment) notNil)
+ and:[(rtv := rtv labelImage) isKindOf:ResourceRetriever])
+ ifTrue:
+ [
+ retriever := rtv className.
+ icon := rtv selector.
+ (iconAndLabel := rtv labelText notNil) ifTrue:[
+ label := rtv labelText.
+ ]
+ ]
+
+ "Modified: / 29.9.1998 / 11:18:25 / cg"
+! !
+
+!MenuEditor::Item methodsFor:'conversion'!
+
+asMenuItem
+ "converts self to a menu item"
+
+ |item rcv|
+
+ item := MenuItem labeled:label.
+ item isVisible:isVisible.
+ item hideMenuOnActivated:hideMenuOnActivated.
+
+ self isSeparator ifFalse:[
+ item activeHelpKey:activeHelpKey.
+ item enabled:enabled.
+ item accessCharacterPosition:accessCharacterPos.
+ item argument:argument.
+ item submenuChannel:submenuChannel.
+ item nameKey:nameKey.
+ item shortcutKeyCharacter:shortcutKey.
+ item startGroup:startGroup.
+ item value:value.
+ item indication:indication.
+ item choice:choice.
+ item choiceValue:choiceValue.
+ item translateLabel: translateLabel.
+ item isButton: isButton.
+ item auxValue: auxValue.
+
+ icon notNil ifTrue:[
+ rcv := ResourceRetriever new.
+ rcv className:retriever.
+ rcv selector:icon.
+ iconAndLabel == true ifTrue:[
+ rcv labelText:label
+ ].
+ item labelImage:rcv
+ ]
+ ].
+ ^item
+
+ "Modified: / 14.8.1998 / 15:36:35 / cg"
+!
+
+toAspects:aspects
+ "put my values into the values of aspects"
+
+ |type|
+ (type := self separatorType) notNil ifTrue: [
+ type := self class separatorSlices findFirst:[:el| el first == type ].
+ (aspects at:#seperatorSelection) selectionIndex:type.
+ ] ifFalse: [
+ (aspects at:#label) value:label.
+ (aspects at:#enabled) value:enabled.
+ (aspects at:#value) value:value.
+ (aspects at:#nameKey) value:nameKey.
+ (aspects at:#indication) value:indication.
+ (aspects at:#choice) value:choice.
+ (aspects at:#choiceValue) value:choiceValue.
+ (aspects at:#shortcutKey) value:shortcutKey.
+ (aspects at:#startGroup) value:startGroup.
+ (aspects at:#accessCharacterPos) value:accessCharacterPos.
+ (aspects at:#translateLabel) value:translateLabel.
+ (aspects at:#submenuChannel) value:submenuChannel.
+ (aspects at:#retriever) value:retriever.
+ (aspects at:#icon) value:icon.
+ (aspects at:#iconAndLabel) value:iconAndLabel.
+ (aspects at:#isButton) value:isButton.
+ (aspects at:#auxValue) value:auxValue.
+
+ (aspects at:#argument)
+ value:(argument isSymbol
+ ifTrue: ['#', argument]
+ ifFalse:[argument]).
+ ].
+ (aspects at:#isVisible) value:isVisible.
+ (aspects at:#hideMenuOnActivated) value:hideMenuOnActivated.
+
+ "Modified: / 14.8.1998 / 15:37:29 / cg"
+! !
+
+!MenuEditor::Item methodsFor:'queries'!
+
+iconFor: aNode
+ "get the icon of the menu item for the tree view"
+
+ (aNode hasChildren or: [aNode parent isNil])
+ ifTrue:
+ [
+ ^MenuEditor submenuImage
+ ]
+ ifFalse:
+ [
+ submenuChannel notNil
+ ifTrue:
+ [
+ ^MenuEditor linkSubmenuImage
+ ]
+ ifFalse:
+ [
+ self isSeparator
+ ifTrue: [^MenuEditor menuSeparatorImage]
+ ifFalse: [^MenuEditor menuItemImage]
+ ]
+ ]
+!
+
+isSeparator
+ "return true if item is a seperator"
+
+ ^self separatorType notNil
+!
+
+treeViewLabel
+ "get the label of the menu item for the tree view"
+
+ ^label
+" asBoldText,
+ (value notNil ifTrue: [': [',
+ value ,
+ (argument isString ifTrue: [' ', (Text string: argument emphasis: #italic)] ifFalse: ['']),
+ ']'] ifFalse: [''])
+
+
+"
+! !
+
!MenuEditor::TreeView class methodsFor:'documentation'!
documentation
@@ -3164,345 +3504,6 @@
app updateChannels
! !
-!MenuEditor::Item class methodsFor:'constants'!
-
-separatorList
- "get the list of available separator types"
-
- ^#('blank' 'single line' 'double line')
-!
-
-separatorSlices
- "get the list of menu spec values of the corresponding separator types"
-
- ^ #(
- ( #blank '' )
- ( #single '-' )
- ( #double '=' )
- )
-! !
-
-!MenuEditor::Item class methodsFor:'documentation'!
-
-documentation
-"
- implements the contents assigned to a TreeItem. An instance
- is associated with one item and keeps all its information
-
- [see also:]
- TreeItem
- MenuEditor
-
- [author:]
- Claus Atzkern
-"
-
-
-! !
-
-!MenuEditor::Item methodsFor:'accessing'!
-
-activeHelpKey
- "get the help key of the menu item"
-
- ^activeHelpKey
-!
-
-activeHelpKey:aKey
- "set the help key of the menu item"
-
- activeHelpKey := aKey
-!
-
-label
- "get the value of the menu item"
-
- ^label
-!
-
-label:something
- "set the value of the menu item"
-
- label := something ? '-'
-!
-
-separatorType
- "get the separator type assigned to item or nil"
-
- label size > 1
- ifFalse:
- [
- label size == 0 ifTrue:[^#blank].
- label first == $- ifTrue:[^#single].
- label first == $= ifTrue:[^#double].
- ].
- ^nil
-
-!
-
-startGroup:aSymbolOrNil
- "set the startGroup attribute"
-
- startGroup := aSymbolOrNil
-
- "Created: / 23.8.1998 / 15:56:03 / cg"
-!
-
-submenuChannel
- "return the value of the instance variable 'submenuChannel' (automatically generated)"
-
- ^submenuChannel
-!
-
-submenuChannel:aChannel
- "get the submenuChannel"
-
- submenuChannel := aChannel
-!
-
-translateLabel:aBoolean
- "set/clear the translate to national-language flag"
-
- translateLabel := aBoolean
-
- "Created: / 6.6.1998 / 17:23:33 / cg"
-!
-
-value:aSymbol
- "set the value attribute"
-
- value := aSymbol
-
- "Created: / 23.8.1998 / 16:02:10 / cg"
-! !
-
-!MenuEditor::Item methodsFor:'building'!
-
-buildFromAspects:aspects
- "read the values of the aspects into my values"
-
- |name|
- self isSeparator
- ifFalse:
- [
- name := label.
- label := (aspects at:#label) value.
-
- (label isNil or:[self isSeparator]) ifTrue:[
- (aspects at:#label) value:(label := name)
- ].
-
- enabled := (aspects at:#enabled) value.
- value := (aspects at:#value) value.
- nameKey := (aspects at:#nameKey) value.
- indication := (aspects at:#indication) value.
- choice := (aspects at:#choice) value.
- choiceValue := (aspects at:#choiceValue) value.
- shortcutKey := (aspects at:#shortcutKey) value.
- startGroup := (aspects at:#startGroup) value.
- accessCharacterPos := (aspects at:#accessCharacterPos) value.
- argument := (aspects at:#argument) value.
- translateLabel := (aspects at:#translateLabel) value.
- isButton := (aspects at:#isButton) value.
- auxValue := (aspects at:#auxValue) value.
-
- argument isString ifTrue:[
- argument size > 1 ifTrue:[
- (argument at:1) == $# ifTrue:[
- argument := (argument copyFrom:2) asSymbol
- ]
- ]
- ].
- submenuChannel := (aspects at:#submenuChannel) value.
- retriever := (aspects at:#retriever) value.
- icon := (aspects at:#icon) value.
- iconAndLabel := (aspects at:#iconAndLabel) value.
- ]
- ifTrue:
- [
- name := (aspects at:#seperatorSelection) selectionIndex.
- label := (self class separatorSlices at:name) last.
- ].
- isVisible := (aspects at:#isVisible) value.
- hideMenuOnActivated := (aspects at:#hideMenuOnActivated) value.
-
- "Modified: / 14.8.1998 / 15:36:38 / cg"
-!
-
-buildFromMenuItem:anItem
- "read the attributes of anItem into my values"
-
- |rtv|
-
- self label:(anItem rawLabel).
- activeHelpKey := anItem activeHelpKey.
-
- (enabled := anItem enabled) isSymbol ifFalse:[
- enabled := nil
- ].
- (value := anItem value) isSymbol ifFalse:[
- value := nil.
- ].
- (indication := anItem indication) isSymbol ifFalse:[
- indication := nil
- ].
- (choice := anItem choice) isSymbol ifFalse:[
- choice := nil
- ].
- choiceValue := anItem choiceValue.
- nameKey := anItem nameKey.
- shortcutKey := anItem shortcutKeyCharacter.
- startGroup := anItem startGroup.
- accessCharacterPos := anItem accessCharacterPosition.
- argument := anItem argument.
-
- submenuChannel := anItem submenuChannel.
- translateLabel := anItem translateLabel.
- isButton := anItem isButton.
- isVisible := anItem isVisible.
- hideMenuOnActivated := anItem hideMenuOnActivated.
- auxValue := anItem auxValue.
-
- (((rtv := anItem adornment) notNil)
- and:[(rtv := rtv labelImage) isKindOf:ResourceRetriever])
- ifTrue:
- [
- retriever := rtv className.
- icon := rtv selector.
- (iconAndLabel := rtv labelText notNil) ifTrue:[
- label := rtv labelText.
- ]
- ]
-
- "Modified: / 29.9.1998 / 11:18:25 / cg"
-! !
-
-!MenuEditor::Item methodsFor:'conversion'!
-
-asMenuItem
- "converts self to a menu item"
-
- |item rcv|
-
- item := MenuItem labeled:label.
- item isVisible:isVisible.
- item hideMenuOnActivated:hideMenuOnActivated.
-
- self isSeparator ifFalse:[
- item activeHelpKey:activeHelpKey.
- item enabled:enabled.
- item accessCharacterPosition:accessCharacterPos.
- item argument:argument.
- item submenuChannel:submenuChannel.
- item nameKey:nameKey.
- item shortcutKeyCharacter:shortcutKey.
- item startGroup:startGroup.
- item value:value.
- item indication:indication.
- item choice:choice.
- item choiceValue:choiceValue.
- item translateLabel: translateLabel.
- item isButton: isButton.
- item auxValue: auxValue.
-
- icon notNil ifTrue:[
- rcv := ResourceRetriever new.
- rcv className:retriever.
- rcv selector:icon.
- iconAndLabel == true ifTrue:[
- rcv labelText:label
- ].
- item labelImage:rcv
- ]
- ].
- ^item
-
- "Modified: / 14.8.1998 / 15:36:35 / cg"
-!
-
-toAspects:aspects
- "put my values into the values of aspects"
-
- |type|
- (type := self separatorType) notNil ifTrue: [
- type := self class separatorSlices findFirst:[:el| el first == type ].
- (aspects at:#seperatorSelection) selectionIndex:type.
- ] ifFalse: [
- (aspects at:#label) value:label.
- (aspects at:#enabled) value:enabled.
- (aspects at:#value) value:value.
- (aspects at:#nameKey) value:nameKey.
- (aspects at:#indication) value:indication.
- (aspects at:#choice) value:choice.
- (aspects at:#choiceValue) value:choiceValue.
- (aspects at:#shortcutKey) value:shortcutKey.
- (aspects at:#startGroup) value:startGroup.
- (aspects at:#accessCharacterPos) value:accessCharacterPos.
- (aspects at:#translateLabel) value:translateLabel.
- (aspects at:#submenuChannel) value:submenuChannel.
- (aspects at:#retriever) value:retriever.
- (aspects at:#icon) value:icon.
- (aspects at:#iconAndLabel) value:iconAndLabel.
- (aspects at:#isButton) value:isButton.
- (aspects at:#auxValue) value:auxValue.
-
- (aspects at:#argument)
- value:(argument isSymbol
- ifTrue: ['#', argument]
- ifFalse:[argument]).
- ].
- (aspects at:#isVisible) value:isVisible.
- (aspects at:#hideMenuOnActivated) value:hideMenuOnActivated.
-
- "Modified: / 14.8.1998 / 15:37:29 / cg"
-! !
-
-!MenuEditor::Item methodsFor:'queries'!
-
-iconFor: aNode
- "get the icon of the menu item for the tree view"
-
- (aNode hasChildren or: [aNode parent isNil])
- ifTrue:
- [
- ^MenuEditor submenuImage
- ]
- ifFalse:
- [
- submenuChannel notNil
- ifTrue:
- [
- ^MenuEditor linkSubmenuImage
- ]
- ifFalse:
- [
- self isSeparator
- ifTrue: [^MenuEditor menuSeparatorImage]
- ifFalse: [^MenuEditor menuItemImage]
- ]
- ]
-!
-
-isSeparator
- "return true if item is a seperator"
-
- ^self separatorType notNil
-!
-
-treeViewLabel
- "get the label of the menu item for the tree view"
-
- ^label
-" asBoldText,
- (value notNil ifTrue: [': [',
- value ,
- (argument isString ifTrue: [' ', (Text string: argument emphasis: #italic)] ifFalse: ['']),
- ']'] ifFalse: [''])
-
-
-"
-! !
-
!MenuEditor class methodsFor:'documentation'!
version