Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
ardublockly
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
ardublockly
Commits
99d9d809
Commit
99d9d809
authored
Jun 30, 2015
by
carlosperate
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Electron: Add menus to window, all non-functional for now.
parent
7aa50c66
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
201 additions
and
12 deletions
+201
-12
package/electron/app/appmenu.js
package/electron/app/appmenu.js
+201
-12
No files found.
package/electron/app/appmenu.js
View file @
99d9d809
...
@@ -20,10 +20,18 @@ var BrowserWindow = require('browser-window');
...
@@ -20,10 +20,18 @@ var BrowserWindow = require('browser-window');
module
.
exports
.
setArdublocklyMenu
=
function
(
devMode
)
{
module
.
exports
.
setArdublocklyMenu
=
function
(
devMode
)
{
if
(
typeof
(
devMode
)
===
'
undefined
'
)
devMode
=
false
;
if
(
typeof
(
devMode
)
===
'
undefined
'
)
devMode
=
false
;
var
ardublocklyMenu
=
[
var
ardublocklyMenu
=
[]
getFileMenuData
(),
if
(
process
.
platform
==
"
darwin
"
)
{
getHelpMenuData
(),
ardublocklyMenu
.
push
(
getMacMenuData
());
];
}
ardublocklyMenu
.
push
(
getFileMenuData
());
ardublocklyMenu
.
push
(
getEditMenuData
());
ardublocklyMenu
.
push
(
getProgramMenuData
());
ardublocklyMenu
.
push
(
getExamplesMenuData
());
if
(
process
.
platform
==
"
darwin
"
)
{
ardublocklyMenu
.
push
(
getWindowMenuData
());
}
ardublocklyMenu
.
push
(
getHelpMenuData
());
if
(
devMode
)
{
if
(
devMode
)
{
ardublocklyMenu
.
push
(
getDevMenuData
());
ardublocklyMenu
.
push
(
getDevMenuData
());
...
@@ -32,11 +40,59 @@ module.exports.setArdublocklyMenu = function(devMode) {
...
@@ -32,11 +40,59 @@ module.exports.setArdublocklyMenu = function(devMode) {
Menu
.
setApplicationMenu
(
Menu
.
buildFromTemplate
(
ardublocklyMenu
));
Menu
.
setApplicationMenu
(
Menu
.
buildFromTemplate
(
ardublocklyMenu
));
};
};
var
get
File
MenuData
=
function
()
{
var
get
Mac
MenuData
=
function
()
{
return
{
return
{
label
:
'
Ardublockly
'
,
submenu
:
[
{
label
:
'
About
'
,
click
:
functionNotImplemented
},
{
type
:
'
separator
'
},
{
label
:
'
Preferences
'
,
//accelerator: 'CmdOrCtrl+comma',
click
:
functionNotImplemented
},
{
type
:
'
separator
'
},
{
label
:
'
Services
'
,
submenu
:
[]
},
{
type
:
'
separator
'
},
{
label
:
'
Hide Ardublockly
'
,
accelerator
:
'
Command+H
'
,
selector
:
'
hide:
'
},
{
label
:
'
Hide Others
'
,
accelerator
:
'
Command+Shift+H
'
,
selector
:
'
hideOtherApplications:
'
},
{
label
:
'
Show All
'
,
selector
:
'
unhideAllApplications:
'
},
{
type
:
'
separator
'
},
{
label
:
'
Quit
'
,
accelerator
:
'
CmdOrCtrl+Q
'
,
click
:
function
()
{
app
.
quit
();
}
}
]
};
};
var
getFileMenuData
=
function
()
{
var
fileMenu
=
{
label
:
'
File
'
,
label
:
'
File
'
,
submenu
:
[
submenu
:
[
{
{
label
:
'
New
'
,
accelerator
:
'
CmdOrCtrl+N
'
,
click
:
functionNotImplemented
},
{
label
:
'
Open
'
,
label
:
'
Open
'
,
accelerator
:
'
CmdOrCtrl+O
'
,
accelerator
:
'
CmdOrCtrl+O
'
,
click
:
functionNotImplemented
click
:
functionNotImplemented
...
@@ -44,13 +100,131 @@ var getFileMenuData = function() {
...
@@ -44,13 +100,131 @@ var getFileMenuData = function() {
label
:
'
Save as
'
,
label
:
'
Save as
'
,
accelerator
:
'
CmdOrCtrl+S
'
,
accelerator
:
'
CmdOrCtrl+S
'
,
click
:
functionNotImplemented
click
:
functionNotImplemented
}
]
};
// On MacOS the Quit option is in the app menu, so only add it if not mac
if
(
process
.
platform
!=
"
darwin
"
)
{
fileMenu
.
submenu
.
push
(
{
type
:
'
separator
'
},
{
},
{
label
:
'
Quit
'
,
label
:
'
Quit
'
,
accelerator
:
'
CmdOrCtrl+Q
'
,
accelerator
:
'
CmdOrCtrl+Q
'
,
click
:
function
()
{
click
:
function
()
{
app
.
quit
();
app
.
quit
();
}
}
}
}
);
}
return
fileMenu
;
};
var
getEditMenuData
=
function
()
{
var
editMenud
=
{
label
:
'
Edit
'
,
submenu
:
[
{
label
:
'
Undo
'
,
accelerator
:
'
CmdOrCtrl+Z
'
,
click
:
functionNotImplemented
},
{
label
:
'
Redo
'
,
accelerator
:
'
CmdOrCtrl+Y
'
,
click
:
functionNotImplemented
},
{
type
:
'
separator
'
},
{
label
:
'
Cut
'
,
accelerator
:
'
CmdOrCtrl+X
'
,
click
:
functionNotImplemented
},
{
label
:
'
Copy
'
,
accelerator
:
'
CmdOrCtrl+C
'
,
click
:
functionNotImplemented
},
{
label
:
'
Paste
'
,
accelerator
:
'
CmdOrCtrl+V
'
,
click
:
functionNotImplemented
}
]
};
// On MacOS Preferences is in the app menu, so only add it if not mac
if
(
process
.
platform
!=
"
darwin
"
)
{
editMenud
.
submenu
.
push
(
{
type
:
'
separator
'
},
{
label
:
'
Preferences
'
,
//accelerator: 'CmdOrCtrl+comma',
click
:
functionNotImplemented
}
);
}
return
editMenud
;
};
var
getExamplesMenuData
=
function
()
{
return
{
label
:
'
Examples
'
,
submenu
:
[
{
label
:
'
Example 1
'
,
click
:
functionNotImplemented
},
{
label
:
'
Example 2
'
,
click
:
functionNotImplemented
},
{
label
:
'
Example 3
'
,
click
:
functionNotImplemented
}
]
};
};
var
getProgramMenuData
=
function
()
{
return
{
label
:
'
Program
'
,
submenu
:
[
{
label
:
'
Open sketch in IDE
'
,
//accelerator: 'CmdOrCtrl+O',
click
:
functionNotImplemented
},
{
label
:
'
Verify
'
,
//accelerator: 'CmdOrCtrl+S',
click
:
functionNotImplemented
},
{
label
:
'
Upload program
'
,
//accelerator: 'CmdOrCtrl+S',
click
:
functionNotImplemented
}
]
};
};
var
getWindowMenuData
=
function
()
{
return
{
label
:
'
Window
'
,
submenu
:
[
{
label
:
'
Minimize
'
,
accelerator
:
'
Command+M
'
,
selector
:
'
performMiniaturize:
'
},
{
label
:
'
Close
'
,
accelerator
:
'
Command+W
'
,
selector
:
'
performClose:
'
},
{
type
:
'
separator
'
},
{
label
:
'
Bring All to Front
'
,
selector
:
'
arrangeInFront:
'
}
]
]
};
};
};
};
...
@@ -60,14 +234,29 @@ var getHelpMenuData = function() {
...
@@ -60,14 +234,29 @@ var getHelpMenuData = function() {
label
:
'
Help
'
,
label
:
'
Help
'
,
submenu
:
[
submenu
:
[
{
{
label
:
'
Quick Start
'
,
click
:
function
()
{
shell
.
openExternal
(
'
http://localhost:8000/documentation/Quick-Start
'
);
}
},
{
label
:
'
Manual
'
,
click
:
function
()
{
shell
.
openExternal
(
'
http://localhost:8000/documentation/Quick-Start
'
);
}
},
{
type
:
'
separator
'
},
{
label
:
'
Website
'
,
label
:
'
Website
'
,
click
:
function
()
{
click
:
function
()
{
shell
.
openExternal
(
'
http://ardublockly.embeddedlog.com
'
);
shell
.
openExternal
(
'
http://ardublockly.embeddedlog.com
'
);
}
}
},
{
},
{
label
:
'
Source code
'
,
label
:
'
Source code
'
,
click
:
function
()
{
click
:
function
()
{
shell
.
openExternal
(
'
https://github.com/carlosperate/ardublockly
'
);
shell
.
openExternal
(
'
https://github.com/carlosperate/ardublockly
'
);
}
}
},
{
},
{
type
:
'
separator
'
type
:
'
separator
'
...
@@ -79,20 +268,20 @@ var getHelpMenuData = function() {
...
@@ -79,20 +268,20 @@ var getHelpMenuData = function() {
};
};
};
};
var
getDevMenuData
=
function
()
{
var
getDevMenuData
=
function
()
{
return
{
return
{
label
:
'
Development
'
,
label
:
'
Development
'
,
submenu
:
[
submenu
:
[
{
{
label
:
'
Reload
'
,
label
:
'
Reload
'
,
accelerator
:
'
CmdOrCtrl+R
'
,
accelerator
:
'
CmdOrCtrl+R
'
,
click
:
function
()
{
click
:
function
()
{
BrowserWindow
.
getFocusedWindow
().
reloadIgnoringCache
();
BrowserWindow
.
getFocusedWindow
().
reloadIgnoringCache
();
}
}
},
{
},
{
label
:
'
Toggle DevTools
'
,
label
:
'
Toggle DevTools
'
,
accelerator
:
'
Alt+CmdOrCtrl+I
'
,
accelerator
:
'
Alt+CmdOrCtrl+I
'
,
click
:
function
()
{
click
:
function
()
{
BrowserWindow
.
getFocusedWindow
().
toggleDevTools
();
BrowserWindow
.
getFocusedWindow
().
toggleDevTools
();
}
}
},
{
},
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment