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' } { #category : #'graphical interface' }
GrafoscopioGUI class >> startDockingBar [ 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. "Creates a custom docking bar for grafoscopio on top, with shorcuts for most used actions,
Some of the functionalities implemented now in the grafoscopio interface for document trees should be moved here, like the ones and a fixed place for asking for help, external tools and grafoscopio updates and about"
related with help, external tools and grafoscopio updates and about"
| launchMenu helpMenu updateMenu | | launchMenu helpMenu updateMenu |
@ -740,8 +739,8 @@ GrafoscopioGUI class >> updateSystem [
GrafoscopioGUI class >> updateUI [ GrafoscopioGUI class >> updateUI [
"I update the User Interface (UI) with new versions of the docking bar or logos where available. "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" I'm helpful while testing new functionality that should be expossed to the user via the UI"
GrafoscopioGUI startDockingBar. self startDockingBar.
(World submorphs select: [ :each | each class = DockingBarMorph ]) allButLastDo: [ :bar | bar delete ]. (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 } { #category : #initialization }
GrafoscopioNode >> becomeDefaultTestTree [ GrafoscopioNode >> becomeDefaultTestTree [
| node1 node2 node3 node4 | | node1 node2 node3 node4 |
@ -176,9 +181,8 @@ GrafoscopioNode >> becomeDefaultTestTree [
body: 'Just testing'. body: 'Just testing'.
node1 addNode: node3. node1 addNode: node3.
node4 := self class new node4 := self class new
header: 'Button'; header: 'Something';
body: 'Click me!'->[42 inspect]; body: 'else'.
tagAs: 'johan'.
node1 addNode: node4. node1 addNode: node4.
self self
addNode: node1; addNode: node1;
@ -368,6 +372,11 @@ GrafoscopioNode >> initialize [
self key: '' self key: ''
] ]
{ #category : #accessing }
GrafoscopioNode >> isEmpty [
body ifNil: [ ^ true ] ifNotNil: [ ^ false ]
]
{ #category : #accessing } { #category : #accessing }
GrafoscopioNode >> key [ GrafoscopioNode >> key [
"Returns a unique key identifying the receiver in the help system" "Returns a unique key identifying the receiver in the help system"

View File

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