\r
\r
C104Keyboard::C104Keyboard(const HKEY_TYPE hkey_type, CWnd *const pParent /*=NULL*/)\r
- : CDialog(C104Keyboard::IDD, pParent)\r
+ : CKeyboardLayout(hkey_type, C104Keyboard::IDD, pParent)\r
{\r
//{{AFX_DATA_INIT(C104Keyboard)\r
// NOTE: the ClassWizard will add member initialization here\r
//}}AFX_DATA_INIT\r
- m_HkeyType = hkey_type;\r
}\r
\r
-\r
void C104Keyboard::DoDataExchange(CDataExchange *const pDX)\r
{\r
CDialog::DoDataExchange(pDX);\r
m_ToolTip.Create(this, TTS_ALWAYSTIP | TTS_NOPREFIX);\r
m_ToolTip.SetMaxTipWidth(0x100); // Enable multiline\r
\r
- CProfile::LoadScanCodeMap(m_HkeyType);\r
- for (int i = 0; i < sizeof(KeyboardLayouts) / sizeof(KeyboardLayouts[0]); ++i) {\r
- if (!GetDlgItem(KeyboardLayouts[i].nBaseControlID)\r
- || !GetDlgItem(KeyboardLayouts[i].nCurrentControlID)) {\r
- continue;\r
- }\r
-\r
- KeyboardLayouts[i].pBaseKey = new CKey(KeyboardLayouts[i].nBaseControlID, NORMAL_KEY, m_HkeyType);\r
- KeyboardLayouts[i].pBaseKey->SubclassDlgItem(KeyboardLayouts[i].nBaseControlID, this);\r
- m_ToolTip.AddTool(GetDlgItem(KeyboardLayouts[i].nBaseControlID), CProfile::GetToolTipID(KeyboardLayouts[i].nToolTipID));\r
-\r
- KeyboardLayouts[i].pCurrentKey = new CKey(KeyboardLayouts[i].nCurrentControlID, ORIGINAL_KEY, m_HkeyType);\r
- KeyboardLayouts[i].pCurrentKey->SubclassDlgItem(KeyboardLayouts[i].nCurrentControlID, this);\r
- m_ToolTip.AddTool(GetDlgItem(KeyboardLayouts[i].nCurrentControlID), CProfile::GetToolTipID(KeyboardLayouts[i].nToolTipID));\r
-\r
- ScanCode current = {'\0'};\r
- if (CProfile::GetScanCodeMap(m_HkeyType, KeyboardLayouts[i].scancode, ¤t)) {\r
- KeyboardLayouts[i].pCurrentKey->SetKeyType(REMAPPED_KEY);\r
-\r
- CString szWindowText;\r
- GetDlgItem(CProfile::GetBaseControlID(current))->GetWindowText(szWindowText);\r
- GetDlgItem(KeyboardLayouts[i].nCurrentControlID)->SetWindowText(szWindowText);\r
-\r
- KeyboardLayout *pKeyboardLayout = CProfile::GetKeyboardLayouts(CProfile::GetBaseControlID(current));\r
- if (pKeyboardLayout) {\r
- m_ToolTip.UpdateTipText(CProfile::GetToolTipID(pKeyboardLayout->nToolTipID), GetDlgItem(KeyboardLayouts[i].nCurrentControlID));\r
- }\r
- }\r
- }\r
+ InitKeyboardLayout();\r
\r
return TRUE; // return TRUE unless you set the focus to a control\r
// EXCEPTION: OCX Property Pages should return FALSE\r
\r
void C104Keyboard::OnOK() \r
{\r
- if (CProfile::LostKeyWarning(m_HkeyType) != IDCANCEL) {\r
- CProfile::SaveScanCodeMap(m_HkeyType);\r
+ if (LostKeyWarning(m_HkeyType) != IDCANCEL) {\r
+ SaveScanCodeMap(m_HkeyType);\r
\r
CDialog::OnOK();\r
}\r
{\r
CDialog::OnDestroy();\r
\r
- for (int i = 0; i < sizeof(KeyboardLayouts) / sizeof(KeyboardLayouts[0]); ++i) {\r
- if (!GetDlgItem(KeyboardLayouts[i].nBaseControlID)\r
- || !GetDlgItem(KeyboardLayouts[i].nCurrentControlID)) {\r
- continue;\r
- }\r
-\r
- if (KeyboardLayouts[i].pBaseKey) {\r
- delete KeyboardLayouts[i].pBaseKey;\r
- KeyboardLayouts[i].pBaseKey = NULL;\r
- }\r
- if (KeyboardLayouts[i].pCurrentKey) {\r
- delete KeyboardLayouts[i].pCurrentKey;\r
- KeyboardLayouts[i].pCurrentKey = NULL;\r
- }\r
- }\r
+ DestroyKeyboardLayout();\r
}\r
\r
BOOL C104Keyboard::PreTranslateMessage(MSG *const pMsg) \r