mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-07 12:49:29 +01:00
todolist: search in used project units
git-svn-id: trunk@53432 -
This commit is contained in:
parent
fe5d7d250d
commit
780d0f8635
@ -65,7 +65,7 @@ uses
|
|||||||
Classes, SysUtils, Math, LCLProc, Forms, Controls, Dialogs, StrUtils,
|
Classes, SysUtils, Math, LCLProc, Forms, Controls, Dialogs, StrUtils,
|
||||||
ComCtrls, ActnList, AvgLvlTree, LazUTF8Classes, LCLType, ButtonPanel,
|
ComCtrls, ActnList, AvgLvlTree, LazUTF8Classes, LCLType, ButtonPanel,
|
||||||
CodeCache, CodeToolManager, BasicCodeTools, FileProcs, LazFileUtils,
|
CodeCache, CodeToolManager, BasicCodeTools, FileProcs, LazFileUtils,
|
||||||
LclIntf,
|
LazFileCache, LclIntf,
|
||||||
// IDEIntf
|
// IDEIntf
|
||||||
LazIDEIntf, IDEImagesIntf, PackageIntf, ProjectIntf,
|
LazIDEIntf, IDEImagesIntf, PackageIntf, ProjectIntf,
|
||||||
// IDE
|
// IDE
|
||||||
@ -241,12 +241,11 @@ var
|
|||||||
i: integer;
|
i: integer;
|
||||||
St : String;
|
St : String;
|
||||||
CurOwner: TObject;
|
CurOwner: TObject;
|
||||||
CurProject: TLazProject;
|
|
||||||
CurPackage: TIDEPackage;
|
|
||||||
CurProjFile: TLazProjectFile;
|
|
||||||
Node: TAvgLvlTreeNode;
|
Node: TAvgLvlTreeNode;
|
||||||
CurFile: TTLScannedFile;
|
CurFile: TTLScannedFile;
|
||||||
CurPkgFile: TLazPackageFile;
|
Units: TStrings;
|
||||||
|
CurProject: TLazProject;
|
||||||
|
CurPkg: TIDEPackage;
|
||||||
begin
|
begin
|
||||||
if not Immediately then begin
|
if not Immediately then begin
|
||||||
fUpdateNeeded:=true;
|
fUpdateNeeded:=true;
|
||||||
@ -263,6 +262,7 @@ begin
|
|||||||
|
|
||||||
Screen.Cursor:=crHourGlass;
|
Screen.Cursor:=crHourGlass;
|
||||||
lvTodo.BeginUpdate;
|
lvTodo.BeginUpdate;
|
||||||
|
Units:=nil;
|
||||||
try
|
try
|
||||||
fUpdating:=True;
|
fUpdating:=True;
|
||||||
CodeToolBoss.ActivateWriteLock;
|
CodeToolBoss.ActivateWriteLock;
|
||||||
@ -273,45 +273,17 @@ begin
|
|||||||
if StartFilename<>'' then begin
|
if StartFilename<>'' then begin
|
||||||
// Find a '.todo' file of the main source
|
// Find a '.todo' file of the main source
|
||||||
St:=ChangeFileExt(StartFilename,'.todo');
|
St:=ChangeFileExt(StartFilename,'.todo');
|
||||||
if FileExistsUTF8(St) then
|
if FileExistsCached(St) then
|
||||||
ScanFile(St);
|
ScanFile(St);
|
||||||
// Scan main source file
|
// Scan main source file
|
||||||
if FilenameIsPascalUnit(StartFilename) then
|
if FilenameIsPascalUnit(StartFilename) then
|
||||||
ScanFile(StartFilename);
|
ScanFile(StartFilename);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// find project/package
|
ResolveIDEItem(CurOwner,CurProject,CurPkg);
|
||||||
ResolveIDEItem(CurOwner,CurProject,CurPackage);
|
Units:=LazarusIDE.FindUnitsOfOwner(CurOwner,true,true,false);
|
||||||
if CurOwner=nil then begin
|
for i:=0 to Units.Count-1 do
|
||||||
CurProject:=LazarusIDE.ActiveProject;
|
ScanFile(Units[i]);
|
||||||
CurOwner:=CurProject;
|
|
||||||
end;
|
|
||||||
|
|
||||||
//debugln(['TIDETodoWindow.UpdateTodos Owner=',DbgSName(CurOwner)]);
|
|
||||||
if CurProject<>nil then begin
|
|
||||||
// scan all units of project
|
|
||||||
Caption:=lisToDoList+' - '+ExtractFileName(CurProject.ProjectInfoFile);
|
|
||||||
FBaseDirectory:=ExtractFilePath(CurProject.ProjectInfoFile);
|
|
||||||
if (CurProject.MainFile<>nil) and (pfMainUnitIsPascalSource in CurProject.Flags)
|
|
||||||
then
|
|
||||||
ScanFile(CurProject.MainFile.Filename);
|
|
||||||
for i:=0 to CurProject.FileCount-1 do begin
|
|
||||||
CurProjFile:=CurProject.Files[i];
|
|
||||||
//debugln(['TIDETodoWindow.UpdateTodos ',CurProjFile.IsPartOfProject,' ',CurProjFile.Filename]);
|
|
||||||
if CurProjFile.IsPartOfProject
|
|
||||||
and FilenameIsPascalUnit(CurProjFile.Filename) then
|
|
||||||
ScanFile(CurProjFile.Filename);
|
|
||||||
end;
|
|
||||||
end else if CurPackage<>nil then begin
|
|
||||||
// scan all units of package
|
|
||||||
Caption:=lisToDoList+' - '+ExtractFilename(CurPackage.Filename);
|
|
||||||
FBaseDirectory:=ExtractFilePath(CurPackage.Filename);
|
|
||||||
for i:=0 to CurPackage.FileCount-1 do begin
|
|
||||||
CurPkgFile:=CurPackage.Files[i];
|
|
||||||
if FilenameIsPascalUnit(CurPkgFile.Filename) then
|
|
||||||
ScanFile(CurPkgFile.Filename);
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
Node:=fScannedFiles.FindLowest;
|
Node:=fScannedFiles.FindLowest;
|
||||||
while Node<>nil do begin
|
while Node<>nil do begin
|
||||||
@ -321,6 +293,7 @@ begin
|
|||||||
Node:=fScannedFiles.FindSuccessor(Node);
|
Node:=fScannedFiles.FindSuccessor(Node);
|
||||||
end;
|
end;
|
||||||
finally
|
finally
|
||||||
|
Units.Free;
|
||||||
CodeToolBoss.DeactivateWriteLock;
|
CodeToolBoss.DeactivateWriteLock;
|
||||||
lvTodo.EndUpdate;
|
lvTodo.EndUpdate;
|
||||||
Screen.Cursor:=crDefault;
|
Screen.Cursor:=crDefault;
|
||||||
@ -452,7 +425,7 @@ begin
|
|||||||
CurOwner:=nil;
|
CurOwner:=nil;
|
||||||
CurProject:=nil;
|
CurProject:=nil;
|
||||||
CurPkg:=nil;
|
CurPkg:=nil;
|
||||||
if IsValidIdent(IDEItem) then begin
|
if IsValidIdent(IDEItem,true) then begin
|
||||||
// package
|
// package
|
||||||
CurPkg:=PackageEditingInterface.FindPackageWithName(IDEItem);
|
CurPkg:=PackageEditingInterface.FindPackageWithName(IDEItem);
|
||||||
CurOwner:=CurPkg;
|
CurOwner:=CurPkg;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user