-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy version control info 2.pas
64 lines (53 loc) · 1.63 KB
/
Copy version control info 2.pas
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
{
Copy Version Control Info inside Record Header between plugins.
Apply script to destination records, then select the source plugin.
Rcords are matched by FormIDs.
}
unit CopyVCInfo;
var
fromPlugin: IInterface;
//==================================================================================
function Process(e: IInterface): integer;
var
frm: TForm;
clb: TCheckListBox;
i: integer;
r: IInterface;
begin
// plugins selection window for the source plugin to copy from
if not Assigned(fromPlugin) then begin
frm := frmFileSelect;
try
frm.Caption := 'Select plugin to copy from';
frm.Width := 420;
clb := TCheckListBox(frm.FindComponent('CheckListBox1'));
// add files except the current one
for i := 0 to Pred(FileCount) do
if not SameText(GetFileName(e), GetFileName(FileByIndex(i))) then begin
clb.Items.AddObject(GetFileName(FileByIndex(i)), FileByIndex(i));
Inc(i);
end;
// get the first checked file
if frm.ShowModal = mrOk then
for i := 0 to Pred(clb.Items.Count) do
if clb.Checked[i] then begin
fromPlugin := ObjectToElement(clb.Items.Objects[i]);
Break;
end;
// if nothing is checked then abort
if not Assigned(fromPlugin) then begin
Result := 1;
Exit;
end;
finally
frm.Free;
end;
end;
// copy VC info
r := RecordByFormID(fromPlugin, FixedFormID(e), False);
if Assigned(r) then begin
SetFormVCS1(e, GetFormVCS1(r));
SetFormVCS2(e, GetFormVCS2(r));
end;
end;
end.