IDE: using nogui widgetset if LCL package not used by project

git-svn-id: trunk@21857 -
This commit is contained in:
mattias 2009-09-25 09:36:28 +00:00
parent 5b02eb7f37
commit e716a6b710
3 changed files with 24 additions and 10 deletions

View File

@ -648,7 +648,7 @@ type
MakeAlwaysRelative: boolean): string;
function GetCustomOptions(Parsed: TCompilerOptionsParseType = coptParsed): string;
function GetOptionsForCTDefines: string;
function GetEffectiveLCLWidgetType: string;
function GetEffectiveLCLWidgetType: string; virtual;
public
// Properties
property ParsedOpts: TParsedCompilerOptions read FParsedOpts;

View File

@ -1615,6 +1615,7 @@ end;
procedure TfrmCompilerOptions.SetupSearchPathsTab(Page: integer);
var
LCLInterface: TLCLPlatform;
s: String;
begin
// Setup the Search Paths Tab
MainNoteBook.Page[Page].Caption:= dlgSearchPaths;
@ -1731,8 +1732,8 @@ begin
with LCLWidgetTypeComboBox do begin
with Items do begin
BeginUpdate;
Add(Format(lisCOdefault,
[LCLPlatformDisplayNames[GetDefaultLCLWidgetType]]));
s:=LCLPlatformDisplayNames[GetDefaultLCLWidgetType];
Add(Format(lisCOdefault,[s]));
for LCLInterface:=Low(TLCLPlatform) to High(TLCLPlatform) do begin
Items.Add(LCLPlatformDisplayNames[LCLInterface]);
end;
@ -1740,7 +1741,6 @@ begin
end;
ItemIndex:=1;
Constraints.MinWidth:=150;
// MG: does not work in win32 intf: AutoSize:=True;
end;
end;

View File

@ -49,7 +49,7 @@ uses
MemCheck,
{$ENDIF}
Classes, SysUtils, TypInfo, FPCAdds, LCLProc, LCLIntf, LCLType, Forms,
Controls, Dialogs,
Controls, Dialogs, InterfaceBase,
Laz_XMLCfg, ExprEval, FileUtil, DefineTemplates, CodeToolManager, CodeCache,
// IDEIntf
PropEdits, ProjectIntf, MacroIntf, LazIDEIntf,
@ -57,7 +57,7 @@ uses
CompOptsModes, ProjectResources, LazConf, frmCustomApplicationOptions,
LazarusIDEStrConsts, CompilerOptions,
TransferMacros, EditorOptions, IDEProcs, RunParamsOpts, ProjectDefs,
FileReferenceList, EditDefineTree, PackageDefs;
FileReferenceList, EditDefineTree, PackageDefs, PackageSystem;
type
TUnitInfo = class;
@ -422,6 +422,7 @@ type
procedure CreateDiff(CompOpts: TBaseCompilerOptions;
Tool: TCompilerDiffTool); override;
procedure InvalidateOptions;
function GetEffectiveLCLWidgetType: string; override;
public
property OwnerProject: TProject read FOwnerProject;
property Project: TProject read FOwnerProject;
@ -792,7 +793,7 @@ type
procedure ReaddRemovedDependency(Dependency: TPkgDependency);
procedure MoveRequiredDependencyUp(Dependency: TPkgDependency);
procedure MoveRequiredDependencyDown(Dependency: TPkgDependency);
function Requires(APackage: TLazPackage): boolean;
function Requires(APackage: TLazPackage; SearchRecursively: boolean): boolean;
procedure GetAllRequiredPackages(var List: TFPList);
procedure AddPackageDependency(const PackageName: string); override;
@ -3729,10 +3730,15 @@ begin
EndUpdate;
end;
function TProject.Requires(APackage: TLazPackage): boolean;
function TProject.Requires(APackage: TLazPackage; SearchRecursively: boolean
): boolean;
begin
Result:=FindCompatibleDependencyInList(FFirstRequiredDependency,pdlRequires,
APackage)<>nil;
if SearchRecursively then
Result:=PackageGraph.FindDependencyRecursively(FFirstRequiredDependency,
APackage)<>nil
else
Result:=FindCompatibleDependencyInList(FFirstRequiredDependency,pdlRequires,
APackage)<>nil;
end;
procedure TProject.GetAllRequiredPackages(var List: TFPList);
@ -4905,6 +4911,14 @@ begin
// TODO: propagate change to all dependant projects
end;
function TProjectCompilerOptions.GetEffectiveLCLWidgetType: string;
begin
if OwnerProject.Requires(PackageGraph.LCLPackage,true) then
Result:=inherited GetEffectiveLCLWidgetType
else
Result:=LCLPlatformDirNames[lpNoGUI];
end;
procedure TProjectCompilerOptions.UpdateGlobals;
begin
FGlobals.TargetCPU:=TargetCPU;