mirror of https://github.com/PCSX2/pcsx2.git
Merge pull request #574 from AdmiralCurtiss/gui-hotkeys-in-menu
Show default keyboard shortcuts in the menu next to Save and Load State.
This commit is contained in:
commit
868d82a22b
|
@ -24,6 +24,9 @@
|
|||
|
||||
#include <wx/iconbndl.h>
|
||||
|
||||
#include <unordered_map>
|
||||
#include "AppAccelerators.h"
|
||||
|
||||
#include "svnrev.h"
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
@ -530,6 +533,7 @@ MainEmuFrame::MainEmuFrame(wxWindow* parent, const wxString& title)
|
|||
|
||||
ApplyCoreStatus();
|
||||
ApplySettings();
|
||||
AppendKeycodeNamesToMenuOptions();
|
||||
}
|
||||
|
||||
MainEmuFrame::~MainEmuFrame() throw()
|
||||
|
@ -696,6 +700,24 @@ void MainEmuFrame::CommitPreset_noTrigger()
|
|||
g_Conf->EmuOptions.EnablePatches = menubar.IsChecked( MenuId_EnablePatches );
|
||||
}
|
||||
|
||||
static void AppendShortcutToMenuOption( wxMenuItem& item, const char* id ) {
|
||||
// this is NOT how a dictionary works but it has like 30 entries so this should still perform okay
|
||||
auto* dict = &wxGetApp().GlobalAccels;
|
||||
for ( auto it = ( *dict )->begin(); it != ( *dict )->end(); ++it ) {
|
||||
if ( strcmp( it->second->Id, id ) == 0 ) {
|
||||
wxString text = item.GetItemLabel();
|
||||
size_t tabPos = text.rfind( L'\t' );
|
||||
KeyAcceleratorCode keycode( (wxKeyCode)it->first );
|
||||
item.SetItemLabel( text.Mid( 0, tabPos ) + L"\t" + keycode.ToString() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MainEmuFrame::AppendKeycodeNamesToMenuOptions() {
|
||||
AppendShortcutToMenuOption( *m_menuSys.FindChildItem( MenuId_Sys_LoadStates ), "States_DefrostCurrentSlot" );
|
||||
AppendShortcutToMenuOption( *m_menuSys.FindChildItem( MenuId_Sys_SaveStates ), "States_FreezeCurrentSlot" );
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// "Extensible" Plugin Menus
|
||||
|
|
|
@ -150,6 +150,7 @@ public:
|
|||
|
||||
void ApplyConfigToGui( AppConfig& configToApply, int flags=0 ); //flags are: AppConfig::APPLY_CONFIG_FROM_PRESET and (currently unused) AppConfig::APPLY_CONFIG_MANUALLY PROPAGATE
|
||||
void CommitPreset_noTrigger();
|
||||
void AppendKeycodeNamesToMenuOptions();
|
||||
|
||||
protected:
|
||||
void DoGiveHelp(const wxString& text, bool show);
|
||||
|
|
Loading…
Reference in New Issue