Searches the file name of a unit If TheOwner is nil the current project is searched. TheOwner can be a project, a package or LazarusIDE. The unit is searched in the unit search path of the the base directory using the codetools unit search rules. It will find units of used packages too, the unit name is case insensitive and the normal extensions .pas, .pp are tried. In case of LazarusIDE it will search in all open packages. If the AFileName contains an extension it will also search in the files listed in the project inspector. It returns the empty string if not found. If the file name is not absolute the file was not newly created and not yet saved to disk. Find units of project/package fuooListed: For a project add the units listed in the project inspector (.lpi). For a package add the units listed in the package editor. With fuooPackages this works recursively for all used packages as well. fuooUsed: Parse the project/package sources recursively and add all used units. Without fuooPackages units from packages are not added. fuooPackages: Extends fuooListed and fuooUsed by units from used packages. fuooSourceEditor: Add units in source editor. returns list of selected items in the Project InspectorResult can be nil. Caller must free the list, do not free the items. Items can be TLazProjectFile or TPkgDependencyID