Commit e9c00940 authored by Jonathan Wilkes's avatar Jonathan Wilkes
Browse files

finish up the Windows menu for canvases and the pd window

parent 7a624700
......@@ -510,7 +510,9 @@ function nw_create_pd_window_menus () {
// Winman sub-entries
winmanMenu.append(new gui.MenuItem({
label: l("menu.nextwin"),
click: pdmenu_next_win,
click: function() {
pdgui.raise_next("pd_window");
},
//key: "c",
//modifiers: "ctrl",
tooltip: l("menu.nextwin_tt")
......@@ -518,7 +520,9 @@ function nw_create_pd_window_menus () {
winmanMenu.append(new gui.MenuItem({
label: l("menu.prevwin"),
click: pdmenu_previous_win,
click: function() {
pdgui.raise_prev("pd_window");
},
//key: "a",
//modifiers: "ctrl",
tooltip: l("menu.prevwin_tt")
......
......@@ -1218,7 +1218,9 @@ function nw_create_patch_window_menus(name) {
winmanMenu.append(new gui.MenuItem({
label: l("menu.nextwin"),
click: menu_generic,
click: function() {
pdgui.raise_next(name);
},
key: String.fromCharCode(12), // Page down
modifiers: "ctrl",
tooltip: l("menu.nextwin_tt"),
......@@ -1226,7 +1228,9 @@ function nw_create_patch_window_menus(name) {
winmanMenu.append(new gui.MenuItem({
label: l("menu.prevwin"),
click: menu_generic,
click: function() {
pdgui.raise_prev(name);
},
key: String.fromCharCode(11), // Page up
modifiers: "ctrl",
tooltip: l("menu.prevwin_tt"),
......
......@@ -40,6 +40,16 @@ exports.get_local_string = lang.get_local_string;
var pd_window;
exports.pd_window;
// Turns out I messed this up. pd_window should really be an
// "nw window", so that you can use it to access all the
// nw window methods and settings. Instead I set it to the
// DOM window object. This complicates things-- for example,
// in walk_window_list I have to take care when comparing
// patchwin[]-- which are nw windows-- and pd_window.
// I'm not sure of the best way to fix this. Probably we want to
// just deal with DOM windows, but that would mean abstracting
// out the stuff that deals with nw window size and
// positioning.
exports.set_pd_window = function(win) {
pd_window = win;
exports.pd_window = win;
......@@ -2897,9 +2907,47 @@ function gui_raise_window(cid) {
}
function gui_raise_pd_window() {
pd_window.focus();
pd_window.focus(-1);
}
// Walk the list of open patch windows. They are walked in the order
// they were created.
// This is a bit complicated because of the way I set pd_window above
function walk_window_list(cid, offset) {
var win_store = global.__nwWindowsStore,
my_win = cid === "pd_window" ? pd_window : patchwin[cid].window,
id_array = [],
my_id, id, next_id;
for (id in win_store) {
if (win_store.hasOwnProperty(id)) {
id_array.push(+id); // build array of numbers
if (win_store[id].window === my_win) {
my_id = +id; // cast as number to match against array
}
}
}
id_array.sort(function(a, b) { return a-b; }); // sort numerically
next_id = (id_array.indexOf(my_id) + offset);
if (next_id < 0) {
next_id += id_array.length;
} else {
next_id %= id_array.length;
}
win_store[id_array[next_id]].focus();
}
function raise_next(cid) {
walk_window_list(cid, 1);
}
exports.raise_next = raise_next;
function raise_prev(cid) {
walk_window_list(cid, -1);
}
exports.raise_prev = raise_prev;
exports.raise_pd_window= gui_raise_pd_window;
// Openpanel and Savepanel
......
......@@ -325,6 +325,8 @@ Everything else: (A [x] means we've fixed it)
that isn't true. Thus if we open many patches at a time, the getscroll
call for the most recent window will cancel the old one, leaving the
older window with the wrong viewport.
[ ] fix the Next Window/Previous Window keybindings. For some reason they
don't work.
Crashers
--------
......
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