From 813c5d07891ed2657d5fd068ecd14bd5f1e902c9 Mon Sep 17 00:00:00 2001 From: mattias Date: Fri, 17 Dec 2004 08:31:42 +0000 Subject: [PATCH] added macrointf git-svn-id: trunk@6383 - --- .gitattributes | 1 + ideintf/macrointf.pas | 85 ++++++++++++++++++++++++++++++++++++++ packager/packagelinks.pas | 13 ++++++ packager/packagesystem.pas | 4 +- packager/pkgmanager.pas | 12 ++++++ 5 files changed, 114 insertions(+), 1 deletion(-) create mode 100644 ideintf/macrointf.pas diff --git a/.gitattributes b/.gitattributes index 5590a467ee..f39a50bcb6 100644 --- a/.gitattributes +++ b/.gitattributes @@ -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 diff --git a/ideintf/macrointf.pas b/ideintf/macrointf.pas new file mode 100644 index 0000000000..958647bd50 --- /dev/null +++ b/ideintf/macrointf.pas @@ -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 FBaseTimeStampnil) + and DependencyOwnerGetPkgFilename(Self,Dependency) then + Result:=FindLinkWithDependencyInTree(FUserLinks,Dependency); end; function TPackageLinks.FindLinkWithPackageID(APackageID: TLazPackageID diff --git a/packager/packagesystem.pas b/packager/packagesystem.pas index b8ebf621bd..995cb439a0 100644 --- a/packager/packagesystem.pas +++ b/packager/packagesystem.pas @@ -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; diff --git a/packager/pkgmanager.pas b/packager/pkgmanager.pas index c7744bea60..8536d7e4ff 100644 --- a/packager/pkgmanager.pas +++ b/packager/pkgmanager.pas @@ -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;