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 }
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 |