Skip to content
Snippets Groups Projects
Commit fa6e3e3d authored by user's avatar user
Browse files

clean up old unused code

parent e171734e
No related branches found
No related tags found
No related merge requests found
...@@ -13,25 +13,26 @@ ...@@ -13,25 +13,26 @@
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" id="patchsvg" height="1000" width="1000" class="noselect"> <svg xmlns="http://www.w3.org/2000/svg" version="1.1" id="patchsvg" height="1000" width="1000" class="noselect">
</svg> </svg>
<script> <script>
'use strict'; 'use strict';
var nw = require('nw.gui'); var nw = require('nw.gui');
var pdgui = require('./pdgui.js'); var pdgui = require('./pdgui.js');
// Apply gui preset to this canvas // Apply gui preset to this canvas
pdgui.skin.apply(this); pdgui.skin.apply(this);
//var name = pdgui.last_loaded(); //var name = pdgui.last_loaded();
var l = pdgui.get_local_string; var l = pdgui.get_local_string;
console.log("my working dire is " + pdgui.get_pwd()); console.log("my working dir is " + pdgui.get_pwd());
document.getElementById("saveDialog").setAttribute("nwworkingdir", pdgui.get_pwd()); document.getElementById("saveDialog")
.setAttribute("nwworkingdir", pdgui.get_pwd());
document.getElementById("fileDialog")
.setAttribute("nwworkingdir", pdgui.get_pwd());
document.getElementById("fileDialog").setAttribute("accept",
Object.keys(pdgui.pd_filetypes).toString());
document.getElementById("fileDialog").setAttribute("nwworkingdir", pdgui.get_pwd()); var last_keydown = "";
document.getElementById("fileDialog").setAttribute("accept",
Object.keys(pdgui.pd_filetypes).toString());
var last_keydown = "";
// This could probably be in pdgui.js // This could probably be in pdgui.js
function add_keymods(key, evt) { function add_keymods(key, evt) {
...@@ -203,12 +204,7 @@ var canvas_events = (function() { ...@@ -203,12 +204,7 @@ var canvas_events = (function() {
text_mouseup: function(evt) { text_mouseup: function(evt) {
pdgui.gui_post("mouseup target is " + pdgui.gui_post("mouseup target is " +
evt.target + " and textbox is " + textbox()); evt.target + " and textbox is " + textbox());
// if (evt.target === textbox) { //evt.stopPropagation();
// pdgui.gui_post("it's a mouseup in a textbox");
// } else {
// pdgui.gui_post("it's a mouseup outside a textbox");
// }
// evt.stopPropagation();
//evt.preventDefault(); //evt.preventDefault();
return false; return false;
}, },
...@@ -237,9 +233,9 @@ var canvas_events = (function() { ...@@ -237,9 +233,9 @@ var canvas_events = (function() {
floating_text_keypress: function(evt) { floating_text_keypress: function(evt) {
pdgui.gui_post("leaving floating mode"); pdgui.gui_post("leaving floating mode");
canvas_events.text(); canvas_events.text();
// evt.stopPropagation(); //evt.stopPropagation();
// evt.preventDefault(); //evt.preventDefault();
// return false; //return false;
} }
} }
; ;
...@@ -344,23 +340,17 @@ var canvas_events = (function() { ...@@ -344,23 +340,17 @@ var canvas_events = (function() {
} }
}()); }());
// This gets called from the nw_create_window function in index.html
// It provides us with our canvas id from the C side. Once we have it
// This gets called from the nw_create_window function in index.html // we can create the menu and register event callbacks
// It provides us with our canvas id from the C side. Once we have it function register_canvas_id(cid) {
// we can create the menu and register event callbacks name = cid; // hack
function register_canvas_id(cid) { create_popup_menu(cid);
console.log("fuck you"); canvas_events.register(cid);
name = cid; // hack canvas_events.normal();
create_popup_menu(cid); nw_create_patch_window_menus(cid);
canvas_events.register(cid); pdgui.canvas_map(cid);
canvas_events.normal(); }
nw_create_patch_window_menus(cid);
pdgui.canvas_map(cid);
}
function create_popup_menu(name) { function create_popup_menu(name) {
// The right-click popup menu // The right-click popup menu
...@@ -387,89 +377,10 @@ function create_popup_menu(name) { ...@@ -387,89 +377,10 @@ function create_popup_menu(name) {
})); }));
} }
// stop-gap
function menu_generic () {
alert("Please implement this");
}
//nw_create_patch_window_menus(name);
function menu_generic () {
alert("Please implement this");
}
function pdmenu_copy () {
alert("Please implement pdmenu_copy");
}
function pdmenu_selectall () {
alert("Please implement pdmenu_selectall");
}
function pdmenu_preferences () {
alert("Please implement pdmenu_preferences");
}
function pdmenu_next_win () {
alert("Please implement pdmenu_preferences");
}
function pdmenu_previous_win () {
alert("Please implement pdmenu_preferences");
}
function pdmenu_parent_win () {
alert("Please implement pdmenu_preferences");
}
function pdmenu_console_win () {
alert("Please implement pdmenu_preferences");
}
function pdmenu_audio_on () {
alert("Please implement pdmenu_preferences");
}
function pdmenu_audio_off () {
alert("Please implement pdmenu_preferences");
}
function pdmenu_test_audio () {
alert("Please implement pdmenu_preferences");
}
function pdmenu_load_meter () {
alert("Please implement pdmenu_preferences");
}
function pdmenu_about_pd () {
alert("Please implement pdmenu_preferences");
}
function pdmenu_manual () {
alert("Please implement pdmenu_preferences");
}
function pdmenu_help_browser () {
alert("Please implement pdmenu_preferences");
}
function pdmenu_l2ork_mailinglist () {
alert("Please implement pdmenu_preferences");
}
function pdmenu_pd_mailinglists () {
alert("Please implement pdmenu_preferences");
}
function pdmenu_forums () {
alert("Please implement pdmenu_preferences");
}
function pdmenu_irc () {
alert("Please implement pdmenu_preferences");
}
var modals = {}; // Edit menu items that should be disabled when editing var modals = {}; // Edit menu items that should be disabled when editing
// an object box // an object box
...@@ -606,20 +517,18 @@ function nw_create_patch_window_menus (name) { ...@@ -606,20 +517,18 @@ function nw_create_patch_window_menus (name) {
// Edit sub-entries // Edit sub-entries
editMenu.append(modals.undo = new nw.MenuItem({ editMenu.append(modals.undo = new nw.MenuItem({
label: l('menu.undo'), label: l('menu.undo'),
click: menu_generic, click: function () {
// key: normal ? 'z' : '', pdgui.pdsend(name + " undo");
// modifiers: normal ? 'ctrl' : '', },
tooltip: l('menu.undo_tt'), tooltip: l('menu.undo_tt'),
// enabled: normal
})); }));
editMenu.append(modals.redo = new nw.MenuItem({ editMenu.append(modals.redo = new nw.MenuItem({
label: l('menu.redo'), label: l('menu.redo'),
click: menu_generic, click: function () {
// key: normal ? 'a' : '', pdgui.pdsend(name + " redo");
// modifiers: normal ? 'ctrl' : '', },
tooltip: l('menu.redo_tt'), tooltip: l('menu.redo_tt'),
// enabled: normal
})); }));
editMenu.append(new nw.MenuItem({ editMenu.append(new nw.MenuItem({
...@@ -631,10 +540,7 @@ function nw_create_patch_window_menus (name) { ...@@ -631,10 +540,7 @@ function nw_create_patch_window_menus (name) {
click: function () { click: function () {
pdgui.pdsend(name + " cut"); pdgui.pdsend(name + " cut");
}, },
// key: normal ? 'x' : '',
// modifiers: normal ? 'ctrl' : '',
tooltip: l('menu.cut_tt'), tooltip: l('menu.cut_tt'),
// enabled: normal
})); }));
editMenu.append(modals.copy = new nw.MenuItem({ editMenu.append(modals.copy = new nw.MenuItem({
...@@ -642,10 +548,7 @@ function nw_create_patch_window_menus (name) { ...@@ -642,10 +548,7 @@ function nw_create_patch_window_menus (name) {
click: function () { click: function () {
pdgui.pdsend(name + " copy"); pdgui.pdsend(name + " copy");
}, },
// key: normal ? 'c' : '',
// modifiers: normal ? 'ctrl' : '',
tooltip: l('menu.copy_tt'), tooltip: l('menu.copy_tt'),
// enabled: normal
})); }));
editMenu.append(modals.paste = new nw.MenuItem({ editMenu.append(modals.paste = new nw.MenuItem({
...@@ -653,10 +556,7 @@ function nw_create_patch_window_menus (name) { ...@@ -653,10 +556,7 @@ function nw_create_patch_window_menus (name) {
click: function () { click: function () {
pdgui.pdsend(name + " paste"); pdgui.pdsend(name + " paste");
}, },
// key: normal ? 'v' : '',
// modifiers: normal ? 'ctrl' : '',
tooltip: l('menu.paste_tt'), tooltip: l('menu.paste_tt'),
// enabled: normal
})); }));
editMenu.append(new nw.MenuItem({ editMenu.append(new nw.MenuItem({
...@@ -678,10 +578,7 @@ function nw_create_patch_window_menus (name) { ...@@ -678,10 +578,7 @@ function nw_create_patch_window_menus (name) {
pdgui.gui_post("fuck butts"); pdgui.gui_post("fuck butts");
} }
}, },
// key: (normal ? 'a' : 't'),
// modifiers: normal ? 'ctrl' : 'ctrl',
tooltip: l('menu.selectall_tt'), tooltip: l('menu.selectall_tt'),
// enabled: normal
})); }));
editMenu.append(new nw.MenuItem({ editMenu.append(new nw.MenuItem({
...@@ -745,16 +642,12 @@ function nw_create_patch_window_menus (name) { ...@@ -745,16 +642,12 @@ function nw_create_patch_window_menus (name) {
editMenu.append(new nw.MenuItem({ editMenu.append(new nw.MenuItem({
label: l('menu.tofront'), label: l('menu.tofront'),
click: menu_generic, click: menu_generic,
// key: 'a',
// modifiers: "ctrl",
tooltip: l('menu.tofront_tt'), tooltip: l('menu.tofront_tt'),
})); }));
editMenu.append(new nw.MenuItem({ editMenu.append(new nw.MenuItem({
label: l('menu.toback'), label: l('menu.toback'),
click: menu_generic, click: menu_generic,
// key: 'a',
// modifiers: "ctrl",
tooltip: l('menu.toback_tt'), tooltip: l('menu.toback_tt'),
})); }));
...@@ -767,8 +660,6 @@ function nw_create_patch_window_menus (name) { ...@@ -767,8 +660,6 @@ function nw_create_patch_window_menus (name) {
click: function () { click: function () {
pdgui.pdsend(name + " menufont"); pdgui.pdsend(name + " menufont");
}, },
// key: 'a',
// modifiers: "ctrl",
tooltip: l('menu.font_tt'), tooltip: l('menu.font_tt'),
})); }));
...@@ -789,16 +680,16 @@ function nw_create_patch_window_menus (name) { ...@@ -789,16 +680,16 @@ function nw_create_patch_window_menus (name) {
editMenu.append(new nw.MenuItem({ editMenu.append(new nw.MenuItem({
label: l('menu.find'), label: l('menu.find'),
click: menu_generic, click: menu_generic,
// key: 'a', key: 'f',
// modifiers: "ctrl", modifiers: "ctrl",
tooltip: l('menu.find_tt'), tooltip: l('menu.find_tt'),
})); }));
editMenu.append(new nw.MenuItem({ editMenu.append(new nw.MenuItem({
label: l('menu.findagain'), label: l('menu.findagain'),
click: menu_generic, click: menu_generic,
// key: 'a', key: 'g',
// modifiers: "ctrl", modifiers: "ctrl",
tooltip: l('menu.findagain') tooltip: l('menu.findagain')
})); }));
...@@ -817,8 +708,6 @@ function nw_create_patch_window_menus (name) { ...@@ -817,8 +708,6 @@ function nw_create_patch_window_menus (name) {
editMenu.append(new nw.MenuItem({ editMenu.append(new nw.MenuItem({
label: l('menu.autotips'), label: l('menu.autotips'),
click: menu_generic, click: menu_generic,
// key: 'a',
// modifiers: "ctrl",
tooltip: l('menu.autotips_tt'), tooltip: l('menu.autotips_tt'),
})); }));
...@@ -863,39 +752,6 @@ function nw_create_patch_window_menus (name) { ...@@ -863,39 +752,6 @@ function nw_create_patch_window_menus (name) {
tooltip: l('menu.object_tt'), tooltip: l('menu.object_tt'),
})); }));
/*
proc menu_floatatom {name accel} {
pd [concat $name dirty 1 \;]
pd [concat $name floatatom $accel \;]
}
proc menu_symbolatom {name accel} {
pd [concat $name dirty 1 \;]
pd [concat $name symbolatom $accel \;]
}
proc menu_comment {name accel} {
pd [concat $name dirty 1 \;]
pd [concat $name text $accel \;]
}
proc menu_graph {name} {
pd [concat $name dirty 1 \;]
set xdraw [expr int([$name.c canvasx 0])]
set ydraw [expr int([$name.c canvasy 0])]
pd [concat $name graph NULL 0 0 0 0 [expr $xdraw+30] [expr $ydraw+30] 0 [expr $ydraw+30]\;]
#pd [concat $name graph \;]
}
proc menu_array {name} {
pd [concat $name dirty 1 \;]
pd [concat $name menuarray \;]
}
*/
putMenu.append(new nw.MenuItem({ putMenu.append(new nw.MenuItem({
label: l('menu.msgbox'), label: l('menu.msgbox'),
click: function() { click: function() {
...@@ -1054,8 +910,6 @@ proc menu_array {name} { ...@@ -1054,8 +910,6 @@ proc menu_array {name} {
// leaving out some placement logic... see pd.tk menu_graph // leaving out some placement logic... see pd.tk menu_graph
pdgui.pdsend(name + " graph NULL 0 0 0 0 30 30 0 30"); pdgui.pdsend(name + " graph NULL 0 0 0 0 30 30 0 30");
}, },
// key: 'a',
// modifiers: "ctrl",
tooltip: l('menu.graph_tt'), tooltip: l('menu.graph_tt'),
})); }));
...@@ -1065,13 +919,12 @@ proc menu_array {name} { ...@@ -1065,13 +919,12 @@ proc menu_array {name} {
pdgui.pdsend(name + " dirty 1"); pdgui.pdsend(name + " dirty 1");
pdgui.pdsend(name + " menuarray"); pdgui.pdsend(name + " menuarray");
}, },
// key: 'a',
// modifiers: "ctrl",
tooltip: l('menu.array_tt'), tooltip: l('menu.array_tt'),
})); }));
// Windows menu... call it "winman" (i.e., window management) to avoid confusion // Windows menu... call it "winman" (i.e., window management)
// to avoid confusion
var winmanMenu = new nw.Menu(); var winmanMenu = new nw.Menu();
// Add to windows menu // Add to windows menu
...@@ -1104,16 +957,12 @@ proc menu_array {name} { ...@@ -1104,16 +957,12 @@ proc menu_array {name} {
winmanMenu.append(new nw.MenuItem({ winmanMenu.append(new nw.MenuItem({
label: l('menu.parentwin'), label: l('menu.parentwin'),
click: menu_generic, click: menu_generic,
// key: 'a',
// modifiers: "ctrl",
tooltip: l('menu.parentwin_tt'), tooltip: l('menu.parentwin_tt'),
})); }));
winmanMenu.append(new nw.MenuItem({ winmanMenu.append(new nw.MenuItem({
label: l('menu.pdwin'), label: l('menu.pdwin'),
click: menu_generic, click: menu_generic,
// key: 'a',
// modifiers: "ctrl",
tooltip: l('menu.pdwin_tt'), tooltip: l('menu.pdwin_tt'),
})); }));
...@@ -1154,16 +1003,12 @@ proc menu_array {name} { ...@@ -1154,16 +1003,12 @@ proc menu_array {name} {
mediaMenu.append(new nw.MenuItem({ mediaMenu.append(new nw.MenuItem({
label: l('menu.test'), label: l('menu.test'),
click: menu_generic, click: menu_generic,
// key: 'a',
// modifiers: "ctrl",
tooltip: l('menu.test_tt'), tooltip: l('menu.test_tt'),
})); }));
mediaMenu.append(new nw.MenuItem({ mediaMenu.append(new nw.MenuItem({
label: l('menu.loadmeter'), label: l('menu.loadmeter'),
click: menu_generic, click: menu_generic,
// key: 'a',
// modifiers: "ctrl",
tooltip: l('menu.loadmeter_tt'), tooltip: l('menu.loadmeter_tt'),
})); }));
...@@ -1188,16 +1033,12 @@ proc menu_array {name} { ...@@ -1188,16 +1033,12 @@ proc menu_array {name} {
helpMenu.append(new nw.MenuItem({ helpMenu.append(new nw.MenuItem({
label: l('menu.manual'), label: l('menu.manual'),
click: menu_generic, click: menu_generic,
// key: 'a',
// modifiers: "ctrl",
tooltip: l('menu.manual'), tooltip: l('menu.manual'),
})); }));
helpMenu.append(new nw.MenuItem({ helpMenu.append(new nw.MenuItem({
label: l('menu.browser'), label: l('menu.browser'),
click: menu_generic, click: menu_generic,
// key: 'a',
// modifiers: "ctrl",
tooltip: l('menu.browser_tt'), tooltip: l('menu.browser_tt'),
})); }));
...@@ -1208,32 +1049,24 @@ proc menu_array {name} { ...@@ -1208,32 +1049,24 @@ proc menu_array {name} {
helpMenu.append(new nw.MenuItem({ helpMenu.append(new nw.MenuItem({
label: l('menu.l2ork_list'), label: l('menu.l2ork_list'),
click: menu_generic, click: menu_generic,
// key: 'a',
// modifiers: "ctrl",
tooltip: l('menu.l2ork_list_tt'), tooltip: l('menu.l2ork_list_tt'),
})); }));
helpMenu.append(new nw.MenuItem({ helpMenu.append(new nw.MenuItem({
label: l('menu.pd_list'), label: l('menu.pd_list'),
click: menu_generic, click: menu_generic,
// key: 'a',
// modifiers: "ctrl",
tooltip: l('menu.pd_list_tt'), tooltip: l('menu.pd_list_tt'),
})); }));
helpMenu.append(new nw.MenuItem({ helpMenu.append(new nw.MenuItem({
label: l('menu.forums'), label: l('menu.forums'),
click: menu_generic, click: menu_generic,
// key: 'a',
// modifiers: "ctrl",
tooltip: l('menu.forums_tt'), tooltip: l('menu.forums_tt'),
})); }));
helpMenu.append(new nw.MenuItem({ helpMenu.append(new nw.MenuItem({
label: l('menu.irc'), label: l('menu.irc'),
click: menu_generic, click: menu_generic,
// key: 'a',
// modifiers: "ctrl",
tooltip: l('menu.irc_tt'), tooltip: l('menu.irc_tt'),
})); }));
...@@ -1242,89 +1075,6 @@ proc menu_array {name} { ...@@ -1242,89 +1075,6 @@ proc menu_array {name} {
} }
/*
function nw_create_canvas_window_menus(name) {
// Window menu
var windowMenu = new nw.Menu;
var windowMenu = new nw.Menu({
type: 'menubar'
});
// File menu
var fileMenu = new nw.Menu();
// Add to window menu
windowMenu.append(new nw.MenuItem({
label: 'File',
submenu: fileMenu
}));
// File sub-entries
fileMenu.append(new nw.MenuItem({
label: 'New',
click: pdgui.menu_new,
key: 'n',
modifiers: "ctrl"
}));
fileMenu.append(new nw.MenuItem({
label: 'Open',
key: 'o',
modifiers: "ctrl",
click: function (){
var chooser = document.querySelector('#fileDialog');
chooser.click();
chooser.addEventListener("change", function(evt) {
menu_open(this.value);
console.log("tried to open something");
}, false);
}
}));
if (pdgui.k12_mode == 1) {
fileMenu.append(new nw.MenuItem({
label: 'K12 Demos',
click: pdgui.menu_k12_open_demos
}));
}
fileMenu.append(new nw.MenuItem({
type: 'separator'
}));
// Note: this must be different for the main Pd window
fileMenu.append(new nw.MenuItem({
label: 'Save',
click: function (){
pdgui.menu_save(name);
},
key: 's',
modifiers: "ctrl"
}));
fileMenu.append(new nw.MenuItem({
label: 'Save as...',
click: function (){
pdgui.menu_saveas(name);
},
key: 'S',
modifiers: "ctrl"
}));
if (pdgui.k12_mode == 0) {
fileMenu.append(new nw.MenuItem({
type: 'separator'
}));
}
// Assign to window
nw.Window.get().menu = windowMenu;
}
*/
</script> </script>
</body> </body>
</html> </html>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment