mirror of
https://github.com/holub/mame
synced 2025-04-23 08:49:55 +03:00
ScrLock no longer is a menu key; it will now enable/disable keyboard menu shortcuts
This commit is contained in:
parent
faf4172fc5
commit
f546afadef
@ -711,7 +711,7 @@ void construct_core_types_keypad(simple_list<input_type_entry> &typelist)
|
||||
|
||||
void construct_core_types_ui_general(simple_list<input_type_entry> &typelist)
|
||||
{
|
||||
INPUT_PORT_DIGITAL_TYPE( 0, UI_GENERAL, UI_CONFIGURE, "Config Menu", input_seq(KEYCODE_TAB, input_seq::or_code, KEYCODE_SCRLOCK) )
|
||||
INPUT_PORT_DIGITAL_TYPE( 0, UI_GENERAL, UI_CONFIGURE, "Config Menu", input_seq(KEYCODE_TAB) )
|
||||
INPUT_PORT_DIGITAL_TYPE( 0, UI_GENERAL, UI_UP, "UI Up", input_seq(KEYCODE_UP, input_seq::or_code, JOYCODE_Y_UP_SWITCH_INDEXED(0)) )
|
||||
INPUT_PORT_DIGITAL_TYPE( 0, UI_GENERAL, UI_DOWN, "UI Down", input_seq(KEYCODE_DOWN, input_seq::or_code, JOYCODE_Y_DOWN_SWITCH_INDEXED(0)) )
|
||||
INPUT_PORT_DIGITAL_TYPE( 0, UI_GENERAL, UI_LEFT, "UI Left", input_seq(KEYCODE_LEFT, input_seq::or_code, JOYCODE_X_LEFT_SWITCH_INDEXED(0)) )
|
||||
@ -754,6 +754,7 @@ void construct_core_types_ui_shortcuts(simple_list<input_type_entry> &typelist)
|
||||
INPUT_PORT_DIGITAL_TYPE( 0, UI_SHORTCUT, UI_TOGGLE_DEBUG, "Toggle Debugger", input_seq(KEYCODE_F5) )
|
||||
INPUT_PORT_DIGITAL_TYPE( 0, UI_SHORTCUT, UI_SAVE_STATE, "Save State", input_seq(KEYCODE_F7, KEYCODE_LSHIFT) )
|
||||
INPUT_PORT_DIGITAL_TYPE( 0, UI_SHORTCUT, UI_LOAD_STATE, "Load State", input_seq(KEYCODE_F7, input_seq::not_code, KEYCODE_LSHIFT) )
|
||||
INPUT_PORT_DIGITAL_TYPE( 0, UI_SHORTCUT, UI_SHORTCUTS_ENABLED,"Enable Shortcuts", input_seq(KEYCODE_SCRLOCK) )
|
||||
}
|
||||
|
||||
void construct_core_types_OSD(simple_list<input_type_entry> &typelist)
|
||||
|
@ -123,6 +123,7 @@
|
||||
const int SPACE_COUNT = 3;
|
||||
const int KEY_BUFFER_SIZE = 4096;
|
||||
const unicode_char INVALID_CHAR = '?';
|
||||
const bool KEYBOARD_TRUMPS_UI_SHORTCUTS = false;
|
||||
|
||||
|
||||
|
||||
@ -2478,7 +2479,7 @@ time_t ioport_manager::initialize()
|
||||
}
|
||||
|
||||
// do we have a keyboard? if so, we may need to change default UI keys in response
|
||||
if (has_keyboard())
|
||||
if (KEYBOARD_TRUMPS_UI_SHORTCUTS && has_keyboard())
|
||||
adjust_ui_seqs_for_keyboard();
|
||||
|
||||
// renumber player numbers for controller ports
|
||||
|
@ -369,13 +369,13 @@ enum ioport_type
|
||||
IPT_UI_PASTE,
|
||||
IPT_UI_SAVE_STATE,
|
||||
IPT_UI_LOAD_STATE,
|
||||
IPT_UI_SHORTCUTS_ENABLED,
|
||||
|
||||
// dummy slots that will likely be filled soon (putting these in as a temporary convenience)
|
||||
IPT_UI_DUMMY1,
|
||||
IPT_UI_DUMMY2,
|
||||
IPT_UI_DUMMY3,
|
||||
IPT_UI_DUMMY4,
|
||||
IPT_UI_DUMMY5,
|
||||
|
||||
// additional OSD-specified UI port types (up to 16)
|
||||
IPT_OSD_1,
|
||||
|
@ -418,6 +418,10 @@ void ui_emu_menubar::build_options_menu()
|
||||
if (machine().config().m_memcard_handler != NULL)
|
||||
options_menu.append<ui_emu_menubar>("Memory Card...", &ui_emu_menubar::start_menu<ui_menu_memory_card>, *this);
|
||||
|
||||
// shortcuts enabled
|
||||
menu_item &shortcuts_enabled_item = options_menu.append<ui_manager>("Menu Shorcuts Enabled", &ui_manager::set_shortcuts_enabled, &ui_manager::shortcuts_enabled, machine().ui(), IPT_UI_SHORTCUTS_ENABLED);
|
||||
shortcuts_enabled_item.set_shortcut_always_enabled(true);
|
||||
|
||||
// cheat
|
||||
if (machine().options().cheat() && machine().cheat().first() != NULL)
|
||||
{
|
||||
|
@ -309,7 +309,7 @@ bool ui_menubar::poll_navigation_keys()
|
||||
result = walk_selection_previous_sub_menu();
|
||||
else if (input_pressed_safe(code_next_sub_menu))
|
||||
result = walk_selection_next_sub_menu();
|
||||
else if (input_pressed_safe(IPT_UI_CONFIGURE))
|
||||
else if (machine().ui().shortcuts_enabled() && input_pressed_safe(IPT_UI_CONFIGURE))
|
||||
toggle_selection();
|
||||
else if (input_pressed_safe(code_selected))
|
||||
invoke(m_selected_item);
|
||||
@ -333,14 +333,19 @@ bool ui_menubar::poll_shortcut_keys(bool swallow)
|
||||
// loop through all shortcut items
|
||||
for (menu_item *item = m_shortcuted_menu_items; item != NULL; item = item->next_with_shortcut())
|
||||
{
|
||||
// sanity check
|
||||
assert(item->is_invokable());
|
||||
|
||||
// did we press this shortcut?
|
||||
if (input_pressed_safe(item->shortcut()) && !swallow)
|
||||
// should we check the shortcut?
|
||||
if (machine().ui().shortcuts_enabled() || item->is_shortcut_always_enabled())
|
||||
{
|
||||
// this shortcut was pressed and we're not swallowing them; invoke it
|
||||
invoke(item);
|
||||
return true;
|
||||
// did we press this shortcut?
|
||||
if (input_pressed_safe(item->shortcut()) && !swallow)
|
||||
{
|
||||
// this shortcut was pressed and we're not swallowing them; invoke it
|
||||
invoke(item);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
@ -831,6 +836,7 @@ ui_menubar::menu_item::menu_item(ui_menubar &menubar, const char *text, ui_menub
|
||||
m_is_checked = false;
|
||||
m_is_enabled = true;
|
||||
m_is_separator = false;
|
||||
m_is_shortcut_always_enabled = false;
|
||||
m_shortcut = shortcut;
|
||||
m_shortcut_text_width = -1;
|
||||
clear_area();
|
||||
|
@ -89,6 +89,7 @@ public:
|
||||
bool is_enabled() const { return m_is_enabled; }
|
||||
bool is_separator() const { return m_is_separator; }
|
||||
bool has_children() const { return m_first_child ? true : false; }
|
||||
bool is_shortcut_always_enabled() const { return m_is_shortcut_always_enabled; }
|
||||
int shortcut() const { return m_shortcut; }
|
||||
const astring &text() const { return m_text; }
|
||||
menu_item *parent() { return m_parent; }
|
||||
@ -106,6 +107,7 @@ public:
|
||||
void set_enabled(bool enabled) { m_is_enabled = enabled; }
|
||||
void set_text(const char *text) { m_text.cpy(text); }
|
||||
void set_next_with_shortcut(menu_item *item) { m_next_with_shortcut = item; }
|
||||
void set_shortcut_always_enabled(bool shortcut_always_enabled) { m_is_shortcut_always_enabled = shortcut_always_enabled; }
|
||||
|
||||
private:
|
||||
// private variables
|
||||
@ -118,6 +120,7 @@ public:
|
||||
bool m_is_checked;
|
||||
bool m_is_enabled;
|
||||
bool m_is_separator;
|
||||
bool m_is_shortcut_always_enabled;
|
||||
menu_item * m_parent;
|
||||
menu_item * m_first_child;
|
||||
menu_item * m_last_child;
|
||||
@ -227,6 +230,7 @@ private:
|
||||
osd_ticks_t m_last_mouse_move;
|
||||
menubar_visibility_t m_menubar_visibility;
|
||||
bool m_first_time;
|
||||
bool m_shortcuts_enabled;
|
||||
|
||||
// selection walking
|
||||
bool walk_selection_previous();
|
||||
|
@ -224,6 +224,7 @@ ui_manager::ui_manager(running_machine &machine)
|
||||
m_popup_text_end = 0;
|
||||
m_use_natural_keyboard = false;
|
||||
m_mouse_arrow_texture = NULL;
|
||||
m_shortcuts_enabled = true;
|
||||
|
||||
// more initialization
|
||||
set_handler(handler_messagebox, 0);
|
||||
@ -939,6 +940,17 @@ void ui_manager::show_mouse(bool status)
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// set_shortcuts_enabled
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_manager::set_shortcuts_enabled(bool shortcuts_enabled)
|
||||
{
|
||||
m_shortcuts_enabled = shortcuts_enabled;
|
||||
popmessage("Menu shortcuts %s", shortcuts_enabled ? "enabled" : "disabled");
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// is_menu_active - return true if the menu
|
||||
// UI handler is active
|
||||
|
@ -171,6 +171,8 @@ public:
|
||||
void decrease_frameskip();
|
||||
void request_quit();
|
||||
void do_single_step();
|
||||
bool shortcuts_enabled() const { return m_shortcuts_enabled; }
|
||||
void set_shortcuts_enabled(bool shortcuts_enabled);
|
||||
|
||||
// UI handlers
|
||||
static UINT32 ui_handler_load_save(running_machine &machine, render_container *container, UINT32 state);
|
||||
@ -201,6 +203,7 @@ private:
|
||||
render_texture * m_mouse_arrow_texture;
|
||||
bool m_mouse_show;
|
||||
ui_menubar * m_menubar;
|
||||
bool m_shortcuts_enabled;
|
||||
|
||||
// text generators
|
||||
astring &disclaimer_string(astring &buffer);
|
||||
|
@ -738,7 +738,7 @@ void windows_osd_interface::customize_input_type_list(simple_list<input_type_ent
|
||||
// disable the config menu if the ALT key is down
|
||||
// (allows ALT-TAB to switch between windows apps)
|
||||
case IPT_UI_CONFIGURE:
|
||||
entry->defseq(SEQ_TYPE_STANDARD).set(KEYCODE_TAB, input_seq::not_code, KEYCODE_LALT, input_seq::not_code, KEYCODE_RALT, input_seq::or_code, KEYCODE_SCRLOCK);
|
||||
entry->defseq(SEQ_TYPE_STANDARD).set(KEYCODE_TAB, input_seq::not_code, KEYCODE_LALT, input_seq::not_code, KEYCODE_RALT);
|
||||
break;
|
||||
|
||||
// alt-enter for fullscreen
|
||||
|
Loading…
Reference in New Issue
Block a user