mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-30 11:30:28 +02:00
added macrointf
git-svn-id: trunk@6383 -
This commit is contained in:
parent
85db9924a1
commit
813c5d0789
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -774,6 +774,7 @@ ideintf/idecommands.pas svneol=native#text/pascal
|
|||||||
ideintf/imagelisteditor.pp svneol=native#text/pascal
|
ideintf/imagelisteditor.pp svneol=native#text/pascal
|
||||||
ideintf/lazideintf.pas svneol=native#text/pascal
|
ideintf/lazideintf.pas svneol=native#text/pascal
|
||||||
ideintf/listviewpropedit.pp 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/newitemintf.pas svneol=native#text/pascal
|
||||||
ideintf/objectinspector.pp svneol=native#text/pascal
|
ideintf/objectinspector.pp svneol=native#text/pascal
|
||||||
ideintf/objinspstrconsts.pas svneol=native#text/pascal
|
ideintf/objinspstrconsts.pas svneol=native#text/pascal
|
||||||
|
85
ideintf/macrointf.pas
Normal file
85
ideintf/macrointf.pas
Normal 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.
|
||||||
|
|
@ -93,14 +93,20 @@ type
|
|||||||
|
|
||||||
{ TPackageLinks }
|
{ TPackageLinks }
|
||||||
|
|
||||||
|
TPackageLinks = class;
|
||||||
|
|
||||||
TPkgLinksState = (
|
TPkgLinksState = (
|
||||||
plsUserLinksNeedUpdate,
|
plsUserLinksNeedUpdate,
|
||||||
plsGlobalLinksNeedUpdate
|
plsGlobalLinksNeedUpdate
|
||||||
);
|
);
|
||||||
TPkgLinksStates = set of TPkgLinksState;
|
TPkgLinksStates = set of TPkgLinksState;
|
||||||
|
|
||||||
|
TDependencyOwnerGetPkgFilename = function(PkgLinks: TPackageLinks;
|
||||||
|
Dependency: TPkgDependency): boolean of object;
|
||||||
|
|
||||||
TPackageLinks = class
|
TPackageLinks = class
|
||||||
private
|
private
|
||||||
|
FDependencyOwnerGetPkgFilename: TDependencyOwnerGetPkgFilename;
|
||||||
FGlobalLinks: TAVLTree; // tree of global TPackageLink sorted for ID
|
FGlobalLinks: TAVLTree; // tree of global TPackageLink sorted for ID
|
||||||
FModified: boolean;
|
FModified: boolean;
|
||||||
FUserLinks: TAVLTree; // tree of user TPackageLink sorted for ID
|
FUserLinks: TAVLTree; // tree of user TPackageLink sorted for ID
|
||||||
@ -138,6 +144,9 @@ type
|
|||||||
procedure RemoveLink(APackageID: TLazPackageID);
|
procedure RemoveLink(APackageID: TLazPackageID);
|
||||||
public
|
public
|
||||||
property Modified: boolean read FModified write SetModified;
|
property Modified: boolean read FModified write SetModified;
|
||||||
|
property DependencyOwnerGetPkgFilename: TDependencyOwnerGetPkgFilename
|
||||||
|
read FDependencyOwnerGetPkgFilename
|
||||||
|
write FDependencyOwnerGetPkgFilename;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
var
|
var
|
||||||
@ -609,6 +618,10 @@ begin
|
|||||||
Result:=FindLinkWithDependencyInTree(FUserLinks,Dependency);
|
Result:=FindLinkWithDependencyInTree(FUserLinks,Dependency);
|
||||||
if Result=nil then
|
if Result=nil then
|
||||||
Result:=FindLinkWithDependencyInTree(FGlobalLinks,Dependency);
|
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;
|
end;
|
||||||
|
|
||||||
function TPackageLinks.FindLinkWithPackageID(APackageID: TLazPackageID
|
function TPackageLinks.FindLinkWithPackageID(APackageID: TLazPackageID
|
||||||
|
@ -2196,7 +2196,9 @@ begin
|
|||||||
PkgLinks.RemoveLink(PkgLink);
|
PkgLinks.RemoveLink(PkgLink);
|
||||||
until false;
|
until false;
|
||||||
end else begin
|
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;
|
||||||
end;
|
end;
|
||||||
fChanged:=true;
|
fChanged:=true;
|
||||||
|
@ -111,6 +111,9 @@ type
|
|||||||
procedure PackageGraphEndUpdate(Sender: TObject; GraphChanged: boolean);
|
procedure PackageGraphEndUpdate(Sender: TObject; GraphChanged: boolean);
|
||||||
procedure PackageGraphFindFPCUnit(const UnitName, Directory: string;
|
procedure PackageGraphFindFPCUnit(const UnitName, Directory: string;
|
||||||
var Filename: string);
|
var Filename: string);
|
||||||
|
// package links
|
||||||
|
function PkgLinksDependencyOwnerGetPkgFilename(PkgLinks: TPackageLinks;
|
||||||
|
Dependency: TPkgDependency): boolean;
|
||||||
|
|
||||||
// menu
|
// menu
|
||||||
procedure MainIDEitmPkgOpenPackageFileClick(Sender: TObject);
|
procedure MainIDEitmPkgOpenPackageFileClick(Sender: TObject);
|
||||||
@ -632,6 +635,14 @@ begin
|
|||||||
Result:=DoUninstallPackage(APackage);
|
Result:=DoUninstallPackage(APackage);
|
||||||
end;
|
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);
|
procedure TPkgManager.mnuConfigCustomCompsClicked(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
ShowConfigureCustomComponents;
|
ShowConfigureCustomComponents;
|
||||||
@ -1577,6 +1588,7 @@ begin
|
|||||||
// package links
|
// package links
|
||||||
PkgLinks:=TPackageLinks.Create;
|
PkgLinks:=TPackageLinks.Create;
|
||||||
PkgLinks.UpdateAll;
|
PkgLinks.UpdateAll;
|
||||||
|
PkgLinks.DependencyOwnerGetPkgFilename:=@PkgLinksDependencyOwnerGetPkgFilename;
|
||||||
|
|
||||||
// package graph
|
// package graph
|
||||||
PackageGraph:=TLazPackageGraph.Create;
|
PackageGraph:=TLazPackageGraph.Create;
|
||||||
|
Loading…
Reference in New Issue
Block a user