2012-12-19 09:30:18 +00:00
|
|
|
/****************************************************************************
|
|
|
|
* *
|
|
|
|
* Project 64 - A Nintendo 64 emulator. *
|
|
|
|
* http://www.pj64-emu.com/ *
|
|
|
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
|
|
|
* *
|
|
|
|
* License: *
|
|
|
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
|
|
|
* *
|
|
|
|
****************************************************************************/
|
2008-11-14 20:51:06 +00:00
|
|
|
#pragma once
|
|
|
|
|
2015-05-04 00:08:53 +00:00
|
|
|
struct VIRTUAL_KEY {
|
|
|
|
LPCSTR Name;
|
|
|
|
int Key;
|
|
|
|
LPCSTR KeyName;
|
|
|
|
};
|
2008-11-14 20:51:06 +00:00
|
|
|
|
|
|
|
class CMenuShortCutKey {
|
|
|
|
public:
|
|
|
|
enum ACCESS_MODE {
|
|
|
|
NONE = 0,
|
|
|
|
GAME_NOT_RUNNING = 1,
|
|
|
|
GAME_RUNNING_WINDOW = 2,
|
|
|
|
NOT_IN_FULLSCREEN = 3,
|
|
|
|
GAME_RUNNING_FULLSCREEN = 4,
|
|
|
|
GAME_RUNNING = 6,
|
|
|
|
ANYTIME = 7,
|
|
|
|
} ;
|
|
|
|
|
|
|
|
private:
|
|
|
|
static VIRTUAL_KEY m_VirtualKeyList[];
|
|
|
|
|
|
|
|
stdstr m_ShortCutName;
|
|
|
|
WORD m_key;
|
|
|
|
bool m_bCtrl;
|
|
|
|
bool m_bAlt;
|
|
|
|
bool m_bShift;
|
|
|
|
ACCESS_MODE m_AccessMode;
|
|
|
|
bool m_bUserAdded;
|
|
|
|
bool m_bInactive;
|
|
|
|
|
|
|
|
public:
|
|
|
|
CMenuShortCutKey(void);
|
|
|
|
CMenuShortCutKey(WORD key, bool bCtrl, bool bAlt, bool bShift, ACCESS_MODE AccessMode, bool bUserAdded, bool bInactive );
|
|
|
|
bool Same (WORD key, bool bCtrl, bool bAlt, bool bShift, ACCESS_MODE AccessMode ) const;
|
|
|
|
|
|
|
|
static VIRTUAL_KEY * VirtualKeyList(int &Size);
|
|
|
|
|
|
|
|
inline stdstr Name ( void ) const { return m_ShortCutName; }
|
|
|
|
inline WORD Key ( void ) const { return m_key; }
|
|
|
|
inline bool Ctrl ( void ) const { return m_bCtrl; }
|
|
|
|
inline bool Alt ( void ) const { return m_bAlt; }
|
|
|
|
inline bool Shift ( void ) const { return m_bShift; }
|
|
|
|
inline bool UserAdded ( void ) const { return m_bUserAdded; }
|
|
|
|
inline bool Inactive ( void ) const { return m_bInactive; }
|
|
|
|
inline ACCESS_MODE AccessMode ( void ) const { return m_AccessMode; }
|
|
|
|
|
|
|
|
inline void SetInactive ( bool Inactive ) { m_bInactive = Inactive; }
|
|
|
|
};
|
|
|
|
|
|
|
|
class CShortCutItem
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
typedef std::list<CMenuShortCutKey> SHORTCUT_KEY_LIST;
|
|
|
|
|
|
|
|
private:
|
|
|
|
typedef CMenuShortCutKey::ACCESS_MODE ACCESS_MODE;
|
|
|
|
|
|
|
|
ACCESS_MODE m_Access;
|
|
|
|
LanguageStringID m_Section;
|
|
|
|
LanguageStringID m_Title;
|
|
|
|
SHORTCUT_KEY_LIST m_AccelList;
|
|
|
|
|
|
|
|
public:
|
|
|
|
CShortCutItem(LanguageStringID Section, LanguageStringID Title, ACCESS_MODE Access);
|
|
|
|
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 );
|
|
|
|
|
|
|
|
inline const SHORTCUT_KEY_LIST & GetAccelItems ( void ) const { return m_AccelList; }
|
|
|
|
inline LanguageStringID Section ( void ) const { return m_Section; }
|
|
|
|
inline LanguageStringID Title ( void ) const { return m_Title; }
|
|
|
|
inline ACCESS_MODE AccessMode ( void ) const { return m_Access; }
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef std::map<int,CShortCutItem> MSC_MAP;
|
|
|
|
|
|
|
|
class CShortCuts
|
|
|
|
{
|
|
|
|
typedef CShortCutItem::SHORTCUT_KEY_LIST SHORTCUT_KEY_LIST;
|
|
|
|
typedef CMenuShortCutKey::ACCESS_MODE ACCESS_MODE;
|
|
|
|
typedef LanguageStringID LangStr;
|
|
|
|
|
|
|
|
MSC_MAP m_ShortCuts;
|
2008-11-27 14:34:13 +00:00
|
|
|
CriticalSection m_CS;
|
2008-11-14 20:51:06 +00:00
|
|
|
|
|
|
|
void AddShortCut ( WORD ID, LangStr Section, LangStr LangID, CMenuShortCutKey::ACCESS_MODE AccessMode);
|
|
|
|
|
|
|
|
public:
|
|
|
|
CShortCuts ( void );
|
|
|
|
~CShortCuts ( void );
|
|
|
|
|
2015-03-04 09:36:08 +00:00
|
|
|
std::wstring ShortCutString ( int MenuID, ACCESS_MODE AccessLevel );
|
|
|
|
LangStr GetMenuItemName ( WORD key, bool bCtrl, bool bAlt, bool bShift, ACCESS_MODE Access );
|
|
|
|
HACCEL GetAcceleratorTable ( void );
|
|
|
|
MSC_MAP & GetShortCuts ( void ) { return m_ShortCuts; }
|
2008-11-14 20:51:06 +00:00
|
|
|
|
|
|
|
void Load ( bool InitialValues = false );
|
|
|
|
void Save ( void );
|
|
|
|
};
|