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

View File

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