Cleaning interface and trying to know where the code nodes are transformed into text.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2016-03-14 23:57:09 +00:00
parent 79c04b04d2
commit 77dcc46157

View File

@ -611,18 +611,6 @@ GrafoscopioBrowser >> bodyForCodeIn: constructor for: aNode [
] ]
{ #category : #'graphical interface' }
GrafoscopioBrowser >> bodyIn: constructor [
"Shows the body of a selected node"
(constructor text asString)
title: 'Texto';
format:[:eachNode |
(eachNode body) isNil
ifTrue: [ '' ]
ifFalse: [ eachNode body]].
]
{ #category : #'graphical interface' } { #category : #'graphical interface' }
GrafoscopioBrowser >> bodyIn: constructor for: aNode [ GrafoscopioBrowser >> bodyIn: constructor for: aNode [
"Shows the body in a constructor for selected node, if node is not tagged. "Shows the body in a constructor for selected node, if node is not tagged.
@ -632,7 +620,7 @@ GrafoscopioBrowser >> bodyIn: constructor for: aNode [
specialTags := #('código'). specialTags := #('código').
(specialTags includes: aNode tags) (specialTags includes: aNode tags)
ifTrue: [^self ]. ifTrue: [^self].
(constructor text) (constructor text)
title: 'Texto '; title: 'Texto ';
format:[ format:[
@ -641,60 +629,10 @@ GrafoscopioBrowser >> bodyIn: constructor for: aNode [
ifFalse: [ aNode body]]. ifFalse: [ aNode body]].
] ]
{ #category : #'graphical interface' }
GrafoscopioBrowser >> browser [
"Returns de browser object, which represents the graphical interface. Useful for debugging purposes"
^ browser.
]
{ #category : #'graphical interface' }
GrafoscopioBrowser >> buildBrowser [
"Main method for building the interface for trees and its nodes"
browser := GLMTabulator new
title: ' | Grafoscopio'.
browser
column: [:c |
c row: #tree span: 6;
row: #nodeHeader span: 1] span: 2;
column: [ :c |
c row: #nodeBody span: 2] span: 5.
browser
updateOn: GLMItemAdded from: #yourself;
updateOn: GLMItemRemoved from: #yourself.
(browser transmit)
to: #tree;
andShow: [:a | self treeOn: a].
"Creating a self updateable body pane"
(browser transmit)
to: #nodeBody;
from: #tree;
andShow: [ :a | self bodyIn: a asString].
(browser transmit )
from: #tree port: #selection;
from: #nodeBody port: #text;
when: [:node :text | text notNil];
to: #nodeBody port: #neverland;
transformed: [:node :text | node body: text asString].
(browser transmit)
from: #tree;
to: #nodeHeader;
andShow: [ :h | self headerOn: h ].
(browser transmit )
from: #tree port: #selection;
from: #nodeHeader port: #text;
when: [:node :text | text notNil];
to: #nodeHeader port: #neverland1;
transformed: [:node :text | node header: text asString]
]
{ #category : #'graphical interface' } { #category : #'graphical interface' }
GrafoscopioBrowser >> buildBrowserNamed: aName [ GrafoscopioBrowser >> buildBrowserNamed: aName [
"Main method for building the interface for trees and its nodes. The name of the browser corresponds to the name of the file "Main method for building the interface for trees and its nodes.
The name of the browser corresponds to the name of the file
where tree is stored (or is named 'draft.ston' by default)" where tree is stored (or is named 'draft.ston' by default)"
self configureInitialTags. self configureInitialTags.
@ -729,9 +667,10 @@ browser
when: [:node :text | text notNil & node notNil]; when: [:node :text | text notNil & node notNil];
to: #nodeBody port: #neverland; to: #nodeBody port: #neverland;
transformed: [:node :content | transformed: [:node :content |
node tags = 'código' node body: content asString.
"node tags = 'código'
ifFalse: [node body: content asString] ifFalse: [node body: content asString]
ifTrue: [node body: content string "text asString"]]. ifTrue: [node body: content asString. Transcript show: content asString]"].
(browser transmit) (browser transmit)
from: #tree; from: #tree;
to: #nodeHeader; to: #nodeHeader;
@ -914,7 +853,7 @@ GrafoscopioBrowser >> open [
GrafoscopioBrowser >> openDefault [ GrafoscopioBrowser >> openDefault [
"Opens a new browser with a default tree" "Opens a new browser with a default tree"
GrafoscopioBrowser configureSettings. GrafoscopioBrowser configureSettings.
self buildBrowser. self buildBrowserNamed: 'draft.ston'.
mainTree := GrafoscopioNode new. mainTree := GrafoscopioNode new.
mainTree becomeDefaultTree. mainTree becomeDefaultTree.
workingFile := draftsLocation / 'draft.ston'. workingFile := draftsLocation / 'draft.ston'.
@ -1031,125 +970,6 @@ GrafoscopioBrowser >> openTutorialInGrafoscopio [
browser openOn: mainTree children. browser openOn: mainTree children.
] ]
{ #category : #'graphical interface' }
GrafoscopioBrowser >> panelAsCodeFor: aNode [
"Shows an interactive playground for Smalltalk code in a node body"
browser := GLMTabulator new.
browser title: 'Código'.
browser column: #code.
browser transmit
to: #code;
transformed: [ GTPlayPage new content: aNode body asString];
andShow: [ :a | a custom: GTPlayground new ].
browser sendToOutside: (#nodeBody asString) from: #code -> #text.
^ browser.
]
{ #category : #'graphical interface' }
GrafoscopioBrowser >> panelBrowserForTransmediaton [
"**Experimental feature.**
Opens grafoscopio in several 'modes'. Each mode corresponds to a operation way, with an specific interface.
We will start with a 'transmediaton' mode to let the people create some transmedia content.
After that we will enable other modes"
| transmediaNode originalNode |
browser := GLMTabulator new.
browser
column: [ :c |
c row: [ :r | r column: #original; column: #transmediado] span: 7";
row: #buttons; span: 1"].
(browser transmit)
to: #original;
andShow: [ :a |
a text
title: 'Original';
format:[:eachNode |
(eachNode tags) = 'original'
ifFalse: [ '' ]
ifTrue: [
originalNode := eachNode.
originalNode children isNotNil
ifTrue: [transmediaNode := originalNode children detect: [:node | node tags = 'transmediado'] ifNone: [ transmediaNode := nil ] ].
originalNode body]]].
(browser transmit)
from: #original;
toOutsidePort: #text.
(browser transmit)
to: #transmediado;
andShow: [ :a |
a text
title: 'Transmediado';
format:[transmediaNode isNotNil
ifFalse: [ '' ]
ifTrue: [transmediaNode body]
]
].
" (browser transmit)
to: #buttons;
andShow: [ :a |
a actionList
act: [:entity | entity inspect ] entitled: 'Subir';
act: [:entity | entity explore ] entitled: 'Previsualizar';
act: [:entity | entity explore ] entitled: 'Publicar'].
"
^ browser.
]
{ #category : #'graphical interface' }
GrafoscopioBrowser >> panelTransmediaFor: aNode [
""
| transmediaNode originalNode |
browser := GLMTabulator new.
browser
column: [ :c |
c row: [ :r | r column: #original; column: #transmediado] span: 7";
row: #buttons; span: 1"].
originalNode := aNode.
originalNode children isNotNil
ifTrue: [transmediaNode := originalNode children
detect: [:node | node tags = 'transmediado']
ifNone: [ transmediaNode := nil ] ].
(browser transmit)
to: #original;
andShow: [ :a |
a text
title: 'Original';
format:[ aNode body isNil
ifTrue: [ '' ]
ifFalse: [ aNode body ]
]].
(browser transmit)
from: #original;
toOutsidePort: #text.
(browser transmit)
to: #transmediado;
andShow: [ :a |
a text
title: 'Transmediado';
format:[transmediaNode isNotNil
ifFalse: [ '' ]
ifTrue: [transmediaNode body]
]
].
" (browser transmit)
to: #buttons;
andShow: [ :a |
a actionList
act: [:entity | entity inspect ] entitled: 'Subir';
act: [:entity | entity explore ] entitled: 'Previsualizar';
act: [:entity | entity explore ] entitled: 'Publicar'].
"
^ browser.
]
{ #category : #persistence } { #category : #persistence }
GrafoscopioBrowser >> replaceContentsFromCache: aNode [ GrafoscopioBrowser >> replaceContentsFromCache: aNode [
"Replaces the contents of aNode from the ones in cacheNode. It doesn't work recursively yet, so it doen't copy the children of the nodes" "Replaces the contents of aNode from the ones in cacheNode. It doesn't work recursively yet, so it doen't copy the children of the nodes"