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

add menu items for "Parent Window" and "Visible Parent Window", more cleanup of menus

parent 5d3ae322
......@@ -231,18 +231,6 @@ function console_find_keydown(elem, evt) {
}
}
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");
}
......@@ -251,38 +239,6 @@ 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");
}
......@@ -568,26 +524,6 @@ function nw_create_pd_window_menus () {
tooltip: l("menu.prevwin_tt")
}));
winmanMenu.append(new gui.MenuItem({
type: "separator"
}));
winmanMenu.append(new gui.MenuItem({
label: l("menu.parentwin"),
click: pdmenu_parent_win,
//key: "a",
//modifiers: "ctrl",
tooltip: l("menu.parentwin_tt")
}));
winmanMenu.append(new gui.MenuItem({
label: l("menu.pdwin"),
click: pdmenu_console_win,
//key: "a",
//modifiers: "ctrl",
tooltip: l("menu.pdwin_tt")
}));
// Media menu
var mediaMenu = new gui.Menu();
......
......@@ -200,6 +200,8 @@
"prevwin_tt": "Give focus to the previous window in the stacking order",
"parentwin": "Parent Window",
"parentwin_tt": "give focus to the parent window of the current window",
"visible_parentwin": "Visible Parent Window",
"visible_parentwin_tt": "give focus to the closest ancestor of this window that is visible",
"pdwin": "Pd Window",
"pdwin_tt": "Give focus to the main Pd window",
......
......@@ -1238,10 +1238,20 @@ function nw_create_patch_window_menus(name) {
winmanMenu.append(new gui.MenuItem({
label: l("menu.parentwin"),
click: menu_generic,
click: function() {
pdgui.pdsend(name, "findparent", 0);
},
tooltip: l("menu.parentwin_tt"),
}));
winmanMenu.append(new gui.MenuItem({
label: l("menu.visible_parentwin"),
click: function() {
pdgui.pdsend(name, "findparent", 1);
},
tooltip: l("menu.visible_parentwin_tt"),
}));
winmanMenu.append(new gui.MenuItem({
label: l("menu.pdwin"),
click: function() {
......
......@@ -5744,19 +5744,28 @@ static void canvas_find_again(t_canvas *x)
}
/* following function serves mainly as a helper function for tcl/tk
and focuses first visible parent (not the immediate parent) */
static void canvas_find_parent(t_canvas *x)
f = 0: show immediate parent
f = 1: show visible parent */
static void canvas_find_parent(t_canvas *x, t_floatarg f)
{
if (x->gl_owner)
{
t_glist *owner = x->gl_owner;
while (!glist_isvisible(owner) &&
!owner->gl_havewindow && owner->gl_owner)
owner = owner->gl_owner;
if (glist_isvisible(owner) && owner->gl_havewindow)
canvas_vis(owner, 1);
if (f != 0) /* find visible parent */
{
t_glist *owner = x->gl_owner;
while (!glist_isvisible(owner) &&
!owner->gl_havewindow && owner->gl_owner)
owner = owner->gl_owner;
if (glist_isvisible(owner) && owner->gl_havewindow)
canvas_vis(owner, 1);
}
else /* find immediate parent */
{
canvas_vis(glist_getcanvas(x->gl_owner), 1);
}
}
else {
else
{
sys_gui("menu_raise_console\n");
}
}
......@@ -7783,7 +7792,7 @@ void g_editor_setup(void)
class_addmethod(canvas_class, (t_method)canvas_find_again,
gensym("findagain"), A_NULL);
class_addmethod(canvas_class, (t_method)canvas_find_parent,
gensym("findparent"), A_NULL);
gensym("findparent"), A_DEFFLOAT, A_NULL);
class_addmethod(canvas_class, (t_method)canvas_done_popup,
gensym("done-popup"), A_FLOAT, A_FLOAT, A_FLOAT, A_NULL);
class_addmethod(canvas_class, (t_method)canvas_donecanvasdialog,
......
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