diff options
author | 2016-03-18 22:00:47 +0100 | |
---|---|---|
committer | 2016-03-18 22:00:47 +0100 | |
commit | 25bc1007af6054e083d5c671f93cbe94878ef0f8 (patch) | |
tree | 5b6b9ab53c8f95caaa505bdc39a7bcf2a9b30920 /src/emu/ui/datmenu.cpp | |
parent | 95aa75c8c6245dc06000e5e8493287c06b19a560 (diff) |
Added support and configuration for the image collection "covers".
Slightly modernized and simplified the code.
Diffstat (limited to 'src/emu/ui/datmenu.cpp')
-rw-r--r-- | src/emu/ui/datmenu.cpp | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/src/emu/ui/datmenu.cpp b/src/emu/ui/datmenu.cpp index 93c776f3e51..a4d3e619ced 100644 --- a/src/emu/ui/datmenu.cpp +++ b/src/emu/ui/datmenu.cpp @@ -1,5 +1,5 @@ // license:BSD-3-Clause -// copyright-holders:Dankan1890 +// copyright-holders:Maurizio Petrarota /********************************************************************* ui/datmenu.cpp @@ -36,6 +36,8 @@ ui_menu_dats_view::ui_menu_dats_view(running_machine &machine, render_container } } m_driver = (driver == nullptr) ? &machine.system() : driver; + m_actual = 0; + m_issoft = false; init_items(); } @@ -52,8 +54,8 @@ ui_menu_dats_view::ui_menu_dats_view(running_machine &machine, render_container m_parent = swinfo->parentname; m_driver = (driver == nullptr) ? &machine.system() : driver; m_swinfo = swinfo; - - issoft = true; + m_actual = 0; + m_issoft = true; if (machine.datfile().has_software(m_list, m_short, m_parent)) m_items_list.emplace_back(_("Software History"), UI_HISTORY_LOAD, machine.datfile().rev_history()); @@ -78,15 +80,15 @@ void ui_menu_dats_view::handle() const ui_menu_event *m_event = process(MENU_FLAG_UI_DATS); if (m_event != nullptr) { - if (m_event->iptkey == IPT_UI_LEFT && actual > 0) + if (m_event->iptkey == IPT_UI_LEFT && m_actual > 0) { - actual--; + m_actual--; reset(UI_MENU_RESET_SELECT_FIRST); } - if (m_event->iptkey == IPT_UI_RIGHT && actual < m_items_list.size() - 1) + if (m_event->iptkey == IPT_UI_RIGHT && m_actual < m_items_list.size() - 1) { - actual++; + m_actual++; reset(UI_MENU_RESET_SELECT_FIRST); } } @@ -99,7 +101,7 @@ void ui_menu_dats_view::handle() void ui_menu_dats_view::populate() { machine().pause(); - (issoft == true) ? get_data_sw() : get_data(); + (m_issoft == true) ? get_data_sw() : get_data(); item_append(MENU_SEPARATOR_ITEM, nullptr, (MENU_FLAG_UI_DATS | MENU_FLAG_LEFT_ARROW | MENU_FLAG_RIGHT_ARROW), nullptr); customtop = 2.0f * machine().ui().get_line_height() + 4.0f * UI_BOX_TB_BORDER; @@ -116,7 +118,7 @@ void ui_menu_dats_view::custom_render(void *selectedref, float top, float bottom ui_manager &mui = machine().ui(); float maxwidth = origx2 - origx1; float width; - std::string driver = (issoft == true) ? m_swinfo->longname : m_driver->description; + std::string driver = (m_issoft == true) ? m_swinfo->longname : m_driver->description; mui.draw_text_full(container, driver.c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE, DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr); @@ -168,8 +170,8 @@ void ui_menu_dats_view::custom_render(void *selectedref, float top, float bottom for (auto & elem : m_items_list) { x1 += space; - rgb_t fcolor = (actual == x) ? rgb_t(0xff, 0xff, 0xff, 0x00) : UI_TEXT_COLOR; - rgb_t bcolor = (actual == x) ? rgb_t(0xff, 0xff, 0xff, 0xff) : UI_TEXT_BG_COLOR; + rgb_t fcolor = (m_actual == x) ? rgb_t(0xff, 0xff, 0xff, 0x00) : UI_TEXT_COLOR; + rgb_t bcolor = (m_actual == x) ? rgb_t(0xff, 0xff, 0xff, 0xff) : UI_TEXT_BG_COLOR; mui.draw_text_full(container, elem.label.c_str(), x1, y1, 1.0f, JUSTIFY_LEFT, WRAP_NEVER, DRAW_NONE, fcolor, bcolor, &width, nullptr); if (bcolor != UI_TEXT_BG_COLOR) @@ -184,7 +186,7 @@ void ui_menu_dats_view::custom_render(void *selectedref, float top, float bottom // bottom std::string revision; - revision.assign(_("Revision: ")).append(m_items_list[actual].revision); + revision.assign(_("Revision: ")).append(m_items_list[m_actual].revision); mui.draw_text_full(container, revision.c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE, DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr); width += 2 * UI_BOX_LR_BORDER; @@ -219,7 +221,7 @@ void ui_menu_dats_view::get_data() std::vector<int> xend; std::string buffer; std::vector<std::string> m_item; - if (m_items_list[actual].option == UI_COMMAND_LOAD) + if (m_items_list[m_actual].option == UI_COMMAND_LOAD) { machine().datfile().command_sub_menu(m_driver, m_item); if (!m_item.empty()) @@ -236,7 +238,7 @@ void ui_menu_dats_view::get_data() } } else - machine().datfile().load_data_info(m_driver, buffer, m_items_list[actual].option); + machine().datfile().load_data_info(m_driver, buffer, m_items_list[m_actual].option); int totallines = machine().ui().wrap_text(container, buffer.c_str(), 0.0f, 0.0f, 1.0f - (4.0f * UI_BOX_LR_BORDER), xstart, xend); for (int x = 0; x < totallines; ++x) @@ -252,7 +254,7 @@ void ui_menu_dats_view::get_data_sw() std::vector<int> xend; std::string buffer; std::vector<std::string> m_item; - if (m_items_list[actual].option == 0) + if (m_items_list[m_actual].option == 0) buffer = m_swinfo->usage; else { |