Packager: Move stuff related to editing projects and packages into a new unit ProjPackEditing.

git-svn-id: trunk@63944 -
This commit is contained in:
juha 2020-10-03 00:07:10 +00:00
parent 487e62d70d
commit f56f6b1a5d
6 changed files with 141 additions and 85 deletions

1
.gitattributes vendored
View File

@ -11294,6 +11294,7 @@ packager/pkgregisterbase.pas svneol=native#text/pascal
packager/pkgvirtualuniteditor.pas svneol=native#text/pascal
packager/projpackchecks.pas svneol=native#text/pascal
packager/projpackcommon.pas svneol=native#text/pascal
packager/projpackediting.pas svneol=native#text/pascal
packager/projpackfilepropgui.pas svneol=native#text/pascal
packager/registration/Makefile.compiled svneol=native#text/plain
packager/registration/README.txt svneol=native#text/plain

View File

@ -57,17 +57,21 @@ interface
uses
Classes, SysUtils,
// LCL
LCLProc, LCLType, LCLIntf, Forms, Controls, Buttons, ComCtrls,
Menus, Dialogs, FileUtil, LazFileUtils, LazFileCache, ExtCtrls, Graphics,
LCLType, LCLIntf, Forms, Controls, Buttons, ComCtrls, Menus, Dialogs,
ExtCtrls, StdCtrls, Graphics,
// LazControls
TreeFilterEdit,
// LazUtils
FileUtil, LazFileUtils, LazUtilities, LazTracer, LazFileCache,
// BuildIntf
ProjectIntf, PackageIntf, PackageLinkIntf, PackageDependencyIntf,
// IDEIntf
IDEHelpIntf, IDECommands, IDEDialogs, IDEImagesIntf, LazIDEIntf, ProjectIntf,
PackageIntf, PackageLinkIntf, MainIntf,
IDEHelpIntf, IDECommands, IDEDialogs, IDEImagesIntf, LazIDEIntf,
// IDE
LazarusIDEStrConsts, IDEProcs, DialogProcs, IDEOptionDefs, EnvironmentOpts,
PackageDefs, Project, PackageEditor, AddToProjectDlg, AddPkgDependencyDlg,
InputHistory, MainBase, ProjPackChecks, PackageLinks, AddFPMakeDependencyDlg;
LazarusIDEStrConsts, MainIntf, IDEProcs, DialogProcs, IDEOptionDefs,
PackageDefs, Project, InputHistory, MainBase, EnvironmentOpts,
AddToProjectDlg, AddPkgDependencyDlg, AddFPMakeDependencyDlg,
ProjPackChecks, ProjPackEditing, ProjPackFilePropGui, PackageLinks;
type
TOnAddUnitToProject =

View File

@ -37,18 +37,20 @@ uses
// LCL
Forms, Controls, StdCtrls, ComCtrls, Buttons, Graphics, Menus, Dialogs,
ExtCtrls, ImgList, LCLType, LCLIntf,
// LazControls
TreeFilterEdit,
// LazUtils
FileUtil, LazFileUtils, LazFileCache, AvgLvlTree, LazLoggerBase, LazTracer,
// BuildIntf
ProjectIntf, PackageDependencyIntf, PackageIntf, IDEOptionsIntf, NewItemIntf,
// IDEIntf
IDEImagesIntf, MenuIntf, LazIDEIntf, ProjectIntf,
FormEditingIntf, PackageDependencyIntf, PackageIntf, IDEHelpIntf, IDEOptionsIntf,
NewItemIntf, IDEWindowIntf, IDEDialogs, ComponentReg, IDEOptEditorIntf,
IDEImagesIntf, MenuIntf, LazIDEIntf, FormEditingIntf, IDEHelpIntf,
IDEWindowIntf, IDEDialogs, ComponentReg, IDEOptEditorIntf,
// IDE
MainBase, IDEProcs, LazarusIDEStrConsts, IDEDefs, CompilerOptions,
EnvironmentOpts, DialogProcs, InputHistory, PackageDefs, AddToPackageDlg,
MainBase, IDEProcs, DialogProcs, LazarusIDEStrConsts, IDEDefs, CompilerOptions,
EnvironmentOpts, InputHistory, PackageSystem, PackageDefs, AddToPackageDlg,
AddPkgDependencyDlg, AddFPMakeDependencyDlg, ProjPackChecks, PkgVirtualUnitEditor,
MissingPkgFilesDlg, PackageSystem, CleanPkgDeps, ProjPackFilePropGui;
MissingPkgFilesDlg, CleanPkgDeps, ProjPackFilePropGui, ProjPackEditing;
const
PackageEditorMenuRootName = 'PackageEditor';
@ -128,61 +130,6 @@ type
function(Sender: TObject; APackage: TLazPackage;
SaveAs: boolean): TModalResult of object;
TPENodeType = (
penFile,
penDependency
);
{ TPENodeData }
TPENodeData = class(TTFENodeData)
public
Typ: TPENodeType;
Name: string; // file or package name
Removed: boolean;
FileType: TPkgFileType;
Next: TPENodeData;
constructor Create(aTyp: TPENodeType; aName: string; aRemoved: boolean);
end;
{ IFilesEditorInterface
An editor with a TTreeView with files and dependencies }
IFilesEditorInterface = interface
function FilesEditTreeView: TTreeView;
function TVNodeFiles: TTreeNode;
function TVNodeRequiredPackages: TTreeNode;
function FilesEditForm: TCustomForm;
function FilesOwner: TObject; // TProject or TLazPackage
function FilesOwnerName: string; // for debugging purposes
procedure BeginUpdate;
procedure EndUpdate;
function GetNodeData(TVNode: TTreeNode): TPENodeData;
function GetNodeItem(NodeData: TPENodeData): TObject;
function GetNodeDataItem(TVNode: TTreeNode; out NodeData: TPENodeData;
out Item: TObject): boolean;
function GetNodeFilename(Node: TTreeNode): string;
function IsDirectoryNode(Node: TTreeNode): boolean;
function FilesBaseDirectory: string;
function FilesOwnerReadOnly: boolean;
function FirstRequiredDependency: TPkgDependency;
function ExtendUnitSearchPath(NewUnitPaths: string): boolean;
function ExtendIncSearchPath(NewIncPaths: string): boolean;
procedure UpdateAll(Immediately: boolean = false);
end;
TPEFlag = (
pefNeedUpdateTitle,
pefNeedUpdateFiles,
pefNeedUpdateRemovedFiles,
pefNeedUpdateRequiredPkgs,
pefNeedUpdateProperties,
pefNeedUpdateButtons,
pefNeedUpdateApplyDependencyButton,
pefNeedUpdateStatusBar
);
TPEFlags = set of TPEFlag;
TIDEPackageOptsDlgAction = (
iodaRead,
iodaWrite,
@ -660,15 +607,6 @@ begin
Result:=Result+' '+lisPckEditFPMakePackage;
end;
{ TPENodeData }
constructor TPENodeData.Create(aTyp: TPENodeType; aName: string; aRemoved: boolean);
begin
Typ:=aTyp;
Name:=aName;
Removed:=aRemoved;
end;
{ TPackageEditorForm }
procedure TPackageEditorForm.PublishClick(Sender: TObject);

View File

@ -47,7 +47,7 @@ uses
LazTracer, LazUtilities, AvgLvlTree,
// Codetools
FileProcs, CodeToolManager,
// IdeIntf
// BuildIntf
PackageDependencyIntf, PackageLinkIntf, PackageIntf, MacroIntf,
// IDE
IDEProcs, EnvironmentOpts, LazConf, IDECmdLine, PackageDefs;

View File

@ -56,14 +56,15 @@ uses
// Codetools
CodeToolsConfig, CodeToolManager, CodeCache, BasicCodeTools,
FileProcs, CodeTree, CTUnitGraph,
// IDE Interface
IDECommands, NewItemIntf, ProjPackIntf, ProjectIntf, PackageIntf,
PackageDependencyIntf, PackageLinkIntf, CompOptsIntf, MenuIntf, IDEWindowIntf,
IDEExternToolIntf, MacroIntf, LazIDEIntf, IDEMsgIntf, SrcEditorIntf,
// BuildIntf
ProjPackIntf, ProjectIntf, PackageIntf, PackageDependencyIntf, PackageLinkIntf,
NewItemIntf, CompOptsIntf, IDEExternToolIntf, MacroIntf,
// IdeIntf
IDECommands, MenuIntf, IDEWindowIntf, LazIDEIntf, IDEMsgIntf, SrcEditorIntf,
ComponentReg, ComponentEditors, PropEdits, IDEDialogs, UnitResources,
// IDE
IDECmdLine, LazarusIDEStrConsts, IDEProcs, DialogProcs, IDEOptionDefs,
EnvironmentOpts, MiscOptions, InputHistory, Project, PackageEditor,
EnvironmentOpts, MiscOptions, InputHistory, Project, ProjPackEditing, PackageEditor,
AddToPackageDlg, PackageDefs, PackageLinks, PackageSystem, OpenInstalledPkgDlg,
PkgGraphExplorer, BrokenDependenciesDlg, CompilerOptions, IDETranslations,
TransferMacros, BuildLazDialog, NewDialog, FindInFilesDlg, ProjectInspector,
@ -99,8 +100,7 @@ type
procedure PackageEditorDragDropTreeView(Sender, Source: TObject; X, Y: Integer);
function PackageEditorDragOverTreeView(Sender, Source: TObject; X, Y: Integer;
out TargetTVNode: TTreeNode; out TargetTVType: TTreeViewInsertMarkType): boolean;
function PackageEditorFindInFiles(Sender: TObject; APackage: TLazPackage
): TModalResult;
function PackageEditorFindInFiles(Sender: TObject; APackage: TLazPackage): TModalResult;
function PackageEditorInstallPackage(Sender: TObject;
APackage: TLazPackage): TModalResult;
function PackageEditorOpenPackage(Sender: TObject; APackage: TLazPackage): TModalResult;

View File

@ -0,0 +1,113 @@
{
***************************************************************************
* *
* This source is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This code 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. See the GNU *
* General Public License for more details. *
* *
* A copy of the GNU General Public License is available on the World *
* Wide Web at <http://www.gnu.org/copyleft/gpl.html>. You can also *
* obtain it by writing to the Free Software Foundation, *
* Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1335, USA. *
* *
***************************************************************************
Author: Juha Manninen
Abstract:
Define types and an interface needed for editing projects and packages.
}
unit ProjPackEditing;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils,
// LCL
Forms, ComCtrls,
// LazControls
TreeFilterEdit,
// BuildIntf
PackageIntf,
// IDE
PackageDefs;
type
TPENodeType = (
penFile,
penDependency
);
{ TPENodeData }
TPENodeData = class(TTFENodeData)
public
Typ: TPENodeType;
Name: string; // file or package name
Removed: boolean;
FileType: TPkgFileType;
Next: TPENodeData;
constructor Create(aTyp: TPENodeType; aName: string; aRemoved: boolean);
end;
{ IFilesEditorInterface
An editor with a TTreeView with files and dependencies }
IFilesEditorInterface = interface
function FilesEditTreeView: TTreeView;
function TVNodeFiles: TTreeNode;
function TVNodeRequiredPackages: TTreeNode;
function FilesEditForm: TCustomForm;
function FilesOwner: TObject; // TProject or TLazPackage
function FilesOwnerName: string; // for debugging purposes
procedure BeginUpdate;
procedure EndUpdate;
function GetNodeData(TVNode: TTreeNode): TPENodeData;
function GetNodeItem(NodeData: TPENodeData): TObject;
function GetNodeDataItem(TVNode: TTreeNode; out NodeData: TPENodeData;
out Item: TObject): boolean;
function GetNodeFilename(Node: TTreeNode): string;
function IsDirectoryNode(Node: TTreeNode): boolean;
function FilesBaseDirectory: string;
function FilesOwnerReadOnly: boolean;
function FirstRequiredDependency: TPkgDependency;
function ExtendUnitSearchPath(NewUnitPaths: string): boolean;
function ExtendIncSearchPath(NewIncPaths: string): boolean;
procedure UpdateAll(Immediately: boolean = false);
end;
TPEFlag = (
pefNeedUpdateTitle,
pefNeedUpdateFiles,
pefNeedUpdateRemovedFiles,
pefNeedUpdateRequiredPkgs,
pefNeedUpdateProperties,
pefNeedUpdateButtons,
pefNeedUpdateApplyDependencyButton,
pefNeedUpdateStatusBar
);
TPEFlags = set of TPEFlag;
implementation
{ TPENodeData }
constructor TPENodeData.Create(aTyp: TPENodeType; aName: string; aRemoved: boolean);
begin
Typ:=aTyp;
Name:=aName;
Removed:=aRemoved;
end;
end.