added macrointf

git-svn-id: trunk@6383 -
This commit is contained in:
mattias 2004-12-17 08:31:42 +00:00
parent 85db9924a1
commit 813c5d0789
5 changed files with 114 additions and 1 deletions

1
.gitattributes vendored
View File

@ -774,6 +774,7 @@ ideintf/idecommands.pas svneol=native#text/pascal
ideintf/imagelisteditor.pp svneol=native#text/pascal
ideintf/lazideintf.pas svneol=native#text/pascal
ideintf/listviewpropedit.pp svneol=native#text/pascal
ideintf/macrointf.pas svneol=native#text/pascal
ideintf/newitemintf.pas svneol=native#text/pascal
ideintf/objectinspector.pp svneol=native#text/pascal
ideintf/objinspstrconsts.pas svneol=native#text/pascal

85
ideintf/macrointf.pas Normal file
View File

@ -0,0 +1,85 @@
{ Copyright (C) 2004
*****************************************************************************
* *
* See the file COPYING.modifiedLGPL, included in this distribution, *
* for details about the copyright. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* *
*****************************************************************************
Abstract:
Interface to the IDE macros.
}
unit MacroIntf;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils;
type
{ TIDEMacros }
TIDEMacros = class
protected
FBaseTimeStamp: integer;
FGraphTimeStamp: integer;
public
property BaseTimeStamp: integer read FBaseTimeStamp;
property GraphTimeStamp: integer read FGraphTimeStamp;
procedure IncreaseBaseStamp;
procedure IncreaseGraphStamp;
function StrHasMacros(const s: string): boolean; virtual;
function SubstituteMacros(var s: string): boolean; virtual;
end;
var
// the global IDE values
IDEMacros: TIDEMacros; // set by the IDE
implementation
const
MaxStamp = $7fffffff;
MinStamp = -$7fffffff;
InvalidStamp = MinStamp-1;
{ TIDEMacros }
procedure TIDEMacros.IncreaseBaseStamp;
begin
if FBaseTimeStamp<MaxStamp then
inc(FBaseTimeStamp)
else
FBaseTimeStamp:=MinStamp;
end;
procedure TIDEMacros.IncreaseGraphStamp;
begin
if FGraphTimeStamp<MaxStamp then
inc(FGraphTimeStamp)
else
FGraphTimeStamp:=MinStamp;
end;
function TIDEMacros.StrHasMacros(const s: string): boolean;
begin
Result:=false;
end;
function TIDEMacros.SubstituteMacros(var s: string): boolean;
begin
Result:=true;
end;
initialization
IDEMacros:=nil;
end.

View File

@ -93,14 +93,20 @@ type
{ TPackageLinks }
TPackageLinks = class;
TPkgLinksState = (
plsUserLinksNeedUpdate,
plsGlobalLinksNeedUpdate
);
TPkgLinksStates = set of TPkgLinksState;
TDependencyOwnerGetPkgFilename = function(PkgLinks: TPackageLinks;
Dependency: TPkgDependency): boolean of object;
TPackageLinks = class
private
FDependencyOwnerGetPkgFilename: TDependencyOwnerGetPkgFilename;
FGlobalLinks: TAVLTree; // tree of global TPackageLink sorted for ID
FModified: boolean;
FUserLinks: TAVLTree; // tree of user TPackageLink sorted for ID
@ -138,6 +144,9 @@ type
procedure RemoveLink(APackageID: TLazPackageID);
public
property Modified: boolean read FModified write SetModified;
property DependencyOwnerGetPkgFilename: TDependencyOwnerGetPkgFilename
read FDependencyOwnerGetPkgFilename
write FDependencyOwnerGetPkgFilename;
end;
var
@ -609,6 +618,10 @@ begin
Result:=FindLinkWithDependencyInTree(FUserLinks,Dependency);
if Result=nil then
Result:=FindLinkWithDependencyInTree(FGlobalLinks,Dependency);
// finally try the history lists of the Dependency Owner (Project/Package)
if (Result=nil) and (Dependency.Owner<>nil)
and DependencyOwnerGetPkgFilename(Self,Dependency) then
Result:=FindLinkWithDependencyInTree(FUserLinks,Dependency);
end;
function TPackageLinks.FindLinkWithPackageID(APackageID: TLazPackageID

View File

@ -2196,7 +2196,9 @@ begin
PkgLinks.RemoveLink(PkgLink);
until false;
end else begin
// there is already a package with this name open
// there is already a package with this name, but wrong version open
// -> unable to load this dependency due to conflict
Dependency.LoadPackageResult:=lprLoadError;
end;
end;
fChanged:=true;

View File

@ -111,6 +111,9 @@ type
procedure PackageGraphEndUpdate(Sender: TObject; GraphChanged: boolean);
procedure PackageGraphFindFPCUnit(const UnitName, Directory: string;
var Filename: string);
// package links
function PkgLinksDependencyOwnerGetPkgFilename(PkgLinks: TPackageLinks;
Dependency: TPkgDependency): boolean;
// menu
procedure MainIDEitmPkgOpenPackageFileClick(Sender: TObject);
@ -632,6 +635,14 @@ begin
Result:=DoUninstallPackage(APackage);
end;
function TPkgManager.PkgLinksDependencyOwnerGetPkgFilename(
PkgLinks: TPackageLinks; Dependency: TPkgDependency): boolean;
begin
Result:=false;
// TODO search in Project/Package history list of dependencies
end;
procedure TPkgManager.mnuConfigCustomCompsClicked(Sender: TObject);
begin
ShowConfigureCustomComponents;
@ -1577,6 +1588,7 @@ begin
// package links
PkgLinks:=TPackageLinks.Create;
PkgLinks.UpdateAll;
PkgLinks.DependencyOwnerGetPkgFilename:=@PkgLinksDependencyOwnerGetPkgFilename;
// package graph
PackageGraph:=TLazPackageGraph.Create;