mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-03 08:41:44 +02:00
Merge r52530 #e31a4d74d3 manually. IDE: Make CompilerMode selection more robust.
git-svn-id: branches/fixes_1_6@52619 -
This commit is contained in:
parent
40ac8cb06f
commit
4df3b960a7
@ -31,37 +31,48 @@ implementation
|
|||||||
|
|
||||||
{$R *.lfm}
|
{$R *.lfm}
|
||||||
|
|
||||||
function SyntaxModeToCaption(const Mode: string): string;
|
const
|
||||||
|
// CompilerMode names to be shown after -M...
|
||||||
|
CompilerModesPretty: array[TCompilerMode] of shortstring = (
|
||||||
|
'fpc', 'Delphi', 'DelphiUnicode', 'gpc', 'tp', 'ObjFPC', 'MacPas', 'iso'
|
||||||
|
);
|
||||||
|
// CompilerMode descriptions.
|
||||||
|
CompilerModesDescr: array[TCompilerMode] of shortstring = (
|
||||||
|
'Free Pascal', 'Delphi', 'Delphi Unicode', 'GNU Pascal', 'Turbo Pascal',
|
||||||
|
'Object Pascal', 'Mac Pascal', 'ISO/IEC 7185 Pascal'
|
||||||
|
);
|
||||||
|
|
||||||
|
function SyntaxModeToCaption(const ModeStr: string): string;
|
||||||
|
var
|
||||||
|
cm: TCompilerMode;
|
||||||
begin
|
begin
|
||||||
if CompareText(Mode, 'ObjFPC') = 0 then
|
Result := '';
|
||||||
Result := lisObjectPascalDefault + ' (-Mobjfpc)'
|
for cm := Low(TCompilerMode) to High(TCompilerMode) do
|
||||||
else if CompareText(Mode, 'Delphi') = 0 then
|
if CompareText(ModeStr, CompilerModeNames[cm]) = 0 then
|
||||||
Result := lisDelphi + ' (-Mdelphi)'
|
begin
|
||||||
else if CompareText(Mode, 'tp') = 0 then
|
if cm = cmOBJFPC then
|
||||||
Result := lisTurboPascal + ' (-Mtp)'
|
Result := lisObjectPascalDefault // Is this needed?
|
||||||
else if CompareText(Mode, 'fpc') = 0 then
|
else
|
||||||
Result := lisFreePascal + ' (-Mfpc)'
|
Result := CompilerModesDescr[cm];
|
||||||
else if CompareText(Mode, 'macpas') = 0 then
|
Result := Result + ' (-M' + CompilerModesPretty[cm] + ')';
|
||||||
Result := lisMacPascal + ' (-Mmacpas)'
|
Break;
|
||||||
else
|
end;
|
||||||
Result := '';
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function CaptionToSyntaxMode(const Caption: string): string;
|
function CaptionToSyntaxMode(const Caption: string): string;
|
||||||
|
var
|
||||||
|
cm: TCompilerMode;
|
||||||
begin
|
begin
|
||||||
if Pos('-Mdelphi', Caption) > 0 then
|
Result := 'ObjFPC';
|
||||||
Result := 'Delphi'
|
// Some modes would go wrong if iterated forward, thus iterate backwards.
|
||||||
else if Pos('-Mtp', Caption) > 0 then
|
for cm := High(TCompilerMode) downto Low(TCompilerMode) do
|
||||||
Result := 'tp'
|
if Pos('-M' + CompilerModesPretty[cm], Caption) > 0 then
|
||||||
else if Pos('-Mmacpas', Caption) > 0 then
|
begin
|
||||||
Result := 'macpas'
|
Result := CompilerModesPretty[cm];
|
||||||
else if Pos('-Mfpc', Caption) > 0 then
|
Break;
|
||||||
Result := 'fpc'
|
end;
|
||||||
else
|
|
||||||
Result := 'ObjFPC';
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
{ TCompilerParsingOptionsFrame }
|
{ TCompilerParsingOptionsFrame }
|
||||||
|
|
||||||
function TCompilerParsingOptionsFrame.GetTitle: string;
|
function TCompilerParsingOptionsFrame.GetTitle: string;
|
||||||
|
Loading…
Reference in New Issue
Block a user