Rearranged some filters. nw

This commit is contained in:
dankan1890 2016-02-11 00:26:12 +01:00
parent 097ae2fe5c
commit 5e5f2788d6
6 changed files with 46 additions and 32 deletions

View File

@ -83,14 +83,14 @@ void ui_menu_custom_filter::handle()
{ {
custfltr::other[pos]--; custfltr::other[pos]--;
for ( ; custfltr::other[pos] > FILTER_UNAVAILABLE && (custfltr::other[pos] == FILTER_CATEGORY for ( ; custfltr::other[pos] > FILTER_UNAVAILABLE && (custfltr::other[pos] == FILTER_CATEGORY
|| custfltr::other[pos] == FILTER_FAVORITE_GAME); custfltr::other[pos]--) ; || custfltr::other[pos] == FILTER_FAVORITE); custfltr::other[pos]--) ;
changed = true; changed = true;
} }
else if (m_event->iptkey == IPT_UI_RIGHT && custfltr::other[pos] < FILTER_LAST - 1) else if (m_event->iptkey == IPT_UI_RIGHT && custfltr::other[pos] < FILTER_LAST - 1)
{ {
custfltr::other[pos]++; custfltr::other[pos]++;
for ( ; custfltr::other[pos] < FILTER_LAST && (custfltr::other[pos] == FILTER_CATEGORY for ( ; custfltr::other[pos] < FILTER_LAST && (custfltr::other[pos] == FILTER_CATEGORY
|| custfltr::other[pos] == FILTER_FAVORITE_GAME); custfltr::other[pos]++) ; || custfltr::other[pos] == FILTER_FAVORITE); custfltr::other[pos]++) ;
changed = true; changed = true;
} }
else if (m_event->iptkey == IPT_UI_SELECT) else if (m_event->iptkey == IPT_UI_SELECT)
@ -98,7 +98,7 @@ void ui_menu_custom_filter::handle()
size_t total = main_filters::length; size_t total = main_filters::length;
std::vector<std::string> s_sel(total); std::vector<std::string> s_sel(total);
for (size_t index = 0; index < total; ++index) for (size_t index = 0; index < total; ++index)
if (index <= FILTER_UNAVAILABLE || index == FILTER_CATEGORY || index == FILTER_FAVORITE_GAME || index == FILTER_CUSTOM) if (index <= FILTER_UNAVAILABLE || index == FILTER_CATEGORY || index == FILTER_FAVORITE || index == FILTER_CUSTOM)
s_sel[index] = "_skip_"; s_sel[index] = "_skip_";
else else
s_sel[index] = main_filters::text[index]; s_sel[index] = main_filters::text[index];

View File

@ -2193,11 +2193,14 @@ void ui_menu::arts_render_images(bitmap_argb32 *tmp_bitmap, float origx1, float
{ {
bool no_available = false; bool no_available = false;
float line_height = machine().ui().get_line_height(); float line_height = machine().ui().get_line_height();
static int old_panel_width_pixel = -1;
static int old_panel_height_pixel = -1;
// if it fails, use the default image // if it fails, use the default image
if (!tmp_bitmap->valid()) if (!tmp_bitmap->valid())
{ {
tmp_bitmap->reset(); //tmp_bitmap->reset();
tmp_bitmap->allocate(256, 256); tmp_bitmap->allocate(256, 256);
for (int x = 0; x < 256; x++) for (int x = 0; x < 256; x++)
for (int y = 0; y < 256; y++) for (int y = 0; y < 256; y++)
@ -2213,6 +2216,16 @@ void ui_menu::arts_render_images(bitmap_argb32 *tmp_bitmap, float origx1, float
int screen_height = machine().render().ui_target().height(); int screen_height = machine().render().ui_target().height();
int panel_width_pixel = panel_width * screen_width; int panel_width_pixel = panel_width * screen_width;
int panel_height_pixel = panel_height * screen_height; int panel_height_pixel = panel_height * screen_height;
if (old_panel_height_pixel == -1 || old_panel_width_pixel == -1)
snapx_bitmap->allocate(panel_width_pixel, panel_height_pixel);
if (old_panel_height_pixel != panel_height_pixel)
old_panel_height_pixel = panel_height_pixel;
if (old_panel_height_pixel != panel_width_pixel)
old_panel_width_pixel = panel_width_pixel;
float ratio = 0.0f; float ratio = 0.0f;
// Calculate resize ratios for resizing // Calculate resize ratios for resizing
@ -2254,8 +2267,9 @@ void ui_menu::arts_render_images(bitmap_argb32 *tmp_bitmap, float origx1, float
else else
dest_bitmap = tmp_bitmap; dest_bitmap = tmp_bitmap;
snapx_bitmap->reset(); //snapx_bitmap->reset();
snapx_bitmap->allocate(panel_width_pixel, panel_height_pixel); if (old_panel_height_pixel != panel_height_pixel || old_panel_width_pixel != panel_width_pixel)
snapx_bitmap->allocate(panel_width_pixel, panel_height_pixel);
int x1 = (0.5f * panel_width_pixel) - (0.5f * dest_xPixel); int x1 = (0.5f * panel_width_pixel) - (0.5f * dest_xPixel);
int y1 = (0.5f * panel_height_pixel) - (0.5f * dest_yPixel); int y1 = (0.5f * panel_height_pixel) - (0.5f * dest_yPixel);

View File

@ -235,7 +235,7 @@ ui_menu_select_game::~ui_menu_select_game()
const game_driver *driver = nullptr; const game_driver *driver = nullptr;
ui_software_info *swinfo = nullptr; ui_software_info *swinfo = nullptr;
ui_options &mopt = machine().ui().options(); ui_options &mopt = machine().ui().options();
if (main_filters::actual == FILTER_FAVORITE_GAME) if (isfavorite())
swinfo = (selected >= 0 && selected < item.size()) ? (ui_software_info *)item[selected].ref : nullptr; swinfo = (selected >= 0 && selected < item.size()) ? (ui_software_info *)item[selected].ref : nullptr;
else else
driver = (selected >= 0 && selected < item.size()) ? (const game_driver *)item[selected].ref : nullptr; driver = (selected >= 0 && selected < item.size()) ? (const game_driver *)item[selected].ref : nullptr;
@ -298,10 +298,10 @@ void ui_menu_select_game::handle()
// handle selections // handle selections
else if (m_event->iptkey == IPT_UI_SELECT) else if (m_event->iptkey == IPT_UI_SELECT)
{ {
if (main_filters::actual != FILTER_FAVORITE_GAME) if (isfavorite())
inkey_select(m_event);
else
inkey_select_favorite(m_event); inkey_select_favorite(m_event);
else
inkey_select(m_event);
} }
// handle UI_LEFT // handle UI_LEFT
@ -374,7 +374,7 @@ void ui_menu_select_game::handle()
// handle UI_HISTORY // handle UI_HISTORY
else if (m_event->iptkey == IPT_UI_HISTORY && enabled_dats) else if (m_event->iptkey == IPT_UI_HISTORY && enabled_dats)
{ {
if (main_filters::actual != FILTER_FAVORITE_GAME) if (!isfavorite())
{ {
const game_driver *driver = (const game_driver *)m_event->itemref; const game_driver *driver = (const game_driver *)m_event->itemref;
if ((FPTR)driver > 3) if ((FPTR)driver > 3)
@ -396,7 +396,7 @@ void ui_menu_select_game::handle()
// handle UI_MAMEINFO // handle UI_MAMEINFO
else if (m_event->iptkey == IPT_UI_MAMEINFO && enabled_dats) else if (m_event->iptkey == IPT_UI_MAMEINFO && enabled_dats)
{ {
if (main_filters::actual != FILTER_FAVORITE_GAME) if (!isfavorite())
{ {
const game_driver *driver = (const game_driver *)m_event->itemref; const game_driver *driver = (const game_driver *)m_event->itemref;
if ((FPTR)driver > 3) if ((FPTR)driver > 3)
@ -423,7 +423,7 @@ void ui_menu_select_game::handle()
// handle UI_STORY // handle UI_STORY
else if (m_event->iptkey == IPT_UI_STORY && enabled_dats) else if (m_event->iptkey == IPT_UI_STORY && enabled_dats)
{ {
if (main_filters::actual != FILTER_FAVORITE_GAME) if (!isfavorite())
{ {
const game_driver *driver = (const game_driver *)m_event->itemref; const game_driver *driver = (const game_driver *)m_event->itemref;
if ((FPTR)driver > 3) if ((FPTR)driver > 3)
@ -440,7 +440,7 @@ void ui_menu_select_game::handle()
// handle UI_SYSINFO // handle UI_SYSINFO
else if (m_event->iptkey == IPT_UI_SYSINFO && enabled_dats) else if (m_event->iptkey == IPT_UI_SYSINFO && enabled_dats)
{ {
if (main_filters::actual != FILTER_FAVORITE_GAME) if (!isfavorite())
{ {
const game_driver *driver = (const game_driver *)m_event->itemref; const game_driver *driver = (const game_driver *)m_event->itemref;
if ((FPTR)driver > 3) if ((FPTR)driver > 3)
@ -457,7 +457,7 @@ void ui_menu_select_game::handle()
// handle UI_COMMAND // handle UI_COMMAND
else if (m_event->iptkey == IPT_UI_COMMAND && enabled_dats) else if (m_event->iptkey == IPT_UI_COMMAND && enabled_dats)
{ {
if (main_filters::actual != FILTER_FAVORITE_GAME) if (!isfavorite())
{ {
const game_driver *driver = (const game_driver *)m_event->itemref; const game_driver *driver = (const game_driver *)m_event->itemref;
if ((FPTR)driver > 3) if ((FPTR)driver > 3)
@ -474,7 +474,7 @@ void ui_menu_select_game::handle()
// handle UI_FAVORITES // handle UI_FAVORITES
else if (m_event->iptkey == IPT_UI_FAVORITES) else if (m_event->iptkey == IPT_UI_FAVORITES)
{ {
if (main_filters::actual != FILTER_FAVORITE_GAME) if (!isfavorite())
{ {
const game_driver *driver = (const game_driver *)m_event->itemref; const game_driver *driver = (const game_driver *)m_event->itemref;
if ((FPTR)driver > 3) if ((FPTR)driver > 3)
@ -588,10 +588,10 @@ void ui_menu_select_game::populate()
ui_globals::switch_image = true; ui_globals::switch_image = true;
int old_item_selected = -1; int old_item_selected = -1;
if (main_filters::actual != FILTER_FAVORITE_GAME) if (!isfavorite())
{ {
// if search is not empty, find approximate matches // if search is not empty, find approximate matches
if (m_search[0] != 0 && !no_active_search()) if (m_search[0] != 0 && !isfavorite())
populate_search(); populate_search();
else else
{ {
@ -797,7 +797,7 @@ void ui_menu_select_game::custom_render(void *selectedref, float top, float bott
filtered.assign(main_filters::text[main_filters::actual]).append(" (").append(c_year::ui[c_year::actual]).append(") -"); filtered.assign(main_filters::text[main_filters::actual]).append(" (").append(c_year::ui[c_year::actual]).append(") -");
// display the current typeahead // display the current typeahead
if (no_active_search()) if (isfavorite())
tempbuf[1].clear(); tempbuf[1].clear();
else else
tempbuf[1].assign(filtered).append(" Search: ").append(m_search).append("_"); tempbuf[1].assign(filtered).append(" Search: ").append(m_search).append("_");
@ -834,7 +834,7 @@ void ui_menu_select_game::custom_render(void *selectedref, float top, float bott
} }
// determine the text to render below // determine the text to render below
if (main_filters::actual != FILTER_FAVORITE_GAME) if (!isfavorite())
driver = ((FPTR)selectedref > 3) ? (const game_driver *)selectedref : nullptr; driver = ((FPTR)selectedref > 3) ? (const game_driver *)selectedref : nullptr;
else else
{ {
@ -1184,9 +1184,9 @@ void ui_menu_select_game::inkey_select_favorite(const ui_menu_event *m_event)
// returns if the search can be activated // returns if the search can be activated
//------------------------------------------------- //-------------------------------------------------
inline bool ui_menu_select_game::no_active_search() inline bool ui_menu_select_game::isfavorite()
{ {
return (main_filters::actual == FILTER_FAVORITE_GAME); return (main_filters::actual == FILTER_FAVORITE);
} }
//------------------------------------------------- //-------------------------------------------------
@ -1198,14 +1198,14 @@ void ui_menu_select_game::inkey_special(const ui_menu_event *m_event)
int buflen = strlen(m_search); int buflen = strlen(m_search);
// if it's a backspace and we can handle it, do so // if it's a backspace and we can handle it, do so
if (((m_event->unichar == 8 || m_event->unichar == 0x7f) && buflen > 0) && !no_active_search()) if (((m_event->unichar == 8 || m_event->unichar == 0x7f) && buflen > 0) && !isfavorite())
{ {
*(char *)utf8_previous_char(&m_search[buflen]) = 0; *(char *)utf8_previous_char(&m_search[buflen]) = 0;
reset(UI_MENU_RESET_SELECT_FIRST); reset(UI_MENU_RESET_SELECT_FIRST);
} }
// if it's any other key and we're not maxed out, update // if it's any other key and we're not maxed out, update
else if ((m_event->unichar >= ' ' && m_event->unichar < 0x7f) && !no_active_search()) else if ((m_event->unichar >= ' ' && m_event->unichar < 0x7f) && !isfavorite())
{ {
buflen += utf8_from_uchar(&m_search[buflen], ARRAY_LENGTH(m_search) - buflen, m_event->unichar); buflen += utf8_from_uchar(&m_search[buflen], ARRAY_LENGTH(m_search) - buflen, m_event->unichar);
m_search[buflen] = 0; m_search[buflen] = 0;

View File

@ -56,7 +56,7 @@ private:
void build_available_list(); void build_available_list();
void build_list(std::vector<const game_driver *> &vec, const char *filter_text = nullptr, int filter = 0, bool bioscheck = false); void build_list(std::vector<const game_driver *> &vec, const char *filter_text = nullptr, int filter = 0, bool bioscheck = false);
bool no_active_search(); bool isfavorite();
void populate_search(); void populate_search();
void init_sorted_list(); void init_sorted_list();
bool load_available_machines(); bool load_available_machines();

View File

@ -25,15 +25,15 @@ std::vector<std::string> c_mnfct::ui;
// Main filters // Main filters
UINT16 main_filters::actual = 0; UINT16 main_filters::actual = 0;
const char *main_filters::text[] = { "All", "Available", "Unavailable", "Working", "Not Mechanical", "Category", "Favorites", "BIOS", const char *main_filters::text[] = { "All", "Available", "Unavailable", "Working", "Not Working", "Mechanical", "Not Mechanical",
"Originals", "Clones", "Not Working", "Mechanical", "Manufacturers", "Years", "Support Save", "Category", "Favorites", "BIOS", "Originals", "Clones", "Manufacturers", "Years", "Support Save",
"Not Support Save", "CHD", "No CHD", "Vertical", "Horizontal", "Custom" }; "Not Support Save", "CHD", "No CHD", "Vertical", "Horizontal", "Custom" };
size_t main_filters::length = ARRAY_LENGTH(main_filters::text); size_t main_filters::length = ARRAY_LENGTH(main_filters::text);
// Software filters // Software filters
UINT16 sw_filters::actual = 0; UINT16 sw_filters::actual = 0;
const char *sw_filters::text[] = { "All", "Available", "Unavailable", "Originals", "Clones", "Years", "Publishers", "Supported", const char *sw_filters::text[] = { "All", "Available", "Unavailable", "Originals", "Clones", "Years", "Publishers", "Supported",
"Partial Supported", "Unsupported", "Region", "Device Type", "Software List", "Custom" }; "Partial Supported", "Unsupported", "Region", "Device Type", "Software List", "Custom" };
size_t sw_filters::length = ARRAY_LENGTH(sw_filters::text); size_t sw_filters::length = ARRAY_LENGTH(sw_filters::text);
// Globals // Globals

View File

@ -28,14 +28,14 @@ enum
FILTER_AVAILABLE, FILTER_AVAILABLE,
FILTER_UNAVAILABLE, FILTER_UNAVAILABLE,
FILTER_WORKING, FILTER_WORKING,
FILTER_NOT_WORKING,
FILTER_MECHANICAL,
FILTER_NOT_MECHANICAL, FILTER_NOT_MECHANICAL,
FILTER_CATEGORY, FILTER_CATEGORY,
FILTER_FAVORITE_GAME, FILTER_FAVORITE,
FILTER_BIOS, FILTER_BIOS,
FILTER_PARENT, FILTER_PARENT,
FILTER_CLONES, FILTER_CLONES,
FILTER_NOT_WORKING,
FILTER_MECHANICAL,
FILTER_MANUFACTURER, FILTER_MANUFACTURER,
FILTER_YEAR, FILTER_YEAR,
FILTER_SAVE, FILTER_SAVE,