--- a/MenuEditor.st Thu Oct 24 16:03:46 2002 +0200
+++ b/MenuEditor.st Thu Oct 24 17:32:37 2002 +0200
@@ -28,35 +28,21 @@
privateIn:MenuEditor
!
-MenuEditor::Item subclass:#ItemAction
- instanceVariableNames:''
- classVariableNames:''
- poolDictionaries:''
- privateIn:MenuEditor
-!
-
-MenuEditor::Item subclass:#ItemLinkedMenu
+MenuEditor::Item subclass:#ActionItem
instanceVariableNames:''
classVariableNames:''
poolDictionaries:''
privateIn:MenuEditor
!
-MenuEditor::Item subclass:#ItemMenu
+MenuEditor::Item subclass:#LinkedMenuItem
instanceVariableNames:''
classVariableNames:''
poolDictionaries:''
privateIn:MenuEditor
!
-MenuEditor::ItemMenu subclass:#ItemRoot
- instanceVariableNames:''
- classVariableNames:''
- poolDictionaries:''
- privateIn:MenuEditor
-!
-
-MenuEditor::Item subclass:#ItemSeparator
+MenuEditor::Item subclass:#MenuItem
instanceVariableNames:''
classVariableNames:''
poolDictionaries:''
@@ -78,6 +64,20 @@
privateIn:MenuEditor
!
+MenuEditor::MenuItem subclass:#RootItem
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ privateIn:MenuEditor
+!
+
+MenuEditor::Item subclass:#SeparatorItem
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ privateIn:MenuEditor
+!
+
!MenuEditor class methodsFor:'documentation'!
copyright
@@ -677,77 +677,78 @@
^
#(#Menu
- #(
- #(#MenuItem
- #label: 'Cut'
- #value: #doCut
- #activeHelpKey: #editCut
- #enabled: #hasSelectionChannel
- )
- #(#MenuItem
- #label: 'Copy'
- #value: #doCopy
- #activeHelpKey: #editCopy
- #enabled: #hasSelectionChannel
- )
- #(#MenuItem
- #label: 'Paste'
- #value: #doPaste
- #activeHelpKey: #editPaste
- #enabled: #valueOfCanPaste
- )
- #(#MenuItem
- #label: 'Delete'
- #value: #doDelete
- #activeHelpKey: #editDelete
- #enabled: #hasSelectionChannel
- )
- #(#MenuItem
- #label: '-'
- )
- #(#MenuItem
- #label: 'Move Up'
- #startGroup: #right
- #value: #doMoveUpOrDown:
- #activeHelpKey: #editMoveUp
- #enabled: #valueOfEnableMovingUpOrDown
- #argument: #up
- #labelImage: #(#ResourceRetriever #Icon #upIcon 'Move Up')
- )
- #(#MenuItem
- #label: 'Move Down'
- #value: #doMoveUpOrDown:
- #activeHelpKey: #editMoveDown
- #enabled: #valueOfEnableMovingUpOrDown
- #argument: #down
- #labelImage: #(#ResourceRetriever #Icon #downIcon 'Move Down')
- )
- #(#MenuItem
- #label: 'Move In'
- #value: #doMoveIn:
- #activeHelpKey: #editMoveIn
- #enabled: #valueOfEnableMovingIn
- #argument: #inNext
- #labelImage: #(#ResourceRetriever #Icon #downRightIcon 'Move In')
- )
- #(#MenuItem
- #label: 'Move In Above'
- #value: #doMoveIn:
- #activeHelpKey: #editMoveInAbove
- #enabled: #valueOfEnableMovingInAbove
- #argument: #inPrev
- #labelImage: #(#ResourceRetriever #Icon #upRightIcon 'Move In Above')
- )
- #(#MenuItem
- #label: 'Move Out'
- #value: #doMoveOut
- #activeHelpKey: #editMoveOut
- #enabled: #valueOfEnableMovingOut
- #labelImage: #(#ResourceRetriever #Icon #leftDownIcon 'Move Out')
- )
- )
- nil
- nil
+ #(
+ #(#MenuItem
+ #label: 'Cut'
+ #translateLabel: true
+ #activeHelpKey: #editCut
+ #enabled: #hasSelectionChannel
+ )
+ #(#MenuItem
+ #label: 'Copy'
+ #translateLabel: true
+ #activeHelpKey: #editCopy
+ #enabled: #hasSelectionChannel
+ )
+ #(#MenuItem
+ #label: 'Paste'
+ #translateLabel: true
+ #activeHelpKey: #editPaste
+ #enabled: #valueOfCanPaste
+ )
+ #(#MenuItem
+ #label: 'Delete'
+ #translateLabel: true
+ #isVisible: false
+ #activeHelpKey: #editDelete
+ #enabled: #hasSelectionChannel
+ )
+ #(#MenuItem
+ #label: '-'
+ )
+ #(#MenuItem
+ #label: 'Move Up'
+ #translateLabel: true
+ #startGroup: #right
+ #activeHelpKey: #editMoveUp
+ #enabled: #valueOfEnableMovingUpOrDown
+ #argument: #up
+ #resourceRetriever: #(#ResourceRetriever #Icon #upIcon '')
+ )
+ #(#MenuItem
+ #label: 'Move Down'
+ #translateLabel: true
+ #activeHelpKey: #editMoveDown
+ #enabled: #valueOfEnableMovingUpOrDown
+ #argument: #down
+ #resourceRetriever: #(#ResourceRetriever #Icon #downIcon '')
+ )
+ #(#MenuItem
+ #label: 'Move Into Next'
+ #translateLabel: true
+ #activeHelpKey: #editMoveIn
+ #enabled: #valueOfEnableMovingIn
+ #argument: #inNext
+ #resourceRetriever: #(#ResourceRetriever #Icon #downRightIcon '')
+ )
+ #(#MenuItem
+ #label: 'Move Into Previous'
+ #translateLabel: true
+ #activeHelpKey: #editMoveInAbove
+ #enabled: #valueOfEnableMovingInAbove
+ #argument: #inPrev
+ #resourceRetriever: #(#ResourceRetriever #Icon #upRightIcon '')
+ )
+ #(#MenuItem
+ #label: 'Move Out'
+ #translateLabel: true
+ #activeHelpKey: #editMoveOut
+ #enabled: #valueOfEnableMovingOut
+ #resourceRetriever: #(#ResourceRetriever #Icon #leftDownIcon '')
+ )
+ )
+ nil
+ nil
)
!
@@ -856,13 +857,6 @@
#(#Menu
#(
#(#MenuItem
- #label: 'Redefine Aspect Methods'
- #hideMenuOnActivated: false
- #activeHelpKey: #settingsRedefineAspectMethods
- #enabled: #hasValidSpecClass
- #indication: #redefineAspectMethodsChannel
- )
- #(#MenuItem
#label: 'Aspect Methods'
#value: #doGenerateAspectMethods
#activeHelpKey: #generateAspectMethods
@@ -964,7 +958,7 @@
#keepLinkedMenu: true
)
#(#MenuItem
- #label: 'Add'
+ #label: 'Item'
#translateLabel: true
#activeHelpKey: #add
#enabled: #hasSingleSelectionChannel
@@ -972,25 +966,32 @@
#keepLinkedMenu: true
)
#(#MenuItem
+ #label: 'Generate'
+ #translateLabel: true
+ #activeHelpKey: #generate
+ #submenuChannel: #generateMenu
+ #keepLinkedMenu: true
+ )
+ #(#MenuItem
#label: 'Test'
#translateLabel: true
#activeHelpKey: #test
#submenuChannel: #submenuTest
)
#(#MenuItem
+ #label: 'Settings'
+ #translateLabel: true
+ #activeHelpKey: #settings
+ #submenuChannel: #settingsMenu
+ #keepLinkedMenu: true
+ )
+ #(#MenuItem
#label: 'History'
#translateLabel: true
#activeHelpKey: #history
#submenuChannel: #menuHistory
)
#(#MenuItem
- #label: 'Generate'
- #translateLabel: true
- #activeHelpKey: #generate
- #submenuChannel: #generateMenu
- #keepLinkedMenu: true
- )
- #(#MenuItem
#label: '&Help'
#translateLabel: true
#startGroup: #right
@@ -1004,6 +1005,37 @@
)
!
+settingsMenu
+ "This resource specification was automatically generated
+ by the MenuEditor of ST/X."
+
+ "Do not manually edit this!! If it is corrupted,
+ the MenuEditor may not be able to read the specification."
+
+ "
+ MenuEditor new openOnClass:MenuEditor andSelector:#generateMenu
+ (Menu new fromLiteralArrayEncoding:(MenuEditor generateMenu)) startUp
+ "
+
+ <resource: #menu>
+
+ ^
+ #(#Menu
+ #(
+ #(#MenuItem
+ #label: 'Redefine Aspect Methods'
+ #translateLabel: true
+ #hideMenuOnActivated: false
+ #activeHelpKey: #settingsRedefineAspectMethods
+ #enabled: #hasValidSpecClass
+ #indication: #redefineAspectMethodsChannel
+ )
+ )
+ nil
+ nil
+ )
+!
+
standardMenus
"This resource specification was automatically generated
by the MenuEditor of ST/X."
@@ -2011,7 +2043,7 @@
listOfItems := HierarchicalList new.
listOfItems application:self.
- listOfItems root:(ItemRoot new).
+ listOfItems root:(RootItem new).
tabHolder := nil asValue.
tabHolder addDependent:self.
@@ -2382,8 +2414,8 @@
selectedItem canAddDelayedMenu ifFalse:[ ^ self ].
self askForItemModification ifFalse:[ ^ self ].
- what == #menu ifTrue:[ delayedItem := ItemMenu new ]
- ifFalse:[ delayedItem := ItemLinkedMenu new ].
+ what == #menu ifTrue:[ delayedItem := MenuItem new ]
+ ifFalse:[ delayedItem := LinkedMenuItem new ].
delayedItem setExpanded:true.
delayedItem := selectedItem add:delayedItem.
@@ -2396,36 +2428,36 @@
doCreateItem
"create a new Item
"
- self addAndSelect:[ ItemAction new ].
+ self addAndSelect:[ ActionItem new translateLabel:true ].
!
doCreateLinkedMenu
"create a new Linked Menu
"
- self addAndSelect:[ ItemLinkedMenu new ].
+ self addAndSelect:[ LinkedMenuItem new ].
!
doCreateMenu
"create a new Menu
"
self addAndSelect:[ |item|
- item := ItemMenu new.
- item expand.
- item
+ item := MenuItem new.
+ item expand.
+ item
].
!
doCreateSep
"create a new Separator Item
"
- self addAndSelect:[ ItemSeparator new ].
+ self addAndSelect:[ SeparatorItem new ].
!
doCreateStandardEditMenu
"create a standart edit menu
"
self addAndSelect:[
- ItemMenu menu:(self class standardEditMenu) labeled:'Edit'
+ MenuItem menu:(self class standardEditMenu) labeled:'Edit' translateLabel:true
].
!
@@ -2433,7 +2465,7 @@
"create a standart file menu
"
self addAndSelect:[
- ItemMenu menu:(self class standardFileMenu) labeled:'File'
+ MenuItem menu:(self class standardFileMenu) labeled:'File' translateLabel:true
].
!
@@ -2443,9 +2475,9 @@
|item|
self addAndSelect:[
- item := ItemMenu menu:(self class standardHelpMenu) labeled:'Help'.
- item aspectAt:#startGroup put:#right.
- item
+ item := MenuItem menu:(self class standardHelpMenu) labeled:'Help' translateLabel:true.
+ item aspectAt:#startGroup put:#right.
+ item
].
! !
@@ -2766,17 +2798,17 @@
classFor:aMenuItem
- aMenuItem ifNil:[ ^ nil ].
-
- aMenuItem value ifNil:[
- aMenuItem submenu ifNotNil:[ ^ MenuEditor::ItemMenu ].
- aMenuItem submenuChannel ifNotNil:[ ^ MenuEditor::ItemLinkedMenu ].
-
- (self separatorTypeOf:(aMenuItem rawLabel)) notNil ifTrue:[
- ^ MenuEditor::ItemSeparator
- ]
+ aMenuItem isNil ifTrue:[ ^ nil ].
+
+ aMenuItem itemValue isNil ifTrue:[
+ aMenuItem submenu notNil ifTrue:[ ^ MenuEditor::MenuItem ].
+ aMenuItem submenuChannel notNil ifTrue:[ ^ MenuEditor::LinkedMenuItem ].
+
+ (self separatorTypeOf:(aMenuItem rawLabel)) notNil ifTrue:[
+ ^ MenuEditor::SeparatorItem
+ ]
].
- ^ MenuEditor::ItemAction
+ ^ MenuEditor::ActionItem
!
menuItem:aMenuItem
@@ -3059,6 +3091,10 @@
"returns the submenu (of class Menu) or nil
"
^ nil
+!
+
+translateLabel:aBoolean
+ menuItem translateLabel:aBoolean
! !
!MenuEditor::Item methodsFor:'aspects'!
@@ -3255,13 +3291,13 @@
^ parent children size > 1
! !
-!MenuEditor::ItemAction class methodsFor:'defaults'!
+!MenuEditor::ActionItem class methodsFor:'defaults'!
defaultLabel
^ 'Action'
! !
-!MenuEditor::ItemAction class methodsFor:'interface - editor'!
+!MenuEditor::ActionItem class methodsFor:'interface - editor'!
addBindingsTo:aspects for:aMenuEditor
"add additional bindings to the aspects
@@ -3282,7 +3318,7 @@
].
! !
-!MenuEditor::ItemAction class methodsFor:'interface - specs'!
+!MenuEditor::ActionItem class methodsFor:'interface - specs'!
basicsEditSpec
"This resource specification was automatically generated
@@ -3532,7 +3568,7 @@
)
! !
-!MenuEditor::ItemAction methodsFor:'accessing'!
+!MenuEditor::ActionItem methodsFor:'accessing'!
menuItem
|item|
@@ -3556,12 +3592,12 @@
submenu := anItem submenu.
submenu notNil ifTrue:[
- item := MenuEditor::ItemMenu new
+ item := MenuEditor::MenuItem new
] ifFalse:[
- anItem submenuChannel ifNil:[
- ^ self
- ].
- item := MenuEditor::ItemLinkedMenu new
+ anItem submenuChannel isNil ifTrue:[
+ ^ self
+ ].
+ item := MenuEditor::LinkedMenuItem new
].
item getDelayedAttributesFrom:anItem.
self add:item.
@@ -3576,7 +3612,7 @@
)
! !
-!MenuEditor::ItemAction methodsFor:'adding & removing'!
+!MenuEditor::ActionItem methodsFor:'adding & removing'!
add:anItem
"add an item; test whether the item is a delayed menu and
@@ -3596,7 +3632,7 @@
^ anItem
! !
-!MenuEditor::ItemAction methodsFor:'aspects'!
+!MenuEditor::ActionItem methodsFor:'aspects'!
aspectAt:aKey put:aValue
"pass the argument to the delayed menu if existant
@@ -3634,20 +3670,20 @@
].
! !
-!MenuEditor::ItemAction methodsFor:'displaying'!
+!MenuEditor::ActionItem methodsFor:'displaying'!
icon
^ self class iconItem
! !
-!MenuEditor::ItemAction methodsFor:'initialization'!
+!MenuEditor::ActionItem methodsFor:'initialization'!
initialize
super initialize.
isExpanded := true.
! !
-!MenuEditor::ItemAction methodsFor:'queries'!
+!MenuEditor::ActionItem methodsFor:'queries'!
canCollapse
^ false
@@ -3667,7 +3703,7 @@
^ true
! !
-!MenuEditor::ItemAction methodsFor:'queries - operation'!
+!MenuEditor::ActionItem methodsFor:'queries - operation'!
canAddDelayedMenu
"returns true if a delayed menu can be added
@@ -3675,13 +3711,13 @@
^ self hasDelayedMenu not
! !
-!MenuEditor::ItemLinkedMenu class methodsFor:'defaults'!
+!MenuEditor::LinkedMenuItem class methodsFor:'defaults'!
defaultLabel
^ 'Linked Menu'
! !
-!MenuEditor::ItemLinkedMenu class methodsFor:'interface - specs'!
+!MenuEditor::LinkedMenuItem class methodsFor:'interface - specs'!
basicsEditSpec
"This resource specification was automatically generated
@@ -3852,7 +3888,7 @@
)
! !
-!MenuEditor::ItemLinkedMenu methodsFor:'accessing'!
+!MenuEditor::LinkedMenuItem methodsFor:'accessing'!
argument:aValue
menuItem argument:aValue.
@@ -3891,7 +3927,7 @@
menuItem submenuChannel:aValue.
! !
-!MenuEditor::ItemLinkedMenu methodsFor:'aspects'!
+!MenuEditor::LinkedMenuItem methodsFor:'aspects'!
aspectAt:aKey put:aValue
"set a specific aspect named aKey to the aValue
@@ -3914,7 +3950,7 @@
aMenuItem keepLinkedMenu:(menuItem keepLinkedMenu).
! !
-!MenuEditor::ItemLinkedMenu methodsFor:'displaying'!
+!MenuEditor::LinkedMenuItem methodsFor:'displaying'!
displayLabel
"returns the label dependent on is delayed or not
@@ -3928,13 +3964,13 @@
^ self class iconLinkedMenu
! !
-!MenuEditor::ItemLinkedMenu methodsFor:'queries'!
+!MenuEditor::LinkedMenuItem methodsFor:'queries'!
isKindOfMenu
^ true
! !
-!MenuEditor::ItemMenu class methodsFor:'defaults'!
+!MenuEditor::MenuItem class methodsFor:'defaults'!
defaultDelayedLabel
^ 'delayed'
@@ -3944,17 +3980,26 @@
^ 'Menu'
! !
-!MenuEditor::ItemMenu class methodsFor:'instance creation'!
+!MenuEditor::MenuItem class methodsFor:'instance creation'!
menu:aMenu labeled:aString
|item|
item := self new.
item menu:aMenu labeled:aString.
- ^ item
+ ^ item
+!
+
+menu:aMenu labeled:aString translateLabel:translateLabel
+ |item|
+
+ item := self new.
+ item menu:aMenu labeled:aString.
+ item translateLabel:translateLabel.
+ ^ item
! !
-!MenuEditor::ItemMenu class methodsFor:'interface - specs'!
+!MenuEditor::MenuItem class methodsFor:'interface - specs'!
basicsEditSpec
"This resource specification was automatically generated
@@ -4067,7 +4112,7 @@
)
! !
-!MenuEditor::ItemMenu methodsFor:'accessing'!
+!MenuEditor::MenuItem methodsFor:'accessing'!
argument:aValue
"/ ignorred.
@@ -4149,7 +4194,7 @@
^ menu
! !
-!MenuEditor::ItemMenu methodsFor:'aspects'!
+!MenuEditor::MenuItem methodsFor:'aspects'!
getDelayedAttributesFrom:aMenuItem
@@ -4162,7 +4207,7 @@
aMenuItem horizontalLayout:(menuItem horizontalLayout).
! !
-!MenuEditor::ItemMenu methodsFor:'displaying'!
+!MenuEditor::MenuItem methodsFor:'displaying'!
displayLabel
"returns the label dependent on is delayed or not
@@ -4176,7 +4221,7 @@
^ self class iconMenu
! !
-!MenuEditor::ItemMenu methodsFor:'queries'!
+!MenuEditor::MenuItem methodsFor:'queries'!
canAddChildren
"children can be added
@@ -4198,399 +4243,6 @@
^ true
! !
-!MenuEditor::ItemRoot class methodsFor:'defaults'!
-
-defaultLabel
- ^ MenuEditor resourceType
-! !
-
-!MenuEditor::ItemRoot class methodsFor:'interface - editor'!
-
-addBindingsTo:aspects for:aMenuEditor
- "add additional bindings to the aspects
- "
-! !
-
-!MenuEditor::ItemRoot class methodsFor:'interface - specs'!
-
-basicsEditSpec
- "This resource specification was automatically generated
- by the UIPainter of ST/X."
-
- "Do not manually edit this!! If it is corrupted,
- the UIPainter may not be able to read the specification."
-
- "
- UIPainter new openOnClass:MenuEditor::ItemRoot andSelector:#basicsEditSpec
- "
-
- <resource: #canvas>
-
- ^
- #(#FullSpec
- #name: #basicsEditSpec
- #window:
- #(#WindowSpec
- #label: 'basicsEditSpec'
- #name: 'basicsEditSpec'
- #min: #(#Point 10 10)
- #max: #(#Point 1280 1024)
- #bounds: #(#Rectangle 644 547 904 593)
- )
- #component:
- #(#SpecCollection
- #collection: #(
- #(#LabelSpec
- #label: 'Selector:'
- #name: 'selectorLabel'
- #layout: #(#AlignmentOrigin 107 0 26 0 1 0.5)
- #activeHelpKey: #basicsSelector
- #resizeForLabel: true
- #adjust: #right
- )
- #(#InputFieldSpec
- #name: 'selectorField'
- #layout: #(#LayoutFrame 110 0 15 0 -5 1.0 37 0)
- #activeHelpKey: #basicsSelector
- #tabable: true
- #model: #rawLabel
- #group: #inputGroup
- #type: #string
- #immediateAccept: false
- #acceptOnReturn: true
- #acceptOnTab: true
- #acceptChannel: #acceptChannel
- #modifiedChannel: #modifiedChannel
- #acceptOnPointerLeave: false
- )
- )
-
- )
- )
-! !
-
-!MenuEditor::ItemRoot methodsFor:'accessing'!
-
-menuItem:aMenuItem
- "rebuild self from a MenuItem
- "
- |submenu selector|
-
- aMenuItem notNil ifTrue:[
- submenu := aMenuItem submenu.
- selector := aMenuItem rawLabel.
- ] ifFalse:[
- selector := submenu := nil.
- ].
- self menu:submenu labeled:selector.
-!
-
-rawLabel:aValue
- "set the label assigned to the item
- "
- |value|
-
- aValue isString ifTrue:[
- value := aValue withoutSeparators.
-
- (value notEmpty and:[value first isLetter]) ifTrue:[
- menuItem rawLabel:(value asSymbol)
- ].
- ].
-!
-
-slices
- ^ #(
- (Basics basicsEditSpec)
- )
-! !
-
-!MenuEditor::ItemRoot methodsFor:'adding & removing'!
-
-remove
- "cannot remove the root item; delete all my children
- "
- self removeAll.
-! !
-
-!MenuEditor::ItemRoot methodsFor:'aspects'!
-
-aspectAt:aKey put:aValue
- "discard all other than the rawLabel
- "
- aKey == #rawLabel ifTrue:[ self rawLabel:aValue ].
-! !
-
-!MenuEditor::ItemRoot methodsFor:'displaying'!
-
-heightOn:aGC
- height ifNil:[ height := aGC font heightOn:aGC device ].
- ^ height
-! !
-
-!MenuEditor::ItemRoot methodsFor:'initialization'!
-
-initialize
- super initialize.
- isExpanded := true.
-! !
-
-!MenuEditor::ItemRoot methodsFor:'queries'!
-
-canCollapse
- ^ false
-!
-
-hasIndicator
- ^ false
-!
-
-isDelayedMenu
- ^ false
-!
-
-isRootItem
- ^ true
-! !
-
-!MenuEditor::ItemRoot methodsFor:'queries - editor'!
-
-actionSelectors
- "returns my action selectors
- "
- ^ #()
-!
-
-aspectSelectors
- "returns my aspect selectors
- "
- ^ #()
-! !
-
-!MenuEditor::ItemRoot methodsFor:'queries - operation'!
-
-canMoveInAbove
- ^ false
-!
-
-canMoveInNext
- ^ false
-!
-
-canMoveOut
- ^ false
-!
-
-canMoveUpOrDown
- ^ false
-! !
-
-!MenuEditor::ItemSeparator class methodsFor:'interface - editor'!
-
-addBindingsTo:aspects for:aMenuEditor
- "add additional bindings to the aspects
- "
- |holder|
-
- aspects at:#seperatorList ifAbsentPut:[
- self separatorSlices collect:[:el| el last ]
- ].
-
- aspects at:#seperatorSelection ifAbsentPut:[
- holder := 0 asValue.
- holder addDependent:aMenuEditor.
- holder
- ].
-!
-
-defaultLabel
- ^ '-'
-!
-
-separatorSlices
- "get the list of menu spec values of the corresponding separator types
- "
- ^ #(
- ( #blank '' 'blank' )
- ( #single '-' 'single line')
- ( #double '=' 'double line')
- )
-! !
-
-!MenuEditor::ItemSeparator class methodsFor:'interface - specs'!
-
-basicsEditSpec
- "This resource specification was automatically generated
- by the UIPainter of ST/X."
-
- "Do not manually edit this!! If it is corrupted,
- the UIPainter may not be able to read the specification."
-
- "
- UIPainter new openOnClass:MenuEditor::ItemSeparator andSelector:#basicsEditSpec
- "
-
- <resource: #canvas>
-
- ^
- #(#FullSpec
- #name: #basicsEditSpec
- #window:
- #(#WindowSpec
- #label: 'basicsEditSpec'
- #name: 'basicsEditSpec'
- #min: #(#Point 10 10)
- #max: #(#Point 1160 870)
- #bounds: #(#Rectangle 160 398 420 643)
- )
- #component:
- #(#SpecCollection
- #collection: #(
- #(#LabelSpec
- #label: 'Separator:'
- #name: 'separatorLabel'
- #layout: #(#AlignmentOrigin 107 0 26 0 1 0.5)
- #resizeForLabel: true
- #adjust: #right
- )
- #(#ComboListSpec
- #name: 'seperatorList'
- #layout: #(#LayoutFrame 110 0 15 0 -5 1.0 37 0)
- #activeHelpKey: #basicsSeparatorType
- #tabable: true
- #model: #seperatorSelection
- #comboList: #seperatorList
- #useIndex: true
- )
- #(#LabelSpec
- #label: 'Visibility:'
- #name: 'visibilityLabel'
- #layout: #(#AlignmentOrigin 107 0 51 0 1 0.5)
- #resizeForLabel: true
- #adjust: #right
- )
- #(#InputFieldSpec
- #name: 'visibilityInputField'
- #layout: #(#LayoutFrame 110 0 40 0 -5 1.0 62 0)
- #activeHelpKey: #detailsVisibility
- #tabable: true
- #model: #isVisible
- #group: #inputGroup
- #type: #symbolOrNil
- #immediateAccept: false
- #acceptOnReturn: true
- #acceptOnTab: true
- #acceptChannel: #acceptChannel
- #modifiedChannel: #modifiedChannel
- #acceptOnPointerLeave: false
- )
- #(#LabelSpec
- #label: 'Start Group:'
- #name: 'startGroupLabel'
- #layout: #(#AlignmentOrigin 107 0 88 0 1 0.5)
- #resizeForLabel: true
- #adjust: #right
- )
- #(#PopUpListSpec
- #label: 'left'
- #name: 'startGroupPopUp'
- #layout: #(#LayoutFrame 110 0 77 0 -5 1.0 99 0)
- #activeHelpKey: #detailsStartGroup
- #tabable: true
- #model: #startGroup
- #menu:
- #(#left
- #right
- )
- )
- )
-
- )
- )
-! !
-
-!MenuEditor::ItemSeparator methodsFor:'accessing'!
-
-icon
- ^ self class iconSeparator
-!
-
-rawLabel:aValue
- |value|
-
- aValue isString ifTrue:[
- value := aValue withoutSeparators.
-
- (self class separatorTypeOf:value) ifNotNil:[
- menuItem rawLabel:value
- ]
- ].
-!
-
-separatorType
- ^ self class separatorTypeOf:(menuItem rawLabel).
-!
-
-slices
- ^ #(
- (Basics basicsEditSpec)
- )
-! !
-
-!MenuEditor::ItemSeparator methodsFor:'aspects'!
-
-fromAspects:aspects
- "put my values into the values of aspects
- "
- |index slice|
-
- index := (aspects at:#seperatorSelection) value ? 0.
- slice := self class separatorSlices at:index ifAbsent:nil.
-
- slice ifNotNil:[ slice := slice at:2 ].
-
- (aspects at:#rawLabel) value:slice.
- ^ super fromAspects:aspects.
-!
-
-toAspects:aspects
- "put my values into the values of aspects
- "
- |index type|
-
- type := self separatorType.
- index := self class separatorSlices findFirst:[:el| el first == type ].
-
- (aspects at:#seperatorSelection) value:index.
- ^ super toAspects:aspects.
-! !
-
-!MenuEditor::ItemSeparator methodsFor:'displaying'!
-
-displayOn:aGC x:x y:y h:h
- "draw the receiver in the graphicsContext, aGC.
- "
- |x1 y0 type|
-
- type := self separatorType.
- type == #blank ifTrue:[ ^ self ].
-
- x1 := x + (self widthOn:aGC).
- y0 := y + (h // 2) - 1.
-
- type == #double ifTrue:[
- y0 := y0 + 1.
- aGC displayLineFromX:x y:y0 toX:x1 y:y0.
- y0 := y0 - 2
- ].
- aGC displayLineFromX:x y:y0 toX:x1 y:y0
-!
-
-widthOn:aGC
- width ifNil:[ width := 60 ].
- ^ width
-! !
-
!MenuEditor::ResourceEditor class methodsFor:'interface specs'!
windowSpec
@@ -5035,6 +4687,399 @@
].
! !
+!MenuEditor::RootItem class methodsFor:'defaults'!
+
+defaultLabel
+ ^ MenuEditor resourceType
+! !
+
+!MenuEditor::RootItem class methodsFor:'interface - editor'!
+
+addBindingsTo:aspects for:aMenuEditor
+ "add additional bindings to the aspects
+ "
+! !
+
+!MenuEditor::RootItem class methodsFor:'interface - specs'!
+
+basicsEditSpec
+ "This resource specification was automatically generated
+ by the UIPainter of ST/X."
+
+ "Do not manually edit this!! If it is corrupted,
+ the UIPainter may not be able to read the specification."
+
+ "
+ UIPainter new openOnClass:MenuEditor::ItemRoot andSelector:#basicsEditSpec
+ "
+
+ <resource: #canvas>
+
+ ^
+ #(#FullSpec
+ #name: #basicsEditSpec
+ #window:
+ #(#WindowSpec
+ #label: 'basicsEditSpec'
+ #name: 'basicsEditSpec'
+ #min: #(#Point 10 10)
+ #max: #(#Point 1280 1024)
+ #bounds: #(#Rectangle 644 547 904 593)
+ )
+ #component:
+ #(#SpecCollection
+ #collection: #(
+ #(#LabelSpec
+ #label: 'Selector:'
+ #name: 'selectorLabel'
+ #layout: #(#AlignmentOrigin 107 0 26 0 1 0.5)
+ #activeHelpKey: #basicsSelector
+ #resizeForLabel: true
+ #adjust: #right
+ )
+ #(#InputFieldSpec
+ #name: 'selectorField'
+ #layout: #(#LayoutFrame 110 0 15 0 -5 1.0 37 0)
+ #activeHelpKey: #basicsSelector
+ #tabable: true
+ #model: #rawLabel
+ #group: #inputGroup
+ #type: #string
+ #immediateAccept: false
+ #acceptOnReturn: true
+ #acceptOnTab: true
+ #acceptChannel: #acceptChannel
+ #modifiedChannel: #modifiedChannel
+ #acceptOnPointerLeave: false
+ )
+ )
+
+ )
+ )
+! !
+
+!MenuEditor::RootItem methodsFor:'accessing'!
+
+menuItem:aMenuItem
+ "rebuild self from a MenuItem
+ "
+ |submenu selector|
+
+ aMenuItem notNil ifTrue:[
+ submenu := aMenuItem submenu.
+ selector := aMenuItem rawLabel.
+ ] ifFalse:[
+ selector := submenu := nil.
+ ].
+ self menu:submenu labeled:selector.
+!
+
+rawLabel:aValue
+ "set the label assigned to the item
+ "
+ |value|
+
+ aValue isString ifTrue:[
+ value := aValue withoutSeparators.
+
+ (value notEmpty and:[value first isLetter]) ifTrue:[
+ menuItem rawLabel:(value asSymbol)
+ ].
+ ].
+!
+
+slices
+ ^ #(
+ (Basics basicsEditSpec)
+ )
+! !
+
+!MenuEditor::RootItem methodsFor:'adding & removing'!
+
+remove
+ "cannot remove the root item; delete all my children
+ "
+ self removeAll.
+! !
+
+!MenuEditor::RootItem methodsFor:'aspects'!
+
+aspectAt:aKey put:aValue
+ "discard all other than the rawLabel
+ "
+ aKey == #rawLabel ifTrue:[ self rawLabel:aValue ].
+! !
+
+!MenuEditor::RootItem methodsFor:'displaying'!
+
+heightOn:aGC
+ height ifNil:[ height := aGC font heightOn:aGC device ].
+ ^ height
+! !
+
+!MenuEditor::RootItem methodsFor:'initialization'!
+
+initialize
+ super initialize.
+ isExpanded := true.
+! !
+
+!MenuEditor::RootItem methodsFor:'queries'!
+
+canCollapse
+ ^ false
+!
+
+hasIndicator
+ ^ false
+!
+
+isDelayedMenu
+ ^ false
+!
+
+isRootItem
+ ^ true
+! !
+
+!MenuEditor::RootItem methodsFor:'queries - editor'!
+
+actionSelectors
+ "returns my action selectors
+ "
+ ^ #()
+!
+
+aspectSelectors
+ "returns my aspect selectors
+ "
+ ^ #()
+! !
+
+!MenuEditor::RootItem methodsFor:'queries - operation'!
+
+canMoveInAbove
+ ^ false
+!
+
+canMoveInNext
+ ^ false
+!
+
+canMoveOut
+ ^ false
+!
+
+canMoveUpOrDown
+ ^ false
+! !
+
+!MenuEditor::SeparatorItem class methodsFor:'interface - editor'!
+
+addBindingsTo:aspects for:aMenuEditor
+ "add additional bindings to the aspects
+ "
+ |holder|
+
+ aspects at:#seperatorList ifAbsentPut:[
+ self separatorSlices collect:[:el| el last ]
+ ].
+
+ aspects at:#seperatorSelection ifAbsentPut:[
+ holder := 0 asValue.
+ holder addDependent:aMenuEditor.
+ holder
+ ].
+!
+
+defaultLabel
+ ^ '-'
+!
+
+separatorSlices
+ "get the list of menu spec values of the corresponding separator types
+ "
+ ^ #(
+ ( #blank '' 'blank' )
+ ( #single '-' 'single line')
+ ( #double '=' 'double line')
+ )
+! !
+
+!MenuEditor::SeparatorItem class methodsFor:'interface - specs'!
+
+basicsEditSpec
+ "This resource specification was automatically generated
+ by the UIPainter of ST/X."
+
+ "Do not manually edit this!! If it is corrupted,
+ the UIPainter may not be able to read the specification."
+
+ "
+ UIPainter new openOnClass:MenuEditor::ItemSeparator andSelector:#basicsEditSpec
+ "
+
+ <resource: #canvas>
+
+ ^
+ #(#FullSpec
+ #name: #basicsEditSpec
+ #window:
+ #(#WindowSpec
+ #label: 'basicsEditSpec'
+ #name: 'basicsEditSpec'
+ #min: #(#Point 10 10)
+ #max: #(#Point 1160 870)
+ #bounds: #(#Rectangle 160 398 420 643)
+ )
+ #component:
+ #(#SpecCollection
+ #collection: #(
+ #(#LabelSpec
+ #label: 'Separator:'
+ #name: 'separatorLabel'
+ #layout: #(#AlignmentOrigin 107 0 26 0 1 0.5)
+ #resizeForLabel: true
+ #adjust: #right
+ )
+ #(#ComboListSpec
+ #name: 'seperatorList'
+ #layout: #(#LayoutFrame 110 0 15 0 -5 1.0 37 0)
+ #activeHelpKey: #basicsSeparatorType
+ #tabable: true
+ #model: #seperatorSelection
+ #comboList: #seperatorList
+ #useIndex: true
+ )
+ #(#LabelSpec
+ #label: 'Visibility:'
+ #name: 'visibilityLabel'
+ #layout: #(#AlignmentOrigin 107 0 51 0 1 0.5)
+ #resizeForLabel: true
+ #adjust: #right
+ )
+ #(#InputFieldSpec
+ #name: 'visibilityInputField'
+ #layout: #(#LayoutFrame 110 0 40 0 -5 1.0 62 0)
+ #activeHelpKey: #detailsVisibility
+ #tabable: true
+ #model: #isVisible
+ #group: #inputGroup
+ #type: #symbolOrNil
+ #immediateAccept: false
+ #acceptOnReturn: true
+ #acceptOnTab: true
+ #acceptChannel: #acceptChannel
+ #modifiedChannel: #modifiedChannel
+ #acceptOnPointerLeave: false
+ )
+ #(#LabelSpec
+ #label: 'Start Group:'
+ #name: 'startGroupLabel'
+ #layout: #(#AlignmentOrigin 107 0 88 0 1 0.5)
+ #resizeForLabel: true
+ #adjust: #right
+ )
+ #(#PopUpListSpec
+ #label: 'left'
+ #name: 'startGroupPopUp'
+ #layout: #(#LayoutFrame 110 0 77 0 -5 1.0 99 0)
+ #activeHelpKey: #detailsStartGroup
+ #tabable: true
+ #model: #startGroup
+ #menu:
+ #(#left
+ #right
+ )
+ )
+ )
+
+ )
+ )
+! !
+
+!MenuEditor::SeparatorItem methodsFor:'accessing'!
+
+icon
+ ^ self class iconSeparator
+!
+
+rawLabel:aValue
+ |value|
+
+ aValue isString ifTrue:[
+ value := aValue withoutSeparators.
+
+ (self class separatorTypeOf:value) ifNotNil:[
+ menuItem rawLabel:value
+ ]
+ ].
+!
+
+separatorType
+ ^ self class separatorTypeOf:(menuItem rawLabel).
+!
+
+slices
+ ^ #(
+ (Basics basicsEditSpec)
+ )
+! !
+
+!MenuEditor::SeparatorItem methodsFor:'aspects'!
+
+fromAspects:aspects
+ "put my values into the values of aspects
+ "
+ |index slice|
+
+ index := (aspects at:#seperatorSelection) value ? 0.
+ slice := self class separatorSlices at:index ifAbsent:nil.
+
+ slice ifNotNil:[ slice := slice at:2 ].
+
+ (aspects at:#rawLabel) value:slice.
+ ^ super fromAspects:aspects.
+!
+
+toAspects:aspects
+ "put my values into the values of aspects
+ "
+ |index type|
+
+ type := self separatorType.
+ index := self class separatorSlices findFirst:[:el| el first == type ].
+
+ (aspects at:#seperatorSelection) value:index.
+ ^ super toAspects:aspects.
+! !
+
+!MenuEditor::SeparatorItem methodsFor:'displaying'!
+
+displayOn:aGC x:x y:y h:h
+ "draw the receiver in the graphicsContext, aGC.
+ "
+ |x1 y0 type|
+
+ type := self separatorType.
+ type == #blank ifTrue:[ ^ self ].
+
+ x1 := x + (self widthOn:aGC).
+ y0 := y + (h // 2) - 1.
+
+ type == #double ifTrue:[
+ y0 := y0 + 1.
+ aGC displayLineFromX:x y:y0 toX:x1 y:y0.
+ y0 := y0 - 2
+ ].
+ aGC displayLineFromX:x y:y0 toX:x1 y:y0
+!
+
+widthOn:aGC
+ width ifNil:[ width := 60 ].
+ ^ width
+! !
+
!MenuEditor class methodsFor:'documentation'!
version