diff --git a/repository/Grafoscopio/GrafoscopioNotebook.class.st b/repository/Grafoscopio/GrafoscopioNotebook.class.st index b4b1482..7834c88 100644 --- a/repository/Grafoscopio/GrafoscopioNotebook.class.st +++ b/repository/Grafoscopio/GrafoscopioNotebook.class.st @@ -67,22 +67,31 @@ GrafoscopioNotebook >> body: anObject [ ] { #category : #operation } -GrafoscopioNotebook >> changeBody: aNodeCollection [ - | node | - node := aNodeCollection first. +GrafoscopioNotebook >> changeBody: aNode [ self needRebuild: false. tree needRebuild: false. - body := self instantiate: node specModelClass new. - body content: node content. - body needRebuild: true. - body body whenTextChanged: [ :arg | node body: arg ]. - header text: node header. - + body := self instantiate: aNode specModelClass new. + body content: aNode content. + body body class = TextModel + ifTrue: [ + body body whenTextChanged: [ :arg | aNode body: arg ]]. + header text: aNode header. + body needRebuild: true. self buildWithSpecLayout: self class defaultSpec. ] +{ #category : #operation } +GrafoscopioNotebook >> demoteNode [ + | currentNode | + currentNode := tree selectedItem content. + currentNode demote. + tree needRebuild: true. + tree roots: tree roots. + self buildWithSpecLayout: self class defaultSpec. +] + { #category : #persistence } GrafoscopioNotebook >> exportAsSton: aNotebook on: aFileStream [ | stonPrettyString | @@ -115,16 +124,12 @@ GrafoscopioNotebook >> header: anObject [ GrafoscopioNotebook >> initializePresenter [ tree whenSelectedItemsChanged: [ :arg | - arg isEmpty ifFalse: [self changeBody: arg ]]. + arg isEmpty ifFalse: [self changeBody: tree selectedItem content ]]. header whenTextChanged: [ :arg | - Transcript show: arg. (tree selectedItem content header) = arg ifFalse: [ (tree selectedItem) content header: arg. - tree roots: tree roots]]. - body whenTextChanged: [:arg | - Transcript show: arg - ] + tree roots: tree roots]] ] { #category : #initialization } @@ -147,9 +152,21 @@ GrafoscopioNotebook >> initializeWidgets [ add: body. ] +{ #category : #operation } +GrafoscopioNotebook >> moveNodeAfter [ + | currentNode | + currentNode := tree selectedItem content. + currentNode moveAfter. + tree needRebuild: true. + tree roots: tree roots. + self buildWithSpecLayout: self class defaultSpec. +] + { #category : #operation } GrafoscopioNotebook >> moveNodeBefore [ - tree selectedItem content moveAfter. + | currentNode | + currentNode := tree selectedItem content. + currentNode moveBefore. tree needRebuild: true. tree roots: tree roots. self buildWithSpecLayout: self class defaultSpec. @@ -419,6 +436,16 @@ GrafoscopioNotebook >> projectSubMenu [ ] +{ #category : #operation } +GrafoscopioNotebook >> promoteNode [ + | currentNode | + currentNode := tree selectedItem content. + currentNode promote. + tree needRebuild: true. + tree roots: tree roots. + self buildWithSpecLayout: self class defaultSpec. +] + { #category : #operation } GrafoscopioNotebook >> removeNode [ | currentNode |