summaryrefslogtreecommitdiffstatshomepage
path: root/src/frontend/mame/ui/filesel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/frontend/mame/ui/filesel.cpp')
-rw-r--r--src/frontend/mame/ui/filesel.cpp128
1 files changed, 67 insertions, 61 deletions
diff --git a/src/frontend/mame/ui/filesel.cpp b/src/frontend/mame/ui/filesel.cpp
index c9c22010d55..5077d7d0a53 100644
--- a/src/frontend/mame/ui/filesel.cpp
+++ b/src/frontend/mame/ui/filesel.cpp
@@ -13,15 +13,19 @@
***************************************************************************/
#include "emu.h"
-#include "ui/ui.h"
-#include "ui/menu.h"
-#include "zippath.h"
+
#include "ui/filesel.h"
+#include "ui/ui.h"
+
#include "imagedev/floppy.h"
+#include "zippath.h"
+
#include <cstring>
+namespace ui {
+
/***************************************************************************
CONSTANTS
***************************************************************************/
@@ -74,8 +78,8 @@ static void input_character(char *buffer, size_t buffer_length, unicode_char uni
// ctor
//-------------------------------------------------
-ui_menu_confirm_save_as::ui_menu_confirm_save_as(mame_ui_manager &mui, render_container *container, bool *yes)
- : ui_menu(mui, container)
+menu_confirm_save_as::menu_confirm_save_as(mame_ui_manager &mui, render_container *container, bool *yes)
+ : menu(mui, container)
{
m_yes = yes;
*m_yes = false;
@@ -86,7 +90,7 @@ ui_menu_confirm_save_as::ui_menu_confirm_save_as(mame_ui_manager &mui, render_co
// dtor
//-------------------------------------------------
-ui_menu_confirm_save_as::~ui_menu_confirm_save_as()
+menu_confirm_save_as::~menu_confirm_save_as()
{
}
@@ -95,10 +99,10 @@ ui_menu_confirm_save_as::~ui_menu_confirm_save_as()
// populate
//-------------------------------------------------
-void ui_menu_confirm_save_as::populate()
+void menu_confirm_save_as::populate()
{
- item_append(_("File Already Exists - Override?"), nullptr, MENU_FLAG_DISABLE, nullptr);
- item_append(MENU_SEPARATOR_ITEM, nullptr, MENU_FLAG_DISABLE, nullptr);
+ item_append(_("File Already Exists - Override?"), nullptr, FLAG_DISABLE, nullptr);
+ item_append(MENU_SEPARATOR_ITEM, nullptr, FLAG_DISABLE, nullptr);
item_append(_("No"), nullptr, 0, ITEMREF_NO);
item_append(_("Yes"), nullptr, 0, ITEMREF_YES);
}
@@ -107,10 +111,10 @@ void ui_menu_confirm_save_as::populate()
// handle - confirm save as menu
//-------------------------------------------------
-void ui_menu_confirm_save_as::handle()
+void menu_confirm_save_as::handle()
{
// process the menu
- const ui_menu_event *event = process(0);
+ const event *event = process(0);
// process the event
if ((event != nullptr) && (event->iptkey == IPT_UI_SELECT))
@@ -119,7 +123,7 @@ void ui_menu_confirm_save_as::handle()
*m_yes = true;
// no matter what, pop out
- ui_menu::stack_pop(machine());
+ menu::stack_pop(machine());
}
}
@@ -156,11 +160,11 @@ static int is_valid_filename_char(unicode_char unichar)
// ctor
//-------------------------------------------------
-ui_menu_file_create::ui_menu_file_create(mame_ui_manager &mui, render_container *container, device_image_interface *image, std::string &current_directory, std::string &current_file, bool *ok)
- : ui_menu(mui, container),
- m_current_directory(current_directory),
- m_current_file(current_file),
- m_current_format(nullptr)
+menu_file_create::menu_file_create(mame_ui_manager &mui, render_container *container, device_image_interface *image, std::string &current_directory, std::string &current_file, bool *ok)
+ : menu(mui, container)
+ , m_current_directory(current_directory)
+ , m_current_file(current_file)
+ , m_current_format(nullptr)
{
m_image = image;
m_ok = ok;
@@ -174,7 +178,7 @@ ui_menu_file_create::ui_menu_file_create(mame_ui_manager &mui, render_container
// dtor
//-------------------------------------------------
-ui_menu_file_create::~ui_menu_file_create()
+menu_file_create::~menu_file_create()
{
}
@@ -183,7 +187,7 @@ ui_menu_file_create::~ui_menu_file_create()
// custom_render - perform our special rendering
//-------------------------------------------------
-void ui_menu_file_create::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2)
+void menu_file_create::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2)
{
extra_text_render(top, bottom, origx1, origy1, origx2, origy2,
m_current_directory.c_str(),
@@ -195,7 +199,7 @@ void ui_menu_file_create::custom_render(void *selectedref, float top, float bott
// populate - populates the file creator menu
//-------------------------------------------------
-void ui_menu_file_create::populate()
+void menu_file_create::populate()
{
std::string buffer;
const image_device_format *format;
@@ -222,7 +226,7 @@ void ui_menu_file_create::populate()
}
// finish up the menu
- item_append(ui_menu_item_type::SEPARATOR);
+ item_append(menu_item_type::SEPARATOR);
item_append(_("Create"), nullptr, 0, ITEMREF_CREATE);
customtop = ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER;
@@ -233,10 +237,10 @@ void ui_menu_file_create::populate()
// handle - file creator menu
//-------------------------------------------------
-void ui_menu_file_create::handle()
+void menu_file_create::handle()
{
// process the menu
- const ui_menu_event *event = process(0);
+ const event *event = process(0);
// process the event
if (event != nullptr)
@@ -251,7 +255,7 @@ void ui_menu_file_create::handle()
if (tmp_file.find(".") != -1 && tmp_file.find(".") < tmp_file.length() - 1)
{
m_current_file = m_filename_buffer;
- ui_menu::stack_pop(machine());
+ menu::stack_pop(machine());
}
else
ui().popup_time(1, "%s", _("Please enter a file extension too"));
@@ -266,7 +270,7 @@ void ui_menu_file_create::handle()
ARRAY_LENGTH(m_filename_buffer),
event->unichar,
is_valid_filename_char);
- reset(UI_MENU_RESET_REMEMBER_POSITION);
+ reset(reset_options::REMEMBER_POSITION);
}
break;
case IPT_UI_CANCEL:
@@ -284,11 +288,11 @@ void ui_menu_file_create::handle()
// ctor
//-------------------------------------------------
-ui_menu_file_selector::ui_menu_file_selector(mame_ui_manager &mui, render_container *container, device_image_interface *image, std::string &current_directory, std::string &current_file, bool has_empty, bool has_softlist, bool has_create, int *result)
- : ui_menu(mui, container),
- m_current_directory(current_directory),
- m_current_file(current_file),
- m_entrylist(nullptr)
+menu_file_selector::menu_file_selector(mame_ui_manager &mui, render_container *container, device_image_interface *image, std::string &current_directory, std::string &current_file, bool has_empty, bool has_softlist, bool has_create, int *result)
+ : menu(mui, container)
+ , m_current_directory(current_directory)
+ , m_current_file(current_file)
+ , m_entrylist(nullptr)
{
m_image = image;
m_has_empty = has_empty;
@@ -302,7 +306,7 @@ ui_menu_file_selector::ui_menu_file_selector(mame_ui_manager &mui, render_contai
// dtor
//-------------------------------------------------
-ui_menu_file_selector::~ui_menu_file_selector()
+menu_file_selector::~menu_file_selector()
{
}
@@ -311,7 +315,7 @@ ui_menu_file_selector::~ui_menu_file_selector()
// custom_render - perform our special rendering
//-------------------------------------------------
-void ui_menu_file_selector::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2)
+void menu_file_selector::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2)
{
extra_text_render(top, bottom,
origx1, origy1, origx2, origy2,
@@ -326,7 +330,7 @@ void ui_menu_file_selector::custom_render(void *selectedref, float top, float bo
// for file selector entries
//-------------------------------------------------
-int ui_menu_file_selector::compare_entries(const file_selector_entry *e1, const file_selector_entry *e2)
+int menu_file_selector::compare_entries(const file_selector_entry *e1, const file_selector_entry *e2)
{
int result;
const char *e1_basename = (e1->basename != nullptr) ? e1->basename : "";
@@ -365,7 +369,7 @@ int ui_menu_file_selector::compare_entries(const file_selector_entry *e1, const
// file selector entry to an entry list
//-------------------------------------------------
-ui_menu_file_selector::file_selector_entry *ui_menu_file_selector::append_entry(
+menu_file_selector::file_selector_entry *menu_file_selector::append_entry(
file_selector_entry_type entry_type, const char *entry_basename, const char *entry_fullpath)
{
file_selector_entry *entry;
@@ -395,7 +399,7 @@ ui_menu_file_selector::file_selector_entry *ui_menu_file_selector::append_entry(
// a menu item for a file selector entry
//-------------------------------------------------
-ui_menu_file_selector::file_selector_entry *ui_menu_file_selector::append_dirent_entry(const osd_directory_entry *dirent)
+menu_file_selector::file_selector_entry *menu_file_selector::append_dirent_entry(const osd_directory_entry *dirent)
{
std::string buffer;
file_selector_entry_type entry_type;
@@ -434,7 +438,7 @@ ui_menu_file_selector::file_selector_entry *ui_menu_file_selector::append_dirent
// a menu item for a file selector entry
//-------------------------------------------------
-void ui_menu_file_selector::append_entry_menu_item(const file_selector_entry *entry)
+void menu_file_selector::append_entry_menu_item(const file_selector_entry *entry)
{
const char *text = nullptr;
const char *subtext = nullptr;
@@ -476,7 +480,7 @@ void ui_menu_file_selector::append_entry_menu_item(const file_selector_entry *en
// populate
//-------------------------------------------------
-void ui_menu_file_selector::populate()
+void menu_file_selector::populate()
{
util::zippath_directory *directory = nullptr;
osd_file::error err;
@@ -562,7 +566,7 @@ void ui_menu_file_selector::populate()
// handle
//-------------------------------------------------
-void ui_menu_file_selector::handle()
+void menu_file_selector::handle()
{
osd_file::error err;
const file_selector_entry *entry;
@@ -570,7 +574,7 @@ void ui_menu_file_selector::handle()
int bestmatch = 0;
// process the menu
- const ui_menu_event *event = process(0);
+ const event *event = process(0);
if (event != nullptr && event->itemref != nullptr)
{
// handle selections
@@ -582,18 +586,18 @@ void ui_menu_file_selector::handle()
case SELECTOR_ENTRY_TYPE_EMPTY:
// empty slot - unload
*m_result = R_EMPTY;
- ui_menu::stack_pop(machine());
+ menu::stack_pop(machine());
break;
case SELECTOR_ENTRY_TYPE_CREATE:
// create
*m_result = R_CREATE;
- ui_menu::stack_pop(machine());
+ menu::stack_pop(machine());
break;
case SELECTOR_ENTRY_TYPE_SOFTWARE_LIST:
*m_result = R_SOFTLIST;
- ui_menu::stack_pop(machine());
+ menu::stack_pop(machine());
break;
case SELECTOR_ENTRY_TYPE_DRIVE:
@@ -607,14 +611,14 @@ void ui_menu_file_selector::handle()
break;
}
m_current_directory.assign(entry->fullpath);
- reset((ui_menu_reset_options)0);
+ reset(reset_options::SELECT_FIRST);
break;
case SELECTOR_ENTRY_TYPE_FILE:
// file
m_current_file.assign(entry->fullpath);
*m_result = R_FILE;
- ui_menu::stack_pop(machine());
+ menu::stack_pop(machine());
break;
}
@@ -717,8 +721,8 @@ void ui_menu_file_selector::handle()
// ctor
//-------------------------------------------------
-ui_menu_select_format::ui_menu_select_format(mame_ui_manager &mui, render_container *container, floppy_image_format_t **formats, int ext_match, int total_usable, int *result)
- : ui_menu(mui, container)
+menu_select_format::menu_select_format(mame_ui_manager &mui, render_container *container, floppy_image_format_t **formats, int ext_match, int total_usable, int *result)
+ : menu(mui, container)
{
m_formats = formats;
m_ext_match = ext_match;
@@ -731,7 +735,7 @@ ui_menu_select_format::ui_menu_select_format(mame_ui_manager &mui, render_contai
// dtor
//-------------------------------------------------
-ui_menu_select_format::~ui_menu_select_format()
+menu_select_format::~menu_select_format()
{
}
@@ -740,15 +744,15 @@ ui_menu_select_format::~ui_menu_select_format()
// populate
//-------------------------------------------------
-void ui_menu_select_format::populate()
+void menu_select_format::populate()
{
- item_append(_("Select image format"), nullptr, MENU_FLAG_DISABLE, nullptr);
+ item_append(_("Select image format"), nullptr, FLAG_DISABLE, nullptr);
for (int i = 0; i < m_total_usable; i++)
{
const floppy_image_format_t *fmt = m_formats[i];
if (i && i == m_ext_match)
- item_append(ui_menu_item_type::SEPARATOR);
+ item_append(menu_item_type::SEPARATOR);
item_append(fmt->description(), fmt->name(), 0, (void *)(FPTR)i);
}
}
@@ -758,14 +762,14 @@ void ui_menu_select_format::populate()
// handle
//-------------------------------------------------
-void ui_menu_select_format::handle()
+void menu_select_format::handle()
{
// process the menu
- const ui_menu_event *event = process(0);
+ const event *event = process(0);
if (event != nullptr && event->iptkey == IPT_UI_SELECT)
{
*m_result = int(FPTR(event->itemref));
- ui_menu::stack_pop(machine());
+ menu::stack_pop(machine());
}
}
@@ -778,9 +782,9 @@ void ui_menu_select_format::handle()
// ctor
//-------------------------------------------------
-ui_menu_select_rw::ui_menu_select_rw(mame_ui_manager &mui, render_container *container,
+menu_select_rw::menu_select_rw(mame_ui_manager &mui, render_container *container,
bool can_in_place, int *result)
- : ui_menu(mui, container)
+ : menu(mui, container)
{
m_can_in_place = can_in_place;
m_result = result;
@@ -791,7 +795,7 @@ ui_menu_select_rw::ui_menu_select_rw(mame_ui_manager &mui, render_container *con
// dtor
//-------------------------------------------------
-ui_menu_select_rw::~ui_menu_select_rw()
+menu_select_rw::~menu_select_rw()
{
}
@@ -800,9 +804,9 @@ ui_menu_select_rw::~ui_menu_select_rw()
// populate
//-------------------------------------------------
-void ui_menu_select_rw::populate()
+void menu_select_rw::populate()
{
- item_append(_("Select access mode"), nullptr, MENU_FLAG_DISABLE, nullptr);
+ item_append(_("Select access mode"), nullptr, FLAG_DISABLE, nullptr);
item_append(_("Read-only"), nullptr, 0, (void *)READONLY);
if (m_can_in_place)
item_append(_("Read-write"), nullptr, 0, (void *)READWRITE);
@@ -815,13 +819,15 @@ void ui_menu_select_rw::populate()
// handle
//-------------------------------------------------
-void ui_menu_select_rw::handle()
+void menu_select_rw::handle()
{
// process the menu
- const ui_menu_event *event = process(0);
+ const event *event = process(0);
if (event != nullptr && event->iptkey == IPT_UI_SELECT)
{
*m_result = int(FPTR(event->itemref));
- ui_menu::stack_pop(machine());
+ menu::stack_pop(machine());
}
}
+
+} // namespace ui