Pharo 8, spec 2 :)

This commit is contained in:
Santiago Bragagnolo 2020-02-23 00:05:41 +00:00 committed by Offray Luna
parent 6128493d6e
commit 9a7f45d8b3
24 changed files with 157 additions and 145 deletions

View File

@ -4,7 +4,7 @@ I provide some convenience functionality to work with files.
Class { Class {
#name : #FileUtils, #name : #FileUtils,
#superclass : #Object, #superclass : #Object,
#category : #'Grafoscopio-Model' #category : 'Grafoscopio-Model'
} }
{ #category : #utilities } { #category : #utilities }

View File

@ -32,7 +32,7 @@ Class {
#classVars : [ #classVars : [
'Current' 'Current'
], ],
#category : #'Grafoscopio-UI' #category : 'Grafoscopio-UI'
} }
{ #category : #'accessing - icons' } { #category : #'accessing - icons' }

View File

@ -24,7 +24,7 @@ Class {
'recentNotebooks', 'recentNotebooks',
'helpMenu' 'helpMenu'
], ],
#category : #'Grafoscopio-UI' #category : 'Grafoscopio-UI'
} }
{ #category : #adding } { #category : #adding }

View File

@ -7,7 +7,7 @@ Class {
#classInstVars : [ #classInstVars : [
'recentNotebooks' 'recentNotebooks'
], ],
#category : #'Grafoscopio-UI' #category : 'Grafoscopio-UI'
} }
{ #category : #'world menu' } { #category : #'world menu' }
@ -69,6 +69,7 @@ GfWorldMenu class >> launchCompatibilityMenuOn: aBuilder [
{ #category : #'world menu' } { #category : #'world menu' }
GfWorldMenu class >> launchMenuOn: aBuilder [ GfWorldMenu class >> launchMenuOn: aBuilder [
<worldMenu> <worldMenu>
(aBuilder item: #'New notebook') (aBuilder item: #'New notebook')
label: 'New notebook'; label: 'New notebook';
order: 1; order: 1;

View File

@ -25,7 +25,7 @@ Class {
'presentation', 'presentation',
'glmPres' 'glmPres'
], ],
#category : #'Grafoscopio-UI' #category : 'Grafoscopio-UI'
} }
{ #category : #specs } { #category : #specs }

View File

@ -9,7 +9,7 @@ Class {
'parent', 'parent',
'tags' 'tags'
], ],
#category : #'Grafoscopio-Model' #category : 'Grafoscopio-Model'
} }
{ #category : #'add/remove nodes' } { #category : #'add/remove nodes' }
@ -37,7 +37,7 @@ GrafoscopioAbstractNode >> addTag: aTag [
{ #category : #exporting } { #category : #exporting }
GrafoscopioAbstractNode >> asTreeNodePresenter [ GrafoscopioAbstractNode >> asTreeNodePresenter [
| node | | node |
node := TreeNodePresenter new. node := SpTreeNodePresenter new.
node node
hasChildren: [ false ]; hasChildren: [ false ];
children: [ {} ]; children: [ {} ];

View File

@ -10,7 +10,7 @@ Class {
#instVars : [ #instVars : [
'button' 'button'
], ],
#category : #'Grafoscopio-UI' #category : 'Grafoscopio-UI'
} }
{ #category : #specs } { #category : #specs }

View File

@ -4,17 +4,18 @@ embedded interactive Playground.
" "
Class { Class {
#name : #GrafoscopioCodeModel, #name : #GrafoscopioCodeModel,
#superclass : #ComposablePresenter, #superclass : #SpPresenter,
#instVars : [ #instVars : [
'body' 'body'
], ],
#category : #'Grafoscopio-UI' #category : 'Grafoscopio-UI'
} }
{ #category : #specs } { #category : #specs }
GrafoscopioCodeModel class >> defaultSpec [ GrafoscopioCodeModel class >> defaultSpec [
^ SpBoxLayout newVertical
^ SpecLayout composed add: #body add: #body;
yourself
] ]
{ #category : #accessing } { #category : #accessing }

View File

@ -5,7 +5,7 @@ Class {
'icon', 'icon',
'body' 'body'
], ],
#category : #'Grafoscopio-Model' #category : 'Grafoscopio-Model'
} }
{ #category : #adding } { #category : #adding }

View File

@ -4,7 +4,7 @@ I define the documentation for the Grafoscopio package.
Class { Class {
#name : #GrafoscopioDocs, #name : #GrafoscopioDocs,
#superclass : #GrafoscopioDocumentation, #superclass : #GrafoscopioDocumentation,
#category : #Grafoscopio #category : 'Grafoscopio'
} }
{ #category : #operation } { #category : #operation }

View File

@ -9,12 +9,12 @@ Class {
#instVars : [ #instVars : [
'links' 'links'
], ],
#category : #'Grafoscopio-UI' #category : 'Grafoscopio-UI'
} }
{ #category : #specs } { #category : #specs }
GrafoscopioLinksList class >> defaultSpec [ GrafoscopioLinksList class >> defaultSpec [
^ SpecLayout composed ^ SpLayout composed
add: #links; add: #links;
yourself yourself
] ]

View File

@ -10,7 +10,7 @@ nb openWithSpec
" "
Class { Class {
#name : #GrafoscopioNewNotebook, #name : #GrafoscopioNewNotebook,
#superclass : #ComposablePresenter, #superclass : #SpPresenter,
#instVars : [ #instVars : [
'tree', 'tree',
'header', 'header',
@ -26,7 +26,7 @@ Class {
#classInstVars : [ #classInstVars : [
'recents' 'recents'
], ],
#category : #'Grafoscopio-UI' #category : 'Grafoscopio-UI'
} }
{ #category : #utility } { #category : #utility }
@ -39,22 +39,21 @@ GrafoscopioNewNotebook class >> SHA1For: aFile is: aSHA1String [
{ #category : #specs } { #category : #specs }
GrafoscopioNewNotebook class >> defaultSpec [ GrafoscopioNewNotebook class >> defaultSpec [
^ SpBoxLayout newVertical
^ SpecLayout composed add: #windowMainMenu
newColumn: [:tcol| withConstraints: [ :constraints | constraints height: self toolbarHeight ];
tcol newRow: [ :wrow | wrow add: #windowMainMenu ] height: (self toolbarHeight); add:
newRow: [:row | (SpPanedLayout newHorizontal
row newColumn: [ :tc | position: 250;
tc add: #tree add: #tree;
] width: 300. add:
row newColumn: [ :bc | (SpBoxLayout newVertical
bc newRow: [ :bcr | bcr add: #header ] height: self toolbarHeight. add: #header height: self toolbarHeight;
bc add: #body; add: #links height: self toolbarHeight ]]] add: #body;
] add: #links height: self toolbarHeight;
yourself);
{ #category : #'instance creation' } yourself);
GrafoscopioNewNotebook class >> initialize [ yourself
recents := Set new.
] ]
{ #category : #'instance creation' } { #category : #'instance creation' }
@ -74,7 +73,7 @@ GrafoscopioNewNotebook class >> open: aFileReference [
{ #category : #'instance creation' } { #category : #'instance creation' }
GrafoscopioNewNotebook class >> recents [ GrafoscopioNewNotebook class >> recents [
^ recents ^ recents ifNil: [ recents := Set new. ]
] ]
{ #category : #'instance creation' } { #category : #'instance creation' }
@ -117,25 +116,24 @@ GrafoscopioNewNotebook >> askToSaveBeforeClosing [
GrafoscopioNewNotebook >> autoSaveBodyOf: aNode [ GrafoscopioNewNotebook >> autoSaveBodyOf: aNode [
| playground bodyContents | | playground bodyContents |
bodyContents := aNode content. bodyContents := aNode content.
self body class = GrafoscopioTextModel self body class = GrafoscopioTextModel
ifTrue: [ self body body whenTextChanged: [ :arg | ifTrue: [ self body body
aNode content: arg. whenTextChangedDo: [ :arg |
"self body body whenTextIsAccepted: [:bodyText | aNode content: arg.
"self body body whenTextIsAccepted: [:bodyText |
self inform: bodyText. self inform: bodyText.
aNode updateEditionTimestamp ]." aNode updateEditionTimestamp ]."
bodyContents = arg ifFalse: [ bodyContents = arg
"self inform: arg." ifFalse: [ "self inform: arg.""aNode updateEditionTimestamp" ] ] ].
"aNode updateEditionTimestamp" ]]].
self body body class = GlamourPresentationModel self body body class = GlamourPresentationModel
ifFalse: [ ^ self ]. ifFalse: [ ^ self ].
playground := self body body glmPres. playground := self body body glmPres.
playground playground
onChangeOfPort: #text onChangeOfPort: #text
act: [ :x | act: [ :x |
aNode content: (x pane port: #entity) value content. aNode content: (x pane port: #entity) value content
"aNode updateEditionTimestamp." "aNode updateEditionTimestamp."
"self inform: aNode edited" ] "self inform: aNode edited" ]
] ]
{ #category : #accessing } { #category : #accessing }
@ -178,8 +176,8 @@ GrafoscopioNewNotebook >> content [
{ #category : #'editing nodes' } { #category : #'editing nodes' }
GrafoscopioNewNotebook >> copyNodeToClipboard [ GrafoscopioNewNotebook >> copyNodeToClipboard [
tree highlightedItem content copyToClipboard. tree selectedItem copyToClipboard.
self notebookContent: notebook. self notebookContent: notebook
] ]
{ #category : #persistence } { #category : #persistence }
@ -200,11 +198,10 @@ GrafoscopioNewNotebook >> createNewExample [
{ #category : #operation } { #category : #operation }
GrafoscopioNewNotebook >> currentNode [ GrafoscopioNewNotebook >> currentNode [
^ tree highlightedItem ^ tree selectedItem
ifNil: [ notebook children ifNil: [ notebook children
ifEmpty: [ notebook root ] ifEmpty: [ notebook root ]
ifNotEmpty: [ notebook children first ] ] ifNotEmpty: [ notebook children first ] ]
ifNotNil: [ :v | v content ]
] ]
{ #category : #operation } { #category : #operation }
@ -251,7 +248,7 @@ GrafoscopioNewNotebook >> defineDebugMessageUI [
{ #category : #'editing nodes' } { #category : #'editing nodes' }
GrafoscopioNewNotebook >> demoteNode [ GrafoscopioNewNotebook >> demoteNode [
| editedNode | | editedNode |
editedNode := tree highlightedItem content. editedNode := tree selectedItem.
editedNode demote. editedNode demote.
self notebookContent: notebook. self notebookContent: notebook.
] ]
@ -265,13 +262,22 @@ GrafoscopioNewNotebook >> downloadImages [
locations." locations."
| parentFolder | | parentFolder |
parentFolder := self workingFile parent. parentFolder := UIManager default
self. chooseDirectory: 'Please, choose a destination for the images'
^ self imagesList do: [ :each | | relativePathString link | from:
link := each contents asUrl. (self workingFile
relativePathString := link directory. ifNil: [ FileLocator home ]
relativePathString ifNotEmpty: [ ifNotNil: [ self workingFile parent ]).
GrafoscopioUtils ensureCreateDirectory: relativePathString into: parentFolder ]] parentFolder
ifNotNil: [ ^ self imagesList
do: [ :each |
| relativePathString link |
link := each contents asUrl.
relativePathString := link directory.
relativePathString
ifNotEmpty: [ GrafoscopioUtils
ensureCreateDirectory: relativePathString
into: parentFolder ] ] ]
] ]
{ #category : #persistence } { #category : #persistence }
@ -432,7 +438,7 @@ GrafoscopioNewNotebook >> extent [
{ #category : #'as yet unclassified' } { #category : #'as yet unclassified' }
GrafoscopioNewNotebook >> findAndReplace [ GrafoscopioNewNotebook >> findAndReplace [
| currentNode replaceGUI findString replaceString | | currentNode replaceGUI findString replaceString |
currentNode := tree highlightedItem content. currentNode := tree selectedItem.
replaceGUI := GrafoscopioReplace new. replaceGUI := GrafoscopioReplace new.
replaceGUI openWithSpec. replaceGUI openWithSpec.
replaceGUI ok replaceGUI ok
@ -500,12 +506,12 @@ GrafoscopioNewNotebook >> importImages [
GrafoscopioNewNotebook >> importLinkContent [ GrafoscopioNewNotebook >> importLinkContent [
"I see if a node link is an url located at 'http://ws.stfx.eu', wich means that is a shared "I see if a node link is an url located at 'http://ws.stfx.eu', wich means that is a shared
workspace, and convert the node body to an interactive playground" workspace, and convert the node body to an interactive playground"
| currentNode nodeContent |
currentNode := tree highlightedItem. | currentNode |
currentNode := tree selectedItem.
currentNode ifNil: [ ^ self ]. currentNode ifNil: [ ^ self ].
nodeContent := currentNode content. currentNode importPlaygroundLink.
nodeContent importPlaygroundLink. currentNode importHtmlLink.
nodeContent importHtmlLink.
self updateBodyFor: currentNode self updateBodyFor: currentNode
] ]
@ -522,21 +528,19 @@ GrafoscopioNewNotebook >> initialize [
{ #category : #initialization } { #category : #initialization }
GrafoscopioNewNotebook >> initializePresenter [ GrafoscopioNewNotebook >> initializePresenter [
tree tree
whenHighlightedItemChanged: whenActivatedDo:
[ :item | tree highlightedItem ifNotNil: [ self updateBodyFor: item content ] ]. [ :selection | selection ifNotNil: [ self updateBodyFor: selection selectedItem ] ].
tree
whenTreeUpdated: [ :item | item ifNotNil: [ self updateBodyFor: item ] ].
header header
whenTextChanged: [ :arg | whenTextChangedDo: [ :arg |
tree highlightedItem content header = arg tree selectedItem header = arg
ifFalse: [ tree highlightedItem content header: arg. ifFalse: [ tree selectedItem header: arg.
tree highlightedItem content updateEditionTimestamp. tree selectedItem updateEditionTimestamp.
tree roots: tree roots ] ]. tree roots: tree roots ] ].
links links
whenTextChanged: [ :arg | whenTextChangedDo: [ :arg |
(tree highlightedItem content respondsTo: #link:) (tree respondsTo: #link:)
ifTrue: [ tree highlightedItem content link: arg. ifTrue: [ tree selectedItem link: arg.
tree highlightedItem content updateEditionTimestamp ] ] tree selectedItem updateEditionTimestamp ] ]
] ]
{ #category : #initialization } { #category : #initialization }
@ -545,21 +549,22 @@ GrafoscopioNewNotebook >> initializeWidgets [
header := self newTextInput. header := self newTextInput.
header autoAccept: true. header autoAccept: true.
body := self newText. body := self newText.
body class logCr. body class traceCr.
body disable. body disable.
body text: '<- Select a node'. body text: '<- Select a node'.
body autoAccept: true. body autoAccept: true.
links := self newTextInput. links := self newTextInput.
tree := self newTree. tree := self newTreeTable.
tree tree addColumn: (SpStringTableColumn evaluated: #title).
childrenBlock: [:node | node children]; " tree
displayBlock: [:node | node title ]. childrenBlock: [ :node | node children value ];
self focusOrder displayBlock: [ :node | node title value ]."
self focusOrder
add: tree; add: tree;
add: header; add: header;
add: body; add: body;
add: links. add: links.
self askOkToClose: true. self askOkToClose: true
] ]
{ #category : #persistence } { #category : #persistence }
@ -596,7 +601,7 @@ GrafoscopioNewNotebook >> links: anObject [
{ #category : #'as yet unclassified' } { #category : #'as yet unclassified' }
GrafoscopioNewNotebook >> linksList [ GrafoscopioNewNotebook >> linksList [
| currentNode | | currentNode |
currentNode := tree highlightedItem content. currentNode := tree selectedItem.
GrafoscopioLinksList new GrafoscopioLinksList new
content: currentNode; content: currentNode;
openWithSpec openWithSpec
@ -652,16 +657,16 @@ GrafoscopioNewNotebook >> metadata [
{ #category : #'editing nodes' } { #category : #'editing nodes' }
GrafoscopioNewNotebook >> moveSelectedNodeDown [ GrafoscopioNewNotebook >> moveSelectedNodeDown [
| editedNode | | editedNode |
editedNode := tree selectedItem content. editedNode := tree selectedItem.
editedNode moveDown. editedNode moveDown.
self notebookContent: notebook. self notebookContent: notebook.
tree needRebuild: true. tree needRebuild: true
] ]
{ #category : #'editing nodes' } { #category : #'editing nodes' }
GrafoscopioNewNotebook >> moveSelectedNodeUp [ GrafoscopioNewNotebook >> moveSelectedNodeUp [
| editedNode | | editedNode |
editedNode := tree highlightedItem content. editedNode := tree selectedItem.
editedNode moveUp. editedNode moveUp.
self notebookContent: notebook self notebookContent: notebook
] ]
@ -702,13 +707,12 @@ GrafoscopioNewNotebook >> notebook: anObject [
{ #category : #api } { #category : #api }
GrafoscopioNewNotebook >> notebookContent: aTree [ GrafoscopioNewNotebook >> notebookContent: aTree [
tree tree roots: aTree children
roots: (aTree children collect: [ :gfcNode | gfcNode asTreeNodePresenter ])
] ]
{ #category : #initialization } { #category : #initialization }
GrafoscopioNewNotebook >> notebookSubMenu [ GrafoscopioNewNotebook >> notebookSubMenu [
^ MenuPresenter new ^ SpMenuBarPresenter new
addGroup: [ :group | addGroup: [ :group |
group group
addItem: [ :item | addItem: [ :item |
@ -875,7 +879,7 @@ GrafoscopioNewNotebook >> pandocOptionsComputed [
{ #category : #'editing nodes' } { #category : #'editing nodes' }
GrafoscopioNewNotebook >> pasteNodeFromClipboard [ GrafoscopioNewNotebook >> pasteNodeFromClipboard [
tree highlightedItem content pasteFromClipboard. tree selectedItem pasteFromClipboard.
self notebookContent: notebook. self notebookContent: notebook.
] ]
@ -933,24 +937,26 @@ GrafoscopioNewNotebook >> projectSubMenu [
{ #category : #'editing nodes' } { #category : #'editing nodes' }
GrafoscopioNewNotebook >> promoteNode [ GrafoscopioNewNotebook >> promoteNode [
| editedNote | | editedNote |
editedNote := tree selectedItem content. editedNote := tree selectedItem.
editedNote promote. editedNote promote.
self notebookContent: notebook self notebookContent: notebook
] ]
{ #category : #'editing nodes' } { #category : #'editing nodes' }
GrafoscopioNewNotebook >> removeNode [ GrafoscopioNewNotebook >> removeNode [
| contentToDelete parentContent newSelectedContent children | | contentToDelete parentContent newSelectedContent children path |
tree selectedItem tree selectedItem
ifNil: [ ^ self inform: 'No node available or properly selected ' ]. ifNil: [ ^ self inform: 'No node available or properly selected ' ].
contentToDelete := tree selectedItem content.
path := tree selection selectedPath.
contentToDelete := tree selectedItem.
contentToDelete shouldAskBeforeRemove contentToDelete shouldAskBeforeRemove
ifTrue: [ (UIManager default ifTrue: [ (UIManager default
questionWithoutCancel: questionWithoutCancel:
'The selected node has children and / or content. This change so far cannot be undone. Are you sure you want to proceed? ' 'The selected node has children and / or content. This change so far cannot be undone. Are you sure you want to proceed? '
title: 'Remove node') title: 'Remove node')
ifFalse: [ ^ self ] ]. ifFalse: [ ^ self ] ].
parentContent := contentToDelete parent. parentContent := tree selectedItem parent.
children := parentContent children. children := parentContent children.
children size > 1 children size > 1
ifTrue: [ children last = contentToDelete ifTrue: [ children last = contentToDelete
@ -958,7 +964,7 @@ GrafoscopioNewNotebook >> removeNode [
ifFalse: [ newSelectedContent := parentContent ]. ifFalse: [ newSelectedContent := parentContent ].
contentToDelete parent removeNode: contentToDelete. contentToDelete parent removeNode: contentToDelete.
self notebookContent: notebook. self notebookContent: notebook.
self resetSelectedItem self resetSelectedItemTo: path.
] ]
{ #category : #'editing nodes' } { #category : #'editing nodes' }
@ -968,6 +974,12 @@ GrafoscopioNewNotebook >> resetSelectedItem [
tree updatePresenter. tree updatePresenter.
] ]
{ #category : #'editing nodes' }
GrafoscopioNewNotebook >> resetSelectedItemTo: aPath [
tree selectPath: {(aPath first min: notebook children size)}.
tree updatePresenter
]
{ #category : #persistence } { #category : #persistence }
GrafoscopioNewNotebook >> saveToFile: aFileReference [ GrafoscopioNewNotebook >> saveToFile: aFileReference [
"I save the current tree/document to a file and update storage timestamp." "I save the current tree/document to a file and update storage timestamp."
@ -1022,14 +1034,13 @@ GrafoscopioNewNotebook >> seePdf [
{ #category : #'editing nodes' } { #category : #'editing nodes' }
GrafoscopioNewNotebook >> selectedItem: anItem [ GrafoscopioNewNotebook >> selectedItem: anItem [
tree selectedItem: (tree roots detect: [ : p | p content = anItem ]). tree selectItem: (tree roots detect: [ : p | p = anItem ]).
tree highlightedItem: tree selectedItem.
] ]
{ #category : #persistence } { #category : #persistence }
GrafoscopioNewNotebook >> subtreeAsMarkdown [ GrafoscopioNewNotebook >> subtreeAsMarkdown [
| currentNode | | currentNode |
currentNode := tree highlightedItem content. currentNode := tree selectedItem.
self inform: ('Exported as: ', String cr, (self subtreeAsMarkdownFileFor: currentNode) fullName ) self inform: ('Exported as: ', String cr, (self subtreeAsMarkdownFileFor: currentNode) fullName )
] ]
@ -1046,14 +1057,14 @@ GrafoscopioNewNotebook >> subtreeAsMarkdownFileFor: aNode [
{ #category : #'editing nodes' } { #category : #'editing nodes' }
GrafoscopioNewNotebook >> toggleCodeNode [ GrafoscopioNewNotebook >> toggleCodeNode [
| currentNode | | currentNode |
currentNode := tree highlightedItem. currentNode := tree selectedItem.
currentNode content toggleCodeText. currentNode toggleCodeText.
self updateBodyFor: currentNode. self updateBodyFor: currentNode
] ]
{ #category : #initialization } { #category : #initialization }
GrafoscopioNewNotebook >> topBar [ GrafoscopioNewNotebook >> topBar [
^ MenuPresenter new ^ SpMenuBarPresenter new
addGroup: [ :group | addGroup: [ :group |
group group
addItem: [ :item | addItem: [ :item |
@ -1071,42 +1082,42 @@ GrafoscopioNewNotebook >> topBar [
group group
addItem: [ :item | addItem: [ :item |
item item
name: nil; name: '';
description: 'Save notebook'; description: 'Save notebook';
icon: (self iconNamed: #glamorousSave); icon: (self iconNamed: #glamorousSave);
action: [ self saveWorkingNotebook ] ]. action: [ self saveWorkingNotebook ] ].
group group
addItem: [ :item | addItem: [ :item |
item item
name: nil; name: '';
description: 'Export all Markdown subtrees'; description: 'Export all Markdown subtrees';
icon: (self iconNamed: #glamorousMore); icon: (self iconNamed: #glamorousMore);
action: [ self exportAllSubtreesAsMarkup ] ]. action: [ self exportAllSubtreesAsMarkup ] ].
group group
addItem: [ :item | addItem: [ :item |
item item
name: nil; name: '';
description: 'Cut'; description: 'Cut';
icon: (self iconNamed: #smallCut); icon: (self iconNamed: #smallCut);
action: [ self cutNodeToClipboard ] ]. action: [ self cutNodeToClipboard ] ].
group group
addItem: [ :item | addItem: [ :item |
item item
name: nil; name: '';
description: 'Copy'; description: 'Copy';
icon: (self iconNamed: #smallCopy); icon: (self iconNamed: #smallCopy);
action: [ self copyNodeToClipboard ] ]. action: [ self copyNodeToClipboard ] ].
group group
addItem: [ :item | addItem: [ :item |
item item
name: nil; name: '';
description: 'Paste'; description: 'Paste';
icon: (self iconNamed: #smallPaste); icon: (self iconNamed: #smallPaste);
action: [ self pasteNodeFromClipboard ] ]. action: [ self pasteNodeFromClipboard ] ].
group group
addItem: [ :item | addItem: [ :item |
item item
name: nil; name: '';
description: 'Find & Replace'; description: 'Find & Replace';
icon: (self iconNamed: #smallFind); icon: (self iconNamed: #smallFind);
action: [ self findAndReplace ] ] ]; action: [ self findAndReplace ] ] ];
@ -1114,42 +1125,42 @@ GrafoscopioNewNotebook >> topBar [
group group
addItem: [ :item | addItem: [ :item |
item item
name: nil; name: '';
description: 'Add node'; description: 'Add node';
icon: MendaIcons new plusIcon; icon: MendaIcons new plusIcon;
action: [ self addNode ] ]. action: [ self addNode ] ].
group group
addItem: [ :item | addItem: [ :item |
item item
name: nil; name: '';
description: 'Delete node'; description: 'Delete node';
icon: MendaIcons new minusIcon; icon: MendaIcons new minusIcon;
action: [ self removeNode ] ]. action: [ self removeNode ] ].
group group
addItem: [ :item | addItem: [ :item |
item item
name: nil; name: '';
description: 'Move node up'; description: 'Move node up';
icon: MendaIcons new arrowUpIcon; icon: MendaIcons new arrowUpIcon;
action: [ self moveSelectedNodeUp ] ]. action: [ self moveSelectedNodeUp ] ].
group group
addItem: [ :item | addItem: [ :item |
item item
name: nil; name: '';
description: 'Move node down'; description: 'Move node down';
icon: MendaIcons new arrowDownIcon; icon: MendaIcons new arrowDownIcon;
action: [ self moveSelectedNodeDown ] ]. action: [ self moveSelectedNodeDown ] ].
group group
addItem: [ :item | addItem: [ :item |
item item
name: nil; name: '';
description: 'Move node left'; description: 'Move node left';
icon: MendaIcons new arrowLeftIcon; icon: MendaIcons new arrowLeftIcon;
action: [ self promoteNode ] ]. action: [ self promoteNode ] ].
group group
addItem: [ :item | addItem: [ :item |
item item
name: nil; name: '';
description: 'Move node right'; description: 'Move node right';
icon: MendaIcons new arrowRightIcon; icon: MendaIcons new arrowRightIcon;
action: [ self demoteNode ] ] ]; action: [ self demoteNode ] ] ];
@ -1157,70 +1168,70 @@ GrafoscopioNewNotebook >> topBar [
group group
addItem: [ :item | addItem: [ :item |
item item
name: nil; name: '';
description: 'Toggle: code <--> text'; description: 'Toggle: code <--> text';
icon: MendaIcons new smalltalkCodeIcon; icon: MendaIcons new smalltalkCodeIcon;
action: [ self toggleCodeNode ] ]. action: [ self toggleCodeNode ] ].
group group
addItem: [ :item | addItem: [ :item |
item item
name: nil; name: '';
description: 'List node links'; description: 'List node links';
icon: (self iconNamed: #tinyMenu); icon: (self iconNamed: #tinyMenu);
action: [ self linksList ] ]. action: [ self linksList ] ].
group group
addItem: [ :item | addItem: [ :item |
item item
name: nil; name: '';
description: 'Visit link'; description: 'Visit link';
icon: (self iconNamed: #glamorousRight); icon: (self iconNamed: #glamorousRight);
action: [ self visitNodeLink ] ]. action: [ self visitNodeLink ] ].
group group
addItem: [ :item | addItem: [ :item |
item item
name: nil; name: '';
description: 'Import link content'; description: 'Import link content';
icon: (self iconNamed: #glamorousOpenFromUrl); icon: (self iconNamed: #glamorousOpenFromUrl);
action: [ self importLinkContent ] ]. action: [ self importLinkContent ] ].
group group
addItem: [ :item | addItem: [ :item |
item item
name: nil; name: '';
description: 'Export link content'; description: 'Export link content';
icon: (self iconNamed: #glamorousSaveToUrl); icon: (self iconNamed: #glamorousSaveToUrl);
action: [ self exportLinkContent ] ]. action: [ self exportLinkContent ] ].
group group
addItem: [ :item | addItem: [ :item |
item item
name: nil; name: '';
description: 'HTML to Markdown'; description: 'HTML to Markdown';
icon: (self iconNamed: #smallProfile); icon: (self iconNamed: #smallProfile);
action: [ self htmlToMarkdown ] ]. action: [ self htmlToMarkdown ] ].
group group
addItem: [ :item | addItem: [ :item |
item item
name: nil; name: '';
description: 'HTML to Markdown subtree'; description: 'HTML to Markdown subtree';
icon: (self iconNamed: #hierarchy); icon: (self iconNamed: #hierarchy);
action: [ self htmlToMarkdownSubtree ] ]. action: [ self htmlToMarkdownSubtree ] ].
group group
addItem: [ :item | addItem: [ :item |
item item
name: nil; name: '';
description: 'Tag as...'; description: 'Tag as...';
icon: MendaIcons new tagAddIcon; icon: MendaIcons new tagAddIcon;
action: [ self inform: 'To be implemented...' ] ]. action: [ self inform: 'To be implemented...' ] ].
group group
addItem: [ :item | addItem: [ :item |
item item
name: nil; name: '';
description: 'Untag ....'; description: 'Untag ....';
icon: MendaIcons new tagMinusIcon; icon: MendaIcons new tagMinusIcon;
action: [ self inform: 'To be implemented...' ] ]. action: [ self inform: 'To be implemented...' ] ].
group group
addItem: [ :item | addItem: [ :item |
item item
name: nil; name: '';
description: 'Edit tags...'; description: 'Edit tags...';
icon: FontAwesomeIcons new tagsIcon; icon: FontAwesomeIcons new tagsIcon;
action: [ self inform: 'To be implemented...' ] ] ]; action: [ self inform: 'To be implemented...' ] ] ];
@ -1228,7 +1239,7 @@ GrafoscopioNewNotebook >> topBar [
debug debug
addItem: [ :item | addItem: [ :item |
item item
name: nil; name: '';
description: 'Debug'; description: 'Debug';
icon: icon:
(self iconNamed: #glamorousBug); (self iconNamed: #glamorousBug);
@ -1251,13 +1262,12 @@ GrafoscopioNewNotebook >> updateBodyFor: aNode [
tree needRebuild: false. tree needRebuild: false.
body needRebuild: true. body needRebuild: true.
aNode openIn: self. aNode openIn: self.
self buildWithSpecLayout: self class defaultSpec self buildWithSpec
] ]
{ #category : #operation } { #category : #operation }
GrafoscopioNewNotebook >> visitNodeLink [ GrafoscopioNewNotebook >> visitNodeLink [
tree selectedItem visitLastLink
tree highlightedItem content visitLastLink.
] ]
{ #category : #accessing } { #category : #accessing }

View File

@ -32,7 +32,7 @@ Class {
#classInstVars : [ #classInstVars : [
'clipboard' 'clipboard'
], ],
#category : #'Grafoscopio-Model' #category : 'Grafoscopio-Model'
} }
{ #category : #utility } { #category : #utility }

View File

@ -4,7 +4,7 @@ I test the main functionality of the GrafoscopioNode class.
Class { Class {
#name : #GrafoscopioNodeTest, #name : #GrafoscopioNodeTest,
#superclass : #TestCase, #superclass : #TestCase,
#category : #'Grafoscopio-Model' #category : 'Grafoscopio-Model'
} }
{ #category : #tests } { #category : #tests }

View File

@ -26,7 +26,7 @@ Class {
#classInstVars : [ #classInstVars : [
'recents' 'recents'
], ],
#category : #'Grafoscopio-UI' #category : 'Grafoscopio-UI'
} }
{ #category : #utility } { #category : #utility }

View File

@ -4,5 +4,5 @@ I test the main functionality of the GrafoscopioNode class.
Class { Class {
#name : #GrafoscopioNotebookTest, #name : #GrafoscopioNotebookTest,
#superclass : #TestCase, #superclass : #TestCase,
#category : #'Grafoscopio-UI' #category : 'Grafoscopio-UI'
} }

View File

@ -11,7 +11,7 @@ Class {
'ok', 'ok',
'cancel' 'cancel'
], ],
#category : #'Grafoscopio-UI' #category : 'Grafoscopio-UI'
} }
{ #category : #specs } { #category : #specs }

View File

@ -4,17 +4,18 @@ Usually my content is markdown text.
" "
Class { Class {
#name : #GrafoscopioTextModel, #name : #GrafoscopioTextModel,
#superclass : #ComposablePresenter, #superclass : #SpPresenter,
#instVars : [ #instVars : [
'body' 'body'
], ],
#category : #'Grafoscopio-UI' #category : 'Grafoscopio-UI'
} }
{ #category : #specs } { #category : #specs }
GrafoscopioTextModel class >> defaultSpec [ GrafoscopioTextModel class >> defaultSpec [
^ SpBoxLayout newVertical
^ SpecLayout composed add: #body add: #body;
yourself
] ]
{ #category : #accessing } { #category : #accessing }
@ -36,6 +37,5 @@ GrafoscopioTextModel >> content: aGrafoscopioNodeContent [
GrafoscopioTextModel >> initializeWidgets [ GrafoscopioTextModel >> initializeWidgets [
body := self newText. body := self newText.
body beForText.
body autoAccept: true. body autoAccept: true.
] ]

View File

@ -21,7 +21,7 @@ Class {
#classInstVars : [ #classInstVars : [
'clipboard' 'clipboard'
], ],
#category : #'Grafoscopio-Model' #category : 'Grafoscopio-Model'
} }
{ #category : #utility } { #category : #utility }
@ -182,7 +182,7 @@ GrafoscopioTextNode >> asStonFromRoot [
{ #category : #accessing } { #category : #accessing }
GrafoscopioTextNode >> asTreeNodePresenter [ GrafoscopioTextNode >> asTreeNodePresenter [
| node | | node |
node := TreeNodePresenter new. node := SpTreeNodePresenter new.
node node
hasChildren: [ self children isNotEmpty ]; hasChildren: [ self children isNotEmpty ];
children: [ self children collect: [ :subNode | subNode asTreeNodePresenter ] ]; children: [ self children collect: [ :subNode | subNode asTreeNodePresenter ] ];

View File

@ -4,7 +4,7 @@ Class {
#instVars : [ #instVars : [
'content' 'content'
], ],
#category : #'Grafoscopio-Model' #category : 'Grafoscopio-Model'
} }
{ #category : #accessing } { #category : #accessing }

View File

@ -4,7 +4,7 @@ Class {
#instVars : [ #instVars : [
'link' 'link'
], ],
#category : #'Grafoscopio-Model' #category : 'Grafoscopio-Model'
} }
{ #category : #'as yet unclassified' } { #category : #'as yet unclassified' }
@ -42,7 +42,7 @@ GrafoscopioUrlNode >> link: aZnUrl [
{ #category : #'as yet unclassified' } { #category : #'as yet unclassified' }
GrafoscopioUrlNode >> openIn: aNotebook [ GrafoscopioUrlNode >> openIn: aNotebook [
super openIn: aNotebook. super openIn: aNotebook.
aNotebook links text: (link ifNil: 'Invalid url') aNotebook links text: (link ifNil: 'Invalid url') asString
] ]
{ #category : #'as yet unclassified' } { #category : #'as yet unclassified' }

View File

@ -4,7 +4,7 @@ I store metadata for this package. These meta data are used by other tools such
Class { Class {
#name : #ManifestGrafoscopio, #name : #ManifestGrafoscopio,
#superclass : #PackageManifest, #superclass : #PackageManifest,
#category : #Grafoscopio #category : 'Grafoscopio'
} }
{ #category : #'code-critics' } { #category : #'code-critics' }

View File

@ -29,7 +29,7 @@ Class {
#classVars : [ #classVars : [
'Current' 'Current'
], ],
#category : #'Grafoscopio-UI' #category : 'Grafoscopio-UI'
} }
{ #category : #'instance creation' } { #category : #'instance creation' }

View File

@ -6,7 +6,7 @@ to javascript enabled web presentations.
Class { Class {
#name : #MindMap, #name : #MindMap,
#superclass : #Object, #superclass : #Object,
#category : #'Grafoscopio-Model' #category : 'Grafoscopio-Model'
} }
{ #category : #'as yet unclassified' } { #category : #'as yet unclassified' }