mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-07-05 11:48:29 +02:00
compiler options now converts line endings of custom and linker options to current line endings
git-svn-id: trunk@9757 -
This commit is contained in:
parent
12d2ead692
commit
ba506191c9
@ -1109,7 +1109,8 @@ begin
|
|||||||
StripSymbols := XMLConfigFile.GetValue(p+'Debugging/StripSymbols/Value', false);
|
StripSymbols := XMLConfigFile.GetValue(p+'Debugging/StripSymbols/Value', false);
|
||||||
ReadLinkSmart;
|
ReadLinkSmart;
|
||||||
PassLinkerOptions := XMLConfigFile.GetValue(p+'Options/PassLinkerOptions/Value', false);
|
PassLinkerOptions := XMLConfigFile.GetValue(p+'Options/PassLinkerOptions/Value', false);
|
||||||
LinkerOptions := f(XMLConfigFile.GetValue(p+'Options/LinkerOptions/Value', ''));
|
LinkerOptions := LineBreaksToSystemLineBreaks(
|
||||||
|
f(XMLConfigFile.GetValue(p+'Options/LinkerOptions/Value', '')));
|
||||||
Win32GraphicApp := XMLConfigFile.GetValue(p+'Options/Win32/GraphicApplication/Value', false);
|
Win32GraphicApp := XMLConfigFile.GetValue(p+'Options/Win32/GraphicApplication/Value', false);
|
||||||
ExecutableType := CompilationExecutableTypeNameToType(
|
ExecutableType := CompilationExecutableTypeNameToType(
|
||||||
XMLConfigFile.GetValue(p+'Options/ExecutableType/Value',''));
|
XMLConfigFile.GetValue(p+'Options/ExecutableType/Value',''));
|
||||||
@ -1147,7 +1148,7 @@ begin
|
|||||||
else
|
else
|
||||||
CustomConfigFile := XMLConfigFile.GetValue(p+'ConfigFile/CustomConfigFile/Value', false);
|
CustomConfigFile := XMLConfigFile.GetValue(p+'ConfigFile/CustomConfigFile/Value', false);
|
||||||
ConfigFilePath := f(XMLConfigFile.GetValue(p+'ConfigFile/ConfigFilePath/Value', 'extrafpc.cfg'));
|
ConfigFilePath := f(XMLConfigFile.GetValue(p+'ConfigFile/ConfigFilePath/Value', 'extrafpc.cfg'));
|
||||||
CustomOptions := XMLConfigFile.GetValue(p+'CustomOptions/Value', '');
|
CustomOptions := LineBreaksToSystemLineBreaks(XMLConfigFile.GetValue(p+'CustomOptions/Value', ''));
|
||||||
|
|
||||||
{ Compilation }
|
{ Compilation }
|
||||||
CompilerPath := f(XMLConfigFile.GetValue(p+'CompilerPath/Value','$(CompPath)'));
|
CompilerPath := f(XMLConfigFile.GetValue(p+'CompilerPath/Value','$(CompPath)'));
|
||||||
@ -1259,7 +1260,8 @@ begin
|
|||||||
XMLConfigFile.SetDeleteValue(p+'Debugging/StripSymbols/Value', StripSymbols,false);
|
XMLConfigFile.SetDeleteValue(p+'Debugging/StripSymbols/Value', StripSymbols,false);
|
||||||
XMLConfigFile.SetDeleteValue(p+'LinkSmart/Value', LinkSmart,false);
|
XMLConfigFile.SetDeleteValue(p+'LinkSmart/Value', LinkSmart,false);
|
||||||
XMLConfigFile.SetDeleteValue(p+'Options/PassLinkerOptions/Value', PassLinkerOptions,false);
|
XMLConfigFile.SetDeleteValue(p+'Options/PassLinkerOptions/Value', PassLinkerOptions,false);
|
||||||
XMLConfigFile.SetDeleteValue(p+'Options/LinkerOptions/Value', LinkerOptions,'');
|
XMLConfigFile.SetDeleteValue(p+'Options/LinkerOptions/Value',
|
||||||
|
LineBreaksToSystemLineBreaks(LinkerOptions),'');
|
||||||
XMLConfigFile.SetDeleteValue(p+'Options/Win32/GraphicApplication/Value', Win32GraphicApp,false);
|
XMLConfigFile.SetDeleteValue(p+'Options/Win32/GraphicApplication/Value', Win32GraphicApp,false);
|
||||||
XMLConfigFile.SetDeleteValue(p+'Options/ExecutableType/Value',
|
XMLConfigFile.SetDeleteValue(p+'Options/ExecutableType/Value',
|
||||||
CompilationExecutableTypeNames[ExecutableType],
|
CompilationExecutableTypeNames[ExecutableType],
|
||||||
@ -1295,7 +1297,8 @@ begin
|
|||||||
XMLConfigFile.SetDeleteValue(p+'ConfigFile/DontUseConfigFile/Value', DontUseConfigFile,false);
|
XMLConfigFile.SetDeleteValue(p+'ConfigFile/DontUseConfigFile/Value', DontUseConfigFile,false);
|
||||||
XMLConfigFile.SetDeleteValue(p+'ConfigFile/CustomConfigFile/Value', CustomConfigFile,false);
|
XMLConfigFile.SetDeleteValue(p+'ConfigFile/CustomConfigFile/Value', CustomConfigFile,false);
|
||||||
XMLConfigFile.SetDeleteValue(p+'ConfigFile/ConfigFilePath/Value', ConfigFilePath,'extrafpc.cfg');
|
XMLConfigFile.SetDeleteValue(p+'ConfigFile/ConfigFilePath/Value', ConfigFilePath,'extrafpc.cfg');
|
||||||
XMLConfigFile.SetDeleteValue(p+'CustomOptions/Value', CustomOptions,'');
|
XMLConfigFile.SetDeleteValue(p+'CustomOptions/Value',
|
||||||
|
LineBreaksToSystemLineBreaks(CustomOptions),'');
|
||||||
|
|
||||||
{ Compilation }
|
{ Compilation }
|
||||||
XMLConfigFile.SetDeleteValue(p+'CompilerPath/Value', CompilerPath,'');
|
XMLConfigFile.SetDeleteValue(p+'CompilerPath/Value', CompilerPath,'');
|
||||||
|
@ -188,6 +188,7 @@ procedure SplitString(const s: string; Delimiter: char; AddTo: TStrings;
|
|||||||
ClearList: boolean = true);
|
ClearList: boolean = true);
|
||||||
function SpecialCharsToSpaces(const s: string): string;
|
function SpecialCharsToSpaces(const s: string): string;
|
||||||
function LineBreaksToDelimiter(const s: string; Delimiter: char): string;
|
function LineBreaksToDelimiter(const s: string; Delimiter: char): string;
|
||||||
|
function LineBreaksToSystemLineBreaks(const s: string): string;
|
||||||
function StringListToText(List: TStrings; const Delimiter: string;
|
function StringListToText(List: TStrings; const Delimiter: string;
|
||||||
IgnoreEmptyLines: boolean = false): string;
|
IgnoreEmptyLines: boolean = false): string;
|
||||||
function StringListPartToText(List: TStrings; FromIndex, ToIndex: integer;
|
function StringListPartToText(List: TStrings; FromIndex, ToIndex: integer;
|
||||||
@ -1537,6 +1538,56 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function LineBreaksToSystemLineBreaks(const s: string): string;
|
||||||
|
var
|
||||||
|
e: string;
|
||||||
|
NewLength: Integer;
|
||||||
|
p, StartPos: Integer;
|
||||||
|
Src: PChar;
|
||||||
|
Dest: PChar;
|
||||||
|
EndLen: Integer;
|
||||||
|
EndPos: PChar;
|
||||||
|
begin
|
||||||
|
if s='' then begin
|
||||||
|
Result:=s;
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
e:=LineEnding;
|
||||||
|
EndLen:=length(e);
|
||||||
|
NewLength:=length(s);
|
||||||
|
p:=1;
|
||||||
|
while p<length(s) do begin
|
||||||
|
if s[p] in [#10,#13] then begin
|
||||||
|
StartPos:=p;
|
||||||
|
inc(p);
|
||||||
|
if (s[p] in [#10,#13]) and (s[p]<>s[p-1]) then inc(p);
|
||||||
|
inc(NewLength,EndLen-(p-StartPos));
|
||||||
|
end else
|
||||||
|
inc(p);
|
||||||
|
end;
|
||||||
|
SetLength(Result,NewLength);
|
||||||
|
Src:=PChar(s);
|
||||||
|
Dest:=PChar(Result);
|
||||||
|
EndPos:=Dest+NewLength;
|
||||||
|
while (Dest<EndPos) do begin
|
||||||
|
if Src^ in [#10,#13] then begin
|
||||||
|
for p:=1 to EndLen do begin
|
||||||
|
Dest^:=e[p];
|
||||||
|
inc(Dest);
|
||||||
|
end;
|
||||||
|
if (Src[1] in [#10,#13]) and (Src^<>Src[1]) then
|
||||||
|
inc(Src,2)
|
||||||
|
else
|
||||||
|
inc(Src);
|
||||||
|
end else begin
|
||||||
|
Dest^:=Src^;
|
||||||
|
inc(Src);
|
||||||
|
inc(Dest);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
//if Src-1<>@s[length(s)] then RaiseGDBException('');
|
||||||
|
end;
|
||||||
|
|
||||||
function StringListToText(List: TStrings; const Delimiter: string;
|
function StringListToText(List: TStrings; const Delimiter: string;
|
||||||
IgnoreEmptyLines: boolean): string;
|
IgnoreEmptyLines: boolean): string;
|
||||||
begin
|
begin
|
||||||
|
@ -823,10 +823,14 @@ begin
|
|||||||
// => collect all neighbour controls for a page
|
// => collect all neighbour controls for a page
|
||||||
NeighbourList:=FindPageNeighbours(Layout,NeighbourControl,AnchorControls);
|
NeighbourList:=FindPageNeighbours(Layout,NeighbourControl,AnchorControls);
|
||||||
try
|
try
|
||||||
|
NeighbourControl.Parent.DisableAlign;
|
||||||
if AnchorControls[akLeft]=nil then ;
|
if AnchorControls[akLeft]=nil then ;
|
||||||
// TODO
|
// TODO: create a PageControl and two pages. And move the neigbbours onto
|
||||||
|
// one page and Control to the other page.
|
||||||
|
|
||||||
finally
|
finally
|
||||||
NeighbourList.Free;
|
NeighbourList.Free;
|
||||||
|
NeighbourControl.Parent.EnableAlign;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -1157,14 +1161,100 @@ end;
|
|||||||
|
|
||||||
function TCustomLazControlDocker.FindPageNeighbours(Layout: TLazDockConfigNode;
|
function TCustomLazControlDocker.FindPageNeighbours(Layout: TLazDockConfigNode;
|
||||||
StartControl: TControl; out AnchorControls: TAnchorControls): TFPList;
|
StartControl: TControl; out AnchorControls: TAnchorControls): TFPList;
|
||||||
|
{ Creates a list of TControl, containing StartControl and neighbours,
|
||||||
|
which are on the same page according to Layout and are a rectangular area.
|
||||||
|
AnchorControls are the four boundaries of the rectangular area and the list
|
||||||
|
contains all controls within these boundaries (and with the same Parent as
|
||||||
|
StartControl).
|
||||||
|
}
|
||||||
|
var
|
||||||
|
ControlList: TFPList;
|
||||||
|
PageNode: TLazDockConfigNode;
|
||||||
|
|
||||||
|
function AddNeighbour(AControl: TControl): boolean;
|
||||||
|
var
|
||||||
|
i: Integer;
|
||||||
|
Sibling: TControl;
|
||||||
|
a: TAnchorKind;
|
||||||
|
NodeName: String;
|
||||||
|
Node: TLazDockConfigNode;
|
||||||
|
OldAnchorControls: TAnchorControls;
|
||||||
|
begin
|
||||||
|
Result:=false;
|
||||||
|
if (AControl=nil) or (AControl.Parent<>StartControl.Parent) then exit;
|
||||||
|
if ControlList.IndexOf(AControl)>=0 then begin
|
||||||
|
// already added
|
||||||
|
exit(true);
|
||||||
|
end;
|
||||||
|
NodeName:=Manager.GetControlConfigName(AControl);
|
||||||
|
Node:=Layout.FindByName(NodeName);
|
||||||
|
if (Node=nil) or (Node.Parent<>PageNode) then begin
|
||||||
|
// this control does not belong to this page
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
|
||||||
|
// add AControl to the list of neighbours
|
||||||
|
ControlList.Add(AControl);
|
||||||
|
// fix AnchorControls, so
|
||||||
|
for a:=Low(TAnchorKind) to High(TAnchorKind) do begin
|
||||||
|
OldAnchorControls[a]:=nil;
|
||||||
|
Sibling:=AControl.AnchorSide[a].Control;
|
||||||
|
if (Sibling<>nil)
|
||||||
|
and ((AnchorControls[a]=AControl)
|
||||||
|
or (AnchorControls[a]=AControl.AnchorSide[OppositeAnchor[a]].Control))
|
||||||
|
then begin
|
||||||
|
OldAnchorControls[a]:=AnchorControls[a];
|
||||||
|
AnchorControls[a]:=Sibling;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
try
|
||||||
|
// add all controls anchored to this control
|
||||||
|
for i:=0 to StartControl.Parent.ControlCount-1 do begin
|
||||||
|
Sibling:=StartControl.Parent.Controls[i];
|
||||||
|
for a:=Low(TAnchorKind) to High(TAnchorKind) do begin
|
||||||
|
if Sibling.AnchorSide[a].Control=AControl then
|
||||||
|
if not AddNeighbour(Sibling) then exit;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
Result:=true;
|
||||||
|
finally
|
||||||
|
if not Result then begin
|
||||||
|
// remove AControl from list and restore AnchorControls
|
||||||
|
ControlList.Remove(AControl);
|
||||||
|
for a:=Low(TAnchorKind) to High(TAnchorKind) do begin
|
||||||
|
if OldAnchorControls[a]<>nil then
|
||||||
|
AnchorControls[a]:=OldAnchorControls[a];
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
var
|
var
|
||||||
a: TAnchorKind;
|
a: TAnchorKind;
|
||||||
|
Added: Boolean;
|
||||||
|
NodeName: String;
|
||||||
|
StartNode: TLazDockConfigNode;
|
||||||
begin
|
begin
|
||||||
Result:=TFPList.Create;
|
ControlList:=TFPList.Create;
|
||||||
Result.Add(StartControl);
|
ControlList.Add(StartControl);
|
||||||
for a:=Low(TAnchorKind) to High(TAnchorKind) do
|
for a:=Low(TAnchorKind) to High(TAnchorKind) do
|
||||||
AnchorControls[a]:=StartControl.AnchorSide[a].Control;
|
AnchorControls[a]:=StartControl.AnchorSide[a].Control;
|
||||||
// TODO: extend
|
|
||||||
|
NodeName:=Manager.GetControlConfigName(StartControl);
|
||||||
|
if NodeName='' then exit;
|
||||||
|
StartNode:=Layout.FindByName(NodeName);
|
||||||
|
if StartNode=nil then exit;
|
||||||
|
PageNode:=StartNode.Parent;
|
||||||
|
if PageNode=nil then exit;
|
||||||
|
repeat
|
||||||
|
Added:=false;
|
||||||
|
for a:=Low(TAnchorKind) to High(TAnchorKind) do begin
|
||||||
|
if AddNeighbour(AnchorControls[a]) then
|
||||||
|
Added:=true;
|
||||||
|
end;
|
||||||
|
until not Added;
|
||||||
|
Result:=ControlList;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TCustomLazControlDocker.GetControlName(AControl: TControl): string;
|
function TCustomLazControlDocker.GetControlName(AControl: TControl): string;
|
||||||
|
Loading…
Reference in New Issue
Block a user