Commit a4bbcb03 authored by nerrons's avatar nerrons
Browse files

index.js: Parse the -k12 arg and do proper initialization

parent ecbd8303
......@@ -30,6 +30,8 @@ function have_args() {
return !!gui.App.argv.length;
}
var k12;
function set_vars(win) {
var port_no, font_engine_sanity, pd_engine_id, argv_offset;
// If the GUI was started by Pd, our port number is going to be
......@@ -42,6 +44,8 @@ function set_vars(win) {
// not under OSX. That means we need an offset hack
argv_offset = process.platform === "darwin" ? 1 : 0;
port_no = gui.App.argv[1 + argv_offset]; // fed to us by the Pd process
// check if started in k12 mode
k12 = gui.App.argv[3 + argv_offset] === "pd-l2ork-k12" ? 1 : 0;
// address unique to the pd_engine
pd_engine_id = gui.App.argv[5 + argv_offset];
} else {
......@@ -62,6 +66,8 @@ function set_vars(win) {
// nw context callbacks (mostly just creating/destroying windows)
pdgui.set_new_window_fn(nw_create_window);
pdgui.set_close_window_fn(nw_close_window);
pdgui.set_k12_mode(k12);
}
function app_quit() {
......@@ -510,8 +516,12 @@ function nw_create_pd_window_menus(gui, w) {
chooser.click();
}
});
if (pdgui.k12_mode == 1) {
minit(m.file.k12, { click: pdgui.menu_k12_open_demos });
if (k12 === 1) {
minit(m.file.k12, {
click: function () {
gui.Shell.showItemInFolder(pdgui.get_k12_demo_dir());
}
});
}
// Note: this must be different for the main Pd window
if (osx) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment