mirror of
https://github.com/holub/mame
synced 2025-04-27 10:43:07 +03:00
UI updates:
* Hook up focus next/focus prev on system/software selection menus (Tab and LShift-Tab, respectively by default) * Allow joystick buttons to be used to change focus on system/software selection menus * Fixed bug that allowed focus to move to hidden panels (nw) Second attempt at doing this, and it worked fine. Must've been in bad mental health when I tried and failed to do this back in May
This commit is contained in:
parent
f1c02b33e1
commit
bc4906f991
@ -373,10 +373,6 @@ void menu_select_game::handle()
|
||||
m_filter_highlight = machine_filter::LAST;
|
||||
break;
|
||||
|
||||
case IPT_UI_CONFIGURE:
|
||||
inkey_navigation();
|
||||
break;
|
||||
|
||||
case IPT_UI_EXPORT:
|
||||
inkey_export();
|
||||
break;
|
||||
|
@ -715,7 +715,7 @@ void menu_select_launch::custom_render(void *selectedref, float top, float botto
|
||||
}
|
||||
|
||||
|
||||
void menu_select_launch::inkey_navigation()
|
||||
void menu_select_launch::rotate_focus(int dir)
|
||||
{
|
||||
switch (get_focus())
|
||||
{
|
||||
@ -723,28 +723,31 @@ void menu_select_launch::inkey_navigation()
|
||||
if (selected_index() <= m_available_items)
|
||||
{
|
||||
m_prev_selected = get_selection_ref();
|
||||
set_selected_index(m_available_items + 1);
|
||||
if ((0 < dir) || (ui_globals::panels_status == HIDE_BOTH))
|
||||
set_selected_index(m_available_items + 1);
|
||||
else if (ui_globals::panels_status == HIDE_RIGHT_PANEL)
|
||||
set_focus(focused_menu::LEFT);
|
||||
else
|
||||
set_focus(focused_menu::RIGHTBOTTOM);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ui_globals::panels_status != HIDE_LEFT_PANEL)
|
||||
set_focus(focused_menu::LEFT);
|
||||
|
||||
else if (ui_globals::panels_status == HIDE_BOTH)
|
||||
{
|
||||
for (int x = 0; x < item_count(); ++x)
|
||||
if (item(x).ref == m_prev_selected)
|
||||
set_selected_index(x);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((0 > dir) || (ui_globals::panels_status == HIDE_BOTH))
|
||||
select_prev();
|
||||
else if (ui_globals::panels_status == HIDE_LEFT_PANEL)
|
||||
set_focus(focused_menu::RIGHTTOP);
|
||||
}
|
||||
else
|
||||
set_focus(focused_menu::LEFT);
|
||||
}
|
||||
break;
|
||||
|
||||
case focused_menu::LEFT:
|
||||
if (ui_globals::panels_status != HIDE_RIGHT_PANEL)
|
||||
if (0 > dir)
|
||||
{
|
||||
set_focus(focused_menu::MAIN);
|
||||
set_selected_index(m_available_items + 1);
|
||||
}
|
||||
else if (ui_globals::panels_status != HIDE_RIGHT_PANEL)
|
||||
{
|
||||
set_focus(focused_menu::RIGHTTOP);
|
||||
}
|
||||
@ -756,12 +759,31 @@ void menu_select_launch::inkey_navigation()
|
||||
break;
|
||||
|
||||
case focused_menu::RIGHTTOP:
|
||||
set_focus(focused_menu::RIGHTBOTTOM);
|
||||
if (0 < dir)
|
||||
{
|
||||
set_focus(focused_menu::RIGHTBOTTOM);
|
||||
}
|
||||
else if (ui_globals::panels_status != HIDE_LEFT_PANEL)
|
||||
{
|
||||
set_focus(focused_menu::LEFT);
|
||||
}
|
||||
else
|
||||
{
|
||||
set_focus(focused_menu::MAIN);
|
||||
set_selected_index(m_available_items + 1);
|
||||
}
|
||||
break;
|
||||
|
||||
case focused_menu::RIGHTBOTTOM:
|
||||
set_focus(focused_menu::MAIN);
|
||||
select_prev();
|
||||
if (0 > dir)
|
||||
{
|
||||
set_focus(focused_menu::RIGHTTOP);
|
||||
}
|
||||
else
|
||||
{
|
||||
set_focus(focused_menu::MAIN);
|
||||
select_prev();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1486,6 +1508,20 @@ void menu_select_launch::handle_keys(uint32_t flags, int &iptkey)
|
||||
set_selected_index(top_line = m_available_items - 1);
|
||||
}
|
||||
|
||||
// focus next rotates throw targets forward
|
||||
if (exclusive_input_pressed(iptkey, IPT_UI_FOCUS_NEXT, 12))
|
||||
{
|
||||
if (!m_ui_error)
|
||||
rotate_focus(1);
|
||||
}
|
||||
|
||||
// focus next rotates throw targets forward
|
||||
if (exclusive_input_pressed(iptkey, IPT_UI_FOCUS_PREV, 12))
|
||||
{
|
||||
if (!m_ui_error)
|
||||
rotate_focus(-1);
|
||||
}
|
||||
|
||||
// pause enables/disables pause
|
||||
if (!m_ui_error && !ignorepause && exclusive_input_pressed(iptkey, IPT_UI_PAUSE, 0))
|
||||
{
|
||||
@ -1504,9 +1540,28 @@ void menu_select_launch::handle_keys(uint32_t flags, int &iptkey)
|
||||
{
|
||||
for (int code = IPT_UI_FIRST + 1; code < IPT_UI_LAST; code++)
|
||||
{
|
||||
if (m_ui_error || code == IPT_UI_CONFIGURE || (code == IPT_UI_LEFT && ignoreleft) || (code == IPT_UI_RIGHT && ignoreright) || (code == IPT_UI_PAUSE && ignorepause))
|
||||
if (m_ui_error)
|
||||
continue;
|
||||
|
||||
switch (code)
|
||||
{
|
||||
case IPT_UI_FOCUS_NEXT:
|
||||
case IPT_UI_FOCUS_PREV:
|
||||
continue;
|
||||
case IPT_UI_LEFT:
|
||||
if (ignoreleft)
|
||||
continue;
|
||||
break;
|
||||
case IPT_UI_RIGHT:
|
||||
if (ignoreright)
|
||||
continue;
|
||||
break;
|
||||
case IPT_UI_PAUSE:
|
||||
if (ignorepause)
|
||||
continue;
|
||||
break;
|
||||
}
|
||||
|
||||
if (exclusive_input_pressed(iptkey, code, 0))
|
||||
break;
|
||||
}
|
||||
@ -1680,9 +1735,8 @@ void menu_select_launch::handle_events(uint32_t flags, event &ev)
|
||||
|
||||
// translate CHAR events into specials
|
||||
case ui_event::IME_CHAR:
|
||||
if (exclusive_input_pressed(ev.iptkey, IPT_UI_CONFIGURE, 0))
|
||||
if (exclusive_input_pressed(ev.iptkey, IPT_UI_FOCUS_NEXT, 0) || exclusive_input_pressed(ev.iptkey, IPT_UI_FOCUS_PREV, 0))
|
||||
{
|
||||
ev.iptkey = IPT_UI_CONFIGURE;
|
||||
stop = true;
|
||||
}
|
||||
else if (m_ui_error)
|
||||
|
@ -123,7 +123,6 @@ protected:
|
||||
virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override;
|
||||
|
||||
// handlers
|
||||
void inkey_navigation();
|
||||
virtual void inkey_export() = 0;
|
||||
void inkey_dats();
|
||||
|
||||
@ -250,6 +249,7 @@ private:
|
||||
}
|
||||
}
|
||||
}
|
||||
void rotate_focus(int dir);
|
||||
|
||||
void draw_toolbar(float x1, float y1, float x2, float y2);
|
||||
void draw_star(float x0, float y0);
|
||||
|
@ -203,10 +203,6 @@ void menu_select_software::handle()
|
||||
m_filter_highlight = software_filter::LAST;
|
||||
break;
|
||||
|
||||
case IPT_UI_CONFIGURE:
|
||||
inkey_navigation();
|
||||
break;
|
||||
|
||||
case IPT_UI_DATS:
|
||||
inkey_dats();
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user