Better ergonomy for saving notebooks: Now saving notebooks opens by default the location where the notebook was saved last time or the user documents location, if the previous one was empty.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2017-03-27 17:19:27 +00:00
parent c3986692be
commit 6016a1f90c
5 changed files with 233 additions and 196 deletions

View File

@ -7,7 +7,7 @@ and its components and the help menu.
" "
Class { Class {
#name : #GrafoscopioGUI, #name : #GrafoscopioDockingBar,
#superclass : #DynamicComposableModel, #superclass : #DynamicComposableModel,
#instVars : [ #instVars : [
'windowMainMenu', 'windowMainMenu',
@ -27,7 +27,7 @@ Class {
} }
{ #category : #specs } { #category : #specs }
GrafoscopioGUI class >> defaultSpec [ GrafoscopioDockingBar class >> defaultSpec [
<spec: #default> <spec: #default>
^ SpecLayout composed ^ SpecLayout composed
@ -53,7 +53,7 @@ GrafoscopioGUI class >> defaultSpec [
] ]
{ #category : #updating } { #category : #updating }
GrafoscopioGUI class >> docDataManual [ GrafoscopioDockingBar class >> docDataManual [
"I define some metadata associated to the manual document. "I define some metadata associated to the manual document.
Language is provided according to the ISO 639-1 code convention." Language is provided according to the ISO 639-1 code convention."
@ -69,7 +69,7 @@ GrafoscopioGUI class >> docDataManual [
] ]
{ #category : #updating } { #category : #updating }
GrafoscopioGUI class >> docDataTutorial [ GrafoscopioDockingBar class >> docDataTutorial [
"I define some metadata associated to the tutorial document. "I define some metadata associated to the tutorial document.
Language is provided according to the ISO 639-1 code convention." Language is provided according to the ISO 639-1 code convention."
@ -86,17 +86,17 @@ GrafoscopioGUI class >> docDataTutorial [
] ]
{ #category : #accessing } { #category : #accessing }
GrafoscopioGUI class >> dockingBar [ GrafoscopioDockingBar class >> dockingBar [
^ dockingBar ^ dockingBar
] ]
{ #category : #accessing } { #category : #accessing }
GrafoscopioGUI class >> dockingBar: anObject [ GrafoscopioDockingBar class >> dockingBar: anObject [
dockingBar := anObject dockingBar := anObject
] ]
{ #category : #'graphical interface' } { #category : #'graphical interface' }
GrafoscopioGUI class >> downloadingFrom: downloadUrl withMessage: aString into: location [ GrafoscopioDockingBar class >> downloadingFrom: downloadUrl withMessage: aString into: location [
| fileName | | fileName |
fileName := (downloadUrl splitOn: $/) last. fileName := (downloadUrl splitOn: $/) last.
(location / fileName) exists ifTrue: [ (location / fileName) ensureDelete ]. (location / fileName) exists ifTrue: [ (location / fileName) ensureDelete ].
@ -116,7 +116,7 @@ GrafoscopioGUI class >> downloadingFrom: downloadUrl withMessage: aString into:
] ]
{ #category : #examples } { #category : #examples }
GrafoscopioGUI class >> exampleBootstrapDynamicUI1 [ GrafoscopioDockingBar class >> exampleBootstrapDynamicUI1 [
"Starting from an example UI from the Spec-Glamour, to customize towards the grafoscopio "Starting from an example UI from the Spec-Glamour, to customize towards the grafoscopio
UI and get some ideas" UI and get some ideas"
@ -186,7 +186,7 @@ GrafoscopioGUI class >> exampleBootstrapDynamicUI1 [
] ]
{ #category : #examples } { #category : #examples }
GrafoscopioGUI class >> exampleBootstrapDynamicUI2 [ GrafoscopioDockingBar class >> exampleBootstrapDynamicUI2 [
"Starting from an example UI from the Spec-Glamour, to customize towards the grafoscopio "Starting from an example UI from the Spec-Glamour, to customize towards the grafoscopio
UI and get some ideas" UI and get some ideas"
@ -262,7 +262,7 @@ GrafoscopioGUI class >> exampleBootstrapDynamicUI2 [
] ]
{ #category : #examples } { #category : #examples }
GrafoscopioGUI class >> exampleBootstrapUI [ GrafoscopioDockingBar class >> exampleBootstrapUI [
"Starting from an example UI from the Spec-Glamour, to customize towards the grafoscopio "Starting from an example UI from the Spec-Glamour, to customize towards the grafoscopio
UI and get some ideas" UI and get some ideas"
@ -297,12 +297,12 @@ GrafoscopioGUI class >> exampleBootstrapUI [
] ]
{ #category : #'class initialization' } { #category : #'class initialization' }
GrafoscopioGUI class >> initialize [ GrafoscopioDockingBar class >> initialize [
self startDockingBar. self start.
] ]
{ #category : #'graphical interface' } { #category : #'graphical interface' }
GrafoscopioGUI class >> messageAbout [ GrafoscopioDockingBar class >> messageAbout [
"Shows the author, license, sponsors and main contributors to the project and point to further documentation on the web" "Shows the author, license, sponsors and main contributors to the project and point to further documentation on the web"
LongMessageDialogWindow new LongMessageDialogWindow new
@ -347,7 +347,7 @@ GrafoscopioGUI class >> messageAbout [
] ]
{ #category : #'graphical interface' } { #category : #'graphical interface' }
GrafoscopioGUI class >> messageNoRecentDocuments [ GrafoscopioDockingBar class >> messageNoRecentDocuments [
"Shows that a feature is not implemeted and point to further documentation on the web" "Shows that a feature is not implemeted and point to further documentation on the web"
UIManager default abort: UIManager default abort:
@ -363,7 +363,7 @@ GrafoscopioGUI class >> messageNoRecentDocuments [
] ]
{ #category : #'graphical interface' } { #category : #'graphical interface' }
GrafoscopioGUI class >> messageNotImplementedYet [ GrafoscopioDockingBar class >> messageNotImplementedYet [
"Shows that a feature is not implemeted and point to further documentation on the web" "Shows that a feature is not implemeted and point to further documentation on the web"
UIManager default abort: UIManager default abort:
@ -379,12 +379,12 @@ GrafoscopioGUI class >> messageNotImplementedYet [
] ]
{ #category : #'graphical interface' } { #category : #'graphical interface' }
GrafoscopioGUI class >> open [ GrafoscopioDockingBar class >> open [
^ self new open ^ self new open
] ]
{ #category : #'graphical interface' } { #category : #'graphical interface' }
GrafoscopioGUI class >> openFromRecentlyUsed [ GrafoscopioDockingBar class >> openFromRecentlyUsed [
"Opens a recent notebooks list" "Opens a recent notebooks list"
| selection | | selection |
@ -402,17 +402,17 @@ GrafoscopioGUI class >> openFromRecentlyUsed [
] ]
{ #category : #accessing } { #category : #accessing }
GrafoscopioGUI class >> recentNotebooks [ GrafoscopioDockingBar class >> recentNotebooks [
^ recentNotebooks ifNil: [recentNotebooks := OrderedCollection new ] ^ recentNotebooks ifNil: [recentNotebooks := OrderedCollection new ]
] ]
{ #category : #accessing } { #category : #accessing }
GrafoscopioGUI class >> recentNotebooks: anOrderedCollection [ GrafoscopioDockingBar class >> recentNotebooks: anOrderedCollection [
recentNotebooks := anOrderedCollection recentNotebooks := anOrderedCollection
] ]
{ #category : #configuration } { #category : #configuration }
GrafoscopioGUI class >> showSettings [ GrafoscopioDockingBar class >> showSettings [
"Shows the settings in a Transcript. This should return a dictionary for better management of the settings. For the moment "Shows the settings in a Transcript. This should return a dictionary for better management of the settings. For the moment
is a quick a dirty hack" is a quick a dirty hack"
@ -421,9 +421,9 @@ GrafoscopioGUI class >> showSettings [
] ]
{ #category : #'graphical interface' } { #category : #'graphical interface' }
GrafoscopioGUI class >> startDockingBar [ GrafoscopioDockingBar class >> start [
"Creates a custom docking bar for grafoscopio on top, with shorcuts for most used actions, "Creates a custom docking bar for grafoscopio on top, for shorcuts to the most used actions,
and a fixed place for asking for help, external tools and grafoscopio updates and about" and as a fixed place for asking for help, external tools and grafoscopio updates and about"
| launchMenu helpMenu updateMenu | | launchMenu helpMenu updateMenu |
@ -453,7 +453,7 @@ GrafoscopioGUI class >> startDockingBar [
helpMenu helpMenu
add: 'Tutorial (Spanish)' target: (GrafoscopioNotebook new) selector: #openTutorial; add: 'Tutorial (Spanish)' target: (GrafoscopioNotebook new) selector: #openTutorial;
add: 'Manual' target: (GrafoscopioNotebook new) selector: #openManual; add: 'Manual' target: (GrafoscopioNotebook new) selector: #openManual;
add: 'Manual (PDF)' target: (self new) selector: #openPDFManual; add: 'Manual (PDF)' target: GrafoscopioDocumentation selector: #openPDFManual;
add: 'Dev''s notes' target: (GrafoscopioNotebook new) selector: #openDevNotes; add: 'Dev''s notes' target: (GrafoscopioNotebook new) selector: #openDevNotes;
add: 'About Grafoscopio' target: self selector: #messageAbout. add: 'About Grafoscopio' target: self selector: #messageAbout.
@ -468,7 +468,7 @@ GrafoscopioGUI class >> startDockingBar [
] ]
{ #category : #updating } { #category : #updating }
GrafoscopioGUI class >> updateDataviz [ GrafoscopioDockingBar class >> updateDataviz [
"I'm update the Dataviz package with new versions of itself take from the source code repository. "I'm update the Dataviz package with new versions of itself take from the source code repository.
DataViz contains Data visualization helpers" DataViz contains Data visualization helpers"
Gofer it Gofer it
@ -479,7 +479,7 @@ GrafoscopioGUI class >> updateDataviz [
] ]
{ #category : #updating } { #category : #updating }
GrafoscopioGUI class >> updateDatavizUI [ GrafoscopioDockingBar class >> updateDatavizUI [
"I'm the User Interface for updating the Dataviz package with new versions of itself take from the source code repository" "I'm the User Interface for updating the Dataviz package with new versions of itself take from the source code repository"
| update | | update |
@ -493,7 +493,7 @@ GrafoscopioGUI class >> updateDatavizUI [
] ]
{ #category : #updating } { #category : #updating }
GrafoscopioGUI class >> updateDocumentationUI [ GrafoscopioDockingBar class >> updateDocumentationUI [
"Updates documentation (manual, tutorials) from official repository" "Updates documentation (manual, tutorials) from official repository"
| update | | update |
@ -505,7 +505,7 @@ GrafoscopioGUI class >> updateDocumentationUI [
] ]
{ #category : #updating } { #category : #updating }
GrafoscopioGUI class >> updateGrafoscopio [ GrafoscopioDockingBar class >> updateGrafoscopio [
"Updates Grafoscopio with new versions of itself take from the source code repository and "Updates Grafoscopio with new versions of itself take from the source code repository and
the User Interface" the User Interface"
Gofer new Gofer new
@ -516,7 +516,7 @@ GrafoscopioGUI class >> updateGrafoscopio [
] ]
{ #category : #updating } { #category : #updating }
GrafoscopioGUI class >> updateGrafoscopioUI [ GrafoscopioDockingBar class >> updateGrafoscopioUI [
"Updates Grafoscopio with new versions of itself take from the source code repository and "Updates Grafoscopio with new versions of itself take from the source code repository and
the User Interface" the User Interface"
| update | | update |
@ -533,7 +533,7 @@ GrafoscopioGUI class >> updateGrafoscopioUI [
] ]
{ #category : #updating } { #category : #updating }
GrafoscopioGUI class >> updatePrerrequisitesScript [ GrafoscopioDockingBar class >> updatePrerrequisitesScript [
"Updates the system prerequisites with new versions of itself take from the source code repository" "Updates the system prerequisites with new versions of itself take from the source code repository"
"Visualization library (which also makes main menu loadable)" "Visualization library (which also makes main menu loadable)"
@ -609,43 +609,39 @@ GrafoscopioGUI class >> updatePrerrequisitesScript [
] ]
{ #category : #updating } { #category : #updating }
GrafoscopioGUI class >> updateRecentNotebooksWith: aFileReference [ GrafoscopioDockingBar class >> updateRecentNotebooksWith: aFileReference [
(self recentNotebooks includes: aFileReference) (self recentNotebooks includes: aFileReference)
ifFalse: [self recentNotebooks add: aFileReference]. ifFalse: [self recentNotebooks add: aFileReference].
] ]
{ #category : #updating } { #category : #updating }
GrafoscopioGUI class >> updateSystem [ GrafoscopioDockingBar class >> updateSystem [
"Updates the system with new versions of itself take from the source code repository" | tmp1 tmp2 |
| update | tmp1 := UIManager default
question: 'Do you wish to update all Grafoscopio and its co-dependencies ?'
update := (UIManager default title: 'Actualizar grafoscopio'.
question: '¿Desea actualizar grafoscopio?' tmp1
title: 'Actualizar grafoscopio'). ifNotNil: [ tmp1
update ifNotNil: [ ifTrue: [ tmp2 := self.
update tmp2
ifFalse: [ self inform: 'Actualización de todo el sistema NO realizada.' ] updateGrafoscopio;
ifTrue: [ updateDataviz.
self GrafoscopioDocumentation update.
updateGrafoscopio; self inform: 'Actualización de todo el sistema terminada.' ]
updateDataviz. ifFalse: [ self inform: 'Actualización de todo el sistema NO realizada.' ] ]
GrafoscopioDocumentation update.
ExternalApp installSQLite32Bits.
self inform: 'Actualización de todo el sistema terminada.']
]
] ]
{ #category : #updating } { #category : #updating }
GrafoscopioGUI class >> updateUI [ GrafoscopioDockingBar class >> updateUI [
"I update the User Interface (UI) with new versions of the docking bar or logos where available. "I update the User Interface (UI) with new versions of the docking bar or logos where available.
I'm helpful while testing new functionality that should be expossed to the user via the UI" I'm helpful while testing new functionality that should be expossed to the user via the UI"
self startDockingBar. self start.
(World submorphs select: [ :each | each class = DockingBarMorph ]) allButFirstDo: [ :bar | bar delete ]. (World submorphs select: [ :each | each class = DockingBarMorph ]) allButFirstDo: [ :bar | bar delete ].
] ]
{ #category : #'ui-building' } { #category : #'ui-building' }
GrafoscopioGUI >> proyectSubMenu [ GrafoscopioDockingBar >> proyectSubMenu [
"This should be integrated with the GrafoscopioNotebook same messages. "This should be integrated with the GrafoscopioNotebook same messages.
Was originally wrote in Spanish, and something is lost in translation, but Grafoscopio Was originally wrote in Spanish, and something is lost in translation, but Grafoscopio
should be available in several languages..." should be available in several languages..."

View File

@ -25,7 +25,22 @@ GrafoscopioDocumentation class >> current [
gfcDocumentation documents gfcDocumentation documents
add: 'Docs/Es/Tutoriales/tutorial.ston'; add: 'Docs/Es/Tutoriales/tutorial.ston';
add: 'Docs/En/Books/Manual/manual.ston'; add: 'Docs/En/Books/Manual/manual.ston';
add: 'Docs/En/dev-notes.ston'. add: 'Docs/En/dev-notes.ston';
add: 'Docs/En/Books/Manual/manual.pdf'.
gfcDocumentation localPlace.
^ gfcDocumentation
]
{ #category : #operation }
GrafoscopioDocumentation class >> dataviz [
"I model the important documents that belong to the Grafoscopio documentation.
When more documents become more mature and usable, I will include them."
| gfcDocumentation |
gfcDocumentation := self new.
gfcDocumentation repository: (FossilRepo new url: 'http://mutabit.com/repos.fossil/grafoscopio').
gfcDocumentation documents
add: 'Packages/Dataviz/dataviz.ston'.
gfcDocumentation localPlace. gfcDocumentation localPlace.
^ gfcDocumentation ^ gfcDocumentation
] ]
@ -39,7 +54,7 @@ GrafoscopioDocumentation class >> download: fileNameWithRelativePath [
relativePathFolders do: [ :folder | newPath := newPath / folder ]. relativePathFolders do: [ :folder | newPath := newPath / folder ].
parentFolder := newPath asFileReference. parentFolder := newPath asFileReference.
parentFolder exists ifFalse: [ parentFolder ensureCreateDirectory ]. parentFolder exists ifFalse: [ parentFolder ensureCreateDirectory ].
GrafoscopioGUI GrafoscopioDockingBar
downloadingFrom: self current repository url asString, '/doc/tip/', fileNameWithRelativePath downloadingFrom: self current repository url asString, '/doc/tip/', fileNameWithRelativePath
withMessage: 'Downloading ', fileName withMessage: 'Downloading ', fileName
into: parentFolder into: parentFolder
@ -51,12 +66,7 @@ GrafoscopioDocumentation class >> initialize [
] ]
{ #category : #updating } { #category : #updating }
GrafoscopioDocumentation class >> isUpdated [ GrafoscopioDocumentation class >> isFileUpdatedFor: relativeFilePath [
^ (self listOutdated size > 0) ifTrue: [ ^ false ] ifFalse: [ ^ true ]
]
{ #category : #updating }
GrafoscopioDocumentation class >> isUpdatedFor: relativeFilePath [
"I compare if the local and remote copies of a relativeFilePath are updated for the current "I compare if the local and remote copies of a relativeFilePath are updated for the current
documentation and return true if they are and false in any other case" documentation and return true if they are and false in any other case"
| localFile | | localFile |
@ -66,10 +76,36 @@ GrafoscopioDocumentation class >> isUpdatedFor: relativeFilePath [
ifTrue: [ ^ ExternalApp compareHashFor: localFile with: (self current repository lastHashNumberFor: relativeFilePath) ] ifTrue: [ ^ ExternalApp compareHashFor: localFile with: (self current repository lastHashNumberFor: relativeFilePath) ]
] ]
{ #category : #updating }
GrafoscopioDocumentation class >> isUpdated [
^ (self listOutdated isEmpty) ifTrue: [ ^ false ] ifFalse: [ ^ true ]
]
{ #category : #updating } { #category : #updating }
GrafoscopioDocumentation class >> listOutdated [ GrafoscopioDocumentation class >> listOutdated [
"I return the list of all documentent where the local copy and the remote copy doesn't match" "I return the list of all documentent where the local copy and the remote copy doesn't match"
^ self current documents select: [ :doc | (self isUpdatedFor: doc) = false ] self listOutdatedDocsIn: self current documents
]
{ #category : #updating }
GrafoscopioDocumentation class >> listOutdatedDocsIn: aDocumentsCollection [
"I return the list of all documentent where the local copy and the remote copy doesn't match"
^ aDocumentsCollection select: [ :doc | (self isFileUpdatedFor: doc) = false ]
]
{ #category : #'as yet unclassified' }
GrafoscopioDocumentation class >> openDatavizIntro [
self shouldBeImplemented.
]
{ #category : #operation }
GrafoscopioDocumentation class >> openPDFManual [
"I open the documentation in PDF format. I only work on Unix right now, but in the future my creator hopes to be able
to have truly multiplatform support"
| pdfManual docs |
docs := self current.
pdfManual := docs documents at: 4.
UnixProcess command: 'xdg-open ', (docs localPlace / pdfManual) fullName.
] ]
{ #category : #updating } { #category : #updating }

View File

@ -24,7 +24,8 @@ Class {
'level', 'level',
'nodesInPreorder', 'nodesInPreorder',
'metadata', 'metadata',
'links' 'links',
'output'
], ],
#classInstVars : [ #classInstVars : [
'clipboard' 'clipboard'
@ -260,7 +261,7 @@ GrafoscopioNode >> bodyAsCode [
| codeBody | | codeBody |
codeBody := '' writeStream. codeBody := '' writeStream.
codeBody codeBody
nextPutAll: ('~~~'); lf; nextPutAll: ('~~~{.numberLines}'); lf;
nextPutAll: (self body contents asString withInternetLineEndings); lf; nextPutAll: (self body contents asString withInternetLineEndings); lf;
nextPutAll: ('~~~'); lf; lf. nextPutAll: ('~~~'); lf; lf.
^ codeBody contents ^ codeBody contents
@ -270,7 +271,7 @@ GrafoscopioNode >> bodyAsCode [
GrafoscopioNode >> bodyAsMarkdownInto: aStream [ GrafoscopioNode >> bodyAsMarkdownInto: aStream [
"I export the header as markdown using the level inside the tree to determine hierarchy "I export the header as markdown using the level inside the tree to determine hierarchy
and replacing all line endings to make them Internet friendly". and replacing all line endings to make them Internet friendly".
self embeddedNodes ifNotNil: [ aStream nextPutAll: (self embedNodes contents withInternetLineEndings); crlf; crlf]. self embeddedNodes ifNotNil: [ aStream nextPutAll: (self embedNodes contents asString withInternetLineEndings); crlf; crlf].
] ]
{ #category : #accessing } { #category : #accessing }
@ -371,7 +372,7 @@ GrafoscopioNode >> embeddedNodes [
GrafoscopioNode >> exportCodeBlockTo: aStream [ GrafoscopioNode >> exportCodeBlockTo: aStream [
"I convert the content of a node taged as 'código' (code) as pandoc markdown and put it "I convert the content of a node taged as 'código' (code) as pandoc markdown and put it
into aStream." into aStream."
aStream nextPutAll: ('~~~'); lf. aStream nextPutAll: ('~~~{.numberLines}'); lf.
aStream nextPutAll: (self body contents asString withInternetLineEndings); lf. aStream nextPutAll: (self body contents asString withInternetLineEndings); lf.
aStream nextPutAll: ('~~~'); lf;lf. aStream nextPutAll: ('~~~'); lf;lf.
^aStream contents ^aStream contents
@ -679,9 +680,13 @@ GrafoscopioNode >> parent: aNode [
] ]
{ #category : #'add/remove nodes' } { #category : #'add/remove nodes' }
GrafoscopioNode >> pasteFromClipboard [ GrafoscopioNode >> pasteFromClipboard [
| clipchild |
self class clipboard self class clipboard
ifNotNil: [ self addNode: self class clipboard ] ifNotNil: [
clipchild := self class clipboard.
self addNode: clipchild.
clipchild ]
ifNil: [ self inform: 'Cache is emtpy. Pleas cut/copy a node before pasting' ] ifNil: [ self inform: 'Cache is emtpy. Pleas cut/copy a node before pasting' ]
] ]

View File

@ -127,11 +127,10 @@ GrafoscopioNotebook >> exportAsMarkdown [
workingFile workingFile
ifNil: [ self inform: 'File NOT exported. Please save the notebook on hard drive first' ] ifNil: [ self inform: 'File NOT exported. Please save the notebook on hard drive first' ]
ifNotNil: [ ifNotNil: [
self markdownFile exists ifTrue: [ self markdownFile delete ]. self markdownFile
self markdownFile ensureCreateFile. exists ifTrue: [ self markdownFile delete ];
self markdownFile writeStreamDo: [:stream | stream nextPutAll: self notebook asMarkdown]. ensureCreateFile;
"[ self exportAsMarkdown: self notebook on: ( markdownFile writeStream )] writeStreamDo: [:stream | stream nextPutAll: self notebook asMarkdown].
ensure: [ (markdownFile writeStream) ifNotNil: #close ]."
self inform: ('File exported as: ', String cr, self markdownFile fullName)] self inform: ('File exported as: ', String cr, self markdownFile fullName)]
] ]
@ -195,8 +194,9 @@ GrafoscopioNotebook >> initializePresenter [
{ #category : #initialization } { #category : #initialization }
GrafoscopioNotebook >> initializeWidgets [ GrafoscopioNotebook >> initializeWidgets [
windowMainMenu := self newWindowMainMenu. windowMainMenu := self topBar.
header := self newTextInput. header := self newTextInput.
header autoAccept: true.
body := self newText. body := self newText.
body disable. body disable.
body text: '<- Select a node'. body text: '<- Select a node'.
@ -247,121 +247,6 @@ GrafoscopioNotebook >> moveNodeBefore [
self notebookContent: notebook self notebookContent: notebook
] ]
{ #category : #initialization }
GrafoscopioNotebook >> newWindowMainMenu [
^MenuModel new
addGroup: [ :group |
group addItem: [ :item |
item
name: 'Notebook';
icon: Smalltalk ui icons smallObjectsIcon;
subMenu: self notebookSubMenu ].
group addItem: [ :item |
item
name: 'Project';
icon: Smalltalk ui icons catalogIcon;
subMenu: self projectSubMenu ] ];
addGroup: [ :group |
group addItem: [ :item |
item
name: nil;
description: 'Save notebook';
icon: Smalltalk ui icons smallSaveIcon;
action: [ self saveWorkingNotebook ] ].
group addItem: [ :item |
item
name: nil;
description: 'Cut';
icon: Smalltalk ui icons smallCutIcon;
action: [ self cutNodeToClipboard ] ].
group addItem: [ :item |
item
name: nil;
description: 'Copy';
icon: Smalltalk ui icons smallCopyIcon;
action: [ self copyNodeToClipboard ] ].
group addItem: [ :item |
item
name: nil;
description: 'Paste';
icon: Smalltalk ui icons smallPasteIcon;
action: [ self pasteNodeFromClipboard ] ]];
addGroup: [ :group |
group addItem: [ :item |
item
name: nil;
description: 'Add node';
icon: MendaIcons new plusIcon;
action: [ self addNode ] ].
group addItem: [ :item |
item
name: nil;
description: 'Delete node';
icon: MendaIcons new minusIcon;
action: [ self removeNode ] ].
group addItem: [ :item |
item
name: nil;
description: 'Move node up';
icon: MendaIcons new arrowUpIcon;
action: [ self moveNodeBefore ] ].
group addItem: [ :item |
item
name: nil;
description: 'Move node down';
icon: MendaIcons new arrowDownIcon;
action: [ self moveNodeAfter ] ].
group addItem: [ :item |
item
name: nil;
description: 'Move node left';
icon: MendaIcons new arrowLeftIcon;
action: [ self promoteNode ] ].
group addItem: [ :item |
item
name: nil;
description: 'Move node right';
icon: MendaIcons new arrowRightIcon;
action: [ self demoteNode ] ]];
addGroup: [ :group |
group addItem: [ :item |
item
name: nil;
description: 'Togle: code <--> text';
icon: MendaIcons new smalltalkCodeIcon;
action: [ self toggleCodeNode ] ].
group addItem: [ :item |
item
name: nil;
description: 'Visit link';
icon: Smalltalk ui icons glamorousRight;
action: [ self visitNodeLink ] ].
group addItem: [ :item |
item
name: nil;
description: 'Load link';
icon: Smalltalk ui icons glamorousRefresh;
action: [ self updateForSpecialLinks ] ].
group addItem: [ :item |
item
name: nil;
description: 'Tag as...';
icon: MendaIcons new tagAddIcon;
action: [ self inform: 'To be implemented...' ] ].
group addItem: [ :item |
item
name: nil;
description: 'Untag ....';
icon: MendaIcons new tagMinusIcon;
action: [ self inform: 'To be implemented...' ] ].
group addItem: [ :item |
item
name: nil;
description: 'Edit tags...';
icon: FontAwesomeIcons new tagsIcon;
action: [ self inform: 'To be implemented...' ] ]].
]
{ #category : #accessing } { #category : #accessing }
GrafoscopioNotebook >> notebook [ GrafoscopioNotebook >> notebook [
^ notebook ^ notebook
@ -468,7 +353,7 @@ GrafoscopioNotebook >> openDocumentationNotebookAt: index [
notebookTemp := (gfcDocs localPlace fullName, '/', (gfcDocs documents at: index)) asFileReference. notebookTemp := (gfcDocs localPlace fullName, '/', (gfcDocs documents at: index)) asFileReference.
notebookTemp exists notebookTemp exists
ifTrue: [self class new openFromFile: notebookTemp] ifTrue: [self class new openFromFile: notebookTemp]
ifFalse: [ GrafoscopioGUI updateDocumentationUI ]] ifFalse: [ GrafoscopioDockingBar updateDocumentationUI ]]
] ]
{ #category : #persistence } { #category : #persistence }
@ -495,7 +380,7 @@ GrafoscopioNotebook >> openFromFileSelector [
self workingFile: fileStream name asFileReference. self workingFile: fileStream name asFileReference.
nb := self class new. nb := self class new.
nb openFromFile: self workingFile. nb openFromFile: self workingFile.
GrafoscopioGUI updateRecentNotebooksWith: workingFile GrafoscopioDockingBar updateRecentNotebooksWith: workingFile
] ]
{ #category : #persistence } { #category : #persistence }
@ -504,7 +389,7 @@ GrafoscopioNotebook >> openFromUrl: anUrl [
| fileName | | fileName |
fileName := (anUrl splitOn: '/') last. fileName := (anUrl splitOn: '/') last.
GrafoscopioGUI GrafoscopioDockingBar
downloadingFrom: anUrl downloadingFrom: anUrl
withMessage: 'Downloading document...' withMessage: 'Downloading document...'
into: FileLocator temp. into: FileLocator temp.
@ -614,7 +499,7 @@ GrafoscopioNotebook >> saveToFile: aFileReference [
ensure: [ (self workingFile writeStream) ifNotNil: #close ]. ensure: [ (self workingFile writeStream) ifNotNil: #close ].
self title: self workingFile basenameWithIndicator, ' | Grafoscopio notebook'. self title: self workingFile basenameWithIndicator, ' | Grafoscopio notebook'.
self inform: ('File saved at: ', String cr, self workingFile fullName). self inform: ('File saved at: ', String cr, self workingFile fullName).
GrafoscopioGUI updateRecentNotebooksWith: aFileReference. GrafoscopioDockingBar updateRecentNotebooksWith: aFileReference.
] ]
@ -626,7 +511,7 @@ GrafoscopioNotebook >> saveToFileUI [
file := UIManager default file := UIManager default
fileSave: 'Export notebook to file as...' fileSave: 'Export notebook to file as...'
extensions: #('ston') extensions: #('ston')
path: nil. path: (workingFile ifNotNil: [ workingFile parent ] ifNil: [ FileLocator documents ] ).
file file
ifNil: [ self inform: 'Export cancelled'. ^ self ] ifNil: [ self inform: 'Export cancelled'. ^ self ]
ifNotNil:[self saveToFile: file]. ifNotNil:[self saveToFile: file].
@ -638,7 +523,7 @@ GrafoscopioNotebook >> saveWorkingNotebook [
self workingFile self workingFile
ifNil: [ self saveToFileUI ] ifNil: [ self saveToFileUI ]
ifNotNil: [ self saveToFile: workingFile ]. ifNotNil: [ self saveToFile: workingFile ].
GrafoscopioGUI updateRecentNotebooksWith: workingFile GrafoscopioDockingBar updateRecentNotebooksWith: workingFile
] ]
@ -653,6 +538,121 @@ GrafoscopioNotebook >> toggleCodeNode [
self updateBodyFor: currentNode. self updateBodyFor: currentNode.
] ]
{ #category : #initialization }
GrafoscopioNotebook >> topBar [
^MenuModel new
addGroup: [ :group |
group addItem: [ :item |
item
name: 'Notebook';
icon: Smalltalk ui icons smallObjects;
subMenu: self notebookSubMenu ].
group addItem: [ :item |
item
name: 'Project';
icon: Smalltalk ui icons catalog;
subMenu: self projectSubMenu ] ];
addGroup: [ :group |
group addItem: [ :item |
item
name: nil;
description: 'Save notebook';
icon: Smalltalk ui icons glamorousSave;
action: [ self saveWorkingNotebook ] ].
group addItem: [ :item |
item
name: nil;
description: 'Cut';
icon: Smalltalk ui icons smallCut;
action: [ self cutNodeToClipboard ] ].
group addItem: [ :item |
item
name: nil;
description: 'Copy';
icon: Smalltalk ui icons smallCopy;
action: [ self copyNodeToClipboard ] ].
group addItem: [ :item |
item
name: nil;
description: 'Paste';
icon: Smalltalk ui icons smallPaste;
action: [ self pasteNodeFromClipboard ] ]];
addGroup: [ :group |
group addItem: [ :item |
item
name: nil;
description: 'Add node';
icon: MendaIcons new plusIcon;
action: [ self addNode ] ].
group addItem: [ :item |
item
name: nil;
description: 'Delete node';
icon: MendaIcons new minusIcon;
action: [ self removeNode ] ].
group addItem: [ :item |
item
name: nil;
description: 'Move node up';
icon: MendaIcons new arrowUpIcon;
action: [ self moveNodeBefore ] ].
group addItem: [ :item |
item
name: nil;
description: 'Move node down';
icon: MendaIcons new arrowDownIcon;
action: [ self moveNodeAfter ] ].
group addItem: [ :item |
item
name: nil;
description: 'Move node left';
icon: MendaIcons new arrowLeftIcon;
action: [ self promoteNode ] ].
group addItem: [ :item |
item
name: nil;
description: 'Move node right';
icon: MendaIcons new arrowRightIcon;
action: [ self demoteNode ] ]];
addGroup: [ :group |
group addItem: [ :item |
item
name: nil;
description: 'Togle: code <--> text';
icon: MendaIcons new smalltalkCodeIcon;
action: [ self toggleCodeNode ] ].
group addItem: [ :item |
item
name: nil;
description: 'Visit link';
icon: Smalltalk ui icons glamorousRight;
action: [ self visitNodeLink ] ].
group addItem: [ :item |
item
name: nil;
description: 'Load link';
icon: Smalltalk ui icons glamorousRefresh;
action: [ self updateForSpecialLinks ] ].
group addItem: [ :item |
item
name: nil;
description: 'Tag as...';
icon: MendaIcons new tagAddIcon;
action: [ self inform: 'To be implemented...' ] ].
group addItem: [ :item |
item
name: nil;
description: 'Untag ....';
icon: MendaIcons new tagMinusIcon;
action: [ self inform: 'To be implemented...' ] ].
group addItem: [ :item |
item
name: nil;
description: 'Edit tags...';
icon: FontAwesomeIcons new tagsIcon;
action: [ self inform: 'To be implemented...' ] ]].
]
{ #category : #accessing } { #category : #accessing }
GrafoscopioNotebook >> tree [ GrafoscopioNotebook >> tree [
^ tree ^ tree

View File

@ -24,12 +24,12 @@ ManifestGrafoscopio class >> ruleRBEqualsTrueRuleV1FalsePositive [
{ #category : #'code-critics' } { #category : #'code-critics' }
ManifestGrafoscopio class >> ruleRBLongMethodsRuleV1FalsePositive [ ManifestGrafoscopio class >> ruleRBLongMethodsRuleV1FalsePositive [
^ #(#(#(#RGMethodDefinition #(#GrafoscopioNotebook #newWindowMainMenu #false)) #'2016-12-17T18:51:33.99062-05:00') #(#(#RGMethodDefinition #(#GrafoscopioNotebook #notebookSubMenu #false)) #'2017-02-02T11:43:53.106456-05:00') ) ^ #(#(#(#RGMethodDefinition #(#GrafoscopioNotebook #topBar #false)) #'2016-12-17T18:51:33.99062-05:00') #(#(#RGMethodDefinition #(#GrafoscopioNotebook #notebookSubMenu #false)) #'2017-02-02T11:43:53.106456-05:00') )
] ]
{ #category : #'code-critics' } { #category : #'code-critics' }
ManifestGrafoscopio class >> ruleRBSentNotImplementedRuleV1FalsePositive [ ManifestGrafoscopio class >> ruleRBSentNotImplementedRuleV1FalsePositive [
^ #(#(#(#RGMetaclassDefinition #(#'GrafoscopioGUI class' #GrafoscopioGUI)) #'2015-12-23T10:38:16.706667-05:00') #(#(#RGClassDefinition #(#GrafoscopioGUI)) #'2016-01-06T18:53:45.844051-05:00') #(#(#RGMethodDefinition #(#GrafoscopioNotebook #newWindowMainMenu #false)) #'2016-12-17T18:51:40.617924-05:00') ) ^ #(#(#(#RGMetaclassDefinition #(#'GrafoscopioGUI class' #GrafoscopioDockingBar)) #'2015-12-23T10:38:16.706667-05:00') #(#(#RGClassDefinition #(#GrafoscopioDockingBar)) #'2016-01-06T18:53:45.844051-05:00') #(#(#RGMethodDefinition #(#GrafoscopioNotebook #topBar #false)) #'2016-12-17T18:51:40.617924-05:00') )
] ]
{ #category : #'code-critics' } { #category : #'code-critics' }