1 {
2  ***************************************************************************
3  *                                                                         *
4  *   This source is free software; you can redistribute it and/or modify   *
5  *   it under the terms of the GNU General Public License as published by  *
6  *   the Free Software Foundation; either version 2 of the License, or     *
7  *   (at your option) any later version.                                   *
8  *                                                                         *
9  *   This code is distributed in the hope that it will be useful, but      *
10  *   WITHOUT ANY WARRANTY; without even the implied warranty of            *
11  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *
12  *   General Public License for more details.                              *
13  *                                                                         *
14  *   A copy of the GNU General Public License is available on the World    *
15  *   Wide Web at <http://www.gnu.org/copyleft/gpl.html>. You can also      *
16  *   obtain it by writing to the Free Software Foundation,                 *
17  *   Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1335, USA.   *
18  *                                                                         *
19  ***************************************************************************
20 
21   Author: Juha Manninen
22 
23   Abstract:
24     Define types and an interface needed for editing projects and packages.
25 }
26 unit ProjPackEditing;
27 
28 {$mode objfpc}{$H+}
29 
30 interface
31 
32 uses
33   Classes, SysUtils,
34   // LCL
35   Forms, ComCtrls,
36   // LazControls
37   TreeFilterEdit,
38   // BuildIntf
39   PackageIntf,
40   // IDE
41   PackageDefs;
42 
43 type
44 
45   TPENodeType = (
46     penFile,
47     penDependency
48     );
49 
50   { TPENodeData }
51 
52   TPENodeData = class(TTFENodeData)
53   public
54     Typ: TPENodeType;
55     Name: string; // file or package name
56     Removed: boolean;
57     FileType: TPkgFileType;
58     Next: TPENodeData;
59     constructor Create(aTyp: TPENodeType; aName: string; aRemoved: boolean);
60   end;
61 
62   { IFilesEditorInterface
63     An editor with a TTreeView with files and dependencies }
64 
65   IFilesEditorInterface = interface
FilesEditTreeViewnull66     function FilesEditTreeView: TTreeView;
TVNodeFilesnull67     function TVNodeFiles: TTreeNode;
TVNodeRequiredPackagesnull68     function TVNodeRequiredPackages: TTreeNode;
FilesEditFormnull69     function FilesEditForm: TCustomForm;
FilesOwnernull70     function FilesOwner: TObject; // TProject or TLazPackage
FilesOwnerNamenull71     function FilesOwnerName: string; // for debugging purposes
72     procedure BeginUpdate;
73     procedure EndUpdate;
GetNodeDataItemnull74     function GetNodeDataItem(TVNode: TTreeNode; out NodeData: TPENodeData;
75       out Item: TObject): boolean;
GetNodeFilenamenull76     function GetNodeFilename(Node: TTreeNode): string;
IsDirectoryNodenull77     function IsDirectoryNode(Node: TTreeNode): boolean;
FilesBaseDirectorynull78     function FilesBaseDirectory: string;
FilesOwnerReadOnlynull79     function FilesOwnerReadOnly: boolean;
FirstRequiredDependencynull80     function FirstRequiredDependency: TPkgDependency;
ExtendUnitSearchPathnull81     function ExtendUnitSearchPath(NewUnitPaths: string): boolean;
ExtendIncSearchPathnull82     function ExtendIncSearchPath(NewIncPaths: string): boolean;
83     procedure UpdateAll(Immediately: boolean = false);
84   end;
85 
86   TPEFlag = (
87     pefNeedUpdateTitle,
88     pefNeedUpdateFiles,
89     pefNeedUpdateRemovedFiles,
90     pefNeedUpdateRequiredPkgs,
91     pefNeedUpdateProperties,
92     pefNeedUpdateButtons,
93     pefNeedUpdateApplyDependencyButton,
94     pefNeedUpdateStatusBar
95     );
96   TPEFlags = set of TPEFlag;
97 
98 
99 implementation
100 
101 { TPENodeData }
102 
103 constructor TPENodeData.Create(aTyp: TPENodeType; aName: string; aRemoved: boolean);
104 begin
105   Typ:=aTyp;
106   Name:=aName;
107   Removed:=aRemoved;
108 end;
109 
110 end.
111 
112