mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-17 17:59:16 +02:00
implemented default package for custom IDE components
git-svn-id: trunk@4088 -
This commit is contained in:
parent
70019f98d4
commit
885a22cec5
@ -47,6 +47,8 @@ unit DefineTemplates;
|
||||
|
||||
{$ifdef FPC} {$mode objfpc} {$endif}{$H+}
|
||||
|
||||
{ $Define VerboseDefineCache}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
@ -1236,6 +1238,9 @@ end;
|
||||
procedure TDefineTree.ClearCache;
|
||||
begin
|
||||
if (FCache.Count=0) and (FVirtualDirCache=nil) then exit;
|
||||
{$IFDEF VerboseDefineCache}
|
||||
writeln('TDefineTree.ClearCache A +++++++++');
|
||||
{$ENDIF}
|
||||
FCache.FreeAndClear;
|
||||
FVirtualDirCache.Free;
|
||||
FVirtualDirCache:=nil;
|
||||
@ -1450,7 +1455,7 @@ var ExpPath: string;
|
||||
begin
|
||||
//writeln('[TDefineTree.GetDefinesForDirectory] "',Path,'"');
|
||||
if (Path<>'') or (not WithVirtualDir) then begin
|
||||
ExpPath:=Path;
|
||||
ExpPath:=TrimFilename(Path);
|
||||
if (ExpPath<>'') and (ExpPath[length(ExpPath)]<>PathDelim) then
|
||||
ExpPath:=ExpPath+PathDelim;
|
||||
DirDef:=FindDirectoryInCache(ExpPath);
|
||||
@ -1664,12 +1669,14 @@ var
|
||||
MacroFuncName: String;
|
||||
NewMacroLen: Integer;
|
||||
MacroParam: string;
|
||||
OldMacroLen: Integer;
|
||||
begin
|
||||
Result:=false;
|
||||
MacroFuncNameEnd:=MacroEnd;
|
||||
MacroFuncNameLen:=MacroFuncNameEnd-MacroStart-1;
|
||||
MacroEnd:=SearchBracketClose(CurValue,MacroFuncNameEnd)+1;
|
||||
if MacroEnd>ValueLen+1 then exit;
|
||||
OldMacroLen:=MacroEnd-MacroStart;
|
||||
// Macro found
|
||||
if MacroFuncNameLen>0 then begin
|
||||
MacroFuncName:=copy(CurValue,MacroStart+1,MacroFuncNameLen);
|
||||
@ -1698,7 +1705,7 @@ var
|
||||
//writeln('**** NewValue MacroStr=',MacroStr);
|
||||
end;
|
||||
NewMacroLen:=length(MacroStr);
|
||||
GrowBuffer(BufferPos+NewMacroLen+ValueLen-MacroStart+1);
|
||||
GrowBuffer(BufferPos+NewMacroLen-OldMacroLen+ValueLen-ValuePos+1);
|
||||
// copy text between this macro and last macro
|
||||
CopyFromValueToBuffer(MacroStart-ValuePos);
|
||||
// copy macro value to buffer
|
||||
@ -1721,7 +1728,8 @@ var
|
||||
end;
|
||||
// copy the buffer into NewValue
|
||||
SetLength(NewValue,BufferPos);
|
||||
Move(Buffer^,NewValue[1],BufferPos);
|
||||
if BufferPos>0 then
|
||||
Move(Buffer^,NewValue[1],BufferPos);
|
||||
// clean up
|
||||
FreeMem(Buffer);
|
||||
Buffer:=nil;
|
||||
@ -1869,7 +1877,9 @@ var
|
||||
|
||||
// function TDefineTree.Calculate(DirDef: TDirectoryDefines): boolean;
|
||||
begin
|
||||
//writeln('[TDefineTree.Calculate] "',DirDef.Path,'"');
|
||||
{$IFDEF VerboseDefineCache}
|
||||
writeln('[TDefineTree.Calculate] ++++++ "',DirDef.Path,'"');
|
||||
{$ENDIF}
|
||||
Result:=true;
|
||||
FErrorTemplate:=nil;
|
||||
ExpandedDirectory:=DirDef.Path;
|
||||
@ -3069,8 +3079,8 @@ begin
|
||||
SubDirTempl.AddChild(TDefineTemplate.Create('lazarus standard components',
|
||||
Format(ctsAddsDirToSourcePath,['synedit']),
|
||||
ExternalMacroStart+'SrcPath',
|
||||
'..'+ds+'synedit'
|
||||
+';'+SrcPath
|
||||
'..'+ds+'synedit;'
|
||||
+SrcPath
|
||||
,da_DefineRecurse));
|
||||
DirTempl.AddChild(SubDirTempl);
|
||||
|
||||
|
@ -66,6 +66,9 @@ function FileIsReadable(const AFilename: string): boolean;
|
||||
function FileIsWritable(const AFilename: string): boolean;
|
||||
function FileIsText(const AFilename: string): boolean;
|
||||
function TrimFilename(const AFilename: string): string;
|
||||
function CleanAndExpandFilename(const Filename: string): string;
|
||||
function CleanAndExpandDirectory(const Filename: string): string;
|
||||
function FileIsInPath(const Filename, Path: string): boolean;
|
||||
function AppendPathDelim(const Path: string): string;
|
||||
function ChompPathDelim(const Path: string): string;
|
||||
function SearchFileInPath(const Filename, BasePath, SearchPath,
|
||||
@ -252,20 +255,60 @@ end;
|
||||
function TrimFilename(const AFilename: string): string;
|
||||
// trim double path delims, heading and trailing spaces
|
||||
// and special dirs . and ..
|
||||
|
||||
function FilenameIsTrimmed(const TheFilename: string): boolean;
|
||||
var
|
||||
l: Integer;
|
||||
i: Integer;
|
||||
begin
|
||||
Result:=false;
|
||||
if TheFilename='' then begin
|
||||
Result:=true;
|
||||
exit;
|
||||
end;
|
||||
l:=length(TheFilename);
|
||||
// check heading spaces
|
||||
if TheFilename[1]=' ' then exit;
|
||||
// check trailing spaces
|
||||
if TheFilename[l]=' ' then exit;
|
||||
i:=1;
|
||||
while i<=l do begin
|
||||
case TheFilename[i] of
|
||||
|
||||
PathDelim:
|
||||
// check for double path delimiter
|
||||
if (i<l) and (TheFilename[i+1]=PathDelim) then exit;
|
||||
|
||||
'.':
|
||||
if (i=1) or (TheFilename[i-1]=PathDelim) then begin
|
||||
// check for . and .. directories
|
||||
if (i=l) or (TheFilename[i+1]=PathDelim) then exit;
|
||||
if (TheFilename[i+1]='.')
|
||||
and ((i=l-1) or (TheFilename[i+2]=PathDelim)) then exit;
|
||||
end;
|
||||
|
||||
end;
|
||||
inc(i);
|
||||
end;
|
||||
Result:=true;
|
||||
end;
|
||||
|
||||
var SrcPos, DestPos, l, DirStart: integer;
|
||||
c: char;
|
||||
begin
|
||||
Result:=AFilename;
|
||||
if FilenameIsTrimmed(Result) then exit;
|
||||
|
||||
l:=length(AFilename);
|
||||
SrcPos:=1;
|
||||
DestPos:=1;
|
||||
|
||||
|
||||
// skip trailing spaces
|
||||
while (l>=1) and (AFilename[SrcPos]=' ') do dec(l);
|
||||
|
||||
while (l>=1) and (AFilename[l]=' ') do dec(l);
|
||||
|
||||
// skip heading spaces
|
||||
while (SrcPos<=l) and (AFilename[SrcPos]=' ') do inc(SrcPos);
|
||||
|
||||
|
||||
// trim double path delims and special dirs . and ..
|
||||
while (SrcPos<=l) do begin
|
||||
c:=AFilename[SrcPos];
|
||||
@ -288,7 +331,8 @@ begin
|
||||
// check for special dirs . and ..
|
||||
if (c='.') then begin
|
||||
if (SrcPos<l) then begin
|
||||
if (AFilename[SrcPos+1]=PathDelim) then begin
|
||||
if (AFilename[SrcPos+1]=PathDelim)
|
||||
and ((DestPos=1) or (AFilename[SrcPos-1]=PathDelim)) then begin
|
||||
// special dir ./
|
||||
// -> skip
|
||||
inc(SrcPos,2);
|
||||
@ -367,6 +411,38 @@ begin
|
||||
SetLength(Result,DestPos-1);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
function CleanAndExpandFilename(const Filename: string): string;
|
||||
------------------------------------------------------------------------------}
|
||||
function CleanAndExpandFilename(const Filename: string): string;
|
||||
begin
|
||||
Result:=ExpandFilename(TrimFileName(Filename));
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
function CleanAndExpandDirectory(const Filename: string): string;
|
||||
------------------------------------------------------------------------------}
|
||||
function CleanAndExpandDirectory(const Filename: string): string;
|
||||
begin
|
||||
Result:=AppendPathDelim(CleanAndExpandFilename(Filename));
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
function FileIsInPath(const Filename, Path: string): boolean;
|
||||
------------------------------------------------------------------------------}
|
||||
function FileIsInPath(const Filename, Path: string): boolean;
|
||||
var
|
||||
ExpFile: String;
|
||||
ExpPath: String;
|
||||
l: integer;
|
||||
begin
|
||||
ExpFile:=CleanAndExpandFilename(Filename);
|
||||
ExpPath:=CleanAndExpandDirectory(Path);
|
||||
l:=length(ExpPath);
|
||||
Result:=(length(ExpFile)>l) and (ExpFile[l+1]=PathDelim)
|
||||
and (CompareFilenames(ExpPath,LeftStr(ExpFile,l))=0);
|
||||
end;
|
||||
|
||||
function AppendPathDelim(const Path: string): string;
|
||||
begin
|
||||
if (Path<>'') and (Path[length(Path)]<>PathDelim) then
|
||||
|
@ -269,6 +269,7 @@ type
|
||||
function NeedsLinkerOpts: boolean;
|
||||
function GetUnitPath(RelativeToBaseDir: boolean): string;
|
||||
function GetIncludePath(RelativeToBaseDir: boolean): string;
|
||||
function GetSrcPath(RelativeToBaseDir: boolean): string;
|
||||
public
|
||||
{ Properties }
|
||||
property Owner: TObject read fOwner write fOwner;
|
||||
@ -1229,6 +1230,22 @@ begin
|
||||
Result:=MergeSearchPaths(CurIncludePath,InhIncludePath);
|
||||
end;
|
||||
|
||||
function TBaseCompilerOptions.GetSrcPath(RelativeToBaseDir: boolean): string;
|
||||
var
|
||||
CurSrcPath: String;
|
||||
InhSrcPath: String;
|
||||
begin
|
||||
// src path
|
||||
CurSrcPath:=ParsedOpts.GetParsedValue(pcosSrcPath);
|
||||
if (not RelativeToBaseDir) then
|
||||
CreateAbsolutePath(CurSrcPath,BaseDirectory);
|
||||
|
||||
// inherited src path
|
||||
InhSrcPath:=GetInheritedOption(icoSrcPath,RelativeToBaseDir);
|
||||
|
||||
Result:=MergeSearchPaths(CurSrcPath,InhSrcPath);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
TBaseCompilerOptions MakeOptionsString
|
||||
------------------------------------------------------------------------------}
|
||||
|
@ -35,13 +35,12 @@ unit EditDefineTree;
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, IDEProcs, CodeToolManager, DefineTemplates,
|
||||
CompilerOptions, TransferMacros, LinkScanner, FileProcs;
|
||||
Classes, SysUtils, FileProcs, FileCtrl, IDEProcs, CodeToolManager,
|
||||
DefineTemplates, CompilerOptions, TransferMacros, LinkScanner;
|
||||
|
||||
procedure CreateProjectDefineTemplate(CompOpts: TCompilerOptions);
|
||||
procedure SetAdditionalGlobalSrcPathToCodeToolBoss(const SrcPath: string);
|
||||
function FindCurrentProjectDirTemplate: TDefineTemplate;
|
||||
function FindCurrentProjectDirSrcPathTemplate: TDefineTemplate;
|
||||
function FindPackagesTemplate: TDefineTemplate;
|
||||
function FindPackageTemplateWithID(const PkgID: string): TDefineTemplate;
|
||||
function CreatePackagesTemplate: TDefineTemplate;
|
||||
@ -49,7 +48,6 @@ function CreatePackageTemplateWithID(const PkgID: string): TDefineTemplate;
|
||||
|
||||
const
|
||||
ProjectDirDefTemplName = 'Current Project Directory';
|
||||
ProjectDirSrcPathTemplName = 'SrcPathAddition';
|
||||
PackagesDefTemplName = 'Packages';
|
||||
PkgOutputDirDefTemplName = 'Output Directory';
|
||||
|
||||
@ -62,13 +60,6 @@ begin
|
||||
ProjectDirDefTemplName,true);
|
||||
end;
|
||||
|
||||
function FindCurrentProjectDirSrcPathTemplate: TDefineTemplate;
|
||||
begin
|
||||
Result:=FindCurrentProjectDirTemplate;
|
||||
if Result<>nil then
|
||||
Result:=Result.FindChildByName(ProjectDirSrcPathTemplName);
|
||||
end;
|
||||
|
||||
function FindPackagesTemplate: TDefineTemplate;
|
||||
begin
|
||||
Result:=CodeToolBoss.DefineTree.FindDefineTemplateByName(
|
||||
@ -115,17 +106,21 @@ var
|
||||
begin
|
||||
Count:=0;
|
||||
for i:=1 to length(s)-1 do begin
|
||||
if ((i=1) or (s[i-1]<>SpecialChar))
|
||||
if ((i=1) or (s[i-1]<>FileProcs.SpecialChar))
|
||||
and (s[i]='$') and (s[i+1] in ['(','{']) then
|
||||
inc(Count);
|
||||
end;
|
||||
if Count=0 then begin
|
||||
Result:=s;
|
||||
exit;
|
||||
end;
|
||||
SetLength(Result,Length(s)+Count);
|
||||
i:=1;
|
||||
j:=1;
|
||||
while (i<=length(s)) do begin
|
||||
if (i<length(s))
|
||||
and ((s[i]='$') and (s[i+1] in ['(','{']))
|
||||
and ((i=1) or (s[i-1]<>SpecialChar))
|
||||
and ((i=1) or (s[i-1]<>FileProcs.SpecialChar))
|
||||
then begin
|
||||
Result[j]:=s[i];
|
||||
Result[j+1]:='(';
|
||||
@ -143,8 +138,11 @@ begin
|
||||
end;
|
||||
|
||||
procedure CreateProjectDefineTemplate(CompOpts: TCompilerOptions);
|
||||
var ProjectDir, s: string;
|
||||
var ProjectDir: string;
|
||||
ProjTempl: TDefineTemplate;
|
||||
UnitPath: String;
|
||||
IncPath: String;
|
||||
SrcPath: String;
|
||||
begin
|
||||
{ ToDo:
|
||||
|
||||
@ -207,36 +205,32 @@ begin
|
||||
// Paths --------------------------------------------------------------------
|
||||
|
||||
// Include Path
|
||||
if CompOpts.IncludeFiles<>'' then begin
|
||||
IncPath:=ConvertTransferMacrosToExternalMacros(CompOpts.GetIncludePath(false));
|
||||
if IncPath<>'' then begin
|
||||
// add include paths
|
||||
ProjTempl.AddChild(TDefineTemplate.Create('IncludePath',
|
||||
'include path addition',ExternalMacroStart+'INCPATH',
|
||||
ConvertTransferMacrosToExternalMacros(CompOpts.IncludeFiles)+';'
|
||||
+'$('+ExternalMacroStart+'INCPATH)',
|
||||
'include path addition',ExternalMacroStart+'IncPath',
|
||||
IncPath+';'
|
||||
+'$('+ExternalMacroStart+'IncPath)',
|
||||
da_DefineRecurse));
|
||||
end;
|
||||
// compiled unit path (ppu/ppw/dcu files)
|
||||
s:=CompOpts.OtherUnitFiles;
|
||||
if (CompOpts.UnitOutputDirectory<>'') then begin
|
||||
if s<>'' then
|
||||
s:=s+';'+CompOpts.UnitOutputDirectory
|
||||
else
|
||||
s:=CompOpts.UnitOutputDirectory;
|
||||
end;
|
||||
if s<>'' then begin
|
||||
UnitPath:=ConvertTransferMacrosToExternalMacros(CompOpts.GetUnitPath(false));
|
||||
if UnitPath<>'' then begin
|
||||
// add compiled unit path
|
||||
ProjTempl.AddChild(TDefineTemplate.Create('UnitPath',
|
||||
'unit path addition',ExternalMacroStart+'UnitPath',
|
||||
ConvertTransferMacrosToExternalMacros(s)+';'
|
||||
UnitPath+';'
|
||||
+'$('+ExternalMacroStart+'UnitPath)',
|
||||
da_DefineRecurse));
|
||||
end;
|
||||
// source path (unitpath + sources for the CodeTools, hidden to the compiler)
|
||||
if (CompOpts.SrcPath<>'') or (s<>'') then begin
|
||||
SrcPath:=ConvertTransferMacrosToExternalMacros(CompOpts.GetSrcPath(false));
|
||||
if (SrcPath<>'') or (UnitPath<>'') then begin
|
||||
// add compiled unit path
|
||||
ProjTempl.AddChild(TDefineTemplate.Create('SrcPath',
|
||||
'source path addition',ExternalMacroStart+'SrcPath',
|
||||
ConvertTransferMacrosToExternalMacros(s+';'+CompOpts.SrcPath)+';'
|
||||
MergeSearchPaths(UnitPath,SrcPath)+';'
|
||||
+'$('+ExternalMacroStart+'SrcPath)',
|
||||
da_DefineRecurse));
|
||||
end;
|
||||
|
@ -44,9 +44,9 @@ program Lazarus;
|
||||
|
||||
uses
|
||||
//cmem,
|
||||
{$IFDEF IDE_MEM_CHECK}
|
||||
{$IFDEF IDE_MEM_CHECK}
|
||||
MemCheck,
|
||||
{$ENDIF}
|
||||
{$ENDIF}
|
||||
Interfaces,
|
||||
Forms,
|
||||
Splash,
|
||||
@ -54,8 +54,7 @@ uses
|
||||
MainBar,
|
||||
MsgView,
|
||||
FindReplaceDialog,
|
||||
FindInFilesDlg,
|
||||
IDEProcs;
|
||||
FindInFilesDlg;
|
||||
|
||||
begin
|
||||
Application.Initialize;
|
||||
@ -77,19 +76,25 @@ begin
|
||||
|
||||
Application.CreateForm(TLazFindReplaceDialog, FindReplaceDlg);
|
||||
Application.CreateForm(TLazFindInFilesDialog, FindInFilesDialog);
|
||||
|
||||
SplashForm.StartTimer;
|
||||
Application.Run;
|
||||
SplashForm.Free;
|
||||
SplashForm:=nil;
|
||||
|
||||
writeln('LAZARUS END - cleaning up ...');
|
||||
|
||||
// free the forms, so that they are freed before the finalization sections
|
||||
FreeThenNil(MainIDE);
|
||||
MainIDE.Free;
|
||||
MainIDE:=nil;
|
||||
end.
|
||||
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.42 2003/04/21 16:21:28 mattias
|
||||
implemented default package for custom IDE components
|
||||
|
||||
Revision 1.41 2003/04/18 15:32:51 mattias
|
||||
implemented file reference list
|
||||
|
||||
|
@ -92,6 +92,9 @@ resourcestring
|
||||
lisTestDirectory = 'Test directory';
|
||||
lisLaunchingCmdLine = 'Launching target command line';
|
||||
lisPublishProjDir = 'Publish project directory';
|
||||
lisProjectUnitPath = 'Project Unit Path';
|
||||
lisProjectIncPath = 'Project Include Path';
|
||||
lisProjectSrcPath = 'Project Src Path';
|
||||
|
||||
// main bar menu
|
||||
lisMenuFile = '&File';
|
||||
|
@ -386,7 +386,7 @@ var
|
||||
PropertyEditorHook1 : TPropertyEditorHook;
|
||||
SourceNotebook : TSourceNotebook;
|
||||
Project1: TProject;
|
||||
|
||||
|
||||
const
|
||||
OpenFlagNames: array[TOpenFlag] of string = (
|
||||
'ofProjectLoading',
|
||||
|
@ -1405,7 +1405,6 @@ begin
|
||||
CompilerOptions.XMLConfigFile := xmlconfig;
|
||||
CompilerOptions.LoadCompilerOptions(true);
|
||||
if FileVersion<2 then CompilerOptions.SrcPath:=OldSrcPath;
|
||||
CreateProjectDefineTemplate(CompilerOptions);
|
||||
|
||||
// load the Publish Options
|
||||
PublishOptions.LoadFromXMLConfig(xmlconfig,'ProjectOptions/PublishOptions/');
|
||||
@ -2547,6 +2546,9 @@ end.
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.113 2003/04/21 16:21:28 mattias
|
||||
implemented default package for custom IDE components
|
||||
|
||||
Revision 1.112 2003/04/20 23:10:03 mattias
|
||||
implemented inherited project compiler options
|
||||
|
||||
|
@ -190,8 +190,28 @@ begin
|
||||
end;
|
||||
|
||||
procedure TTransferMacroList.Add(NewMacro: TTransferMacro);
|
||||
var
|
||||
l: Integer;
|
||||
r: Integer;
|
||||
m: Integer;
|
||||
cmp: Integer;
|
||||
begin
|
||||
fItems.Add(NewMacro);
|
||||
l:=0;
|
||||
r:=fItems.Count-1;
|
||||
m:=0;
|
||||
while l<=r do begin
|
||||
m:=(l+r) shr 1;
|
||||
cmp:=AnsiCompareText(NewMacro.Name,Items[m].Name);
|
||||
if cmp<0 then
|
||||
r:=m-1
|
||||
else if cmp>0 then
|
||||
l:=m+1
|
||||
else
|
||||
break;
|
||||
end;
|
||||
if (m<fItems.Count) and (AnsiCompareText(NewMacro.Name,Items[m].Name)>0) then
|
||||
inc(m);
|
||||
fItems.Insert(m,NewMacro);
|
||||
end;
|
||||
|
||||
function TTransferMacroList.SubstituteStr(var s:string): boolean;
|
||||
@ -345,16 +365,26 @@ end;
|
||||
|
||||
function TTransferMacroList.FindByName(const MacroName: string): TTransferMacro;
|
||||
var
|
||||
i:integer;
|
||||
Cnt: Integer;
|
||||
l: Integer;
|
||||
r: Integer;
|
||||
m: Integer;
|
||||
cmp: Integer;
|
||||
begin
|
||||
Cnt:=Count;
|
||||
for i:=0 to Cnt-1 do
|
||||
if AnsiCompareText(MacroName,Items[i].Name)=0 then begin
|
||||
Result:=Items[i];
|
||||
exit;
|
||||
l:=0;
|
||||
r:=fItems.Count-1;
|
||||
m:=0;
|
||||
while l<=r do begin
|
||||
m:=(l+r) shr 1;
|
||||
Result:=Items[m];
|
||||
cmp:=AnsiCompareText(Result.Name,Items[m].Name);
|
||||
if cmp<0 then
|
||||
r:=m-1
|
||||
else if cmp>0 then
|
||||
l:=m+1
|
||||
else begin
|
||||
break;
|
||||
end;
|
||||
Result:=nil;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TTransferMacroList.MF_Ext(const Filename:string;
|
||||
|
@ -38,7 +38,11 @@ unit ComponentReg;
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, IDEProcs;
|
||||
Classes, SysUtils,
|
||||
{$IFDEF CustomIDEComps}
|
||||
CustomIDEComps,
|
||||
{$ENDIF}
|
||||
IDEProcs, LazarusPackageIntf;
|
||||
|
||||
type
|
||||
TComponentPriorityCategory = (
|
||||
@ -143,6 +147,12 @@ var
|
||||
function ComparePriority(const p1,p2: TComponentPriority): integer;
|
||||
function CompareIDEComponentByClassName(Data1, Data2: pointer): integer;
|
||||
|
||||
type
|
||||
RegisterUnitComponentProc = procedure(const Page, UnitName: ShortString;
|
||||
ComponentClass: TComponentClass);
|
||||
|
||||
procedure RegisterCustomIDEComponents(RegisterProc: RegisterUnitComponentProc);
|
||||
|
||||
|
||||
implementation
|
||||
|
||||
@ -165,6 +175,13 @@ begin
|
||||
Comp2.ComponentClass.Classname);
|
||||
end;
|
||||
|
||||
procedure RegisterCustomIDEComponents(RegisterProc: RegisterUnitComponentProc);
|
||||
begin
|
||||
{$IFDEF CustomIDEComps}
|
||||
CustomIDEComps.RegisterCustomComponents(RegisterProc);
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
{ TIDEComponent }
|
||||
|
||||
constructor TIDEComponent.Create(TheComponentClass: TComponentClass;
|
||||
|
@ -2699,7 +2699,6 @@ begin
|
||||
// update the package block define template (the container for all other
|
||||
// define templates of the package)
|
||||
if FMain=nil then begin
|
||||
writeln('TLazPackageDefineTemplates.UpdateMain A ',LazPackage.IDAsString);
|
||||
FMain:=CreatePackageTemplateWithID(LazPackage.IDAsString);
|
||||
end;
|
||||
FMain.Name:=LazPackage.IDAsString;
|
||||
@ -2720,7 +2719,6 @@ begin
|
||||
if (FOutPutSrcPath=nil)
|
||||
or (fLastOutputDirSrcPathIDAsString<>LazPackage.IDAsString) then begin
|
||||
fLastOutputDirSrcPathIDAsString:=LazPackage.IDAsString;
|
||||
writeln('TLazPackageDefineTemplates.UpdateDefinesForOutputDirectory A ',LazPackage.IDAsString);
|
||||
FOutPutSrcPath:=TDefineTemplate.Create('CompiledSrcPath',
|
||||
'CompiledSrcPath addition',CompiledSrcPathMacroName,
|
||||
'$PkgSrcPath('+fLastOutputDirSrcPathIDAsString+');'
|
||||
@ -2773,8 +2771,6 @@ begin
|
||||
end else
|
||||
fLastSourceDirectories:=TStringList.Create;
|
||||
|
||||
writeln('TLazPackageDefineTemplates.UpdateDefinesForSourceDirectories A ',LazPackage.IDAsString,' "',NewSourceDirs.Text,'"');
|
||||
|
||||
// build source directory define templates
|
||||
fLastSourceDirectories.Assign(NewSourceDirs);
|
||||
if (FMain=nil) and (fLastSourceDirectories.Count>0) then UpdateMain;
|
||||
|
@ -47,7 +47,7 @@ uses
|
||||
{$ENDIF}
|
||||
Classes, SysUtils, AVL_Tree, Laz_XMLCfg, FileCtrl, Forms, Controls, Dialogs,
|
||||
LazarusIDEStrConsts, IDEProcs, PackageLinks, PackageDefs, LazarusPackageIntf,
|
||||
ComponentReg, RegisterLCL, RegisterFCL;
|
||||
ComponentReg, RegisterFCL, RegisterLCL, RegisterSynEdit;
|
||||
|
||||
type
|
||||
TFindPackageFlag = (
|
||||
@ -75,6 +75,7 @@ type
|
||||
private
|
||||
FAbortRegistration: boolean;
|
||||
fChanged: boolean;
|
||||
FDefaultPackage: TLazPackage;
|
||||
FErrorMsg: string;
|
||||
FFCLPackage: TLazPackage;
|
||||
FItems: TList; // unsorted list of TLazPackage
|
||||
@ -88,10 +89,13 @@ type
|
||||
FRegistrationFile: TPkgFile;
|
||||
FRegistrationPackage: TLazPackage;
|
||||
FRegistrationUnitName: string;
|
||||
FSynEditPackage: TLazPackage;
|
||||
FTree: TAVLTree; // sorted tree of TLazPackage
|
||||
FUpdateLock: integer;
|
||||
function CreateFCLPackage: TLazPackage;
|
||||
function CreateLCLPackage: TLazPackage;
|
||||
function CreateSynEditPackage: TLazPackage;
|
||||
function CreateDefaultPackage: TLazPackage;
|
||||
function GetPackages(Index: integer): TLazPackage;
|
||||
procedure DoDependencyChanged(Dependency: TPkgDependency);
|
||||
procedure SetAbortRegistration(const AValue: boolean);
|
||||
@ -175,6 +179,10 @@ type
|
||||
ComponentClasses: array of TComponentClass);
|
||||
procedure RegistrationError(const Msg: string);
|
||||
procedure RegisterStaticPackages;
|
||||
procedure RegisterStaticPackage(APackage: TLazPackage;
|
||||
RegisterProc: TRegisterProc);
|
||||
procedure RegisterDefaultPackageComponent(const Page, UnitName: ShortString;
|
||||
ComponentClass: TComponentClass);
|
||||
public
|
||||
// dependency handling
|
||||
procedure AddDependencyToPackage(APackage: TLazPackage;
|
||||
@ -194,6 +202,8 @@ type
|
||||
property ErrorMsg: string read FErrorMsg write FErrorMsg;
|
||||
property FCLPackage: TLazPackage read FFCLPackage;
|
||||
property LCLPackage: TLazPackage read FLCLPackage;
|
||||
property SynEditPackage: TLazPackage read FSynEditPackage;
|
||||
property DefaultPackage: TLazPackage read FDefaultPackage;
|
||||
property OnAddPackage: TPkgAddedEvent read FOnAddPackage write FOnAddPackage;
|
||||
property OnBeginUpdate: TNotifyEvent read FOnBeginUpdate write FOnBeginUpdate;
|
||||
property OnChangePackageName: TPkgChangeNameEvent read FOnChangePackageName
|
||||
@ -216,6 +226,12 @@ var
|
||||
|
||||
implementation
|
||||
|
||||
procedure RegisterCustomIDEComponent(const Page, UnitName: ShortString;
|
||||
ComponentClass: TComponentClass);
|
||||
begin
|
||||
PackageGraph.RegisterDefaultPackageComponent(Page,UnitName,ComponentClass);
|
||||
end;
|
||||
|
||||
procedure RegisterComponentsGlobalHandler(const Page: string;
|
||||
ComponentClasses: array of TComponentClass);
|
||||
begin
|
||||
@ -850,6 +866,78 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function TLazPackageGraph.CreateSynEditPackage: TLazPackage;
|
||||
begin
|
||||
Result:=TLazPackage.Create;
|
||||
with Result do begin
|
||||
AutoCreated:=true;
|
||||
Name:='SynEdit';
|
||||
Filename:='$(LazarusDir)/components/synedit/';
|
||||
Version.SetValues(1,0,1,1);
|
||||
Author:='SynEdit - http://sourceforge.net/projects/synedit/';
|
||||
AutoInstall:=pitStatic;
|
||||
AutoUpdate:=false;
|
||||
Description:='SynEdit - the editor component used by Lazarus. '
|
||||
+'http://sourceforge.net/projects/synedit/';
|
||||
PackageType:=lptDesignTime;
|
||||
Installed:=pitStatic;
|
||||
CompilerOptions.UnitOutputDirectory:='';
|
||||
|
||||
// add units
|
||||
AddFile('synedit.pp','SynEdit',pftUnit,[],cpBase);
|
||||
AddFile('syneditlazdsgn.pas','SynEditLazDsgn',pftUnit,[],cpBase);
|
||||
AddFile('syncompletion.pas','SynCompletion',pftUnit,[],cpBase);
|
||||
AddFile('synexporthtml.pas','SynExportHTML',pftUnit,[],cpBase);
|
||||
AddFile('synmacrorecorder.pas','SynMacroRecorder',pftUnit,[],cpBase);
|
||||
AddFile('synmemo.pas','SynMemo',pftUnit,[],cpBase);
|
||||
AddFile('synhighlighterpas.pas','SynHighlighterPas',pftUnit,[],cpBase);
|
||||
AddFile('synhighlightercpp.pp','SynHighlighterCPP',pftUnit,[],cpBase);
|
||||
AddFile('synhighlighterjava.pas','SynHighlighterJava',pftUnit,[],cpBase);
|
||||
AddFile('synhighlighterperl.pas','SynHighlighterPerl',pftUnit,[],cpBase);
|
||||
AddFile('synhighlighterhtml.pp','SynHighlighterHTML',pftUnit,[],cpBase);
|
||||
AddFile('synhighlighterxml.pas','SynHighlighterXML',pftUnit,[],cpBase);
|
||||
AddFile('synhighlighterlfm.pas','SynHighlighterLFM',pftUnit,[],cpBase);
|
||||
AddFile('synhighlightermulti.pas','SynHighlighterMulti',pftUnit,[],cpBase);
|
||||
|
||||
// add unit paths
|
||||
UsageOptions.UnitPath:='$(LazarusDir)/components/units';
|
||||
|
||||
// add requirements
|
||||
AddRequiredDependency(LCLPackage.CreateDependencyForThisPkg);
|
||||
|
||||
Modified:=false;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TLazPackageGraph.CreateDefaultPackage: TLazPackage;
|
||||
begin
|
||||
Result:=TLazPackage.Create;
|
||||
with Result do begin
|
||||
AutoCreated:=true;
|
||||
Name:='DefaultPackage';
|
||||
Filename:='$(LazarusDir)/components/custom/';
|
||||
Version.SetValues(1,0,1,1);
|
||||
Author:='Anonymous';
|
||||
AutoInstall:=pitStatic;
|
||||
AutoUpdate:=false;
|
||||
Description:='This is the default package. '
|
||||
+'Used only for components without a package. '
|
||||
+'These components are outdated.';
|
||||
PackageType:=lptDesignTime;
|
||||
Installed:=pitStatic;
|
||||
CompilerOptions.UnitOutputDirectory:='';
|
||||
|
||||
// add unit paths
|
||||
UsageOptions.UnitPath:='$(LazarusDir)/components/custom';
|
||||
|
||||
// add requirements
|
||||
AddRequiredDependency(LCLPackage.CreateDependencyForThisPkg);
|
||||
AddRequiredDependency(SynEditPackage.CreateDependencyForThisPkg);
|
||||
|
||||
Modified:=false;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TLazPackageGraph.AddPackage(APackage: TLazPackage);
|
||||
var
|
||||
RequiredPackage: TLazPackage;
|
||||
@ -889,6 +977,11 @@ begin
|
||||
// LCL
|
||||
FLCLPackage:=CreateLCLPackage;
|
||||
AddPackage(FLCLPackage);
|
||||
// SynEdit
|
||||
FSynEditPackage:=CreateSynEditPackage;
|
||||
AddPackage(FSynEditPackage);
|
||||
// the default package will be added on demand
|
||||
FDefaultPackage:=CreateDefaultPackage;
|
||||
end;
|
||||
|
||||
procedure TLazPackageGraph.ClosePackage(APackage: TLazPackage);
|
||||
@ -1274,18 +1367,52 @@ end;
|
||||
|
||||
procedure TLazPackageGraph.RegisterStaticPackages;
|
||||
begin
|
||||
// FCL
|
||||
RegistrationPackage:=FCLPackage;
|
||||
RegisterFCL.Register;
|
||||
FCLPackage.Registered:=true;
|
||||
|
||||
// LCL
|
||||
RegistrationPackage:=LCLPackage;
|
||||
RegisterLCL.Register;
|
||||
LCLPackage.Registered:=true;
|
||||
BeginUpdate(true);
|
||||
// IDE built-in packages
|
||||
RegisterStaticPackage(FCLPackage,@RegisterFCL.Register);
|
||||
RegisterStaticPackage(LCLPackage,@RegisterLCL.Register);
|
||||
RegisterStaticPackage(SynEditPackage,@RegisterSynEdit.Register);
|
||||
|
||||
// clean up
|
||||
// custom IDE components
|
||||
RegistrationPackage:=DefaultPackage;
|
||||
ComponentReg.RegisterCustomIDEComponents(@RegisterCustomIDEComponent);
|
||||
if DefaultPackage.FileCount=0 then begin
|
||||
FreeThenNil(FDefaultPackage);
|
||||
end else begin
|
||||
DefaultPackage.Name:=CreateUniquePkgName('DefaultPackage',DefaultPackage);
|
||||
AddPackage(DefaultPackage);
|
||||
end;
|
||||
RegistrationPackage:=nil;
|
||||
|
||||
// installed packages
|
||||
// ToDo
|
||||
|
||||
EndUpdate;
|
||||
end;
|
||||
|
||||
procedure TLazPackageGraph.RegisterStaticPackage(APackage: TLazPackage;
|
||||
RegisterProc: TRegisterProc);
|
||||
begin
|
||||
RegistrationPackage:=APackage;
|
||||
RegisterProc();
|
||||
APackage.Registered:=true;
|
||||
RegistrationPackage:=nil;
|
||||
end;
|
||||
|
||||
procedure TLazPackageGraph.RegisterDefaultPackageComponent(const Page,
|
||||
UnitName: ShortString; ComponentClass: TComponentClass);
|
||||
var
|
||||
PkgFile: TPkgFile;
|
||||
NewPkgFilename: String;
|
||||
begin
|
||||
PkgFile:=FDefaultPackage.FindUnit(UnitName,true);
|
||||
if PkgFile=nil then begin
|
||||
NewPkgFilename:=UnitName+'.pas';
|
||||
PkgFile:=FDefaultPackage.AddFile(NewPkgFilename,UnitName,pftUnit,[],
|
||||
cpOptional);
|
||||
end;
|
||||
FRegistrationFile:=PkgFile;
|
||||
RegisterComponentsHandler(Page,[ComponentClass]);
|
||||
end;
|
||||
|
||||
procedure TLazPackageGraph.AddDependencyToPackage(APackage: TLazPackage;
|
||||
|
@ -41,13 +41,13 @@ interface
|
||||
{$I ide.inc}
|
||||
|
||||
uses
|
||||
{$IFDEF IDE_MEM_CHECK}
|
||||
{$IFDEF IDE_MEM_CHECK}
|
||||
MemCheck,
|
||||
{$ENDIF}
|
||||
{$ENDIF}
|
||||
Classes, SysUtils, LCLProc, Forms, Controls, FileCtrl,
|
||||
Dialogs, Menus, CodeToolManager, CodeCache, Laz_XMLCfg, AVL_Tree,
|
||||
LazarusIDEStrConsts, KeyMapping, EnvironmentOpts, IDEProcs, ProjectDefs,
|
||||
InputHistory, IDEDefs, UComponentManMain, Project, ComponentReg,
|
||||
InputHistory, IDEDefs, Project, ComponentReg, UComponentManMain,
|
||||
PackageEditor, AddToPackageDlg, PackageDefs, PackageLinks, PackageSystem,
|
||||
OpenInstalledPkgDlg, PkgGraphExplorer, BrokenDependenciesDlg, CompilerOptions,
|
||||
ExtToolDialog, ExtToolEditDlg, EditDefineTree, DefineTemplates,
|
||||
@ -376,6 +376,8 @@ end;
|
||||
|
||||
procedure TPkgManager.OnApplicationIdle(Sender: TObject);
|
||||
begin
|
||||
if (Screen.ActiveCustomForm<>nil)
|
||||
and (fsModal in Screen.ActiveCustomForm.FormState) then exit;
|
||||
PackageGraph.CloseUnneededPackages;
|
||||
end;
|
||||
|
||||
@ -961,10 +963,7 @@ procedure TPkgManager.LoadInstalledPackages;
|
||||
begin
|
||||
// base packages
|
||||
PackageGraph.AddStaticBasePackages;
|
||||
|
||||
PackageGraph.RegisterStaticPackages;
|
||||
// custom packages
|
||||
// ToDo
|
||||
end;
|
||||
|
||||
function TPkgManager.AddPackageToGraph(APackage: TLazPackage
|
||||
|
Loading…
Reference in New Issue
Block a user