\r
void CProfile::LevelUp()\r
{\r
- const int nCurrentLevel = AfxGetApp()->GetProfileInt(_T(""), _T("Level"), 0);\r
+ int nCurrentLevel = AfxGetApp()->GetProfileInt(_T(""), _T("Level"), 0);\r
for (int nAppID = 0; nAppID < MAX_APP; ++nAppID) {\r
CString entry;\r
entry.Format(IDS_REG_ENTRY_APPLICATION, nAppID);\r
AfxGetApp()->WriteProfileInt(_T(""), _T("Level"), 4);\r
}\r
\r
-void CProfile::AddKeyBind2C_(const LPCSTR szAppName, const BYTE bVk)\r
+void CProfile::AddKeyBind2C_(LPCSTR szAppName, BYTE bVk)\r
{\r
int nComID;\r
for (nComID = 0; nComID < MAX_COMMAND; ++nComID)\r
RegCloseKey(hKey);\r
} else {\r
// Set the default assignment\r
- for (int i = 0; const int nKey = CCommands::GetDefaultCommandKey(nComID, i); ++i) {\r
+ for (int i = 0; int nKey = CCommands::GetDefaultCommandKey(nComID, i); ++i) {\r
if (CCommands::GetDefaultControlID(nComID, i) == IDC_CO2)\r
continue;\r
- const int nType = CCommands::GetDefaultCommandType(nComID, i);\r
+ int nType = CCommands::GetDefaultCommandType(nComID, i);\r
m_Config.nCommandID[nAppID][nType][nKey] = nComID;\r
}\r
}\r
{\r
const CString section(MAKEINTRESOURCE(IDS_REG_SECTION_APPLICATION)); \r
for (int nAppID = 0; nAppID < MAX_APP; ++nAppID) {\r
- const LPCTSTR szAppName = m_Config.szSpecialApp[nAppID];\r
+ LPCTSTR szAppName = m_Config.szSpecialApp[nAppID];\r
CString entry;\r
entry.Format(IDS_REG_ENTRY_APPLICATION, nAppID);\r
if (!szAppName[0]) {\r
pApp->SendIPCMessage(XKEYMACS_RELOAD);\r
}\r
\r
-void CProfile::SaveKeyBind(const LPCTSTR appName, int comID, int type, int key)\r
+void CProfile::SaveKeyBind(LPCTSTR appName, int comID, int type, int key)\r
{\r
if (!comID)\r
return;\r
SaveKeyBind(appName, comName, type, key);\r
}\r
\r
-void CProfile::SaveKeyBind(const LPCTSTR appName, const LPCTSTR comName, int type, int key)\r
+void CProfile::SaveKeyBind(LPCTSTR appName, LPCTSTR comName, int type, int key)\r
{\r
CString subKey = CString(MAKEINTRESOURCE(IDS_REGSUBKEY_DATA)) + _T("\\") + appName + _T("\\") + comName;\r
CString s = KeyToString(type, key);\r
RegCloseKey(hKey);\r
}\r
\r
-void CProfile::StringToKey(const LPCTSTR str, int& type, int& key)\r
+void CProfile::StringToKey(LPCTSTR str, int& type, int& key)\r
{\r
m_KeyString.ToKey(str, type, key);\r
}\r
EnumWindows(EnumWindowsProc, reinterpret_cast<LPARAM>(&cProperties));\r
\r
for (int i = 0; i < MAX_APP; ++i) {\r
- const LPCTSTR szAppName = m_Config.szSpecialApp[i];\r
- const LPCTSTR szAppTitle = m_szAppTitle[i];\r
+ LPCTSTR szAppName = m_Config.szSpecialApp[i];\r
+ LPCTSTR szAppTitle = m_szAppTitle[i];\r
if (!szAppName[0] || !_tcscmp(szAppName, _T("IME")))\r
continue;\r
if (CString(MAKEINTRESOURCE(IDS_DEFAULT)) == szAppName ||\r
CloseHandle(hProcessSnap);\r
}\r
\r
-BOOL CALLBACK CProfile::EnumWindowsProc(const HWND hWnd, const LPARAM lParam)\r
+BOOL CALLBACK CProfile::EnumWindowsProc(HWND hWnd, LPARAM lParam)\r
{\r
CProperties *pProperties = reinterpret_cast<CProperties*>(lParam);\r
PTASK_LIST pTask = CProfile::m_TaskList;\r
bool CProfile::GetAppTitle(CString& appTitle, const CString& windowName, int nth)\r
{\r
const CString sep(MAKEINTRESOURCE(IDS_SEPARATE_WINDOWTITLE));\r
- const int nSep = windowName.Find(sep);\r
+ int nSep = windowName.Find(sep);\r
if (nSep < 0) {\r
appTitle = windowName;\r
return false;\r
\r
void CProfile::CopyData(const CString szDstApp, const CString szSrcApp)\r
{\r
- const int nDstApp = AssignAppID(szDstApp);\r
- const int nSrcApp = GetAppID(szSrcApp);\r
+ int nDstApp = AssignAppID(szDstApp);\r
+ int nSrcApp = GetAppID(szSrcApp);\r
if (nDstApp == MAX_APP || nSrcApp == MAX_APP)\r
return;\r
SetSettingStyle(nDstApp, SETTING_SPECIFIC);\r
#undef CopyMember\r
}\r
\r
-int CProfile::AssignAppID(const LPCSTR szAppName)\r
+int CProfile::AssignAppID(LPCSTR szAppName)\r
{\r
int nAppID = GetAppID(szAppName);\r
if (nAppID != MAX_APP)\r
return MAX_APP;\r
}\r
\r
-int CProfile::GetAppID(const LPCSTR szAppName)\r
+int CProfile::GetAppID(LPCSTR szAppName)\r
{\r
int nAppID = 0;\r
for (nAppID = 0; nAppID < MAX_APP; ++nAppID)\r
return nAppID;\r
}\r
\r
-int CProfile::GetSettingStyle(const int nAppID)\r
+int CProfile::GetSettingStyle(int nAppID)\r
{\r
if (nAppID == MAX_APP)\r
return SETTING_DEFAULT;\r
m_Config.nSettingStyle[nAppID] = static_cast<BYTE>(nSettingStyle);\r
}\r
\r
-void CProfile::SetAppTitle(const int nAppID, const CString& appTitle)\r
+void CProfile::SetAppTitle(int nAppID, const CString& appTitle)\r
{\r
_tcsncpy_s(m_szAppTitle[nAppID], appTitle, _TRUNCATE);\r
}\r
\r
-int CProfile::GetCommandID(const int nAppID, const int nType, const int nKey)\r
+int CProfile::GetCommandID(int nAppID, int nType, int nKey)\r
{\r
int nComID = m_Config.nCommandID[nAppID][nType][nKey];\r
if (nKey == 0xf0 && Commands[nComID].fCommand == CCommands::C_Eisu)\r
return nComID;\r
}\r
\r
-void CProfile::SetCommandID(const int nAppID, const int nType, const int nKey, int nComID)\r
+void CProfile::SetCommandID(int nAppID, int nType, int nKey, int nComID)\r
{\r
if (nKey == 0xf0 && Commands[nComID].fCommand == CCommands::C_)\r
// Change CommandID C_Eisu\r
m_Config.nCommandID[nAppID][nType][nKey] = static_cast<BYTE>(nComID);\r
}\r
\r
-BOOL CProfile::GetUseDialogSetting(const int nAppID)\r
+BOOL CProfile::GetUseDialogSetting(int nAppID)\r
{\r
return m_Config.bUseDialogSetting[nAppID];\r
}\r
\r
-void CProfile::SetUseDialogSetting(const int nAppID, const BOOL bUseDialogSetting)\r
+void CProfile::SetUseDialogSetting(int nAppID, BOOL bUseDialogSetting)\r
{\r
m_Config.bUseDialogSetting[nAppID] = static_cast<BYTE>(bUseDialogSetting);\r
}\r
\r
-BOOL CProfile::GetEnableCUA(const int nAppID)\r
+BOOL CProfile::GetEnableCUA(int nAppID)\r
{\r
return m_Config.bEnableCUA[nAppID];\r
}\r
\r
-void CProfile::SetEnableCUA(const int nAppID, const BOOL bEnableCUA)\r
+void CProfile::SetEnableCUA(int nAppID, BOOL bEnableCUA)\r
{\r
m_Config.bEnableCUA[nAppID] = static_cast<BYTE>(bEnableCUA);\r
}\r
\r
-int CProfile::GetKillRingMax(const int nAppID)\r
+int CProfile::GetKillRingMax(int nAppID)\r
{\r
return m_Config.nKillRingMax[nAppID];\r
}\r
\r
-void CProfile::SetKillRingMax(const int nAppID, const int nKillRingMax)\r
+void CProfile::SetKillRingMax(int nAppID, int nKillRingMax)\r
{\r
m_Config.nKillRingMax[nAppID] = static_cast<BYTE>(nKillRingMax > 255 ? 255 : nKillRingMax);\r
}\r
\r
-CString CProfile::GetWindowText(const int nAppID)\r
+CString CProfile::GetWindowText(int nAppID)\r
{\r
return m_Config.szWindowText[nAppID];\r
}\r
\r
-void CProfile::SetWindowText(const int nAppID, const CString szWindowText)\r
+void CProfile::SetWindowText(int nAppID, const CString szWindowText)\r
{\r
if (CUtils::GetWindowTextType(szWindowText) == IDS_WINDOW_TEXT_IGNORE)\r
_tcscpy_s(m_Config.szWindowText[nAppID], _T("*"));\r
\r
if (verInfo.dwPlatformId == VER_PLATFORM_WIN32_NT) {\r
HKEY hKey = NULL;\r
- CString szSubKey(_T("SYSTEM\\CurrentControlSet\\Services\\i8042prt\\Parameters"));\r
+ const CString szSubKey(_T("SYSTEM\\CurrentControlSet\\Services\\i8042prt\\Parameters"));\r
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, szSubKey, 0, KEY_QUERY_VALUE, &hKey) == ERROR_SUCCESS) {\r
static const CString szValueName(_T("OverrideKeyboardSubtype"));\r
if (RegQueryValueEx(hKey, szValueName, NULL, NULL, (LPBYTE)&subtype, &cbData) != ERROR_SUCCESS) {\r
static void InitAppList(CProperties& cProperties);\r
static void CopyData(CString szDestinationApplication, CString szSourceApplication);\r
static void ClearData(CString szCurrentApplication);\r
- static int AssignAppID(const LPCSTR szAppName);\r
+ static int AssignAppID(LPCSTR szAppName);\r
static int DefaultAppID();\r
- static int GetAppID(const LPCSTR szAppName);\r
- static int GetSettingStyle(const int nAppID);\r
- static void SetSettingStyle(const int nAppID, const int nSettingStyle);\r
- static void SetAppTitle(const int nAppID, const CString& appTitle);\r
+ static int GetAppID(LPCSTR szAppName);\r
+ static int GetSettingStyle(int nAppID);\r
+ static void SetSettingStyle(int nAppID, int nSettingStyle);\r
+ static void SetAppTitle(int nAppID, const CString& appTitle);\r
static int GetCommandID(int nAppID, int nType, int nKey);\r
static void SetCommandID(int nAppID, int nType, int nKey, int nComID);\r
static BOOL GetUseDialogSetting(int nAppID);\r
static TCHAR m_szAppTitle[MAX_APP][WINDOW_TEXT_LENGTH];\r
static void DeleteAllRegistryData();\r
static void LevelUp();\r
- static void AddKeyBind2C_(const LPCTSTR szApplicationName, BYTE bVk);\r
+ static void AddKeyBind2C_(LPCTSTR szApplicationName, BYTE bVk);\r
static void LoadRegistry();\r
static void SaveRegistry();\r
static void SetDllData();\r
- static void SaveKeyBind(const LPCTSTR appName, int comID, int type, int key);\r
- static void SaveKeyBind(const LPCTSTR appName, const LPCTSTR comName, int type, int key);\r
+ static void SaveKeyBind(LPCTSTR appName, int comID, int type, int key);\r
+ static void SaveKeyBind(LPCTSTR appName, LPCTSTR comName, int type, int key);\r
static TASK_LIST m_TaskList[MAX_TASKS];\r
static DWORD m_dwTasks;\r
static void GetTaskList();\r
if (m_nAppID < 0)\r
m_nAppID = nAppID;\r
else {\r
- const LPCSTR curText = m_Config.szWindowText[m_nAppID];\r
- const LPCSTR newText = m_Config.szWindowText[nAppID];\r
- const int curType = CUtils::GetWindowTextType(curText);\r
- const int newType = CUtils::GetWindowTextType(newText);\r
+ LPCSTR curText = m_Config.szWindowText[m_nAppID];\r
+ LPCSTR newText = m_Config.szWindowText[nAppID];\r
+ int curType = CUtils::GetWindowTextType(curText);\r
+ int newType = CUtils::GetWindowTextType(newText);\r
if (curType < newType || curType == newType && _tcscmp(curText, newText) <= 0)\r
m_nAppID = nAppID;\r
}\r
\r
LRESULT CALLBACK CXkeymacsDll::KeyboardProc(int nCode, WPARAM wParam, LPARAM lParam)\r
{\r
- const BYTE nOrigKey = static_cast<BYTE>(wParam);\r
- const bool bRelease = (HIWORD(lParam) & KF_UP) != 0;\r
- const bool bExtended = (HIWORD(lParam) & KF_EXTENDED) != 0;\r
+ BYTE nOrigKey = static_cast<BYTE>(wParam);\r
+ bool bRelease = (HIWORD(lParam) & KF_UP) != 0;\r
+ bool bExtended = (HIWORD(lParam) & KF_EXTENDED) != 0;\r
BYTE nKey = nOrigKey;\r
\r
static BOOL bLocked = FALSE;\r
case VK_RWIN:\r
case VK_APPS:\r
for (int i = 0; i < MAX_COMMAND_TYPE; ++i) {\r
- int (*const fCommand)() = fCommand(i);\r
+ int (*fCommand)() = fCommand(i);\r
if (fCommand && !(nOrigKey == VK_MENU && fCommand == CCommands::MetaAlt))\r
goto HOOK;\r
}\r
if (CheckOriginal(nVirtualType, nOrigKey))\r
goto DO_NOTHING;\r
\r
- int (*const fCommand)() = fCommand(nType);\r
+ int (*fCommand)() = fCommand(nType);\r
if (fCommand == CCommands::EnableOrDisableXKeymacs) {\r
ToggleKeyboardHookState();\r
goto HOOK;\r
memset(szPath, 0, sizeof(szPath));\r
goto HOOK;\r
} else if (nKey && index < MAX_PATH - 1) {\r
- const BOOL bIsShiftDown = IsDown(VK_SHIFT, FALSE);\r
+ BOOL bIsShiftDown = IsDown(VK_SHIFT, FALSE);\r
TCHAR nAscii = 0;\r
do { // 1-127\r
if (a2v(++nAscii) == nKey && bIsShiftDown == IsShift(nAscii)) {\r
UpdateKeyboardState(VK_CONTROL, 0);\r
}\r
\r
- const BOOL bHookApp =\r
+ BOOL bHookApp =\r
CUtils::IsVisualCpp() || CUtils::IsVisualStudio() ||\r
CUtils::IsInternetExplorer() || CUtils::IsFirefox() || CUtils::IsChrome();\r
if (after & META && !(before & META)) {\r
if (!def[0])\r
return;\r
std::vector<KeyBind> keybinds;\r
- const LPCTSTR last = def + _tcslen(def) - 1;\r
+ LPCTSTR last = def + _tcslen(def) - 1;\r
if (*def == _T('"') && *last == _T('"')) {\r
++def; // skip '"'\r
while (def < last)\r
UINT before = GetModifierState(FALSE);\r
\r
for (std::vector<KeyBind>::const_iterator p = keybinds.begin(); p != keybinds.end(); ++p) {\r
- const int nType = p->nType;\r
- const BYTE bVk = p->bVk;\r
+ int nType = p->nType;\r
+ BYTE bVk = p->bVk;\r
int (*fCommand)() = nType < MAX_COMMAND_TYPE ? Commands[m_Config.nCommandID[m_nAppID][nType][bVk]].fCommand : NULL;\r
if (fCommand) {\r
if (fCommand == CCommands::ExecuteExtendedCommand)\r
if (nType & SHIFT)\r
DepressKey(VK_SHIFT);\r
Kdu(bVk);\r
- const int nNextType = (p + 1) != keybinds.end() ? (p + 1)->nType : 0;\r
+ int nNextType = (p + 1) != keybinds.end() ? (p + 1)->nType : 0;\r
if (nType & SHIFT && !(nNextType & SHIFT))\r
ReleaseKey(VK_SHIFT);\r
if (nType & WIN_ALT && !(nNextType & WIN_ALT))\r