mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-30 23:30:30 +02:00
Merged revision(s) 50839 #9e35d2c52c from trunk:
Packager: Update search paths after "Add Active File To Package". Issue #27720. ........ git-svn-id: branches/fixes_1_6@50971 -
This commit is contained in:
parent
cf117df75d
commit
b30da44735
@ -4284,9 +4284,6 @@ resourcestring
|
|||||||
lisAF2PPackageNotFound = 'Package "%s" not found.';
|
lisAF2PPackageNotFound = 'Package "%s" not found.';
|
||||||
lisAF2PPackageIsReadOnly = 'Package is read only';
|
lisAF2PPackageIsReadOnly = 'Package is read only';
|
||||||
lisAF2PThePackageIsReadOnly = 'The package %s is read only.';
|
lisAF2PThePackageIsReadOnly = 'The package %s is read only.';
|
||||||
lisAF2PTheFileIsAlreadyInThePackage = 'The file "%s"%sis already in the package %s.';
|
|
||||||
lisAF2PUnitName = 'Unit name: ';
|
|
||||||
lisAF2PHasRegisterProcedure = 'Has Register procedure';
|
|
||||||
lisAF2PFileType = 'File type';
|
lisAF2PFileType = 'File type';
|
||||||
lisPEExpandDirectory = 'Expand directory';
|
lisPEExpandDirectory = 'Expand directory';
|
||||||
lisPECollapseDirectory = 'Collapse directory';
|
lisPECollapseDirectory = 'Collapse directory';
|
||||||
|
@ -59,9 +59,13 @@ uses
|
|||||||
{$IFDEF IDE_MEM_CHECK}
|
{$IFDEF IDE_MEM_CHECK}
|
||||||
MemCheck,
|
MemCheck,
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
Classes, LCLType, LCLIntf, Buttons, Menus, SysUtils,
|
Classes, SysUtils, typinfo, AVL_Tree,
|
||||||
typinfo, Controls, Graphics, ExtCtrls, Dialogs, FileUtil, Forms,
|
LCLType, LCLIntf, Buttons, Menus, Controls, Graphics, ExtCtrls, Dialogs, Forms,
|
||||||
LazFileUtils, CodeToolManager, CodeCache, AVL_Tree, SynEditKeyCmds,
|
SynEditKeyCmds,
|
||||||
|
// Codetools
|
||||||
|
CodeToolManager, CodeCache,
|
||||||
|
// LazUtils
|
||||||
|
FileUtil, LazFileUtils,
|
||||||
// IDEIntf
|
// IDEIntf
|
||||||
PropEdits, ObjectInspector, MenuIntf, SrcEditorIntf, ProjectIntf,
|
PropEdits, ObjectInspector, MenuIntf, SrcEditorIntf, ProjectIntf,
|
||||||
CompOptsIntf, LazIDEIntf, IDEDialogs, IDEWindowIntf,
|
CompOptsIntf, LazIDEIntf, IDEDialogs, IDEWindowIntf,
|
||||||
|
@ -1,69 +1,31 @@
|
|||||||
object AddFileToAPackageDialog: TAddFileToAPackageDialog
|
object AddFileToAPackageDialog: TAddFileToAPackageDialog
|
||||||
Left = 347
|
Left = 408
|
||||||
Height = 424
|
Height = 272
|
||||||
Top = 221
|
Top = 224
|
||||||
Width = 469
|
Width = 469
|
||||||
ActiveControl = FileNameEdit
|
ActiveControl = FileNameEdit
|
||||||
Caption = 'AddFileToAPackageDialog'
|
Caption = 'AddFileToAPackageDialog'
|
||||||
ClientHeight = 424
|
ClientHeight = 272
|
||||||
ClientWidth = 469
|
ClientWidth = 469
|
||||||
OnClose = AddFileToAPackageDlgClose
|
OnClose = AddFileToAPackageDlgClose
|
||||||
Position = poScreenCenter
|
Position = poScreenCenter
|
||||||
ShowHint = True
|
ShowHint = True
|
||||||
LCLVersion = '0.9.29'
|
LCLVersion = '1.7'
|
||||||
object FileGroupBox: TGroupBox
|
object FileGroupBox: TGroupBox
|
||||||
Left = 6
|
Left = 6
|
||||||
Height = 148
|
Height = 58
|
||||||
Top = 6
|
Top = 6
|
||||||
Width = 457
|
Width = 457
|
||||||
Align = alTop
|
Align = alTop
|
||||||
AutoSize = True
|
AutoSize = True
|
||||||
BorderSpacing.Around = 6
|
BorderSpacing.Around = 6
|
||||||
Caption = 'FileGroupBox'
|
Caption = 'FileGroupBox'
|
||||||
ClientHeight = 130
|
ClientHeight = 39
|
||||||
ClientWidth = 453
|
ClientWidth = 453
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
object UnitNameLabel: TLabel
|
|
||||||
AnchorSideTop.Control = FileNameEdit
|
|
||||||
AnchorSideTop.Side = asrBottom
|
|
||||||
Left = 6
|
|
||||||
Height = 14
|
|
||||||
Top = 33
|
|
||||||
Width = 439
|
|
||||||
Anchors = [akTop, akLeft, akRight]
|
|
||||||
BorderSpacing.Left = 6
|
|
||||||
BorderSpacing.Top = 6
|
|
||||||
BorderSpacing.Right = 6
|
|
||||||
Caption = 'UnitNameLabel'
|
|
||||||
ParentColor = False
|
|
||||||
end
|
|
||||||
object FileTypeRadioGroup: TRadioGroup
|
|
||||||
AnchorSideTop.Control = HasRegisterProcCheckBox
|
|
||||||
AnchorSideTop.Side = asrBottom
|
|
||||||
Left = 6
|
|
||||||
Height = 25
|
|
||||||
Top = 99
|
|
||||||
Width = 439
|
|
||||||
Anchors = [akTop, akLeft, akRight]
|
|
||||||
AutoFill = True
|
|
||||||
AutoSize = True
|
|
||||||
BorderSpacing.Around = 6
|
|
||||||
Caption = 'FileTypeRadioGroup'
|
|
||||||
ChildSizing.LeftRightSpacing = 6
|
|
||||||
ChildSizing.TopBottomSpacing = 6
|
|
||||||
ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
|
|
||||||
ChildSizing.EnlargeVertical = crsHomogenousChildResize
|
|
||||||
ChildSizing.ShrinkHorizontal = crsScaleChilds
|
|
||||||
ChildSizing.ShrinkVertical = crsScaleChilds
|
|
||||||
ChildSizing.Layout = cclLeftToRightThenTopToBottom
|
|
||||||
ChildSizing.ControlsPerLine = 1
|
|
||||||
Constraints.MinHeight = 25
|
|
||||||
TabOrder = 3
|
|
||||||
TabStop = True
|
|
||||||
end
|
|
||||||
object FileNameEdit: TEdit
|
object FileNameEdit: TEdit
|
||||||
Left = 6
|
Left = 6
|
||||||
Height = 21
|
Height = 27
|
||||||
Top = 6
|
Top = 6
|
||||||
Width = 439
|
Width = 439
|
||||||
Anchors = [akTop, akLeft, akRight]
|
Anchors = [akTop, akLeft, akRight]
|
||||||
@ -72,59 +34,35 @@ object AddFileToAPackageDialog: TAddFileToAPackageDialog
|
|||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
Text = 'FileNameEdit'
|
Text = 'FileNameEdit'
|
||||||
end
|
end
|
||||||
object UnitNameEdit: TEdit
|
|
||||||
AnchorSideTop.Control = UnitNameLabel
|
|
||||||
AnchorSideTop.Side = asrBottom
|
|
||||||
Left = 6
|
|
||||||
Height = 21
|
|
||||||
Top = 49
|
|
||||||
Width = 439
|
|
||||||
Anchors = [akTop, akLeft, akRight]
|
|
||||||
BorderSpacing.Top = 2
|
|
||||||
TabOrder = 1
|
|
||||||
Text = 'UnitNameEdit'
|
|
||||||
end
|
|
||||||
object HasRegisterProcCheckBox: TCheckBox
|
|
||||||
AnchorSideTop.Control = UnitNameEdit
|
|
||||||
AnchorSideTop.Side = asrBottom
|
|
||||||
Left = 6
|
|
||||||
Height = 17
|
|
||||||
Top = 76
|
|
||||||
Width = 439
|
|
||||||
Anchors = [akTop, akLeft, akRight]
|
|
||||||
BorderSpacing.Top = 6
|
|
||||||
Caption = 'HasRegisterProcCheckBox'
|
|
||||||
TabOrder = 2
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
object PackagesGroupBox: TGroupBox
|
object PackagesGroupBox: TGroupBox
|
||||||
Left = 6
|
Left = 6
|
||||||
Height = 74
|
Height = 85
|
||||||
Top = 160
|
Top = 70
|
||||||
Width = 457
|
Width = 457
|
||||||
Align = alTop
|
Align = alTop
|
||||||
Anchors = [akLeft, akRight]
|
Anchors = [akLeft, akRight]
|
||||||
AutoSize = True
|
AutoSize = True
|
||||||
BorderSpacing.Around = 6
|
BorderSpacing.Around = 6
|
||||||
Caption = 'PackagesGroupBox'
|
Caption = 'PackagesGroupBox'
|
||||||
ClientHeight = 56
|
ClientHeight = 66
|
||||||
ClientWidth = 453
|
ClientWidth = 453
|
||||||
TabOrder = 1
|
TabOrder = 1
|
||||||
object PackagesComboBox: TComboBox
|
object PackagesComboBox: TComboBox
|
||||||
Left = 6
|
Left = 6
|
||||||
Height = 21
|
Height = 27
|
||||||
Top = 6
|
Top = 6
|
||||||
Width = 441
|
Width = 441
|
||||||
Align = alTop
|
Align = alTop
|
||||||
BorderSpacing.Around = 6
|
BorderSpacing.Around = 6
|
||||||
ItemHeight = 13
|
ItemHeight = 0
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
Text = 'PackagesComboBox'
|
Text = 'PackagesComboBox'
|
||||||
end
|
end
|
||||||
object ShowAllCheckBox: TCheckBox
|
object ShowAllCheckBox: TCheckBox
|
||||||
Left = 6
|
Left = 6
|
||||||
Height = 17
|
Height = 21
|
||||||
Top = 33
|
Top = 39
|
||||||
Width = 441
|
Width = 441
|
||||||
Align = alTop
|
Align = alTop
|
||||||
BorderSpacing.Around = 6
|
BorderSpacing.Around = 6
|
||||||
@ -135,9 +73,17 @@ object AddFileToAPackageDialog: TAddFileToAPackageDialog
|
|||||||
end
|
end
|
||||||
object BtnPanel: TButtonPanel
|
object BtnPanel: TButtonPanel
|
||||||
Left = 6
|
Left = 6
|
||||||
Height = 26
|
Height = 32
|
||||||
Top = 392
|
Top = 234
|
||||||
Width = 457
|
Width = 457
|
||||||
|
OKButton.Name = 'OKButton'
|
||||||
|
OKButton.DefaultCaption = True
|
||||||
|
HelpButton.Name = 'HelpButton'
|
||||||
|
HelpButton.DefaultCaption = True
|
||||||
|
CloseButton.Name = 'CloseButton'
|
||||||
|
CloseButton.DefaultCaption = True
|
||||||
|
CancelButton.Name = 'CancelButton'
|
||||||
|
CancelButton.DefaultCaption = True
|
||||||
TabOrder = 2
|
TabOrder = 2
|
||||||
ShowButtons = [pbOK, pbCancel, pbHelp]
|
ShowButtons = [pbOK, pbCancel, pbHelp]
|
||||||
ShowBevel = False
|
ShowBevel = False
|
||||||
|
@ -51,13 +51,9 @@ type
|
|||||||
|
|
||||||
TAddFileToAPackageDialog = class(TForm)
|
TAddFileToAPackageDialog = class(TForm)
|
||||||
BtnPanel: TButtonPanel;
|
BtnPanel: TButtonPanel;
|
||||||
HasRegisterProcCheckBox: TCheckBox;
|
|
||||||
FileTypeRadioGroup: TRadioGroup;
|
|
||||||
UnitNameEdit: TEdit;
|
|
||||||
FileNameEdit: TEdit;
|
FileNameEdit: TEdit;
|
||||||
FileGroupBox: TGroupBox;
|
FileGroupBox: TGroupBox;
|
||||||
PackagesGroupBox: TGroupBox;
|
PackagesGroupBox: TGroupBox;
|
||||||
UnitNameLabel: TLabel;
|
|
||||||
PackagesComboBox: TComboBox;
|
PackagesComboBox: TComboBox;
|
||||||
ShowAllCheckBox: TCheckBox;
|
ShowAllCheckBox: TCheckBox;
|
||||||
procedure AddFileToAPackageDlgClose(Sender: TObject;
|
procedure AddFileToAPackageDlgClose(Sender: TObject;
|
||||||
@ -67,47 +63,31 @@ type
|
|||||||
procedure PackagesGroupBoxResize(Sender: TObject);
|
procedure PackagesGroupBoxResize(Sender: TObject);
|
||||||
procedure ShowAllCheckBoxClick(Sender: TObject);
|
procedure ShowAllCheckBoxClick(Sender: TObject);
|
||||||
private
|
private
|
||||||
FOnGetIDEFileInfo: TGetIDEFileStateEvent;
|
|
||||||
fPackages: TAVLTree;// tree of TLazPackage
|
fPackages: TAVLTree;// tree of TLazPackage
|
||||||
function GetFileType: TPkgFileType;
|
|
||||||
function GetFilename: string;
|
function GetFilename: string;
|
||||||
function GetHasRegisterProc: boolean;
|
|
||||||
function GetUnitName: string;
|
|
||||||
procedure SetFileType(const AValue: TPkgFileType);
|
|
||||||
procedure SetFilename(const AValue: string);
|
procedure SetFilename(const AValue: string);
|
||||||
procedure SetHasRegisterProc(const AValue: boolean);
|
|
||||||
procedure SetUnitName(const AValue: string);
|
|
||||||
procedure SetupComponents;
|
procedure SetupComponents;
|
||||||
public
|
public
|
||||||
constructor Create(TheOwner: TComponent); override;
|
constructor Create(TheOwner: TComponent); override;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
procedure UpdateAvailablePackages;
|
procedure UpdateAvailablePackages;
|
||||||
property Filename: string read GetFilename write SetFilename;
|
property Filename: string read GetFilename write SetFilename;
|
||||||
property Unit_Name: string read GetUnitName write SetUnitName;
|
|
||||||
property FileType: TPkgFileType read GetFileType write SetFileType;
|
|
||||||
property HasRegisterProc: boolean read GetHasRegisterProc write SetHasRegisterProc;
|
|
||||||
property OnGetIDEFileInfo: TGetIDEFileStateEvent read FOnGetIDEFileInfo write FOnGetIDEFileInfo;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
function ShowAddFileToAPackageDlg(const Filename, AUnitName: string;
|
function ShowAddFileToAPackageDlg(const Filename: string): TModalResult;
|
||||||
HasRegisterProc: boolean; OnGetIDEFileInfo: TGetIDEFileStateEvent): TModalResult;
|
|
||||||
|
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
{$R *.lfm}
|
{$R *.lfm}
|
||||||
|
|
||||||
function ShowAddFileToAPackageDlg(const Filename, AUnitName: string;
|
function ShowAddFileToAPackageDlg(const Filename: string): TModalResult;
|
||||||
HasRegisterProc: boolean; OnGetIDEFileInfo: TGetIDEFileStateEvent): TModalResult;
|
|
||||||
var
|
var
|
||||||
AddFileToAPackageDialog: TAddFileToAPackageDialog;
|
AddFileToAPackageDialog: TAddFileToAPackageDialog;
|
||||||
begin
|
begin
|
||||||
AddFileToAPackageDialog:=TAddFileToAPackageDialog.Create(nil);
|
AddFileToAPackageDialog:=TAddFileToAPackageDialog.Create(nil);
|
||||||
AddFileToAPackageDialog.Filename:=Filename;
|
AddFileToAPackageDialog.Filename:=Filename;
|
||||||
AddFileToAPackageDialog.Unit_Name:=AUnitName;
|
|
||||||
AddFileToAPackageDialog.HasRegisterProc:=HasRegisterProc;
|
|
||||||
AddFileToAPackageDialog.OnGetIDEFileInfo:=OnGetIDEFileInfo;
|
|
||||||
AddFileToAPackageDialog.UpdateAvailablePackages;
|
AddFileToAPackageDialog.UpdateAvailablePackages;
|
||||||
Result:=AddFileToAPackageDialog.ShowModal;
|
Result:=AddFileToAPackageDialog.ShowModal;
|
||||||
AddFileToAPackageDialog.Free;
|
AddFileToAPackageDialog.Free;
|
||||||
@ -130,10 +110,8 @@ procedure TAddFileToAPackageDialog.OkButtonClick(Sender: TObject);
|
|||||||
var
|
var
|
||||||
PkgID: TLazPackageID;
|
PkgID: TLazPackageID;
|
||||||
APackage: TLazPackage;
|
APackage: TLazPackage;
|
||||||
PkgFile: TPkgFile;
|
|
||||||
FileFlags: TPkgFileFlags;
|
|
||||||
AddType: TAddToPkgType;
|
|
||||||
aFilename: String;
|
aFilename: String;
|
||||||
|
NewUnitPaths, NewIncPaths: String;
|
||||||
begin
|
begin
|
||||||
aFilename:=Filename;
|
aFilename:=Filename;
|
||||||
PkgID:=TLazPackageID.Create;
|
PkgID:=TLazPackageID.Create;
|
||||||
@ -162,31 +140,14 @@ begin
|
|||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// check if file is already in the package
|
|
||||||
PkgFile:=APackage.FindPkgFile(aFilename,true,false);
|
|
||||||
if PkgFile<>nil then begin
|
|
||||||
MessageDlg(lisPkgMangFileIsAlreadyInPackage,
|
|
||||||
Format(lisAF2PTheFileIsAlreadyInThePackage,[aFilename,LineEnding,APackage.IDAsString]),
|
|
||||||
mtError,[mbCancel],0);
|
|
||||||
exit;
|
|
||||||
end;
|
|
||||||
|
|
||||||
// check filename
|
|
||||||
if FilenameIsPascalSource(aFilename) then
|
|
||||||
AddType:=d2ptUnit
|
|
||||||
else
|
|
||||||
AddType:=d2ptFile;
|
|
||||||
if not CheckAddingUnitFilename(APackage,AddType,
|
|
||||||
OnGetIDEFileInfo,aFilename) then exit;
|
|
||||||
|
|
||||||
// ok -> add file to package
|
// ok -> add file to package
|
||||||
APackage.BeginUpdate;
|
APackage.BeginUpdate;
|
||||||
FileFlags:=[];
|
NewUnitPaths:='';
|
||||||
if FileType in PkgFileUnitTypes then
|
NewIncPaths:='';
|
||||||
Include(FileFlags,pffAddToPkgUsesSection);
|
APackage.AddFileByName(aFilename, NewUnitPaths, NewIncPaths);
|
||||||
if HasRegisterProc then
|
// extend unit and include search path
|
||||||
Include(FileFlags,pffHasRegisterProc);
|
if not APackage.ExtendUnitSearchPath(NewUnitPaths) then exit;
|
||||||
APackage.AddFile(aFilename,Unit_Name,FileType,FileFlags,cpNormal);
|
if not APackage.ExtendIncSearchPath(NewIncPaths) then exit;
|
||||||
if APackage.Editor<>nil then APackage.Editor.UpdateAll(true);
|
if APackage.Editor<>nil then APackage.Editor.UpdateAll(true);
|
||||||
APackage.EndUpdate;
|
APackage.EndUpdate;
|
||||||
|
|
||||||
@ -208,67 +169,21 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TAddFileToAPackageDialog.SetupComponents;
|
procedure TAddFileToAPackageDialog.SetupComponents;
|
||||||
var
|
|
||||||
pft: TPkgFileType;
|
|
||||||
begin
|
begin
|
||||||
FileGroupBox.Caption:=lisFile;
|
FileGroupBox.Caption:=lisFile;
|
||||||
FileNameEdit.Text:='';
|
FileNameEdit.Text:='';
|
||||||
UnitNameLabel.Caption:=lisAF2PUnitName;
|
|
||||||
UnitNameEdit.Text:='';
|
|
||||||
HasRegisterProcCheckBox.Caption:=lisAF2PHasRegisterProcedure;
|
|
||||||
PackagesGroupBox.Caption:=lisAF2PDestinationPackage;
|
PackagesGroupBox.Caption:=lisAF2PDestinationPackage;
|
||||||
ShowAllCheckBox.Caption:=lisAF2PShowAll;
|
ShowAllCheckBox.Caption:=lisAF2PShowAll;
|
||||||
BtnPanel.OkButton.Caption:=lisMenuOk;
|
BtnPanel.OkButton.Caption:=lisMenuOk;
|
||||||
BtnPanel.OkButton.OnClick:=@OkButtonClick;
|
BtnPanel.OkButton.OnClick:=@OkButtonClick;
|
||||||
BtnPanel.OkButton.ModalResult:=mrNone;
|
BtnPanel.OkButton.ModalResult:=mrNone;
|
||||||
BtnPanel.HelpButton.OnClick:=@HelpButtonClick;
|
BtnPanel.HelpButton.OnClick:=@HelpButtonClick;
|
||||||
|
|
||||||
with FileTypeRadioGroup do begin
|
|
||||||
Caption:=lisAF2PFileType;
|
|
||||||
with Items do begin
|
|
||||||
BeginUpdate;
|
|
||||||
for pft:=Low(TPkgFileType) to High(TPkgFileType) do begin
|
|
||||||
if pft in PkgFileUnitTypes then continue;
|
|
||||||
Add(GetPkgFileTypeLocalizedName(pft));
|
|
||||||
end;
|
|
||||||
EndUpdate;
|
|
||||||
end;
|
|
||||||
ItemIndex:=0;
|
|
||||||
Columns:=2;
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TAddFileToAPackageDialog.SetFilename(const AValue: string);
|
procedure TAddFileToAPackageDialog.SetFilename(const AValue: string);
|
||||||
var
|
|
||||||
NewPFT: TPkgFileType;
|
|
||||||
begin
|
begin
|
||||||
if FileNameEdit.Text=AValue then exit;
|
if FileNameEdit.Text=AValue then exit;
|
||||||
FileNameEdit.Text:=AValue;
|
FileNameEdit.Text:=AValue;
|
||||||
if FilenameIsPascalUnit(AValue) then
|
|
||||||
NewPFT:=pftUnit
|
|
||||||
else if CompareFileExt(AValue,'.lfm',true)=0 then
|
|
||||||
NewPFT:=pftLFM
|
|
||||||
else if CompareFileExt(AValue,'.lrs',true)=0 then
|
|
||||||
NewPFT:=pftLRS
|
|
||||||
else if CompareFileExt(AValue,'.inc',true)=0 then
|
|
||||||
NewPFT:=pftInclude
|
|
||||||
else if FileIsText(AValue) then
|
|
||||||
NewPFT:=pftText
|
|
||||||
else
|
|
||||||
NewPFT:=pftBinary;
|
|
||||||
FileType:=NewPFT;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TAddFileToAPackageDialog.SetHasRegisterProc(const AValue: boolean);
|
|
||||||
begin
|
|
||||||
if HasRegisterProc=AValue then exit;
|
|
||||||
HasRegisterProcCheckBox.Checked:=AValue;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TAddFileToAPackageDialog.SetUnitName(const AValue: string);
|
|
||||||
begin
|
|
||||||
if Unit_Name=AValue then exit;
|
|
||||||
UnitNameEdit.Text:=AValue;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TAddFileToAPackageDialog.GetFilename: string;
|
function TAddFileToAPackageDialog.GetFilename: string;
|
||||||
@ -276,62 +191,6 @@ begin
|
|||||||
Result:=FileNameEdit.Text;
|
Result:=FileNameEdit.Text;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TAddFileToAPackageDialog.GetFileType: TPkgFileType;
|
|
||||||
var
|
|
||||||
i: Integer;
|
|
||||||
CurPFT: TPkgFileType;
|
|
||||||
begin
|
|
||||||
if FileTypeRadioGroup.Visible then begin
|
|
||||||
i:=0;
|
|
||||||
for CurPFT:=Low(TPkgFileType) to High(TPkgFileType) do begin
|
|
||||||
if CurPFT in PkgFileUnitTypes then continue;
|
|
||||||
if FileTypeRadioGroup.ItemIndex=i then begin
|
|
||||||
Result:=CurPFT;
|
|
||||||
exit;
|
|
||||||
end;
|
|
||||||
inc(i);
|
|
||||||
end;
|
|
||||||
Result:=pftText;
|
|
||||||
end else begin
|
|
||||||
Result:=pftUnit;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function TAddFileToAPackageDialog.GetHasRegisterProc: boolean;
|
|
||||||
begin
|
|
||||||
Result:=HasRegisterProcCheckBox.Checked;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function TAddFileToAPackageDialog.GetUnitName: string;
|
|
||||||
begin
|
|
||||||
Result:=UnitNameEdit.Text;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TAddFileToAPackageDialog.SetFileType(const AValue: TPkgFileType);
|
|
||||||
var
|
|
||||||
ShowUnitProps: Boolean;
|
|
||||||
i: Integer;
|
|
||||||
CurPFT: TPkgFileType;
|
|
||||||
begin
|
|
||||||
if FileType=AValue then exit;
|
|
||||||
i:=0;
|
|
||||||
for CurPFT:=Low(TPkgFileType) to High(TPkgFileType) do begin
|
|
||||||
if CurPFT in PkgFileUnitTypes then continue;
|
|
||||||
if CurPFT=AValue then break;
|
|
||||||
inc(i);
|
|
||||||
end;
|
|
||||||
if i<FileTypeRadioGroup.Items.Count then
|
|
||||||
FileTypeRadioGroup.ItemIndex:=i
|
|
||||||
else
|
|
||||||
FileTypeRadioGroup.ItemIndex:=-1;
|
|
||||||
|
|
||||||
ShowUnitProps:=(AValue in PkgFileUnitTypes);
|
|
||||||
UnitNameLabel.Visible:=ShowUnitProps;
|
|
||||||
UnitNameEdit.Visible:=ShowUnitProps;
|
|
||||||
HasRegisterProcCheckBox.Visible:=ShowUnitProps;
|
|
||||||
FileTypeRadioGroup.Visible:=not ShowUnitProps;
|
|
||||||
end;
|
|
||||||
|
|
||||||
constructor TAddFileToAPackageDialog.Create(TheOwner: TComponent);
|
constructor TAddFileToAPackageDialog.Create(TheOwner: TComponent);
|
||||||
begin
|
begin
|
||||||
inherited Create(TheOwner);
|
inherited Create(TheOwner);
|
||||||
|
@ -37,14 +37,20 @@ unit PackageDefs;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, contnrs, typinfo, LCLProc, LCLType, LResources, Graphics,
|
// FCL, LCL
|
||||||
Forms, FileProcs, FileUtil, AVL_Tree, LazConfigStorage, Laz2_XMLCfg,
|
Classes, SysUtils, contnrs, typinfo, AVL_Tree,
|
||||||
LazFileUtils, LazFileCache, LazUTF8, BasicCodeTools, CodeToolsCfgScript,
|
LCLProc, LCLType, LResources, Graphics, Controls, Forms, Dialogs,
|
||||||
DefineTemplates, CodeToolManager, CodeCache, CodeToolsStructs, PropEdits,
|
// Codetools
|
||||||
LazIDEIntf, MacroIntf, MacroDefIntf, PackageIntf, IDEOptionsIntf, ProjPackBase,
|
FileProcs, FileUtil, LazConfigStorage, Laz2_XMLCfg, BasicCodeTools,
|
||||||
|
DefineTemplates, CodeToolManager, CodeCache, CodeToolsCfgScript, CodeToolsStructs,
|
||||||
|
// LazUtils
|
||||||
|
LazFileUtils, LazFileCache, LazUTF8,
|
||||||
|
// IDEIntf
|
||||||
|
PropEdits, LazIDEIntf, MacroIntf, MacroDefIntf, PackageIntf, IDEOptionsIntf,
|
||||||
|
ProjPackBase, IDEDialogs, ComponentReg,
|
||||||
|
// IDE
|
||||||
EditDefineTree, CompilerOptions, CompOptsModes, IDEOptionDefs,
|
EditDefineTree, CompilerOptions, CompOptsModes, IDEOptionDefs,
|
||||||
LazarusIDEStrConsts, IDEProcs, ComponentReg, TransferMacros,
|
LazarusIDEStrConsts, IDEProcs, TransferMacros, FileReferenceList, PublishModule;
|
||||||
FileReferenceList, PublishModule;
|
|
||||||
|
|
||||||
type
|
type
|
||||||
TLazPackage = class;
|
TLazPackage = class;
|
||||||
@ -639,6 +645,8 @@ type
|
|||||||
function IsMakingSense: boolean;
|
function IsMakingSense: boolean;
|
||||||
procedure ConsistencyCheck;
|
procedure ConsistencyCheck;
|
||||||
// paths, define templates
|
// paths, define templates
|
||||||
|
function ExtendUnitSearchPath(NewUnitPaths: string): boolean;
|
||||||
|
function ExtendIncSearchPath(NewIncPaths: string): boolean;
|
||||||
function IsVirtual: boolean; override;
|
function IsVirtual: boolean; override;
|
||||||
function HasDirectory: boolean;
|
function HasDirectory: boolean;
|
||||||
function HasStaticDirectory: boolean;
|
function HasStaticDirectory: boolean;
|
||||||
@ -682,6 +690,8 @@ type
|
|||||||
function AddFile(const NewFilename, NewUnitName: string;
|
function AddFile(const NewFilename, NewUnitName: string;
|
||||||
NewFileType: TPkgFileType; NewFlags: TPkgFileFlags;
|
NewFileType: TPkgFileType; NewFlags: TPkgFileFlags;
|
||||||
CompPriorityCat: TComponentPriorityCategory): TPkgFile;
|
CompPriorityCat: TComponentPriorityCategory): TPkgFile;
|
||||||
|
function AddFileByName(aFilename: string;
|
||||||
|
var NewUnitPaths, NewIncPaths: String): Boolean;
|
||||||
function AddRemovedFile(const NewFilename, NewUnitName: string;
|
function AddRemovedFile(const NewFilename, NewUnitName: string;
|
||||||
NewFileType: TPkgFileType; NewFlags: TPkgFileFlags;
|
NewFileType: TPkgFileType; NewFlags: TPkgFileFlags;
|
||||||
CompPriorityCat: TComponentPriorityCategory): TPkgFile;
|
CompPriorityCat: TComponentPriorityCategory): TPkgFile;
|
||||||
@ -3160,6 +3170,50 @@ begin
|
|||||||
CheckList(FComponents,true,true,true);
|
CheckList(FComponents,true,true,true);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TLazPackage.ExtendUnitSearchPath(NewUnitPaths: string): boolean;
|
||||||
|
var
|
||||||
|
CurUnitPaths: String;
|
||||||
|
r: TModalResult;
|
||||||
|
begin
|
||||||
|
CurUnitPaths:=CompilerOptions.ParsedOpts.GetParsedValue(pcosUnitPath);
|
||||||
|
NewUnitPaths:=RemoveSearchPaths(NewUnitPaths,CurUnitPaths);
|
||||||
|
if NewUnitPaths<>'' then begin
|
||||||
|
NewUnitPaths:=CreateRelativeSearchPath(NewUnitPaths,Directory);
|
||||||
|
r:=IDEMessageDialog(lisExtendUnitPath,
|
||||||
|
Format(lisExtendUnitSearchPathOfPackageWith, [Name, #13,
|
||||||
|
NewUnitPaths]), mtConfirmation, [mbYes, mbNo, mbCancel]);
|
||||||
|
case r of
|
||||||
|
mrYes: CompilerOptions.OtherUnitFiles:=
|
||||||
|
MergeSearchPaths(CompilerOptions.OtherUnitFiles,NewUnitPaths);
|
||||||
|
mrNo: ;
|
||||||
|
else exit(false);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
Result:=true;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TLazPackage.ExtendIncSearchPath(NewIncPaths: string): boolean;
|
||||||
|
var
|
||||||
|
CurIncPaths: String;
|
||||||
|
r: TModalResult;
|
||||||
|
begin
|
||||||
|
CurIncPaths:=CompilerOptions.ParsedOpts.GetParsedValue(pcosIncludePath);
|
||||||
|
NewIncPaths:=RemoveSearchPaths(NewIncPaths,CurIncPaths);
|
||||||
|
if NewIncPaths<>'' then begin
|
||||||
|
NewIncPaths:=CreateRelativeSearchPath(NewIncPaths,Directory);
|
||||||
|
r:=IDEMessageDialog(lisExtendIncludePath,
|
||||||
|
Format(lisExtendIncludeFileSearchPathOfPackageWith, [Name, #13,
|
||||||
|
NewIncPaths]), mtConfirmation, [mbYes, mbNo, mbCancel]);
|
||||||
|
case r of
|
||||||
|
mrYes: CompilerOptions.IncludePath:=
|
||||||
|
MergeSearchPaths(CompilerOptions.IncludePath,NewIncPaths);
|
||||||
|
mrNo: ;
|
||||||
|
else exit(false);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
Result:=true;
|
||||||
|
end;
|
||||||
|
|
||||||
function TLazPackage.IndexOfPkgComponent(PkgComponent: TPkgComponent): integer;
|
function TLazPackage.IndexOfPkgComponent(PkgComponent: TPkgComponent): integer;
|
||||||
begin
|
begin
|
||||||
Result:=FComponents.IndexOf(PkgComponent);
|
Result:=FComponents.IndexOf(PkgComponent);
|
||||||
@ -3358,6 +3412,44 @@ begin
|
|||||||
Modified:=true;
|
Modified:=true;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TLazPackage.AddFileByName(aFilename: string;
|
||||||
|
var NewUnitPaths, NewIncPaths: String): Boolean;
|
||||||
|
var
|
||||||
|
NewFileType: TPkgFileType;
|
||||||
|
NewUnitName: String;
|
||||||
|
HasRegister: Boolean;
|
||||||
|
NewFlags: TPkgFileFlags;
|
||||||
|
Code: TCodeBuffer;
|
||||||
|
CurDir: String;
|
||||||
|
begin
|
||||||
|
Result := True;
|
||||||
|
aFilename:=CleanAndExpandFilename(aFileName);
|
||||||
|
if not FileExistsUTF8(aFilename) then Exit(False);
|
||||||
|
if DirPathExists(aFilename) then Exit(False);
|
||||||
|
if FindPkgFile(aFilename,true,false)<>nil then Exit(False);
|
||||||
|
NewFileType:=FileNameToPkgFileType(aFilename);
|
||||||
|
NewFlags:=[];
|
||||||
|
HasRegister:=false;
|
||||||
|
NewUnitName:='';
|
||||||
|
if (NewFileType=pftUnit) then begin
|
||||||
|
Code:=CodeToolBoss.LoadFile(aFilename,true,false);
|
||||||
|
NewUnitName:=CodeToolBoss.GetSourceName(Code,false);
|
||||||
|
if NewUnitName='' then
|
||||||
|
NewUnitName:=ExtractFileNameOnly(aFilename);
|
||||||
|
if FindUsedUnit(NewUnitName)=nil then
|
||||||
|
Include(NewFlags,pffAddToPkgUsesSection);
|
||||||
|
CodeToolBoss.HasInterfaceRegisterProc(Code,HasRegister);
|
||||||
|
if HasRegister then
|
||||||
|
Include(NewFlags,pffHasRegisterProc);
|
||||||
|
end;
|
||||||
|
AddFile(aFilename,NewUnitName,NewFileType,NewFlags,cpNormal);
|
||||||
|
CurDir:=ChompPathDelim(ExtractFilePath(aFilename));
|
||||||
|
if NewFileType=pftUnit then
|
||||||
|
NewUnitPaths:=MergeSearchPaths(NewUnitPaths,CurDir)
|
||||||
|
else
|
||||||
|
NewIncPaths:=MergeSearchPaths(NewIncPaths,CurDir);
|
||||||
|
end;
|
||||||
|
|
||||||
function TLazPackage.AddRemovedFile(const NewFilename, NewUnitName: string;
|
function TLazPackage.AddRemovedFile(const NewFilename, NewUnitName: string;
|
||||||
NewFileType: TPkgFileType; NewFlags: TPkgFileFlags;
|
NewFileType: TPkgFileType; NewFlags: TPkgFileFlags;
|
||||||
CompPriorityCat: TComponentPriorityCategory): TPkgFile;
|
CompPriorityCat: TComponentPriorityCategory): TPkgFile;
|
||||||
|
@ -320,7 +320,6 @@ type
|
|||||||
FFirstNodeData: array[TPENodeType] of TPENodeData;
|
FFirstNodeData: array[TPENodeType] of TPENodeData;
|
||||||
fUpdateLock: integer;
|
fUpdateLock: integer;
|
||||||
fForcedFlags: TPEFlags;
|
fForcedFlags: TPEFlags;
|
||||||
function AddOneFile(aFilename: string; var NewUnitPaths, NewIncPaths: String): TModalResult;
|
|
||||||
procedure DoAddNewFile(NewItem: TNewIDEItemTemplate);
|
procedure DoAddNewFile(NewItem: TNewIDEItemTemplate);
|
||||||
procedure FreeNodeData(Typ: TPENodeType);
|
procedure FreeNodeData(Typ: TPENodeType);
|
||||||
function CreateNodeData(Typ: TPENodeType; aName: string; aRemoved: boolean): TPENodeData;
|
function CreateNodeData(Typ: TPENodeType; aName: string; aRemoved: boolean): TPENodeData;
|
||||||
@ -1456,11 +1455,11 @@ begin
|
|||||||
NewUnitPaths:='';
|
NewUnitPaths:='';
|
||||||
NewIncPaths:='';
|
NewIncPaths:='';
|
||||||
for i:=0 to high(Filenames) do
|
for i:=0 to high(Filenames) do
|
||||||
if not (AddOneFile(FileNames[i], NewUnitPaths, NewIncPaths) in [mrOk, mrIgnore]) then break;
|
LazPackage.AddFileByName(FileNames[i], NewUnitPaths, NewIncPaths);
|
||||||
//UpdateAll(false);
|
//UpdateAll(false);
|
||||||
// extend unit and include search path
|
// extend unit and include search path
|
||||||
if not ExtendUnitSearchPath(NewUnitPaths) then exit;
|
if not LazPackage.ExtendUnitSearchPath(NewUnitPaths) then exit;
|
||||||
if not ExtendIncSearchPath(NewIncPaths) then exit;
|
if not LazPackage.ExtendIncSearchPath(NewIncPaths) then exit;
|
||||||
finally
|
finally
|
||||||
EndUpdate;
|
EndUpdate;
|
||||||
end;
|
end;
|
||||||
@ -1557,47 +1556,6 @@ begin
|
|||||||
DoUseUnitsInDirectory(false);
|
DoUseUnitsInDirectory(false);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TPackageEditorForm.AddOneFile(aFilename: string;
|
|
||||||
var NewUnitPaths, NewIncPaths: String): TModalResult;
|
|
||||||
var
|
|
||||||
NewFileType: TPkgFileType;
|
|
||||||
NewUnitName: String;
|
|
||||||
HasRegister: Boolean;
|
|
||||||
NewFlags: TPkgFileFlags;
|
|
||||||
Code: TCodeBuffer;
|
|
||||||
CurDir: String;
|
|
||||||
begin
|
|
||||||
Result := mrOK;
|
|
||||||
aFilename:=CleanAndExpandFilename(aFileName);
|
|
||||||
if not FileExistsUTF8(aFilename) then Exit(mrIgnore);
|
|
||||||
if DirPathExists(aFilename) then Exit(mrIgnore);
|
|
||||||
if LazPackage.FindPkgFile(aFilename,true,false)<>nil then Exit(mrIgnore);
|
|
||||||
NewFileType:=FileNameToPkgFileType(aFilename);
|
|
||||||
NewFlags:=[];
|
|
||||||
HasRegister:=false;
|
|
||||||
NewUnitName:='';
|
|
||||||
if (NewFileType=pftUnit) then begin
|
|
||||||
Code:=CodeToolBoss.LoadFile(aFilename,true,false);
|
|
||||||
NewUnitName:=CodeToolBoss.GetSourceName(Code,false);
|
|
||||||
if NewUnitName='' then
|
|
||||||
NewUnitName:=ExtractFileNameOnly(aFilename);
|
|
||||||
if LazPackage.FindUsedUnit(NewUnitName)=nil then
|
|
||||||
Include(NewFlags,pffAddToPkgUsesSection);
|
|
||||||
CodeToolBoss.HasInterfaceRegisterProc(Code,HasRegister);
|
|
||||||
if HasRegister then
|
|
||||||
Include(NewFlags,pffHasRegisterProc);
|
|
||||||
end;
|
|
||||||
{$IFDEF VerbosePkgEditDrag}
|
|
||||||
debugln(['TPackageEditorForm.FormDropFiles Adding files: ',aFilename,' Unit=',NewUnitName,' Type=',PkgFileTypeIdents[NewFileType],' use=',pffAddToPkgUsesSection in NewFlags,' hasregister=',pffHasRegisterProc in NewFlags]);
|
|
||||||
{$ENDIF}
|
|
||||||
LazPackage.AddFile(aFilename,NewUnitName,NewFileType,NewFlags,cpNormal);
|
|
||||||
CurDir:=ChompPathDelim(ExtractFilePath(aFilename));
|
|
||||||
if NewFileType=pftUnit then
|
|
||||||
NewUnitPaths:=MergeSearchPaths(NewUnitPaths,CurDir)
|
|
||||||
else
|
|
||||||
NewIncPaths:=MergeSearchPaths(NewIncPaths,CurDir);
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TPackageEditorForm.mnuAddDiskFileClick(Sender: TObject);
|
procedure TPackageEditorForm.mnuAddDiskFileClick(Sender: TObject);
|
||||||
var
|
var
|
||||||
OpenDialog: TOpenDialog;
|
OpenDialog: TOpenDialog;
|
||||||
@ -1619,15 +1577,15 @@ begin
|
|||||||
+'|'+dlgFilterLazarusPackage+' (*.lpk)|*.lpk'
|
+'|'+dlgFilterLazarusPackage+' (*.lpk)|*.lpk'
|
||||||
+'|'+dlgFilterLazarusProjectSource+' (*.lpr)|*.lpr';
|
+'|'+dlgFilterLazarusProjectSource+' (*.lpr)|*.lpr';
|
||||||
if OpenDialog.Execute then begin
|
if OpenDialog.Execute then begin
|
||||||
|
InputHistories.StoreFileDialogSettings(OpenDialog);
|
||||||
NewUnitPaths:='';
|
NewUnitPaths:='';
|
||||||
NewIncPaths:='';
|
NewIncPaths:='';
|
||||||
for i:=0 to OpenDialog.Files.Count-1 do
|
for i:=0 to OpenDialog.Files.Count-1 do
|
||||||
if not (AddOneFile(OpenDialog.Files[i], NewUnitPaths, NewIncPaths) in [mrOk, mrIgnore]) then break;
|
LazPackage.AddFileByName(OpenDialog.Files[i], NewUnitPaths, NewIncPaths);
|
||||||
InputHistories.StoreFileDialogSettings(OpenDialog);
|
|
||||||
//UpdateAll(false);
|
//UpdateAll(false);
|
||||||
// extend unit and include search path
|
// extend unit and include search path
|
||||||
if not ExtendUnitSearchPath(NewUnitPaths) then exit;
|
if not LazPackage.ExtendUnitSearchPath(NewUnitPaths) then exit;
|
||||||
if not ExtendIncSearchPath(NewIncPaths) then exit;
|
if not LazPackage.ExtendIncSearchPath(NewIncPaths) then exit;
|
||||||
end;
|
end;
|
||||||
finally
|
finally
|
||||||
OpenDialog.Free;
|
OpenDialog.Free;
|
||||||
@ -3065,47 +3023,13 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
function TPackageEditorForm.ExtendUnitSearchPath(NewUnitPaths: string): boolean;
|
function TPackageEditorForm.ExtendUnitSearchPath(NewUnitPaths: string): boolean;
|
||||||
var
|
|
||||||
CurUnitPaths: String;
|
|
||||||
r: TModalResult;
|
|
||||||
begin
|
begin
|
||||||
CurUnitPaths:=LazPackage.CompilerOptions.ParsedOpts.GetParsedValue(pcosUnitPath);
|
Result:=LazPackage.ExtendUnitSearchPath(NewUnitPaths);
|
||||||
NewUnitPaths:=RemoveSearchPaths(NewUnitPaths,CurUnitPaths);
|
|
||||||
if NewUnitPaths<>'' then begin
|
|
||||||
NewUnitPaths:=CreateRelativeSearchPath(NewUnitPaths,LazPackage.Directory);
|
|
||||||
r:=IDEMessageDialog(lisExtendUnitPath,
|
|
||||||
Format(lisExtendUnitSearchPathOfPackageWith, [LazPackage.Name, #13,
|
|
||||||
NewUnitPaths]), mtConfirmation, [mbYes, mbNo, mbCancel]);
|
|
||||||
case r of
|
|
||||||
mrYes: LazPackage.CompilerOptions.OtherUnitFiles:=
|
|
||||||
MergeSearchPaths(LazPackage.CompilerOptions.OtherUnitFiles,NewUnitPaths);
|
|
||||||
mrNo: ;
|
|
||||||
else exit(false);
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
Result:=true;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TPackageEditorForm.ExtendIncSearchPath(NewIncPaths: string): boolean;
|
function TPackageEditorForm.ExtendIncSearchPath(NewIncPaths: string): boolean;
|
||||||
var
|
|
||||||
CurIncPaths: String;
|
|
||||||
r: TModalResult;
|
|
||||||
begin
|
begin
|
||||||
CurIncPaths:=LazPackage.CompilerOptions.ParsedOpts.GetParsedValue(pcosIncludePath);
|
Result:=LazPackage.ExtendIncSearchPath(NewIncPaths);
|
||||||
NewIncPaths:=RemoveSearchPaths(NewIncPaths,CurIncPaths);
|
|
||||||
if NewIncPaths<>'' then begin
|
|
||||||
NewIncPaths:=CreateRelativeSearchPath(NewIncPaths,LazPackage.Directory);
|
|
||||||
r:=IDEMessageDialog(lisExtendIncludePath,
|
|
||||||
Format(lisExtendIncludeFileSearchPathOfPackageWith, [LazPackage.Name, #13,
|
|
||||||
NewIncPaths]), mtConfirmation, [mbYes, mbNo, mbCancel]);
|
|
||||||
case r of
|
|
||||||
mrYes: LazPackage.CompilerOptions.IncludePath:=
|
|
||||||
MergeSearchPaths(LazPackage.CompilerOptions.IncludePath,NewIncPaths);
|
|
||||||
mrNo: ;
|
|
||||||
else exit(false);
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
Result:=true;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TPackageEditorForm.FilesEditTreeView: TTreeView;
|
function TPackageEditorForm.FilesEditTreeView: TTreeView;
|
||||||
|
@ -5042,8 +5042,6 @@ var
|
|||||||
ActiveUnitInfo: TUnitInfo;
|
ActiveUnitInfo: TUnitInfo;
|
||||||
PkgFile: TPkgFile;
|
PkgFile: TPkgFile;
|
||||||
Filename: String;
|
Filename: String;
|
||||||
TheUnitName: String;
|
|
||||||
HasRegisterProc: Boolean;
|
|
||||||
begin
|
begin
|
||||||
MainIDE.GetCurrentUnitInfo(ActiveSourceEditor,ActiveUnitInfo);
|
MainIDE.GetCurrentUnitInfo(ActiveSourceEditor,ActiveUnitInfo);
|
||||||
if ActiveSourceEditor=nil then exit(mrAbort);
|
if ActiveSourceEditor=nil then exit(mrAbort);
|
||||||
@ -5075,18 +5073,7 @@ begin
|
|||||||
if Result<>mrIgnore then exit;
|
if Result<>mrIgnore then exit;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
TheUnitName:='';
|
Result:=ShowAddFileToAPackageDlg(Filename);
|
||||||
HasRegisterProc:=false;
|
|
||||||
if FilenameIsPascalUnit(Filename) then begin
|
|
||||||
Result:=DoGetUnitRegisterInfo(Filename,TheUnitName,HasRegisterProc,false);
|
|
||||||
if Result<>mrOk then begin
|
|
||||||
debugln(['Error: (lazarus) [TPkgManager.DoAddActiveUnitToAPackage] DoGetUnitRegisterInfo failed']);
|
|
||||||
exit;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
Result:=ShowAddFileToAPackageDlg(Filename,TheUnitName,HasRegisterProc,
|
|
||||||
@MainIDE.GetIDEFileState);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TPkgManager.DoNewPackageComponent: TModalResult;
|
function TPkgManager.DoNewPackageComponent: TModalResult;
|
||||||
|
Loading…
Reference in New Issue
Block a user