mirror of
https://github.com/holub/mame
synced 2025-04-20 23:42:22 +03:00
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
This commit is contained in:
parent
8a209caeeb
commit
dd673e6fa6
@ -206,31 +206,12 @@ void menu_custom_filter::populate(float &customtop, float &custombottom)
|
||||
//-------------------------------------------------
|
||||
void menu_custom_filter::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2)
|
||||
{
|
||||
float width;
|
||||
|
||||
// get the size of the text
|
||||
ui().draw_text_full(container(), _("Select custom filters:"), 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.0f * UI_BOX_LR_BORDER) + 0.01f;
|
||||
float maxwidth = std::max(width, origx2 - origx1);
|
||||
|
||||
// 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(), _("Select custom filters:"), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::NEVER,
|
||||
mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr);
|
||||
char const *const text[] = { _("Select custom filters:") };
|
||||
draw_text_box(
|
||||
std::begin(text), std::end(text),
|
||||
origx1, origx2, origy1 - top, origy1 - UI_BOX_TB_BORDER,
|
||||
ui::text_layout::CENTER, ui::text_layout::NEVER, false,
|
||||
UI_TEXT_COLOR, UI_GREEN_COLOR, 1.0f);
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
@ -521,31 +502,12 @@ void menu_swcustom_filter::populate(float &customtop, float &custombottom)
|
||||
//-------------------------------------------------
|
||||
void menu_swcustom_filter::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2)
|
||||
{
|
||||
float width;
|
||||
|
||||
// get the size of the text
|
||||
ui().draw_text_full(container(), _("Select custom filters:"), 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.0f * UI_BOX_LR_BORDER) + 0.01f;
|
||||
float maxwidth = std::max(width, origx2 - origx1);
|
||||
|
||||
// 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(), _("Select custom filters:"), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::NEVER,
|
||||
mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr);
|
||||
char const *const text[] = { _("Select custom filters:") };
|
||||
draw_text_box(
|
||||
std::begin(text), std::end(text),
|
||||
origx1, origx2, origy1 - top, origy1 - UI_BOX_TB_BORDER,
|
||||
ui::text_layout::CENTER, ui::text_layout::NEVER, false,
|
||||
UI_TEXT_COLOR, UI_GREEN_COLOR, 1.0f);
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
|
@ -160,30 +160,12 @@ void menu_custom_ui::populate(float &customtop, float &custombottom)
|
||||
|
||||
void menu_custom_ui::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2)
|
||||
{
|
||||
float width;
|
||||
|
||||
ui().draw_text_full(container(), _("Custom UI Settings"), 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(), _("Custom UI Settings"), 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);
|
||||
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,
|
||||
ui::text_layout::CENTER, ui::text_layout::TRUNCATE, false,
|
||||
UI_TEXT_COLOR, UI_GREEN_COLOR, 1.0f);
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
@ -216,7 +198,7 @@ menu_font_ui::menu_font_ui(mame_ui_manager &mui, render_container &container) :
|
||||
m_info_max = atof(moptions.get_entry(OPTION_INFOS_SIZE)->maximum());
|
||||
m_info_min = atof(moptions.get_entry(OPTION_INFOS_SIZE)->minimum());
|
||||
m_font_max = atof(moptions.get_entry(OPTION_FONT_ROWS)->maximum());
|
||||
m_font_max = atof(moptions.get_entry(OPTION_FONT_ROWS)->minimum());
|
||||
m_font_min = atof(moptions.get_entry(OPTION_FONT_ROWS)->minimum());
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
@ -359,60 +341,22 @@ void menu_font_ui::populate(float &customtop, float &custombottom)
|
||||
|
||||
void menu_font_ui::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2)
|
||||
{
|
||||
float width;
|
||||
|
||||
// top text
|
||||
std::string topbuf(_("UI Fonts Settings"));
|
||||
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,
|
||||
ui::text_layout::CENTER, ui::text_layout::TRUNCATE, false,
|
||||
UI_TEXT_COLOR, UI_GREEN_COLOR, 1.0f);
|
||||
|
||||
ui().draw_text_full(container(), topbuf.c_str(), 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(), topbuf.c_str(), 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 ((uintptr_t)selectedref == INFOS_SIZE)
|
||||
if (uintptr_t(selectedref) == INFOS_SIZE)
|
||||
{
|
||||
topbuf = _("Sample text - Lorem ipsum dolor sit amet, consectetur adipiscing elit.");
|
||||
|
||||
ui().draw_text_full(container(), topbuf.c_str(), 0.0f, 0.0f, 1.0f, ui::text_layout::LEFT, ui::text_layout::NEVER,
|
||||
mame_ui_manager::NONE, rgb_t::white(), rgb_t::black(), &width, nullptr, m_info_size);
|
||||
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;
|
||||
y2 = origy2 + bottom;
|
||||
|
||||
// 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(), topbuf.c_str(), x1, y1, x2 - x1, ui::text_layout::LEFT, ui::text_layout::NEVER,
|
||||
mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr, m_info_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,
|
||||
ui::text_layout::LEFT, ui::text_layout::NEVER, false,
|
||||
UI_TEXT_COLOR, UI_GREEN_COLOR, m_info_size);
|
||||
}
|
||||
}
|
||||
|
||||
@ -516,69 +460,30 @@ void menu_colors_ui::populate(float &customtop, float &custombottom)
|
||||
|
||||
void menu_colors_ui::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2)
|
||||
{
|
||||
float width, maxwidth = origx2 - origx1;
|
||||
float line_height = ui().get_line_height();
|
||||
|
||||
// top text
|
||||
std::string topbuf(_("UI Colors Settings"));
|
||||
|
||||
ui().draw_text_full(container(), topbuf.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;
|
||||
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;
|
||||
|
||||
// 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(), topbuf.c_str(), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::NEVER,
|
||||
mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr);
|
||||
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,
|
||||
ui::text_layout::CENTER, ui::text_layout::TRUNCATE, false,
|
||||
UI_TEXT_COLOR, UI_GREEN_COLOR, 1.0f);
|
||||
|
||||
// bottom text
|
||||
// get the text for 'UI Select'
|
||||
std::string ui_select_text = machine().input().seq_name(machine().ioport().type_seq(IPT_UI_SELECT, 0, SEQ_TYPE_STANDARD));
|
||||
topbuf = string_format(_("Double click or press %1$s to change the color value"), ui_select_text);
|
||||
|
||||
ui().draw_text_full(container(), topbuf.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;
|
||||
maxwidth = std::max(maxwidth, width);
|
||||
|
||||
// compute our bounds
|
||||
x1 = 0.5f - 0.5f * maxwidth;
|
||||
x2 = x1 + maxwidth;
|
||||
y1 = origy2 + UI_BOX_TB_BORDER;
|
||||
y2 = origy2 + bottom;
|
||||
|
||||
// draw a box
|
||||
ui().draw_outlined_box(container(), x1, y1, x2, y2, UI_RED_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(), topbuf.c_str(), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::NEVER,
|
||||
mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr);
|
||||
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,
|
||||
ui::text_layout::CENTER, ui::text_layout::TRUNCATE, false,
|
||||
UI_TEXT_COLOR, UI_RED_COLOR, 1.0f);
|
||||
|
||||
// compute maxwidth
|
||||
topbuf = _("Menu Preview");
|
||||
char const *const topbuf = _("Menu Preview");
|
||||
|
||||
ui().draw_text_full(container(), topbuf.c_str(), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::NEVER,
|
||||
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);
|
||||
maxwidth = width + 2.0f * UI_BOX_LR_BORDER;
|
||||
float maxwidth = width + 2.0f * UI_BOX_LR_BORDER;
|
||||
|
||||
std::string sampletxt[5];
|
||||
|
||||
@ -597,10 +502,10 @@ void menu_colors_ui::custom_render(void *selectedref, float top, float bottom, f
|
||||
}
|
||||
|
||||
// compute our bounds for header
|
||||
x1 = origx2 + 2.0f * UI_BOX_LR_BORDER;
|
||||
x2 = x1 + maxwidth;
|
||||
y1 = origy1;
|
||||
y2 = y1 + bottom - UI_BOX_TB_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;
|
||||
|
||||
// draw a box
|
||||
ui().draw_outlined_box(container(), x1, y1, x2, y2, UI_GREEN_COLOR);
|
||||
@ -612,10 +517,11 @@ void menu_colors_ui::custom_render(void *selectedref, float top, float bottom, f
|
||||
y2 -= UI_BOX_TB_BORDER;
|
||||
|
||||
// draw the text within it
|
||||
ui().draw_text_full(container(), topbuf.c_str(), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::NEVER,
|
||||
ui().draw_text_full(container(), topbuf, x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::NEVER,
|
||||
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;
|
||||
|
@ -113,31 +113,12 @@ void menu_directory::populate(float &customtop, float &custombottom)
|
||||
|
||||
void menu_directory::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2)
|
||||
{
|
||||
float width;
|
||||
|
||||
// get the size of the text
|
||||
ui().draw_text_full(container(), _("Folders Setup"), 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.0f * UI_BOX_LR_BORDER) + 0.01f;
|
||||
float maxwidth = std::max(width, origx2 - origx1);
|
||||
|
||||
// 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(), _("Folders Setup"), 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);
|
||||
char const *const toptext[] = { _("Folders Setup") };
|
||||
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);
|
||||
}
|
||||
|
||||
/**************************************************
|
||||
@ -183,7 +164,7 @@ void menu_display_actual::handle()
|
||||
|
||||
void menu_display_actual::populate(float &customtop, float &custombottom)
|
||||
{
|
||||
m_tempbuf = string_format(_("Current %1$s Folders"), _(s_folders[m_ref].name));
|
||||
m_heading[0] = string_format(_("Current %1$s Folders"), _(s_folders[m_ref].name));
|
||||
if (ui().options().exists(s_folders[m_ref].option))
|
||||
m_searchpath.assign(ui().options().value(s_folders[m_ref].option));
|
||||
else
|
||||
@ -210,61 +191,17 @@ void menu_display_actual::populate(float &customtop, float &custombottom)
|
||||
|
||||
void menu_display_actual::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2)
|
||||
{
|
||||
float width, maxwidth = origx2 - origx1;
|
||||
float lineh = ui().get_line_height();
|
||||
|
||||
for (auto & elem : m_folders)
|
||||
{
|
||||
ui().draw_text_full(container(), elem.c_str(), 0.0f, 0.0f, 1.0f, ui::text_layout::LEFT, ui::text_layout::TRUNCATE, mame_ui_manager::NONE, rgb_t::white(), rgb_t::black(), &width, nullptr);
|
||||
width += (2.0f * UI_BOX_LR_BORDER) + 0.01f;
|
||||
maxwidth = std::max(maxwidth, width);
|
||||
}
|
||||
|
||||
// get the size of the text
|
||||
ui().draw_text_full(container(), m_tempbuf.c_str(), 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.0f * UI_BOX_LR_BORDER) + 0.01f;
|
||||
maxwidth = std::max(width, maxwidth);
|
||||
|
||||
// compute our bounds
|
||||
float x1 = 0.5f - 0.5f * maxwidth;
|
||||
float x2 = x1 + maxwidth;
|
||||
float y1 = origy1 - top;
|
||||
float y2 = y1 + lineh + 2.0f * 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_tempbuf.c_str(), 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);
|
||||
|
||||
// compute our bounds
|
||||
x1 = 0.5f - 0.5f * maxwidth;
|
||||
x2 = x1 + maxwidth;
|
||||
y1 = y2 + 2.0f * UI_BOX_TB_BORDER;
|
||||
y2 = origy1 - UI_BOX_TB_BORDER;
|
||||
|
||||
// draw a box
|
||||
ui().draw_outlined_box(container(), x1, y1, x2, y2, UI_BACKGROUND_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
|
||||
for (auto & elem : m_folders)
|
||||
{
|
||||
ui().draw_text_full(container(), elem.c_str(), x1, y1, x2 - x1, ui::text_layout::LEFT, ui::text_layout::TRUNCATE,
|
||||
mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr);
|
||||
y1 += lineh;
|
||||
}
|
||||
|
||||
float const lineheight(ui().get_line_height());
|
||||
float const maxwidth(draw_text_box(
|
||||
std::begin(m_folders), std::end(m_folders),
|
||||
origx1, origx2, origy1 - (3.0f * UI_BOX_TB_BORDER) - (m_folders.size() * lineheight), origy1 - UI_BOX_TB_BORDER,
|
||||
ui::text_layout::CENTER, ui::text_layout::TRUNCATE, false,
|
||||
UI_TEXT_COLOR, UI_BACKGROUND_COLOR, 1.0f));
|
||||
draw_text_box(
|
||||
std::begin(m_heading), std::end(m_heading),
|
||||
0.5f * (1.0f - maxwidth), 0.5f * (1.0f + maxwidth), origy1 - top, origy1 - top + lineheight + (2.0f * UI_BOX_TB_BORDER),
|
||||
ui::text_layout::CENTER, ui::text_layout::TRUNCATE, false,
|
||||
UI_TEXT_COLOR, UI_GREEN_COLOR, 1.0f);
|
||||
}
|
||||
|
||||
/**************************************************
|
||||
@ -476,73 +413,25 @@ void menu_add_change_folder::populate(float &customtop, float &custombottom)
|
||||
|
||||
void menu_add_change_folder::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2)
|
||||
{
|
||||
float width, maxwidth = origx2 - origx1;
|
||||
std::string tempbuf[2];
|
||||
tempbuf[0] = string_format(
|
||||
(m_change)
|
||||
? _("Change %1$s Folder - Search: %2$s_")
|
||||
: _("Add %1$s Folder - Search: %2$s_"),
|
||||
_(s_folders[m_ref].name),
|
||||
m_search);
|
||||
tempbuf[1] = m_current_path;
|
||||
|
||||
// get the size of the text
|
||||
for (auto & elem : tempbuf)
|
||||
{
|
||||
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.0f * UI_BOX_LR_BORDER) + 0.01f;
|
||||
maxwidth = std::max(width, maxwidth);
|
||||
}
|
||||
|
||||
// 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
|
||||
for (auto & elem : tempbuf)
|
||||
{
|
||||
ui().draw_text_full(container(), elem.c_str(), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::NEVER,
|
||||
mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr);
|
||||
y1 = y1 + ui().get_line_height();
|
||||
}
|
||||
std::string const toptext[] = {
|
||||
util::string_format(
|
||||
m_change ? _("Change %1$s Folder - Search: %2$s_") : _("Add %1$s Folder - Search: %2$s_"),
|
||||
_(s_folders[m_ref].name),
|
||||
m_search),
|
||||
m_current_path };
|
||||
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::NEVER, false,
|
||||
UI_TEXT_COLOR, UI_GREEN_COLOR, 1.0f);
|
||||
|
||||
// bottom text
|
||||
tempbuf[0] = _("Press TAB to set");
|
||||
|
||||
ui().draw_text_full(container(), tempbuf[0].c_str(), 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;
|
||||
maxwidth = std::max(maxwidth, width);
|
||||
|
||||
// compute our bounds
|
||||
x1 = 0.5f - 0.5f * maxwidth;
|
||||
x2 = x1 + maxwidth;
|
||||
y1 = origy2 + UI_BOX_TB_BORDER;
|
||||
y2 = origy2 + bottom;
|
||||
|
||||
// draw a box
|
||||
ui().draw_outlined_box(container(), x1, y1, x2, y2, UI_RED_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(), tempbuf[0].c_str(), 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);
|
||||
|
||||
char const *const bottomtext[] = { _("Press TAB to set") };
|
||||
draw_text_box(
|
||||
std::begin(bottomtext), std::end(bottomtext),
|
||||
origx1, origx2, origy2 + UI_BOX_TB_BORDER, origy2 + bottom,
|
||||
ui::text_layout::CENTER, ui::text_layout::TRUNCATE, false,
|
||||
UI_TEXT_COLOR, UI_RED_COLOR, 1.0f);
|
||||
}
|
||||
|
||||
/**************************************************
|
||||
@ -621,31 +510,12 @@ void menu_remove_folder::populate(float &customtop, float &custombottom)
|
||||
|
||||
void menu_remove_folder::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2)
|
||||
{
|
||||
float width;
|
||||
std::string tempbuf = string_format(_("Remove %1$s Folder"), _(s_folders[m_ref].name));
|
||||
|
||||
// get the size of the text
|
||||
ui().draw_text_full(container(), tempbuf.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.0f * UI_BOX_LR_BORDER) + 0.01f;
|
||||
float maxwidth = std::max(width, origx2 - origx1);
|
||||
|
||||
// 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(), tempbuf.c_str(), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::NEVER, mame_ui_manager::NORMAL,
|
||||
UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr);
|
||||
std::string const toptext[] = {string_format(_("Remove %1$s Folder"), _(s_folders[m_ref].name)) };
|
||||
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);
|
||||
}
|
||||
|
||||
} // namespace ui
|
||||
|
@ -60,7 +60,7 @@ private:
|
||||
virtual void populate(float &customtop, float &custombottom) override;
|
||||
virtual void handle() override;
|
||||
|
||||
std::string m_tempbuf, m_searchpath;
|
||||
std::string m_heading[1], m_searchpath;
|
||||
std::vector<std::string> m_folders;
|
||||
int m_ref;
|
||||
};
|
||||
|
@ -1302,8 +1302,8 @@ void menu::extra_text_position(float origx1, float origx2, float origy, float ys
|
||||
|
||||
void menu::extra_text_render(float top, float bottom, float origx1, float origy1, float origx2, float origy2, const char *header, const char *footer)
|
||||
{
|
||||
header = ((header != nullptr) && (header[0] != '\0')) ? header : nullptr;
|
||||
footer = ((footer != nullptr) && (footer[0] != '\0')) ? footer : nullptr;
|
||||
header = (header && *header) ? header : nullptr;
|
||||
footer = (footer && *footer) ? footer : nullptr;
|
||||
|
||||
if (header != nullptr)
|
||||
extra_text_draw_box(origx1, origx2, origy1, top, header, -1);
|
||||
|
@ -204,9 +204,60 @@ 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);
|
||||
|
||||
// draw a box of text - used for the custom boxes above/below menus
|
||||
template <typename Iter>
|
||||
float draw_text_box(
|
||||
Iter begin, Iter end,
|
||||
float origx1, float origx2, float y1, float y2,
|
||||
ui::text_layout::text_justify justify, ui::text_layout::word_wrapping wrap, bool scale,
|
||||
rgb_t fgcolor, rgb_t bgcolor, float text_size)
|
||||
{
|
||||
// size up the text
|
||||
float maxwidth(origx2 - origx1);
|
||||
for (Iter it = begin; it != end; ++it)
|
||||
{
|
||||
float width;
|
||||
ui().draw_text_full(
|
||||
container(), get_c_str(*it),
|
||||
0.0f, 0.0f, 1.0f, justify, wrap,
|
||||
mame_ui_manager::NONE, rgb_t::black(), rgb_t::white(),
|
||||
&width, nullptr, text_size);
|
||||
width += 2.0f * UI_BOX_LR_BORDER;
|
||||
maxwidth = (std::max)(maxwidth, width);
|
||||
}
|
||||
if (scale && ((origx2 - origx1) < maxwidth))
|
||||
{
|
||||
text_size *= ((origx2 - origx1) / maxwidth);
|
||||
maxwidth = origx2 - origx1;
|
||||
}
|
||||
|
||||
// draw containing box
|
||||
float x1(0.5f * (1.0f - maxwidth));
|
||||
float x2(x1 + maxwidth);
|
||||
ui().draw_outlined_box(container(), x1, y1, x2, y2, bgcolor);
|
||||
|
||||
// inset box and draw content
|
||||
x1 += UI_BOX_LR_BORDER;
|
||||
x2 -= UI_BOX_LR_BORDER;
|
||||
y1 += UI_BOX_TB_BORDER;
|
||||
y2 -= UI_BOX_TB_BORDER;
|
||||
for (Iter it = begin; it != end; ++it)
|
||||
{
|
||||
ui().draw_text_full(
|
||||
container(), get_c_str(*it),
|
||||
x1, y1, x2 - x1, justify, wrap,
|
||||
mame_ui_manager::NORMAL, fgcolor, UI_TEXT_BG_COLOR,
|
||||
nullptr, nullptr, text_size);
|
||||
y1 += ui().get_line_height();
|
||||
}
|
||||
|
||||
// in case you want another box of similar width
|
||||
return maxwidth;
|
||||
}
|
||||
|
||||
void draw_background();
|
||||
|
||||
// configure the menu for custom rendering
|
||||
// draw additional menu content
|
||||
virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2);
|
||||
|
||||
// map mouse to menu coordinates
|
||||
@ -313,6 +364,9 @@ private:
|
||||
static void exit(running_machine &machine);
|
||||
static global_state_ptr get_global_state(running_machine &machine);
|
||||
|
||||
static char const *get_c_str(std::string const &str) { return str.c_str(); }
|
||||
static char const *get_c_str(char const *str) { return str; }
|
||||
|
||||
global_state_ptr const m_global_state;
|
||||
bool m_special_main_menu;
|
||||
mame_ui_manager &m_ui; // UI we are attached to
|
||||
|
@ -792,42 +792,12 @@ void menu_machine_configure::populate(float &customtop, float &custombottom)
|
||||
|
||||
void menu_machine_configure::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2)
|
||||
{
|
||||
float width;
|
||||
std::string text[2];
|
||||
float maxwidth = origx2 - origx1;
|
||||
|
||||
text[0] = _("Configure machine:");
|
||||
text[1] = m_drv->type.fullname();
|
||||
|
||||
for (auto & elem : text)
|
||||
{
|
||||
ui().draw_text_full(container(), elem.c_str(), 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;
|
||||
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;
|
||||
|
||||
// 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
|
||||
for (auto & elem : text)
|
||||
{
|
||||
ui().draw_text_full(container(), elem.c_str(), 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);
|
||||
y1 += ui().get_line_height();
|
||||
}
|
||||
char const *const text[] = { _("Configure machine:"), m_drv->type.fullname() };
|
||||
draw_text_box(
|
||||
std::begin(text), std::end(text),
|
||||
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);
|
||||
}
|
||||
|
||||
void menu_machine_configure::setup_bios()
|
||||
@ -944,30 +914,12 @@ void menu_plugins_configure::populate(float &customtop, float &custombottom)
|
||||
|
||||
void menu_plugins_configure::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2)
|
||||
{
|
||||
float width;
|
||||
|
||||
ui().draw_text_full(container(), _("Plugins"), 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(), _("Plugins"), 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);
|
||||
char const *const toptext[] = { _("Plugins") };
|
||||
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);
|
||||
}
|
||||
|
||||
} // namespace ui
|
||||
|
@ -58,7 +58,7 @@ const options_entry ui_options::s_option_entries[] =
|
||||
// UI options
|
||||
{ nullptr, nullptr, OPTION_HEADER, "UI OPTIONS" },
|
||||
{ OPTION_INFOS_SIZE "(0.05-1.00)", "0.75", OPTION_FLOAT, "UI right panel infos text size (0.05 - 1.00)" },
|
||||
{ OPTION_FONT_ROWS "(25-40)", "30", OPTION_INTEGER, "UI font text size (25 - 40)" },
|
||||
{ OPTION_FONT_ROWS "(25-40)", "30", OPTION_INTEGER, "UI font lines per screen (25 - 40)" },
|
||||
{ OPTION_HIDE_PANELS "(0-3)", "0", OPTION_INTEGER, "UI hide left/right panel in main view (0 = Show all, 1 = hide left, 2 = hide right, 3 = hide both" },
|
||||
{ OPTION_UI_BORDER_COLOR, "ffffffff", OPTION_STRING, "UI border color (ARGB)" },
|
||||
{ OPTION_UI_BACKGROUND_COLOR, "ef101030", OPTION_STRING, "UI background color (ARGB)" },
|
||||
@ -83,8 +83,7 @@ const options_entry ui_options::s_option_entries[] =
|
||||
// ui_options - constructor
|
||||
//-------------------------------------------------
|
||||
|
||||
ui_options::ui_options()
|
||||
: core_options()
|
||||
ui_options::ui_options() : core_options()
|
||||
{
|
||||
add_entries(ui_options::s_option_entries);
|
||||
}
|
||||
|
@ -295,29 +295,12 @@ void menu_game_options::populate(float &customtop, float &custombottom)
|
||||
|
||||
void menu_game_options::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2)
|
||||
{
|
||||
float width;
|
||||
ui().draw_text_full(container(), _("Settings"), 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(), _("Settings"), 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);
|
||||
char const *const toptext[] = { _("Settings") };
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
|
@ -149,60 +149,20 @@ void menu_selector::populate(float &customtop, float &custombottom)
|
||||
|
||||
void menu_selector::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2)
|
||||
{
|
||||
float width;
|
||||
std::string tempbuf = std::string(_("Selection List - Search: ")).append(m_search).append("_");
|
||||
std::string tempbuf[1] = { std::string(_("Selection List - Search: ")).append(m_search).append("_") };
|
||||
draw_text_box(
|
||||
std::begin(tempbuf), std::end(tempbuf),
|
||||
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);
|
||||
|
||||
// get the size of the text
|
||||
ui().draw_text_full(container(), tempbuf.c_str(), 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.0f * UI_BOX_LR_BORDER) + 0.01f;
|
||||
float maxwidth = std::max(width, origx2 - origx1);
|
||||
|
||||
// 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(), tempbuf.c_str(), 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);
|
||||
|
||||
// bottom text
|
||||
// get the text for 'UI Select'
|
||||
std::string ui_select_text = machine().input().seq_name(machine().ioport().type_seq(IPT_UI_SELECT, 0, SEQ_TYPE_STANDARD));
|
||||
tempbuf = string_format(_("Double click or press %1$s to select"), ui_select_text);
|
||||
|
||||
ui().draw_text_full(container(), tempbuf.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;
|
||||
maxwidth = std::max(maxwidth, width);
|
||||
|
||||
// compute our bounds
|
||||
x1 = 0.5f - 0.5f * maxwidth;
|
||||
x2 = x1 + maxwidth;
|
||||
y1 = origy2 + UI_BOX_TB_BORDER;
|
||||
y2 = origy2 + bottom;
|
||||
|
||||
// draw a box
|
||||
ui().draw_outlined_box(container(), x1, y1, x2, y2, UI_RED_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(), tempbuf.c_str(), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::NEVER,
|
||||
mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr);
|
||||
tempbuf[0] = string_format(_("Double click or press %1$s to select"), machine().input().seq_name(machine().ioport().type_seq(IPT_UI_SELECT, 0, SEQ_TYPE_STANDARD)));
|
||||
draw_text_box(
|
||||
std::begin(tempbuf), std::end(tempbuf),
|
||||
origx1, origx2, origy2 + UI_BOX_TB_BORDER, origy2 + bottom,
|
||||
ui::text_layout::CENTER, ui::text_layout::TRUNCATE, false,
|
||||
UI_TEXT_COLOR, UI_RED_COLOR, 1.0f);
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
|
@ -246,29 +246,12 @@ void menu_select_launch::software_parts::handle()
|
||||
|
||||
void menu_select_launch::software_parts::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2)
|
||||
{
|
||||
float width;
|
||||
ui().draw_text_full(container(), _("Software part selection:"), 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(), _("Software part selection:"), 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);
|
||||
char const *const text[] = { _("Software part selection:") };
|
||||
draw_text_box(
|
||||
std::begin(text), std::end(text),
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
@ -369,29 +352,12 @@ void menu_select_launch::bios_selection::handle()
|
||||
|
||||
void menu_select_launch::bios_selection::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2)
|
||||
{
|
||||
float width;
|
||||
ui().draw_text_full(container(), _("BIOS selection:"), 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(), _("BIOS selection:"), 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);
|
||||
char const *const text[] = { _("BIOS selection:") };
|
||||
draw_text_box(
|
||||
std::begin(text), std::end(text),
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
@ -587,47 +553,15 @@ void menu_select_launch::custom_render(void *selectedref, float top, float botto
|
||||
|
||||
// determine the text for the header
|
||||
make_topbox_text(tempbuf[0], tempbuf[1], tempbuf[2]);
|
||||
float const y1 = origy1 - 3.0f * UI_BOX_TB_BORDER - ui().get_line_height();
|
||||
draw_text_box(
|
||||
tempbuf, tempbuf + 3,
|
||||
origx1, origx2, origy1 - top, y1,
|
||||
ui::text_layout::CENTER, ui::text_layout::NEVER, true,
|
||||
UI_TEXT_COLOR, UI_BACKGROUND_COLOR, 1.0f);
|
||||
|
||||
// get the size of the text
|
||||
float maxwidth = origx2 - origx1;
|
||||
for (int line = 0; line < 3; ++line)
|
||||
{
|
||||
float width;
|
||||
ui().draw_text_full(container(), tempbuf[line].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;
|
||||
maxwidth = (std::max)(width, maxwidth);
|
||||
}
|
||||
|
||||
float text_size = 1.0f;
|
||||
if (maxwidth > origx2 - origx1)
|
||||
{
|
||||
text_size = (origx2 - origx1) / maxwidth;
|
||||
maxwidth = origx2 - origx1;
|
||||
}
|
||||
|
||||
// compute our bounds
|
||||
float tbarspace = ui().get_line_height();
|
||||
float x1 = 0.5f - 0.5f * maxwidth;
|
||||
float x2 = x1 + maxwidth;
|
||||
float y1 = origy1 - top;
|
||||
float y2 = origy1 - 3.0f * UI_BOX_TB_BORDER - tbarspace;
|
||||
|
||||
// draw a box
|
||||
ui().draw_outlined_box(container(), x1, y1, x2, y2, UI_BACKGROUND_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
|
||||
for (int line = 0; line < 3; ++line)
|
||||
{
|
||||
ui().draw_text_full(container(), tempbuf[line].c_str(), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::NEVER,
|
||||
mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr, text_size);
|
||||
y1 += ui().get_line_height();
|
||||
}
|
||||
// draw toolbar
|
||||
draw_toolbar(origx1, y1, origx2, origy1 - UI_BOX_TB_BORDER);
|
||||
|
||||
// determine the text to render below
|
||||
ui_software_info const *swinfo;
|
||||
@ -730,58 +664,16 @@ void menu_select_launch::custom_render(void *selectedref, float top, float botto
|
||||
tempbuf[4].clear();
|
||||
}
|
||||
|
||||
// compute our bounds
|
||||
x1 = 0.5f - 0.5f * maxwidth;
|
||||
x2 = x1 + maxwidth;
|
||||
y1 = y2;
|
||||
y2 = origy1 - UI_BOX_TB_BORDER;
|
||||
|
||||
// draw toolbar
|
||||
draw_toolbar(x1, y1, x2, y2);
|
||||
|
||||
// get the size of the text
|
||||
maxwidth = origx2 - origx1;
|
||||
|
||||
for (auto &elem : tempbuf)
|
||||
{
|
||||
float width;
|
||||
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;
|
||||
maxwidth = (std::max)(maxwidth, width);
|
||||
}
|
||||
|
||||
if (maxwidth > origx2 - origx1)
|
||||
{
|
||||
text_size = (origx2 - origx1) / maxwidth;
|
||||
maxwidth = origx2 - origx1;
|
||||
}
|
||||
|
||||
// compute our bounds
|
||||
x1 = 0.5f - 0.5f * maxwidth;
|
||||
x2 = x1 + maxwidth;
|
||||
y1 = origy2 + UI_BOX_TB_BORDER;
|
||||
y2 = origy2 + bottom;
|
||||
|
||||
// draw a box
|
||||
ui().draw_outlined_box(container(), x1, y1, x2, y2, color);
|
||||
|
||||
// take off the borders
|
||||
x1 += UI_BOX_LR_BORDER;
|
||||
x2 -= UI_BOX_LR_BORDER;
|
||||
y1 += UI_BOX_TB_BORDER;
|
||||
// draw the footer
|
||||
draw_text_box(
|
||||
std::begin(tempbuf), std::end(tempbuf),
|
||||
origx1, origx2, origy2 + UI_BOX_TB_BORDER, origy2 + bottom,
|
||||
ui::text_layout::CENTER, ui::text_layout::NEVER, true,
|
||||
UI_TEXT_COLOR, color, 1.0f);
|
||||
|
||||
// is favorite? draw the star
|
||||
if (isstar)
|
||||
draw_star(x1, y1);
|
||||
|
||||
// draw all lines
|
||||
for (auto &elem : tempbuf)
|
||||
{
|
||||
ui().draw_text_full(container(), elem.c_str(), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::NEVER,
|
||||
mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr, text_size);
|
||||
y1 += ui().get_line_height();
|
||||
}
|
||||
draw_star(origx1 + UI_BOX_LR_BORDER, origy2 + (2.0f * UI_BOX_TB_BORDER));
|
||||
}
|
||||
|
||||
|
||||
|
@ -286,10 +286,7 @@ void simple_menu_select_game::populate(float &customtop, float &custombottom)
|
||||
void simple_menu_select_game::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2)
|
||||
{
|
||||
const game_driver *driver;
|
||||
float width, maxwidth;
|
||||
float x1, y1, x2, y2;
|
||||
std::string tempbuf[5];
|
||||
int line;
|
||||
|
||||
// display the current typeahead
|
||||
if (!m_search.empty())
|
||||
@ -297,37 +294,12 @@ void simple_menu_select_game::custom_render(void *selectedref, float top, float
|
||||
else
|
||||
tempbuf[0] = _("Type name or select: (random)");
|
||||
|
||||
// get the size of the text
|
||||
ui().draw_text_full(
|
||||
container(), tempbuf[0].c_str(),
|
||||
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;
|
||||
maxwidth = std::max(width, origx2 - origx1);
|
||||
|
||||
// compute our bounds
|
||||
x1 = 0.5f - 0.5f * maxwidth;
|
||||
x2 = x1 + maxwidth;
|
||||
y1 = origy1 - top;
|
||||
y2 = origy1 - UI_BOX_TB_BORDER;
|
||||
|
||||
// draw a box
|
||||
ui().draw_outlined_box(container(), x1, y1, x2, y2, UI_BACKGROUND_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(), tempbuf[0].c_str(),
|
||||
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);
|
||||
// draw the top box
|
||||
draw_text_box(
|
||||
tempbuf, tempbuf + 1,
|
||||
origx1, origx2, origy1 - top, origy1 - UI_BOX_TB_BORDER,
|
||||
ui::text_layout::CENTER, ui::text_layout::TRUNCATE, false,
|
||||
UI_TEXT_COLOR, UI_BACKGROUND_COLOR, 1.0f);
|
||||
|
||||
// determine the text to render below
|
||||
driver = ((uintptr_t)selectedref > skip_main_items) ? (const game_driver *)selectedref : nullptr;
|
||||
@ -386,7 +358,7 @@ void simple_menu_select_game::custom_render(void *selectedref, float top, float
|
||||
else
|
||||
{
|
||||
const char *s = emulator_info::get_copyright();
|
||||
line = 0;
|
||||
unsigned line = 0;
|
||||
|
||||
// first line is version string
|
||||
tempbuf[line++] = string_format("%s %s", emulator_info::get_appname(), build_version);
|
||||
@ -408,38 +380,12 @@ void simple_menu_select_game::custom_render(void *selectedref, float top, float
|
||||
}
|
||||
}
|
||||
|
||||
// get the size of the text
|
||||
maxwidth = origx2 - origx1;
|
||||
for (line = 0; line < 4; line++)
|
||||
{
|
||||
ui().draw_text_full(container(), tempbuf[line].c_str(), 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;
|
||||
maxwidth = std::max(maxwidth, width);
|
||||
}
|
||||
|
||||
// compute our bounds
|
||||
x1 = 0.5f - 0.5f * maxwidth;
|
||||
x2 = x1 + maxwidth;
|
||||
y1 = origy2 + UI_BOX_TB_BORDER;
|
||||
y2 = origy2 + bottom;
|
||||
|
||||
// draw a box
|
||||
rgb_t const color = driver ? m_cached_color : UI_BACKGROUND_COLOR;
|
||||
ui().draw_outlined_box(container(), x1, y1, x2, y2, color);
|
||||
|
||||
// take off the borders
|
||||
x1 += UI_BOX_LR_BORDER;
|
||||
x2 -= UI_BOX_LR_BORDER;
|
||||
y1 += UI_BOX_TB_BORDER;
|
||||
|
||||
// draw all lines
|
||||
for (line = 0; line < 4; line++)
|
||||
{
|
||||
ui().draw_text_full(container(), tempbuf[line].c_str(), 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);
|
||||
y1 += ui().get_line_height();
|
||||
}
|
||||
// draw the bottom box
|
||||
draw_text_box(
|
||||
tempbuf, tempbuf + 4,
|
||||
origx1, origx2, origy2 + UI_BOX_TB_BORDER, origy2 + bottom,
|
||||
ui::text_layout::CENTER, ui::text_layout::TRUNCATE, true,
|
||||
UI_TEXT_COLOR, driver ? m_cached_color : UI_BACKGROUND_COLOR, 1.0f);
|
||||
}
|
||||
|
||||
|
||||
|
@ -299,23 +299,47 @@ void menu_slot_devices::populate(float &customtop, float &custombottom)
|
||||
}
|
||||
item_append(menu_item_type::SEPARATOR);
|
||||
item_append(_("Reset"), "", 0, ITEMREF_RESET);
|
||||
|
||||
// leave space for the name of the current option at the bottom
|
||||
custombottom = ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// handle
|
||||
// custom_render - draw extra menu content
|
||||
//-------------------------------------------------
|
||||
|
||||
void menu_slot_devices::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2)
|
||||
{
|
||||
if (selectedref && (ITEMREF_RESET != selectedref))
|
||||
{
|
||||
device_slot_interface *const slot(reinterpret_cast<device_slot_interface *>(selectedref));
|
||||
device_slot_option const *const option(get_current_option(*slot));
|
||||
char const *const text[] = { option ? option->devtype().fullname() : _("[empty slot]") };
|
||||
draw_text_box(
|
||||
std::begin(text), std::end(text),
|
||||
origx1, origx2, origy2 + UI_BOX_TB_BORDER, origy2 + bottom,
|
||||
ui::text_layout::CENTER, ui::text_layout::TRUNCATE, false,
|
||||
UI_TEXT_COLOR, UI_BACKGROUND_COLOR, 1.0f);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// handle - process an input event
|
||||
//-------------------------------------------------
|
||||
|
||||
void menu_slot_devices::handle()
|
||||
{
|
||||
// process the menu
|
||||
const event *menu_event = process(0);
|
||||
event const *const menu_event(process(0));
|
||||
|
||||
if (menu_event != nullptr && menu_event->itemref != nullptr)
|
||||
if (menu_event && menu_event->itemref != nullptr)
|
||||
{
|
||||
if (menu_event->itemref == ITEMREF_RESET && menu_event->iptkey == IPT_UI_SELECT)
|
||||
if (menu_event->itemref == ITEMREF_RESET)
|
||||
{
|
||||
machine().schedule_hard_reset();
|
||||
if (menu_event->iptkey == IPT_UI_SELECT)
|
||||
machine().schedule_hard_reset();
|
||||
}
|
||||
else if (menu_event->iptkey == IPT_UI_LEFT || menu_event->iptkey == IPT_UI_RIGHT)
|
||||
{
|
||||
|
@ -7,12 +7,11 @@
|
||||
Internal menu for the slot options.
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef MAME_FRONTEND_UI_SLOTOPT_H
|
||||
#define MAME_FRONTEND_UI_SLOTOPT_H
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "ui/menu.h"
|
||||
|
||||
#include <unordered_map>
|
||||
@ -26,6 +25,7 @@ public:
|
||||
|
||||
private:
|
||||
virtual void populate(float &customtop, float &custombottom) override;
|
||||
virtual void custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) override;
|
||||
virtual void handle() override;
|
||||
|
||||
device_slot_option *get_current_option(device_slot_interface &slot) const;
|
||||
|
@ -140,29 +140,12 @@ void menu_sound_options::populate(float &customtop, float &custombottom)
|
||||
|
||||
void menu_sound_options::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2)
|
||||
{
|
||||
float width;
|
||||
ui().draw_text_full(container(), _("Sound Options"), 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(), _("Sound Options"), 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);
|
||||
char const *const toptext[] = { _("Sound Options") };
|
||||
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);
|
||||
}
|
||||
|
||||
} // namespace ui
|
||||
|
@ -328,9 +328,7 @@ void menu_load_save_state_base::slot_selected(std::string &&name)
|
||||
|
||||
void menu_load_save_state_base::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2)
|
||||
{
|
||||
extra_text_render(top, bottom, origx1, origy1, origx2, origy2,
|
||||
m_header,
|
||||
m_footer);
|
||||
extra_text_render(top, bottom, origx1, origy1, origx2, origy2, m_header, m_footer);
|
||||
}
|
||||
|
||||
|
||||
|
@ -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;
|
||||
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);
|
||||
|
||||
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)
|
||||
if (selectedref)
|
||||
{
|
||||
option &selected_sm_option = *reinterpret_cast<option *>(selectedref);
|
||||
if (selected_sm_option.entry != nullptr)
|
||||
option &selected_sm_option(*reinterpret_cast<option *>(selectedref));
|
||||
if (selected_sm_option.entry)
|
||||
{
|
||||
ui().draw_text_full(container(), selected_sm_option.entry->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;
|
||||
maxwidth = std::max(origx2 - origx1, width);
|
||||
|
||||
// compute our bounds
|
||||
x1 = 0.5f - 0.5f * maxwidth;
|
||||
x2 = x1 + maxwidth;
|
||||
y1 = origy2 + UI_BOX_TB_BORDER;
|
||||
y2 = origy2 + bottom;
|
||||
|
||||
// draw a box
|
||||
ui().draw_outlined_box(container(), x1, y1, x2, y2, UI_RED_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(), selected_sm_option.entry->description(), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::NEVER,
|
||||
mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr);
|
||||
char const *const bottomtext[] = { selected_sm_option.entry->description() };
|
||||
draw_text_box(
|
||||
std::begin(bottomtext), std::end(bottomtext),
|
||||
origx1, origx2, origy2 + UI_BOX_TB_BORDER, origy2 + bottom,
|
||||
ui::text_layout::CENTER, ui::text_layout::TRUNCATE, false,
|
||||
UI_TEXT_COLOR, UI_RED_COLOR, 1.0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user