\r
Config CProfile::m_Config;\r
KeyString CProfile::m_KeyString(CProfile::Is106Keyboard() != FALSE);\r
-TCHAR CProfile::m_szAppTitle[MAX_APP][WINDOW_TEXT_LENGTH];\r
+TCHAR CProfile::m_AppTitle[MAX_APP][WINDOW_TEXT_LENGTH];\r
TASK_LIST CProfile::m_TaskList[MAX_TASKS];\r
DWORD CProfile::m_dwTasks;\r
\r
\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_(LPCTSTR appName, BYTE bVk)\r
{\r
int nComID;\r
for (nComID = 0; nComID < MAX_COMMAND; ++nComID)\r
if (Commands[nComID].fCommand == CCommands::C_)\r
break;\r
- SaveKeyBind(szAppName, nComID, NONE, bVk);\r
+ SaveKeyBind(appName, nComID, NONE, bVk);\r
}\r
\r
void CProfile::LoadRegistry()\r
bDialog = true;\r
_tcsncpy_s(m_Config.szSpecialApp[nAppID], appName, _TRUNCATE);\r
entry.LoadString(IDS_REG_ENTRY_APPLICATOIN_TITLE);\r
- _tcsncpy_s(m_szAppTitle[nAppID], AfxGetApp()->GetProfileString(appName, entry), _TRUNCATE);\r
+ _tcsncpy_s(m_AppTitle[nAppID], AfxGetApp()->GetProfileString(appName, entry), _TRUNCATE);\r
entry.LoadString(IDS_REG_ENTRY_WINDOW_TEXT);\r
_tcsncpy_s(m_Config.szWindowText[nAppID], AfxGetApp()->GetProfileString(appName, entry, _T("*")), _TRUNCATE);\r
\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 appName = m_Config.szSpecialApp[nAppID];\r
CString entry;\r
entry.Format(IDS_REG_ENTRY_APPLICATION, nAppID);\r
- if (!szAppName[0]) {\r
+ if (!appName[0]) {\r
if (!AfxGetApp()->GetProfileString(section, entry).IsEmpty())\r
AfxGetApp()->WriteProfileString(section, entry, _T(""));\r
continue;\r
}\r
- AfxGetApp()->WriteProfileString(section, entry, szAppName);\r
+ AfxGetApp()->WriteProfileString(section, entry, appName);\r
\r
entry.LoadString(IDS_REG_ENTRY_APPLICATOIN_TITLE);\r
- CString appTitle = m_szAppTitle[nAppID];\r
+ CString appTitle = m_AppTitle[nAppID];\r
appTitle.TrimLeft(_T(' '));\r
- AfxGetApp()->WriteProfileString(szAppName, entry, appTitle);\r
+ AfxGetApp()->WriteProfileString(appName, entry, appTitle);\r
entry.LoadString(IDS_REG_ENTRY_WINDOW_TEXT);\r
- AfxGetApp()->WriteProfileString(szAppName, entry, m_Config.szWindowText[nAppID]);\r
+ AfxGetApp()->WriteProfileString(appName, entry, m_Config.szWindowText[nAppID]);\r
\r
// Create all commands\r
for (int nComID = 1; nComID < MAX_COMMAND; ++nComID)\r
- SaveKeyBind(szAppName, nComID, 0, 0);\r
+ SaveKeyBind(appName, nComID, 0, 0);\r
for (int nType = 0; nType < MAX_COMMAND_TYPE; ++nType)\r
for (int nKey = 0; nKey < MAX_KEY; ++nKey)\r
- SaveKeyBind(szAppName, m_Config.nCommandID[nAppID][nType][nKey], nType, nKey);\r
+ SaveKeyBind(appName, m_Config.nCommandID[nAppID][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(szAppName, CDotXkeymacs::GetFunctionSymbol(nFuncID), nType, nKey);\r
+ SaveKeyBind(appName, CDotXkeymacs::GetFunctionSymbol(nFuncID), nType, nKey);\r
}\r
\r
entry.LoadString(IDS_REG_ENTRY_KILL_RING_MAX);\r
- AfxGetApp()->WriteProfileInt(szAppName, entry, m_Config.nKillRingMax[nAppID]);\r
+ AfxGetApp()->WriteProfileInt(appName, entry, m_Config.nKillRingMax[nAppID]);\r
entry.LoadString(IDS_REG_ENTRY_USE_DIALOG_SETTING);\r
- AfxGetApp()->WriteProfileInt(szAppName, entry, m_Config.bUseDialogSetting[nAppID]);\r
+ AfxGetApp()->WriteProfileInt(appName, entry, m_Config.bUseDialogSetting[nAppID]);\r
entry.LoadString(IDS_REG_ENTRY_DISABLE_XKEYMACS);\r
- AfxGetApp()->WriteProfileInt(szAppName, entry, m_Config.nSettingStyle[nAppID] == SETTING_DISABLE);\r
+ AfxGetApp()->WriteProfileInt(appName, entry, m_Config.nSettingStyle[nAppID] == SETTING_DISABLE);\r
entry.LoadString(IDC_REG_ENTRY_IGNORE_META_CTRL);\r
- AfxGetApp()->WriteProfileInt(szAppName, entry, m_Config.bIgnoreUndefinedMetaCtrl[nAppID]);\r
+ AfxGetApp()->WriteProfileInt(appName, entry, m_Config.bIgnoreUndefinedMetaCtrl[nAppID]);\r
entry.LoadString(IDC_REG_ENTRY_IGNORE_C_X);\r
- AfxGetApp()->WriteProfileInt(szAppName, entry, m_Config.bIgnoreUndefinedC_x[nAppID]);\r
+ AfxGetApp()->WriteProfileInt(appName, entry, m_Config.bIgnoreUndefinedC_x[nAppID]);\r
entry.LoadString(IDC_REG_ENTRY_ENABLE_CUA);\r
- AfxGetApp()->WriteProfileInt(szAppName, entry, m_Config.bEnableCUA[nAppID]);\r
+ AfxGetApp()->WriteProfileInt(appName, entry, m_Config.bEnableCUA[nAppID]);\r
entry.LoadString(IDS_REG_ENTRY_326_COMPATIBLE);\r
- AfxGetApp()->WriteProfileInt(szAppName, entry, m_Config.b326Compatible[nAppID]);\r
+ AfxGetApp()->WriteProfileInt(appName, entry, m_Config.b326Compatible[nAppID]);\r
}\r
}\r
\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
- if (!szAppName[0] || !_tcscmp(szAppName, _T("IME")))\r
+ LPCTSTR appName = m_Config.szSpecialApp[i];\r
+ LPCTSTR appTitle = m_AppTitle[i];\r
+ if (!appName[0] || !_tcscmp(appName, _T("IME")))\r
continue;\r
- if (CString(MAKEINTRESOURCE(IDS_DEFAULT)) == szAppName ||\r
- CString(MAKEINTRESOURCE(IDS_DIALOG)) == szAppName)\r
+ if (CString(MAKEINTRESOURCE(IDS_DEFAULT)) == appName ||\r
+ CString(MAKEINTRESOURCE(IDS_DIALOG)) == appName)\r
continue;\r
- cProperties.AddItem(szAppTitle, szAppName);\r
+ cProperties.AddItem(appTitle, appName);\r
}\r
AddIMEInfo(cProperties);\r
}\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
cProperties.AddItem(p->szDescription, p->szFileName);\r
}\r
\r
-void CProfile::ClearData(const CString szCurrentApplication)\r
+void CProfile::ClearData(LPCTSTR appName)\r
{\r
- for (int nAppID = 0; nAppID < MAX_APP; ++nAppID)\r
- if (szCurrentApplication == m_Config.szSpecialApp[nAppID]) {\r
- ZeroMemory(m_Config.nCommandID[nAppID], sizeof(m_Config.nCommandID[nAppID]));\r
- ZeroMemory(m_Config.szSpecialApp[nAppID], CLASS_NAME_LENGTH);\r
- return;\r
- }\r
+ int n = GetAppID(appName);\r
+ if (n == MAX_APP)\r
+ return;\r
+ ZeroMemory(m_Config.nCommandID[n], sizeof(m_Config.nCommandID[n]));\r
+ ZeroMemory(m_Config.szSpecialApp[n], CLASS_NAME_LENGTH);\r
}\r
\r
-void CProfile::CopyData(const CString szDstApp, const CString szSrcApp)\r
+void CProfile::CopyDefault(LPCTSTR appName)\r
{\r
- const int nDstApp = AssignAppID(szDstApp);\r
- const int nSrcApp = GetAppID(szSrcApp);\r
- if (nDstApp == MAX_APP || nSrcApp == MAX_APP)\r
+ int dst = AssignAppID(appName);\r
+ int src = DefaultAppID();\r
+ if (src == MAX_APP || dst == MAX_APP)\r
return;\r
- SetSettingStyle(nDstApp, SETTING_SPECIFIC);\r
+ SetSettingStyle(dst, SETTING_SPECIFIC);\r
\r
-#define CopyMember(member) CopyMemory(&m_Config. ## member ## [nDstApp], &m_Config. ## member ## [nSrcApp], sizeof(m_Config. ## member ## [nSrcApp]))\r
+#define CopyMember(member) CopyMemory(&m_Config. ## member ## [dst], &m_Config. ## member ## [src], sizeof(m_Config. ## member ## [src]))\r
CopyMember(b326Compatible);\r
CopyMember(nFunctionID);\r
CopyMember(bEnableCUA);\r
#undef CopyMember\r
}\r
\r
-int CProfile::AssignAppID(const LPCSTR szAppName)\r
+int CProfile::AssignAppID(LPCTSTR appName)\r
{\r
- int nAppID = GetAppID(szAppName);\r
+ int nAppID = GetAppID(appName);\r
if (nAppID != MAX_APP)\r
return nAppID;\r
for (nAppID = 0; nAppID < MAX_APP; ++nAppID)\r
if (!m_Config.szSpecialApp[nAppID][0]) {\r
- _tcsncpy_s(m_Config.szSpecialApp[nAppID], szAppName, _TRUNCATE);\r
+ _tcsncpy_s(m_Config.szSpecialApp[nAppID], appName, _TRUNCATE);\r
return nAppID;\r
}\r
return nAppID;\r
return MAX_APP;\r
}\r
\r
-int CProfile::GetAppID(const LPCSTR szAppName)\r
+int CProfile::GetAppID(LPCTSTR appName)\r
{\r
int nAppID = 0;\r
for (nAppID = 0; nAppID < MAX_APP; ++nAppID)\r
- if (!_tcscmp(szAppName, m_Config.szSpecialApp[nAppID]))\r
+ if (!_tcscmp(appName, m_Config.szSpecialApp[nAppID]))\r
break;\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
+ _tcsncpy_s(m_AppTitle[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
+LPCTSTR 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& text)\r
{\r
- if (CUtils::GetWindowTextType(szWindowText) == IDS_WINDOW_TEXT_IGNORE)\r
- _tcscpy_s(m_Config.szWindowText[nAppID], _T("*"));\r
- else\r
- _tcsncpy_s(m_Config.szWindowText[nAppID], szWindowText, _TRUNCATE);\r
+ _tcsncpy_s(m_Config.szWindowText[nAppID],\r
+ CUtils::GetWindowTextType(text) == IDS_WINDOW_TEXT_IGNORE ? _T("*") : text, _TRUNCATE);\r
}\r
\r
BOOL CProfile::Is106Keyboard()\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