diff options
Diffstat (limited to 'src/frontend/mame/ui/custui.cpp')
-rw-r--r-- | src/frontend/mame/ui/custui.cpp | 94 |
1 files changed, 44 insertions, 50 deletions
diff --git a/src/frontend/mame/ui/custui.cpp b/src/frontend/mame/ui/custui.cpp index 65b1ad2fa5e..186a5bc1c2d 100644 --- a/src/frontend/mame/ui/custui.cpp +++ b/src/frontend/mame/ui/custui.cpp @@ -161,7 +161,7 @@ void menu_custom_ui::populate(float &customtop, float &custombottom) item_append(_("Show side panels"), _(HIDE_STATUS[ui_globals::panels_status]), arrow_flags, (void *)(uintptr_t)HIDE_MENU); item_append(menu_item_type::SEPARATOR); - customtop = ui().get_line_height() + 3.0f * ui().box_tb_border(); + customtop = ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; } //------------------------------------------------- @@ -173,9 +173,9 @@ void menu_custom_ui::custom_render(void *selectedref, float top, float bottom, f char const *const text[] = { _("Custom UI Settings") }; draw_text_box( std::begin(text), std::end(text), - origx1, origx2, origy1 - top, origy1 - ui().box_tb_border(), + origx1, origx2, origy1 - top, origy1 - UI_BOX_TB_BORDER, ui::text_layout::CENTER, ui::text_layout::TRUNCATE, false, - ui().colors().text_color(), UI_GREEN_COLOR, 1.0f); + UI_TEXT_COLOR, UI_GREEN_COLOR, 1.0f); } //------------------------------------------------- @@ -245,9 +245,6 @@ menu_font_ui::~menu_font_ui() machine().options().set_value(OPTION_UI_FONT, name, OPTION_PRIORITY_CMDLINE); moptions.set_value(OPTION_INFOS_SIZE, m_info_size, OPTION_PRIORITY_CMDLINE); moptions.set_value(OPTION_FONT_ROWS, m_font_size, OPTION_PRIORITY_CMDLINE); - - // OPTION_FONT_ROWS was changed; update the font info - ui().update_target_font_height(); } //------------------------------------------------- @@ -352,7 +349,7 @@ void menu_font_ui::populate(float &customtop, float &custombottom) item_append(menu_item_type::SEPARATOR); - custombottom = customtop = ui().get_line_height() + 3.0f * ui().box_tb_border(); + custombottom = customtop = ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; } //------------------------------------------------- @@ -365,25 +362,25 @@ void menu_font_ui::custom_render(void *selectedref, float top, float bottom, flo char const *const toptext[] = { _("UI Fonts Settings") }; draw_text_box( std::begin(toptext), std::end(toptext), - origx1, origx2, origy1 - top, origy1 - ui().box_tb_border(), + origx1, origx2, origy1 - top, origy1 - UI_BOX_TB_BORDER, ui::text_layout::CENTER, ui::text_layout::TRUNCATE, false, - ui().colors().text_color(), UI_GREEN_COLOR, 1.0f); + UI_TEXT_COLOR, UI_GREEN_COLOR, 1.0f); if (uintptr_t(selectedref) == INFOS_SIZE) { char const *const bottomtext[] = { _("Sample text - Lorem ipsum dolor sit amet, consectetur adipiscing elit.") }; draw_text_box( std::begin(bottomtext), std::end(bottomtext), - origx1, origx2, origy2 + ui().box_tb_border(), origy2 + bottom, + origx1, origx2, origy2 + UI_BOX_TB_BORDER, origy2 + bottom, ui::text_layout::LEFT, ui::text_layout::NEVER, false, - ui().colors().text_color(), UI_GREEN_COLOR, m_info_size); + UI_TEXT_COLOR, UI_GREEN_COLOR, m_info_size); } } //------------------------------------------------- // ctor //------------------------------------------------- -#define SET_COLOR_UI(var, opt) var[M##opt].color = mui.options().rgb_value(OPTION_##opt); var[M##opt].option = OPTION_##opt +#define SET_COLOR_UI(var, opt) var[M##opt].color = opt; var[M##opt].option = OPTION_##opt menu_colors_ui::menu_colors_ui(mame_ui_manager &mui, render_container &container) : menu(mui, container) { @@ -417,9 +414,6 @@ menu_colors_ui::~menu_colors_ui() dec_color = string_format("%x", (uint32_t)m_color_table[index].color); ui().options().set_value(m_color_table[index].option, dec_color.c_str(), OPTION_PRIORITY_CMDLINE); } - - // refresh our cached colors - ui().colors().refresh(ui().options()); } //------------------------------------------------- @@ -474,7 +468,7 @@ void menu_colors_ui::populate(float &customtop, float &custombottom) item_append(menu_item_type::SEPARATOR); item_append(_("Restore originals colors"), "", 0, (void *)(uintptr_t)MUI_RESTORE); - custombottom = customtop = ui().get_line_height() + 3.0f * ui().box_tb_border(); + custombottom = customtop = ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; } //------------------------------------------------- @@ -487,18 +481,18 @@ void menu_colors_ui::custom_render(void *selectedref, float top, float bottom, f char const *const toptext[] = { _("UI Colors Settings") }; draw_text_box( std::begin(toptext), std::end(toptext), - origx1, origx2, origy1 - top, origy1 - ui().box_tb_border(), + origx1, origx2, origy1 - top, origy1 - UI_BOX_TB_BORDER, ui::text_layout::CENTER, ui::text_layout::TRUNCATE, false, - ui().colors().text_color(), UI_GREEN_COLOR, 1.0f); + UI_TEXT_COLOR, UI_GREEN_COLOR, 1.0f); // bottom text // get the text for 'UI Select' std::string const bottomtext[] = { util::string_format(_("Double click or press %1$s to change the color value"), machine().input().seq_name(machine().ioport().type_seq(IPT_UI_SELECT, 0, SEQ_TYPE_STANDARD))) }; draw_text_box( std::begin(bottomtext), std::end(bottomtext), - origx1, origx2, origy2 + ui().box_tb_border(), origy2 + bottom, + origx1, origx2, origy2 + UI_BOX_TB_BORDER, origy2 + bottom, ui::text_layout::CENTER, ui::text_layout::TRUNCATE, false, - ui().colors().text_color(), UI_RED_COLOR, 1.0f); + UI_TEXT_COLOR, UI_RED_COLOR, 1.0f); // compute maxwidth char const *const topbuf = _("Menu Preview"); @@ -506,7 +500,7 @@ void menu_colors_ui::custom_render(void *selectedref, float top, float bottom, f float width; ui().draw_text_full(container(), topbuf, 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::NEVER, mame_ui_manager::NONE, rgb_t::white(), rgb_t::black(), &width, nullptr); - float maxwidth = width + 2.0f * ui().box_lr_border(); + float maxwidth = width + 2.0f * UI_BOX_LR_BORDER; std::string sampletxt[5]; @@ -520,43 +514,43 @@ void menu_colors_ui::custom_render(void *selectedref, float top, float bottom, f { ui().draw_text_full(container(), elem.c_str(), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::NEVER, mame_ui_manager::NONE, rgb_t::white(), rgb_t::black(), &width, nullptr); - width += 2 * ui().box_lr_border(); + width += 2 * UI_BOX_LR_BORDER; maxwidth = std::max(maxwidth, width); } // compute our bounds for header - float x1 = origx2 + 2.0f * ui().box_lr_border(); + float x1 = origx2 + 2.0f * UI_BOX_LR_BORDER; float x2 = x1 + maxwidth; float y1 = origy1; - float y2 = y1 + bottom - ui().box_tb_border(); + float y2 = y1 + bottom - 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(); - y2 -= ui().box_tb_border(); + x1 += UI_BOX_LR_BORDER; + x2 -= UI_BOX_LR_BORDER; + y1 += UI_BOX_TB_BORDER; + y2 -= UI_BOX_TB_BORDER; // draw the text within it ui().draw_text_full(container(), topbuf, x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::NEVER, - mame_ui_manager::NORMAL, ui().colors().text_color(), ui().colors().text_bg_color(), nullptr, nullptr); + mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); // compute our bounds for menu preview float line_height = ui().get_line_height(); - x1 -= ui().box_lr_border(); - x2 += ui().box_lr_border(); - y1 = y2 + 2.0f * ui().box_tb_border(); - y2 = y1 + 5.0f * line_height + 2.0f * ui().box_tb_border(); + x1 -= UI_BOX_LR_BORDER; + x2 += UI_BOX_LR_BORDER; + y1 = y2 + 2.0f * UI_BOX_TB_BORDER; + y2 = y1 + 5.0f * line_height + 2.0f * UI_BOX_TB_BORDER; // draw a box ui().draw_outlined_box(container(), x1, y1, x2, y2, m_color_table[MUI_BACKGROUND_COLOR].color); // take off the borders - x1 += ui().box_lr_border(); - x2 -= ui().box_lr_border(); - y1 += ui().box_tb_border(); + x1 += UI_BOX_LR_BORDER; + x2 -= UI_BOX_LR_BORDER; + y1 += UI_BOX_TB_BORDER; // draw normal text ui().draw_text_full(container(), sampletxt[0].c_str(), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::NEVER, @@ -781,7 +775,7 @@ void menu_rgb_ui::populate(float &customtop, float &custombottom) item_append(_("Choose from palette"), "", 0, (void *)(uintptr_t)PALETTE_CHOOSE); item_append(menu_item_type::SEPARATOR); - custombottom = customtop = ui().get_line_height() + 3.0f * ui().box_tb_border(); + custombottom = customtop = ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; } //------------------------------------------------- @@ -795,52 +789,52 @@ void menu_rgb_ui::custom_render(void *selectedref, float top, float bottom, floa // top text ui().draw_text_full(container(), m_title.c_str(), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::NEVER, mame_ui_manager::NONE, rgb_t::white(), rgb_t::black(), &width); - width += 2 * ui().box_lr_border(); + width += 2 * UI_BOX_LR_BORDER; maxwidth = std::max(maxwidth, 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(); + 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(); + 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_title.c_str(), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::NEVER, - mame_ui_manager::NORMAL, ui().colors().text_color(), ui().colors().text_bg_color()); + mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR); std::string sampletxt(_("Color preview =")); ui().draw_text_full(container(), sampletxt.c_str(), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::NEVER, mame_ui_manager::NONE, rgb_t::white(), rgb_t::black(), &width); - width += 2 * ui().box_lr_border(); + width += 2 * UI_BOX_LR_BORDER; maxwidth = std::max(origx2 - origx1, width); // compute our bounds x1 = 0.5f - 0.5f * maxwidth; x2 = x1 + maxwidth; - y1 = origy2 + ui().box_tb_border(); + y1 = origy2 + UI_BOX_TB_BORDER; y2 = origy2 + bottom; // draw a box ui().draw_outlined_box(container(), x1, y1, x1 + width, y2, UI_RED_COLOR); // take off the borders - x1 += ui().box_lr_border(); - y1 += ui().box_tb_border(); + x1 += UI_BOX_LR_BORDER; + y1 += UI_BOX_TB_BORDER; // draw the normal text - ui().draw_text_full(container(), sampletxt.c_str(), x1, y1, width - ui().box_lr_border(), ui::text_layout::CENTER, ui::text_layout::NEVER, + ui().draw_text_full(container(), sampletxt.c_str(), x1, y1, width - UI_BOX_LR_BORDER, ui::text_layout::CENTER, ui::text_layout::NEVER, mame_ui_manager::NORMAL, rgb_t::white(), rgb_t::black()); - x1 += width + ui().box_lr_border(); - y1 -= ui().box_tb_border(); + x1 += width + UI_BOX_LR_BORDER; + y1 -= UI_BOX_TB_BORDER; // draw color box ui().draw_outlined_box(container(), x1, y1, x2, y2, *m_color); |