diff -r b46624bb6994 -r 94fcd912ef88 MenuEditor.st --- a/MenuEditor.st Fri May 11 13:22:03 2001 +0200 +++ b/MenuEditor.st Thu May 17 13:09:50 2001 +0200 @@ -196,16 +196,16 @@ ^super helpSpec addPairsFrom:#( #addMenuItem -'Adds a new menu item.' +'Add a new menu item.' #addMenuSeparator -'Adds a new menu separator.' +'Add a new menu separator.' #addSubMenu -'Adds a new sub menu.' +'Add a new sub menu.' #addSubMenuLink -'Adds a new linked sub menu.' +'Add a new linked sub menu.' #basicsAction 'An action selector with 0, 1 (the argument field), or 2 (the selected item) arguments.' @@ -223,7 +223,7 @@ 'Aspect for boolean holder, block, or method, specifying the indication state (CheckToggle behavior).' #basicsIsButton -'Turns on/off a button behavior.' +'Enable/disable button-like behavior.' #basicsKey 'Internal key of the item (optional, for programmed accesses).' @@ -271,28 +271,28 @@ 'Aspect or binding providing a boolean value holder for the visibility-state of the menu item.' #fileLoad -'Opens a dialog to select and load a menu spec from a class.' +'Open a dialog to select and load a menu spec from a class.' #fileNew -'Creates a new menu spec.' +'Create a new menu spec.' #filePickAMenu 'Select a menu from an open view and read its specification' #fileSave -'Saves the menu spec (and the help spec, if modified).' +'Save the menu spec (and the help spec, if modified).' #fileSaveAs -'Opens a dialog to save the menu spec (and the help spec, if modified).' +'Open a dialog to save the menu spec (and the help spec, if modified).' #hideMenuOnActivated -'If on, the menu hides itself after an item was activated' +'If on, the menu hides itself after the item was activated.' #imageImageAndLabel -'Toggles display of both image and textual label.' +'Toggle display of both image and textual label.' #imageImageEditor -'Opens an Image Editor on the resource method defined by retriever and selector.' +'Open an Image Editor on the resource method defined by retriever and selector.' #imageImageList 'Currently existing image resources.' @@ -304,13 +304,13 @@ 'Selector returning an image (sent to above or the application).' #keepLinkedMenu -'Keep the linked menu after activation (do not destroy)' +'Keep the linked menu after activation (do not destroy).' #showBusyCursorWhilePerforming -'If on, a busy cursor is shown while an items action is performed' +'If on, a busy cursor is shown while the items action is performing.' #triggerOnDown -'If on, the items action is performed on mouse-button press (default is on button-release)' +'If on, the items action is performed on mouse-button press (default is on button-release).' ) ! ! @@ -889,6 +889,7 @@ #layout: #(#AlignmentOrigin 107 0 26 0 1 0.5) #resizeForLabel: true #adjust: #right + #activeHelpKey: #basicsSelector ) #(#InputFieldSpec #name: 'selectorField' @@ -1947,6 +1948,14 @@ #labelImage: #(#ResourceRetriever #Icon #downRightIcon) ) #(#MenuItem + #label: 'Move In Above' + #isButton: true + #value: #doStepInAbove + #activeHelpKey: #editMoveInAbove + #enabled: #valueOfEnableMovingInAbove + #labelImage: #(#ResourceRetriever #Icon #upRightIcon) + ) + #(#MenuItem #label: 'Move Out' #isButton: true #value: #doStepOut @@ -2174,18 +2183,24 @@ updateChannels "update channels" - |node parent next state canPaste| + |node parent next prev state canPaste selectedNodes firstParent + enableMovingOut enableMovingIn indices indexOfLast| + + enableMovingOut := enableMovingIn := false. state := false. node := treeView selectedNode. node notNil ifTrue:[ + "/ single node selected self hasAnySingleSelection value:true. canPaste := self valueOfCanPaste value. (parent := node parent) notNil ifTrue:[ next := parent childAt:((parent indexOfChild:node) + 1). + prev := parent childAt:((parent indexOfChild:node) - 1). self valueOfEnableMovingIn value:(next notNil and:[next hasChildren]). + self valueOfEnableMovingInAbove value:(prev notNil and:[prev hasChildren]). self valueOfEnableMovingUpOrDown value:(parent children size > 1). self valueOfEnableMovingOut value:parent parent notNil. self hasValidSelection value:true. @@ -2193,21 +2208,39 @@ ^ self ]. ] ifFalse:[ + "/ multiple nodes selected canPaste := false. self hasAnySingleSelection value:false. treeView numberOfSelections ~~ 0 ifTrue:[ canPaste := false. - state := (treeView isInSelection:1) not + state := (treeView isInSelection:1) not. + + selectedNodes := treeView selectedNodes. + + "/ see if all selected nodes have a common parent. + firstParent := selectedNodes first parent. + (selectedNodes conform:[:eachNode | eachNode parent == firstParent]) ifTrue:[ + "/ yes - they have +"/ next := firstParent childAt:((firstParent indexOfChild:node) + 1). +"/ self valueOfEnableMovingIn value:(next notNil and:[next hasChildren]). + enableMovingOut := firstParent parent notNil. +"/ self halt. + + indexOfLast := (selectedNodes collect:[:eachNode | firstParent indexOfChild:eachNode]) max. + next := firstParent childAt:(indexOfLast + 1). + enableMovingIn := (next notNil and:[next hasChildren]). + ] ifFalse:[ +"/ self halt. + ]. ] ]. self valueOfEnableMovingUpOrDown value:false. - self valueOfEnableMovingIn value:false. - self valueOfEnableMovingOut value:false. + self valueOfEnableMovingIn value:enableMovingIn. + self valueOfEnableMovingOut value:enableMovingOut. self hasValidSelection value:state. self valueOfCanPaste value:canPaste. - ! updateImageView @@ -2701,19 +2734,22 @@ doStepIn "move selected menu item into next submenu" - treeView selectedNodeBecomeChildOfNext. + "/ treeView selectedNodeBecomeChildOfNext. + treeView selectedNodesBecomeChildrenOfNext. modified := true. - - - - - +! + +doStepInAbove + "move selected menu item into previous submenu" + + treeView selectedNodeBecomeChildOfPrevious. + modified := true. ! doStepOut - "move selected menu item out from parent submenu" - - treeView selectedNodeBecomeSisterOfParent. + "move selected menu item(s) out from parent submenu" + + treeView selectedNodesBecomeSistersOfParent. modified := true. !