mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2026-03-13 09:24:25 +08:00
Merge latest changes (r258) from VirtualTree repository. Magically fixes issue #1832.
This commit is contained in:
@@ -24,6 +24,22 @@
|
||||
// (C) 1999-2001 digital publishing AG. All Rights Reserved.
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// April 2010
|
||||
// - Bug fix: Ctrl+Click on a node often cause a delayed update of the displayed selection due to a missing (or
|
||||
// misplaced) call to Invalidate() in HandleClickSelection().
|
||||
// - Bug fix: Shift+PgUp and Shift+PgDown now behave like a usual List(View) and select the node of the previous/
|
||||
// next page. The behaviourly that was formerly assigned to these shortcuts is now triggeres when using
|
||||
// Shift+Alt+PgUp / Shift+Alt+PgDown
|
||||
// March 2010
|
||||
// - Bug fix: TBaseVirtualTree.CMMouseLeave now checks if the header is assigned before working with it
|
||||
// - Bug fix: TCustomVirtualTreeOptions.SetPaintOptions will now invalidate the node cache if toChildrenAbove is
|
||||
// changed
|
||||
// - Bug fix: TBaseVirtualTree.HandleMouseUp will no longer cause an AV if HitInfo.HitNode is not assigned and
|
||||
// tsToggleFocusedSelection is set
|
||||
// - Improvement: new properties TBaseVirtualTree.OnAddToSelection and TBaseVirtualTree.OnRemoveFromSelection
|
||||
// - Bug fix: fixed a whole bunch of painting issues regarding drag & drop
|
||||
// - Bug fix: fixed TBaseVirtualTree.DragFinished to generate a button up event in case of using OLE drag & drop
|
||||
// - Bug fix: TBaseVirtualTree.DeleteChildren no longer fails if the given node is nil
|
||||
// January 2010
|
||||
// - Bug fix: Removed defaults from TVirtualTreeColumn.BiDiMode and TVirtualTreeColumn.Color
|
||||
// - Bug fix: Clearing the columns while editing no longer raises an exception
|
||||
@@ -337,7 +353,7 @@
|
||||
// Anthony Mills, Alexander Egorushkin (BCB), Mathias Torell (BCB), Frank van den Bergh, Vadim Sedulin, Peter Evans,
|
||||
// Milan Vandrovec (BCB), Steve Moss, Joe White, David Clark, Anders Thomsen, Igor Afanasyev, Eugene Programmer,
|
||||
// Corbin Dunn, Richard Pringle, Uli Gerhardt, Azza, Igor Savkic, Daniel Bauten, Timo Tegtmeier, Dmitry Zegebart,
|
||||
// Andreas Hausladen
|
||||
// Andreas Hausladen, Joachim Marder
|
||||
// Beta testers:
|
||||
// Freddy Ertl, Hans-Jürgen Schnorrenberg, Werner Lehmann, Jim Kueneman, Vadim Sedulin, Moritz Franckenstein,
|
||||
// Wim van der Vegt, Franc v/d Westelaken
|
||||
@@ -2052,6 +2068,8 @@ type
|
||||
TVTFocusChangingEvent = procedure(Sender: TBaseVirtualTree; OldNode, NewNode: PVirtualNode; OldColumn,
|
||||
NewColumn: TColumnIndex; var Allowed: Boolean) of object;
|
||||
TVTFocusChangeEvent = procedure(Sender: TBaseVirtualTree; Node: PVirtualNode; Column: TColumnIndex) of object;
|
||||
TVTAddToSelectionEvent = procedure(Sender: TBaseVirtualTree; Node: PVirtualNode) of object;
|
||||
TVTRemoveFromSelectionEvent = procedure(Sender: TBaseVirtualTree; Node: PVirtualNode) of object;
|
||||
TVTGetImageEvent = procedure(Sender: TBaseVirtualTree; Node: PVirtualNode; Kind: TVTImageKind; Column: TColumnIndex;
|
||||
var Ghosted: Boolean; var ImageIndex: Integer) of object;
|
||||
TVTGetImageExEvent = procedure(Sender: TBaseVirtualTree; Node: PVirtualNode; Kind: TVTImageKind; Column: TColumnIndex;
|
||||
@@ -2357,8 +2375,8 @@ type
|
||||
FOnGetImage: TVTGetImageEvent; // Used to retrieve the image index of a given node.
|
||||
FOnGetImageEx: TVTGetImageExEvent; // Used to retrieve the image index of a given node along with a custom
|
||||
// image list.
|
||||
FOnGetImageText: TVTGetImageTextEvent; // Used to retrieve the image alternative text of a given node.
|
||||
// Used by the accessibility interface to provide useful text for status images.
|
||||
FOnGetImageText: TVTGetImageTextEvent; // Used to retrieve the image alternative text of a given node.
|
||||
// Used by the accessibility interface to provide useful text for status images.
|
||||
FOnHotChange: TVTHotNodeChangeEvent; // called when the current "hot" node (that is, the node under the mouse)
|
||||
// changes and hot tracking is enabled
|
||||
FOnExpanding, // called just before a node is expanded
|
||||
@@ -2384,6 +2402,8 @@ type
|
||||
FOnFocusChanging: TVTFocusChangingEvent; // called when the focus is about to go to a new node and/or column
|
||||
// (can be cancelled)
|
||||
FOnFocusChanged: TVTFocusChangeEvent; // called when the focus goes to a new node and/or column
|
||||
FOnAddToSelection: TVTAddToSelectionEvent; // called when a node is added to the selection
|
||||
FOnRemoveFromSelection: TVTRemoveFromSelectionEvent; // called when a node is removed from the selection
|
||||
FOnGetPopupMenu: TVTPopupEvent; // called when the popup for a node or the header needs to be shown
|
||||
FOnGetHelpContext: TVTHelpContextEvent; // called when a node specific help theme should be called
|
||||
FOnCreateEditor: TVTCreateEditorEvent; // called when a node goes into edit mode, this allows applications
|
||||
@@ -2940,6 +2960,7 @@ type
|
||||
property TreeOptions: TCustomVirtualTreeOptions read FOptions write SetOptions;
|
||||
property WantTabs: Boolean read FWantTabs write FWantTabs default False;
|
||||
|
||||
property OnAddToSelection: TVTAddToSelectionEvent read FOnAddToSelection write FOnAddToSelection;
|
||||
property OnAdvancedHeaderDraw: TVTAdvancedHeaderPaintEvent read FOnAdvancedHeaderDraw write FOnAdvancedHeaderDraw;
|
||||
property OnAfterAutoFitColumn: TVTAfterAutoFitColumnEvent read FOnAfterAutoFitColumn write FOnAfterAutoFitColumn;
|
||||
property OnAfterAutoFitColumns: TVTAfterAutoFitColumnsEvent read FOnAfterAutoFitColumns write FOnAfterAutoFitColumns;
|
||||
@@ -3045,6 +3066,7 @@ type
|
||||
property OnNodeMoved: TVTNodeMovedEvent read FOnNodeMoved write FOnNodeMoved;
|
||||
property OnNodeMoving: TVTNodeMovingEvent read FOnNodeMoving write FOnNodeMoving;
|
||||
property OnPaintBackground: TVTBackgroundPaintEvent read FOnPaintBackground write FOnPaintBackground;
|
||||
property OnRemoveFromSelection: TVTRemoveFromSelectionEvent read FOnRemoveFromSelection write FOnRemoveFromSelection;
|
||||
property OnRenderOLEData: TVTRenderOLEDataEvent read FOnRenderOLEData write FOnRenderOLEData;
|
||||
property OnResetNode: TVTChangeEvent read FOnResetNode write FOnResetNode;
|
||||
property OnSaveNode: TVTSaveNodeEvent read FOnSaveNode write FOnSaveNode;
|
||||
@@ -3583,6 +3605,7 @@ type
|
||||
property Visible;
|
||||
property WantTabs;
|
||||
|
||||
property OnAddToSelection;
|
||||
property OnAdvancedHeaderDraw;
|
||||
property OnAfterAutoFitColumn;
|
||||
property OnAfterAutoFitColumns;
|
||||
@@ -3699,6 +3722,7 @@ type
|
||||
property OnNodeMoved;
|
||||
property OnNodeMoving;
|
||||
property OnPaintBackground;
|
||||
property OnRemoveFromSelection;
|
||||
property OnRenderOLEData;
|
||||
property OnResetNode;
|
||||
property OnResize;
|
||||
@@ -3836,6 +3860,7 @@ type
|
||||
property Visible;
|
||||
property WantTabs;
|
||||
|
||||
property OnAddToSelection;
|
||||
property OnAdvancedHeaderDraw;
|
||||
property OnAfterAutoFitColumn;
|
||||
property OnAfterAutoFitColumns;
|
||||
@@ -3948,6 +3973,7 @@ type
|
||||
property OnNodeMoved;
|
||||
property OnNodeMoving;
|
||||
property OnPaintBackground;
|
||||
property OnRemoveFromSelection;
|
||||
property OnRenderOLEData;
|
||||
property OnResetNode;
|
||||
property OnResize;
|
||||
@@ -6437,30 +6463,39 @@ begin
|
||||
RedrawWindow(Handle, nil, 0, RDW_INVALIDATE or RDW_VALIDATE or RDW_FRAME);
|
||||
end
|
||||
else
|
||||
if toShowFilteredNodes in ToBeSet + ToBeCleared then
|
||||
begin
|
||||
BeginUpdate;
|
||||
InterruptValidation;
|
||||
Run := GetFirst;
|
||||
while Assigned(Run) do
|
||||
if toShowFilteredNodes in ToBeSet + ToBeCleared then
|
||||
begin
|
||||
if (vsFiltered in Run.States) and FullyVisible[Run] then
|
||||
if toShowFilteredNodes in ToBeSet then
|
||||
BeginUpdate;
|
||||
InterruptValidation;
|
||||
Run := GetFirst;
|
||||
while Assigned(Run) do
|
||||
begin
|
||||
if (vsFiltered in Run.States) and FullyVisible[Run] then
|
||||
if toShowFilteredNodes in ToBeSet then
|
||||
begin
|
||||
Inc(FVisibleCount);
|
||||
AdjustTotalHeight(Run.Parent, Run.NodeHeight, True);
|
||||
end
|
||||
else
|
||||
begin
|
||||
AdjustTotalHeight(Run.Parent, -Run.NodeHeight, True);
|
||||
Dec(FVisibleCount);
|
||||
end;
|
||||
Run := GetNext(Run);
|
||||
end;
|
||||
EndUpdate;
|
||||
end
|
||||
else
|
||||
if toChildrenAbove in ToBeSet + ToBeCleared then
|
||||
begin
|
||||
InvalidateCache;
|
||||
if FUpdateCount = 0 then
|
||||
begin
|
||||
Inc(FVisibleCount);
|
||||
AdjustTotalHeight(Run.Parent, Run.NodeHeight, True);
|
||||
end
|
||||
else
|
||||
begin
|
||||
AdjustTotalHeight(Run.Parent, -Run.NodeHeight, True);
|
||||
Dec(FVisibleCount);
|
||||
ValidateCache;
|
||||
Invalidate;
|
||||
end;
|
||||
Run := GetNext(Run);
|
||||
end;
|
||||
EndUpdate;
|
||||
end
|
||||
else
|
||||
Invalidate;
|
||||
end else
|
||||
Invalidate;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
@@ -15166,7 +15201,6 @@ begin
|
||||
if ssShift in Shift then
|
||||
begin
|
||||
SelectNodes(FRangeAnchor, NewNode, True);
|
||||
Invalidate;
|
||||
end
|
||||
else
|
||||
begin
|
||||
@@ -15182,6 +15216,7 @@ begin
|
||||
else
|
||||
AddToSelection(NewNode);
|
||||
end;
|
||||
Invalidate;
|
||||
end
|
||||
else
|
||||
// Shift key down
|
||||
@@ -17504,9 +17539,12 @@ begin
|
||||
FCurrentHotNode := nil;
|
||||
end;
|
||||
|
||||
Header.FColumns.FDownIndex := NoColumn;
|
||||
Header.FColumns.FHoverIndex := NoColumn;
|
||||
Header.FColumns.FCheckBoxHit := False;
|
||||
if Assigned(Header) then
|
||||
begin
|
||||
Header.FColumns.FDownIndex := NoColumn;
|
||||
Header.FColumns.FHoverIndex := NoColumn;
|
||||
Header.FColumns.FCheckBoxHit := False;
|
||||
end;
|
||||
|
||||
inherited;
|
||||
end;
|
||||
@@ -18089,7 +18127,7 @@ begin
|
||||
if Shift = [ssCtrl, ssShift] then
|
||||
SetOffsetX(FOffsetX + ClientWidth)
|
||||
else
|
||||
if [ssShift] = Shift then
|
||||
if [ssShift,ssAlt] = Shift then
|
||||
begin
|
||||
if FFocusedColumn <= NoColumn then
|
||||
NewColumn := FHeader.FColumns.GetFirstVisibleColumn
|
||||
@@ -18140,7 +18178,7 @@ begin
|
||||
if Shift = [ssCtrl, ssShift] then
|
||||
SetOffsetX(FOffsetX - ClientWidth)
|
||||
else
|
||||
if [ssShift] = Shift then
|
||||
if [ssShift,ssAlt] = Shift then
|
||||
begin
|
||||
if FFocusedColumn <= NoColumn then
|
||||
NewColumn := FHeader.FColumns.GetFirstVisibleColumn
|
||||
@@ -22169,7 +22207,8 @@ begin
|
||||
begin
|
||||
FDropTargetNode := HitInfo.HitNode;
|
||||
R := GetDisplayRect(HitInfo.HitNode, FHeader.MainColumn, False);
|
||||
if hiOnItemLabel in HitInfo.HitPositions then
|
||||
if (hiOnItemLabel in HitInfo.HitPositions) or ((hiOnItem in HitInfo.HitPositions) and
|
||||
((toFullRowDrag in FOptions.FMiscOptions) or (toFullRowSelect in FOptions.FSelectionOptions)))then
|
||||
FLastDropMode := dmOnNode
|
||||
else
|
||||
if ((R.Top + R.Bottom) div 2) > Pt.Y then
|
||||
@@ -22203,7 +22242,7 @@ var
|
||||
P: TPoint;
|
||||
|
||||
begin
|
||||
if [tsVCLDragPending, tsVCLDragging, tsVCLDragFinished] * FStates = [] then
|
||||
if [tsOLEDragging, tsVCLDragPending, tsVCLDragging, tsVCLDragFinished] * FStates = [] then
|
||||
Exit;
|
||||
|
||||
DoStateChange([], [tsVCLDragPending, tsVCLDragging, tsUserDragObject, tsVCLDragFinished]);
|
||||
@@ -22260,10 +22299,10 @@ var
|
||||
HitInfo: THitInfo;
|
||||
ImageHit: Boolean;
|
||||
LabelHit: Boolean;
|
||||
ItemHit: Boolean;
|
||||
DragPos: TPoint;
|
||||
Tree: TBaseVirtualTree;
|
||||
LastNode: PVirtualNode;
|
||||
|
||||
DeltaX,
|
||||
DeltaY: Integer;
|
||||
ScrollOptions: TScrollUpdateOptions;
|
||||
@@ -22331,15 +22370,17 @@ begin
|
||||
GetHitTestInfoAt(Pt.X, Pt.Y, True, HitInfo);
|
||||
ImageHit := HitInfo.HitPositions * [hiOnNormalIcon, hiOnStateIcon] <> [];
|
||||
LabelHit := hiOnItemLabel in HitInfo.HitPositions;
|
||||
ItemHit := ((hiOnItem in HitInfo.HitPositions) and ((toFullRowDrag in FOptions.FMiscOptions) or
|
||||
(toFullRowSelect in FOptions.FSelectionOptions)));
|
||||
// In report mode only direct hits of the node captions/images in the main column are accepted as hits.
|
||||
if (toReportMode in FOptions.FMiscOptions) and not ((LabelHit or ImageHit) and
|
||||
(HitInfo.HitColumn = FHeader.MainColumn)) then
|
||||
if (toReportMode in FOptions.FMiscOptions) and not (ItemHit or ((LabelHit or ImageHit) and
|
||||
(HitInfo.HitColumn = FHeader.MainColumn))) then
|
||||
HitInfo.HitNode := nil;
|
||||
|
||||
if Assigned(HitInfo.HitNode) then
|
||||
begin
|
||||
R := GetDisplayRect(HitInfo.HitNode, NoColumn, False);
|
||||
if LabelHit or ImageHit or not (toShowDropmark in FOptions.FPaintOptions) then
|
||||
if ItemHit or LabelHit or ImageHit or not (toShowDropmark in FOptions.FPaintOptions) then
|
||||
NewDropMode := dmOnNode
|
||||
else
|
||||
if ((R.Top + R.Bottom) div 2) > Pt.Y then
|
||||
@@ -23602,7 +23643,7 @@ begin
|
||||
AddToSelection(FFocusedNode);
|
||||
end;
|
||||
|
||||
if (tsToggleFocusedSelection in FStates) and (HitInfo.HitNode = FFocusedNode) then
|
||||
if (tsToggleFocusedSelection in FStates) and (HitInfo.HitNode = FFocusedNode) and Assigned(HitInfo.HitNode) then //Prevent AV when dereferencing HitInfo.HitNode below, see bug #100
|
||||
begin
|
||||
if vsSelected in HitInfo.HitNode.States then
|
||||
RemoveFromSelection(HitInfo.HitNode)
|
||||
@@ -23854,7 +23895,11 @@ begin
|
||||
if ForceInsert then
|
||||
begin
|
||||
for I := 0 to NewLength - 1 do
|
||||
begin
|
||||
Include(NewItems[I].States, vsSelected);
|
||||
if Assigned(FOnAddToSelection) then
|
||||
FOnAddToSelection(Self, NewItems[I]);
|
||||
end;
|
||||
end
|
||||
else
|
||||
begin
|
||||
@@ -23871,7 +23916,11 @@ begin
|
||||
(SiblingConstrained and (FRangeAnchor.Parent <> NewItems[I].Parent)) then
|
||||
Inc(Cardinal(NewItems[I]))
|
||||
else
|
||||
begin
|
||||
Include(NewItems[I].States, vsSelected);
|
||||
if Assigned(FOnAddToSelection) then
|
||||
FOnAddToSelection(Self, NewItems[I]);
|
||||
end;
|
||||
end;
|
||||
|
||||
I := PackArray(NewItems, NewLength);
|
||||
@@ -23978,6 +24027,8 @@ begin
|
||||
begin
|
||||
Dec(FSelectionCount);
|
||||
Exclude(FSelection[FSelectionCount].States, vsSelected);
|
||||
if Assigned(FOnRemoveFromSelection) then
|
||||
FOnRemoveFromSelection(Self, FSelection[FSelectionCount]);
|
||||
end;
|
||||
ResetRangeAnchor;
|
||||
FSelection := nil;
|
||||
@@ -24277,6 +24328,8 @@ begin
|
||||
begin
|
||||
Exclude(Node.States, vsSelected);
|
||||
Inc(Cardinal(FSelection[Index]));
|
||||
if Assigned(FOnRemoveFromSelection) then
|
||||
FOnRemoveFromSelection(Self, Node);
|
||||
end;
|
||||
end;
|
||||
|
||||
@@ -25115,11 +25168,14 @@ begin
|
||||
(toFullRowSelect in FOptions.FSelectionOptions) then
|
||||
InnerRect := CellRect;
|
||||
if not IsRectEmpty(InnerRect) then
|
||||
if MMXAvailable and (toUseBlendedSelection in FOptions.PaintOptions) then
|
||||
AlphaBlendSelection(Brush.Color)
|
||||
if tsUseExplorerTheme in FStates then
|
||||
DrawBackground(TREIS_SELECTED)
|
||||
else
|
||||
with InnerRect do
|
||||
RoundRect(Left, Top, Right, Bottom, FSelectionCurveRadius, FSelectionCurveRadius);
|
||||
if MMXAvailable and (toUseBlendedSelection in FOptions.PaintOptions) then
|
||||
AlphaBlendSelection(Brush.Color)
|
||||
else
|
||||
with InnerRect do
|
||||
RoundRect(Left, Top, Right, Bottom, FSelectionCurveRadius, FSelectionCurveRadius);
|
||||
end
|
||||
else
|
||||
begin
|
||||
@@ -27017,7 +27073,7 @@ var
|
||||
ParentVisible: Boolean;
|
||||
|
||||
begin
|
||||
if (Node.ChildCount > 0) and not (toReadOnly in FOptions.FMiscOptions) then
|
||||
if Assigned(Node) and (Node.ChildCount > 0) and not (toReadOnly in FOptions.FMiscOptions) then
|
||||
begin
|
||||
Assert(not (tsIterating in FStates), 'Deleting nodes during tree iteration leads to invalid pointers.');
|
||||
|
||||
@@ -33563,8 +33619,10 @@ begin
|
||||
if (toHotTrack in FOptions.FPaintOptions) and (Node = FCurrentHotNode) then
|
||||
begin
|
||||
if not (tsUseExplorerTheme in FStates) then
|
||||
begin
|
||||
Canvas.Font.Style := Canvas.Font.Style + [fsUnderline];
|
||||
Canvas.Font.Color := FColors.HotColor;
|
||||
Canvas.Font.Color := FColors.HotColor;
|
||||
end;
|
||||
end;
|
||||
|
||||
// Change the font color only if the node also is drawn in selected style.
|
||||
@@ -33574,7 +33632,7 @@ begin
|
||||
begin
|
||||
if Node = FDropTargetNode then
|
||||
begin
|
||||
if (FLastDropMode = dmOnNode) or (vsSelected in Node.States) and not
|
||||
if ((FLastDropMode = dmOnNode) or (vsSelected in Node.States)) and not
|
||||
(tsUseExplorerTheme in FStates) then
|
||||
Canvas.Font.Color := clHighlightText;
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user