implemented adding files from directory in project inspector, fixed extrac proc checking overlapping blocks

git-svn-id: trunk@6690 -
This commit is contained in:
mattias 2005-01-26 15:45:08 +00:00
parent 8815a1a07d
commit 945205ad3c
14 changed files with 512 additions and 141 deletions

View File

@ -149,6 +149,7 @@ var
CursorNode: TCodeTreeNode; CursorNode: TCodeTreeNode;
BeginBlockNode: TCodeTreeNode; BeginBlockNode: TCodeTreeNode;
BlockCleanEnd: Integer; BlockCleanEnd: Integer;
BlockCleanStart: LongInt;
ANode: TCodeTreeNode; ANode: TCodeTreeNode;
ProcLvl: Integer; ProcLvl: Integer;
begin begin
@ -163,6 +164,7 @@ begin
if CaretToCleanPos(EndPos,CleanEndPos)<>0 then exit; if CaretToCleanPos(EndPos,CleanEndPos)<>0 then exit;
if CleanStartPos>=CleanEndPos then exit; if CleanStartPos>=CleanEndPos then exit;
{$IFDEF CTDebug} {$IFDEF CTDebug}
debugln('TExtractProcTool.CheckExtractProc Selection="',copy(Src,CleanStartPos,CleanEndPos-CleanStartPos),'"');
DebugLn('TExtractProcTool.CheckExtractProc node check ..'); DebugLn('TExtractProcTool.CheckExtractProc node check ..');
{$ENDIF} {$ENDIF}
// check if in a Begin..End block // check if in a Begin..End block
@ -178,24 +180,52 @@ begin
// check every block in selection // check every block in selection
while true do begin while true do begin
ReadNextAtom; ReadNextAtom;
if (CurPos.StartPos>SrcLen) or (CurPos.StartPos>CursorNode.EndPos) if (CurPos.EndPos>CleanEndPos) or (CurPos.StartPos>SrcLen)
or (CurPos.StartPos>CleanStartPos) then or (CurPos.StartPos>CursorNode.EndPos) then
break; break;
if WordIsLogicalBlockStart.DoItUpperCase(UpperSrc, //debugln('TExtractProcTool.CheckExtractProc A "',GetAtom,'"');
if WordIsBlockStatementStart.DoItUpperCase(UpperSrc,
CurPos.StartPos,CurPos.EndPos-CurPos.StartPos) CurPos.StartPos,CurPos.EndPos-CurPos.StartPos)
then begin then begin
if not ReadTilBlockEnd(true,false) then exit; //debugln('TExtractProcTool.CheckExtractProc WordIsBlockStatementStart "',GetAtom,'"');
BlockCleanStart:=CurPos.StartPos;
if not ReadTilBlockStatementEnd(true) then exit;
BlockCleanEnd:=CurPos.EndPos; BlockCleanEnd:=CurPos.EndPos;
if BlockCleanEnd<CleanEndPos then exit; debugln(copy(Src,BlockCleanStart,BlockCleanEnd-BlockCleanStart));
//debugln('TExtractProcTool.CheckExtractProc BlockEnd "',GetAtom,'" BlockCleanEnd=',dbgs(BlockCleanEnd),' CleanEndPos=',dbgs(CleanEndPos),' Result=',dbgs(Result),' BlockStartedInside=',dbgs(BlockCleanStart>=CleanStartPos));
if BlockCleanStart<CleanStartPos then begin
// this block started outside the selection
// -> it should end outside
if (BlockCleanEnd>=CleanStartPos) and (BlockCleanEnd<CleanEndPos) then
begin
// block overlaps selection
exit;
end;
if BlockCleanEnd>=CleanEndPos then begin
// set cursor back to block start
MoveCursorToCleanPos(BlockCleanStart);
ReadNextAtom;
end;
end else begin
// this block started inside the selection
// -> it should end inside
if (BlockCleanEnd>CleanEndPos) then begin
// block overlaps selection
exit;
end;
end;
//debugln('TExtractProcTool.CheckExtractProc Block ok');
end end
else if WordIsLogicalBlockEnd.DoItUpperCase(UpperSrc, else if WordIsBlockStatementEnd.DoItUpperCase(UpperSrc,
CurPos.StartPos,CurPos.EndPos-CurPos.StartPos) CurPos.StartPos,CurPos.EndPos-CurPos.StartPos)
then begin then begin
// a block ended inside, that started outside
exit; exit;
end end
else if WordIsLogicalBlockMiddle.DoItUpperCase(UpperSrc, else if WordIsBlockStatementMiddle.DoItUpperCase(UpperSrc,
CurPos.StartPos,CurPos.EndPos-CurPos.StartPos) CurPos.StartPos,CurPos.EndPos-CurPos.StartPos)
then begin then begin
// a block ended inside, that started outside
exit; exit;
end; end;
end; end;

View File

@ -110,6 +110,9 @@ var
WordIsLogicalBlockStart, WordIsLogicalBlockStart,
WordIsLogicalBlockEnd, WordIsLogicalBlockEnd,
WordIsLogicalBlockMiddle, WordIsLogicalBlockMiddle,
WordIsBlockStatementStart,
WordIsBlockStatementEnd,
WordIsBlockStatementMiddle,
WordIsBinaryOperator, WordIsBinaryOperator,
WordIsLvl1Operator, WordIsLvl2Operator, WordIsLvl3Operator, WordIsLvl4Operator, WordIsLvl1Operator, WordIsLvl2Operator, WordIsLvl3Operator, WordIsLvl4Operator,
WordIsBooleanOperator, WordIsBooleanOperator,
@ -1071,6 +1074,9 @@ begin
Add('}',{$ifdef FPC}@{$endif}AllwaysTrue); Add('}',{$ifdef FPC}@{$endif}AllwaysTrue);
Add('END',{$ifdef FPC}@{$endif}AllwaysTrue); Add('END',{$ifdef FPC}@{$endif}AllwaysTrue);
Add('UNTIL',{$ifdef FPC}@{$endif}AllwaysTrue); Add('UNTIL',{$ifdef FPC}@{$endif}AllwaysTrue);
Add('IMPLEMENTATION',{$ifdef FPC}@{$endif}AllwaysTrue);
Add('INITIALIZATION',{$ifdef FPC}@{$endif}AllwaysTrue);
Add('FINALIZATION',{$ifdef FPC}@{$endif}AllwaysTrue);
end; end;
WordIsLogicalBlockMiddle:=TKeyWordFunctionList.Create; WordIsLogicalBlockMiddle:=TKeyWordFunctionList.Create;
@ -1080,6 +1086,37 @@ begin
Add('EXCEPT',{$ifdef FPC}@{$endif}AllwaysTrue); Add('EXCEPT',{$ifdef FPC}@{$endif}AllwaysTrue);
end; end;
WordIsBlockStatementStart:=TKeyWordFunctionList.Create;
KeyWordLists.Add(WordIsBlockStatementStart);
with WordIsBlockStatementStart do begin
Add('(',{$ifdef FPC}@{$endif}AllwaysTrue);
Add('[',{$ifdef FPC}@{$endif}AllwaysTrue);
Add('{',{$ifdef FPC}@{$endif}AllwaysTrue);
Add('ASM',{$ifdef FPC}@{$endif}AllwaysTrue);
Add('BEGIN',{$ifdef FPC}@{$endif}AllwaysTrue);
Add('CASE',{$ifdef FPC}@{$endif}AllwaysTrue);
Add('REPEAT',{$ifdef FPC}@{$endif}AllwaysTrue);
Add('TRY',{$ifdef FPC}@{$endif}AllwaysTrue);
Add('UNIT',{$ifdef FPC}@{$endif}AllwaysTrue);
end;
WordIsBlockStatementEnd:=TKeyWordFunctionList.Create;
KeyWordLists.Add(WordIsBlockStatementEnd);
with WordIsBlockStatementEnd do begin
Add(')',{$ifdef FPC}@{$endif}AllwaysTrue);
Add(']',{$ifdef FPC}@{$endif}AllwaysTrue);
Add('}',{$ifdef FPC}@{$endif}AllwaysTrue);
Add('END',{$ifdef FPC}@{$endif}AllwaysTrue);
Add('UNTIL',{$ifdef FPC}@{$endif}AllwaysTrue);
end;
WordIsBlockStatementMiddle:=TKeyWordFunctionList.Create;
KeyWordLists.Add(WordIsBlockStatementMiddle);
with WordIsBlockStatementMiddle do begin
Add('FINALLY',{$ifdef FPC}@{$endif}AllwaysTrue);
Add('EXCEPT',{$ifdef FPC}@{$endif}AllwaysTrue);
end;
WordIsBinaryOperator:=TKeyWordFunctionList.Create; WordIsBinaryOperator:=TKeyWordFunctionList.Create;
KeyWordLists.Add(WordIsBinaryOperator); KeyWordLists.Add(WordIsBinaryOperator);
with WordIsBinaryOperator do begin with WordIsBinaryOperator do begin

View File

@ -184,6 +184,7 @@ type
function ReadSubRange(ExceptionOnError: boolean): boolean; function ReadSubRange(ExceptionOnError: boolean): boolean;
function ReadTilBlockEnd(StopOnBlockMiddlePart, function ReadTilBlockEnd(StopOnBlockMiddlePart,
CreateNodes: boolean): boolean; CreateNodes: boolean): boolean;
function ReadTilBlockStatementEnd(ExceptionOnNotFound: boolean): boolean;
function ReadBackTilBlockEnd(StopOnBlockMiddlePart: boolean): boolean; function ReadBackTilBlockEnd(StopOnBlockMiddlePart: boolean): boolean;
function ReadTilVariableEnd(ExceptionOnError: boolean): boolean; function ReadTilVariableEnd(ExceptionOnError: boolean): boolean;
function ReadTilStatementEnd(ExceptionOnError, function ReadTilStatementEnd(ExceptionOnError,
@ -1947,6 +1948,19 @@ begin
until false; until false;
end; end;
function TPascalParserTool.ReadTilBlockStatementEnd(
ExceptionOnNotFound: boolean): boolean;
begin
if CurPos.Flag in [cafRoundBracketOpen,cafEdgedBracketOpen] then
Result:=ReadTilBracketClose(ExceptionOnNotFound)
else if WordIsBlockStatementStart.DoItUpperCase(UpperSrc,
CurPos.StartPos,CurPos.EndPos-CurPos.StartPos)
then
Result:=ReadTilBlockEnd(false,false)
else
Result:=false;
end;
function TPascalParserTool.ReadBackTilBlockEnd( function TPascalParserTool.ReadBackTilBlockEnd(
StopOnBlockMiddlePart: boolean): boolean; StopOnBlockMiddlePart: boolean): boolean;
// read begin..end, try..finally, case..end, repeat..until, asm..end blocks // read begin..end, try..finally, case..end, repeat..until, asm..end blocks

View File

@ -3448,7 +3448,7 @@ begin
// jump backward to matching bracket // jump backward to matching bracket
if not ReadBackwardTilAnyBracketClose then exit; if not ReadBackwardTilAnyBracketClose then exit;
end end
else if WordIsLogicalBlockStart.DoItUpperCase(UpperSrc, else if WordIsBlockStatementStart.DoItUpperCase(UpperSrc,
CurPos.StartPos,CurPos.EndPos-CurPos.StartPos) then CurPos.StartPos,CurPos.EndPos-CurPos.StartPos) then
begin begin
// block start found // block start found
@ -3545,7 +3545,7 @@ begin
// jump backward to matching bracket // jump backward to matching bracket
if not ReadBackwardTilAnyBracketClose then exit; if not ReadBackwardTilAnyBracketClose then exit;
end end
else if WordIsLogicalBlockStart.DoItUpperCase(UpperSrc, else if WordIsBlockStatementStart.DoItUpperCase(UpperSrc,
CurPos.StartPos,CurPos.EndPos-CurPos.StartPos) then CurPos.StartPos,CurPos.EndPos-CurPos.StartPos) then
begin begin
// block start found // block start found

View File

@ -39,7 +39,7 @@ uses
ComCtrls, StdCtrls, ExtCtrls, Menus, Dialogs, Graphics, FileUtil, ComCtrls, StdCtrls, ExtCtrls, Menus, Dialogs, Graphics, FileUtil,
{$IFNDEF VER1_0}AVL_Tree{$ELSE}OldAvLTree{$ENDIF}, {$IFNDEF VER1_0}AVL_Tree{$ELSE}OldAvLTree{$ENDIF},
LazarusIDEStrConsts, IDEProcs, IDEOptionDefs, EnvironmentOpts, LazarusIDEStrConsts, IDEProcs, IDEOptionDefs, EnvironmentOpts,
Project, PackageDefs, PackageSystem; Project, PackageDefs, PackageSystem, InputHistory;
type type
TAddToProjectType = ( TAddToProjectType = (
@ -51,15 +51,18 @@ type
public public
AddType: TAddToProjectType; AddType: TAddToProjectType;
Dependency: TPkgDependency; Dependency: TPkgDependency;
Files: TList; // list of TUnitInfo FileNames: TStrings;
destructor Destroy; override; destructor Destroy; override;
end; end;
{ TAddToProjectDialog }
TAddToProjectDialog = class(TForm) TAddToProjectDialog = class(TForm)
// notebook // notebook
NoteBook: TNoteBook; NoteBook: TNoteBook;
AddFilePage: TPage; AddEditorFilePage: TPage;
NewDependPage: TPage; NewDependPage: TPage;
AddFilesPage: TPage;
// add file page // add file page
AddFileLabel: TLabel; AddFileLabel: TLabel;
AddFileListBox: TListBox; AddFileListBox: TListBox;
@ -74,14 +77,29 @@ type
DependMaxVersionEdit: TEdit; DependMaxVersionEdit: TEdit;
NewDependButton: TButton; NewDependButton: TButton;
CancelDependButton: TButton; CancelDependButton: TButton;
// add files page
FilesListView: TListView;
FilesBrowseButton: TButton;
FilesShortenButton: TButton;
FilesDeleteButton: TButton;
FilesAddButton: TButton;
procedure AddFileButtonClick(Sender: TObject); procedure AddFileButtonClick(Sender: TObject);
procedure AddFilePageResize(Sender: TObject); procedure AddFilePageResize(Sender: TObject);
procedure AddToProjectDialogClose(Sender: TObject; procedure AddToProjectDialogClose(Sender: TObject;
var CloseAction: TCloseAction); var CloseAction: TCloseAction);
procedure NewDependButtonClick(Sender: TObject); procedure NewDependButtonClick(Sender: TObject);
procedure NewDependPageResize(Sender: TObject); procedure NewDependPageResize(Sender: TObject);
procedure FilesAddButtonClick(Sender: TObject);
procedure FilesBrowseButtonClick(Sender: TObject);
procedure FilesDeleteButtonClick(Sender: TObject);
procedure FilesShortenButtonClick(Sender: TObject);
private private
fPackages: TAVLTree;// tree of TLazPackage or TPackageLink fPackages: TAVLTree;// tree of TLazPackage or TPackageLink
function CheckAddingFile(NewFiles: TStringList; var NewFilename: string
): TModalResult;
procedure SetupAddEditorFilePage;
procedure SetupAddRequirementPage;
procedure SetupAddFilesPage;
procedure SetupComponents; procedure SetupComponents;
procedure OnIteratePackages(APackageID: TLazPackageID); procedure OnIteratePackages(APackageID: TLazPackageID);
public public
@ -253,66 +271,25 @@ procedure TAddToProjectDialog.AddFileButtonClick(Sender: TObject);
var var
i: Integer; i: Integer;
NewFilename: string; NewFilename: string;
NewUnitName: String; NewFiles: TStringList;
NewFiles: TList;
NewFile: TUnitInfo;
j: Integer;
OtherFile: TUnitInfo;
OtherUnitName: String;
ConflictFile: TUnitInfo;
begin begin
try try
NewFiles:=TList.Create; NewFiles:=TStringList.Create;
for i:=0 to AddFileListBox.Items.Count-1 do begin for i:=0 to AddFileListBox.Items.Count-1 do begin
if not AddFileListBox.Selected[i] then continue; if not AddFileListBox.Selected[i] then continue;
NewFilename:=AddFileListBox.Items[i]; NewFilename:=AddFileListBox.Items[i];
// expand filename case CheckAddingFile(NewFiles, NewFilename) of
if not FilenameIsAbsolute(NewFilename) then mrOk: ;
NewFilename:= mrIgnore: continue;
TrimFilename(TheProject.ProjectDirectory+PathDelim+NewFilename); else
NewFile:=TheProject.UnitInfoWithFilename(NewFilename);
if NewFile=nil then continue;
// check unit name
if FilenameIsPascalUnit(NewFilename) then begin
// check unitname is valid pascal identifier
NewUnitName:=ExtractFileNameOnly(NewFilename);
if (NewUnitName='') or not (IsValidIdent(NewUnitName)) then begin
MessageDlg(lisProjAddInvalidPascalUnitName,
Format(lisProjAddTheUnitNameIsNotAValidPascalIdentifier, ['"',
NewUnitName, '"']),
mtWarning,[mbIgnore,mbCancel],0);
exit; exit;
end; end;
// check if unitname already exists in project NewFiles.Add(NewFilename);
ConflictFile:=TheProject.UnitWithUnitname(NewUnitName);
if ConflictFile<>nil then begin
MessageDlg(lisProjAddUnitNameAlreadyExists,
Format(lisProjAddTheUnitNameAlreadyExistsInTheProject, ['"',
NewUnitName, '"', #13, '"', ConflictFile.Filename, '"']),
mtWarning,[mbCancel],0);
exit;
end;
// check if unitname already exists in selection
for j:=0 to NewFiles.Count-1 do begin
OtherFile:=TUnitInfo(NewFiles[j]);
if FilenameIsPascalUnit(OtherFile.Filename) then begin
OtherUnitName:=ExtractFileNameOnly(OtherFile.Filename);
if AnsiCompareText(OtherUnitName,NewUnitName)=0 then begin
MessageDlg(lisProjAddUnitNameAlreadyExists,
Format(lisProjAddTheUnitNameAlreadyExistsInTheSelection, ['"',
NewUnitName, '"', #13, '"', OtherFile.Filename, '"']),
mtWarning,[mbCancel],0);
exit;
end;
end;
end;
end;
NewFiles.Add(NewFile);
end; end;
// everything ok // everything ok
AddResult:=TAddToProjectResult.Create; AddResult:=TAddToProjectResult.Create;
AddResult.AddType:=a2pFiles; AddResult.AddType:=a2pFiles;
AddResult.Files:=NewFiles; AddResult.FileNames:=NewFiles;
NewFiles:=nil; NewFiles:=nil;
finally finally
NewFiles.Free; NewFiles.Free;
@ -357,56 +334,130 @@ begin
SetBounds(x+NewDependButton.Width+10,y,80,Height); SetBounds(x+NewDependButton.Width+10,y,80,Height);
end; end;
procedure TAddToProjectDialog.FilesAddButtonClick(Sender: TObject);
var
i: Integer;
NewFilename: string;
NewFiles: TStringList;
begin
try
NewFiles:=TStringList.Create;
for i:=0 to FilesListView.Items.Count-1 do begin
NewFilename:=FilesListView.Items[i].Caption;
case CheckAddingFile(NewFiles, NewFilename) of
mrOk: ;
mrIgnore: continue;
else
exit;
end;
NewFiles.Add(NewFilename);
end;
// everything ok
AddResult:=TAddToProjectResult.Create;
AddResult.AddType:=a2pFiles;
AddResult.FileNames:=NewFiles;
NewFiles:=nil;
finally
NewFiles.Free;
end;
ModalResult:=mrOk;
end;
procedure TAddToProjectDialog.FilesBrowseButtonClick(Sender: TObject);
var
OpenDialog: TOpenDialog;
AFilename: string;
i: Integer;
NewListItem: TListItem;
NewPgkFileType: TPkgFileType;
ADirectory: String;
begin
OpenDialog:=TOpenDialog.Create(nil);
try
InputHistories.ApplyFileDialogSettings(OpenDialog);
ADirectory:=TheProject.ProjectDirectory;
if not FilenameIsAbsolute(ADirectory) then ADirectory:='';
if ADirectory<>'' then
OpenDialog.InitialDir:=ADirectory;
OpenDialog.Title:=lisOpenFile;
OpenDialog.Options:=OpenDialog.Options
+[ofFileMustExist,ofPathMustExist,ofAllowMultiSelect];
if OpenDialog.Execute then begin
for i:=0 to OpenDialog.Files.Count-1 do begin
AFilename:=CleanAndExpandFilename(OpenDialog.Files[i]);
if FileExists(AFilename) then begin
if ADirectory<>'' then
AFilename:=CreateRelativePath(AFilename,ADirectory);
NewListItem:=FilesListView.Items.Add;
NewListItem.Caption:=AFilename;
NewPgkFileType:=FileNameToPkgFileType(AFilename);
NewListItem.SubItems.Add(GetPkgFileTypeLocalizedName(NewPgkFileType));
end;
end;
end;
InputHistories.StoreFileDialogSettings(OpenDialog);
finally
OpenDialog.Free;
end;
end;
procedure TAddToProjectDialog.FilesDeleteButtonClick(Sender: TObject);
var
i: Integer;
begin
for i:=FilesListView.Items.Count-1 downto 0 do
if FilesListView.Items[i].Selected then
FilesListView.Items.Delete(i);
end;
procedure TAddToProjectDialog.FilesShortenButtonClick(Sender: TObject);
var
SwitchToAbsolute: Boolean;
i: Integer;
Filename: String;
ADirectory: String;
begin
if FilesListView.Items.Count=0 then exit;
if (TheProject=nil)
or (not FilenameIsAbsolute(TheProject.ProjectDirectory)) then exit;
ADirectory:=TheProject.ProjectDirectory;
SwitchToAbsolute:=not FilenameIsAbsolute(FilesListView.Items[0].Caption);
for i:=0 to FilesListView.Items.Count-1 do begin
Filename:=FilesListView.Items[i].Caption;
if SwitchToAbsolute then
Filename:=CreateAbsolutePath(Filename,ADirectory)
else
Filename:=CreateRelativePath(Filename,ADirectory);
FilesListView.Items[i].Caption:=Filename;
end;
end;
procedure TAddToProjectDialog.SetupComponents; procedure TAddToProjectDialog.SetupComponents;
begin begin
NoteBook:=TNoteBook.Create(Self); NoteBook:=TNoteBook.Create(Self);
with NoteBook do begin with NoteBook do begin
Name:='NoteBook'; Name:='NoteBook';
Parent:=Self; Parent:=Self;
Pages.Add('Add File'); Pages.Add(lisProjAddEditorFile);
AddFilePage:=Page[0]; AddEditorFilePage:=Page[0];
Pages.Add(lisProjAddNewRequirement); Pages.Add(lisProjAddNewRequirement);
NewDependPage:=Page[1]; NewDependPage:=Page[1];
Pages.Add(lisProjAddFiles);
AddFilesPage:=Page[2];
PageIndex:=0; PageIndex:=0;
Align:=alClient; Align:=alClient;
end; end;
AddFilePage.OnResize:=@AddFilePageResize; AddEditorFilePage.OnResize:=@AddFilePageResize;
NewDependPage.OnResize:=@NewDependPageResize; NewDependPage.OnResize:=@NewDependPageResize;
AddFileLabel:=TLabel.Create(Self); SetupAddEditorFilePage;
with AddFileLabel do begin SetupAddRequirementPage;
Name:='AddFileLabel'; SetupAddFilesPage;
Parent:=AddFilePage;
Caption:=lisProjAddAddFileToProject;
end; end;
AddFileListBox:=TListBox.Create(Self); procedure TAddToProjectDialog.SetupAddRequirementPage;
with AddFileListBox do begin begin
Name:='AddFileListBox';
Parent:=AddFilePage;
MultiSelect:=true;
end;
AddFileButton:=TButton.Create(Self);
with AddFileButton do begin
Name:='AddFileButton';
Parent:=AddFilePage;
Caption:=lisLazBuildOk;
OnClick:=@AddFileButtonClick;
end;
CancelAddFileButton:=TButton.Create(Self);
with CancelAddFileButton do begin
Name:='CancelAddFileButton';
Parent:=AddFilePage;
Caption:=dlgCancel;
ModalResult:=mrCancel;
end;
// add required package
DependPkgNameLabel:=TLabel.Create(Self); DependPkgNameLabel:=TLabel.Create(Self);
with DependPkgNameLabel do begin with DependPkgNameLabel do begin
Name:='DependPkgNameLabel'; Name:='DependPkgNameLabel';
@ -466,12 +517,169 @@ begin
end; end;
end; end;
procedure TAddToProjectDialog.SetupAddFilesPage;
var
CurColumn: TListColumn;
begin
FilesListView:=TListView.Create(Self);
with FilesListView do begin
Name:='FilesListView';
Parent:=AddFilesPage;
MultiSelect:=true;
ViewStyle:=vsReport;
CurColumn:=Columns.Add;
CurColumn.Width:=200;
CurColumn.Caption:=lisA2PFilename2;
CurColumn:=Columns.Add;
CurColumn.Caption:=dlgEnvType;
Align:=alTop;
end;
FilesBrowseButton:=TButton.Create(Self);
with FilesBrowseButton do begin
Name:='FilesBrowseButton';
Parent:=AddFilesPage;
Caption:=lisPathEditBrowse;
AutoSize:=true;
Anchors:=[akLeft,akBottom];
Left:=5;
AnchorParallel(akBottom,5,Parent);
OnClick:=@FilesBrowseButtonClick;
end;
FilesListView.AnchorToNeighbour(akBottom,5,FilesBrowseButton);
FilesShortenButton:=TButton.Create(Self);
with FilesShortenButton do begin
Name:='FilesShortenButton';
Parent:=AddFilesPage;
Caption:=lisA2PSwitchPaths;
AutoSize:=true;
AnchorToNeighbour(akLeft,5,FilesBrowseButton);
AnchorVerticalCenterTo(FilesBrowseButton);
OnClick:=@FilesShortenButtonClick;
end;
FilesDeleteButton:=TButton.Create(Self);
with FilesDeleteButton do begin
Name:='FilesDeleteButton';
Parent:=AddFilesPage;
Caption:=dlgEdDelete;
AutoSize:=true;
AnchorToNeighbour(akLeft,5,FilesShortenButton);
AnchorVerticalCenterTo(FilesBrowseButton);
OnClick:=@FilesDeleteButtonClick;
end;
FilesAddButton:=TButton.Create(Self);
with FilesAddButton do begin
Name:='FilesAddButton';
Parent:=AddFilesPage;
Caption:=lisA2PAddFilesToPackage;
AutoSize:=true;
AnchorToNeighbour(akLeft,5,FilesDeleteButton);
AnchorVerticalCenterTo(FilesBrowseButton);
OnClick:=@FilesAddButtonClick;
end;
end;
procedure TAddToProjectDialog.OnIteratePackages(APackageID: TLazPackageID); procedure TAddToProjectDialog.OnIteratePackages(APackageID: TLazPackageID);
begin begin
if (fPackages.Find(APackageID)=nil) then if (fPackages.Find(APackageID)=nil) then
fPackages.Add(APackageID); fPackages.Add(APackageID);
end; end;
procedure TAddToProjectDialog.SetupAddEditorFilePage;
begin
AddFileLabel:=TLabel.Create(Self);
with AddFileLabel do begin
Name:='AddFileLabel';
Parent:=AddEditorFilePage;
Caption:=lisProjAddAddFileToProject;
end;
AddFileListBox:=TListBox.Create(Self);
with AddFileListBox do begin
Name:='AddFileListBox';
Parent:=AddEditorFilePage;
MultiSelect:=true;
end;
AddFileButton:=TButton.Create(Self);
with AddFileButton do begin
Name:='AddFileButton';
Parent:=AddEditorFilePage;
Caption:=lisLazBuildOk;
OnClick:=@AddFileButtonClick;
end;
CancelAddFileButton:=TButton.Create(Self);
with CancelAddFileButton do begin
Name:='CancelAddFileButton';
Parent:=AddEditorFilePage;
Caption:=dlgCancel;
ModalResult:=mrCancel;
end;
end;
function TAddToProjectDialog.CheckAddingFile(NewFiles: TStringList;
var NewFilename: string): TModalResult;
var
ConflictFile: TUnitInfo;
OtherUnitName: String;
OtherFile: string;
j: Integer;
NewFile: TUnitInfo;
NewUnitName: String;
begin
Result:=mrCancel;
// expand filename
if not FilenameIsAbsolute(NewFilename) then
NewFilename:=
TrimFilename(TheProject.ProjectDirectory+PathDelim+NewFilename);
// check if file is already part of project
NewFile:=TheProject.UnitInfoWithFilename(NewFilename);
if (NewFile<>nil) and NewFile.IsPartOfProject then begin
Result:=mrIgnore;
exit;
end;
// check unit name
if FilenameIsPascalUnit(NewFilename) then begin
// check unitname is valid pascal identifier
NewUnitName:=ExtractFileNameOnly(NewFilename);
if (NewUnitName='') or not (IsValidIdent(NewUnitName)) then begin
MessageDlg(lisProjAddInvalidPascalUnitName,
Format(lisProjAddTheUnitNameIsNotAValidPascalIdentifier, ['"',
NewUnitName, '"']),
mtWarning, [mbIgnore, mbCancel], 0);
exit;
end;
// check if unitname already exists in project
ConflictFile:=TheProject.UnitWithUnitname(NewUnitName);
if ConflictFile<>nil then begin
MessageDlg(lisProjAddUnitNameAlreadyExists,
Format(lisProjAddTheUnitNameAlreadyExistsInTheProject, ['"',
NewUnitName, '"', #13, '"', ConflictFile.Filename, '"']),
mtWarning, [mbCancel, mbIgnore], 0);
exit;
end;
// check if unitname already exists in selection
for j:=0 to NewFiles.Count-1 do begin
OtherFile:=NewFiles[j];
if FilenameIsPascalUnit(OtherFile) then begin
OtherUnitName:=ExtractFileNameOnly(OtherFile);
if CompareText(OtherUnitName, NewUnitName)=0 then begin
MessageDlg(lisProjAddUnitNameAlreadyExists,
Format(lisProjAddTheUnitNameAlreadyExistsInTheSelection, ['"',
NewUnitName, '"', #13, '"', OtherFile, '"']),
mtWarning, [mbCancel], 0);
exit;
end;
end;
end;
end;
Result:=mrOk;
end;
constructor TAddToProjectDialog.Create(TheOwner: TComponent); constructor TAddToProjectDialog.Create(TheOwner: TComponent);
begin begin
inherited Create(TheOwner); inherited Create(TheOwner);
@ -540,7 +748,7 @@ end;
destructor TAddToProjectResult.Destroy; destructor TAddToProjectResult.Destroy;
begin begin
Files.Free; FileNames.Free;
inherited Destroy; inherited Destroy;
end; end;

View File

@ -1783,7 +1783,7 @@ Processor specific options:
// unit path // unit path
CurUnitPath:=GetUnitPath(true); CurUnitPath:=GetUnitPath(true);
debugln('TBaseCompilerOptions.MakeOptionsString A ',dbgsName(Self),' CurUnitPath="',CurUnitPath,'"'); //debugln('TBaseCompilerOptions.MakeOptionsString A ',dbgsName(Self),' CurUnitPath="',CurUnitPath,'"');
// always add the current directory to the unit path, so that the compiler // always add the current directory to the unit path, so that the compiler
// checks for changed files in the directory // checks for changed files in the directory
CurUnitPath:=CurUnitPath+';.'; CurUnitPath:=CurUnitPath+';.';

View File

@ -1907,6 +1907,8 @@ resourcestring
lisProjAddTheUnitNameAlreadyExistsInTheSelection = 'The unit name %s%s%s ' lisProjAddTheUnitNameAlreadyExistsInTheSelection = 'The unit name %s%s%s '
+'already exists in the selection%swith file: %s%s%s.'; +'already exists in the selection%swith file: %s%s%s.';
lisProjAddNewRequirement = 'New Requirement'; lisProjAddNewRequirement = 'New Requirement';
lisProjAddFiles = 'Add files';
lisProjAddEditorFile = 'Add editor files';
lisProjAddAddFileToProject = 'Add file to project:'; lisProjAddAddFileToProject = 'Add file to project:';
lisProjAddPackageName = 'Package Name:'; lisProjAddPackageName = 'Package Name:';
lisProjAddMinimumVersionOptional = 'Minimum Version (optional):'; lisProjAddMinimumVersionOptional = 'Minimum Version (optional):';

View File

@ -11380,6 +11380,9 @@ end.
{ ============================================================================= { =============================================================================
$Log$ $Log$
Revision 1.839 2005/01/26 15:45:07 mattias
implemented adding files from directory in project inspector, fixed extrac proc checking overlapping blocks
Revision 1.838 2005/01/25 01:14:19 mattias Revision 1.838 2005/01/25 01:14:19 mattias
implemented automatic redirecting of package output directory and filestate cache implemented automatic redirecting of package output directory and filestate cache

View File

@ -216,8 +216,9 @@ end;
procedure TProjectInspectorForm.AddBitBtnClick(Sender: TObject); procedure TProjectInspectorForm.AddBitBtnClick(Sender: TObject);
var var
AddResult: TAddToProjectResult; AddResult: TAddToProjectResult;
NewFile: TUnitInfo;
i: Integer; i: Integer;
NewFilename: string;
NewFile: TUnitInfo;
begin begin
if ShowAddToProjectDlg(LazProject,AddResult)<>mrOk then exit; if ShowAddToProjectDlg(LazProject,AddResult)<>mrOk then exit;
@ -225,8 +226,16 @@ begin
a2pFiles: a2pFiles:
begin begin
BeginUpdate; BeginUpdate;
for i:=0 to AddResult.Files.Count-1 do begin for i:=0 to AddResult.FileNames.Count-1 do begin
NewFile:=TUnitInfo(AddResult.Files[i]); NewFilename:=AddResult.FileNames[i];
NewFile:=LazProject.UnitInfoWithFilename(NewFilename);
if NewFile<>nil then begin
if NewFile.IsPartOfProject then continue;
end else begin
NewFile:=TUnitInfo.Create(nil);
NewFile.Filename:=NewFilename;
LazProject.AddFile(NewFile,false);
end;
NewFile.IsPartOfProject:=true; NewFile.IsPartOfProject:=true;
if Assigned(OnAddUnitToProject) then begin if Assigned(OnAddUnitToProject) then begin
if OnAddUnitToProject(Self,NewFile)<>mrOk then break; if OnAddUnitToProject(Self,NewFile)<>mrOk then break;

View File

@ -1120,6 +1120,8 @@ type
function AutoSizeDelayed: boolean; virtual; function AutoSizeDelayed: boolean; virtual;
procedure AnchorToNeighbour(Side: TAnchorKind; Space: integer; procedure AnchorToNeighbour(Side: TAnchorKind; Space: integer;
Sibling: TControl); Sibling: TControl);
procedure AnchorParallel(Side: TAnchorKind; Space: integer;
Sibling: TControl);
procedure AnchorHorizontalCenterTo(Sibling: TControl); procedure AnchorHorizontalCenterTo(Sibling: TControl);
procedure AnchorVerticalCenterTo(Sibling: TControl); procedure AnchorVerticalCenterTo(Sibling: TControl);
procedure SetBounds(aLeft, aTop, aWidth, aHeight: integer); virtual; procedure SetBounds(aLeft, aTop, aWidth, aHeight: integer); virtual;
@ -2660,7 +2662,7 @@ begin
Position:=0; Position:=0;
OwnerParent:=FOwner.Parent; OwnerParent:=FOwner.Parent;
if OwnerParent=nil then begin if OwnerParent=nil then begin
// AnchorSide is only between siblings allowed // AnchorSide is only between siblings or its direct parent allowed
ReferenceControl:=nil; ReferenceControl:=nil;
exit; exit;
end; end;
@ -2676,9 +2678,10 @@ begin
exit; exit;
end; end;
// check sibling // check if ReferenceControl is valid
if (ReferenceControl.Parent<>OwnerParent) then begin if (ReferenceControl.Parent<>OwnerParent)
// not a sibling -> invalid AnchorSide and (ReferenceControl<>OwnerParent) then begin
// not a sibling and not the parent -> invalid AnchorSide
ReferenceControl:=nil; ReferenceControl:=nil;
exit; exit;
end; end;
@ -2695,24 +2698,38 @@ begin
asrTop: asrTop:
if Kind in [akLeft,akRight] then begin if Kind in [akLeft,akRight] then begin
// anchor to left side of ReferenceControl // anchor to left side of ReferenceControl
if ReferenceControl=OwnerParent then
Position:=0
else
Position:=ReferenceControl.Left; Position:=ReferenceControl.Left;
if Kind=akLeft then begin if Kind=akLeft then begin
// anchor left of ReferenceControl and left of Owner // anchor left of ReferenceControl and left of Owner
inc(Position,OwnerBorderSpacing); inc(Position,OwnerBorderSpacing);
end else begin end else begin
// anchor left of ReferenceControl and right of Owner // anchor left of ReferenceControl and right of Owner
if ReferenceControl=OwnerParent then
OwnerBorderSpacing:=Max(OwnerBorderSpacing,
OwnerParent.ChildSizing.LeftRightSpacing)
else
OwnerBorderSpacing:=Max(OwnerBorderSpacing, OwnerBorderSpacing:=Max(OwnerBorderSpacing,
ReferenceControl.BorderSpacing.GetSpace(akLeft)); ReferenceControl.BorderSpacing.GetSpace(akLeft));
dec(Position,OwnerBorderSpacing); dec(Position,OwnerBorderSpacing);
end; end;
end else begin end else begin
// anchor to top side of ReferenceControl // anchor to top side of ReferenceControl
if ReferenceControl=OwnerParent then
Position:=0
else
Position:=ReferenceControl.Top; Position:=ReferenceControl.Top;
if Kind=akTop then begin if Kind=akTop then begin
// anchor top of ReferenceControl and top of Owner // anchor top of ReferenceControl and top of Owner
inc(Position,OwnerBorderSpacing); inc(Position,OwnerBorderSpacing);
end else begin end else begin
// anchor top of ReferenceControl and bottom of Owner // anchor top of ReferenceControl and bottom of Owner
if ReferenceControl=OwnerParent then
OwnerBorderSpacing:=Max(OwnerBorderSpacing,
OwnerParent.ChildSizing.TopBottomSpacing)
else
OwnerBorderSpacing:=Max(OwnerBorderSpacing, OwnerBorderSpacing:=Max(OwnerBorderSpacing,
ReferenceControl.BorderSpacing.GetSpace(akTop)); ReferenceControl.BorderSpacing.GetSpace(akTop));
dec(Position,OwnerBorderSpacing); dec(Position,OwnerBorderSpacing);
@ -2722,9 +2739,16 @@ begin
asrBottom: asrBottom:
if Kind in [akLeft,akRight] then begin if Kind in [akLeft,akRight] then begin
// anchor to right side of ReferenceControl // anchor to right side of ReferenceControl
if ReferenceControl=OwnerParent then
Position:=OwnerParent.ClientWidth
else
Position:=ReferenceControl.Left+ReferenceControl.Width; Position:=ReferenceControl.Left+ReferenceControl.Width;
if Kind=akLeft then begin if Kind=akLeft then begin
// anchor right of ReferenceControl and left of Owner // anchor right of ReferenceControl and left of Owner
if ReferenceControl=OwnerParent then
OwnerBorderSpacing:=Max(OwnerBorderSpacing,
OwnerParent.ChildSizing.LeftRightSpacing)
else
OwnerBorderSpacing:=Max(OwnerBorderSpacing, OwnerBorderSpacing:=Max(OwnerBorderSpacing,
ReferenceControl.BorderSpacing.GetSpace(akRight)); ReferenceControl.BorderSpacing.GetSpace(akRight));
inc(Position,OwnerBorderSpacing); inc(Position,OwnerBorderSpacing);
@ -2734,9 +2758,16 @@ begin
end; end;
end else begin end else begin
// anchor to bottom side of ReferenceControl // anchor to bottom side of ReferenceControl
if ReferenceControl=OwnerParent then
Position:=OwnerParent.ClientHeight
else
Position:=ReferenceControl.Top+ReferenceControl.Height; Position:=ReferenceControl.Top+ReferenceControl.Height;
if Kind=akTop then begin if Kind=akTop then begin
// anchor bottom of ReferenceControl and top of Owner // anchor bottom of ReferenceControl and top of Owner
if ReferenceControl=OwnerParent then
OwnerBorderSpacing:=Max(OwnerBorderSpacing,
OwnerParent.ChildSizing.TopBottomSpacing)
else
OwnerBorderSpacing:=Max(OwnerBorderSpacing, OwnerBorderSpacing:=Max(OwnerBorderSpacing,
ReferenceControl.BorderSpacing.GetSpace(akBottom)); ReferenceControl.BorderSpacing.GetSpace(akBottom));
inc(Position,OwnerBorderSpacing); inc(Position,OwnerBorderSpacing);
@ -2749,6 +2780,9 @@ begin
asrCenter: asrCenter:
if Kind in [akLeft,akRight] then begin if Kind in [akLeft,akRight] then begin
// center horizontally // center horizontally
if ReferenceControl=OwnerParent then
Position:=OwnerParent.ClientWidth div 2
else
Position:=ReferenceControl.Left+(ReferenceControl.Width div 2); Position:=ReferenceControl.Left+(ReferenceControl.Width div 2);
if Kind=akLeft then if Kind=akLeft then
dec(Position,FOwner.Width div 2) dec(Position,FOwner.Width div 2)
@ -2756,6 +2790,9 @@ begin
inc(Position,FOwner.Width div 2); inc(Position,FOwner.Width div 2);
end else begin end else begin
// center vertically // center vertically
if ReferenceControl=OwnerParent then
Position:=OwnerParent.ClientHeight div 2
else
Position:=ReferenceControl.Top+(ReferenceControl.Height div 2); Position:=ReferenceControl.Top+(ReferenceControl.Height div 2);
if Kind=akTop then if Kind=akTop then
dec(Position,FOwner.Height div 2) dec(Position,FOwner.Height div 2)
@ -2770,6 +2807,9 @@ begin
exit; exit;
end; end;
// ReferenceControl is not visible -> try next // ReferenceControl is not visible -> try next
if ReferenceControl=OwnerParent then
NextReferenceSide:=nil
else
NextReferenceSide:=ReferenceControl.AnchorSide[ NextReferenceSide:=ReferenceControl.AnchorSide[
AnchorReferenceSide[Kind,ReferenceSide]]; AnchorReferenceSide[Kind,ReferenceSide]];
if (NextReferenceSide=nil) then begin if (NextReferenceSide=nil) then begin
@ -2855,6 +2895,9 @@ end.
{ ============================================================================= { =============================================================================
$Log$ $Log$
Revision 1.277 2005/01/26 15:45:08 mattias
implemented adding files from directory in project inspector, fixed extrac proc checking overlapping blocks
Revision 1.276 2005/01/25 09:58:16 mattias Revision 1.276 2005/01/25 09:58:16 mattias
fixed fpc 1.0.10 compilation fixed fpc 1.0.10 compilation

View File

@ -3259,6 +3259,25 @@ begin
Anchors:=Anchors+[Side]; Anchors:=Anchors+[Side];
end; end;
procedure TControl.AnchorParallel(Side: TAnchorKind; Space: integer;
Sibling: TControl);
begin
case Side of
akLeft: BorderSpacing.Left:=Space;
akTop: BorderSpacing.Top:=Space;
akRight: BorderSpacing.Right:=Space;
akBottom: BorderSpacing.Bottom:=Space;
end;
case Side of
akLeft: AnchorSide[Side].Side:=asrLeft;
akTop: AnchorSide[Side].Side:=asrTop;
akRight: AnchorSide[Side].Side:=asrRight;
akBottom: AnchorSide[Side].Side:=asrBottom;
end;
AnchorSide[Side].Control:=Sibling;
Anchors:=Anchors+[Side];
end;
{------------------------------------------------------------------------------ {------------------------------------------------------------------------------
procedure TControl.AnchorHorizontalCenterTo(Sibling: TControl); procedure TControl.AnchorHorizontalCenterTo(Sibling: TControl);
@ -3430,6 +3449,9 @@ end;
{ ============================================================================= { =============================================================================
$Log$ $Log$
Revision 1.242 2005/01/26 15:45:08 mattias
implemented adding files from directory in project inspector, fixed extrac proc checking overlapping blocks
Revision 1.241 2005/01/24 12:23:11 mattias Revision 1.241 2005/01/24 12:23:11 mattias
fixed TColorButton.Paint fixed TColorButton.Paint

View File

@ -168,10 +168,11 @@ var
end; end;
Result:=DefaultPosition; Result:=DefaultPosition;
CurAnchorSide:=Control.AnchorSide[Kind]; CurAnchorSide:=Control.AnchorSide[Kind];
//debugln('GetAnchorSidePosition Self=',DbgSName(Self),' Control=',DbgSName(Control),' ',dbgs(CurAnchorSide.Control<>nil)); //debugln('GetAnchorSidePosition A Self=',DbgSName(Self),' Control=',DbgSName(Control),' ',DbgSName(CurAnchorSide.Control));
CurAnchorSide.GetSidePosition(ReferenceControl,ReferenceSide,Position); CurAnchorSide.GetSidePosition(ReferenceControl,ReferenceSide,Position);
if ReferenceControl<>nil then if ReferenceControl<>nil then
Result:=Position; Result:=Position;
//debugln('GetAnchorSidePosition B Self=',DbgSName(Self),' Control=',DbgSName(Control),' ',dbgs(Result));
AnchorSideCacheValid[Kind]:=true; AnchorSideCacheValid[Kind]:=true;
AnchorSideCache[Kind]:=Result; AnchorSideCache[Kind]:=Result;
end; end;
@ -4386,6 +4387,9 @@ end;
{ ============================================================================= { =============================================================================
$Log$ $Log$
Revision 1.308 2005/01/26 15:45:08 mattias
implemented adding files from directory in project inspector, fixed extrac proc checking overlapping blocks
Revision 1.307 2005/01/25 09:58:16 mattias Revision 1.307 2005/01/25 09:58:16 mattias
fixed fpc 1.0.10 compilation fixed fpc 1.0.10 compilation

View File

@ -184,7 +184,6 @@ type
procedure AutoCompleteNewComponentUnitName; procedure AutoCompleteNewComponentUnitName;
procedure UpdateAddUnitInfo; procedure UpdateAddUnitInfo;
procedure UpdateAddFileInfo; procedure UpdateAddFileInfo;
function FileNameToPkgFileType(const AFilename: string): TPkgFileType;
function SwitchRelativeAbsoluteFilename(const Filename: string): string; function SwitchRelativeAbsoluteFilename(const Filename: string): string;
public public
Params: TAddToPkgResult; Params: TAddToPkgResult;
@ -872,7 +871,7 @@ begin
OpenDialog.Options:=OpenDialog.Options OpenDialog.Options:=OpenDialog.Options
+[ofFileMustExist,ofPathMustExist,ofAllowMultiSelect]; +[ofFileMustExist,ofPathMustExist,ofAllowMultiSelect];
if OpenDialog.Execute then begin if OpenDialog.Execute then begin
for i:=0 to OpenDialog.Files.COunt-1 do begin for i:=0 to OpenDialog.Files.Count-1 do begin
AFilename:=CleanAndExpandFilename(OpenDialog.Files[i]); AFilename:=CleanAndExpandFilename(OpenDialog.Files[i]);
if FileExists(AFilename) then begin if FileExists(AFilename) then begin
LazPackage.ShortenFilename(AFilename,true); LazPackage.ShortenFilename(AFilename,true);
@ -1724,25 +1723,6 @@ begin
AddFileTypeRadioGroup.ItemIndex:=i; AddFileTypeRadioGroup.ItemIndex:=i;
end; end;
function TAddToPackageDlg.FileNameToPkgFileType(const AFilename: string
): TPkgFileType;
begin
if CompareFileExt(AFilename,'.lfm',true)=0 then
Result:=pftLFM
else if CompareFileExt(AFilename,'.lrs',true)=0 then
Result:=pftLRS
else if CompareFileExt(AFilename,'.inc',true)=0 then
Result:=pftInclude
else if CompareFileExt(AFilename,'.pas',true)=0 then
Result:=pftUnit
else if CompareFileExt(AFilename,'.pp',true)=0 then
Result:=pftUnit
else if FileIsText(AFilename) then
Result:=pftText
else
Result:=pftBinary;
end;
function TAddToPackageDlg.SwitchRelativeAbsoluteFilename(const Filename: string function TAddToPackageDlg.SwitchRelativeAbsoluteFilename(const Filename: string
): string; ): string;
begin begin

View File

@ -807,6 +807,7 @@ function PkgFileTypeIdentToType(const s: string): TPkgFileType;
function LazPackageTypeIdentToType(const s: string): TLazPackageType; function LazPackageTypeIdentToType(const s: string): TLazPackageType;
function GetPkgFileTypeLocalizedName(FileType: TPkgFileType): string; function GetPkgFileTypeLocalizedName(FileType: TPkgFileType): string;
function NameToAutoUpdatePolicy(const s: string): TPackageUpdatePolicy; function NameToAutoUpdatePolicy(const s: string): TPackageUpdatePolicy;
function FileNameToPkgFileType(const AFilename: string): TPkgFileType;
procedure SortDependencyList(Dependencies: TList); procedure SortDependencyList(Dependencies: TList);
procedure LoadPkgDependencyList(XMLConfig: TXMLConfig; const ThePath: string; procedure LoadPkgDependencyList(XMLConfig: TXMLConfig; const ThePath: string;
@ -872,6 +873,24 @@ begin
Result:=pupAsNeeded; Result:=pupAsNeeded;
end; end;
function FileNameToPkgFileType(const AFilename: string): TPkgFileType;
begin
if CompareFileExt(AFilename,'.lfm',true)=0 then
Result:=pftLFM
else if CompareFileExt(AFilename,'.lrs',true)=0 then
Result:=pftLRS
else if CompareFileExt(AFilename,'.inc',true)=0 then
Result:=pftInclude
else if CompareFileExt(AFilename,'.pas',true)=0 then
Result:=pftUnit
else if CompareFileExt(AFilename,'.pp',true)=0 then
Result:=pftUnit
else if FileIsText(AFilename) then
Result:=pftText
else
Result:=pftBinary;
end;
procedure LoadPkgDependencyList(XMLConfig: TXMLConfig; const ThePath: string; procedure LoadPkgDependencyList(XMLConfig: TXMLConfig; const ThePath: string;
var First: TPkgDependency; ListType: TPkgDependencyList; Owner: TObject; var First: TPkgDependency; ListType: TPkgDependencyList; Owner: TObject;
HoldPackages: boolean); HoldPackages: boolean);