Revert "ideintf: moved diff options to ide"

This reverts commit 08e256ebbd.
This commit is contained in:
mattias 2023-06-11 22:00:09 +02:00
parent 7a05fd5b85
commit 1132dcd45e
2 changed files with 45 additions and 72 deletions

View File

@ -44,7 +44,7 @@ uses
LazFileCache, LazFileUtils, LazLoggerBase, LazUTF8, AvgLvlTree, Laz2_XMLCfg, LazFileCache, LazFileUtils, LazLoggerBase, LazUTF8, AvgLvlTree, Laz2_XMLCfg,
LazConfigStorage, LazConfigStorage,
// IdeConfig // IdeConfig
LazConf, RecentListProcs, IdeXmlConfigProcs, DiffPatch, LazConf, RecentListProcs, IdeXmlConfigProcs,
// IdeIntf // IdeIntf
ProjectIntf, IDEDialogs; ProjectIntf, IDEDialogs;
@ -161,6 +161,9 @@ type
private private
FCleanOutputFileMask: string; FCleanOutputFileMask: string;
FCleanSourcesFileMask: string; FCleanSourcesFileMask: string;
FDiffFlags: TTextDiffFlags;
FDiffText2: string;
FDiffText2OnlySelection: boolean;
FFileDialogSettings: TFileDialogSettings; FFileDialogSettings: TFileDialogSettings;
FFilename: string; FFilename: string;
@ -192,12 +195,12 @@ type
public public
constructor Create; constructor Create;
destructor Destroy; override; destructor Destroy; override;
procedure Clear; virtual; procedure Clear;
procedure Load; virtual; procedure Load;
procedure Save; virtual; procedure Save;
procedure LoadFromXMLConfig(XMLConfig: TXMLConfig; const Path: string); virtual; procedure LoadFromXMLConfig(XMLConfig: TXMLConfig; const Path: string);
procedure SaveToXMLConfig(XMLConfig: TXMLConfig; const Path: string); virtual; procedure SaveToXMLConfig(XMLConfig: TXMLConfig; const Path: string);
procedure SetLazarusDefaultFilename; virtual; procedure SetLazarusDefaultFilename;
// Find- and replace-history // Find- and replace-history
function AddToFindHistory(const AFindStr: string): boolean; function AddToFindHistory(const AFindStr: string): boolean;
@ -238,6 +241,11 @@ type
// various history lists // various history lists
property HistoryLists: THistoryLists read FHistoryLists; property HistoryLists: THistoryLists read FHistoryLists;
// diff dialog
property DiffFlags: TTextDiffFlags read FDiffFlags write FDiffFlags;
property DiffText2: string read FDiffText2 write FDiffText2;
property DiffText2OnlySelection: boolean read FDiffText2OnlySelection
write FDiffText2OnlySelection;
// new dialog // new dialog
property NewProjectType: string read FNewProjectType write FNewProjectType; property NewProjectType: string read FNewProjectType write FNewProjectType;
property NewFileType: string read FNewFileType write FNewFileType; property NewFileType: string read FNewFileType write FNewFileType;
@ -284,7 +292,7 @@ const
); );
var var
InputHistories: TInputHistories = nil; // set by IDE InputHistories: TInputHistories = nil;
function CompareIHIgnoreItems(Item1, Item2: Pointer): integer; function CompareIHIgnoreItems(Item1, Item2: Pointer): integer;
function CompareAnsiStringWithIHIgnoreItem(AString, Item: Pointer): integer; function CompareAnsiStringWithIHIgnoreItem(AString, Item: Pointer): integer;
@ -298,6 +306,8 @@ implementation
const const
DefaultHistoryFile = 'inputhistory.xml'; DefaultHistoryFile = 'inputhistory.xml';
InputHistoryVersion = 1; InputHistoryVersion = 1;
DefaultDiffFlags = [tdfIgnoreCase,tdfIgnoreEmptyLineChanges,
tdfIgnoreLineEnds,tdfIgnoreTrailingSpaces];
function CompareIHIgnoreItems(Item1, Item2: Pointer): integer; function CompareIHIgnoreItems(Item1, Item2: Pointer): integer;
var var
@ -382,6 +392,9 @@ begin
Height:=0; Height:=0;
InitialDir:=''; InitialDir:='';
end; end;
FDiffFlags:=DefaultDiffFlags;
FDiffText2:='';
FDiffText2OnlySelection:=false;
FNewProjectType:=''; FNewProjectType:='';
FNewFileType:=''; FNewFileType:='';
FLastConvertDelphiProject:=''; FLastConvertDelphiProject:='';
@ -394,6 +407,7 @@ end;
procedure TInputHistories.LoadFromXMLConfig(XMLConfig: TXMLConfig; const Path: string); procedure TInputHistories.LoadFromXMLConfig(XMLConfig: TXMLConfig; const Path: string);
var var
DiffFlag: TTextDiffFlag;
FIFOption: TLazFindInFileSearchOption; FIFOption: TLazFindInFileSearchOption;
begin begin
// Find- and replace-history // Find- and replace-history
@ -430,6 +444,18 @@ begin
DefaultProjectCleanSourcesFileMask); DefaultProjectCleanSourcesFileMask);
// history lists // history lists
FHistoryLists.LoadFromXMLConfig(XMLConfig,Path+'HistoryLists/'); FHistoryLists.LoadFromXMLConfig(XMLConfig,Path+'HistoryLists/');
// diff dialog
FDiffFlags:=[];
for DiffFlag:=Low(TTextDiffFlag) to High(TTextDiffFlag) do begin
if XMLConfig.GetValue(
Path+'DiffDialog/Options/'+TextDiffFlagNames[DiffFlag],
DiffFlag in DefaultDiffFlags)
then
Include(FDiffFlags,DiffFlag);
end;
FDiffText2:=XMLConfig.GetValue(Path+'DiffDialog/Text2/Name','');
FDiffText2OnlySelection:=
XMLConfig.GetValue(Path+'DiffDialog/Text2/OnlySelection',false);
// new items // new items
FNewProjectType:=XMLConfig.GetValue(Path+'New/Project/Type',''); FNewProjectType:=XMLConfig.GetValue(Path+'New/Project/Type','');
@ -451,6 +477,7 @@ end;
procedure TInputHistories.SaveToXMLConfig(XMLConfig: TXMLConfig; const Path: string); procedure TInputHistories.SaveToXMLConfig(XMLConfig: TXMLConfig; const Path: string);
var var
DiffFlag: TTextDiffFlag;
FIFOption: TLazFindInFileSearchOption; FIFOption: TLazFindInFileSearchOption;
begin begin
// Find- and replace-history // Find- and replace-history
@ -485,6 +512,15 @@ begin
DefaultProjectCleanSourcesFileMask); DefaultProjectCleanSourcesFileMask);
// history lists // history lists
FHistoryLists.SaveToXMLConfig(XMLConfig,Path+'HistoryLists/',True); FHistoryLists.SaveToXMLConfig(XMLConfig,Path+'HistoryLists/',True);
// diff dialog
for DiffFlag:=Low(TTextDiffFlag) to High(TTextDiffFlag) do begin
XMLConfig.SetDeleteValue(
Path+'DiffDialog/Options/'+TextDiffFlagNames[DiffFlag],
DiffFlag in DiffFlags,DiffFlag in DefaultDiffFlags);
end;
XMLConfig.SetDeleteValue(Path+'DiffDialog/Text2/Name',FDiffText2,'');
XMLConfig.SetDeleteValue(Path+'DiffDialog/Text2/OnlySelection',
FDiffText2OnlySelection,false);
// new items // new items
XMLConfig.SetDeleteValue(Path+'New/Project/Type',FNewProjectType,''); XMLConfig.SetDeleteValue(Path+'New/Project/Type',FNewProjectType,'');

View File

@ -34,7 +34,7 @@ uses
// SynEdit // SynEdit
SynEditTypes, SynEditTypes,
// IDE // IDE
InputHistory, DiffPatch; InputHistory;
type type
@ -51,9 +51,6 @@ type
SaveOptionsSelSpecific = [ssoEntireScope, ssoSelectedOnly]; SaveOptionsSelSpecific = [ssoEntireScope, ssoSelectedOnly];
SaveOptions = SaveOptionsGeneral + SaveOptionsSelSpecific; SaveOptions = SaveOptionsGeneral + SaveOptionsSelSpecific;
private private
FDiffFlags: TTextDiffFlags;
FDiffText2: string;
FDiffText2OnlySelection: boolean;
FFindOptions: array[Boolean] of TSynSearchOptions; // array[SelAvail] - selection available FFindOptions: array[Boolean] of TSynSearchOptions; // array[SelAvail] - selection available
function GetFindOptions(const ASelAvail: Boolean): TSynSearchOptions; function GetFindOptions(const ASelAvail: Boolean): TSynSearchOptions;
procedure SetFindOptions(const ASelAvail: Boolean; procedure SetFindOptions(const ASelAvail: Boolean;
@ -64,16 +61,7 @@ type
public public
constructor Create; constructor Create;
destructor Destroy; override; destructor Destroy; override;
procedure Clear; override;
property FindOptions[const ASelAvail: Boolean]: TSynSearchOptions read GetFindOptions write SetFindOptions; property FindOptions[const ASelAvail: Boolean]: TSynSearchOptions read GetFindOptions write SetFindOptions;
procedure LoadFromXMLConfig(XMLConfig: TXMLConfig; const Path: string); override;
procedure SaveToXMLConfig(XMLConfig: TXMLConfig; const Path: string); override;
// diff dialog
property DiffFlags: TTextDiffFlags read FDiffFlags write FDiffFlags;
property DiffText2: string read FDiffText2 write FDiffText2;
property DiffText2OnlySelection: boolean read FDiffText2OnlySelection
write FDiffText2OnlySelection;
end; end;
const const
@ -98,10 +86,6 @@ var
implementation implementation
const
DefaultDiffFlags = [tdfIgnoreCase,tdfIgnoreEmptyLineChanges,
tdfIgnoreLineEnds,tdfIgnoreTrailingSpaces];
{ TInputHistoriesWithSearchOpt } { TInputHistoriesWithSearchOpt }
constructor TInputHistoriesWithSearchOpt.Create; constructor TInputHistoriesWithSearchOpt.Create;
@ -115,53 +99,6 @@ begin
inherited Destroy; inherited Destroy;
end; end;
procedure TInputHistoriesWithSearchOpt.Clear;
begin
inherited Clear;
FDiffFlags:=DefaultDiffFlags;
FDiffText2:='';
FDiffText2OnlySelection:=false;
end;
procedure TInputHistoriesWithSearchOpt.LoadFromXMLConfig(XMLConfig: TXMLConfig;
const Path: string);
var
DiffFlag: TTextDiffFlag;
begin
inherited LoadFromXMLConfig(XMLConfig, Path);
// diff dialog
FDiffFlags:=[];
for DiffFlag:=Low(TTextDiffFlag) to High(TTextDiffFlag) do begin
if XMLConfig.GetValue(
Path+'DiffDialog/Options/'+TextDiffFlagNames[DiffFlag],
DiffFlag in DefaultDiffFlags)
then
Include(FDiffFlags,DiffFlag);
end;
FDiffText2:=XMLConfig.GetValue(Path+'DiffDialog/Text2/Name','');
FDiffText2OnlySelection:=
XMLConfig.GetValue(Path+'DiffDialog/Text2/OnlySelection',false);
end;
procedure TInputHistoriesWithSearchOpt.SaveToXMLConfig(XMLConfig: TXMLConfig;
const Path: string);
var
DiffFlag: TTextDiffFlag;
begin
inherited SaveToXMLConfig(XMLConfig, Path);
// diff dialog
for DiffFlag:=Low(TTextDiffFlag) to High(TTextDiffFlag) do begin
XMLConfig.SetDeleteValue(
Path+'DiffDialog/Options/'+TextDiffFlagNames[DiffFlag],
DiffFlag in DiffFlags,DiffFlag in DefaultDiffFlags);
end;
XMLConfig.SetDeleteValue(Path+'DiffDialog/Text2/Name',FDiffText2,'');
XMLConfig.SetDeleteValue(Path+'DiffDialog/Text2/OnlySelection',
FDiffText2OnlySelection,false);
end;
function TInputHistoriesWithSearchOpt.GetFindOptions( function TInputHistoriesWithSearchOpt.GetFindOptions(
const ASelAvail: Boolean): TSynSearchOptions; const ASelAvail: Boolean): TSynSearchOptions;
begin begin