Grafoscopio/src/Grafoscopio/GfWorldMenu.class.st

165 lines
4.3 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 >> helpMenuOn: aBuilder [
<worldMenu>
(aBuilder item: #GfManual)
label: 'Manual';
order: 1;
parent: #GfHelpAndDocs;
action: [ GrafoscopioNewNotebook 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: [ GrafoscopioNewNotebook open: DatavizDocs introNotebook ].
(aBuilder item: #GfHelpDevNotes)
label: 'Devs''s notes';
order: 4;
parent: #GfHelpAndDocs;
action: [ GrafoscopioNewNotebook 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: [ GrafoscopioNewNotebook new openDefault ].
(aBuilder item: #'Notebook from file...')
label: 'Notebook from file...';
order: 2;
parent: #GfLaunch;
action: [ GrafoscopioNewNotebook new openFromFileSelector ].
(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: [ GrafoscopioNewNotebook 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 >> openRecentMenu: aBuilder [
<worldMenu>
GrafoscopioNewNotebook recents
do: [ :f |
(aBuilder item: #'Open', f basename )
label: 'Open ', f basename;
order: 1;
parent: #GfLaunchOpenRecent;
action: [ GrafoscopioNewNotebook open: f ] ]
]
{ #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].
]