Previous 199869 Revisions Next

r44667 Thursday 4th February, 2016 at 14:14:29 UTC by Miodrag Milanović
removed UME filtering (nw)
[src/emu/ui]menu.cpp menu.h moptions.cpp moptions.h optsmenu.cpp optsmenu.h selgame.cpp utils.cpp utils.h

trunk/src/emu/ui/menu.cpp
r253178r253179
19501950               selected = visible_items + 2;
19511951               stop = true;
19521952            }
1953            else if (hover >= HOVER_MAME_ALL && hover <= HOVER_MAME_SYSTEMS)
1954            {
1955               ume_filters::actual = (HOVER_MAME_ALL - hover) * (-1);
1956               menu_event.iptkey = IPT_OTHER;
1957               stop = true;
1958            }
19591953            else if (hover >= HOVER_RP_FIRST && hover <= HOVER_RP_LAST)
19601954            {
19611955               ui_globals::rpanel = (HOVER_RP_FIRST - hover) * (-1);
r253178r253179
20302024}
20312025
20322026//-------------------------------------------------
2033//  draw UME box
2034//-------------------------------------------------
2035
2036void ui_menu::draw_ume_box(float x1, float y1, float x2, float y2)
2037{
2038   float text_size = 0.65f;
2039   ui_manager &mui = machine().ui();
2040   float line_height = mui.get_line_height() * text_size;
2041   float maxwidth = 0.0f;
2042
2043   for (int x = 0; x < ume_filters::length; x++)
2044   {
2045      float width;
2046      // compute width of left hand side
2047      mui.draw_text_full(container, ume_filters::text[x], 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_NEVER,
2048         DRAW_NONE, UI_TEXT_COLOR, ARGB_BLACK, &width, nullptr, text_size);
2049      width += 2 * UI_BOX_LR_BORDER;
2050      maxwidth = MAX(maxwidth, width);
2051   }
2052
2053   x2 = x1 + maxwidth;
2054
2055   mui.draw_outlined_box(container, x1, y1, x2, y2, UI_BACKGROUND_COLOR);
2056
2057   // take off the borders
2058   x1 += UI_BOX_LR_BORDER;
2059   x2 -= UI_BOX_LR_BORDER;
2060   y1 += UI_BOX_TB_BORDER;
2061   y2 -= UI_BOX_TB_BORDER;
2062
2063   for (int filter = 0; filter < ume_filters::length; filter++)
2064   {
2065      rgb_t bgcolor = UI_TEXT_BG_COLOR;
2066      rgb_t fgcolor = UI_TEXT_COLOR;
2067
2068      if (mouse_hit && x1 <= mouse_x && x2 > mouse_x && y1 <= mouse_y && y1 + line_height > mouse_y)
2069      {
2070         bgcolor = UI_MOUSEOVER_BG_COLOR;
2071         fgcolor = UI_MOUSEOVER_COLOR;
2072         hover = HOVER_MAME_ALL + filter;
2073      }
2074
2075      if (ume_filters::actual == filter)
2076      {
2077         bgcolor = UI_SELECTED_BG_COLOR;
2078         fgcolor = UI_SELECTED_COLOR;
2079      }
2080
2081      if (bgcolor != UI_TEXT_BG_COLOR)
2082         container->add_rect(x1, y1, x2, y1 + line_height, bgcolor, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXWRAP(TRUE));
2083
2084      mui.draw_text_full(container, ume_filters::text[filter], x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_NEVER,
2085         DRAW_NORMAL, fgcolor, bgcolor, nullptr, nullptr, text_size);
2086
2087      y1 += line_height;
2088   }
2089}
2090
2091//-------------------------------------------------
20922027//  draw right box title
20932028//-------------------------------------------------
20942029
trunk/src/emu/ui/menu.h
r253178r253179
204204   INT32 mouse_target_x, mouse_target_y;
205205   float mouse_x, mouse_y;
206206
207   // draw UME box
208   void draw_ume_box(float x1, float y1, float x2, float y2);
209
210207   // draw toolbar
211208   void draw_toolbar(float x1, float y1, float x2, float y2, bool software = false);
212209
trunk/src/emu/ui/moptions.cpp
r253178r253179
4949   { OPTION_USE_BACKGROUND,                "1",      OPTION_BOOLEAN,      "enable background image in main view" },
5050   { OPTION_SKIP_BIOS_MENU,                "0",      OPTION_BOOLEAN,      "skip bios submenu, start with configured or default" },
5151   { OPTION_SKIP_PARTS_MENU,               "0",      OPTION_BOOLEAN,      "skip parts submenu, start with first part" },
52   { OPTION_START_FILTER,                  "0",      OPTION_INTEGER,      "startup filter (0 = ALL, 1 = ARCADES, 2 = SYSTEMS)" },
5352   { OPTION_LAST_USED_FILTER,              "",         OPTION_STRING,      "latest used filter" },
5453   { OPTION_LAST_USED_MACHINE,             "",         OPTION_STRING,      "latest used machine" },
5554   { OPTION_INFO_AUTO_AUDIT,               "0",      OPTION_BOOLEAN,      "enable auto audit in the general info panel" },
trunk/src/emu/ui/moptions.h
r253178r253179
4444#define OPTION_USE_BACKGROUND         "use_background"
4545#define OPTION_SKIP_BIOS_MENU         "skip_biosmenu"
4646#define OPTION_SKIP_PARTS_MENU        "skip_partsmenu"
47#define OPTION_START_FILTER           "start_filter"
4847#define OPTION_LAST_USED_FILTER       "last_used_filter"
4948#define OPTION_LAST_USED_MACHINE      "last_used_machine"
5049#define OPTION_INFO_AUTO_AUDIT        "info_audit_enabled"
r253178r253179
106105   bool use_background_image() const { return bool_value(OPTION_USE_BACKGROUND); }
107106   bool skip_bios_menu() const { return bool_value(OPTION_SKIP_BIOS_MENU); }
108107   bool skip_parts_menu() const { return bool_value(OPTION_SKIP_PARTS_MENU); }
109   int start_filter() const { return int_value(OPTION_START_FILTER); }
110108   const char *last_used_machine() const { return value(OPTION_LAST_USED_MACHINE); }
111109   const char *last_used_filter() const { return value(OPTION_LAST_USED_FILTER); }
112110   bool info_audit() const { return bool_value(OPTION_INFO_AUTO_AUDIT); }
trunk/src/emu/ui/optsmenu.cpp
r253178r253179
205205            if (m_event->iptkey == IPT_UI_SELECT)
206206               ui_menu::stack_push(global_alloc_clear<ui_menu_custom_filter>(machine(), container));
207207            break;
208
209         case UME_SYSTEM:
210            if (m_event->iptkey == IPT_UI_LEFT || m_event->iptkey == IPT_UI_RIGHT)
211            {
212               (m_event->iptkey == IPT_UI_RIGHT) ? ume_filters::actual++ : ume_filters::actual--;
213               changed = true;
214            }
215            else if (m_event->iptkey == IPT_UI_SELECT)
216            {
217               int total = ume_filters::length;
218               std::vector<std::string> s_sel(total);
219               for (int index = 0; index < total; ++index)
220                  s_sel[index] = ume_filters::text[index];
221
222               ui_menu::stack_push(global_alloc_clear<ui_menu_selector>(machine(), container, s_sel, ume_filters::actual));
223            }
224
225            break;
226208      }
227209
228210   if (changed)
r253178r253179
239221   std::string fbuff;
240222
241223   // add filter item
242   UINT32 arrow_flags = get_arrow_flags(0, ume_filters::length - 1, ume_filters::actual);
243   item_append("Machine", ume_filters::text[ume_filters::actual], arrow_flags, (void *)(FPTR)UME_SYSTEM);
244
245   // add filter item
246   arrow_flags = get_arrow_flags((int)FILTER_FIRST, (int)FILTER_LAST, main_filters::actual);
224   UINT32 arrow_flags = get_arrow_flags((int)FILTER_FIRST, (int)FILTER_LAST, main_filters::actual);
247225   item_append("Filter", main_filters::text[main_filters::actual], arrow_flags, (void *)(FPTR)FILTER_MENU);
248226
249227   // add category subitem
trunk/src/emu/ui/optsmenu.h
r253178r253179
3838      CONTROLLER_MENU,
3939      SAVE_OPTIONS,
4040      CGI_MENU,
41      CUSTOM_FILTER,
42      UME_SYSTEM
41      CUSTOM_FILTER
4342   };
4443};
4544
trunk/src/emu/ui/selgame.cpp
r253178r253179
173173   ui_globals::curdats_view = MEWUI_FIRST_LOAD;
174174   ui_globals::switch_image = false;
175175   ui_globals::default_image = true;
176   ume_filters::actual = moptions.start_filter();
177176   ui_globals::panels_status = moptions.hide_panels();
178177}
179178
r253178r253179
206205   else if (main_filters::actual == FILTER_SCREEN)
207206      filter.append(",").append(screen_filters::text[screen_filters::actual]);
208207
209   mopt.set_value(OPTION_START_FILTER, ume_filters::actual, OPTION_PRIORITY_CMDLINE, error_string);
210208   mopt.set_value(OPTION_LAST_USED_FILTER, filter.c_str(), OPTION_PRIORITY_CMDLINE, error_string);
211209   mopt.set_value(OPTION_LAST_USED_MACHINE, last_driver.c_str(), OPTION_PRIORITY_CMDLINE, error_string);
212210   mopt.set_value(OPTION_HIDE_PANELS, ui_globals::panels_status, OPTION_PRIORITY_CMDLINE, error_string);
r253178r253179
755753   ui_manager &mui = machine().ui();
756754   float tbarspace = mui.get_line_height();
757755
758   if (ume_filters::actual == MEWUI_MAME)
759      strprintf(tempbuf[0], "MAME %s ( %d / %d machines (%d BIOS) )", bare_build_version, visible_items, (driver_list::total() - 1), m_isabios + m_issbios);
760   else if (ume_filters::actual == MEWUI_ARCADES)
761      strprintf(tempbuf[0], "MAME %s ( %d / %d arcades (%d BIOS) )", bare_build_version, visible_items, m_isarcades, m_isabios);
762   else if (ume_filters::actual == MEWUI_SYSTEMS)
763      strprintf(tempbuf[0], "MAME %s ( %d / %d systems (%d BIOS) )", bare_build_version, visible_items, m_issystems, m_issbios);
764
756   strprintf(tempbuf[0], "MAME %s ( %d / %d machines (%d BIOS) )", bare_build_version, visible_items, (driver_list::total() - 1), m_isabios + m_issbios);   
765757   std::string filtered;
766758
767759   if (main_filters::actual == FILTER_CATEGORY && !machine().inifile().ini_index.empty())
r253178r253179
817809      y1 += mui.get_line_height();
818810   }
819811
820   // draw ume box
821   x1 -= UI_BOX_LR_BORDER;
822   y1 = origy1 - top;
823   draw_ume_box(x1, y1, x2, y2);
824
825812   // determine the text to render below
826813   if (main_filters::actual != FILTER_FAVORITE_GAME)
827814      driver = ((FPTR)selectedref > 2) ? (const game_driver *)selectedref : nullptr;
r253178r253179
12351222      if (!bioscheck && filter != FILTER_BIOS && (s_driver->flags & MACHINE_IS_BIOS_ROOT) != 0)
12361223         continue;
12371224
1238      if ((s_driver->flags & MACHINE_TYPE_ARCADE) && ume_filters::actual == MEWUI_SYSTEMS)
1239         continue;
1240
1241      if (!(s_driver->flags & MACHINE_TYPE_ARCADE) && ume_filters::actual == MEWUI_ARCADES)
1242         continue;
1243
12441225      switch (filter)
12451226      {
12461227         case FILTER_ALL:
r253178r253179
13441325
13451326   for (auto & elem : s_drivers)
13461327   {
1347      if ((elem->flags & MACHINE_TYPE_ARCADE) && ume_filters::actual == MEWUI_SYSTEMS)
1348         continue;
1349
1350      if (!(elem->flags & MACHINE_TYPE_ARCADE) && ume_filters::actual == MEWUI_ARCADES)
1351         continue;
1352
13531328      m_displaylist.push_back(elem);
13541329   }
13551330
r253178r253179
14231398   {
14241399      if (!bioscheck && filter != FILTER_BIOS && (s_driver->flags & MACHINE_IS_BIOS_ROOT) != 0)
14251400         continue;
1426
1427      if ((s_driver->flags & MACHINE_TYPE_ARCADE) && ume_filters::actual == MEWUI_SYSTEMS)
1428         continue;
1429
1430      if (!(s_driver->flags & MACHINE_TYPE_ARCADE) && ume_filters::actual == MEWUI_ARCADES)
1431         continue;
1432
14331401      int idx = driver_list::find(s_driver->name);
14341402
14351403      switch (filter)
trunk/src/emu/ui/utils.cpp
r253178r253179
4242const char *screen_filters::text[] = { "<none>", "Raster", "Vector", "LCD" };
4343size_t screen_filters::length = ARRAY_LENGTH(screen_filters::text);
4444
45// UME
46UINT16 ume_filters::actual = 0;
47const char *ume_filters::text[] = { "ALL", "ARCADES", "SYSTEMS" };
48size_t ume_filters::length = ARRAY_LENGTH(ume_filters::text);
49
5045// Globals
5146UINT8 ui_globals::rpanel = 0;
5247UINT8 ui_globals::curimage_view = 0;
trunk/src/emu/ui/utils.h
r253178r253179
128128
129129enum
130130{
131   MEWUI_MAME_FIRST = 0,
132   MEWUI_MAME = MEWUI_MAME_FIRST,
133   MEWUI_ARCADES,
134   MEWUI_SYSTEMS,
135   MEWUI_MAME_LAST = MEWUI_SYSTEMS
136};
137
138enum
139{
140131   HOVER_DAT_UP = -1000,
141132   HOVER_DAT_DOWN,
142133   HOVER_UI_LEFT,
r253178r253179
152143   HOVER_B_SETTINGS,
153144   HOVER_RPANEL_ARROW,
154145   HOVER_LPANEL_ARROW,
155   HOVER_MAME_ALL,
156   HOVER_MAME_ARCADES,
157   HOVER_MAME_SYSTEMS,
158146   HOVER_FILTER_FIRST,
159147   HOVER_FILTER_LAST = (HOVER_FILTER_FIRST) + 1 + FILTER_LAST,
160148   HOVER_SW_FILTER_FIRST,


Previous 199869 Revisions Next


© 1997-2024 The MAME Team