Commit 02f52fe1 authored by Jonathan Wilkes's avatar Jonathan Wilkes
Browse files

add "View" menu and a zoom reset menu item

parent 2a299b67
......@@ -444,20 +444,6 @@ function nw_create_pd_window_menus(gui, w) {
if (osx) {
minit(m.edit.reselect, { enabled: false });
}
minit(m.edit.zoomin, {
click: function () {
var z = gui.Window.get().zoomLevel;
if (z < 8) { z++; }
gui.Window.get().zoomLevel = z;
}
});
minit(m.edit.zoomout, {
click: function () {
var z = gui.Window.get().zoomLevel;
if (z > -7) { z--; }
gui.Window.get().zoomLevel = z;
}
});
if (osx) {
minit(m.edit.tidyup, { enabled: false });
minit(m.edit.tofront, { enabled: false });
......@@ -494,6 +480,35 @@ function nw_create_pd_window_menus(gui, w) {
click: pdgui.open_prefs,
});
// View menu
minit(m.view.zoomin, {
click: function () {
var z = gui.Window.get().zoomLevel;
if (z < 8) { z++; }
gui.Window.get().zoomLevel = z;
}
});
minit(m.view.zoomout, {
click: function () {
var z = gui.Window.get().zoomLevel;
if (z > -7) { z--; }
gui.Window.get().zoomLevel = z;
}
});
minit(m.view.zoomreset, {
click: function () {
gui.Window.get().zoomLevel = 0;
}
});
minit(m.view.fullscreen, {
click: function() {
var win = gui.Window.get(),
fullscreen = win.isFullscreen;
win.isFullscreen = !fullscreen;
pdgui.post("fullscreen is " + !fullscreen);
}
});
// Put menu
if (osx) {
minit(m.put.object, { enabled: false });
......@@ -515,14 +530,6 @@ function nw_create_pd_window_menus(gui, w) {
}
// Winman sub-entries
minit(m.win.fullscreen, {
click: function() {
var win = gui.Window.get(),
fullscreen = win.isFullscreen;
win.isFullscreen = !fullscreen;
pdgui.post("fullscreen is " + !fullscreen);
}
});
minit(m.win.nextwin, {
click: function() {
pdgui.raise_next("pd_window");
......
......@@ -126,10 +126,6 @@
"selectall_tt": "Select all objects in a patch",
"reselect": "Reselect",
"reselect_tt": "Restore the previous selection",
"zoomin": "Zoom In",
"zoomin_tt": "Make the patch visually larger",
"zoomout": "Zoom Out",
"zoomout_tt": "Make the patch visually smaller",
"find": "Find",
"find_tt": "Find text in the console output",
"tidyup": "Tidy Up",
......@@ -155,6 +151,16 @@
"preferences": "Preferences",
"preferences_tt": "Open a dialog window to configure the running instance of Pd",
"view": "View",
"zoomin": "Zoom In",
"zoomin_tt": "Make the patch visually larger",
"zoomout": "Zoom Out",
"zoomout_tt": "Make the patch visually smaller",
"zoomreset": "Reset Zoom",
"zoomreset_tt": "Reset the zoom to the original level",
"fullscreen": "Fullscreen",
"put": "Put",
"object": "Object",
......@@ -193,7 +199,6 @@
"windows": "Windows",
"fullscreen": "Fullscreen",
"nextwin": "Next Window",
"nextwin_tt": "Give focus to the next open window in the stacking order",
"prevwin": "Previous Window",
......
......@@ -737,22 +737,6 @@ function nw_create_patch_window_menus(gui, w, name) {
enabled: true,
click: function () { pdgui.pdsend(name, "reselect"); }
});
minit(m.edit.zoomin, {
enabled: true,
click: function () {
var z = gui.Window.get().zoomLevel;
if (z < 8) { z++; }
gui.Window.get().zoomLevel = z;
}
});
minit(m.edit.zoomout, {
enabled: true,
click: function () {
var z = gui.Window.get().zoomLevel;
if (z > -7) { z--; }
gui.Window.get().zoomLevel = z;
}
});
minit(m.edit.tidyup, {
enabled: true,
click: function() { pdgui.pdsend(name, "tidy"); }
......@@ -821,6 +805,38 @@ function nw_create_patch_window_menus(gui, w, name) {
click: pdgui.open_prefs
});
// View menu
minit(m.view.zoomin, {
enabled: true,
click: function () {
var z = gui.Window.get().zoomLevel;
if (z < 8) { z++; }
gui.Window.get().zoomLevel = z;
}
});
minit(m.view.zoomout, {
enabled: true,
click: function () {
var z = gui.Window.get().zoomLevel;
if (z > -7) { z--; }
gui.Window.get().zoomLevel = z;
}
});
minit(m.view.zoomreset, {
enabled: true,
click: function () {
gui.Window.get().zoomLevel = 0;
}
});
minit(m.view.fullscreen, {
click: function() {
var win = gui.Window.get();
var fullscreen = win.isFullscreen;
win.isFullscreen = !fullscreen;
pdgui.post("fullscreen is " + fullscreen);
}
});
// Put menu
minit(m.put.object, {
enabled: true,
......@@ -953,14 +969,6 @@ function nw_create_patch_window_menus(gui, w, name) {
});
// Window
minit(m.win.fullscreen, {
click: function() {
var win = gui.Window.get();
var fullscreen = win.isFullscreen;
win.isFullscreen = !fullscreen;
pdgui.post("fullscreen is " + fullscreen);
}
});
minit(m.win.nextwin, {
click: function() {
pdgui.raise_next(name);
......
......@@ -158,18 +158,6 @@ function create_menu(gui, type) {
}));
}
editMenu.append(new gui.MenuItem({ type: "separator" }));
editMenu.append(m.edit.zoomin = new gui.MenuItem({
label: l("menu.zoomin"),
key: "=",
modifiers: cmd_or_ctrl,
tooltip: l("menu.zoomin_tt")
}));
editMenu.append(m.edit.zoomout = new gui.MenuItem({
label: l("menu.zoomout"),
key: "-",
modifiers: cmd_or_ctrl,
tooltip: l("menu.zoomout_tt")
}));
editMenu.append(new gui.MenuItem({ type: "separator" }));
if (canvas_menu) {
editMenu.append(m.edit.tidyup = new gui.MenuItem({
......@@ -236,6 +224,44 @@ function create_menu(gui, type) {
tooltip: l("menu.preferences_tt")
}));
// View menu
var viewMenu = new gui.Menu();
// Add to window menu
windowMenu.append(new gui.MenuItem({
label: l("menu.view"),
submenu: viewMenu
}));
// View sub-entries
m.view= {};
viewMenu.append(m.view.zoomin = new gui.MenuItem({
label: l("menu.zoomin"),
key: "=",
modifiers: cmd_or_ctrl,
tooltip: l("menu.zoomin_tt")
}));
viewMenu.append(m.view.zoomout = new gui.MenuItem({
label: l("menu.zoomout"),
key: "-",
modifiers: cmd_or_ctrl,
tooltip: l("menu.zoomout_tt")
}));
viewMenu.append(new gui.MenuItem({ type: "separator" }));
viewMenu.append(m.view.zoomreset = new gui.MenuItem({
label: l("menu.zoomreset"),
key: "0",
modifiers: cmd_or_ctrl,
tooltip: l("menu.zoomreset_tt")
}));
viewMenu.append(new gui.MenuItem({ type: "separator" }));
viewMenu.append(m.view.fullscreen = new gui.MenuItem({
label: l("menu.fullscreen"),
key: process.platform === "darwin" ? "f" : "f11",
modifiers: process.platform === "darwin" ? "cmd+shift" : null,
tooltip: l("menu.fullscreen_tt")
}));
if (canvas_menu) {
// Put menu
var putMenu = new gui.Menu();
......@@ -353,11 +379,6 @@ function create_menu(gui, type) {
// Win sub-entries
m.win = {};
winmanMenu.append(m.win.fullscreen = new gui.MenuItem({
label: l("menu.fullscreen"),
key: "f11",
tooltip: l("menu.nextwin_tt")
}));
winmanMenu.append(m.win.nextwin = new gui.MenuItem({
label: l("menu.nextwin"),
key: String.fromCharCode(12), // Page down
......
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