diff --git a/repository/Grafoscopio/GrafoscopioBrowser.class.st b/repository/Grafoscopio/GrafoscopioBrowser.class.st index 353ce8b..571250c 100644 --- a/repository/Grafoscopio/GrafoscopioBrowser.class.st +++ b/repository/Grafoscopio/GrafoscopioBrowser.class.st @@ -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' } GrafoscopioBrowser >> bodyForCodeIn: constructor for: aNode [ "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 properly for other messages" - aNode tags isNil - ifFalse: [^self ]. + | specialTags | + + specialTags := #('código' 'original'). + (specialTags includes: aNode tags) + ifTrue: [^self ]. (constructor text) title: 'Texto '; format:[ @@ -263,14 +281,17 @@ browser when: [:selection | selection notNil]; andShow: [ :a :node | self bodyIn: a for: node. - self body2ForCodeIn: a for: node. + self body3ForCodeIn: a for: node. self bodyForTransmediaIn: a for: node ]. (browser transmit ) - from: #tree port: #selection; - from: #nodeBody port: #text; - when: [:node :text | text notNil & node notNil]; - to: #nodeBody port: #neverland; - transformed: [:node :text | node body: text asString]. + from: #tree port: #selection; + from: #nodeBody port: #text; + when: [:node :text | text notNil & node notNil]; + to: #nodeBody port: #neverland; + transformed: [:node :content | + node tags = 'código' + ifFalse: [node body: content asString] + ifTrue: [node body: content]]. (browser transmit) from: #tree; to: #nodeHeader; @@ -683,23 +704,15 @@ GrafoscopioBrowser >> openWorking [ GrafoscopioBrowser >> panelAsCodeFor: aNode [ "Shows an interactive playground for Smalltalk code in a node body" -" browser := GLMTabulator new. - browser title: 'Playground'. - browser row: #code. - browser transmit + browser := GLMTabulator new. + browser title: 'Código'. + browser column: #code. + 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; - transformed: [ GTPlayPage new content: aNode body ]; - andShow: [ :a | a custom: GTPlayground new ]. -^ browser. + transformed: [ GTPlayPage new content: aNode body ]; + andShow: [ :a | a custom: GTPlayground new ]. + browser sendToOutside: #nodeBody from: #code -> #text. + ^ browser. ] { #category : #'graphical interface' } diff --git a/repository/Grafoscopio/GrafoscopioNode.class.st b/repository/Grafoscopio/GrafoscopioNode.class.st index d474ba9..9e98519 100644 --- a/repository/Grafoscopio/GrafoscopioNode.class.st +++ b/repository/Grafoscopio/GrafoscopioNode.class.st @@ -186,6 +186,21 @@ GrafoscopioNode >> 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 } GrafoscopioNode >> demote [ "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" tags := aTag. + aTag = 'código' + ifTrue: [self body: (GTPlayPage new content: self body) content] ] { #category : #accessing } @@ -486,6 +503,13 @@ GrafoscopioNode >> tags [ ^ tags ] +{ #category : #accessing } +GrafoscopioNode >> title [ + "Returns the receiver header" + + ^ header +] + { #category : #'add/remove nodes' } GrafoscopioNode >> visitedGoTo: aCollection [ "Stores the current node in a collection and recursively stores its children"