From 20435782fbb11cecee1f77ad6b0036b111b96670 Mon Sep 17 00:00:00 2001 From: Offray Luna Date: Wed, 26 Nov 2014 21:10:58 +0000 Subject: [PATCH] Starting to support modes: a visual layout and behavioural modifications for particular experiences inside grafoscopio. --- .../Grafoscopio/GrafoscopioBrowser.class.st | 125 +++++++++++++++++- 1 file changed, 122 insertions(+), 3 deletions(-) diff --git a/repository/Grafoscopio/GrafoscopioBrowser.class.st b/repository/Grafoscopio/GrafoscopioBrowser.class.st index 045c782..004b6e9 100644 --- a/repository/Grafoscopio/GrafoscopioBrowser.class.st +++ b/repository/Grafoscopio/GrafoscopioBrowser.class.st @@ -154,7 +154,7 @@ browser ] { #category : #'graphical interface' } -GrafoscopioBrowser >> buildBrowserTransmedia [ +GrafoscopioBrowser >> buildBrowserTransmediaton [ "Main method for building the interface for trees and its nodes" browser := GLMTabulator new @@ -172,7 +172,7 @@ browser (browser transmit) to: #tree; - andShow: [:a | self treeOn: a]. + andShow: [:a | self treeForTransmediatonOn: a]. "Creating a self updatable body pane" (browser transmit) to: #nodeBody; @@ -399,6 +399,29 @@ GrafoscopioBrowser >> openFromFile [ browser openOn: mainTree children. ] +{ #category : #persistence } +GrafoscopioBrowser >> openFromFileInMode: aMode [ +"Opens a tree from a file and shows it on a specific graphical mode. Graphical modes are like themes in Grafoscopio which organize interface in a particular +layout to optimize interaction in a particular setting. For the moment only 'transmediaton' mode is supported (transmediaton is a transmedia hackathon)" + + | fileStream currentChildren | + self configureSettings. + fileStream := UITheme builder + fileOpen: 'Elija un archivo .ston' + extensions: #('ston'). + + fileStream isNil ifTrue: [ ^nil ]. + workingFile := fileStream name asFileReference. + currentChildren := (STON fromStream: fileStream). + mainTree := GrafoscopioNode new + header: 'Arbol principal'; + level: 0. + mainTree children: currentChildren. + aMode = 'transmediaton' + ifTrue: [self buildBrowserTransmediaton ]. + browser openOn: mainTree children. +] + { #category : #'graphical interface' } GrafoscopioBrowser >> openInMode: aMode [ "**Experimental feature.** @@ -443,7 +466,7 @@ GrafoscopioBrowser >> openInModeTransmediaton [ After that we will enable other modes" | draftsLocation | "self configureSettings." - self buildBrowserTransmedia. + self buildBrowserTransmediaton. mainTree := GrafoscopioNode new. mainTree becomeDefaultTree. draftsLocation := FileSystem disk workingDirectory / 'Grafoscopio' / 'Drafts'. @@ -595,6 +618,102 @@ GrafoscopioBrowser >> saveWorkingTree [ self inform: 'Archivo Guardado'. ] +{ #category : #'graphical interface' } +GrafoscopioBrowser >> treeForTransmediatonOn: constructor [ + "Shows the correspondent tree of a node" + + (constructor tree) "Layout" + title: mainTree header; + children: [ :eachNode | + (eachNode children) isNil + ifTrue: [ self inform: 'Seleccione un nodo para ver su contenido' ] + ifFalse:[ eachNode children ] ]; + format:[:eachNode | + (eachNode header) isNil + ifTrue: [ '' ] + ifFalse: [ eachNode header ]]; + "Adding nodes" + act: [:treePresentation | + (treePresentation selection) isNotNil + ifTrue: [treePresentation selection addNodeAfter]. + treePresentation update] + icon: GLMUIThemeExtraIcons glamorousZoomIn + entitled: 'Add node'; + "Removing nodes" + act: [:treePresentation | + (treePresentation selection isNotNil) + ifTrue: [(treePresentation selection parent) + removeNode: treePresentation selection] + ifFalse: [treePresentation entity removeLast]. + treePresentation update] + icon: GLMUIThemeExtraIcons glamorousZoomOut + entitled: 'Remove node'; + + "Move nodes in the same hierarchy" + + act: [:treePresentation | + (treePresentation selection isNotNil) + ifTrue: [treePresentation selection moveBefore]. + treePresentation update] + icon: GLMUIThemeExtraIcons glamorousUp + entitled: 'Move node up'; + + act: [:treePresentation | + (treePresentation selection isNotNil) + ifTrue: [treePresentation selection moveAfter]. + treePresentation update] + icon: GLMUIThemeExtraIcons glamorousDown + entitled: 'Move node down'; + + act: [:treePresentation | + (treePresentation selection isNotNil) + ifTrue: [treePresentation selection promote]. + treePresentation update] + icon: GLMUIThemeExtraIcons glamorousLeft + entitled: 'Move node left'; + + act: [:treePresentation | + (treePresentation selection isNotNil) + ifTrue: [treePresentation selection demote]. + treePresentation update] + icon: GLMUIThemeExtraIcons glamorousRight + entitled: 'Move node rigt'; + + act: [ :treePresentation | treePresentation update ] + icon: GLMUIThemeExtraIcons glamorousRefresh + entitled: 'Update'; + + act: [self saveWorkingTree] + icon: GLMUIThemeExtraIcons glamorousSave + entitled: 'Save current tree'; + + "Menu options" + act: [ GrafoscopioBrowser new openFromFileInMode: 'transmediaton'] entitled: 'Arbol > Abrir/Cargar ...'; + act: [self saveToFile] entitled: 'Arbol > Guardar como ...'; + act: [self exportAsHtml] entitled: 'Arbol > Exportar como html'; + "act: [:x | x printString inspect] entitled: 'Arbol > Definir título';" + act: [:treePresentation | + (treePresentation selection isNotNil) + ifTrue: [self copyNodeIntoCache: treePresentation selection]. + treePresentation update] entitled: 'Nodo > Copiar nodo'; + act: [:treePresentation | + (treePresentation selection isNotNil) + ifTrue: [self replaceContentsFromCache: treePresentation selection]. + treePresentation update] entitled: 'Nodo > Pegar nodo'; + act: [self enableRepository] entitled: 'Proyecto > Activar'; + act: [self addFileToRepository] entitled: 'Proyecto > Agregar archivo'; + act: [:x | x printString inspect] entitled: 'Proyecto > Eliminar archivo'; + act: [self repositoryCommit] entitled: 'Proyecto > Enviar al histórico'; + act: [self repositoryCredentials] entitled: 'Proyecto > Acreditarse'; + act: [self updateSystem] entitled: 'Grafoscopio > Actualizar'; + act: [self updateSystem] entitled: 'Grafoscopio > Actualizar prerrequisitos'; + act: [:x | x printString inspect] entitled: 'Grafoscopio > Actualizar herramientas externas'; + act: [self configurePandoc] entitled: 'Grafoscopio > Herramientas externas > Definir ruta a pandoc'; + act: [:x | x printString inspect] entitled: 'Grafoscopio > Herramientas externas > Definir ruta a fossil'; + act: [:x | x printString inspect] entitled: 'Grafoscopio > Acerca de...'. + +] + { #category : #'graphical interface' } GrafoscopioBrowser >> treeOn: constructor [ "Shows the correspondent tree of a node"