1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
|
/*
IgnoreState plugin for Miranda-IM (www.miranda-im.org)
(c) 2010 by Kildor
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "stdafx.h"
#define MS_SKINENG_DRAWICONEXFIX "SkinEngine/DrawIconEx_Fix"
static bool bInitializing;
INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
HWND hTree = GetDlgItem(hwndDlg, IDC_FILTER);
switch (msg) {
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
bInitializing = true;
fill_filter();
SetWindowLongPtr(hTree, GWL_STYLE, GetWindowLongPtr(hTree, GWL_STYLE) | TVS_NOHSCROLL);
{
HIMAGELIST himlButtonIcons = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_COLOR32 | ILC_MASK, 2, 2);
TreeView_SetImageList(hTree, himlButtonIcons, TVSIL_NORMAL);
TreeView_DeleteAllItems(hTree);
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 = TreeView_InsertItem(hTree, &tvis);
TreeView_SetCheckState(hTree, hti, checkState(ii[i].type));
}
}
CheckDlgButton(hwndDlg, IDC_IGNORE_IGNOREALL, bUseMirandaSettings ? BST_CHECKED : BST_UNCHECKED);
EnableWindow(GetDlgItem(hwndDlg, IDC_FILTER), !bUseMirandaSettings);
bInitializing = false;
return TRUE;
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDC_IGNORE_IGNOREALL:
EnableWindow(GetDlgItem(hwndDlg, IDC_FILTER), BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_IGNORE_IGNOREALL));
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
}
break;
case WM_NOTIFY:
switch (((LPNMHDR)lParam)->idFrom) {
case 0:
switch (((LPNMHDR)lParam)->code) {
case PSN_APPLY:
{
DWORD flags = 0;
TVITEM tvi;
tvi.mask = TVIF_HANDLE | TBIF_LPARAM;
tvi.hItem = TreeView_GetRoot(hTree); //check ignore all
while (tvi.hItem) {
TreeView_GetItem(hTree, &tvi);
if (TreeView_GetCheckState(hTree, tvi.hItem)) flags |= 1 << (tvi.lParam - 1);
tvi.hItem = TreeView_GetNextSibling(hTree, tvi.hItem);
}
db_set_dw(NULL, MODULENAME, "Filter", flags);
bUseMirandaSettings = IsDlgButtonChecked(hwndDlg, IDC_IGNORE_IGNOREALL) ? 1 : 0;
db_set_b(NULL, MODULENAME, "UseMirandaSettings", bUseMirandaSettings);
fill_filter();
}
}
case IDC_FILTER:
if (((LPNMHDR)lParam)->code == NM_CLICK)
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
}
}
return FALSE;
}
int onOptInitialise(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { 0 };
odp.hInstance = g_hInst;
odp.flags = ODPF_BOLDGROUPS;
odp.szGroup.a = LPGEN("Icons");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_IGNORE_OPT);
odp.szTitle.a = LPGEN("Ignore State");
odp.pfnDlgProc = DlgProcOptions;
Options_AddPage(wParam, &odp);
return 0;
}
|