summaryrefslogtreecommitdiffstatshomepage
path: root/src/frontend/mame/ui/sliders.cpp
diff options
context:
space:
mode:
author Vas Crabb <vas@vastheman.com>2021-11-02 07:53:18 +1100
committer Vas Crabb <vas@vastheman.com>2021-11-02 07:53:18 +1100
commit8ab63e2072f6cfe19b8f8e2acfbd29754d282c79 (patch)
tree5e05b0a71e44d3b5466a28e9232b32252a96d620 /src/frontend/mame/ui/sliders.cpp
parent782359169952d8fd7bf737ff45a0c3650ca12c7e (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 'src/frontend/mame/ui/sliders.cpp')
-rw-r--r--src/frontend/mame/ui/sliders.cpp38
1 files changed, 19 insertions, 19 deletions
diff --git a/src/frontend/mame/ui/sliders.cpp b/src/frontend/mame/ui/sliders.cpp
index e26b76e2302..4dbb69baa1a 100644
--- a/src/frontend/mame/ui/sliders.cpp
+++ b/src/frontend/mame/ui/sliders.cpp
@@ -41,9 +41,23 @@ void menu_sliders::handle(event const *ev)
// process the menu
if (ev)
{
- // handle keys if there is a valid item selected
- if (ev->itemref && (ev->type == menu_item_type::SLIDER))
+ if (ev->iptkey == IPT_UI_ON_SCREEN_DISPLAY)
{
+ // toggle visibility
+ if (m_menuless_mode)
+ {
+ stack_pop();
+ }
+ else
+ {
+ m_hidden = !m_hidden;
+ set_process_flags(PROCESS_LR_REPEAT | (m_hidden ? PROCESS_CUSTOM_ONLY : 0));
+ }
+
+ }
+ else if (ev->itemref && (ev->type == menu_item_type::SLIDER))
+ {
+ // handle keys if there is a valid item selected
const slider_state *slider = (const slider_state *)ev->itemref;
int32_t curvalue = slider->update(nullptr, SLIDER_NOCHANGE);
int32_t increment = 0;
@@ -53,24 +67,11 @@ void menu_sliders::handle(event const *ev)
switch (ev->iptkey)
{
- // toggle visibility
- case IPT_UI_ON_SCREEN_DISPLAY:
- if (m_menuless_mode)
- {
- stack_pop();
- }
- else
- {
- m_hidden = !m_hidden;
- set_process_flags(PROCESS_LR_REPEAT | (m_hidden ? PROCESS_CUSTOM_ONLY : 0));
- }
- break;
-
// decrease value
case IPT_UI_LEFT:
if (alt_pressed && shift_pressed)
increment = -1;
- if (alt_pressed)
+ else if (alt_pressed)
increment = -(curvalue - slider->minval);
else if (shift_pressed)
increment = (slider->incval > 10) ? -(slider->incval / 10) : -1;
@@ -84,7 +85,7 @@ void menu_sliders::handle(event const *ev)
case IPT_UI_RIGHT:
if (alt_pressed && shift_pressed)
increment = 1;
- if (alt_pressed)
+ else if (alt_pressed)
increment = slider->maxval - curvalue;
else if (shift_pressed)
increment = (slider->incval > 10) ? (slider->incval / 10) : 1;
@@ -116,10 +117,9 @@ void menu_sliders::handle(event const *ev)
reset(reset_options::REMEMBER_REF);
}
}
-
- // if we are selecting an invalid item and we are hidden, skip to the next one
else if (m_hidden)
{
+ // if we are selecting an invalid item and we are hidden, skip to the next one
if (ev->iptkey == IPT_UI_UP || ev->iptkey == IPT_UI_PAGE_UP)
{
// if we got here via up or page up, select the previous item