From 8ad5d78570dc6c46a4b8dab550b9207ae1d9bfed Mon Sep 17 00:00:00 2001 From: Takashi Sawanaka Date: Sun, 14 Feb 2016 10:24:00 +0900 Subject: [PATCH] Add the following methods: CTrDialog::SetDlgItemChecked() CTrDialog::EnableDlgItem() CTrDialog::SetDlgItemFocus() CTrDialog::GetDlgItemText() CTrDialog::SetDlgItemText() --- Src/AboutDlg.cpp | 10 +- Src/DirCmpReportDlg.cpp | 2 +- Src/DirColsDlg.cpp | 15 +-- Src/DirCompProgressBar.cpp | 20 +--- Src/EncodingErrorBar.cpp | 2 +- Src/EncodingErrorBar.h | 2 +- Src/FileFiltersDlg.cpp | 20 +--- Src/LoadSaveCodepageDlg.cpp | 23 ++--- Src/LoadSaveCodepageDlg.h | 1 - Src/PluginsListDlg.cpp | 12 +-- Src/ProjectFilePathsDlg.cpp | 9 +- Src/PropArchive.cpp | 23 +---- Src/PropArchive.h | 1 - Src/PropBackups.cpp | 10 +- Src/PropCodepage.cpp | 32 ++---- Src/PropColors.cpp | 3 +- Src/PropCompare.cpp | 2 +- Src/PropCompareBinary.cpp | 2 +- Src/PropCompareBinary.h | 2 +- Src/PropCompareFolder.cpp | 12 +-- Src/PropCompareImage.cpp | 2 +- Src/PropCompareImage.h | 2 +- Src/PropEditor.cpp | 23 +---- Src/PropEditor.h | 1 - Src/PropGeneral.cpp | 2 +- Src/PropRegistry.cpp | 6 +- Src/PropShell.cpp | 14 +-- Src/PropSyntaxColors.cpp | 247 +++++++++++--------------------------------- Src/PropSyntaxColors.h | 57 ++-------- Src/PropTextColors.cpp | 30 ++---- Src/PropTextColors.h | 2 +- Src/SaveClosingDlg.cpp | 32 +++--- Src/TestFilterDlg.cpp | 50 +++------ Src/TestFilterDlg.h | 3 +- Src/TrDialogs.h | 48 +++++++++ 35 files changed, 229 insertions(+), 493 deletions(-) diff --git a/Src/AboutDlg.cpp b/Src/AboutDlg.cpp index f3fae093a..3d8d1a884 100644 --- a/Src/AboutDlg.cpp +++ b/Src/AboutDlg.cpp @@ -108,14 +108,14 @@ BOOL CAboutDlg::Impl::OnInitDialog() DEFAULT_QUALITY, DEFAULT_PITCH | FF_SWISS, _T("Tahoma")); ReleaseDC(pDC); - GetDlgItem(IDC_STATIC)->SetWindowText(m_p->m_info.developers.c_str()); + SetDlgItemText(IDC_STATIC, m_p->m_info.developers); GetDlgItem(IDC_STATIC)->SetFont(&m_font); GetDlgItem(IDC_VERSION)->SetFont(&m_font); - CString link; - GetDlgItem(IDC_WWW)->GetWindowText(link); - link = CString(_T("m_info.website.c_str() + CString(_T("\">")) + link + _T(""); - GetDlgItem(IDC_WWW)->SetWindowText(link); + String link; + GetDlgItemText(IDC_WWW, link); + link = _T("m_info.website + _T("\">") + link + _T(""); + SetDlgItemText(IDC_WWW, link); UpdateData(FALSE); diff --git a/Src/DirCmpReportDlg.cpp b/Src/DirCmpReportDlg.cpp index 973a20dbe..4a92c5697 100644 --- a/Src/DirCmpReportDlg.cpp +++ b/Src/DirCmpReportDlg.cpp @@ -147,7 +147,7 @@ void DirCmpReportDlg::OnBtnDblclickCopyClipboard() void DirCmpReportDlg::OnCbnSelchangeReportStylecombo() { - GetDlgItem(IDC_REPORT_INCLUDEFILECMPREPORT)->EnableWindow( + EnableDlgItem(IDC_REPORT_INCLUDEFILECMPREPORT, m_ctlStyle.GetItemData(m_ctlStyle.GetCurSel()) == REPORT_TYPE_SIMPLEHTML); } diff --git a/Src/DirColsDlg.cpp b/Src/DirColsDlg.cpp index 44a1f5bca..174401d6e 100644 --- a/Src/DirColsDlg.cpp +++ b/Src/DirColsDlg.cpp @@ -275,19 +275,12 @@ void CDirColsDlg::OnLvnItemchangedColdlgList(NMHDR *pNMHDR, LRESULT *pResult) if (m_cols[j].log_col == data) break; } - GetDlgItem(IDC_COLDLG_DESC)->SetWindowText(m_cols[j].desc.c_str()); + SetDlgItemText(IDC_COLDLG_DESC, m_cols[j].desc); // Disable Up/Down -buttons when first/last items are selected. - if (ind == 0) - GetDlgItem(IDC_UP)->EnableWindow(FALSE); - else - GetDlgItem(IDC_UP)->EnableWindow(TRUE); - - if (ind == m_listColumns.GetItemCount() - m_listColumns.GetSelectedCount()) - GetDlgItem(IDC_DOWN)->EnableWindow(FALSE); - else - GetDlgItem(IDC_DOWN)->EnableWindow(TRUE); - + EnableDlgItem(IDC_UP, ind != 0); + EnableDlgItem(IDC_DOWN, + ind != m_listColumns.GetItemCount() - m_listColumns.GetSelectedCount()); } *pResult = 0; } diff --git a/Src/DirCompProgressBar.cpp b/Src/DirCompProgressBar.cpp index bc5135afa..40ca2c69f 100644 --- a/Src/DirCompProgressBar.cpp +++ b/Src/DirCompProgressBar.cpp @@ -26,10 +26,8 @@ void DirCompProgressBar::ClearStat() CProgressCtrl *pProg = (CProgressCtrl*) GetDlgItem(IDC_PROGRESSCOMPARE); pProg->SetPos(0); - CStatic *pCompared = (CStatic *) GetDlgItem(IDC_ITEMSCOMPARED); - CStatic *pTotal = (CStatic *) GetDlgItem(IDC_ITEMSTOTAL); - pCompared->SetWindowText(_T("0")); - pTotal->SetWindowText(_T("0")); + SetDlgItemInt(IDC_ITEMSCOMPARED, 0); + SetDlgItemInt(IDC_ITEMSTOTAL, 0); m_prevState = CompareStats::STATE_IDLE; } @@ -102,16 +100,8 @@ void DirCompProgressBar::SetCompareStat(CompareStats * pCompareStats) void DirCompProgressBar::SetProgressState(int comparedItems, int totalItems) { CProgressCtrl *pProg = (CProgressCtrl*) GetDlgItem(IDC_PROGRESSCOMPARE); - CStatic *pCompared = (CStatic *) GetDlgItem(IDC_ITEMSCOMPARED); - CStatic *pTotal = (CStatic *) GetDlgItem(IDC_ITEMSTOTAL); - - TCHAR num[15] = {0}; - _itot(totalItems, num, 10); - pTotal->SetWindowText(num); - - pProg->SetRange32(0, totalItems); - _itot(comparedItems, num, 10); - pCompared->SetWindowText(num); + SetDlgItemInt(IDC_ITEMSTOTAL, totalItems); + SetDlgItemInt(IDC_ITEMSCOMPARED, comparedItems); pProg->SetPos(comparedItems); #ifdef __ITaskbarList3_INTERFACE_DEFINED__ @@ -158,7 +148,7 @@ void DirCompProgressBar::OnTimer(UINT_PTR nIDEvent) { SetProgressState(m_pCompareStats->GetComparedItems(), m_pCompareStats->GetTotalItems()); if (const DIFFITEM *pdi = m_pCompareStats->GetCurDiffItem()) - GetDlgItem(IDC_PATH_COMPARING)->SetWindowTextW(pdi->diffFileInfo[0].GetFile().c_str()); + SetDlgItemText(IDC_PATH_COMPARING, pdi->diffFileInfo[0].GetFile()); } // Compare is ready // Update total items too since we might get only this one state diff --git a/Src/EncodingErrorBar.cpp b/Src/EncodingErrorBar.cpp index 93d9bb7d4..2fe68fcbc 100644 --- a/Src/EncodingErrorBar.cpp +++ b/Src/EncodingErrorBar.cpp @@ -47,7 +47,7 @@ BOOL CEncodingErrorBar::Create(CWnd *pParentWnd) // EXCEPTION: OCX Property Pages should return FALSE } -void CEncodingErrorBar::SetText(const CString& sText) +void CEncodingErrorBar::SetText(const String& sText) { SetDlgItemText(IDC_STATIC, sText); } diff --git a/Src/EncodingErrorBar.h b/Src/EncodingErrorBar.h index a448b8d0e..ca1638eb5 100644 --- a/Src/EncodingErrorBar.h +++ b/Src/EncodingErrorBar.h @@ -15,7 +15,7 @@ public: CEncodingErrorBar(); BOOL Create(CWnd* pParentWnd); - void SetText(const CString& sText); + void SetText(const String& sText); // Dialog Data //{{AFX_DATA(CEncodingErrorBar) diff --git a/Src/FileFiltersDlg.cpp b/Src/FileFiltersDlg.cpp index bf82dcd29..321066577 100644 --- a/Src/FileFiltersDlg.cpp +++ b/Src/FileFiltersDlg.cpp @@ -263,17 +263,6 @@ void FileFiltersDlg::OnDblclkFiltersList(NMHDR* pNMHDR, LRESULT* pResult) } /** - * @brief Shortcut to enable or disable a control. - * @param [in] parent Pointer to dialog. - * @param [in] item Control's resourceID in dialog. - * @param [in] enable TRUE if item is enabled, FALSE if disabled. - */ -static void EnableDlgItem(CWnd * parent, int item, bool enable) -{ - parent->GetDlgItem(item)->EnableWindow(!!enable); -} - -/** * @brief Is item in list the item? * @param [in] item Item to test. * @return true if item is item. @@ -305,9 +294,9 @@ void FileFiltersDlg::OnLvnItemchangedFilterfileList(NMHDR *pNMHDR, LRESULT *pRes bool isNone = string_compare_nocase(txt, txtNone) == 0; - EnableDlgItem(this, IDC_FILTERFILE_TEST_BTN, !isNone); - EnableDlgItem(this, IDC_FILTERFILE_EDITBTN, !isNone); - EnableDlgItem(this, IDC_FILTERFILE_DELETEBTN, !isNone); + EnableDlgItem(IDC_FILTERFILE_TEST_BTN, !isNone); + EnableDlgItem(IDC_FILTERFILE_EDITBTN, !isNone); + EnableDlgItem(IDC_FILTERFILE_DELETEBTN, !isNone); } *pResult = 0; } @@ -400,7 +389,8 @@ void FileFiltersDlg::OnBnClickedFilterfileNewbutton() if (globalPath.empty() && userPath.empty()) { - LangMessageBox(IDS_FILEFILTER_NO_USERFOLDER, MB_ICONSTOP); + AfxMessageBox( + _("User's filter file folder is not defined!\n\nPlease select filter folder in Options/System.").c_str(), MB_ICONSTOP); return; } diff --git a/Src/LoadSaveCodepageDlg.cpp b/Src/LoadSaveCodepageDlg.cpp index 79aabf41b..8f5431569 100644 --- a/Src/LoadSaveCodepageDlg.cpp +++ b/Src/LoadSaveCodepageDlg.cpp @@ -91,12 +91,9 @@ BOOL CLoadSaveCodepageDlg::OnInitDialog() int i, j; for (i = 0, j = 0; i < count; i++) { - TCHAR desc[256]; - wsprintf(desc, _T("%05d - %ls"), cpi[i].codepage, cpi[i].desc); - combol.AddString(desc); - combol.SetItemData(j, cpi[i].codepage); - combos.AddString(desc); - combos.SetItemData(j, cpi[i].codepage); + String desc = string_format(_T("%05d - %ls"), cpi[i].codepage, cpi[i].desc); + combol.AddString(desc.c_str()); + combos.AddString(desc.c_str()); if (cpi[i].codepage == m_nLoadCodepage) { combol.SetCurSel(j); @@ -110,9 +107,9 @@ BOOL CLoadSaveCodepageDlg::OnInitDialog() AfxGetMainWnd()->CenterWindow(this); - SetDlgItemText(IDC_LEFT_FILES_LABEL, m_sAffectsLeftString.c_str()); - SetDlgItemText(IDC_MIDDLE_FILES_LABEL, m_sAffectsMiddleString.c_str()); - SetDlgItemText(IDC_RIGHT_FILES_LABEL, m_sAffectsRightString.c_str()); + SetDlgItemText(IDC_LEFT_FILES_LABEL, m_sAffectsLeftString); + SetDlgItemText(IDC_MIDDLE_FILES_LABEL, m_sAffectsMiddleString); + SetDlgItemText(IDC_RIGHT_FILES_LABEL, m_sAffectsRightString); UpdateSaveGroup(); @@ -124,14 +121,6 @@ BOOL CLoadSaveCodepageDlg::OnInitDialog() } /** - * @brief Shortcut to enable or disable a control - */ -void CLoadSaveCodepageDlg::EnableDlgItem(int item, bool enable) -{ - GetDlgItem(item)->EnableWindow(!!enable); -} - -/** * @brief If user unchecks left, then check right (to ensure never have nothing checked) */ void CLoadSaveCodepageDlg::OnAffectsLeftBtnClicked() diff --git a/Src/LoadSaveCodepageDlg.h b/Src/LoadSaveCodepageDlg.h index b887f966e..9622aabcb 100644 --- a/Src/LoadSaveCodepageDlg.h +++ b/Src/LoadSaveCodepageDlg.h @@ -31,7 +31,6 @@ public: private: void UpdateDataToWindow() { UpdateData(FALSE); } void UpdateDataFromWindow() { UpdateData(TRUE); } - void EnableDlgItem(int item, bool enable); void UpdateSaveGroup(); // Implementation data diff --git a/Src/PluginsListDlg.cpp b/Src/PluginsListDlg.cpp index c258ae947..1923d2322 100644 --- a/Src/PluginsListDlg.cpp +++ b/Src/PluginsListDlg.cpp @@ -51,12 +51,8 @@ BOOL PluginsListDlg::OnInitDialog() AddPlugins(); m_list.SetItemState(0, LVIS_SELECTED, LVIS_SELECTED); - bool pluginsEnabled = GetOptionsMgr()->GetBool(OPT_PLUGINS_ENABLED); - if (pluginsEnabled) - { - CButton *btn = (CButton *)GetDlgItem(IDC_PLUGINS_ENABLE); - btn->SetCheck(BST_CHECKED); - } + SetDlgItemChecked(IDC_PLUGINS_ENABLE, + GetOptionsMgr()->GetBool(OPT_PLUGINS_ENABLED) ? BST_CHECKED : BST_UNCHECKED); return FALSE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE @@ -120,8 +116,8 @@ void PluginsListDlg::AddPluginsToList(const wchar_t *pluginEvent, const String& */ void PluginsListDlg::OnBnClickedOk() { - CButton *btn = (CButton *)GetDlgItem(IDC_PLUGINS_ENABLE); - GetOptionsMgr()->SaveOption(OPT_PLUGINS_ENABLED, (btn->GetCheck() == BST_CHECKED)); + GetOptionsMgr()->SaveOption(OPT_PLUGINS_ENABLED, + (IsDlgButtonChecked(IDC_PLUGINS_ENABLE) == 1)); for (int i = 0; i < m_list.GetItemCount(); ++i) { diff --git a/Src/ProjectFilePathsDlg.cpp b/Src/ProjectFilePathsDlg.cpp index 6099d6193..6498623b2 100644 --- a/Src/ProjectFilePathsDlg.cpp +++ b/Src/ProjectFilePathsDlg.cpp @@ -94,12 +94,11 @@ void ProjectFilePathsDlg::OnBnClickedProjRfileBrowse() void ProjectFilePathsDlg::OnBnClickedProjFilterSelect() { String filterPrefix = _("[F] "); - CString curFilter; + String curFilter; const BOOL bUseMask = theApp.m_pGlobalFileFilter->IsUsingMask(); GetDlgItemText(IDC_PROJ_FILTER_EDIT, curFilter); - curFilter.TrimLeft(); - curFilter.TrimRight(); + curFilter = string_trim_ws(curFilter); GetMainFrame()->SelectFilter(); @@ -109,13 +108,13 @@ void ProjectFilePathsDlg::OnBnClickedProjFilterSelect() // If we had filter chosen and now has mask we can overwrite filter if (!bUseMask || curFilter[0] != '*') { - SetDlgItemText(IDC_PROJ_FILTER_EDIT, filterNameOrMask.c_str()); + SetDlgItemText(IDC_PROJ_FILTER_EDIT, filterNameOrMask); } } else { filterNameOrMask = filterPrefix + filterNameOrMask; - SetDlgItemText(IDC_PROJ_FILTER_EDIT, filterNameOrMask.c_str()); + SetDlgItemText(IDC_PROJ_FILTER_EDIT, filterNameOrMask); } } diff --git a/Src/PropArchive.cpp b/Src/PropArchive.cpp index 567959ac3..8af5683ac 100644 --- a/Src/PropArchive.cpp +++ b/Src/PropArchive.cpp @@ -32,6 +32,7 @@ void PropArchive::DoDataExchange(CDataExchange* pDX) CPropertyPage::DoDataExchange(pDX); DDX_Check(pDX, IDC_ARCHIVE_ENABLE, m_bEnableSupport); DDX_Check(pDX, IDC_ARCHIVE_DETECTTYPE, m_bProbeType); + UpdateControls(); } @@ -59,20 +60,6 @@ void PropArchive::WriteOptions() } /** - * @brief Called before propertysheet is drawn. - */ -BOOL PropArchive::OnInitDialog() -{ - OptionsPanel::OnInitDialog(); - UpdateData(FALSE); - - UpdateControls(); - - return TRUE; // return TRUE unless you set the focus to a control - // EXCEPTION: OCX Property Pages should return FALSE -} - -/** * @brief Called when archive support is enabled or disabled. */ void PropArchive::OnEnableClicked() @@ -85,11 +72,5 @@ void PropArchive::OnEnableClicked() */ void PropArchive::UpdateControls() { - CButton *chkEnabled = (CButton *) GetDlgItem(IDC_ARCHIVE_ENABLE); - CButton *chkProbe = (CButton *) GetDlgItem(IDC_ARCHIVE_DETECTTYPE); - - BOOL enableItems = FALSE; - if (chkEnabled->GetCheck() == 1) - enableItems = TRUE; - chkProbe->EnableWindow(enableItems); + EnableDlgItem(IDC_ARCHIVE_DETECTTYPE, IsDlgButtonChecked(IDC_ARCHIVE_ENABLE) == 1); } diff --git a/Src/PropArchive.h b/Src/PropArchive.h index d260309ad..ae0a35ac0 100644 --- a/Src/PropArchive.h +++ b/Src/PropArchive.h @@ -27,7 +27,6 @@ public: protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - virtual BOOL OnInitDialog(); void UpdateControls(); afx_msg void OnEnableClicked(); diff --git a/Src/PropBackups.cpp b/Src/PropBackups.cpp index 689fb8dec..8d6be8817 100644 --- a/Src/PropBackups.cpp +++ b/Src/PropBackups.cpp @@ -55,7 +55,7 @@ void PropBackups::ReadOptions() m_bCreateForFolderCmp = GetOptionsMgr()->GetBool(OPT_BACKUP_FOLDERCMP); m_bCreateForFileCmp = GetOptionsMgr()->GetBool(OPT_BACKUP_FILECMP); m_nBackupFolder = GetOptionsMgr()->GetInt(OPT_BACKUP_LOCATION); - m_sGlobalFolder = GetOptionsMgr()->GetString(OPT_BACKUP_GLOBALFOLDER).c_str(); + m_sGlobalFolder = GetOptionsMgr()->GetString(OPT_BACKUP_GLOBALFOLDER); m_bAppendBak = GetOptionsMgr()->GetBool(OPT_BACKUP_ADD_BAK); m_bAppendTime = GetOptionsMgr()->GetBool(OPT_BACKUP_ADD_TIME); } @@ -72,9 +72,9 @@ void PropBackups::WriteOptions() GetOptionsMgr()->SaveOption(OPT_BACKUP_FOLDERCMP, m_bCreateForFolderCmp); GetOptionsMgr()->SaveOption(OPT_BACKUP_FILECMP, m_bCreateForFileCmp); GetOptionsMgr()->SaveOption(OPT_BACKUP_LOCATION, m_nBackupFolder); - GetOptionsMgr()->SaveOption(OPT_BACKUP_GLOBALFOLDER, String(m_sGlobalFolder)); - GetOptionsMgr()->SaveOption(OPT_BACKUP_ADD_BAK, m_bAppendBak == TRUE); - GetOptionsMgr()->SaveOption(OPT_BACKUP_ADD_TIME, m_bAppendTime == TRUE); + GetOptionsMgr()->SaveOption(OPT_BACKUP_GLOBALFOLDER, m_sGlobalFolder); + GetOptionsMgr()->SaveOption(OPT_BACKUP_ADD_BAK, m_bAppendBak); + GetOptionsMgr()->SaveOption(OPT_BACKUP_ADD_TIME, m_bAppendTime); } /** @@ -85,6 +85,6 @@ void PropBackups::OnBnClickedBackupBrowse() String path; if (SelectFolder(path, m_sGlobalFolder.c_str(), _T(""), GetSafeHwnd())) { - SetDlgItemText(IDC_BACKUP_FOLDER, path.c_str()); + SetDlgItemText(IDC_BACKUP_FOLDER, path); } } diff --git a/Src/PropCodepage.cpp b/Src/PropCodepage.cpp index 4f677c3f9..7b6d9e8b3 100644 --- a/Src/PropCodepage.cpp +++ b/Src/PropCodepage.cpp @@ -102,18 +102,10 @@ BOOL PropCodepage::OnInitDialog() { OptionsPanel::OnInitDialog(); - CEdit * pEdit = (CEdit *) GetDlgItem(IDC_CUSTOM_CP_NUMBER); - // Enable/disable "Custom codepage" edit field - if (IsDlgButtonChecked(IDC_CP_CUSTOM)) - pEdit->EnableWindow(TRUE); - else - pEdit->EnableWindow(FALSE); - - if (IsDlgButtonChecked(IDC_DETECT_CODEPAGE2)) - m_comboAutodetectType.EnableWindow(TRUE); - else - m_comboAutodetectType.EnableWindow(FALSE); + EnableDlgItem(IDC_CUSTOM_CP_NUMBER, IsDlgButtonChecked(IDC_CP_CUSTOM) == 1); + m_comboAutodetectType.EnableWindow( + IsDlgButtonChecked(IDC_DETECT_CODEPAGE2) == 1); m_comboCustomCodepageValue.SetWindowText(string_to_str(m_nCustomCodepageValue).c_str()); @@ -127,10 +119,8 @@ BOOL PropCodepage::OnInitDialog() { if (cpi[i].codepage == 1200 /* UNICODE */) continue; - TCHAR desc[256]; - wsprintf(desc, _T("%05d - %ls"), cpi[i].codepage, cpi[i].desc); - m_comboCustomCodepageValue.AddString(desc); - m_comboCustomCodepageValue.SetItemData(j, cpi[i].codepage); + String desc = string_format(_T("%05d - %ls"), cpi[i].codepage, cpi[i].desc); + m_comboCustomCodepageValue.AddString(desc.c_str()); if (cpi[i].codepage == m_nCustomCodepageValue) m_comboCustomCodepageValue.SetCurSel(j); j++; @@ -154,20 +144,18 @@ BOOL PropCodepage::OnInitDialog() void PropCodepage::OnCpSystem() { - GetDlgItem(IDC_CUSTOM_CP_NUMBER)->EnableWindow(FALSE); + EnableDlgItem(IDC_CUSTOM_CP_NUMBER, false); } void PropCodepage::OnCpCustom() { - GetDlgItem(IDC_CUSTOM_CP_NUMBER)->EnableWindow(TRUE); + EnableDlgItem(IDC_CUSTOM_CP_NUMBER, true); } void PropCodepage::OnDetectCodepage2() { - if (IsDlgButtonChecked(IDC_DETECT_CODEPAGE2)) - m_comboAutodetectType.EnableWindow(TRUE); - else - m_comboAutodetectType.EnableWindow(FALSE); + m_comboAutodetectType.EnableWindow( + IsDlgButtonChecked(IDC_DETECT_CODEPAGE2) == 1); } void PropCodepage::OnDetectAutodetecttype() @@ -177,7 +165,7 @@ void PropCodepage::OnDetectAutodetecttype() void PropCodepage::OnCpUi() { - GetDlgItem(IDC_CUSTOM_CP_NUMBER)->EnableWindow(FALSE); + EnableDlgItem(IDC_CUSTOM_CP_NUMBER, false); } void PropCodepage::GetEncodingCodePageFromNameString() diff --git a/Src/PropColors.cpp b/Src/PropColors.cpp index 4e1f66da1..f690469eb 100644 --- a/Src/PropColors.cpp +++ b/Src/PropColors.cpp @@ -138,8 +138,7 @@ void PropMergeColors::BrowseColor(CColorButton & colorButton) void PropMergeColors::UpdateTextColorButtonState(int checkboxId, CColorButton &btn) { - CButton *chkbox = static_cast(GetDlgItem(checkboxId)); - chkbox->SetCheck(btn.GetColor() != COLOR_NONE); + SetDlgItemChecked(checkboxId, btn.GetColor() != COLOR_NONE); btn.ShowWindow(btn.GetColor() != COLOR_NONE ? SW_SHOW : SW_HIDE); } diff --git a/Src/PropCompare.cpp b/Src/PropCompare.cpp index f15531399..15c3c4c66 100644 --- a/Src/PropCompare.cpp +++ b/Src/PropCompare.cpp @@ -62,7 +62,7 @@ void PropCompare::ReadOptions() m_bIgnoreBlankLines = GetOptionsMgr()->GetBool(OPT_CMP_IGNORE_BLANKLINES); m_bFilterCommentsLines = GetOptionsMgr()->GetBool(OPT_CMP_FILTER_COMMENTLINES); m_bIgnoreCase = GetOptionsMgr()->GetBool(OPT_CMP_IGNORE_CASE); - m_bIgnoreEol = GetOptionsMgr()->GetBool(OPT_CMP_IGNORE_EOL) ? true : false; + m_bIgnoreEol = GetOptionsMgr()->GetBool(OPT_CMP_IGNORE_EOL); m_bMovedBlocks = GetOptionsMgr()->GetBool(OPT_CMP_MOVED_BLOCKS); m_bMatchSimilarLines = GetOptionsMgr()->GetBool(OPT_CMP_MATCH_SIMILAR_LINES); } diff --git a/Src/PropCompareBinary.cpp b/Src/PropCompareBinary.cpp index c5a30909a..0125bc108 100644 --- a/Src/PropCompareBinary.cpp +++ b/Src/PropCompareBinary.cpp @@ -75,7 +75,7 @@ END_MESSAGE_MAP() */ void PropCompareBinary::ReadOptions() { - m_sFilePatterns = GetOptionsMgr()->GetString(OPT_CMP_BIN_FILEPATTERNS).c_str(); + m_sFilePatterns = GetOptionsMgr()->GetString(OPT_CMP_BIN_FILEPATTERNS); } /** diff --git a/Src/PropCompareBinary.h b/Src/PropCompareBinary.h index 24a4b2f92..25ccd3f72 100644 --- a/Src/PropCompareBinary.h +++ b/Src/PropCompareBinary.h @@ -26,7 +26,7 @@ public: // Dialog Data //{{AFX_DATA(PropCompareBinary) enum { IDD = IDD_PROPPAGE_COMPARE_BINARY }; - CString m_sFilePatterns; + String m_sFilePatterns; //}}AFX_DATA diff --git a/Src/PropCompareFolder.cpp b/Src/PropCompareFolder.cpp index f16d612e4..99d8c4bc9 100644 --- a/Src/PropCompareFolder.cpp +++ b/Src/PropCompareFolder.cpp @@ -111,11 +111,7 @@ BOOL PropCompareFolder::OnInitDialog() combo->AddString(item.c_str()); combo->SetCurSel(m_compareMethod); - CButton * pBtn = (CButton*) GetDlgItem(IDC_COMPARE_STOPFIRST); - if (m_compareMethod == 1) - pBtn->EnableWindow(TRUE); - else - pBtn->EnableWindow(FALSE); + EnableDlgItem(IDC_COMPARE_STOPFIRST, m_compareMethod == 1); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE @@ -143,9 +139,5 @@ void PropCompareFolder::OnDefaults() void PropCompareFolder::OnCbnSelchangeComparemethodcombo() { CComboBox * pCombo = (CComboBox*) GetDlgItem(IDC_COMPAREMETHODCOMBO); - CButton * pBtn = (CButton*) GetDlgItem(IDC_COMPARE_STOPFIRST); - if (pCombo->GetCurSel() == 1) - pBtn->EnableWindow(TRUE); - else - pBtn->EnableWindow(FALSE); + EnableDlgItem(IDC_COMPARE_STOPFIRST, pCombo->GetCurSel() == 1); } diff --git a/Src/PropCompareImage.cpp b/Src/PropCompareImage.cpp index 859bb09b8..d3bd4c5b0 100644 --- a/Src/PropCompareImage.cpp +++ b/Src/PropCompareImage.cpp @@ -45,7 +45,7 @@ END_MESSAGE_MAP() */ void PropCompareImage::ReadOptions() { - m_sFilePatterns = GetOptionsMgr()->GetString(OPT_CMP_IMG_FILEPATTERNS).c_str(); + m_sFilePatterns = GetOptionsMgr()->GetString(OPT_CMP_IMG_FILEPATTERNS); } /** diff --git a/Src/PropCompareImage.h b/Src/PropCompareImage.h index 712a7dff2..7c220a1aa 100644 --- a/Src/PropCompareImage.h +++ b/Src/PropCompareImage.h @@ -26,7 +26,7 @@ public: // Dialog Data //{{AFX_DATA(PropCompareImage) enum { IDD = IDD_PROPPAGE_COMPARE_IMAGE }; - CString m_sFilePatterns; + String m_sFilePatterns; //}}AFX_DATA diff --git a/Src/PropEditor.cpp b/Src/PropEditor.cpp index dbab96f50..77eb4fb01 100644 --- a/Src/PropEditor.cpp +++ b/Src/PropEditor.cpp @@ -44,6 +44,7 @@ void PropEditor::DoDataExchange(CDataExchange* pDX) DDX_Check(pDX, IDC_HILITE_CHECK, m_bHiliteSyntax); DDX_Radio(pDX, IDC_PROP_INSERT_TABS, m_nTabType); DDX_Text(pDX, IDC_TAB_EDIT, m_nTabSize); + DDV_MaxChars(pDX, std::to_string(m_nTabSize).c_str(), 2); DDX_Check(pDX, IDC_AUTOMRESCAN_CHECK, m_bAutomaticRescan); DDX_Check(pDX, IDC_MIXED_EOL, m_bAllowMixedEol); DDX_Check(pDX, IDC_VIEW_LINE_DIFFERENCES, m_bViewLineDifferences); @@ -107,12 +108,6 @@ BOOL PropEditor::OnInitDialog() { OptionsPanel::OnInitDialog(); - CEdit * pEdit = (CEdit *) GetDlgItem(IDC_TAB_EDIT); - - // Limit max text of tabsize to 2 chars - if (pEdit != NULL) - pEdit->SetLimitText(2); - LoadBreakTypeStrings(); UpdateDataToWindow(); UpdateLineDiffControls(); @@ -139,16 +134,6 @@ void PropEditor::OnLineDiffControlClicked() UpdateLineDiffControls(); } -/** - * @brief Shortcut to enable or disable a control - * @param [in] item ID of dialog control to enable/disable. - * @param [in] enable if true control is enabled, else disabled. - */ -void PropEditor::EnableDlgItem(int item, bool enable) -{ - GetDlgItem(item)->EnableWindow(!!enable); -} - /** * @brief Update availability of line difference controls */ @@ -167,11 +152,7 @@ void PropEditor::UpdateLineDiffControls() */ void PropEditor::OnEnKillfocusTabEdit() { - CEdit * pEdit = (CEdit *)GetDlgItem(IDC_TAB_EDIT); - String valueAsText; - pEdit->GetWindowText(PopString(valueAsText)); - int value = 0; - try { value = std::stoi(valueAsText); } catch (...) {}; + unsigned value = GetDlgItemInt(IDC_TAB_EDIT); if (value < 1 || value > MAX_TABSIZE) { String msg = string_format_string1( diff --git a/Src/PropEditor.h b/Src/PropEditor.h index 6d7a55896..fe62ca061 100644 --- a/Src/PropEditor.h +++ b/Src/PropEditor.h @@ -47,7 +47,6 @@ private: void UpdateDataToWindow() { UpdateData(FALSE); } void UpdateDataFromWindow() { UpdateData(TRUE); } void UpdateLineDiffControls(); - void EnableDlgItem(int item, bool enable); // Overrides // ClassWizard generated virtual function overrides diff --git a/Src/PropGeneral.cpp b/Src/PropGeneral.cpp index 77afa1cd9..09eda53a1 100644 --- a/Src/PropGeneral.cpp +++ b/Src/PropGeneral.cpp @@ -152,5 +152,5 @@ void PropGeneral::WriteOptions() void PropGeneral::OnResetAllMessageBoxes() { CMessageBoxDialog::ResetMessageBoxes(); - LangMessageBox(IDS_MESSAGE_BOX_ARE_RESET, MB_ICONINFORMATION); + AfxMessageBox(_("All message boxes are now displayed again.").c_str(), MB_ICONINFORMATION); } diff --git a/Src/PropRegistry.cpp b/Src/PropRegistry.cpp index 433d2ae49..b4e26451b 100644 --- a/Src/PropRegistry.cpp +++ b/Src/PropRegistry.cpp @@ -104,7 +104,7 @@ void PropRegistry::OnBrowseEditor() String path; if (SelectFile(GetSafeHwnd(), path, m_strEditorPath.c_str(), _("Open"), _("Programs|*.exe;*.bat;*.cmd|All Files (*.*)|*.*||"), TRUE)) { - SetDlgItemText(IDC_EXT_EDITOR_PATH, path.c_str()); + SetDlgItemText(IDC_EXT_EDITOR_PATH, path); } } @@ -114,7 +114,7 @@ void PropRegistry::OnBrowseFilterPath() String path; if (SelectFolder(path, m_strUserFilterPath.c_str(), _("Open"), GetSafeHwnd())) { - SetDlgItemText(IDC_FILTER_USER_PATH, path.c_str()); + SetDlgItemText(IDC_FILTER_USER_PATH, path); } } @@ -124,6 +124,6 @@ void PropRegistry::OnBrowseTmpFolder() String path; if (SelectFolder(path, m_tempFolder.c_str(), _T(""), GetSafeHwnd())) { - SetDlgItemText(IDC_TMPFOLDER_NAME, path.c_str()); + SetDlgItemText(IDC_TMPFOLDER_NAME, path); } } diff --git a/Src/PropShell.cpp b/Src/PropShell.cpp index 7816d6ce2..462b4885d 100644 --- a/Src/PropShell.cpp +++ b/Src/PropShell.cpp @@ -86,8 +86,8 @@ BOOL PropShell::OnInitDialog() #define BCM_SETSHIELD (0x1600/*BCM_FIRST*/ + 0x000C) #endif - ::SendMessage(GetDlgItem(IDC_REGISTER_SHELLEXTENSION)->m_hWnd, BCM_SETSHIELD, 0, TRUE); - ::SendMessage(GetDlgItem(IDC_UNREGISTER_SHELLEXTENSION)->m_hWnd, BCM_SETSHIELD, 0, TRUE); + SendDlgItemMessage(IDC_REGISTER_SHELLEXTENSION, BCM_SETSHIELD, 0, TRUE); + SendDlgItemMessage(IDC_UNREGISTER_SHELLEXTENSION, BCM_SETSHIELD, 0, TRUE); // Update shell extension checkboxes UpdateButtons(); @@ -225,11 +225,11 @@ void PropShell::AdvancedContextMenuCheck() void PropShell::UpdateButtons() { bool registered = IsShellExtensionRegistered(); - GetDlgItem(IDC_EXPLORER_CONTEXT)->EnableWindow(registered); - GetDlgItem(IDC_REGISTER_SHELLEXTENSION)->EnableWindow(!registered); - GetDlgItem(IDC_UNREGISTER_SHELLEXTENSION)->EnableWindow(registered); - GetDlgItem(IDC_EXPLORER_ADVANCED)->EnableWindow( - GetDlgItem(IDC_EXPLORER_CONTEXT)->IsWindowEnabled() && IsDlgButtonChecked(IDC_EXPLORER_CONTEXT)); + EnableDlgItem(IDC_EXPLORER_CONTEXT, registered); + EnableDlgItem(IDC_REGISTER_SHELLEXTENSION, !registered); + EnableDlgItem(IDC_UNREGISTER_SHELLEXTENSION, registered); + EnableDlgItem(IDC_EXPLORER_ADVANCED, + registered && IsDlgButtonChecked(IDC_EXPLORER_CONTEXT)); } void PropShell::OnRegisterShellExtension() diff --git a/Src/PropSyntaxColors.cpp b/Src/PropSyntaxColors.cpp index 90d9b1127..2fe530c77 100644 --- a/Src/PropSyntaxColors.cpp +++ b/Src/PropSyntaxColors.cpp @@ -15,42 +15,25 @@ #define new DEBUG_NEW #endif +static const unsigned ColorIndices[] = { + COLORINDEX_KEYWORD, COLORINDEX_FUNCNAME, COLORINDEX_COMMENT, + COLORINDEX_NUMBER, COLORINDEX_OPERATOR, COLORINDEX_STRING, + COLORINDEX_PREPROCESSOR, COLORINDEX_USER1, COLORINDEX_USER2 +}; + IMPLEMENT_DYNAMIC(PropSyntaxColors, CPropertyPage) PropSyntaxColors::PropSyntaxColors(COptionsMgr *optionsMgr, SyntaxColors *pColors) : OptionsPanel(optionsMgr, PropSyntaxColors::IDD) -, m_nKeywordsBold(0) -, m_nFunctionsBold(0) -, m_nCommentsBold(0) -, m_nNumbersBold(0) -, m_nOperatorsBold(0) -, m_nStringsBold(0) -, m_nPreProcessorBold(0) -, m_nUser1Bold(0) -, m_nUser2Bold(0) { m_pTempColors = pColors; // Set colors for buttons, do NOT invalidate - m_btnKeywordsText.SetColor(m_pTempColors->GetColor(COLORINDEX_KEYWORD), FALSE); - m_btnFunctionsText.SetColor(m_pTempColors->GetColor(COLORINDEX_FUNCNAME), FALSE); - m_btnCommentsText.SetColor(m_pTempColors->GetColor(COLORINDEX_COMMENT), FALSE); - m_btnNumbersText.SetColor(m_pTempColors->GetColor(COLORINDEX_NUMBER), FALSE); - m_btnOperatorsText.SetColor(m_pTempColors->GetColor(COLORINDEX_OPERATOR), FALSE); - m_btnStringsText.SetColor(m_pTempColors->GetColor(COLORINDEX_STRING), FALSE); - m_btnPreprocessorText.SetColor(m_pTempColors->GetColor(COLORINDEX_PREPROCESSOR), FALSE); - m_btnUser1Text.SetColor(m_pTempColors->GetColor(COLORINDEX_USER1), FALSE); - m_btnUser2Text.SetColor(m_pTempColors->GetColor(COLORINDEX_USER2), FALSE); - - m_nKeywordsBold = GetCheckVal(COLORINDEX_KEYWORD); - m_nFunctionsBold = GetCheckVal(COLORINDEX_FUNCNAME); - m_nCommentsBold = GetCheckVal(COLORINDEX_COMMENT); - m_nNumbersBold = GetCheckVal(COLORINDEX_NUMBER); - m_nOperatorsBold = GetCheckVal(COLORINDEX_OPERATOR); - m_nStringsBold = GetCheckVal(COLORINDEX_STRING); - m_nPreProcessorBold = GetCheckVal(COLORINDEX_PREPROCESSOR); - m_nUser1Bold = GetCheckVal(COLORINDEX_USER1); - m_nUser2Bold = GetCheckVal(COLORINDEX_USER2); + for (auto&& colorIndex : ColorIndices) + { + m_colorButtons[colorIndex].SetColor(m_pTempColors->GetColor(colorIndex), FALSE); + m_nBolds[colorIndex] = GetCheckVal(colorIndex); + } memset(m_cCustColors, 0, sizeof(m_cCustColors)); } @@ -58,56 +41,47 @@ PropSyntaxColors::PropSyntaxColors(COptionsMgr *optionsMgr, SyntaxColors *pColor void PropSyntaxColors::DoDataExchange(CDataExchange* pDX) { CPropertyPage::DoDataExchange(pDX); - DDX_Control(pDX, IDC_SCOLOR_KEYWORDS, m_btnKeywordsText); - DDX_Control(pDX, IDC_SCOLOR_FUNCTIONS, m_btnFunctionsText); - DDX_Control(pDX, IDC_SCOLOR_COMMENTS, m_btnCommentsText); - DDX_Control(pDX, IDC_SCOLOR_NUMBERS, m_btnNumbersText); - DDX_Control(pDX, IDC_SCOLOR_OPERATORS, m_btnOperatorsText); - DDX_Control(pDX, IDC_SCOLOR_STRINGS, m_btnStringsText); - DDX_Control(pDX, IDC_SCOLOR_PREPROCESSOR, m_btnPreprocessorText); - DDX_Control(pDX, IDC_SCOLOR_USER1, m_btnUser1Text); - DDX_Control(pDX, IDC_SCOLOR_USER2, m_btnUser2Text); - DDX_Control(pDX, IDC_SCOLOR_KEYWORDS_BOLD, m_btnKeywordsBold); - DDX_Control(pDX, IDC_SCOLOR_FUNCTIONS_BOLD, m_btnFunctionsBold); - DDX_Control(pDX, IDC_SCOLOR_COMMENTS_BOLD, m_btnCommentsBold); - DDX_Control(pDX, IDC_SCOLOR_NUMBERS_BOLD, m_btnNumbersBold); - DDX_Control(pDX, IDC_SCOLOR_OPERATORS_BOLD, m_btnOperatorsBold); - DDX_Control(pDX, IDC_SCOLOR_STRINGS_BOLD, m_btnStringsBold); - DDX_Control(pDX, IDC_SCOLOR_PREPROCESSOR_BOLD, m_btnPreProcessorBold); - DDX_Control(pDX, IDC_SCOLOR_USER1_BOLD, m_btnUser1Bold); - DDX_Control(pDX, IDC_SCOLOR_USER2_BOLD, m_btnUser2Bold); - DDX_Check(pDX, IDC_SCOLOR_KEYWORDS_BOLD, m_nKeywordsBold); - DDX_Check(pDX, IDC_SCOLOR_FUNCTIONS_BOLD, m_nFunctionsBold); - DDX_Check(pDX, IDC_SCOLOR_COMMENTS_BOLD, m_nCommentsBold); - DDX_Check(pDX, IDC_SCOLOR_NUMBERS_BOLD, m_nNumbersBold); - DDX_Check(pDX, IDC_SCOLOR_OPERATORS_BOLD, m_nOperatorsBold); - DDX_Check(pDX, IDC_SCOLOR_STRINGS_BOLD, m_nStringsBold); - DDX_Check(pDX, IDC_SCOLOR_PREPROCESSOR_BOLD, m_nPreProcessorBold); - DDX_Check(pDX, IDC_SCOLOR_USER1_BOLD, m_nUser1Bold); - DDX_Check(pDX, IDC_SCOLOR_USER2_BOLD, m_nUser2Bold); + DDX_Control(pDX, IDC_SCOLOR_KEYWORDS, m_colorButtons[COLORINDEX_KEYWORD]); + DDX_Control(pDX, IDC_SCOLOR_FUNCTIONS, m_colorButtons[COLORINDEX_FUNCNAME]); + DDX_Control(pDX, IDC_SCOLOR_COMMENTS, m_colorButtons[COLORINDEX_COMMENT]); + DDX_Control(pDX, IDC_SCOLOR_NUMBERS, m_colorButtons[COLORINDEX_NUMBER]); + DDX_Control(pDX, IDC_SCOLOR_OPERATORS, m_colorButtons[COLORINDEX_OPERATOR]); + DDX_Control(pDX, IDC_SCOLOR_STRINGS, m_colorButtons[COLORINDEX_STRING]); + DDX_Control(pDX, IDC_SCOLOR_PREPROCESSOR, m_colorButtons[COLORINDEX_PREPROCESSOR]); + DDX_Control(pDX, IDC_SCOLOR_USER1, m_colorButtons[COLORINDEX_USER1]); + DDX_Control(pDX, IDC_SCOLOR_USER2, m_colorButtons[COLORINDEX_USER2]); + DDX_Check(pDX, IDC_SCOLOR_KEYWORDS_BOLD, m_nBolds[COLORINDEX_KEYWORD]); + DDX_Check(pDX, IDC_SCOLOR_FUNCTIONS_BOLD, m_nBolds[COLORINDEX_FUNCNAME]); + DDX_Check(pDX, IDC_SCOLOR_COMMENTS_BOLD, m_nBolds[COLORINDEX_COMMENT]); + DDX_Check(pDX, IDC_SCOLOR_NUMBERS_BOLD, m_nBolds[COLORINDEX_NUMBER]); + DDX_Check(pDX, IDC_SCOLOR_OPERATORS_BOLD, m_nBolds[COLORINDEX_OPERATOR]); + DDX_Check(pDX, IDC_SCOLOR_STRINGS_BOLD, m_nBolds[COLORINDEX_STRING]); + DDX_Check(pDX, IDC_SCOLOR_PREPROCESSOR_BOLD, m_nBolds[COLORINDEX_PREPROCESSOR]); + DDX_Check(pDX, IDC_SCOLOR_USER1_BOLD, m_nBolds[COLORINDEX_USER1]); + DDX_Check(pDX, IDC_SCOLOR_USER2_BOLD, m_nBolds[COLORINDEX_USER2]); } BEGIN_MESSAGE_MAP(PropSyntaxColors, CPropertyPage) - ON_BN_CLICKED(IDC_SCOLOR_KEYWORDS, OnBnClickedEcolorKeywords) - ON_BN_CLICKED(IDC_SCOLOR_FUNCTIONS, OnBnClickedEcolorFunctions) - ON_BN_CLICKED(IDC_SCOLOR_COMMENTS, OnBnClickedEcolorComments) - ON_BN_CLICKED(IDC_SCOLOR_NUMBERS, OnBnClickedEcolorNumbers) - ON_BN_CLICKED(IDC_SCOLOR_OPERATORS, OnBnClickedEcolorOperators) - ON_BN_CLICKED(IDC_SCOLOR_STRINGS, OnBnClickedEcolorStrings) - ON_BN_CLICKED(IDC_SCOLOR_PREPROCESSOR, OnBnClickedEcolorPreprocessor) - ON_BN_CLICKED(IDC_SCOLOR_USER1, OnBnClickedEcolorUser1) - ON_BN_CLICKED(IDC_SCOLOR_USER2, OnBnClickedEcolorUser2) + ON_BN_CLICKED(IDC_SCOLOR_KEYWORDS, OnBnClickedEcolor) + ON_BN_CLICKED(IDC_SCOLOR_FUNCTIONS, OnBnClickedEcolor) + ON_BN_CLICKED(IDC_SCOLOR_COMMENTS, OnBnClickedEcolor) + ON_BN_CLICKED(IDC_SCOLOR_NUMBERS, OnBnClickedEcolor) + ON_BN_CLICKED(IDC_SCOLOR_OPERATORS, OnBnClickedEcolor) + ON_BN_CLICKED(IDC_SCOLOR_STRINGS, OnBnClickedEcolor) + ON_BN_CLICKED(IDC_SCOLOR_PREPROCESSOR, OnBnClickedEcolor) + ON_BN_CLICKED(IDC_SCOLOR_USER1, OnBnClickedEcolor) + ON_BN_CLICKED(IDC_SCOLOR_USER2, OnBnClickedEcolor) ON_BN_CLICKED(IDC_SCOLORS_BDEFAULTS, OnBnClickedEcolorsBdefaults) - ON_BN_CLICKED(IDC_SCOLOR_KEYWORDS_BOLD, OnBnClickedEcolorKeywordsBold) - ON_BN_CLICKED(IDC_SCOLOR_FUNCTIONS_BOLD, OnBnClickedEcolorFunctionsBold) - ON_BN_CLICKED(IDC_SCOLOR_COMMENTS_BOLD, OnBnClickedEcolorCommentsBold) - ON_BN_CLICKED(IDC_SCOLOR_NUMBERS_BOLD, OnBnClickedEcolorNumbersBold) - ON_BN_CLICKED(IDC_SCOLOR_OPERATORS_BOLD, OnBnClickedEcolorOperatorsBold) - ON_BN_CLICKED(IDC_SCOLOR_STRINGS_BOLD, OnBnClickedEcolorStringsBold) - ON_BN_CLICKED(IDC_SCOLOR_PREPROCESSOR_BOLD, OnBnClickedEcolorPreprocessorBold) - ON_BN_CLICKED(IDC_SCOLOR_USER1_BOLD, OnBnClickedEcolorUser1Bold) - ON_BN_CLICKED(IDC_SCOLOR_USER2_BOLD, OnBnClickedEcolorUser2Bold) + ON_BN_CLICKED(IDC_SCOLOR_KEYWORDS_BOLD, (OnBnClickedBoldButton)) + ON_BN_CLICKED(IDC_SCOLOR_FUNCTIONS_BOLD, (OnBnClickedBoldButton)) + ON_BN_CLICKED(IDC_SCOLOR_COMMENTS_BOLD, (OnBnClickedBoldButton)) + ON_BN_CLICKED(IDC_SCOLOR_NUMBERS_BOLD, (OnBnClickedBoldButton)) + ON_BN_CLICKED(IDC_SCOLOR_OPERATORS_BOLD, (OnBnClickedBoldButton)) + ON_BN_CLICKED(IDC_SCOLOR_STRINGS_BOLD, (OnBnClickedBoldButton)) + ON_BN_CLICKED(IDC_SCOLOR_PREPROCESSOR_BOLD, (OnBnClickedBoldButton)) + ON_BN_CLICKED(IDC_SCOLOR_USER1_BOLD, (OnBnClickedBoldButton)) + ON_BN_CLICKED(IDC_SCOLOR_USER2_BOLD, (OnBnClickedBoldButton)) END_MESSAGE_MAP() /** @@ -134,7 +108,7 @@ void PropSyntaxColors::WriteOptions() /** * @brief Let user browse common color dialog, and select a color & save to registry */ -void PropSyntaxColors::BrowseColorAndSave(CColorButton & colorButton, int colorIndex) +void PropSyntaxColors::BrowseColorAndSave(unsigned colorIndex) { COLORREF currentColor = m_pTempColors->GetColor(colorIndex); CColorDialog dialog(currentColor); @@ -144,126 +118,34 @@ void PropSyntaxColors::BrowseColorAndSave(CColorButton & colorButton, int colorI if (dialog.DoModal() == IDOK) { currentColor = dialog.GetColor(); - colorButton.SetColor(currentColor); + m_colorButtons[colorIndex].SetColor(currentColor); m_pTempColors->SetColor(colorIndex, currentColor); } Options::CustomColors::Save(GetOptionsMgr(), m_cCustColors); } -void PropSyntaxColors::OnBnClickedEcolorKeywords() -{ - BrowseColorAndSave(m_btnKeywordsText, COLORINDEX_KEYWORD); -} - -void PropSyntaxColors::OnBnClickedEcolorFunctions() -{ - BrowseColorAndSave(m_btnFunctionsText, COLORINDEX_FUNCNAME); -} - -void PropSyntaxColors::OnBnClickedEcolorComments() -{ - BrowseColorAndSave(m_btnCommentsText, COLORINDEX_COMMENT); -} - -void PropSyntaxColors::OnBnClickedEcolorNumbers() -{ - BrowseColorAndSave(m_btnNumbersText, COLORINDEX_NUMBER); -} - -void PropSyntaxColors::OnBnClickedEcolorOperators() -{ - BrowseColorAndSave(m_btnOperatorsText, COLORINDEX_OPERATOR); -} - -void PropSyntaxColors::OnBnClickedEcolorStrings() +template +void PropSyntaxColors::OnBnClickedEcolor() { - BrowseColorAndSave(m_btnStringsText, COLORINDEX_STRING); -} - -void PropSyntaxColors::OnBnClickedEcolorPreprocessor() -{ - BrowseColorAndSave(m_btnPreprocessorText, COLORINDEX_PREPROCESSOR); -} - -void PropSyntaxColors::OnBnClickedEcolorUser1() -{ - BrowseColorAndSave(m_btnUser1Text, COLORINDEX_USER1); -} - -void PropSyntaxColors::OnBnClickedEcolorUser2() -{ - BrowseColorAndSave(m_btnUser2Text, COLORINDEX_USER2); + BrowseColorAndSave(colorIndex); } void PropSyntaxColors::OnBnClickedEcolorsBdefaults() { m_pTempColors->SetDefaults(); - m_btnKeywordsText.SetColor(m_pTempColors->GetColor(COLORINDEX_KEYWORD)); - m_btnFunctionsText.SetColor(m_pTempColors->GetColor(COLORINDEX_FUNCNAME)); - m_btnCommentsText.SetColor(m_pTempColors->GetColor(COLORINDEX_COMMENT)); - m_btnNumbersText.SetColor(m_pTempColors->GetColor(COLORINDEX_NUMBER)); - m_btnOperatorsText.SetColor(m_pTempColors->GetColor(COLORINDEX_OPERATOR)); - m_btnStringsText.SetColor(m_pTempColors->GetColor(COLORINDEX_STRING)); - m_btnPreprocessorText.SetColor(m_pTempColors->GetColor(COLORINDEX_PREPROCESSOR)); - m_btnUser1Text.SetColor(m_pTempColors->GetColor(COLORINDEX_USER1)); - m_btnUser2Text.SetColor(m_pTempColors->GetColor(COLORINDEX_USER2)); - - m_nKeywordsBold = GetCheckVal(COLORINDEX_KEYWORD); - m_nFunctionsBold = GetCheckVal(COLORINDEX_FUNCNAME); - m_nCommentsBold = GetCheckVal(COLORINDEX_COMMENT); - m_nNumbersBold = GetCheckVal(COLORINDEX_NUMBER); - m_nOperatorsBold = GetCheckVal(COLORINDEX_OPERATOR); - m_nStringsBold = GetCheckVal(COLORINDEX_STRING); - m_nPreProcessorBold = GetCheckVal(COLORINDEX_PREPROCESSOR); - m_nUser1Bold = GetCheckVal(COLORINDEX_USER1); - m_nUser2Bold = GetCheckVal(COLORINDEX_USER2); + for (auto&& colorIndex : ColorIndices) + { + m_colorButtons[colorIndex].SetColor(m_pTempColors->GetColor(colorIndex)); + m_nBolds[colorIndex] = GetCheckVal(colorIndex); + } UpdateData(FALSE); } -void PropSyntaxColors::OnBnClickedEcolorKeywordsBold() -{ - UpdateBoldStatus(m_btnKeywordsBold, COLORINDEX_KEYWORD); -} - -void PropSyntaxColors::OnBnClickedEcolorFunctionsBold() +template +void PropSyntaxColors::OnBnClickedBoldButton() { - UpdateBoldStatus(m_btnFunctionsBold, COLORINDEX_FUNCNAME); -} - -void PropSyntaxColors::OnBnClickedEcolorCommentsBold() -{ - UpdateBoldStatus(m_btnCommentsBold, COLORINDEX_COMMENT); -} - -void PropSyntaxColors::OnBnClickedEcolorNumbersBold() -{ - UpdateBoldStatus(m_btnNumbersBold, COLORINDEX_NUMBER); -} - -void PropSyntaxColors::OnBnClickedEcolorOperatorsBold() -{ - UpdateBoldStatus(m_btnOperatorsBold, COLORINDEX_OPERATOR); -} - -void PropSyntaxColors::OnBnClickedEcolorStringsBold() -{ - UpdateBoldStatus(m_btnStringsBold, COLORINDEX_STRING); -} - -void PropSyntaxColors::OnBnClickedEcolorPreprocessorBold() -{ - UpdateBoldStatus(m_btnPreProcessorBold, COLORINDEX_PREPROCESSOR); -} - -void PropSyntaxColors::OnBnClickedEcolorUser1Bold() -{ - UpdateBoldStatus(m_btnUser1Bold, COLORINDEX_USER1); -} - -void PropSyntaxColors::OnBnClickedEcolorUser2Bold() -{ - UpdateBoldStatus(m_btnUser2Bold, COLORINDEX_USER2); + m_pTempColors->SetBold(colorIndex, IsDlgButtonChecked(ctlId) == BST_CHECKED); } int PropSyntaxColors::GetCheckVal(UINT nColorIndex) @@ -273,12 +155,3 @@ int PropSyntaxColors::GetCheckVal(UINT nColorIndex) else return BST_UNCHECKED; } - -void PropSyntaxColors::UpdateBoldStatus(CButton &btn, UINT colorIndex) -{ - int state = btn.GetCheck(); - if (state == BST_CHECKED) - m_pTempColors->SetBold(colorIndex, TRUE); - else - m_pTempColors->SetBold(colorIndex, FALSE); -} diff --git a/Src/PropSyntaxColors.h b/Src/PropSyntaxColors.h index 1d6261e44..879ace6fd 100644 --- a/Src/PropSyntaxColors.h +++ b/Src/PropSyntaxColors.h @@ -8,8 +8,7 @@ #include "ColorButton.h" #include "OptionsPanel.h" - -class SyntaxColors; +#include "SyntaxColors.h" const int NumCustomColors = 16; @@ -33,60 +32,20 @@ private: protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - afx_msg void OnBnClickedEcolorKeywords(); - afx_msg void OnBnClickedEcolorFunctions(); - afx_msg void OnBnClickedEcolorComments(); - afx_msg void OnBnClickedEcolorNumbers(); - afx_msg void OnBnClickedEcolorOperators(); - afx_msg void OnBnClickedEcolorStrings(); - afx_msg void OnBnClickedEcolorPreprocessor(); - afx_msg void OnBnClickedEcolorUser1(); - afx_msg void OnBnClickedEcolorUser2(); + template + afx_msg void OnBnClickedEcolor(); afx_msg void OnBnClickedEcolorsBdefaults(); - afx_msg void OnBnClickedEcolorKeywordsBold(); - afx_msg void OnBnClickedEcolorFunctionsBold(); - afx_msg void OnBnClickedEcolorCommentsBold(); - afx_msg void OnBnClickedEcolorNumbersBold(); - afx_msg void OnBnClickedEcolorOperatorsBold(); - afx_msg void OnBnClickedEcolorStringsBold(); - afx_msg void OnBnClickedEcolorPreprocessorBold(); - afx_msg void OnBnClickedEcolorUser1Bold(); - afx_msg void OnBnClickedEcolorUser2Bold(); + template + afx_msg void OnBnClickedBoldButton(); - void BrowseColorAndSave(CColorButton & colorButton, int colorIndex); + void BrowseColorAndSave(unsigned colorIndex); int GetCheckVal(UINT nColorIndex); - void UpdateBoldStatus(CButton &btn, UINT colorIndex); DECLARE_MESSAGE_MAP() private: - CColorButton m_btnKeywordsText; - CColorButton m_btnFunctionsText; - CColorButton m_btnCommentsText; - CColorButton m_btnNumbersText; - CColorButton m_btnOperatorsText; - CColorButton m_btnStringsText; - CColorButton m_btnPreprocessorText; - CColorButton m_btnUser1Text; - CColorButton m_btnUser2Text; - int m_nKeywordsBold; - int m_nFunctionsBold; - int m_nCommentsBold; - int m_nNumbersBold; - int m_nOperatorsBold; - int m_nStringsBold; - int m_nPreProcessorBold; - int m_nUser1Bold; - int m_nUser2Bold; - CButton m_btnKeywordsBold; - CButton m_btnFunctionsBold; - CButton m_btnCommentsBold; - CButton m_btnNumbersBold; - CButton m_btnOperatorsBold; - CButton m_btnStringsBold; - CButton m_btnPreProcessorBold; - CButton m_btnUser1Bold; - CButton m_btnUser2Bold; + CColorButton m_colorButtons[COLORINDEX_LAST + 1]; + int m_nBolds[COLORINDEX_LAST + 1]; SyntaxColors *m_pTempColors; COLORREF m_cCustColors[16]; diff --git a/Src/PropTextColors.cpp b/Src/PropTextColors.cpp index a1d25990e..af77f243f 100644 --- a/Src/PropTextColors.cpp +++ b/Src/PropTextColors.cpp @@ -220,33 +220,19 @@ void PropTextColors::OnDefaultsStandardColors() // Reset all text colors to default every time user checks defaults button SerializeColorsToFromScreen(SET_DEFAULTS); - CButton * btn = (CButton *)GetDlgItem(IDC_DEFAULT_STANDARD_COLORS); - if (btn->GetCheck() == BST_UNCHECKED) - { - EnableColorButtons(FALSE); - } - else - { - EnableColorButtons(TRUE); - } + EnableColorButtons(IsDlgButtonChecked(IDC_DEFAULT_STANDARD_COLORS) == 1); } /** * @brief Enable / disable color controls on dialog. * @param [in] bEnable If TRUE color controls are enabled. */ -void PropTextColors::EnableColorButtons(BOOL bEnable) +void PropTextColors::EnableColorButtons(bool bEnable) { - CStatic * stc = (CStatic *) GetDlgItem(IDC_CUSTOM_COLORS_GROUP); - stc->EnableWindow(bEnable); - stc = (CStatic *) GetDlgItem(IDC_WHITESPACE_COLOR_LABEL); - stc->EnableWindow(bEnable); - stc = (CStatic *) GetDlgItem(IDC_TEXT_COLOR_LABEL); - stc->EnableWindow(bEnable); - stc = (CStatic *) GetDlgItem(IDC_SELECTION_COLOR_LABEL); - stc->EnableWindow(bEnable); - stc = (CStatic *) GetDlgItem(IDC_BACKGROUND_COLUMN_LABEL); - stc->EnableWindow(bEnable); - stc = (CStatic *) GetDlgItem(IDC_TEXT_COLUMN_LABEL); - stc->EnableWindow(bEnable); + EnableDlgItem(IDC_CUSTOM_COLORS_GROUP, bEnable); + EnableDlgItem(IDC_WHITESPACE_COLOR_LABEL, bEnable); + EnableDlgItem(IDC_TEXT_COLOR_LABEL, bEnable); + EnableDlgItem(IDC_SELECTION_COLOR_LABEL, bEnable); + EnableDlgItem(IDC_BACKGROUND_COLUMN_LABEL, bEnable); + EnableDlgItem(IDC_TEXT_COLUMN_LABEL, bEnable); } diff --git a/Src/PropTextColors.h b/Src/PropTextColors.h index 2cbf4795e..1c962c34d 100644 --- a/Src/PropTextColors.h +++ b/Src/PropTextColors.h @@ -58,7 +58,7 @@ protected: void BrowseColorAndSave(CColorButton & colorButton, int colorIndex); void SerializeColorsToFromScreen(OPERATION op); void SerializeColorToFromScreen(OPERATION op, CColorButton & btn, int colorIndex); - void EnableColorButtons(BOOL bEnable); + void EnableColorButtons(bool bEnable); // Generated message map functions //{{AFX_MSG(PropTextColors) diff --git a/Src/SaveClosingDlg.cpp b/Src/SaveClosingDlg.cpp index 9d301dff8..73b80c1ce 100644 --- a/Src/SaveClosingDlg.cpp +++ b/Src/SaveClosingDlg.cpp @@ -80,41 +80,41 @@ BOOL SaveClosingDlg::OnInitDialog() { CTrDialog::OnInitDialog(); - GetDlgItem(IDC_SAVECLOSING_SAVELEFT)->SetFocus(); + SetDlgItemFocus(IDC_SAVECLOSING_SAVELEFT); if (!m_bAskForLeft) { // Left items disabled move focus to middle side items - GetDlgItem(IDC_SAVECLOSING_SAVEMIDDLE)->SetFocus(); + SetDlgItemFocus(IDC_SAVECLOSING_SAVEMIDDLE); - GetDlgItem(IDC_SAVECLOSING_LEFTFRAME)->EnableWindow(FALSE); - GetDlgItem(IDC_SAVECLOSING_LEFTFILE)->EnableWindow(FALSE); - GetDlgItem(IDC_SAVECLOSING_SAVELEFT)->EnableWindow(FALSE); - GetDlgItem(IDC_SAVECLOSING_DISCARDLEFT)->EnableWindow(FALSE); + EnableDlgItem(IDC_SAVECLOSING_LEFTFRAME, false); + EnableDlgItem(IDC_SAVECLOSING_LEFTFILE, false); + EnableDlgItem(IDC_SAVECLOSING_SAVELEFT, false); + EnableDlgItem(IDC_SAVECLOSING_DISCARDLEFT, false); } if (!m_bAskForMiddle) { // Middle items disabled move focus to right side items if (!m_bAskForLeft) - GetDlgItem(IDC_SAVECLOSING_SAVERIGHT)->SetFocus(); + SetDlgItemFocus(IDC_SAVECLOSING_SAVERIGHT); - GetDlgItem(IDC_SAVECLOSING_MIDDLEFRAME)->EnableWindow(FALSE); - GetDlgItem(IDC_SAVECLOSING_MIDDLEFILE)->EnableWindow(FALSE); - GetDlgItem(IDC_SAVECLOSING_SAVEMIDDLE)->EnableWindow(FALSE); - GetDlgItem(IDC_SAVECLOSING_DISCARDMIDDLE)->EnableWindow(FALSE); + EnableDlgItem(IDC_SAVECLOSING_MIDDLEFRAME, false); + EnableDlgItem(IDC_SAVECLOSING_MIDDLEFILE, false); + EnableDlgItem(IDC_SAVECLOSING_SAVEMIDDLE, false); + EnableDlgItem(IDC_SAVECLOSING_DISCARDMIDDLE, false); } if (!m_bAskForRight) { - GetDlgItem(IDC_SAVECLOSING_RIGHTFRAME)->EnableWindow(FALSE); - GetDlgItem(IDC_SAVECLOSING_RIGHTFILE)->EnableWindow(FALSE); - GetDlgItem(IDC_SAVECLOSING_SAVERIGHT)->EnableWindow(FALSE); - GetDlgItem(IDC_SAVECLOSING_DISCARDRIGHT)->EnableWindow(FALSE); + EnableDlgItem(IDC_SAVECLOSING_RIGHTFRAME, false); + EnableDlgItem(IDC_SAVECLOSING_RIGHTFILE, false); + EnableDlgItem(IDC_SAVECLOSING_SAVERIGHT, false); + EnableDlgItem(IDC_SAVECLOSING_DISCARDRIGHT, false); } if (m_bDisableCancel) { - GetDlgItem(IDCANCEL)->EnableWindow(FALSE); + EnableDlgItem(IDCANCEL, false); } // setup handler for resizing this dialog diff --git a/Src/TestFilterDlg.cpp b/Src/TestFilterDlg.cpp index 6a7e2bad4..7000b0bfb 100644 --- a/Src/TestFilterDlg.cpp +++ b/Src/TestFilterDlg.cpp @@ -53,10 +53,10 @@ BOOL CTestFilterDlg::OnInitDialog() { CTrDialog::OnInitDialog(); - GetDlgItem(IDC_TEST_TEXT)->SetFocus(); + SetDlgItemFocus(IDC_TEST_TEXT); String name = m_pFileFilterMgr->GetFilterName(m_pFileFilter); - SetDlgItemText(IDC_HEADER_FILTER_NAME, name.c_str()); + SetDlgItemText(IDC_HEADER_FILTER_NAME, name); return FALSE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE @@ -66,7 +66,7 @@ BOOL CTestFilterDlg::OnInitDialog() void CTestFilterDlg::OnTestBtn() { String text; - GetDlgItemText(IDC_TEST_TEXT, PopString(text)); + GetDlgItemText(IDC_TEST_TEXT, text); bool passed = CheckText(text); @@ -76,21 +76,6 @@ void CTestFilterDlg::OnTestBtn() AppendResult(text); } -/** @brief user pressed key. */ -void CTestFilterDlg::OnOK() -{ - CWnd *pWnd = GetFocus(); - ASSERT (pWnd); - if (IDCANCEL == pWnd->GetDlgCtrlID()) - { - CTrDialog::OnCancel(); - } - else - { - OnTestBtn(); - } -} - /** * @brief Test text against filter. * @param [in] text Text to test. @@ -98,8 +83,7 @@ void CTestFilterDlg::OnOK() */ bool CTestFilterDlg::CheckText(String text) const { - CButton * IsDirButton = (CButton *)GetDlgItem(IDC_IS_DIRECTORY); - bool isDir = (IsDirButton->GetCheck() == BST_CHECKED); + bool isDir = (IsDlgButtonChecked(IDC_IS_DIRECTORY) == 1); if (isDir) { // Convert any forward slashes to canonical Windows-style backslashes @@ -113,25 +97,17 @@ bool CTestFilterDlg::CheckText(String text) const } /** - * @brief Add text to end of edit control. - * @param [in] edit Edit contror into which the text is added. - * @param [in] text Text to add to edit control. - */ -void AppendToEditBox(CEdit & edit, const String& text) -{ - int len = edit.GetWindowTextLength(); - edit.SetSel(len, len); - edit.ReplaceSel(text.c_str()); -} - -/** * @brief Add new result to end of result edit box. * @param [in] result Result text to add. */ -void CTestFilterDlg::AppendResult(String result) +void CTestFilterDlg::AppendResult(const String& result) { - CEdit * edit = (CEdit *)GetDlgItem(IDC_RESULTS); - if (edit->GetWindowTextLength()>0) - result = _T("\r\n") + result; - AppendToEditBox(*edit, result); + String text; + GetDlgItemText(IDC_RESULTS, text); + if (text.length() > 0) + text += _T("\r\n") + result; + else + text = result; + SetDlgItemText(IDC_RESULTS, text); + SendDlgItemMessage(IDC_RESULTS, WM_VSCROLL, SB_BOTTOM, 0L); } diff --git a/Src/TestFilterDlg.h b/Src/TestFilterDlg.h index 4879e9485..a00bd2c0e 100644 --- a/Src/TestFilterDlg.h +++ b/Src/TestFilterDlg.h @@ -29,7 +29,7 @@ private: // Implementation methods private: bool CheckText(String text) const; - void AppendResult(String result); + void AppendResult(const String& result); // Dialog Data //{{AFX_DATA(CTestFilterDlg) @@ -49,7 +49,6 @@ private: // Generated message map functions //{{AFX_MSG(CTestFilterDlg) virtual BOOL OnInitDialog(); - virtual void OnOK(); afx_msg void OnTestBtn(); //}}AFX_MSG DECLARE_MESSAGE_MAP() diff --git a/Src/TrDialogs.h b/Src/TrDialogs.h index 62e3a04d2..921a79290 100644 --- a/Src/TrDialogs.h +++ b/Src/TrDialogs.h @@ -2,6 +2,39 @@ #include "DDXHelper.h" +namespace DlgUtils +{ + template + void SetDlgItemChecked(T* dlg, unsigned id, unsigned value) + { + dlg->SendDlgItemMessage(id, BM_SETCHECK, value); + } + + template + void EnableDlgItem(T* dlg, unsigned id, bool enabled) + { + dlg->GetDlgItem(id)->EnableWindow(enabled); + } + + template + void SetDlgItemFocus(T* dlg, unsigned id) + { + dlg->GetDlgItem(id)->SetFocus(); + } + + template + unsigned GetDlgItemText(T* dlg, unsigned id, String& text) + { + return static_cast(dlg)->GetDlgItemText(id, PopString(text)); + } + + template + void SetDlgItemText(T* dlg, unsigned id, const String& text) + { + return static_cast(dlg)->SetDlgItemText(id, text.c_str()); + } +} + class CTrDialog : public CDialog { DECLARE_DYNAMIC(CTrDialog) @@ -11,6 +44,11 @@ public: CTrDialog(LPCTSTR lpszTemplateName, CWnd *pParentWnd = NULL) : CDialog(lpszTemplateName, pParentWnd) {} virtual BOOL OnInitDialog(); + void SetDlgItemChecked(unsigned id, unsigned value) { DlgUtils::SetDlgItemChecked(this, id, value); } + void EnableDlgItem(unsigned id, bool enabled) { DlgUtils::EnableDlgItem(this, id, enabled); } + void SetDlgItemFocus(unsigned id) { DlgUtils::SetDlgItemFocus(this, id); } + unsigned GetDlgItemText(unsigned id, String& text) { return DlgUtils::GetDlgItemText(this, id, text); } + void SetDlgItemText(unsigned id, const String& text) { DlgUtils::SetDlgItemText(this, id, text); } }; class CTrPropertyPage : public CPropertyPage @@ -24,6 +62,11 @@ public: : CPropertyPage(lpszTemplateName, nIDCaption, dwSize) {} virtual BOOL OnInitDialog(); + void SetDlgItemChecked(unsigned id, bool value) { DlgUtils::SetDlgItemChecked(this, id, value); } + void EnableDlgItem(unsigned id, bool enabled) { DlgUtils::EnableDlgItem(this, id, enabled); } + void SetDlgItemFocus(unsigned id) { DlgUtils::SetDlgItemFocus(this, id); } + unsigned GetDlgItemText(unsigned id, String& text) { return DlgUtils::GetDlgItemText(this, id, text); } + void SetDlgItemText(unsigned id, const String& text) { DlgUtils::SetDlgItemText(this, id, text); } }; class CTrDialogBar : public CDialogBar @@ -34,4 +77,9 @@ public: UINT nStyle, UINT nID); virtual BOOL Create(CWnd* pParentWnd, UINT nIDTemplate, UINT nStyle, UINT nID); + void SetDlgItemChecked(unsigned id, bool value) { DlgUtils::SetDlgItemChecked(this, id, value); } + void EnableDlgItem(unsigned id, bool enabled) { DlgUtils::EnableDlgItem(this, id, enabled); } + void SetDlgItemFocus(unsigned id) { DlgUtils::SetDlgItemFocus(this, id); } + unsigned GetDlgItemText(unsigned id, String& text) { return DlgUtils::GetDlgItemText(this, id, text); } + void SetDlgItemText(unsigned id, const String& text) { DlgUtils::SetDlgItemText(this, id, text); } }; -- 2.11.0