LCL: Restore a class procedure TCustomShellTreeView.GetFilesInDir. Rename a helper procedure to avoid name clash.

This commit is contained in:
Juha 2023-12-02 14:49:33 +02:00
parent 946c47ea3c
commit ef8b5603be

View File

@ -123,6 +123,9 @@ type
{ Methods specific to Lazarus - useful for other classes } { Methods specific to Lazarus - useful for other classes }
class function GetBasePath: string; class function GetBasePath: string;
function GetRootPath: string; function GetRootPath: string;
class procedure GetFilesInDir(const ABaseDir: string; AMask: string;
AObjectTypes: TObjectTypes; AResult: TStrings; AFileSortType: TFileSortType = fstNone;
ACaseSensitivity: TMaskCaseSensitivity = mcsPlatformDefault);
{ Other methods specific to Lazarus } { Other methods specific to Lazarus }
function GetPathFromNode(ANode: TTreeNode): string; function GetPathFromNode(ANode: TTreeNode): string;
procedure PopulateWithBaseFiles; procedure PopulateWithBaseFiles;
@ -480,7 +483,7 @@ end;
{ TFileItemAVLTree { TFileItemAVLTree
Specialized TAVLTree descendant for sorting the TFileItems found by the Specialized TAVLTree descendant for sorting the TFileItems found by the
helper function GetFilesInDir such that a user-friendly compare function helper function GetFilesInDirectory such that a user-friendly compare function
can be applied. } can be applied. }
type type
@ -816,7 +819,7 @@ end;
AMask may contain multiple file masks separated by ; AMask may contain multiple file masks separated by ;
} }
procedure GetFilesInDir(const ABaseDir: string; AMask: string; procedure GetFilesInDirectory(const ABaseDir: string; AMask: string;
AObjectTypes: TObjectTypes; AResult: TStrings; AFileSortType: TFileSortType; AObjectTypes: TObjectTypes; AResult: TStrings; AFileSortType: TFileSortType;
ACaseSensitivity: TMaskCaseSensitivity = mcsPlatformDefault; ACaseSensitivity: TMaskCaseSensitivity = mcsPlatformDefault;
ASortCompare: TFileItemCompareEvent = nil); ASortCompare: TFileItemCompareEvent = nil);
@ -977,6 +980,14 @@ begin
Result := IncludeTrailingPathDelimiter(Result); Result := IncludeTrailingPathDelimiter(Result);
end; end;
class procedure TCustomShellTreeView.GetFilesInDir(const ABaseDir: string;
AMask: string; AObjectTypes: TObjectTypes; AResult: TStrings;
AFileSortType: TFileSortType; ACaseSensitivity: TMaskCaseSensitivity);
begin
GetFilesInDirectory(ABaseDir, AMask, AObjectTypes, AResult,
AFileSortType, ACaseSensitivity);
end;
function TCustomShellTreeView.NodeHasChildren(Node: TTreeNode): Boolean; function TCustomShellTreeView.NodeHasChildren(Node: TTreeNode): Boolean;
function HasSubDir(Const ADir: String): Boolean; function HasSubDir(Const ADir: String): Boolean;
@ -1042,7 +1053,8 @@ begin
Items.BeginUpdate; Items.BeginUpdate;
try try
Files.OwnsObjects := True; Files.OwnsObjects := True;
GetFilesInDir(ANodePath, AllFilesMask, FObjectTypes, Files, FFileSortType, mcsPlatformDefault, FOnSortCompare); GetFilesInDirectory(ANodePath, AllFilesMask, FObjectTypes, Files,
FFileSortType, mcsPlatformDefault, FOnSortCompare);
Result := Files.Count > 0; Result := Files.Count > 0;
for i := 0 to Files.Count - 1 do for i := 0 to Files.Count - 1 do
@ -1157,10 +1169,10 @@ begin
FOnAddItem(Self, ABasePath, AFileInfo, CanAdd); FOnAddItem(Self, ABasePath, AFileInfo, CanAdd);
end; end;
function TCustomShellTreeView.DrawBuiltinIcon(ANode: TTreeNode; ARect: TRect): TSize; function TCustomShellTreeView.DrawBuiltInIcon(ANode: TTreeNode; ARect: TRect): TSize;
begin begin
if FUseBuiltinIcons then if FUseBuiltinIcons then
Result := TWSCustomShellTreeViewClass(WidgetSetClass).DrawBuiltinIcon(Self, ANode, ARect) Result := TWSCustomShellTreeViewClass(WidgetSetClass).DrawBuiltInIcon(Self, ANode, ARect)
else else
Result := inherited; Result := inherited;
end; end;
@ -1835,7 +1847,8 @@ begin
Files := TStringList.Create; Files := TStringList.Create;
try try
Files.OwnsObjects := True; Files.OwnsObjects := True;
GetFilesInDir(FRoot, Trim(FMask), FObjectTypes, Files, fstNone, FMaskCaseSensitivity); GetFilesInDirectory(FRoot, Trim(FMask), FObjectTypes, Files, fstNone,
FMaskCaseSensitivity);
for i := 0 to Files.Count - 1 do for i := 0 to Files.Count - 1 do
begin begin