mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-06-08 22:18:17 +02:00
TShellTreeView: rename a function, no functional changes.
This commit is contained in:
parent
cad367e40a
commit
44e3241162
@ -111,7 +111,7 @@ type
|
|||||||
function CanExpand(Node: TTreeNode): Boolean; override;
|
function CanExpand(Node: TTreeNode): Boolean; override;
|
||||||
procedure Collapse(Node: TTreeNode); override;
|
procedure Collapse(Node: TTreeNode); override;
|
||||||
function DrawBuiltInIcon(ANode: TTreeNode; ARect: TRect): TSize; override;
|
function DrawBuiltInIcon(ANode: TTreeNode; ARect: TRect): TSize; override;
|
||||||
function Exists(APath: String): Boolean;
|
function ExistsAndIsValid(APath: String): Boolean;
|
||||||
function GetBuiltinIconSize: TSize; override;
|
function GetBuiltinIconSize: TSize; override;
|
||||||
function NodeHasChildren(Node: TTreeNode): Boolean; override;
|
function NodeHasChildren(Node: TTreeNode): Boolean; override;
|
||||||
property ExpandCollapseMode: TExpandCollapseMode read FExpandCollapseMode write FExpandCollapseMode default ecmRefreshedExpanding;
|
property ExpandCollapseMode: TExpandCollapseMode read FExpandCollapseMode write FExpandCollapseMode default ecmRefreshedExpanding;
|
||||||
@ -656,7 +656,7 @@ begin
|
|||||||
RootNode := Items.AddChild(nil, FRoot);
|
RootNode := Items.AddChild(nil, FRoot);
|
||||||
RootNode.HasChildren := True;
|
RootNode.HasChildren := True;
|
||||||
RootNode.Expand(False);
|
RootNode.Expand(False);
|
||||||
if Exists(CurrPath) then
|
if ExistsAndIsValid(CurrPath) then
|
||||||
SetPath(CurrPath);
|
SetPath(CurrPath);
|
||||||
end;
|
end;
|
||||||
finally
|
finally
|
||||||
@ -675,7 +675,7 @@ begin
|
|||||||
try
|
try
|
||||||
BeginUpdate;
|
BeginUpdate;
|
||||||
//Refresh(nil);
|
//Refresh(nil);
|
||||||
//if Exists(CurrPath) then
|
//if ExistsAndIsValid(CurrPath) then
|
||||||
// SetPath(CurrPath);
|
// SetPath(CurrPath);
|
||||||
UpdateView;
|
UpdateView;
|
||||||
finally
|
finally
|
||||||
@ -707,7 +707,7 @@ begin
|
|||||||
RootNode := Items.AddChild(nil, FRoot);
|
RootNode := Items.AddChild(nil, FRoot);
|
||||||
RootNode.HasChildren := True;
|
RootNode.HasChildren := True;
|
||||||
RootNode.Expand(False);
|
RootNode.Expand(False);
|
||||||
if Exists(Currpath) then
|
if ExistsAndIsValid(Currpath) then
|
||||||
SetPath(CurrPath);
|
SetPath(CurrPath);
|
||||||
end;
|
end;
|
||||||
finally
|
finally
|
||||||
@ -1256,7 +1256,7 @@ procedure TCustomShellTreeView.UpdateView(AStartDir: String = '');
|
|||||||
if APath[i] = PathDelimiter then
|
if APath[i] = PathDelimiter then
|
||||||
begin
|
begin
|
||||||
path := Copy(APath, 1, i);
|
path := Copy(APath, 1, i);
|
||||||
if Exists(path) then
|
if ExistsAndIsValid(path) then
|
||||||
Result := path
|
Result := path
|
||||||
else
|
else
|
||||||
break;
|
break;
|
||||||
@ -1348,7 +1348,7 @@ begin
|
|||||||
RecordNodeState(startNode, expandedPaths);
|
RecordNodeState(startNode, expandedPaths);
|
||||||
RestoreNodeState(startNode, true, expandedPaths);
|
RestoreNodeState(startNode, true, expandedPaths);
|
||||||
|
|
||||||
if Exists(selectedPath) then
|
if ExistsAndIsValid(selectedPath) then
|
||||||
begin
|
begin
|
||||||
Path := selectedPath;
|
Path := selectedPath;
|
||||||
// Setting the path expands the selected node --> apply the stored state.
|
// Setting the path expands the selected node --> apply the stored state.
|
||||||
@ -1380,7 +1380,7 @@ begin
|
|||||||
Result := GetPathFromNode(Selected);
|
Result := GetPathFromNode(Selected);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TCustomShellTreeView.Exists(APath: String): Boolean;
|
function TCustomShellTreeView.ExistsAndIsValid(APath: String): Boolean;
|
||||||
// APath should be fully qualified
|
// APath should be fully qualified
|
||||||
var
|
var
|
||||||
Attr: LongInt;
|
Attr: LongInt;
|
||||||
@ -1532,7 +1532,7 @@ begin
|
|||||||
|
|
||||||
if not FileNameIsAbsolute(AValue) then
|
if not FileNameIsAbsolute(AValue) then
|
||||||
begin
|
begin
|
||||||
if Exists(FQRootPath + AValue) then
|
if ExistsAndIsValid(FQRootPath + AValue) then
|
||||||
begin
|
begin
|
||||||
//Expand it, since it may be in the form of ../../foo
|
//Expand it, since it may be in the form of ../../foo
|
||||||
AValue := ExpandFileNameUtf8(FQRootPath + AValue);
|
AValue := ExpandFileNameUtf8(FQRootPath + AValue);
|
||||||
@ -1540,9 +1540,9 @@ begin
|
|||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
//don't expand Avalue yet, we may need it in error message
|
//don't expand Avalue yet, we may need it in error message
|
||||||
if not Exists(ExpandFileNameUtf8(AValue)) then
|
if not ExistsAndIsValid(ExpandFileNameUtf8(AValue)) then
|
||||||
Raise EInvalidPath.CreateFmt(sShellCtrlsInvalidPath,[ExpandFileNameUtf8(FQRootPath + AValue)]);
|
Raise EInvalidPath.CreateFmt(sShellCtrlsInvalidPath,[ExpandFileNameUtf8(FQRootPath + AValue)]);
|
||||||
//Directory (or file) exists
|
//Directory (or file) ExistsAndIsValid
|
||||||
//Make it fully qualified
|
//Make it fully qualified
|
||||||
AValue := ExpandFileNameUtf8(AValue);
|
AValue := ExpandFileNameUtf8(AValue);
|
||||||
end;
|
end;
|
||||||
@ -1552,11 +1552,11 @@ begin
|
|||||||
//AValue is an absoulte path to begin with , but still needs expanding (because TryCreateRelativePath requires this)
|
//AValue is an absoulte path to begin with , but still needs expanding (because TryCreateRelativePath requires this)
|
||||||
AValue := ExpandFilenameUtf8(AValue);
|
AValue := ExpandFilenameUtf8(AValue);
|
||||||
//if not DirectoryExistsUtf8(AValue) then
|
//if not DirectoryExistsUtf8(AValue) then
|
||||||
if not Exists(AValue) then
|
if not ExistsAndIsValid(AValue) then
|
||||||
Raise EInvalidPath.CreateFmt(sShellCtrlsInvalidPath,[AValue]);
|
Raise EInvalidPath.CreateFmt(sShellCtrlsInvalidPath,[AValue]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
//AValue now is a fully qualified path and it exists
|
//AValue now is a fully qualified path and it ExistsAndIsValid
|
||||||
//Now check if it is a subdirectory of FQRootPath
|
//Now check if it is a subdirectory of FQRootPath
|
||||||
//RelPath := CreateRelativePath(AValue, FQRootPath, False);
|
//RelPath := CreateRelativePath(AValue, FQRootPath, False);
|
||||||
IsRelPath := (FQRootPath = '') or TryCreateRelativePath(AValue, FQRootPath, False, True, RelPath);
|
IsRelPath := (FQRootPath = '') or TryCreateRelativePath(AValue, FQRootPath, False, True, RelPath);
|
||||||
|
Loading…
Reference in New Issue
Block a user