diff options
author | Kirill Volinsky <Mataes2007@gmail.com> | 2018-12-27 10:57:29 +0300 |
---|---|---|
committer | Kirill Volinsky <Mataes2007@gmail.com> | 2018-12-27 10:57:29 +0300 |
commit | df19001fa48529bd59096ebd9a0b1ce669278532 (patch) | |
tree | c473fae78e845a207d06e35f2e87580160c85db8 | |
parent | 02c1073358630dc010bc74df7e35e14d30d58488 (diff) |
IgnoreState: options class structure fix
-rw-r--r-- | plugins/IgnoreState/src/options.cpp | 107 | ||||
-rw-r--r-- | plugins/IgnoreState/src/stdafx.h | 16 |
2 files changed, 57 insertions, 66 deletions
diff --git a/plugins/IgnoreState/src/options.cpp b/plugins/IgnoreState/src/options.cpp index d662672517..b14fab1e38 100644 --- a/plugins/IgnoreState/src/options.cpp +++ b/plugins/IgnoreState/src/options.cpp @@ -20,67 +20,74 @@ #include "stdafx.h"
-COptDialog::COptDialog() :
- CDlgBase(g_plugin, IDD_IGNORE_OPT),
- m_tvFilter(this, IDC_FILTER),
- m_chkIgnoreAll(this, IDC_IGNORE_IGNOREALL)
+class COptDialog : public CDlgBase
{
- m_chkIgnoreAll.OnChange = Callback(this, &COptDialog::OnIgnoreAllChange);
-}
+ CCtrlTreeView m_tvFilter;
+ CCtrlCheck m_chkIgnoreAll;
-bool COptDialog::OnInitDialog()
-{
- fill_filter();
- SetWindowLongPtr(m_tvFilter.GetHwnd(), GWL_STYLE, GetWindowLongPtr(m_tvFilter.GetHwnd(), GWL_STYLE) | TVS_NOHSCROLL);
+public:
+ COptDialog() :
+ CDlgBase(g_plugin, IDD_IGNORE_OPT),
+ m_tvFilter(this, IDC_FILTER),
+ m_chkIgnoreAll(this, IDC_IGNORE_IGNOREALL)
{
- HIMAGELIST himlButtonIcons = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_COLOR32 | ILC_MASK, 2, 2);
- m_tvFilter.SetImageList(himlButtonIcons, TVSIL_NORMAL);
- m_tvFilter.DeleteAllItems();
-
- for (int i = 2; i < nII; i++) { // we don`t need it IGNORE_ALL and IGNORE_MESSAGE
- TVINSERTSTRUCT tvis = {};
- int index = ImageList_AddIcon(himlButtonIcons, Skin_LoadIcon(ii[i].icon));
- tvis.hParent = nullptr;
- tvis.hInsertAfter = TVI_LAST;
- tvis.item.mask = TVIF_PARAM | TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_STATE;
- tvis.item.lParam = ii[i].type;
- tvis.item.pszText = TranslateW(ii[i].name);
- tvis.item.iImage = tvis.item.iSelectedImage = index;
- HTREEITEM hti = m_tvFilter.InsertItem(&tvis);
- m_tvFilter.SetCheckState(hti, checkState(ii[i].type));
- }
+ m_chkIgnoreAll.OnChange = Callback(this, &COptDialog::OnIgnoreAllChange);
}
- m_chkIgnoreAll.SetState(bUseMirandaSettings);
- m_tvFilter.Enable(!bUseMirandaSettings);
+ bool OnInitDialog() override
+ {
+ fill_filter();
+ SetWindowLongPtr(m_tvFilter.GetHwnd(), GWL_STYLE, GetWindowLongPtr(m_tvFilter.GetHwnd(), GWL_STYLE) | TVS_NOHSCROLL);
+ {
+ HIMAGELIST himlButtonIcons = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_COLOR32 | ILC_MASK, 2, 2);
+ m_tvFilter.SetImageList(himlButtonIcons, TVSIL_NORMAL);
+ m_tvFilter.DeleteAllItems();
- return true;
-}
+ for (int i = 2; i < nII; i++) { // we don`t need it IGNORE_ALL and IGNORE_MESSAGE
+ TVINSERTSTRUCT tvis = {};
+ int index = ImageList_AddIcon(himlButtonIcons, Skin_LoadIcon(ii[i].icon));
+ tvis.hParent = nullptr;
+ tvis.hInsertAfter = TVI_LAST;
+ tvis.item.mask = TVIF_PARAM | TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_STATE;
+ tvis.item.lParam = ii[i].type;
+ tvis.item.pszText = TranslateW(ii[i].name);
+ tvis.item.iImage = tvis.item.iSelectedImage = index;
+ HTREEITEM hti = m_tvFilter.InsertItem(&tvis);
+ m_tvFilter.SetCheckState(hti, checkState(ii[i].type));
+ }
+ }
-void COptDialog::OnIgnoreAllChange(CCtrlBase*)
-{
- m_tvFilter.Enable(!m_chkIgnoreAll.GetState());
-}
+ m_chkIgnoreAll.SetState(bUseMirandaSettings);
+ m_tvFilter.Enable(!bUseMirandaSettings);
-bool COptDialog::OnApply()
-{
- DWORD flags = 0;
- TVITEMEX tvi;
- tvi.mask = TVIF_HANDLE | TBIF_LPARAM;
- tvi.hItem = m_tvFilter.GetRoot(); //check ignore all
- while (tvi.hItem) {
- m_tvFilter.GetItem(&tvi);
- if (m_tvFilter.GetCheckState(tvi.hItem)) flags |= 1 << (tvi.lParam - 1);
- tvi.hItem = m_tvFilter.GetNextSibling(tvi.hItem);
+ return true;
}
- g_plugin.setDword("Filter", flags);
- bUseMirandaSettings = m_chkIgnoreAll.GetState();
- g_plugin.setByte("UseMirandaSettings", bUseMirandaSettings);
+ void OnIgnoreAllChange(CCtrlBase*)
+ {
+ m_tvFilter.Enable(!m_chkIgnoreAll.GetState());
+ }
- fill_filter();
- return true;
-}
+ bool OnApply() override
+ {
+ DWORD flags = 0;
+ TVITEMEX tvi;
+ tvi.mask = TVIF_HANDLE | TBIF_LPARAM;
+ tvi.hItem = m_tvFilter.GetRoot(); //check ignore all
+ while (tvi.hItem) {
+ m_tvFilter.GetItem(&tvi);
+ if (m_tvFilter.GetCheckState(tvi.hItem)) flags |= 1 << (tvi.lParam - 1);
+ tvi.hItem = m_tvFilter.GetNextSibling(tvi.hItem);
+ }
+ g_plugin.setDword("Filter", flags);
+
+ bUseMirandaSettings = m_chkIgnoreAll.GetState();
+ g_plugin.setByte("UseMirandaSettings", bUseMirandaSettings);
+
+ fill_filter();
+ return true;
+ }
+};
int onOptInitialise(WPARAM wParam, LPARAM)
{
diff --git a/plugins/IgnoreState/src/stdafx.h b/plugins/IgnoreState/src/stdafx.h index 056dc3a602..b7fced8013 100644 --- a/plugins/IgnoreState/src/stdafx.h +++ b/plugins/IgnoreState/src/stdafx.h @@ -68,20 +68,4 @@ VOID fill_filter(); extern HANDLE hExtraIcon;
-class COptDialog : public CDlgBase
-{
-private:
- CCtrlTreeView m_tvFilter;
- CCtrlCheck m_chkIgnoreAll;
-
-protected:
- bool OnInitDialog() override;
- bool OnApply() override;
-
- void OnIgnoreAllChange(CCtrlBase*);
-
-public:
- COptDialog();
-};
-
#endif //COMMHEADERS_H
|