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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
|
{}
const
etHK = 1; // Groups changed
etACT = 2; // Actions changed
const
ACI_APPLY :PAnsiChar = 'ACI_Apply';
ACI_NEW :PAnsiChar = 'ACI_New';
ACI_UP :PAnsiChar = 'ACI_Up';
ACI_DOWN :PAnsiChar = 'ACI_Down';
ACI_DELETE :PAnsiChar = 'ACI_Delete';
ACI_RELOAD :PAnsiChar = 'ACI_Reload';
ACI_TEST :PAnsiChar = 'ACI_Test';
ACI_IMPORT :PAnsiChar = 'ACI_Import';
ACI_EXPORT :PAnsiChar = 'ACI_Export';
const
ACI_CONTACT = 'ACI_Contact';
ACI_SERVICE = 'ACI_Service';
ACI_PROGRAM = 'ACI_Program';
ACI_INSERT = 'ACI_Insert';
ACI_ADVANCE = 'ACI_Advanced';
ACI_CHAIN = 'ACI_Chain';
ACI_RW = 'ACI_Database';
ACI_MESSAGE = 'ACI_Message';
ACI_FORMAT = 'ACI_Format';
ACI_VAR_UNCHECKED = 'ACI_VarUnChecked';
ACI_VAR_CHECKED = 'ACI_VarChecked';
const
sresInt = 0;
sresHex = 1;
sresString = 2;
sresStruct = 3;
type
tActId = record
code:dword;
id :dword;
icon:PAnsiChar;
text:PAnsiChar;
end;
const
ActIds:array [0..ACT_MAXTYPE-1] of tActId = (
(code:ACT_CONTACT; id:IDI_CONTACT; icon:ACI_CONTACT; text:'Open contact window'),
(code:ACT_SERVICE; id:IDI_SERVICE; icon:ACI_SERVICE; text:'Call service'),
(code:ACT_PROGRAM; id:IDI_PROGRAM; icon:ACI_PROGRAM; text:'Execute program'),
(code:ACT_TEXT ; id:IDI_INSERT ; icon:ACI_INSERT ; text:'Insert text'),
(code:ACT_ADVANCE; id:IDI_ADVANCE; icon:ACI_ADVANCE; text:'Advanced'),
(code:ACT_CHAIN ; id:IDI_CHAIN ; icon:ACI_CHAIN ; text:'Link to action'),
(code:ACT_RW ; id:IDI_RW ; icon:ACI_RW ; text:'Profile'),
(code:ACT_MESSAGE; id:IDI_MESSAGE; icon:ACI_MESSAGE; text:'MessageBox'));
procedure RegisterIcon(var sid:TSKINICONDESC;id:uint_ptr;name:PAnsiChar;descr:PAnsiChar);
var
buf:array [0..63] of WideChar;
begin
sid.hDefaultIcon :=LoadImage(hInstance,MAKEINTRESOURCE(id),IMAGE_ICON,16,16,0);
sid.pszName :=name;
sid.szDescription.w:=FastAnsiToWideBuf(descr,buf);
Skin_AddIcon(@sid);
DestroyIcon(sid.hDefaultIcon);
end;
procedure RegisterIcons;
var
sid:TSKINICONDESC;
i:integer;
begin
FillChar(sid,SizeOf(TSKINICONDESC),0);
sid.cbSize :=SizeOf(TSKINICONDESC);
sid.cx :=16;
sid.cy :=16;
sid.flags :=SIDF_UNICODE;
sid.szSection.w:='Actions';
RegisterIcon(sid,IDI_APPLY ,ACI_APPLY ,'Apply');
RegisterIcon(sid,IDI_NEW ,ACI_NEW ,'New');
RegisterIcon(sid,IDI_DELETE ,ACI_DELETE ,'Delete');
RegisterIcon(sid,IDI_UP ,ACI_UP ,'Up');
RegisterIcon(sid,IDI_DOWN ,ACI_DOWN ,'Down');
RegisterIcon(sid,IDI_RELOAD ,ACI_RELOAD ,'Reload');
RegisterIcon(sid,IDI_TEST ,ACI_TEST ,'Test');
RegisterIcon(sid,IDI_IMPORT ,ACI_IMPORT ,'Import');
RegisterIcon(sid,IDI_EXPORT ,ACI_EXPORT ,'Export');
RegisterIcon(sid,IDI_FORMAT ,ACI_FORMAT ,'Contact list format');
for i:=0 to ACT_MAXTYPE-1 do
with ActIds[i] do
RegisterIcon(sid,id,icon,text);
sid.cx:=8;
sid.cy:=8;
RegisterIcon(sid,IDI_VAR_CHECKED ,ACI_VAR_CHECKED ,'Use Variables');
RegisterIcon(sid,IDI_VAR_UNCHECKED,ACI_VAR_UNCHECKED,'Don''t use Variables');
end;
procedure SetStart;
begin
if NewGroupList=nil then
begin
NewGroupList:=GroupList;
NewMaxGroups:=MaxGroups;
end;
if NewActionList=nil then
begin
NewActionList:=ActionList;
NewMaxActions:=MaxActions;
end;
end;
procedure SetChanged(wnd:HWND;atype:integer);
begin
SendMessage(GetParent(wnd),PSM_CHANGED,0,0);
if ((atype and etHK )<>0) and (NewGroupList =GroupList ) then NewGroupList :=CloneGroupList;
if ((atype and etACT)<>0) and (NewActionList=ActionList) then NewActionList:=CloneActionList;
end;
procedure SetSave(Dialog:HWND;curIdx:integer);
var
i,j:integer;
li:LV_ITEMW;
wnd:HWND;
begin
if NewGroupList<>GroupList then
begin
DestroyGroups(GroupList,MaxGroups);
wnd:=GetDlgItem(Dialog,IDC_ACTION_GROUP);
j:=SendMessageW(wnd,LVM_GETITEMCOUNT,0,0);
MaxGroups:=j;
if j>0 then
begin
GetMem (GroupList ,MaxGroups*SizeOf(tHKRecord));
FillChar(GroupList^,MaxGroups*SizeOf(tHKRecord),0);
li.mask :=LVIF_PARAM;
li.iSubItem:=0;
for i:=0 to j-1 do
begin
li.iItem:=i;
SendMessageW(wnd,LVM_GETITEMW,0,lparam(@li)); // GetLParam(wnd,i);
move(NewGroupList^[li.lParam],GroupList^[i],SizeOf(tHKRecord));
li.lParam:=i;
SendMessageW(wnd,LVM_SETITEMW,0,lparam(@li));
end;
end
else
GroupList:=nil;
FreeMem(NewGroupList);
NewGroupList:=GroupList;
NewMaxGroups:=MaxGroups;
end;
end;
procedure SetCancel;
begin
if NewActionList<>nil then
begin
if (NewActionList<>ActionList) then
DestroyActions(NewActionList,NewMaxActions);
NewActionList:=nil;
end;
if NewGroupList<>nil then
begin
if (NewGroupList<>GroupList) then
DestroyGroups(NewGroupList,NewMaxGroups);
NewGroupList:=nil;
end;
end;
{$include i_opt_dlg2.inc}
function OnOptInitialise(wParam:WPARAM;lParam:LPARAM):int;cdecl;
var
odp:TOPTIONSDIALOGPAGE;
ptr:pActionLink;
tmpl:pAnsiChar;
name:pansiChar;
proc:pointer;
i:integer;
begin
result:=0;
NoDescription :=TranslateW('No description');
StrCopyW(xmlfilename,'c:\export.xml');
DoInitCommonControls(ICC_USEREX_CLASSES);
FillChar(odp,SizeOf(odp),0);
odp.cbSize :=SizeOf(odp);
odp.flags :=ODPF_BOLDGROUPS;
odp.Position :=900003000;
odp.hInstance :=hInstance;
odp.szGroup.a :='Services';
odp.szTitle.a :='Actions';
odp.szTab.a :='Actions';
odp.pfnDlgProc :=@DlgProcOpt2;
odp.pszTemplate:=PAnsiChar(IDD_ACTION);
Options_AddPage(wParam,@odp);
ptr:=ActionLink;
while ptr<>nil do
begin
if @ptr^.AddOption<>nil then
begin
i:=ptr^.AddOption(tmpl,proc,name);
odp.pszTemplate:=tmpl;
odp.pfnDlgProc :=proc;
odp.szTab.a :=name;
Options_AddPage(wParam,@odp);
if i>0 then continue;
end;
ptr:=ptr^.Next;
end;
end;
|