From a475a1ad46ab81048272419c368365c147242b44 Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Tue, 25 Dec 2018 14:42:26 +0300 Subject: Fingerprint: moved to m_gui --- plugins/FingerprintNG/res/resource.rc | 3 +- plugins/FingerprintNG/src/options.cpp | 93 +++++++++++++++++++---------------- plugins/FingerprintNG/src/stdafx.h | 19 +++++++ 3 files changed, 70 insertions(+), 45 deletions(-) diff --git a/plugins/FingerprintNG/res/resource.rc b/plugins/FingerprintNG/res/resource.rc index b1b6f94849..05d2422296 100644 --- a/plugins/FingerprintNG/res/resource.rc +++ b/plugins/FingerprintNG/res/resource.rc @@ -70,8 +70,7 @@ BEGIN GROUPBOX "Fingerprint overlays icons",IDC_STATIC,15,15,290,60 CONTROL "Miranda clients",IDC_GROUP_MIRANDA,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,20,30,140,10 CONTROL "Miranda packs overlays",IDC_GROUP_MIRANDA_PACKS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,20,40,140,10 - CONTROL "Show Miranda version at Overlay#2",IDC_GROUP_MIRANDA_VERSION, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,20,60,140,10 + CONTROL "Show Miranda version at Overlay#2",IDC_GROUP_MIRANDA_VERSION,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,20,60,140,10 CONTROL "Resource overlays",IDC_GROUP_OVERLAYS_RESOURCE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,170,30,120,10 CONTROL "Platform overlays",IDC_GROUP_OVERLAYS_PLATFORM,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,170,40,120,10 CONTROL "Protocols overlays",IDC_GROUP_OVERLAYS_PROTO,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,170,50,120,10 diff --git a/plugins/FingerprintNG/src/options.cpp b/plugins/FingerprintNG/src/options.cpp index 05194cb4df..cea4b17c0a 100644 --- a/plugins/FingerprintNG/src/options.cpp +++ b/plugins/FingerprintNG/src/options.cpp @@ -55,65 +55,72 @@ static settings[] = { IDC_STATUSBAR, TRUE, "StatusBarIcon" } }; -/*static void OptDlgChanged(HWND hwndDlg, BOOL show) +void COptDialog::LoadDBCheckState(int idCtrl, LPCSTR szSetting, BYTE bDef) { -if (show) -ShowWindow(GetDlgItem(hwndDlg, IDC_OPTCHANGENOTE), SW_SHOW); -SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); -}*/ + CCtrlCheck item(this, idCtrl); + item.SetState(g_plugin.getByte(szSetting, bDef)); +} -static void LoadDBCheckState(HWND hwndDlg, int idCtrl, LPCSTR szSetting, BYTE bDef) +void COptDialog::StoreDBCheckState(int idCtrl, LPCSTR szSetting) { - CheckDlgButton(hwndDlg, idCtrl, g_plugin.getByte(szSetting, bDef) ? BST_CHECKED : BST_UNCHECKED); + CCtrlCheck item(this, idCtrl); + g_plugin.setByte(szSetting, item.GetState()); } -static void StoreDBCheckState(HWND hwndDlg, int idCtrl, LPCSTR szSetting) +COptDialog::COptDialog() : + CDlgBase(g_plugin, IDD_DIALOG), + m_chkMiranda(this, IDC_GROUP_MIRANDA), + m_chkMirandaPacks(this, IDC_GROUP_MIRANDA_PACKS), + m_chkMirandaVer(this, IDC_GROUP_MIRANDA_VERSION), + m_chkOverRes(this, IDC_GROUP_OVERLAYS_RESOURCE), + m_chkOverPlatf(this, IDC_GROUP_OVERLAYS_PLATFORM), + m_chkOverProto(this, IDC_GROUP_OVERLAYS_PROTO), + m_chkOverUnicode(this, IDC_GROUP_OVERLAYS_UNICODE), + m_chkOverSecur(this, IDC_GROUP_OVERLAYS_SECURITY), + m_chkFacebbok(this, IDC_GROUP_FACEBOOK), + m_chkGG(this, IDC_GROUP_GG), + m_chkICQ(this, IDC_GROUP_ICQ), + m_chkIRC(this, IDC_GROUP_IRC), + m_chkJabber(this, IDC_GROUP_JABBER), + m_chkMSN(this, IDC_GROUP_MSN), + m_chkQQ(this, IDC_GROUP_QQ), + m_chkRSS(this, IDC_GROUP_RSS), + m_chkVK(this, IDC_GROUP_VK), + m_chkWeather(this, IDC_GROUP_WEATHER), + m_chkMulti(this, IDC_GROUP_MULTI), + m_chkOthersProto(this, IDC_GROUP_OTHER_PROTOS), + m_chkOthers(this, IDC_GROUP_OTHERS), + m_chkStatusBar(this, IDC_STATUSBAR) { - g_plugin.setByte(szSetting, (BYTE)IsDlgButtonChecked(hwndDlg, idCtrl)); + } -static INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) +bool COptDialog::OnInitDialog() { - switch (msg) { - case WM_INITDIALOG: - TranslateDialogDefault(hwndDlg); - for (auto &it : settings) - LoadDBCheckState(hwndDlg, it.idCtrl, it.szSetName, it.defValue); - break; - - case WM_COMMAND: - if (HIWORD(wParam) == BN_CLICKED) - for (auto &it : settings) - if (it.idCtrl == LOWORD(wParam)) { - SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); - break; - } - break; - - case WM_NOTIFY: - NMHDR * hdr = (NMHDR *)lParam; - if (hdr && hdr->code == PSN_APPLY) { - for (auto &it : settings) - StoreDBCheckState(hwndDlg, it.idCtrl, it.szSetName); - - ClearFI(); - RegisterIcons(); - - for (auto &hContact : Contacts()) - OnExtraImageApply(hContact, 0); - } - break; - } - return FALSE; + for (auto &it : settings) + LoadDBCheckState(it.idCtrl, it.szSetName, it.defValue); + return true; +} + +bool COptDialog::OnApply() +{ + for (auto &it : settings) + StoreDBCheckState(it.idCtrl, it.szSetName); + + ClearFI(); + RegisterIcons(); + + for (auto &hContact : Contacts()) + OnExtraImageApply(hContact, 0); + return true; } int OnOptInitialise(WPARAM wParam, LPARAM) { OPTIONSDIALOGPAGE odp = {}; odp.szGroup.w = LPGENW("Icons"); - odp.pszTemplate = MAKEINTRESOURCEA(IDD_DIALOG); odp.szTitle.w = LPGENW("Fingerprint"); - odp.pfnDlgProc = DlgProcOptions; + odp.pDialog = new COptDialog; odp.flags = ODPF_BOLDGROUPS | ODPF_UNICODE; g_plugin.addOptions(wParam, &odp); return 0; diff --git a/plugins/FingerprintNG/src/stdafx.h b/plugins/FingerprintNG/src/stdafx.h index 8b5a28b62e..e08fde4acf 100644 --- a/plugins/FingerprintNG/src/stdafx.h +++ b/plugins/FingerprintNG/src/stdafx.h @@ -38,6 +38,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include #include #include +#include #include @@ -148,3 +149,21 @@ extern int DEFAULT_KN_FP_MASK_COUNT, DEFAULT_KN_FP_OVERLAYS_COUNT, DEFAULT_KN_FP // the last count is how many masks from 2nd layer is used as Miranda version overlays (counting from the end) #define DEFAULT_KN_FP_OVERLAYS2_NO_VER_COUNT (DEFAULT_KN_FP_OVERLAYS2_COUNT - 13) #define DEFAULT_KN_FP_OVERLAYS3_NO_UNICODE_COUNT (DEFAULT_KN_FP_OVERLAYS3_COUNT - 1) + +class COptDialog : public CDlgBase +{ +private: + CCtrlCheck m_chkMiranda, m_chkMirandaPacks, m_chkMirandaVer, m_chkOverRes, m_chkOverPlatf, m_chkOverProto, m_chkOverUnicode, m_chkOverSecur, + m_chkFacebbok, m_chkGG, m_chkICQ, m_chkIRC, m_chkJabber, m_chkMSN, m_chkQQ, m_chkRSS, m_chkVK, m_chkWeather, m_chkMulti, m_chkOthersProto, + m_chkOthers, m_chkStatusBar; + +protected: + bool OnInitDialog() override; + bool OnApply() override; + + void LoadDBCheckState(int idCtrl, LPCSTR szSetting, BYTE bDef); + void StoreDBCheckState(int idCtrl, LPCSTR szSetting); + +public: + COptDialog(); +}; \ No newline at end of file -- cgit v1.2.3