- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 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
for i := 0 to high(vParagsChanges) do
begin
if vParNumIn < vParagsChanges[i].ParNo1 then
begin
inc(vParNumOut, vParagsChanges[i].ParNo1 - vParNumIn);
vParNumIn := vParagsChanges[i].ParNo1;
end;
if i < high(vParagsChanges) then
if (vParagsChanges[i].ParNo1+vParagsChanges[i].Range=vParagsChanges[i+1].ParNo1) and
((vParagsChanges[i].Kind=ckDelete) and (vParagsChanges[i+1].Kind=ckAdd)) then
{if vParagsChanges[i].Range = vParagsChanges[i+1].Range then}
begin
vUnitedPars := min(vParagsChanges[i].Range, vParagsChanges[i+1].Range);
if vParagsChanges[i+1].Range >= vUnitedPars then
vParagsChanges[i+1].Range := vParagsChanges[i+1].Range - vUnitedPars;
if vParagsChanges[i].Range >= vUnitedPars then
vParagsChanges[i].Range := vParagsChanges[i].Range - vUnitedPars;
for j := 0 to vUnitedPars-1 do
begin
FParsHL[vParNumIn+vInsertedCount1+j].Kind := pkReplaced;
vTagsInfoEx := GetTagsInfo(Editor1.Parag(vParNumIn+vInsertedCount1+j).Str);
FParsHL[vParNumIn+vInsertedCount1+j].ViewGroups := GetViewGroupsByChangeItems(vTagsInfoEx.TagKinds);
vTagsInfoEx := GetTagsInfo(Editor2.Parag(vParNumIn+vInsertedCount1+j).Str);
FParsHL[vParNumIn+vInsertedCount1+j].ViewGroups := FParsHL[vParNumIn+vInsertedCount1+j].ViewGroups + GetViewGroupsByChangeItems(vTagsInfoEx.TagKinds);
if vParagsChanges[i].InCard then
FParsHL[vParNumIn+vInsertedCount1+j].ViewGroups := FParsHL[vParNumIn+vInsertedCount1+j].ViewGroups + [vgCard]
else
FParsHL[vParNumIn+vInsertedCount1+j].ViewGroups := FParsHL[vParNumIn+vInsertedCount1+j].ViewGroups + [vgText];
end;
inc(vParNumIn, vUnitedPars);
inc(vParNumOut, vUnitedPars);
end;
case vParagsChanges[i].Kind of
ckAdd: begin
for j := 0 to vParagsChanges[i].Range-1 do
begin
vTmpParag := TRTFParag.Create(nil, False, False, raLeft{raRight});
FEditor1.InsPar(vParNumIn+vInsertedCount1+j, vTmpParag, false);
FParsHL[vParNumIn+vInsertedCount1+j].Kind := pkAdded;
vTagsInfoEx := GetTagsInfo(Editor2.Parag(vParNumOut+vInsertedCount2+j).Str);
if vParagsChanges[i].InCard then
FParsHL[vParNumIn+vInsertedCount1+j].ViewGroups := GetViewGroupsByChangeItems(vTagsInfoEx.TagKinds) + [vgCard]
else
FParsHL[vParNumIn+vInsertedCount1+j].ViewGroups := GetViewGroupsByChangeItems(vTagsInfoEx.TagKinds) + [vgText];
end;
inc(vInsertedCount1, vParagsChanges[i].Range);
inc(vParNumOut, vParagsChanges[i].Range);
end;
ckDelete: begin
for j := 0 to vParagsChanges[i].Range-1 do
begin
vTmpParag := TRTFParag.Create(nil, False, False, raLeft);
FEditor2.InsPar(vParNumOut+vInsertedCount2+j, vTmpParag, false);
FParsHL[vParNumOut+vInsertedCount2+j].Kind := pkDeleted;
vTagsInfoEx := GetTagsInfo(Editor1.Parag(vParNumIn+vInsertedCount1+j).Str);
if vParagsChanges[i].InCard then
FParsHL[vParNumOut+vInsertedCount2+j].ViewGroups := GetViewGroupsByChangeItems(vTagsInfoEx.TagKinds) + [vgCard]
else
FParsHL[vParNumOut+vInsertedCount2+j].ViewGroups := GetViewGroupsByChangeItems(vTagsInfoEx.TagKinds) + [vgText];
end;
inc(vInsertedCount2, vParagsChanges[i].Range);
inc(vParNumIn, vParagsChanges[i].Range);
end;
ckModify: begin
if (ciAlignment in vParagsChanges[i].ChangedItems) and (vParagsChanges[i].StrChanges = nil) then
FParsHL[vParNumIn+vInsertedCount1].Kind := pkAlignment
else
FParsHL[vParNumIn+vInsertedCount1].Kind := pkModified;
FParsHL[vParNumIn+vInsertedCount1].Changes := GetViewChanges(vParagsChanges[i].StrChanges);
FParsHL[vParNumIn+vInsertedCount1].ViewGroups := GetViewGroupsByChangeItems(vParagsChanges[i].ChangedItems);
if vParagsChanges[i].InCard then
if (ciText in vParagsChanges[i].ChangedItems) or (ciAlignment in vParagsChanges[i].ChangedItems) then
begin
FParsHL[vParNumIn+vInsertedCount1].ViewGroups := FParsHL[vParNumIn+vInsertedCount1].ViewGroups + [vgCard];
FParsHL[vParNumIn+vInsertedCount1].ViewGroups := FParsHL[vParNumIn+vInsertedCount1].ViewGroups - [vgText, vgAlignment];
for j := 0 to high(FParsHL[vParNumIn+vInsertedCount1].Changes) do
if FParsHL[vParNumIn+vInsertedCount1].Changes[j].ViewGroup = vgText then
FParsHL[vParNumIn+vInsertedCount1].Changes[j].ViewGroup := vgCard;
end;
inc(vParNumIn, 1);
inc(vParNumOut, 1);
end;
end;
end;
Такой г****код возник не за 1 день. Голову пришлось поломать основательно :))
Комментарии убраны, дабы не портить удовольствие от прочтения.