diff options
author | 2016-03-02 21:49:49 +0100 | |
---|---|---|
committer | 2016-03-02 21:49:49 +0100 | |
commit | 9fe9f6d93e672bcd926f9e7461774bc9cc22e094 (patch) | |
tree | 3911b611dd010a4108b90fb8b8c82116eec21117 /src/emu/ui/custui.cpp | |
parent | dbdf21ee465acadf3e643d62d6bedfcc297ada85 (diff) | |
parent | 1914702e6fae052668df5b068a502bca57c9a3b0 (diff) |
Merge remote-tracking branch 'refs/remotes/mamedev/master'
# Resolved Conflicts:
# src/osd/modules/render/d3d/d3dhlsl.cpp
# src/osd/windows/winmain.cpp
Diffstat (limited to 'src/emu/ui/custui.cpp')
-rw-r--r-- | src/emu/ui/custui.cpp | 115 |
1 files changed, 54 insertions, 61 deletions
diff --git a/src/emu/ui/custui.cpp b/src/emu/ui/custui.cpp index 6492faebabf..6aaed9105df 100644 --- a/src/emu/ui/custui.cpp +++ b/src/emu/ui/custui.cpp @@ -1,4 +1,4 @@ -// license:BSD-3-Clause +// license:BSD-3-Clause // copyright-holders:Dankan1890 /********************************************************************* @@ -16,10 +16,10 @@ #include "ui/utils.h" #include <algorithm> -const char *ui_menu_custom_ui::hide_status[] = { - __("Show All"), - __("Hide Filters"), - __("Hide Info/Image"), +const char *ui_menu_custom_ui::hide_status[] = { + __("Show All"), + __("Hide Filters"), + __("Hide Info/Image"), __("Hide Both") }; //------------------------------------------------- @@ -63,7 +63,7 @@ ui_menu_custom_ui::~ui_menu_custom_ui() ui_globals::reset = true; } -//------------------------------------------------- +//------------------------------------------------- // handle //------------------------------------------------- @@ -102,6 +102,7 @@ void ui_menu_custom_ui::handle() ui_menu::stack_push(global_alloc_clear<ui_menu_selector>(machine(), container, s_sel, ui_globals::panels_status)); } + break; } case LANGUAGE_MENU: { @@ -119,6 +120,7 @@ void ui_menu_custom_ui::handle() ui_menu::stack_push(global_alloc_clear<ui_menu_selector>(machine(), container, s_sel, m_currlang)); } + break; } } } @@ -160,7 +162,7 @@ void ui_menu_custom_ui::custom_render(void *selectedref, float top, float bottom ui_manager &mui = machine().ui(); mui.draw_text_full(container, _("Custom UI Settings"), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE, - DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr); + DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr); width += 2 * UI_BOX_LR_BORDER; float maxwidth = MAX(origx2 - origx1, width); @@ -180,7 +182,7 @@ void ui_menu_custom_ui::custom_render(void *selectedref, float top, float bottom // draw the text within it mui.draw_text_full(container, _("Custom UI Settings"), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_TRUNCATE, - DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); + DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); } //------------------------------------------------- @@ -263,7 +265,7 @@ void ui_menu_font_ui::list() std::stable_sort(m_fonts.begin(), m_fonts.end()); // add default string to the top of array - m_fonts.insert(m_fonts.begin(), std::string("default")); + m_fonts.insert(m_fonts.begin(), std::string(_("default"))); } #endif @@ -361,7 +363,6 @@ void ui_menu_font_ui::populate() { // set filter arrow UINT32 arrow_flags; - std::string tmptxt; #ifdef UI_WINDOWS // add fonts option @@ -377,16 +378,13 @@ void ui_menu_font_ui::populate() #endif arrow_flags = get_arrow_flags(m_font_min, m_font_max, m_font_size); - strprintf(tmptxt, "%2d", m_font_size); - item_append(_("Lines"), tmptxt.c_str(), arrow_flags, (void *)(FPTR)FONT_SIZE); + item_append(_("Lines"), string_format("%2d", m_font_size).c_str(), arrow_flags, (void *)(FPTR)FONT_SIZE); item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); // add item - tmptxt.clear(); - strprintf(tmptxt, "%3.2f", m_info_size); arrow_flags = get_arrow_flags(m_info_min, m_info_max, m_info_size); - item_append(_("Infos text size"), tmptxt.c_str(), arrow_flags, (void *)(FPTR)INFOS_SIZE); + item_append(_("Infos text size"), string_format("%3.2f", m_info_size).c_str(), arrow_flags, (void *)(FPTR)INFOS_SIZE); item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); @@ -406,7 +404,7 @@ void ui_menu_font_ui::custom_render(void *selectedref, float top, float bottom, std::string topbuf(_("UI Fonts Settings")); mui.draw_text_full(container, topbuf.c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE, - DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr); + DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr); width += 2 * UI_BOX_LR_BORDER; float maxwidth = MAX(origx2 - origx1, width); @@ -426,14 +424,14 @@ void ui_menu_font_ui::custom_render(void *selectedref, float top, float bottom, // draw the text within it mui.draw_text_full(container, topbuf.c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_TRUNCATE, - DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); + DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); if ((FPTR)selectedref == INFOS_SIZE) { topbuf = _("Sample text - Lorem ipsum dolor sit amet, consectetur adipiscing elit."); mui.draw_text_full(container, topbuf.c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_LEFT, WRAP_NEVER, - DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr, m_info_size); + DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr, m_info_size); width += 2 * UI_BOX_LR_BORDER; maxwidth = MAX(origx2 - origx1, width); @@ -453,7 +451,7 @@ void ui_menu_font_ui::custom_render(void *selectedref, float top, float bottom, // draw the text within it mui.draw_text_full(container, topbuf.c_str(), x1, y1, x2 - x1, JUSTIFY_LEFT, WRAP_NEVER, - DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr, m_info_size); + DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr, m_info_size); } } @@ -491,7 +489,7 @@ ui_menu_colors_ui::~ui_menu_colors_ui() std::string error_string, dec_color; for (int index = 1; index < MUI_RESTORE; index++) { - strprintf(dec_color, "%x", (UINT32)m_color_table[index].color); + dec_color = string_format("%x", (UINT32)m_color_table[index].color); machine().ui().options().set_value(m_color_table[index].option, dec_color.c_str(), OPTION_PRIORITY_CMDLINE, error_string); } } @@ -565,7 +563,7 @@ void ui_menu_colors_ui::custom_render(void *selectedref, float top, float bottom std::string topbuf(_("UI Colors Settings")); mui.draw_text_full(container, topbuf.c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_NEVER, - DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr); + DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr); width += 2 * UI_BOX_LR_BORDER; maxwidth = MAX(maxwidth, width); @@ -585,7 +583,7 @@ void ui_menu_colors_ui::custom_render(void *selectedref, float top, float bottom // draw the text within it mui.draw_text_full(container, topbuf.c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_NEVER, - DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); + DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); // bottom text // get the text for 'UI Select' @@ -593,7 +591,7 @@ void ui_menu_colors_ui::custom_render(void *selectedref, float top, float bottom topbuf.assign(_("Double click or press ")).append(ui_select_text.c_str()).append(_(" to change the color value")); mui.draw_text_full(container, topbuf.c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_NEVER, - DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr); + DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr); width += 2 * UI_BOX_LR_BORDER; maxwidth = MAX(maxwidth, width); @@ -613,13 +611,13 @@ void ui_menu_colors_ui::custom_render(void *selectedref, float top, float bottom // draw the text within it mui.draw_text_full(container, topbuf.c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_NEVER, - DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); + DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); // compute maxwidth topbuf = _("Menu Preview"); mui.draw_text_full(container, topbuf.c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_NEVER, - DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr); + DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr); maxwidth = width + 2.0f * UI_BOX_LR_BORDER; std::string sampletxt[5]; @@ -633,7 +631,7 @@ void ui_menu_colors_ui::custom_render(void *selectedref, float top, float bottom for (auto & elem: sampletxt) { mui.draw_text_full(container, elem.c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_NEVER, - DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr); + DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr); width += 2 * UI_BOX_LR_BORDER; maxwidth = MAX(maxwidth, width); } @@ -655,7 +653,7 @@ void ui_menu_colors_ui::custom_render(void *selectedref, float top, float bottom // draw the text within it mui.draw_text_full(container, topbuf.c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_NEVER, - DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); + DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); // compute our bounds for menu preview x1 -= UI_BOX_LR_BORDER; @@ -673,29 +671,29 @@ void ui_menu_colors_ui::custom_render(void *selectedref, float top, float bottom // draw normal text mui.draw_text_full(container, sampletxt[0].c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_NEVER, - DRAW_NORMAL, m_color_table[MUI_TEXT_COLOR].color, m_color_table[MUI_TEXT_BG_COLOR].color, nullptr, nullptr); + DRAW_NORMAL, m_color_table[MUI_TEXT_COLOR].color, m_color_table[MUI_TEXT_BG_COLOR].color, nullptr, nullptr); y1 += line_height; // draw subitem text mui.draw_text_full(container, sampletxt[1].c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_NEVER, - DRAW_NORMAL, m_color_table[MUI_SUBITEM_COLOR].color, m_color_table[MUI_TEXT_BG_COLOR].color, nullptr, nullptr); + DRAW_NORMAL, m_color_table[MUI_SUBITEM_COLOR].color, m_color_table[MUI_TEXT_BG_COLOR].color, nullptr, nullptr); y1 += line_height; // draw selected text highlight(container, x1, y1, x2, y1 + line_height, m_color_table[MUI_SELECTED_BG_COLOR].color); mui.draw_text_full(container, sampletxt[2].c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_NEVER, - DRAW_NORMAL, m_color_table[MUI_SELECTED_COLOR].color, m_color_table[MUI_SELECTED_BG_COLOR].color, nullptr, nullptr); + DRAW_NORMAL, m_color_table[MUI_SELECTED_COLOR].color, m_color_table[MUI_SELECTED_BG_COLOR].color, nullptr, nullptr); y1 += line_height; // draw mouse over text highlight(container, x1, y1, x2, y1 + line_height, m_color_table[MUI_MOUSEOVER_BG_COLOR].color); mui.draw_text_full(container, sampletxt[3].c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_NEVER, - DRAW_NORMAL, m_color_table[MUI_MOUSEOVER_COLOR].color, m_color_table[MUI_MOUSEOVER_BG_COLOR].color, nullptr, nullptr); + DRAW_NORMAL, m_color_table[MUI_MOUSEOVER_COLOR].color, m_color_table[MUI_MOUSEOVER_BG_COLOR].color, nullptr, nullptr); y1 += line_height; // draw clone text mui.draw_text_full(container, sampletxt[4].c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_NEVER, - DRAW_NORMAL, m_color_table[MUI_CLONE_COLOR].color, m_color_table[MUI_TEXT_BG_COLOR].color, nullptr, nullptr); + DRAW_NORMAL, m_color_table[MUI_CLONE_COLOR].color, m_color_table[MUI_TEXT_BG_COLOR].color, nullptr, nullptr); } @@ -854,44 +852,39 @@ void ui_menu_rgb_ui::populate() { // set filter arrow UINT32 arrow_flags = MENU_FLAG_LEFT_ARROW | MENU_FLAG_RIGHT_ARROW; - std::string text; std::string s_text = std::string(m_search).append("_"); if (m_lock_ref != RGB_ALPHA) { arrow_flags = get_arrow_flags(0, 255, m_color->a()); - strprintf(text, "%3d", m_color->a()); - item_append("Alpha", text.c_str(), arrow_flags, (void *)(FPTR)RGB_ALPHA); + item_append(_("Alpha"), string_format("%3d", m_color->a()).c_str(), arrow_flags, (void *)(FPTR)RGB_ALPHA); } else - item_append("Alpha", s_text.c_str(), 0, (void *)(FPTR)RGB_ALPHA); + item_append(_("Alpha"), s_text.c_str(), 0, (void *)(FPTR)RGB_ALPHA); if (m_lock_ref != RGB_RED) { arrow_flags = get_arrow_flags(0, 255, m_color->r()); - strprintf(text, "%3d", m_color->r()); - item_append("Red", text.c_str(), arrow_flags, (void *)(FPTR)RGB_RED); + item_append(_("Red"), string_format("%3d", m_color->r()).c_str(), arrow_flags, (void *)(FPTR)RGB_RED); } else - item_append("Red", s_text.c_str(), 0, (void *)(FPTR)RGB_RED); + item_append(_("Red"), s_text.c_str(), 0, (void *)(FPTR)RGB_RED); if (m_lock_ref != RGB_GREEN) { arrow_flags = get_arrow_flags(0, 255, m_color->g()); - strprintf(text, "%3d", m_color->g()); - item_append("Green", text.c_str(), arrow_flags, (void *)(FPTR)RGB_GREEN); + item_append(_("Green"), string_format("%3d", m_color->g()).c_str(), arrow_flags, (void *)(FPTR)RGB_GREEN); } else - item_append("Green", s_text.c_str(), 0, (void *)(FPTR)RGB_GREEN); + item_append(_("Green"), s_text.c_str(), 0, (void *)(FPTR)RGB_GREEN); if (m_lock_ref != RGB_BLUE) { arrow_flags = get_arrow_flags(0, 255, m_color->b()); - strprintf(text, "%3d", m_color->b()); - item_append("Blue", text.c_str(), arrow_flags, (void *)(FPTR)RGB_BLUE); + item_append(_("Blue"), string_format("%3d", m_color->b()).c_str(), arrow_flags, (void *)(FPTR)RGB_BLUE); } else - item_append("Blue", s_text.c_str(), 0, (void *)(FPTR)RGB_BLUE); + item_append(_("Blue"), s_text.c_str(), 0, (void *)(FPTR)RGB_BLUE); item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); item_append(_("Choose from palette"), nullptr, 0, (void *)(FPTR)PALETTE_CHOOSE); @@ -912,7 +905,7 @@ void ui_menu_rgb_ui::custom_render(void *selectedref, float top, float bottom, f // top text std::string topbuf = std::string(m_title).append(_(" - ARGB Settings")); mui.draw_text_full(container, topbuf.c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_NEVER, - DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr); + DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr); width += 2 * UI_BOX_LR_BORDER; maxwidth = MAX(maxwidth, width); @@ -932,12 +925,12 @@ void ui_menu_rgb_ui::custom_render(void *selectedref, float top, float bottom, f // draw the text within it mui.draw_text_full(container, topbuf.c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_NEVER, - DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); + DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); std::string sampletxt(_("Color preview =")); maxwidth = origx2 - origx1; mui.draw_text_full(container, sampletxt.c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_NEVER, - DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr); + DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr); width += 2 * UI_BOX_LR_BORDER; maxwidth = MAX(maxwidth, width); @@ -957,7 +950,7 @@ void ui_menu_rgb_ui::custom_render(void *selectedref, float top, float bottom, f // draw the normal text mui.draw_text_full(container, sampletxt.c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_NEVER, - DRAW_NORMAL, ARGB_WHITE, ARGB_BLACK, nullptr, nullptr); + DRAW_NORMAL, ARGB_WHITE, ARGB_BLACK, nullptr, nullptr); float t_x2 = x1 - UI_BOX_LR_BORDER + maxwidth; x1 = x2 + 2.0f * UI_BOX_LR_BORDER; @@ -1030,23 +1023,23 @@ void ui_menu_rgb_ui::inkey_special(const ui_menu_event *m_event) } ui_menu_palette_sel::palcolor ui_menu_palette_sel::m_palette[] = { - { "White", "FFFFFFFF" }, - { "Silver", "FFC0C0C0" }, - { "Gray", "FF808080" }, - { "Black", "FF000000" }, - { "Red", "FFFF0000" }, - { "Orange", "FFFFA500" }, - { "Yellow", "FFFFFF00" }, - { "Green", "FF00FF00" }, - { "Blue", "FF0000FF" }, - { "Violet", "FF8F00FF" } + { __("White"), "FFFFFFFF" }, + { __("Silver"), "FFC0C0C0" }, + { __("Gray"), "FF808080" }, + { __("Black"), "FF000000" }, + { __("Red"), "FFFF0000" }, + { __("Orange"), "FFFFA500" }, + { __("Yellow"), "FFFFFF00" }, + { __("Green"), "FF00FF00" }, + { __("Blue"), "FF0000FF" }, + { __("Violet"), "FF8F00FF" } }; //------------------------------------------------- // ctor //------------------------------------------------- -ui_menu_palette_sel::ui_menu_palette_sel(running_machine &machine, render_container *container, rgb_t &_color) +ui_menu_palette_sel::ui_menu_palette_sel(running_machine &machine, render_container *container, rgb_t &_color) : ui_menu(machine, container), m_original(_color) { } @@ -1085,7 +1078,7 @@ void ui_menu_palette_sel::handle() void ui_menu_palette_sel::populate() { for (int x = 0; x < ARRAY_LENGTH(m_palette); ++x) - item_append(m_palette[x].name, m_palette[x].argb, MENU_FLAG_UI_PALETTE, (void *)(FPTR)(x + 1)); + item_append(_(m_palette[x].name), m_palette[x].argb, MENU_FLAG_UI_PALETTE, (void *)(FPTR)(x + 1)); item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); } |