diff options
author | 2021-11-02 07:53:18 +1100 | |
---|---|---|
committer | 2021-11-02 07:53:18 +1100 | |
commit | 8ab63e2072f6cfe19b8f8e2acfbd29754d282c79 (patch) | |
tree | 5e05b0a71e44d3b5466a28e9232b32252a96d620 /plugins/inputmacro/inputmacro_menu.lua | |
parent | 782359169952d8fd7bf737ff45a0c3650ca12c7e (diff) |
Fix various usability issues:
frontend: Made it so you can press UI On Screen Display to hide the
Analog Controls menu and see the response to your inputs without the
risk of changing settings, and see more axes at once and scroll them for
systems with very large number of axes. Also ensure the axis being
configured is visible when the menu is visible, and made the menu behave
a bit more like the system input assignments menu (including
previous/next group navigation).
frontend: Allow Lua to draw to the UI container - this addresses the
main complaint in #7475. Note that drawing to the UI container will
draw over any UI elements, including menus. Plugins can check
menu_active to avoid drawing over menus. Also removed some unnecessary
use of sol::overload.
frontend: Improved info/image box navigation on the system/softwre
selection menus, and cleaned up some leftover code that came from the
copy/pasted event handling functions.
frontend: Fixed sliders menu not handling Alt+Shift as intended (thanks
Coverity). Fixed a couple of harmless Coverity errors, too.
emu/inpttype.ipp: Made the default assignment for Save State recognise
right shift.
plugins: Added next/previous group navigation to input macro edit menu.
docs: Added basic description of the system and software selection
menus, and corrected a couple of errors in the Lua reference.
Diffstat (limited to 'plugins/inputmacro/inputmacro_menu.lua')
-rw-r--r-- | plugins/inputmacro/inputmacro_menu.lua | 49 |
1 files changed, 37 insertions, 12 deletions
diff --git a/plugins/inputmacro/inputmacro_menu.lua b/plugins/inputmacro/inputmacro_menu.lua index b6b8c9413c0..944361c88fe 100644 --- a/plugins/inputmacro/inputmacro_menu.lua +++ b/plugins/inputmacro/inputmacro_menu.lua @@ -308,7 +308,30 @@ local function handle_edit_items(index, event) end end - return namecancel + local selection + if command.step then + if event == 'prevgroup' then + if command.step > 1 then + local found_break = false + selection = index - 1 + while (not edit_items[selection]) or (edit_items[selection].step == command.step) do + selection = selection - 1 + end + local step = edit_items[selection].step + while edit_items[selection - 1] and (edit_items[selection - 1].step == step) do + selection = selection - 1 + end + end + elseif event == 'nextgroup' then + if command.step < #edit_current_macro.steps then + selection = index + 1 + while (not edit_items[selection]) or (edit_items[selection].step == command.step) do + selection = selection + 1 + end + end + end + end + return namecancel, selection end local function add_edit_items(items) @@ -393,14 +416,15 @@ local function add_edit_items(items) end local function handle_add(index, event) - if handle_edit_items(index, event) then - return true + local handled, selection = handle_edit_items(index, event) + if handled then + return true, selection elseif event == 'cancel' then edit_current_macro = nil edit_menu_active = false edit_items = nil table.remove(menu_stack) - return true + return true, selection elseif (index == edit_item_exit) and (event == 'select') then if current_macro_complete() then table.insert(macros, edit_current_macro) @@ -410,22 +434,23 @@ local function handle_add(index, event) edit_current_macro = nil edit_items = nil table.remove(menu_stack) - return true + return true, selection end - return false + return false, selection end local function handle_edit(index, event) - if handle_edit_items(index, event) then - return true + local handled, selection = handle_edit_items(index, event) + if handled then + return true, selection elseif (event == 'cancel') or ((index == edit_item_exit) and (event == 'select')) then edit_current_macro = nil edit_menu_active = false edit_items = nil table.remove(menu_stack) - return true + return true, selection end - return false + return false, selection end local function populate_add() @@ -449,7 +474,7 @@ local function populate_add() if edit_switch_poller then return edit_switch_poller:overlay(items, selection, 'lrrepeat') else - return items, selection, 'lrrepeat' + return items, selection, 'lrrepeat' .. (edit_name_buffer and ' ignorepause' or '') end end @@ -470,7 +495,7 @@ local function populate_edit() if edit_switch_poller then return edit_switch_poller:overlay(items, selection, 'lrrepeat') else - return items, selection, 'lrrepeat' + return items, selection, 'lrrepeat' .. (edit_name_buffer and ' ignorepause' or '') end end |