|
@@ -172,7 +172,6 @@ type
|
|
FMask: string;
|
|
FMask: string;
|
|
FNaturalOrderNumericalSorting: Boolean;
|
|
FNaturalOrderNumericalSorting: Boolean;
|
|
FAlwaysSortDirectoriesByName: Boolean;
|
|
FAlwaysSortDirectoriesByName: Boolean;
|
|
- FDarkMode: Boolean;
|
|
|
|
FScrollOnDragOver: TListViewScrollOnDragOver;
|
|
FScrollOnDragOver: TListViewScrollOnDragOver;
|
|
FStatusFileInfo: TStatusFileInfo;
|
|
FStatusFileInfo: TStatusFileInfo;
|
|
FOnBusy: TDirViewBusy;
|
|
FOnBusy: TDirViewBusy;
|
|
@@ -182,7 +181,6 @@ type
|
|
FRecreatingWnd: Integer;
|
|
FRecreatingWnd: Integer;
|
|
|
|
|
|
procedure CNNotify(var Message: TWMNotify); message CN_NOTIFY;
|
|
procedure CNNotify(var Message: TWMNotify); message CN_NOTIFY;
|
|
- procedure WMNotify(var Msg: TWMNotify); message WM_NOTIFY;
|
|
|
|
procedure WMLButtonDblClk(var Message: TWMLButtonDblClk); message WM_LBUTTONDBLCLK;
|
|
procedure WMLButtonDblClk(var Message: TWMLButtonDblClk); message WM_LBUTTONDBLCLK;
|
|
procedure WMLButtonUp(var Message: TWMLButtonUp); message WM_LBUTTONUP;
|
|
procedure WMLButtonUp(var Message: TWMLButtonUp); message WM_LBUTTONUP;
|
|
procedure WMContextMenu(var Message: TWMContextMenu); message WM_CONTEXTMENU;
|
|
procedure WMContextMenu(var Message: TWMContextMenu); message WM_CONTEXTMENU;
|
|
@@ -333,13 +331,11 @@ type
|
|
procedure SetMask(Value: string); virtual;
|
|
procedure SetMask(Value: string); virtual;
|
|
procedure SetNaturalOrderNumericalSorting(Value: Boolean);
|
|
procedure SetNaturalOrderNumericalSorting(Value: Boolean);
|
|
procedure SetAlwaysSortDirectoriesByName(Value: Boolean);
|
|
procedure SetAlwaysSortDirectoriesByName(Value: Boolean);
|
|
- procedure SetDarkMode(Value: Boolean);
|
|
|
|
procedure ScrollOnDragOverBeforeUpdate(ObjectToValidate: TObject);
|
|
procedure ScrollOnDragOverBeforeUpdate(ObjectToValidate: TObject);
|
|
procedure ScrollOnDragOverAfterUpdate;
|
|
procedure ScrollOnDragOverAfterUpdate;
|
|
procedure DoHistoryGo(Index: Integer);
|
|
procedure DoHistoryGo(Index: Integer);
|
|
procedure WMSetFocus(var Message: TWMSetFocus); message WM_SETFOCUS;
|
|
procedure WMSetFocus(var Message: TWMSetFocus); message WM_SETFOCUS;
|
|
procedure WMKillFocus(var Message: TWMKillFocus); message WM_KILLFOCUS;
|
|
procedure WMKillFocus(var Message: TWMKillFocus); message WM_KILLFOCUS;
|
|
- procedure WMThemeChanged(var Message: TMessage); message WM_THEMECHANGED;
|
|
|
|
procedure EnsureSelectionRedrawn;
|
|
procedure EnsureSelectionRedrawn;
|
|
function HiddenCount: Integer; virtual; abstract;
|
|
function HiddenCount: Integer; virtual; abstract;
|
|
function FilteredCount: Integer; virtual; abstract;
|
|
function FilteredCount: Integer; virtual; abstract;
|
|
@@ -355,7 +351,6 @@ type
|
|
function NeedImageList(Size: TImageListSize; Recreate: Boolean; var OverlayImages: TImageList): TImageList;
|
|
function NeedImageList(Size: TImageListSize; Recreate: Boolean; var OverlayImages: TImageList): TImageList;
|
|
procedure NeedImageLists(Recreate: Boolean);
|
|
procedure NeedImageLists(Recreate: Boolean);
|
|
procedure FreeImageLists;
|
|
procedure FreeImageLists;
|
|
- procedure UpdateDarkMode;
|
|
|
|
procedure DoUpdateStatusBar(Force: Boolean = False);
|
|
procedure DoUpdateStatusBar(Force: Boolean = False);
|
|
procedure DoCustomDrawItem(Item: TListItem; Stage: TCustomDrawStage);
|
|
procedure DoCustomDrawItem(Item: TListItem; Stage: TCustomDrawStage);
|
|
procedure ItemCalculatedSizeUpdated(Item: TListItem; OldSize, NewSize: Int64);
|
|
procedure ItemCalculatedSizeUpdated(Item: TListItem; OldSize, NewSize: Int64);
|
|
@@ -457,7 +452,6 @@ type
|
|
property Mask: string read FMask write SetMask;
|
|
property Mask: string read FMask write SetMask;
|
|
property NaturalOrderNumericalSorting: Boolean read FNaturalOrderNumericalSorting write SetNaturalOrderNumericalSorting;
|
|
property NaturalOrderNumericalSorting: Boolean read FNaturalOrderNumericalSorting write SetNaturalOrderNumericalSorting;
|
|
property AlwaysSortDirectoriesByName: Boolean read FAlwaysSortDirectoriesByName write SetAlwaysSortDirectoriesByName;
|
|
property AlwaysSortDirectoriesByName: Boolean read FAlwaysSortDirectoriesByName write SetAlwaysSortDirectoriesByName;
|
|
- property DarkMode: Boolean read FDarkMode write SetDarkMode;
|
|
|
|
property DirViewStyle: TDirViewStyle read GetDirViewStyle write SetDirViewStyle;
|
|
property DirViewStyle: TDirViewStyle read GetDirViewStyle write SetDirViewStyle;
|
|
|
|
|
|
property OnContextPopup;
|
|
property OnContextPopup;
|
|
@@ -571,7 +565,7 @@ const
|
|
implementation
|
|
implementation
|
|
|
|
|
|
uses
|
|
uses
|
|
- Math, DirViewColProperties, UITypes, Types, OperationWithTimeout, Winapi.UxTheme, Vcl.Themes, System.IOUtils;
|
|
|
|
|
|
+ Math, DirViewColProperties, UITypes, Types, OperationWithTimeout, System.IOUtils;
|
|
|
|
|
|
const
|
|
const
|
|
ResDirUp = 'DIRUP%2.2d';
|
|
ResDirUp = 'DIRUP%2.2d';
|
|
@@ -886,7 +880,6 @@ begin
|
|
FMask := '';
|
|
FMask := '';
|
|
FNaturalOrderNumericalSorting := True;
|
|
FNaturalOrderNumericalSorting := True;
|
|
FAlwaysSortDirectoriesByName := False;
|
|
FAlwaysSortDirectoriesByName := False;
|
|
- FDarkMode := False;
|
|
|
|
|
|
|
|
FOnHistoryChange := nil;
|
|
FOnHistoryChange := nil;
|
|
FOnPathChange := nil;
|
|
FOnPathChange := nil;
|
|
@@ -950,37 +943,6 @@ begin
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
|
|
-procedure TCustomDirView.WMNotify(var Msg: TWMNotify);
|
|
|
|
-begin
|
|
|
|
- // This all is to make header text white in dark mode.
|
|
|
|
- if Msg.NMHdr.code = NM_CUSTOMDRAW then
|
|
|
|
- begin
|
|
|
|
- if DarkMode and SupportsDarkMode and
|
|
|
|
- GetSysDarkTheme and // When system app theme is light, headers are not dark
|
|
|
|
- (FHeaderHandle <> 0) and (Msg.NMHdr^.hWndFrom = FHeaderHandle) then
|
|
|
|
- begin
|
|
|
|
- with PNMLVCustomDraw(Msg.NMHdr)^ do
|
|
|
|
- begin
|
|
|
|
- if nmcd.dwDrawStage = CDDS_PREPAINT then
|
|
|
|
- begin
|
|
|
|
- inherited;
|
|
|
|
- Msg.Result := Msg.Result or CDRF_NOTIFYITEMDRAW;
|
|
|
|
- end
|
|
|
|
- else
|
|
|
|
- if nmcd.dwDrawStage = CDDS_ITEMPREPAINT then
|
|
|
|
- begin
|
|
|
|
- SetTextColor(nmcd.hdc, ColorToRGB(Font.Color));
|
|
|
|
- Msg.Result := CDRF_DODEFAULT;
|
|
|
|
- inherited;
|
|
|
|
- end
|
|
|
|
- else inherited;
|
|
|
|
- end;
|
|
|
|
- end
|
|
|
|
- else inherited;
|
|
|
|
- end
|
|
|
|
- else inherited;
|
|
|
|
-end;
|
|
|
|
-
|
|
|
|
procedure TCustomDirView.DrawThumbnail(Item: TListItem; DC: HDC);
|
|
procedure TCustomDirView.DrawThumbnail(Item: TListItem; DC: HDC);
|
|
var
|
|
var
|
|
Rect: TRect;
|
|
Rect: TRect;
|
|
@@ -1332,31 +1294,6 @@ begin
|
|
LargeImages := nil;
|
|
LargeImages := nil;
|
|
end;
|
|
end;
|
|
|
|
|
|
-procedure TCustomDirView.WMThemeChanged(var Message: TMessage);
|
|
|
|
-begin
|
|
|
|
- if SupportsDarkMode then // To reduce impact
|
|
|
|
- begin
|
|
|
|
- UpdateDarkMode;
|
|
|
|
- RedrawWindow(Handle, nil, 0, RDW_FRAME or RDW_INVALIDATE);
|
|
|
|
- end;
|
|
|
|
-
|
|
|
|
- inherited;
|
|
|
|
-end;
|
|
|
|
-
|
|
|
|
-procedure TCustomDirView.UpdateDarkMode;
|
|
|
|
-begin
|
|
|
|
- if SupportsDarkMode then // To reduce impact
|
|
|
|
- begin
|
|
|
|
- AllowDarkModeForWindow(Self, DarkMode);
|
|
|
|
-
|
|
|
|
- if FHeaderHandle <> 0 then
|
|
|
|
- begin
|
|
|
|
- AllowDarkModeForWindow(FHeaderHandle, DarkMode);
|
|
|
|
- SendMessage(FHeaderHandle, WM_THEMECHANGED, 0, 0);
|
|
|
|
- end;
|
|
|
|
- end;
|
|
|
|
-end;
|
|
|
|
-
|
|
|
|
procedure TCustomDirView.CreateWnd;
|
|
procedure TCustomDirView.CreateWnd;
|
|
begin
|
|
begin
|
|
inherited;
|
|
inherited;
|
|
@@ -1365,19 +1302,6 @@ begin
|
|
PopupMenu.Autopopup := False;
|
|
PopupMenu.Autopopup := False;
|
|
FDragDropFilesEx.DragDropControl := Self;
|
|
FDragDropFilesEx.DragDropControl := Self;
|
|
|
|
|
|
- if SupportsDarkMode then
|
|
|
|
- begin
|
|
|
|
- // This enables dark mode - List view itself supports dark mode somewhat even in the our 'Explorer' theme.
|
|
|
|
- // The 'ItemsView' has better (Explorer-like) dark mode selection color, but on the other hand it does not have dark scrollbars.
|
|
|
|
- // win32-darkmode has ugly fix for that (FixDarkScrollBar), which we do not want to employ.
|
|
|
|
- // The 'DarkMode_Explorer' uses the standard selection color (bright blue).
|
|
|
|
-
|
|
|
|
- // Enables dark headers:
|
|
|
|
- SetWindowTheme(FHeaderHandle, 'ItemsView', nil);
|
|
|
|
-
|
|
|
|
- if DarkMode then UpdateDarkMode;
|
|
|
|
- end;
|
|
|
|
-
|
|
|
|
NeedImageLists(False);
|
|
NeedImageLists(False);
|
|
end;
|
|
end;
|
|
|
|
|
|
@@ -3587,17 +3511,6 @@ begin
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
|
|
-procedure TCustomDirView.SetDarkMode(Value: Boolean);
|
|
|
|
-begin
|
|
|
|
- if DarkMode <> Value then
|
|
|
|
- begin
|
|
|
|
- FDarkMode := Value;
|
|
|
|
- // Call only when switching to dark more and when switching back to the light mode.
|
|
|
|
- // But not for initial light mode - To reduce an impact of calling an undocumented function.
|
|
|
|
- if HandleAllocated then UpdateDarkMode;
|
|
|
|
- end;
|
|
|
|
-end;
|
|
|
|
-
|
|
|
|
// WM_SETFOCUS works even when focus is moved to another window/app,
|
|
// WM_SETFOCUS works even when focus is moved to another window/app,
|
|
// while .Enter works only when focus is moved to other control of the same window.
|
|
// while .Enter works only when focus is moved to other control of the same window.
|
|
procedure TCustomDirView.WMSetFocus(var Message: TWMSetFocus);
|
|
procedure TCustomDirView.WMSetFocus(var Message: TWMSetFocus);
|