From 1132dcd45ea4b97e98a4a2eabb60bd98470b064b Mon Sep 17 00:00:00 2001 From: mattias Date: Sun, 11 Jun 2023 22:00:09 +0200 Subject: [PATCH] Revert "ideintf: moved diff options to ide" This reverts commit 08e256ebbd7c80bcd931f089e8084c8e1688d5db. --- components/ideintf/inputhistory.pas | 52 +++++++++++++++++++---- ide/inputhistorywithsearchopt.pas | 65 +---------------------------- 2 files changed, 45 insertions(+), 72 deletions(-) diff --git a/components/ideintf/inputhistory.pas b/components/ideintf/inputhistory.pas index b222d78fd6..81ccef376c 100644 --- a/components/ideintf/inputhistory.pas +++ b/components/ideintf/inputhistory.pas @@ -44,7 +44,7 @@ uses LazFileCache, LazFileUtils, LazLoggerBase, LazUTF8, AvgLvlTree, Laz2_XMLCfg, LazConfigStorage, // IdeConfig - LazConf, RecentListProcs, IdeXmlConfigProcs, + DiffPatch, LazConf, RecentListProcs, IdeXmlConfigProcs, // IdeIntf ProjectIntf, IDEDialogs; @@ -161,6 +161,9 @@ type private FCleanOutputFileMask: string; FCleanSourcesFileMask: string; + FDiffFlags: TTextDiffFlags; + FDiffText2: string; + FDiffText2OnlySelection: boolean; FFileDialogSettings: TFileDialogSettings; FFilename: string; @@ -192,12 +195,12 @@ type public constructor Create; destructor Destroy; override; - procedure Clear; virtual; - procedure Load; virtual; - procedure Save; virtual; - procedure LoadFromXMLConfig(XMLConfig: TXMLConfig; const Path: string); virtual; - procedure SaveToXMLConfig(XMLConfig: TXMLConfig; const Path: string); virtual; - procedure SetLazarusDefaultFilename; virtual; + procedure Clear; + procedure Load; + procedure Save; + procedure LoadFromXMLConfig(XMLConfig: TXMLConfig; const Path: string); + procedure SaveToXMLConfig(XMLConfig: TXMLConfig; const Path: string); + procedure SetLazarusDefaultFilename; // Find- and replace-history function AddToFindHistory(const AFindStr: string): boolean; @@ -238,6 +241,11 @@ type // various history lists 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 property NewProjectType: string read FNewProjectType write FNewProjectType; property NewFileType: string read FNewFileType write FNewFileType; @@ -284,7 +292,7 @@ const ); var - InputHistories: TInputHistories = nil; // set by IDE + InputHistories: TInputHistories = nil; function CompareIHIgnoreItems(Item1, Item2: Pointer): integer; function CompareAnsiStringWithIHIgnoreItem(AString, Item: Pointer): integer; @@ -298,6 +306,8 @@ implementation const DefaultHistoryFile = 'inputhistory.xml'; InputHistoryVersion = 1; + DefaultDiffFlags = [tdfIgnoreCase,tdfIgnoreEmptyLineChanges, + tdfIgnoreLineEnds,tdfIgnoreTrailingSpaces]; function CompareIHIgnoreItems(Item1, Item2: Pointer): integer; var @@ -382,6 +392,9 @@ begin Height:=0; InitialDir:=''; end; + FDiffFlags:=DefaultDiffFlags; + FDiffText2:=''; + FDiffText2OnlySelection:=false; FNewProjectType:=''; FNewFileType:=''; FLastConvertDelphiProject:=''; @@ -394,6 +407,7 @@ end; procedure TInputHistories.LoadFromXMLConfig(XMLConfig: TXMLConfig; const Path: string); var + DiffFlag: TTextDiffFlag; FIFOption: TLazFindInFileSearchOption; begin // Find- and replace-history @@ -430,6 +444,18 @@ begin DefaultProjectCleanSourcesFileMask); // history lists 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 FNewProjectType:=XMLConfig.GetValue(Path+'New/Project/Type',''); @@ -451,6 +477,7 @@ end; procedure TInputHistories.SaveToXMLConfig(XMLConfig: TXMLConfig; const Path: string); var + DiffFlag: TTextDiffFlag; FIFOption: TLazFindInFileSearchOption; begin // Find- and replace-history @@ -485,6 +512,15 @@ begin DefaultProjectCleanSourcesFileMask); // history lists 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 XMLConfig.SetDeleteValue(Path+'New/Project/Type',FNewProjectType,''); diff --git a/ide/inputhistorywithsearchopt.pas b/ide/inputhistorywithsearchopt.pas index f96ef06043..abae7faccf 100644 --- a/ide/inputhistorywithsearchopt.pas +++ b/ide/inputhistorywithsearchopt.pas @@ -34,7 +34,7 @@ uses // SynEdit SynEditTypes, // IDE - InputHistory, DiffPatch; + InputHistory; type @@ -51,9 +51,6 @@ type SaveOptionsSelSpecific = [ssoEntireScope, ssoSelectedOnly]; SaveOptions = SaveOptionsGeneral + SaveOptionsSelSpecific; private - FDiffFlags: TTextDiffFlags; - FDiffText2: string; - FDiffText2OnlySelection: boolean; FFindOptions: array[Boolean] of TSynSearchOptions; // array[SelAvail] - selection available function GetFindOptions(const ASelAvail: Boolean): TSynSearchOptions; procedure SetFindOptions(const ASelAvail: Boolean; @@ -64,16 +61,7 @@ type public constructor Create; destructor Destroy; override; - procedure Clear; override; 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; const @@ -98,10 +86,6 @@ var implementation -const - DefaultDiffFlags = [tdfIgnoreCase,tdfIgnoreEmptyLineChanges, - tdfIgnoreLineEnds,tdfIgnoreTrailingSpaces]; - { TInputHistoriesWithSearchOpt } constructor TInputHistoriesWithSearchOpt.Create; @@ -115,53 +99,6 @@ begin inherited Destroy; 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( const ASelAvail: Boolean): TSynSearchOptions; begin