did a minor reorganization of the menu
This commit is contained in:
		
							parent
							
								
									8f2912225b
								
							
						
					
					
						commit
						af3adf660e
					
				
							
								
								
									
										169
									
								
								menu.js
									
									
									
									
									
								
							
							
						
						
									
										169
									
								
								menu.js
									
									
									
									
									
								
							@ -65,63 +65,41 @@ function init(window) {
 | 
			
		||||
  win = window;
 | 
			
		||||
 | 
			
		||||
  var template = [
 | 
			
		||||
    {
 | 
			
		||||
      label: 'File',
 | 
			
		||||
      submenu: [
 | 
			
		||||
        {
 | 
			
		||||
          role: 'close'
 | 
			
		||||
        }
 | 
			
		||||
      ]
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
      label: 'Edit',
 | 
			
		||||
      submenu: [
 | 
			
		||||
        {
 | 
			
		||||
          role: 'undo'
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
          role: 'redo'
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
          type: 'separator'
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
          role: 'cut'
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
          role: 'copy'
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
          role: 'paste'
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
          role: 'delete'
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
          role: 'selectall'
 | 
			
		||||
        }
 | 
			
		||||
        { role: 'undo' },
 | 
			
		||||
        { role: 'redo' },
 | 
			
		||||
        { type: 'separator' },
 | 
			
		||||
 | 
			
		||||
        { role: 'cut' },
 | 
			
		||||
        { role: 'copy' },
 | 
			
		||||
        { role: 'paste' },
 | 
			
		||||
        { role: 'pasteandmatchstyle' },
 | 
			
		||||
        { role: 'delete' },
 | 
			
		||||
        { role: 'selectall' }
 | 
			
		||||
      ]
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
      label: 'View',
 | 
			
		||||
      submenu: [
 | 
			
		||||
        {
 | 
			
		||||
          label: 'Full Screen',
 | 
			
		||||
          type: 'checkbox',
 | 
			
		||||
          accelerator: process.platform === 'darwin' ? 'Ctrl+Command+F' : 'F11',
 | 
			
		||||
          click: toggleFullScreen,
 | 
			
		||||
        },
 | 
			
		||||
        { role: 'reload' },
 | 
			
		||||
        { role: 'forcereload' },
 | 
			
		||||
        { type: 'separator' },
 | 
			
		||||
 | 
			
		||||
        { role: 'resetzoom' },
 | 
			
		||||
        { role: 'zoomin' },
 | 
			
		||||
        { role: 'zoomout' },
 | 
			
		||||
        { type: 'separator' },
 | 
			
		||||
 | 
			
		||||
        { role: 'togglefullscreen' },
 | 
			
		||||
        {
 | 
			
		||||
          label: 'Float on Top',
 | 
			
		||||
          type: 'checkbox',
 | 
			
		||||
          click: toggleAlwaysOnTop,
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
          type: 'separator'
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
          type: 'separator'
 | 
			
		||||
        },
 | 
			
		||||
        { type: 'separator' },
 | 
			
		||||
 | 
			
		||||
        {
 | 
			
		||||
          label: 'Developer',
 | 
			
		||||
          submenu: [
 | 
			
		||||
@ -141,76 +119,49 @@ function init(window) {
 | 
			
		||||
    template.unshift({
 | 
			
		||||
      label: 'Electron Demo',
 | 
			
		||||
      submenu: [
 | 
			
		||||
        {
 | 
			
		||||
          role: 'about'
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
          type: 'separator'
 | 
			
		||||
        },
 | 
			
		||||
        { role: 'about' },
 | 
			
		||||
        { type: 'separator' },
 | 
			
		||||
 | 
			
		||||
        {
 | 
			
		||||
          label: 'Preferences',
 | 
			
		||||
          accelerator: 'Cmd+,',
 | 
			
		||||
          click: function () { console.log('TODO: implement preferences'); }
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
          type: 'separator'
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
          role: 'services',
 | 
			
		||||
          submenu: []
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
          type: 'separator'
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
          role: 'hide'
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
          role: 'hideothers'
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
          role: 'unhide'
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
          type: 'separator'
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
          role: 'quit'
 | 
			
		||||
        }
 | 
			
		||||
        { type: 'separator' },
 | 
			
		||||
 | 
			
		||||
        { role: 'services',   submenu: [] },
 | 
			
		||||
        { type: 'separator' },
 | 
			
		||||
        { role: 'hide' },
 | 
			
		||||
        { role: 'hideothers' },
 | 
			
		||||
        { role: 'unhide' },
 | 
			
		||||
        { type: 'separator' },
 | 
			
		||||
 | 
			
		||||
        { role: 'quit' }
 | 
			
		||||
      ]
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    // Edit menu (Mac)
 | 
			
		||||
    template[2].submenu.push(
 | 
			
		||||
      {
 | 
			
		||||
        type: 'separator'
 | 
			
		||||
      },
 | 
			
		||||
      { type: 'separator' },
 | 
			
		||||
      {
 | 
			
		||||
        label: 'Speech',
 | 
			
		||||
        submenu: [
 | 
			
		||||
          {
 | 
			
		||||
            role: 'startspeaking'
 | 
			
		||||
          },
 | 
			
		||||
          {
 | 
			
		||||
            role: 'stopspeaking'
 | 
			
		||||
          }
 | 
			
		||||
          { role: 'startspeaking' },
 | 
			
		||||
          { role: 'stopspeaking' }
 | 
			
		||||
        ]
 | 
			
		||||
      }
 | 
			
		||||
    );
 | 
			
		||||
 | 
			
		||||
    // Window menu (Mac)
 | 
			
		||||
    template.push({
 | 
			
		||||
      role: 'window',
 | 
			
		||||
      role: 'Window',
 | 
			
		||||
      submenu: [
 | 
			
		||||
        {
 | 
			
		||||
          role: 'minimize'
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
          type: 'separator'
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
          role: 'front'
 | 
			
		||||
        }
 | 
			
		||||
        { role: 'close' },
 | 
			
		||||
        { role: 'minimize' },
 | 
			
		||||
        { role: 'zoom' },
 | 
			
		||||
        { type: 'separator' },
 | 
			
		||||
 | 
			
		||||
        { role: 'front' }
 | 
			
		||||
      ]
 | 
			
		||||
    });
 | 
			
		||||
  }
 | 
			
		||||
@ -218,11 +169,16 @@ function init(window) {
 | 
			
		||||
  // On Windows and Linux, open dialogs do not support selecting both files and
 | 
			
		||||
  // folders and files, so add an extra menu item so there is one for each type.
 | 
			
		||||
  if (process.platform === 'linux' || process.platform === 'win32') {
 | 
			
		||||
    template.unshift({
 | 
			
		||||
      label: 'File',
 | 
			
		||||
      submenu: [
 | 
			
		||||
        { role: 'quit' },
 | 
			
		||||
      ]
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    // Edit menu (Windows, Linux)
 | 
			
		||||
    template[1].submenu.push(
 | 
			
		||||
      {
 | 
			
		||||
        type: 'separator'
 | 
			
		||||
      },
 | 
			
		||||
      { type: 'separator' },
 | 
			
		||||
      {
 | 
			
		||||
        label: 'Preferences',
 | 
			
		||||
        accelerator: 'CmdOrCtrl+,',
 | 
			
		||||
@ -230,6 +186,15 @@ function init(window) {
 | 
			
		||||
      }
 | 
			
		||||
    );
 | 
			
		||||
 | 
			
		||||
    // Window menu (Windows, Linux)
 | 
			
		||||
    template.push({
 | 
			
		||||
      role: 'Qindow',
 | 
			
		||||
      submenu: [
 | 
			
		||||
        { role: 'minimize' },
 | 
			
		||||
        { role: 'close' },
 | 
			
		||||
      ]
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    // Add an help.about option
 | 
			
		||||
    template.push({
 | 
			
		||||
      label: 'Help',
 | 
			
		||||
@ -241,16 +206,6 @@ function init(window) {
 | 
			
		||||
      ],
 | 
			
		||||
    });
 | 
			
		||||
  }
 | 
			
		||||
  // Add "File > Quit" menu item so Linux distros where the system tray icon is
 | 
			
		||||
  // missing will have a way to quit the app.
 | 
			
		||||
  if (process.platform === 'linux') {
 | 
			
		||||
    // File menu (Linux)
 | 
			
		||||
    template[0].submenu.push({
 | 
			
		||||
      label: 'Quit',
 | 
			
		||||
      accelerator: 'CmdOrCtrl+Q',
 | 
			
		||||
      click: function () { return app.quit(); }
 | 
			
		||||
    });
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  menu = electron.Menu.buildFromTemplate(template);
 | 
			
		||||
  electron.Menu.setApplicationMenu(menu);
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user