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
|
unit iac_notes;
interface
implementation
uses
windows, messages, commctrl,
common, wrapper,
mirutils, dbsettings, m_api,
global, iac_global;
{$include i_cnst_notes.inc}
{$resource iac_notes.res}
const
opt_text = 'text';
type
tNotesAction = class(tBaseAction)
private
note:PWideChar;
public
constructor Create(uid:dword);
destructor Destroy; override;
function DoAction(var WorkData:tWorkData):LRESULT; override;
procedure Save(node:pointer;fmt:integer); override;
procedure Load(node:pointer;fmt:integer); override;
end;
//----- Support functions -----
//----- Object realization -----
constructor tNotesAction.Create(uid:dword);
begin
inherited Create(uid);
end;
destructor tNotesAction.Destroy;
begin
inherited Destroy;
end;
function tNotesAction.DoAction(var WorkData:tWorkData):LRESULT;
begin
result:=0;
end;
procedure tNotesAction.Load(node:pointer;fmt:integer);
var
section: array [0..127] of AnsiChar;
pc:pAnsiChar;
begin
inherited Load(node,0);
case fmt of
0: begin
pc:=StrCopyE(section,pAnsiChar(node));
StrCopy(pc,opt_text); note:=DBReadUnicode(0,DBBranch,section,nil);
end;
{
1: begin
end;
}
end;
end;
procedure tNotesAction.Save(node:pointer;fmt:integer);
var
section: array [0..127] of AnsiChar;
pc:pAnsiChar;
begin
inherited Save(node,fmt);
case fmt of
0: begin
pc:=StrCopyE(section,pAnsiChar(node));
StrCopy(pc,opt_text); DBWriteUnicode(0,DBBranch,section,note);
end;
{
1: begin
end;
}
end;
end;
//----- Dialog realization -----
procedure ClearFields(Dialog:HWND);
begin
SetDlgItemTextW(Dialog,IDC_TXT_TEXT,nil);
end;
function DlgProc(Dialog:HWND;hMessage:uint;wParam:WPARAM;lParam:LPARAM):LRESULT; stdcall;
const
NoProcess:boolean=true;
begin
result:=0;
case hMessage of
WM_INITDIALOG: begin
TranslateDialogDefault(Dialog);
end;
WM_ACT_SETVALUE: begin
NoProcess:=true;
ClearFields(Dialog);
with tNotesAction(lParam) do
begin
SetDlgItemTextW(Dialog,IDC_TXT_TEXT,note);
end;
NoProcess:=false;
end;
WM_ACT_RESET: begin
NoProcess:=true;
ClearFields(Dialog);
NoProcess:=false;
end;
WM_ACT_SAVE: begin
with tNotesAction(lParam) do
begin
flags:=0;
note:=GetDlgText(Dialog,IDC_TXT_TEXT);
end;
end;
WM_COMMAND: begin
case wParam shr 16 of
EN_CHANGE: if not NoProcess then
SendMessage(GetParent(GetParent(Dialog)),PSM_CHANGED,0,0);
end;
end;
WM_HELP: begin
result:=1;
end;
end;
end;
//----- Export/interface functions -----
var
vc:tActModule;
function CreateAction:tBaseAction;
begin
result:=tNotesAction.Create(vc.Hash);
end;
function CreateDialog(parent:HWND):HWND;
begin
result:=CreateDialogW(hInstance,'IDD_ACTNOTES',parent,@DlgProc);
end;
procedure Init;
begin
vc.Next :=ModuleLink;
vc.Name :='Notes';
vc.Dialog :=@CreateDialog;
vc.Create :=@CreateAction;
vc.Icon :='IDI_NOTES';
ModuleLink :=@vc;
end;
begin
Init;
end.
|