2016-05-12 11:42:48 +00:00
|
|
|
"
|
|
|
|
I am a Grafoscopio Notebook.
|
|
|
|
|
|
|
|
Example:
|
|
|
|
| testTree nb |
|
|
|
|
testTree := GrafoscopioNode new becomeDefaultTestTree.
|
|
|
|
nb := GrafoscopioNotebook new.
|
|
|
|
nb notebookContent: testTree.
|
|
|
|
nb openWithSpec
|
|
|
|
"
|
2016-05-03 15:15:02 +00:00
|
|
|
Class {
|
|
|
|
#name : #GrafoscopioNotebook,
|
|
|
|
#superclass : #ComposableModel,
|
|
|
|
#instVars : [
|
|
|
|
'tree',
|
|
|
|
'header',
|
2016-05-12 11:42:48 +00:00
|
|
|
'body',
|
2016-05-18 15:08:33 +00:00
|
|
|
'windowMainMenu',
|
2016-05-26 17:01:26 +00:00
|
|
|
'workingFile',
|
|
|
|
'notebook'
|
2016-05-03 15:15:02 +00:00
|
|
|
],
|
|
|
|
#category : #'Grafoscopio-UI'
|
|
|
|
}
|
|
|
|
|
2016-05-18 15:08:33 +00:00
|
|
|
{ #category : #utility }
|
|
|
|
GrafoscopioNotebook class >> SHA1For: aFile is: aSHA1String [
|
|
|
|
"I verify that a file has the same signature that the one in a given string,
|
|
|
|
returning true in that case or false otherwise"
|
|
|
|
^ (SHA1 new hashMessage: aFile asFileReference binaryReadStream contents) hex = aSHA1String
|
|
|
|
|
|
|
|
]
|
|
|
|
|
2016-05-03 15:15:02 +00:00
|
|
|
{ #category : #specs }
|
|
|
|
GrafoscopioNotebook class >> defaultSpec [
|
|
|
|
"comment stating purpose of message"
|
|
|
|
|
|
|
|
^ SpecLayout composed
|
2016-05-12 11:42:48 +00:00
|
|
|
newColumn: [:tcol|
|
|
|
|
tcol newRow: [ :wrow | wrow add: #windowMainMenu ] height: (self toolbarHeight);
|
|
|
|
newRow: [:row |
|
|
|
|
row newColumn: [ :tc |
|
|
|
|
tc add: #tree
|
|
|
|
] width: 300.
|
|
|
|
row newColumn: [ :bc |
|
|
|
|
bc newRow: [ :bcr | bcr add: #header ] height: self toolbarHeight.
|
|
|
|
bc add: #body ]]]
|
2016-07-21 12:19:22 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #operation }
|
|
|
|
GrafoscopioNotebook >> addNode [
|
2016-08-10 12:05:37 +00:00
|
|
|
| newSelectedNode |
|
2016-07-27 22:15:25 +00:00
|
|
|
tree needRebuild: true.
|
2016-08-10 12:05:37 +00:00
|
|
|
newSelectedNode := tree selectedItem content addNodeAfterMe.
|
2016-07-27 22:15:25 +00:00
|
|
|
tree roots: tree roots.
|
|
|
|
self buildWithSpecLayout: self class defaultSpec.
|
2016-07-21 12:19:22 +00:00
|
|
|
|
|
|
|
|
2016-05-03 15:15:02 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #accessing }
|
|
|
|
GrafoscopioNotebook >> body [
|
|
|
|
^ body
|
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #accessing }
|
|
|
|
GrafoscopioNotebook >> body: anObject [
|
|
|
|
body := anObject
|
|
|
|
]
|
|
|
|
|
2016-05-12 11:42:48 +00:00
|
|
|
{ #category : #operation }
|
2016-07-28 11:26:03 +00:00
|
|
|
GrafoscopioNotebook >> changeBody: aNode [
|
2016-05-03 15:15:02 +00:00
|
|
|
self needRebuild: false.
|
|
|
|
tree needRebuild: false.
|
2016-08-10 12:05:37 +00:00
|
|
|
body needRebuild: true.
|
2016-05-03 15:15:02 +00:00
|
|
|
|
2016-07-28 11:26:03 +00:00
|
|
|
body := self instantiate: aNode specModelClass new.
|
|
|
|
body content: aNode content.
|
|
|
|
body body class = TextModel
|
2016-07-28 15:09:26 +00:00
|
|
|
ifTrue: [body body whenTextChanged: [ :arg | aNode body: arg ]].
|
|
|
|
body body class = GlamourPresentationModel
|
2016-08-07 17:25:48 +00:00
|
|
|
ifTrue: [ | playground |
|
|
|
|
playground := body body glmPres.
|
|
|
|
playground when: GLMContextChanged
|
|
|
|
do: [ :ann | ann property = #text
|
|
|
|
ifTrue: [ | playgroundText |
|
|
|
|
playgroundText := (playground pane ports at: 2) value.
|
|
|
|
aNode body: playgroundText]
|
|
|
|
]
|
|
|
|
].
|
2016-07-28 11:26:03 +00:00
|
|
|
header text: aNode header.
|
|
|
|
body needRebuild: true.
|
2016-05-03 15:15:02 +00:00
|
|
|
self buildWithSpecLayout: self class defaultSpec.
|
|
|
|
|
|
|
|
]
|
|
|
|
|
2016-07-28 11:26:03 +00:00
|
|
|
{ #category : #operation }
|
|
|
|
GrafoscopioNotebook >> demoteNode [
|
|
|
|
| currentNode |
|
|
|
|
currentNode := tree selectedItem content.
|
|
|
|
currentNode demote.
|
|
|
|
tree needRebuild: true.
|
|
|
|
tree roots: tree roots.
|
|
|
|
self buildWithSpecLayout: self class defaultSpec.
|
|
|
|
]
|
|
|
|
|
2016-05-26 17:01:26 +00:00
|
|
|
{ #category : #persistence }
|
|
|
|
GrafoscopioNotebook >> exportAsSton: aNotebook on: aFileStream [
|
|
|
|
| stonPrettyString |
|
|
|
|
aNotebook flatten.
|
|
|
|
stonPrettyString := String streamContents: [ :stream |
|
|
|
|
(STON writer on: stream)
|
|
|
|
newLine: String crlf;
|
|
|
|
prettyPrint: true;
|
|
|
|
keepNewLines: true;
|
|
|
|
nextPut: aNotebook children].
|
|
|
|
aFileStream nextPutAll: stonPrettyString
|
|
|
|
]
|
|
|
|
|
2016-05-03 15:15:02 +00:00
|
|
|
{ #category : #accessing }
|
|
|
|
GrafoscopioNotebook >> extent [
|
|
|
|
^800@500
|
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #accessing }
|
|
|
|
GrafoscopioNotebook >> header [
|
|
|
|
^ header
|
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #accessing }
|
|
|
|
GrafoscopioNotebook >> header: anObject [
|
|
|
|
header := anObject
|
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #initialization }
|
|
|
|
GrafoscopioNotebook >> initializePresenter [
|
2016-08-10 12:05:37 +00:00
|
|
|
tree whenSelectedItemChanged: [ :item |
|
|
|
|
self updateBodyFor: item.
|
|
|
|
header whenTextChanged: [ :arg |
|
|
|
|
(tree selectedItem content header) = arg
|
|
|
|
ifFalse: [
|
|
|
|
(tree highlightedItem) content header: arg.
|
|
|
|
tree roots: tree roots]]]
|
|
|
|
|
2016-05-03 15:15:02 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #initialization }
|
|
|
|
GrafoscopioNotebook >> initializeWidgets [
|
|
|
|
|
2016-05-12 11:42:48 +00:00
|
|
|
windowMainMenu := self newWindowMainMenu.
|
2016-05-03 15:15:02 +00:00
|
|
|
tree := TreeModel new.
|
2016-05-12 11:42:48 +00:00
|
|
|
header := self newTextInput.
|
2016-07-27 22:15:25 +00:00
|
|
|
body := self newText.
|
2016-05-03 15:15:02 +00:00
|
|
|
body disable.
|
2016-08-10 12:05:37 +00:00
|
|
|
body text: '<- Select a node'.
|
2016-07-27 22:15:25 +00:00
|
|
|
tree
|
|
|
|
childrenBlock: [:node | node children];
|
2016-05-03 15:15:02 +00:00
|
|
|
displayBlock: [:node | node title ].
|
2016-08-11 11:57:35 +00:00
|
|
|
tree whenBuiltDo: [ tree selectedItem: (tree roots first)"; takeHighlight; yourself" ].
|
2016-07-27 22:15:25 +00:00
|
|
|
self focusOrder
|
|
|
|
add: tree;
|
|
|
|
add: header;
|
|
|
|
add: body.
|
|
|
|
]
|
|
|
|
|
2016-07-28 11:26:03 +00:00
|
|
|
{ #category : #operation }
|
|
|
|
GrafoscopioNotebook >> moveNodeAfter [
|
|
|
|
| currentNode |
|
|
|
|
currentNode := tree selectedItem content.
|
|
|
|
currentNode moveAfter.
|
|
|
|
tree needRebuild: true.
|
|
|
|
tree roots: tree roots.
|
|
|
|
self buildWithSpecLayout: self class defaultSpec.
|
|
|
|
]
|
|
|
|
|
2016-07-27 22:15:25 +00:00
|
|
|
{ #category : #operation }
|
|
|
|
GrafoscopioNotebook >> moveNodeBefore [
|
2016-07-28 11:26:03 +00:00
|
|
|
| currentNode |
|
|
|
|
currentNode := tree selectedItem content.
|
|
|
|
currentNode moveBefore.
|
2016-07-27 22:15:25 +00:00
|
|
|
tree needRebuild: true.
|
|
|
|
tree roots: tree roots.
|
|
|
|
self buildWithSpecLayout: self class defaultSpec.
|
2016-05-03 15:15:02 +00:00
|
|
|
]
|
|
|
|
|
2016-05-12 11:42:48 +00:00
|
|
|
{ #category : #initialization }
|
|
|
|
GrafoscopioNotebook >> newWindowMainMenu [
|
|
|
|
^MenuModel new
|
|
|
|
addGroup: [ :group |
|
|
|
|
group addItem: [ :item |
|
|
|
|
item
|
2016-05-12 15:50:22 +00:00
|
|
|
name: 'Notebook';
|
2016-05-12 11:42:48 +00:00
|
|
|
icon: Smalltalk ui icons smallObjectsIcon;
|
|
|
|
subMenu: self notebookSubMenu ].
|
|
|
|
group addItem: [ :item |
|
|
|
|
item
|
2016-05-12 15:50:22 +00:00
|
|
|
name: 'Project';
|
2016-05-12 11:42:48 +00:00
|
|
|
icon: Smalltalk ui icons catalogIcon;
|
|
|
|
subMenu: self projectSubMenu ] ];
|
|
|
|
addGroup: [ :group |
|
|
|
|
group addItem: [ :item |
|
|
|
|
item
|
|
|
|
name: nil;
|
2016-05-12 15:50:22 +00:00
|
|
|
description: 'Save notebook';
|
2016-05-12 11:42:48 +00:00
|
|
|
icon: Smalltalk ui icons smallSaveIcon;
|
2016-05-26 17:01:26 +00:00
|
|
|
action: [ self saveWorkingNotebook ] ].
|
2016-05-12 11:42:48 +00:00
|
|
|
group addItem: [ :item |
|
|
|
|
item
|
|
|
|
name: nil;
|
2016-05-12 15:50:22 +00:00
|
|
|
description: 'Undo';
|
2016-05-12 11:42:48 +00:00
|
|
|
icon: Smalltalk ui icons smallUndoIcon;
|
2016-05-12 15:50:22 +00:00
|
|
|
action: [ self inform: 'To be implemented...' ] ].
|
2016-05-12 11:42:48 +00:00
|
|
|
group addItem: [ :item |
|
|
|
|
item
|
|
|
|
name: nil;
|
2016-05-12 15:50:22 +00:00
|
|
|
description: 'Redo';
|
2016-05-12 11:42:48 +00:00
|
|
|
icon: Smalltalk ui icons smallRedoIcon;
|
2016-05-12 15:50:22 +00:00
|
|
|
action: [ self inform: 'To be implemented...' ] ]];
|
2016-05-12 11:42:48 +00:00
|
|
|
addGroup: [ :group |
|
|
|
|
group addItem: [ :item |
|
|
|
|
item
|
|
|
|
name: nil;
|
2016-05-12 15:50:22 +00:00
|
|
|
description: 'Add nodo';
|
2016-05-12 11:42:48 +00:00
|
|
|
icon: MendaIcons new plusIcon;
|
2016-07-21 12:19:22 +00:00
|
|
|
action: [ self addNode ] ].
|
2016-05-12 11:42:48 +00:00
|
|
|
group addItem: [ :item |
|
|
|
|
item
|
|
|
|
name: nil;
|
2016-05-12 15:50:22 +00:00
|
|
|
description: 'Delete node';
|
2016-05-12 11:42:48 +00:00
|
|
|
icon: MendaIcons new minusIcon;
|
2016-07-21 12:19:22 +00:00
|
|
|
action: [ self removeNode ] ].
|
2016-05-12 11:42:48 +00:00
|
|
|
group addItem: [ :item |
|
|
|
|
item
|
|
|
|
name: nil;
|
2016-05-12 15:50:22 +00:00
|
|
|
description: 'Move up node';
|
2016-05-12 11:42:48 +00:00
|
|
|
icon: MendaIcons new arrowUpIcon;
|
2016-07-21 12:19:22 +00:00
|
|
|
action: [ self moveNodeBefore ] ].
|
2016-05-12 11:42:48 +00:00
|
|
|
group addItem: [ :item |
|
|
|
|
item
|
|
|
|
name: nil;
|
2016-05-12 15:50:22 +00:00
|
|
|
description: 'Move down node';
|
2016-05-12 11:42:48 +00:00
|
|
|
icon: MendaIcons new arrowDownIcon;
|
2016-07-21 12:19:22 +00:00
|
|
|
action: [ self moveNodeAfter ] ].
|
2016-05-12 11:42:48 +00:00
|
|
|
group addItem: [ :item |
|
|
|
|
item
|
|
|
|
name: nil;
|
2016-05-12 15:50:22 +00:00
|
|
|
description: 'Move node left';
|
2016-05-12 11:42:48 +00:00
|
|
|
icon: MendaIcons new arrowLeftIcon;
|
2016-07-21 12:19:22 +00:00
|
|
|
action: [ self promoteNode ] ].
|
2016-05-12 11:42:48 +00:00
|
|
|
group addItem: [ :item |
|
|
|
|
item
|
|
|
|
name: nil;
|
2016-05-12 15:50:22 +00:00
|
|
|
description: 'Move node right';
|
2016-05-12 11:42:48 +00:00
|
|
|
icon: MendaIcons new arrowRightIcon;
|
2016-07-21 12:19:22 +00:00
|
|
|
action: [ self demoteNode ] ]];
|
2016-05-12 11:42:48 +00:00
|
|
|
addGroup: [ :group |
|
|
|
|
group addItem: [ :item |
|
|
|
|
item
|
|
|
|
name: nil;
|
2016-05-12 15:50:22 +00:00
|
|
|
description: 'Togle: code <--> text';
|
2016-05-12 11:42:48 +00:00
|
|
|
icon: MendaIcons new smalltalkCodeIcon;
|
2016-05-12 15:50:22 +00:00
|
|
|
action: [ self inform: 'To be implemented...' ] ].
|
2016-05-12 11:42:48 +00:00
|
|
|
group addItem: [ :item |
|
|
|
|
item
|
|
|
|
name: nil;
|
2016-05-12 15:50:22 +00:00
|
|
|
description: 'Tag as...';
|
2016-05-12 11:42:48 +00:00
|
|
|
icon: MendaIcons new tagAddIcon;
|
2016-05-12 15:50:22 +00:00
|
|
|
action: [ self inform: 'To be implemented...' ] ].
|
2016-05-12 11:42:48 +00:00
|
|
|
group addItem: [ :item |
|
|
|
|
item
|
|
|
|
name: nil;
|
2016-05-12 15:50:22 +00:00
|
|
|
description: 'Untag ....';
|
2016-05-12 11:42:48 +00:00
|
|
|
icon: MendaIcons new tagMinusIcon;
|
2016-05-12 15:50:22 +00:00
|
|
|
action: [ self inform: 'To be implemented...' ] ].
|
2016-05-12 11:42:48 +00:00
|
|
|
group addItem: [ :item |
|
|
|
|
item
|
|
|
|
name: nil;
|
2016-05-12 15:50:22 +00:00
|
|
|
description: 'Edit tags...';
|
2016-05-12 11:42:48 +00:00
|
|
|
icon: FontAwesomeIcons new tagsIcon;
|
2016-05-12 15:50:22 +00:00
|
|
|
action: [ self inform: 'To be implemented...' ] ]].
|
2016-05-12 11:42:48 +00:00
|
|
|
]
|
|
|
|
|
2016-05-26 17:01:26 +00:00
|
|
|
{ #category : #accessing }
|
|
|
|
GrafoscopioNotebook >> notebook [
|
|
|
|
^ notebook
|
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #accessing }
|
|
|
|
GrafoscopioNotebook >> notebook: anObject [
|
|
|
|
notebook := anObject
|
|
|
|
]
|
|
|
|
|
2016-05-12 11:42:48 +00:00
|
|
|
{ #category : #api }
|
2016-05-03 15:15:02 +00:00
|
|
|
GrafoscopioNotebook >> notebookContent: aTree [
|
|
|
|
|
|
|
|
tree roots: aTree children
|
|
|
|
|
|
|
|
]
|
|
|
|
|
2016-05-12 11:42:48 +00:00
|
|
|
{ #category : #initialization }
|
|
|
|
GrafoscopioNotebook >> notebookSubMenu [
|
|
|
|
|
|
|
|
^ MenuModel new
|
|
|
|
addGroup: [ :group |
|
|
|
|
group addItem: [ :item |
|
|
|
|
item
|
2016-05-12 15:50:22 +00:00
|
|
|
name: 'Save';
|
2016-05-12 11:42:48 +00:00
|
|
|
icon: Smalltalk ui icons smallSaveIcon;
|
|
|
|
shortcut: $s command;
|
2016-05-26 17:01:26 +00:00
|
|
|
action: [ self saveWorkingNotebook ] ].
|
2016-05-12 11:42:48 +00:00
|
|
|
group addItem: [ :item |
|
|
|
|
item
|
2016-05-12 15:50:22 +00:00
|
|
|
name: 'Save as...';
|
2016-05-12 11:42:48 +00:00
|
|
|
icon: Smalltalk ui icons smallSaveAsIcon;
|
2016-06-28 16:22:00 +00:00
|
|
|
action: [ self saveToFileUI ] ].
|
2016-05-12 11:42:48 +00:00
|
|
|
group addItem: [ :item |
|
|
|
|
item
|
2016-05-12 15:50:22 +00:00
|
|
|
name: 'Export as html';
|
2016-05-12 11:42:48 +00:00
|
|
|
icon: Smalltalk ui icons smallWindowIcon;
|
2016-05-12 15:50:22 +00:00
|
|
|
action: [ self inform: 'To be implemented...' ] ].
|
2016-05-12 11:42:48 +00:00
|
|
|
group addItem: [ :item |
|
|
|
|
item
|
2016-05-12 15:50:22 +00:00
|
|
|
name: 'Export as pdf';
|
2016-05-12 11:42:48 +00:00
|
|
|
icon: Smalltalk ui icons smallPrintIcon;
|
2016-05-12 15:50:22 +00:00
|
|
|
action: [ self inform: 'To be implemented...' ] ].
|
2016-05-12 11:42:48 +00:00
|
|
|
group addItem: [ :item |
|
|
|
|
item
|
2016-05-12 15:50:22 +00:00
|
|
|
name: 'See html';
|
2016-05-12 11:42:48 +00:00
|
|
|
icon: Smalltalk ui icons smallInspectItIcon;
|
2016-05-12 15:50:22 +00:00
|
|
|
action: [ self inform: 'To be implemented...' ] ].
|
2016-05-12 11:42:48 +00:00
|
|
|
group addItem: [ :item |
|
|
|
|
item
|
2016-05-12 15:50:22 +00:00
|
|
|
name: 'See pdf';
|
2016-05-12 11:42:48 +00:00
|
|
|
icon: Smalltalk ui icons smallInspectItIcon;
|
2016-05-12 15:50:22 +00:00
|
|
|
action: [ self inform: 'To be implemented...' ] ] ]
|
2016-05-12 11:42:48 +00:00
|
|
|
]
|
|
|
|
|
2016-07-19 13:56:25 +00:00
|
|
|
{ #category : #persistence }
|
|
|
|
GrafoscopioNotebook >> openDefault [
|
|
|
|
"I open a new default notebook"
|
|
|
|
|
|
|
|
| nb |
|
|
|
|
nb := self class new.
|
|
|
|
nb
|
|
|
|
notebook: (GrafoscopioNode new becomeDefaultTree);
|
|
|
|
title: ' New | Grafoscopio notebook';
|
|
|
|
notebookContent: nb notebook.
|
|
|
|
^ nb openWithSpec.
|
|
|
|
]
|
|
|
|
|
2016-05-06 16:51:51 +00:00
|
|
|
{ #category : #persistence }
|
|
|
|
GrafoscopioNotebook >> openFromFile: aFileName [
|
|
|
|
"I open a notebook from a file named aFileName containing a grafoscopio tree"
|
|
|
|
|
2016-05-26 17:01:26 +00:00
|
|
|
self workingFile: aFileName.
|
|
|
|
self notebook: ((STON fromString: self workingFile contents) at: 1) parent.
|
|
|
|
self title: self workingFile basenameWithIndicator, ' | Grafoscopio notebook'.
|
|
|
|
self notebookContent: self notebook.
|
|
|
|
^ self openWithSpec.
|
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #persistence }
|
|
|
|
GrafoscopioNotebook >> openFromFileSelector [
|
|
|
|
|
|
|
|
| fileStream nb |
|
|
|
|
fileStream := UITheme builder
|
|
|
|
fileOpen: 'Choose a file'
|
|
|
|
extensions: #('ston').
|
|
|
|
fileStream ifNil: [
|
|
|
|
self inform: 'No file selected'.
|
|
|
|
^ self ].
|
|
|
|
self workingFile: fileStream name asFileReference.
|
2016-05-06 16:51:51 +00:00
|
|
|
nb := self class new.
|
2016-05-26 17:01:26 +00:00
|
|
|
nb openFromFile: self workingFile.
|
2016-05-06 16:51:51 +00:00
|
|
|
]
|
|
|
|
|
2016-07-22 12:52:44 +00:00
|
|
|
{ #category : #persistence }
|
|
|
|
GrafoscopioNotebook >> openFromUrl: anUrl [
|
|
|
|
"Opens a tree from a file named aFileName"
|
|
|
|
|
|
|
|
| fileName |
|
|
|
|
fileName := anUrl splitOn: '/' last.
|
|
|
|
GrafoscopioGUI
|
|
|
|
downloadingFrom: anUrl
|
|
|
|
withMessage: 'Downloading document...'
|
|
|
|
into: FileLocator temp.
|
|
|
|
self class new openFromFile: (FileLocator temp fileName)
|
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #persistence }
|
|
|
|
GrafoscopioNotebook >> openFromUrlUI [
|
|
|
|
"This method generates the UI for the openFromUrl: method, it asks for a URL from the user"
|
|
|
|
|
|
|
|
| fileUrl |
|
|
|
|
"GrafoscopioBrowser configureSettings."
|
|
|
|
fileUrl := UIManager default
|
|
|
|
textEntry: 'Ingrese la URL'
|
|
|
|
title: 'Nuevo documento desde URL'.
|
|
|
|
fileUrl isNil ifTrue: [ ^nil ].
|
|
|
|
self class new openFromUrl: fileUrl
|
|
|
|
]
|
|
|
|
|
2016-07-21 12:19:22 +00:00
|
|
|
{ #category : #persistence }
|
|
|
|
GrafoscopioNotebook >> openTutorial [
|
|
|
|
| tutorial |
|
|
|
|
tutorial := (FileLocator documents / 'Grafoscopio/Docs/Es/Turiales/tutorial.ston' ) asFileReference.
|
2016-07-22 12:52:44 +00:00
|
|
|
tutorial exists
|
|
|
|
ifTrue: [self class new openFromFile: tutorial]
|
|
|
|
ifFalse: [ GrafoscopioGUI updateDocumentationUI ]
|
2016-07-21 12:19:22 +00:00
|
|
|
]
|
|
|
|
|
2016-05-12 11:42:48 +00:00
|
|
|
{ #category : #initialization }
|
|
|
|
GrafoscopioNotebook >> projectSubMenu [
|
|
|
|
|
|
|
|
^ MenuModel new
|
|
|
|
addGroup: [ :group |
|
|
|
|
group addItem: [ :item |
|
|
|
|
item
|
2016-07-21 12:19:22 +00:00
|
|
|
name: 'Activate remote repository...';
|
2016-05-12 11:42:48 +00:00
|
|
|
icon: Smalltalk ui icons smallPushpinIcon;
|
2016-07-21 12:19:22 +00:00
|
|
|
action: [ self inform: 'To be implemented ...' ] ].
|
2016-05-12 11:42:48 +00:00
|
|
|
group addItem: [ :item |
|
|
|
|
item
|
2016-07-21 12:19:22 +00:00
|
|
|
name: 'Activate local repository...';
|
2016-05-12 11:42:48 +00:00
|
|
|
icon: Smalltalk ui icons homeIcon;
|
2016-07-21 12:19:22 +00:00
|
|
|
action: [ self inform: 'To be implemented ...' ] ].
|
2016-05-12 11:42:48 +00:00
|
|
|
group addItem: [ :item |
|
|
|
|
item
|
2016-07-21 12:19:22 +00:00
|
|
|
name: 'Add file...';
|
2016-05-12 11:42:48 +00:00
|
|
|
icon: Smalltalk ui icons newerPackagesAvailableIcon;
|
2016-07-21 12:19:22 +00:00
|
|
|
action: [ self inform: 'To be implemented ...' ] ].
|
2016-05-12 11:42:48 +00:00
|
|
|
group addItem: [ :item |
|
|
|
|
item
|
2016-07-21 12:19:22 +00:00
|
|
|
name: 'Delete file...';
|
2016-05-12 11:42:48 +00:00
|
|
|
icon: Smalltalk ui icons packageDeleteIcon;
|
2016-07-21 12:19:22 +00:00
|
|
|
action: [ self inform: 'To be implemented ...' ] ].
|
2016-05-12 11:42:48 +00:00
|
|
|
group addItem: [ :item |
|
|
|
|
item
|
2016-07-21 12:19:22 +00:00
|
|
|
name: 'Commit to repository';
|
2016-05-12 11:42:48 +00:00
|
|
|
icon: Smalltalk ui icons smallScreenshotIcon;
|
2016-07-21 12:19:22 +00:00
|
|
|
action: [ self inform: 'To be implemented ...' ] ].
|
2016-05-12 11:42:48 +00:00
|
|
|
group addItem: [ :item |
|
|
|
|
item
|
2016-07-21 12:19:22 +00:00
|
|
|
name: 'Credentials';
|
2016-05-12 11:42:48 +00:00
|
|
|
icon: Smalltalk ui icons userIcon;
|
2016-07-21 12:19:22 +00:00
|
|
|
action: [ self inform: 'To be implemented ...' ] ] ]
|
2016-05-12 11:42:48 +00:00
|
|
|
|
|
|
|
]
|
|
|
|
|
2016-07-27 22:15:25 +00:00
|
|
|
{ #category : #operation }
|
2016-07-28 11:26:03 +00:00
|
|
|
GrafoscopioNotebook >> promoteNode [
|
|
|
|
| currentNode |
|
|
|
|
currentNode := tree selectedItem content.
|
|
|
|
currentNode promote.
|
|
|
|
tree needRebuild: true.
|
|
|
|
tree roots: tree roots.
|
|
|
|
self buildWithSpecLayout: self class defaultSpec.
|
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #operation }
|
2016-07-27 22:15:25 +00:00
|
|
|
GrafoscopioNotebook >> removeNode [
|
2016-08-07 17:25:48 +00:00
|
|
|
| nodeToDelete |
|
|
|
|
nodeToDelete := tree selectedItem content.
|
|
|
|
nodeToDelete parent removeNode: nodeToDelete.
|
|
|
|
"tree selectedItem: tree selectedItem parentNode."
|
|
|
|
tree selectOnlyLastHighlighted.
|
2016-07-27 22:15:25 +00:00
|
|
|
tree needRebuild: true.
|
|
|
|
tree roots: tree roots.
|
|
|
|
self buildWithSpecLayout: self class defaultSpec.
|
|
|
|
|
|
|
|
|
|
|
|
]
|
|
|
|
|
2016-06-28 16:22:00 +00:00
|
|
|
{ #category : #persistence }
|
|
|
|
GrafoscopioNotebook >> saveToFile: aFileReference [
|
|
|
|
"I save the current tree/document to a file"
|
|
|
|
|
|
|
|
aFileReference ifNil: [ self inform: 'No file selected for saving. Save NOT done'. ^ self ].
|
|
|
|
workingFile := aFileReference.
|
2016-07-19 12:41:41 +00:00
|
|
|
self workingFile exists ifTrue: [self workingFile delete].
|
|
|
|
self workingFile ensureCreateFile.
|
|
|
|
[ self exportAsSton: self notebook on: (self workingFile writeStream)]
|
|
|
|
ensure: [ (self workingFile writeStream) ifNotNil: #close ].
|
2016-07-19 13:56:25 +00:00
|
|
|
self title: self workingFile basenameWithIndicator, ' | Grafoscopio notebook'.
|
2016-07-19 12:41:41 +00:00
|
|
|
self inform: ('File saved at: ', String cr, self workingFile fullName).
|
2016-06-28 16:22:00 +00:00
|
|
|
GrafoscopioGUI updateRecentNotebooksWith: aFileReference.
|
|
|
|
|
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #persistence }
|
|
|
|
GrafoscopioNotebook >> saveToFileUI [
|
|
|
|
|
|
|
|
| file |
|
|
|
|
|
|
|
|
file := UITheme builder
|
|
|
|
fileSave: 'Export notebook to file as...'
|
|
|
|
extensions: #('ston')
|
|
|
|
path: nil.
|
|
|
|
file
|
|
|
|
ifNil: [ self inform: 'Export cancelled'. ^ self ]
|
|
|
|
ifNotNil:[self saveToFile: file].
|
|
|
|
]
|
|
|
|
|
2016-05-26 17:01:26 +00:00
|
|
|
{ #category : #persistence }
|
|
|
|
GrafoscopioNotebook >> saveWorkingNotebook [
|
|
|
|
"Saves the current tree to the user predefined file location used when he/she opened it."
|
2016-07-19 12:41:41 +00:00
|
|
|
self workingFile
|
|
|
|
ifNil: [ self saveToFileUI ]
|
|
|
|
ifNotNil: [ self saveToFile: workingFile ]
|
|
|
|
|
2016-05-26 17:01:26 +00:00
|
|
|
]
|
|
|
|
|
2016-05-03 15:15:02 +00:00
|
|
|
{ #category : #accessing }
|
|
|
|
GrafoscopioNotebook >> tree [
|
|
|
|
^ tree
|
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #accessing }
|
|
|
|
GrafoscopioNotebook >> tree: anObject [
|
|
|
|
tree := anObject
|
|
|
|
]
|
2016-05-12 11:42:48 +00:00
|
|
|
|
2016-08-10 12:05:37 +00:00
|
|
|
{ #category : #operation }
|
|
|
|
GrafoscopioNotebook >> updateBodyFor: item [
|
|
|
|
item
|
|
|
|
ifNotNil: [ self changeBody: item ]
|
2016-08-11 11:57:35 +00:00
|
|
|
ifNil: [ ]
|
2016-08-10 12:05:37 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #operation }
|
|
|
|
GrafoscopioNotebook >> updateBodyFor: item or: bufferedSelection [
|
|
|
|
item
|
|
|
|
ifNotNil: [ self changeBody: item ]
|
|
|
|
ifNil: [ self changeBody: bufferedSelection ]
|
|
|
|
]
|
|
|
|
|
2016-05-12 11:42:48 +00:00
|
|
|
{ #category : #accessing }
|
|
|
|
GrafoscopioNotebook >> windowMainMenu [
|
|
|
|
^ windowMainMenu
|
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #accessing }
|
|
|
|
GrafoscopioNotebook >> windowMainMenu: anObject [
|
|
|
|
windowMainMenu := anObject
|
|
|
|
]
|
2016-05-26 17:01:26 +00:00
|
|
|
|
|
|
|
{ #category : #accessing }
|
|
|
|
GrafoscopioNotebook >> workingFile [
|
|
|
|
^ workingFile
|
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #accessing }
|
|
|
|
GrafoscopioNotebook >> workingFile: aFile [
|
|
|
|
workingFile := aFile.
|
|
|
|
]
|