Basic adding of nodes working, but have the problem reported today in the Pharo mailing list. I will try the approached I talked in the message today.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2016-08-18 17:31:14 +00:00
parent e4f7533ce3
commit b9448781ad
3 changed files with 54 additions and 41 deletions

View File

@ -506,9 +506,8 @@ GrafoscopioGUI class >> showSettings [
{ #category : #'graphical interface' }
GrafoscopioGUI class >> startDockingBar [
"Creates a custom docking bar for grafoscopio on top, with shorcuts for most used actions, and a fixed place for asking for help.
Some of the functionalities implemented now in the grafoscopio interface for document trees should be moved here, like the ones
related with help, external tools and grafoscopio updates and about"
"Creates a custom docking bar for grafoscopio on top, with shorcuts for most used actions,
and a fixed place for asking for help, external tools and grafoscopio updates and about"
| launchMenu helpMenu updateMenu |
@ -740,8 +739,8 @@ GrafoscopioGUI class >> updateSystem [
GrafoscopioGUI class >> updateUI [
"I update the User Interface (UI) with new versions of the docking bar or logos where available.
I'm helpful while testing new functionality that should be expossed to the user via the UI"
GrafoscopioGUI startDockingBar.
(World submorphs select: [ :each | each class = DockingBarMorph ]) allButLastDo: [ :bar | bar delete ].
self startDockingBar.
(World submorphs select: [ :each | each class = DockingBarMorph ]) allButFirstDo: [ :bar | bar delete ].
]

View File

@ -158,6 +158,11 @@ GrafoscopioNode >> asSton [
]
{ #category : #accessing }
GrafoscopioNode >> asText [
^ self body
]
{ #category : #initialization }
GrafoscopioNode >> becomeDefaultTestTree [
| node1 node2 node3 node4 |
@ -176,9 +181,8 @@ GrafoscopioNode >> becomeDefaultTestTree [
body: 'Just testing'.
node1 addNode: node3.
node4 := self class new
header: 'Button';
body: 'Click me!'->[42 inspect];
tagAs: 'johan'.
header: 'Something';
body: 'else'.
node1 addNode: node4.
self
addNode: node1;
@ -368,6 +372,11 @@ GrafoscopioNode >> initialize [
self key: ''
]
{ #category : #accessing }
GrafoscopioNode >> isEmpty [
body ifNil: [ ^ true ] ifNotNil: [ ^ false ]
]
{ #category : #accessing }
GrafoscopioNode >> key [
"Returns a unique key identifying the receiver in the help system"

View File

@ -47,15 +47,13 @@ GrafoscopioNotebook class >> defaultSpec [
]
{ #category : #operation }
GrafoscopioNotebook >> addNode [
GrafoscopioNotebook >> addNode [
tree needRebuild: true.
tree selectedItem content addNodeAfterMe.
self selectNextItem.
tree highlightedItem content addNodeAfterMe.
self notebookContent: notebook.
tree roots: tree roots.
self highlightNextItem.
self buildWithSpecLayout: self class defaultSpec.
]
{ #category : #accessing }
@ -73,10 +71,10 @@ GrafoscopioNotebook >> changeBody: aNode [
self needRebuild: false.
tree needRebuild: false.
body needRebuild: true.
body := self instantiate: aNode specModelClass new.
body := self instantiate: aNode content specModelClass new.
body content: aNode content.
body body class = TextModel
ifTrue: [body body whenTextChanged: [ :arg | aNode body: arg ]].
ifTrue: [body body whenTextChanged: [ :arg | aNode content body: arg ]].
body body class = GlamourPresentationModel
ifTrue: [ | playground |
playground := body body glmPres.
@ -84,10 +82,10 @@ GrafoscopioNotebook >> changeBody: aNode [
do: [ :ann | ann property = #text
ifTrue: [ | playgroundText |
playgroundText := (playground pane ports at: 2) value.
aNode body: playgroundText]
aNode content body: playgroundText]
]
].
header text: aNode header.
header text: aNode content header.
self buildWithSpecLayout: self class defaultSpec.
]
@ -130,15 +128,38 @@ GrafoscopioNotebook >> header: anObject [
header := anObject
]
{ #category : #operation }
GrafoscopioNotebook >> highlightNextItem [
| currentItem |
currentItem := tree highlightedItem.
currentItem
ifNotNil: [ | allItems index childrenSize parentNode |
currentItem parentNode
ifNil: [
parentNode := currentItem container.
allItems := parentNode roots ]
ifNotNil: [
parentNode := currentItem parentNode.
allItems := parentNode children value. ].
childrenSize := currentItem content parent children size.
index := allItems indexOf: currentItem.
(index < childrenSize) ifTrue: [
"{allItems . currentItem . index } inspect."
currentItem selected: false.
parentNode
highlightedItem: ((allItems at:(index+1)) selected:true;
takeHighlight;yourself).
]
]
]
{ #category : #initialization }
GrafoscopioNotebook >> initializePresenter [
tree whenSelectedItemChanged: [ :item |
self updateBodyFor: item.
header whenTextChanged: [ :arg |
(tree selectedItem content header) = arg
ifFalse: [
(tree highlightedItem) content header: arg.
tree roots: tree roots]]]
tree whenHighlightedItemChanged: [ :item | self updateBodyFor: item].
header whenTextChanged: [ :arg |
(tree highlightedItem content header) = arg
ifFalse: [ (tree highlightedItem) content header: arg.
tree roots: tree roots]].
]
@ -153,7 +174,6 @@ GrafoscopioNotebook >> initializeWidgets [
tree
childrenBlock: [:node | node children];
displayBlock: [:node | node title ].
tree whenBuiltDo: [ tree selectedItem: (tree roots first selected: true; takeHighlight; yourself)].
self focusOrder
add: tree;
add: header;
@ -514,21 +534,6 @@ 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