From 067bd391d5a6d28e250f6e375607be6d667f66bf Mon Sep 17 00:00:00 2001 From: MikalaiR Date: Sun, 17 Apr 2016 19:36:45 +0000 Subject: AuthState: options -> core ui git-svn-id: http://svn.miranda-ng.org/main/trunk@16708 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/AuthState/res/authstate.rc | 2 +- plugins/AuthState/src/main.cpp | 2 -- plugins/AuthState/src/options.cpp | 50 +------------------------------------- plugins/AuthState/src/stdafx.h | 33 +++---------------------- 4 files changed, 6 insertions(+), 81 deletions(-) (limited to 'plugins') diff --git a/plugins/AuthState/res/authstate.rc b/plugins/AuthState/res/authstate.rc index 7e898cfe81..6f496f8059 100644 --- a/plugins/AuthState/res/authstate.rc +++ b/plugins/AuthState/res/authstate.rc @@ -78,7 +78,7 @@ BEGIN CONTROL "Show Request icon",IDC_AUTHICON,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,30,70,246,18 CONTROL "Show Grant icon",IDC_GRANTICON,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,30,86,246,18 GROUPBOX "Plugin settings",IDC_STATIC,19,23,276,90 - CONTROL "Enable menu item (restart required)",IDC_ENABLEMENUITEM,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,30,42,246,13 + CONTROL "Enable menu item",IDC_ENABLEMENUITEM,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,30,42,246,13 CONTROL "Show icons only for recently added contacts",IDC_ICONSFORRECENT, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,30,55,246,17 END diff --git a/plugins/AuthState/src/main.cpp b/plugins/AuthState/src/main.cpp index 253463fa31..08e9f96cb1 100644 --- a/plugins/AuthState/src/main.cpp +++ b/plugins/AuthState/src/main.cpp @@ -177,8 +177,6 @@ extern "C" int __declspec(dllexport) Load(void) HookEvent(ME_DB_CONTACT_ADDED, onDBContactAdded); CreateServiceFunction("AuthState/MenuItem", onAuthMenuSelected); - Options.Load(); - CMenuItem mi; SET_UID(mi, 0xc5a784ea, 0x8b07, 0x4b95, 0xa2, 0xb2, 0x84, 0x9d, 0x87, 0x43, 0x7e, 0xda); mi.position = -1999901005; diff --git a/plugins/AuthState/src/options.cpp b/plugins/AuthState/src/options.cpp index de4b90fedc..23bf7f609f 100644 --- a/plugins/AuthState/src/options.cpp +++ b/plugins/AuthState/src/options.cpp @@ -19,61 +19,13 @@ #include "stdafx.h" -INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) -{ - static int bInitializing = 0; - switch (msg) { - case WM_INITDIALOG: - TranslateDialogDefault(hwndDlg); - bInitializing = 1; - - CheckDlgButton(hwndDlg, IDC_AUTHICON, Options.bUseAuthIcon ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_GRANTICON, Options.bUseGrantIcon ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_ENABLEMENUITEM, Options.bContactMenuItem ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_ICONSFORRECENT, Options.bIconsForRecentContacts ? BST_CHECKED : BST_UNCHECKED); - - bInitializing = 0; - return TRUE; - - case WM_COMMAND: - switch (LOWORD(wParam)) { - case IDC_AUTHICON: - case IDC_GRANTICON: - case IDC_ENABLEMENUITEM: - case IDC_ICONSFORRECENT: - SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); - break; - } - break; - - case WM_NOTIFY: - if (((LPNMHDR)lParam)->idFrom == 0) - switch (((LPNMHDR)lParam)->code) { - case PSN_APPLY: - Options.bUseAuthIcon = IsDlgButtonChecked(hwndDlg, IDC_AUTHICON); - Options.bUseGrantIcon = IsDlgButtonChecked(hwndDlg, IDC_GRANTICON); - Options.bContactMenuItem = IsDlgButtonChecked(hwndDlg, IDC_ENABLEMENUITEM); - Options.bIconsForRecentContacts = IsDlgButtonChecked(hwndDlg, IDC_ICONSFORRECENT); - - for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) - onExtraImageApplying((WPARAM)hContact, 0); - - Options.Save(); - return TRUE; - } - } - return FALSE; -} - int onOptInitialise(WPARAM wParam, LPARAM) { OPTIONSDIALOGPAGE odp = { 0 }; - odp.hInstance = g_hInst; odp.pszGroup = LPGEN("Icons"); - odp.pszTemplate = MAKEINTRESOURCEA(IDD_AUTHSTATE_OPT); odp.pszTitle = LPGEN("Auth state"); - odp.pfnDlgProc = DlgProcOptions; odp.flags = ODPF_BOLDGROUPS; + odp.pDialog = new COptionsDialog; Options_AddPage(wParam, &odp); return 0; } diff --git a/plugins/AuthState/src/stdafx.h b/plugins/AuthState/src/stdafx.h index b3fc4a0e4c..356af71def 100644 --- a/plugins/AuthState/src/stdafx.h +++ b/plugins/AuthState/src/stdafx.h @@ -30,46 +30,21 @@ #include #include #include -#include -#include #include +#include #include "resource.h" #include "Version.h" #define MODULENAME "AuthState" -struct Opts -{ - BYTE bUseAuthIcon; - BYTE bUseGrantIcon; - BYTE bContactMenuItem; - BYTE bIconsForRecentContacts; - - void Load() - { - bUseAuthIcon = db_get_b(NULL, MODULENAME, "EnableAuthIcon", 1); - bUseGrantIcon = db_get_b(NULL, MODULENAME, "EnableGrantIcon", 1); - bContactMenuItem = db_get_b(NULL, MODULENAME, "MenuItem", 0); - bIconsForRecentContacts = db_get_b(NULL, MODULENAME, "EnableOnlyForRecent", 0); - } - - void Save() - { - db_set_b(NULL, MODULENAME, "EnableAuthIcon", bUseAuthIcon); - db_set_b(NULL, MODULENAME, "EnableGrantIcon", bUseGrantIcon); - db_set_b(NULL, MODULENAME, "MenuItem", bContactMenuItem); - db_set_b(NULL, MODULENAME, "EnableOnlyForRecent", bIconsForRecentContacts); - } - -}; - -extern Opts Options; - int onOptInitialise(WPARAM wParam, LPARAM lParam); int onExtraImageApplying(WPARAM wParam, LPARAM lParam); extern HINSTANCE g_hInst; extern HANDLE hExtraIcon; +#include "options.h" + + #endif //COMMHEADERS_H -- cgit v1.2.3