ADD: Differ - option to set 'modified' text color in binary mode

This commit is contained in:
Alexander Koblov 2021-08-08 17:10:54 +03:00
commit afd778c94d
3 changed files with 18 additions and 4 deletions

View file

@ -732,6 +732,9 @@ begin
BinaryViewerLeft.SecondViewer:= BinaryViewerRight;
BinaryViewerRight.SecondViewer:= BinaryViewerLeft;
BinaryViewerLeft.Modified:= gDifferModifiedBinaryColor;
BinaryViewerRight.Modified:= gDifferModifiedBinaryColor;
FontOptionsToFont(gFonts[dcfEditor], SynDiffEditLeft.Font);
FontOptionsToFont(gFonts[dcfEditor], SynDiffEditRight.Font);
FontOptionsToFont(gFonts[dcfViewer], BinaryViewerLeft.Font);

View file

@ -3,7 +3,7 @@
-------------------------------------------------------------------------
Binary difference viewer and comparator
Copyright (C) 2014 Alexander Koblov (alexx2000@mail.ru)
Copyright (C) 2014-2021 Alexander Koblov (alexx2000@mail.ru)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -35,6 +35,7 @@ type
TBinaryDiffViewer = class(TViewerControl)
private
FModified: TColor;
FScrollLock: Integer;
FKeepScrolling: Boolean;
FSecondViewer: TBinaryDiffViewer;
@ -45,6 +46,7 @@ type
constructor Create(AOwner: TComponent); override;
property KeepScrolling: Boolean read FKeepScrolling write FKeepScrolling;
property SecondViewer: TBinaryDiffViewer read FSecondViewer write FSecondViewer;
property Modified: TColor read FModified write FModified;
property LastError: String read FLastError;
end;
@ -123,9 +125,9 @@ begin
for I := 0 to MineLength - 1 do
begin
if (I > ForeignLength) or (PWord(P1)^ <> PWord(P2)^) then
Canvas.Font.Color := clRed
Canvas.Font.Color := FModified
else
Canvas.Font.Color := clBlack;
Canvas.Font.Color := clWindowText;
SymbolColor[I]:= Canvas.Font.Color;
WordHex:= Copy(P1, 1, cWordSize);
Canvas.TextOut(X, Y, WordHex);
@ -142,7 +144,7 @@ begin
Canvas.TextOut(X, Y, WordHex[I]);
Inc(X, SymbolWidth);
end;
Canvas.Font.Color := clBlack
Canvas.Font.Color := clWindowText;
end;
end;
end;
@ -168,6 +170,7 @@ end;
constructor TBinaryDiffViewer.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
FModified:= clRed;
Mode:= vcmHex;
end;

View file

@ -639,6 +639,7 @@ var
gDifferAddedColor: TColor;
gDifferDeletedColor: TColor;
gDifferModifiedColor: TColor;
gDifferModifiedBinaryColor: TColor;
{SyncDirs}
gSyncDirsSubdirs,
@ -2001,6 +2002,7 @@ begin
gDifferAddedColor := clPaleGreen;
gDifferDeletedColor := clPaleRed;
gDifferModifiedColor := clPaleBlue;
gDifferModifiedBinaryColor := clRed;
{SyncDirs}
gSyncDirsSubdirs := False;
@ -3096,6 +3098,10 @@ begin
gDifferAddedColor := GetValue(SubNode, 'Added', gDifferAddedColor);
gDifferDeletedColor := GetValue(SubNode, 'Deleted', gDifferDeletedColor);
gDifferModifiedColor := GetValue(SubNode, 'Modified', gDifferModifiedColor);
SubNode := FindNode(Node, 'Colors/Binary');
if Assigned(SubNode) then begin
gDifferModifiedBinaryColor := GetValue(SubNode, 'Modified', gDifferModifiedBinaryColor);
end;
end;
end;
@ -3699,6 +3705,8 @@ begin
SetValue(SubNode, 'Added', gDifferAddedColor);
SetValue(SubNode, 'Deleted', gDifferDeletedColor);
SetValue(SubNode, 'Modified', gDifferModifiedColor);
SubNode := FindNode(Node, 'Colors/Binary', True);
SetValue(SubNode, 'Modified', gDifferModifiedBinaryColor);
{ SyncDirs }
Node := FindNode(Root, 'SyncDirs', True);