IDE: implemented dialog to add whole directories to a package

git-svn-id: trunk@16187 -
This commit is contained in:
mattias 2008-08-22 16:48:33 +00:00
parent 32d3de4548
commit 438148c17d
8 changed files with 605 additions and 73 deletions

3
.gitattributes vendored
View File

@ -3602,6 +3602,9 @@ lcl/widgetset/wstoolwin.pp svneol=native#text/pascal
lcl/xmlpropstorage.pas svneol=native#text/pascal
/localize.bat svneol=native#text/plain
/localize.sh -text svneol=native#application/x-sh
packager/adddirtopkgdlg.lfm svneol=native#text/plain
packager/adddirtopkgdlg.lrs svneol=native#text/plain
packager/adddirtopkgdlg.pas svneol=native#text/plain
packager/addfiletoapackagedlg.lfm svneol=native#text/plain
packager/addfiletoapackagedlg.lrs svneol=native#text/pascal
packager/addfiletoapackagedlg.pas svneol=native#text/pascal

View File

@ -1028,6 +1028,7 @@ resourcestring
lisEnvOptDlgInvalidDebuggerFilenameMsg =
'The debugger file "%s" is not an executable.';
lisEnvOptDlgDirectoryNotFound = 'Directory not found';
lisTheDirectoryWasNotFound = 'The directory %s was not found.';
lisInstallationFailed = 'Installation failed';
lisPkgMangThePackageFailedToCompileRemoveItFromTheInstallati = 'The package %'
+'s%s%s failed to compile.%sRemove it from the installation list?';
@ -1530,6 +1531,10 @@ resourcestring
lisShowUnits = 'Show units';
lisShowIdentifiers = 'Show identifiers';
lisFilter = 'Filter';
lisRegularExpression = 'Regular expression';
lisInvalidFilter = 'Invalid filter';
lisInvalidExpression = 'Invalid expression:%s%s%s%s';
lisExcludeFilter2 = 'Exclude filter';
lisPrivate = 'Private';
lisProtected = 'Protected';
lisEMDPublic = 'Public';
@ -3821,6 +3826,7 @@ resourcestring
+'filenames with full path or with relative path';
lisDeleteSelectedFiles = 'Delete selected files';
lisAddDirectory = 'Add directory';
lisAddFilesOfDirectory = 'Add files of directory';
implementation

158
packager/adddirtopkgdlg.lfm Normal file
View File

@ -0,0 +1,158 @@
object AddDirToPkgDialog: TAddDirToPkgDialog
Left = 305
Height = 366
Top = 261
Width = 400
ActiveControl = DirEdit
Caption = 'AddDirToPkgDialog'
ClientHeight = 366
ClientWidth = 400
OnCreate = FormCreate
OnDestroy = FormDestroy
Position = poScreenCenter
LCLVersion = '0.9.25'
object DirGroupBox: TGroupBox
Height = 86
Width = 400
Align = alTop
AutoSize = True
Caption = 'DirGroupBox'
ClientHeight = 67
ClientWidth = 396
TabOrder = 0
object DirEdit: TEdit
AnchorSideLeft.Control = DirGroupBox
AnchorSideTop.Control = DirGroupBox
AnchorSideRight.Control = DirButton
Left = 6
Height = 27
Top = 6
Width = 360
Anchors = [akTop, akLeft, akRight]
AutoSize = True
BorderSpacing.Left = 6
BorderSpacing.Top = 6
TabOrder = 0
Text = 'DirEdit'
end
object DirButton: TButton
AnchorSideTop.Control = DirEdit
AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = DirGroupBox
AnchorSideRight.Side = asrBottom
Left = 366
Height = 29
Top = 5
Width = 24
Anchors = [akTop, akRight]
AutoSize = True
BorderSpacing.Top = 6
BorderSpacing.Right = 6
Caption = '...'
OnClick = DirButtonClick
TabOrder = 1
end
object SubDirCheckBox: TCheckBox
AnchorSideLeft.Control = DirGroupBox
AnchorSideTop.Control = DirEdit
AnchorSideTop.Side = asrBottom
Left = 6
Height = 22
Top = 39
Width = 130
BorderSpacing.Around = 6
Caption = 'SubDirCheckBox'
Checked = True
State = cbChecked
TabOrder = 2
end
end
object IncludeGroupBox: TGroupBox
Height = 116
Top = 86
Width = 400
Align = alTop
AutoSize = True
Caption = 'IncludeGroupBox'
ClientHeight = 97
ClientWidth = 396
TabOrder = 1
object IncludeRegExCheckBox: TCheckBox
Left = 6
Height = 22
Top = 41
Width = 384
Align = alClient
BorderSpacing.Around = 6
Caption = 'IncludeRegExCheckBox'
TabOrder = 0
end
object IncludeFilterCombobox: TComboBox
Left = 6
Height = 29
Top = 6
Width = 384
Align = alTop
AutoCompleteText = [cbactEndOfLineComplete, cbactSearchAscending]
BorderSpacing.Around = 6
MaxLength = 0
TabOrder = 1
Text = 'IncludeFilterCombobox'
end
object OnlyTextCheckBox: TCheckBox
Left = 6
Height = 22
Top = 69
Width = 384
Align = alBottom
BorderSpacing.Around = 6
Caption = 'OnlyTextCheckBox'
Checked = True
State = cbChecked
TabOrder = 2
end
end
object ExcludeGroupBox: TGroupBox
Height = 88
Top = 202
Width = 400
Align = alTop
AutoSize = True
Caption = 'ExcludeGroupBox'
ClientHeight = 69
ClientWidth = 396
TabOrder = 2
object ExcludeRegExCheckBox: TCheckBox
Left = 6
Height = 22
Top = 41
Width = 384
Align = alClient
BorderSpacing.Around = 6
Caption = 'ExcludeRegExCheckBox'
TabOrder = 0
end
object ExcludeFilterCombobox: TComboBox
Left = 6
Height = 29
Top = 6
Width = 384
Align = alTop
AutoCompleteText = [cbactEndOfLineComplete, cbactSearchAscending]
BorderSpacing.Around = 6
MaxLength = 0
TabOrder = 1
Text = 'ExcludeFilterCombobox'
end
end
object ButtonPanel1: TButtonPanel
Left = 6
Height = 50
Top = 316
Width = 388
Align = alBottom
AutoSize = True
TabOrder = 3
ShowButtons = [pbOK, pbCancel]
end
end

View File

@ -0,0 +1,51 @@
{ This is an automatically generated lazarus resource file }
LazarusResources.Add('TAddDirToPkgDialog','FORMDATA',[
'TPF0'#18'TAddDirToPkgDialog'#17'AddDirToPkgDialog'#4'Left'#3'1'#1#6'Height'#3
+'n'#1#3'Top'#3#5#1#5'Width'#3#144#1#13'ActiveControl'#7#7'DirEdit'#7'Caption'
+#6#17'AddDirToPkgDialog'#12'ClientHeight'#3'n'#1#11'ClientWidth'#3#144#1#8'O'
+'nCreate'#7#10'FormCreate'#9'OnDestroy'#7#11'FormDestroy'#8'Position'#7#14'p'
+'oScreenCenter'#10'LCLVersion'#6#6'0.9.25'#0#9'TGroupBox'#11'DirGroupBox'#6
+'Height'#2'V'#5'Width'#3#144#1#5'Align'#7#5'alTop'#8'AutoSize'#9#7'Caption'#6
+#11'DirGroupBox'#12'ClientHeight'#2'C'#11'ClientWidth'#3#140#1#8'TabOrder'#2
+#0#0#5'TEdit'#7'DirEdit'#22'AnchorSideLeft.Control'#7#11'DirGroupBox'#21'Anc'
+'horSideTop.Control'#7#11'DirGroupBox'#23'AnchorSideRight.Control'#7#9'DirBu'
+'tton'#4'Left'#2#6#6'Height'#2#27#3'Top'#2#6#5'Width'#3'h'#1#7'Anchors'#11#5
+'akTop'#6'akLeft'#7'akRight'#0#8'AutoSize'#9#18'BorderSpacing.Left'#2#6#17'B'
+'orderSpacing.Top'#2#6#8'TabOrder'#2#0#4'Text'#6#7'DirEdit'#0#0#7'TButton'#9
+'DirButton'#21'AnchorSideTop.Control'#7#7'DirEdit'#18'AnchorSideTop.Side'#7#9
+'asrCenter'#23'AnchorSideRight.Control'#7#11'DirGroupBox'#20'AnchorSideRight'
+'.Side'#7#9'asrBottom'#4'Left'#3'n'#1#6'Height'#2#29#3'Top'#2#5#5'Width'#2#24
+#7'Anchors'#11#5'akTop'#7'akRight'#0#8'AutoSize'#9#17'BorderSpacing.Top'#2#6
+#19'BorderSpacing.Right'#2#6#7'Caption'#6#3'...'#7'OnClick'#7#14'DirButtonCl'
+'ick'#8'TabOrder'#2#1#0#0#9'TCheckBox'#14'SubDirCheckBox'#22'AnchorSideLeft.'
+'Control'#7#11'DirGroupBox'#21'AnchorSideTop.Control'#7#7'DirEdit'#18'Anchor'
+'SideTop.Side'#7#9'asrBottom'#4'Left'#2#6#6'Height'#2#22#3'Top'#2''''#5'Widt'
+'h'#3#130#0#20'BorderSpacing.Around'#2#6#7'Caption'#6#14'SubDirCheckBox'#7'C'
+'hecked'#9#5'State'#7#9'cbChecked'#8'TabOrder'#2#2#0#0#0#9'TGroupBox'#15'Inc'
+'ludeGroupBox'#6'Height'#2't'#3'Top'#2'V'#5'Width'#3#144#1#5'Align'#7#5'alTo'
+'p'#8'AutoSize'#9#7'Caption'#6#15'IncludeGroupBox'#12'ClientHeight'#2'a'#11
+'ClientWidth'#3#140#1#8'TabOrder'#2#1#0#9'TCheckBox'#20'IncludeRegExCheckBox'
+#4'Left'#2#6#6'Height'#2#22#3'Top'#2')'#5'Width'#3#128#1#5'Align'#7#8'alClie'
+'nt'#20'BorderSpacing.Around'#2#6#7'Caption'#6#20'IncludeRegExCheckBox'#8'Ta'
+'bOrder'#2#0#0#0#9'TComboBox'#21'IncludeFilterCombobox'#4'Left'#2#6#6'Height'
+#2#29#3'Top'#2#6#5'Width'#3#128#1#5'Align'#7#5'alTop'#16'AutoCompleteText'#11
+#22'cbactEndOfLineComplete'#20'cbactSearchAscending'#0#20'BorderSpacing.Arou'
+'nd'#2#6#9'MaxLength'#2#0#8'TabOrder'#2#1#4'Text'#6#21'IncludeFilterCombobox'
+#0#0#9'TCheckBox'#16'OnlyTextCheckBox'#4'Left'#2#6#6'Height'#2#22#3'Top'#2'E'
+#5'Width'#3#128#1#5'Align'#7#8'alBottom'#20'BorderSpacing.Around'#2#6#7'Capt'
+'ion'#6#16'OnlyTextCheckBox'#7'Checked'#9#5'State'#7#9'cbChecked'#8'TabOrder'
+#2#2#0#0#0#9'TGroupBox'#15'ExcludeGroupBox'#6'Height'#2'X'#3'Top'#3#202#0#5
+'Width'#3#144#1#5'Align'#7#5'alTop'#8'AutoSize'#9#7'Caption'#6#15'ExcludeGro'
+'upBox'#12'ClientHeight'#2'E'#11'ClientWidth'#3#140#1#8'TabOrder'#2#2#0#9'TC'
+'heckBox'#20'ExcludeRegExCheckBox'#4'Left'#2#6#6'Height'#2#22#3'Top'#2')'#5
+'Width'#3#128#1#5'Align'#7#8'alClient'#20'BorderSpacing.Around'#2#6#7'Captio'
+'n'#6#20'ExcludeRegExCheckBox'#8'TabOrder'#2#0#0#0#9'TComboBox'#21'ExcludeFi'
+'lterCombobox'#4'Left'#2#6#6'Height'#2#29#3'Top'#2#6#5'Width'#3#128#1#5'Alig'
+'n'#7#5'alTop'#16'AutoCompleteText'#11#22'cbactEndOfLineComplete'#20'cbactSe'
+'archAscending'#0#20'BorderSpacing.Around'#2#6#9'MaxLength'#2#0#8'TabOrder'#2
+#1#4'Text'#6#21'ExcludeFilterCombobox'#0#0#0#12'TButtonPanel'#12'ButtonPanel'
+'1'#4'Left'#2#6#6'Height'#2'2'#3'Top'#3'<'#1#5'Width'#3#132#1#5'Align'#7#8'a'
+'lBottom'#8'AutoSize'#9#8'TabOrder'#2#3#11'ShowButtons'#11#4'pbOK'#8'pbCance'
+'l'#0#0#0#0
]);

268
packager/adddirtopkgdlg.pas Normal file
View File

@ -0,0 +1,268 @@
unit AddDirToPkgDlg;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, LCLProc, LResources, Forms, Controls, Graphics, Dialogs,
StdCtrls, ExtCtrls, ButtonPanel,
SynRegExpr, FileUtil,
// IDE
IDEWindowIntf, InputHistory, IDEProcs,
LazarusIDEStrConsts, PackageDefs;
type
{ TAddDirToPkgDialog }
TAddDirToPkgDialog = class(TForm)
ButtonPanel1: TButtonPanel;
OnlyTextCheckBox: TCheckBox;
ExcludeFilterCombobox: TComboBox;
ExcludeRegExCheckBox: TCheckBox;
ExcludeGroupBox: TGroupBox;
IncludeFilterCombobox: TComboBox;
IncludeRegExCheckBox: TCheckBox;
IncludeGroupBox: TGroupBox;
SubDirCheckBox: TCheckBox;
DirButton: TButton;
DirGroupBox: TGroupBox;
DirEdit: TEdit;
procedure ButtonPanel1CancelClick(Sender: TObject);
procedure ButtonPanel1OkClick(Sender: TObject);
procedure DirButtonClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
private
FFiles: TStrings;
FLazPackage: TLazPackage;
fIncludeFilterRE, fExcludeFilterRE: TRegExpr;
procedure SetLazPackage(const AValue: TLazPackage);
function GatherFiles(Directory: string; WithSubDirs: boolean;
OnlyTextFiles: boolean;
IncludeFilter: string; IncludeFilterRegEx: boolean;
ExcludeFilter: string; ExcludeFilterRegEx: boolean): boolean;
function UpdateFilter: boolean;
public
property LazPackage: TLazPackage read FLazPackage write SetLazPackage;
property Files: TStrings read FFiles write FFiles;
end;
function ShowAddDirToPkgDialog(APackage: TLazPackage;
out Files: TStrings): TModalResult;
implementation
function ShowAddDirToPkgDialog(APackage: TLazPackage;
out Files: TStrings): TModalResult;
var
AddDirToPkgDialog: TAddDirToPkgDialog;
begin
Files:=TStringList.Create;
AddDirToPkgDialog:=TAddDirToPkgDialog.Create(nil);
try
AddDirToPkgDialog.LazPackage:=APackage;
AddDirToPkgDialog.Files:=Files;
Result:=AddDirToPkgDialog.ShowModal;
finally
AddDirToPkgDialog.Free;
end;
end;
{ TAddDirToPkgDialog }
procedure TAddDirToPkgDialog.FormCreate(Sender: TObject);
begin
Caption:=lisAddFilesOfDirectory;
DirGroupBox.Caption:=lisCodeToolsDefsInsertBehindDirectory;
SubDirCheckBox.Caption:=lisFindFileIncludeSubDirectories;
IncludeGroupBox.Caption:=lisFilter;
IncludeRegExCheckBox.Caption:=lisRegularExpression;
OnlyTextCheckBox.Caption:=lisFindFileOnlyTextFiles;
ExcludeGroupBox.Caption:=lisExcludeFilter2;
ExcludeRegExCheckBox.Caption:=lisRegularExpression;
ButtonPanel1.OKButton.OnClick:=@ButtonPanel1OkClick;
ButtonPanel1.CancelButton.OnClick:=@ButtonPanel1CancelClick;
with IncludeFilterCombobox.Items do begin
BeginUpdate;
Clear;
Add('*.pas;*.pp;*.p;*.inc;*.lfm;*.lrs;*.txt;*.xml');
Add('*.pas;*.pp;*.p;*.inc');
EndUpdate;
end;
IncludeFilterCombobox.ItemIndex:=0;
with ExcludeFilterCombobox.Items do begin
BeginUpdate;
Clear;
Add('*.o;*.ppu;*.dcu;*.a;*.so;*.dll;*.compiled;*.po');
EndFormUpdate;
end;
ExcludeFilterCombobox.ItemIndex:=0;
fIncludeFilterRE:=TRegExpr.Create;
fExcludeFilterRE:=TRegExpr.Create;
end;
procedure TAddDirToPkgDialog.FormDestroy(Sender: TObject);
begin
FreeAndNil(fIncludeFilterRE);
FreeAndNil(fExcludeFilterRE);
end;
procedure TAddDirToPkgDialog.ButtonPanel1CancelClick(Sender: TObject);
begin
IDEDialogLayoutList.SaveLayout(Self);
ModalResult:=mrCancel;
end;
procedure TAddDirToPkgDialog.ButtonPanel1OkClick(Sender: TObject);
begin
if not GatherFiles(DirEdit.Text,SubDirCheckBox.Checked,
OnlyTextCheckBox.Checked,
IncludeFilterCombobox.Text,IncludeRegExCheckBox.Checked,
ExcludeFilterCombobox.Text,ExcludeRegExCheckBox.Checked) then exit;
IDEDialogLayoutList.SaveLayout(Self);
ModalResult:=mrOk;
end;
procedure TAddDirToPkgDialog.DirButtonClick(Sender: TObject);
var
SelectDirectoryDialog: TSelectDirectoryDialog;
begin
SelectDirectoryDialog:=TSelectDirectoryDialog.Create(nil);
try
SelectDirectoryDialog.InitialDir:=LazPackage.Directory;
SelectDirectoryDialog.Options:=SelectDirectoryDialog.Options+[ofPathMustExist];
InputHistories.ApplyFileDialogSettings(SelectDirectoryDialog);
if SelectDirectoryDialog.Execute then begin
DirEdit.Text:=SelectDirectoryDialog.FileName;
end;
InputHistories.StoreFileDialogSettings(SelectDirectoryDialog);
finally
SelectDirectoryDialog.Free;
end;
end;
procedure TAddDirToPkgDialog.SetLazPackage(const AValue: TLazPackage);
begin
if FLazPackage=AValue then exit;
FLazPackage:=AValue;
DirEdit.Text:=FLazPackage.Directory;
end;
function TAddDirToPkgDialog.GatherFiles(Directory: string;
WithSubDirs: boolean; OnlyTextFiles: boolean; IncludeFilter: string;
IncludeFilterRegEx: boolean; ExcludeFilter: string;
ExcludeFilterRegEx: boolean): boolean;
function FileCanBeAdded(AFilename: string): boolean;
begin
Result:=false;
DebugLn(['FileCanBeAdded AAA1 ',AFilename]);
// check include filter
if (fIncludeFilterRE.Expression<>'')
and (not fIncludeFilterRE.Exec(ExtractFilename(AFilename))) then
exit;
DebugLn(['FileCanBeAdded AAA2 ',AFilename]);
// check exclude filter
if (fExcludeFilterRE.Expression<>'')
and (fExcludeFilterRE.Exec(ExtractFilename(AFilename))) then
exit;
DebugLn(['FileCanBeAdded AAA3 ',AFilename]);
// check binaries
if OnlyTextFiles and (not FileIsText(AFilename)) then exit;
DebugLn(['FileCanBeAdded AAA4 ',AFilename]);
Result:=true;
end;
function SearchDir(CurDir: string): boolean;
var
FileInfo: TSearchRec;
CurFilename: String;
begin
Result:=false;
CurDir:=CleanAndExpandDirectory(CurDir);
if not DirPathExists(CurDir) then begin
MessageDlg(lisEnvOptDlgDirectoryNotFound,
Format(lisTheDirectoryWasNotFound, [CurDir]), mtError, [mbCancel], 0);
exit;
end;
if SysUtils.FindFirst(CurDir+GetAllFilesMask,faAnyFile,FileInfo)=0 then begin
repeat
// check if special file
if (FileInfo.Name='.') or (FileInfo.Name='..') or (FileInfo.Name='') then
continue;
CurFilename:=CurDir+FileInfo.Name;
if (FileInfo.Attr and faDirectory)>0 then begin
if WithSubDirs and not SearchDir(CurFilename) then exit;
end else begin
if FileCanBeAdded(CurFilename) then
Files.Add(CurFilename);
end;
until SysUtils.FindNext(FileInfo)<>0;
end;
SysUtils.FindClose(FileInfo);
Result:=true;
end;
begin
Files.Clear;
Result:=false;
if not UpdateFilter then exit;
Result:=SearchDir(Directory);
end;
function TAddDirToPkgDialog.UpdateFilter: boolean;
var
Expr: String;
begin
Expr:=IncludeFilterCombobox.Text;
if not IncludeRegExCheckBox.Checked then
Expr:=SimpleSyntaxToRegExpr(Expr);
if Expr<>'' then begin
Result:=false;
try
fIncludeFilterRE.Expression:=Expr;
Result:=true;
except
on E: Exception do begin
MessageDlg(lisInvalidFilter,
Format(lisInvalidExpression, [#13, Expr, #13, E.Message]), mtError, [
mbCancel], 0);
end;
end;
if not Result then exit;
end;
Expr:=ExcludeFilterCombobox.Text;
if not ExcludeRegExCheckBox.Checked then
Expr:=SimpleSyntaxToRegExpr(Expr);
if Expr<>'' then begin
Result:=false;
try
fExcludeFilterRE.Expression:=Expr;
Result:=true;
except
on E: Exception do begin
MessageDlg(lisInvalidFilter,
Format(lisInvalidExpression, [#13, Expr, #13, E.Message]), mtError, [
mbCancel], 0);
end;
end;
if not Result then exit;
end;
Result:=true;
end;
initialization
{$I adddirtopkgdlg.lrs}
end.

View File

@ -1,7 +1,7 @@
object AddToPackageDlg: TAddToPackageDlg
Left = 390
Left = 395
Height = 300
Top = 362
Top = 386
Width = 500
ActiveControl = NoteBook
Caption = 'Add to package'
@ -22,12 +22,12 @@ object AddToPackageDlg: TAddToPackageDlg
TabOrder = 0
object NewFilePage: TPage
Caption = 'New File'
ClientWidth = 498
ClientHeight = 273
ClientWidth = 496
ClientHeight = 269
OnResize = NewFilePageResize
object NewFileTreeView: TTreeView
AnchorSideBottom.Control = NewFileOkButton
Height = 218
Height = 214
Width = 249
Align = alLeft
BorderSpacing.Bottom = 5
@ -43,17 +43,17 @@ object AddToPackageDlg: TAddToPackageDlg
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = NewFileOkButton
Left = 249
Height = 218
Width = 249
Height = 214
Width = 247
Align = alClient
BorderSpacing.Bottom = 5
Caption = 'NewFileDescriptionGroupBox'
ClientHeight = 199
ClientWidth = 245
ClientHeight = 195
ClientWidth = 243
TabOrder = 1
object NewFileHelpLabel: TLabel
Height = 199
Width = 245
Height = 195
Width = 243
Align = alClient
Caption = 'NewFileHelpLabel'
ParentColor = False
@ -62,16 +62,16 @@ object AddToPackageDlg: TAddToPackageDlg
end
object NewFileBtnPanel: TPanel
Height = 50
Top = 223
Width = 498
Top = 219
Width = 496
Align = alBottom
BevelOuter = bvNone
ClientHeight = 50
ClientWidth = 498
ClientWidth = 496
TabOrder = 2
object NewFileOkButton: TButton
AnchorSideBottom.Side = asrBottom
Left = 222
Left = 220
Height = 38
Top = 6
Width = 119
@ -86,7 +86,7 @@ object AddToPackageDlg: TAddToPackageDlg
end
object NewFileCancelButton: TButton
AnchorSideLeft.Side = asrBottom
Left = 347
Left = 345
Height = 38
Top = 6
Width = 145
@ -101,8 +101,8 @@ object AddToPackageDlg: TAddToPackageDlg
end
object AddUnitPage: TPage
Caption = 'Add Unit'
ClientWidth = 498
ClientHeight = 273
ClientWidth = 496
ClientHeight = 269
object AddUnitFilenameLabel: TLabel
AnchorSideTop.Control = AddUnitFilenameEdit
AnchorSideTop.Side = asrCenter
@ -130,7 +130,7 @@ object AddToPackageDlg: TAddToPackageDlg
Left = 148
Height = 27
Top = 5
Width = 292
Width = 290
Anchors = [akTop, akLeft, akRight]
AutoSize = True
TabOrder = 0
@ -138,7 +138,7 @@ object AddToPackageDlg: TAddToPackageDlg
end
object AddUnitFileBrowseButton: TButton
AnchorSideRight.Control = AddUnitFileShortenButton
Left = 440
Left = 438
Height = 29
Top = 5
Width = 24
@ -151,7 +151,7 @@ object AddToPackageDlg: TAddToPackageDlg
object AddUnitFileShortenButton: TButton
AnchorSideRight.Control = AddUnitPage
AnchorSideRight.Side = asrBottom
Left = 464
Left = 462
Height = 29
Top = 5
Width = 34
@ -258,8 +258,8 @@ object AddToPackageDlg: TAddToPackageDlg
end
object NewComponentPage: TPage
Caption = 'New Component'
ClientWidth = 498
ClientHeight = 273
ClientWidth = 496
ClientHeight = 269
object AncestorTypeLabel: TLabel
AnchorSideTop.Control = AncestorComboBox
AnchorSideTop.Side = asrCenter
@ -460,8 +460,8 @@ object AddToPackageDlg: TAddToPackageDlg
end
object NewRequirementPage: TPage
Caption = 'New Requirement'
ClientWidth = 498
ClientHeight = 273
ClientWidth = 496
ClientHeight = 269
object DependPkgNameLabel: TLabel
AnchorSideTop.Control = DependPkgNameComboBox
AnchorSideTop.Side = asrCenter
@ -562,8 +562,8 @@ object AddToPackageDlg: TAddToPackageDlg
end
object AddFilePage: TPage
Caption = 'Add File'
ClientWidth = 498
ClientHeight = 273
ClientWidth = 496
ClientHeight = 269
object AddFilenameLabel: TLabel
AnchorSideTop.Control = AddFilenameEdit
AnchorSideTop.Side = asrCenter
@ -581,7 +581,7 @@ object AddToPackageDlg: TAddToPackageDlg
Left = 122
Height = 27
Top = 5
Width = 318
Width = 316
Anchors = [akTop, akLeft, akRight]
AutoSize = True
TabOrder = 0
@ -589,7 +589,7 @@ object AddToPackageDlg: TAddToPackageDlg
end
object AddFileBrowseButton: TButton
AnchorSideRight.Control = AddFileShortenButton
Left = 440
Left = 438
Height = 29
Top = 5
Width = 24
@ -602,7 +602,7 @@ object AddToPackageDlg: TAddToPackageDlg
object AddFileShortenButton: TButton
AnchorSideRight.Control = AddFilePage
AnchorSideRight.Side = asrBottom
Left = 464
Left = 462
Height = 29
Top = 5
Width = 34
@ -666,12 +666,12 @@ object AddToPackageDlg: TAddToPackageDlg
end
object AddFilesPage: TPage
Caption = 'Add Files'
ClientWidth = 498
ClientHeight = 273
ClientWidth = 496
ClientHeight = 269
object FilesListView: TListView
AnchorSideBottom.Control = FilesBrowseButton
Height = 227
Width = 498
Height = 223
Width = 496
Align = alClient
BorderSpacing.Bottom = 5
Columns = <
@ -689,13 +689,13 @@ object AddToPackageDlg: TAddToPackageDlg
end
object AddFilesBtnPanel: TPanel
Height = 41
Top = 232
Width = 498
Top = 228
Width = 496
Align = alBottom
AutoSize = True
BevelOuter = bvNone
ClientHeight = 41
ClientWidth = 498
ClientWidth = 496
TabOrder = 1
object FilesBrowseButton: TButton
AnchorSideBottom.Side = asrBottom
@ -712,7 +712,7 @@ object AddToPackageDlg: TAddToPackageDlg
end
object FilesAddButton: TButton
AnchorSideLeft.Side = asrBottom
Left = 498
Left = 496
Height = 29
Top = 6
Width = 107

View File

@ -1,40 +1,40 @@
{ This is an automatically generated lazarus resource file }
LazarusResources.Add('TAddToPackageDlg','FORMDATA',[
'TPF0'#16'TAddToPackageDlg'#15'AddToPackageDlg'#4'Left'#3#134#1#6'Height'#3','
+#1#3'Top'#3'j'#1#5'Width'#3#244#1#13'ActiveControl'#7#8'NoteBook'#7'Caption'
'TPF0'#16'TAddToPackageDlg'#15'AddToPackageDlg'#4'Left'#3#139#1#6'Height'#3','
+#1#3'Top'#3#130#1#5'Width'#3#244#1#13'ActiveControl'#7#8'NoteBook'#7'Caption'
+#6#14'Add to package'#12'ClientHeight'#3','#1#11'ClientWidth'#3#244#1#10'Key'
+'Preview'#9#7'OnClose'#7#20'AddToPackageDlgClose'#8'OnCreate'#7#10'FormCreat'
+'e'#9'OnDestroy'#7#11'FormDestroy'#9'OnKeyDown'#7#22'AddToPackageDlgKeyDown'
+#8'Position'#7#14'poScreenCenter'#10'LCLVersion'#6#6'0.9.25'#0#9'TNotebook'#8
+'NoteBook'#6'Height'#3','#1#5'Width'#3#244#1#5'Align'#7#8'alClient'#9'PageIn'
+'dex'#2#5#8'TabOrder'#2#0#0#5'TPage'#11'NewFilePage'#7'Caption'#6#8'New File'
+#11'ClientWidth'#3#242#1#12'ClientHeight'#3#17#1#8'OnResize'#7#17'NewFilePag'
+#11'ClientWidth'#3#240#1#12'ClientHeight'#3#13#1#8'OnResize'#7#17'NewFilePag'
+'eResize'#0#9'TTreeView'#15'NewFileTreeView'#24'AnchorSideBottom.Control'#7
+#15'NewFileOkButton'#6'Height'#3#218#0#5'Width'#3#249#0#5'Align'#7#6'alLeft'
+#15'NewFileOkButton'#6'Height'#3#214#0#5'Width'#3#249#0#5'Align'#7#6'alLeft'
+#20'BorderSpacing.Bottom'#2#5#17'DefaultItemHeight'#2#19#8'TabOrder'#2#0#7'O'
+'nClick'#7#20'NewFileTreeViewClick'#10'OnDblClick'#7#23'NewFileTreeViewDblCl'
+'ick'#18'OnSelectionChanged'#7#31'NewFileTreeViewSelectionChanged'#0#0#9'TGr'
+'oupBox'#26'NewFileDescriptionGroupBox'#22'AnchorSideLeft.Control'#7#15'NewF'
+'ileTreeView'#19'AnchorSideLeft.Side'#7#9'asrBottom'#20'AnchorSideRight.Side'
+#7#9'asrBottom'#24'AnchorSideBottom.Control'#7#15'NewFileOkButton'#4'Left'#3
+#249#0#6'Height'#3#218#0#5'Width'#3#249#0#5'Align'#7#8'alClient'#20'BorderSp'
+#249#0#6'Height'#3#214#0#5'Width'#3#247#0#5'Align'#7#8'alClient'#20'BorderSp'
+'acing.Bottom'#2#5#7'Caption'#6#26'NewFileDescriptionGroupBox'#12'ClientHeig'
+'ht'#3#199#0#11'ClientWidth'#3#245#0#8'TabOrder'#2#1#0#6'TLabel'#16'NewFileH'
+'elpLabel'#6'Height'#3#199#0#5'Width'#3#245#0#5'Align'#7#8'alClient'#7'Capti'
+'ht'#3#195#0#11'ClientWidth'#3#243#0#8'TabOrder'#2#1#0#6'TLabel'#16'NewFileH'
+'elpLabel'#6'Height'#3#195#0#5'Width'#3#243#0#5'Align'#7#8'alClient'#7'Capti'
+'on'#6#16'NewFileHelpLabel'#11'ParentColor'#8#8'WordWrap'#9#0#0#0#6'TPanel'
+#15'NewFileBtnPanel'#6'Height'#2'2'#3'Top'#3#223#0#5'Width'#3#242#1#5'Align'
+#15'NewFileBtnPanel'#6'Height'#2'2'#3'Top'#3#219#0#5'Width'#3#240#1#5'Align'
+#7#8'alBottom'#10'BevelOuter'#7#6'bvNone'#12'ClientHeight'#2'2'#11'ClientWid'
+'th'#3#242#1#8'TabOrder'#2#2#0#7'TButton'#15'NewFileOkButton'#21'AnchorSideB'
+'ottom.Side'#7#9'asrBottom'#4'Left'#3#222#0#6'Height'#2'&'#3'Top'#2#6#5'Widt'
+'th'#3#240#1#8'TabOrder'#2#2#0#7'TButton'#15'NewFileOkButton'#21'AnchorSideB'
+'ottom.Side'#7#9'asrBottom'#4'Left'#3#220#0#6'Height'#2'&'#3'Top'#2#6#5'Widt'
+'h'#2'w'#5'Align'#7#7'alRight'#7'Anchors'#11#8'akBottom'#0#8'AutoSize'#9#20
+'BorderSpacing.Around'#2#6#7'Caption'#6#15'NewFileOkButton'#7'Enabled'#8#7'O'
+'nClick'#7#20'NewFileOkButtonClick'#8'TabOrder'#2#0#0#0#7'TButton'#19'NewFil'
+'eCancelButton'#19'AnchorSideLeft.Side'#7#9'asrBottom'#4'Left'#3'['#1#6'Heig'
+'eCancelButton'#19'AnchorSideLeft.Side'#7#9'asrBottom'#4'Left'#3'Y'#1#6'Heig'
+'ht'#2'&'#3'Top'#2#6#5'Width'#3#145#0#5'Align'#7#7'alRight'#8'AutoSize'#9#20
+'BorderSpacing.Around'#2#6#7'Caption'#6#19'NewFileCancelButton'#11'ModalResu'
+'lt'#2#2#8'TabOrder'#2#1#0#0#0#0#5'TPage'#11'AddUnitPage'#7'Caption'#6#8'Add'
+' Unit'#11'ClientWidth'#3#242#1#12'ClientHeight'#3#17#1#0#6'TLabel'#20'AddUn'
+' Unit'#11'ClientWidth'#3#240#1#12'ClientHeight'#3#13#1#0#6'TLabel'#20'AddUn'
+'itFilenameLabel'#21'AnchorSideTop.Control'#7#19'AddUnitFilenameEdit'#18'Anc'
+'horSideTop.Side'#7#9'asrCenter'#4'Left'#2#5#6'Height'#2#20#3'Top'#2#8#5'Wid'
+'th'#3#143#0#7'Caption'#6#20'AddUnitFilenameLabel'#11'ParentColor'#8#0#0#6'T'
@ -44,14 +44,14 @@ LazarusResources.Add('TAddToPackageDlg','FORMDATA',[
+'or'#8#0#0#5'TEdit'#19'AddUnitFilenameEdit'#22'AnchorSideLeft.Control'#7#20
+'AddUnitFilenameLabel'#19'AnchorSideLeft.Side'#7#9'asrBottom'#23'AnchorSideR'
+'ight.Control'#7#23'AddUnitFileBrowseButton'#4'Left'#3#148#0#6'Height'#2#27#3
+'Top'#2#5#5'Width'#3'$'#1#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#0#8'Au'
+'Top'#2#5#5'Width'#3'"'#1#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#0#8'Au'
+'toSize'#9#8'TabOrder'#2#0#4'Text'#6#19'AddUnitFilenameEdit'#0#0#7'TButton'
+#23'AddUnitFileBrowseButton'#23'AnchorSideRight.Control'#7#24'AddUnitFileSho'
+'rtenButton'#4'Left'#3#184#1#6'Height'#2#29#3'Top'#2#5#5'Width'#2#24#7'Ancho'
+'rtenButton'#4'Left'#3#182#1#6'Height'#2#29#3'Top'#2#5#5'Width'#2#24#7'Ancho'
+'rs'#11#5'akTop'#7'akRight'#0#8'AutoSize'#9#7'Caption'#6#3'...'#7'OnClick'#7
+#28'AddUnitFileBrowseButtonClick'#8'TabOrder'#2#1#0#0#7'TButton'#24'AddUnitF'
+'ileShortenButton'#23'AnchorSideRight.Control'#7#11'AddUnitPage'#20'AnchorSi'
+'deRight.Side'#7#9'asrBottom'#4'Left'#3#208#1#6'Height'#2#29#3'Top'#2#5#5'Wi'
+'deRight.Side'#7#9'asrBottom'#4'Left'#3#206#1#6'Height'#2#29#3'Top'#2#5#5'Wi'
+'dth'#2'"'#7'Anchors'#11#5'akTop'#7'akRight'#0#8'AutoSize'#9#7'Caption'#6#2
+'<>'#7'OnClick'#7#29'AddUnitFileShortenButtonClick'#8'TabOrder'#2#2#0#0#5'TE'
+'dit'#18'AddUnitSrcNameEdit'#22'AnchorSideLeft.Control'#7#19'AddUnitSrcNameL'
@ -88,8 +88,8 @@ LazarusResources.Add('TAddToPackageDlg','FORMDATA',[
+'ft'#2'y'#6'Height'#2#29#3'Top'#3#209#0#5'Width'#3#149#0#8'AutoSize'#9#18'Bo'
+'rderSpacing.Left'#2#10#7'Caption'#6#19'CancelAddUnitButton'#7'OnClick'#7#24
+'CancelAddUnitButtonClick'#8'TabOrder'#2#9#0#0#0#5'TPage'#16'NewComponentPag'
+'e'#7'Caption'#6#13'New Component'#11'ClientWidth'#3#242#1#12'ClientHeight'#3
+#17#1#0#6'TLabel'#17'AncestorTypeLabel'#21'AnchorSideTop.Control'#7#16'Ances'
+'e'#7'Caption'#6#13'New Component'#11'ClientWidth'#3#240#1#12'ClientHeight'#3
+#13#1#0#6'TLabel'#17'AncestorTypeLabel'#21'AnchorSideTop.Control'#7#16'Ances'
+'torComboBox'#18'AnchorSideTop.Side'#7#9'asrCenter'#4'Left'#2#5#6'Height'#2
+#20#3'Top'#2#9#5'Width'#2'x'#7'Caption'#6#17'AncestorTypeLabel'#11'ParentCol'
+'or'#8#0#0#6'TLabel'#14'ClassNameLabel'#21'AnchorSideTop.Control'#7#13'Class'
@ -158,8 +158,8 @@ LazarusResources.Add('TAddToPackageDlg','FORMDATA',[
+#4'Left'#3#168#0#6'Height'#2#29#3'Top'#3#193#0#5'Width'#3#200#0#8'AutoSize'#9
+#18'BorderSpacing.Left'#2#6#7'Caption'#6#24'CancelNewComponentButton'#7'OnCl'
+'ick'#7#29'CancelNewComponentButtonClick'#8'TabOrder'#2#9#0#0#0#5'TPage'#18
+'NewRequirementPage'#7'Caption'#6#15'New Requirement'#11'ClientWidth'#3#242#1
+#12'ClientHeight'#3#17#1#0#6'TLabel'#18'DependPkgNameLabel'#21'AnchorSideTop'
+'NewRequirementPage'#7'Caption'#6#15'New Requirement'#11'ClientWidth'#3#240#1
+#12'ClientHeight'#3#13#1#0#6'TLabel'#18'DependPkgNameLabel'#21'AnchorSideTop'
+'.Control'#7#21'DependPkgNameComboBox'#18'AnchorSideTop.Side'#7#9'asrCenter'
+#4'Left'#2#5#6'Height'#2#20#3'Top'#2#9#5'Width'#3#147#0#7'Caption'#6#18'Depe'
+'ndPkgNameLabel'#11'ParentColor'#8#0#0#6'TLabel'#21'DependMinVersionLabel'#21
@ -193,20 +193,20 @@ LazarusResources.Add('TAddToPackageDlg','FORMDATA',[
+'ight'#2#29#3'Top'#2'}'#5'Width'#3#148#0#8'AutoSize'#9#18'BorderSpacing.Left'
+#2#6#7'Caption'#6#18'CancelDependButton'#11'ModalResult'#2#2#8'TabOrder'#2#4
+#0#0#0#5'TPage'#11'AddFilePage'#7'Caption'#6#8'Add File'#11'ClientWidth'#3
,#242#1#12'ClientHeight'#3#17#1#0#6'TLabel'#16'AddFilenameLabel'#21'AnchorSid'
,#240#1#12'ClientHeight'#3#13#1#0#6'TLabel'#16'AddFilenameLabel'#21'AnchorSid'
+'eTop.Control'#7#15'AddFilenameEdit'#18'AnchorSideTop.Side'#7#9'asrCenter'#4
+'Left'#2#5#6'Height'#2#20#3'Top'#2#8#5'Width'#2'u'#7'Caption'#6#16'AddFilena'
+'meLabel'#11'ParentColor'#8#0#0#5'TEdit'#15'AddFilenameEdit'#22'AnchorSideLe'
+'ft.Control'#7#16'AddFilenameLabel'#19'AnchorSideLeft.Side'#7#9'asrBottom'#23
+'AnchorSideRight.Control'#7#19'AddFileBrowseButton'#4'Left'#2'z'#6'Height'#2
+#27#3'Top'#2#5#5'Width'#3'>'#1#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#0
+#27#3'Top'#2#5#5'Width'#3'<'#1#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#0
+#8'AutoSize'#9#8'TabOrder'#2#0#4'Text'#6#15'AddFilenameEdit'#0#0#7'TButton'
+#19'AddFileBrowseButton'#23'AnchorSideRight.Control'#7#20'AddFileShortenButt'
+'on'#4'Left'#3#184#1#6'Height'#2#29#3'Top'#2#5#5'Width'#2#24#7'Anchors'#11#5
+'on'#4'Left'#3#182#1#6'Height'#2#29#3'Top'#2#5#5'Width'#2#24#7'Anchors'#11#5
+'akTop'#7'akRight'#0#8'AutoSize'#9#7'Caption'#6#3'...'#7'OnClick'#7#24'AddFi'
+'leBrowseButtonClick'#8'TabOrder'#2#1#0#0#7'TButton'#20'AddFileShortenButton'
+#23'AnchorSideRight.Control'#7#11'AddFilePage'#20'AnchorSideRight.Side'#7#9
+'asrBottom'#4'Left'#3#208#1#6'Height'#2#29#3'Top'#2#5#5'Width'#2'"'#7'Anchor'
+'asrBottom'#4'Left'#3#206#1#6'Height'#2#29#3'Top'#2#5#5'Width'#2'"'#7'Anchor'
+'s'#11#5'akTop'#7'akRight'#0#8'AutoSize'#9#7'Caption'#6#2'<>'#7'OnClick'#7#25
+'AddFileShortenButtonClick'#8'TabOrder'#2#2#0#0#11'TRadioGroup'#21'AddFileTy'
+'peRadioGroup'#21'AnchorSideTop.Control'#7#15'AddFilenameEdit'#18'AnchorSide'
@ -228,20 +228,20 @@ LazarusResources.Add('TAddToPackageDlg','FORMDATA',[
+'utton'#4'Left'#2'o'#6'Height'#2#29#3'Top'#2']'#5'Width'#3#143#0#8'AutoSize'
+#9#18'BorderSpacing.Left'#2#6#7'Caption'#6#19'CancelAddFileButton'#7'OnClick'
+#7#24'CancelAddFileButtonClick'#8'TabOrder'#2#5#0#0#0#5'TPage'#12'AddFilesPa'
+'ge'#7'Caption'#6#9'Add Files'#11'ClientWidth'#3#242#1#12'ClientHeight'#3#17
+'ge'#7'Caption'#6#9'Add Files'#11'ClientWidth'#3#240#1#12'ClientHeight'#3#13
+#1#0#9'TListView'#13'FilesListView'#24'AnchorSideBottom.Control'#7#17'FilesB'
+'rowseButton'#6'Height'#3#227#0#5'Width'#3#242#1#5'Align'#7#8'alClient'#20'B'
+'rowseButton'#6'Height'#3#223#0#5'Width'#3#240#1#5'Align'#7#8'alClient'#20'B'
+'orderSpacing.Bottom'#2#5#7'Columns'#14#1#7'Caption'#6#8'Filename'#5'Width'#3
+#200#0#0#1#7'Caption'#6#4'Type'#5'Width'#3#24#1#0#0#11'MultiSelect'#9#8'TabO'
+'rder'#2#0#9'ViewStyle'#7#8'vsReport'#0#0#6'TPanel'#16'AddFilesBtnPanel'#6'H'
+'eight'#2')'#3'Top'#3#232#0#5'Width'#3#242#1#5'Align'#7#8'alBottom'#8'AutoSi'
+'ze'#9#10'BevelOuter'#7#6'bvNone'#12'ClientHeight'#2')'#11'ClientWidth'#3#242
+'eight'#2')'#3'Top'#3#228#0#5'Width'#3#240#1#5'Align'#7#8'alBottom'#8'AutoSi'
+'ze'#9#10'BevelOuter'#7#6'bvNone'#12'ClientHeight'#2')'#11'ClientWidth'#3#240
+#1#8'TabOrder'#2#1#0#7'TButton'#17'FilesBrowseButton'#21'AnchorSideBottom.Si'
+'de'#7#9'asrBottom'#4'Left'#2#6#6'Height'#2#29#3'Top'#2#6#5'Width'#3#128#0#5
+'Align'#7#6'alLeft'#8'AutoSize'#9#20'BorderSpacing.Around'#2#6#7'Caption'#6
+#17'FilesBrowseButton'#7'OnClick'#7#22'FilesBrowseButtonClick'#8'TabOrder'#2
+#0#0#0#7'TButton'#14'FilesAddButton'#19'AnchorSideLeft.Side'#7#9'asrBottom'#4
+'Left'#3#242#1#6'Height'#2#29#3'Top'#2#6#5'Width'#2'k'#5'Align'#7#6'alLeft'#8
+'Left'#3#240#1#6'Height'#2#29#3'Top'#2#6#5'Width'#2'k'#5'Align'#7#6'alLeft'#8
+'AutoSize'#9#20'BorderSpacing.Around'#2#6#7'Caption'#6#14'FilesAddButton'#7
+'OnClick'#7#19'FilesAddButtonClick'#8'TabOrder'#2#1#0#0#7'TBitBtn'#18'FilesS'
+'hortenButton'#19'AnchorSideLeft.Side'#7#9'asrBottom'#4'Left'#3'{'#1#6'Heigh'

View File

@ -42,7 +42,8 @@ uses
ExtCtrls, Dialogs, FileUtil, ComCtrls, AVL_Tree, LCLProc,
NewItemIntf, ProjectIntf,
LazarusIDEStrConsts, IDEWindowIntf, InputHistory, CodeToolManager, IDEDefs,
IDEProcs, EnvironmentOpts, PackageSystem, PackageDefs, ComponentReg;
IDEProcs, EnvironmentOpts, PackageSystem, PackageDefs, ComponentReg,
AddDirToPkgDlg;
type
TAddToPkgType = (
@ -207,6 +208,7 @@ type
procedure UpdateAddFileInfo;
function SwitchRelativeAbsoluteFilename(const Filename: string): string;
procedure FillNewFileTreeView;
function FindFileInFilesList(AFilename: string): Integer;
public
Params: TAddToPkgResult;
procedure UpdateAvailableAncestorTypes;
@ -832,11 +834,13 @@ begin
for i:=0 to OpenDialog.Files.Count-1 do begin
AFilename:=CleanAndExpandFilename(OpenDialog.Files[i]);
if FileExists(AFilename) then begin
LazPackage.ShortenFilename(AFilename,true);
NewListItem:=FilesListView.Items.Add;
NewListItem.Caption:=AFilename;
NewPgkFileType:=FileNameToPkgFileType(AFilename);
NewListItem.SubItems.Add(GetPkgFileTypeLocalizedName(NewPgkFileType));
if FindFileInFilesList(AFilename)<0 then begin
LazPackage.ShortenFilename(AFilename,true);
NewListItem:=FilesListView.Items.Add;
NewListItem.Caption:=AFilename;
NewPgkFileType:=FileNameToPkgFileType(AFilename);
NewListItem.SubItems.Add(GetPkgFileTypeLocalizedName(NewPgkFileType));
end;
end;
end;
end;
@ -856,8 +860,29 @@ begin
end;
procedure TAddToPackageDlg.FilesDirButtonClick(Sender: TObject);
var
i: Integer;
Files: TStrings;
AFilename: string;
NewListItem: TListItem;
NewPgkFileType: TPkgFileType;
begin
Files:=nil;
try
if ShowAddDirToPkgDialog(LazPackage,Files)<>mrOk then exit;
for i:=0 to Files.Count-1 do begin
AFilename:=Files[i];
if FindFileInFilesList(AFilename)<0 then begin
LazPackage.ShortenFilename(AFilename,true);
NewListItem:=FilesListView.Items.Add;
NewListItem.Caption:=AFilename;
NewPgkFileType:=FileNameToPkgFileType(AFilename);
NewListItem.SubItems.Add(GetPkgFileTypeLocalizedName(NewPgkFileType));
end;
end;
finally
Files.Free;
end;
end;
procedure TAddToPackageDlg.FilesShortenButtonClick(Sender: TObject);
@ -1528,6 +1553,27 @@ begin
NewFileTreeView.EndUpdate;
end;
function TAddToPackageDlg.FindFileInFilesList(AFilename: string): Integer;
var
i: Integer;
Item: TListItem;
OtherFilename: String;
begin
if not FilenameIsAbsolute(AFilename) then
LazPackage.LongenFilename(AFilename);
for i:=0 to FilesListView.Items.Count-1 do begin
Item:=FilesListView.Items[i];
OtherFilename:=Item.Caption;
if not FilenameIsAbsolute(OtherFilename) then
LazPackage.LongenFilename(OtherFilename);
if CompareFilenames(AFilename,OtherFilename)=0 then begin
Result:=i;
exit;
end;
end;
Result:=-1;
end;
procedure TAddToPackageDlg.UpdateAvailableAncestorTypes;
var
ANode: TAVLTreeNode;