diff options
author | Vadim Dashevskiy <watcherhd@gmail.com> | 2012-07-20 12:16:27 +0000 |
---|---|---|
committer | Vadim Dashevskiy <watcherhd@gmail.com> | 2012-07-20 12:16:27 +0000 |
commit | b25fef05f6feb88edd6ddad6a27193db9257d2de (patch) | |
tree | 6ac6a43438cec42fc12e30f0654ee9667d27dcb7 /plugins/MenuItemEx/src/options.cpp | |
parent | 4d43e0d03f0c0db187a7f56c7520b959f644af5c (diff) |
MenuItemEx: changed folder structure
git-svn-id: http://svn.miranda-ng.org/main/trunk@1078 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/MenuItemEx/src/options.cpp')
-rw-r--r-- | plugins/MenuItemEx/src/options.cpp | 136 |
1 files changed, 136 insertions, 0 deletions
diff --git a/plugins/MenuItemEx/src/options.cpp b/plugins/MenuItemEx/src/options.cpp new file mode 100644 index 0000000000..0aa0bbb68b --- /dev/null +++ b/plugins/MenuItemEx/src/options.cpp @@ -0,0 +1,136 @@ +#include "menuex.h"
+
+
+extern HINSTANCE hinstance;
+
+struct {
+ int idc;
+ int flag;
+}
+static const checkboxes[]={
+ { IDC_COPYID, VF_CID },
+ { IDC_STATUSMSG, VF_STAT },
+ { IDC_COPYIP, VF_CIP },
+ { IDC_COPYMIRVER, VF_CMV },
+ { IDC_VIS, VF_VS },
+ { IDC_SHOWALPHAICONS, VF_SAI },
+ { IDC_HIDE, VF_HFL },
+ { IDC_IGNORE, VF_IGN },
+ { IDC_IGNOREHIDE, VF_IGNH },
+ { IDC_PROTOS, VF_PROTO },
+ { IDC_ADDED, VF_ADD },
+ { IDC_AUTHREQ, VF_REQ },
+ { IDC_SHOWID, VF_SHOWID },
+ { IDC_COPYIDNAME, VF_CIDN },
+ { IDC_RECVFILES, VF_RECV },
+ { IDC_SMNAME, VF_SMNAME },
+ { IDC_TRIMID, VF_TRIMID },
+ { IDC_REFRESH_DETAILS, VF_REFRESH }
+};
+
+INT_PTR CALLBACK OptionsProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam)
+{
+ DWORD flags=DBGetContactSettingDword(NULL,VISPLG,"flags",vf_default);
+ TCHAR buffer[64] = {0};
+ int i;
+
+ switch(msg)
+ {
+ case WM_INITDIALOG:
+
+ TranslateDialogDefault(hdlg);
+
+ for (i = 0; i < SIZEOF(checkboxes); i++)
+ {
+ CheckDlgButton(hdlg, checkboxes[i].idc, (flags & checkboxes[i].flag) ? BST_CHECKED : BST_UNCHECKED);
+ }
+
+ if (ServiceExists(MS_POPUP_ADDPOPUP))
+ {
+ for (i = 0; i < 4; i++)
+ {
+ GetDlgItemText(hdlg, checkboxes[i].idc, buffer, SIZEOF(buffer) - 3);
+ _tcscat(buffer, _T(" *"));
+ SetDlgItemText(hdlg, checkboxes[i].idc, buffer);
+ }
+ }
+ else
+ ShowWindow(GetDlgItem(hdlg, IDC_HINT1), SW_HIDE);
+
+ if (!bMir_08)
+ EnableWindow(GetDlgItem(hdlg,IDC_PROTOS), 0);
+
+ SendMessage(hdlg, WM_USER + 50, 0, 0);
+ return 0;
+
+ case WM_USER+50:
+
+ EnableWindow(GetDlgItem(hdlg,IDC_SHOWALPHAICONS),
+ IsDlgButtonChecked(hdlg,IDC_VIS) == BST_CHECKED);
+ EnableWindow(GetDlgItem(hdlg,IDC_IGNOREHIDE),
+ IsDlgButtonChecked(hdlg,IDC_IGNORE) == BST_CHECKED);
+ EnableWindow(GetDlgItem(hdlg,IDC_COPYIDNAME),
+ IsDlgButtonChecked(hdlg,IDC_COPYID) == BST_CHECKED);
+ EnableWindow(GetDlgItem(hdlg,IDC_SHOWID),
+ IsDlgButtonChecked(hdlg,IDC_COPYID) == BST_CHECKED);
+ EnableWindow(GetDlgItem(hdlg,IDC_TRIMID),
+ (IsDlgButtonChecked(hdlg,IDC_COPYID) == BST_CHECKED && IsDlgButtonChecked(hdlg,IDC_SHOWID) == BST_CHECKED));
+ EnableWindow(GetDlgItem(hdlg,IDC_SMNAME),
+ IsDlgButtonChecked(hdlg,IDC_STATUSMSG) == BST_CHECKED);
+ return 1;
+
+ case WM_NOTIFY:
+ switch(((LPNMHDR)lparam)->code){
+ case PSN_APPLY:
+ {
+ DWORD mod_flags=0;
+
+ for (i = 0; i < SIZEOF(checkboxes); i++)
+ {
+ mod_flags |= IsDlgButtonChecked(hdlg, checkboxes[i].idc) ? checkboxes[i].flag : 0;
+ }
+
+ //DBDeleteContactSetting(NULL,VISPLG,"flags");
+ DBWriteContactSettingDword(NULL,VISPLG,"flags",mod_flags);
+
+ return 1;
+ }
+ }
+ break;
+
+ case WM_COMMAND:
+ if(HIWORD(wparam)==BN_CLICKED && GetFocus()==(HWND)lparam) {
+ SendMessage(GetParent(hdlg),PSM_CHANGED,0,0);
+ if (LOWORD(wparam) == IDC_VIS ||
+ LOWORD(wparam) == IDC_IGNORE ||
+ LOWORD(wparam) == IDC_COPYID ||
+ LOWORD(wparam) == IDC_STATUSMSG ||
+ LOWORD(wparam) == IDC_SHOWID) {
+
+ SendMessage(hdlg, WM_USER + 50, 0, 0);
+ }
+ }
+ return 0;
+
+ case WM_CLOSE:
+ EndDialog(hdlg,0);
+ return 0;
+ }
+ return 0;
+}
+
+int OptionsInit(WPARAM wparam,LPARAM lparam)
+{
+ OPTIONSDIALOGPAGE odp={0};
+ odp.cbSize = sizeof(odp);
+ odp.position = 955000000;
+ odp.hInstance = hinstance;
+ odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS);
+ odp.pszTitle = MODULENAME;
+ odp.pfnDlgProc = OptionsProc;
+ odp.pszGroup = LPGEN("Customize");
+ odp.flags = ODPF_BOLDGROUPS;
+ Options_AddPage(wparam,&odp);
+
+ return 0;
+}
|