Skip to content

Commit

Permalink
prevent global menu shortcut messing up w/ sub-menu's (#1620)
Browse files Browse the repository at this point in the history
  • Loading branch information
p3r7 authored Nov 20, 2022
1 parent f242b29 commit 487610b
Showing 1 changed file with 24 additions and 9 deletions.
33 changes: 24 additions & 9 deletions lua/core/menu.lua
Original file line number Diff line number Diff line change
Expand Up @@ -210,16 +210,33 @@ end

-- global menu keys
function _menu.keycode(c,value)
if value==1 then
if c=="F1" then _menu.set_page("MIX")
elseif c=="F2" then _menu.set_page("TAPE")
elseif c=="F3" then _menu.set_page("HOME")
elseif c=="F4" then _menu.set_page("PARAMS")
-- those are globals and can't be overriden by a sub-menu
if value>0 then
if c=="F1" then
_menu.set_page("MIX")
return
elseif c=="F2" then
_menu.set_page("TAPE")
return
elseif c=="F3" then
_menu.set_page("HOME")
return
elseif c=="F4" then
_menu.set_page("PARAMS")
return
end
end

-- if a sub-menu defines its own handler, it takes precedence...
if _menu.keyboardcode then
_menu.keyboardcode(c,value)
return
end

-- ... otherwise we use those default bindings in most places

-- E2 emu (scolling)
if value>=1 then
if value>0 then
if c=="DOWN" then
_menu.penc(2,1)
elseif c=="UP" then
Expand All @@ -231,7 +248,7 @@ function _menu.keycode(c,value)
end
end

-- key emu
-- K2/K3 emu
if value==1 or value==0 then
if c=="LEFT" then
_menu.key(2,value)
Expand All @@ -246,8 +263,6 @@ function _menu.keycode(c,value)
elseif c=="EQUAL" then
_menu.penc(3,value)
end

if _menu.keyboardcode then _menu.keyboardcode(c,value) end
end

function _menu.keychar(c)
Expand Down

0 comments on commit 487610b

Please sign in to comment.