* Synchronize with main VTV repository up to svn rev 461

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@3404 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
blikblum
2014-08-01 23:38:38 +00:00
parent ead4186b6e
commit c72e94c749

View File

@ -1105,6 +1105,7 @@ type
procedure GetColumnBounds(Column: TColumnIndex; out Left, Right: Integer); procedure GetColumnBounds(Column: TColumnIndex; out Left, Right: Integer);
function GetFirstVisibleColumn(ConsiderAllowFocus: Boolean = False): TColumnIndex; function GetFirstVisibleColumn(ConsiderAllowFocus: Boolean = False): TColumnIndex;
function GetLastVisibleColumn(ConsiderAllowFocus: Boolean = False): TColumnIndex; function GetLastVisibleColumn(ConsiderAllowFocus: Boolean = False): TColumnIndex;
function GetFirstColumn: TColumnIndex;
function GetNextColumn(Column: TColumnIndex): TColumnIndex; function GetNextColumn(Column: TColumnIndex): TColumnIndex;
function GetNextVisibleColumn(Column: TColumnIndex; ConsiderAllowFocus: Boolean = False): TColumnIndex; function GetNextVisibleColumn(Column: TColumnIndex; ConsiderAllowFocus: Boolean = False): TColumnIndex;
function GetPreviousColumn(Column: TColumnIndex): TColumnIndex; function GetPreviousColumn(Column: TColumnIndex): TColumnIndex;
@ -1174,7 +1175,7 @@ type
hoShowSortGlyphs, // Allow visible sort glyphs. hoShowSortGlyphs, // Allow visible sort glyphs.
hoVisible, // Header is visible. hoVisible, // Header is visible.
hoAutoSpring, // Distribute size changes of the header to all columns, which are sizable and have the hoAutoSpring, // Distribute size changes of the header to all columns, which are sizable and have the
// coAutoSpring option enabled. hoAutoResize must be enabled too. // coAutoSpring option enabled.
hoFullRepaintOnResize, // Fully invalidate the header (instead of subsequent columns only) when a column is resized. hoFullRepaintOnResize, // Fully invalidate the header (instead of subsequent columns only) when a column is resized.
hoDisableAnimatedResize, // Disable animated resize for all columns. hoDisableAnimatedResize, // Disable animated resize for all columns.
hoHeightResize, // Allow resizing header height via mouse. hoHeightResize, // Allow resizing header height via mouse.
@ -1916,104 +1917,97 @@ type
end; end;
// XE2 VCL Style // XE2+ VCL Style
// TODO: Compilerversion Ein/Ausschalten < Ist Eingeschaltet > {$ifdef VCLStyleSupport}
{$ifdef VCLStyleSupport} TVclStyleScrollBarsHook = class(TMouseTrackControlStyleHook)
TVclStyleScrollBarsHook = class(TMouseTrackControlStyleHook)strict private type strict private type
{$REGION 'TVclStyleScrollBarWindow'} {$REGION 'TVclStyleScrollBarWindow'}
TVclStyleScrollBarWindow = class(TWinControl)strict private FScrollBarWindowOwner: TVclStyleScrollBarsHook; TVclStyleScrollBarWindow = class(TWinControl)strict private FScrollBarWindowOwner: TVclStyleScrollBarsHook;
FScrollBarVertical: Boolean; FScrollBarVertical: Boolean;
FScrollBarVisible: Boolean; FScrollBarVisible: Boolean;
FScrollBarEnabled: Boolean; FScrollBarEnabled: Boolean;
procedure WMNCHitTest(var Msg: TWMNCHitTest); procedure WMNCHitTest(var Msg: TWMNCHitTest);
message WM_NCHITTEST; message WM_NCHITTEST;
procedure WMEraseBkgnd(var Msg: TMessage); procedure WMEraseBkgnd(var Msg: TMessage);
message WM_ERASEBKGND; message WM_ERASEBKGND;
procedure WMPaint(var Msg: TWMPaint); procedure WMPaint(var Msg: TWMPaint);
message WM_PAINT; message WM_PAINT;
strict protected strict protected
procedure CreateParams(var Params: TCreateParams); procedure CreateParams(var Params: TCreateParams);
override; override;
public public
constructor Create(AOwner: TComponent); constructor Create(AOwner: TComponent);
override; override;
property ScrollBarWindowOwner: TVclStyleScrollBarsHook read FScrollBarWindowOwner write FScrollBarWindowOwner; property ScrollBarWindowOwner: TVclStyleScrollBarsHook read FScrollBarWindowOwner write FScrollBarWindowOwner;
property ScrollBarVertical: Boolean read FScrollBarVertical write FScrollBarVertical; property ScrollBarVertical: Boolean read FScrollBarVertical write FScrollBarVertical;
property ScrollBarVisible: Boolean read FScrollBarVisible write FScrollBarVisible; property ScrollBarVisible: Boolean read FScrollBarVisible write FScrollBarVisible;
property ScrollBarEnabled: Boolean read FScrollBarEnabled write FScrollBarEnabled; property ScrollBarEnabled: Boolean read FScrollBarEnabled write FScrollBarEnabled;
end; end;
{$ENDREGION} {$ENDREGION}
private private
FHorzScrollBarDownButtonRect: TRect; FHorzScrollBarDownButtonRect: TRect;
FHorzScrollBarDownButtonState: TThemedScrollBar; FHorzScrollBarDownButtonState: TThemedScrollBar;
FHorzScrollBarRect: TRect; FHorzScrollBarRect: TRect;
FHorzScrollBarSliderState: TThemedScrollBar; FHorzScrollBarSliderState: TThemedScrollBar;
FHorzScrollBarSliderTrackRect: TRect; FHorzScrollBarSliderTrackRect: TRect;
FHorzScrollBarUpButtonRect: TRect; FHorzScrollBarUpButtonRect: TRect;
FHorzScrollBarUpButtonState: TThemedScrollBar; FHorzScrollBarUpButtonState: TThemedScrollBar;
FHorzScrollBarWindow: TVclStyleScrollBarWindow; FHorzScrollBarWindow: TVclStyleScrollBarWindow;
FLeftMouseButtonDown: Boolean; FLeftMouseButtonDown: Boolean;
FPrevScrollPos: Integer; FPrevScrollPos: Integer;
FScrollPos: Single; FScrollPos: Single;
FVertScrollBarDownButtonRect: TRect; FVertScrollBarDownButtonRect: TRect;
FVertScrollBarDownButtonState: TThemedScrollBar; FVertScrollBarDownButtonState: TThemedScrollBar;
FVertScrollBarRect: TRect; FVertScrollBarRect: TRect;
FVertScrollBarSliderState: TThemedScrollBar; FVertScrollBarSliderState: TThemedScrollBar;
FVertScrollBarSliderTrackRect: TRect; FVertScrollBarSliderTrackRect: TRect;
FVertScrollBarUpButtonRect: TRect; FVertScrollBarUpButtonRect: TRect;
FVertScrollBarUpButtonState: TThemedScrollBar; FVertScrollBarUpButtonState: TThemedScrollBar;
FVertScrollBarWindow: TVclStyleScrollBarWindow; FVertScrollBarWindow: TVclStyleScrollBarWindow;
procedure WMKeyDown(var Msg: TMessage); procedure WMKeyDown(var Msg: TMessage);
message WM_KEYDOWN; message WM_KEYDOWN;
procedure WMKeyUp(var Msg: TMessage); procedure WMKeyUp(var Msg: TMessage);
message WM_KEYUP; message WM_KEYUP;
procedure WMLButtonDown(var Msg: TWMMouse); procedure WMLButtonDown(var Msg: TWMMouse);
message WM_LBUTTONDOWN; message WM_LBUTTONDOWN;
procedure WMLButtonUp(var Msg: TWMMouse); procedure WMLButtonUp(var Msg: TWMMouse);
message WM_LBUTTONUP; message WM_LBUTTONUP;
procedure WMNCLButtonDown(var Msg: TWMMouse); procedure WMNCLButtonDown(var Msg: TWMMouse);
message WM_NCLBUTTONDOWN; message WM_NCLBUTTONDOWN;
procedure WMNCMouseMove(var Msg: TWMMouse); procedure WMNCMouseMove(var Msg: TWMMouse);
message WM_NCMOUSEMOVE; message WM_NCMOUSEMOVE;
procedure WMNCLButtonUp(var Msg: TWMMouse); procedure WMNCLButtonUp(var Msg: TWMMouse);
message WM_NCLBUTTONUP; message WM_NCLBUTTONUP;
procedure WMNCPaint(var Msg: TMessage); procedure WMNCPaint(var Msg: TMessage);
message WM_NCPAINT; message WM_NCPAINT;
procedure WMMouseMove(var Msg: TWMMouse); procedure WMMouseMove(var Msg: TWMMouse);
message WM_MOUSEMOVE; message WM_MOUSEMOVE;
procedure WMMouseWheel(var Msg: TMessage); procedure WMMouseWheel(var Msg: TMessage);
message WM_MOUSEWHEEL; message WM_MOUSEWHEEL;
procedure WMVScroll(var Msg: TMessage); procedure WMVScroll(var Msg: TMessage);
message WM_VSCROLL; message WM_VSCROLL;
procedure WMHScroll(var Msg: TMessage); procedure WMHScroll(var Msg: TMessage);
message WM_HSCROLL; message WM_HSCROLL;
procedure WMCaptureChanged(var Msg: TMessage); procedure WMCaptureChanged(var Msg: TMessage);
message WM_CAPTURECHANGED; message WM_CAPTURECHANGED;
procedure WMNCLButtonDblClk(var Msg: TWMMouse); procedure WMNCLButtonDblClk(var Msg: TWMMouse);
message WM_NCLBUTTONDBLCLK; message WM_NCLBUTTONDBLCLK;
procedure WMSize(var Msg: TMessage); procedure WMSize(var Msg: TMessage);
message WM_SIZE; message WM_SIZE;
protected protected
procedure CalcScrollBarsRect; procedure CalcScrollBarsRect; virtual;
virtual; procedure DrawHorzScrollBar(DC: HDC); virtual;
procedure DrawHorzScrollBar(DC: HDC); procedure DrawVertScrollBar(DC: HDC); virtual;
virtual; function GetHorzScrollBarSliderRect: TRect;
procedure DrawVertScrollBar(DC: HDC); function GetVertScrollBarSliderRect: TRect;
virtual; procedure MouseLeave; override;
function GetHorzScrollBarSliderRect: TRect; procedure PaintScrollBars; virtual;
function GetVertScrollBarSliderRect: TRect; function PointInTreeHeader(const P: TPoint): Boolean;
procedure MouseLeave; procedure UpdateScrollBarWindow;
override; public
procedure PaintScrollBars; constructor Create(AControl: TWinControl); override;
virtual; destructor Destroy; override;
function PointInTreeHeader(const P: TPoint): Boolean;
procedure UpdateScrollBarWindow;
public
constructor Create(AControl: TWinControl);
override;
destructor Destroy;
override;
end; end;
{$ifend} {$ifend}
@ -6230,7 +6224,9 @@ begin
lNullPoint := Point(0,0); lNullPoint := Point(0,0);
if Supports(DragSourceHelper, IDragSourceHelper2, lDragSourceHelper2) then if Supports(DragSourceHelper, IDragSourceHelper2, lDragSourceHelper2) then
lDragSourceHelper2.SetFlags(DSH_ALLOWDROPDESCRIPTIONTEXT);// Show description texts lDragSourceHelper2.SetFlags(DSH_ALLOWDROPDESCRIPTIONTEXT);// Show description texts
if not Succeeded(DragSourceHelper.InitializeFromWindow(0, lNullPoint, DataObject)) then begin // First let the system try to initialze the DragSourceHelper, this works fine e.g. for file system objects // First let the system try to initialze the DragSourceHelper, this works fine for file system objects (CF_HDROP)
StandardOLEFormat.cfFormat := CF_HDROP;
if not Succeeded(DataObject.QueryGetData(StandardOLEFormat)) or not Succeeded(DragSourceHelper.InitializeFromWindow(0, lNullPoint, DataObject)) then begin
// Supply the drag source helper with our drag image. // Supply the drag source helper with our drag image.
DragInfo.sizeDragImage.cx := Width; DragInfo.sizeDragImage.cx := Width;
DragInfo.sizeDragImage.cy := Height; DragInfo.sizeDragImage.cy := Height;
@ -6788,6 +6784,8 @@ begin
if Value <> FCheckBox then if Value <> FCheckBox then
begin begin
FCheckBox := Value; FCheckBox := Value;
if Value and (csDesigning in Owner.Header.Treeview.ComponentState) then
Owner.Header.Options := Owner.Header.Options + [hoShowImages];
//lcl //lcl
if FCheckBox then if FCheckBox then
Owner.Header.Treeview.CheckImageListNeeded; Owner.Header.Treeview.CheckImageListNeeded;
@ -8651,6 +8649,19 @@ end;
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
function TVirtualTreeColumns.GetFirstColumn: TColumnIndex;
// Returns the first column in display order.
begin
if Count = 0 then
Result := InvalidColumn
else
Result := FPositionToIndex[0];
end;
//----------------------------------------------------------------------------------------------------------------------
function TVirtualTreeColumns.GetNextColumn(Column: TColumnIndex): TColumnIndex; function TVirtualTreeColumns.GetNextColumn(Column: TColumnIndex): TColumnIndex;
// Returns the next column in display order. Column is the index of an item in the collection (a column). // Returns the next column in display order. Column is the index of an item in the collection (a column).
@ -8986,6 +8997,7 @@ var
DrawFormat: Cardinal; DrawFormat: Cardinal;
Pos: TRect; Pos: TRect;
DrawHot: Boolean; DrawHot: Boolean;
ImageWidth: Integer;
begin begin
ColImageInfo.Ghosted := False; ColImageInfo.Ghosted := False;
PaintInfo.Column := Items[AColumn]; PaintInfo.Column := Items[AColumn];
@ -9093,8 +9105,13 @@ var
// main glyph // main glyph
FHasImage := False; FHasImage := False;
if Assigned(Images) then
ImageWidth := Images.Width
else
ImageWidth := 0;
if not (hpeHeaderGlyph in ActualElements) and ShowHeaderGlyph and if not (hpeHeaderGlyph in ActualElements) and ShowHeaderGlyph and
(not ShowSortGlyph or (FBidiMode <> bdLeftToRight) or (GlyphPos.X + Images.Width <= SortGlyphPos.X) ) then (not ShowSortGlyph or (FBidiMode <> bdLeftToRight) or (GlyphPos.X + ImageWidth <= SortGlyphPos.X) ) then
begin begin
if not FCheckBox then if not FCheckBox then
begin begin
@ -16577,7 +16594,7 @@ begin
if (toCheckSupport in FOptions.FMiscOptions) and Assigned(FFocusedNode) and if (toCheckSupport in FOptions.FMiscOptions) and Assigned(FFocusedNode) and
(FFocusedNode.CheckType <> ctNone) then (FFocusedNode.CheckType <> ctNone) then
begin begin
if (FStates * [tsKeyCheckPending, tsMouseCheckPending] = []) and Assigned(FFocusedNode) and if (FStates * [tsKeyCheckPending, tsMouseCheckPending] = []) and
not (vsDisabled in FFocusedNode.States) then not (vsDisabled in FFocusedNode.States) then
begin begin
with FFocusedNode^ do with FFocusedNode^ do
@ -17965,6 +17982,13 @@ end;
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
{$ifdef VCLStyleSupport}
class constructor TBaseVirtualTree.Create;
begin
TCustomStyleEngine.RegisterStyleHook(TBaseVirtualTree, TVclStyleScrollBarsHook);
end;
{$ifend}
procedure TBaseVirtualTree.CreateParams(var Params: TCreateParams); procedure TBaseVirtualTree.CreateParams(var Params: TCreateParams);
const const
@ -18765,6 +18789,7 @@ begin
end; end;
{$endif} {$endif}
Canvas.Font := Self.Font; // Fixes issue #298
FOnBeforeCellPaint(Self, Canvas, Node, Column, CellPaintMode, CellRect, ContentRect); FOnBeforeCellPaint(Self, Canvas, Node, Column, CellPaintMode, CellRect, ContentRect);
{$ifdef LCLWin32} {$ifdef LCLWin32}
@ -20568,12 +20593,12 @@ begin
GetCursorPos(P); GetCursorPos(P);
P := ScreenToClient(P); P := ScreenToClient(P);
if tsRightButtonDown in FStates then if tsRightButtonDown in FStates then
Perform(LM_RBUTTONUP, 0, LPARAM(PointToSmallPoint(P))) Perform(LM_RBUTTONUP, 0, LPARAM(Cardinal(PointToSmallPoint(P))))
else else
if tsMiddleButtonDown in FStates then if tsMiddleButtonDown in FStates then
Perform(LM_MBUTTONUP, 0, LPARAM(PointToSmallPoint(P))) Perform(LM_MBUTTONUP, 0, LPARAM(Cardinal(PointToSmallPoint(P))))
else else
Perform(LM_LBUTTONUP, 0, LPARAM(PointToSmallPoint(P))); Perform(LM_LBUTTONUP, 0, LPARAM(Cardinal(PointToSmallPoint(P))));
{$ifdef DEBUG_VTV}Logger.ExitMethod([lcDrag],'DragFinished');{$endif} {$ifdef DEBUG_VTV}Logger.ExitMethod([lcDrag],'DragFinished');{$endif}
end; end;
@ -22787,7 +22812,7 @@ begin
inherited; inherited;
// TODO: Hinzugefügt - TBaseVirtualTree.Loaded // TODO: Hinzugefügt - TBaseVirtualTree.Loaded
{$ifdef VCLStyleSupport} {$ifdef VCLStyleSupport}
FSavedBorderWidth := BevelWidth; FSavedBorderWidth := BorderWidth;
FSavedBevelKind := BevelKind; FSavedBevelKind := BevelKind;
VclStyleChanged; VclStyleChanged;
{$IFEND} {$IFEND}
@ -23608,20 +23633,29 @@ var
end; end;
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
//lcl: todo
{
procedure DrawBackground(State: Integer);
begin
if (toGridExtensions in FOptions.FMiscOptions) or (toFullRowSelect in FOptions.FSelectionOptions) then
DrawThemeBackground(Theme, PaintInfo.Canvas.Handle, TVP_TREEITEM, State, RowRect, nil)
else
DrawThemeBackground(Theme, PaintInfo.Canvas.Handle, TVP_TREEITEM, State, InnerRect, nil);
end;
{$ifdef ThemeSupport}
//todo procedure DrawThemedFocusRect(State: Integer);
{ var
procedure DrawBackground(State: Integer); Theme: HTHEME;
begin begin
with PaintInfo do Theme := OpenThemeData(Application.Handle, 'Explorer::ItemsView');
if (toGridExtensions in FOptions.FMiscOptions) or (toFullRowSelect in FOptions.FSelectionOptions) then if (toGridExtensions in FOptions.FMiscOptions) or (toFullRowSelect in FOptions.FSelectionOptions) then
DrawThemeBackground(Theme, Canvas.Handle, TVP_TREEITEM, State, RowRect, @CellRect) DrawThemeBackground(Theme, PaintInfo.Canvas.Handle, LVP_LISTDETAIL, State, RowRect, nil)
else else
DrawThemeBackground(Theme, Canvas.Handle, TVP_TREEITEM, State, InnerRect, nil); DrawThemeBackground(Theme, PaintInfo.Canvas.Handle, LVP_LISTDETAIL, State, InnerRect, nil);
end; CloseThemeData(Theme);
} end;
{$endif ThemeSupport} }
//--------------- end local functions --------------------------------------- //--------------- end local functions ---------------------------------------
@ -23769,16 +23803,10 @@ begin
// draw focus rect // draw focus rect
if (poDrawFocusRect in PaintOptions) and if (poDrawFocusRect in PaintOptions) and
(Focused or (toPopupMode in FOptions.FPaintOptions)) and (FFocusedNode = Node) and (Focused or (toPopupMode in FOptions.FPaintOptions)) and (FFocusedNode = Node) and
( (Column = FFocusedColumn) ( (Column = FFocusedColumn) or
{$ifdef ThemeSupport} ((not (toExtendedFocus in FOptions.FSelectionOptions) or IsWinVistaOrAbove) and
//todo
{ or
(not (toExtendedFocus in FOptions.FSelectionOptions) and
(toFullRowSelect in FOptions.FSelectionOptions) and (toFullRowSelect in FOptions.FSelectionOptions) and
(Theme <> 0) ) (tsUseExplorerTheme in FStates) ) ) then
}
{$endif ThemeSupport}
) then
begin begin
TextColorBackup := GetTextColor(Handle); TextColorBackup := GetTextColor(Handle);
SetTextColor(Handle, $FFFFFF); SetTextColor(Handle, $FFFFFF);
@ -23807,7 +23835,18 @@ begin
} }
{$endif ThemeSupport} {$endif ThemeSupport}
LCLIntf.DrawFocusRect(Handle, FocusRect); if (tsUseExplorerTheme in FStates) and IsWinVistaOrAbove then begin
//Draw focused unselected style like Windows 7 Explorer
//lcl: todo
{
if not (vsSelected in Node.States) then
DrawThemedFocusRect(LIS_NORMAL)
else
DrawBackground(TREIS_HOTSELECTED);
}
end
else
LCLIntf.DrawFocusRect(Handle, FocusRect);
SetTextColor(Handle, TextColorBackup); SetTextColor(Handle, TextColorBackup);
SetBkColor(Handle, BackColorBackup); SetBkColor(Handle, BackColorBackup);
end; end;
@ -24699,7 +24738,7 @@ end;
procedure TBaseVirtualTree.ValidateNodeDataSize(var Size: Integer); procedure TBaseVirtualTree.ValidateNodeDataSize(var Size: Integer);
begin begin
Size := 0; Size := sizeof(Pointer);
if Assigned(FOnGetNodeDataSize) then if Assigned(FOnGetNodeDataSize) then
FOnGetNodeDataSize(Self, Size); FOnGetNodeDataSize(Self, Size);
end; end;
@ -24907,7 +24946,7 @@ function TBaseVirtualTree.AddChild(Parent: PVirtualNode; UserData: Pointer = nil
// Adds a new node to the given parent node. This is simply done by increasing the child count of the // Adds a new node to the given parent node. This is simply done by increasing the child count of the
// parent node. If Parent is nil then the new node is added as (last) top level node. // parent node. If Parent is nil then the new node is added as (last) top level node.
// UserData can be used to set the first 4 bytes of the user data area to an initial value which can be used // UserData can be used to set the first sizeof(Pointer) bytes of the user data area to an initial value which can be used
// in OnInitNode and will also cause to trigger the OnFreeNode event (if <> nil) even if the node is not yet // in OnInitNode and will also cause to trigger the OnFreeNode event (if <> nil) even if the node is not yet
// "officially" initialized. // "officially" initialized.
// AddChild is a compatibility method and will implicitly validate the parent node. This is however // AddChild is a compatibility method and will implicitly validate the parent node. This is however
@ -28680,7 +28719,7 @@ end;
function TBaseVirtualTree.InsertNode(Node: PVirtualNode; Mode: TVTNodeAttachMode; UserData: Pointer = nil): PVirtualNode; function TBaseVirtualTree.InsertNode(Node: PVirtualNode; Mode: TVTNodeAttachMode; UserData: Pointer = nil): PVirtualNode;
// Adds a new node relative to Node. The final position is determined by Mode. // Adds a new node relative to Node. The final position is determined by Mode.
// UserData can be used to set the first 4 bytes of the user data area to an initial value which can be used // UserData can be used to set the first sizeof(Pointer) bytes of the user data area to an initial value which can be used
// in OnInitNode and will also cause to trigger the OnFreeNode event (if <> nil) even if the node is not yet // in OnInitNode and will also cause to trigger the OnFreeNode event (if <> nil) even if the node is not yet
// "officially" initialized. // "officially" initialized.
// InsertNode is a compatibility method and will implicitly validate the given node if the new node // InsertNode is a compatibility method and will implicitly validate the given node if the new node
@ -28716,7 +28755,7 @@ begin
// Check if there is initial user data and there is also enough user data space allocated. // Check if there is initial user data and there is also enough user data space allocated.
if Assigned(UserData) then if Assigned(UserData) then
if FNodeDataSize >= 4 then if FNodeDataSize >= sizeof(Pointer) then
begin begin
NodeData := Pointer(PByte(@Result.Data) + FTotalInternalDataSize); NodeData := Pointer(PByte(@Result.Data) + FTotalInternalDataSize);
NodeData^ := UserData; NodeData^ := UserData;
@ -29870,18 +29909,11 @@ begin
NodeBitmap.Width := TargetRect.Right - TargetRect.Left; NodeBitmap.Width := TargetRect.Right - TargetRect.Left;
NodeBitmap.Height := TargetRect.Bottom - TargetRect.Top; NodeBitmap.Height := TargetRect.Bottom - TargetRect.Top;
end; end;
// Make sure the buffer bitmap and target bitmap use the same transformation mode.
{$ifndef Gtk}
// Call back application/descendants whether they want to erase this area.
{$ifdef UseSetCanvasOrigin}
SetCanvasOrigin(PaintInfo.Canvas, Target.X, 0);
{$else}
SetWindowOrgEx(PaintInfo.Canvas.Handle, Target.X, 0, nil);
{$endif}
{$endif}
{$ifdef DEBUG_VTV}Logger.Send([lcPaintDetails],'NodeBitmap.Handle after changing height to background',NodeBitmap.Handle);{$endif} {$ifdef DEBUG_VTV}Logger.Send([lcPaintDetails],'NodeBitmap.Handle after changing height to background',NodeBitmap.Handle);{$endif}
{$ifdef DEBUG_VTV}Logger.Send([lcPaintDetails],'TargetRect',TargetRect);{$endif} {$ifdef DEBUG_VTV}Logger.Send([lcPaintDetails],'TargetRect',TargetRect);{$endif}
{$ifdef DEBUG_VTV}Logger.Send([lcPaintDetails],'NodeBitmap Width: %d Height: %d',[NodeBitmap.Width,NodeBitmap.Height]);{$endif} {$ifdef DEBUG_VTV}Logger.Send([lcPaintDetails],'NodeBitmap Width: %d Height: %d',[NodeBitmap.Width,NodeBitmap.Height]);{$endif}
// Call back application/descendants whether they want to erase this area.
if not DoPaintBackground(PaintInfo.Canvas, TargetRect) then if not DoPaintBackground(PaintInfo.Canvas, TargetRect) then
begin begin
if UseBackground then if UseBackground then
@ -29899,6 +29931,11 @@ begin
else else
begin begin
// Consider here also colors of the columns. // Consider here also colors of the columns.
{$ifdef UseSetCanvasOrigin}
SetCanvasOrigin(PaintInfo.Canvas, Target.X, 0); // This line caused issue #313 when it was placed above the if-statement
{$else}
SetWindowOrgEx(PaintInfo.Canvas.Handle, Target.X, 0, nil);
{$endif}
if UseColumns then if UseColumns then
begin begin
with FHeader.FColumns do with FHeader.FColumns do
@ -29950,7 +29987,10 @@ begin
Dec(R.Right); Dec(R.Right);
end; end;
PaintInfo.Canvas.Brush.Color := FColors.BackGroundColor; if not (coParentColor in Items[FirstColumn].FOptions) then
PaintInfo.Canvas.Brush.Color := Items[FirstColumn].FColor
else
PaintInfo.Canvas.Brush.Color := FColors.BackGroundColor;
PaintInfo.Canvas.FillRect(R); PaintInfo.Canvas.FillRect(R);
end; end;
FirstColumn := GetNextVisibleColumn(FirstColumn); FirstColumn := GetNextVisibleColumn(FirstColumn);
@ -30904,7 +30944,7 @@ procedure TBaseVirtualTree.SortTree(Column: TColumnIndex; Direction: TSortDirect
begin begin
if DoInit and not (vsInitialized in Run.States) then if DoInit and not (vsInitialized in Run.States) then
InitNode(Run); InitNode(Run);
if (vsInitialized in Run.States) and Expanded[Run] then // There is no need to sort collapsed branches if (vsInitialized in Run.States) and (not (toAutoSort in TreeOptions.AutoOptions) or Expanded[Run]) then // There is no need to sort collapsed branches
DoSort(Run); DoSort(Run);
Run := Run.NextSibling; Run := Run.NextSibling;
end; end;
@ -31295,7 +31335,9 @@ begin
end; end;
end; end;
end; end;
end; if toAutoSort in FOptions.FAutoOptions then
Sort(Node, FHeader.FSortColumn, FHeader.FSortDirection, False);
end;// if UpdateCount = 0
Include(Node.States, vsExpanded); Include(Node.States, vsExpanded);
AdjustTotalHeight(Node, HeightDelta, True); AdjustTotalHeight(Node, HeightDelta, True);
@ -32284,7 +32326,6 @@ begin
begin begin
// Set default font values first. // Set default font values first.
Canvas.Font := Font; Canvas.Font := Font;
// TODO: Added - procedure TCustomVirtualStringTree.InitializeTextProperties
if Enabled then // Es werden sonst nur die Farben verwendet von Font die an Canvas.Font übergeben wurden if Enabled then // Es werden sonst nur die Farben verwendet von Font die an Canvas.Font übergeben wurden
Canvas.Font.Color := FColors.NodeFontColor Canvas.Font.Color := FColors.NodeFontColor
else else