From d64ea5331b2312f81df464fb22dcef0191216d86 Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Sun, 31 Oct 2021 12:31:16 +1100 Subject: -frontend: Refactored menu event handling and fixed a number of issues. (#8777) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Moved common code for drawing about box, info viewer, and other text box menus to a base class; removed the last of the info viewer logic and the multi-line item hack from the base menu class. * Added previous/next group navigation for general inputs and plugin input selection menus. * Moved message catalog logic to lib/util, allowing osd and emu to use localised messages. * Made the base menu class use the UI manager’s feature for holding session state rather than a static map and mutex. * Improved menu event handling model, and fixed many issues, particularly with menus behaving badly when hidden/shown. * Added better support for menus that don’t participate in the usual menu stack, like the menuless sliders and the save/load state menus. * Made a number of menus refresh state when being shown after being hidden (fixes MT08121 among other issues). * Fixed indication of mounted slot option in the slot option details menu. * Improved appearance of background menus when emulation isn't running - draw all menus in the stack, and darken the background menus to make the edges of the active menu clearer. * Fixed locale issues in -listxml. -debugger: Made GUI debuggers more uniform. * Added new memory view features to Win32 debugger. * Fixed spelling of hexadecimal in Cocoa debugger and added decimal address option. * Fixed duplicate keyboard shortcut in Cocoa debugger (Shift-Cmd-D was both new device window and 64-bit float format). * Made keyboard shortcuts slightly more consistent across debuggers. -plugins: Moved input selection menu and sequence polling code to a common library. Fixed the issue that prevented keyboard inputs being mapped with -steadykey on. -docs: Started adding some documentation for MAME's internal UI, and updated the list of example front-ends. -Regenerated message catalog sources. For translators, the new strings are mostly: * The names of the inputs provided by the OS-dependent layer for things like fullscreen and video features. These show up in the user interface inputs menu. * The names for automatically generated views. These show up in the video options menu - test with a system with a lot of screens to see more variants. * The input macro plugin UI. * A few format strings for analog input assignments. * A few strings for the about box header. --- src/frontend/mame/ui/utils.cpp | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'src/frontend/mame/ui/utils.cpp') diff --git a/src/frontend/mame/ui/utils.cpp b/src/frontend/mame/ui/utils.cpp index 35aef723b13..27a27b45678 100644 --- a/src/frontend/mame/ui/utils.cpp +++ b/src/frontend/mame/ui/utils.cpp @@ -385,6 +385,7 @@ private: , m_handler(std::move(handler)) , m_added(false) { + set_process_flags(PROCESS_LR_REPEAT); } virtual ~menu_configure() override { m_handler(m_parent); } @@ -412,7 +413,7 @@ private: }; virtual void populate(float &customtop, float &custombottom) override; - virtual void handle() override; + virtual void handle(event const *ev) override; bool set_filter_type(unsigned pos, typename Base::type n) { @@ -567,15 +568,14 @@ void composite_filter_impl_base::menu_configure::populate(floa } template -void composite_filter_impl_base::menu_configure::handle() +void composite_filter_impl_base::menu_configure::handle(event const *ev) { - const event *menu_event = process(PROCESS_LR_REPEAT); - if (menu_event && menu_event->itemref) + if (ev && ev->itemref) { m_added = false; bool changed(false); - uintptr_t const ref(reinterpret_cast(menu_event->itemref)); - switch (menu_event->iptkey) + uintptr_t const ref(reinterpret_cast(ev->itemref)); + switch (ev->iptkey) { case IPT_UI_LEFT: case IPT_UI_RIGHT: @@ -584,7 +584,7 @@ void composite_filter_impl_base::menu_configure::handle() // change filter type unsigned const pos(ref - FILTER_FIRST); typename Base::type const current(m_parent.m_filters[pos]->get_type()); - if (IPT_UI_LEFT == menu_event->iptkey) + if (IPT_UI_LEFT == ev->iptkey) { typename Base::type n(current); while ((Base::FIRST < n) && !changed) @@ -607,7 +607,7 @@ void composite_filter_impl_base::menu_configure::handle() { // change filter value Base &pos(*m_parent.m_filters[ref - ADJUST_FIRST]); - changed = (IPT_UI_LEFT == menu_event->iptkey) ? pos.adjust_left() : pos.adjust_right(); + changed = (IPT_UI_LEFT == ev->iptkey) ? pos.adjust_left() : pos.adjust_right(); } break; @@ -971,6 +971,7 @@ private: , m_state(std::make_unique []>(mame_machine_manager::instance()->inifile().get_file_count())) , m_ini(parent.m_ini) { + set_process_flags(PROCESS_LR_REPEAT); inifile_manager const &mgr(mame_machine_manager::instance()->inifile()); for (size_t i = 0; mgr.get_file_count() > i; ++i) { @@ -1015,7 +1016,7 @@ private: }; virtual void populate(float &customtop, float &custombottom) override; - virtual void handle() override; + virtual void handle(event const *ev) override; category_machine_filter &m_parent; std::function m_handler; @@ -1093,15 +1094,14 @@ void category_machine_filter::menu_configure::populate(float &customtop, float & customtop = ui().get_line_height() + 3.0f * ui().box_tb_border(); } -void category_machine_filter::menu_configure::handle() +void category_machine_filter::menu_configure::handle(event const *ev) { - const event *menu_event = process(PROCESS_LR_REPEAT); - if (menu_event && menu_event->itemref) + if (ev && ev->itemref) { bool changed(false); - uintptr_t const ref(reinterpret_cast(menu_event->itemref)); + uintptr_t const ref(reinterpret_cast(ev->itemref)); inifile_manager const &mgr(mame_machine_manager::instance()->inifile()); - switch (menu_event->iptkey) + switch (ev->iptkey) { case IPT_UI_LEFT: if ((INI_FILE == ref) && m_ini) -- cgit v1.2.3-70-g09d2