void ui_menu_font_ui::populate() { // set filter arrow UINT32 arrow_flags; std::string tmptxt; #ifdef UI_WINDOWS // add fonts option arrow_flags = get_arrow_flags(0, m_fonts.size() - 1, m_actual); std::string name(m_fonts[m_actual]); item_append(_("UI Font"), name.c_str(), arrow_flags, (void *)(FPTR)MUI_FNT); if (name != "default") { item_append(_("Bold"), m_bold ? "On" : "Off", m_bold ? MENU_FLAG_RIGHT_ARROW : MENU_FLAG_LEFT_ARROW, (void *)(FPTR)MUI_BOLD); item_append(_("Italic"), m_italic ? "On" : "Off", m_italic ? MENU_FLAG_RIGHT_ARROW : MENU_FLAG_LEFT_ARROW, (void *)(FPTR)MUI_ITALIC); } #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(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(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); custombottom = customtop = machine().ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; }
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); } else 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); } else 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); } else 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); } else 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); item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); custombottom = customtop = machine().ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; }
//------------------------------------------------- // populate //------------------------------------------------- void ui_menu_custom_filter::populate() { // add main filter UINT32 arrow_flags = get_arrow_flags((int)FILTER_ALL, (int)FILTER_UNAVAILABLE, custfltr::main); item_append(_("Main filter"), main_filters::text[custfltr::main], arrow_flags, (void *)(FPTR)MAIN_FILTER); // add other filters for (int x = 1; x <= custfltr::numother; x++) { item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); // add filter items arrow_flags = get_arrow_flags((int)FILTER_UNAVAILABLE + 1, (int)FILTER_LAST - 1, custfltr::other[x]); item_append(_("Other filter"), main_filters::text[custfltr::other[x]], arrow_flags, (void *)(FPTR)(OTHER_FILTER + x)); if (m_added) selected = item.size() - 2; // add manufacturer subitem if (custfltr::other[x] == FILTER_MANUFACTURER && c_mnfct::ui.size() > 0) { arrow_flags = get_arrow_flags(0, c_mnfct::ui.size() - 1, custfltr::mnfct[x]); std::string fbuff("^!Manufacturer"); convert_command_glyph(fbuff); item_append(fbuff.c_str(), c_mnfct::ui[custfltr::mnfct[x]].c_str(), arrow_flags, (void *)(FPTR)(MNFCT_FILTER + x)); } // add year subitem else if (custfltr::other[x] == FILTER_YEAR && c_year::ui.size() > 0) { arrow_flags = get_arrow_flags(0, c_year::ui.size() - 1, custfltr::year[x]); std::string fbuff("^!Year"); convert_command_glyph(fbuff); item_append(fbuff.c_str(), c_year::ui[custfltr::year[x]].c_str(), arrow_flags, (void *)(FPTR)(YEAR_FILTER + x)); } } item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); if (custfltr::numother > 0) item_append(_("Remove last filter"), nullptr, 0, (void *)(FPTR)REMOVE_FILTER); if (custfltr::numother < MAX_CUST_FILTER - 2) item_append(_("Add filter"), nullptr, 0, (void *)(FPTR)ADD_FILTER); item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); customtop = machine().ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; }
void ui_menu_machine_configure::populate() { // add options items item_append(_("Bios"), nullptr, MENU_FLAG_DISABLE | MENU_FLAG_UI_HEADING, nullptr); if (!m_bios.empty()) { UINT32 arrows = get_arrow_flags(0, m_bios.size() - 1, m_curbios); item_append(_("Driver"), m_bios[m_curbios].first.c_str(), arrows, (void *)(FPTR)BIOS); } else item_append(_("This machine has no bios."), nullptr, MENU_FLAG_DISABLE, nullptr); item_append(ui_menu_item_type::SEPARATOR); item_append(_(advanced_submenu_options[0].description), nullptr, 0, (void *)(FPTR)ADVANCED); item_append(_(video_submenu_options[0].description), nullptr, 0, (void *)(FPTR)VIDEO); item_append(_(control_submenu_options[0].description), nullptr, 0, (void *)(FPTR)CONTROLLER); item_append(ui_menu_item_type::SEPARATOR); if (!mame_machine_manager::instance()->favorite().isgame_favorite(m_drv)) item_append(_("Add To Favorites"), nullptr, 0, (void *)ADDFAV); else item_append(_("Remove From Favorites"), nullptr, 0, (void *)DELFAV); item_append(ui_menu_item_type::SEPARATOR); item_append(_("Save machine configuration"), nullptr, 0, (void *)(FPTR)SAVE); item_append(ui_menu_item_type::SEPARATOR); customtop = 2.0f * mame_machine_manager::instance()->ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; }
void ui_menu_custom_ui::populate() { UINT32 arrow_flags; item_append(_("Fonts"), nullptr, 0, (void *)(FPTR)FONT_MENU); item_append(_("Colors"), nullptr, 0, (void *)(FPTR)COLORS_MENU); if (!m_lang.empty()) { arrow_flags = get_arrow_flags(0, m_lang.size() - 1, m_currlang); item_append(_("Language"), m_lang[m_currlang].c_str(), arrow_flags, (void *)(FPTR)LANGUAGE_MENU); } 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(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); customtop = machine().ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; }
void ui_menu_controller_mapping::populate() { // add options for (int d = 1; d < ARRAY_LENGTH(m_options); ++d) { UINT32 arrow_flags = get_arrow_flags(0, ARRAY_LENGTH(m_device_status) - 1, m_options[d].status); item_append(_(m_options[d].description), m_device_status[m_options[d].status], arrow_flags, (void *)(FPTR)d); } item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); customtop = machine().ui().get_line_height() + (3.0f * UI_BOX_TB_BORDER); }
void ui_menu_display_options::populate() { // add video mode option std::string v_text(m_video[m_list[m_options[1].status]]); UINT32 arrow_flags = get_arrow_flags(0, m_list.size() - 1, m_options[1].status); item_append(m_options[1].description, v_text.c_str(), arrow_flags, (void *)(FPTR)1); // add options items for (int opt = 2; opt < ARRAY_LENGTH(m_options); ++opt) if (strcmp(m_options[opt].option, OSDOPTION_PRESCALE) != 0) item_append(m_options[opt].description, m_options[opt].status ? "On" : "Off", m_options[opt].status ? MENU_FLAG_RIGHT_ARROW : MENU_FLAG_LEFT_ARROW, (void *)(FPTR)opt); else { strprintf(v_text, "%d", m_options[opt].status); arrow_flags = get_arrow_flags(1, 3, m_options[opt].status); item_append(m_options[opt].description, v_text.c_str(), arrow_flags, (void *)(FPTR)opt); } item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); customtop = machine().ui().get_line_height() + (3.0f * UI_BOX_TB_BORDER); }
void menu_sound_options::populate() { UINT32 arrow_flags = get_arrow_flags(0, ARRAY_LENGTH(m_sound_rate) - 1, m_cur_rates); m_sample_rate = m_sound_rate[m_cur_rates]; // add options items item_append(_("Sound"), m_sound ? _("On") : _("Off"), m_sound ? FLAG_RIGHT_ARROW : FLAG_LEFT_ARROW, (void *)(FPTR)ENABLE_SOUND); item_append(_("Sample Rate"), string_format("%d", m_sample_rate).c_str(), arrow_flags, (void *)(FPTR)SAMPLE_RATE); item_append(_("Use External Samples"), m_samples ? _("On") : _("Off"), m_samples ? FLAG_RIGHT_ARROW : FLAG_LEFT_ARROW, (void *)(FPTR)ENABLE_SAMPLES); item_append(menu_item_type::SEPARATOR); customtop = ui().get_line_height() + (3.0f * UI_BOX_TB_BORDER); }
void ui_menu_sound_options::populate() { UINT32 arrow_flags = get_arrow_flags(0, ARRAY_LENGTH(m_sound_rate) - 1, m_cur_rates); m_sample_rate = m_sound_rate[m_cur_rates]; std::string s_text; strprintf(s_text, "%d", m_sample_rate); // add options items item_append("Sound", m_sound ? "On" : "Off", m_sound ? MENU_FLAG_RIGHT_ARROW : MENU_FLAG_LEFT_ARROW, (void *)(FPTR)ENABLE_SOUND); item_append("Sample Rate", s_text.c_str(), arrow_flags, (void *)(FPTR)SAMPLE_RATE); item_append("Use External Samples", m_samples ? "On" : "Off", m_samples ? MENU_FLAG_RIGHT_ARROW : MENU_FLAG_LEFT_ARROW, (void *)(FPTR)ENABLE_SAMPLES); item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); customtop = machine().ui().get_line_height() + (3.0f * UI_BOX_TB_BORDER); }
//------------------------------------------------- // populate //------------------------------------------------- void ui_menu_swcustom_filter::populate() { // add main filter UINT32 arrow_flags = get_arrow_flags((int)UI_SW_ALL, (int)UI_SW_UNAVAILABLE, sw_custfltr::main); item_append(_("Main filter"), sw_filters::text[sw_custfltr::main], arrow_flags, (void *)(FPTR)MAIN_FILTER); // add other filters for (int x = 1; x <= sw_custfltr::numother; x++) { item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); // add filter items arrow_flags = get_arrow_flags((int)UI_SW_UNAVAILABLE + 1, (int)UI_SW_LAST - 1, sw_custfltr::other[x]); item_append(_("Other filter"), sw_filters::text[sw_custfltr::other[x]], arrow_flags, (void *)(FPTR)(OTHER_FILTER + x)); if (m_added) selected = item.size() - 2; // add publisher subitem if (sw_custfltr::other[x] == UI_SW_PUBLISHERS && m_filter.publisher.ui.size() > 0) { arrow_flags = get_arrow_flags(0, m_filter.publisher.ui.size() - 1, sw_custfltr::mnfct[x]); std::string fbuff("^!Publisher"); convert_command_glyph(fbuff); item_append(fbuff.c_str(), m_filter.publisher.ui[sw_custfltr::mnfct[x]].c_str(), arrow_flags, (void *)(FPTR)(MNFCT_FILTER + x)); } // add year subitem else if (sw_custfltr::other[x] == UI_SW_YEARS && m_filter.year.ui.size() > 0) { arrow_flags = get_arrow_flags(0, m_filter.year.ui.size() - 1, sw_custfltr::year[x]); std::string fbuff("^!Year"); convert_command_glyph(fbuff); item_append(fbuff.c_str(), m_filter.year.ui[sw_custfltr::year[x]].c_str(), arrow_flags, (void *)(FPTR)(YEAR_FILTER + x)); } // add year subitem else if (sw_custfltr::other[x] == UI_SW_LIST && m_filter.swlist.name.size() > 0) { arrow_flags = get_arrow_flags(0, m_filter.swlist.name.size() - 1, sw_custfltr::list[x]); std::string fbuff("^!Software List"); convert_command_glyph(fbuff); item_append(fbuff.c_str(), m_filter.swlist.description[sw_custfltr::list[x]].c_str(), arrow_flags, (void *)(FPTR)(LIST_FILTER + x)); } // add device type subitem else if (sw_custfltr::other[x] == UI_SW_TYPE && m_filter.type.ui.size() > 0) { arrow_flags = get_arrow_flags(0, m_filter.type.ui.size() - 1, sw_custfltr::type[x]); std::string fbuff("^!Device type"); convert_command_glyph(fbuff); item_append(fbuff.c_str(), m_filter.type.ui[sw_custfltr::type[x]].c_str(), arrow_flags, (void *)(FPTR)(TYPE_FILTER + x)); } // add region subitem else if (sw_custfltr::other[x] == UI_SW_REGION && m_filter.region.ui.size() > 0) { arrow_flags = get_arrow_flags(0, m_filter.region.ui.size() - 1, sw_custfltr::region[x]); std::string fbuff("^!Region"); convert_command_glyph(fbuff); item_append(fbuff.c_str(), m_filter.region.ui[sw_custfltr::region[x]].c_str(), arrow_flags, (void *)(FPTR)(REGION_FILTER + x)); } } item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); if (sw_custfltr::numother > 0) item_append(_("Remove last filter"), nullptr, 0, (void *)(FPTR)REMOVE_FILTER); if (sw_custfltr::numother < MAX_CUST_FILTER - 2) item_append(_("Add filter"), nullptr, 0, (void *)(FPTR)ADD_FILTER); item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); customtop = machine().ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; }
void menu_game_options::populate(float &customtop, float &custombottom) { if (machine().options().ui() != emu_options::UI_SIMPLE) { // set filter arrow std::string fbuff; // add filter item uint32_t arrow_flags = get_arrow_flags<uint16_t>(FILTER_FIRST, FILTER_LAST, m_main); item_append(_("Filter"), main_filters::text[m_main], arrow_flags, (void *)(uintptr_t)FILTER_MENU); // add category subitem if (m_main == FILTER_CATEGORY && mame_machine_manager::instance()->inifile().total() > 0) { inifile_manager &inif = mame_machine_manager::instance()->inifile(); arrow_flags = get_arrow_flags(uint16_t(0), uint16_t(inif.total() - 1), inif.cur_file()); fbuff = _(" ^!File"); convert_command_glyph(fbuff); item_append(fbuff, inif.get_file(), arrow_flags, (void *)(uintptr_t)FILE_CATEGORY_FILTER); arrow_flags = get_arrow_flags(uint16_t(0), uint16_t(inif.cat_total() - 1), inif.cur_cat()); fbuff = _(" ^!Category"); convert_command_glyph(fbuff); item_append(fbuff, inif.get_category(), arrow_flags, (void *)(uintptr_t)CATEGORY_FILTER); } // add manufacturer subitem else if (m_main == FILTER_MANUFACTURER && c_mnfct::ui.size() > 0) { arrow_flags = get_arrow_flags(uint16_t(0), uint16_t(c_mnfct::ui.size() - 1), c_mnfct::actual); fbuff = _("^!Manufacturer"); convert_command_glyph(fbuff); item_append(fbuff, c_mnfct::ui[c_mnfct::actual], arrow_flags, (void *)(uintptr_t)MANUFACT_CAT_FILTER); } // add year subitem else if (m_main == FILTER_YEAR && c_year::ui.size() > 0) { arrow_flags = get_arrow_flags(uint16_t(0), uint16_t(c_year::ui.size() - 1), c_year::actual); fbuff.assign(_("^!Year")); convert_command_glyph(fbuff); item_append(fbuff, c_year::ui[c_year::actual], arrow_flags, (void *)(uintptr_t)YEAR_CAT_FILTER); } // add custom subitem else if (m_main == FILTER_CUSTOM) { fbuff = _("^!Setup custom filter"); convert_command_glyph(fbuff); item_append(fbuff, "", 0, (void *)(uintptr_t)CUSTOM_FILTER); } item_append(menu_item_type::SEPARATOR); // add options items item_append(_("Customize UI"), "", 0, (void *)(uintptr_t)CUSTOM_MENU); item_append(_("Configure Directories"), "", 0, (void *)(uintptr_t)CONF_DIR); } item_append(_(submenu::video_options[0].description), "", 0, (void *)(uintptr_t)DISPLAY_MENU); item_append(_("Sound Options"), "", 0, (void *)(uintptr_t)SOUND_MENU); item_append(_(submenu::misc_options[0].description), "", 0, (void *)(uintptr_t)MISC_MENU); item_append(_(submenu::control_options[0].description), "", 0, (void *)(uintptr_t)CONTROLLER_MENU); item_append(_("General Inputs"), "", 0, (void *)(uintptr_t)CGI_MENU); item_append(_(submenu::advanced_options[0].description), "", 0, (void *)(uintptr_t)ADVANCED_MENU); item_append(menu_item_type::SEPARATOR); item_append(_("Save Configuration"), "", 0, (void *)(uintptr_t)SAVE_CONFIG); custombottom = 2.0f * ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; customtop = ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; }
void submenu::populate() { UINT32 arrow_flags; // add options for (auto sm_option = m_options.begin(); sm_option < m_options.end(); ++sm_option) { // skip first heading (is menu title) if (sm_option == m_options.begin() && sm_option->type == option_type::HEAD) continue; switch (sm_option->type) { case option_type::HEAD: item_append(_(sm_option->description), "", FLAG_DISABLE | FLAG_UI_HEADING, nullptr); break; case option_type::SEP: item_append(menu_item_type::SEPARATOR); break; case option_type::CMD: item_append(_(sm_option->description), "", 0, static_cast<void*>(&(*sm_option))); break; case option_type::EMU: case option_type::UI: case option_type::OSD: switch (sm_option->entry->type()) { case OPTION_BOOLEAN: arrow_flags = sm_option->options->bool_value(sm_option->name) ? FLAG_RIGHT_ARROW : FLAG_LEFT_ARROW; item_append(_(sm_option->description), (arrow_flags == FLAG_RIGHT_ARROW) ? "On" : "Off", arrow_flags, static_cast<void*>(&(*sm_option))); break; case OPTION_INTEGER: { int i_min, i_max; int i_cur = atoi(sm_option->entry->value()); if (sm_option->entry->has_range()) { i_min = atoi(sm_option->entry->minimum()); i_max = atoi(sm_option->entry->maximum()); } else { i_min = std::numeric_limits<int>::min(); i_max = std::numeric_limits<int>::max(); } arrow_flags = get_arrow_flags(i_min, i_max, i_cur); item_append(_(sm_option->description), sm_option->entry->value(), arrow_flags, static_cast<void*>(&(*sm_option))); } break; case OPTION_FLOAT: { float f_min, f_max; float f_cur = atof(sm_option->entry->value()); if (sm_option->entry->has_range()) { f_min = atof(sm_option->entry->minimum()); f_max = atof(sm_option->entry->maximum()); } else { f_min = 0.0f; f_max = std::numeric_limits<float>::max(); } arrow_flags = get_arrow_flags(f_min, f_max, f_cur); std::string tmptxt = string_format("%g", f_cur); item_append(_(sm_option->description), tmptxt.c_str(), arrow_flags, static_cast<void*>(&(*sm_option))); } break; case OPTION_STRING: { std::string const v_cur(sm_option->entry->value()); int const cur_value = std::distance(sm_option->value.begin(), std::find(sm_option->value.begin(), sm_option->value.end(), v_cur)); arrow_flags = get_arrow_flags(0, int(unsigned(sm_option->value.size() - 1)), cur_value); item_append(_(sm_option->description), sm_option->options->value(sm_option->name), arrow_flags, static_cast<void*>(&(*sm_option))); } break; default: arrow_flags = FLAG_RIGHT_ARROW; item_append(_(sm_option->description), sm_option->options->value(sm_option->name), arrow_flags, static_cast<void*>(&(*sm_option))); break; } break; default: osd_printf_error("Unknown option type: %s", _(sm_option->description)); break; } } item_append(menu_item_type::SEPARATOR); custombottom = customtop = ui().get_line_height() + (3.0f * UI_BOX_TB_BORDER); }