mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-10 17:08:04 +02:00
IDE: compilier options: trim leading/trailing spaces from custom options to reduce modified
git-svn-id: trunk@27804 -
This commit is contained in:
parent
2a26e6b67f
commit
b342522087
@ -661,6 +661,7 @@ type
|
||||
function ShortenPath(const SearchPath: string;
|
||||
MakeAlwaysRelative: boolean): string;
|
||||
function GetCustomOptions(Parsed: TCompilerOptionsParseType): string;
|
||||
function TrimCustomOptions(o: string): string; override;
|
||||
function GetOptionsForCTDefines: string;
|
||||
function GetEffectiveLCLWidgetType: string; virtual;
|
||||
|
||||
@ -1326,9 +1327,13 @@ begin
|
||||
end;
|
||||
|
||||
procedure TBaseCompilerOptions.SetCustomOptions(const AValue: string);
|
||||
var
|
||||
NewValue: String;
|
||||
begin
|
||||
if CustomOptions=AValue then exit;
|
||||
ParsedOpts.SetUnparsedValue(pcosCustomOptions,AValue);
|
||||
// Keep line breaks for formatting in options dialog
|
||||
NewValue:=Trim(AValue);
|
||||
if CustomOptions=NewValue then exit;
|
||||
ParsedOpts.SetUnparsedValue(pcosCustomOptions,NewValue);
|
||||
IncreaseChangeStamp;
|
||||
end;
|
||||
|
||||
@ -2201,6 +2206,15 @@ begin
|
||||
Result:=SpecialCharsToSpaces(Result,true);
|
||||
end;
|
||||
|
||||
function TBaseCompilerOptions.TrimCustomOptions(o: string): string;
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
Result:=Trim(o);
|
||||
for i:=length(Result) downto 1 do
|
||||
if Result[i] in [#0..#31,#127] then System.Delete(Result,i,1);
|
||||
end;
|
||||
|
||||
function TBaseCompilerOptions.GetOptionsForCTDefines: string;
|
||||
|
||||
procedure Add(s: string);
|
||||
@ -3319,6 +3333,7 @@ begin
|
||||
if Done(ExecuteBefore.CreateDiff(CompOpts.ExecuteBefore,Tool)) then exit;
|
||||
if Done(ExecuteAfter.CreateDiff(CompOpts.ExecuteAfter,Tool)) then exit;
|
||||
if Done(Tool.AddDiff('CreateMakefileOnBuild',fCreateMakefileOnBuild,CompOpts.fCreateMakefileOnBuild)) then exit;
|
||||
if Result then debugln(['TBaseCompilerOptions.CreateDiff END']);
|
||||
end;
|
||||
|
||||
|
||||
@ -4136,7 +4151,8 @@ var
|
||||
i: Integer;
|
||||
OtherMacro: TLazBuildMacro;
|
||||
begin
|
||||
if (Tool=nil) and (Count<>OtherProperties.Count) then exit(true);
|
||||
Result:=Tool.AddDiff('BuildMacros/Count',Count,OtherProperties.Count);
|
||||
if (Tool=nil) and Result then exit;
|
||||
for i:=0 to OtherProperties.Count-1 do begin
|
||||
OtherMacro:=OtherProperties.Items[i];
|
||||
if i>=Count then
|
||||
|
@ -908,6 +908,7 @@ var
|
||||
NewConfigFilePath: String;
|
||||
AdditionalConfig: String;
|
||||
OldPath: String;
|
||||
//Diff: TStringList;
|
||||
begin
|
||||
Result:=false;
|
||||
|
||||
@ -1142,12 +1143,14 @@ begin
|
||||
end;
|
||||
|
||||
// check for change and mark as modified
|
||||
//debugln(['TfrmCompilerOptions.SaveFormToOptions "',OldCompOpts.CustomOptions,'" "',Options.CustomOptions,'"']);
|
||||
if not OldCompOpts.IsEqual(Options) then begin
|
||||
//Diff:=TStringList.Create;
|
||||
//options.CreateDiff(OldCompOpts,Diff);
|
||||
//debugln(Diff.Text);
|
||||
//Options.CreateDiffAsText(OldCompOpts,Diff);
|
||||
//debugln('DIFF:',Diff.Text);
|
||||
//Diff.Free;
|
||||
Options.Modified:=true;
|
||||
//debugln(['TfrmCompilerOptions.SaveFormToOptions AAA1 ',Options.Modified,' ',dbgs(Options.ChangeStamp),' ',Options.ChangeStamp=Options.InvalidChangeStamp]);
|
||||
IncreaseCompilerParseStamp;
|
||||
end;
|
||||
Result:=true;
|
||||
@ -1157,6 +1160,7 @@ begin
|
||||
Options.Modified:=OldCompOpts.Modified;
|
||||
end;
|
||||
end;
|
||||
//debugln(['TfrmCompilerOptions.SaveFormToOptions ',Options.Modified]);
|
||||
end;
|
||||
|
||||
function TfrmCompilerOptions.SaveFormToOptions(
|
||||
|
@ -299,6 +299,7 @@ type
|
||||
constructor Create(const TheOwner: TObject); virtual;
|
||||
destructor Destroy; override;
|
||||
function IsActive: boolean; virtual;
|
||||
function TrimCustomOptions(o: string): string; virtual; abstract;
|
||||
public
|
||||
property Owner: TObject read fOwner write fOwner;
|
||||
property Modified: boolean read GetModified write SetModified;
|
||||
@ -1816,7 +1817,7 @@ end;
|
||||
function TLazCompilerOptions.GetModified: boolean;
|
||||
begin
|
||||
Result:=(FSavedChangeStamp=InvalidChangeStamp)
|
||||
or (FSavedChangeStamp=FChangeStamp);
|
||||
or (FSavedChangeStamp<>FChangeStamp);
|
||||
end;
|
||||
|
||||
constructor TLazCompilerOptions.Create(const TheOwner: TObject);
|
||||
|
@ -363,7 +363,6 @@ type
|
||||
FSkipCompiler: Boolean;
|
||||
protected
|
||||
procedure SetLazPackage(const AValue: TLazPackage);
|
||||
procedure SetModified(const NewValue: boolean); override;
|
||||
procedure SetCustomOptions(const AValue: string); override;
|
||||
procedure SetIncludePaths(const AValue: string); override;
|
||||
procedure SetLibraryPaths(const AValue: string); override;
|
||||
@ -2180,7 +2179,7 @@ end;
|
||||
|
||||
function TLazPackage.GetModified: boolean;
|
||||
begin
|
||||
Result:=lpfModified in FFlags;
|
||||
Result:=(lpfModified in FFlags) or CompilerOptions.Modified;
|
||||
end;
|
||||
|
||||
procedure TLazPackage.SetAddToProjectUsesSection(const AValue: boolean);
|
||||
@ -2376,7 +2375,10 @@ begin
|
||||
Exclude(FFlags,lpfModified);
|
||||
Exclude(FFlags,lpfSkipSaving);
|
||||
if not AValue then
|
||||
begin
|
||||
PublishOptions.Modified:=false;
|
||||
CompilerOptions.Modified:=false;
|
||||
end;
|
||||
if (OldModified<>Modified) and (Editor<>nil) then
|
||||
Editor.UpdateAll(false);
|
||||
end;
|
||||
@ -3634,12 +3636,6 @@ begin
|
||||
FLazPackage:=AValue;
|
||||
end;
|
||||
|
||||
procedure TPkgCompilerOptions.SetModified(const NewValue: boolean);
|
||||
begin
|
||||
inherited SetModified(NewValue);
|
||||
if Modified and (LazPackage<>nil) then LazPackage.Modified:=true;
|
||||
end;
|
||||
|
||||
procedure TPkgCompilerOptions.SetCustomOptions(const AValue: string);
|
||||
begin
|
||||
if CustomOptions=AValue then exit;
|
||||
|
Loading…
Reference in New Issue
Block a user