summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author dankan1890 <mewuidev2@gmail.com>2016-02-11 00:26:12 +0100
committer dankan1890 <mewuidev2@gmail.com>2016-02-11 00:26:12 +0100
commit5e5f2788d68256b51fb7cd0d9c3a4938286b497e (patch)
treeb440d908031575719f8c7ed60828008788fba011
parent097ae2fe5c0c32d540301ceac6600c5161dacb50 (diff)
Rearranged some filters. nw
-rw-r--r--src/emu/ui/custmenu.cpp6
-rw-r--r--src/emu/ui/menu.cpp20
-rw-r--r--src/emu/ui/selgame.cpp36
-rw-r--r--src/emu/ui/selgame.h2
-rw-r--r--src/emu/ui/utils.cpp8
-rw-r--r--src/emu/ui/utils.h6
6 files changed, 46 insertions, 32 deletions
diff --git a/src/emu/ui/custmenu.cpp b/src/emu/ui/custmenu.cpp
index 2abbd533d75..27cdf2c17c4 100644
--- a/src/emu/ui/custmenu.cpp
+++ b/src/emu/ui/custmenu.cpp
@@ -83,14 +83,14 @@ void ui_menu_custom_filter::handle()
{
custfltr::other[pos]--;
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;
}
else if (m_event->iptkey == IPT_UI_RIGHT && custfltr::other[pos] < FILTER_LAST - 1)
{
custfltr::other[pos]++;
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;
}
else if (m_event->iptkey == IPT_UI_SELECT)
@@ -98,7 +98,7 @@ void ui_menu_custom_filter::handle()
size_t total = main_filters::length;
std::vector<std::string> s_sel(total);
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_";
else
s_sel[index] = main_filters::text[index];
diff --git a/src/emu/ui/menu.cpp b/src/emu/ui/menu.cpp
index d1cef3a20a8..886b069bd7d 100644
--- a/src/emu/ui/menu.cpp
+++ b/src/emu/ui/menu.cpp
@@ -2193,11 +2193,14 @@ void ui_menu::arts_render_images(bitmap_argb32 *tmp_bitmap, float origx1, float
{
bool no_available = false;
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 (!tmp_bitmap->valid())
{
- tmp_bitmap->reset();
+ //tmp_bitmap->reset();
tmp_bitmap->allocate(256, 256);
for (int x = 0; x < 256; x++)
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 panel_width_pixel = panel_width * screen_width;
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;
// Calculate resize ratios for resizing
@@ -2254,8 +2267,9 @@ void ui_menu::arts_render_images(bitmap_argb32 *tmp_bitmap, float origx1, float
else
dest_bitmap = tmp_bitmap;
- snapx_bitmap->reset();
- snapx_bitmap->allocate(panel_width_pixel, panel_height_pixel);
+ //snapx_bitmap->reset();
+ 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 y1 = (0.5f * panel_height_pixel) - (0.5f * dest_yPixel);
diff --git a/src/emu/ui/selgame.cpp b/src/emu/ui/selgame.cpp
index a7c4940b29c..e911f948945 100644
--- a/src/emu/ui/selgame.cpp
+++ b/src/emu/ui/selgame.cpp
@@ -235,7 +235,7 @@ ui_menu_select_game::~ui_menu_select_game()
const game_driver *driver = nullptr;
ui_software_info *swinfo = nullptr;
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;
else
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
else if (m_event->iptkey == IPT_UI_SELECT)
{
- if (main_filters::actual != FILTER_FAVORITE_GAME)
- inkey_select(m_event);
- else
+ if (isfavorite())
inkey_select_favorite(m_event);
+ else
+ inkey_select(m_event);
}
// handle UI_LEFT
@@ -374,7 +374,7 @@ void ui_menu_select_game::handle()
// handle UI_HISTORY
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;
if ((FPTR)driver > 3)
@@ -396,7 +396,7 @@ void ui_menu_select_game::handle()
// handle UI_MAMEINFO
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;
if ((FPTR)driver > 3)
@@ -423,7 +423,7 @@ void ui_menu_select_game::handle()
// handle UI_STORY
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;
if ((FPTR)driver > 3)
@@ -440,7 +440,7 @@ void ui_menu_select_game::handle()
// handle UI_SYSINFO
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;
if ((FPTR)driver > 3)
@@ -457,7 +457,7 @@ void ui_menu_select_game::handle()
// handle UI_COMMAND
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;
if ((FPTR)driver > 3)
@@ -474,7 +474,7 @@ void ui_menu_select_game::handle()
// handle 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;
if ((FPTR)driver > 3)
@@ -588,10 +588,10 @@ void ui_menu_select_game::populate()
ui_globals::switch_image = true;
int old_item_selected = -1;
- if (main_filters::actual != FILTER_FAVORITE_GAME)
+ if (!isfavorite())
{
// if search is not empty, find approximate matches
- if (m_search[0] != 0 && !no_active_search())
+ if (m_search[0] != 0 && !isfavorite())
populate_search();
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(") -");
// display the current typeahead
- if (no_active_search())
+ if (isfavorite())
tempbuf[1].clear();
else
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
- if (main_filters::actual != FILTER_FAVORITE_GAME)
+ if (!isfavorite())
driver = ((FPTR)selectedref > 3) ? (const game_driver *)selectedref : nullptr;
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
//-------------------------------------------------
-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);
// 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;
reset(UI_MENU_RESET_SELECT_FIRST);
}
// 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);
m_search[buflen] = 0;
diff --git a/src/emu/ui/selgame.h b/src/emu/ui/selgame.h
index 67906471663..4c1cf548d60 100644
--- a/src/emu/ui/selgame.h
+++ b/src/emu/ui/selgame.h
@@ -56,7 +56,7 @@ private:
void build_available_list();
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 init_sorted_list();
bool load_available_machines();
diff --git a/src/emu/ui/utils.cpp b/src/emu/ui/utils.cpp
index 79bec2fc149..608b6b16a88 100644
--- a/src/emu/ui/utils.cpp
+++ b/src/emu/ui/utils.cpp
@@ -25,15 +25,15 @@ std::vector<std::string> c_mnfct::ui;
// Main filters
UINT16 main_filters::actual = 0;
-const char *main_filters::text[] = { "All", "Available", "Unavailable", "Working", "Not Mechanical", "Category", "Favorites", "BIOS",
- "Originals", "Clones", "Not Working", "Mechanical", "Manufacturers", "Years", "Support Save",
- "Not Support Save", "CHD", "No CHD", "Vertical", "Horizontal", "Custom" };
+const char *main_filters::text[] = { "All", "Available", "Unavailable", "Working", "Not Working", "Mechanical", "Not Mechanical",
+ "Category", "Favorites", "BIOS", "Originals", "Clones", "Manufacturers", "Years", "Support Save",
+ "Not Support Save", "CHD", "No CHD", "Vertical", "Horizontal", "Custom" };
size_t main_filters::length = ARRAY_LENGTH(main_filters::text);
// Software filters
UINT16 sw_filters::actual = 0;
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);
// Globals
diff --git a/src/emu/ui/utils.h b/src/emu/ui/utils.h
index 1cc08e2ae7e..81c509f9958 100644
--- a/src/emu/ui/utils.h
+++ b/src/emu/ui/utils.h
@@ -28,14 +28,14 @@ enum
FILTER_AVAILABLE,
FILTER_UNAVAILABLE,
FILTER_WORKING,
+ FILTER_NOT_WORKING,
+ FILTER_MECHANICAL,
FILTER_NOT_MECHANICAL,
FILTER_CATEGORY,
- FILTER_FAVORITE_GAME,
+ FILTER_FAVORITE,
FILTER_BIOS,
FILTER_PARENT,
FILTER_CLONES,
- FILTER_NOT_WORKING,
- FILTER_MECHANICAL,
FILTER_MANUFACTURER,
FILTER_YEAR,
FILTER_SAVE,