From c9e410a36d69416b8900c64ee9aa6cf7c3896c3c Mon Sep 17 00:00:00 2001 From: Offray Luna Date: Sun, 7 Aug 2016 17:25:48 +0000 Subject: [PATCH] Persistence on basic notebooks done! Text and code playgrounds are saved almost automatically (text needs explicit saving). --- .../Grafoscopio/GrafoscopioNotebook.class.st | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/repository/Grafoscopio/GrafoscopioNotebook.class.st b/repository/Grafoscopio/GrafoscopioNotebook.class.st index 2d3ed42..f28acc6 100644 --- a/repository/Grafoscopio/GrafoscopioNotebook.class.st +++ b/repository/Grafoscopio/GrafoscopioNotebook.class.st @@ -76,9 +76,15 @@ GrafoscopioNotebook >> changeBody: aNode [ body body class = TextModel ifTrue: [body body whenTextChanged: [ :arg | aNode body: arg ]]. body body class = GlamourPresentationModel - ifTrue: [ - "Transcript show:" "body body glmPres inspect" ]. - "Transcript show: body body class; cr." + ifTrue: [ | playground | + playground := body body glmPres. + playground when: GLMContextChanged + do: [ :ann | ann property = #text + ifTrue: [ | playgroundText | + playgroundText := (playground pane ports at: 2) value. + aNode body: playgroundText] + ] + ]. header text: aNode header. body needRebuild: true. self buildWithSpecLayout: self class defaultSpec. @@ -451,9 +457,11 @@ GrafoscopioNotebook >> promoteNode [ { #category : #operation } GrafoscopioNotebook >> removeNode [ - | currentNode | - currentNode := tree selectedItem content. - currentNode parent removeNode: currentNode. + | nodeToDelete | + nodeToDelete := tree selectedItem content. + nodeToDelete parent removeNode: nodeToDelete. + "tree selectedItem: tree selectedItem parentNode." + tree selectOnlyLastHighlighted. tree needRebuild: true. tree roots: tree roots. self buildWithSpecLayout: self class defaultSpec.