diff options
author | 2021-10-31 12:31:16 +1100 | |
---|---|---|
committer | 2021-10-31 12:31:16 +1100 | |
commit | d64ea5331b2312f81df464fb22dcef0191216d86 (patch) | |
tree | a3f3784371da401e6a675e5b6b9734b88281a08d /src/frontend/mame/ui/selmenu.cpp | |
parent | cfffc54b61cabc5ef9533396bf87324eb5eeb63e (diff) |
-frontend: Refactored menu event handling and fixed a number of issues. (#8777)
* 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.
Diffstat (limited to 'src/frontend/mame/ui/selmenu.cpp')
-rw-r--r-- | src/frontend/mame/ui/selmenu.cpp | 49 |
1 files changed, 17 insertions, 32 deletions
diff --git a/src/frontend/mame/ui/selmenu.cpp b/src/frontend/mame/ui/selmenu.cpp index 2228f7b1b60..d55009623e8 100644 --- a/src/frontend/mame/ui/selmenu.cpp +++ b/src/frontend/mame/ui/selmenu.cpp @@ -171,7 +171,7 @@ protected: private: virtual void populate(float &customtop, float &custombottom) override; - virtual void handle() override; + virtual void handle(event const *ev) override; ui_software_info const &m_uiinfo; s_parts const m_parts; @@ -191,7 +191,7 @@ private: bios_selection(mame_ui_manager &mui, render_container &container, s_bios &&biosname, void const *driver, bool software, bool inlist); virtual void populate(float &customtop, float &custombottom) override; - virtual void handle() override; + virtual void handle(event const *ev) override; void const *m_driver; bool m_software, m_inlist; @@ -294,15 +294,14 @@ void menu_select_launch::software_parts::populate(float &customtop, float &custo // handle //------------------------------------------------- -void menu_select_launch::software_parts::handle() +void menu_select_launch::software_parts::handle(event const *ev) { // process the menu - const event *menu_event = process(0); - if (menu_event && (menu_event->iptkey) == IPT_UI_SELECT && menu_event->itemref) + if (ev && (ev->iptkey == IPT_UI_SELECT) && ev->itemref) { for (auto const &elem : m_parts) { - if ((void*)&elem == menu_event->itemref) + if ((void*)&elem == ev->itemref) { launch_system(ui(), *m_uiinfo.driver, &m_uiinfo, &elem.first, nullptr); break; @@ -374,15 +373,14 @@ void menu_select_launch::bios_selection::populate(float &customtop, float &custo // handle //------------------------------------------------- -void menu_select_launch::bios_selection::handle() +void menu_select_launch::bios_selection::handle(event const *ev) { // process the menu - const event *menu_event = process(0); - if (menu_event && menu_event->iptkey == IPT_UI_SELECT && menu_event->itemref) + if (ev && (ev->iptkey == IPT_UI_SELECT) && ev->itemref) { for (auto & elem : m_bios) { - if ((void*)&elem.first == menu_event->itemref) + if ((void*)&elem.first == ev->itemref) { if (!m_software) { @@ -541,6 +539,7 @@ menu_select_launch::menu_select_launch(mame_ui_manager &mui, render_container &c , m_flags(256) { set_needs_prev_menu_item(false); + set_process_flags(PROCESS_LR_REPEAT); } @@ -636,7 +635,7 @@ void menu_select_launch::launch_system(mame_ui_manager &mui, game_driver const & mame_machine_manager::instance()->schedule_new_driver(driver); mui.machine().schedule_hard_reset(); - stack_reset(mui.machine()); + stack_reset(mui); } @@ -675,11 +674,11 @@ void menu_select_launch::custom_render(void *selectedref, float top, float botto tempbuf[0] = make_software_description(*swinfo, system); // next line is year, publisher - tempbuf[1] = string_format(_("%1$s, %2$-.100s"), swinfo->year, swinfo->publisher); + tempbuf[1] = string_format(_("%1$s, %2$s"), swinfo->year, swinfo->publisher); // next line is parent/clone if (!swinfo->parentname.empty()) - tempbuf[2] = string_format(_("Software is clone of: %1$-.100s"), !swinfo->parentlongname.empty() ? swinfo->parentlongname : swinfo->parentname); + tempbuf[2] = string_format(_("Software is clone of: %1$s"), !swinfo->parentlongname.empty() ? swinfo->parentlongname : swinfo->parentname); else tempbuf[2] = _("Software is parent"); @@ -706,7 +705,7 @@ void menu_select_launch::custom_render(void *selectedref, float top, float botto isstar = mame_machine_manager::instance()->favorite().is_favorite_system(driver); // first line is year, manufacturer - tempbuf[0] = string_format(_("%1$s, %2$-.100s"), driver.year, driver.manufacturer); + tempbuf[0] = string_format(_("%1$s, %2$s"), driver.year, driver.manufacturer); // next line is clone/parent status int cloneof = driver_list::non_bios_clone(driver); @@ -714,9 +713,9 @@ void menu_select_launch::custom_render(void *selectedref, float top, float botto if (0 > cloneof) tempbuf[1] = _("Driver is parent"); else if (system) - tempbuf[1] = string_format(_("Driver is clone of: %1$-.100s"), system->parent); + tempbuf[1] = string_format(_("Driver is clone of: %1$s"), system->parent); else - tempbuf[1] = string_format(_("Driver is clone of: %1$-.100s"), driver_list::driver(cloneof).type.fullname()); + tempbuf[1] = string_format(_("Driver is clone of: %1$s"), driver_list::driver(cloneof).type.fullname()); // next line is overall driver status system_flags const &flags(get_system_flags(driver)); @@ -1278,7 +1277,7 @@ void menu_select_launch::draw_toolbar(float x1, float y1, float x2, float y2) float const ypos = y2 + ui().get_line_height() + 2.0f * ui().box_tb_border(); ui().draw_text_box( container(), - have_parent ? _("Return to previous menu") : _("Exit"), + have_parent ? _("Return to Previous Menu") : _("Exit"), text_layout::text_justify::RIGHT, 1.0f - lr_border, ypos, ui().colors().background_color()); } @@ -1407,8 +1406,6 @@ void menu_select_launch::get_title_search(std::string &snaptext, std::string &se void menu_select_launch::handle_keys(uint32_t flags, int &iptkey) { - bool const ignorepause = stack_has_special_main_menu(); - // bail if no items if (item_count() == 0) return; @@ -1603,15 +1600,6 @@ void menu_select_launch::handle_keys(uint32_t flags, int &iptkey) rotate_focus(-1); } - // pause enables/disables pause - if (!m_ui_error && !ignorepause && exclusive_input_pressed(iptkey, IPT_UI_PAUSE, 0)) - { - if (machine().paused()) - machine().resume(); - else - machine().pause(); - } - // handle a toggle cheats request if (!m_ui_error && machine().ui_input().pressed_repeat(IPT_UI_TOGGLE_CHEAT, 0)) mame_machine_manager::instance()->cheat().set_enable(!mame_machine_manager::instance()->cheat().enabled()); @@ -1628,6 +1616,7 @@ void menu_select_launch::handle_keys(uint32_t flags, int &iptkey) { case IPT_UI_FOCUS_NEXT: case IPT_UI_FOCUS_PREV: + case IPT_UI_PAUSE: continue; case IPT_UI_LEFT: if (ignoreleft) @@ -1637,10 +1626,6 @@ void menu_select_launch::handle_keys(uint32_t flags, int &iptkey) if (ignoreright) continue; break; - case IPT_UI_PAUSE: - if (ignorepause) - continue; - break; } if (exclusive_input_pressed(iptkey, code, 0)) |