diff --git a/repository/Grafoscopio/GrafoscopioBrowser.class.st b/repository/Grafoscopio/GrafoscopioBrowser.class.st index f77ccf7..5aa3033 100644 --- a/repository/Grafoscopio/GrafoscopioBrowser.class.st +++ b/repository/Grafoscopio/GrafoscopioBrowser.class.st @@ -560,7 +560,7 @@ GrafoscopioBrowser >> treeOn: constructor [ "Adding nodes" act: [:treePresentation | (treePresentation selection) isNotNil - ifTrue: [treePresentation selection addNodeAfter]. + ifTrue: [treePresentation selection addNodeAfterMe]. treePresentation update] icon: GLMUIThemeExtraIcons glamorousZoomIn entitled: 'Adicionar nodo'; diff --git a/repository/Grafoscopio/GrafoscopioGUI.class.st b/repository/Grafoscopio/GrafoscopioGUI.class.st index b6a4fab..34453f2 100644 --- a/repository/Grafoscopio/GrafoscopioGUI.class.st +++ b/repository/Grafoscopio/GrafoscopioGUI.class.st @@ -613,7 +613,7 @@ GrafoscopioGUI class >> updateGrafoscopio [ Gofer new smalltalkhubUser: 'Offray' project: 'Grafoscopio'; package: 'Grafoscopio'; - load. + loadVersion: #development. self updateUI. ] diff --git a/repository/Grafoscopio/GrafoscopioNode.class.st b/repository/Grafoscopio/GrafoscopioNode.class.st index 908fa87..42830a7 100644 --- a/repository/Grafoscopio/GrafoscopioNode.class.st +++ b/repository/Grafoscopio/GrafoscopioNode.class.st @@ -82,11 +82,11 @@ GrafoscopioNode >> addNode: aNode [ ] { #category : #'add/remove nodes' } -GrafoscopioNode >> addNodeAfter [ +GrafoscopioNode >> addNodeAfterMe [ "Adds a generic node after the given node so they become slibings of the same parent" | genericNode | genericNode := GrafoscopioNode - header: 'nuevoNodo' body: ''. + header: 'newNode' body: ''. self parent children add: genericNode after: self. genericNode parent: self parent. genericNode level: self level. @@ -578,9 +578,6 @@ GrafoscopioNode >> removeLastNode [ { #category : #'add/remove nodes' } GrafoscopioNode >> removeNode: aNode [ - "Adds the given node to the receivers collection of children, and sets this object as the parent - of the node" - self children remove: aNode. ] diff --git a/repository/Grafoscopio/GrafoscopioNotebook.class.st b/repository/Grafoscopio/GrafoscopioNotebook.class.st index ffca276..b4b1482 100644 --- a/repository/Grafoscopio/GrafoscopioNotebook.class.st +++ b/repository/Grafoscopio/GrafoscopioNotebook.class.st @@ -48,7 +48,10 @@ GrafoscopioNotebook class >> defaultSpec [ { #category : #operation } GrafoscopioNotebook >> addNode [ - + tree needRebuild: true. + tree selectedItem content addNodeAfterMe. + tree roots: tree roots. + self buildWithSpecLayout: self class defaultSpec. ] @@ -73,7 +76,7 @@ GrafoscopioNotebook >> changeBody: aNodeCollection [ body := self instantiate: node specModelClass new. body content: node content. body needRebuild: true. - + body body whenTextChanged: [ :arg | node body: arg ]. header text: node header. self buildWithSpecLayout: self class defaultSpec. @@ -112,15 +115,15 @@ GrafoscopioNotebook >> header: anObject [ GrafoscopioNotebook >> initializePresenter [ tree whenSelectedItemsChanged: [ :arg | - arg isEmpty ifFalse: [self changeBody: arg ]]. - + arg isEmpty ifFalse: [self changeBody: arg ]]. header whenTextChanged: [ :arg | + Transcript show: arg. (tree selectedItem content header) = arg ifFalse: [ - (tree selectedItem) content header: header text. + (tree selectedItem) content header: arg. tree roots: tree roots]]. - body whenTextChanged: [ :arg | - (tree selectedItem) content body: body text + body whenTextChanged: [:arg | + Transcript show: arg ] ] @@ -129,15 +132,27 @@ GrafoscopioNotebook >> initializeWidgets [ windowMainMenu := self newWindowMainMenu. tree := TreeModel new. - body := self newText. - header := self newTextInput. + body := self newText. body disable. body text: '<-- Select a node in the left panel'. - tree childrenBlock: [:node | node children]; + tree + childrenBlock: [:node | node children]; displayBlock: [:node | node title ]. + self focusOrder + add: tree; + add: header; + add: body. +] + +{ #category : #operation } +GrafoscopioNotebook >> moveNodeBefore [ + tree selectedItem content moveAfter. + tree needRebuild: true. + tree roots: tree roots. + self buildWithSpecLayout: self class defaultSpec. ] { #category : #initialization } @@ -404,6 +419,18 @@ GrafoscopioNotebook >> projectSubMenu [ ] +{ #category : #operation } +GrafoscopioNotebook >> removeNode [ + | currentNode | + currentNode := tree selectedItem content. + currentNode parent removeNode: currentNode. + tree needRebuild: true. + tree roots: tree roots. + self buildWithSpecLayout: self class defaultSpec. + + +] + { #category : #persistence } GrafoscopioNotebook >> saveToFile: aFileReference [ "I save the current tree/document to a file"