Skip to content

Commit

Permalink
Removed meanwhile obsolete global var IsWinVistaOrAbove
Browse files Browse the repository at this point in the history
  • Loading branch information
joachimmarder committed Aug 1, 2023
1 parent f1595d8 commit 9e28d42
Showing 1 changed file with 9 additions and 19 deletions.
28 changes: 9 additions & 19 deletions Source/VirtualTrees.BaseTree.pas
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,7 @@ interface
{$ENDIF}
;

var
IsWinVistaOrAbove: Boolean;

{$MinEnumSize 1, make enumerations as small as possible}
{$MinEnumSize 1, make enumerations as small as possible}

type
{$IFDEF VT_FMX}
Expand Down Expand Up @@ -2105,7 +2102,7 @@ procedure TVirtualTreeHintWindow.Paint();
Font.Color := clInfoText;
Pen.Color := clBlack;
Brush.Color := clInfoBk;
if IsWinVistaOrAbove and StyleServices(Tree).Enabled and ((toThemeAware in Tree.TreeOptions.PaintOptions) or
if StyleServices(Tree).Enabled and ((toThemeAware in Tree.TreeOptions.PaintOptions) or
(toUseExplorerTheme in Tree.TreeOptions.PaintOptions)) then
begin
if toUseExplorerTheme in Tree.TreeOptions.PaintOptions then // ToolTip style
Expand Down Expand Up @@ -2478,8 +2475,6 @@ procedure InitializeGlobalStructures();
// This watcher is used whenever a global structure could be modified by more than one thread.
gWatcher := TCriticalSection.Create();

IsWinVistaOrAbove := (Win32MajorVersion >= 6);

// Initialize OLE subsystem for drag'n drop and clipboard operations.
NeedToUnitialize := not IsLibrary and Succeeded(OleInitialize(nil));

Expand Down Expand Up @@ -4539,7 +4534,7 @@ procedure TBaseVirtualTree.PrepareBitmaps(NeedButtons, NeedLines: Boolean);
begin
SetSize(Size.cx, Size.cy);

if IsWinVistaOrAbove and (tsUseThemes in FStates) and (toUseExplorerTheme in FOptions.PaintOptions) or VclStyleEnabled then
if (tsUseThemes in FStates) and (toUseExplorerTheme in FOptions.PaintOptions) or VclStyleEnabled then
begin
if (FHeader.MainColumn > NoColumn) then
Brush.Color := FHeader.Columns[FHeader.MainColumn].GetEffectiveColor
Expand Down Expand Up @@ -9300,7 +9295,7 @@ procedure TBaseVirtualTree.CreateWnd;
if ((StyleServices.Enabled ) and (toThemeAware in TreeOptions.PaintOptions) ) then
begin
DoStateChange([tsUseThemes]);
if (toUseExplorerTheme in FOptions.PaintOptions) and IsWinVistaOrAbove then
if (toUseExplorerTheme in FOptions.PaintOptions) then
begin
DoStateChange([tsUseExplorerTheme]);
SetWindowTheme('explorer');
Expand Down Expand Up @@ -11688,14 +11683,9 @@ procedure TBaseVirtualTree.DragAndDrop(AllowedEffects: Dword; const DataObject:
var
lDragEffect: DWord; // required for type compatibility with SHDoDragDrop
begin
if IsWinVistaOrAbove then
begin
lDragEffect := DWord(DragEffect);
SHDoDragDrop(Self.Handle, DataObject, nil, AllowedEffects, lDragEffect); // supports drag hints on Windows Vista and later
DragEffect := Integer(lDragEffect);
end
else
Winapi.ActiveX.DoDragDrop(DataObject, DragManager as IDropSource, AllowedEffects, DragEffect);
lDragEffect := DWord(DragEffect);
SHDoDragDrop(Self.Handle, DataObject, nil, AllowedEffects, lDragEffect); // supports drag hints on Windows Vista and later
DragEffect := Integer(lDragEffect);
end;

//----------------------------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -14986,7 +14976,7 @@ procedure TBaseVirtualTree.PrepareCell(var PaintInfo: TVTPaintInfo; WindowOrgX,
if (poDrawFocusRect in PaintOptions) and
(Focused or (toPopupMode in FOptions.PaintOptions)) and (FFocusedNode = Node) and
( (Column = FFocusedColumn) or
((not (toExtendedFocus in FOptions.SelectionOptions) or IsWinVistaOrAbove) and
(not (toExtendedFocus in FOptions.SelectionOptions) and
(toFullRowSelect in FOptions.SelectionOptions) and
(tsUseExplorerTheme in FStates) ) ) then
begin
Expand All @@ -15007,7 +14997,7 @@ procedure TBaseVirtualTree.PrepareCell(var PaintInfo: TVTPaintInfo; WindowOrgX,
if tsUseExplorerTheme in FStates then
InflateRect(FocusRect, -1, -1);

if (tsUseExplorerTheme in FStates) and IsWinVistaOrAbove then
if (tsUseExplorerTheme in FStates) then
begin
//Draw focused unselected style like Windows 7 Explorer
if not (vsSelected in Node.States) then
Expand Down

0 comments on commit 9e28d42

Please sign in to comment.