Zitat:
Versprechen kann ich es dir nicht, aber ich werde mich mal damit beschäftigen...
Habe Dir eine
Unit gesendet, die Du dafür einbauen kannst.
So könnte dann Dein Compare aussehen:
Delphi-Quellcode:
procedure TCEp.Compare(const Child1, Child2 : TCEpChild);
var
i, j : integer;
Differ : TStandardTextComparer;
Diff : TDifference;
BMark : TSynEditMark;
begin
Child1.ChainWith(Child2);
Child2.ChainWith(Child1);
Child1.Compare(Child2);
Child2.Compare(Child1);
Differ := TStandardTextComparer.Create;
Differ.IgnoreCase := ((MainForm.TB_SelectHighlighter.Text <> 'PostScript')
and
(MainForm.TB_SelectHighlighter.Text <> 'Text'));
Differ.IgnoreSpaces := false;
Differ.SpacesAsOne := (MainForm.TB_SelectHighlighter.Text <> 'Text');
Differ.Heuristic := 0;
Differ.Clear;
Differ.Compare(Child1.Editor.Lines, Child2.Editor.Lines);
SetLength(Child1.CmpLineR, Child1.Editor.Lines.Count+1);
SetLength(Child1.CmpLineG, Child1.Editor.Lines.Count+1);
for i := 0 to Child1.Editor.Lines.Count
do begin
Child1.CmpLineR[i] := false;
Child1.CmpLineG[i] := false;
end;
SetLength(Child2.CmpLineR, Child2.Editor.Lines.Count+1);
SetLength(Child2.CmpLineG, Child2.Editor.Lines.Count+1);
for i := 0 to Child2.Editor.Lines.Count
do begin
Child2.CmpLineR[i] := false;
Child2.CmpLineG[i] := false;
end;
for i := 0 to Differ.Count - 1 do
begin
Diff := Differ.Diff[i];
for j := Diff.Left.Start to Diff.Left.Stop
do Child1.CmpLineR[j] := true;
if (Diff.Left.Start = Diff.Left.Stop)
then Child1.CmpLineG[Diff.Left.Start] := true;
BMark := TSynEditMark.Create(Child1.Editor);
with BMark
do begin
Line := Diff.Left.Start;
ImageIndex := 10;
Visible := true;
end;
Child1.Editor.Marks.Place(BMark);
for j := Diff.Right.Start to Diff.Right.Stop
do Child2.CmpLineR[j] := true;
if (Diff.Right.Start = Diff.Right.Stop)
then Child2.CmpLineG[Diff.Right.Start] := true;
BMark := TSynEditMark.Create(Child2.Editor);
with BMark
do begin
Line := Diff.Right.Start;
ImageIndex := 10;
Visible := true;
end;
Child2.Editor.Marks.Place(BMark);
end;
i := Differ.Count;
Differ.Free;
with Child1.Editor
do begin
OnSpecialLineColors := Child1.EditorSpecialLineColors;
CaretX := 1;
CaretY := 1;
TopLine := 1;
Repaint;
end;
with Child2.Editor
do begin
OnSpecialLineColors := Child2.EditorSpecialLineColors;
CaretX := 1;
CaretY := 1;
TopLine := 1;
Repaint;
end;
Application.ProcessMessages;
MessageBox(0, PAnsiChar(IntToStr(i) + ' Unterschiede gefunden.'), 'Dateiunterschiede finden', MB_ICONINFORMATION or MB_OK or MB_TOPMOST);
end;