New GUI: Basic outlining implemented for promote/demote & before/after operations. Next, proper saving of body (text first, then code).

This commit is contained in:
Offray Vladimir Luna Cárdenas 2016-07-28 11:26:03 +00:00
parent 7e4dd89d94
commit 61940a3c4d

View File

@ -67,22 +67,31 @@ GrafoscopioNotebook >> body: anObject [
] ]
{ #category : #operation } { #category : #operation }
GrafoscopioNotebook >> changeBody: aNodeCollection [ GrafoscopioNotebook >> changeBody: aNode [
| node |
node := aNodeCollection first.
self needRebuild: false. self needRebuild: false.
tree needRebuild: false. tree needRebuild: false.
body := self instantiate: node specModelClass new. body := self instantiate: aNode specModelClass new.
body content: node content. body content: aNode content.
body needRebuild: true. body body class = TextModel
body body whenTextChanged: [ :arg | node body: arg ]. ifTrue: [
header text: node header. body body whenTextChanged: [ :arg | aNode body: arg ]].
header text: aNode header.
body needRebuild: true.
self buildWithSpecLayout: self class defaultSpec. 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 } { #category : #persistence }
GrafoscopioNotebook >> exportAsSton: aNotebook on: aFileStream [ GrafoscopioNotebook >> exportAsSton: aNotebook on: aFileStream [
| stonPrettyString | | stonPrettyString |
@ -115,16 +124,12 @@ GrafoscopioNotebook >> header: anObject [
GrafoscopioNotebook >> initializePresenter [ GrafoscopioNotebook >> initializePresenter [
tree whenSelectedItemsChanged: [ :arg | tree whenSelectedItemsChanged: [ :arg |
arg isEmpty ifFalse: [self changeBody: arg ]]. arg isEmpty ifFalse: [self changeBody: tree selectedItem content ]].
header whenTextChanged: [ :arg | header whenTextChanged: [ :arg |
Transcript show: arg.
(tree selectedItem content header) = arg (tree selectedItem content header) = arg
ifFalse: [ ifFalse: [
(tree selectedItem) content header: arg. (tree selectedItem) content header: arg.
tree roots: tree roots]]. tree roots: tree roots]]
body whenTextChanged: [:arg |
Transcript show: arg
]
] ]
{ #category : #initialization } { #category : #initialization }
@ -147,9 +152,21 @@ GrafoscopioNotebook >> initializeWidgets [
add: body. 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 } { #category : #operation }
GrafoscopioNotebook >> moveNodeBefore [ GrafoscopioNotebook >> moveNodeBefore [
tree selectedItem content moveAfter. | currentNode |
currentNode := tree selectedItem content.
currentNode moveBefore.
tree needRebuild: true. tree needRebuild: true.
tree roots: tree roots. tree roots: tree roots.
self buildWithSpecLayout: self class defaultSpec. 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 } { #category : #operation }
GrafoscopioNotebook >> removeNode [ GrafoscopioNotebook >> removeNode [
| currentNode | | currentNode |