From d45335ec05cfeabb036be8f2d542988bab9cabad Mon Sep 17 00:00:00 2001 From: dankan1890 Date: Sun, 21 Feb 2016 19:55:38 +0100 Subject: [PATCH] ui: more localization and code fix. (nw) --- src/emu/ui/custui.cpp | 10 +- src/emu/ui/dirmenu.cpp | 636 ++++++++++++++++++++-------------------- src/emu/ui/dirmenu.h | 43 +-- src/emu/ui/ui.cpp | 112 +++---- src/emu/ui/videoopt.cpp | 16 +- src/emu/ui/viewgfx.cpp | 2 +- 6 files changed, 394 insertions(+), 425 deletions(-) diff --git a/src/emu/ui/custui.cpp b/src/emu/ui/custui.cpp index a707ebe0597..4b8cb58dd0d 100644 --- a/src/emu/ui/custui.cpp +++ b/src/emu/ui/custui.cpp @@ -16,7 +16,11 @@ #include "ui/utils.h" #include -const char *ui_menu_custom_ui::hide_status[] = { "Show All", "Hide Filters", "Hide Info/Image", "Hide Both" }; +const char *ui_menu_custom_ui::hide_status[] = { + __("Show All"), + __("Hide Filters"), + __("Hide Info/Image"), + __("Hide Both") }; //------------------------------------------------- // ctor @@ -94,7 +98,7 @@ void ui_menu_custom_ui::handle() int total = ARRAY_LENGTH(hide_status); std::vector s_sel(total); for (int index = 0; index < total; ++index) - s_sel[index] = hide_status[index]; + s_sel[index] = _(hide_status[index]); ui_menu::stack_push(global_alloc_clear(machine(), container, s_sel, ui_globals::panels_status)); } @@ -140,7 +144,7 @@ void ui_menu_custom_ui::populate() } arrow_flags = get_arrow_flags(0, (int)HIDE_BOTH, ui_globals::panels_status); - item_append(_("Show side panels"), hide_status[ui_globals::panels_status], arrow_flags, (void *)(FPTR)HIDE_MENU); + item_append(_("Show side panels"), _(hide_status[ui_globals::panels_status]), arrow_flags, (void *)(FPTR)HIDE_MENU); item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); customtop = machine().ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; diff --git a/src/emu/ui/dirmenu.cpp b/src/emu/ui/dirmenu.cpp index 81353b3bdc8..366dcd3e23c 100644 --- a/src/emu/ui/dirmenu.cpp +++ b/src/emu/ui/dirmenu.cpp @@ -16,54 +16,269 @@ #include "ui/utils.h" #include "ui/optsmenu.h" +static enum +{ + ADDING = 1, + CHANGE +}; + struct folders_entry { const char *name; const char *option; + const int action; }; -static const folders_entry s_folders_entry[] = +static const folders_entry s_folders[] = { - { "ROMs", OPTION_MEDIAPATH }, - { "UI", OPTION_UI_PATH }, - { "Samples", OPTION_SAMPLEPATH }, - { "DATs", OPTION_HISTORY_PATH }, - { "INIs", OPTION_INIPATH }, - { "Extra INIs", OPTION_EXTRAINI_PATH }, - { "Icons", OPTION_ICONS_PATH }, - { "Cheats", OPTION_CHEATPATH }, - { "Snapshots", OPTION_SNAPSHOT_DIRECTORY }, - { "Cabinets", OPTION_CABINETS_PATH }, - { "Flyers", OPTION_FLYERS_PATH }, - { "Titles", OPTION_TITLES_PATH }, - { "Ends", OPTION_ENDS_PATH }, - { "PCBs", OPTION_PCBS_PATH }, - { "Marquees", OPTION_MARQUEES_PATH }, - { "Controls Panels", OPTION_CPANELS_PATH }, - { "Crosshairs", OPTION_CROSSHAIRPATH }, - { "Artworks", OPTION_ARTPATH }, - { "Bosses", OPTION_BOSSES_PATH }, - { "Artworks Preview", OPTION_ARTPREV_PATH }, - { "Select", OPTION_SELECT_PATH }, - { "GameOver", OPTION_GAMEOVER_PATH }, - { "HowTo", OPTION_HOWTO_PATH }, - { "Logos", OPTION_LOGOS_PATH }, - { "Scores", OPTION_SCORES_PATH }, - { "Versus", OPTION_VERSUS_PATH }, - { nullptr } + { __("ROMs"), OPTION_MEDIAPATH, ADDING }, + { __("UI"), OPTION_UI_PATH, CHANGE }, + { __("Language"), OPTION_LANGUAGEPATH, CHANGE }, + { __("Samples"), OPTION_SAMPLEPATH, ADDING }, + { __("DATs"), OPTION_HISTORY_PATH, CHANGE }, + { __("INIs"), OPTION_INIPATH, ADDING }, + { __("Extra INIs"), OPTION_EXTRAINI_PATH, CHANGE }, + { __("Icons"), OPTION_ICONS_PATH, ADDING }, + { __("Cheats"), OPTION_CHEATPATH, ADDING }, + { __("Snapshots"), OPTION_SNAPSHOT_DIRECTORY, ADDING }, + { __("Cabinets"), OPTION_CABINETS_PATH, ADDING }, + { __("Flyers"), OPTION_FLYERS_PATH, ADDING }, + { __("Titles"), OPTION_TITLES_PATH, ADDING }, + { __("Ends"), OPTION_ENDS_PATH, ADDING }, + { __("PCBs"), OPTION_PCBS_PATH, ADDING }, + { __("Marquees"), OPTION_MARQUEES_PATH, ADDING }, + { __("Controls Panels"), OPTION_CPANELS_PATH, ADDING }, + { __("Crosshairs"), OPTION_CROSSHAIRPATH, ADDING }, + { __("Artworks"), OPTION_ARTPATH, ADDING }, + { __("Bosses"), OPTION_BOSSES_PATH, ADDING }, + { __("Artworks Preview"), OPTION_ARTPREV_PATH, ADDING }, + { __("Select"), OPTION_SELECT_PATH, ADDING }, + { __("GameOver"), OPTION_GAMEOVER_PATH, ADDING }, + { __("HowTo"), OPTION_HOWTO_PATH, ADDING }, + { __("Logos"), OPTION_LOGOS_PATH, ADDING }, + { __("Scores"), OPTION_SCORES_PATH, ADDING }, + { __("Versus"), OPTION_VERSUS_PATH, ADDING }, }; + /************************************************** - MENU ADD FOLDER + MENU DIRECTORY **************************************************/ //------------------------------------------------- // ctor / dtor //------------------------------------------------- -ui_menu_add_change_folder::ui_menu_add_change_folder(running_machine &machine, render_container *container, int ref, bool _change) : ui_menu(machine, container) +ui_menu_directory::ui_menu_directory(running_machine &machine, render_container *container) : ui_menu(machine, container) { - m_ref = ref - 1; - m_change = _change; +} + +ui_menu_directory::~ui_menu_directory() +{ + save_ui_options(machine()); + ui_globals::reset = true; +} + +//------------------------------------------------- +// handle +//------------------------------------------------- + +void ui_menu_directory::handle() +{ + // process the menu + const ui_menu_event *m_event = process(0); + + if (m_event != nullptr && m_event->itemref != nullptr && m_event->iptkey == IPT_UI_SELECT) + ui_menu::stack_push(global_alloc_clear(machine(), container, selected)); +} + +//------------------------------------------------- +// populate +//------------------------------------------------- + +void ui_menu_directory::populate() +{ + + for (auto & elem : s_folders) + item_append(_(elem.name), nullptr, 0, (void *)(FPTR)elem.action); + + item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); + customtop = machine().ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; +} + +//------------------------------------------------- +// perform our special rendering +//------------------------------------------------- + +void ui_menu_directory::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) +{ + float width; + ui_manager &mui = machine().ui(); + + // get the size of the text + mui.draw_text_full(container, _("Folders Setup"), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE, + DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr); + width += (2.0f * UI_BOX_LR_BORDER) + 0.01f; + float maxwidth = 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 + mui.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 + mui.draw_text_full(container, _("Folders Setup"), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_TRUNCATE, + DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); +} + +/************************************************** + MENU DISPLAY PATH +**************************************************/ +//------------------------------------------------- +// ctor / dtor +//------------------------------------------------- + +ui_menu_display_actual::ui_menu_display_actual(running_machine &machine, render_container *container, int ref) + : ui_menu(machine, container), m_ref(ref) +{ +} + +ui_menu_display_actual::~ui_menu_display_actual() +{ +} + +//------------------------------------------------- +// handle +//------------------------------------------------- + +void ui_menu_display_actual::handle() +{ + // process the menu + const ui_menu_event *m_event = process(0); + if (m_event != nullptr && m_event->itemref != nullptr && m_event->iptkey == IPT_UI_SELECT) + switch ((FPTR)m_event->itemref) + { + case REMOVE: + ui_menu::stack_push(global_alloc_clear(machine(), container, m_ref)); + break; + + case ADD_CHANGE: + ui_menu::stack_push(global_alloc_clear(machine(), container, m_ref)); + break; + } +} + +//------------------------------------------------- +// populate +//------------------------------------------------- + +void ui_menu_display_actual::populate() +{ + m_tempbuf.assign(_("Current ")).append(_(s_folders[m_ref].name)).append(_(" Folders")); + if (machine().ui().options().exists(s_folders[m_ref].option)) { + m_searchpath.assign(machine().ui().options().value(s_folders[m_ref].option)); + } + else { + m_searchpath.assign(machine().options().value(s_folders[m_ref].option)); + } + path_iterator path(m_searchpath.c_str()); + std::string curpath; + m_folders.clear(); + while (path.next(curpath, nullptr)) + m_folders.push_back(curpath); + + item_append((s_folders[m_ref].action == CHANGE) ? _("Change Folder") : _("Add Folder"), nullptr, 0, (void *)ADD_CHANGE); + + if (m_folders.size() > 1) + item_append(_("Remove Folder"), nullptr, 0, (void *)REMOVE); + + item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); + customtop = (m_folders.size() + 1) * machine().ui().get_line_height() + 6.0f * UI_BOX_TB_BORDER; +} + +//------------------------------------------------- +// perform our special rendering +//------------------------------------------------- + +void ui_menu_display_actual::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) +{ + float width, maxwidth = origx2 - origx1; + ui_manager &mui = machine().ui(); + float lineh = mui.get_line_height(); + + for (auto & elem : m_folders) + { + mui.draw_text_full(container, elem.c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_LEFT, WRAP_TRUNCATE, DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr); + width += (2.0f * UI_BOX_LR_BORDER) + 0.01f; + maxwidth = MAX(maxwidth, width); + } + + // get the size of the text + mui.draw_text_full(container, m_tempbuf.c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE, DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr); + width += (2.0f * UI_BOX_LR_BORDER) + 0.01f; + maxwidth = 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 + mui.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 + mui.draw_text_full(container, m_tempbuf.c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_TRUNCATE, + DRAW_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 + mui.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) + { + mui.draw_text_full(container, elem.c_str(), x1, y1, x2 - x1, JUSTIFY_LEFT, WRAP_TRUNCATE, + DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); + y1 += lineh; + } + +} + +/************************************************** +MENU ADD FOLDER +**************************************************/ +//------------------------------------------------- +// ctor / dtor +//------------------------------------------------- + +ui_menu_add_change_folder::ui_menu_add_change_folder(running_machine &machine, render_container *container, int ref) : ui_menu(machine, container) +{ + m_ref = ref; + m_change = (s_folders[ref].action == CHANGE); m_search[0] = '\0'; // configure the starting path @@ -71,6 +286,22 @@ ui_menu_add_change_folder::ui_menu_add_change_folder(running_machine &machine, r osd_get_full_path(&dst, "."); m_current_path = dst; osd_free(dst); + + std::string searchpath; + if (machine.ui().options().exists(s_folders[m_ref].option)) + { + searchpath = machine.ui().options().value(s_folders[m_ref].option); + } + else + { + searchpath = machine.options().value(s_folders[m_ref].option); + } + + path_iterator path(searchpath.c_str()); + std::string curpath; + while (path.next(curpath, nullptr)) + m_folders.push_back(curpath); + } ui_menu_add_change_folder::~ui_menu_add_change_folder() @@ -144,38 +375,41 @@ void ui_menu_add_change_folder::handle() std::string error_string; if (m_change) { - if (machine().ui().options().exists(s_folders_entry[m_ref].option)) + if (machine().ui().options().exists(s_folders[m_ref].option)) { - machine().ui().options().set_value(s_folders_entry[m_ref].option, m_current_path.c_str(), OPTION_PRIORITY_CMDLINE, error_string); + machine().ui().options().set_value(s_folders[m_ref].option, m_current_path.c_str(), OPTION_PRIORITY_CMDLINE, error_string); } - else { - if (strcmp(machine().options().value(s_folders_entry[m_ref].option), m_current_path.c_str()) != 0) + else + { + if (strcmp(machine().options().value(s_folders[m_ref].option), m_current_path.c_str()) != 0) { - machine().options().set_value(s_folders_entry[m_ref].option, m_current_path.c_str(), OPTION_PRIORITY_CMDLINE, error_string); - machine().options().mark_changed(s_folders_entry[m_ref].option); + machine().options().set_value(s_folders[m_ref].option, m_current_path.c_str(), OPTION_PRIORITY_CMDLINE, error_string); + machine().options().mark_changed(s_folders[m_ref].option); } } machine().datfile().reset_run(); } else { + m_folders.push_back(m_current_path); std::string tmppath; - if (machine().ui().options().exists(s_folders_entry[m_ref].option)) { - tmppath.assign(machine().ui().options().value(s_folders_entry[m_ref].option)).append(";").append(m_current_path.c_str()); - } - else { - tmppath.assign(machine().options().value(s_folders_entry[m_ref].option)).append(";").append(m_current_path.c_str()); - } - - if (machine().ui().options().exists(s_folders_entry[m_ref].option)) + for (int x = 0; x < m_folders.size(); ++x) { - machine().ui().options().set_value(s_folders_entry[m_ref].option, tmppath.c_str(), OPTION_PRIORITY_CMDLINE, error_string); + tmppath.append(m_folders[x]); + if (x != m_folders.size() - 1) + tmppath.append(";"); } - else { - if (strcmp(machine().options().value(s_folders_entry[m_ref].option), tmppath.c_str()) != 0) + + if (machine().ui().options().exists(s_folders[m_ref].option)) + { + machine().ui().options().set_value(s_folders[m_ref].option, tmppath.c_str(), OPTION_PRIORITY_CMDLINE, error_string); + } + else + { + if (strcmp(machine().options().value(s_folders[m_ref].option), tmppath.c_str()) != 0) { - machine().options().set_value(s_folders_entry[m_ref].option, tmppath.c_str(), OPTION_PRIORITY_CMDLINE, error_string); - machine().options().mark_changed(s_folders_entry[m_ref].option); + machine().options().set_value(s_folders[m_ref].option, tmppath.c_str(), OPTION_PRIORITY_CMDLINE, error_string); + machine().options().mark_changed(s_folders[m_ref].option); } } } @@ -279,14 +513,14 @@ void ui_menu_add_change_folder::custom_render(void *selectedref, float top, floa ui_manager &mui = machine().ui(); std::string tempbuf[2]; tempbuf[0] = (m_change) ? _("Change)") : _("Add"); - tempbuf[0].append(" ").append(s_folders_entry[m_ref].name).append(_(" Folder - Search: ")).append(m_search).append("_"); + tempbuf[0].append(" ").append(_(s_folders[m_ref].name)).append(_(" Folder - Search: ")).append(m_search).append("_"); tempbuf[1] = m_current_path; // get the size of the text - for (auto & elem: tempbuf) + for (auto & elem : tempbuf) { 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.0f * UI_BOX_LR_BORDER) + 0.01f; maxwidth = MAX(width, maxwidth); } @@ -341,245 +575,6 @@ void ui_menu_add_change_folder::custom_render(void *selectedref, float top, floa } -/************************************************** - MENU DIRECTORY -**************************************************/ -//------------------------------------------------- -// ctor / dtor -//------------------------------------------------- - -ui_menu_directory::ui_menu_directory(running_machine &machine, render_container *container) : ui_menu(machine, container) -{ -} - -ui_menu_directory::~ui_menu_directory() -{ - save_ui_options(machine()); - ui_globals::reset = true; -} - -//------------------------------------------------- -// handle -//------------------------------------------------- - -void ui_menu_directory::handle() -{ - // process the menu - const ui_menu_event *m_event = process(0); - - if (m_event != nullptr && m_event->itemref != nullptr && m_event->iptkey == IPT_UI_SELECT) - { - int ref = (FPTR)m_event->itemref; - bool change = (ref == HISTORY_FOLDERS || ref == EXTRAINI_FOLDERS || ref == UI_FOLDERS); - ui_menu::stack_push(global_alloc_clear(machine(), container, ref, change)); - } -} - -//------------------------------------------------- -// populate -//------------------------------------------------- - -void ui_menu_directory::populate() -{ - item_append("Roms", nullptr, 0, (void *)(FPTR)ROM_FOLDERS); - item_append("UI", nullptr, 0, (void *)(FPTR)UI_FOLDERS); - item_append("Samples", nullptr, 0, (void *)(FPTR)SAMPLE_FOLDERS); - item_append("INIs", nullptr, 0, (void *)(FPTR)INI_FOLDERS); - item_append("Artwork", nullptr, 0, (void *)(FPTR)ARTWORK_FOLDERS); - item_append("DATs (History, Mameinfo, etc...)", nullptr, 0, (void *)(FPTR)HISTORY_FOLDERS); - item_append("Extra INI (Category, etc...)", nullptr, 0, (void *)(FPTR)EXTRAINI_FOLDERS); - item_append("Icons", nullptr, 0, (void *)(FPTR)ICON_FOLDERS); - item_append("Cheats", nullptr, 0, (void *)(FPTR)CHEAT_FOLDERS); - item_append("Snapshots", nullptr, 0, (void *)(FPTR)SNAPSHOT_FOLDERS); - item_append("Cabinets", nullptr, 0, (void *)(FPTR)CABINET_FOLDERS); - item_append("Flyers", nullptr, 0, (void *)(FPTR)FLYER_FOLDERS); - item_append("Titles", nullptr, 0, (void *)(FPTR)TITLE_FOLDERS); - item_append("Ends", nullptr, 0, (void *)(FPTR)ENDS_FOLDERS); - item_append("PCBs", nullptr, 0, (void *)(FPTR)PCB_FOLDERS); - item_append("Marquees", nullptr, 0, (void *)(FPTR)MARQUEES_FOLDERS); - item_append("Control Panels", nullptr, 0, (void *)(FPTR)CPANEL_FOLDERS); - item_append("Bosses", nullptr, 0, (void *)(FPTR)BOSSES_FOLDERS); - item_append("Versus", nullptr, 0, (void *)(FPTR)VERSUS_FOLDERS); - item_append("Game Over", nullptr, 0, (void *)(FPTR)GAMEOVER_FOLDERS); - item_append("How To", nullptr, 0, (void *)(FPTR)HOWTO_FOLDERS); - item_append("Select", nullptr, 0, (void *)(FPTR)SELECT_FOLDERS); - item_append("Artwork Preview", nullptr, 0, (void *)(FPTR)ARTPREV_FOLDERS); - item_append("Scores", nullptr, 0, (void *)(FPTR)SCORES_FOLDERS); - item_append("Logos", nullptr, 0, (void *)(FPTR)LOGO_FOLDERS); - item_append("Crosshairs", nullptr, 0, (void *)(FPTR)CROSSHAIR_FOLDERS); - - item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); - customtop = machine().ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; -} - -//------------------------------------------------- -// perform our special rendering -//------------------------------------------------- - -void ui_menu_directory::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) -{ - float width; - ui_manager &mui = machine().ui(); - - // get the size of the text - mui.draw_text_full(container, _("Folders Setup"), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE, - DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr); - width += (2.0f * UI_BOX_LR_BORDER) + 0.01f; - float maxwidth = 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 - mui.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 - mui.draw_text_full(container, _("Folders Setup"), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_TRUNCATE, - DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); -} - -/************************************************** - MENU DISPLAY PATH -**************************************************/ -//------------------------------------------------- -// ctor / dtor -//------------------------------------------------- - -ui_menu_display_actual::ui_menu_display_actual(running_machine &machine, render_container *container, int ref, bool _change) : ui_menu(machine, container) -{ - m_ref = ref; - m_change = _change; -} - -ui_menu_display_actual::~ui_menu_display_actual() -{ -} - -//------------------------------------------------- -// handle -//------------------------------------------------- - -void ui_menu_display_actual::handle() -{ - // process the menu - const ui_menu_event *m_event = process(0); - if (m_event != nullptr && m_event->itemref != nullptr && m_event->iptkey == IPT_UI_SELECT) - switch ((FPTR)m_event->itemref) - { - case REMOVE_FOLDER: - ui_menu::stack_push(global_alloc_clear(machine(), container, m_ref)); - break; - - case ADD_FOLDER: - case CHANGE_FOLDER: - ui_menu::stack_push(global_alloc_clear(machine(), container, m_ref, m_change)); - break; - } -} - -//------------------------------------------------- -// populate -//------------------------------------------------- - -void ui_menu_display_actual::populate() -{ - m_tempbuf.assign(_("Current ")).append(s_folders_entry[m_ref - 1].name).append(_(" Folders")); - if (machine().ui().options().exists(s_folders_entry[m_ref - 1].option)) { - m_searchpath.assign(machine().ui().options().value(s_folders_entry[m_ref - 1].option)); - } - else { - m_searchpath.assign(machine().options().value(s_folders_entry[m_ref - 1].option)); - } - path_iterator path(m_searchpath.c_str()); - std::string curpath; - m_folders.clear(); - while (path.next(curpath, nullptr)) - m_folders.push_back(curpath); - - if (m_change) - item_append(_("Change Folder"), nullptr, 0, (void *)CHANGE_FOLDER); - else - item_append(_("Add Folder"), nullptr, 0, (void *)ADD_FOLDER); - - if (m_folders.size() > 1) - item_append(_("Remove Folder"), nullptr, 0, (void *)REMOVE_FOLDER); - - item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); - customtop = (m_folders.size() + 1) * machine().ui().get_line_height() + 6.0f * UI_BOX_TB_BORDER; -} - -//------------------------------------------------- -// perform our special rendering -//------------------------------------------------- - -void ui_menu_display_actual::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) -{ - float width, maxwidth = origx2 - origx1; - ui_manager &mui = machine().ui(); - float lineh = mui.get_line_height(); - - for (auto & elem : m_folders) - { - mui.draw_text_full(container, elem.c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_LEFT, WRAP_TRUNCATE, DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr); - width += (2.0f * UI_BOX_LR_BORDER) + 0.01f; - maxwidth = MAX(maxwidth, width); - } - - // get the size of the text - mui.draw_text_full(container, m_tempbuf.c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE, DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr); - width += (2.0f * UI_BOX_LR_BORDER) + 0.01f; - maxwidth = 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 - mui.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 - mui.draw_text_full(container, m_tempbuf.c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_TRUNCATE, - DRAW_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 - mui.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) - { - mui.draw_text_full(container, elem.c_str(), x1, y1, x2 - x1, JUSTIFY_LEFT, WRAP_TRUNCATE, - DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); - y1 += lineh; - } - -} - /************************************************** MENU REMOVE FOLDER **************************************************/ @@ -589,14 +584,16 @@ void ui_menu_display_actual::custom_render(void *selectedref, float top, float b ui_menu_remove_folder::ui_menu_remove_folder(running_machine &machine, render_container *container, int ref) : ui_menu(machine, container) { - m_ref = ref - 1; - if (machine.ui().options().exists(s_folders_entry[m_ref].option)) { - m_searchpath.assign(machine.ui().options().value(s_folders_entry[m_ref].option)); - } - else { - m_searchpath.assign(machine.options().value(s_folders_entry[m_ref].option)); - } + m_ref = ref; + if (machine.ui().options().exists(s_folders[m_ref].option)) + m_searchpath.assign(machine.ui().options().value(s_folders[m_ref].option)); + else + m_searchpath.assign(machine.options().value(s_folders[m_ref].option)); + path_iterator path(m_searchpath.c_str()); + std::string curpath; + while (path.next(curpath, nullptr)) + m_folders.push_back(curpath); } ui_menu_remove_folder::~ui_menu_remove_folder() @@ -613,23 +610,25 @@ void ui_menu_remove_folder::handle() const ui_menu_event *m_event = process(0); if (m_event != nullptr && m_event->itemref != nullptr && m_event->iptkey == IPT_UI_SELECT) { - int index = (FPTR)m_event->itemref - 1; - std::string tmppath; - for (size_t i = 0; i < item.size() - 2; i++) - if (i != index) - tmppath.append(item[i].text).append(";"); - - tmppath.substr(0, tmppath.size() - 1); - std::string error_string; - if (machine().ui().options().exists(s_folders_entry[m_ref].option)) + std::string tmppath, error_string; + for (int x = 0; x < m_folders.size(); ++x) { - machine().ui().options().set_value(s_folders_entry[m_ref].option, tmppath.c_str(), OPTION_PRIORITY_CMDLINE, error_string); + if (x != selected) + tmppath.append(m_folders[x]); + if (x < m_folders.size() - 1) + tmppath.append(";"); } - else { - if (strcmp(machine().options().value(s_folders_entry[m_ref].option),tmppath.c_str())!=0) + + if (machine().ui().options().exists(s_folders[m_ref].option)) + { + machine().ui().options().set_value(s_folders[m_ref].option, tmppath.c_str(), OPTION_PRIORITY_CMDLINE, error_string); + } + else + { + if (strcmp(machine().options().value(s_folders[m_ref].option),tmppath.c_str())!=0) { - machine().options().set_value(s_folders_entry[m_ref].option, tmppath.c_str(), OPTION_PRIORITY_CMDLINE, error_string); - machine().options().mark_changed(s_folders_entry[m_ref].option); + machine().options().set_value(s_folders[m_ref].option, tmppath.c_str(), OPTION_PRIORITY_CMDLINE, error_string); + machine().options().mark_changed(s_folders[m_ref].option); } } @@ -644,12 +643,9 @@ void ui_menu_remove_folder::handle() void ui_menu_remove_folder::populate() { - path_iterator path(m_searchpath.c_str()); - std::string curpath; int folders_count = 0; - - while (path.next(curpath, nullptr)) - item_append(curpath.c_str(), nullptr, 0, (void *)(FPTR)++folders_count); + for (auto & elem : m_folders) + item_append(elem.c_str(), nullptr, 0, (void *)(FPTR)++folders_count); item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); @@ -664,7 +660,7 @@ void ui_menu_remove_folder::custom_render(void *selectedref, float top, float bo { float width; ui_manager &mui = machine().ui(); - std::string tempbuf = std::string(_("Remove ")).append(s_folders_entry[m_ref].name).append(_(" Folder")); + std::string tempbuf = std::string(_("Remove ")).append(_(s_folders[m_ref].name)).append(_(" Folder")); // get the size of the text mui.draw_text_full(container, tempbuf.c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_NEVER, DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr); diff --git a/src/emu/ui/dirmenu.h b/src/emu/ui/dirmenu.h index 47734fc6542..5c48d9ad696 100644 --- a/src/emu/ui/dirmenu.h +++ b/src/emu/ui/dirmenu.h @@ -25,37 +25,6 @@ public: virtual void populate() override; virtual void handle() override; virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override; - -private: - enum - { - ROM_FOLDERS = 1, - UI_FOLDERS, - SAMPLE_FOLDERS, - HISTORY_FOLDERS, - INI_FOLDERS, - EXTRAINI_FOLDERS, - ICON_FOLDERS, - CHEAT_FOLDERS, - SNAPSHOT_FOLDERS, - CABINET_FOLDERS, - FLYER_FOLDERS, - TITLE_FOLDERS, - ENDS_FOLDERS, - PCB_FOLDERS, - MARQUEES_FOLDERS, - CPANEL_FOLDERS, - CROSSHAIR_FOLDERS, - ARTWORK_FOLDERS, - BOSSES_FOLDERS, - ARTPREV_FOLDERS, - SELECT_FOLDERS, - GAMEOVER_FOLDERS, - HOWTO_FOLDERS, - LOGO_FOLDERS, - SCORES_FOLDERS, - VERSUS_FOLDERS - }; }; //------------------------------------------------- @@ -65,7 +34,7 @@ private: class ui_menu_display_actual : public ui_menu { public: - ui_menu_display_actual(running_machine &machine, render_container *container, int selectedref, bool _change); + ui_menu_display_actual(running_machine &machine, render_container *container, int selectedref); virtual ~ui_menu_display_actual(); virtual void populate() override; virtual void handle() override; @@ -75,13 +44,11 @@ private: std::string m_tempbuf, m_searchpath; std::vector m_folders; int m_ref; - bool m_change; enum { - ADD_FOLDER = 1, - REMOVE_FOLDER, - CHANGE_FOLDER + ADD_CHANGE = 1, + REMOVE, }; }; @@ -101,6 +68,7 @@ public: private: std::string m_searchpath; int m_ref; + std::vector m_folders; }; //------------------------------------------------- @@ -110,7 +78,7 @@ private: class ui_menu_add_change_folder : public ui_menu { public: - ui_menu_add_change_folder(running_machine &machine, render_container *container, int ref, bool change); + ui_menu_add_change_folder(running_machine &machine, render_container *container, int ref); virtual ~ui_menu_add_change_folder(); virtual void populate() override; virtual void handle() override; @@ -123,6 +91,7 @@ private: std::string m_current_path; char m_search[40]; bool m_change; + std::vector m_folders; }; #endif /* __UI_DIRMENU_H__ */ diff --git a/src/emu/ui/ui.cpp b/src/emu/ui/ui.cpp index 6652bf0b8e8..8a0c7f2549c 100644 --- a/src/emu/ui/ui.cpp +++ b/src/emu/ui/ui.cpp @@ -412,7 +412,7 @@ void ui_manager::display_startup_screens(bool first_time, bool show_disclaimer) if (show_mandatory_fileman && machine().image().mandatory_scan(messagebox_text).length() > 0) { std::string warning; - warning.assign("This driver requires images to be loaded in the following device(s): ").append(messagebox_text.substr(0, messagebox_text.length() - 2)); + warning.assign(_("This driver requires images to be loaded in the following device(s): ")).append(messagebox_text.substr(0, messagebox_text.length() - 2)); ui_menu_file_manager::force_file_manager(machine(), &machine().render().ui_container(), warning.c_str()); } break; @@ -1059,9 +1059,9 @@ bool ui_manager::show_timecode_total() std::string &ui_manager::disclaimer_string(std::string &str) { - str.assign("Usage of emulators in conjunction with ROMs you don't own is forbidden by copyright law.\n\n"); - strcatprintf(str, "IF YOU ARE NOT LEGALLY ENTITLED TO PLAY \"%s\" ON THIS EMULATOR, PRESS ESC.\n\n", machine().system().description); - str.append("Otherwise, type OK or move the joystick left then right to continue"); + str.assign(_("Usage of emulators in conjunction with ROMs you don't own is forbidden by copyright law.\n\n")); + strcatprintf(str, _("IF YOU ARE NOT LEGALLY ENTITLED TO PLAY \"%s\" ON THIS EMULATOR, PRESS ESC.\n\n"), machine().system().description); + str.append(_("Otherwise, type OK or move the joystick left then right to continue")); return str; } @@ -1096,7 +1096,7 @@ std::string &ui_manager::warnings_string(std::string &str) // add a warning if any ROMs were loaded with warnings if (machine().rom_load().warnings() > 0) { - str.append("One or more ROMs/CHDs for this machine are incorrect. The machine may not run correctly.\n"); + str.append(_("One or more ROMs/CHDs for this machine are incorrect. The machine may not run correctly.\n")); if (machine().system().flags & WARNING_FLAGS) str.append("\n"); } @@ -1109,42 +1109,42 @@ std::string &ui_manager::warnings_string(std::string &str) // if we have at least one warning flag, print the general header if ((machine().system().flags & WARNING_FLAGS) || machine().rom_load().knownbad() > 0) { - str.append("There are known problems with this machine\n\n"); + str.append(_("There are known problems with this machine\n\n")); // add a warning if any ROMs are flagged BAD_DUMP/NO_DUMP if (machine().rom_load().knownbad() > 0) { - str.append("One or more ROMs/CHDs for this machine have not been correctly dumped.\n"); + str.append(_("One or more ROMs/CHDs for this machine have not been correctly dumped.\n")); } // add one line per warning flag if (machine().system().flags & MACHINE_IMPERFECT_KEYBOARD) - str.append("The keyboard emulation may not be 100% accurate.\n"); + str.append(_("The keyboard emulation may not be 100% accurate.\n")); if (machine().system().flags & MACHINE_IMPERFECT_COLORS) - str.append("The colors aren't 100% accurate.\n"); + str.append(_("The colors aren't 100% accurate.\n")); if (machine().system().flags & MACHINE_WRONG_COLORS) - str.append("The colors are completely wrong.\n"); + str.append(_("The colors are completely wrong.\n")); if (machine().system().flags & MACHINE_IMPERFECT_GRAPHICS) - str.append("The video emulation isn't 100% accurate.\n"); + str.append(_("The video emulation isn't 100% accurate.\n")); if (machine().system().flags & MACHINE_IMPERFECT_SOUND) - str.append("The sound emulation isn't 100% accurate.\n"); + str.append(_("The sound emulation isn't 100% accurate.\n")); if (machine().system().flags & MACHINE_NO_SOUND) { - str.append("The machine lacks sound.\n"); + str.append(_("The machine lacks sound.\n")); } if (machine().system().flags & MACHINE_NO_COCKTAIL) - str.append("Screen flipping in cocktail mode is not supported.\n"); + str.append(_("Screen flipping in cocktail mode is not supported.\n")); // check if external artwork is present before displaying this warning? if (machine().system().flags & MACHINE_REQUIRES_ARTWORK) { - str.append("The machine requires external artwork files\n"); + str.append(_("The machine requires external artwork files\n")); } if (machine().system().flags & MACHINE_IS_INCOMPLETE ) { - str.append("This machine was never completed. It may exhibit strange behavior or missing elements that are not bugs in the emulation.\n"); + str.append(_("This machine was never completed. It may exhibit strange behavior or missing elements that are not bugs in the emulation.\n")); } if (machine().system().flags & MACHINE_NO_SOUND_HW ) { - str.append("This machine has no sound hardware, MAME will produce no sounds, this is expected behaviour.\n"); + str.append(_("This machine has no sound hardware, MAME will produce no sounds, this is expected behaviour.\n")); } // if there's a NOT WORKING, UNEMULATED PROTECTION or GAME MECHANICAL warning, make it stronger @@ -1152,15 +1152,15 @@ std::string &ui_manager::warnings_string(std::string &str) { // add the strings for these warnings if (machine().system().flags & MACHINE_UNEMULATED_PROTECTION) { - str.append("The machine has protection which isn't fully emulated.\n"); + str.append(_("The machine has protection which isn't fully emulated.\n")); } if (machine().system().flags & MACHINE_NOT_WORKING) { - str.append("\nTHIS MACHINE DOESN'T WORK. The emulation for this machine is not yet complete. " - "There is nothing you can do to fix this problem except wait for the developers to improve the emulation.\n"); + str.append(_("\nTHIS MACHINE DOESN'T WORK. The emulation for this machine is not yet complete. " + "There is nothing you can do to fix this problem except wait for the developers to improve the emulation.\n")); } if (machine().system().flags & MACHINE_MECHANICAL) { - str.append("\nCertain elements of this machine cannot be emulated as it requires actual physical interaction or consists of mechanical devices. " - "It is not possible to fully play this machine.\n"); + str.append(_("\nCertain elements of this machine cannot be emulated as it requires actual physical interaction or consists of mechanical devices. " + "It is not possible to fully play this machine.\n")); } // find the parent of this driver @@ -1178,7 +1178,7 @@ std::string &ui_manager::warnings_string(std::string &str) { // this one works, add a header and display the name of the clone if (!foundworking) { - str.append("\n\nThere are working clones of this machine: "); + str.append(_("\n\nThere are working clones of this machine: ")); } else str.append(", "); @@ -1192,7 +1192,7 @@ std::string &ui_manager::warnings_string(std::string &str) } // add the 'press OK' string - str.append("\n\nType OK or move the joystick left then right to continue"); + str.append(_("\n\nType OK or move the joystick left then right to continue")); return str; } @@ -1251,7 +1251,7 @@ std::string &ui_manager::game_info_astring(std::string &str) // append the Sound: string if (!found_sound) - str.append("\nSound:\n"); + str.append(_("\nSound:\n")); found_sound = true; // count how many identical sound chips we have @@ -1279,11 +1279,11 @@ std::string &ui_manager::game_info_astring(std::string &str) } // display screen information - str.append("\nVideo:\n"); + str.append(_("\nVideo:\n")); screen_device_iterator scriter(machine().root_device()); int scrcount = scriter.count(); if (scrcount == 0) - str.append("None\n"); + str.append(_("None\n")); else { for (screen_device *screen = scriter.first(); screen != nullptr; screen = scriter.next()) @@ -1295,7 +1295,7 @@ std::string &ui_manager::game_info_astring(std::string &str) } if (screen->screen_type() == SCREEN_TYPE_VECTOR) - str.append("Vector\n"); + str.append(_("Vector\n")); else { const rectangle &visarea = screen->visible_area(); @@ -1587,22 +1587,22 @@ UINT32 ui_manager::handler_ingame(running_machine &machine, render_container *co if (machine.ui_active()) { machine.ui().popup_time(2, "%s\n%s\n%s\n%s\n%s\n%s\n", - "Keyboard Emulation Status", + _("Keyboard Emulation Status"), "-------------------------", - "Mode: PARTIAL Emulation", - "UI: Enabled", + _("Mode: PARTIAL Emulation"), + _("UI: Enabled"), "-------------------------", - "**Use ScrLock to toggle**"); + _("**Use ScrLock to toggle**")); } else { machine.ui().popup_time(2, "%s\n%s\n%s\n%s\n%s\n%s\n", - "Keyboard Emulation Status", + _("Keyboard Emulation Status"), "-------------------------", - "Mode: FULL Emulation", - "UI: Disabled", + _("Mode: FULL Emulation"), + _("UI: Disabled"), "-------------------------", - "**Use ScrLock to toggle**"); + _("**Use ScrLock to toggle**")); } } } @@ -1746,13 +1746,13 @@ UINT32 ui_manager::handler_ingame(running_machine &machine, render_container *co { if (!machine.options().cheat()) { - machine.popmessage("Autofire can't be enabled"); + machine.popmessage(_("Autofire can't be enabled")); } else { bool autofire_toggle = machine.ioport().get_autofire_toggle(); machine.ioport().set_autofire_toggle(!autofire_toggle); - machine.popmessage("Autofire %s", autofire_toggle ? "Enabled" : "Disabled"); + machine.popmessage("Autofire %s", autofire_toggle ? _("Enabled") : _("Disabled")); } } @@ -1785,9 +1785,9 @@ UINT32 ui_manager::handler_load_save(running_machine &machine, render_container // okay, we're waiting for a key to select a slot; display a message if (state == LOADSAVE_SAVE) - machine.ui().draw_message_window(container, "Select position to save to"); + machine.ui().draw_message_window(container, _("Select position to save to")); else - machine.ui().draw_message_window(container, "Select position to load from"); + machine.ui().draw_message_window(container, _("Select position to load from")); // if load/save state sequence is still being pressed, do not read the filename yet if (machine.ui().m_load_save_hold) { @@ -1811,9 +1811,9 @@ UINT32 ui_manager::handler_load_save(running_machine &machine, render_container { // display a popup indicating things were cancelled if (state == LOADSAVE_SAVE) - machine.popmessage("Save cancelled"); + machine.popmessage(_("Save cancelled")); else - machine.popmessage("Load cancelled"); + machine.popmessage(_("Load cancelled")); // reset the state machine.resume(); @@ -1856,12 +1856,12 @@ UINT32 ui_manager::handler_load_save(running_machine &machine, render_container // display a popup indicating that the save will proceed if (state == LOADSAVE_SAVE) { - machine.popmessage("Save to position %s", filename); + machine.popmessage(_("Save to position %s"), filename); machine.schedule_save(filename); } else { - machine.popmessage("Load from position %s", filename); + machine.popmessage(_("Load from position %s"), filename); machine.schedule_load(filename); } @@ -1901,9 +1901,9 @@ UINT32 ui_manager::handler_confirm_quit(running_machine &machine, render_contain std::string ui_cancel_text = machine.input().seq_name(machine.ioport().type_seq(IPT_UI_CANCEL, 0, SEQ_TYPE_STANDARD)); // assemble the quit message - std::string quit_message = strformat("Are you sure you want to quit?\n\n" + std::string quit_message = strformat(_("Are you sure you want to quit?\n\n" "Press ''%s'' to quit,\n" - "Press ''%s'' to return to emulation.", + "Press ''%s'' to return to emulation."), ui_select_text.c_str(), ui_cancel_text.c_str()); @@ -1977,7 +1977,7 @@ static slider_state *slider_init(running_machine &machine) int item; // add overall volume - *tailptr = slider_alloc(machine, "Master Volume", -32, 0, 0, 1, slider_volume, nullptr); + *tailptr = slider_alloc(machine, _("Master Volume"), -32, 0, 0, 1, slider_volume, nullptr); tailptr = &(*tailptr)->next; // add per-channel volume @@ -1988,7 +1988,7 @@ static slider_state *slider_init(running_machine &machine) INT32 defval = 1000; str.assign(info.stream->input_name(info.inputnum)); - str.append(" Volume"); + str.append(_(" Volume")); *tailptr = slider_alloc(machine, str.c_str(), 0, defval, maxval, 20, slider_mixervol, (void *)(FPTR)item); tailptr = &(*tailptr)->next; } @@ -2091,13 +2091,13 @@ static slider_state *slider_init(running_machine &machine) if (screen->screen_type() == SCREEN_TYPE_VECTOR) { // add vector control - *tailptr = slider_alloc(machine, "Vector Flicker", 0, 0, 1000, 10, slider_flicker, nullptr); + *tailptr = slider_alloc(machine, _("Vector Flicker"), 0, 0, 1000, 10, slider_flicker, nullptr); tailptr = &(*tailptr)->next; - *tailptr = slider_alloc(machine, "Beam Width Minimum", 1, 100, 1000, 1, slider_beam_width_min, nullptr); + *tailptr = slider_alloc(machine, _("Beam Width Minimum"), 1, 100, 1000, 1, slider_beam_width_min, nullptr); tailptr = &(*tailptr)->next; - *tailptr = slider_alloc(machine, "Beam Width Maximum", 1, 100, 1000, 1, slider_beam_width_max, nullptr); + *tailptr = slider_alloc(machine, _("Beam Width Maximum"), 1, 100, 1000, 1, slider_beam_width_max, nullptr); tailptr = &(*tailptr)->next; - *tailptr = slider_alloc(machine, "Beam Intensity Weight", -1000, 0, 1000, 10, slider_beam_intensity_weight, nullptr); + *tailptr = slider_alloc(machine, _("Beam Intensity Weight"), -1000, 0, 1000, 10, slider_beam_intensity_weight, nullptr); tailptr = &(*tailptr)->next; break; } @@ -2537,9 +2537,9 @@ static char *slider_get_screen_desc(screen_device &screen) static char descbuf[256]; if (scrcount > 1) - sprintf(descbuf, "Screen '%s'", screen.tag()); + sprintf(descbuf, _("Screen '%s'"), screen.tag()); else - strcpy(descbuf, "Screen"); + strcpy(descbuf, _("Screen")); return descbuf; } @@ -2557,7 +2557,7 @@ static INT32 slider_crossscale(running_machine &machine, void *arg, std::string if (newval != SLIDER_NOCHANGE) field->set_crosshair_scale(float(newval) * 0.001); if (str != nullptr) - strprintf(*str,"%s %s %1.3f", "Crosshair Scale", (field->crosshair_axis() == CROSSHAIR_AXIS_X) ? "X" : "Y", float(newval) * 0.001f); + strprintf(*str,"%s %s %1.3f", _("Crosshair Scale"), (field->crosshair_axis() == CROSSHAIR_AXIS_X) ? "X" : "Y", float(newval) * 0.001f); return floor(field->crosshair_scale() * 1000.0f + 0.5f); } #endif @@ -2576,7 +2576,7 @@ static INT32 slider_crossoffset(running_machine &machine, void *arg, std::string if (newval != SLIDER_NOCHANGE) field->set_crosshair_offset(float(newval) * 0.001f); if (str != nullptr) - strprintf(*str,"%s %s %1.3f", "Crosshair Offset", (field->crosshair_axis() == CROSSHAIR_AXIS_X) ? "X" : "Y", float(newval) * 0.001f); + strprintf(*str,"%s %s %1.3f", _("Crosshair Offset"), (field->crosshair_axis() == CROSSHAIR_AXIS_X) ? "X" : "Y", float(newval) * 0.001f); return field->crosshair_offset(); } #endif diff --git a/src/emu/ui/videoopt.cpp b/src/emu/ui/videoopt.cpp index aa3bc21dd5f..6ba6aa710f3 100644 --- a/src/emu/ui/videoopt.cpp +++ b/src/emu/ui/videoopt.cpp @@ -52,7 +52,7 @@ void ui_menu_video_targets::populate() break; /* add a menu item */ - sprintf(buffer, "Screen #%d", targetnum); + sprintf(buffer, _("Screen #%d"), targetnum); item_append(buffer, nullptr, 0, target); } } @@ -200,31 +200,31 @@ void ui_menu_video_options::populate() case ROT180: subtext = "180" UTF8_DEGREES; break; case ROT270: subtext = "CCW 90" UTF8_DEGREES; break; } - item_append("Rotate", subtext, MENU_FLAG_LEFT_ARROW | MENU_FLAG_RIGHT_ARROW, (void *)VIDEO_ITEM_ROTATE); + item_append(_("Rotate"), subtext, MENU_FLAG_LEFT_ARROW | MENU_FLAG_RIGHT_ARROW, (void *)VIDEO_ITEM_ROTATE); /* backdrop item */ enabled = target->backdrops_enabled(); - item_append("Backdrops", enabled ? "Enabled" : "Disabled", enabled ? MENU_FLAG_LEFT_ARROW : MENU_FLAG_RIGHT_ARROW, (void *)VIDEO_ITEM_BACKDROPS); + item_append(_("Backdrops"), enabled ? _("Enabled") : _("Disabled"), enabled ? MENU_FLAG_LEFT_ARROW : MENU_FLAG_RIGHT_ARROW, (void *)VIDEO_ITEM_BACKDROPS); /* overlay item */ enabled = target->overlays_enabled(); - item_append("Overlays", enabled ? "Enabled" : "Disabled", enabled ? MENU_FLAG_LEFT_ARROW : MENU_FLAG_RIGHT_ARROW, (void *)VIDEO_ITEM_OVERLAYS); + item_append(_("Overlays"), enabled ? _("Enabled") : _("Disabled"), enabled ? MENU_FLAG_LEFT_ARROW : MENU_FLAG_RIGHT_ARROW, (void *)VIDEO_ITEM_OVERLAYS); /* bezel item */ enabled = target->bezels_enabled(); - item_append("Bezels", enabled ? "Enabled" : "Disabled", enabled ? MENU_FLAG_LEFT_ARROW : MENU_FLAG_RIGHT_ARROW, (void *)VIDEO_ITEM_BEZELS); + item_append(_("Bezels"), enabled ? _("Enabled") : _("Disabled"), enabled ? MENU_FLAG_LEFT_ARROW : MENU_FLAG_RIGHT_ARROW, (void *)VIDEO_ITEM_BEZELS); /* cpanel item */ enabled = target->cpanels_enabled(); - item_append("CPanels", enabled ? "Enabled" : "Disabled", enabled ? MENU_FLAG_LEFT_ARROW : MENU_FLAG_RIGHT_ARROW, (void *)VIDEO_ITEM_CPANELS); + item_append(_("CPanels"), enabled ? _("Enabled") : _("Disabled"), enabled ? MENU_FLAG_LEFT_ARROW : MENU_FLAG_RIGHT_ARROW, (void *)VIDEO_ITEM_CPANELS); /* marquee item */ enabled = target->marquees_enabled(); - item_append("Marquees", enabled ? "Enabled" : "Disabled", enabled ? MENU_FLAG_LEFT_ARROW : MENU_FLAG_RIGHT_ARROW, (void *)VIDEO_ITEM_MARQUEES); + item_append(_("Marquees"), enabled ? _("Enabled") : _("Disabled"), enabled ? MENU_FLAG_LEFT_ARROW : MENU_FLAG_RIGHT_ARROW, (void *)VIDEO_ITEM_MARQUEES); /* cropping */ enabled = target->zoom_to_screen(); - item_append("View", enabled ? "Cropped" : "Full", enabled ? MENU_FLAG_RIGHT_ARROW : MENU_FLAG_LEFT_ARROW, (void *)VIDEO_ITEM_ZOOM); + item_append(_("View"), enabled ? _("Cropped") : _("Full"), enabled ? MENU_FLAG_RIGHT_ARROW : MENU_FLAG_LEFT_ARROW, (void *)VIDEO_ITEM_ZOOM); } ui_menu_video_options::~ui_menu_video_options() diff --git a/src/emu/ui/viewgfx.cpp b/src/emu/ui/viewgfx.cpp index 326e67779c9..ff34e732f1e 100644 --- a/src/emu/ui/viewgfx.cpp +++ b/src/emu/ui/viewgfx.cpp @@ -388,7 +388,7 @@ static void palette_handler(running_machine &machine, render_container *containe cellboxbounds.y0 += 3.0f * chheight; // figure out the title and expand the outer box to fit - const char *suffix = palette->indirect_entries() == 0 ? "" : state.palette.which ? " COLORS" : " PENS"; + const char *suffix = palette->indirect_entries() == 0 ? "" : state.palette.which ? _(" COLORS") : _(" PENS"); sprintf(title, "'%s'%s", palette->tag(), suffix); titlewidth = ui_font->string_width(chheight, machine.render().ui_aspect(), title); x0 = 0.0f;