Added a move constructor and got rid of the 'const char *' overload. I had to update a ton of call sites that relied on being able to

pass nullptr.  It is inevitable that there are more
This commit is contained in:
Nathan Woods 2016-06-29 20:50:36 -04:00
parent 78576d09c6
commit a2b07a8969
28 changed files with 164 additions and 171 deletions

View File

@ -168,7 +168,7 @@ void menu_audit::handle()
void menu_audit::populate()
{
item_append("Dummy", nullptr, 0, (void *)(FPTR)1);
item_append("Dummy", "", 0, (void *)(FPTR)1);
}
//-------------------------------------------------

View File

@ -74,7 +74,7 @@ void menu_barcode_reader::populate()
// finish up the menu
item_append(menu_item_type::SEPARATOR);
item_append(_("Enter Code"), nullptr, 0, ITEMREF_ENTER_BARCODE);
item_append(_("Enter Code"), "", 0, ITEMREF_ENTER_BARCODE);
customtop = ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER;
}

View File

@ -133,7 +133,7 @@ void menu_cheat::populate()
std::string subtext;
// add the autofire menu
item_append(_("Autofire Settings"), nullptr, 0, (void *)ITEMREF_CHEATS_AUTOFIRE_SETTINGS);
item_append(_("Autofire Settings"), "", 0, (void *)ITEMREF_CHEATS_AUTOFIRE_SETTINGS);
/* add a separator */
item_append(menu_item_type::SEPARATOR);
@ -147,17 +147,17 @@ void menu_cheat::populate()
if (text == MENU_SEPARATOR_ITEM)
item_append(menu_item_type::SEPARATOR);
else
item_append(text.c_str(), subtext.c_str(), flags, curcheat.get());
item_append(text, subtext, flags, curcheat.get());
}
/* add a separator */
item_append(menu_item_type::SEPARATOR);
/* add a reset all option */
item_append(_("Reset All"), nullptr, 0, (void *)ITEMREF_CHEATS_RESET_ALL);
item_append(_("Reset All"), "", 0, (void *)ITEMREF_CHEATS_RESET_ALL);
/* add a reload all cheats option */
item_append(_("Reload All"), nullptr, 0, (void *)ITEMREF_CHEATS_RELOAD_ALL);
item_append(_("Reload All"), "", 0, (void *)ITEMREF_CHEATS_RELOAD_ALL);
}
}
@ -313,7 +313,7 @@ void menu_autofire::populate()
if (menu_items==0)
{
item_append(menu_item_type::SEPARATOR);
item_append(_("No buttons found on this machine!"), nullptr, FLAG_DISABLE, nullptr);
item_append(_("No buttons found on this machine!"), "", FLAG_DISABLE, nullptr);
}
/* add a separator */

View File

@ -192,10 +192,10 @@ void menu_custom_filter::populate()
item_append(menu_item_type::SEPARATOR);
if (custfltr::numother > 0)
item_append(_("Remove last filter"), nullptr, 0, (void *)(FPTR)REMOVE_FILTER);
item_append(_("Remove last filter"), "", 0, (void *)(FPTR)REMOVE_FILTER);
if (custfltr::numother < MAX_CUST_FILTER - 2)
item_append(_("Add filter"), nullptr, 0, (void *)(FPTR)ADD_FILTER);
item_append(_("Add filter"), "", 0, (void *)(FPTR)ADD_FILTER);
item_append(menu_item_type::SEPARATOR);
customtop = ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER;
@ -506,10 +506,10 @@ void menu_swcustom_filter::populate()
item_append(menu_item_type::SEPARATOR);
if (sw_custfltr::numother > 0)
item_append(_("Remove last filter"), nullptr, 0, (void *)(FPTR)REMOVE_FILTER);
item_append(_("Remove last filter"), "", 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(_("Add filter"), "", 0, (void *)(FPTR)ADD_FILTER);
item_append(menu_item_type::SEPARATOR);

View File

@ -140,8 +140,8 @@ void menu_custom_ui::handle()
void 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);
item_append(_("Fonts"), "", 0, (void *)(FPTR)FONT_MENU);
item_append(_("Colors"), "", 0, (void *)(FPTR)COLORS_MENU);
if (!m_lang.empty())
{
@ -503,25 +503,25 @@ void menu_colors_ui::handle()
void menu_colors_ui::populate()
{
item_append(_("Normal text"), nullptr, 0, (void *)(FPTR)MUI_TEXT_COLOR);
item_append(_("Selected color"), nullptr, 0, (void *)(FPTR)MUI_SELECTED_COLOR);
item_append(_("Normal text background"), nullptr, 0, (void *)(FPTR)MUI_TEXT_BG_COLOR);
item_append(_("Selected background color"), nullptr, 0, (void *)(FPTR)MUI_SELECTED_BG_COLOR);
item_append(_("Subitem color"), nullptr, 0, (void *)(FPTR)MUI_SUBITEM_COLOR);
item_append(_("Clone"), nullptr, 0, (void *)(FPTR)MUI_CLONE_COLOR);
item_append(_("Border"), nullptr, 0, (void *)(FPTR)MUI_BORDER_COLOR);
item_append(_("Background"), nullptr, 0, (void *)(FPTR)MUI_BACKGROUND_COLOR);
item_append(_("Dipswitch"), nullptr, 0, (void *)(FPTR)MUI_DIPSW_COLOR);
item_append(_("Unavailable color"), nullptr, 0, (void *)(FPTR)MUI_UNAVAILABLE_COLOR);
item_append(_("Slider color"), nullptr, 0, (void *)(FPTR)MUI_SLIDER_COLOR);
item_append(_("Gfx viewer background"), nullptr, 0, (void *)(FPTR)MUI_GFXVIEWER_BG_COLOR);
item_append(_("Mouse over color"), nullptr, 0, (void *)(FPTR)MUI_MOUSEOVER_COLOR);
item_append(_("Mouse over background color"), nullptr, 0, (void *)(FPTR)MUI_MOUSEOVER_BG_COLOR);
item_append(_("Mouse down color"), nullptr, 0, (void *)(FPTR)MUI_MOUSEDOWN_COLOR);
item_append(_("Mouse down background color"), nullptr, 0, (void *)(FPTR)MUI_MOUSEDOWN_BG_COLOR);
item_append(_("Normal text"), "", 0, (void *)(FPTR)MUI_TEXT_COLOR);
item_append(_("Selected color"), "", 0, (void *)(FPTR)MUI_SELECTED_COLOR);
item_append(_("Normal text background"), "", 0, (void *)(FPTR)MUI_TEXT_BG_COLOR);
item_append(_("Selected background color"), "", 0, (void *)(FPTR)MUI_SELECTED_BG_COLOR);
item_append(_("Subitem color"), "", 0, (void *)(FPTR)MUI_SUBITEM_COLOR);
item_append(_("Clone"), "", 0, (void *)(FPTR)MUI_CLONE_COLOR);
item_append(_("Border"), "", 0, (void *)(FPTR)MUI_BORDER_COLOR);
item_append(_("Background"), "", 0, (void *)(FPTR)MUI_BACKGROUND_COLOR);
item_append(_("Dipswitch"), "", 0, (void *)(FPTR)MUI_DIPSW_COLOR);
item_append(_("Unavailable color"), "", 0, (void *)(FPTR)MUI_UNAVAILABLE_COLOR);
item_append(_("Slider color"), "", 0, (void *)(FPTR)MUI_SLIDER_COLOR);
item_append(_("Gfx viewer background"), "", 0, (void *)(FPTR)MUI_GFXVIEWER_BG_COLOR);
item_append(_("Mouse over color"), "", 0, (void *)(FPTR)MUI_MOUSEOVER_COLOR);
item_append(_("Mouse over background color"), "", 0, (void *)(FPTR)MUI_MOUSEOVER_BG_COLOR);
item_append(_("Mouse down color"), "", 0, (void *)(FPTR)MUI_MOUSEDOWN_COLOR);
item_append(_("Mouse down background color"), "", 0, (void *)(FPTR)MUI_MOUSEDOWN_BG_COLOR);
item_append(menu_item_type::SEPARATOR);
item_append(_("Restore originals colors"), nullptr, 0, (void *)(FPTR)MUI_RESTORE);
item_append(_("Restore originals colors"), "", 0, (void *)(FPTR)MUI_RESTORE);
custombottom = customtop = ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER;
}
@ -863,7 +863,7 @@ void menu_rgb_ui::populate()
item_append(_("Blue"), s_text.c_str(), 0, (void *)(FPTR)RGB_BLUE);
item_append(menu_item_type::SEPARATOR);
item_append(_("Choose from palette"), nullptr, 0, (void *)(FPTR)PALETTE_CHOOSE);
item_append(_("Choose from palette"), "", 0, (void *)(FPTR)PALETTE_CHOOSE);
item_append(menu_item_type::SEPARATOR);
custombottom = customtop = ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER;

View File

@ -247,7 +247,7 @@ void menu_dats_view::get_data()
for (int x = 0; x < lines; ++x)
{
std::string tempbuf(buffer.substr(xstart[x], xend[x] - xstart[x]));
item_append(tempbuf.c_str(), nullptr, (FLAG_UI_DATS | FLAG_DISABLE), (void *)(FPTR)(x + 1));
item_append(tempbuf, "", (FLAG_UI_DATS | FLAG_DISABLE), (void *)(FPTR)(x + 1));
}
}
@ -270,7 +270,7 @@ void menu_dats_view::get_data_sw()
for (int x = 0; x < lines; ++x)
{
std::string tempbuf(buffer.substr(xstart[x], xend[x] - xstart[x]));
item_append(tempbuf.c_str(), nullptr, (FLAG_UI_DATS | FLAG_DISABLE), (void *)(FPTR)(x + 1));
item_append(tempbuf, "", (FLAG_UI_DATS | FLAG_DISABLE), (void *)(FPTR)(x + 1));
}
}

View File

@ -266,7 +266,7 @@ void menu_device_config::populate()
str << "[None]\n";
const_cast<machine_config &>(machine().config()).device_remove(&machine().config().root_device(), m_option->name());
item_append(str.str().c_str(), nullptr, FLAG_MULTILINE, nullptr);
item_append(str.str(), "", FLAG_MULTILINE, nullptr);
}
void menu_device_config::handle()

View File

@ -102,7 +102,7 @@ void menu_directory::handle()
void menu_directory::populate()
{
for (auto & elem : s_folders)
item_append(_(elem.name), nullptr, 0, (void *)(FPTR)elem.action);
item_append(_(elem.name), "", 0, (void *)(FPTR)elem.action);
item_append(menu_item_type::SEPARATOR);
customtop = ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER;
@ -199,7 +199,7 @@ void menu_display_actual::populate()
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(_("Remove Folder"), "", 0, (void *)REMOVE);
item_append(menu_item_type::SEPARATOR);
customtop = (m_folders.size() + 1) * ui().get_line_height() + 6.0f * UI_BOX_TB_BORDER;
@ -626,7 +626,7 @@ void menu_remove_folder::populate()
{
int folders_count = 0;
for (auto & elem : m_folders)
item_append(elem.c_str(), nullptr, 0, (void *)(FPTR)++folders_count);
item_append(elem, "", 0, (void *)(FPTR)++folders_count);
item_append(menu_item_type::SEPARATOR);
customtop = ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER;

View File

@ -110,8 +110,8 @@ void menu_file_manager::populate()
if (!m_warnings.empty())
{
item_append(m_warnings.c_str(), nullptr, FLAG_DISABLE, nullptr);
item_append("", nullptr, FLAG_DISABLE, nullptr);
item_append(m_warnings, "", FLAG_DISABLE, nullptr);
item_append("", "", FLAG_DISABLE, nullptr);
}
// cycle through all devices for this system
@ -143,18 +143,18 @@ void menu_file_manager::populate()
first_entry = false;
else
item_append(menu_item_type::SEPARATOR);
item_append(string_format("[root%s]", dev.tag()).c_str(), nullptr, 0, nullptr);
item_append(string_format("[root%s]", dev.tag()), "", 0, nullptr);
tag_appended = true;
}
// finally, append the image interface to the menu
fill_image_line(&scan, tmp_inst, tmp_name);
item_append(tmp_inst.c_str(), tmp_name.c_str(), 0, (void *)&scan);
item_append(tmp_inst, tmp_name, 0, (void *)&scan);
}
}
}
}
item_append(menu_item_type::SEPARATOR);
item_append("Reset", nullptr, 0, (void *)1);
item_append("Reset", "", 0, (void *)1);
custombottom = ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER;
}

View File

@ -106,10 +106,10 @@ menu_confirm_save_as::~menu_confirm_save_as()
void menu_confirm_save_as::populate()
{
item_append(_("File Already Exists - Override?"), nullptr, FLAG_DISABLE, nullptr);
item_append(_("File Already Exists - Override?"), "", FLAG_DISABLE, nullptr);
item_append(menu_item_type::SEPARATOR);
item_append(_("No"), nullptr, 0, ITEMREF_NO);
item_append(_("Yes"), nullptr, 0, ITEMREF_YES);
item_append(_("No"), "", 0, ITEMREF_NO);
item_append(_("Yes"), "", 0, ITEMREF_YES);
}
//-------------------------------------------------
@ -232,7 +232,7 @@ void menu_file_create::populate()
// finish up the menu
item_append(menu_item_type::SEPARATOR);
item_append(_("Create"), nullptr, 0, ITEMREF_CREATE);
item_append(_("Create"), "", 0, ITEMREF_CREATE);
customtop = ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER;
}
@ -799,7 +799,7 @@ menu_select_format::~menu_select_format()
void menu_select_format::populate()
{
item_append(_("Select image format"), nullptr, FLAG_DISABLE, nullptr);
item_append(_("Select image format"), "", FLAG_DISABLE, nullptr);
for (int i = 0; i < m_total_usable; i++)
{
const floppy_image_format_t *fmt = m_formats[i];
@ -859,12 +859,12 @@ menu_select_rw::~menu_select_rw()
void menu_select_rw::populate()
{
item_append(_("Select access mode"), nullptr, FLAG_DISABLE, nullptr);
item_append(_("Read-only"), nullptr, 0, (void *)READONLY);
item_append(_("Select access mode"), "", FLAG_DISABLE, nullptr);
item_append(_("Read-only"), "", 0, (void *)READONLY);
if (m_can_in_place)
item_append(_("Read-write"), nullptr, 0, (void *)READWRITE);
item_append(_("Read this image, write to another image"), nullptr, 0, (void *)WRITE_OTHER);
item_append(_("Read this image, write to diff"), nullptr, 0, (void *)WRITE_DIFF);
item_append(_("Read-write"), "", 0, (void *)READWRITE);
item_append(_("Read this image, write to another image"), "", 0, (void *)WRITE_OTHER);
item_append(_("Read this image, write to diff"), "", 0, (void *)WRITE_DIFF);
}

View File

@ -32,7 +32,7 @@ menu_game_info::~menu_game_info()
void menu_game_info::populate()
{
std::string tempstring;
item_append(ui().game_info_astring(tempstring).c_str(), nullptr, FLAG_MULTILINE, nullptr);
item_append(ui().game_info_astring(tempstring), "", FLAG_MULTILINE, nullptr);
}
void menu_game_info::handle()
@ -57,8 +57,8 @@ menu_image_info::~menu_image_info()
void menu_image_info::populate()
{
item_append(machine().system().description, nullptr, FLAG_DISABLE, nullptr);
item_append("", nullptr, FLAG_DISABLE, nullptr);
item_append(machine().system().description, "", FLAG_DISABLE, nullptr);
item_append("", "", FLAG_DISABLE, nullptr);
for (device_image_interface &image : image_interface_iterator(machine().root_device()))
image_info(&image);
@ -90,7 +90,7 @@ void menu_image_info::image_info(device_image_interface *image)
item_append(image->longname(), "", FLAG_DISABLE, nullptr);
// display manufacturer and year
item_append(string_format("%s, %s", image->manufacturer(), image->year()).c_str(), "", FLAG_DISABLE, nullptr);
item_append(string_format("%s, %s", image->manufacturer(), image->year()), "", FLAG_DISABLE, nullptr);
// display supported information, if available
switch (image->supported())
@ -108,7 +108,7 @@ void menu_image_info::image_info(device_image_interface *image)
}
else
item_append(image->brief_instance_name(), _("[empty]"), 0, nullptr);
item_append("", nullptr, FLAG_DISABLE, nullptr);
item_append("", "", FLAG_DISABLE, nullptr);
}
} // namespace ui

View File

@ -25,8 +25,8 @@ menu_pty_info::~menu_pty_info()
void menu_pty_info::populate()
{
item_append(_("Pseudo terminals"), nullptr, FLAG_DISABLE, nullptr);
item_append("", nullptr, FLAG_DISABLE, nullptr);
item_append(_("Pseudo terminals"), "", FLAG_DISABLE, nullptr);
item_append("", "", FLAG_DISABLE, nullptr);
for (device_pty_interface &pty : pty_interface_iterator(machine().root_device()))
{
@ -35,7 +35,7 @@ void menu_pty_info::populate()
item_append(port_name, pty.slave_name(), FLAG_DISABLE, nullptr);
else
item_append(port_name, _("[failed]"), FLAG_DISABLE, nullptr);
item_append("", nullptr, FLAG_DISABLE, nullptr);
item_append("", "", FLAG_DISABLE, nullptr);
}
}

View File

@ -50,14 +50,13 @@ void menu_input_groups::populate()
int player;
/* build up the menu */
item_append(_("User Interface"), nullptr, 0, (void *)(IPG_UI + 1));
item_append(_("User Interface"), "", 0, (void *)(IPG_UI + 1));
for (player = 0; player < MAX_PLAYERS; player++)
{
char buffer[40];
sprintf(buffer, "Player %d Controls", player + 1);
item_append(buffer, nullptr, 0, (void *)(FPTR)(IPG_PLAYER1 + player + 1));
auto s = string_format("Player %d Controls", player + 1);
item_append(s, "", 0, (void *)(FPTR)(IPG_PLAYER1 + player + 1));
}
item_append(_("Other Controls"), nullptr, 0, (void *)(FPTR)(IPG_OTHER + 1));
item_append(_("Other Controls"), "", 0, (void *)(FPTR)(IPG_OTHER + 1));
}
menu_input_groups::~menu_input_groups()
@ -416,7 +415,7 @@ void menu_input::populate_and_sort(input_item_data *itemlist)
first_entry = false;
else
item_append(menu_item_type::SEPARATOR);
item_append(string_format("[root%s]", item->owner_name).c_str(), nullptr, 0, nullptr);
item_append(string_format("[root%s]", item->owner_name), "", 0, nullptr);
prev_owner.assign(item->owner_name);
}
@ -437,7 +436,7 @@ void menu_input::populate_and_sort(input_item_data *itemlist)
}
/* add the item */
item_append(text.c_str(), subtext.c_str(), flags, item);
item_append(text, subtext, flags, item);
}
}
@ -567,7 +566,7 @@ void menu_settings::populate()
else
item_append(menu_item_type::SEPARATOR);
string_format("[root%s]", field.device().tag());
item_append(string_format("[root%s]", field.device().tag()).c_str(), nullptr, 0, nullptr);
item_append(string_format("[root%s]", field.device().tag()), "", 0, nullptr);
prev_owner.assign(field.device().tag());
}
@ -619,7 +618,7 @@ void menu_settings::populate()
custombottom = dipcount ? dipcount * (DIP_SWITCH_HEIGHT + DIP_SWITCH_SPACING) + DIP_SWITCH_SPACING : 0;
item_append(menu_item_type::SEPARATOR);
item_append(_("Reset"), nullptr, 0, (void *)1);
item_append(_("Reset"), "", 0, (void *)1);
}
menu_settings::~menu_settings()
@ -863,7 +862,7 @@ void menu_analog::populate()
first_entry = false;
else
item_append(menu_item_type::SEPARATOR);
item_append(string_format("[root%s]", field.device().tag()).c_str(), nullptr, 0, nullptr);
item_append(string_format("[root%s]", field.device().tag()), "", 0, nullptr);
prev_owner.assign(field.device().tag());
}

View File

@ -51,35 +51,35 @@ menu_main::menu_main(mame_ui_manager &mui, render_container *container) : menu(m
void menu_main::populate()
{
/* add input menu items */
item_append(_("Input (general)"), nullptr, 0, (void *)INPUT_GROUPS);
item_append(_("Input (general)"), "", 0, (void *)INPUT_GROUPS);
item_append(_("Input (this Machine)"), nullptr, 0, (void *)INPUT_SPECIFIC);
item_append(_("Input (this Machine)"), "", 0, (void *)INPUT_SPECIFIC);
/* add optional input-related menus */
if (machine().ioport().has_analog())
item_append(_("Analog Controls"), nullptr, 0, (void *)ANALOG);
item_append(_("Analog Controls"), "", 0, (void *)ANALOG);
if (machine().ioport().has_dips())
item_append(_("Dip Switches"), nullptr, 0, (void *)SETTINGS_DIP_SWITCHES);
item_append(_("Dip Switches"), "", 0, (void *)SETTINGS_DIP_SWITCHES);
if (machine().ioport().has_configs())
{
item_append(_("Machine Configuration"), nullptr, 0, (void *)SETTINGS_DRIVER_CONFIG);
item_append(_("Machine Configuration"), "", 0, (void *)SETTINGS_DRIVER_CONFIG);
}
/* add bookkeeping menu */
item_append(_("Bookkeeping Info"), nullptr, 0, (void *)BOOKKEEPING);
item_append(_("Bookkeeping Info"), "", 0, (void *)BOOKKEEPING);
/* add game info menu */
item_append(_("Machine Information"), nullptr, 0, (void *)GAME_INFO);
item_append(_("Machine Information"), "", 0, (void *)GAME_INFO);
for (device_image_interface &image : image_interface_iterator(machine().root_device()))
{
if (image.user_loadable())
{
/* add image info menu */
item_append(_("Image Information"), nullptr, 0, (void *)IMAGE_MENU_IMAGE_INFO);
item_append(_("Image Information"), "", 0, (void *)IMAGE_MENU_IMAGE_INFO);
/* add file manager menu */
item_append(_("File Manager"), nullptr, 0, (void *)IMAGE_MENU_FILE_MANAGER);
item_append(_("File Manager"), "", 0, (void *)IMAGE_MENU_FILE_MANAGER);
break;
}
@ -87,65 +87,65 @@ void menu_main::populate()
/* add tape control menu */
if (cassette_device_iterator(machine().root_device()).first() != nullptr)
item_append(_("Tape Control"), nullptr, 0, (void *)TAPE_CONTROL);
item_append(_("Tape Control"), "", 0, (void *)TAPE_CONTROL);
if (pty_interface_iterator(machine().root_device()).first() != nullptr)
item_append(_("Pseudo terminals"), nullptr, 0, (void *)PTY_INFO);
item_append(_("Pseudo terminals"), "", 0, (void *)PTY_INFO);
if (machine().ioport().has_bioses())
item_append(_("Bios Selection"), nullptr, 0, (void *)BIOS_SELECTION);
item_append(_("Bios Selection"), "", 0, (void *)BIOS_SELECTION);
/* add slot info menu */
if (slot_interface_iterator(machine().root_device()).first() != nullptr)
item_append(_("Slot Devices"), nullptr, 0, (void *)SLOT_DEVICES);
item_append(_("Slot Devices"), "", 0, (void *)SLOT_DEVICES);
/* add Barcode reader menu */
if (barcode_reader_device_iterator(machine().root_device()).first() != nullptr)
item_append(_("Barcode Reader"), nullptr, 0, (void *)BARCODE_READ);
item_append(_("Barcode Reader"), "", 0, (void *)BARCODE_READ);
/* add network info menu */
if (network_interface_iterator(machine().root_device()).first() != nullptr)
item_append(_("Network Devices"), nullptr, 0, (void*)NETWORK_DEVICES);
item_append(_("Network Devices"), "", 0, (void*)NETWORK_DEVICES);
/* add keyboard mode menu */
if (machine().ioport().has_keyboard() && machine().ioport().natkeyboard().can_post())
item_append(_("Keyboard Mode"), nullptr, 0, (void *)KEYBOARD_MODE);
item_append(_("Keyboard Mode"), "", 0, (void *)KEYBOARD_MODE);
/* add sliders menu */
item_append(_("Slider Controls"), nullptr, 0, (void *)SLIDERS);
item_append(_("Slider Controls"), "", 0, (void *)SLIDERS);
/* add video options menu */
item_append(_("Video Options"), nullptr, 0, (machine().render().target_by_index(1) != nullptr) ? (void *)VIDEO_TARGETS : (void *)VIDEO_OPTIONS);
item_append(_("Video Options"), "", 0, (machine().render().target_by_index(1) != nullptr) ? (void *)VIDEO_TARGETS : (void *)VIDEO_OPTIONS);
/* add crosshair options menu */
if (machine().crosshair().get_usage())
item_append(_("Crosshair Options"), nullptr, 0, (void *)CROSSHAIR);
item_append(_("Crosshair Options"), "", 0, (void *)CROSSHAIR);
/* add cheat menu */
if (machine().options().cheat())
item_append(_("Cheat"), nullptr, 0, (void *)CHEAT);
item_append(_("Cheat"), "", 0, (void *)CHEAT);
if (machine().options().plugins())
item_append(_("Plugin Options"), nullptr, 0, (void *)PLUGINS);
item_append(_("Plugin Options"), "", 0, (void *)PLUGINS);
// add dats menu
if (ui().options().enabled_dats() && mame_machine_manager::instance()->datfile().has_data())
item_append(_("External DAT View"), nullptr, 0, (void *)EXTERNAL_DATS);
item_append(_("External DAT View"), "", 0, (void *)EXTERNAL_DATS);
item_append(menu_item_type::SEPARATOR);
/* add favorite menu */
if (!mame_machine_manager::instance()->favorite().isgame_favorite())
item_append(_("Add To Favorites"), nullptr, 0, (void *)ADD_FAVORITE);
item_append(_("Add To Favorites"), "", 0, (void *)ADD_FAVORITE);
else
item_append(_("Remove From Favorites"), nullptr, 0, (void *)REMOVE_FAVORITE);
item_append(_("Remove From Favorites"), "", 0, (void *)REMOVE_FAVORITE);
item_append(menu_item_type::SEPARATOR);
// item_append(_("Quit from Machine"), nullptr, 0, (void *)QUIT_GAME);
/* add reset and exit menus */
item_append(_("Select New Machine"), nullptr, 0, (void *)SELECT_GAME);
item_append(_("Select New Machine"), "", 0, (void *)SELECT_GAME);
}
menu_main::~menu_main()

View File

@ -261,21 +261,21 @@ void menu::reset(reset_options options)
// add an item to return
if (!m_parent)
{
item_append(_("Return to Machine"), nullptr, 0, nullptr);
item_append(_("Return to Machine"), "", 0, nullptr);
}
else if (m_parent->is_special_main_menu())
{
if (machine().options().ui() == emu_options::UI_SIMPLE)
item_append(_("Exit"), nullptr, 0, nullptr);
item_append(_("Exit"), "", 0, nullptr);
else
item_append(_("Exit"), nullptr, FLAG_UI | FLAG_LEFT_ARROW | FLAG_RIGHT_ARROW, nullptr);
item_append(_("Exit"), "", FLAG_UI | FLAG_LEFT_ARROW | FLAG_RIGHT_ARROW, nullptr);
}
else
{
if (machine().options().ui() != emu_options::UI_SIMPLE && menu::stack_has_special_main_menu())
item_append(_("Return to Previous Menu"), nullptr, FLAG_UI | FLAG_LEFT_ARROW | FLAG_RIGHT_ARROW, nullptr);
item_append(_("Return to Previous Menu"), "", FLAG_UI | FLAG_LEFT_ARROW | FLAG_RIGHT_ARROW, nullptr);
else
item_append(_("Return to Previous Menu"), nullptr, 0, nullptr);
item_append(_("Return to Previous Menu"), "", 0, nullptr);
}
}
@ -321,23 +321,7 @@ void menu::item_append(menu_item item)
void menu::item_append(menu_item_type type)
{
if (type == menu_item_type::SEPARATOR)
item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr, menu_item_type::SEPARATOR);
}
//-------------------------------------------------
// item_append - append a new item to the
// end of the menu
//-------------------------------------------------
void menu::item_append(const char *text, const char *subtext, UINT32 flags, void *ref, menu_item_type type)
{
// need distinct overload because we might get nullptr
item_append(
std::string(text ? text : ""),
std::string(subtext ? subtext : ""),
flags,
ref,
type);
item_append(MENU_SEPARATOR_ITEM, "", 0, nullptr, menu_item_type::SEPARATOR);
}
//-------------------------------------------------
@ -346,6 +330,16 @@ void menu::item_append(const char *text, const char *subtext, UINT32 flags, void
//-------------------------------------------------
void menu::item_append(const std::string &text, const std::string &subtext, UINT32 flags, void *ref, menu_item_type type)
{
item_append((std::string&&)text, (std::string&&)subtext, flags, ref, type);
}
//-------------------------------------------------
// item_append - append a new item to the
// end of the menu
//-------------------------------------------------
void menu::item_append(std::string &&text, std::string &&subtext, UINT32 flags, void *ref, menu_item_type type)
{
// only allow multiline as the first item
if ((flags & FLAG_MULTILINE) != 0)

View File

@ -63,8 +63,8 @@ public:
std::vector<menu_item> item; // array of items
// append a new item to the end of the menu
void item_append(const char *text, const char *subtext, UINT32 flags, void *ref, menu_item_type type = menu_item_type::UNKNOWN);
void item_append(const std::string &text, const std::string &subtext, UINT32 flags, void *ref, menu_item_type type = menu_item_type::UNKNOWN);
void item_append(std::string &&text, std::string &&subtext, UINT32 flags, void *ref, menu_item_type type = menu_item_type::UNKNOWN);
void item_append(menu_item item);
void item_append(menu_item_type type);

View File

@ -93,7 +93,7 @@ void menu_bios_selection::populate()
}
item_append(menu_item_type::SEPARATOR);
item_append(_("Reset"), nullptr, 0, (void *)1);
item_append(_("Reset"), "", 0, (void *)1);
}
menu_bios_selection::~menu_bios_selection()
@ -265,7 +265,7 @@ void menu_bookkeeping::populate()
}
/* append the single item */
item_append(tempstring.str().c_str(), nullptr, FLAG_MULTILINE, nullptr);
item_append(tempstring.str(), "", FLAG_MULTILINE, nullptr);
}
/*-------------------------------------------------
@ -672,9 +672,9 @@ void menu_export::handle()
void menu_export::populate()
{
// add options items
item_append(_("Export list in XML format (like -listxml)"), nullptr, 0, (void *)(FPTR)1);
item_append(_("Export list in XML format (like -listxml, but exclude devices)"), nullptr, 0, (void *)(FPTR)3);
item_append(_("Export list in TXT format (like -listfull)"), nullptr, 0, (void *)(FPTR)2);
item_append(_("Export list in XML format (like -listxml)"), "", 0, (void *)(FPTR)1);
item_append(_("Export list in XML format (like -listxml, but exclude devices)"), "", 0, (void *)(FPTR)3);
item_append(_("Export list in TXT format (like -listfull)"), "", 0, (void *)(FPTR)2);
item_append(menu_item_type::SEPARATOR);
}
@ -771,28 +771,28 @@ void menu_machine_configure::handle()
void menu_machine_configure::populate()
{
// add options items
item_append(_("Bios"), nullptr, FLAG_DISABLE | FLAG_UI_HEADING, nullptr);
item_append(_("Bios"), "", FLAG_DISABLE | 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, FLAG_DISABLE, nullptr);
item_append(_("This machine has no bios."), "", FLAG_DISABLE, nullptr);
item_append(menu_item_type::SEPARATOR);
item_append(_(submenu::advanced_options[0].description), nullptr, 0, (void *)(FPTR)ADVANCED);
item_append(_(submenu::video_options[0].description), nullptr, 0, (void *)(FPTR)VIDEO);
item_append(_(submenu::control_options[0].description), nullptr, 0, (void *)(FPTR)CONTROLLER);
item_append(_(submenu::advanced_options[0].description), "", 0, (void *)(FPTR)ADVANCED);
item_append(_(submenu::video_options[0].description), "", 0, (void *)(FPTR)VIDEO);
item_append(_(submenu::control_options[0].description), "", 0, (void *)(FPTR)CONTROLLER);
item_append(menu_item_type::SEPARATOR);
if (!mame_machine_manager::instance()->favorite().isgame_favorite(m_drv))
item_append(_("Add To Favorites"), nullptr, 0, (void *)ADDFAV);
item_append(_("Add To Favorites"), "", 0, (void *)ADDFAV);
else
item_append(_("Remove From Favorites"), nullptr, 0, (void *)DELFAV);
item_append(_("Remove From Favorites"), "", 0, (void *)DELFAV);
item_append(menu_item_type::SEPARATOR);
item_append(_("Save machine configuration"), nullptr, 0, (void *)(FPTR)SAVE);
item_append(_("Save machine configuration"), "", 0, (void *)(FPTR)SAVE);
item_append(menu_item_type::SEPARATOR);
customtop = 2.0f * ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER;
}

View File

@ -267,23 +267,23 @@ void menu_game_options::populate()
{
fbuff = _("^!Setup custom filter");
convert_command_glyph(fbuff);
item_append(fbuff.c_str(), nullptr, 0, (void *)(FPTR)CUSTOM_FILTER);
item_append(fbuff.c_str(), "", 0, (void *)(FPTR)CUSTOM_FILTER);
}
item_append(menu_item_type::SEPARATOR);
// add options items
item_append(_("Customize UI"), nullptr, 0, (void *)(FPTR)CUSTOM_MENU);
item_append(_("Configure Directories"), nullptr, 0, (void *)(FPTR)CONF_DIR);
item_append(_("Customize UI"), "", 0, (void *)(FPTR)CUSTOM_MENU);
item_append(_("Configure Directories"), "", 0, (void *)(FPTR)CONF_DIR);
}
item_append(_(submenu::video_options[0].description), nullptr, 0, (void *)(FPTR)DISPLAY_MENU);
item_append(_("Sound Options"), nullptr, 0, (void *)(FPTR)SOUND_MENU);
item_append(_(submenu::misc_options[0].description), nullptr, 0, (void *)(FPTR)MISC_MENU);
item_append(_(submenu::control_options[0].description), nullptr, 0, (void *)(FPTR)CONTROLLER_MENU);
item_append(_("General Inputs"), nullptr, 0, (void *)(FPTR)CGI_MENU);
item_append(_(submenu::advanced_options[0].description), nullptr, 0, (void *)(FPTR)ADVANCED_MENU);
item_append(_(submenu::video_options[0].description), "", 0, (void *)(FPTR)DISPLAY_MENU);
item_append(_("Sound Options"), "", 0, (void *)(FPTR)SOUND_MENU);
item_append(_(submenu::misc_options[0].description), "", 0, (void *)(FPTR)MISC_MENU);
item_append(_(submenu::control_options[0].description), "", 0, (void *)(FPTR)CONTROLLER_MENU);
item_append(_("General Inputs"), "", 0, (void *)(FPTR)CGI_MENU);
item_append(_(submenu::advanced_options[0].description), "", 0, (void *)(FPTR)ADVANCED_MENU);
item_append(menu_item_type::SEPARATOR);
item_append(_("Save Configuration"), nullptr, 0, (void *)(FPTR)SAVE_CONFIG);
item_append(_("Save Configuration"), "", 0, (void *)(FPTR)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;

View File

@ -37,7 +37,7 @@ menu_plugin::menu_plugin(mame_ui_manager &mui, render_container *container) :
void menu_plugin::populate()
{
for (auto &curplugin : m_plugins)
item_append(curplugin.c_str(), nullptr, 0, (void *)curplugin.c_str());
item_append(curplugin, "", 0, (void *)curplugin.c_str());
item_append(menu_item_type::SEPARATOR);
}

View File

@ -137,7 +137,7 @@ void menu_selector::populate()
find_matches(m_search);
for (int curitem = 0; m_searchlist[curitem]; ++curitem)
item_append(m_searchlist[curitem]->c_str(), nullptr, 0, (void *)m_searchlist[curitem]);
item_append(m_searchlist[curitem]->c_str(), "", 0, (void *)m_searchlist[curitem]);
}
else
{
@ -148,7 +148,7 @@ void menu_selector::populate()
selected = added;
added++;
item_append(m_str_items[index].c_str(), nullptr, 0, (void *)&m_str_items[index]);
item_append(m_str_items[index].c_str(), "", 0, (void *)&m_str_items[index]);
}
}

View File

@ -552,7 +552,7 @@ void menu_select_game::populate()
if (cloneof)
flags_ui |= FLAG_INVERT;
item_append(elem->description, nullptr, flags_ui, (void *)elem);
item_append(elem->description, "", flags_ui, (void *)elem);
curitem++;
}
}
@ -581,7 +581,7 @@ void menu_select_game::populate()
if (cloneof)
flags_ui |= FLAG_INVERT;
item_append(mfavorite.longname.c_str(), nullptr, flags_ui, (void *)&mfavorite);
item_append(mfavorite.longname, "", flags_ui, (void *)&mfavorite);
}
else
{
@ -600,12 +600,12 @@ void menu_select_game::populate()
if (menu::stack_has_special_main_menu())
{
UINT32 flags_ui = FLAG_UI | FLAG_LEFT_ARROW | FLAG_RIGHT_ARROW;
item_append(_("Configure Options"), nullptr, flags_ui, (void *)(FPTR)CONF_OPTS);
item_append(_("Configure Machine"), nullptr, flags_ui, (void *)(FPTR)CONF_MACHINE);
item_append(_("Configure Options"), "", flags_ui, (void *)(FPTR)CONF_OPTS);
item_append(_("Configure Machine"), "", flags_ui, (void *)(FPTR)CONF_MACHINE);
skip_main_items = 2;
if (machine().options().plugins())
{
item_append(_("Plugins"), nullptr, flags_ui, (void *)(FPTR)CONF_PLUGINS);
item_append(_("Plugins"), "", flags_ui, (void *)(FPTR)CONF_PLUGINS);
skip_main_items++;
}
}
@ -1549,7 +1549,7 @@ void menu_select_game::populate_search()
if (cx != -1 && ((driver_list::driver(cx).flags & MACHINE_IS_BIOS_ROOT) != 0))
cloneof = false;
}
item_append(m_searchlist[curitem]->description, nullptr, (!cloneof) ? flags_ui : (FLAG_INVERT | flags_ui),
item_append(m_searchlist[curitem]->description, "", (!cloneof) ? flags_ui : (FLAG_INVERT | flags_ui),
(void *)m_searchlist[curitem]);
}
}

View File

@ -432,7 +432,7 @@ void menu_select_software::populate()
{
// if the device can be loaded empty, add an item
if (m_has_empty_start)
item_append("[Start empty]", nullptr, flags_ui, (void *)&m_swinfo[0]);
item_append("[Start empty]", "", flags_ui, (void *)&m_swinfo[0]);
m_displaylist.clear();
m_tmp.clear();
@ -2036,7 +2036,7 @@ bios_selection::~bios_selection()
void bios_selection::populate()
{
for (auto & elem : m_bios)
item_append(elem.first.c_str(), nullptr, 0, (void *)&elem.first);
item_append(elem.first, "", 0, (void *)&elem.first);
item_append(menu_item_type::SEPARATOR);
customtop = ui().get_line_height() + (3.0f * UI_BOX_TB_BORDER);

View File

@ -242,7 +242,7 @@ void simple_menu_select_game::populate()
"the docs directory for information on configuring %2$s."),
emulator_info::get_configname(),
emulator_info::get_appname());
item_append(txt.c_str(), nullptr, FLAG_MULTILINE | FLAG_REDTEXT, nullptr);
item_append(txt, "", FLAG_MULTILINE | FLAG_REDTEXT, nullptr);
return;
}
@ -267,7 +267,7 @@ void simple_menu_select_game::populate()
if (menu::stack_has_special_main_menu())
{
item_append(menu_item_type::SEPARATOR);
item_append(_("Configure Options"), nullptr, 0, (void *)1);
item_append(_("Configure Options"), "", 0, (void *)1);
skip_main_items = 1;
}

View File

@ -171,7 +171,7 @@ void menu_slot_devices::populate()
item_append(slot.device().tag() + 1, opt_name.c_str(), (slot.fixed() || slot_get_length(slot) == 0) ? 0 : (FLAG_LEFT_ARROW | FLAG_RIGHT_ARROW), (void *)&slot);
}
item_append(menu_item_type::SEPARATOR);
item_append(_("Reset"), nullptr, 0, (void *)1);
item_append(_("Reset"), "", 0, (void *)1);
}
menu_slot_devices::~menu_slot_devices()

View File

@ -314,13 +314,13 @@ void submenu::populate()
switch (sm_option->type)
{
case option_type::HEAD:
item_append(_(sm_option->description), nullptr, FLAG_DISABLE | FLAG_UI_HEADING, nullptr);
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), nullptr, 0, static_cast<void*>(&(*sm_option)));
item_append(_(sm_option->description), "", 0, static_cast<void*>(&(*sm_option)));
break;
case option_type::EMU:
case option_type::UI:

View File

@ -64,18 +64,18 @@ void menu_software_parts::populate()
software_part_menu_entry *entry1 = (software_part_menu_entry *) m_pool_alloc(sizeof(*entry1));
entry1->type = T_EMPTY;
entry1->part = nullptr;
item_append(_("[empty slot]"), nullptr, 0, entry1);
item_append(_("[empty slot]"), "", 0, entry1);
software_part_menu_entry *entry2 = (software_part_menu_entry *) m_pool_alloc(sizeof(*entry2));
entry2->type = T_FMGR;
entry2->part = nullptr;
item_append(_("[file manager]"), nullptr, 0, entry2);
item_append(_("[file manager]"), "", 0, entry2);
software_part_menu_entry *entry3 = (software_part_menu_entry *) m_pool_alloc(sizeof(*entry3));
entry3->type = T_SWLIST;
entry3->part = nullptr;
item_append(_("[software list]"), nullptr, 0, entry3);
item_append(_("[software list]"), "", 0, entry3);
}
for (const software_part &swpart : m_info->parts())
@ -234,7 +234,7 @@ void menu_software_list::populate()
append_software_entry(swinfo);
// add an entry to change ordering
item_append(_("Switch Item Ordering"), nullptr, 0, (void *)1);
item_append(_("Switch Item Ordering"), "", 0, (void *)1);
// append all of the menu entries
for (entry_info *entry = m_entrylist; entry != nullptr; entry = entry->next)
@ -422,7 +422,7 @@ void menu_software::populate()
if (swinfo.first_part()->matches_interface(m_interface))
found = true;
if (found)
item_append(swlistdev.description(), nullptr, 0, (void *)&swlistdev);
item_append(swlistdev.description(), "", 0, (void *)&swlistdev);
}
// add compatible software lists for this system
@ -437,8 +437,8 @@ void menu_software::populate()
if (found)
{
if (!have_compatible)
item_append(_("[compatible lists]"), nullptr, FLAG_DISABLE, nullptr);
item_append(swlistdev.description(), nullptr, 0, (void *)&swlistdev);
item_append(_("[compatible lists]"), "", FLAG_DISABLE, nullptr);
item_append(swlistdev.description(), "", 0, (void *)&swlistdev);
}
have_compatible = true;
}

View File

@ -92,19 +92,19 @@ void menu_tape_control::populate()
TAPECMD_SLIDER);
// pause or stop
item_append(_("Pause/Stop"), nullptr, 0, TAPECMD_STOP);
item_append(_("Pause/Stop"), "", 0, TAPECMD_STOP);
// play
item_append(_("Play"), nullptr, 0, TAPECMD_PLAY);
item_append(_("Play"), "", 0, TAPECMD_PLAY);
// record
item_append(_("Record"), nullptr, 0, TAPECMD_RECORD);
item_append(_("Record"), "", 0, TAPECMD_RECORD);
// rewind
item_append(_("Rewind"), nullptr, 0, TAPECMD_REWIND);
item_append(_("Rewind"), "", 0, TAPECMD_REWIND);
// fast forward
item_append(_("Fast Forward"), nullptr, 0, TAPECMD_FAST_FORWARD);
item_append(_("Fast Forward"), "", 0, TAPECMD_FAST_FORWARD);
}
}
}

View File

@ -54,7 +54,7 @@ void menu_video_targets::populate()
/* add a menu item */
sprintf(buffer, _("Screen #%d"), targetnum);
item_append(buffer, nullptr, 0, target);
item_append(buffer, "", 0, target);
}
}
@ -187,7 +187,7 @@ void menu_video_options::populate()
/* create a string for the item, replacing underscores with spaces */
tempstring.assign(name);
strreplace(tempstring, "_", " ");
item_append(tempstring.c_str(), nullptr, 0, (void *)(FPTR)(VIDEO_ITEM_VIEW + viewnum));
item_append(tempstring.c_str(), "", 0, (void *)(FPTR)(VIDEO_ITEM_VIEW + viewnum));
}
/* add a separator */