return m_strApplicationName;\r
}\r
\r
-void CData::SetCommandID(int nCommandType, int nKey, int nCommandID)\r
+void CData::SetCommandID(int nType, int nKey, int nComID)\r
{\r
- ASSERT(nCommandType >= 0 || nCommandType < MAX_COMMAND_TYPE);\r
+ ASSERT(nType >= 0 || nType < MAX_COMMAND_TYPE);\r
ASSERT(nKey <= 0 || nKey < MAX_KEY);\r
- m_nCommandID[nCommandType][nKey] = nCommandID;\r
+ m_nCommandID[nType][nKey] = nComID;\r
}\r
\r
-int CData::GetCommandID(int nCommandType, int nKey)\r
+int CData::GetCommandID(int nType, int nKey)\r
{\r
- ASSERT(nCommandType >= 0 || nCommandType < MAX_COMMAND_TYPE);\r
+ ASSERT(nType >= 0 || nType < MAX_COMMAND_TYPE);\r
ASSERT(nKey <= 0 || nKey < MAX_KEY);\r
- return m_nCommandID[nCommandType][nKey];\r
+ return m_nCommandID[nType][nKey];\r
}\r
\r
void CData::ClearAll()\r
int GetKillRingMax();\r
CString GetApplicationTitle();\r
void SetApplicationTitle(LPCTSTR lpszApplicationTitle);\r
- int GetCommandID(int nCommandType, int nKey);\r
- void SetCommandID(int nCommandType, int nKey, int nCommandID);\r
+ int GetCommandID(int nType, int nKey);\r
+ void SetCommandID(int nType, int nKey, int nComID);\r
CString GetApplicationName();\r
void SetApplicationName(LPCTSTR lpszApplicationName);\r
CData();\r
return CString(_T("Undefined Command"));\r
}\r
\r
-void CDotXkeymacs::ClearKey(int nIndex, int nApplicationID)\r
+void CDotXkeymacs::ClearKey(int nIndex, int nAppID)\r
{\r
if (nIndex < 0 || m_oFunctionDefinition.GetCount() <= nIndex) {\r
return;\r
}\r
\r
if (CFunctionDefinition *pFunctionDefinition = (CFunctionDefinition *)m_oFunctionDefinition.GetAt(m_oFunctionDefinition.FindIndex(nIndex))) {\r
- pFunctionDefinition->ClearKey(nApplicationID);\r
+ pFunctionDefinition->ClearKey(nAppID);\r
}\r
\r
- for (int nCommandType = 0; nCommandType < MAX_COMMAND_TYPE; ++nCommandType) {\r
+ for (int nType = 0; nType < MAX_COMMAND_TYPE; ++nType) {\r
for (int nKey = 0; nKey < MAX_KEY; ++nKey) {\r
- if (m_nIndex[nApplicationID][nCommandType][nKey] == nIndex) {\r
- m_nIndex[nApplicationID][nCommandType][nKey] = -1;\r
+ if (m_nIndex[nAppID][nType][nKey] == nIndex) {\r
+ m_nIndex[nAppID][nType][nKey] = -1;\r
}\r
}\r
}\r
}\r
\r
-void CDotXkeymacs::SetKey(int nIndex, int nApplicationID, int nCommandType, int nKey)\r
+void CDotXkeymacs::SetKey(int nIndex, int nAppID, int nType, int nKey)\r
{\r
if (nIndex < 0 || m_oFunctionDefinition.GetCount() <= nIndex) {\r
return;\r
}\r
\r
if (CFunctionDefinition *pFunctionDefinition = (CFunctionDefinition *)m_oFunctionDefinition.GetAt(m_oFunctionDefinition.FindIndex(nIndex))) {\r
- pFunctionDefinition->SetKey(nApplicationID, nCommandType, nKey);\r
- m_nIndex[nApplicationID][nCommandType][nKey] = nIndex;\r
+ pFunctionDefinition->SetKey(nAppID, nType, nKey);\r
+ m_nIndex[nAppID][nType][nKey] = nIndex;\r
}\r
}\r
\r
return -1;\r
}\r
\r
-int CDotXkeymacs::GetKeyNumber(int nIndex, int nApplicationID)\r
+int CDotXkeymacs::GetKeyNumber(int nIndex, int nAppID)\r
{\r
if (nIndex < 0 || m_oFunctionDefinition.GetCount() <= nIndex) {\r
return 0;\r
}\r
\r
CFunctionDefinition *pFunctionDefinition = (CFunctionDefinition *)m_oFunctionDefinition.GetAt(m_oFunctionDefinition.FindIndex(nIndex));\r
- return pFunctionDefinition->GetKeyNumber(nApplicationID);\r
+ return pFunctionDefinition->GetKeyNumber(nAppID);\r
}\r
\r
-void CDotXkeymacs::GetKey(int nIndex, int nApplicationID, int nKeyID, int *pCommandType, int *pKey)\r
+void CDotXkeymacs::GetKey(int nIndex, int nAppID, int nKeyID, int *pCommandType, int *pKey)\r
{\r
if (nIndex < 0 || m_oFunctionDefinition.GetCount() <= nIndex) {\r
return;\r
}\r
\r
CFunctionDefinition *pFunctionDefinition = (CFunctionDefinition *)m_oFunctionDefinition.GetAt(m_oFunctionDefinition.FindIndex(nIndex));\r
- pFunctionDefinition->GetKey(nApplicationID, nKeyID, pCommandType, pKey);\r
+ pFunctionDefinition->GetKey(nAppID, nKeyID, pCommandType, pKey);\r
}\r
\r
-int CDotXkeymacs::GetIndex(int nApplicationID, int nCommandType, int nKey)\r
+int CDotXkeymacs::GetIndex(int nAppID, int nType, int nKey)\r
{\r
- return m_nIndex[nApplicationID][nCommandType][nKey];\r
+ return m_nIndex[nAppID][nType][nKey];\r
}\r
\r
-void CDotXkeymacs::RemoveKey(const int nIndex, const int nApplicationID, const int nCommandType, const int nKey)\r
+void CDotXkeymacs::RemoveKey(const int nIndex, const int nAppID, const int nType, const int nKey)\r
{\r
if (nIndex < 0 || m_oFunctionDefinition.GetCount() <= nIndex) {\r
return;\r
\r
CFunctionDefinition *pFunctionDefinition = (CFunctionDefinition *)m_oFunctionDefinition.GetAt(m_oFunctionDefinition.FindIndex(nIndex));\r
if (pFunctionDefinition) {\r
- pFunctionDefinition->RemoveKey(nApplicationID, nCommandType, nKey);\r
+ pFunctionDefinition->RemoveKey(nAppID, nType, nKey);\r
}\r
}\r
\r
-void CDotXkeymacs::RemoveKey(const int nApplicationID, const int nCommandType, const int nKey)\r
+void CDotXkeymacs::RemoveKey(const int nAppID, const int nType, const int nKey)\r
{\r
for (int nIndex = 0; nIndex < m_oFunctionDefinition.GetCount(); ++nIndex) {\r
- RemoveKey(nIndex, nApplicationID, nCommandType, nKey);\r
+ RemoveKey(nIndex, nAppID, nType, nKey);\r
}\r
}\r
\r
class CDotXkeymacs \r
{\r
public:\r
- static void RemoveKey(const int nApplicationID, const int nCommandType, const int nKey);\r
- static void RemoveKey(const int nIndex, const int nApplicationID, const int nCommandType, const int nKey);\r
+ static void RemoveKey(const int nAppID, const int nType, const int nKey);\r
+ static void RemoveKey(const int nIndex, const int nAppID, const int nType, const int nKey);\r
static CString GetFunctionDefinition(int nIndex);\r
- static int GetIndex(int nApplicationID, int nCommandType, int nKey);\r
- static void GetKey(int nIndex, int nApplicationID, int nKeyID, int *pCommandType, int *pKey);\r
- static int GetKeyNumber(int nIndex, int nApplicationID);\r
+ static int GetIndex(int nAppID, int nType, int nKey);\r
+ static void GetKey(int nIndex, int nAppID, int nKeyID, int *pCommandType, int *pKey);\r
+ static int GetKeyNumber(int nIndex, int nAppID);\r
static int GetIndex(CString szSymbol);\r
- static void SetKey(int nIndex, int nApplicationID, int nCommandType, int nKey);\r
- static void ClearKey(int nIndex, int nApplicationID);\r
+ static void SetKey(int nIndex, int nAppID, int nType, int nKey);\r
+ static void ClearKey(int nIndex, int nAppID);\r
static CString GetFunctionDefinition(CString szSymbol);\r
static CString GetFunctionSymbol(int nIndex);\r
static int GetFunctionNumber();\r
\r
struct CommandTypeName\r
{\r
- int nCommandType;\r
- LPCTSTR szCommandTypeName;\r
+ int nType;\r
+ LPCTSTR szName;\r
};\r
\r
static const CommandTypeName CommandTypes[] = {\r
\r
CString regApp(MAKEINTRESOURCE(IDS_REGSUBKEY_DATA));\r
regApp += _T("\\") + appName;\r
- for (int nCommandID = 1; nCommandID < MAX_COMMAND; nCommandID++) {\r
- entry = CCommands::GetCommandName(nCommandID);\r
+ for (int nComID = 1; nComID < MAX_COMMAND; nComID++) {\r
+ entry = CCommands::GetCommandName(nComID);\r
HKEY hKey;\r
const CString& regKey = regApp + _T("\\") + entry;\r
if (RegOpenKeyEx(HKEY_CURRENT_USER, regKey, 0, KEY_READ, &hKey) == ERROR_SUCCESS) {\r
TCHAR szKeyBind[128];\r
DWORD dwKeyBind = _countof(szKeyBind);\r
for (DWORD dwIndex = 0; RegEnumKeyEx(hKey, dwIndex, szKeyBind, &dwKeyBind, NULL, NULL, NULL, NULL) == ERROR_SUCCESS; dwIndex++) {\r
- int nCommandType, nKey;\r
- ReadKeyBind(&nCommandType, &nKey, szKeyBind);\r
- m_Data[nAppID].SetCommandID(nCommandType, nKey, nCommandID);\r
+ int nType, nKey;\r
+ ReadKeyBind(&nType, &nKey, szKeyBind);\r
+ m_Data[nAppID].SetCommandID(nType, nKey, nComID);\r
dwKeyBind = _countof(szKeyBind);\r
}\r
RegCloseKey(hKey);\r
} else {\r
// Set the default assignment\r
- for (int i = 0; const int nKey = CCommands::GetDefaultCommandKey(nCommandID, i); i++) {\r
- if (CCommands::GetDefaultControlID(nCommandID, i) == IDC_CO2)\r
+ for (int i = 0; const int nKey = CCommands::GetDefaultCommandKey(nComID, i); i++) {\r
+ if (CCommands::GetDefaultControlID(nComID, i) == IDC_CO2)\r
continue;\r
- const int nCommandType = CCommands::GetDefaultCommandType(nCommandID, i);\r
- m_Data[nAppID].SetCommandID(nCommandType, nKey, nCommandID);\r
+ const int nType = CCommands::GetDefaultCommandType(nComID, i);\r
+ m_Data[nAppID].SetCommandID(nType, nKey, nComID);\r
}\r
}\r
}\r
- for (int nFunctionID = 0; nFunctionID < CDotXkeymacs::GetFunctionNumber(); nFunctionID++) {\r
+ for (int nFuncID = 0; nFuncID < CDotXkeymacs::GetFunctionNumber(); nFuncID++) {\r
HKEY hKey;\r
- const CString regKey = regApp + _T("\\") + CDotXkeymacs::GetFunctionSymbol(nFunctionID);\r
+ const CString regKey = regApp + _T("\\") + CDotXkeymacs::GetFunctionSymbol(nFuncID);\r
if (RegOpenKeyEx(HKEY_CURRENT_USER, regKey, 0, KEY_READ, &hKey) == ERROR_SUCCESS) {\r
- CDotXkeymacs::ClearKey(nFunctionID, nAppID);\r
+ CDotXkeymacs::ClearKey(nFuncID, nAppID);\r
TCHAR szKeyBind[128];\r
DWORD dwKeyBind = _countof(szKeyBind);\r
for (DWORD dwIndex = 0; RegEnumKeyEx(hKey, dwIndex, szKeyBind, &dwKeyBind, NULL, NULL, NULL, NULL) == ERROR_SUCCESS; dwIndex++) {\r
- int nCommandType, nKey;\r
- ReadKeyBind(&nCommandType, &nKey, szKeyBind);\r
- CDotXkeymacs::SetKey(nFunctionID, nAppID, nCommandType, nKey);\r
+ int nType, nKey;\r
+ ReadKeyBind(&nType, &nKey, szKeyBind);\r
+ CDotXkeymacs::SetKey(nFuncID, nAppID, nType, nKey);\r
dwKeyBind = _countof(szKeyBind);\r
}\r
RegCloseKey(hKey);\r
CString regApp(MAKEINTRESOURCE(IDS_REGSUBKEY_DATA));\r
regApp += _T("\\") + appName;\r
// Create all commands\r
- for (int nCommandID = 1; nCommandID < MAX_COMMAND; nCommandID++)\r
- SaveCommand(appName, nCommandID);\r
- for (int nCommandType = 0; nCommandType < MAX_COMMAND_TYPE; nCommandType++)\r
+ for (int nComID = 1; nComID < MAX_COMMAND; nComID++)\r
+ SaveCommand(appName, nComID);\r
+ for (int nType = 0; nType < MAX_COMMAND_TYPE; nType++)\r
for (int nKey = 0; nKey < MAX_KEY; nKey++)\r
- SaveKeyBind(appName, m_Data[nAppID].GetCommandID(nCommandType, nKey), nCommandType, nKey);\r
- for (int nFunctionID = 0; nFunctionID < CDotXkeymacs::GetFunctionNumber(); nFunctionID++)\r
- for (int nKeyID = 0; nKeyID < CDotXkeymacs::GetKeyNumber(nFunctionID, nAppID); nKeyID++) {\r
- int nCommandType, nKey;\r
- CDotXkeymacs::GetKey(nFunctionID, nAppID, nKeyID, &nCommandType, &nKey);\r
- SaveKeyBind(appName, CDotXkeymacs::GetFunctionSymbol(nFunctionID), nCommandType, nKey);\r
+ SaveKeyBind(appName, m_Data[nAppID].GetCommandID(nType, nKey), nType, nKey);\r
+ for (int nFuncID = 0; nFuncID < CDotXkeymacs::GetFunctionNumber(); nFuncID++)\r
+ for (int nKeyID = 0; nKeyID < CDotXkeymacs::GetKeyNumber(nFuncID, nAppID); nKeyID++) {\r
+ int nType, nKey;\r
+ CDotXkeymacs::GetKey(nFuncID, nAppID, nKeyID, &nType, &nKey);\r
+ SaveKeyBind(appName, CDotXkeymacs::GetFunctionSymbol(nFuncID), nType, nKey);\r
}\r
\r
entry.LoadString(IDS_REG_ENTRY_KILL_RING_MAX);\r
void CProfile::SetDllData()\r
{\r
CXkeymacsDll::ClearFunctionDefinition();\r
- for (int nFunctionID = 0; nFunctionID < CDotXkeymacs::GetFunctionNumber(); ++nFunctionID) {\r
- CXkeymacsDll::SetFunctionDefinition(nFunctionID, CDotXkeymacs::GetFunctionDefinition(nFunctionID));\r
+ for (int nFuncID = 0; nFuncID < CDotXkeymacs::GetFunctionNumber(); ++nFuncID) {\r
+ CXkeymacsDll::SetFunctionDefinition(nFuncID, CDotXkeymacs::GetFunctionDefinition(nFuncID));\r
}\r
\r
- for (int nApplicationID = 0; nApplicationID < MAX_APP; ++nApplicationID) {\r
+ for (int nAppID = 0; nAppID < MAX_APP; ++nAppID) {\r
\r
- CString szApplicationName = m_Data[nApplicationID].GetApplicationName();\r
+ CString szApplicationName = m_Data[nAppID].GetApplicationName();\r
\r
if (szApplicationName.IsEmpty()) {\r
- CXkeymacsDll::Clear(nApplicationID);\r
+ CXkeymacsDll::Clear(nAppID);\r
continue;\r
}\r
\r
- CXkeymacsDll::SetApplicationName(nApplicationID, szApplicationName);\r
- CXkeymacsDll::SetWindowText(nApplicationID, m_Data[nApplicationID].GetWindowText());\r
- CXkeymacsDll::SetCommandID(nApplicationID, CONTROL, 'X', 0);\r
+ CXkeymacsDll::SetApplicationName(nAppID, szApplicationName);\r
+ CXkeymacsDll::SetWindowText(nAppID, m_Data[nAppID].GetWindowText());\r
+ CXkeymacsDll::SetCommandID(nAppID, CONTROL, 'X', 0);\r
\r
- for (int nCommandType = 0; nCommandType < MAX_COMMAND_TYPE; ++nCommandType) {\r
+ for (int nType = 0; nType < MAX_COMMAND_TYPE; ++nType) {\r
for (int nKey = 0; nKey < MAX_KEY; ++nKey) {\r
- const int nCommandID = m_Data[nApplicationID].GetCommandID(nCommandType, nKey);\r
- CXkeymacsDll::SetCommandID(nApplicationID, nCommandType, nKey, nCommandID);\r
- if ((nCommandType & CONTROLX) && nCommandID) {\r
- CXkeymacsDll::SetCommandID(nApplicationID, CONTROL, 'X', 1); // Commands[1] is C-x\r
+ const int nComID = m_Data[nAppID].GetCommandID(nType, nKey);\r
+ CXkeymacsDll::SetCommandID(nAppID, nType, nKey, nComID);\r
+ if ((nType & CONTROLX) && nComID) {\r
+ CXkeymacsDll::SetCommandID(nAppID, CONTROL, 'X', 1); // Commands[1] is C-x\r
}\r
}\r
}\r
\r
- for (int nFunctionID = 0; nFunctionID < CDotXkeymacs::GetFunctionNumber(); ++nFunctionID) {\r
- for (int nKeyID = 0; nKeyID < CDotXkeymacs::GetKeyNumber(nFunctionID, nApplicationID); ++nKeyID) {\r
- int nCommandType = 0;\r
+ for (int nFuncID = 0; nFuncID < CDotXkeymacs::GetFunctionNumber(); ++nFuncID) {\r
+ for (int nKeyID = 0; nKeyID < CDotXkeymacs::GetKeyNumber(nFuncID, nAppID); ++nKeyID) {\r
+ int nType = 0;\r
int nKey = 0;\r
- CDotXkeymacs::GetKey(nFunctionID, nApplicationID, nKeyID, &nCommandType, &nKey);\r
- CXkeymacsDll::SetFunctionKey(nFunctionID, nApplicationID, nCommandType, nKey);\r
- if (nCommandType & CONTROLX) {\r
- CXkeymacsDll::SetCommandID(nApplicationID, CONTROL, 'X', 1); // Commands[1] is C-x\r
+ CDotXkeymacs::GetKey(nFuncID, nAppID, nKeyID, &nType, &nKey);\r
+ CXkeymacsDll::SetFunctionKey(nFuncID, nAppID, nType, nKey);\r
+ if (nType & CONTROLX) {\r
+ CXkeymacsDll::SetCommandID(nAppID, CONTROL, 'X', 1); // Commands[1] is C-x\r
}\r
}\r
}\r
\r
- CXkeymacsDll::SetKillRingMax(nApplicationID, m_Data[nApplicationID].GetKillRingMax());\r
- CXkeymacsDll::SetUseDialogSetting(nApplicationID, m_Data[nApplicationID].GetUseDialogSetting());\r
- CXkeymacsDll::SetSettingStyle(nApplicationID, m_Data[nApplicationID].GetSettingStyle());\r
- CXkeymacsDll::SetIgnoreUndefinedMetaCtrl(nApplicationID, m_Data[nApplicationID].GetIgnoreUndefinedMetaCtrl());\r
- CXkeymacsDll::SetIgnoreUndefinedC_x(nApplicationID, m_Data[nApplicationID].GetIgnoreUndefinedC_x());\r
- CXkeymacsDll::SetEnableCUA(nApplicationID, m_Data[nApplicationID].GetEnableCUA());\r
- CXkeymacsDll::Set326Compatible(nApplicationID, m_Data[nApplicationID].Get326Compatible());\r
+ CXkeymacsDll::SetKillRingMax(nAppID, m_Data[nAppID].GetKillRingMax());\r
+ CXkeymacsDll::SetUseDialogSetting(nAppID, m_Data[nAppID].GetUseDialogSetting());\r
+ CXkeymacsDll::SetSettingStyle(nAppID, m_Data[nAppID].GetSettingStyle());\r
+ CXkeymacsDll::SetIgnoreUndefinedMetaCtrl(nAppID, m_Data[nAppID].GetIgnoreUndefinedMetaCtrl());\r
+ CXkeymacsDll::SetIgnoreUndefinedC_x(nAppID, m_Data[nAppID].GetIgnoreUndefinedC_x());\r
+ CXkeymacsDll::SetEnableCUA(nAppID, m_Data[nAppID].GetEnableCUA());\r
+ CXkeymacsDll::Set326Compatible(nAppID, m_Data[nAppID].Get326Compatible());\r
}\r
CXkeymacsApp *pApp = static_cast<CXkeymacsApp *>(AfxGetApp());\r
if (!pApp->IsWow64())\r
*pnKey = KeyBind2Key(szKeyBind + _tcslen(CommandType2String(*pnCommandType)));\r
}\r
\r
-CString CProfile::WriteKeyBind(const int nCommandType, const int nKey)\r
+CString CProfile::WriteKeyBind(const int nType, const int nKey)\r
{\r
CString szKeyBind;\r
- szKeyBind.Format(_T("%s%s"), CommandType2String(nCommandType), Key2String(nKey));\r
+ szKeyBind.Format(_T("%s%s"), CommandType2String(nType), Key2String(nKey));\r
return szKeyBind;\r
}\r
\r
int CProfile::KeyBind2CommandType(LPCTSTR szKeyBind)\r
{\r
- for (int nCommandType = MAX_COMMAND_TYPE - 1; nCommandType; --nCommandType) {\r
- if (IsCommandType(nCommandType, szKeyBind)) {\r
- return nCommandType;\r
+ for (int nType = MAX_COMMAND_TYPE - 1; nType; --nType) {\r
+ if (IsCommandType(nType, szKeyBind)) {\r
+ return nType;\r
}\r
}\r
return NONE;\r
return 0;\r
}\r
\r
-LPCTSTR CProfile::CommandType2String(int nCommandType)\r
+LPCTSTR CProfile::CommandType2String(int nType)\r
{\r
- if (nCommandType < 0 || sizeof(CommandTypes) / sizeof(CommandTypes[0]) <= nCommandType) {\r
+ if (nType < 0 || sizeof(CommandTypes) / sizeof(CommandTypes[0]) <= nType) {\r
ASSERT(0);\r
- nCommandType = NONE;\r
+ nType = NONE;\r
}\r
- return CommandTypes[nCommandType].szCommandTypeName;\r
+ return CommandTypes[nType].szName;\r
}\r
\r
LPCTSTR CProfile::Key2String(int nKey)\r
return KeyNames[nKey].name;\r
}\r
\r
-BOOL CProfile::IsCommandType(const int nCommandType, LPCTSTR szKeyBind)\r
+BOOL CProfile::IsCommandType(const int nType, LPCTSTR szKeyBind)\r
{\r
- LPCTSTR szCommandType = CommandType2String(nCommandType);\r
+ LPCTSTR szCommandType = CommandType2String(nType);\r
\r
if (!_tcsnicmp(szKeyBind, szCommandType, _tcslen(szCommandType))) {\r
return TRUE;\r
return FALSE;\r
}\r
\r
-void CProfile::SaveKeyBind(const CString szApplicationName, const int nCommandID, const int nCommandType, const int nKey)\r
+void CProfile::SaveKeyBind(const CString szApplicationName, const int nComID, const int nType, const int nKey)\r
{\r
- if (!nCommandID) {\r
+ if (!nComID) {\r
return;\r
}\r
\r
- CString szCommandName = CCommands::GetCommandName(nCommandID);\r
+ CString szCommandName = CCommands::GetCommandName(nComID);\r
if (szCommandName.IsEmpty()) {\r
return;\r
}\r
\r
- SaveKeyBind(szApplicationName, szCommandName, nCommandType, nKey);\r
+ SaveKeyBind(szApplicationName, szCommandName, nType, nKey);\r
}\r
\r
-void CProfile::SaveKeyBind(const CString szApplicationName, const CString szCommandName, const int nCommandType, const int nKey)\r
+void CProfile::SaveKeyBind(const CString szApplicationName, const CString szCommandName, const int nType, const int nKey)\r
{\r
- CString szKeyBind = WriteKeyBind(nCommandType, nKey);\r
+ CString szKeyBind = WriteKeyBind(nType, nKey);\r
CString szSubKey(MAKEINTRESOURCE(IDS_REGSUBKEY_DATA));\r
szSubKey += _T("\\") + szApplicationName + _T("\\") + szCommandName;\r
if (!szKeyBind.IsEmpty()) {\r
}\r
}\r
\r
-void CProfile::SaveCommand(const CString szApplicationName, const int nCommandID)\r
+void CProfile::SaveCommand(const CString szApplicationName, const int nComID)\r
{\r
- SaveKeyBind(szApplicationName, nCommandID, 0, 0);\r
+ SaveKeyBind(szApplicationName, nComID, 0, 0);\r
}\r
\r
void CProfile::AddKeyBind2C_(const CString szApplicationName, const BYTE bVk)\r
{\r
- int nCommandID;\r
- for (nCommandID = 0; nCommandID < MAX_COMMAND; ++nCommandID) {\r
- if (Commands[nCommandID].fCommand == CCommands::C_) {\r
+ int nComID;\r
+ for (nComID = 0; nComID < MAX_COMMAND; ++nComID) {\r
+ if (Commands[nComID].fCommand == CCommands::C_) {\r
break;\r
}\r
}\r
\r
- SaveKeyBind(szApplicationName, nCommandID, NONE, bVk);\r
+ SaveKeyBind(szApplicationName, nComID, NONE, bVk);\r
}\r
\r
void CProfile::LevelUp()\r
switch (AfxGetApp()->GetProfileInt(szSection, szEntry, nDefalutLevel)) {\r
case nDefalutLevel:\r
{\r
- for (int nApplicationID = 0; nApplicationID < MAX_APP; ++nApplicationID) {\r
+ for (int nAppID = 0; nAppID < MAX_APP; ++nAppID) {\r
CString szEntry;\r
- szEntry.Format(IDS_REG_ENTRY_APPLICATION, nApplicationID);\r
+ szEntry.Format(IDS_REG_ENTRY_APPLICATION, nAppID);\r
\r
CString szApplicationName;\r
szApplicationName = AfxGetApp()->GetProfileString(CString(MAKEINTRESOURCE(IDS_REG_SECTION_APPLICATION)), szEntry);\r
// Do NOT write break; here.\r
case 1:\r
{\r
- for (int nApplicationID = 0; nApplicationID < MAX_APP; ++nApplicationID) {\r
+ for (int nAppID = 0; nAppID < MAX_APP; ++nAppID) {\r
CString szEntry;\r
- szEntry.Format(IDS_REG_ENTRY_APPLICATION, nApplicationID);\r
+ szEntry.Format(IDS_REG_ENTRY_APPLICATION, nAppID);\r
\r
CString szApplicationName;\r
szApplicationName = AfxGetApp()->GetProfileString(CString(MAKEINTRESOURCE(IDS_REG_SECTION_APPLICATION)), szEntry);\r
// Do NOT write break; here.\r
case 2:\r
{\r
- for (int nApplicationID = 0; nApplicationID < MAX_APP; ++nApplicationID) {\r
+ for (int nAppID = 0; nAppID < MAX_APP; ++nAppID) {\r
CString szEntry;\r
- szEntry.Format(IDS_REG_ENTRY_APPLICATION, nApplicationID);\r
+ szEntry.Format(IDS_REG_ENTRY_APPLICATION, nAppID);\r
\r
CString szApplicationName;\r
szApplicationName = AfxGetApp()->GetProfileString(CString(MAKEINTRESOURCE(IDS_REG_SECTION_APPLICATION)), szEntry);\r
// Do NOT write break; here.\r
case 3:\r
{\r
- for (int nApplicationID = 0; nApplicationID < MAX_APP; ++nApplicationID) {\r
+ for (int nAppID = 0; nAppID < MAX_APP; ++nAppID) {\r
CString szEntry;\r
- szEntry.Format(IDS_REG_ENTRY_APPLICATION, nApplicationID);\r
+ szEntry.Format(IDS_REG_ENTRY_APPLICATION, nAppID);\r
\r
CString szApplicationName;\r
szApplicationName = AfxGetApp()->GetProfileString(CString(MAKEINTRESOURCE(IDS_REG_SECTION_APPLICATION)), szEntry);\r
}\r
\r
// rename original function to remove IDS_REG_ORIGINAL_PREFIX\r
- for (int nFunctionID = 0; nFunctionID < CDotXkeymacs::GetFunctionNumber(); ++nFunctionID) {\r
+ for (int nFuncID = 0; nFuncID < CDotXkeymacs::GetFunctionNumber(); ++nFuncID) {\r
HKEY hKey = NULL;\r
CString szSubKey(MAKEINTRESOURCE(IDS_REGSUBKEY_DATA));\r
- szSubKey += _T("\\") + szApplicationName + _T("\\") + CString(MAKEINTRESOURCE(IDS_REG_ORIGINAL_PREFIX)) + CDotXkeymacs::GetFunctionSymbol(nFunctionID);\r
+ szSubKey += _T("\\") + szApplicationName + _T("\\") + CString(MAKEINTRESOURCE(IDS_REG_ORIGINAL_PREFIX)) + CDotXkeymacs::GetFunctionSymbol(nFuncID);\r
if (RegOpenKeyEx(HKEY_CURRENT_USER, szSubKey, 0, KEY_READ, &hKey) == ERROR_SUCCESS) {\r
// Use registry data\r
TCHAR szKeyBind[128] = {'\0'};\r
DWORD dwKeyBind = sizeof(szKeyBind);\r
FILETIME ft = {'\0'}; // not use\r
for (DWORD dwIndex = 0; RegEnumKeyEx(hKey, dwIndex, szKeyBind, &dwKeyBind, NULL, NULL, NULL, &ft) == ERROR_SUCCESS; ++dwIndex) {\r
- int nCommandType = 0;\r
+ int nType = 0;\r
int nKey = 0;\r
- ReadKeyBind(&nCommandType, &nKey, szKeyBind);\r
- SaveKeyBind(szApplicationName, CDotXkeymacs::GetFunctionSymbol(nFunctionID), nCommandType, nKey);\r
+ ReadKeyBind(&nType, &nKey, szKeyBind);\r
+ SaveKeyBind(szApplicationName, CDotXkeymacs::GetFunctionSymbol(nFuncID), nType, nKey);\r
\r
memset(szKeyBind, 0, sizeof(szKeyBind));\r
dwKeyBind = sizeof(szKeyBind);\r
\r
void CProfile::ClearData(const CString szCurrentApplication)\r
{\r
- int nApplicationID;\r
- for (nApplicationID = 0; nApplicationID < MAX_APP; ++nApplicationID) {\r
- if (m_Data[nApplicationID].GetApplicationName() == szCurrentApplication) {\r
+ int nAppID;\r
+ for (nAppID = 0; nAppID < MAX_APP; ++nAppID) {\r
+ if (m_Data[nAppID].GetApplicationName() == szCurrentApplication) {\r
break;\r
}\r
}\r
- if (nApplicationID < MAX_APP) {\r
- m_Data[nApplicationID].ClearAll();\r
+ if (nAppID < MAX_APP) {\r
+ m_Data[nAppID].ClearAll();\r
}\r
}\r
\r
{\r
int nSavedSetting = 0;\r
\r
- for (int nApplicationID = 0; nApplicationID < MAX_APP; ++nApplicationID) {\r
+ for (int nAppID = 0; nAppID < MAX_APP; ++nAppID) {\r
CString szApplicationName;\r
- szApplicationName = m_Data[nApplicationID].GetApplicationName();\r
+ szApplicationName = m_Data[nAppID].GetApplicationName();\r
if (!szApplicationName.IsEmpty()) {\r
++nSavedSetting;\r
}\r
*nSettingStyle = SETTING_UNDEFINED;\r
}\r
\r
- int nApplicationID = GetApplicationIndex(szApplicationName);\r
+ int nAppID = GetApplicationIndex(szApplicationName);\r
\r
- if (nApplicationID == MAX_APP) {\r
+ if (nAppID == MAX_APP) {\r
if (bSaveAndValidate) { // GetDialogData\r
- for (nApplicationID = 0; nApplicationID < MAX_APP; ++nApplicationID) {\r
- CString sz = m_Data[nApplicationID].GetApplicationName();\r
+ for (nAppID = 0; nAppID < MAX_APP; ++nAppID) {\r
+ CString sz = m_Data[nAppID].GetApplicationName();\r
if (sz.IsEmpty()) {\r
- m_Data[nApplicationID].SetApplicationName(szApplicationName);\r
+ m_Data[nAppID].SetApplicationName(szApplicationName);\r
break;\r
}\r
}\r
- if (nApplicationID == MAX_APP) {\r
- return nApplicationID;\r
+ if (nAppID == MAX_APP) {\r
+ return nAppID;\r
}\r
} else { // SetDialogData\r
- for (nApplicationID = 0; nApplicationID < MAX_APP; ++nApplicationID) {\r
- if (IsDefault(m_Data[nApplicationID].GetApplicationName())) {\r
+ for (nAppID = 0; nAppID < MAX_APP; ++nAppID) {\r
+ if (IsDefault(m_Data[nAppID].GetApplicationName())) {\r
*nSettingStyle = SETTING_DEFAULT;\r
break;\r
}\r
}\r
- if (nApplicationID == MAX_APP) {\r
- return nApplicationID;\r
+ if (nAppID == MAX_APP) {\r
+ return nAppID;\r
}\r
}\r
}\r
\r
if (bSaveAndValidate) { // GetDialogData\r
- m_Data[nApplicationID].SetSettingStyle(*nSettingStyle);\r
+ m_Data[nAppID].SetSettingStyle(*nSettingStyle);\r
} else { // SetDialogData\r
if (*nSettingStyle == SETTING_UNDEFINED) { // It means that *nSettingStyle != SETTING_DEFAULT.\r
- *nSettingStyle = m_Data[nApplicationID].GetSettingStyle();\r
+ *nSettingStyle = m_Data[nAppID].GetSettingStyle();\r
}\r
}\r
\r
- return nApplicationID;\r
+ return nAppID;\r
}\r
\r
BOOL CProfile::Is106Keyboard()\r
return;\r
}\r
\r
-void CProfile::UpdateApplicationTitle(CComboBox *const cApplicationList, const CString szCurrentApplication, const int nApplicationID, const BOOL bSaveAndValidate)\r
+void CProfile::UpdateApplicationTitle(CComboBox *const cApplicationList, const CString szCurrentApplication, const int nAppID, const BOOL bSaveAndValidate)\r
{\r
static CString szApplicationTitle;\r
if (bSaveAndValidate) { // GetDialogData\r
if (!CProfile::IsDefault(szCurrentApplication)) {\r
- m_Data[nApplicationID].SetApplicationTitle(szApplicationTitle);\r
+ m_Data[nAppID].SetApplicationTitle(szApplicationTitle);\r
}\r
szApplicationTitle.Empty();\r
} else { // SetDialogData\r
}\r
}\r
\r
-void CProfile::SetCommandID(const int nApplicationID, const int nCommandType, const int nKey, int nCommandID)\r
+void CProfile::SetCommandID(const int nAppID, const int nType, const int nKey, int nComID)\r
{\r
- if (nKey == 0xf0 && Commands[nCommandID].fCommand == CCommands::C_) {\r
+ if (nKey == 0xf0 && Commands[nComID].fCommand == CCommands::C_) {\r
// Change CommandID C_Eisu\r
- for (nCommandID = 1; nCommandID < MAX_COMMAND; ++nCommandID) {\r
- if (Commands[nCommandID].fCommand == CCommands::C_Eisu) {\r
+ for (nComID = 1; nComID < MAX_COMMAND; ++nComID) {\r
+ if (Commands[nComID].fCommand == CCommands::C_Eisu) {\r
break;\r
}\r
}\r
}\r
- m_Data[nApplicationID].SetCommandID(nCommandType, nKey, nCommandID);\r
+ m_Data[nAppID].SetCommandID(nType, nKey, nComID);\r
}\r
\r
-int CProfile::GetCommandID(const int nApplicationID, const int nCommandType, const int nKey)\r
+int CProfile::GetCommandID(const int nAppID, const int nType, const int nKey)\r
{\r
- int nCommandID = m_Data[nApplicationID].GetCommandID(nCommandType, nKey);\r
- if (nKey == 0xf0 && Commands[nCommandID].fCommand == CCommands::C_Eisu) {\r
+ int nComID = m_Data[nAppID].GetCommandID(nType, nKey);\r
+ if (nKey == 0xf0 && Commands[nComID].fCommand == CCommands::C_Eisu) {\r
// Change CommandID C_\r
- for (nCommandID = 1; nCommandID < MAX_COMMAND; ++nCommandID) {\r
- if (Commands[nCommandID].fCommand == CCommands::C_) {\r
+ for (nComID = 1; nComID < MAX_COMMAND; ++nComID) {\r
+ if (Commands[nComID].fCommand == CCommands::C_) {\r
break;\r
}\r
}\r
}\r
- return nCommandID;\r
+ return nComID;\r
}\r
\r
-void CProfile::SetKillRingMax(const int nApplicationID, const int nKillRingMax)\r
+void CProfile::SetKillRingMax(const int nAppID, const int nKillRingMax)\r
{\r
- m_Data[nApplicationID].SetKillRingMax(nKillRingMax);\r
+ m_Data[nAppID].SetKillRingMax(nKillRingMax);\r
}\r
\r
-int CProfile::GetKillRingMax(const int nApplicationID)\r
+int CProfile::GetKillRingMax(const int nAppID)\r
{\r
- return m_Data[nApplicationID].GetKillRingMax();\r
+ return m_Data[nAppID].GetKillRingMax();\r
}\r
\r
-void CProfile::SetUseDialogSetting(const int nApplicationID, const BOOL bUseDialogSetting)\r
+void CProfile::SetUseDialogSetting(const int nAppID, const BOOL bUseDialogSetting)\r
{\r
- m_Data[nApplicationID].SetUseDialogSetting(bUseDialogSetting);\r
+ m_Data[nAppID].SetUseDialogSetting(bUseDialogSetting);\r
}\r
\r
-BOOL CProfile::GetUseDialogSetting(const int nApplicationID)\r
+BOOL CProfile::GetUseDialogSetting(const int nAppID)\r
{\r
- return m_Data[nApplicationID].GetUseDialogSetting();\r
+ return m_Data[nAppID].GetUseDialogSetting();\r
}\r
\r
-void CProfile::SetWindowText(const int nApplicationID, const CString szWindowText)\r
+void CProfile::SetWindowText(const int nAppID, const CString szWindowText)\r
{\r
- m_Data[nApplicationID].SetWindowText(szWindowText);\r
+ m_Data[nAppID].SetWindowText(szWindowText);\r
}\r
\r
-CString CProfile::GetWindowText(const int nApplicationID)\r
+CString CProfile::GetWindowText(const int nAppID)\r
{\r
- return m_Data[nApplicationID].GetWindowText();\r
+ return m_Data[nAppID].GetWindowText();\r
}\r
\r
void CProfile::DeleteAllRegistryData()\r
HKEY hkey = NULL;\r
if (RegOpenKeyEx(HKEY_CURRENT_USER, CString(MAKEINTRESOURCE(IDS_REGSUBKEY_DATA)), 0, KEY_ALL_ACCESS, &hkey) == ERROR_SUCCESS) {\r
// I am sure that I have to do only one time, but...\r
- for (int nApplicationID = 0; nApplicationID < MAX_APP; ++nApplicationID) {\r
+ for (int nAppID = 0; nAppID < MAX_APP; ++nAppID) {\r
DWORD dwIndex = 0;\r
TCHAR szName[SUB_KEY_NAME_LENGTH] = {'\0'};\r
DWORD dwName = sizeof(szName);\r
// if there is NOT the application in the data, return MAX_APP\r
int CProfile::GetApplicationIndex(const CString szApplicationName)\r
{\r
- int nApplicationID = 0;\r
- for (nApplicationID = 0; nApplicationID < MAX_APP; ++nApplicationID) {\r
- if (m_Data[nApplicationID].GetApplicationName() == szApplicationName) {\r
+ int nAppID = 0;\r
+ for (nAppID = 0; nAppID < MAX_APP; ++nAppID) {\r
+ if (m_Data[nAppID].GetApplicationName() == szApplicationName) {\r
break;\r
}\r
}\r
- return nApplicationID;\r
+ return nAppID;\r
}\r
\r
// Return True if Windows Vista or later.\r
return;\r
}\r
\r
-BOOL CProfile::GetEnableCUA(const int nApplicationID)\r
+BOOL CProfile::GetEnableCUA(const int nAppID)\r
{\r
- return m_Data[nApplicationID].GetEnableCUA();\r
+ return m_Data[nAppID].GetEnableCUA();\r
}\r
\r
-void CProfile::SetEnableCUA(const int nApplicationID, const BOOL bEnableCUA)\r
+void CProfile::SetEnableCUA(const int nAppID, const BOOL bEnableCUA)\r
{\r
- m_Data[nApplicationID].SetEnableCUA(bEnableCUA);\r
+ m_Data[nAppID].SetEnableCUA(bEnableCUA);\r
}\r
\r
int CProfile::GetKeyboardSpeed()\r
{\r
public:\r
static int GetKeyboardSpeed(void);\r
- static CString GetWindowText(int nApplicationID);\r
- static void SetWindowText(int nApplicationID, CString szWindowText);\r
- static void SetEnableCUA(int nApplicationID, BOOL bEnableCUA);\r
- static BOOL GetEnableCUA(int nApplicationID);\r
+ static CString GetWindowText(int nAppID);\r
+ static void SetWindowText(int nAppID, CString szWindowText);\r
+ static void SetEnableCUA(int nAppID, BOOL bEnableCUA);\r
+ static BOOL GetEnableCUA(int nAppID);\r
static void ImportProperties();\r
static void ExportProperties();\r
static void RestartComputer();\r
static void LoadScanCodeMap(HKEY_TYPE hkeyType);\r
static BOOL Is106Keyboard();\r
static BOOL IsDialog(CString sz);\r
- static BOOL GetUseDialogSetting(int nApplicationID);\r
- static void SetUseDialogSetting(int nApplicationID, BOOL bUseDialogSetting);\r
+ static BOOL GetUseDialogSetting(int nAppID);\r
+ static void SetUseDialogSetting(int nAppID, BOOL bUseDialogSetting);\r
static int GetApplicationIndex(CString szApplicationName);\r
static void CopyData(CString szDestinationApplication, CString szSourceApplication);\r
static void ReadKeyBind(int *pnCommandType, int *pnKey, LPCTSTR szKeyBind);\r
static LPCTSTR Key2String(int nKey);\r
- static LPCTSTR CommandType2String(int nCommandType);\r
+ static LPCTSTR CommandType2String(int nType);\r
static int GetCurrentApplicationID(CComboBox *cApplicationList, CString szCurrentApplication);\r
- static int GetKillRingMax(int nApplicationID);\r
- static void SetKillRingMax(int nApplicationID, int nKillRingMax);\r
- static int GetCommandID(int nApplicationID, int nCommandType, int nKey);\r
- static void SetCommandID(int nApplicationID, int nCommandType, int nKey, int nCommandID);\r
- static void UpdateApplicationTitle(CComboBox *cApplicationList, CString szCurrentApplication, int nApplicationID, BOOL bSaveAndValidate);\r
+ static int GetKillRingMax(int nAppID);\r
+ static void SetKillRingMax(int nAppID, int nKillRingMax);\r
+ static int GetCommandID(int nAppID, int nType, int nKey);\r
+ static void SetCommandID(int nAppID, int nType, int nKey, int nComID);\r
+ static void UpdateApplicationTitle(CComboBox *cApplicationList, CString szCurrentApplication, int nAppID, BOOL bSaveAndValidate);\r
static void GetApplicationTitle(CComboBox *cApplicationList, CString &rList, int nIndex = -1);\r
static BOOL IsDefault(CString sz);\r
static int GetApplicationIndex(CString szApplicationName, BOOL bSaveAndValidate, int *nSettingStyle);\r
static void SaveData();\r
\r
private:\r
- static void SaveKeyBind(CString szApplicationName, CString szCommandName, int nCommandType, int nKey);\r
+ static void SaveKeyBind(CString szApplicationName, CString szCommandName, int nType, int nKey);\r
static BOOL DiableTokenPrivileges();\r
static BOOL AdjustTokenPrivileges(LPCTSTR lpName);\r
- static void SaveCommand(CString szApplicationName, int nCommandID);\r
- static void SaveKeyBind(CString szApplicationName, int nCommandID, int nCommandType, int nKey);\r
+ static void SaveCommand(CString szApplicationName, int nComID);\r
+ static void SaveKeyBind(CString szApplicationName, int nComID, int nType, int nKey);\r
static void AddKeyBind2C_(CString szApplicationName, BYTE bVk);\r
static void LevelUp();\r
static void Item2AppName(CString *sz);\r
static TASK_LIST m_TaskList[MAX_TASKS];\r
static DWORD m_dwTasks;\r
static void GetTaskList();\r
- static BOOL IsCommandType(int nCommandType, LPCTSTR szKeyBind);\r
+ static BOOL IsCommandType(int nType, LPCTSTR szKeyBind);\r
static int KeyBind2Key(LPCTSTR szKey);\r
static int KeyBind2CommandType(LPCTSTR szKeyBind);\r
- static CString WriteKeyBind(int nCommandType, int nKey);\r
+ static CString WriteKeyBind(int nType, int nKey);\r
static void LoadRegistry();\r
static void SaveRegistry();\r
static void AddIMEInfo(CComboBox *cApplicationList);\r
\r
// get all category type\r
m_cCategory.ResetContent();\r
- for (int nCommandID = 1; nCommandID < MAX_COMMAND; ++nCommandID) {\r
- CString szCommandName = CCommands::GetCommandName(nCommandID);\r
+ for (int nComID = 1; nComID < MAX_COMMAND; ++nComID) {\r
+ CString szCommandName = CCommands::GetCommandName(nComID);\r
if (szCommandName.IsEmpty()) {\r
break;\r
}\r
- int nCategoryID = CCommands::GetCategoryID(nCommandID);\r
+ int nCategoryID = CCommands::GetCategoryID(nComID);\r
if (!nCategoryID) {\r
continue;\r
}\r
CString szCategory;\r
m_cCategory.GetLBText(m_cCategory.GetCurSel(), szCategory);\r
if (szCategory.Compare(CString(MAKEINTRESOURCE(IDS_ORIGINAL)))) {\r
- for (int nCommandID = 1; nCommandID < MAX_COMMAND; ++nCommandID) {\r
- CString szCommandName = CCommands::GetCommandName(nCommandID);\r
+ for (int nComID = 1; nComID < MAX_COMMAND; ++nComID) {\r
+ CString szCommandName = CCommands::GetCommandName(nComID);\r
if (szCommandName.IsEmpty()) {\r
break;\r
}\r
\r
- if (szCategory == CString(MAKEINTRESOURCE(CCommands::GetCategoryID(nCommandID)))) {\r
+ if (szCategory == CString(MAKEINTRESOURCE(CCommands::GetCategoryID(nComID)))) {\r
m_cCommands.AddString(szCommandName);\r
}\r
}\r
} else {\r
- for (int nFunctionID = 0; nFunctionID < CDotXkeymacs::GetFunctionNumber(); ++nFunctionID) {\r
+ for (int nFuncID = 0; nFuncID < CDotXkeymacs::GetFunctionNumber(); ++nFuncID) {\r
BOOL bOriginal = TRUE;\r
- for (int nCommandID = 1; nCommandID < MAX_COMMAND; ++nCommandID) {\r
- CString szCommandName = CCommands::GetCommandName(nCommandID);\r
+ for (int nComID = 1; nComID < MAX_COMMAND; ++nComID) {\r
+ CString szCommandName = CCommands::GetCommandName(nComID);\r
if (szCommandName.IsEmpty()) {\r
break;\r
}\r
\r
- if (szCommandName == CDotXkeymacs::GetFunctionSymbol(nFunctionID)) {\r
+ if (szCommandName == CDotXkeymacs::GetFunctionSymbol(nFuncID)) {\r
bOriginal = FALSE; // overwriting build-in keybindings\r
break;\r
}\r
}\r
if (bOriginal) {\r
- m_cCommands.AddString(CDotXkeymacs::GetFunctionSymbol(nFunctionID));\r
+ m_cCommands.AddString(CDotXkeymacs::GetFunctionSymbol(nFuncID));\r
}\r
}\r
}\r
m_cCommands.GetText(m_cCommands.GetCurSel(), szCurrentCommandName);\r
\r
if (szCategory.Compare(CString(MAKEINTRESOURCE(IDS_ORIGINAL)))) {\r
- for (int nCommandType = 0; nCommandType < MAX_COMMAND_TYPE; ++nCommandType) {\r
+ for (int nType = 0; nType < MAX_COMMAND_TYPE; ++nType) {\r
for (int nKey = 0; nKey < MAX_KEY; ++nKey) {\r
- if (CCommands::GetCommandName(CProfile::GetCommandID(m_nApplicationID, nCommandType, nKey)) == szCurrentCommandName) {\r
+ if (CCommands::GetCommandName(CProfile::GetCommandID(m_nApplicationID, nType, nKey)) == szCurrentCommandName) {\r
CString sz;\r
- sz.Format(_T("%s%s"), CProfile::CommandType2String(nCommandType), CProfile::Key2String(nKey));\r
+ sz.Format(_T("%s%s"), CProfile::CommandType2String(nType), CProfile::Key2String(nKey));\r
m_cCurrentKeys.AddString(sz);\r
}\r
}\r
}\r
\r
CString szCommandName;\r
- for (int nCommandID = 0; nCommandID < MAX_COMMAND; ++nCommandID) {\r
- szCommandName = CCommands::GetCommandName(nCommandID);\r
+ for (int nComID = 0; nComID < MAX_COMMAND; ++nComID) {\r
+ szCommandName = CCommands::GetCommandName(nComID);\r
if (szCommandName.IsEmpty()) {\r
break;\r
}\r
if (szCommandName == szCurrentCommandName) {\r
- m_nCommandID = nCommandID;\r
+ m_nCommandID = nComID;\r
break;\r
}\r
}\r
m_cDescription.SetWindowText(CString(MAKEINTRESOURCE(CCommands::GetDescriptionID(m_nCommandID))));\r
\r
// overwrite by original command's description if needed\r
- for (int nFunctionID = 0; nFunctionID < CDotXkeymacs::GetFunctionNumber(); ++nFunctionID) {\r
- if (szCommandName == CDotXkeymacs::GetFunctionSymbol(nFunctionID)) {\r
+ for (int nFuncID = 0; nFuncID < CDotXkeymacs::GetFunctionNumber(); ++nFuncID) {\r
+ if (szCommandName == CDotXkeymacs::GetFunctionSymbol(nFuncID)) {\r
m_cDescription.SetWindowText(CDotXkeymacs::GetFunctionDefinition(szCurrentCommandName));\r
break;\r
}\r
} else {\r
const int nIndex = CDotXkeymacs::GetIndex(szCurrentCommandName);\r
for (int nKeyID = 0; nKeyID < CDotXkeymacs::GetKeyNumber(nIndex, m_nApplicationID); ++nKeyID) {\r
- int nCommandType = 0;\r
+ int nType = 0;\r
int nKey = 0;\r
- CDotXkeymacs::GetKey(nIndex, m_nApplicationID, nKeyID, &nCommandType, &nKey);\r
+ CDotXkeymacs::GetKey(nIndex, m_nApplicationID, nKeyID, &nType, &nKey);\r
\r
CString sz;\r
- sz.Format(_T("%s%s"), CProfile::CommandType2String(nCommandType), CProfile::Key2String(nKey));\r
+ sz.Format(_T("%s%s"), CProfile::CommandType2String(nType), CProfile::Key2String(nKey));\r
m_cCurrentKeys.AddString(sz);\r
}\r
\r
void CPropertiesAdvanced::SetNewKey()\r
{\r
CString szNewKey;\r
- int nCommandType = NONE;\r
+ int nType = NONE;\r
\r
if (m_bC_x) {\r
szNewKey += _T("Ctrl+X ");\r
- nCommandType += CONTROLX;\r
+ nType += CONTROLX;\r
}\r
if (IsCtrlDown()) {\r
szNewKey += _T("Ctrl+");\r
- nCommandType += CONTROL;\r
+ nType += CONTROL;\r
}\r
if (IsMetaDown()) {\r
szNewKey += _T("Meta+");\r
- nCommandType += META;\r
+ nType += META;\r
}\r
if (IsShiftDown()) {\r
szNewKey += _T("Shift+");\r
- nCommandType += SHIFT;\r
+ nType += SHIFT;\r
}\r
\r
- m_nAssignCommandType = nCommandType;\r
+ m_nAssignCommandType = nType;\r
\r
szNewKey += CProfile::Key2String(m_nAssignKey);\r
if (m_pNewKey) {\r
}\r
}\r
\r
-void CPropertiesAdvanced::SetCommandID(int nCommandType, int nKey, int nCommandID)\r
+void CPropertiesAdvanced::SetCommandID(int nType, int nKey, int nComID)\r
{\r
- m_nCommandIDs[nCommandType][nKey] = nCommandID;\r
+ m_nCommandIDs[nType][nKey] = nComID;\r
\r
// Set C-x if it is needed.\r
- if ((nCommandType & CONTROLX)) {\r
+ if ((nType & CONTROLX)) {\r
// Get CommandID of C-x.\r
int nCommandIDofC_x;\r
for (nCommandIDofC_x = 0; nCommandIDofC_x < MAX_COMMAND; ++nCommandIDofC_x) {\r
}\r
}\r
\r
- if (nCommandID) {\r
+ if (nComID) {\r
m_nCommandIDs[CONTROL]['X'] = nCommandIDofC_x;\r
} else {\r
for (int i = 0; i < MAX_COMMAND_TYPE; ++i) { // i is command-type.\r
\r
void CPropertiesAdvanced::InitCommandIDs()\r
{\r
- for (int nCommandType = 0; nCommandType < MAX_COMMAND_TYPE; ++nCommandType) {\r
+ for (int nType = 0; nType < MAX_COMMAND_TYPE; ++nType) {\r
for (int nKey = 0; nKey < MAX_KEY; ++nKey) {\r
- SetCommandID(nCommandType, nKey, CProfile::GetCommandID(m_nApplicationID, nCommandType, nKey));\r
+ SetCommandID(nType, nKey, CProfile::GetCommandID(m_nApplicationID, nType, nKey));\r
}\r
}\r
}\r
static BOOL IsMetaDown();\r
static BOOL IsCtrlDown();\r
void InitCommandIDs();\r
- static void SetCommandID(int nCommandType, int nKey, int nCommandID);\r
+ static void SetCommandID(int nType, int nKey, int nComID);\r
static int m_nCommandIDs[MAX_COMMAND_TYPE][MAX_KEY];\r
static void SetNewKey();\r
static int m_nAssignKey;\r
\r
void CPropertiesBasic::SetAllDialogData(UINT nCheck, BOOL bChanged)\r
{\r
- for (int nCommandID = 0; nCommandID < MAX_COMMAND; ++nCommandID) {\r
- CString szCommandName = CCommands::GetCommandName(nCommandID);\r
+ for (int nComID = 0; nComID < MAX_COMMAND; ++nComID) {\r
+ CString szCommandName = CCommands::GetCommandName(nComID);\r
if (szCommandName.IsEmpty()) {\r
break;\r
}\r
\r
for (int i = 0; ; ++i) {\r
- int nKey = CCommands::GetDefaultCommandKey(nCommandID, i);\r
- int nControlID = CCommands::GetDefaultControlID(nCommandID, i);\r
+ int nKey = CCommands::GetDefaultCommandKey(nComID, i);\r
+ int nControlID = CCommands::GetDefaultControlID(nComID, i);\r
if (nKey == 0) {\r
break;\r
}\r
SetAllDialogData(1, FALSE);\r
CheckDlgButton(IDC_CO2, BST_CHECKED);\r
}\r
- for (int nCommandID = 0; nCommandID < MAX_COMMAND; ++nCommandID) {\r
- CString szCommandName = CCommands::GetCommandName(nCommandID);\r
+ for (int nComID = 0; nComID < MAX_COMMAND; ++nComID) {\r
+ CString szCommandName = CCommands::GetCommandName(nComID);\r
if (szCommandName.IsEmpty()) {\r
break;\r
}\r
\r
for (int i = 0; ; ++i) {\r
- int nCommandType = CCommands::GetDefaultCommandType(nCommandID, i);\r
- int nKey = CCommands::GetDefaultCommandKey(nCommandID, i);\r
- int nControlID = CCommands::GetDefaultControlID(nCommandID, i);\r
+ int nType = CCommands::GetDefaultCommandType(nComID, i);\r
+ int nKey = CCommands::GetDefaultCommandKey(nComID, i);\r
+ int nControlID = CCommands::GetDefaultControlID(nComID, i);\r
if (nKey == 0) {\r
break;\r
}\r
if (nControlID == IDC_CO2) {\r
continue;\r
}\r
- if (!m_bChanged[nCommandID]) {\r
+ if (!m_bChanged[nComID]) {\r
continue;\r
}\r
if (IsDlgButtonChecked(nControlID)) {\r
- CProfile::SetCommandID(m_pProperties->GetApplicationID(), nCommandType, nKey, nCommandID);\r
- CDotXkeymacs::RemoveKey(m_pProperties->GetApplicationID(), nCommandType, nKey);\r
+ CProfile::SetCommandID(m_pProperties->GetApplicationID(), nType, nKey, nComID);\r
+ CDotXkeymacs::RemoveKey(m_pProperties->GetApplicationID(), nType, nKey);\r
} else {\r
- CProfile::SetCommandID(m_pProperties->GetApplicationID(), nCommandType, nKey, 0);\r
+ CProfile::SetCommandID(m_pProperties->GetApplicationID(), nType, nKey, 0);\r
}\r
} else { // SetDialogData\r
- if (nCommandID != CProfile::GetCommandID(m_pProperties->GetApplicationID(), nCommandType, nKey)) {\r
+ if (nComID != CProfile::GetCommandID(m_pProperties->GetApplicationID(), nType, nKey)) {\r
CheckDlgButton(nControlID, BST_UNCHECKED);\r
}\r
}\r
}\r
// only for Toggle Imput Method Editor C-o: Canna mode\r
if (bSaveAndValidate) { // GetDialogData\r
- int nCommandType = CONTROL;\r
+ int nType = CONTROL;\r
int nKey = 'O';\r
- if (CProfile::GetCommandID(m_pProperties->GetApplicationID(), nCommandType, nKey) == 0) {\r
+ if (CProfile::GetCommandID(m_pProperties->GetApplicationID(), nType, nKey) == 0) {\r
if (IsDlgButtonChecked(IDC_CO2)) {\r
- for (int nCommandID = 0; nCommandID < MAX_COMMAND; ++nCommandID) {\r
- CString szCommandName = CCommands::GetCommandName(nCommandID);\r
+ for (int nComID = 0; nComID < MAX_COMMAND; ++nComID) {\r
+ CString szCommandName = CCommands::GetCommandName(nComID);\r
if (szCommandName.IsEmpty()) {\r
break;\r
}\r
if (!szCommandName.CompareNoCase(_T("toggle-input-method"))) {\r
- CProfile::SetCommandID(m_pProperties->GetApplicationID(), nCommandType, nKey, nCommandID);\r
- CProfile::SetCommandID(m_pProperties->GetApplicationID(), CONTROL+SHIFT, nKey, nCommandID);\r
+ CProfile::SetCommandID(m_pProperties->GetApplicationID(), nType, nKey, nComID);\r
+ CProfile::SetCommandID(m_pProperties->GetApplicationID(), CONTROL+SHIFT, nKey, nComID);\r
break;\r
}\r
}\r
\r
void CPropertiesBasic::Changed(int nObjectID)\r
{\r
- for (int nCommandID = 0; nCommandID < MAX_COMMAND; ++nCommandID) {\r
- CString szCommandName = CCommands::GetCommandName(nCommandID);\r
+ for (int nComID = 0; nComID < MAX_COMMAND; ++nComID) {\r
+ CString szCommandName = CCommands::GetCommandName(nComID);\r
if (szCommandName.IsEmpty()) {\r
break;\r
}\r
\r
for (int i = 0; ; ++i) {\r
- if (CCommands::GetDefaultCommandKey(nCommandID, i) == 0) {\r
+ if (CCommands::GetDefaultCommandKey(nComID, i) == 0) {\r
break;\r
}\r
\r
- int nControlID = CCommands::GetDefaultControlID(nCommandID, i);\r
+ int nControlID = CCommands::GetDefaultControlID(nComID, i);\r
if ((nControlID == nObjectID)\r
|| ((nObjectID == IDC_CO) && (nControlID == IDC_CO2))\r
|| ((nObjectID == IDC_CO2) && (nControlID == IDC_CO))) {\r
- m_bChanged[nCommandID] = TRUE;\r
+ m_bChanged[nComID] = TRUE;\r
}\r
}\r
}\r
{\r
BOOL bEnable = m_pProperties->IsEnableControl();\r
\r
- for (int nCommandID = 0; nCommandID < MAX_COMMAND; ++nCommandID) {\r
- CString szCommandName = CCommands::GetCommandName(nCommandID);\r
+ for (int nComID = 0; nComID < MAX_COMMAND; ++nComID) {\r
+ CString szCommandName = CCommands::GetCommandName(nComID);\r
if (szCommandName.IsEmpty()) {\r
break;\r
}\r
\r
for (int i = 0; ; ++i) {\r
- int nKey = CCommands::GetDefaultCommandKey(nCommandID, i);\r
- int nControlID = CCommands::GetDefaultControlID(nCommandID, i);\r
+ int nKey = CCommands::GetDefaultCommandKey(nComID, i);\r
+ int nControlID = CCommands::GetDefaultControlID(nComID, i);\r
if (nKey == 0) {\r
break;\r
}\r
CPropertyPage::OnInitDialog();\r
\r
if (m_ToolTip.Create(this)) {\r
- for (int nCommandID = 0; nCommandID < MAX_COMMAND; ++nCommandID) {\r
- CString szCommandName = CCommands::GetCommandName(nCommandID);\r
+ for (int nComID = 0; nComID < MAX_COMMAND; ++nComID) {\r
+ CString szCommandName = CCommands::GetCommandName(nComID);\r
if (szCommandName.IsEmpty()) {\r
break;\r
}\r
\r
for (int i = 0; ; ++i) {\r
- int nKey = CCommands::GetDefaultCommandKey(nCommandID, i);\r
- int nControlID = CCommands::GetDefaultControlID(nCommandID, i);\r
+ int nKey = CCommands::GetDefaultCommandKey(nComID, i);\r
+ int nControlID = CCommands::GetDefaultControlID(nComID, i);\r
if (nKey == 0) {\r
break;\r
}\r
if (GetDlgItem(nControlID)) {\r
- m_ToolTip.AddTool(GetDlgItem(nControlID), CString(MAKEINTRESOURCE(CCommands::GetToolTipID(nCommandID))));\r
+ m_ToolTip.AddTool(GetDlgItem(nControlID), CString(MAKEINTRESOURCE(CCommands::GetToolTipID(nComID))));\r
}\r
}\r
}\r
m_nCommandWidth = 0;\r
m_nKeyWidth = 0;\r
\r
- for (int nCommandID = 1; nCommandID < MAX_COMMAND; ++nCommandID) {\r
- CString szCommandName = CCommands::GetCommandName(nCommandID);\r
+ for (int nComID = 1; nComID < MAX_COMMAND; ++nComID) {\r
+ CString szCommandName = CCommands::GetCommandName(nComID);\r
if (szCommandName.IsEmpty()) {\r
break;\r
}\r
\r
- CString szCategory(MAKEINTRESOURCE(CCommands::GetCategoryID(nCommandID)));\r
+ CString szCategory(MAKEINTRESOURCE(CCommands::GetCategoryID(nComID)));\r
if (szCategory.IsEmpty()) {\r
continue;\r
}\r
\r
BOOL bInserted = FALSE;\r
- for (int nCommandType = 0; nCommandType < MAX_COMMAND_TYPE; ++nCommandType) {\r
+ for (int nType = 0; nType < MAX_COMMAND_TYPE; ++nType) {\r
for (int nKey = 0; nKey < MAX_KEY; ++nKey) {\r
- if (nCommandID == CProfile::GetCommandID(m_pProperties->GetApplicationID(), nCommandType, nKey)) {\r
+ if (nComID == CProfile::GetCommandID(m_pProperties->GetApplicationID(), nType, nKey)) {\r
CString szKey;\r
- szKey.Format(_T("%s%s"), CProfile::CommandType2String(nCommandType), CProfile::Key2String(nKey));\r
+ szKey.Format(_T("%s%s"), CProfile::CommandType2String(nType), CProfile::Key2String(nKey));\r
\r
InsertItem(szCategory, szCommandName, szKey);\r
\r
\r
BOOL CCommands::IsKillCommand(int (*nFunctionPointer)())\r
{\r
- for (int nCommandID = 1; nCommandID < MAX_COMMAND; ++nCommandID) {\r
- if (Commands[nCommandID].fCommand == nFunctionPointer) {\r
- return !_tcsncmp(Commands[nCommandID].szCommandName, _T("kill-"), 5);\r
+ for (int nComID = 1; nComID < MAX_COMMAND; ++nComID) {\r
+ if (Commands[nComID].fCommand == nFunctionPointer) {\r
+ return !_tcsncmp(Commands[nComID].szCommandName, _T("kill-"), 5);\r
}\r
}\r
return FALSE;\r
\r
void CCommands::PrintFunctionName(int (*nFunctionPointer)())\r
{\r
- for (int nCommandID = 1; nCommandID < MAX_COMMAND; ++nCommandID) {\r
- if (Commands[nCommandID].fCommand == nFunctionPointer) {\r
- CUtils::Log(_T("m_LastCommand: %s"), Commands[nCommandID].szCommandName);\r
+ for (int nComID = 1; nComID < MAX_COMMAND; ++nComID) {\r
+ if (Commands[nComID].fCommand == nFunctionPointer) {\r
+ CUtils::Log(_T("m_LastCommand: %s"), Commands[nComID].szCommandName);\r
}\r
}\r
}\r
return Reset(GOTO_HOOKX);\r
}\r
\r
-CString CCommands::GetCommandName(int nCommandID)\r
+CString CCommands::GetCommandName(int nComID)\r
{\r
- CString szCommandName(Commands[nCommandID].szCommandName);\r
+ CString szCommandName(Commands[nComID].szCommandName);\r
return szCommandName;\r
}\r
\r
-int CCommands::GetCategoryID(int nCommandID)\r
+int CCommands::GetCategoryID(int nComID)\r
{\r
- return Commands[nCommandID].nCategoryID;\r
+ return Commands[nComID].nCategoryID;\r
}\r
\r
-int CCommands::GetDescriptionID(int nCommandID)\r
+int CCommands::GetDescriptionID(int nComID)\r
{\r
- return Commands[nCommandID].nDescriptionID;\r
+ return Commands[nComID].nDescriptionID;\r
}\r
\r
-int CCommands::GetToolTipID(int nCommandID)\r
+int CCommands::GetToolTipID(int nComID)\r
{\r
- return Commands[nCommandID].nToolTipID;\r
+ return Commands[nComID].nToolTipID;\r
}\r
\r
-int CCommands::GetDefaultCommandType(int nCommandID, int nIndex)\r
+int CCommands::GetDefaultCommandType(int nComID, int nIndex)\r
{\r
- if (nCommandID < 0 || MAX_COMMAND <= nCommandID\r
+ if (nComID < 0 || MAX_COMMAND <= nComID\r
|| nIndex < 0 || MAX_KEY_BIND <= nIndex) {\r
ASSERT(0);\r
return NONE;\r
}\r
\r
- int nCommandType = Commands[nCommandID].keybind[nIndex].nCommandType;\r
- int bVk = Commands[nCommandID].keybind[nIndex].bVk;\r
+ int nType = Commands[nComID].keybind[nIndex].nType;\r
+ int bVk = Commands[nComID].keybind[nIndex].bVk;\r
\r
if (CXkeymacsDll::Is106Keyboard()) {\r
- if (nCommandType & SHIFT) { // Shift\r
+ if (nType & SHIFT) { // Shift\r
switch (bVk) {\r
case '2':\r
case '6':\r
case 0xBA: // VK_OEM_1 Used for miscellaneous characters; it can vary by keyboard. \r
// Windows 2000/XP: For the US standard keyboard, the ';:' key\r
- nCommandType &= ~SHIFT;\r
+ nType &= ~SHIFT;\r
break;\r
default:\r
break;\r
// Windows 2000/XP: For the US standard keyboard, the '`~' key\r
case 0xDE: // VK_OEM_7 Used for miscellaneous characters; it can vary by keyboard. \r
// Windows 2000/XP: For the US standard keyboard, the 'single-quote/double-quote' key\r
- nCommandType |= SHIFT;\r
+ nType |= SHIFT;\r
break;\r
default:\r
break;\r
}\r
}\r
\r
- return nCommandType;\r
+ return nType;\r
}\r
\r
-int CCommands::GetDefaultCommandKey(int nCommandID, int nIndex)\r
+int CCommands::GetDefaultCommandKey(int nComID, int nIndex)\r
{\r
- if (nCommandID < 0 || MAX_COMMAND <= nCommandID\r
+ if (nComID < 0 || MAX_COMMAND <= nComID\r
|| nIndex < 0 || MAX_KEY_BIND <= nIndex) {\r
ASSERT(0);\r
return 0;\r
}\r
\r
- int nCommandType = Commands[nCommandID].keybind[nIndex].nCommandType;\r
- int bVk = Commands[nCommandID].keybind[nIndex].bVk;\r
+ int nType = Commands[nComID].keybind[nIndex].nType;\r
+ int bVk = Commands[nComID].keybind[nIndex].bVk;\r
\r
if (CXkeymacsDll::Is106Keyboard()) {\r
- if (nCommandType & SHIFT) { // Shift\r
+ if (nType & SHIFT) { // Shift\r
switch (bVk) {\r
case '0':\r
bVk = '9';\r
return bVk;\r
}\r
\r
-int CCommands::GetDefaultControlID(int nCommandID, int nIndex)\r
+int CCommands::GetDefaultControlID(int nComID, int nIndex)\r
{\r
- if (nCommandID < 0 || MAX_COMMAND <= nCommandID\r
+ if (nComID < 0 || MAX_COMMAND <= nComID\r
|| nIndex < 0 || MAX_KEY_BIND <= nIndex) {\r
ASSERT(0);\r
return 0;\r
}\r
\r
- return Commands[nCommandID].keybind[nIndex].nControlID;\r
+ return Commands[nComID].keybind[nIndex].nControlID;\r
}\r
static int BackwardChar();\r
static int BeginningOfLine();\r
static int ForwardChar();\r
- static CString GetCommandName(int nCommandID);\r
- static int GetCategoryID(int nCommandID);\r
- static int GetDescriptionID(int nCommandID);\r
- static int GetToolTipID(int nCommandID);\r
- static int GetDefaultCommandType(int nCommandID, int nIndex);\r
- static int GetDefaultCommandKey(int nCommandID, int nIndex);\r
- static int GetDefaultControlID(int nCommandID, int nIndex);\r
+ static CString GetCommandName(int nComID);\r
+ static int GetCategoryID(int nComID);\r
+ static int GetDescriptionID(int nComID);\r
+ static int GetToolTipID(int nComID);\r
+ static int GetDefaultCommandType(int nComID, int nIndex);\r
+ static int GetDefaultCommandKey(int nComID, int nIndex);\r
+ static int GetDefaultControlID(int nComID, int nIndex);\r
static void DoSetInputMethodOpenStatus(INPUT_METHOD_OPEN_STATUS status, BOOL isComplete = FALSE);\r
\r
private:\r
return m_szDefinition;\r
}\r
\r
-void CFunctionDefinition::ClearKey(int nApplicationID)\r
+void CFunctionDefinition::ClearKey(int nAppID)\r
{\r
- if (nApplicationID < 0 || MAX_APP <= nApplicationID) {\r
+ if (nAppID < 0 || MAX_APP <= nAppID) {\r
return;\r
}\r
\r
- while (!m_oKey[nApplicationID].IsEmpty()) {\r
- KeyBind *pKeyBind = (KeyBind *)m_oKey[nApplicationID].GetHead();\r
+ while (!m_oKey[nAppID].IsEmpty()) {\r
+ KeyBind *pKeyBind = (KeyBind *)m_oKey[nAppID].GetHead();\r
delete pKeyBind;\r
pKeyBind = NULL;\r
- m_oKey[nApplicationID].RemoveHead();\r
+ m_oKey[nAppID].RemoveHead();\r
}\r
}\r
\r
-void CFunctionDefinition::SetKey(int nApplicationID, int nCommandType, int nKey)\r
+void CFunctionDefinition::SetKey(int nAppID, int nType, int nKey)\r
{\r
- if (nApplicationID < 0 || MAX_APP <= nApplicationID) {\r
+ if (nAppID < 0 || MAX_APP <= nAppID) {\r
return;\r
}\r
\r
KeyBind *pKeyBind = new KeyBind;\r
\r
if (pKeyBind) {\r
- pKeyBind->nCommandType = nCommandType;\r
+ pKeyBind->nType = nType;\r
pKeyBind->bVk = (BYTE)nKey;\r
pKeyBind->nControlID = 0;\r
\r
- m_oKey[nApplicationID].AddTail((CObject *)pKeyBind);\r
+ m_oKey[nAppID].AddTail((CObject *)pKeyBind);\r
}\r
}\r
catch (CMemoryException* e) {\r
}\r
}\r
\r
-int CFunctionDefinition::GetKeyNumber(int nApplicationID)\r
+int CFunctionDefinition::GetKeyNumber(int nAppID)\r
{\r
- if (nApplicationID < 0 || MAX_APP <= nApplicationID) {\r
+ if (nAppID < 0 || MAX_APP <= nAppID) {\r
return 0;\r
}\r
\r
- return m_oKey[nApplicationID].GetCount();\r
+ return m_oKey[nAppID].GetCount();\r
}\r
\r
-void CFunctionDefinition::GetKey(int nApplicationID, int nKeyID, int *pCommandType, int *pKey)\r
+void CFunctionDefinition::GetKey(int nAppID, int nKeyID, int *pCommandType, int *pKey)\r
{\r
*pCommandType = 0;\r
*pKey = 0;\r
\r
- if (nApplicationID < 0 || MAX_APP <= nApplicationID) {\r
+ if (nAppID < 0 || MAX_APP <= nAppID) {\r
return;\r
}\r
- if (nKeyID < 0 || m_oKey[nApplicationID].GetCount() <= nKeyID) {\r
+ if (nKeyID < 0 || m_oKey[nAppID].GetCount() <= nKeyID) {\r
return;\r
}\r
\r
- KeyBind *pKeyBind = (KeyBind *)m_oKey[nApplicationID].GetAt(m_oKey[nApplicationID].FindIndex(nKeyID));\r
- *pCommandType = pKeyBind->nCommandType;\r
+ KeyBind *pKeyBind = (KeyBind *)m_oKey[nAppID].GetAt(m_oKey[nAppID].FindIndex(nKeyID));\r
+ *pCommandType = pKeyBind->nType;\r
*pKey = pKeyBind->bVk;\r
}\r
\r
-void CFunctionDefinition::RemoveKey(int nApplicationID, int nCommandType, int nKey)\r
+void CFunctionDefinition::RemoveKey(int nAppID, int nType, int nKey)\r
{\r
- if (nApplicationID < 0 || MAX_APP <= nApplicationID) {\r
+ if (nAppID < 0 || MAX_APP <= nAppID) {\r
return;\r
}\r
\r
- for (POSITION pos = m_oKey[nApplicationID].GetHeadPosition(); pos; ) {\r
+ for (POSITION pos = m_oKey[nAppID].GetHeadPosition(); pos; ) {\r
POSITION currentPos = pos;\r
- KeyBind *pKeyBind = (KeyBind *)m_oKey[nApplicationID].GetNext(pos);\r
- if (pKeyBind->nCommandType == nCommandType && pKeyBind->bVk == nKey) {\r
+ KeyBind *pKeyBind = (KeyBind *)m_oKey[nAppID].GetNext(pos);\r
+ if (pKeyBind->nType == nType && pKeyBind->bVk == nKey) {\r
delete pKeyBind;\r
pKeyBind = NULL;\r
- m_oKey[nApplicationID].RemoveAt(currentPos);\r
+ m_oKey[nAppID].RemoveAt(currentPos);\r
break;\r
}\r
}\r
class AFX_EXT_CLASS CFunctionDefinition\r
{\r
public:\r
- void RemoveKey(int nApplicationID, int nCommandType, int nKey);\r
- void GetKey(int nApplicationID, int nKeyID, int *pCommandType, int *pKey);\r
- int GetKeyNumber(int nApplicationID);\r
- void SetKey(int nApplicationID, int nCommandType, int nKey);\r
- void ClearKey(int nApplicationID);\r
+ void RemoveKey(int nAppID, int nType, int nKey);\r
+ void GetKey(int nAppID, int nKeyID, int *pCommandType, int *pKey);\r
+ int GetKeyNumber(int nAppID);\r
+ void SetKey(int nAppID, int nType, int nKey);\r
+ void ClearKey(int nAppID);\r
CString GetDefinition();\r
CString GetSymbol();\r
void SetDefinition(CString szDefinition);\r
{\r
ASSERT(0 <= wParam && wParam <= UCHAR_MAX);\r
\r
- UINT nCommandType = NONE;\r
+ UINT nType = NONE;\r
BYTE nOrigKey = (BYTE)wParam;\r
\r
static BOOL bLocked = FALSE;\r
}\r
\r
// set command type\r
- nCommandType = IsDown(VK_SHIFT) * SHIFT | IsControl() * CONTROL | IsMeta() * META | CCommands::bC_x() * CONTROLX;\r
+ nType = IsDown(VK_SHIFT) * SHIFT | IsControl() * CONTROL | IsMeta() * META | CCommands::bC_x() * CONTROLX;\r
// Ignore undefined C-x ?\r
- if (nCommandType & CONTROLX) {\r
- if (Commands[m_Config.nCommandID[m_nApplicationID][nCommandType][nKey]].fCommand == NULL\r
- && m_Config.nFunctionID[m_nApplicationID][nCommandType][nKey] < 0) {\r
+ if (nType & CONTROLX) {\r
+ if (Commands[m_Config.nCommandID[m_nApplicationID][nType][nKey]].fCommand == NULL\r
+ && m_Config.nFunctionID[m_nApplicationID][nType][nKey] < 0) {\r
if (m_Config.bIgnoreUndefinedC_x[m_nApplicationID]) {\r
CCommands::Reset(GOTO_HOOK);\r
goto HOOK;\r
}\r
- nCommandType &= ~CONTROLX;\r
+ nType &= ~CONTROLX;\r
}\r
}\r
// Ignore undefined Meta Ctrl+?\r
- if (CCommands::bM_() && (nCommandType & CONTROL)) {\r
- if (Commands[m_Config.nCommandID[m_nApplicationID][nCommandType][nKey]].fCommand == NULL\r
- && m_Config.nFunctionID[m_nApplicationID][nCommandType][nKey] < 0) {\r
+ if (CCommands::bM_() && (nType & CONTROL)) {\r
+ if (Commands[m_Config.nCommandID[m_nApplicationID][nType][nKey]].fCommand == NULL\r
+ && m_Config.nFunctionID[m_nApplicationID][nType][nKey] < 0) {\r
if (m_Config.bIgnoreUndefinedMetaCtrl[m_nApplicationID]) {\r
if (CheckOriginal(CONTROL, nKey)) {\r
goto DO_NOTHING;\r
CCommands::Reset(GOTO_HOOK);\r
goto HOOK;\r
}\r
- nCommandType &= ~META;\r
+ nType &= ~META;\r
}\r
}\r
\r
goto DO_NOTHING;\r
}\r
\r
- if (Commands[m_Config.nCommandID[m_nApplicationID][nCommandType][nKey]].fCommand == CCommands::EnableOrDisableXKeymacs) {\r
+ if (Commands[m_Config.nCommandID[m_nApplicationID][nType][nKey]].fCommand == CCommands::EnableOrDisableXKeymacs) {\r
ToggleKeyboardHookState();\r
goto HOOK;\r
}\r
- if (Commands[m_Config.nCommandID[m_nApplicationID][nCommandType][nKey]].fCommand == CCommands::EnableXKeymacs) {\r
+ if (Commands[m_Config.nCommandID[m_nApplicationID][nType][nKey]].fCommand == CCommands::EnableXKeymacs) {\r
if (!m_bHook) {\r
ToggleKeyboardHookState();\r
}\r
goto HOOK;\r
}\r
- if (Commands[m_Config.nCommandID[m_nApplicationID][nCommandType][nKey]].fCommand == CCommands::DisableXKeymacs) {\r
+ if (Commands[m_Config.nCommandID[m_nApplicationID][nType][nKey]].fCommand == CCommands::DisableXKeymacs) {\r
if (m_bHook) {\r
ToggleKeyboardHookState();\r
}\r
\r
if (lParam & BEING_RELEASED) {\r
// ignore\r
- } else if (Commands[m_Config.nCommandID[m_nApplicationID][nCommandType][nKey]].fCommand == CCommands::BackwardChar) {\r
+ } else if (Commands[m_Config.nCommandID[m_nApplicationID][nType][nKey]].fCommand == CCommands::BackwardChar) {\r
if (index) {\r
--index;\r
}\r
goto HOOKX;\r
- } else if (Commands[m_Config.nCommandID[m_nApplicationID][nCommandType][nKey]].fCommand == CCommands::BeginningOfLine) {\r
+ } else if (Commands[m_Config.nCommandID[m_nApplicationID][nType][nKey]].fCommand == CCommands::BeginningOfLine) {\r
index = 0;\r
goto HOOKX;\r
- } else if (Commands[m_Config.nCommandID[m_nApplicationID][nCommandType][nKey]].fCommand == CCommands::DeleteBackwardChar) {\r
+ } else if (Commands[m_Config.nCommandID[m_nApplicationID][nType][nKey]].fCommand == CCommands::DeleteBackwardChar) {\r
if (index) {\r
--index;\r
memmove(&szPath[index], &szPath[index + 1], _tcslen(szPath) - index);\r
SetM_xTip(szPath);\r
}\r
goto HOOKX;\r
- } else if (Commands[m_Config.nCommandID[m_nApplicationID][nCommandType][nKey]].fCommand == CCommands::DeleteChar) {\r
+ } else if (Commands[m_Config.nCommandID[m_nApplicationID][nType][nKey]].fCommand == CCommands::DeleteChar) {\r
if (index < _tcslen(szPath)) {\r
memmove(&szPath[index], &szPath[index + 1], _tcslen(szPath) - index);\r
SetM_xTip(szPath);\r
}\r
goto HOOKX;\r
- } else if (Commands[m_Config.nCommandID[m_nApplicationID][nCommandType][nKey]].fCommand == CCommands::EndOfLine) {\r
+ } else if (Commands[m_Config.nCommandID[m_nApplicationID][nType][nKey]].fCommand == CCommands::EndOfLine) {\r
index = _tcslen(szPath);\r
goto HOOKX;\r
- } else if (Commands[m_Config.nCommandID[m_nApplicationID][nCommandType][nKey]].fCommand == CCommands::ForwardChar) {\r
+ } else if (Commands[m_Config.nCommandID[m_nApplicationID][nType][nKey]].fCommand == CCommands::ForwardChar) {\r
if (index < _tcslen(szPath)) {\r
++index;\r
}\r
goto HOOKX;\r
- } else if (Commands[m_Config.nCommandID[m_nApplicationID][nCommandType][nKey]].fCommand == CCommands::KeyboardQuit) {\r
+ } else if (Commands[m_Config.nCommandID[m_nApplicationID][nType][nKey]].fCommand == CCommands::KeyboardQuit) {\r
CCommands::bM_x(FALSE);\r
index = 0;\r
memset(szPath, 0, sizeof(szPath));\r
goto HOOK;\r
} else if (nKey == VK_RETURN\r
- || Commands[m_Config.nCommandID[m_nApplicationID][nCommandType][nKey]].fCommand == CCommands::Newline) {\r
+ || Commands[m_Config.nCommandID[m_nApplicationID][nType][nKey]].fCommand == CCommands::Newline) {\r
InvokeM_x(szPath);\r
\r
CCommands::bM_x(FALSE);\r
}\r
\r
if (CCommands::bC_u()) {\r
- if ((nCommandType == NONE) && ('0' <= nKey) && (nKey <= '9')) {\r
+ if ((nType == NONE) && ('0' <= nKey) && (nKey <= '9')) {\r
CCommands::NumericArgument(nKey - '0');\r
goto HOOK0_9;\r
}\r
- if ((nCommandType == NONE) && (nKey == 0xBD)) {\r
+ if ((nType == NONE) && (nKey == 0xBD)) {\r
CCommands::NumericArgumentMinus();\r
goto HOOK0_9;\r
}\r
}\r
\r
- if (Commands[m_Config.nCommandID[m_nApplicationID][nCommandType & ~CONTROL][nKey]].fCommand == CCommands::OneShotModifierCtrl) {\r
+ if (Commands[m_Config.nCommandID[m_nApplicationID][nType & ~CONTROL][nKey]].fCommand == CCommands::OneShotModifierCtrl) {\r
nOneShotModifier[nKey] = VK_CONTROL;\r
DepressKey(VK_CONTROL);\r
bCherryOneShotModifier = TRUE;\r
goto HOOK;\r
- } else if (Commands[m_Config.nCommandID[m_nApplicationID][nCommandType][nKey]].fCommand == CCommands::OneShotModifierCtrlRepeat) {\r
+ } else if (Commands[m_Config.nCommandID[m_nApplicationID][nType][nKey]].fCommand == CCommands::OneShotModifierCtrlRepeat) {\r
nOneShotModifier[nKey] = VK_CONTROL;\r
DepressKey(VK_CONTROL);\r
bCherryOneShotModifier = TRUE;\r
goto HOOK;\r
- } else if (Commands[m_Config.nCommandID[m_nApplicationID][nCommandType & ~CONTROL][nKey]].fCommand == CCommands::OneShotModifierCtrlRepeat) {\r
+ } else if (Commands[m_Config.nCommandID[m_nApplicationID][nType & ~CONTROL][nKey]].fCommand == CCommands::OneShotModifierCtrlRepeat) {\r
ReleaseKey(VK_CONTROL);\r
bCherryOneShotModifier = FALSE;\r
Kdu(nKey);\r
goto HOOK;\r
- } else if (Commands[m_Config.nCommandID[m_nApplicationID][nCommandType & ~META][nKey]].fCommand == CCommands::OneShotModifierAlt) {\r
+ } else if (Commands[m_Config.nCommandID[m_nApplicationID][nType & ~META][nKey]].fCommand == CCommands::OneShotModifierAlt) {\r
nOneShotModifier[nKey] = VK_MENU;\r
DepressKey(VK_MENU);\r
bCherryOneShotModifier = TRUE;\r
goto HOOK;\r
- } else if (Commands[m_Config.nCommandID[m_nApplicationID][nCommandType][nKey]].fCommand == CCommands::OneShotModifierAltRepeat) {\r
+ } else if (Commands[m_Config.nCommandID[m_nApplicationID][nType][nKey]].fCommand == CCommands::OneShotModifierAltRepeat) {\r
nOneShotModifier[nKey] = VK_MENU;\r
DepressKey(VK_MENU);\r
bCherryOneShotModifier = TRUE;\r
goto HOOK;\r
- } else if (Commands[m_Config.nCommandID[m_nApplicationID][nCommandType & ~META][nKey]].fCommand == CCommands::OneShotModifierAltRepeat) {\r
+ } else if (Commands[m_Config.nCommandID[m_nApplicationID][nType & ~META][nKey]].fCommand == CCommands::OneShotModifierAltRepeat) {\r
ReleaseKey(VK_MENU);\r
bCherryOneShotModifier = FALSE;\r
Kdu(nKey);\r
goto HOOK;\r
- } else if (Commands[m_Config.nCommandID[m_nApplicationID][nCommandType & ~SHIFT][nKey]].fCommand == CCommands::OneShotModifierShift) {\r
+ } else if (Commands[m_Config.nCommandID[m_nApplicationID][nType & ~SHIFT][nKey]].fCommand == CCommands::OneShotModifierShift) {\r
nOneShotModifier[nKey] = VK_SHIFT;\r
DepressKey(VK_SHIFT);\r
bCherryOneShotModifier = TRUE;\r
goto HOOK;\r
- } else if (Commands[m_Config.nCommandID[m_nApplicationID][nCommandType][nKey]].fCommand == CCommands::OneShotModifierShiftRepeat) {\r
+ } else if (Commands[m_Config.nCommandID[m_nApplicationID][nType][nKey]].fCommand == CCommands::OneShotModifierShiftRepeat) {\r
nOneShotModifier[nKey] = VK_SHIFT;\r
DepressKey(VK_SHIFT);\r
bCherryOneShotModifier = TRUE;\r
goto HOOK;\r
- } else if (Commands[m_Config.nCommandID[m_nApplicationID][nCommandType & ~SHIFT][nKey]].fCommand == CCommands::OneShotModifierShiftRepeat) {\r
+ } else if (Commands[m_Config.nCommandID[m_nApplicationID][nType & ~SHIFT][nKey]].fCommand == CCommands::OneShotModifierShiftRepeat) {\r
ReleaseKey(VK_SHIFT);\r
bCherryOneShotModifier = FALSE;\r
Kdu(nKey);\r
}\r
}\r
\r
- if (0 <= m_Config.nFunctionID[m_nApplicationID][nCommandType][nKey]\r
- && m_Config.nFunctionID[m_nApplicationID][nCommandType][nKey] < MAX_FUNCTION\r
- && _tcslen(m_Config.szFunctionDefinition[m_Config.nFunctionID[m_nApplicationID][nCommandType][nKey]])) {\r
- CallFunction(m_Config.nFunctionID[m_nApplicationID][nCommandType][nKey]);\r
+ if (0 <= m_Config.nFunctionID[m_nApplicationID][nType][nKey]\r
+ && m_Config.nFunctionID[m_nApplicationID][nType][nKey] < MAX_FUNCTION\r
+ && _tcslen(m_Config.szFunctionDefinition[m_Config.nFunctionID[m_nApplicationID][nType][nKey]])) {\r
+ CallFunction(m_Config.nFunctionID[m_nApplicationID][nType][nKey]);\r
CCommands::Reset(GOTO_HOOK);\r
goto HOOK;\r
}\r
\r
- if (!Commands[m_Config.nCommandID[m_nApplicationID][nCommandType][nKey]].fCommand) {\r
+ if (!Commands[m_Config.nCommandID[m_nApplicationID][nType][nKey]].fCommand) {\r
if (nOrigKey == VK_CONTROL || nOrigKey == VK_MENU || nOrigKey == VK_SHIFT) {\r
goto DO_NOTHING;\r
}\r
\r
- if (!(nCommandType & SHIFT)) {\r
+ if (!(nType & SHIFT)) {\r
if (CCommands::IsSetMark()) {\r
- if (CCommands::MoveCaret(nKey, nCommandType & CONTROL) != CONTINUE) {\r
+ if (CCommands::MoveCaret(nKey, nType & CONTROL) != CONTINUE) {\r
CCommands::ClearNumericArgument();\r
goto HOOK;\r
}\r
}\r
\r
if (CCommands::IsTemporarilyDisableXKeymacs()\r
- && Commands[m_Config.nCommandID[m_nApplicationID][nCommandType][nKey]].fCommand != CCommands::KeyboardQuit) {\r
+ && Commands[m_Config.nCommandID[m_nApplicationID][nType][nKey]].fCommand != CCommands::KeyboardQuit) {\r
CCommands::SetTemporarilyDisableXKeymacs(FALSE);\r
goto DO_NOTHING;\r
}\r
\r
if (!bLocked) {\r
bLocked = TRUE;\r
- fCommand = Commands[m_Config.nCommandID[m_nApplicationID][nCommandType][nKey]].fCommand;\r
+ fCommand = Commands[m_Config.nCommandID[m_nApplicationID][nType][nKey]].fCommand;\r
RECURSIVE_COMMAND:\r
switch (fCommand()) {\r
case GOTO_DO_NOTHING:\r
SendIconMessage(msg, 6);\r
}\r
\r
-void CXkeymacsDll::SetApplicationName(int nApplicationID, CString szApplicationName)\r
+void CXkeymacsDll::SetApplicationName(int nAppID, CString szApplicationName)\r
{\r
- ZeroMemory(m_Config.szSpecialApp[nApplicationID], CLASS_NAME_LENGTH);\r
- _tcsncpy_s(m_Config.szSpecialApp[nApplicationID], szApplicationName, _TRUNCATE);\r
+ ZeroMemory(m_Config.szSpecialApp[nAppID], CLASS_NAME_LENGTH);\r
+ _tcsncpy_s(m_Config.szSpecialApp[nAppID], szApplicationName, _TRUNCATE);\r
}\r
\r
-void CXkeymacsDll::SetWindowText(int nApplicationID, CString szWindowText)\r
+void CXkeymacsDll::SetWindowText(int nAppID, CString szWindowText)\r
{\r
- ZeroMemory(m_Config.szWindowText[nApplicationID], WINDOW_TEXT_LENGTH);\r
- _tcsncpy_s(m_Config.szWindowText[nApplicationID], szWindowText, _TRUNCATE);\r
+ ZeroMemory(m_Config.szWindowText[nAppID], WINDOW_TEXT_LENGTH);\r
+ _tcsncpy_s(m_Config.szWindowText[nAppID], szWindowText, _TRUNCATE);\r
}\r
\r
-void CXkeymacsDll::SetCommandID(int nApplicationID, int nCommandType, int nKey, int nCommandID)\r
+void CXkeymacsDll::SetCommandID(int nAppID, int nType, int nKey, int nComID)\r
{\r
- m_Config.nCommandID[nApplicationID][nCommandType][nKey] = nCommandID;\r
+ m_Config.nCommandID[nAppID][nType][nKey] = nComID;\r
}\r
\r
-void CXkeymacsDll::SetKillRingMax(int nApplicationID, int nKillRingMax)\r
+void CXkeymacsDll::SetKillRingMax(int nAppID, int nKillRingMax)\r
{\r
- m_Config.nKillRingMax[nApplicationID] = nKillRingMax;\r
+ m_Config.nKillRingMax[nAppID] = nKillRingMax;\r
}\r
\r
-void CXkeymacsDll::SetUseDialogSetting(int nApplicationID, BOOL bUseDialogSetting)\r
+void CXkeymacsDll::SetUseDialogSetting(int nAppID, BOOL bUseDialogSetting)\r
{\r
- m_Config.bUseDialogSetting[nApplicationID] = bUseDialogSetting;\r
+ m_Config.bUseDialogSetting[nAppID] = bUseDialogSetting;\r
}\r
\r
-// Clear data of nApplicationID\r
-void CXkeymacsDll::Clear(int nApplicationID)\r
+// Clear data of nAppID\r
+void CXkeymacsDll::Clear(int nAppID)\r
{\r
- if (0 <= nApplicationID && nApplicationID < MAX_APP) {\r
- ZeroMemory(m_Config.szSpecialApp[nApplicationID], sizeof(m_Config.szSpecialApp[nApplicationID]));\r
- ZeroMemory(m_Config.nCommandID[nApplicationID], sizeof(m_Config.nCommandID[nApplicationID]));\r
- m_Config.nKillRingMax[nApplicationID] = 0;\r
- m_Config.bUseDialogSetting[nApplicationID] = FALSE;\r
- m_Config.nSettingStyle[nApplicationID] = 0;\r
+ if (0 <= nAppID && nAppID < MAX_APP) {\r
+ ZeroMemory(m_Config.szSpecialApp[nAppID], sizeof(m_Config.szSpecialApp[nAppID]));\r
+ ZeroMemory(m_Config.nCommandID[nAppID], sizeof(m_Config.nCommandID[nAppID]));\r
+ m_Config.nKillRingMax[nAppID] = 0;\r
+ m_Config.bUseDialogSetting[nAppID] = FALSE;\r
+ m_Config.nSettingStyle[nAppID] = 0;\r
} else {\r
ASSERT(0);\r
}\r
return pSnap->GetNext();\r
}\r
\r
-void CXkeymacsDll::SetOriginal(UINT nCommandType, BYTE bVk)\r
+void CXkeymacsDll::SetOriginal(UINT nType, BYTE bVk)\r
{\r
- m_nOriginal[nCommandType & ~SHIFT][bVk]++;\r
+ m_nOriginal[nType & ~SHIFT][bVk]++;\r
}\r
\r
-int CXkeymacsDll::CheckOriginal(UINT nCommandType, BYTE bVk)\r
+int CXkeymacsDll::CheckOriginal(UINT nType, BYTE bVk)\r
{\r
- nCommandType &= ~SHIFT;\r
- if (m_nOriginal[nCommandType][bVk])\r
- return m_nOriginal[nCommandType][bVk]--;\r
+ nType &= ~SHIFT;\r
+ if (m_nOriginal[nType][bVk])\r
+ return m_nOriginal[nType][bVk]--;\r
return 0;\r
}\r
\r
m_nKillRing += nKillRing;\r
}\r
\r
-void CXkeymacsDll::SetSettingStyle(int nApplicationID, int nSettingStyle)\r
+void CXkeymacsDll::SetSettingStyle(int nAppID, int nSettingStyle)\r
{\r
- m_Config.nSettingStyle[nApplicationID] = nSettingStyle;\r
+ m_Config.nSettingStyle[nAppID] = nSettingStyle;\r
}\r
\r
-void CXkeymacsDll::SetIgnoreUndefinedMetaCtrl(int nApplicationID, BOOL bIgnoreUndefinedMetaCtrl)\r
+void CXkeymacsDll::SetIgnoreUndefinedMetaCtrl(int nAppID, BOOL bIgnoreUndefinedMetaCtrl)\r
{\r
- m_Config.bIgnoreUndefinedMetaCtrl[nApplicationID] = bIgnoreUndefinedMetaCtrl;\r
+ m_Config.bIgnoreUndefinedMetaCtrl[nAppID] = bIgnoreUndefinedMetaCtrl;\r
}\r
\r
-void CXkeymacsDll::SetIgnoreUndefinedC_x(int nApplicationID, BOOL bIgnoreUndefinedC_x)\r
+void CXkeymacsDll::SetIgnoreUndefinedC_x(int nAppID, BOOL bIgnoreUndefinedC_x)\r
{\r
- m_Config.bIgnoreUndefinedC_x[nApplicationID] = bIgnoreUndefinedC_x;\r
+ m_Config.bIgnoreUndefinedC_x[nAppID] = bIgnoreUndefinedC_x;\r
}\r
\r
-void CXkeymacsDll::SetEnableCUA(int nApplicationID, BOOL bEnableCUA)\r
+void CXkeymacsDll::SetEnableCUA(int nAppID, BOOL bEnableCUA)\r
{\r
- m_Config.bEnableCUA[nApplicationID] = bEnableCUA;\r
+ m_Config.bEnableCUA[nAppID] = bEnableCUA;\r
}\r
\r
BOOL CXkeymacsDll::GetEnableCUA()\r
return CONTINUE;\r
}\r
\r
-void CXkeymacsDll::SetFunctionKey(int nFunctionID, int nApplicationID, int nCommandType, int nKey)\r
+void CXkeymacsDll::SetFunctionKey(int nFuncID, int nAppID, int nType, int nKey)\r
{\r
- if (nApplicationID < 0 || MAX_APP <= nApplicationID\r
- || nCommandType < 0 || MAX_COMMAND_TYPE <= nCommandType\r
+ if (nAppID < 0 || MAX_APP <= nAppID\r
+ || nType < 0 || MAX_COMMAND_TYPE <= nType\r
|| nKey < 0 || MAX_KEY <= nKey) {\r
return;\r
}\r
\r
- m_Config.nFunctionID[nApplicationID][nCommandType][nKey] = nFunctionID;\r
+ m_Config.nFunctionID[nAppID][nType][nKey] = nFuncID;\r
}\r
\r
void CXkeymacsDll::ClearFunctionDefinition()\r
memset(m_Config.szFunctionDefinition, 0, sizeof(m_Config.szFunctionDefinition));\r
}\r
\r
-void CXkeymacsDll::SetFunctionDefinition(int nFunctionID, CString szDefinition)\r
+void CXkeymacsDll::SetFunctionDefinition(int nFuncID, CString szDefinition)\r
{\r
- if (nFunctionID < 0 || nFunctionID >= MAX_FUNCTION)\r
+ if (nFuncID < 0 || nFuncID >= MAX_FUNCTION)\r
return;\r
- memset(m_Config.szFunctionDefinition[nFunctionID], 0, sizeof(m_Config.szFunctionDefinition[nFunctionID]));\r
- _tcscpy_s(m_Config.szFunctionDefinition[nFunctionID], szDefinition);\r
+ memset(m_Config.szFunctionDefinition[nFuncID], 0, sizeof(m_Config.szFunctionDefinition[nFuncID]));\r
+ _tcscpy_s(m_Config.szFunctionDefinition[nFuncID], szDefinition);\r
return;\r
}\r
\r
// call an original command which is defined in dot.xkeymacs\r
-void CXkeymacsDll::CallFunction(int nFunctionID)\r
+void CXkeymacsDll::CallFunction(int nFuncID)\r
{\r
- if (nFunctionID < 0 || nFunctionID >= MAX_FUNCTION)\r
+ if (nFuncID < 0 || nFuncID >= MAX_FUNCTION)\r
return;\r
- LPCTSTR def = m_Config.szFunctionDefinition[nFunctionID];\r
+ LPCTSTR def = m_Config.szFunctionDefinition[nFuncID];\r
if (!def[0])\r
return;\r
std::vector<KeyBind> keybinds;\r
UINT before = GetModifierState(FALSE);\r
\r
for (std::vector<KeyBind>::const_iterator p = keybinds.begin(); p != keybinds.end(); p++) {\r
- const int nCommandType = p->nCommandType;\r
+ const int nType = p->nType;\r
const BYTE bVk = p->bVk;\r
- int (*fCommand)() = nCommandType < MAX_COMMAND_TYPE ? Commands[m_Config.nCommandID[m_nApplicationID][nCommandType][bVk]].fCommand : NULL;\r
+ int (*fCommand)() = nType < MAX_COMMAND_TYPE ? Commands[m_Config.nCommandID[m_nApplicationID][nType][bVk]].fCommand : NULL;\r
if (fCommand) {\r
if (fCommand == CCommands::ExecuteExtendedCommand)\r
bM_x = TRUE;\r
SetModifierState(0, before);\r
bInitialized = TRUE;\r
}\r
-// CUtils::Log("CallFunction: Command Name: %s", Commands[m_Config.nCommandID[m_nApplicationID][nCommandType][bVk]].szCommandName);\r
+// CUtils::Log("CallFunction: Command Name: %s", Commands[m_Config.nCommandID[m_nApplicationID][nType][bVk]].szCommandName);\r
while (fCommand() == GOTO_RECURSIVE)\r
;\r
continue;\r
else if (bVk != 0) {\r
TCHAR nAscii = 0;\r
do { // 1-127\r
- if (a2v(++nAscii) == bVk && ((nCommandType & SHIFT) != 0) == IsShift(nAscii)) {\r
+ if (a2v(++nAscii) == bVk && ((nType & SHIFT) != 0) == IsShift(nAscii)) {\r
// CUtils::Log("M-x: %#X (%c), %#X (%c)", bVk, bVk, nAscii, nAscii);\r
szPath[index++] = nAscii;\r
break;\r
SetModifierState(0, before);\r
bInitialized = TRUE;\r
}\r
- if (nCommandType & WIN_WIN)\r
+ if (nType & WIN_WIN)\r
DepressKey(VK_LWIN);\r
- if (nCommandType & WIN_CTRL)\r
+ if (nType & WIN_CTRL)\r
DepressKey(VK_CONTROL);\r
- if (nCommandType & WIN_ALT)\r
+ if (nType & WIN_ALT)\r
DepressKey(VK_MENU);\r
- if (nCommandType & SHIFT)\r
+ if (nType & SHIFT)\r
DepressKey(VK_SHIFT);\r
Kdu(bVk);\r
- const int nNextType = (p + 1) != keybinds.end() ? (p + 1)->nCommandType : 0;\r
- if (nCommandType & SHIFT && !(nNextType & SHIFT))\r
+ const int nNextType = (p + 1) != keybinds.end() ? (p + 1)->nType : 0;\r
+ if (nType & SHIFT && !(nNextType & SHIFT))\r
ReleaseKey(VK_SHIFT);\r
- if (nCommandType & WIN_ALT && !(nNextType & WIN_ALT))\r
+ if (nType & WIN_ALT && !(nNextType & WIN_ALT))\r
ReleaseKey(VK_MENU);\r
- if (nCommandType & WIN_CTRL && !(nNextType & WIN_CTRL))\r
+ if (nType & WIN_CTRL && !(nNextType & WIN_CTRL))\r
ReleaseKey(VK_CONTROL);\r
- if (nCommandType & WIN_WIN && !(nNextType & WIN_WIN))\r
+ if (nType & WIN_WIN && !(nNextType & WIN_WIN))\r
ReleaseKey(VK_LWIN);\r
}\r
\r
for (int i = 0; i < MAX_MODIFIER; i++) {\r
size_t len = _tcslen(Modifiers[i].name);\r
if (!_tcsncmp(def, Modifiers[i].name, len)) {\r
- keybind.nCommandType |= Modifiers[i].id;\r
+ keybind.nType |= Modifiers[i].id;\r
def += len;\r
goto LOOP;\r
}\r
}\r
}\r
- if (IsShift(*def) && !(keybind.nCommandType & (WIN_CTRL | WIN_ALT | WIN_WIN)))\r
- keybind.nCommandType |= SHIFT;\r
+ if (IsShift(*def) && !(keybind.nType & (WIN_CTRL | WIN_ALT | WIN_WIN)))\r
+ keybind.nType |= SHIFT;\r
int i = 0;\r
for (; i < MAX_KEYNAME; i++) {\r
size_t len = _tcslen(KeyNames[i].name);\r
}\r
}\r
\r
-void CXkeymacsDll::Set326Compatible(int nApplicationID, BOOL b326Compatible)\r
+void CXkeymacsDll::Set326Compatible(int nAppID, BOOL b326Compatible)\r
{\r
- m_Config.b326Compatible[nApplicationID] = b326Compatible;\r
+ m_Config.b326Compatible[nAppID] = b326Compatible;\r
}\r
\r
BOOL CXkeymacsDll::Get326Compatible()\r
\r
struct KeyBind\r
{\r
- int nCommandType;\r
+ int nType;\r
BYTE bVk;\r
int nControlID;\r
};\r
static BOOL LoadConfig();\r
static void SetM_xTip(const TCHAR *const szPath);\r
static BOOL Get326Compatible();\r
- static void Set326Compatible(int nApplicationID, BOOL b326Compatible);\r
+ static void Set326Compatible(int nAppID, BOOL b326Compatible);\r
static void SetCursorData(HCURSOR hEnable, HCURSOR hDisableTMP, HCURSOR hDisableWOCQ, HICON hDisable, BOOL bEnable);\r
static unsigned int GetMaxKeyInterval(void);\r
static void SetKeyboardSpeed(int nKeyboardSpeed);\r
static int GetAccelerate(void);\r
static void SetAccelerate(int nAccelerate);\r
- static void SetWindowText(int nApplicationID, CString szWindowText);\r
- static void SetKillRingMax(int nApplicationID, int nKillRingMax);\r
- static void Clear(int nApplicationID);\r
+ static void SetWindowText(int nAppID, CString szWindowText);\r
+ static void SetKillRingMax(int nAppID, int nKillRingMax);\r
+ static void Clear(int nAppID);\r
static BOOL IsKeyboardHook();\r
- static void SetCommandID(int nApplicationID, int nCommandType, int nKey, int nCommandID);\r
- static void SetApplicationName(int nApplicationID, CString szApplicationName);\r
+ static void SetCommandID(int nAppID, int nType, int nKey, int nComID);\r
+ static void SetApplicationName(int nAppID, CString szApplicationName);\r
static void ReleaseHooks();\r
- static void SetEnableCUA(int nApplicationID, BOOL bEnableCUA);\r
- static void SetIgnoreUndefinedC_x(int nApplicationID, BOOL bIgnoreUndefinedC_x);\r
- static void SetIgnoreUndefinedMetaCtrl(int nApplicationID, BOOL bIgnoreUndefinedMetaCtrl);\r
+ static void SetEnableCUA(int nAppID, BOOL bEnableCUA);\r
+ static void SetIgnoreUndefinedC_x(int nAppID, BOOL bIgnoreUndefinedC_x);\r
+ static void SetIgnoreUndefinedMetaCtrl(int nAppID, BOOL bIgnoreUndefinedMetaCtrl);\r
static void SetHooks();\r
static void ResetHooks();\r
- static void SetSettingStyle(int nApplicationID, int nSettingStyle);\r
- static void SetUseDialogSetting(int nApplicationID, BOOL bUseDialogSetting);\r
+ static void SetSettingStyle(int nAppID, int nSettingStyle);\r
+ static void SetUseDialogSetting(int nAppID, BOOL bUseDialogSetting);\r
static void AddKillRing(BOOL bNewData = TRUE);\r
static void CallMacro();\r
static void ClearFunctionDefinition();\r
static BOOL IsDown(BYTE bVk, BOOL bPhysicalKey = TRUE);\r
static void Kdu(BYTE bVk, DWORD n = 1, BOOL bOriginal = TRUE);\r
static void ReleaseKey(BYTE bVk);\r
- static void SetFunctionDefinition(int nFunctionID, CString szDefinition);\r
- static void SetFunctionKey(int nFunctionID, int nApplicationID, int nCommandType, int nKey);\r
+ static void SetFunctionDefinition(int nFuncID, CString szDefinition);\r
+ static void SetFunctionKey(int nFuncID, int nAppID, int nType, int nKey);\r
static BOOL Is106Keyboard();\r
static void Set106Keyboard(BOOL b106Keyboard);\r
static void ToggleKeyboardHookState();\r
static KeyBind ParseKey(LPCTSTR& def);\r
static BYTE a2v(TCHAR nAscii);\r
static BOOL IsShift(TCHAR nAscii);\r
- static void CallFunction(int nFunctionID);\r
+ static void CallFunction(int nFuncID);\r
static int IsPassThrough(BYTE nKey);\r
static BOOL IsDepressedShiftKeyOnly(BYTE nKey);\r
static BOOL IsDepressedModifier(int Modifier(), BOOL bPhysicalKey = TRUE);\r
static std::list<KbdMacro> m_Macro;\r
static BOOL m_bRecordingMacro;\r
static BOOL m_bDown[MAX_KEY];\r
- static void SetOriginal(UINT nCommandType, BYTE bVk);\r
- static int CheckOriginal(UINT nCommandType, BYTE bVk);\r
+ static void SetOriginal(UINT nType, BYTE bVk);\r
+ static int CheckOriginal(UINT nType, BYTE bVk);\r
static void InitKeyboardProc(BOOL bImeComposition);\r
static int m_nApplicationID;\r
static int m_nOriginal[MAX_COMMAND_TYPE][MAX_KEY];\r