diff --git a/pd/nw/index.js b/pd/nw/index.js index 0c7da6dc4cd8d6745c8cc2eb46d5e5a12d9b2554..f6b8ecff8911fff0e52bf6ddd5546344ba235262 100644 --- a/pd/nw/index.js +++ b/pd/nw/index.js @@ -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"); diff --git a/pd/nw/locales/en/translation.json b/pd/nw/locales/en/translation.json index 3a032575e33f15d7bb6ed0047658c2dd1dfde4e4..049a6f1b3a82a234f355388694dfa1f2528c77c4 100644 --- a/pd/nw/locales/en/translation.json +++ b/pd/nw/locales/en/translation.json @@ -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", diff --git a/pd/nw/pd_canvas.js b/pd/nw/pd_canvas.js index 0876ad1da01c64ea844f23ff2c93c65e17e2dd92..b9fce9e694c11152260ebdcfefec285b933b5f05 100644 --- a/pd/nw/pd_canvas.js +++ b/pd/nw/pd_canvas.js @@ -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); diff --git a/pd/nw/pd_menus.js b/pd/nw/pd_menus.js index bf2cf70f5140e7c93baab29a4cacd28bb6acb54f..d38d10434af5b30d946299c284076ff3a510c5d7 100644 --- a/pd/nw/pd_menus.js +++ b/pd/nw/pd_menus.js @@ -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