* Use {$packset 1} so sets can be of 1 or 2 bytes (by Juha Manninen)

* Change TVirtualNode to record instead of a packed record. Remove dummy padding field

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@1036 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
blikblum
2009-12-08 15:13:52 +00:00
parent 822745d0fc
commit 6f6aee59f0

View File

@ -1,6 +1,7 @@
unit VirtualTrees; unit VirtualTrees;
{$mode delphi}{$H+} {$mode delphi}{$H+}
{$packset 1}
// Version 4.8.6 // Version 4.8.6
// //
@ -861,7 +862,7 @@ type
Tree: TBaseVirtualTree; Tree: TBaseVirtualTree;
end; end;
TVirtualNode = packed record TVirtualNode = record
Index, // index of node with regard to its parent Index, // index of node with regard to its parent
ChildCount: Cardinal; // number of child nodes ChildCount: Cardinal; // number of child nodes
NodeHeight: Word; // height in pixels NodeHeight: Word; // height in pixels
@ -873,7 +874,6 @@ type
TotalCount, // sum of this node, all of its child nodes and their child nodes etc. TotalCount, // sum of this node, all of its child nodes and their child nodes etc.
TotalHeight: Cardinal; // height in pixels this node covers on screen including the height of all of its TotalHeight: Cardinal; // height in pixels this node covers on screen including the height of all of its
// children // children
Dummy2: Word; // FPC: Sets need 4 bytes / in Delphi only 2 bytes
// Note: Some copy routines require that all pointers (as well as the data area) in a node are // Note: Some copy routines require that all pointers (as well as the data area) in a node are
// located at the end of the node! Hence if you want to add new member fields (except pointers to internal // located at the end of the node! Hence if you want to add new member fields (except pointers to internal
// data) then put them before field Parent. // data) then put them before field Parent.
@ -5674,7 +5674,7 @@ procedure TWorkerThread.ChangeTreeStates(EnterStates, LeaveStates: TChangeStates
begin begin
if Assigned(FCurrentTree) and (FCurrentTree.HandleAllocated) then if Assigned(FCurrentTree) and (FCurrentTree.HandleAllocated) then
SendMessage(FCurrentTree.Handle, WM_CHANGESTATE, Integer(EnterStates), Integer(LeaveStates)); SendMessage(FCurrentTree.Handle, WM_CHANGESTATE, Byte(EnterStates), Byte(LeaveStates));
end; end;
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
@ -7839,17 +7839,17 @@ procedure TVirtualTreeColumn.LoadFromStream(const Stream: TStream; Version: Inte
//todo_lcl_check //todo_lcl_check
begin begin
if Version >= 3 then if Version >= 3 then
Result := TVTColumnOptions(LongWord(Value and $FFFF)) Result := TVTColumnOptions(Word(Value and $FFFF))
else else
if Version = 2 then if Version = 2 then
Result := TVTColumnOptions(LongWord(Value and $FF)) Result := TVTColumnOptions(Word(Value and $FF))
else else
begin begin
// In version 2 coParentColor has been added. This needs an option shift for older stream formats. // In version 2 coParentColor has been added. This needs an option shift for older stream formats.
// The first (lower) 4 options remain as they are. // The first (lower) 4 options remain as they are.
Result := TVTColumnOptions(LongWord(Word(Value) and $F)); Result := TVTColumnOptions(Word(Value) and $F);
Value := (Value and not $F) shl 1; Value := (Value and not $F) shl 1;
Result := Result + TVTColumnOptions(LongWord(Value and $FF)); Result := Result + TVTColumnOptions(Word(Value and $FF));
end; end;
end; end;
@ -7992,7 +7992,7 @@ begin
WriteBuffer(FSpacing, SizeOf(FSpacing)); WriteBuffer(FSpacing, SizeOf(FSpacing));
Dummy := Ord(FBiDiMode); Dummy := Ord(FBiDiMode);
WriteBuffer(Dummy, SizeOf(Dummy)); WriteBuffer(Dummy, SizeOf(Dummy));
Dummy := LongWord(FOptions); Dummy := Word(FOptions);
WriteBuffer(Dummy, SizeOf(Dummy)); WriteBuffer(Dummy, SizeOf(Dummy));
// parts introduced with stream version 1 // parts introduced with stream version 1
@ -11426,7 +11426,7 @@ begin
Height := Dummy; Height := Dummy;
ReadBuffer(Dummy, SizeOf(Dummy)); ReadBuffer(Dummy, SizeOf(Dummy));
FOptions := OldOptions; FOptions := OldOptions;
Options := TVTHeaderOptions(LongWord(Dummy)); Options := TVTHeaderOptions(Word(Dummy));
// PopupMenu is neither saved nor restored // PopupMenu is neither saved nor restored
ReadBuffer(Dummy, SizeOf(Dummy)); ReadBuffer(Dummy, SizeOf(Dummy));
Style := TVTHeaderStyle(Dummy); Style := TVTHeaderStyle(Dummy);
@ -11706,7 +11706,7 @@ begin
WriteBuffer(Dummy, SizeOf(Dummy)); WriteBuffer(Dummy, SizeOf(Dummy));
Dummy := FHeight; Dummy := FHeight;
WriteBuffer(Dummy, SizeOf(Dummy)); WriteBuffer(Dummy, SizeOf(Dummy));
Dummy := LongWord(FOptions); Dummy := Word(FOptions);
WriteBuffer(Dummy, SizeOf(Dummy)); WriteBuffer(Dummy, SizeOf(Dummy));
// PopupMenu is neither saved nor restored // PopupMenu is neither saved nor restored
Dummy := Ord(FStyle); Dummy := Ord(FStyle);
@ -16164,23 +16164,23 @@ var
begin begin
Logger.EnterMethod([lcMessages],'WMChangeState'); Logger.EnterMethod([lcMessages],'WMChangeState');
EnterStates := []; EnterStates := [];
if csStopValidation in TChangeStates(LongWord(Message.WParam)) then if csStopValidation in TChangeStates(Byte(Message.WParam)) then
Include(EnterStates, tsStopValidation); Include(EnterStates, tsStopValidation);
if csUseCache in TChangeStates(LongWord(Message.WParam)) then if csUseCache in TChangeStates(Byte(Message.WParam)) then
Include(EnterStates, tsUseCache); Include(EnterStates, tsUseCache);
if csValidating in TChangeStates(LongWord(Message.WParam)) then if csValidating in TChangeStates(Byte(Message.WParam)) then
Include(EnterStates, tsValidating); Include(EnterStates, tsValidating);
if csValidationNeeded in TChangeStates(LongWord(Message.WParam)) then if csValidationNeeded in TChangeStates(Byte(Message.WParam)) then
Include(EnterStates, tsValidationNeeded); Include(EnterStates, tsValidationNeeded);
LeaveStates := []; LeaveStates := [];
if csStopValidation in TChangeStates(LongWord(Message.LParam)) then if csStopValidation in TChangeStates(Byte(Message.LParam)) then
Include(LeaveStates, tsStopValidation); Include(LeaveStates, tsStopValidation);
if csUseCache in TChangeStates(LongWord(Message.LParam)) then if csUseCache in TChangeStates(Byte(Message.LParam)) then
Include(LeaveStates, tsUseCache); Include(LeaveStates, tsUseCache);
if csValidating in TChangeStates(LongWord(Message.LParam)) then if csValidating in TChangeStates(Byte(Message.LParam)) then
Include(LeaveStates, tsValidating); Include(LeaveStates, tsValidating);
if csValidationNeeded in TChangeStates(LongWord(Message.LParam)) then if csValidationNeeded in TChangeStates(Byte(Message.LParam)) then
Include(LeaveStates, tsValidationNeeded); Include(LeaveStates, tsValidationNeeded);
DoStateChange(EnterStates, LeaveStates); DoStateChange(EnterStates, LeaveStates);