First version of executable auto-updateable playgrounds in a grafoscopio document tree. Almost ready for going wider in Internet :-). Integration of testing branch)
This commit is contained in:
parent
25bcbdbb17
commit
11cefd26b6
@ -96,6 +96,21 @@ GrafoscopioBrowser >> body2ForCodeIn: constructor for: aNode [
|
|||||||
|
|
||||||
]
|
]
|
||||||
|
|
||||||
|
{ #category : #'graphical interface' }
|
||||||
|
GrafoscopioBrowser >> body3ForCodeIn: constructor for: aNode [
|
||||||
|
"Shows the body in a constructor for selected node, if node is not tagged. If it is tagged it will return itself, so it can be rendered
|
||||||
|
properly for other messages"
|
||||||
|
|
||||||
|
| innerBrowser |
|
||||||
|
|
||||||
|
aNode tags = 'código'
|
||||||
|
ifFalse: [^self].
|
||||||
|
|
||||||
|
innerBrowser := GTPlayground new.
|
||||||
|
constructor custom: innerBrowser.
|
||||||
|
|
||||||
|
]
|
||||||
|
|
||||||
{ #category : #'graphical interface' }
|
{ #category : #'graphical interface' }
|
||||||
GrafoscopioBrowser >> bodyForCodeIn: constructor for: aNode [
|
GrafoscopioBrowser >> bodyForCodeIn: constructor for: aNode [
|
||||||
"Shows the body of a selected node as executable code."
|
"Shows the body of a selected node as executable code."
|
||||||
@ -164,8 +179,11 @@ GrafoscopioBrowser >> bodyIn: constructor for: aNode [
|
|||||||
"Shows the body in a constructor for selected node, if node is not tagged. If it is tagged it will return itself, so it can be rendered
|
"Shows the body in a constructor for selected node, if node is not tagged. If it is tagged it will return itself, so it can be rendered
|
||||||
properly for other messages"
|
properly for other messages"
|
||||||
|
|
||||||
aNode tags isNil
|
| specialTags |
|
||||||
ifFalse: [^self ].
|
|
||||||
|
specialTags := #('código' 'original').
|
||||||
|
(specialTags includes: aNode tags)
|
||||||
|
ifTrue: [^self ].
|
||||||
(constructor text)
|
(constructor text)
|
||||||
title: 'Texto ';
|
title: 'Texto ';
|
||||||
format:[
|
format:[
|
||||||
@ -263,14 +281,17 @@ browser
|
|||||||
when: [:selection | selection notNil];
|
when: [:selection | selection notNil];
|
||||||
andShow: [ :a :node |
|
andShow: [ :a :node |
|
||||||
self bodyIn: a for: node.
|
self bodyIn: a for: node.
|
||||||
self body2ForCodeIn: a for: node.
|
self body3ForCodeIn: a for: node.
|
||||||
self bodyForTransmediaIn: a for: node ].
|
self bodyForTransmediaIn: a for: node ].
|
||||||
(browser transmit )
|
(browser transmit )
|
||||||
from: #tree port: #selection;
|
from: #tree port: #selection;
|
||||||
from: #nodeBody port: #text;
|
from: #nodeBody port: #text;
|
||||||
when: [:node :text | text notNil & node notNil];
|
when: [:node :text | text notNil & node notNil];
|
||||||
to: #nodeBody port: #neverland;
|
to: #nodeBody port: #neverland;
|
||||||
transformed: [:node :text | node body: text asString].
|
transformed: [:node :content |
|
||||||
|
node tags = 'código'
|
||||||
|
ifFalse: [node body: content asString]
|
||||||
|
ifTrue: [node body: content]].
|
||||||
(browser transmit)
|
(browser transmit)
|
||||||
from: #tree;
|
from: #tree;
|
||||||
to: #nodeHeader;
|
to: #nodeHeader;
|
||||||
@ -683,23 +704,15 @@ GrafoscopioBrowser >> openWorking [
|
|||||||
GrafoscopioBrowser >> panelAsCodeFor: aNode [
|
GrafoscopioBrowser >> panelAsCodeFor: aNode [
|
||||||
"Shows an interactive playground for Smalltalk code in a node body"
|
"Shows an interactive playground for Smalltalk code in a node body"
|
||||||
|
|
||||||
" browser := GLMTabulator new.
|
browser := GLMTabulator new.
|
||||||
browser title: 'Playground'.
|
browser title: 'Código'.
|
||||||
browser row: #code.
|
browser column: #code.
|
||||||
browser transmit
|
browser transmit
|
||||||
to: #code;
|
|
||||||
transformed: [GTPlayPage new content: aNode body];
|
|
||||||
andShow: [ :a | a custom GTPlayground new ].
|
|
||||||
^ browser."
|
|
||||||
|
|
||||||
browser := GLMTabulator new.
|
|
||||||
browser title: 'Código'.
|
|
||||||
browser column: #code.
|
|
||||||
browser transmit
|
|
||||||
to: #code;
|
to: #code;
|
||||||
transformed: [ GTPlayPage new content: aNode body ];
|
transformed: [ GTPlayPage new content: aNode body ];
|
||||||
andShow: [ :a | a custom: GTPlayground new ].
|
andShow: [ :a | a custom: GTPlayground new ].
|
||||||
^ browser.
|
browser sendToOutside: #nodeBody from: #code -> #text.
|
||||||
|
^ browser.
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #'graphical interface' }
|
{ #category : #'graphical interface' }
|
||||||
|
@ -186,6 +186,21 @@ GrafoscopioNode >> children: aCollection [
|
|||||||
children := aCollection.
|
children := aCollection.
|
||||||
]
|
]
|
||||||
|
|
||||||
|
{ #category : #accessing }
|
||||||
|
GrafoscopioNode >> content [
|
||||||
|
"Returns the receivers body"
|
||||||
|
|
||||||
|
^ body
|
||||||
|
|
||||||
|
]
|
||||||
|
|
||||||
|
{ #category : #accessing }
|
||||||
|
GrafoscopioNode >> content: anObject [
|
||||||
|
"Sets the receivers body to the given object"
|
||||||
|
|
||||||
|
body := anObject
|
||||||
|
]
|
||||||
|
|
||||||
{ #category : #movement }
|
{ #category : #movement }
|
||||||
GrafoscopioNode >> demote [
|
GrafoscopioNode >> demote [
|
||||||
"Moves the current node down in the hierachy, making a children of its current previous slibing"
|
"Moves the current node down in the hierachy, making a children of its current previous slibing"
|
||||||
@ -477,6 +492,8 @@ GrafoscopioNode >> tagAs: aTag [
|
|||||||
know if a tag excludes others from the same node"
|
know if a tag excludes others from the same node"
|
||||||
|
|
||||||
tags := aTag.
|
tags := aTag.
|
||||||
|
aTag = 'código'
|
||||||
|
ifTrue: [self body: (GTPlayPage new content: self body) content]
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
@ -486,6 +503,13 @@ GrafoscopioNode >> tags [
|
|||||||
^ tags
|
^ tags
|
||||||
]
|
]
|
||||||
|
|
||||||
|
{ #category : #accessing }
|
||||||
|
GrafoscopioNode >> title [
|
||||||
|
"Returns the receiver header"
|
||||||
|
|
||||||
|
^ header
|
||||||
|
]
|
||||||
|
|
||||||
{ #category : #'add/remove nodes' }
|
{ #category : #'add/remove nodes' }
|
||||||
GrafoscopioNode >> visitedGoTo: aCollection [
|
GrafoscopioNode >> visitedGoTo: aCollection [
|
||||||
"Stores the current node in a collection and recursively stores its children"
|
"Stores the current node in a collection and recursively stores its children"
|
||||||
|
Loading…
Reference in New Issue
Block a user