MenuEditor.st
changeset 912 931b23146b3d
parent 902 f510032000ad
child 916 ec057a5e0efc
equal deleted inserted replaced
911:ec8db5b62352 912:931b23146b3d
  2771 ! !
  2771 ! !
  2772 
  2772 
  2773 !MenuEditor::TreeView methodsFor:'menus'!
  2773 !MenuEditor::TreeView methodsFor:'menus'!
  2774 
  2774 
  2775 doCopy
  2775 doCopy
       
  2776     |clip|
  2776 
  2777 
  2777     self hasSelection ifTrue:[
  2778     self hasSelection ifTrue:[
  2778         self application clipboard: OrderedCollection new.
  2779         self application clipboard:(clip := OrderedCollection new).
  2779         self selectionDo:[:i| self application clipboard add:((listOfNodes at:i) copy)].
  2780         self selectionDo:[:i | clip add:((listOfNodes at:i) copy)].
  2780         self topView application updateAllToolInstances.
  2781         self topView application updateAllToolInstances.
  2781     ]
  2782     ]
  2782 !
  2783 !
  2783 
  2784 
  2784 doCreateItem
  2785 doCreateItem
  2812 
  2813 
  2813     self addElement:(self nodeLabel:nil)
  2814     self addElement:(self nodeLabel:nil)
  2814 !
  2815 !
  2815 
  2816 
  2816 doCut
  2817 doCut
  2817 
  2818     |app|
  2818     (self topView application hasValidSelection value and: [self askForItemModification])
  2819 
       
  2820     app := self topView application.
       
  2821     (app hasValidSelection value and: [self askForItemModification])
  2819     ifTrue:
  2822     ifTrue:
  2820     [
  2823     [
  2821         |selectedNodes|
  2824         |selectedNodes|
  2822         self doCopy.
  2825         self doCopy.
  2823         selectedNodes := self selection asSortedCollection.
  2826         selectedNodes := self selection asSortedCollection.
  2824         self selectedNodesRemove.
  2827         self selectedNodesRemove.
  2825         self selection: selectedNodes first - 1.
  2828         self selection: selectedNodes first - 1.
  2826         self setModified.
  2829         self setModified.
  2827         self topView application updateAllToolInstances.
  2830         app updateAllToolInstances.
  2828     ]
  2831     ]
  2829 
  2832 
  2830 !
  2833 !
  2831 
  2834 
  2832 doDelete
  2835 doDelete
  2842     ]
  2845     ]
  2843 
  2846 
  2844 !
  2847 !
  2845 
  2848 
  2846 doPaste
  2849 doPaste
  2847 
  2850     |clip|
  2848     (self application clipboard notNil and:[self selectedNode notNil]) ifTrue:[
  2851 
  2849         self addElement:(self application clipboard collect:[:el| el copy])
  2852     clip := self application clipboard.
       
  2853     (clip notNil and:[self selectedNode notNil]) ifTrue:[
       
  2854         self addElement:(clip collect:[:el| el copy])
  2850     ].
  2855     ].
  2851 ! !
  2856 ! !
  2852 
  2857 
  2853 !MenuEditor::TreeView methodsFor:'private'!
  2858 !MenuEditor::TreeView methodsFor:'private'!
  2854 
  2859 
  2919 
  2924 
  2920 
  2925 
  2921 !
  2926 !
  2922 
  2927 
  2923 setModified 
  2928 setModified 
  2924 
  2929     |app|
  2925     self topView application modified: true.
  2930 
  2926 
  2931     (app := self topView application) modified: true.
  2927     self topView application updateChannels
  2932     app updateChannels
  2928 ! !
  2933 ! !
  2929 
  2934 
  2930 !MenuEditor class methodsFor:'documentation'!
  2935 !MenuEditor class methodsFor:'documentation'!
  2931 
  2936 
  2932 version
  2937 version