1 // PropertiesBasic.cpp : implementation file
\r
5 #include "xkeymacs.h"
\r
6 #include "DotXkeymacs.h"
\r
8 #include "Properties.h"
\r
9 #include "PropertiesBasic.h"
\r
12 #define new DEBUG_NEW
\r
14 static char THIS_FILE[] = __FILE__;
\r
17 /////////////////////////////////////////////////////////////////////////////
\r
18 // CPropertiesBasic property page
\r
20 IMPLEMENT_DYNCREATE(CPropertiesBasic, CPropertyPage)
\r
22 CPropertiesBasic::CPropertiesBasic() : CPropertyPage(CPropertiesBasic::IDD)
\r
24 //{{AFX_DATA_INIT(CPropertiesBasic)
\r
28 CPropertiesBasic::~CPropertiesBasic()
\r
32 void CPropertiesBasic::DoDataExchange(CDataExchange* pDX)
\r
34 CPropertyPage::DoDataExchange(pDX);
\r
35 //{{AFX_DATA_MAP(CPropertiesBasic)
\r
40 BEGIN_MESSAGE_MAP(CPropertiesBasic, CPropertyPage)
\r
41 //{{AFX_MSG_MAP(CPropertiesBasic)
\r
43 ON_BN_CLICKED(IDC_ALT, OnAlt)
\r
44 ON_BN_CLICKED(IDC_C_, OnC_)
\r
45 ON_BN_CLICKED(IDC_CA, OnCa)
\r
46 ON_BN_CLICKED(IDC_CB, OnCb)
\r
47 ON_BN_CLICKED(IDC_CBACKSLASH, OnCbackslash)
\r
48 ON_BN_CLICKED(IDC_CBACKSLASH_106, OnCbackslash106)
\r
49 ON_BN_CLICKED(IDC_CD, OnCd)
\r
50 ON_BN_CLICKED(IDC_CDIGIT, OnCdigit)
\r
51 ON_BN_CLICKED(IDC_CE, OnCe)
\r
52 ON_BN_CLICKED(IDC_CF, OnCf)
\r
53 ON_BN_CLICKED(IDC_CG, OnCg)
\r
54 ON_BN_CLICKED(IDC_CH, OnCh)
\r
55 ON_BN_CLICKED(IDC_CI, OnCi)
\r
56 ON_BN_CLICKED(IDC_CK, OnCk)
\r
57 ON_BN_CLICKED(IDC_CL, OnCl)
\r
58 ON_BN_CLICKED(IDC_CM, OnCm)
\r
59 ON_BN_CLICKED(IDC_CMS5, OnCms5)
\r
60 ON_BN_CLICKED(IDC_CN, OnCn)
\r
61 ON_BN_CLICKED(IDC_CO, OnCo)
\r
62 ON_BN_CLICKED(IDC_CO2, OnCo2)
\r
63 ON_BN_CLICKED(IDC_CP, OnCp)
\r
64 ON_BN_CLICKED(IDC_CQ, OnCq)
\r
65 ON_BN_CLICKED(IDC_CR, OnCr)
\r
66 ON_BN_CLICKED(IDC_CS, OnCs)
\r
67 ON_BN_CLICKED(IDC_CSLASH, OnCslash)
\r
68 ON_BN_CLICKED(IDC_CSPACE, OnCspace)
\r
69 ON_BN_CLICKED(IDC_CT, OnCt)
\r
70 ON_BN_CLICKED(IDC_CU, OnCu)
\r
71 ON_BN_CLICKED(IDC_CV, OnCv)
\r
72 ON_BN_CLICKED(IDC_CW, OnCw)
\r
73 ON_BN_CLICKED(IDC_CXB, OnCxb)
\r
74 ON_BN_CLICKED(IDC_CXCC, OnCxcc)
\r
75 ON_BN_CLICKED(IDC_CXCF, OnCxcf)
\r
76 ON_BN_CLICKED(IDC_CXCJ, OnCxcj)
\r
77 ON_BN_CLICKED(IDC_CXCP, OnCxcp)
\r
78 ON_BN_CLICKED(IDC_CXCS, OnCxcs)
\r
79 ON_BN_CLICKED(IDC_CXCT, OnCxct)
\r
80 ON_BN_CLICKED(IDC_CXCW, OnCxcw)
\r
81 ON_BN_CLICKED(IDC_CXE, OnCxe)
\r
82 ON_BN_CLICKED(IDC_CXH, OnCxh)
\r
83 ON_BN_CLICKED(IDC_CXK, OnCxk)
\r
84 ON_BN_CLICKED(IDC_CXS0, OnCxs0)
\r
85 ON_BN_CLICKED(IDC_CXS9, OnCxs9)
\r
86 ON_BN_CLICKED(IDC_CXU, OnCxu)
\r
87 ON_BN_CLICKED(IDC_CY, OnCy)
\r
88 ON_BN_CLICKED(IDC_CZ, OnCz)
\r
89 ON_BN_CLICKED(IDC_LEFT_ALT, OnLeftAlt)
\r
90 ON_BN_CLICKED(IDC_MB, OnMb)
\r
91 ON_BN_CLICKED(IDC_MD, OnMd)
\r
92 ON_BN_CLICKED(IDC_MF, OnMf)
\r
93 ON_BN_CLICKED(IDC_MI, OnMi)
\r
94 ON_BN_CLICKED(IDC_MS1, OnMs1)
\r
95 ON_BN_CLICKED(IDC_MS5, OnMs5)
\r
96 ON_BN_CLICKED(IDC_MSCOMMA, OnMscomma)
\r
97 ON_BN_CLICKED(IDC_MSPERIOD, OnMsperiod)
\r
98 ON_BN_CLICKED(IDC_MV, OnMv)
\r
99 ON_BN_CLICKED(IDC_MW, OnMw)
\r
100 ON_BN_CLICKED(IDC_MY, OnMy)
\r
101 ON_BN_CLICKED(IDC_RIGHT_ALT, OnRightAlt)
\r
102 ON_BN_CLICKED(IDC_ESCAPE, OnEscape)
\r
103 ON_BN_CLICKED(IDC_SQUARE_BRA, OnSquareBra)
\r
104 ON_BN_CLICKED(IDC_MDEL, OnMdel)
\r
105 ON_BN_CLICKED(IDC_MF12, OnMf12)
\r
106 ON_BN_CLICKED(IDC_MT, OnMt)
\r
107 ON_BN_CLICKED(IDC_MC, OnMc)
\r
108 ON_BN_CLICKED(IDC_ML, OnMl)
\r
109 ON_BN_CLICKED(IDC_MU, OnMu)
\r
110 ON_BN_CLICKED(IDC_MX, OnMx)
\r
114 /////////////////////////////////////////////////////////////////////////////
\r
115 // CPropertiesBasic message handlers
\r
117 BOOL CPropertiesBasic::OnSetActive()
\r
119 m_pProperties->EnableControl(BASIC_TAB);
\r
122 return CPropertyPage::OnSetActive();
\r
125 void CPropertiesBasic::SetAllDialogData(UINT nCheck, BOOL bChanged)
\r
127 for (int nComID = 0; nComID < MAX_COMMAND; ++nComID) {
\r
128 CString szCommandName = CCommands::GetCommandName(nComID);
\r
129 if (szCommandName.IsEmpty()) {
\r
133 for (int i = 0; ; ++i) {
\r
134 int nKey = CCommands::GetDefaultCommandKey(nComID, i);
\r
135 int nControlID = CCommands::GetDefaultControlID(nComID, i);
\r
139 CheckDlgButton(nControlID, nCheck);
\r
142 CheckDlgButton(IDC_CO2, BST_UNCHECKED);
\r
144 InitChanged(bChanged);
\r
147 void CPropertiesBasic::SetDialogData()
\r
149 SetAllDialogData(1, FALSE);
\r
150 CheckDlgButton(IDC_CO2, BST_CHECKED);
\r
151 const int nAppID = m_pProperties->GetApplicationID();
\r
152 if (nAppID == MAX_APP)
\r
154 for (int nComID = 0; nComID < MAX_COMMAND; ++nComID) {
\r
155 const LPCSTR szComName = CCommands::GetCommandName(nComID);
\r
158 for (int i = 0; const int nKey = CCommands::GetDefaultCommandKey(nComID, i); ++i) {
\r
159 const int nType = CCommands::GetDefaultCommandType(nComID, i);
\r
160 const int nControlID = CCommands::GetDefaultControlID(nComID, i);
\r
161 if (nComID != CProfile::GetCommandID(nAppID, nType, nKey))
\r
162 CheckDlgButton(nControlID, BST_UNCHECKED);
\r
168 void CPropertiesBasic::InitChanged(BOOL bChanged)
\r
170 for (int i = 0; i < MAX_COMMAND; ++i) {
\r
171 if (CCommands::GetDefaultControlID(i, 0) || !bChanged) {
\r
172 m_bChanged[i] = bChanged;
\r
177 int CPropertiesBasic::OnCreate(LPCREATESTRUCT lpCreateStruct)
\r
179 if (CPropertyPage::OnCreate(lpCreateStruct) == -1)
\r
182 m_pProperties = (CProperties *)GetParent()->GetParent();
\r
187 void CPropertiesBasic::GetDialogData()
\r
190 const int nAppID = m_pProperties->GetApplicationID();
\r
191 if (nAppID == MAX_APP)
\r
193 for (int nComID = 0; nComID < MAX_COMMAND; ++nComID) {
\r
194 const LPCSTR szComName = CCommands::GetCommandName(nComID);
\r
197 for (int i = 0; const int nKey = CCommands::GetDefaultCommandKey(nComID, i); ++i) {
\r
198 const int nType = CCommands::GetDefaultCommandType(nComID, i);
\r
199 const int nControlID = CCommands::GetDefaultControlID(nComID, i);
\r
200 if (!m_bChanged[nComID])
\r
202 if (IsDlgButtonChecked(nControlID)) {
\r
203 CProfile::SetCommandID(nAppID, nType, nKey, nComID);
\r
204 CDotXkeymacs::RemoveKey(nAppID, nType, nKey);
\r
205 } else if (nControlID != IDC_CO2)
\r
206 CProfile::SetCommandID(nAppID, nType, nKey, 0);
\r
211 void CPropertiesBasic::OnAlt()
\r
216 void CPropertiesBasic::OnC_()
\r
221 void CPropertiesBasic::OnCa()
\r
226 void CPropertiesBasic::OnCb()
\r
231 void CPropertiesBasic::OnCbackslash()
\r
233 Changed(IDC_CBACKSLASH);
\r
236 void CPropertiesBasic::OnCbackslash106()
\r
238 Changed(IDC_CBACKSLASH_106);
\r
241 void CPropertiesBasic::OnCd()
\r
246 void CPropertiesBasic::OnCdigit()
\r
248 Changed(IDC_CDIGIT);
\r
251 void CPropertiesBasic::OnCe()
\r
256 void CPropertiesBasic::OnCf()
\r
261 void CPropertiesBasic::OnCg()
\r
266 void CPropertiesBasic::OnCh()
\r
271 void CPropertiesBasic::OnCi()
\r
276 void CPropertiesBasic::OnCk()
\r
281 void CPropertiesBasic::OnCl()
\r
286 void CPropertiesBasic::OnCm()
\r
291 void CPropertiesBasic::OnCms5()
\r
296 void CPropertiesBasic::OnCn()
\r
301 void CPropertiesBasic::OnCo()
\r
304 if (IsDlgButtonChecked(IDC_CO) == BST_CHECKED) {
\r
305 CheckDlgButton(IDC_CO2, BST_UNCHECKED);
\r
310 void CPropertiesBasic::OnCo2()
\r
313 if (IsDlgButtonChecked(IDC_CO2) == BST_CHECKED) {
\r
314 CheckDlgButton(IDC_CO, BST_UNCHECKED);
\r
319 void CPropertiesBasic::OnCp()
\r
324 void CPropertiesBasic::OnCq()
\r
329 void CPropertiesBasic::OnCr()
\r
334 void CPropertiesBasic::OnCs()
\r
339 void CPropertiesBasic::OnCslash()
\r
341 Changed(IDC_CSLASH);
\r
344 void CPropertiesBasic::OnCspace()
\r
346 Changed(IDC_CSPACE);
\r
349 void CPropertiesBasic::OnCt()
\r
354 void CPropertiesBasic::OnCu()
\r
359 void CPropertiesBasic::OnCv()
\r
364 void CPropertiesBasic::OnCw()
\r
369 void CPropertiesBasic::OnCxb()
\r
374 void CPropertiesBasic::OnCxcc()
\r
379 void CPropertiesBasic::OnCxcf()
\r
384 void CPropertiesBasic::OnCxcj()
\r
389 void CPropertiesBasic::OnCxcp()
\r
394 void CPropertiesBasic::OnCxcs()
\r
399 void CPropertiesBasic::OnCxct()
\r
404 void CPropertiesBasic::OnCxcw()
\r
409 void CPropertiesBasic::OnCxe()
\r
414 void CPropertiesBasic::OnCxh()
\r
419 void CPropertiesBasic::OnCxk()
\r
424 void CPropertiesBasic::OnCxs0()
\r
429 void CPropertiesBasic::OnCxs9()
\r
434 void CPropertiesBasic::OnCxu()
\r
439 void CPropertiesBasic::OnCy()
\r
444 void CPropertiesBasic::OnCz()
\r
449 void CPropertiesBasic::OnEscape()
\r
451 Changed(IDC_ESCAPE);
\r
454 void CPropertiesBasic::OnLeftAlt()
\r
456 Changed(IDC_LEFT_ALT);
\r
459 void CPropertiesBasic::OnMb()
\r
464 void CPropertiesBasic::OnMd()
\r
469 void CPropertiesBasic::OnMf()
\r
474 void CPropertiesBasic::OnMi()
\r
479 void CPropertiesBasic::OnMs1()
\r
484 void CPropertiesBasic::OnMs5()
\r
489 void CPropertiesBasic::OnMscomma()
\r
491 Changed(IDC_MSCOMMA);
\r
494 void CPropertiesBasic::OnMsperiod()
\r
496 Changed(IDC_MSPERIOD);
\r
499 void CPropertiesBasic::OnMv()
\r
504 void CPropertiesBasic::OnMw()
\r
509 void CPropertiesBasic::OnMy()
\r
514 void CPropertiesBasic::OnRightAlt()
\r
516 Changed(IDC_RIGHT_ALT);
\r
519 void CPropertiesBasic::OnSquareBra()
\r
521 Changed(IDC_SQUARE_BRA);
\r
524 void CPropertiesBasic::Changed(int nObjectID)
\r
526 for (int nComID = 0; nComID < MAX_COMMAND; ++nComID) {
\r
527 CString szCommandName = CCommands::GetCommandName(nComID);
\r
528 if (szCommandName.IsEmpty()) {
\r
532 for (int i = 0; ; ++i) {
\r
533 if (CCommands::GetDefaultCommandKey(nComID, i) == 0) {
\r
537 int nControlID = CCommands::GetDefaultControlID(nComID, i);
\r
538 if ((nControlID == nObjectID)
\r
539 || ((nObjectID == IDC_CO) && (nControlID == IDC_CO2))
\r
540 || ((nObjectID == IDC_CO2) && (nControlID == IDC_CO))) {
\r
541 m_bChanged[nComID] = TRUE;
\r
547 BOOL CPropertiesBasic::OnKillActive()
\r
551 return CPropertyPage::OnKillActive();
\r
554 void CPropertiesBasic::EnableControl()
\r
556 BOOL bEnable = m_pProperties->IsEnableControl();
\r
558 for (int nComID = 0; nComID < MAX_COMMAND; ++nComID) {
\r
559 CString szCommandName = CCommands::GetCommandName(nComID);
\r
560 if (szCommandName.IsEmpty()) {
\r
564 for (int i = 0; ; ++i) {
\r
565 int nKey = CCommands::GetDefaultCommandKey(nComID, i);
\r
566 int nControlID = CCommands::GetDefaultControlID(nComID, i);
\r
570 if (GetDlgItem(nControlID)) {
\r
571 GetDlgItem(nControlID)->EnableWindow(bEnable);
\r
577 BOOL CPropertiesBasic::PreTranslateMessage(MSG* pMsg)
\r
579 m_ToolTip.RelayEvent(pMsg);
\r
581 return CPropertyPage::PreTranslateMessage(pMsg);
\r
584 BOOL CPropertiesBasic::OnInitDialog()
\r
586 CPropertyPage::OnInitDialog();
\r
588 if (m_ToolTip.Create(this)) {
\r
589 for (int nComID = 0; nComID < MAX_COMMAND; ++nComID) {
\r
590 CString szCommandName = CCommands::GetCommandName(nComID);
\r
591 if (szCommandName.IsEmpty()) {
\r
595 for (int i = 0; ; ++i) {
\r
596 int nKey = CCommands::GetDefaultCommandKey(nComID, i);
\r
597 int nControlID = CCommands::GetDefaultControlID(nComID, i);
\r
601 if (GetDlgItem(nControlID)) {
\r
602 m_ToolTip.AddTool(GetDlgItem(nControlID), CString(MAKEINTRESOURCE(CCommands::GetToolTipID(nComID))));
\r
608 return TRUE; // return TRUE unless you set the focus to a control
\r
609 // EXCEPTION: OCX Property Pages should return FALSE
\r
612 void CPropertiesBasic::OnMdel()
\r
617 void CPropertiesBasic::OnMf12()
\r
622 void CPropertiesBasic::OnMt()
\r
627 void CPropertiesBasic::OnMc()
\r
632 void CPropertiesBasic::OnMl()
\r
637 void CPropertiesBasic::OnMu()
\r
642 void CPropertiesBasic::OnMx()
\r