\r
/////////////////////////////////////////////////////////////////////////////\r
// CPropertiesAdvanced property page\r
-int CPropertiesAdvanced::m_nApplicationID = 0;\r
+int CPropertiesAdvanced::m_nAppID = 0;\r
int CPropertiesAdvanced::m_nCommandID = 0;\r
CEdit * CPropertiesAdvanced::m_pNewKey = NULL;\r
CButton * CPropertiesAdvanced::m_pAssign = NULL;\r
BOOL CPropertiesAdvanced::OnSetActive() \r
{\r
m_pProperties->EnableControl(ADVANCED_TAB);\r
- SetDialogData(m_pProperties->GetCurrentApplication());\r
+ SetDialogData();\r
\r
return CPropertyPage::OnSetActive();\r
}\r
\r
-void CPropertiesAdvanced::SetDialogData(CString szApplicationName)\r
+void CPropertiesAdvanced::SetDialogData()\r
{\r
- UpdateDialogData(szApplicationName, FALSE);\r
-}\r
-\r
-void CPropertiesAdvanced::UpdateDialogData(CString szApplicationName, BOOL bSaveAndValidate)\r
-{\r
- m_nApplicationID = m_pProperties->GetApplicationID();\r
-\r
- if (bSaveAndValidate) { // GetDialogData\r
- UpdateData();\r
- }\r
-\r
- if (m_nApplicationID == MAX_APP) { // FIXME\r
+ m_nAppID = m_pProperties->GetApplicationID();\r
+ if (m_nAppID == MAX_APP)\r
return;\r
- }\r
-\r
InitCommandIDs();\r
- m_bEnableCUA = CProfile::GetEnableCUA(m_nApplicationID);\r
-\r
- if (!bSaveAndValidate) { // SetDialogData\r
- SetCurrentKeys();\r
- }\r
-\r
- if (!bSaveAndValidate) { // SetDialogData\r
- UpdateData(FALSE);\r
- }\r
+ m_bEnableCUA = CProfile::GetEnableCUA(m_nAppID);\r
+ SetCurrentKeys();\r
+ UpdateData(FALSE);\r
}\r
\r
void CPropertiesAdvanced::GetDialogData()\r
{\r
- UpdateDialogData(m_pProperties->GetCurrentApplication(), TRUE);\r
+ UpdateData();\r
}\r
\r
int CPropertiesAdvanced::OnCreate(LPCREATESTRUCT lpCreateStruct) \r
{\r
CPropertyPage::OnInitDialog();\r
\r
- m_nApplicationID = m_pProperties->GetApplicationID();\r
+ m_nAppID = m_pProperties->GetApplicationID();\r
InitCategoryList();\r
SetCommands();\r
\r
- SetDialogData(m_pProperties->GetCurrentApplication());\r
+ SetDialogData();\r
\r
m_cAssign.EnableWindow(FALSE);\r
m_cRemove.EnableWindow(FALSE);\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
\r
BOOL bExist = FALSE;\r
- for (int i = 0; nCategoryIDs[i]; ++i) {\r
+ int i;\r
+ for (i = 0; nCategoryIDs[i]; ++i) {\r
if (nCategoryIDs[i] == nCategoryID) {\r
bExist = TRUE;\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_nAppID, 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
}\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
+ for (int nKeyID = 0; nKeyID < CDotXkeymacs::GetKeyNumber(nIndex, m_nAppID); ++nKeyID) {\r
+ int nType = 0;\r
int nKey = 0;\r
- CDotXkeymacs::GetKey(nIndex, m_nApplicationID, nKeyID, &nCommandType, &nKey);\r
+ CDotXkeymacs::GetKey(nIndex, m_nAppID, 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
{\r
TCHAR szKeyBind[128] = {'\0'};\r
m_cCurrentKeys.GetText(m_cCurrentKeys.GetCurSel(), szKeyBind);\r
- CProfile::ReadKeyBind(&m_nRemoveCommandType, &m_nRemoveKey, szKeyBind);\r
+ CProfile::ReadKeyBind(m_nRemoveCommandType, m_nRemoveKey, szKeyBind);\r
m_cRemove.EnableWindow();\r
}\r
\r
void CPropertiesAdvanced::OnAssign() \r
{\r
// Remove Current Setting\r
- CProfile::SetCommandID(m_nApplicationID, m_nAssignCommandType, m_nAssignKey, 0);\r
+ CProfile::SetCommandID(m_nAppID, m_nAssignCommandType, m_nAssignKey, 0);\r
SetCommandID(m_nAssignCommandType, m_nAssignKey, 0);\r
- CDotXkeymacs::RemoveKey(m_nApplicationID, m_nAssignCommandType, m_nAssignKey);\r
+ CDotXkeymacs::RemoveKey(m_nAppID, m_nAssignCommandType, m_nAssignKey);\r
\r
// Assign New Setting\r
CString szItem;\r
m_cCategory.GetLBText(m_cCategory.GetCurSel(), szCategory);\r
\r
if (szCategory.Compare(CString(MAKEINTRESOURCE(IDS_ORIGINAL)))) {\r
- CProfile::SetCommandID(m_nApplicationID, m_nAssignCommandType, m_nAssignKey, m_nCommandID);\r
+ CProfile::SetCommandID(m_nAppID, m_nAssignCommandType, m_nAssignKey, m_nCommandID);\r
SetCommandID(m_nAssignCommandType, m_nAssignKey, m_nCommandID);\r
} else {\r
CString szCurrentCommandName;\r
m_cCommands.GetText(m_cCommands.GetCurSel(), szCurrentCommandName);\r
- CDotXkeymacs::SetKey(CDotXkeymacs::GetIndex(szCurrentCommandName), m_nApplicationID, m_nAssignCommandType, m_nAssignKey);\r
+ CDotXkeymacs::SetKey(CDotXkeymacs::GetIndex(szCurrentCommandName), m_nAppID, m_nAssignCommandType, m_nAssignKey);\r
}\r
m_cCurrentKeys.AddString(szItem);\r
}\r
m_cCategory.GetLBText(m_cCategory.GetCurSel(), szCategory);\r
\r
if (szCategory.Compare(CString(MAKEINTRESOURCE(IDS_ORIGINAL)))) {\r
- CProfile::SetCommandID(m_nApplicationID, m_nRemoveCommandType, m_nRemoveKey, 0);\r
+ CProfile::SetCommandID(m_nAppID, m_nRemoveCommandType, m_nRemoveKey, 0);\r
SetCommandID(m_nRemoveCommandType, m_nRemoveKey, 0);\r
} else {\r
CString szCurrentCommandName;\r
m_cCommands.GetText(m_cCommands.GetCurSel(), szCurrentCommandName);\r
- CDotXkeymacs::RemoveKey(CDotXkeymacs::GetIndex(szCurrentCommandName), m_nApplicationID, m_nRemoveCommandType, m_nRemoveKey);\r
+ CDotXkeymacs::RemoveKey(CDotXkeymacs::GetIndex(szCurrentCommandName), m_nAppID, m_nRemoveCommandType, m_nRemoveKey);\r
}\r
\r
m_cCurrentKeys.DeleteString(m_cCurrentKeys.GetCurSel());\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
if (m_pCurrentlyAssigned) {\r
CString szCurrentlyAssigned(_T("Currently assigned to:\n"));\r
\r
- if (m_nCommandIDs[m_nAssignCommandType][m_nAssignKey] || CDotXkeymacs::GetIndex(m_nApplicationID, m_nAssignCommandType, m_nAssignKey) == -1) {\r
+ if (m_nCommandIDs[m_nAssignCommandType][m_nAssignKey] || CDotXkeymacs::GetIndex(m_nAppID, m_nAssignCommandType, m_nAssignKey) == -1) {\r
szCurrentlyAssigned += CCommands::GetCommandName(m_nCommandIDs[m_nAssignCommandType][m_nAssignKey]);\r
} else {\r
- szCurrentlyAssigned += CDotXkeymacs::GetFunctionSymbol(CDotXkeymacs::GetIndex(m_nApplicationID, m_nAssignCommandType, m_nAssignKey));\r
+ szCurrentlyAssigned += CDotXkeymacs::GetFunctionSymbol(CDotXkeymacs::GetIndex(m_nAppID, m_nAssignCommandType, m_nAssignKey));\r
}\r
m_pCurrentlyAssigned->SetWindowText(szCurrentlyAssigned);\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
- for (int nCommandIDofC_x = 0; nCommandIDofC_x < MAX_COMMAND; ++nCommandIDofC_x) {\r
+ int nCommandIDofC_x;\r
+ for (nCommandIDofC_x = 0; nCommandIDofC_x < MAX_COMMAND; ++nCommandIDofC_x) {\r
if (!_tcsicmp(CCommands::GetCommandName(nCommandIDofC_x), _T("C-x"))) {\r
break;\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_nAppID, nType, nKey));\r
}\r
}\r
}\r
void CPropertiesAdvanced::OnEnableCua() \r
{\r
UpdateData();\r
- CProfile::SetEnableCUA(m_nApplicationID, m_bEnableCUA);\r
+ CProfile::SetEnableCUA(m_nAppID, m_bEnableCUA);\r
}\r
\r
BOOL CPropertiesAdvanced::IsCtrlDown()\r