diff --git a/repository/Grafoscopio/GrafoscopioBrowser.class.st b/repository/Grafoscopio/GrafoscopioBrowser.class.st index 3845b6b..46fe260 100644 --- a/repository/Grafoscopio/GrafoscopioBrowser.class.st +++ b/repository/Grafoscopio/GrafoscopioBrowser.class.st @@ -15,6 +15,7 @@ Class { 'browser', 'explorer', 'mainTree', + 'tagsAvailable', '\r\t\t\t\t\t\t\t\t\tnonVar1', 'cacheNode', 'workingFile', @@ -70,6 +71,34 @@ GrafoscopioBrowser >> addFileToRepository [ 'echo "Added file to enabled repository"'. ] +{ #category : #tags } +GrafoscopioBrowser >> addTagTo: aNode [ + "Tags the node passed as argument with a value from the collection of tags available" + | selection | + + tagsAvailable isNil + ifFalse: [ + selection := UIManager default chooseFrom: tagsAvailable title: 'Elija una etiqueta'. + aNode tagAs: (tagsAvailable at: selection) + ] + ifTrue: [self messageNoTagsAvailable]. + +] + +{ #category : #tags } +GrafoscopioBrowser >> addToTagsAvailable [ + "Adds a tag to the collection of tags available" + + | tag | + tagsAvailable isNil + ifTrue: [tagsAvailable := OrderedCollection new]. + tag := UIManager default + textEntry: 'Nombre de la etiqueta' + title: 'Agregue una etiqueta'. + tagsAvailable add: tag. + +] + { #category : #'graphical interface' } GrafoscopioBrowser >> bodyForTransmediaOn: constructor [ "Shows the body of a transmedia type of node" @@ -252,7 +281,10 @@ browser { #category : #'graphical interface' } GrafoscopioBrowser >> buildBrowserNamed: aName [ -"Main method for building the interface for trees and its nodes. The name of the browser corresponds to the name of the file where tree is stored (or is named 'draft.ston' by default)" +"Main method for building the interface for trees and its nodes. The name of the browser corresponds to the name of the file +where tree is stored (or is named 'draft.ston' by default)" + +self configureInitialTags. browser := GLMTabulator new title: aName, ' | Grafoscopio'. @@ -352,6 +384,20 @@ GrafoscopioBrowser >> configureFossil [ ] +{ #category : #'system-support' } +GrafoscopioBrowser >> configureInitialTags [ + "Configures a list of predefined tags available to use. More tags should be added from a repository. + The idea is that nodes are processed and show differently according to their tags. So users should be + able to define their own tags with custom UI and behaviour" + + tagsAvailable := OrderedCollection new. + tagsAvailable + add: 'original'; + add: 'transmediado'; + add: 'texto'; + add: 'código'. +] + { #category : #'system-support' } GrafoscopioBrowser >> configurePandoc [ "Stablish where is located pandoc according to the operative system and the input of the user" @@ -520,6 +566,20 @@ GrafoscopioBrowser >> messageAbout [ title: 'About Grafoscopio'. ] +{ #category : #'graphical interface' } +GrafoscopioBrowser >> messageNoTagsAvailable [ + "Shows that there is no tags available and the procedure to add some tags" + + UIManager default + abort: + 'Use primero el menu:', + (String with: Character cr), + '"Etiquetas > Agregar a disponibles"', + (String with: Character cr), + 'para agregar etiquetas y luego sí agregue etiquetas al nodo' + title: 'Sin etiquetas disponibles!' +] + { #category : #'graphical interface' } GrafoscopioBrowser >> messageNotImplementedYet [ "Shows that a feature is not implemeted and point to further documentation on the web" @@ -527,7 +587,7 @@ GrafoscopioBrowser >> messageNotImplementedYet [ UIManager default abort: 'Esta funcionalidad aún no está implementada!', (String with: Character cr), - 'Para información sobre futuras versiones, por favor visite:', + 'Para información sobre futuras versiones, por favor visite: ', (String with: Character cr), (String with: Character cr), 'http://mutabit.com/grafoscopio' @@ -805,6 +865,16 @@ GrafoscopioBrowser >> saveWorkingTree [ self inform: 'Archivo guardado como: ', workingFile asString. ] +{ #category : #tags } +GrafoscopioBrowser >> showTagsAvailable [ + "Adds a tag to the collection of tags available" + + tagsAvailable isNil + ifTrue: [self messageNoTagsAvailable] + ifFalse: [self messageNotImplementedYet] + +] + { #category : #'graphical interface' } GrafoscopioBrowser >> treeForTransmediatonOn: aTree [ "Shows the correspondent tree of a node" @@ -971,11 +1041,16 @@ GrafoscopioBrowser >> treeOn: constructor [ icon: GLMUIThemeExtraIcons glamorousSave entitled: 'Save current tree'; - "Menu options" + "Options Menu + =============" + + "For trees" act: [ GrafoscopioBrowser open] entitled: 'Nuevo ...' categorized: 'Arbol'; act: [ GrafoscopioBrowser new openFromFile] entitled: 'Abrir/Cargar ...' categorized: 'Arbol'; act: [self saveToFile] entitled: 'Guardar como ...' categorized: 'Arbol'; act: [self exportAsHtml] entitled: 'Exportar como html' categorized: 'Arbol'; + + "For nodes" act: [:treePresentation | (treePresentation selection isNotNil) ifTrue: [self copyNodeIntoCache: treePresentation selection]. @@ -984,13 +1059,29 @@ GrafoscopioBrowser >> treeOn: constructor [ (treePresentation selection isNotNil) ifTrue: [self replaceContentsFromCache: treePresentation selection]. treePresentation update] entitled: 'Pegar nodo' categorized: 'Nodo'; - "act: [ ]; entitled: 'Etiquetar > como: Código'; - act: [ ]; entitled: 'Etiquetar > como: Texto';" + + "For tags" + act: [self showTagsAvailable] entitled: 'Ver disponibles' categorized: 'Etiquetas'; + act: [self addToTagsAvailable] entitled: 'Agregar a disponibles' categorized: 'Etiquetas'; + act: [:treePresentation | + (treePresentation selection isNotNil) + ifTrue: [self addTagTo: treePresentation selection] ] + entitled: 'Agregar al nodo' categorized: 'Etiquetas'; + act: [self messageNotImplementedYet] entitled: 'Eliminar del nodo' categorized: 'Etiquetas'; + + "For projects" act: [self enableRepository] entitled: 'Activar' categorized: 'Proyecto'; act: [self addFileToRepository] entitled: 'Agregar archivo' categorized: 'Proyecto'; act: [self messageNotImplementedYet] entitled: 'Eliminar archivo' categorized: 'Proyecto'; act: [self repositoryCommit] entitled: 'Enviar al histórico' categorized: 'Proyecto'; act: [self repositoryCredentials] entitled: 'Acreditarse' categorized: 'Proyecto'; + + "For help" + act: [self messageNotImplementedYet] entitled: 'Ver como html en línea' categorized: 'Ayuda'; + act: [self messageNotImplementedYet] entitled: 'Ver como html fuera línea' categorized: 'Ayuda'; + act: [self messageNotImplementedYet] entitled: 'Ver como árbol en grafoscopio' categorized: 'Ayuda'; + + "For grafoscopio" act: [self updateGrafoscopio] entitled: 'Actualizar' categorized: 'Grafoscopio'; act: [self updatePrerrequisites] entitled: 'Actualizar prerrequisitos' categorized: 'Grafoscopio'; act: [self messageNotImplementedYet] entitled: 'Herramientas externas > Actualizar' categorized: 'Grafoscopio'; diff --git a/repository/Grafoscopio/GrafoscopioNode.class.st b/repository/Grafoscopio/GrafoscopioNode.class.st index 2e1a9f6..7990dd4 100644 --- a/repository/Grafoscopio/GrafoscopioNode.class.st +++ b/repository/Grafoscopio/GrafoscopioNode.class.st @@ -445,6 +445,14 @@ GrafoscopioNode >> returnConfig [ ^configDict ] +{ #category : #accessing } +GrafoscopioNode >> tagAs: aTag [ + "Tags the recipient node with aTag. For the moment we will have only one tag. In the future we will have several and there will be rules to + know if a tag excludes others from the same node" + + tags := aTag. +] + { #category : #'add/remove nodes' } GrafoscopioNode >> visitedGoTo: aCollection [ "Stores the current node in a collection and recursively stores its children"