mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-28 03:21:44 +02:00
IDE: Refactor, move code from TProjectBuildModes to TBuildMatrixOptions.
git-svn-id: trunk@45413 -
This commit is contained in:
parent
0f98855e32
commit
c9836f4278
@ -147,6 +147,7 @@ type
|
||||
procedure AppendCustomOptions(Target, ActiveMode: string; var Options: string);
|
||||
procedure GetOutputDirectory(Target, ActiveMode: string; var OutDir: string);
|
||||
function FindOption(const ID: string): TBuildMatrixOption;
|
||||
function FindMacro(const MacroName, MacroValue: string): TBuildMatrixOption;
|
||||
end;
|
||||
|
||||
EMMMacroSyntaxException = class(Exception)
|
||||
@ -625,6 +626,25 @@ begin
|
||||
Result:=nil;
|
||||
end;
|
||||
|
||||
function TBuildMatrixOptions.FindMacro(const MacroName, MacroValue: string): TBuildMatrixOption;
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
i:=Count-1;
|
||||
while i>=0 do
|
||||
begin
|
||||
Result:=Items[i];
|
||||
if (Result.Typ=bmotIDEMacro)
|
||||
and (Result.Targets='*')
|
||||
and (Result.MacroName=MacroName)
|
||||
and (Result.Value=MacroValue)
|
||||
then
|
||||
exit;
|
||||
dec(i);
|
||||
end;
|
||||
Result:=nil;
|
||||
end;
|
||||
|
||||
{ TBuildMatrixOption }
|
||||
|
||||
procedure TBuildMatrixOption.SetMacroName(AValue: string);
|
||||
|
@ -6977,34 +6977,13 @@ end;
|
||||
|
||||
procedure TProjectBuildModes.AddMatrixMacro(const MacroName, MacroValue, ModeIdentifier: string;
|
||||
InSession: boolean);
|
||||
|
||||
function FindMacro(MatrixOptions: TBuildMatrixOptions;
|
||||
const MacroName, MacroValue: string): TBuildMatrixOption;
|
||||
var
|
||||
j: Integer;
|
||||
begin
|
||||
j:=MatrixOptions.Count-1;
|
||||
while j>=0 do
|
||||
begin
|
||||
Result:=MatrixOptions[j];
|
||||
if (Result.Typ=bmotIDEMacro)
|
||||
and (Result.Targets='*')
|
||||
and (Result.MacroName=MacroName)
|
||||
and (Result.Value=MacroValue)
|
||||
then
|
||||
exit;
|
||||
dec(j);
|
||||
end;
|
||||
Result:=nil;
|
||||
end;
|
||||
|
||||
var
|
||||
MatrixOptions: TBuildMatrixOptions;
|
||||
MatrixOption: TBuildMatrixOption;
|
||||
begin
|
||||
MatrixOption:=FindMacro(SharedMatrixOptions,MacroName,MacroValue);
|
||||
MatrixOption:=SharedMatrixOptions.FindMacro(MacroName,MacroValue);
|
||||
if MatrixOption=nil then
|
||||
MatrixOption:=FindMacro(SessionMatrixOptions,MacroName,MacroValue);
|
||||
MatrixOption:=SessionMatrixOptions.FindMacro(MacroName,MacroValue);
|
||||
if MatrixOption<>nil then begin
|
||||
// Macro already exists => enable mode for this macro
|
||||
MatrixOption.EnableMode(ModeIdentifier);
|
||||
|
Loading…
Reference in New Issue
Block a user