UPD: Differ - move settings to doublecmd.xml

This commit is contained in:
Alexander Koblov 2021-08-07 23:12:08 +03:00
commit 0c22651107
3 changed files with 39 additions and 13 deletions

View file

@ -13,7 +13,7 @@ object frmDiffer: TfrmDiffer
OnDestroy = FormDestroy
OnKeyDown = FormKeyDown
OnResize = FormResize
SessionProperties = 'actAutoCompare.Checked;actIgnoreCase.Checked;actIgnoreWhiteSpace.Checked;actKeepScrolling.Checked;actLineDifferences.Checked;actPaintBackground.Checked;Height;Left;Top;Width;WindowState'
SessionProperties = 'actAutoCompare.Checked;Height;Left;Top;Width;WindowState'
ShowHint = True
ShowInTaskBar = stAlways
LCLVersion = '2.0.7.0'

View file

@ -198,7 +198,6 @@ type
procedure FormCloseQuery(Sender: TObject; var CanClose: boolean);
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure FormRestoreProperties(Sender: TObject);
procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
procedure FormResize(Sender: TObject);
procedure btnCancelClick(Sender: TObject);
@ -738,11 +737,19 @@ begin
FontOptionsToFont(gFonts[dcfViewer], BinaryViewerLeft.Font);
FontOptionsToFont(gFonts[dcfViewer], BinaryViewerRight.Font);
// Load settings
actIgnoreCase.Checked := gDifferIgnoreCase;
actKeepScrolling.Checked := gDifferKeepScrolling;
actLineDifferences.Checked := gDifferLineDifferences;
actPaintBackground.Checked := gDifferPaintBackground;
actIgnoreWhiteSpace.Checked := gDifferIgnoreWhiteSpace;
// Initialize mode
actKeepScrollingExecute(actKeepScrolling);
actPaintBackgroundExecute(actPaintBackground);
// Initialize property storage
with InitPropStorage(Self) do
begin
OnRestoreProperties:= @FormRestoreProperties;
end;
InitPropStorage(Self);
// Fill encoding menu
EncodingList:= TStringList.Create;
@ -760,13 +767,6 @@ begin
FreeAndNil(BinaryDiffList);
end;
procedure TfrmDiffer.FormRestoreProperties(Sender: TObject);
begin
// Initialize mode
actKeepScrollingExecute(actKeepScrolling);
actPaintBackgroundExecute(actPaintBackground);
end;
procedure TfrmDiffer.FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
begin
if Key = VK_ESCAPE then
@ -919,6 +919,12 @@ end;
procedure TfrmDiffer.FormClose(Sender: TObject; var CloseAction: TCloseAction);
begin
CloseAction:= caFree;
// Save settings
gDifferIgnoreCase := actIgnoreCase.Checked;
gDifferKeepScrolling := actKeepScrolling.Checked;
gDifferLineDifferences := actLineDifferences.Checked;
gDifferPaintBackground := actPaintBackground.Checked;
gDifferIgnoreWhiteSpace := actIgnoreWhiteSpace.Checked;
end;
procedure TfrmDiffer.FormCloseQuery(Sender: TObject; var CanClose: boolean);

View file

@ -631,6 +631,11 @@ var
gEditorSynEditRightEdge: Integer;
{ Differ }
gDifferIgnoreCase,
gDifferKeepScrolling,
gDifferLineDifferences,
gDifferPaintBackground,
gDifferIgnoreWhiteSpace: Boolean;
gDifferAddedColor: TColor;
gDifferDeletedColor: TColor;
gDifferModifiedColor: TColor;
@ -1988,6 +1993,11 @@ begin
gEditorSynEditRightEdge := 80;
{ Differ }
gDifferIgnoreCase := False;
gDifferKeepScrolling := True;
gDifferPaintBackground := True;
gDifferLineDifferences := False;
gDifferIgnoreWhiteSpace := False;
gDifferAddedColor := clPaleGreen;
gDifferDeletedColor := clPaleRed;
gDifferModifiedColor := clPaleBlue;
@ -3075,6 +3085,11 @@ begin
Node := Root.FindNode('Differ');
if Assigned(Node) then
begin
gDifferIgnoreCase := GetValue(Node, 'IgnoreCase', gDifferIgnoreCase);
gDifferKeepScrolling := GetValue(Node, 'KeepScrolling', gDifferKeepScrolling);
gDifferPaintBackground := GetValue(Node, 'PaintBackground', gDifferPaintBackground);
gDifferLineDifferences := GetValue(Node, 'LineDifferences', gDifferLineDifferences);
gDifferIgnoreWhiteSpace := GetValue(Node, 'IgnoreWhiteSpace', gDifferIgnoreWhiteSpace);
SubNode := FindNode(Node, 'Colors');
if Assigned(SubNode) then
begin
@ -3675,6 +3690,11 @@ begin
{ Differ }
Node := FindNode(Root, 'Differ',True);
SetValue(Node, 'IgnoreCase', gDifferIgnoreCase);
SetValue(Node, 'KeepScrolling', gDifferKeepScrolling);
SetValue(Node, 'PaintBackground', gDifferPaintBackground);
SetValue(Node, 'LineDifferences', gDifferLineDifferences);
SetValue(Node, 'IgnoreWhiteSpace', gDifferIgnoreWhiteSpace);
SubNode := FindNode(Node, 'Colors', True);
SetValue(SubNode, 'Added', gDifferAddedColor);
SetValue(SubNode, 'Deleted', gDifferDeletedColor);