From dd673e6fa64347e1ed8a58fd8408bf36898e07ba Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Mon, 7 Aug 2017 17:00:24 +1000 Subject: internal UI improvements: * Greatly reduce copy/paste code for drawing menu header/footer boxes * Display full name of selected slot device below slots menu * Fix up spacing on dircetory configuration menu * Fix min/max for UI font rows per screen setting --- src/frontend/mame/ui/submenu.cpp | 67 ++++++++++------------------------------ 1 file changed, 16 insertions(+), 51 deletions(-) (limited to 'src/frontend/mame/ui/submenu.cpp') diff --git a/src/frontend/mame/ui/submenu.cpp b/src/frontend/mame/ui/submenu.cpp index 8bc4aed0def..367fb429a53 100644 --- a/src/frontend/mame/ui/submenu.cpp +++ b/src/frontend/mame/ui/submenu.cpp @@ -423,59 +423,24 @@ void submenu::populate(float &customtop, float &custombottom) void submenu::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) { - float width; - - ui().draw_text_full(container(), _(m_options[0].description), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::TRUNCATE, - mame_ui_manager::NONE, rgb_t::white(), rgb_t::black(), &width, nullptr); - width += 2 * UI_BOX_LR_BORDER; - float maxwidth = std::max(origx2 - origx1, width); - - // compute our bounds - float x1 = 0.5f - 0.5f * maxwidth; - float x2 = x1 + maxwidth; - float y1 = origy1 - top; - float y2 = origy1 - UI_BOX_TB_BORDER; - - // draw a box - ui().draw_outlined_box(container(), x1, y1, x2, y2, UI_GREEN_COLOR); - - // take off the borders - x1 += UI_BOX_LR_BORDER; - x2 -= UI_BOX_LR_BORDER; - y1 += UI_BOX_TB_BORDER; - - // draw the text within it - ui().draw_text_full(container(), _(m_options[0].description), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::TRUNCATE, - mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); - - if (selectedref != nullptr) + char const *const toptext[] = { _(m_options[0].description) }; + draw_text_box( + std::begin(toptext), std::end(toptext), + origx1, origx2, origy1 - top, origy1 - UI_BOX_TB_BORDER, + ui::text_layout::CENTER, ui::text_layout::TRUNCATE, false, + UI_TEXT_COLOR, UI_GREEN_COLOR, 1.0f); + + if (selectedref) { - option &selected_sm_option = *reinterpret_cast