diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/emu/ui/menu.cpp | 4 | ||||
-rw-r--r-- | src/emu/ui/selgame.cpp | 31 | ||||
-rw-r--r-- | src/emu/ui/selgame.h | 3 | ||||
-rw-r--r-- | src/emu/ui/selsoft.cpp | 4 | ||||
-rw-r--r-- | src/emu/ui/ui.cpp | 14 | ||||
-rw-r--r-- | src/emu/ui/ui.h | 5 |
6 files changed, 23 insertions, 38 deletions
diff --git a/src/emu/ui/menu.cpp b/src/emu/ui/menu.cpp index f9094824534..1d8ae588c0f 100644 --- a/src/emu/ui/menu.cpp +++ b/src/emu/ui/menu.cpp @@ -1420,7 +1420,7 @@ void ui_menu::draw_select_game(bool noinput) { float line_height = machine().ui().get_line_height(); float ud_arrow_width = line_height * machine().render().ui_aspect(); - float gutter_width = 0.52f * line_height * machine().render().ui_aspect(); + float gutter_width = 0.52f * ud_arrow_width; mouse_x = -1, mouse_y = -1; float right_panel_size = (ui_globals::panels_status == HIDE_BOTH || ui_globals::panels_status == HIDE_RIGHT_PANEL) ? 2.0f * UI_BOX_LR_BORDER : 0.3f; float visible_width = 1.0f - 4.0f * UI_BOX_LR_BORDER; @@ -1579,7 +1579,7 @@ void ui_menu::draw_select_game(bool noinput) else draw_icon(linenum, item[itemnum].ref, effective_left, line_y); - space = mui.get_line_height() * container->manager().ui_aspect() * 1.5f; + space = ud_arrow_width * 1.5f; } mui.draw_text_full(container, itemtext, effective_left + space, line_y, effective_width - space, JUSTIFY_LEFT, WRAP_TRUNCATE, DRAW_NORMAL, item_invert ? fgcolor3 : fgcolor, bgcolor, nullptr, nullptr); diff --git a/src/emu/ui/selgame.cpp b/src/emu/ui/selgame.cpp index 8560bb846af..daaa072f9ef 100644 --- a/src/emu/ui/selgame.cpp +++ b/src/emu/ui/selgame.cpp @@ -496,7 +496,6 @@ void ui_menu_select_game::populate() // reset search string m_search[0] = '\0'; m_displaylist.clear(); - m_tmp.clear(); // if filter is set on category, build category list switch (main_filters::actual) @@ -505,16 +504,16 @@ void ui_menu_select_game::populate() build_category(); break; case FILTER_MANUFACTURER: - build_list(m_tmp, c_mnfct::ui[c_mnfct::actual].c_str()); + build_list(c_mnfct::ui[c_mnfct::actual].c_str()); break; case FILTER_YEAR: - build_list(m_tmp, c_year::ui[c_year::actual].c_str()); + build_list(c_year::ui[c_year::actual].c_str()); break; case FILTER_CUSTOM: build_custom(); break; default: - build_list(m_tmp); + build_list(); break; } @@ -1280,7 +1279,7 @@ void ui_menu_select_game::inkey_configure(const ui_menu_event *m_event) // build list //------------------------------------------------- -void ui_menu_select_game::build_list(std::vector<const game_driver *> &s_drivers, const char *filter_text, int filter, bool bioscheck) +void ui_menu_select_game::build_list(const char *filter_text, int filter, bool bioscheck, std::vector<const game_driver *> s_drivers) { int cx = 0; bool cloneof = false; @@ -1444,13 +1443,13 @@ void ui_menu_select_game::build_custom() switch (filter) { case FILTER_YEAR: - build_list(s_drivers, c_year::ui[custfltr::year[count]].c_str(), filter, bioscheck); + build_list(c_year::ui[custfltr::year[count]].c_str(), filter, bioscheck, s_drivers); break; case FILTER_MANUFACTURER: - build_list(s_drivers, c_mnfct::ui[custfltr::mnfct[count]].c_str(), filter, bioscheck); + build_list(c_mnfct::ui[custfltr::mnfct[count]].c_str(), filter, bioscheck, s_drivers); break; default: - build_list(s_drivers, nullptr, filter, bioscheck); + build_list(nullptr, filter, bioscheck, s_drivers); break; } } @@ -1462,14 +1461,14 @@ void ui_menu_select_game::build_custom() void ui_menu_select_game::build_category() { + m_displaylist.clear(); std::vector<int> temp_filter; machine().inifile().load_ini_category(temp_filter); for (auto actual : temp_filter) - m_tmp.push_back(&driver_list::driver(actual)); + m_displaylist.push_back(&driver_list::driver(actual)); - std::stable_sort(m_tmp.begin(), m_tmp.end(), sorted_game_list); - m_displaylist = m_tmp; + std::stable_sort(m_displaylist.begin(), m_displaylist.end(), sorted_game_list); } //------------------------------------------------- @@ -1780,7 +1779,7 @@ float ui_menu_select_game::draw_left_panel(float x1, float y1, float x2, float y { float origy1 = y1; float origy2 = y2; - float text_size = 0.75f; + float text_size = machine().ui().options().infos_size(); float line_height_max = line_height * text_size; float left_width = 0.0f; int text_lenght = main_filters::length; @@ -1796,13 +1795,13 @@ float ui_menu_select_game::draw_left_panel(float x1, float y1, float x2, float y line_height_max = line_height * text_size; } - float text_sign = mui.get_string_width_ex("_# ", text_size); + float text_sign = mui.get_string_width("_# ", text_size); for (int x = 0; x < text_lenght; ++x) { float total_width; // compute width of left hand side - total_width = mui.get_string_width_ex(text[x], text_size); + total_width = mui.get_string_width(text[x], text_size); total_width += text_sign; // track the maximum @@ -2076,7 +2075,7 @@ void ui_menu_select_game::infos_render(void *selectedref, float origx1, float or else if (ui_globals::curdats_view == UI_STORY_LOAD) { // check size - float textlen = mui.get_string_width_ex(tempbuf.c_str(), text_size); + float textlen = mui.get_string_width(tempbuf.c_str(), text_size); float tmp_size = (textlen > sc) ? text_size * (sc / textlen) : text_size; size_t last_underscore = tempbuf.find_last_of("_"); @@ -2106,7 +2105,7 @@ void ui_menu_select_game::infos_render(void *selectedref, float origx1, float or else if (ui_globals::curdats_view == UI_COMMAND_LOAD || ui_globals::curdats_view == UI_GENERAL_LOAD) { // check size - float textlen = mui.get_string_width_ex(tempbuf.c_str(), text_size); + float textlen = mui.get_string_width(tempbuf.c_str(), text_size); float tmp_size = (textlen > sc) ? text_size * (sc / textlen) : text_size; int first_dspace = (ui_globals::curdats_view == UI_COMMAND_LOAD) ? tempbuf.find(" ") : tempbuf.find(":"); diff --git a/src/emu/ui/selgame.h b/src/emu/ui/selgame.h index 6db7b23ebeb..11dee880927 100644 --- a/src/emu/ui/selgame.h +++ b/src/emu/ui/selgame.h @@ -53,7 +53,6 @@ private: std::vector<const game_driver *> m_availsortedlist; std::vector<const game_driver *> m_unavailsortedlist; std::vector<const game_driver *> m_displaylist; - std::vector<const game_driver *> m_tmp; const game_driver *m_searchlist[VISIBLE_GAMES_IN_SEARCH + 1]; @@ -61,7 +60,7 @@ private: void build_custom(); void build_category(); void build_available_list(); - void build_list(std::vector<const game_driver *> &vec, const char *filter_text = nullptr, int filter = 0, bool bioscheck = false); + void build_list(const char *filter_text = nullptr, int filter = 0, bool bioscheck = false, std::vector<const game_driver *> vec = {}); bool isfavorite(); void populate_search(); diff --git a/src/emu/ui/selsoft.cpp b/src/emu/ui/selsoft.cpp index c4d2fab576a..5aaf00422c0 100644 --- a/src/emu/ui/selsoft.cpp +++ b/src/emu/ui/selsoft.cpp @@ -1415,13 +1415,13 @@ float ui_menu_select_software::draw_left_panel(float x1, float y1, float x2, flo line_height = l_height * text_size; } - float text_sign = mui.get_string_width_ex("_# ", text_size); + float text_sign = mui.get_string_width("_# ", text_size); for (int x = 0; x < text_lenght; ++x) { float total_width; // compute width of left hand side - total_width = mui.get_string_width_ex(text[x], text_size); + total_width = mui.get_string_width(text[x], text_size); total_width += text_sign; // track the maximum diff --git a/src/emu/ui/ui.cpp b/src/emu/ui/ui.cpp index b8ad5ee7f9c..2112f8ad553 100644 --- a/src/emu/ui/ui.cpp +++ b/src/emu/ui/ui.cpp @@ -602,9 +602,9 @@ float ui_manager::get_char_width(unicode_char ch) // character string //------------------------------------------------- -float ui_manager::get_string_width(const char *s) +float ui_manager::get_string_width(const char *s, float text_size) { - return get_font()->utf8string_width(get_line_height(), machine().render().ui_aspect(), s); + return get_font()->utf8string_width(get_line_height() * text_size, machine().render().ui_aspect(), s); } @@ -2685,16 +2685,6 @@ void ui_manager::draw_textured_box(render_container *container, float x0, float } //------------------------------------------------- -// get_string_width_ex - return the width of a -// character string with given text size -//------------------------------------------------- - -float ui_manager::get_string_width_ex(const char *s, float text_size) -{ - return get_font()->utf8string_width(get_line_height() * text_size, machine().render().ui_aspect(), s); -} - -//------------------------------------------------- // decode UI color options //------------------------------------------------- diff --git a/src/emu/ui/ui.h b/src/emu/ui/ui.h index 9af361c8cc5..ad6c3d11ae1 100644 --- a/src/emu/ui/ui.h +++ b/src/emu/ui/ui.h @@ -140,7 +140,7 @@ public: render_font *get_font(); float get_line_height(); float get_char_width(unicode_char ch); - float get_string_width(const char *s); + float get_string_width(const char *s, float text_size = 1.0f); void draw_outlined_box(render_container *container, float x0, float y0, float x1, float y1, rgb_t backcolor); void draw_outlined_box(render_container *container, float x0, float y0, float x1, float y1, rgb_t fgcolor, rgb_t bgcolor); void draw_text(render_container *container, const char *buf, float x, float y); @@ -186,9 +186,6 @@ public: // draw an outlined box with given line color and filled with a texture void draw_textured_box(render_container *container, float x0, float y0, float x1, float y1, rgb_t backcolor, rgb_t linecolor, render_texture *texture = nullptr, UINT32 flags = PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); - // return text string width with given text size - float get_string_width_ex(const char *s, float text_size); - private: // instance variables running_machine & m_machine; |