1- const electron = require ( 'electron' )
1+ // const electron = require('electron')
2+ const { app, BrowserWindow, dialog, shell, Menu} = require ( 'electron' ) ;
23// Module to control application life.
3- const app = electron . app
4+ // const app = electron.app
45// Module to create native browser window.
5- const BrowserWindow = electron . BrowserWindow
6+ // const BrowserWindow = electron.BrowserWindow
7+ // const Menu = require('electron').Menu
68
79const path = require ( 'path' )
810const url = require ( 'url' )
@@ -22,6 +24,65 @@ function createWindow () {
2224 slashes : true
2325 } ) )
2426
27+ // MENU
28+ // Create the Application's main menu
29+ var template = [ {
30+ label : "Application" ,
31+ submenu : [
32+ { label : "About Application" , selector : "orderFrontStandardAboutPanel:" } ,
33+ { type : "separator" } ,
34+ { label : "Quit" , accelerator : "Command+Q" , click : function ( ) { app . quit ( ) ; } }
35+ ] } , {
36+ label : "Edit" ,
37+ submenu : [
38+ { label : "Undo" , accelerator : "CmdOrCtrl+Z" , selector : "undo:" } ,
39+ { label : "Redo" , accelerator : "Shift+CmdOrCtrl+Z" , selector : "redo:" } ,
40+ { type : "separator" } ,
41+ { label : "Cut" , accelerator : "CmdOrCtrl+X" , selector : "cut:" } ,
42+ { label : "Copy" , accelerator : "CmdOrCtrl+C" , selector : "copy:" } ,
43+ { label : "Paste" , accelerator : "CmdOrCtrl+V" , selector : "paste:" } ,
44+ { role : 'pasteandmatchstyle' } ,
45+ { role : 'delete' } ,
46+ { label : "Select All" , accelerator : "CmdOrCtrl+A" , selector : "selectAll:" } ,
47+ { type : 'separator' } ,
48+ { label : 'Speech' ,
49+ submenu : [
50+ { role : 'startspeaking' } , //perhaps add keyboard shortcut?
51+ { role : 'stopspeaking' } //perhaps add keyboard shortcut?
52+ ] }
53+ ] } , {
54+ label : 'View' ,
55+ submenu : [
56+ { role : 'reload' } ,
57+ { role : 'forcereload' } ,
58+ { role : 'toggledevtools' , accelerator : "CmdOrCtrl+Alt+I" } ,
59+ { type : 'separator' } ,
60+ { role : 'resetzoom' } ,
61+ { role : 'zoomin' } ,
62+ { role : 'zoomout' } ,
63+ { type : 'separator' } ,
64+ { role : 'togglefullscreen' }
65+ ] } , {
66+ role : 'window' ,
67+ submenu : [
68+ { role : 'minimize' } ,
69+ { role : 'close' }
70+ ] } , {
71+ role : 'help' ,
72+ submenu : [
73+ {
74+ label : 'Project Page' ,
75+ click ( ) { require ( 'electron' ) . shell . openExternal ( 'https://github.com/OpenNewsLabs/oTranscribe-electron' ) }
76+ } ,
77+ {
78+ label : 'User Manual' ,
79+ click ( ) { require ( 'electron' ) . shell . openExternal ( 'https://github.com/OpenNewsLabs/oTranscribe-electron' ) }
80+ }
81+ ] }
82+ ] ;
83+
84+ Menu . setApplicationMenu ( Menu . buildFromTemplate ( template ) ) ;
85+
2586 // Open the DevTools.
2687 // mainWindow.webContents.openDevTools()
2788
@@ -34,6 +95,10 @@ function createWindow () {
3495 } )
3596}
3697
98+
99+
100+
101+
37102// This method will be called when Electron has finished
38103// initialization and is ready to create browser windows.
39104// Some APIs can only be used after this event occurs.
@@ -58,3 +123,6 @@ app.on('activate', function () {
58123
59124// In this file you can include the rest of your app's specific main process
60125// code. You can also put them in separate files and require them here.
126+ //
127+ //
128+
0 commit comments