183 lines
5.0 KiB
Smalltalk
183 lines
5.0 KiB
Smalltalk
"
|
|
I define the Grafoscopio main menu presented in the Pharo World.
|
|
"
|
|
Class {
|
|
#name : #GfWorldMenu,
|
|
#superclass : #Object,
|
|
#classInstVars : [
|
|
'recentNotebooks'
|
|
],
|
|
#category : #'Grafoscopio-UI'
|
|
}
|
|
|
|
{ #category : #'world menu' }
|
|
GfWorldMenu class >> getProjectExample [
|
|
| project unit |
|
|
project := GrafoscopioProject new.
|
|
unit := GrafoscopioUnitNode new.
|
|
unit name: 'Pillar-Example'.
|
|
unit
|
|
addChild: [ GrafoscopioPillarNode new
|
|
text: GrafoscopioPillarASText openExample;
|
|
yourself ]
|
|
ofClass: GrafoscopioPillarNode.
|
|
project document addChild: unit ofClass: GrafoscopioUnitNode.
|
|
^ project
|
|
]
|
|
|
|
{ #category : #'world menu' }
|
|
GfWorldMenu class >> getProjectFromFile [
|
|
| file |
|
|
file := UIManager default
|
|
chooseExistingFileReference: 'Choose a file'
|
|
extensions: #('ston')
|
|
path: FileLocator documents.
|
|
^ (STON fromStream: file readStream)
|
|
]
|
|
|
|
{ #category : #'world menu' }
|
|
GfWorldMenu class >> helpMenuOn: aBuilder [
|
|
<worldMenu>
|
|
|
|
(aBuilder item: #GfManual)
|
|
label: 'Manual';
|
|
order: 1;
|
|
parent: #GfHelpAndDocs;
|
|
action: [ GrafoscopioNotebook open: GrafoscopioDocs manual ].
|
|
(aBuilder item: #GfManualPDF)
|
|
label: 'Manual (PDF)';
|
|
order: 2;
|
|
parent: #GfHelpAndDocs;
|
|
action: [ GrafoscopioDocs openPDFManual ].
|
|
(aBuilder item: #GfHelpDataviz)
|
|
label: 'Dataviz';
|
|
order: 3;
|
|
parent: #GfHelpAndDocs;
|
|
action: [ GrafoscopioNotebook open: DatavizDocs introNotebook ].
|
|
(aBuilder item: #GfHelpDevNotes)
|
|
label: 'Devs''s notes';
|
|
order: 4;
|
|
parent: #GfHelpAndDocs;
|
|
action: [ GrafoscopioNotebook open: GrafoscopioDocs devNotes ].
|
|
(aBuilder item: #GfHelpAbout)
|
|
label: 'About Grafoscopio';
|
|
order: 5;
|
|
parent: #GfHelpAndDocs;
|
|
action: [ GfUIHelpers messageAbout ].
|
|
]
|
|
|
|
{ #category : #'world menu' }
|
|
GfWorldMenu class >> launchCompatibilityMenuOn: aBuilder [
|
|
<worldMenu>
|
|
|
|
(aBuilder item: #'New notebook')
|
|
label: 'New notebook';
|
|
order: 1;
|
|
parent: #GfLaunchCompatibility;
|
|
action: [ GrafoscopioNotebook new openDefault ].
|
|
(aBuilder item: #'Notebook from file...')
|
|
label: 'Notebook from file...';
|
|
order: 2;
|
|
parent: #GfLaunchCompatibility;
|
|
action: [ GrafoscopioNotebook new openFromFileSelector ].
|
|
(aBuilder item: #'Notebook from the Internet...')
|
|
label: 'Notebook from the Internet...';
|
|
order: 3;
|
|
parent: #GfLaunchCompatibility;
|
|
action: [ GrafoscopioNotebook new openFromUrlUI ].
|
|
(aBuilder item: #recentNotebooks)
|
|
label: 'Recent notebooks...';
|
|
order: 4;
|
|
parent: #GfLaunchCompatibility;
|
|
action: [ GfUIHelpers openFromRecentlyUsed ]
|
|
]
|
|
|
|
{ #category : #'world menu' }
|
|
GfWorldMenu class >> launchMenuOn: aBuilder [
|
|
<worldMenu>
|
|
|
|
(aBuilder item: #'New notebook')
|
|
label: 'New notebook';
|
|
order: 1;
|
|
parent: #GfLaunch;
|
|
action: [ (GrafoscopioTreeNotebook on: GrafoscopioProject new ) openWithSpec ].
|
|
(aBuilder item: #'New Notebook from example ')
|
|
label: 'Notebook from from example ';
|
|
order: 2;
|
|
parent: #GfLaunch;
|
|
action: [ (GrafoscopioTreeNotebook on: (self getProjectExample)) openWithSpec ].
|
|
(aBuilder item: #'Notebook from file...')
|
|
label: 'Notebook from file...';
|
|
order: 2;
|
|
parent: #GfLaunch;
|
|
action: [ (GrafoscopioTreeNotebook on: (self getProjectFromFile)) openWithSpec ].
|
|
(aBuilder item: #GfLaunchOpenRecent)
|
|
label: 'Open recent...';
|
|
order: 2;
|
|
parent: #GfLaunch.
|
|
(aBuilder item: #'Notebook from the Internet...')
|
|
label: 'Notebook from the Internet...';
|
|
order: 3;
|
|
parent: #GfLaunch;
|
|
action: [ GrafoscopioTreeNotebook new openFromUrlUI ].
|
|
(aBuilder item: #recentNotebooks)
|
|
label: 'Recent notebooks...';
|
|
order: 4;
|
|
parent: #GfLaunch;
|
|
action: [ GfUIHelpers openFromRecentlyUsed ]
|
|
]
|
|
|
|
{ #category : #'world menu' }
|
|
GfWorldMenu class >> mainMenuItemsOn: aBuilder [
|
|
"I add the main Grafoscopio menu to the Pharo World."
|
|
|
|
<worldMenu>
|
|
(aBuilder item: #Grafoscopio)
|
|
label: 'Grafoscopio';
|
|
order: 1;
|
|
with: [ (aBuilder
|
|
item: #GfLaunch;
|
|
label: 'Launch') target: self.
|
|
(aBuilder
|
|
item: #GfLaunchCompatibility;
|
|
label: 'Launch Compatibility') target: self.
|
|
(aBuilder
|
|
item: #GfUpdate;
|
|
label: 'Update') target: self.
|
|
(aBuilder
|
|
item: #GfHelpAndDocs;
|
|
label: 'Help & Docs') target: self ]
|
|
]
|
|
|
|
{ #category : #'world menu' }
|
|
GfWorldMenu class >> updateMenuOn: aBuilder [
|
|
<worldMenu>
|
|
|
|
(aBuilder item: #GfUpdateGrafoscopio)
|
|
label: 'Grafoscopio';
|
|
order: 1;
|
|
parent: #GfUpdate;
|
|
action: [ GfUIHelpers updateGrafoscopioUI ].
|
|
(aBuilder item: #GfUpdateDocs)
|
|
label: 'Documentation';
|
|
order: 2;
|
|
parent: #GfUpdate;
|
|
action: [ GrafoscopioDocumentation updateAllUI ].
|
|
(aBuilder item: #GfUpdateDataviz)
|
|
label: 'DataViz package';
|
|
order: 3;
|
|
parent: #GfUpdate;
|
|
action: [ GfUIHelpers updateDatavizUI ].
|
|
(aBuilder item: #GfUpdateAll)
|
|
label: 'All the system';
|
|
order: 4;
|
|
parent: #GfUpdate;
|
|
action: [ GfUIHelpers updateSystem ].
|
|
]
|
|
|
|
{ #category : #updating }
|
|
GfWorldMenu class >> updateRecentNotebooksWith: aFileReference [
|
|
(self recentNotebooks includes: aFileReference)
|
|
ifFalse: [self recentNotebooks add: aFileReference].
|
|
]
|