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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
|
{Misc}
procedure SetAllContactStat(hwndList:HWND);
var
hContact:TMCONTACT;
hItem:THANDLE;
begin
hContact:=db_find_first();
while hContact<>0 do
begin
hItem:=SendMessage(hwndList,CLM_FINDCONTACT,hContact,0);
if hItem<>0 then
begin
SendMessage(hwndList,CLM_SETCHECKMARK,hItem,
DBReadByte(hContact,strCList,ShareOptText,0));
end;
hContact:=db_find_next(hContact);
end;
end;
procedure SaveAllContactStat(hwndList:HWND);
var
hContact:TMCONTACT;
hItem:THANDLE;
begin
hContact:=db_find_first();
while hContact<>0 do
begin
hItem:=SendMessage(hwndList,CLM_FINDCONTACT,hContact,0);
if hItem<>0 then
begin
if SendMessage(hwndList,CLM_GETCHECKMARK,hItem,0)<>0 then
DBWriteByte(hContact,strCList,ShareOptText,1)
else
DBDeleteSetting(hContact,strCList,ShareOptText);
end;
hContact:=db_find_next(hContact);
end;
end;
procedure ResetListOptions(hwndList:HWND);
var
i:integer;
begin
SendMessage(hwndList,CLM_SETBKBITMAP ,0,0);
SendMessage(hwndList,CLM_SETBKCOLOR ,GetSysColor(COLOR_WINDOW),0);
SendMessage(hwndList,CLM_SETGREYOUTFLAGS,0,0);
SendMessage(hwndList,CLM_SETLEFTMARGIN ,2,0);
SendMessage(hwndList,CLM_SETINDENT ,10,0);
for i:=0 to FONTID_MAX do
SendMessage(hwndList,CLM_SETTEXTCOLOR,i,GetSysColor(COLOR_WINDOWTEXT));
SetWindowLongPtr(hwndList,GWL_STYLE,GetWindowLongPtr(hwndList,GWL_STYLE) or CLS_SHOWHIDDEN);
end;
procedure SetHistMask(Dlg:HWND);
begin
CheckDlgButton(Dlg,IDC_IN_REQUEST ,ORD((HistMask and hmInRequest )<>0));
CheckDlgButton(Dlg,IDC_OUT_REQUEST,ORD((HistMask and hmOutRequest)<>0));
CheckDlgButton(Dlg,IDC_IN_INFO ,ORD((HistMask and hmInInfo )<>0));
CheckDlgButton(Dlg,IDC_OUT_INFO ,ORD((HistMask and hmOutInfo )<>0));
CheckDlgButton(Dlg,IDC_IN_ERROR ,ORD((HistMask and hmInError )<>0));
CheckDlgButton(Dlg,IDC_OUT_ERROR ,ORD((HistMask and hmOutError )<>0));
CheckDlgButton(Dlg,IDC_IREQUEST ,ORD((HistMask and hmIRequest )<>0));
CheckDlgButton(Dlg,IDC_ISEND ,ORD((HistMask and hmISend )<>0));
end;
procedure SaveHistMask(Dlg:HWND);
begin
HistMask:=0;
if IsDlgButtonChecked(Dlg,IDC_IN_REQUEST )<>BST_UNCHECKED then HistMask:=HistMask or hmInRequest;
if IsDlgButtonChecked(Dlg,IDC_OUT_REQUEST)<>BST_UNCHECKED then HistMask:=HistMask or hmOutRequest;
if IsDlgButtonChecked(Dlg,IDC_IN_INFO )<>BST_UNCHECKED then HistMask:=HistMask or hmInInfo;
if IsDlgButtonChecked(Dlg,IDC_OUT_INFO )<>BST_UNCHECKED then HistMask:=HistMask or hmOutInfo;
if IsDlgButtonChecked(Dlg,IDC_IN_ERROR )<>BST_UNCHECKED then HistMask:=HistMask or hmInError;
if IsDlgButtonChecked(Dlg,IDC_OUT_ERROR )<>BST_UNCHECKED then HistMask:=HistMask or hmOutError;
if IsDlgButtonChecked(Dlg,IDC_IREQUEST )<>BST_UNCHECKED then HistMask:=HistMask or hmIRequest;
if IsDlgButtonChecked(Dlg,IDC_ISEND )<>BST_UNCHECKED then HistMask:=HistMask or hmISend;
end;
function DlgProcOptions(Dialog:HWND;hMessage:uint;wParam:WPARAM;lParam:LPARAM):LRESULT; stdcall;
const
Changed:integer=0;
// hItemAll:THANDLE=0;
var
// cii:TCLCINFOITEM;
hList:HWND;
begin
result:=0;
case hMessage of
WM_INITDIALOG: begin
TranslateDialogDefault(Dialog);
Changed:=DLGED_INIT;
hList:=GetDlgItem(Dialog,IDC_SHARE);
ResetListOptions(hList);
SendMessage(hList,CLM_SETUSEGROUPS ,1,0);
SendMessage(hList,CLM_SETHIDEEMPTYGROUPS,1,0);
// SendMessage(hList,CLM_SETEXTRACOLUMNS,2,0);
{
FillChar(cii,SizeOf(cii),0);
cii.cbSize :=SizeOf(cii);
cii.flags :=CLCIIF_GROUPFONT or CLCIIF_CHECKBOX;
cii.pszText.w:=TranslateW('** All contacts **');
hItemAll:=SendMessage(hList,CLM_ADDINFOITEM,0,tlparam(@cii));
}
SetAllContactStat(hList);
SetHistMask(Dialog);
SetDlgItemTextW(Dialog,IDC_PROTO_TEXT,ProtoText);
Changed:=0;
end;
WM_COMMAND: begin
if Changed<>DLGED_INIT then
begin
case wParam shr 16 of
BN_CLICKED,EN_CHANGE: SendMessage(GetParent(Dialog),PSM_CHANGED,0,0);
end;
end;
end;
WM_NOTIFY: begin
if Changed<>DLGED_INIT then
begin
if PNMHDR(lParam)^.idFrom=IDC_SHARE then
if integer(PNMHdr(lParam)^.code)=CLN_CHECKCHANGED then
SendMessage(GetParent(Dialog),PSM_CHANGED,0,0);
if integer(PNMHdr(lParam)^.code)=PSN_APPLY then
begin
mFreeMem(ProtoText);
ProtoText:=GetDlgText(Dialog,IDC_PROTO_TEXT);
SaveAllContactStat(GetDlgItem(Dialog,IDC_SHARE));
SaveHistMask(Dialog);
WriteOptions;
end;
end;
end;
else
{result:=}DefWindowProc(Dialog,hMessage,wParam,lParam);
end;
end;
|