IDE: show skipped designtime only packages

git-svn-id: trunk@32137 -
This commit is contained in:
mattias 2011-08-31 21:50:56 +00:00
parent d5ad4ab713
commit c72bad92c1
2 changed files with 93 additions and 61 deletions

View File

@ -36,10 +36,10 @@ unit compiler_inherited_options;
interface interface
uses uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, Classes, SysUtils, LCLProc, FileUtil, Forms, Controls, Graphics, Dialogs,
StdCtrls, ComCtrls, ExtCtrls, StdCtrls, ComCtrls, ExtCtrls,
CodeToolsCfgScript, IDEOptionsIntf, IDEImagesIntf, ProjectIntf, CompOptsIntf, CodeToolsCfgScript, IDEOptionsIntf, IDEImagesIntf, ProjectIntf, CompOptsIntf,
Project, CompilerOptions, LazarusIDEStrConsts, IDEProcs; Project, PackageDefs, CompilerOptions, LazarusIDEStrConsts, IDEProcs;
type type
@ -150,82 +150,113 @@ var
ChildNode.SelectedIndex := ChildNode.ImageIndex; ChildNode.SelectedIndex := ChildNode.ImageIndex;
end; end;
var
SkippedPkgList: TFPList;
AProject: TProject;
Pkg: TLazPackage;
begin begin
OptionsList := nil; OptionsList := nil;
//debugln(['TCompilerInheritedOptionsFrame.UpdateInheritedTree START CompilerOpts=',DbgSName(CompilerOpts)]);
CompilerOpts.GetInheritedCompilerOptions(OptionsList); CompilerOpts.GetInheritedCompilerOptions(OptionsList);
InhTreeView.BeginUpdate; SkippedPkgList:=nil;
ClearInheritedTree; try
if OptionsList <> nil then if CompilerOpts is TProjectCompilerOptions then begin
begin AProject:=TProjectCompilerOptions(CompilerOpts).LazProject;
Vars:=GetBuildMacroValues(CompilerOpts,false); AProject.GetAllRequiredPackages(SkippedPkgList);
// add All node if (SkippedPkgList<>nil)
AncestorNode := InhTreeView.Items.Add(nil, lisAllInheritedOptions); and (not (pfUseDesignTimePackages in AProject.Flags)) then begin
AncestorNode.ImageIndex := ImageIndexInherited; // keep design time only packages
AncestorNode.SelectedIndex := AncestorNode.ImageIndex; for i:=SkippedPkgList.Count-1 downto 0 do
with CompilerOpts do if TLazPackage(SkippedPkgList[i]).PackageType<>lptDesignTime then
begin SkippedPkgList.Delete(i);
AddChildNode(lisunitPath, end;
GetInheritedOption(icoUnitPath, True), icoUnitPath);
AddChildNode(lisincludePath,
GetInheritedOption(icoIncludePath, True), icoIncludePath);
AddChildNode(lisobjectPath,
GetInheritedOption(icoObjectPath, True), icoObjectPath);
AddChildNode(lislibraryPath,
GetInheritedOption(icoLibraryPath, True), icoLibraryPath);
AddChildNode(lislinkerOptions, GetInheritedOption(icoLinkerOptions, True),
icoLinkerOptions);
AddChildNode(liscustomOptions, GetInheritedOption(icoCustomOptions, True),
icoCustomOptions);
end; end;
AncestorNode.Expanded := True; //debugln(['TCompilerInheritedOptionsFrame.UpdateInheritedTree END']);
// add detail nodes InhTreeView.BeginUpdate;
for i := 0 to OptionsList.Count - 1 do ClearInheritedTree;
if OptionsList <> nil then
begin begin
AncestorOptions := TAdditionalCompilerOptions(OptionsList[i]); Vars:=GetBuildMacroValues(CompilerOpts,false);
AncestorNode := InhTreeView.Items.Add(nil, ''); // add All node
AncestorNode.Text := AncestorOptions.GetOwnerName; AncestorNode := InhTreeView.Items.Add(nil, lisAllInheritedOptions);
AncestorNode.ImageIndex := ImageIndexPackage; AncestorNode.ImageIndex := ImageIndexInherited;
AncestorNode.SelectedIndex := AncestorNode.ImageIndex; AncestorNode.SelectedIndex := AncestorNode.ImageIndex;
AncestorBaseOpts:=AncestorOptions.GetBaseCompilerOptions; with CompilerOpts do
with AncestorOptions.ParsedOpts do
begin begin
AddChildNode(lisunitPath, AddChildNode(lisunitPath,
CreateRelativeSearchPath(GetParsedValue(pcosUnitPath), GetInheritedOption(icoUnitPath, True), icoUnitPath);
CompilerOpts.BaseDirectory),
icoUnitPath);
AddChildNode(lisincludePath, AddChildNode(lisincludePath,
CreateRelativeSearchPath(GetParsedValue(pcosIncludePath), GetInheritedOption(icoIncludePath, True), icoIncludePath);
CompilerOpts.BaseDirectory),
icoIncludePath);
AddChildNode(lisobjectPath, AddChildNode(lisobjectPath,
CreateRelativeSearchPath(GetParsedValue(pcosObjectPath), GetInheritedOption(icoObjectPath, True), icoObjectPath);
CompilerOpts.BaseDirectory),
icoObjectPath);
AddChildNode(lislibraryPath, AddChildNode(lislibraryPath,
CreateRelativeSearchPath(GetParsedValue(pcosLibraryPath), GetInheritedOption(icoLibraryPath, True), icoLibraryPath);
CompilerOpts.BaseDirectory), AddChildNode(lislinkerOptions, GetInheritedOption(icoLinkerOptions, True),
icoLibraryPath);
AddChildNode(lislinkerOptions, GetParsedValue(pcosLinkerOptions),
icoLinkerOptions); icoLinkerOptions);
AddChildNode(liscustomOptions, GetParsedValue(pcosCustomOptions), AddChildNode(liscustomOptions, GetInheritedOption(icoCustomOptions, True),
icoCustomOptions); icoCustomOptions);
end; end;
if (AncestorBaseOpts<>nil) and (Vars<>nil) then begin
for j:=0 to AncestorBaseOpts.BuildMacros.Count-1 do
begin
Macro:=AncestorBaseOpts.BuildMacros[j];
AddChildNode(Macro.Identifier,Vars.Values[Macro.Identifier],icoNone);
end;
end;
AncestorNode.Expanded := True; AncestorNode.Expanded := True;
// add detail nodes
for i := 0 to OptionsList.Count - 1 do
begin
AncestorOptions := TAdditionalCompilerOptions(OptionsList[i]);
AncestorNode := InhTreeView.Items.Add(nil, '');
AncestorNode.Text := AncestorOptions.GetOwnerName;
AncestorNode.ImageIndex := ImageIndexPackage;
AncestorNode.SelectedIndex := AncestorNode.ImageIndex;
AncestorBaseOpts:=AncestorOptions.GetBaseCompilerOptions;
with AncestorOptions.ParsedOpts do
begin
AddChildNode(lisunitPath,
CreateRelativeSearchPath(GetParsedValue(pcosUnitPath),
CompilerOpts.BaseDirectory),
icoUnitPath);
AddChildNode(lisincludePath,
CreateRelativeSearchPath(GetParsedValue(pcosIncludePath),
CompilerOpts.BaseDirectory),
icoIncludePath);
AddChildNode(lisobjectPath,
CreateRelativeSearchPath(GetParsedValue(pcosObjectPath),
CompilerOpts.BaseDirectory),
icoObjectPath);
AddChildNode(lislibraryPath,
CreateRelativeSearchPath(GetParsedValue(pcosLibraryPath),
CompilerOpts.BaseDirectory),
icoLibraryPath);
AddChildNode(lislinkerOptions, GetParsedValue(pcosLinkerOptions),
icoLinkerOptions);
AddChildNode(liscustomOptions, GetParsedValue(pcosCustomOptions),
icoCustomOptions);
end;
if (AncestorBaseOpts<>nil) and (Vars<>nil) then begin
for j:=0 to AncestorBaseOpts.BuildMacros.Count-1 do
begin
Macro:=AncestorBaseOpts.BuildMacros[j];
AddChildNode(Macro.Identifier,Vars.Values[Macro.Identifier],icoNone);
end;
end;
AncestorNode.Expanded := True;
end;
OptionsList.Free;
end
else
begin
InhTreeView.Items.Add(nil, lisNoCompilerOptionsInherited);
end; end;
OptionsList.Free; if SkippedPkgList<>nil then begin
end for i:=0 to SkippedPkgList.Count-1 do begin
else Pkg:=TLazPackage(SkippedPkgList[i]);
begin AncestorNode := InhTreeView.Items.Add(nil, '');
InhTreeView.Items.Add(nil, lisNoCompilerOptionsInherited); AncestorNode.Text := Format(lisExcludedAtRunTime, [Pkg.Name]);
AncestorNode.ImageIndex := ImageIndexPackage;
AncestorNode.SelectedIndex := AncestorNode.ImageIndex;
end;
end;
InhTreeView.EndUpdate;
finally
SkippedPkgList.Free;
end; end;
InhTreeView.EndUpdate;
end; end;
destructor TCompilerInheritedOptionsFrame.Destroy; destructor TCompilerInheritedOptionsFrame.Destroy;

View File

@ -1773,6 +1773,7 @@ resourcestring
dlgCOOpts = 'Options: '; dlgCOOpts = 'Options: ';
dlgCOAsmStyle = 'Assembler style:'; dlgCOAsmStyle = 'Assembler style:';
lisNoCompilerOptionsInherited = 'No compiler options inherited.'; lisNoCompilerOptionsInherited = 'No compiler options inherited.';
lisExcludedAtRunTime = '%s excluded at run time';
lisAllInheritedOptions = 'All inherited options'; lisAllInheritedOptions = 'All inherited options';
lisunitPath = 'unit path'; lisunitPath = 'unit path';
lisincludePath = 'include path'; lisincludePath = 'include path';