6502SimDesktop/app/electron/menu.js

74 lines
2.4 KiB
JavaScript
Raw Normal View History

2017-03-12 16:34:06 +00:00
const { app } = require('electron')
2017-03-30 03:14:03 +00:00
2017-03-12 05:50:25 +00:00
const OSXtemplate = [
{
2017-03-12 21:32:50 +00:00
label: 'Application',
2017-03-12 05:50:25 +00:00
submenu: [
2017-03-12 21:32:50 +00:00
{ label: 'About 6502Desktop', selector: 'orderFrontStandardAboutPanel:' },
{ label: 'Quit', accelerator: 'Command+Q', click: function () { app.quit(); } }
2017-03-12 05:50:25 +00:00
]
},
{
2017-03-12 21:32:50 +00:00
label: 'Edit',
2017-03-12 05:50:25 +00:00
submenu: [
2017-03-12 21:32:50 +00:00
{ label: 'Undo', accelerator: 'Cmd+Z', selector: 'undo:' },
{ label: 'Redo', accelerator: 'Shift+Cmd+Z', selector: 'redo:' },
{ label: 'Cut', accelerator: 'Cmd+X', selector: 'cut:' },
{ label: 'Copy', accelerator: 'Cmd+C', selector: 'copy:' },
{ label: 'Paste', accelerator: 'Cmd+V', selector: 'paste:' },
{ label: 'Select All', accelerator: 'Cmd+A', selector: 'selectAll:' }
]
},
{
label: 'View',
submenu: (process.env.NODE_ENV === 'development') ? [
{ label: '&Reload', accelerator: 'Ctrl+R',
click() { mainWindow.webContents.reload(); } },
{ label: 'Toggle &Full Screen', accelerator: 'F11',
click() { mainWindow.setFullScreen(!mainWindow.isFullScreen()); }
},
{ label: 'Toggle &Developer Tools', accelerator: 'Alt+Ctrl+I',
click() { mainWindow.toggleDevTools(); } }
] : [
{ label: 'Toggle &Full Screen', accelerator: 'F11',
click() { mainWindow.setFullScreen(!mainWindow.isFullScreen()); } }
2017-03-12 05:50:25 +00:00
]
2017-03-30 03:14:03 +00:00
},
{
label: 'Help',
submenu: [
{ label: 'Easy 6502 Tutorial', click: function () { require('electron').shell.openExternal('http://electron.atom.io'); } }
]
},
2017-03-12 05:50:25 +00:00
]
const PCtemplate = [
{
2017-03-12 21:32:50 +00:00
label: 'File',
2017-03-12 05:50:25 +00:00
submenu: [
2017-03-12 21:32:50 +00:00
{ label: 'Quit', accelerator: 'Alt+F4', click: function () { app.quit(); } }
2017-03-12 05:50:25 +00:00
]
},
{
2017-03-12 21:32:50 +00:00
label: 'Edit',
2017-03-12 05:50:25 +00:00
submenu: [
2017-03-12 21:32:50 +00:00
{ label: 'Undo', accelerator: 'Ctrl+Z', selector: 'undo:' },
{ label: 'Redo', accelerator: 'Shift+Ctrl+Z', selector: 'redo:' },
{ label: 'Cut', accelerator: 'Ctrl+X', selector: 'cut:' },
{ label: 'Copy', accelerator: 'Ctrl+C', selector: 'copy:' },
{ label: 'Paste', accelerator: 'Ctrl+V', selector: 'paste:' },
{ label: 'Select All', accelerator: 'Ctrl+A', selector: 'selectAll:' }
2017-03-12 05:50:25 +00:00
]
},
{
2017-03-12 21:32:50 +00:00
label: 'Help',
2017-03-12 05:50:25 +00:00
submenu: [
2017-03-12 21:32:50 +00:00
{ label: 'About 6502Desktop', selector: 'orderFrontStandardAboutPanel:' },
2017-03-30 03:14:03 +00:00
{ label: 'Easy 6502 Tutorial', click: function () { electronOpenLinkInBrowser('http://example.com'); } }
2017-03-12 05:50:25 +00:00
]
},
]
module.exports.OSXtemplate = OSXtemplate;
2017-03-30 03:14:03 +00:00
module.exports.PCtemplate = PCtemplate;