IDE: Add examples to the list of recent projects if it is empty and the examples have write access. Issue #14506

git-svn-id: trunk@31962 -
This commit is contained in:
juha 2011-08-12 13:19:14 +00:00
parent ff7e117d2f
commit 02803ca4af

View File

@ -322,8 +322,7 @@ type
FNewFormTemplate: string;
FNewUnitTemplate: string;
function GetDebuggerEventLogColors(AIndex: TDBGEventType
): TDebuggerEventLogColor;
function GetDebuggerEventLogColors(AIndex: TDBGEventType): TDebuggerEventLogColor;
procedure SetCompilerFilename(const AValue: string);
procedure SetDebuggerEventLogColors(AIndex: TDBGEventType;
const AValue: TDebuggerEventLogColor);
@ -921,6 +920,17 @@ var
XMLConfig: TXMLConfig;
FileVersion: integer;
procedure AddRecentProjectInitial(aProjPath, aProjFile: string);
var
WholeFilePath: String;
begin
aProjPath:=SwitchPathDelims(aProjPath, True);
aProjFile:=SwitchPathDelims(aProjFile, True);
WholeFilePath:=ExtractFilePath(Application.ExeName) + aProjPath + aProjFile;
if FileIsWritable(aProjPath) and FileIsWritable(WholeFilePath) then
AddToRecentList(WholeFilePath, FRecentProjectFiles, FMaxRecentProjectFiles);
end;
procedure LoadBackupInfo(var BackupInfo: TBackupInfo; const Path:string);
var i:integer;
begin
@ -982,10 +992,8 @@ begin
Cfg:=TXMLOptionsStorage.Create(XMLConfig);
try
Path:='EnvironmentOptions/';
FileVersion:=XMLConfig.GetValue(Path+'Version/Value',0);
// language
LoadLanguage;
@ -1219,6 +1227,15 @@ begin
LoadRecentList(XMLConfig,FRecentPackageFiles,
Path+'Recent/PackageFiles/');
// Add example projects to an empty project list if examples have write access
if FRecentProjectFiles.count=0 then begin
AddRecentProjectInitial('examples/jpeg/', 'jpegexample.lpi');
AddRecentProjectInitial('examples/sprites/', 'spriteexample.lpi');
AddRecentProjectInitial('examples/openglcontrol/', 'openglcontrol_demo.lpi');
AddRecentProjectInitial('examples/barchart/', 'chartdemo.lpi');
AddRecentProjectInitial('examples/', 'hello.lpi');
end;
// external tools
fExternalTools.Load(FConfigStore,Path+'ExternalTools/');