Reload short cuts on change
This commit is contained in:
parent
11813ff5f2
commit
d4ec1f7f37
|
@ -17,7 +17,6 @@ CMainMenu::CMainMenu(CMainGui * hMainWindow) :
|
|||
|
||||
hMainWindow->SetWindowMenu(this);
|
||||
|
||||
m_ChangeUISettingList.push_back(Info_ShortCutsChanged);
|
||||
m_ChangeSettingList.push_back(GameRunning_LimitFPS);
|
||||
m_ChangeUISettingList.push_back(UserInterface_InFullScreen);
|
||||
m_ChangeUISettingList.push_back(UserInterface_AlwaysOnTop);
|
||||
|
@ -63,10 +62,13 @@ CMainMenu::CMainMenu(CMainGui * hMainWindow) :
|
|||
{
|
||||
g_Settings->RegisterChangeCB(*iter, this, (CSettings::SettingChangedFunc)SettingsChanged);
|
||||
}
|
||||
|
||||
g_Settings->RegisterChangeCB((SettingID)Info_ShortCutsChanged, this, (CSettings::SettingChangedFunc)stShortCutsChanged);
|
||||
}
|
||||
|
||||
CMainMenu::~CMainMenu()
|
||||
{
|
||||
g_Settings->UnregisterChangeCB((SettingID)Info_ShortCutsChanged, this, (CSettings::SettingChangedFunc)stShortCutsChanged);
|
||||
for (UISettingList::const_iterator iter = m_ChangeUISettingList.begin(); iter != m_ChangeUISettingList.end(); iter++)
|
||||
{
|
||||
g_Settings->UnregisterChangeCB((SettingID)*iter, this, (CSettings::SettingChangedFunc)SettingsChanged);
|
||||
|
@ -132,6 +134,13 @@ void CMainMenu::SetTraceModuleSetttings(SettingID Type)
|
|||
g_Settings->SaveDword(Type, value);
|
||||
}
|
||||
|
||||
void CMainMenu::ShortCutsChanged(void)
|
||||
{
|
||||
m_ShortCuts.Load();
|
||||
ResetMenu();
|
||||
m_ResetAccelerators = true;
|
||||
}
|
||||
|
||||
void CMainMenu::OnOpenRom(HWND hWnd)
|
||||
{
|
||||
std::string File = ChooseFileToOpen(hWnd);
|
||||
|
|
|
@ -64,10 +64,10 @@ public:
|
|||
CMainMenu(CMainGui * Window);
|
||||
~CMainMenu();
|
||||
|
||||
int ProcessAccelerator(HWND hWnd, void * lpMsg);
|
||||
bool ProcessMessage(HWND hWnd, DWORD wNotifyCode, DWORD wID);
|
||||
void ResetMenu(void);
|
||||
void ResetAccelerators(void) { m_ResetAccelerators = true; }
|
||||
int ProcessAccelerator(HWND hWnd, void * lpMsg);
|
||||
bool ProcessMessage(HWND hWnd, DWORD wNotifyCode, DWORD wID);
|
||||
void ResetMenu(void);
|
||||
void ResetAccelerators(void) { m_ResetAccelerators = true; }
|
||||
|
||||
private:
|
||||
CMainMenu();
|
||||
|
@ -94,8 +94,10 @@ private:
|
|||
std::string ChooseROMFileToOpen(HWND hParent);
|
||||
std::string ChooseDiskFileToOpen(HWND hParent);
|
||||
void SetTraceModuleSetttings(SettingID Type);
|
||||
void ShortCutsChanged(void);
|
||||
|
||||
static void SettingsChanged(CMainMenu * _this);
|
||||
static void stShortCutsChanged(CMainMenu * _this) { return _this->ShortCutsChanged(); }
|
||||
|
||||
typedef std::list<SettingID> SettingList;
|
||||
typedef std::list<UISettingID> UISettingList;
|
||||
|
|
|
@ -288,7 +288,7 @@ void CShortCutItem::RemoveItem(CMenuShortCutKey * ShortCut)
|
|||
}
|
||||
}
|
||||
|
||||
bool CShortCutItem::Avaliable(CMenuShortCutKey::RUNNING_STATE RunningState)
|
||||
bool CShortCutItem::Avaliable(CMenuShortCutKey::RUNNING_STATE RunningState) const
|
||||
{
|
||||
switch (RunningState)
|
||||
{
|
||||
|
|
|
@ -80,7 +80,7 @@ public:
|
|||
void Reset(LanguageStringID Section, LanguageStringID Title, ACCESS_MODE Access);
|
||||
void AddShortCut(WORD key, bool bCtrl, bool bAlt, bool bShift, ACCESS_MODE AccessMode, bool bUserAdded = false, bool bInactive = false);
|
||||
void RemoveItem(CMenuShortCutKey * ShortCut);
|
||||
bool Avaliable(RUNNING_STATE RunningState);
|
||||
bool Avaliable(RUNNING_STATE RunningState) const;
|
||||
|
||||
inline const SHORTCUT_KEY_LIST & GetAccelItems(void) const { return m_AccelList; }
|
||||
inline LanguageStringID Section(void) const { return m_Section; }
|
||||
|
@ -96,12 +96,6 @@ class CShortCuts
|
|||
typedef CMenuShortCutKey::ACCESS_MODE ACCESS_MODE;
|
||||
typedef CMenuShortCutKey::RUNNING_STATE RUNNING_STATE;
|
||||
typedef LanguageStringID LangStr;
|
||||
|
||||
MSC_MAP m_ShortCuts;
|
||||
CriticalSection m_CS;
|
||||
|
||||
void AddShortCut(WORD ID, LangStr Section, LangStr LangID, CMenuShortCutKey::ACCESS_MODE AccessMode);
|
||||
|
||||
public:
|
||||
CShortCuts(void);
|
||||
~CShortCuts(void);
|
||||
|
@ -109,8 +103,14 @@ public:
|
|||
std::wstring ShortCutString(int MenuID, RUNNING_STATE RunningState);
|
||||
LangStr GetMenuItemName(WORD key, bool bCtrl, bool bAlt, bool bShift, RUNNING_STATE RunningState);
|
||||
HACCEL GetAcceleratorTable(void);
|
||||
MSC_MAP & GetShortCuts(void) { return m_ShortCuts; }
|
||||
const MSC_MAP & GetShortCuts(void) const { return m_ShortCuts; }
|
||||
|
||||
void Load(bool InitialValues = false);
|
||||
void Save(void);
|
||||
|
||||
private:
|
||||
CriticalSection m_CS;
|
||||
MSC_MAP m_ShortCuts;
|
||||
|
||||
void AddShortCut(WORD ID, LangStr Section, LangStr LangID, CMenuShortCutKey::ACCESS_MODE AccessMode);
|
||||
};
|
||||
|
|
|
@ -45,8 +45,8 @@ COptionsShortCutsPage::COptionsShortCutsPage(HWND hParent, const RECT & rcDispay
|
|||
|
||||
void COptionsShortCutsPage::CheckResetEnable(void)
|
||||
{
|
||||
MSC_MAP & ShortCuts = m_ShortCuts.GetShortCuts();
|
||||
for (MSC_MAP::iterator Item = ShortCuts.begin(); Item != ShortCuts.end(); Item++)
|
||||
const MSC_MAP & ShortCuts = m_ShortCuts.GetShortCuts();
|
||||
for (MSC_MAP::const_iterator Item = ShortCuts.begin(); Item != ShortCuts.end(); Item++)
|
||||
{
|
||||
const SHORTCUT_KEY_LIST & ShortCutList = Item->second.GetAccelItems();
|
||||
for (SHORTCUT_KEY_LIST::const_iterator ShortCut_item = ShortCutList.begin(); ShortCut_item != ShortCutList.end(); ShortCut_item++)
|
||||
|
@ -66,10 +66,10 @@ void COptionsShortCutsPage::OnCpuStateChanged(UINT /*Code*/, int /*id*/, HWND /*
|
|||
{
|
||||
RUNNING_STATE RunningState = (RUNNING_STATE)m_CpuState.GetItemData(m_CpuState.GetCurSel());
|
||||
|
||||
MSC_MAP & ShortCuts = m_ShortCuts.GetShortCuts();
|
||||
const MSC_MAP & ShortCuts = m_ShortCuts.GetShortCuts();
|
||||
m_MenuItems.DeleteAllItems();
|
||||
|
||||
for (MSC_MAP::iterator Item = ShortCuts.begin(); Item != ShortCuts.end(); Item++)
|
||||
for (MSC_MAP::const_iterator Item = ShortCuts.begin(); Item != ShortCuts.end(); Item++)
|
||||
{
|
||||
if (!Item->second.Avaliable(RunningState))
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue