mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2025-08-26 11:17:57 +08:00
Update VirtualTree component to their current master state
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@ -93,7 +93,7 @@ type
|
|||||||
procedure MouseLeave; override;
|
procedure MouseLeave; override;
|
||||||
procedure PaintScroll; override;
|
procedure PaintScroll; override;
|
||||||
function PointInTreeHeader(const P: TPoint): Boolean;
|
function PointInTreeHeader(const P: TPoint): Boolean;
|
||||||
procedure UpdateScroll;
|
procedure UpdateScroll;{$if CompilerVersion >= 34}override;{$ifend}
|
||||||
public
|
public
|
||||||
constructor Create(AControl: TWinControl); override;
|
constructor Create(AControl: TWinControl); override;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
unit VirtualTrees;
|
unit VirtualTrees;
|
||||||
|
|
||||||
// The contents of this file are subject to the Mozilla Public License
|
// The contents of this file are subject to the Mozilla Public License
|
||||||
@ -72,6 +71,7 @@ interface
|
|||||||
{$HPPEMIT '#pragma comment(lib, "VirtualTreesR")'}
|
{$HPPEMIT '#pragma comment(lib, "VirtualTreesR")'}
|
||||||
{$endif}
|
{$endif}
|
||||||
{$HPPEMIT '#pragma comment(lib, "Shell32")'}
|
{$HPPEMIT '#pragma comment(lib, "Shell32")'}
|
||||||
|
{$HPPEMIT '#pragma link "VirtualTrees.Accessibility"'}
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Winapi.Windows, Winapi.oleacc, Winapi.Messages, System.SysUtils, Vcl.Graphics,
|
Winapi.Windows, Winapi.oleacc, Winapi.Messages, System.SysUtils, Vcl.Graphics,
|
||||||
@ -86,7 +86,7 @@ type
|
|||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
const
|
const
|
||||||
VTVersion = '7.3.0';
|
VTVersion = '7.4.0' deprecated 'This const is going to be removed in a future version';
|
||||||
|
|
||||||
const
|
const
|
||||||
VTTreeStreamVersion = 3;
|
VTTreeStreamVersion = 3;
|
||||||
@ -1048,6 +1048,7 @@ type
|
|||||||
function GetOwner: TVirtualTreeColumns; reintroduce;
|
function GetOwner: TVirtualTreeColumns; reintroduce;
|
||||||
procedure ReadHint(Reader: TReader);
|
procedure ReadHint(Reader: TReader);
|
||||||
procedure ReadText(Reader: TReader);
|
procedure ReadText(Reader: TReader);
|
||||||
|
procedure SetCollection(Value: TCollection); override;
|
||||||
property HasImage: Boolean read FHasImage;
|
property HasImage: Boolean read FHasImage;
|
||||||
property ImageRect: TRect read FImageRect;
|
property ImageRect: TRect read FImageRect;
|
||||||
public
|
public
|
||||||
@ -1355,7 +1356,7 @@ type
|
|||||||
function DoHeightTracking(var P: TPoint; Shift: TShiftState): Boolean; virtual;
|
function DoHeightTracking(var P: TPoint; Shift: TShiftState): Boolean; virtual;
|
||||||
function DoHeightDblClickResize(var P: TPoint; Shift: TShiftState): Boolean; virtual;
|
function DoHeightDblClickResize(var P: TPoint; Shift: TShiftState): Boolean; virtual;
|
||||||
procedure DoSetSortColumn(Value: TColumnIndex; pSortDirection: TSortDirection); virtual;
|
procedure DoSetSortColumn(Value: TColumnIndex; pSortDirection: TSortDirection); virtual;
|
||||||
procedure DragTo(P: TPoint);
|
procedure DragTo(P: TPoint); virtual;
|
||||||
procedure FixedAreaConstraintsChanged(Sender: TObject);
|
procedure FixedAreaConstraintsChanged(Sender: TObject);
|
||||||
function GetColumnsClass: TVirtualTreeColumnsClass; virtual;
|
function GetColumnsClass: TVirtualTreeColumnsClass; virtual;
|
||||||
function GetOwner: TPersistent; override;
|
function GetOwner: TPersistent; override;
|
||||||
@ -2576,7 +2577,7 @@ type
|
|||||||
procedure DoColumnClick(Column: TColumnIndex; Shift: TShiftState); virtual;
|
procedure DoColumnClick(Column: TColumnIndex; Shift: TShiftState); virtual;
|
||||||
procedure DoColumnDblClick(Column: TColumnIndex; Shift: TShiftState); virtual;
|
procedure DoColumnDblClick(Column: TColumnIndex; Shift: TShiftState); virtual;
|
||||||
procedure DoColumnResize(Column: TColumnIndex); virtual;
|
procedure DoColumnResize(Column: TColumnIndex); virtual;
|
||||||
procedure DoColumnVisibilityChanged(const Column: TColumnIndex; Visible: Boolean);
|
procedure DoColumnVisibilityChanged(const Column: TColumnIndex; Visible: Boolean); virtual;
|
||||||
function DoCompare(Node1, Node2: PVirtualNode; Column: TColumnIndex): Integer; virtual;
|
function DoCompare(Node1, Node2: PVirtualNode; Column: TColumnIndex): Integer; virtual;
|
||||||
function DoCreateDataObject: IDataObject; virtual;
|
function DoCreateDataObject: IDataObject; virtual;
|
||||||
function DoCreateDragManager: IVTDragManager; virtual;
|
function DoCreateDragManager: IVTDragManager; virtual;
|
||||||
@ -3005,7 +3006,7 @@ type
|
|||||||
procedure CopyToClipboard; virtual;
|
procedure CopyToClipboard; virtual;
|
||||||
procedure CutToClipboard; virtual;
|
procedure CutToClipboard; virtual;
|
||||||
procedure DeleteChildren(Node: PVirtualNode; ResetHasChildren: Boolean = False);
|
procedure DeleteChildren(Node: PVirtualNode; ResetHasChildren: Boolean = False);
|
||||||
procedure DeleteNode(Node: PVirtualNode); overload; inline;
|
procedure DeleteNode(Node: PVirtualNode; pReIndex: Boolean = True); overload; inline;
|
||||||
procedure DeleteNodes(const pNodes: TNodeArray);
|
procedure DeleteNodes(const pNodes: TNodeArray);
|
||||||
procedure DeleteSelectedNodes; virtual;
|
procedure DeleteSelectedNodes; virtual;
|
||||||
function Dragging: Boolean;
|
function Dragging: Boolean;
|
||||||
@ -3371,6 +3372,7 @@ type
|
|||||||
Column: TColumnIndex;
|
Column: TColumnIndex;
|
||||||
CellText: string;
|
CellText: string;
|
||||||
StaticText: string;
|
StaticText: string;
|
||||||
|
StaticTextAlignment: TAlignment;
|
||||||
ExportType: TVTExportType;
|
ExportType: TVTExportType;
|
||||||
constructor Create(pNode: PVirtualNode; pColumn: TColumnIndex; pExportType: TVTExportType = TVTExportType.etNone);
|
constructor Create(pNode: PVirtualNode; pColumn: TColumnIndex; pExportType: TVTExportType = TVTExportType.etNone);
|
||||||
end;
|
end;
|
||||||
@ -3414,7 +3416,7 @@ type
|
|||||||
FPreviouslySelected: TStringList;
|
FPreviouslySelected: TStringList;
|
||||||
procedure InitializeTextProperties(var PaintInfo: TVTPaintInfo); // [IPK] - private to protected
|
procedure InitializeTextProperties(var PaintInfo: TVTPaintInfo); // [IPK] - private to protected
|
||||||
procedure PaintNormalText(var PaintInfo: TVTPaintInfo; TextOutFlags: Integer; Text: string); virtual; // [IPK] - private to protected
|
procedure PaintNormalText(var PaintInfo: TVTPaintInfo; TextOutFlags: Integer; Text: string); virtual; // [IPK] - private to protected
|
||||||
procedure PaintStaticText(const PaintInfo: TVTPaintInfo; TextOutFlags: Integer; const Text: string); virtual; // [IPK] - private to protected
|
procedure PaintStaticText(const PaintInfo: TVTPaintInfo; pStaticTextAlignment: TAlignment; const Text: string); virtual; // [IPK] - private to protected
|
||||||
procedure AdjustPaintCellRect(var PaintInfo: TVTPaintInfo; var NextNonEmpty: TColumnIndex); override;
|
procedure AdjustPaintCellRect(var PaintInfo: TVTPaintInfo; var NextNonEmpty: TColumnIndex); override;
|
||||||
function CanExportNode(Node: PVirtualNode): Boolean;
|
function CanExportNode(Node: PVirtualNode): Boolean;
|
||||||
function CalculateStaticTextWidth(Canvas: TCanvas; Node: PVirtualNode; Column: TColumnIndex; const Text: string): Integer; virtual;
|
function CalculateStaticTextWidth(Canvas: TCanvas; Node: PVirtualNode; Column: TColumnIndex; const Text: string): Integer; virtual;
|
||||||
@ -6436,9 +6438,16 @@ begin
|
|||||||
|
|
||||||
inherited Create(Collection);
|
inherited Create(Collection);
|
||||||
|
|
||||||
FWidth := Owner.FDefaultWidth;
|
if Assigned(Owner) then begin
|
||||||
FLastWidth := Owner.FDefaultWidth;
|
FWidth := Owner.FDefaultWidth;
|
||||||
FPosition := Owner.Count - 1;
|
FLastWidth := Owner.FDefaultWidth;
|
||||||
|
FPosition := Owner.Count - 1;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TVirtualTreeColumn.SetCollection(Value: TCollection);
|
||||||
|
begin
|
||||||
|
inherited;
|
||||||
// Read parent bidi mode and color values as default values.
|
// Read parent bidi mode and color values as default values.
|
||||||
ParentBiDiModeChanged;
|
ParentBiDiModeChanged;
|
||||||
ParentColorChanged;
|
ParentColorChanged;
|
||||||
@ -8282,12 +8291,21 @@ end;
|
|||||||
//----------------------------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
procedure TVirtualTreeColumns.Notify(Item: TCollectionItem; Action: System.Classes.TCollectionNotification);
|
procedure TVirtualTreeColumns.Notify(Item: TCollectionItem; Action: System.Classes.TCollectionNotification);
|
||||||
|
var
|
||||||
|
I: Integer;
|
||||||
begin
|
begin
|
||||||
if Action in [cnExtracting, cnDeleting] then
|
if Action in [cnExtracting, cnDeleting] then
|
||||||
|
begin
|
||||||
|
// Adjust all positions larger than the deleted column's position. Fixes #959
|
||||||
|
for I := 0 to Count - 1 do begin
|
||||||
|
if Items[I].Position > TVirtualTreeColumn(Item).Position then
|
||||||
|
Items[I].Position := Items[I].Position - 1;
|
||||||
|
end;//for I
|
||||||
|
|
||||||
with Header.Treeview do
|
with Header.Treeview do
|
||||||
if not (csLoading in ComponentState) and (FFocusedColumn = Item.Index) then
|
if not (csLoading in ComponentState) and (FFocusedColumn = Item.Index) then
|
||||||
FFocusedColumn := NoColumn;
|
FFocusedColumn := NoColumn;
|
||||||
|
end;// if cnDeleting
|
||||||
end;
|
end;
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------------------------
|
||||||
@ -10320,7 +10338,7 @@ begin
|
|||||||
begin
|
begin
|
||||||
NewWidth := FTrackPoint.X - XPos;
|
NewWidth := FTrackPoint.X - XPos;
|
||||||
NextColumn := FColumns.GetPreviousVisibleColumn(FColumns.FTrackIndex);
|
NextColumn := FColumns.GetPreviousVisibleColumn(FColumns.FTrackIndex);
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
NewWidth := XPos - FTrackPoint.X;
|
NewWidth := XPos - FTrackPoint.X;
|
||||||
@ -11832,12 +11850,14 @@ begin
|
|||||||
Result := StyleServices.GetSystemColor(FColors[Index]);
|
Result := StyleServices.GetSystemColor(FColors[Index]);
|
||||||
cBorderColor:
|
cBorderColor:
|
||||||
if (seBorder in FOwner.StyleElements) then
|
if (seBorder in FOwner.StyleElements) then
|
||||||
Result := StyleServices.GetSystemColor(FColors[Index]);
|
Result := StyleServices.GetSystemColor(FColors[Index])
|
||||||
|
else
|
||||||
|
Result := FColors[Index];
|
||||||
cHotColor:
|
cHotColor:
|
||||||
if not StyleServices.GetElementColor(StyleServices.GetElementDetails(ttItemHot), ecTextColor, Result) then
|
if not StyleServices.GetElementColor(StyleServices.GetElementDetails(ttItemHot), ecTextColor, Result) then
|
||||||
Result := StyleServices.GetSystemColor(FColors[Index]);
|
Result := StyleServices.GetSystemColor(FColors[Index]);
|
||||||
cHeaderHotColor:
|
cHeaderHotColor:
|
||||||
if not StyleServices.GetElementColor(StyleServices.GetElementDetails(thHeaderItemNormal), ecTextColor, Result) then
|
if not StyleServices.GetElementColor(StyleServices.GetElementDetails(thHeaderItemHot), ecTextColor, Result) then
|
||||||
Result := StyleServices.GetSystemColor(FColors[Index]);
|
Result := StyleServices.GetSystemColor(FColors[Index]);
|
||||||
cSelectionTextColor:
|
cSelectionTextColor:
|
||||||
if not StyleServices.GetElementColor(StyleServices.GetElementDetails(ttItemSelected), ecTextColor, Result) then
|
if not StyleServices.GetElementColor(StyleServices.GetElementDetails(ttItemSelected), ecTextColor, Result) then
|
||||||
@ -20689,10 +20709,11 @@ begin
|
|||||||
begin
|
begin
|
||||||
if DeltaX <> 0 then
|
if DeltaX <> 0 then
|
||||||
begin
|
begin
|
||||||
|
UpdateHorizontalScrollBar(suoRepaintScrollBars in Options);
|
||||||
if (suoRepaintHeader in Options) and (hoVisible in FHeader.FOptions) then
|
if (suoRepaintHeader in Options) and (hoVisible in FHeader.FOptions) then
|
||||||
FHeader.Invalidate(nil);
|
FHeader.Invalidate(nil);
|
||||||
if not (tsSizing in FStates) and (FScrollBarOptions.ScrollBars in [System.UITypes.TScrollStyle.ssHorizontal, System.UITypes.TScrollStyle.ssBoth]) then
|
if not (tsSizing in FStates) and (FScrollBarOptions.ScrollBars in [System.UITypes.TScrollStyle.ssHorizontal, System.UITypes.TScrollStyle.ssBoth]) then
|
||||||
UpdateHorizontalScrollBar(suoRepaintScrollBars in Options);
|
UpdateVerticalScrollBar(suoRepaintScrollBars in Options);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if (DeltaY <> 0) and ([tsThumbTracking, tsSizing] * FStates = []) then
|
if (DeltaY <> 0) and ([tsThumbTracking, tsSizing] * FStates = []) then
|
||||||
@ -20923,7 +20944,7 @@ end;
|
|||||||
|
|
||||||
//----------------------------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
function TBaseVirtualTree.DoValidateCache: Boolean;
|
function TBaseVirtualTree.DoValidateCache(): Boolean;
|
||||||
|
|
||||||
// This method fills the cache, which is used to speed up searching for nodes.
|
// This method fills the cache, which is used to speed up searching for nodes.
|
||||||
// The strategy is simple: Take the current number of visible nodes and distribute evenly a number of marks
|
// The strategy is simple: Take the current number of visible nodes and distribute evenly a number of marks
|
||||||
@ -20980,14 +21001,14 @@ begin
|
|||||||
while not (tsStopValidation in FStates) do
|
while not (tsStopValidation in FStates) do
|
||||||
begin
|
begin
|
||||||
// If the cache is full then stop the loop.
|
// If the cache is full then stop the loop.
|
||||||
if (Integer(Index) > Length(FPositionCache)) then // ADDED: 17.09.2013 - Veit Zimmermann
|
if (Integer(Index) >= Length(FPositionCache)) then
|
||||||
Break; // ADDED: 17.09.2013 - Veit Zimmermann
|
Break;
|
||||||
if (EntryCount mod CacheThreshold) = 0 then
|
if (EntryCount mod CacheThreshold) = 0 then
|
||||||
begin
|
begin
|
||||||
// New cache entry to set up.
|
// New cache entry to set up.
|
||||||
with FPositionCache[Index] do
|
with FPositionCache[Index] do
|
||||||
begin
|
begin
|
||||||
Node := CurrentNode; // 2 EAccessViolation seen here in TreeSize V4.3.1 (Write of address 00000000)
|
Node := CurrentNode; // 2 EAccessViolation seen here in TreeSize V4.3.1, 1 in V4.4.0 (Write of address 00000000)
|
||||||
AbsoluteTop := CurrentTop;
|
AbsoluteTop := CurrentTop;
|
||||||
end;
|
end;
|
||||||
Inc(Index);
|
Inc(Index);
|
||||||
@ -21504,10 +21525,14 @@ begin
|
|||||||
begin
|
begin
|
||||||
if (SelectedCount = 0) and not SelectionLocked then
|
if (SelectedCount = 0) and not SelectionLocked then
|
||||||
begin
|
begin
|
||||||
if Assigned(FNextNodeToSelect) then
|
if not Assigned(FNextNodeToSelect) then
|
||||||
Selected[FNextNodeToSelect] := True
|
begin
|
||||||
else
|
FNextNodeToSelect := GetFirstVisible;
|
||||||
Selected[GetFirstVisible] := True;
|
// Avoid selecting a disabled node, see #954
|
||||||
|
while Assigned(FNextNodeToSelect) and IsDisabled[FNextNodeToSelect] do
|
||||||
|
FNextNodeToSelect := GetNextVisible(FNextNodeToSelect);
|
||||||
|
end;
|
||||||
|
Selected[FNextNodeToSelect] := True;
|
||||||
Self.ScrollIntoView(Self.GetFirstSelected, False);
|
Self.ScrollIntoView(Self.GetFirstSelected, False);
|
||||||
end;// if nothing selected
|
end;// if nothing selected
|
||||||
EnsureNodeFocused();
|
EnsureNodeFocused();
|
||||||
@ -22524,7 +22549,7 @@ begin
|
|||||||
NewCheckState := DetermineNextCheckState(HitInfo.HitNode.CheckType, HitInfo.HitNode.CheckState);
|
NewCheckState := DetermineNextCheckState(HitInfo.HitNode.CheckType, HitInfo.HitNode.CheckState);
|
||||||
if (ssLeft in KeysToShiftState(Message.Keys)) and DoChecking(HitInfo.HitNode, NewCheckState) then
|
if (ssLeft in KeysToShiftState(Message.Keys)) and DoChecking(HitInfo.HitNode, NewCheckState) then
|
||||||
begin
|
begin
|
||||||
if (Self.SelectedCount > 1) and (Selected[HitInfo.HitNode]) then
|
if (Self.SelectedCount > 1) and (Selected[HitInfo.HitNode]) and not (toSyncCheckboxesWithSelection in TreeOptions.SelectionOptions) then
|
||||||
SetCheckStateForAll(NewCheckState, True)
|
SetCheckStateForAll(NewCheckState, True)
|
||||||
else
|
else
|
||||||
DoCheckClick(HitInfo.HitNode, NewCheckState);
|
DoCheckClick(HitInfo.HitNode, NewCheckState);
|
||||||
@ -22830,7 +22855,7 @@ begin
|
|||||||
// Fix: Any parent check state must be propagated here.
|
// Fix: Any parent check state must be propagated here.
|
||||||
// Because the CheckType is normally set in DoInitNode
|
// Because the CheckType is normally set in DoInitNode
|
||||||
// by the App.
|
// by the App.
|
||||||
if Node.CheckType in [ctTriStateCheckBox] then
|
if (Node.CheckType = ctTriStateCheckBox) and (toAutoTristateTracking in FOptions.FAutoOptions) then
|
||||||
begin
|
begin
|
||||||
ParentCheckState := Self.GetCheckState(Node.Parent);
|
ParentCheckState := Self.GetCheckState(Node.Parent);
|
||||||
SelfCheckState := Self.GetCheckState(Node);
|
SelfCheckState := Self.GetCheckState(Node);
|
||||||
@ -22841,7 +22866,9 @@ begin
|
|||||||
and (Parent <> FRoot)
|
and (Parent <> FRoot)
|
||||||
then
|
then
|
||||||
SetCheckState(Node, Node.Parent.CheckState);
|
SetCheckState(Node, Node.Parent.CheckState);
|
||||||
end;
|
end
|
||||||
|
else if (toSyncCheckboxesWithSelection in TreeOptions.SelectionOptions) then
|
||||||
|
Node.CheckType := TCheckType.ctCheckBox;
|
||||||
|
|
||||||
if ivsDisabled in InitStates then
|
if ivsDisabled in InitStates then
|
||||||
Include(States, vsDisabled);
|
Include(States, vsDisabled);
|
||||||
@ -23117,11 +23144,11 @@ end;
|
|||||||
|
|
||||||
//----------------------------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
procedure TBaseVirtualTree.InternalClearSelection;
|
procedure TBaseVirtualTree.InternalClearSelection();
|
||||||
|
|
||||||
var
|
var
|
||||||
Count: Integer;
|
Count: Integer;
|
||||||
|
lNode: PVirtualNode;
|
||||||
begin
|
begin
|
||||||
// It is possible that there are invalid node references in the selection array
|
// It is possible that there are invalid node references in the selection array
|
||||||
// if the tree update is locked and changes in the structure were made.
|
// if the tree update is locked and changes in the structure were made.
|
||||||
@ -23139,11 +23166,12 @@ begin
|
|||||||
while FSelectionCount > 0 do
|
while FSelectionCount > 0 do
|
||||||
begin
|
begin
|
||||||
Dec(FSelectionCount);
|
Dec(FSelectionCount);
|
||||||
|
lNode := FSelection[FSelectionCount];
|
||||||
//sync path note: deselect when click on another or on outside area
|
//sync path note: deselect when click on another or on outside area
|
||||||
Exclude(FSelection[FSelectionCount].States, vsSelected);
|
Exclude(lNode.States, vsSelected);
|
||||||
if SyncCheckstateWithSelection[FSelection[FSelectionCount]] then
|
if SyncCheckstateWithSelection[lNode] then
|
||||||
checkstate[FSelection[FSelectionCount]] := csUncheckedNormal;
|
CheckState[lNode] := csUncheckedNormal;
|
||||||
DoRemoveFromSelection(FSelection[FSelectionCount]);
|
DoRemoveFromSelection(lNode);
|
||||||
end;
|
end;
|
||||||
ResetRangeAnchor;
|
ResetRangeAnchor;
|
||||||
FSelection := nil;
|
FSelection := nil;
|
||||||
@ -23399,7 +23427,7 @@ begin
|
|||||||
//sync path note: deselect when overlapping drawselection is made
|
//sync path note: deselect when overlapping drawselection is made
|
||||||
Exclude(Node.States, vsSelected);
|
Exclude(Node.States, vsSelected);
|
||||||
if SyncCheckstateWithSelection[Node] then
|
if SyncCheckstateWithSelection[Node] then
|
||||||
checkstate[Node] := csUncheckedNormal;
|
Node.CheckState := csUncheckedNormal; // Avoid using SetCheckState() as it handles toSyncCheckboxesWithSelection as well.
|
||||||
Inc(PAnsiChar(FSelection[Index]));
|
Inc(PAnsiChar(FSelection[Index]));
|
||||||
DoRemoveFromSelection(Node);
|
DoRemoveFromSelection(Node);
|
||||||
AdviseChangeEvent(False, Node, crIgnore);
|
AdviseChangeEvent(False, Node, crIgnore);
|
||||||
@ -24625,7 +24653,7 @@ begin
|
|||||||
//sync path note: deselect when a ctrl click removes a selection
|
//sync path note: deselect when a ctrl click removes a selection
|
||||||
Exclude(Node.States, vsSelected);
|
Exclude(Node.States, vsSelected);
|
||||||
if SyncCheckstateWithSelection[Node] then
|
if SyncCheckstateWithSelection[Node] then
|
||||||
checkstate[Node] := csUncheckedNormal;
|
Node.CheckState := csUncheckedNormal; // Avoid using SetCheckState() as it handles toSyncCheckboxesWithSelection as well.
|
||||||
|
|
||||||
if FindNodeInSelection(Node, Index, -1, -1) and (Index < FSelectionCount - 1) then
|
if FindNodeInSelection(Node, Index, -1, -1) and (Index < FSelectionCount - 1) then
|
||||||
Move(FSelection[Index + 1], FSelection[Index], (FSelectionCount - Index - 1) * SizeOf(Pointer));
|
Move(FSelection[Index + 1], FSelection[Index], (FSelectionCount - Index - 1) * SizeOf(Pointer));
|
||||||
@ -25305,7 +25333,7 @@ end;
|
|||||||
|
|
||||||
//----------------------------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
procedure TBaseVirtualTree.UpdateHeaderRect;
|
procedure TBaseVirtualTree.UpdateHeaderRect();
|
||||||
|
|
||||||
// Calculates the rectangle the header occupies in non-client area.
|
// Calculates the rectangle the header occupies in non-client area.
|
||||||
// These coordinates are in window rectangle.
|
// These coordinates are in window rectangle.
|
||||||
@ -25320,8 +25348,10 @@ begin
|
|||||||
FHeaderRect := Rect(0, 0, Width, Height);
|
FHeaderRect := Rect(0, 0, Width, Height);
|
||||||
|
|
||||||
// Consider borders...
|
// Consider borders...
|
||||||
Size := GetBorderDimensions;
|
if HandleAllocated then begin // Prevent preliminary creation of window handle, see issue #933
|
||||||
InflateRect(FHeaderRect, Size.cx, Size.cy);
|
Size := GetBorderDimensions();
|
||||||
|
InflateRect(FHeaderRect, Size.cx, Size.cy);
|
||||||
|
end;
|
||||||
|
|
||||||
// ... and bevels.
|
// ... and bevels.
|
||||||
OffsetX := BorderWidth;
|
OffsetX := BorderWidth;
|
||||||
@ -26519,9 +26549,9 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TBaseVirtualTree.DeleteNode(Node: PVirtualNode);
|
procedure TBaseVirtualTree.DeleteNode(Node: PVirtualNode; pReIndex: Boolean = True);
|
||||||
begin
|
begin
|
||||||
DeleteNode(Node, True, False);
|
DeleteNode(Node, pReIndex, False);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------------------------
|
||||||
@ -30855,7 +30885,7 @@ begin
|
|||||||
NodeBitmap.Free;
|
NodeBitmap.Free;
|
||||||
end;//try..finally
|
end;//try..finally
|
||||||
|
|
||||||
if (ChildCount[nil] = 0) and (FEmptyListMessage <> '') then
|
if (FEmptyListMessage <> '') and ((ChildCount[nil] = 0) or (GetFirstVisible = nil)) then
|
||||||
begin
|
begin
|
||||||
// output a message if no items are to display
|
// output a message if no items are to display
|
||||||
Canvas.Font := Self.Font;
|
Canvas.Font := Self.Font;
|
||||||
@ -30865,7 +30895,7 @@ begin
|
|||||||
R.Right := R.Left + Width - 2;
|
R.Right := R.Left + Width - 2;
|
||||||
R.Bottom := Height -2;
|
R.Bottom := Height -2;
|
||||||
TargetCanvas.Font.Color := clGrayText;
|
TargetCanvas.Font.Color := clGrayText;
|
||||||
TargetCanvas.TextRect(R, FEmptyListMessage, [tfNoClip, tfLeft, tfWordBreak]);
|
TargetCanvas.TextRect(R, FEmptyListMessage, [tfNoClip, tfLeft, tfWordBreak, tfExpandTabs]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
DoAfterPaint(TargetCanvas);
|
DoAfterPaint(TargetCanvas);
|
||||||
@ -32013,7 +32043,15 @@ var
|
|||||||
begin
|
begin
|
||||||
Window := Handle;
|
Window := Handle;
|
||||||
DC := GetDC(Handle);
|
DC := GetDC(Handle);
|
||||||
Self.Brush.Color := FColors.BackGroundColor;
|
|
||||||
|
if (toShowBackground in FOptions.FPaintOptions) and Assigned(FBackground.Graphic) then
|
||||||
|
Self.Brush.Style := bsClear
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
Self.Brush.Style := bsSolid;
|
||||||
|
Self.Brush.Color := FColors.BackGroundColor;
|
||||||
|
end;
|
||||||
|
|
||||||
Brush := Self.Brush.Handle;
|
Brush := Self.Brush.Handle;
|
||||||
|
|
||||||
if (Mode1 <> tamNoScroll) and (Mode2 <> tamNoScroll) then
|
if (Mode1 <> tamNoScroll) and (Mode2 <> tamNoScroll) then
|
||||||
@ -32947,8 +32985,8 @@ begin
|
|||||||
// check NextNode, otherwise we got AV
|
// check NextNode, otherwise we got AV
|
||||||
if NextNode <> nil then
|
if NextNode <> nil then
|
||||||
begin
|
begin
|
||||||
// Continue editing next node
|
// Continue editing next node
|
||||||
ClearSelection;
|
Tree.ClearSelection();
|
||||||
Tree.Selected[NextNode] := True;
|
Tree.Selected[NextNode] := True;
|
||||||
if Tree.CanEdit(Tree.FocusedNode, Tree.FocusedColumn) then
|
if Tree.CanEdit(Tree.FocusedNode, Tree.FocusedColumn) then
|
||||||
Tree.DoEdit;
|
Tree.DoEdit;
|
||||||
@ -33576,8 +33614,7 @@ end;
|
|||||||
|
|
||||||
//----------------------------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
procedure TCustomVirtualStringTree.PaintStaticText(const PaintInfo: TVTPaintInfo; TextOutFlags: Integer;
|
procedure TCustomVirtualStringTree.PaintStaticText(const PaintInfo: TVTPaintInfo; pStaticTextAlignment: TAlignment; const Text: string);
|
||||||
const Text: string);
|
|
||||||
|
|
||||||
// This method retrives and draws the static text bound to a particular node.
|
// This method retrives and draws the static text bound to a particular node.
|
||||||
|
|
||||||
@ -33617,12 +33654,17 @@ begin
|
|||||||
Canvas.Font.Color := FColors.DisabledColor;
|
Canvas.Font.Color := FColors.DisabledColor;
|
||||||
|
|
||||||
R := ContentRect;
|
R := ContentRect;
|
||||||
if Alignment = taRightJustify then begin
|
if pStaticTextAlignment = taRightJustify then begin
|
||||||
Dec(R.Right, NodeWidth + FTextMargin);
|
DrawFormat := DrawFormat or DT_RIGHT;
|
||||||
DrawFormat := DrawFormat or DT_RIGHT
|
Dec(R.Right, FTextMargin);
|
||||||
|
if PaintInfo.Alignment = taRightJustify then
|
||||||
|
Dec(R.Right, NodeWidth); // room for node text
|
||||||
end
|
end
|
||||||
else
|
else begin
|
||||||
Inc(R.Left, NodeWidth + FTextMargin);
|
Inc(R.Left, FTextMargin);
|
||||||
|
if PaintInfo.Alignment = taRightJustify then
|
||||||
|
Inc(R.Left, NodeWidth); // room for node text
|
||||||
|
end;
|
||||||
|
|
||||||
if Canvas.TextFlags and ETO_OPAQUE = 0 then
|
if Canvas.TextFlags and ETO_OPAQUE = 0 then
|
||||||
SetBkMode(Canvas.Handle, TRANSPARENT)
|
SetBkMode(Canvas.Handle, TRANSPARENT)
|
||||||
@ -34018,6 +34060,7 @@ begin
|
|||||||
lEventArgs := TVSTGetCellTextEventArgs.Create(PaintInfo.Node, PaintInfo.Column);
|
lEventArgs := TVSTGetCellTextEventArgs.Create(PaintInfo.Node, PaintInfo.Column);
|
||||||
|
|
||||||
lEventArgs.CellText := FDefaultText;
|
lEventArgs.CellText := FDefaultText;
|
||||||
|
lEventArgs.StaticTextAlignment := PaintInfo.Alignment;
|
||||||
DoGetText(lEventArgs);
|
DoGetText(lEventArgs);
|
||||||
|
|
||||||
// Paint the normal text first...
|
// Paint the normal text first...
|
||||||
@ -34026,7 +34069,7 @@ begin
|
|||||||
|
|
||||||
// ... and afterwards the static text if not centered and the node is not multiline enabled.
|
// ... and afterwards the static text if not centered and the node is not multiline enabled.
|
||||||
if (Alignment <> taCenter) and not (vsMultiline in PaintInfo.Node.States) and (toShowStaticText in TreeOptions.FStringOptions) and not lEventArgs.StaticText.IsEmpty then
|
if (Alignment <> taCenter) and not (vsMultiline in PaintInfo.Node.States) and (toShowStaticText in TreeOptions.FStringOptions) and not lEventArgs.StaticText.IsEmpty then
|
||||||
PaintStaticText(PaintInfo, TextOutFlags, lEventArgs.StaticText);
|
PaintStaticText(PaintInfo, lEventArgs.StaticTextAlignment, lEventArgs.StaticText);
|
||||||
finally
|
finally
|
||||||
RestoreFontChangeEvent(PaintInfo.Canvas);
|
RestoreFontChangeEvent(PaintInfo.Canvas);
|
||||||
end;
|
end;
|
||||||
|
Reference in New Issue
Block a user