From c9b8f7454849ba2c92b9b5f745629a3f47ae9783 Mon Sep 17 00:00:00 2001 From: Nathan Woods Date: Tue, 14 Jun 2016 00:00:30 -0400 Subject: [PATCH] Incorporating Vas Crabb feedback --- src/frontend/mame/ui/filesel.cpp | 5 ++++- src/frontend/mame/ui/filesel.h | 4 +++- src/frontend/mame/ui/menu.cpp | 4 +++- src/frontend/mame/ui/menu.h | 4 +++- src/frontend/mame/ui/text.cpp | 4 ++-- src/frontend/mame/ui/text.h | 2 ++ 6 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/frontend/mame/ui/filesel.cpp b/src/frontend/mame/ui/filesel.cpp index bf44b364e53..61f3f8d5fb2 100644 --- a/src/frontend/mame/ui/filesel.cpp +++ b/src/frontend/mame/ui/filesel.cpp @@ -364,13 +364,16 @@ void menu_file_selector::custom_render(void *selectedref, float top, float botto // custom_mouse_down - perform our special mouse down //------------------------------------------------- -void menu_file_selector::custom_mouse_down() +bool menu_file_selector::custom_mouse_down() { if (m_hover_directory.length() > 0) { m_current_directory = m_hover_directory; reset(reset_options::SELECT_FIRST); + return true; } + + return false; } diff --git a/src/frontend/mame/ui/filesel.h b/src/frontend/mame/ui/filesel.h index 1a5ba962779..66be755f699 100644 --- a/src/frontend/mame/ui/filesel.h +++ b/src/frontend/mame/ui/filesel.h @@ -68,7 +68,9 @@ public: virtual void populate() override; virtual void handle() override; virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override; - virtual void custom_mouse_down() override; + +protected: + virtual bool custom_mouse_down() override; private: enum file_selector_entry_type diff --git a/src/frontend/mame/ui/menu.cpp b/src/frontend/mame/ui/menu.cpp index ae8625a8835..d6c53638a44 100644 --- a/src/frontend/mame/ui/menu.cpp +++ b/src/frontend/mame/ui/menu.cpp @@ -914,7 +914,9 @@ void menu::handle_events(UINT32 flags) { // if we are hovering over a valid item, select it with a single click case UI_EVENT_MOUSE_DOWN: - custom_mouse_down(); + if (custom_mouse_down()) + return; + if ((flags & PROCESS_ONLYCHAR) == 0) { if (hover >= 0 && hover < item.size()) diff --git a/src/frontend/mame/ui/menu.h b/src/frontend/mame/ui/menu.h index 0353060da5f..cf68cbcea75 100644 --- a/src/frontend/mame/ui/menu.h +++ b/src/frontend/mame/ui/menu.h @@ -70,7 +70,6 @@ public: // configure the menu for custom rendering virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2); - virtual void custom_mouse_down() { } // allocate temporary memory from the menu's memory pool void *m_pool_alloc(size_t size); @@ -288,6 +287,9 @@ protected: void extra_text_position(float origx1, float origx2, float origy, float yspan, text_layout &layout, int direction, float &x1, float &y1, float &x2, float &y2); + // custom events + virtual bool custom_mouse_down() { return false; } + template static T *topmost_menu() { return dynamic_cast(menu_stack.get()); } diff --git a/src/frontend/mame/ui/text.cpp b/src/frontend/mame/ui/text.cpp index b535ff552ff..c029c410ff4 100644 --- a/src/frontend/mame/ui/text.cpp +++ b/src/frontend/mame/ui/text.cpp @@ -22,7 +22,7 @@ INLINE FUNCTIONS // is_space_character //------------------------------------------------- -static inline bool is_space_character(unicode_char ch) +inline bool is_space_character(unicode_char ch) { return ch == ' '; } @@ -33,7 +33,7 @@ static inline bool is_space_character(unicode_char ch) // character a possible line break? //------------------------------------------------- -static inline bool is_breakable_char(unicode_char ch) +inline bool is_breakable_char(unicode_char ch) { // regular spaces and hyphens are breakable if (is_space_character(ch) || ch == '-') diff --git a/src/frontend/mame/ui/text.h b/src/frontend/mame/ui/text.h index a77fbf2620e..791aff9b112 100644 --- a/src/frontend/mame/ui/text.h +++ b/src/frontend/mame/ui/text.h @@ -93,6 +93,8 @@ private: size_t span; }; + // this should really be "positioned glyph" as glyphs != characters, but + // we'll get there eventually struct positioned_char { unicode_char character;