diff --git a/repository/Grafoscopio/GrafoscopioGUI.class.st b/repository/Grafoscopio/GrafoscopioGUI.class.st index 80e18f7..0e8dfe8 100644 --- a/repository/Grafoscopio/GrafoscopioGUI.class.st +++ b/repository/Grafoscopio/GrafoscopioGUI.class.st @@ -22,21 +22,11 @@ Class { #classInstVars : [ 'dockingBar', 'recentNotebooks', - 'cacheNode' + 'nodesClipboard' ], #category : #'Grafoscopio-UI' } -{ #category : #accessing } -GrafoscopioGUI class >> cacheNode [ - ^ cacheNode -] - -{ #category : #accessing } -GrafoscopioGUI class >> cacheNode: anObject [ - cacheNode := anObject -] - { #category : #specs } GrafoscopioGUI class >> defaultSpec [ @@ -389,6 +379,16 @@ GrafoscopioGUI class >> messageNotImplementedYet [ title: 'No implementado aún'. ] +{ #category : #accessing } +GrafoscopioGUI class >> nodesClipboard [ + ^ nodesClipboard +] + +{ #category : #accessing } +GrafoscopioGUI class >> nodesClipboard: anObject [ + nodesClipboard := anObject +] + { #category : #'graphical interface' } GrafoscopioGUI class >> open [ ^ self new open diff --git a/repository/Grafoscopio/GrafoscopioNode.class.st b/repository/Grafoscopio/GrafoscopioNode.class.st index 980e590..83fe029 100644 --- a/repository/Grafoscopio/GrafoscopioNode.class.st +++ b/repository/Grafoscopio/GrafoscopioNode.class.st @@ -246,6 +246,12 @@ GrafoscopioNode >> content: anObject [ body := anObject ] +{ #category : #'add/remove nodes' } +GrafoscopioNode >> copyToClipboard [ + GrafoscopioGUI nodesClipboard: self copy. + +] + { #category : #movement } GrafoscopioNode >> demote [ "Moves the current node down in the hierachy, making a children of its current previous slibing" @@ -368,9 +374,10 @@ GrafoscopioNode >> initialize [ "Creates a empty new node" super initialize. - self header: 'newHeader'. - self body: ''. - self key: '' + self + header: 'newHeader'; + body: ''; + level: 0 ] { #category : #accessing } @@ -532,6 +539,14 @@ GrafoscopioNode >> parent: aNode [ parent := aNode ] +{ #category : #'add/remove nodes' } +GrafoscopioNode >> pasteFromClipboard [ + GrafoscopioGUI nodesClipboard + ifNotNil: [ self addNode: GrafoscopioGUI nodesClipboard ] + ifNil: [ self inform: 'Cache is emtpy. Pleas cut/copy a node before pasting' ] + +] + { #category : #exporting } GrafoscopioNode >> preorderTraversal [ nodesInPreorder := OrderedCollection new.