Initial support for named windows.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2015-01-07 13:24:02 +00:00
parent edb10effef
commit 454c582629
2 changed files with 63 additions and 19 deletions

View File

@ -93,8 +93,9 @@ GrafoscopioBrowser >> bodyOn: constructor [
GrafoscopioBrowser >> buildBrowser [
"Main method for building the interface for trees and its nodes"
browser := GLMTabulator new
title: 'Grafoscopio'.
title: ' | Grafoscopio'.
browser
column: [:c |
@ -249,6 +250,50 @@ browser
]
{ #category : #'graphical interface' }
GrafoscopioBrowser >> buildBrowserNamed: aName [
"Main method for building the interface for trees and its nodes"
browser := GLMTabulator new
title: aName, ' | 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 updatable body pane"
(browser transmit)
to: #nodeBody;
from: #tree;
andShow: [ :a | self bodyOn: a].
(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' }
GrafoscopioBrowser >> buildBrowserTransmediaton [
"Main method for building the interface for trees and its nodes"
@ -455,12 +500,12 @@ GrafoscopioBrowser >> open [
This is changed when the file is saved with the 'Save as' menu option"
| draftsLocation |
"self configureSettings."
self buildBrowser.
mainTree := GrafoscopioNode new.
mainTree becomeDefaultTree.
draftsLocation := FileSystem disk workingDirectory / 'Grafoscopio' / 'Drafts'.
draftsLocation ensureCreateDirectory.
workingFile := draftsLocation / 'draft.ston'.
self buildBrowserNamed: workingFile basenameWithIndicator.
browser openOn: mainTree children.
]
@ -482,7 +527,6 @@ GrafoscopioBrowser >> openFromFile [
| fileStream currentChildren |
self configureSettings.
self buildBrowser.
fileStream := UITheme builder
fileOpen: 'Elija un archivo .ston'
extensions: #('ston').
@ -490,6 +534,7 @@ GrafoscopioBrowser >> openFromFile [
fileStream isNil ifTrue: [ ^nil ].
workingFile := fileStream name asFileReference.
currentChildren := (STON fromStream: fileStream).
self buildBrowserNamed: workingFile basenameWithIndicator.
mainTree := GrafoscopioNode new
header: 'Arbol principal';
level: 0.
@ -886,6 +931,7 @@ GrafoscopioBrowser >> treeOn: constructor [
entitled: 'Save current tree';
"Menu options"
act: [ GrafoscopioBrowser open] entitled: 'Arbol > Nuevo ...';
act: [ GrafoscopioBrowser new openFromFile] entitled: 'Arbol > Abrir/Cargar ...';
act: [self saveToFile] entitled: 'Arbol > Guardar como ...';
act: [self exportAsHtml] entitled: 'Arbol > Exportar como html';

View File

@ -128,27 +128,15 @@ GrafoscopioNode >> asSton [
{ #category : #initialization }
GrafoscopioNode >> becomeDefaultTree [
| node1 node2 node3 |
| node1 |
self level: 0.
self header: 'Arbol principal'.
node1 := GrafoscopioNode
header: 'Nodo 1'
body: 'Texto 1'.
node2 := GrafoscopioNode
header: 'Nodo 2'
body: 'Texto 2'.
node3 := GrafoscopioNode
header: 'Nodo 3'
body: 'Texto 3'.
self
addNode: node1;
addNode: node2.
node2 addNode: node3.
addNode: node1.
]
{ #category : #accessing }
@ -292,7 +280,17 @@ GrafoscopioNode >> markdownContent [
markdown nextPutAll: (self header copyReplaceTokens: #cr with: #lf); crlf; crlf.
embedNodes := self children select: [:each | ((each header findTokens: $ ) at: 1) = '%embed'].
temporalBody := self body.
embedNodes ifNotNil: [ embedNodes do: [ :each | temporalBody := temporalBody copyReplaceAll: (each header) with: each body]].
embedNodes ifNotNil: [
(temporalBody includesSubstring: '%embed-all')
ifFalse: [embedNodes do: [ :each | temporalBody := temporalBody copyReplaceAll: (each header) with: each body]]
ifTrue: [
embedNodes do:
[ :each | temporalBody := temporalBody copyReplaceAll: '%embed-all' with: (each body,
(String with: Character cr),
'%embed-all')].
temporalBody := temporalBody copyReplaceAll: '%embed-all' with: ''
]
].
markdown nextPutAll: (temporalBody contents withInternetLineEndings ); crlf; crlf].
(self header = '%config')