1
0
mirror of https://github.com/winscp/winscp.git synced 2026-10-24 02:28:55 +03:00

Introduced C++ shell around some heavy Pascal classes to allow their gradual reimplementation to C++

UNICODE define added everywhere (except Putty, which in Ansi code) to make sure A/W suffixes are added consistently across the code

CreateDirectory renamed to avoid problems with being interpreted as CreateDirectoryW in C++ code and CreateDirectory in Pascal code (being also a function in WinAPI)

Source commit: b8d27b5097829c42f853b629e57aebaaab066b9e
This commit is contained in:
Martin Prikryl
2025-12-04 13:57:36 +00:00
parent 980db10682
commit 86b35a6a39
31 changed files with 462 additions and 377 deletions

View File

@@ -53,7 +53,7 @@
<BPILibOutputDir>$(INTERM_PATH)\$(Platform)\$(Config)</BPILibOutputDir>
<DCC_CBuilderOutput>JPHNE</DCC_CBuilderOutput>
<DCC_Namespace>Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;System;Xml;Data;Datasnap;Web;Soap;Vcl;$(DCC_Namespace)</DCC_Namespace>
<Defines>DESIGN_ONLY;$(Defines)</Defines>
<Defines>UNICODE;DESIGN_ONLY;$(Defines)</Defines>
<DesignOnlyPackage>true</DesignOnlyPackage>
<FinalOutputDir>$(INTERM_PATH)\$(Platform)\$(Config)</FinalOutputDir>
<ILINK_Description>WinSCP components</ILINK_Description>
@@ -96,6 +96,24 @@
<TASM_Debugging>None</TASM_Debugging>
</PropertyGroup>
<ItemGroup>
<CppCompile Include="components\DirView.cpp">
<DependentOn>components\DirView.h</DependentOn>
<BuildOrder>14</BuildOrder>
</CppCompile>
<ResFiles Include="components\DirView.dcr">
<BuildOrder>13</BuildOrder>
</ResFiles>
<CppCompile Include="components\DriveView.cpp">
<DependentOn>components\DriveView.h</DependentOn>
<BuildOrder>11</BuildOrder>
</CppCompile>
<ResFiles Include="components\DriveView.dcr">
<BuildOrder>12</BuildOrder>
</ResFiles>
<CppCompile Include="components\IEDriveInfo.cpp">
<DependentOn>components\IEDriveInfo.h</DependentOn>
<BuildOrder>15</BuildOrder>
</CppCompile>
<CppCompile Include="components\ThemePageControl.cpp">
<DependentOn>components\ThemePageControl.h</DependentOn>
<BuildOrder>11</BuildOrder>

View File

@@ -44,7 +44,7 @@
<DCC_Namespace>System;Xml;Data;Datasnap;Web;Soap;Vcl;$(DCC_Namespace)</DCC_Namespace>
<DCC_UnitSearchPath>packages\my;$(DCC_UnitSearchPath)</DCC_UnitSearchPath>
<DCC_UNSAFE_TYPE>true</DCC_UNSAFE_TYPE>
<Defines>$(Defines)</Defines>
<Defines>UNICODE;$(Defines)</Defines>
<FinalOutputDir>$(INTERM_PATH)\$(Platform)\$(Config)</FinalOutputDir>
<ILINK_Description>Drag and Drop Components</ILINK_Description>
<ILINK_GenerateImportLibrary>true</ILINK_GenerateImportLibrary>

View File

@@ -45,7 +45,7 @@
<DCC_TYPEINFO_IMPLICITLY_ADDED>false</DCC_TYPEINFO_IMPLICITLY_ADDED>
<DCC_UnitSearchPath>packages\my;packages\dragndrop;$(DCC_UnitSearchPath)</DCC_UnitSearchPath>
<DCC_UNSAFE_TYPE>true</DCC_UNSAFE_TYPE>
<Defines>$(Defines)</Defines>
<Defines>UNICODE;$(Defines)</Defines>
<FinalOutputDir>$(INTERM_PATH)\$(Platform)\$(Config)</FinalOutputDir>
<ILINK_Description>Filemanager Toolset</ILINK_Description>
<ILINK_GenerateImportLibrary>true</ILINK_GenerateImportLibrary>
@@ -106,23 +106,15 @@
<BuildOrder>50</BuildOrder>
<BuildOrder>0</BuildOrder>
</DelphiCompile>
<ResFiles Include="packages\filemng\DirView.dcr">
<BuildOrder>-1</BuildOrder>
<BuildOrder>11</BuildOrder>
</ResFiles>
<DelphiCompile Include="packages\filemng\DirView.pas">
<BuildOrder>8</BuildOrder>
<BuildOrder>18</BuildOrder>
</DelphiCompile>
<DelphiCompile Include="packages\filemng\DirViewColProperties.pas">
<BuildOrder>44</BuildOrder>
<BuildOrder>4</BuildOrder>
</DelphiCompile>
<ResFiles Include="packages\filemng\DriveView.dcr">
<BuildOrder>-1</BuildOrder>
<BuildOrder>17</BuildOrder>
</ResFiles>
<DelphiCompile Include="packages\filemng\DriveView.pas">
<DelphiCompile Include="packages\filemng\DirViewInt.pas">
<BuildOrder>8</BuildOrder>
<BuildOrder>18</BuildOrder>
</DelphiCompile>
<DelphiCompile Include="packages\filemng\DriveViewInt.pas">
<BuildOrder>14</BuildOrder>
</DelphiCompile>
<DelphiCompile Include="packages\filemng\FileChanges.pas">
@@ -137,7 +129,7 @@
<BuildOrder>20</BuildOrder>
<BuildOrder>19</BuildOrder>
</DelphiCompile>
<DelphiCompile Include="packages\filemng\IEDriveInfo.pas">
<DelphiCompile Include="packages\filemng\IEDriveInfoInt.pas">
<BuildOrder>38</BuildOrder>
<BuildOrder>22</BuildOrder>
</DelphiCompile>

View File

@@ -44,7 +44,7 @@
<DCC_CBuilderOutput>JPHNE</DCC_CBuilderOutput>
<DCC_Namespace>System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace)</DCC_Namespace>
<DCC_UnitSearchPath>packages\jcl;$(DCC_UnitSearchPath)</DCC_UnitSearchPath>
<Defines>WINSCP;$(Defines)</Defines>
<Defines>UNICODE;WINSCP;$(Defines)</Defines>
<DynamicRTL>true</DynamicRTL>
<FinalOutputDir>$(INTERM_PATH)\$(Platform)\$(Config)</FinalOutputDir>
<ILINK_GenerateImportLibrary>true</ILINK_GenerateImportLibrary>

View File

@@ -45,7 +45,7 @@
<DCC_CBuilderOutput>JPHNE</DCC_CBuilderOutput>
<DCC_Namespace>System;Xml;Data;Datasnap;Web;Soap;Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;$(DCC_Namespace)</DCC_Namespace>
<DCC_UnitSearchPath>packages\png;packages\my;$(DCC_UnitSearchPath)</DCC_UnitSearchPath>
<Defines>WINSCP;$(Defines)</Defines>
<Defines>UNICODE;WINSCP;$(Defines)</Defines>
<DynamicRTL>true</DynamicRTL>
<FinalOutputDir>$(INTERM_PATH)\$(Platform)\$(Config)</FinalOutputDir>
<ILINK_Description>Png Components</ILINK_Description>

View File

@@ -51,7 +51,7 @@
<RunBCCOutOfProcess>true</RunBCCOutOfProcess>
<SanitizedProjectName>RScpComp</SanitizedProjectName>
<SubProcessesNumber>8</SubProcessesNumber>
<TLIB_PageSize>64</TLIB_PageSize>
<TLIB_PageSize>128</TLIB_PageSize>
<UsingDelphiRTL>true</UsingDelphiRTL>
<VerInfo_Keys>CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
<VerInfo_Locale>1033</VerInfo_Locale>
@@ -83,6 +83,18 @@
<TASM_Debugging>None</TASM_Debugging>
</PropertyGroup>
<ItemGroup>
<CppCompile Include="components\DirView.cpp">
<DependentOn>components\DirView.h</DependentOn>
<BuildOrder>4</BuildOrder>
</CppCompile>
<CppCompile Include="components\DriveView.cpp">
<DependentOn>components\DriveView.h</DependentOn>
<BuildOrder>3</BuildOrder>
</CppCompile>
<CppCompile Include="components\IEDriveInfo.cpp">
<DependentOn>components\IEDriveInfo.h</DependentOn>
<BuildOrder>5</BuildOrder>
</CppCompile>
<CppCompile Include="components\ThemePageControl.cpp">
<DependentOn>components\ThemePageControl.h</DependentOn>
<BuildOrder>3</BuildOrder>

View File

@@ -0,0 +1,14 @@
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "DirView.h"
#include "IEDriveInfo.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
//---------------------------------------------------------------------------
__fastcall TDirView::TDirView(TComponent * AOwner) :
TDirViewInt(AOwner)
{
DriveInfoRequire();
}

View File

@@ -0,0 +1,13 @@
//---------------------------------------------------------------------------
#ifndef DirViewH
#define DirViewH
//---------------------------------------------------------------------------
#include "DirViewInt.hpp"
//---------------------------------------------------------------------------
class TDirView : public TDirViewInt
{
public:
__fastcall TDirView(TComponent * AOwner);
};
//---------------------------------------------------------------------------
#endif

View File

@@ -0,0 +1,14 @@
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "DriveView.h"
#include "IEDriveInfo.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
//---------------------------------------------------------------------------
__fastcall TDriveView::TDriveView(TComponent * AOwner) :
TDriveViewInt(AOwner)
{
DriveInfoRequire();
}

View File

@@ -0,0 +1,13 @@
//---------------------------------------------------------------------------
#ifndef DriveViewH
#define DriveViewH
//---------------------------------------------------------------------------
#include "DriveViewInt.hpp"
//---------------------------------------------------------------------------
class TDriveView : public TDriveViewInt
{
public:
__fastcall TDriveView(TComponent * AOwner);
};
//---------------------------------------------------------------------------
#endif

View File

@@ -0,0 +1,20 @@
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "IEDriveInfo.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
//---------------------------------------------------------------------------
void DriveInfoRequire()
{
if (DriveInfo == nullptr)
{
DriveInfoInit(new TDriveInfo());
}
}
//---------------------------------------------------------------------------
__fastcall TDriveInfo::TDriveInfo() :
TDriveInfoInt()
{
}

View File

@@ -0,0 +1,15 @@
//---------------------------------------------------------------------------
#ifndef IEDriveInfoH
#define IEDriveInfoH
//---------------------------------------------------------------------------
#include "IEDriveInfoInt.hpp"
//---------------------------------------------------------------------------
class TDriveInfo : public TDriveInfoInt
{
public:
__fastcall TDriveInfo();
};
//---------------------------------------------------------------------------
void DriveInfoRequire();
//---------------------------------------------------------------------------
#endif

View File

@@ -7,7 +7,6 @@
#include <memory>
#include <PasTools.hpp>
#include <TBXOfficeXPTheme.hpp>
#include <TBX.hpp>
#include <StrUtils.hpp>
#include <CustomWinConfiguration.h>
#include "ThemePageControl.h"
@@ -20,15 +19,6 @@
//---------------------------------------------------------------------------
#define IDS_UTIL_TAB L"TAB"
//---------------------------------------------------------------------------
namespace Themepagecontrol
{
void __fastcall PACKAGE Register()
{
TComponentClass classes[] = { __classid(TThemePageControl), __classid(TThemeTabSheet) };
RegisterComponents(L"Scp", classes, LENOF(classes) - 1);
}
}
//----------------------------------------------------------------------------------------------------------
__fastcall TThemeTabSheet::TThemeTabSheet(TComponent * Owner) :
TTabSheet(Owner)
{

View File

@@ -3,6 +3,7 @@
#define ThemePageControlH
//---------------------------------------------------------------------------
#include <ComCtrls.hpp>
#include <TBX.hpp>
//---------------------------------------------------------------------------
enum TThemeTabSheetButtons { ttbNone, ttbClose, ttbDropDown };
enum TThemeTabCaptionTruncation { tttNone, tttEllipsis, tttNoText };

View File

@@ -27,15 +27,6 @@
#define ASSERT_VALID_ITEM
#endif
//---------------------------------------------------------------------------
namespace Unixdirview
{
void __fastcall PACKAGE Register()
{
TComponentClass classes[] = { __classid(TUnixDirView) };
RegisterComponents(L"Scp", classes, LENOF(classes) - 1);
}
}
//---------------------------------------------------------------------------
#ifndef DESIGN_ONLY
#define HOMEDIRECTORY L""
#endif
@@ -1015,12 +1006,12 @@ int __fastcall TUnixDirView::FilteredCount()
return FFilteredCount;
}
//---------------------------------------------------------------------------
void __fastcall TUnixDirView::CreateDirectory(UnicodeString DirName)
void __fastcall TUnixDirView::CreateDir(UnicodeString DirName)
{
CreateDirectoryEx(DirName, NULL);
CreateDirEx(DirName, NULL);
}
//---------------------------------------------------------------------------
void __fastcall TUnixDirView::CreateDirectoryEx(UnicodeString DirName, const TRemoteProperties * Properties)
void __fastcall TUnixDirView::CreateDirEx(UnicodeString DirName, const TRemoteProperties * Properties)
{
#ifndef DESIGN_ONLY
DebugAssert(Terminal);

View File

@@ -96,8 +96,8 @@ protected:
public:
__fastcall TUnixDirView(TComponent* Owner);
virtual __fastcall ~TUnixDirView();
virtual void __fastcall CreateDirectory(UnicodeString DirName);
void __fastcall CreateDirectoryEx(UnicodeString DirName, const TRemoteProperties * Properties);
virtual void __fastcall CreateDir(UnicodeString DirName);
void __fastcall CreateDirEx(UnicodeString DirName, const TRemoteProperties * Properties);
virtual void __fastcall DisplayPropertiesMenu();
virtual void __fastcall ExecuteHomeDirectory();
virtual void __fastcall ExecuteParentDirectory();

View File

@@ -17,15 +17,6 @@
#pragma package(smart_init)
//---------------------------------------------------------------------------
namespace Unixdriveview
{
void __fastcall PACKAGE Register()
{
TComponentClass classes[] = { __classid(TUnixDriveView) };
RegisterComponents(L"Scp", classes, LENOF(classes) - 1);
}
}
//---------------------------------------------------------------------------
__fastcall TUnixDriveView::TUnixDriveView(TComponent * Owner) :
TCustomUnixDriveView(Owner)
{

View File

@@ -4725,7 +4725,7 @@ void __fastcall TCustomScpExplorerForm::CreateRemoteDirectory(
DebugAssert(!IsLocalBrowserMode());
Properties.Valid = Properties.Valid << vpEncrypt;
Properties.Encrypt = GUIConfiguration->CurrentCopyParam.EncryptNewFiles;
RemoteDirView->CreateDirectoryEx(Path, &Properties);
RemoteDirView->CreateDirEx(Path, &Properties);
}
//---------------------------------------------------------------------------
void __fastcall TCustomScpExplorerForm::CreateDirectory(TOperationSide Side)
@@ -4751,7 +4751,7 @@ void __fastcall TCustomScpExplorerForm::CreateDirectory(TOperationSide Side)
}
else
{
DirView(Side)->CreateDirectory(Name);
DirView(Side)->CreateDir(Name);
}
}
}

View File

@@ -32,6 +32,8 @@
#pragma link "TBXStatusBars"
#pragma link "TBXToolPals"
#pragma link "ThemePageControl"
#pragma link "DriveViewInt"
#pragma link "DirViewInt"
#pragma resource "*.dfm"
//---------------------------------------------------------------------------
class TSynchronizedBrowsingGuard
@@ -1421,7 +1423,7 @@ void __fastcall TScpCommanderForm::CreateLocalDirectory(const UnicodeString & Pa
{
CreateLocalDirectory(Dir);
}
LocalDirView->CreateDirectory(Path);
LocalDirView->CreateDir(Path);
}
//---------------------------------------------------------------------------
void __fastcall TScpCommanderForm::SynchronizeBrowsingRemote(

View File

@@ -16,14 +16,14 @@
#include <ComCtrls.hpp>
#include <ExtCtrls.hpp>
#include <ToolWin.hpp>
#include <DirView.hpp>
#include <DirView.h>
#include <PathLabel.hpp>
#include <WinInterface.h>
#include "HistoryComboBox.h"
#include "CustomDriveView.hpp"
#include "DriveView.hpp"
#include "DriveView.h"
#include "UnixDriveView.h"
#include "TB2Dock.hpp"
#include "TB2Item.hpp"
@@ -37,6 +37,8 @@
#include "TBXToolPals.hpp"
#include "ThemePageControl.h"
#include <Vcl.AppEvnts.hpp>
#include "DriveViewInt.hpp"
#include "DirViewInt.hpp"
//---------------------------------------------------------------------------
class TScpCommanderForm : public TCustomScpExplorerForm
{

View File

@@ -11,7 +11,7 @@ uses
Windows, Messages, Classes, Graphics, Controls,
Forms, ComCtrls, ShellAPI, ComObj, ShlObj, Dialogs,
ActiveX, CommCtrl, Extctrls, ImgList, Menus, FileCtrl,
PIDL, BaseUtils, DragDrop, DragDropFilesEx, IEDriveInfo,
PIDL, BaseUtils, DragDrop, DragDropFilesEx, IEDriveInfoInt,
IEListView, PathLabel, SysUtils, PasTools;
const
@@ -379,7 +379,7 @@ type
procedure ExecuteParentDirectory; virtual; abstract;
procedure ExecuteRootDirectory; virtual; abstract;
procedure ExecuteCurrentFile();
procedure CreateDirectory(DirName: string); virtual; abstract;
procedure CreateDir(DirName: string); virtual; abstract;
function FindFileItem(FileName: string): TListItem;
procedure HistoryGo(Index: Integer);
function ItemIsDirectory(Item: TListItem): Boolean; virtual; abstract;
@@ -1566,7 +1566,7 @@ begin
if not Existed then
begin
if Dir then
CreateDir(FallbackPath)
SysUtils.CreateDir(FallbackPath)
else
TFile.WriteAllText(FallbackPath, '');
end;

View File

@@ -5,7 +5,7 @@ interface
uses
Classes, ComCtrls, CommCtrl, Windows, Controls, Forms, ShlObj, Messages,
Graphics,
DragDrop, CustomDirView, IEDriveInfo, DragDropFilesEx, PasTools;
DragDrop, CustomDirView, IEDriveInfoInt, DragDropFilesEx, PasTools;
type
{Types uses by the function IterateSubTree:}

View File

@@ -1,4 +1,4 @@
unit DirView;
unit DirViewInt;
{===============================================================
Component TDirView / Version 2.6, January 2000
===============================================================
@@ -83,12 +83,12 @@ type
TDirViewFileIconForName = procedure(Sender: TObject; var FileName: string) of object;
type
TDirView = class;
TDirViewInt = class;
// TIconUpdateThread (Fetch shell icons via thread)
TIconUpdateThread = class(TCompThread)
private
FOwner: TDirView;
FOwner: TDirViewInt;
FSyncIcon: Integer;
FSyncThumbnail: TBitmap;
FCurrentIndex: Integer;
@@ -96,20 +96,20 @@ type
FCurrentItemData: TFileRec;
protected
constructor Create(Owner: TDirView);
constructor Create(Owner: TDirViewInt);
procedure Execute; override;
public
destructor Destroy; override;
end;
// WORKAROUND: TQueue<Integer>.Create fails when TDirView is created in IDE, while TQueue<TIconUpdateSchedule>.Create works
// WORKAROUND: TQueue<Integer>.Create fails when TDirViewInt is created in IDE, while TQueue<TIconUpdateSchedule>.Create works
TIconUpdateSchedule = record
Index: Integer;
end;
// TDirView
TDirView = class(TCustomDirView)
// TDirViewInt
TDirViewInt = class(TCustomDirView)
private
FConfirmDelete: Boolean;
FConfirmOverwrite: Boolean;
@@ -266,7 +266,7 @@ type
procedure TerminateThreads;
// Create a new subdirectory:
procedure CreateDirectory(DirName: string); override;
procedure CreateDir(DirName: string); override;
// Delete all selected files:
// Check, if file or files still exists:
@@ -365,9 +365,7 @@ type
// The only way to make Items stored automatically and survive handle recreation.
// Though we should implement custom persisting to avoid publishing this
property Items;
end; // TDirView
procedure Register;
end; // TDirViewInt
// Returns True, if the specified extension matches one of the extensions in ExtList:
function MatchesFileExt(Ext: string; const FileExtList: string): Boolean;
@@ -387,7 +385,7 @@ uses
PIDL, Forms, Dialogs,
ComObj,
ActiveX, ImgList,
ShellDialogs, IEDriveInfo,
ShellDialogs, IEDriveInfoInt,
FileChanges, Math, PasTools, StrUtils, Types, UITypes;
var
@@ -396,11 +394,6 @@ var
var
DaylightHack: Boolean;
procedure Register;
begin
RegisterComponents('DriveDir', [TDirView]);
end;
function MatchesFileExt(Ext: string; const FileExtList: string): Boolean;
begin
Result := (Length(Ext) = 3) and (Pos(Ext, FileExtList) <> 0);
@@ -608,7 +601,7 @@ end;
// TIconUpdateThread
constructor TIconUpdateThread.Create(Owner: TDirView);
constructor TIconUpdateThread.Create(Owner: TDirViewInt);
begin
inherited Create(True);
FOwner := Owner;
@@ -669,9 +662,9 @@ begin
end;
end;
// TDirView
// TDirViewInt
constructor TDirView.Create(AOwner: TComponent);
constructor TDirViewInt.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
@@ -713,7 +706,7 @@ begin
FLastPath := nil;
end;
destructor TDirView.Destroy;
destructor TDirViewInt.Destroy;
begin
FreeAndNil(FIconUpdateQueue);
FreeAndNil(FIconUpdateQueueDeferred);
@@ -729,7 +722,7 @@ begin
FPath := '';
end;
procedure TDirView.WMDestroy(var Msg: TWMDestroy);
procedure TDirViewInt.WMDestroy(var Msg: TWMDestroy);
begin
Selected := nil;
ClearItems;
@@ -737,7 +730,7 @@ begin
inherited;
end;
procedure TDirView.TerminateThreads;
procedure TDirViewInt.TerminateThreads;
begin
StopIconUpdateThread;
StopWatchThread;
@@ -748,7 +741,7 @@ begin
end;
end;
function TDirView.GetHomeDirectory: string;
function TDirViewInt.GetHomeDirectory: string;
begin
if FHomeDirectory <> '' then Result := FHomeDirectory
else
@@ -762,17 +755,17 @@ begin
end;
end;
function TDirView.GetIsRoot: Boolean;
function TDirViewInt.GetIsRoot: Boolean;
begin
Result := IsRootPath(Path);
end;
function TDirView.GetPath: string;
function TDirViewInt.GetPath: string;
begin
Result := FPath;
end;
procedure TDirView.PathChanged;
procedure TDirViewInt.PathChanged;
var
Expanded: string;
begin
@@ -789,7 +782,7 @@ begin
FLastPath.AddOrSetValue(DriveInfo.GetDriveKey(Expanded), Expanded);
end;
procedure TDirView.SetPath(Value: string);
procedure TDirViewInt.SetPath(Value: string);
const
LongPathPrefix = '\\?\';
var
@@ -853,7 +846,7 @@ begin
end;
end;
procedure TDirView.OpenFallbackPath(Value: string);
procedure TDirViewInt.OpenFallbackPath(Value: string);
var
APath: string;
begin
@@ -876,7 +869,7 @@ begin
end;
end;
procedure TDirView.SetLoadEnabled(Value: Boolean);
procedure TDirViewInt.SetLoadEnabled(Value: Boolean);
begin
if Value <> LoadEnabled then
begin
@@ -889,29 +882,29 @@ begin
end;
end;
function TDirView.GetPathName: string;
function TDirViewInt.GetPathName: string;
begin
if IsRoot then Result := IncludeTrailingBackslash(Path)
else Result := Path;
end;
function TDirView.GetFileRec(Index: Integer): PFileRec;
function TDirViewInt.GetFileRec(Index: Integer): PFileRec;
begin
if Index > Pred(Items.Count) then Result := nil
else Result := Items[index].Data;
end;
function TDirView.HiddenCount: Integer;
function TDirViewInt.HiddenCount: Integer;
begin
Result := FHiddenCount;
end;
function TDirView.FilteredCount: Integer;
function TDirViewInt.FilteredCount: Integer;
begin
Result := FFilteredCount;
end;
function TDirView.AddItem(SRec: SysUtils.TSearchRec): TListItem;
function TDirViewInt.AddItem(SRec: SysUtils.TSearchRec): TListItem;
var
PItem: PFileRec;
Item: TListItem;
@@ -959,7 +952,7 @@ begin
Result := Item;
end;
procedure TDirView.AddParentDirItem;
procedure TDirViewInt.AddParentDirItem;
var
PItem: PFileRec;
Item: TListItem;
@@ -999,7 +992,7 @@ begin
PItem^.Empty := False;
end;
procedure TDirView.LoadFromRecycleBin(Dir: string);
procedure TDirViewInt.LoadFromRecycleBin(Dir: string);
var
PIDLRecycleLocal: PItemIDList;
PCurrList: PItemIDList;
@@ -1094,7 +1087,7 @@ begin
end;
end;
function TDirView.GetShellFolder(Dir: string): iShellFolder;
function TDirViewInt.GetShellFolder(Dir: string): iShellFolder;
var
Eaten: ULONG;
Attr: ULONG;
@@ -1121,34 +1114,34 @@ begin
end;
end;
function TDirView.ItemIsDirectory(Item: TListItem): Boolean;
function TDirViewInt.ItemIsDirectory(Item: TListItem): Boolean;
begin
Result :=
(Assigned(Item) and Assigned(Item.Data) and
PFileRec(Item.Data)^.IsDirectory);
end;
function TDirView.ItemIsFile(Item: TListItem): Boolean;
function TDirViewInt.ItemIsFile(Item: TListItem): Boolean;
begin
Result :=
(Assigned(Item) and Assigned(Item.Data) and
(not PFileRec(Item.Data)^.IsParentDir));
end;
function TDirView.ItemIsParentDirectory(Item: TListItem): Boolean;
function TDirViewInt.ItemIsParentDirectory(Item: TListItem): Boolean;
begin
Result :=
(Assigned(Item) and Assigned(Item.Data) and
PFileRec(Item.Data)^.IsParentDir);
end;
function TDirView.ItemIsRecycleBin(Item: TListItem): Boolean;
function TDirViewInt.ItemIsRecycleBin(Item: TListItem): Boolean;
begin
Result := (Assigned(Item) and Assigned(Item.Data) and
PFileRec(Item.Data)^.IsRecycleBin);
end;
function TDirView.ItemMatchesFilter(Item: TListItem; const Filter: TFileFilter): Boolean;
function TDirViewInt.ItemMatchesFilter(Item: TListItem; const Filter: TFileFilter): Boolean;
var
FileRec: PFileRec;
begin
@@ -1164,7 +1157,7 @@ begin
FileRec^.Size, FileTimeToDateTime(FileRec^.FileTime), Filter.Masks, False)));
end;
function TDirView.FileMatches(FileName: string; const SearchRec: TSearchRec): Boolean;
function TDirViewInt.FileMatches(FileName: string; const SearchRec: TSearchRec): Boolean;
var
Directory: Boolean;
FileSize: Int64;
@@ -1196,7 +1189,7 @@ begin
end;
end;
function TDirView.ItemOverlayIndexes(Item: TListItem): Word;
function TDirViewInt.ItemOverlayIndexes(Item: TListItem): Word;
begin
Result := inherited ItemOverlayIndexes(Item);
if Assigned(Item) and Assigned(Item.Data) then
@@ -1206,7 +1199,7 @@ begin
end;
end;
procedure TDirView.Load(DoFocusSomething: Boolean);
procedure TDirViewInt.Load(DoFocusSomething: Boolean);
begin
try
StopIconUpdateThread;
@@ -1230,7 +1223,7 @@ begin
end;
end;
procedure TDirView.LoadFiles;
procedure TDirViewInt.LoadFiles;
var
SRec: SysUtils.TSearchRec;
DosError: Integer;
@@ -1330,7 +1323,7 @@ begin
end;
end;
procedure TDirView.Reload2;
procedure TDirViewInt.Reload2;
type
PEFileRec = ^TEFileRec;
TEFileRec = record
@@ -1561,7 +1554,7 @@ begin
end;
end;
procedure TDirView.PerformItemDragDropOperation(Item: TListItem; Effect: Integer; Paste: Boolean);
procedure TDirViewInt.PerformItemDragDropOperation(Item: TListItem; Effect: Integer; Paste: Boolean);
var
TargetPath: string;
begin
@@ -1586,13 +1579,13 @@ begin
PerformDragDropFileOperation(TargetPath, Effect);
end;
procedure TDirView.ReLoad(CacheIcons: Boolean);
procedure TDirViewInt.ReLoad(CacheIcons: Boolean);
begin
if not FLoadEnabled then FDirty := True
else inherited;
end;
function TDirView.GetAttrString(Attr: Integer): string;
function TDirViewInt.GetAttrString(Attr: Integer): string;
const
Attrs: array[1..5] of Integer =
(FILE_ATTRIBUTE_COMPRESSED, FILE_ATTRIBUTE_ARCHIVE,
@@ -1616,7 +1609,7 @@ begin
end;
end;
function TDirView.GetFileInfo(
function TDirViewInt.GetFileInfo(
CanUsePIDL: Boolean; PIDL: PItemIDList; Path: string; CanTimeout: Boolean;
dwFileAttributes: DWORD; var psfi: TSHFileInfoW; uFlags: UINT): DWORD_PTR;
var
@@ -1650,7 +1643,7 @@ begin
end;
end;
procedure TDirView.DoFetchIcon(
procedure TDirViewInt.DoFetchIcon(
FilePath: string; IsSpecialExt: Boolean; CanTimeout: Boolean; FileRec: PFileRec; var ImageIndex: Integer; var TypeName: string);
var
Eaten: ULONG;
@@ -1732,7 +1725,7 @@ begin
end;
end;
procedure TDirView.GetDisplayData(Item: TListItem; FetchIcon: Boolean);
procedure TDirViewInt.GetDisplayData(Item: TListItem; FetchIcon: Boolean);
var
FileInfo: TShFileInfo;
IsSpecialExt: Boolean;
@@ -1783,12 +1776,12 @@ begin
end;
end;
function TDirView.GetDirOK: Boolean;
function TDirViewInt.GetDirOK: Boolean;
begin
Result := FDirOK;
end;
function TDirView.ItemFullFileName(Item: TListItem): string;
function TDirViewInt.ItemFullFileName(Item: TListItem): string;
begin
if Assigned(Item) and Assigned(Item.Data) then
begin
@@ -1810,14 +1803,14 @@ begin
Result := EmptyStr;
end;
function TDirView.ItemFileNameOnly(Item: TListItem): string;
function TDirViewInt.ItemFileNameOnly(Item: TListItem): string;
begin
Assert(Assigned(Item) and Assigned(Item.Data));
Result := PFileRec(Item.Data)^.FileName;
SetLength(Result, Length(Result) - Length(ItemFileExt(Item)));
end;
function TDirView.ItemFileExt(Item: TListItem): string;
function TDirViewInt.ItemFileExt(Item: TListItem): string;
begin
Assert(Assigned(Item) and Assigned(Item.Data));
Result := ExtractFileExt(PFileRec(Item.Data)^.FileName);
@@ -1827,8 +1820,8 @@ function CompareFileType(I1, I2: TListItem; P1, P2: PFileRec): Integer;
var
Key1, Key2: string;
begin
if P1.Empty then TDirView(I1.ListView).GetDisplayData(I1, False);
if P2.Empty then TDirView(I2.ListView).GetDisplayData(I2, False);
if P1.Empty then TDirViewInt(I1.ListView).GetDisplayData(I1, False);
if P2.Empty then TDirViewInt(I2.ListView).GetDisplayData(I2, False);
if P1.IsDirectory then
begin
Key1 := P1.TypeName + ' ' + P1.DisplayName;
@@ -1839,7 +1832,7 @@ begin
Key1 := P1.TypeName + ' ' + P1.FileExt + ' ' + P1.DisplayName;
Key2 := P2.TypeName + ' ' + P2.FileExt + ' ' + P2.DisplayName;
end;
Result := CompareLogicalTextPas(Key1, Key2, TDirView(I1.ListView).NaturalOrderNumericalSorting);
Result := CompareLogicalTextPas(Key1, Key2, TDirViewInt(I1.ListView).NaturalOrderNumericalSorting);
end;
function CompareFileTime(P1, P2: PFileRec): Integer;
@@ -1862,7 +1855,7 @@ begin
if P.CalculatedSize >= 0 then Result := P.CalculatedSize;
end;
function CompareFile(I1, I2: TListItem; AOwner: TDirView): Integer; stdcall;
function CompareFile(I1, I2: TListItem; AOwner: TDirViewInt): Integer; stdcall;
var
ConsiderDirection: Boolean;
P1, P2: PFileRec;
@@ -1962,7 +1955,7 @@ begin
end;
end;
procedure TDirView.SortItems;
procedure TDirViewInt.SortItems;
begin
if HandleAllocated then
begin
@@ -1976,7 +1969,7 @@ begin
end
end;
procedure TDirView.ValidateFile(Item : TListItem);
procedure TDirViewInt.ValidateFile(Item : TListItem);
var
Index: Integer;
begin
@@ -1990,7 +1983,7 @@ begin
end;
end;
procedure TDirView.ValidateFile(FileName: TFileName);
procedure TDirViewInt.ValidateFile(FileName: TFileName);
var
FilePath: string;
begin
@@ -2001,7 +1994,7 @@ begin
ValidateFile(FindFileItem(ExtractFileName(FileName)));
end;
procedure TDirView.ValidateSelectedFiles;
procedure TDirViewInt.ValidateSelectedFiles;
var
FileList: TStrings;
i: Integer;
@@ -2050,7 +2043,7 @@ begin
end;
end;
procedure TDirView.CreateDirectory(DirName: string);
procedure TDirViewInt.CreateDir(DirName: string);
var
SRec: SysUtils.TSearchRec;
Item: TListItem;
@@ -2067,7 +2060,7 @@ begin
StopIconUpdateThread;
try
// create the physical directory:
Win32Check(Windows.CreateDirectory(PChar(ApiPath(DirName)), nil));
Win32Check(CreateDirectory(PChar(ApiPath(DirName)), nil));
if IncludeTrailingBackslash(ExtractFilePath(ExpandFileName(DirName))) =
IncludeTrailingBackslash(Path) then
@@ -2099,7 +2092,7 @@ begin
end;
end;
procedure TDirView.DisplayContextMenu(Where: TPoint);
procedure TDirViewInt.DisplayContextMenu(Where: TPoint);
var
FileList: TStringList;
Index: Integer;
@@ -2270,7 +2263,7 @@ begin
end;
end;
procedure TDirView.GetDisplayInfo(ListItem: TListItem;
procedure TDirViewInt.GetDisplayInfo(ListItem: TListItem;
var DispInfo: TLVItem);
var
Value: string;
@@ -2336,7 +2329,7 @@ begin
end;
end;
function TDirView.ItemColor(Item: TListItem): TColor;
function TDirViewInt.ItemColor(Item: TListItem): TColor;
begin
if PFileRec(Item.Data).Attr and FILE_ATTRIBUTE_COMPRESSED <> 0 then
begin
@@ -2351,7 +2344,7 @@ begin
Result := clDefaultItemColor;
end;
function TDirView.ItemThumbnail(Item: TListItem; Size: TSize): TBitmap;
function TDirViewInt.ItemThumbnail(Item: TListItem; Size: TSize): TBitmap;
var
ItemData: PFileRec;
begin
@@ -2378,7 +2371,7 @@ begin
end;
end;
procedure TDirView.StartFileDeleteThread;
procedure TDirViewInt.StartFileDeleteThread;
var
Files: TStringList;
begin
@@ -2391,7 +2384,7 @@ begin
end;
end;
procedure TDirView.IconUpdateEnqueue(ListItem: TListItem);
procedure TDirViewInt.IconUpdateEnqueue(ListItem: TListItem);
var
Schedule: TIconUpdateSchedule;
begin
@@ -2405,7 +2398,7 @@ begin
StartIconUpdateThread;
end;
function TDirView.IconUpdatePeek: Integer;
function TDirViewInt.IconUpdatePeek: Integer;
begin
if FIconUpdateQueue.Count > 0 then
Result := FIconUpdateQueue.Peek.Index
@@ -2415,7 +2408,7 @@ begin
Result := -1;
end;
procedure TDirView.IconUpdateDequeue;
procedure TDirViewInt.IconUpdateDequeue;
begin
if FIconUpdateQueue.Count > 0 then
FIconUpdateQueue.Dequeue
@@ -2425,12 +2418,12 @@ begin
Assert(FIconUpdateSet.Count = FIconUpdateQueue.Count + FIconUpdateQueueDeferred.Count);
end;
function TDirView.ThumbnailNeeded(ItemData: PFileRec): Boolean;
function TDirViewInt.ThumbnailNeeded(ItemData: PFileRec): Boolean;
begin
Result := (not Assigned(ItemData.Thumbnail)) and (ItemData.ThumbnailSize <> ThumbnailNotNeeded);
end;
procedure TDirView.DoFetchIconUpdate;
procedure TDirViewInt.DoFetchIconUpdate;
var
Item: TListItem;
ItemData: PFileRec;
@@ -2499,7 +2492,7 @@ begin
end;
end;
procedure TDirView.DoUpdateIcon;
procedure TDirViewInt.DoUpdateIcon;
var
Item: TListItem;
ItemData: PFileRec;
@@ -2554,7 +2547,7 @@ begin
end;
end;
procedure TDirView.StartIconUpdateThread;
procedure TDirViewInt.StartIconUpdateThread;
begin
if DirOK and UseIconUpdateThread then
begin
@@ -2564,7 +2557,7 @@ begin
end;
end;
procedure TDirView.StopIconUpdateThread;
procedure TDirViewInt.StopIconUpdateThread;
begin
if Assigned(FIconUpdateThread) then
begin
@@ -2581,7 +2574,7 @@ begin
end;
end;
procedure TDirView.StopWatchThread;
procedure TDirViewInt.StopWatchThread;
begin
if Assigned(FDiscMonitor) then
begin
@@ -2589,7 +2582,7 @@ begin
end;
end;
procedure TDirView.StartWatchThread;
procedure TDirViewInt.StartWatchThread;
begin
if (Length(Path) > 0) and WatchForChanges and DirOK then
begin
@@ -2613,7 +2606,7 @@ begin
end;
end;
procedure TDirView.TimerOnTimer(Sender: TObject);
procedure TDirViewInt.TimerOnTimer(Sender: TObject);
begin
if not Loading then
begin
@@ -2624,7 +2617,7 @@ begin
end;
end;
procedure TDirView.ChangeDetected(Sender: TObject; const Directory: string;
procedure TDirViewInt.ChangeDetected(Sender: TObject; const Directory: string;
var SubdirsChanged: Boolean);
begin
// avoid prolonging the actual update with each change, as if continous change
@@ -2637,19 +2630,19 @@ begin
end;
end;
procedure TDirView.ChangeInvalid(Sender: TObject; const Directory: string;
procedure TDirViewInt.ChangeInvalid(Sender: TObject; const Directory: string;
const ErrorStr: string);
begin
FDiscMonitor.Close;
end;
function TDirView.WatchThreadActive: Boolean;
function TDirViewInt.WatchThreadActive: Boolean;
begin
Result := WatchForChanges and Assigned(FDiscMonitor) and
FDiscMonitor.Active and FDiscMonitor.Enabled;
end;
procedure TDirView.SetChangeInterval(Value: Cardinal);
procedure TDirViewInt.SetChangeInterval(Value: Cardinal);
begin
if Value > 0 then
begin
@@ -2658,18 +2651,18 @@ begin
end;
end;
procedure TDirView.SetDirColProperties(Value: TDirViewColProperties);
procedure TDirViewInt.SetDirColProperties(Value: TDirViewColProperties);
begin
if Value <> ColProperties then
ColProperties := Value;
end;
function TDirView.GetDirColProperties: TDirViewColProperties;
function TDirViewInt.GetDirColProperties: TDirViewColProperties;
begin
Result := TDirViewColProperties(ColProperties);
end;
procedure TDirView.SetWatchForChanges(Value: Boolean);
procedure TDirViewInt.SetWatchForChanges(Value: Boolean);
begin
if WatchForChanges <> Value then
begin
@@ -2682,7 +2675,7 @@ begin
end;
end;
procedure TDirView.DisplayPropertiesMenu;
procedure TDirViewInt.DisplayPropertiesMenu;
var
FileList: TStringList;
Index: Integer;
@@ -2724,7 +2717,7 @@ begin
end;
end;
procedure TDirView.ExecuteFile(Item: TListItem);
procedure TDirViewInt.ExecuteFile(Item: TListItem);
var
DefDir: string;
FileName: string;
@@ -2763,7 +2756,7 @@ begin
end;
end;
procedure TDirView.ExecuteDrive(Drive: string);
procedure TDirViewInt.ExecuteDrive(Drive: string);
var
APath: string;
DriveRoot: string;
@@ -2802,12 +2795,12 @@ begin
Path := APath;
end;
procedure TDirView.ExecuteHomeDirectory;
procedure TDirViewInt.ExecuteHomeDirectory;
begin
Path := HomeDirectory;
end;
procedure TDirView.ExecuteParentDirectory;
procedure TDirViewInt.ExecuteParentDirectory;
begin
if Valid then
begin
@@ -2822,7 +2815,7 @@ begin
end;
end;
procedure TDirView.ExecuteRootDirectory;
procedure TDirViewInt.ExecuteRootDirectory;
begin
if Valid then
begin
@@ -2835,7 +2828,7 @@ begin
end;
end;
procedure TDirView.Delete(Item: TListItem);
procedure TDirViewInt.Delete(Item: TListItem);
begin
if Assigned(Item) and Assigned(Item.Data) and not (csRecreating in ControlState) then
begin
@@ -2853,7 +2846,7 @@ begin
inherited Delete(Item);
end;
procedure TDirView.InternalEdit(const HItem: TLVItem);
procedure TDirViewInt.InternalEdit(const HItem: TLVItem);
var
Item: TListItem;
Info: string;
@@ -2926,7 +2919,7 @@ begin
end;
end;
function TDirView.ItemFileName(Item: TListItem): string;
function TDirViewInt.ItemFileName(Item: TListItem): string;
begin
if Assigned(Item) and Assigned(Item.Data) then
Result := ExtractFileName(PFileRec(Item.Data)^.FileName)
@@ -2934,21 +2927,21 @@ begin
Result := '';
end;
function TDirView.ItemFileSize(Item: TListItem): Int64;
function TDirViewInt.ItemFileSize(Item: TListItem): Int64;
begin
Result := 0;
if Assigned(Item) and Assigned(Item.Data) then
Result := GetItemFileSize(PFileRec(Item.Data));
end;
function TDirView.ItemFileTime(Item: TListItem;
function TDirViewInt.ItemFileTime(Item: TListItem;
var Precision: TDateTimePrecision): TDateTime;
begin
Result := FileTimeToDateTime(PFileRec(Item.Data)^.FileTime);
Precision := tpMillisecond;
end;
function TDirView.ItemImageIndex(Item: TListItem;
function TDirViewInt.ItemImageIndex(Item: TListItem;
Cache: Boolean): Integer;
begin
if Assigned(Item) and Assigned(Item.Data) then
@@ -2969,19 +2962,19 @@ begin
else Result := -1;
end;
procedure TDirView.Notification(AComponent: TComponent; Operation: TOperation);
procedure TDirViewInt.Notification(AComponent: TComponent; Operation: TOperation);
begin
inherited Notification(AComponent, Operation);
if (Operation = opRemove) and (AComponent = FDriveView) then
FDriveView := nil;
end;
procedure TDirView.ReloadDirectory;
procedure TDirViewInt.ReloadDirectory;
begin
Reload(True);
end;
procedure TDirView.ResetItemImage(Index: Integer);
procedure TDirViewInt.ResetItemImage(Index: Integer);
var
LVI: TLVItem;
begin
@@ -2999,7 +2992,7 @@ end;
// Drag&Drop handling
procedure TDirView.SignalFileDelete(Sender: TObject; Files: TStringList);
procedure TDirViewInt.SignalFileDelete(Sender: TObject; Files: TStringList);
// Called by TFileDeleteThread, when a file was deleted by the Drag&Drop target window:
var
Index: Integer;
@@ -3009,7 +3002,7 @@ begin
ValidateFile(Files[Index]);
end;
procedure TDirView.DDMenuPopup(Sender: TObject; AMenu: HMenu; DataObj: IDataObject;
procedure TDirViewInt.DDMenuPopup(Sender: TObject; AMenu: HMenu; DataObj: IDataObject;
AMinCustCmd: Integer; grfKeyState: Longint; pt: TPoint);
begin
if Assigned(FDriveView) then
@@ -3026,7 +3019,7 @@ begin
inherited;
end;
procedure TDirView.DDMenuDone(Sender: TObject; AMenu: HMenu);
procedure TDirViewInt.DDMenuDone(Sender: TObject; AMenu: HMenu);
begin
if not WatchThreadActive then
begin
@@ -3042,7 +3035,7 @@ begin
inherited;
end;
procedure TDirView.DDDropHandlerSucceeded(Sender: TObject; grfKeyState: Longint;
procedure TDirViewInt.DDDropHandlerSucceeded(Sender: TObject; grfKeyState: Longint;
Point: TPoint; dwEffect: Longint);
begin
// Not sure why is this here. There's no "disable" counterparty.
@@ -3055,7 +3048,7 @@ begin
inherited;
end;
procedure TDirView.AddToDragFileList(FileList: TFileList; Item: TListItem);
procedure TDirViewInt.AddToDragFileList(FileList: TFileList; Item: TListItem);
begin
Assert(Assigned(Item));
if IsRecycleBin then
@@ -3075,7 +3068,7 @@ begin
else inherited;
end;
procedure TDirView.DDDragDetect(grfKeyState: Longint; DetectStart, Point: TPoint;
procedure TDirViewInt.DDDragDetect(grfKeyState: Longint; DetectStart, Point: TPoint;
DragStatus: TDragDetectStatus);
var
WasWatchThreadActive: Boolean;
@@ -3090,7 +3083,7 @@ begin
end;
end;
procedure TDirView.DDChooseEffect(grfKeyState: Integer; var dwEffect: Integer; PreferredEffect: Integer);
procedure TDirViewInt.DDChooseEffect(grfKeyState: Integer; var dwEffect: Integer; PreferredEffect: Integer);
begin
if DragDropFilesEx.OwnerIsSource and
(dwEffect = DROPEFFECT_COPY) and (not Assigned(DropTarget)) then
@@ -3123,7 +3116,7 @@ begin
inherited;
end;
procedure TDirView.PerformDragDropFileOperation(TargetPath: string; Effect: Integer);
procedure TDirViewInt.PerformDragDropFileOperation(TargetPath: string; Effect: Integer);
var
Index: Integer;
SourcePath: string;
@@ -3163,8 +3156,8 @@ begin
DriveView.StopWatchThread;
if (DropSourceControl <> Self) and
(DropSourceControl is TDirView) then
TDirView(DropSourceControl).StopWatchThread;
(DropSourceControl is TDirViewInt) then
TDirViewInt(DropSourceControl).StopWatchThread;
if DropFiles(
DragDropFilesEx, Effect, FFileOperator, TargetPath, IsRecycleBin,
@@ -3192,11 +3185,11 @@ begin
end;
if Assigned(DropSourceControl) and
(DropSourceControl is TDirView) and
(DropSourceControl is TDirViewInt) and
(DropSourceControl <> Self) and
(Effect = DROPEFFECT_MOVE) then
begin
TDirView(DropSourceControl).ValidateSelectedFiles;
TDirViewInt(DropSourceControl).ValidateSelectedFiles;
end;
if Assigned(FDriveView) and SourceIsDirectory then
@@ -3228,8 +3221,8 @@ begin
FDriveView.StartWatchThread;
Sleep(0);
WatchForChanges := OldWatchForChanges;
if (DropSourceControl <> Self) and (DropSourceControl is TDirView) then
TDirView(DropSourceControl).StartWatchThread;
if (DropSourceControl <> Self) and (DropSourceControl is TDirViewInt) then
TDirViewInt(DropSourceControl).StartWatchThread;
Screen.Cursor := OldCursor;
end;
end;
@@ -3237,14 +3230,14 @@ begin
end;
end;
procedure TDirView.DDError(ErrorNo: TDDError);
procedure TDirViewInt.DDError(ErrorNo: TDDError);
begin
if Assigned(OnDDError) then OnDDError(Self, ErrorNo)
else
raise EDragDrop.Create(Format(SDragDropError, [Ord(ErrorNo)]));
end;
procedure TDirView.ClearCutState;
procedure TDirViewInt.ClearCutState;
begin
// This is all far from perfect, as the clipboard can change for number of other reasons.
// We should better monitor the clipboard changes (the way we do in TImportSessionsDialog).
@@ -3266,7 +3259,7 @@ begin
end;
end;
procedure TDirView.EmptyClipboard;
procedure TDirViewInt.EmptyClipboard;
begin
if Windows.OpenClipBoard(0) then
begin
@@ -3276,7 +3269,7 @@ begin
end;
end;
function TDirView.DoCopyToClipboard(Focused: Boolean; Cut: Boolean; Operation: TClipBoardOperation): Boolean;
function TDirViewInt.DoCopyToClipboard(Focused: Boolean; Cut: Boolean; Operation: TClipBoardOperation): Boolean;
var
Item: TListItem;
SaveCursor: TCursor;
@@ -3311,17 +3304,17 @@ begin
end;
end;
function TDirView.CopyToClipBoard(Focused: Boolean): Boolean;
function TDirViewInt.CopyToClipBoard(Focused: Boolean): Boolean;
begin
Result := DoCopyToClipboard(Focused, False, cboCopy);
end;
function TDirView.CutToClipBoard(Focused: Boolean): Boolean;
function TDirViewInt.CutToClipBoard(Focused: Boolean): Boolean;
begin
Result := DoCopyToClipboard(Focused, True, cboCut);
end;
function TDirView.PasteFromClipBoard(TargetPath: string): Boolean;
function TDirViewInt.PasteFromClipBoard(TargetPath: string): Boolean;
var
Effect: LongInt;
begin
@@ -3336,23 +3329,23 @@ begin
end;
end;
function TDirView.DragCompleteFileList: Boolean;
function TDirViewInt.DragCompleteFileList: Boolean;
begin
Result := inherited DragCompleteFileList and
(FDriveType <> DRIVE_REMOVABLE);
end;
function TDirView.NewColProperties: TCustomListViewColProperties;
function TDirViewInt.NewColProperties: TCustomListViewColProperties;
begin
Result := TDirViewColProperties.Create(Self);
end;
function TDirView.SortAscendingByDefault(Index: Integer): Boolean;
function TDirViewInt.SortAscendingByDefault(Index: Integer): Boolean;
begin
Result := not (TDirViewCol(Index) in [dvSize, dvChanged]);
end;
procedure TDirView.SetItemImageIndex(Item: TListItem; Index: Integer);
procedure TDirViewInt.SetItemImageIndex(Item: TListItem; Index: Integer);
begin
Assert(Assigned(Item));
var PItem := PFileRec(Item.Data);
@@ -3363,7 +3356,7 @@ begin
end;
end;
procedure TDirView.SetItemCalculatedSize(Item: TListItem; ASize: Int64);
procedure TDirViewInt.SetItemCalculatedSize(Item: TListItem; ASize: Int64);
var
OldSize: Int64;
begin

View File

@@ -1,4 +1,4 @@
unit DriveView;
unit DriveViewInt;
{==================================================================
Component TDriveView / Version 2.6, January 2000
@@ -38,8 +38,8 @@ interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, ComObj,
Dialogs, ComCtrls, ShellApi, CommCtrl, ExtCtrls, ActiveX, ShlObj,
DirView, ShellDialogs, DragDrop, DragDropFilesEx, FileChanges, FileOperator,
DiscMon, IEDriveInfo, IEListView, BaseUtils, CustomDirView,
DirViewInt, ShellDialogs, DragDrop, DragDropFilesEx, FileChanges, FileOperator,
DiscMon, IEDriveInfoInt, IEListView, BaseUtils, CustomDirView,
CustomDriveView, System.Generics.Collections, CompThread;
type
@@ -66,7 +66,7 @@ type
PScanDirInfo = ^TScanDirInfo;
TDriveView = class;
TDriveViewInt = class;
TSubDirReaderSchedule = class
Node: TTreeNode;
@@ -111,7 +111,7 @@ type
procedure Terminate; override;
protected
constructor Create(DriveView: TDriveView);
constructor Create(DriveView: TDriveViewInt);
procedure Add(Node: TTreeNode; Path: string);
procedure Delete(Node: TTreeNode);
function Detach: Integer;
@@ -120,7 +120,7 @@ type
procedure Execute; override;
private
FDriveView: TDriveView;
FDriveView: TDriveViewInt;
FEvent: THandle;
FQueue: TStack<TSubDirReaderSchedule>;
FResults: TQueue<TSubDirReaderSchedule>;
@@ -140,7 +140,7 @@ type
TTreeNodeArray = array of TTreeNode;
TDriveView = class(TCustomDriveView)
TDriveViewInt = class(TCustomDriveView)
private
FDriveStatus: TObjectDictionary<string, TDriveStatus>;
@@ -169,7 +169,7 @@ type
FOnNeedHiddenDirectories: TNotifyEvent;
// used components:
FDirView: TDirView;
FDirView: TDirViewInt;
FFileOperator: TFileOperator;
FChangeInterval: Cardinal;
@@ -210,7 +210,7 @@ type
protected
procedure SetSelected(Node: TTreeNode);
procedure SetWatchDirectory(Value: Boolean);
procedure SetDirView(Value: TDirView);
procedure SetDirView(Value: TDirViewInt);
procedure SetDirectory(Value: string); override;
function DoScanDir(FromNode: TTreeNode): Boolean;
procedure AddChildNode(ParentNode: TTreeNode; ParentPath: string; SRec: TSearchRec);
@@ -326,8 +326,8 @@ type
property ConfirmOverwrite: Boolean read FConfirmOverwrite write FConfirmOverwrite default True;
// Enable automatic update on filesystem changes:
property WatchDirectory: Boolean read FWatchDirectory write SetWatchDirectory default False;
// Linked component TDirView:
property DirView: TDirView read FDirView write SetDirView;
// Linked component TDirViewInt:
property DirView: TDirViewInt read FDirView write SetDirView;
// Additional events:
property OnDisplayContextMenu: TNotifyEvent read FOnDisplayContextMenu
write FOnDisplayContextMenu;
@@ -421,8 +421,6 @@ type
var
DriveViewLoadingTooLongLimit: Integer = 0;
procedure Register;
implementation
uses
@@ -435,11 +433,6 @@ const
WM_USER_SUBDIRREADER = WM_USER_SHCHANGENOTIFY + 1;
procedure Register;
begin
RegisterComponents('DriveDir', [TDriveView]);
end;
constructor TNodeData.Create;
begin
inherited;
@@ -462,7 +455,7 @@ end;
// TSubDirReaderThread
constructor TSubDirReaderThread.Create(DriveView: TDriveView);
constructor TSubDirReaderThread.Create(DriveView: TDriveViewInt);
begin
inherited Create(True);
FDriveView := DriveView;
@@ -779,7 +772,7 @@ end;
// Not sure if this is ever used (possibly only when "assigning" tree view to another instance, what never do).
// It is NOT used when recreating a tree view handle - for that a node is serialized and deserialized,
// including a pointer to TNodeData. See csRecreating condition in TDriveView.Delete.
// including a pointer to TNodeData. See csRecreating condition in TDriveViewInt.Delete.
procedure TDriveTreeNode.Assign(Source: TPersistent);
var
SourceData: TNodeData;
@@ -802,9 +795,9 @@ begin
end;
end;
// TDriveView
// TDriveViewInt
constructor TDriveView.Create(AOwner: TComponent);
constructor TDriveViewInt.Create(AOwner: TComponent);
var
Drive: TRealDrive;
begin
@@ -853,7 +846,7 @@ begin
FDragDropFilesEx.ShellExtensions.DragDropHandler := True;
end; // Create
destructor TDriveView.Destroy;
destructor TDriveViewInt.Destroy;
var
DriveStatusPair: TDriveStatusPair;
begin
@@ -880,7 +873,7 @@ begin
inherited Destroy;
end; // Destroy
function TDriveView.CreateDriveStatus: TDriveStatus;
function TDriveViewInt.CreateDriveStatus: TDriveStatus;
begin
Result := TDriveStatus.Create;
Result.Scanned := False;
@@ -896,13 +889,13 @@ begin
Result.ChangeTimer.OnTimer := ChangeTimerOnTimer;
end;
procedure TDriveView.DriveRemoving(Drive: string);
procedure TDriveViewInt.DriveRemoving(Drive: string);
begin
DriveRemoved(Drive);
TerminateWatchThread(Drive);
end;
procedure TDriveView.CreateWnd;
procedure TDriveViewInt.CreateWnd;
var
DriveStatus: TDriveStatus;
begin
@@ -935,7 +928,7 @@ begin
end;
end; // CreateWnd
procedure TDriveView.DestroyWnd;
procedure TDriveViewInt.DestroyWnd;
var
DriveStatus: TDriveStatus;
I: Integer;
@@ -981,7 +974,7 @@ begin
inherited;
end;
function TDriveView.NodeColor(Node: TTreeNode): TColor;
function TDriveViewInt.NodeColor(Node: TTreeNode): TColor;
begin
Result := clDefaultItemColor;
var NodeData := TNodeData(Node.Data);
@@ -1000,17 +993,17 @@ begin
end;
end;
function TDriveView.GetCustomDirView: TCustomDirView;
function TDriveViewInt.GetCustomDirView: TCustomDirView;
begin
Result := DirView;
end;
procedure TDriveView.SetCustomDirView(Value: TCustomDirView);
procedure TDriveViewInt.SetCustomDirView(Value: TCustomDirView);
begin
DirView := Value as TDirView;
DirView := Value as TDirViewInt;
end;
function TDriveView.NodePath(Node: TTreeNode): string;
function TDriveViewInt.NodePath(Node: TTreeNode): string;
var
ParentNode: TTreeNode;
begin
@@ -1037,24 +1030,24 @@ end;
// NodePathName: Returns the complete path to Node with trailing backslash on rootnodes:
// C:\ ,C:\WINDOWS, C:\WINDOWS\SYSTEM
function TDriveView.NodePathName(Node: TTreeNode): string;
function TDriveViewInt.NodePathName(Node: TTreeNode): string;
begin
Result := NodePath(Node);
if IsRootPath(Result) then
Result := IncludeTrailingBackslash(Result);
end;
function TDriveView.NodeIsRecycleBin(Node: TTreeNode): Boolean;
function TDriveViewInt.NodeIsRecycleBin(Node: TTreeNode): Boolean;
begin
Result := TNodeData(Node.Data).IsRecycleBin;
end;
function TDriveView.NodePathExists(Node: TTreeNode): Boolean;
function TDriveViewInt.NodePathExists(Node: TTreeNode): Boolean;
begin
Result := DirectoryExists(ApiPath(NodePathName(Node)));
end;
function TDriveView.CanEdit(Node: TTreeNode): Boolean;
function TDriveViewInt.CanEdit(Node: TTreeNode): Boolean;
begin
Result := inherited CanEdit(Node) or FForceRename;
if Result then
@@ -1069,7 +1062,7 @@ begin
FForceRename := False;
end;
procedure TDriveView.Edit(const Item: TTVItem);
procedure TDriveViewInt.Edit(const Item: TTVItem);
var
Node: TTreeNode;
Info: string;
@@ -1135,7 +1128,7 @@ begin
end;
end; // Edit
procedure TDriveView.WMUserRename(var Message: TMessage);
procedure TDriveViewInt.WMUserRename(var Message: TMessage);
begin
if Assigned(FRenameNode) then
begin
@@ -1146,7 +1139,7 @@ begin
end;
end;
function TDriveView.CanExpand(Node: TTreeNode): Boolean;
function TDriveViewInt.CanExpand(Node: TTreeNode): Boolean;
var
SubNode: TTreeNode;
Drive: string;
@@ -1187,14 +1180,14 @@ begin
end;
end; // CanExpand
procedure TDriveView.GetImageIndex(Node: TTreeNode);
procedure TDriveViewInt.GetImageIndex(Node: TTreeNode);
begin
if TNodeData(Node.Data).IconEmpty then
SetImageIndex(Node);
inherited;
end;
procedure TDriveView.Loaded;
procedure TDriveViewInt.Loaded;
begin
inherited;
// Create the drive nodes:
@@ -1206,12 +1199,12 @@ begin
FCreating := False;
end;
function TDriveView.CreateNode: TTreeNode;
function TDriveViewInt.CreateNode: TTreeNode;
begin
Result := TDriveTreeNode.Create(Items);
end;
procedure TDriveView.Delete(Node: TTreeNode);
procedure TDriveViewInt.Delete(Node: TTreeNode);
var
NodeData: TNodeData;
begin
@@ -1241,7 +1234,7 @@ begin
end;
end; // OnDelete
procedure TDriveView.KeyPress(var Key: Char);
procedure TDriveViewInt.KeyPress(var Key: Char);
begin
inherited;
@@ -1255,7 +1248,7 @@ begin
end;
end;
function TDriveView.CanChange(Node: TTreeNode): Boolean;
function TDriveViewInt.CanChange(Node: TTreeNode): Boolean;
var
Path: string;
Drive: string;
@@ -1309,7 +1302,7 @@ begin
end;
end;
procedure TDriveView.Change(Node: TTreeNode);
procedure TDriveViewInt.Change(Node: TTreeNode);
var
Drive: string;
OldSerial: DWORD;
@@ -1385,7 +1378,7 @@ begin
inherited;
end;
procedure TDriveView.SetImageIndex(Node: TTreeNode);
procedure TDriveViewInt.SetImageIndex(Node: TTreeNode);
var
FileInfo: TShFileInfo;
Drive, NodePath: string;
@@ -1464,7 +1457,7 @@ begin
end;
end;
function TDriveView.GetDrives: TStrings;
function TDriveViewInt.GetDrives: TStrings;
var
DriveStatusPair: TDriveStatusPair;
Drives: TStringList;
@@ -1479,7 +1472,7 @@ begin
Result := Drives;
end;
procedure TDriveView.DriveRemoved(Drive: string);
procedure TDriveViewInt.DriveRemoved(Drive: string);
var
NewDrive: Char;
begin
@@ -1514,7 +1507,7 @@ begin
end;
end;
procedure TDriveView.DriveNotification(Notification: TDriveNotification; Drive: string);
procedure TDriveViewInt.DriveNotification(Notification: TDriveNotification; Drive: string);
begin
case Notification of
dnRefresh:
@@ -1528,7 +1521,7 @@ begin
end;
end;
procedure TDriveView.RefreshRootNodes(Floppy: Boolean);
procedure TDriveViewInt.RefreshRootNodes(Floppy: Boolean);
var
Drives: TStrings;
NewText: string;
@@ -1610,7 +1603,7 @@ begin
end;
end;
procedure TDriveView.AddChildNode(ParentNode: TTreeNode; ParentPath: string; SRec: TSearchRec);
procedure TDriveViewInt.AddChildNode(ParentNode: TTreeNode; ParentPath: string; SRec: TSearchRec);
var
NewNode: TTreeNode;
NodeData: TNodeData;
@@ -1634,7 +1627,7 @@ begin
end;
function TDriveView.GetDriveStatus(Drive: string): TDriveStatus;
function TDriveViewInt.GetDriveStatus(Drive: string): TDriveStatus;
begin
if not FDriveStatus.TryGetValue(Drive, Result) then
begin
@@ -1643,19 +1636,19 @@ begin
end;
end;
function TDriveView.DoScanDir(FromNode: TTreeNode): Boolean;
function TDriveViewInt.DoScanDir(FromNode: TTreeNode): Boolean;
begin
Result := not TNodeData(FromNode.Data).IsRecycleBin;
end;
function TDriveView.DirAttrMask: Integer;
function TDriveViewInt.DirAttrMask: Integer;
begin
Result := faDirectory or faSysFile;
if ShowHiddenDirs then
Result := Result or faHidden;
end;
procedure TDriveView.ScanDrive(Drive: string);
procedure TDriveViewInt.ScanDrive(Drive: string);
begin
ValidateDirectory(FindNodeToPath(DriveInfo.GetDriveRoot(Drive)));
GetDriveStatus(Drive).Scanned := True;
@@ -1674,7 +1667,7 @@ begin
Result := System.Copy(S, 1, I);
end;
function TDriveView.DoSearchSubDirs(
function TDriveViewInt.DoSearchSubDirs(
ParentNode: TTreeNode; Path: string; Level: Integer; ExistingOnly: Boolean;
var SelectionHierarchy: TTreeNodeArray; var SelectionHierarchyHeight: Integer): TTreeNode;
var
@@ -1733,7 +1726,7 @@ begin
end;
end;
function TDriveView.SearchSubDirs(
function TDriveViewInt.SearchSubDirs(
ParentNode: TTreeNode; Path: string; Level: Integer; ExistingOnly: Boolean;
var SelectionHierarchy: TTreeNodeArray; var SelectionHierarchyHeight: Integer): TTreeNode;
var
@@ -1772,7 +1765,7 @@ begin
end;
end; // SearchSubDirs
function TDriveView.DoFindNodeToPath(Path: string; ExistingOnly: Boolean): TTreeNode;
function TDriveViewInt.DoFindNodeToPath(Path: string; ExistingOnly: Boolean): TTreeNode;
var
SelectionHierarchy: TTreeNodeArray;
SelectionHierarchyHeight: Integer;
@@ -1784,7 +1777,7 @@ begin
if Length(Path) < 3 then
Exit;
// Particularly when used by TDirView to delegate browsing to
// Particularly when used by TDirViewInt to delegate browsing to
// hidden drive view, the handle may not be created
HandleNeeded;
@@ -1872,17 +1865,17 @@ begin
end;
end;
function TDriveView.FindNodeToPath(Path: string): TTreeNode;
function TDriveViewInt.FindNodeToPath(Path: string): TTreeNode;
begin
Result := DoFindNodeToPath(Path, False);
end;
function TDriveView.TryFindNodeToPath(Path: string): TTreeNode;
function TDriveViewInt.TryFindNodeToPath(Path: string): TTreeNode;
begin
Result := DoFindNodeToPath(Path, True);
end;
function TDriveView.GetSubDir(var SRec: TSearchRec): Boolean;
function TDriveViewInt.GetSubDir(var SRec: TSearchRec): Boolean;
begin
Result := True;
while Result and
@@ -1897,7 +1890,7 @@ begin
end;
end;
function TDriveView.FindFirstSubDir(Path: string; var SRec: TSearchRec): Boolean;
function TDriveViewInt.FindFirstSubDir(Path: string; var SRec: TSearchRec): Boolean;
begin
Result := (FindFirstEx(ApiPath(Path), DirAttrMask, SRec, FIND_FIRST_EX_LARGE_FETCH_PAS, FindExSearchLimitToDirectories) = 0);
if Result then
@@ -1907,12 +1900,12 @@ begin
end;
end;
function TDriveView.FindNextSubDir(var SRec: TSearchRec): Boolean;
function TDriveViewInt.FindNextSubDir(var SRec: TSearchRec): Boolean;
begin
Result := (FindNext(SRec) = 0) and GetSubDir(SRec);
end;
function TDriveView.ReadSubDirsBatch(Node: TTreeNode; var SRec: TSearchRec; CheckInterval, Limit: Integer): Boolean;
function TDriveViewInt.ReadSubDirsBatch(Node: TTreeNode; var SRec: TSearchRec; CheckInterval, Limit: Integer): Boolean;
var
Start: TDateTime;
Cont: Boolean;
@@ -1953,7 +1946,7 @@ begin
FindClose(Srec);
end;
procedure TDriveView.DelayedNodeTimer(Sender: TObject);
procedure TDriveViewInt.DelayedNodeTimer(Sender: TObject);
var
Node: TTreeNode;
NodeData: TNodeData;
@@ -1987,12 +1980,12 @@ begin
UpdateDelayedNodeTimer;
end;
procedure TDriveView.UpdateDelayedNodeTimer;
procedure TDriveViewInt.UpdateDelayedNodeTimer;
begin
FDelayedNodeTimer.Enabled := HandleAllocated and (FDelayedNodes.Count > 0);
end;
procedure TDriveView.ReadSubDirs(Node: TTreeNode);
procedure TDriveViewInt.ReadSubDirs(Node: TTreeNode);
var
SRec: TSearchRec;
NodeData: TNodeData;
@@ -2032,7 +2025,7 @@ begin
Application.ProcessMessages;
end;
procedure TDriveView.CancelDelayedNode(Node: TTreeNode);
procedure TDriveViewInt.CancelDelayedNode(Node: TTreeNode);
var
NodeData: TNodeData;
begin
@@ -2041,7 +2034,7 @@ begin
FreeAndNil(NodeData.DelayedExclude);
end;
procedure TDriveView.DeleteNode(Node: TTreeNode);
procedure TDriveViewInt.DeleteNode(Node: TTreeNode);
var
ValidNode: TTreeNode;
begin
@@ -2060,7 +2053,7 @@ begin
Node.Delete;
end;
function TDriveView.CallBackValidateDir(var Node: TTreeNode; Data: Pointer): Boolean;
function TDriveViewInt.CallBackValidateDir(var Node: TTreeNode; Data: Pointer): Boolean;
var
WorkNode: TTreeNode;
DelNode: TTreeNode;
@@ -2168,7 +2161,7 @@ begin
end;
end;
procedure TDriveView.RebuildTree;
procedure TDriveViewInt.RebuildTree;
var
Drive: string;
begin
@@ -2180,7 +2173,7 @@ begin
end;
end;
procedure TDriveView.ValidateCurrentDirectoryIfNotMonitoring;
procedure TDriveViewInt.ValidateCurrentDirectoryIfNotMonitoring;
begin
if Assigned(Selected) and
not Assigned(GetDriveStatus(GetDriveToNode(Selected)).DiscMonitor) then
@@ -2189,7 +2182,7 @@ begin
end;
end;
procedure TDriveView.ValidateDirectoryEx(Node: TTreeNode; Recurse: TRecursiveScan;
procedure TDriveViewInt.ValidateDirectoryEx(Node: TTreeNode; Recurse: TRecursiveScan;
NewDirs: Boolean);
var
Info: PScanDirInfo;
@@ -2260,14 +2253,14 @@ begin
end;
end;
function TDriveView.GetDriveTypeToNode(Node: TTreeNode): Integer;
function TDriveViewInt.GetDriveTypeToNode(Node: TTreeNode): Integer;
begin
Assert(Assigned(Node));
Result := DriveInfo.Get(GetDriveToNode(Node)).DriveType;
end;
procedure TDriveView.CreateWatchThread(Drive: string);
procedure TDriveViewInt.CreateWatchThread(Drive: string);
begin
if csDesigning in ComponentState then
Exit;
@@ -2289,7 +2282,7 @@ begin
end;
end;
procedure TDriveView.SetWatchDirectory(Value: Boolean);
procedure TDriveViewInt.SetWatchDirectory(Value: Boolean);
begin
if FWatchDirectory <> Value then
begin
@@ -2301,7 +2294,7 @@ begin
end;
end;
procedure TDriveView.SetDirView(Value: TDirView);
procedure TDriveViewInt.SetDirView(Value: TDirViewInt);
begin
if Assigned(FDirView) then
FDirView.DriveView := nil;
@@ -2312,7 +2305,7 @@ begin
FDirView.DriveView := Self;
end;
function TDriveView.NodeWatched(Node: TTreeNode): Boolean;
function TDriveViewInt.NodeWatched(Node: TTreeNode): Boolean;
var
Drive: string;
begin
@@ -2320,7 +2313,7 @@ begin
Result := WatchThreadActive(Drive);
end;
procedure TDriveView.ChangeInvalid(Sender: TObject; const Directory: string;
procedure TDriveViewInt.ChangeInvalid(Sender: TObject; const Directory: string;
const ErrorStr: string);
var
Drive: string;
@@ -2329,7 +2322,7 @@ begin
GetDriveStatus(Drive).DiscMonitor.Close;
end;
procedure TDriveView.ChangeDetected(Sender: TObject; const Directory: string;
procedure TDriveViewInt.ChangeDetected(Sender: TObject; const Directory: string;
var SubdirsChanged: Boolean);
var
DirChanged: string;
@@ -2347,7 +2340,7 @@ begin
end;
end;
procedure TDriveView.ChangeTimerOnTimer(Sender: TObject);
procedure TDriveViewInt.ChangeTimerOnTimer(Sender: TObject);
var
DriveStatusPair: TDriveStatusPair;
begin
@@ -2379,14 +2372,14 @@ begin
end;
end;
procedure TDriveView.SubscribeDriveNotifications(Drive: string);
procedure TDriveViewInt.SubscribeDriveNotifications(Drive: string);
begin
// As previously, subscribe drive notification only once the drive is at least once visited.
// Shouldn't do much harm to subscribe always, but just in case.
DriveInfo.SubscribeDriveNotifications(Drive);
end;
procedure TDriveView.StartWatchThread;
procedure TDriveViewInt.StartWatchThread;
var
Drive: string;
begin
@@ -2404,7 +2397,7 @@ begin
SubscribeDriveNotifications(Drive);
end;
procedure TDriveView.StopWatchThread;
procedure TDriveViewInt.StopWatchThread;
var
Drive: string;
begin
@@ -2417,18 +2410,18 @@ begin
end;
end;
procedure TDriveView.SuspendChangeTimer;
procedure TDriveViewInt.SuspendChangeTimer;
begin
Inc(FChangeTimerSuspended);
end;
procedure TDriveView.ResumeChangeTimer;
procedure TDriveViewInt.ResumeChangeTimer;
begin
Assert(FChangeTimerSuspended > 0);
Dec(FChangeTimerSuspended);
end;
procedure TDriveView.TerminateWatchThread(Drive: string);
procedure TDriveViewInt.TerminateWatchThread(Drive: string);
begin
var DriveStatus := GetDriveStatus(Drive);
if Assigned(DriveStatus.DiscMonitor) then
@@ -2438,7 +2431,7 @@ begin
end;
end;
procedure TDriveView.StartAllWatchThreads;
procedure TDriveViewInt.StartAllWatchThreads;
var
DriveStatusPair: TDriveStatusPair;
Drive: string;
@@ -2471,7 +2464,7 @@ begin
end;
end;
procedure TDriveView.StopAllWatchThreads;
procedure TDriveViewInt.StopAllWatchThreads;
var
DriveStatusPair: TDriveStatusPair;
begin
@@ -2488,7 +2481,7 @@ begin
end;
end;
function TDriveView.WatchThreadActive(Drive: string): Boolean;
function TDriveViewInt.WatchThreadActive(Drive: string): Boolean;
begin
Result := FWatchDirectory and
Assigned(GetDriveStatus(Drive).DiscMonitor) and
@@ -2496,7 +2489,7 @@ begin
GetDriveStatus(Drive).DiscMonitor.Enabled;
end;
function TDriveView.WatchThreadActive: Boolean;
function TDriveViewInt.WatchThreadActive: Boolean;
var
Drive: string;
begin
@@ -2511,7 +2504,7 @@ begin
Result := WatchThreadActive(Drive);
end;
function TDriveView.FindPathNode(Path: string): TTreeNode;
function TDriveViewInt.FindPathNode(Path: string): TTreeNode;
var
PossiblyHiddenPath: string;
Attrs: Integer;
@@ -2548,7 +2541,7 @@ begin
until Assigned(Result) or (Length(Path) < 3);
end;
procedure TDriveView.SetDirectory(Value: string);
procedure TDriveViewInt.SetDirectory(Value: string);
begin
Value := IncludeTrailingBackslash(Value);
FDirectory := Value;
@@ -2562,7 +2555,7 @@ begin
end;
end;
function TDriveView.GetDirName(Node: TTreeNode): string;
function TDriveViewInt.GetDirName(Node: TTreeNode): string;
begin
if Assigned(Node) and Assigned(Node.Data) then
Result := TNodeData(Node.Data).DirName
@@ -2571,7 +2564,7 @@ begin
end;
// GetDrive: returns the drive of the Node.
function TDriveView.GetDriveToNode(Node: TTreeNode): string;
function TDriveViewInt.GetDriveToNode(Node: TTreeNode): string;
var
Path: string;
begin
@@ -2582,7 +2575,7 @@ begin
end;
// RootNode: returns the rootnode to the Node:
function TDriveView.RootNode(Node: TTreeNode): TTreeNode;
function TDriveViewInt.RootNode(Node: TTreeNode): TTreeNode;
begin
Result := Node;
if not Assigned(Node) then
@@ -2591,7 +2584,7 @@ begin
Result := Result.Parent;
end;
function TDriveView.GetDisplayName(Node: TTreeNode): string;
function TDriveViewInt.GetDisplayName(Node: TTreeNode): string;
begin
Result := '';
if (not Assigned(Node)) or (not Assigned(Node.Data)) then
@@ -2604,7 +2597,7 @@ begin
end;
end;
procedure TDriveView.DisplayContextMenu(Node: TTreeNode; Point: TPoint);
procedure TDriveViewInt.DisplayContextMenu(Node: TTreeNode; Point: TPoint);
var
Verb: string;
DirWatched: Boolean;
@@ -2646,13 +2639,13 @@ begin
ValidateDirectory(Node);
end;
procedure TDriveView.DisplayPropertiesMenu(Node: TTreeNode);
procedure TDriveViewInt.DisplayPropertiesMenu(Node: TTreeNode);
begin
Assert(Assigned(Node));
ShellExecuteContextCommand(FParentForm.Handle, shcProperties, NodePathName(Node));
end;
procedure TDriveView.SetSelected(Node: TTreeNode);
procedure TDriveViewInt.SetSelected(Node: TTreeNode);
begin
if Node <> Selected then
begin
@@ -2665,13 +2658,13 @@ begin
end;
// Called by TFileDeleteThread, when a file deletion was detected by the D&D receiving application:
procedure TDriveView.SignalDirDelete(Sender: TObject; Files: TStringList);
procedure TDriveViewInt.SignalDirDelete(Sender: TObject; Files: TStringList);
begin
if Files.Count > 0 then
ValidateDirectory(FindNodeToPath(Files[0]));
end;
function TDriveView.DDSourceEffects: TDropEffectSet;
function TDriveViewInt.DDSourceEffects: TDropEffectSet;
begin
if not Assigned(FDragNode.Parent) then
Result := [deLink]
@@ -2679,7 +2672,7 @@ begin
Result := [deLink, deCopy, deMove];
end;
procedure TDriveView.DDChooseEffect(KeyState: Integer; var Effect: Integer; PreferredEffect: Integer);
procedure TDriveViewInt.DDChooseEffect(KeyState: Integer; var Effect: Integer; PreferredEffect: Integer);
begin
if DropTarget = nil then Effect := DROPEFFECT_NONE
else
@@ -2704,12 +2697,12 @@ begin
inherited;
end;
function TDriveView.DragCompleteFileList: Boolean;
function TDriveViewInt.DragCompleteFileList: Boolean;
begin
Result := (GetDriveTypeToNode(FDragNode) <> DRIVE_REMOVABLE);
end;
function TDriveView.DDExecute: TDragResult;
function TDriveViewInt.DDExecute: TDragResult;
var
WatchThreadOK: Boolean;
DragParentPath: string;
@@ -2740,7 +2733,7 @@ begin
end;
end;
procedure TDriveView.PerformDragDropFileOperation(Node: TTreeNode; Effect: Integer);
procedure TDriveViewInt.PerformDragDropFileOperation(Node: TTreeNode; Effect: Integer);
var
Index: Integer;
SourcePath: string;
@@ -2769,10 +2762,10 @@ begin
FDirView.StopWatchThread;
if Assigned(DropSourceControl) and
(DropSourceControl is TDirView) and
(DropSourceControl is TDirViewInt) and
(DropSourceControl <> FDirView) then
begin
TDirView(DropSourceControl).StopWatchThread;
TDirViewInt(DropSourceControl).StopWatchThread;
end;
if DropFiles(
@@ -2784,7 +2777,7 @@ begin
end;
ClearDragFileList(FDragDropFilesEx.FileList);
// TDirView.PerformDragDropFileOperation validates the SourcePath and that actually seems correct
// TDirViewInt.PerformDragDropFileOperation validates the SourcePath and that actually seems correct
SourceParentPath := ExtractFilePath(ExcludeTrailingBackslash(SourcePath));
end
else
@@ -2806,7 +2799,7 @@ begin
// Update source directory, if move-operation was performed:
if ((Effect = DROPEFFECT_MOVE) or IsRecycleBin) then
begin
// See comment in corresponding operation in TDirView.PerformDragDropFileOperation
// See comment in corresponding operation in TDirViewInt.PerformDragDropFileOperation
SourceNode := TryFindNodeToPath(SourceParentPath);
if Assigned(SourceNode) then
ValidateDirectory(SourceNode);
@@ -2822,7 +2815,7 @@ begin
if Effect = DROPEFFECT_MOVE then
Items.EndUpdate;
// Update linked component TDirView:
// Update linked component TDirViewInt:
if Assigned(FDirView) and (not FDirView.WatchThreadActive) then
begin
case Effect of
@@ -2840,10 +2833,10 @@ begin
end;
end;
// Update the DropSource control, if files are moved and it is a TDirView:
if (Effect = DROPEFFECT_MOVE) and (DropSourceControl is TDirView) then
// Update the DropSource control, if files are moved and it is a TDirViewInt:
if (Effect = DROPEFFECT_MOVE) and (DropSourceControl is TDirViewInt) then
begin
TDirView(DropSourceControl).ValidateSelectedFiles;
TDirViewInt(DropSourceControl).ValidateSelectedFiles;
end;
finally
@@ -2853,15 +2846,15 @@ begin
if Assigned(FDirView) and (not FDirView.WatchThreadActive) then
FDirView.StartWatchThread;
if Assigned(DropSourceControl) and (DropSourceControl is TDirView) and
(not TDirView(DropSourceControl).WatchThreadActive) then
TDirView(DropSourceControl).StartWatchThread;
if Assigned(DropSourceControl) and (DropSourceControl is TDirViewInt) and
(not TDirViewInt(DropSourceControl).WatchThreadActive) then
TDirViewInt(DropSourceControl).StartWatchThread;
Screen.Cursor := SaveCursor;
end;
end;
// Clipboard operations:
procedure TDriveView.ClearCutState;
procedure TDriveViewInt.ClearCutState;
begin
if FLastPathCut <> '' then
begin
@@ -2879,7 +2872,7 @@ begin
end;
end;
procedure TDriveView.EmptyClipboard;
procedure TDriveViewInt.EmptyClipboard;
begin
if Windows.OpenClipBoard(0) then
begin
@@ -2889,16 +2882,16 @@ begin
end;
end;
procedure TDriveView.EmptyClipboardIfCut;
procedure TDriveViewInt.EmptyClipboardIfCut;
begin
// interface for TDirView - prevent recursion
// interface for TDirViewInt - prevent recursion
if FLastPathCut <> '' then
begin
EmptyClipboard;
end;
end;
function TDriveView.CanPasteFromClipBoard: Boolean;
function TDriveViewInt.CanPasteFromClipBoard: Boolean;
begin
Result := False;
if Assigned(Selected) and Windows.OpenClipboard(0) then
@@ -2908,7 +2901,7 @@ begin
end;
end;
procedure TDriveView.PasteFromClipBoard(Node: TTreeNode);
procedure TDriveViewInt.PasteFromClipBoard(Node: TTreeNode);
var
Effect: LongInt;
begin
@@ -2923,7 +2916,7 @@ begin
end;
end;
procedure TDriveView.CMSysColorChange(var Message: TMessage);
procedure TDriveViewInt.CMSysColorChange(var Message: TMessage);
begin
if not FValidateFlag then
begin
@@ -2938,7 +2931,7 @@ begin
end;
end;
procedure TDriveView.DirHasNoChildren(Path: string);
procedure TDriveViewInt.DirHasNoChildren(Path: string);
begin
var Node := FindNodeToPath(Path);
if Assigned(Node) and Assigned(Node.Data) and (not TNodeData(Node.Data).Scanned) then

View File

@@ -1,4 +1,4 @@
unit IEDriveInfo;
unit IEDriveInfoInt;
{==================================================================
@@ -34,7 +34,7 @@ uses
BaseUtils, System.Generics.Collections, Vcl.Graphics, Winapi.Messages;
const
{Flags used by TDriveInfo.ReadDriveStatus and TDriveView.RefreshRootNodes:}
{Flags used by TDriveInfoInt.ReadDriveStatus and TDriveView.RefreshRootNodes:}
dsValid = 0; {checks only whether drive is still valid}
dsImageIndex = 1; {Fetch imageindex, if not allready fetched}
dsSize = 2; {Fetch disk size and serialnumber}
@@ -81,7 +81,7 @@ type
TDriveNotification = (dnRefresh, dnRemoving);
TDriveNotificationEvent = procedure(Notification: TDriveNotification; Drive: string) of object;
TDriveInfo = class(TObject)
TDriveInfoInt = class(TObject)
private
FData: TObjectDictionary<string, TDriveInfoRec>;
FNoDrives: DWORD;
@@ -110,11 +110,13 @@ type
procedure UpdateDriveNotifications(Drive: string);
procedure UpdateDrivesNotifications;
procedure ProcessThreadResults;
constructor Create;
procedure ReadAsynchronous;
procedure DoReadDriveStatus(Drive: string; Flags: Integer);
procedure DriveRemoving(Drive: string);
protected
constructor Create;
public
function Get(Drive: string): TDriveInfoRec;
property SpecialFolder[Folder: TSpecialFolder]: PSpecialFolderRec read GetFolder;
@@ -149,9 +151,11 @@ function GetNetWorkConnected(Drive: string): Boolean;
function IsRootPath(Path: string): Boolean;
function GetThumbnail(Path: string; Size: TSize): TBitmap;
{Central drive information object instance of TDriveInfo}
{Central drive information object instance of TDriveInfoInt}
var
DriveInfo : TDriveInfo;
DriveInfo : TDriveInfoInt = nil;
procedure DriveInfoInit(ADriveInfo: TDriveInfoInt);
resourceString
ErrorInvalidDrive = '%s is a invalid drive letter.';
@@ -217,7 +221,7 @@ begin
end;
end;
constructor TDriveInfo.Create;
constructor TDriveInfoInt.Create;
begin
inherited;
@@ -227,17 +231,17 @@ begin
FData := TObjectDictionary<string, TDriveInfoRec>.Create([doOwnsValues]);
FHandlers := TList<TDriveNotificationEvent>.Create;
FChangeNotify := 0;
end; {TDriveInfo.Create}
end; {TDriveInfoInt.Create}
destructor TDriveInfo.Destroy;
destructor TDriveInfoInt.Destroy;
begin
Assert(FHandlers.Count = 0);
FHandlers.Free;
FData.Free;
inherited;
end; {TDriveInfo.Destroy}
end; {TDriveInfoInt.Destroy}
procedure TDriveInfo.NeedData;
procedure TDriveInfoInt.NeedData;
begin
if not FLoaded then
begin
@@ -248,7 +252,7 @@ begin
ProcessThreadResults;
end;
procedure TDriveInfo.ProcessThreadResults;
procedure TDriveInfoInt.ProcessThreadResults;
var
I: Integer;
Drive: Char;
@@ -269,7 +273,7 @@ begin
end;
end;
function TDriveInfo.DoAnyValidPath(DriveType: Integer; CanBeHidden: Boolean; var Path: string): Boolean;
function TDriveInfoInt.DoAnyValidPath(DriveType: Integer; CanBeHidden: Boolean; var Path: string): Boolean;
var
Drive: TRealDrive;
DriveInfoRec: TDriveInfoRec;
@@ -291,7 +295,7 @@ begin
Result := False;
end;
function TDriveInfo.AnyValidPath: string;
function TDriveInfoInt.AnyValidPath: string;
begin
if (not DoAnyValidPath(DRIVE_FIXED, False, Result)) and
(not DoAnyValidPath(DRIVE_FIXED, True, Result)) and
@@ -301,19 +305,19 @@ begin
end;
end;
function TDriveInfo.IsRealDrive(Drive: string): Boolean;
function TDriveInfoInt.IsRealDrive(Drive: string): Boolean;
begin
Result := (Length(Drive) = 1);
Assert((not Result) or ((Drive[1] >= FirstDrive) and (Drive[1] <= LastDrive)));
end;
function TDriveInfo.IsFixedDrive(Drive: string): Boolean;
function TDriveInfoInt.IsFixedDrive(Drive: string): Boolean;
begin
Result := True;
if IsRealDrive(Drive) and (Drive[1] < FirstFixedDrive) then Result := False;
end;
function TDriveInfo.GetDriveKey(Path: string): string;
function TDriveInfoInt.GetDriveKey(Path: string): string;
begin
Result := ExtractFileDrive(Path);
if (Length(Result) = 2) and (Result[2] = DriveDelim) then
@@ -331,7 +335,7 @@ begin
end;
end;
function TDriveInfo.GetDriveRoot(Drive: string): string;
function TDriveInfoInt.GetDriveRoot(Drive: string): string;
begin
if IsRealDrive(Drive) then
begin
@@ -344,7 +348,7 @@ begin
end;
end;
function TDriveInfo.GetFolder(Folder: TSpecialFolder): PSpecialFolderRec;
function TDriveInfoInt.GetFolder(Folder: TSpecialFolder): PSpecialFolderRec;
var
FileInfo: TShFileInfo;
Path: PChar;
@@ -380,7 +384,7 @@ begin
Result := @FFolders[Folder];
end;
procedure TDriveInfo.SetHonorDrivePolicy(Value: Integer);
procedure TDriveInfoInt.SetHonorDrivePolicy(Value: Integer);
var
Drive: TRealDrive;
begin
@@ -397,19 +401,19 @@ begin
end;
end;
function TDriveInfo.GetFirstFixedDrive: Char;
function TDriveInfoInt.GetFirstFixedDrive: Char;
begin
if UseABDrives then Result := FirstDrive
else Result := SystemDrive;
end;
function TDriveInfo.GetDriveBitMask(Drive: string): Integer;
function TDriveInfoInt.GetDriveBitMask(Drive: string): Integer;
begin
Assert(IsRealDrive(Drive));
Result := (1 shl (Ord(Drive[1]) - Ord('A')));
end;
procedure TDriveInfo.ReadDriveBasicStatus(Drive: string);
procedure TDriveInfoInt.ReadDriveBasicStatus(Drive: string);
var
ValidDriveType: Boolean;
InaccessibleByDrivePolicy, HiddenByDrivePolicy: Boolean;
@@ -433,7 +437,7 @@ begin
end;
end;
procedure TDriveInfo.ResetDrive(Drive: string);
procedure TDriveInfoInt.ResetDrive(Drive: string);
begin
with FData[Drive] do
begin
@@ -449,7 +453,7 @@ begin
end;
end;
function TDriveInfo.ReadDriveMask(Reg: TRegistry; ValueName: string): DWORD;
function TDriveInfoInt.ReadDriveMask(Reg: TRegistry; ValueName: string): DWORD;
var
DataInfo: TRegDataInfo;
begin
@@ -468,7 +472,7 @@ begin
end;
end;
procedure TDriveInfo.Load;
procedure TDriveInfoInt.Load;
var
Drive: TRealDrive;
Reg: TRegistry;
@@ -503,7 +507,7 @@ begin
FFolders[Folder].Valid := False;
end;
procedure TDriveInfo.ReadAsynchronous;
procedure TDriveInfoInt.ReadAsynchronous;
var
Drive: TRealDrive;
Drives: string;
@@ -523,7 +527,7 @@ begin
end;
end;
function TDriveInfo.AddDrive(Drive: string): TDriveInfoRec;
function TDriveInfoInt.AddDrive(Drive: string): TDriveInfoRec;
begin
Result := TDriveInfoRec.Create;
FData.Add(Drive, Result);
@@ -534,7 +538,7 @@ begin
ReadDriveBasicStatus(Drive);
end;
function TDriveInfo.GetImageIndex(Drive: string): Integer;
function TDriveInfoInt.GetImageIndex(Drive: string): Integer;
begin
NeedData;
@@ -546,9 +550,9 @@ begin
ReadDriveStatus(Drive, dsImageIndex);
Result := Get(Drive).ImageIndex;
end;
end; {TDriveInfo.GetImageIndex}
end; {TDriveInfoInt.GetImageIndex}
function TDriveInfo.GetDisplayName(Drive: string): string;
function TDriveInfoInt.GetDisplayName(Drive: string): string;
begin
if Get(Drive).Valid then
begin
@@ -560,9 +564,9 @@ begin
begin
Result := GetSimpleName(Drive);
end;
end; {TDriveInfo.GetDisplayname}
end; {TDriveInfoInt.GetDisplayname}
function TDriveInfo.GetPrettyName(Drive: string): string;
function TDriveInfoInt.GetPrettyName(Drive: string): string;
begin
if Get(Drive).Valid then
begin
@@ -573,15 +577,15 @@ begin
if Length(Result) = 0 then
Result := GetSimpleName(Drive);
end; {TDriveInfo.GetPrettyName}
end; {TDriveInfoInt.GetPrettyName}
function TDriveInfo.GetSimpleName(Drive: string): string;
function TDriveInfoInt.GetSimpleName(Drive: string): string;
begin
Result := Drive;
if IsRealDrive(Result) then Result := Result + ':';
end;
function TDriveInfo.Get(Drive: string): TDriveInfoRec;
function TDriveInfoInt.Get(Drive: string): TDriveInfoRec;
begin
NeedData;
@@ -594,9 +598,9 @@ begin
Result := AddDrive(Drive);
DriveRefresh;
end;
end; {TDriveInfo.GetData}
end; {TDriveInfoInt.GetData}
procedure TDriveInfo.ReadDriveStatus(Drive: string; Flags: Integer);
procedure TDriveInfoInt.ReadDriveStatus(Drive: string; Flags: Integer);
begin
// Among other, this makes sure the pending drive-ready status from the background thread are collected,
// before we overwrite it with fresh status here.
@@ -604,7 +608,7 @@ begin
DoReadDriveStatus(Drive, Flags);
end;
procedure TDriveInfo.DoReadDriveStatus(Drive: string; Flags: Integer);
procedure TDriveInfoInt.DoReadDriveStatus(Drive: string; Flags: Integer);
var
FileInfo: TShFileInfo;
DriveRoot: string;
@@ -733,9 +737,9 @@ begin
ResetDrive(Drive);
end;
end;
end; {TDriveInfo.ReadDriveStatus}
end; {TDriveInfoInt.ReadDriveStatus}
procedure TDriveInfo.OverrideDrivePolicy(Drive: string);
procedure TDriveInfoInt.OverrideDrivePolicy(Drive: string);
var
Mask: DWORD;
begin
@@ -748,7 +752,7 @@ begin
DriveRefresh;
end;
procedure TDriveInfo.AddHandler(Handler: TDriveNotificationEvent);
procedure TDriveInfoInt.AddHandler(Handler: TDriveNotificationEvent);
var
ChangeNotifyEntry: TSHChangeNotifyEntry;
Dummy: string;
@@ -775,7 +779,7 @@ begin
end;
end;
procedure TDriveInfo.RemoveHandler(Handler: TDriveNotificationEvent);
procedure TDriveInfoInt.RemoveHandler(Handler: TDriveNotificationEvent);
begin
if (FHandlers.Remove(Handler) >= 0) and (FHandlers.Count = 0) then
begin
@@ -788,7 +792,7 @@ begin
end;
end;
procedure TDriveInfo.InvokeHandlers(DriveNotification: TDriveNotification; Drive: string);
procedure TDriveInfoInt.InvokeHandlers(DriveNotification: TDriveNotification; Drive: string);
var
Handler: TDriveNotificationEvent;
begin
@@ -841,7 +845,7 @@ function SHChangeNotification_Lock(hChange: THandle; dwProcId: DWORD;
var PPidls: PPItemIDList; var plEvent: Longint): THANDLE; stdcall;
external 'shell32.dll' name 'SHChangeNotification_Lock';
procedure TDriveInfo.InternalWndProc(var Msg: TMessage);
procedure TDriveInfoInt.InternalWndProc(var Msg: TMessage);
var
DeviceType: DWORD;
UnitMask: DWORD;
@@ -935,7 +939,7 @@ begin
end;
end;
procedure TDriveInfo.DriveRemoving(Drive: string);
procedure TDriveInfoInt.DriveRemoving(Drive: string);
begin
FData[Drive].DriveReady := False;
UpdateDriveNotifications(Drive);
@@ -943,12 +947,12 @@ begin
InvokeHandlers(dnRemoving, Drive);
end;
procedure TDriveInfo.CancelDriveRefresh;
procedure TDriveInfoInt.CancelDriveRefresh;
begin
KillTimer(InternalWindowHandle, 1);
end;
procedure TDriveInfo.ScheduleDriveRefresh;
procedure TDriveInfoInt.ScheduleDriveRefresh;
begin
CancelDriveRefresh;
// Delay refreshing drives for a sec.
@@ -960,7 +964,7 @@ begin
SetTimer(InternalWindowHandle, 1, MSecsPerSec, nil);
end;
procedure TDriveInfo.UpdateDriveNotifications(Drive: string);
procedure TDriveInfoInt.UpdateDriveNotifications(Drive: string);
var
NeedNotifications: Boolean;
Path: string;
@@ -1020,7 +1024,7 @@ begin
end;
end;
procedure TDriveInfo.UpdateDrivesNotifications;
procedure TDriveInfoInt.UpdateDrivesNotifications;
var
Drive: string;
begin
@@ -1028,12 +1032,12 @@ begin
UpdateDriveNotifications(Drive);
end;
procedure TDriveInfo.DriveRefresh;
procedure TDriveInfoInt.DriveRefresh;
begin
InvokeHandlers(dnRefresh, '');
end;
procedure TDriveInfo.SubscribeDriveNotifications(Drive: string);
procedure TDriveInfoInt.SubscribeDriveNotifications(Drive: string);
begin
Get(Drive).SubscribeDriveNotifications := True;
UpdateDriveNotifications(Drive);
@@ -1196,13 +1200,17 @@ begin
end;
end;
initialization
procedure DriveInfoInit(ADriveInfo: TDriveInfoInt);
begin
InitializeCriticalSection(ThreadLock);
if not Assigned(DriveInfo) then
begin
DriveInfo := TDriveInfo.Create;
DriveInfo := ADriveInfo;
InternalWindowHandle := Classes.AllocateHWnd(DriveInfo.InternalWndProc);
end;
end;
initialization
finalization
if Assigned(DriveInfo) then

View File

@@ -43,7 +43,7 @@
<DCC_EXPLICIT_STRING_CAST_LOSS>true</DCC_EXPLICIT_STRING_CAST_LOSS>
<DCC_Namespace>Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;System;Xml;Data;Datasnap;Web;Soap;Vcl;$(DCC_Namespace)</DCC_Namespace>
<DCC_UnitSearchPath>packages\my;$(DCC_UnitSearchPath)</DCC_UnitSearchPath>
<Defines>$(Define);$(Defines)</Defines>
<Defines>UNICODE;$(Defines)</Defines>
<FinalOutputDir>$(INTERM_PATH)\$(Platform)\$(Config)</FinalOutputDir>
<ILINK_Description>Toolbar2000 Components (Jordan Russell)</ILINK_Description>
<ILINK_GenerateImportLibrary>true</ILINK_GenerateImportLibrary>

View File

@@ -43,6 +43,7 @@
<DCC_EXPLICIT_STRING_CAST_LOSS>true</DCC_EXPLICIT_STRING_CAST_LOSS>
<DCC_Namespace>Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;System;Xml;Data;Datasnap;Web;Soap;Vcl;$(DCC_Namespace)</DCC_Namespace>
<DCC_UnitSearchPath>packages\tbx;packages\tb2k;packages\my;$(DCC_UnitSearchPath)</DCC_UnitSearchPath>
<Defines>UNICODE;$(Defines)</Defines>
<FinalOutputDir>$(INTERM_PATH)\$(Platform)\$(Config)</FinalOutputDir>
<ILINK_Description>Toolbar2000 -- TBX Extensions (Alex Denisov)</ILINK_Description>
<ILINK_GenerateImportLibrary>true</ILINK_GenerateImportLibrary>

View File

@@ -12,7 +12,7 @@
#include <DragExt.h>
#include <OperationWithTimeout.hpp>
#include "FileInfo.h"
#include "DriveView.hpp"
#include "DriveView.h"
//---------------------------------------------------------------------------
TWinConfiguration * WinConfiguration = NULL;
//---------------------------------------------------------------------------

View File

@@ -8,6 +8,7 @@
#include <Glyphs.h>
#include <Custom.h>
#include <HistoryComboBox.h>
#include <IEDriveInfo.h>
#include "JclDebug.hpp"
#include "JclHookExcept.hpp"
@@ -1492,6 +1493,7 @@ void __fastcall WinInitialize()
Application->OnGetMainFormHandle = MakeMethod<TGetHandleEvent>(nullptr, AppGetMainFormHandle);
THistoryComboBox::OnLoadHistory = MakeMethod<THistoryComboHistoryEvent>(nullptr, LoadHistory);
THistoryComboBox::OnSaveHistory = MakeMethod<THistoryComboHistoryEvent>(nullptr, SaveHistory);
DriveInfoRequire();
}
//---------------------------------------------------------------------------
void __fastcall WinFinalize()