BOOL CPropertiesBasic::OnSetActive() \r
{\r
m_pProperties->EnableControl(BASIC_TAB);\r
- SetDialogData(m_pProperties->GetCurrentApplication());\r
+ SetDialogData();\r
\r
return CPropertyPage::OnSetActive();\r
}\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
InitChanged(bChanged);\r
}\r
\r
-void CPropertiesBasic::SetDialogData(CString szApplicationName)\r
+void CPropertiesBasic::SetDialogData()\r
{\r
- UpdateDialogData(szApplicationName, FALSE);\r
-}\r
-\r
-void CPropertiesBasic::UpdateDialogData(CString szApplicationName, BOOL bSaveAndValidate)\r
-{\r
- if (bSaveAndValidate) { // GetDialogData\r
- UpdateData();\r
- }\r
-\r
- if (m_pProperties->GetApplicationID() == MAX_APP) {\r
- if (!bSaveAndValidate) {\r
- SetAllDialogData(1, FALSE); // FIXME\r
- }\r
+ SetAllDialogData(1, FALSE);\r
+ CheckDlgButton(IDC_CO2, BST_CHECKED);\r
+ const int nAppID = m_pProperties->GetApplicationID();\r
+ if (nAppID == MAX_APP)\r
return;\r
- }\r
-\r
- // on/off\r
- if (!bSaveAndValidate) { // SetDialogData\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
- 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
- if (nKey == 0) {\r
- break;\r
- }\r
- if (bSaveAndValidate) { // GetDialogData\r
- if (nControlID == IDC_CO2) {\r
- continue;\r
- }\r
- if (!m_bChanged[nCommandID]) {\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
- } else {\r
- CProfile::SetCommandID(m_pProperties->GetApplicationID(), nCommandType, nKey, 0);\r
- }\r
- } else { // SetDialogData\r
- if (nCommandID != CProfile::GetCommandID(m_pProperties->GetApplicationID(), nCommandType, nKey)) {\r
- CheckDlgButton(nControlID, BST_UNCHECKED);\r
- }\r
- }\r
+ for (int nComID = 0; nComID < MAX_COMMAND; ++nComID) {\r
+ const LPCSTR szComName = CCommands::GetCommandName(nComID);\r
+ if (!szComName[0])\r
+ return;\r
+ for (int i = 0; const int nKey = CCommands::GetDefaultCommandKey(nComID, i); ++i) {\r
+ const int nType = CCommands::GetDefaultCommandType(nComID, i);\r
+ const int nControlID = CCommands::GetDefaultControlID(nComID, i);\r
+ if (nComID != CProfile::GetCommandID(nAppID, nType, nKey))\r
+ CheckDlgButton(nControlID, BST_UNCHECKED);\r
}\r
}\r
- // only for Toggle Imput Method Editor C-o: Canna mode\r
- if (bSaveAndValidate) { // GetDialogData\r
- int nCommandType = CONTROL;\r
- int nKey = 'O';\r
- if (CProfile::GetCommandID(m_pProperties->GetApplicationID(), nCommandType, nKey) == 0) {\r
- if (IsDlgButtonChecked(IDC_CO2)) {\r
- for (int nCommandID = 0; nCommandID < MAX_COMMAND; ++nCommandID) {\r
- CString szCommandName = CCommands::GetCommandName(nCommandID);\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
- break;\r
- }\r
- }\r
- }\r
- }\r
- }\r
-\r
- if (!bSaveAndValidate) { // SetDialogData\r
- UpdateData(FALSE);\r
- }\r
+ UpdateData(FALSE);\r
}\r
\r
void CPropertiesBasic::InitChanged(BOOL bChanged)\r
\r
void CPropertiesBasic::GetDialogData()\r
{\r
- UpdateDialogData(m_pProperties->GetCurrentApplication(), TRUE);\r
+ UpdateData();\r
+ const int nAppID = m_pProperties->GetApplicationID();\r
+ if (nAppID == MAX_APP)\r
+ return;\r
+ for (int nComID = 0; nComID < MAX_COMMAND; ++nComID) {\r
+ const LPCSTR szComName = CCommands::GetCommandName(nComID);\r
+ if (!szComName[0])\r
+ return;\r
+ for (int i = 0; const int nKey = CCommands::GetDefaultCommandKey(nComID, i); ++i) {\r
+ const int nType = CCommands::GetDefaultCommandType(nComID, i);\r
+ const int nControlID = CCommands::GetDefaultControlID(nComID, i);\r
+ if (!m_bChanged[nComID])\r
+ continue;\r
+ if (IsDlgButtonChecked(nControlID)) {\r
+ CProfile::SetCommandID(nAppID, nType, nKey, nComID);\r
+ CDotXkeymacs::RemoveKey(nAppID, nType, nKey);\r
+ } else if (nControlID != IDC_CO2)\r
+ CProfile::SetCommandID(nAppID, nType, nKey, 0);\r
+ }\r
+ }\r
}\r
\r
void CPropertiesBasic::OnAlt() \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