From bf1b960ad17043a533db9a5fac3209e20160667c Mon Sep 17 00:00:00 2001 From: Offray Luna Date: Sun, 14 Aug 2016 15:37:40 +0000 Subject: [PATCH] Temporal disabling of Roassal Examples from main menu, to a easier install while debuging GUI selection. --- .../Grafoscopio/GrafoscopioGUI.class.st | 19 +--------- .../Grafoscopio/GrafoscopioNotebook.class.st | 38 ++++++++++++++----- 2 files changed, 30 insertions(+), 27 deletions(-) diff --git a/repository/Grafoscopio/GrafoscopioGUI.class.st b/repository/Grafoscopio/GrafoscopioGUI.class.st index 34453f2..64b6dc6 100644 --- a/repository/Grafoscopio/GrafoscopioGUI.class.st +++ b/repository/Grafoscopio/GrafoscopioGUI.class.st @@ -519,7 +519,7 @@ GrafoscopioGUI class >> startDockingBar [ add: 'Notebook from Internet...' target: (GrafoscopioNotebook new) selector: #openFromUrlUI; add: 'Recent notebooks...' target: self selector: #openFromRecentlyUsed; add: 'Example notebooks...' target: self selector: #messageNotImplementedYet; - add: 'Roassal visualizations gallery' target: (RTExampleBrowser new) selector: #open; + "add: 'Roassal visualizations gallery' target: (RTExampleBrowser new) selector: #open;" add: 'Playground' target: (Smalltalk tools) selector: #openWorkspace; add: 'Transcript' target: (Smalltalk tools) selector: #openTranscript. @@ -757,23 +757,6 @@ GrafoscopioGUI >> initializePresenter [ ] ] -{ #category : #initialization } -GrafoscopioGUI >> initializePresenter2 [ - tree whenSelectedItemChanged: [:node | - node tag = 'código' - ifTrue: [ ] - ifFalse: [ ] - - ]. - nodeHeader acceptBlock: [ :text| - tree selectedItem - ifNotNil: [:x | - x content: text. - self updateTree - ] - ] -] - { #category : #initialization } GrafoscopioGUI >> initializeWidgets [ diff --git a/repository/Grafoscopio/GrafoscopioNotebook.class.st b/repository/Grafoscopio/GrafoscopioNotebook.class.st index 5230907..7f6f916 100644 --- a/repository/Grafoscopio/GrafoscopioNotebook.class.st +++ b/repository/Grafoscopio/GrafoscopioNotebook.class.st @@ -48,9 +48,10 @@ GrafoscopioNotebook class >> defaultSpec [ { #category : #operation } GrafoscopioNotebook >> addNode [ - | newSelectedNode | + tree needRebuild: true. - newSelectedNode := tree selectedItem content addNodeAfterMe. + tree selectedItem content addNodeAfterMe. + self selectNextItem. tree roots: tree roots. self buildWithSpecLayout: self class defaultSpec. @@ -71,8 +72,7 @@ GrafoscopioNotebook >> body: anObject [ GrafoscopioNotebook >> changeBody: aNode [ self needRebuild: false. tree needRebuild: false. - body needRebuild: true. - + body needRebuild: true. body := self instantiate: aNode specModelClass new. body content: aNode content. body body class = TextModel @@ -88,7 +88,6 @@ GrafoscopioNotebook >> changeBody: aNode [ ] ]. header text: aNode header. - body needRebuild: true. self buildWithSpecLayout: self class defaultSpec. ] @@ -145,17 +144,16 @@ GrafoscopioNotebook >> initializePresenter [ { #category : #initialization } GrafoscopioNotebook >> initializeWidgets [ - windowMainMenu := self newWindowMainMenu. - tree := TreeModel new. header := self newTextInput. body := self newText. body disable. body text: '<- Select a node'. + tree := TreeModel new. tree childrenBlock: [:node | node children]; displayBlock: [:node | node title ]. - tree whenBuiltDo: [ tree selectedItem: (tree roots first)"; takeHighlight; yourself" ]. + tree whenBuiltDo: [ tree selectedItem: (tree roots first selected: true; takeHighlight; yourself)]. self focusOrder add: tree; add: header; @@ -292,7 +290,14 @@ GrafoscopioNotebook >> notebook: anObject [ { #category : #api } GrafoscopioNotebook >> notebookContent: aTree [ - tree roots: aTree children + | nodeBlock | + nodeBlock:= [:gfcNode | |node| + node := TreeNodeModel new. + node + hasChildren: [ gfcNode children isNotEmpty ]; + children: [ gfcNode children collect: [:subNode | nodeBlock value: subNode ]]; + content: gfcNode]. + tree roots: (aTree children collect:[ :gfcNode | nodeBlock value: gfcNode]) ] @@ -509,6 +514,21 @@ GrafoscopioNotebook >> saveWorkingNotebook [ ] +{ #category : #operation } +GrafoscopioNotebook >> selectNextItem [ + | currentItem | + currentItem := self tree selectedItem. + currentItem ifNotNil: [ | allItems index| + allItems := currentItem container roots. + index := allItems indexOf: currentItem. + (index < allItems size) ifTrue: [ + currentItem selected: false. + currentItem container selectedItem: ((allItems at:(index+1)) selected:true;takeHighlight;yourself). + tree selectedItem inspect. + ] + ] +] + { #category : #accessing } GrafoscopioNotebook >> tree [ ^ tree