ideintf: moved diff options back to ide

This commit is contained in:
mattias 2023-06-11 21:55:14 +02:00
parent 08e256ebbd
commit 3cff2b6dc4
3 changed files with 28 additions and 20 deletions

View File

@ -44,7 +44,7 @@ uses
LazFileCache, LazFileUtils, LazLoggerBase, LazUTF8, AvgLvlTree, Laz2_XMLCfg,
LazConfigStorage,
// IdeConfig
LazConf, RecentListProcs, IdeXmlConfigProcs,
RecentListProcs, IdeXmlConfigProcs,
// IdeIntf
ProjectIntf, IDEDialogs;
@ -162,8 +162,7 @@ type
FCleanOutputFileMask: string;
FCleanSourcesFileMask: string;
FFileDialogSettings: TFileDialogSettings;
FFilename: string;
// Find- and replace-history
FFindHistory: TStringList;
FFindInFilesSearchOptions: TLazFindInFileSearchOptions;
@ -187,6 +186,7 @@ type
procedure SetFilename(const AValue: string);
protected
FFilename: string;
procedure LoadSearchOptions(XMLConfig: TXMLConfig; const Path: string); virtual; abstract;
procedure SaveSearchOptions(XMLConfig: TXMLConfig; const Path: string); virtual; abstract;
public
@ -296,7 +296,6 @@ implementation
const
DefaultHistoryFile = 'inputhistory.xml';
InputHistoryVersion = 1;
function CompareIHIgnoreItems(Item1, Item2: Pointer): integer;
@ -508,12 +507,7 @@ begin
end;
procedure TInputHistories.SetLazarusDefaultFilename;
var
ConfFileName: string;
begin
ConfFileName:=AppendPathDelim(GetPrimaryConfigPath)+DefaultHistoryFile;
CopySecondaryConfigFile(DefaultHistoryFile);
FFilename:=ConfFilename;
end;
procedure TInputHistories.Load;

View File

@ -47,9 +47,10 @@ uses
// SynEdit
SynEdit, SynHighlighterDiff,
// IdeIntf
IDEWindowIntf, IDEHelpIntf, IDEImagesIntf, InputHistory,
IDEWindowIntf, IDEHelpIntf, IDEImagesIntf,
// IDE
LazarusIDEStrConsts, EditorOptions, DiffPatch, SourceEditor, EnvironmentOpts;
LazarusIDEStrConsts, EditorOptions, DiffPatch, SourceEditor,
InputhistoryWithSearchOpt, EnvironmentOpts;
type
@ -440,7 +441,7 @@ begin
// get recent Text 2
i:=0;
LastText2Name:=InputHistories.DiffText2;
LastText2Name:=InputHistoriesSO.DiffText2;
if LastText2Name<>'' then
i:=fAvailableFiles.IndexOfName(LastText2Name);
if i<0 then i:=0;
@ -448,7 +449,7 @@ begin
fSelectedFile2.SetIndex(i);
// set recent options
SetDiffOptions(InputHistories.DiffFlags);
SetDiffOptions(InputHistoriesSO.DiffFlags);
// and action ...
UpdateDiff;
@ -481,13 +482,13 @@ end;
procedure TDiffDlg.SaveSettings;
begin
InputHistories.DiffFlags:=GetDiffOptions;
InputHistoriesSO.DiffFlags:=GetDiffOptions;
if (fSelectedFile2<>nil) and (fSelectedFile2.fFile<>nil) then begin
InputHistories.DiffText2:=fSelectedFile2.fFile.Name;
InputHistories.DiffText2OnlySelection:=Text2OnlySelectionCheckBox.Checked;
InputHistoriesSO.DiffText2:=fSelectedFile2.fFile.Name;
InputHistoriesSO.DiffText2OnlySelection:=Text2OnlySelectionCheckBox.Checked;
end else begin
InputHistories.DiffText2:='';
InputHistories.DiffText2OnlySelection:=false;
InputHistoriesSO.DiffText2:='';
InputHistoriesSO.DiffText2OnlySelection:=false;
end;
IDEDialogLayoutList.SaveLayout(Self);
end;

View File

@ -30,11 +30,11 @@ interface
uses
// LazUtils
Laz2_XMLCfg,
Laz2_XMLCfg, LazFileUtils,
// SynEdit
SynEditTypes,
// IDE
InputHistory, DiffPatch;
LazConf, InputHistory, DiffPatch;
type
@ -65,6 +65,8 @@ type
constructor Create;
destructor Destroy; override;
procedure Clear; override;
procedure SetLazarusDefaultFilename; 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;
@ -99,6 +101,7 @@ var
implementation
const
DefaultHistoryFile = 'inputhistory.xml';
DefaultDiffFlags = [tdfIgnoreCase,tdfIgnoreEmptyLineChanges,
tdfIgnoreLineEnds,tdfIgnoreTrailingSpaces];
@ -123,6 +126,16 @@ begin
FDiffText2OnlySelection:=false;
end;
procedure TInputHistoriesWithSearchOpt.SetLazarusDefaultFilename;
var
ConfFileName: string;
begin
ConfFileName:=AppendPathDelim(GetPrimaryConfigPath)+DefaultHistoryFile;
CopySecondaryConfigFile(DefaultHistoryFile);
FFilename:=ConfFilename;
inherited SetLazarusDefaultFilename;
end;
procedure TInputHistoriesWithSearchOpt.LoadFromXMLConfig(XMLConfig: TXMLConfig;
const Path: string);
var