LazUtils, LCL: Move LCLProc.CompareRect() -> GraphMath.SameRect(). Deprecate LCLProc.CompareRect().

This commit is contained in:
Juha 2023-07-03 16:51:51 +03:00
parent d8405a9db8
commit 0bc32656ed
12 changed files with 59 additions and 54 deletions

View File

@ -9,9 +9,9 @@ interface
uses uses
Types, Classes, SysUtils, Math, Types, Classes, SysUtils, Math,
// LCL // LCL
LCLProc, ExtCtrls, ComCtrls, Forms, Controls, ExtCtrls, ComCtrls, Forms, Controls,
// LazUtils // LazUtils
AvgLvlTree, LazConfigStorage, Laz2_XMLCfg, LazLoggerBase, LazTracer, AvgLvlTree, LazConfigStorage, Laz2_XMLCfg, LazLoggerBase, LazTracer, GraphMath,
// AnchorDocking // AnchorDocking
AnchorDockStr; AnchorDockStr;
@ -916,7 +916,7 @@ end;
procedure TAnchorDockLayoutTreeNode.SetBoundsRect(const AValue: TRect); procedure TAnchorDockLayoutTreeNode.SetBoundsRect(const AValue: TRect);
begin begin
if CompareRect(@FBoundsRect,@AValue) then exit; if SameRect(@FBoundsRect,@AValue) then exit;
FBoundsRect:=AValue; FBoundsRect:=AValue;
IncreaseChangeStamp; IncreaseChangeStamp;
end; end;
@ -1001,7 +1001,7 @@ end;
procedure TAnchorDockLayoutTreeNode.SetWorkAreaRect(const AValue: TRect); procedure TAnchorDockLayoutTreeNode.SetWorkAreaRect(const AValue: TRect);
begin begin
if CompareRect(@FWorkAreaRect,@AValue) then exit; if SameRect(@FWorkAreaRect,@AValue) then exit;
FWorkAreaRect:=AValue; FWorkAreaRect:=AValue;
IncreaseChangeStamp; IncreaseChangeStamp;
end; end;
@ -1083,7 +1083,7 @@ var
a: TAnchorKind; a: TAnchorKind;
begin begin
Result:=false; Result:=false;
if (not CompareRect(@FBoundsRect,@Node.FBoundsRect)) if (not SameRect(@FBoundsRect,@Node.FBoundsRect))
or (Count<>Node.Count) or (Count<>Node.Count)
or (NodeType<>Node.NodeType) or (NodeType<>Node.NodeType)
or (Name<>Node.Name) or (Name<>Node.Name)
@ -1094,7 +1094,7 @@ begin
or (PageIndex<>Node.PageIndex) or (PageIndex<>Node.PageIndex)
or (BoundSplitterPos<>Node.BoundSplitterPos) or (BoundSplitterPos<>Node.BoundSplitterPos)
or (PixelsPerInch<>Node.PixelsPerInch) or (PixelsPerInch<>Node.PixelsPerInch)
or (not CompareRect(@FWorkAreaRect,@Node.FWorkAreaRect)) or (not SameRect(@FWorkAreaRect,@Node.FWorkAreaRect))
then then
exit; exit;
for a:=low(TAnchorKind) to high(TAnchorKind) do for a:=low(TAnchorKind) to high(TAnchorKind) do

View File

@ -25,9 +25,9 @@ interface
uses uses
Classes, SysUtils, Laz_AVL_Tree, Classes, SysUtils, Laz_AVL_Tree,
// LCL // LCL
LCLProc, LResources, Forms, Controls, Dialogs, XMLPropStorage, LResources, Forms, Controls, Dialogs, XMLPropStorage,
// LazUtils // LazUtils
LazConfigStorage, FileUtil, LazFileUtils, LazFileCache, LazConfigStorage, FileUtil, LazFileUtils, LazFileCache, GraphMath,
// CodeTools // CodeTools
CodeAtom, CodeTree, KeywordFuncLists, NonPascalCodeTools, BasicCodeTools, CodeAtom, CodeTree, KeywordFuncLists, NonPascalCodeTools, BasicCodeTools,
FileProcs, CodeCache, SourceChanger, CodeToolManager, FileProcs, CodeCache, SourceChanger, CodeToolManager,
@ -1789,7 +1789,7 @@ end;
procedure TH2PasConverter.SetWindowBounds(const AValue: TRect); procedure TH2PasConverter.SetWindowBounds(const AValue: TRect);
begin begin
if CompareRect(@FWindowBounds,@AValue) then exit; if SameRect(@FWindowBounds,@AValue) then exit;
FWindowBounds:=AValue; FWindowBounds:=AValue;
Modified:=true; Modified:=true;
end; end;
@ -1847,7 +1847,7 @@ end;
function TH2PasConverter.IsEqual(AConverter: TH2PasConverter): boolean; function TH2PasConverter.IsEqual(AConverter: TH2PasConverter): boolean;
begin begin
if (FAutoOpenLastProject<>AConverter.FAutoOpenLastProject) if (FAutoOpenLastProject<>AConverter.FAutoOpenLastProject)
or (not CompareRect(@FWindowBounds,@AConverter.FWindowBounds)) or (not SameRect(@FWindowBounds,@AConverter.FWindowBounds))
or (Fh2pasFilename<>AConverter.h2pasFilename) or (Fh2pasFilename<>AConverter.h2pasFilename)
or (not FProjectHistory.Equals(AConverter.FProjectHistory)) or (not FProjectHistory.Equals(AConverter.FProjectHistory))
then then

View File

@ -81,6 +81,7 @@ procedure MakeMinMax(var i1, i2: integer);
procedure MoveRect(var ARect: TRect; x, y: Integer); procedure MoveRect(var ARect: TRect; x, y: Integer);
procedure MoveRectToFit(var ARect: TRect; const MaxRect: TRect); procedure MoveRectToFit(var ARect: TRect; const MaxRect: TRect);
function SameRect(R1, R2: PRect): Boolean;
procedure PolyBezier2Polyline(Beziers: Array of TBezier; procedure PolyBezier2Polyline(Beziers: Array of TBezier;
var Points : PPoint; var Count : Longint); Overload; var Points : PPoint; var Count : Longint); Overload;
@ -872,6 +873,16 @@ begin
end; end;
end; end;
function SameRect(R1, R2: PRect): Boolean;
begin
Result:=(R1^.Left=R2^.Left) and (R1^.Top=R2^.Top) and
(R1^.Bottom=R2^.Bottom) and (R1^.Right=R2^.Right);
{if not Result then begin
DebugLn(' DIFFER: ',R1^.Left,',',R1^.Top,',',R1^.Right,',',R1^.Bottom
,' <> ',R2^.Left,',',R2^.Top,',',R2^.Right,',',R2^.Bottom);
end;}
end;
{------------------------------------------------------------------------------ {------------------------------------------------------------------------------
Method: PolyBezier2Polyline Method: PolyBezier2Polyline
Params: Beziers, Points, Count Params: Beziers, Points, Count

View File

@ -39,9 +39,9 @@ interface
uses uses
Types, Classes, SysUtils, Math, FPCanvas, Types, Classes, SysUtils, Math, FPCanvas,
// LCL // LCL
LCLIntf, LCLProc, Controls, Forms, Graphics, Menus, ComCtrls, LCLIntf, Controls, Forms, Graphics, Menus, ComCtrls,
// LazUtils // LazUtils
GraphType, GraphMath, GraphType, GraphMath, LazLoggerBase,
// IDEIntf // IDEIntf
PropEditUtils, ComponentEditors, FormEditingIntf, PropEditUtils, ComponentEditors, FormEditingIntf,
// IDE // IDE
@ -772,7 +772,7 @@ var
r: TRect; r: TRect;
begin begin
r:=GetBounds; r:=GetBounds;
Result:=not CompareRect(@r,@FMovedResizedBounds); Result:=not SameRect(@r,@FMovedResizedBounds);
end; end;
function TSelectedControl.IsTopLvl: boolean; function TSelectedControl.IsTopLvl: boolean;
@ -2838,7 +2838,6 @@ end;
procedure TControlSelection.SetRubberBandBounds(ARect:TRect); procedure TControlSelection.SetRubberBandBounds(ARect:TRect);
var var
i :integer;
InvFrame: TRect; InvFrame: TRect;
begin begin
if FForm = nil then exit; if FForm = nil then exit;
@ -2847,7 +2846,7 @@ begin
MakeMinMax(ARect.Left, ARect.Right); MakeMinMax(ARect.Left, ARect.Right);
MakeMinMax(ARect.Top, ARect.Bottom); MakeMinMax(ARect.Top, ARect.Bottom);
if not CompareRect(@FRubberBandBounds, @ARect) then if not SameRect(@FRubberBandBounds, @ARect) then
begin begin
if (FForm <> nil) and (cssRubberbandPainted in FStates) then if (FForm <> nil) and (cssRubberbandPainted in FStates) then
begin begin

View File

@ -40,10 +40,10 @@ uses
// RTL + FCL // RTL + FCL
Types, Classes, Math, SysUtils, Variants, TypInfo, Types, Classes, Math, SysUtils, Variants, TypInfo,
// LCL // LCL
LCLProc, LCLType, LResources, LCLIntf, LMessages, InterfaceBase, LCLType, LResources, LCLIntf, LMessages, InterfaceBase,
Forms, Controls, Graphics, Dialogs, ExtCtrls, Menus, ClipBrd, Forms, Controls, Graphics, Dialogs, ExtCtrls, Menus, ClipBrd,
// LazUtils // LazUtils
GraphType, LazFileUtils, LazFileCache, LazLoggerBase, LazUtilities, GraphType, GraphMath, LazFileUtils, LazFileCache, LazLoggerBase, LazUtilities,
// IDEIntf // IDEIntf
IDEDialogs, PropEdits, PropEditUtils, ComponentEditors, MenuIntf, IDEDialogs, PropEdits, PropEditUtils, ComponentEditors, MenuIntf,
IDEImagesIntf, FormEditingIntf, ComponentReg, IDECommands, LazIDEIntf, IDEImagesIntf, FormEditingIntf, ComponentReg, IDECommands, LazIDEIntf,
@ -3716,8 +3716,8 @@ var
begin begin
NewFormBounds:=Form.BoundsRect; NewFormBounds:=Form.BoundsRect;
if FDefaultFormBoundsValid then begin if FDefaultFormBoundsValid then begin
if (not CompareRect(@NewFormBounds,@FLastFormBounds)) if (not SameRect(@NewFormBounds,@FLastFormBounds))
and (not CompareRect(@NewFormBounds,@FDefaultFormBounds)) then begin and (not SameRect(@NewFormBounds,@FDefaultFormBounds)) then begin
//debugln('TDesigner.CheckFormBounds'); //debugln('TDesigner.CheckFormBounds');
Modified; Modified;
if Selection.SelectionForm=Form then begin if Selection.SelectionForm=Form then begin
@ -4179,7 +4179,7 @@ var
if not (Ancestor is TControl) then exit; if not (Ancestor is TControl) then exit;
OldBounds:=AControl.BoundsRect; OldBounds:=AControl.BoundsRect;
NewBounds:=Ancestor.BoundsRect; NewBounds:=Ancestor.BoundsRect;
if not CompareRect(@OldBounds,@NewBounds) then begin if not SameRect(@OldBounds,@NewBounds) then begin
AControl.BoundsRect:=NewBounds; AControl.BoundsRect:=NewBounds;
HasChanged:=true; HasChanged:=true;
end; end;

View File

@ -42,7 +42,7 @@ uses
LCLProc, LCLType, LCLIntf, LResources, LMessages, Forms, Controls, LCLProc, LCLType, LCLIntf, LResources, LMessages, Forms, Controls,
Graphics, Dialogs, Themes, Buttons, Graphics, Dialogs, Themes, Buttons,
// LazUtils // LazUtils
LazStringUtils, LazStringUtils, GraphMath,
// SynEdit // SynEdit
SynEdit, SynEditKeyCmds, SynEdit, SynEditKeyCmds,
// CodeTools // CodeTools
@ -882,7 +882,7 @@ var
inc(y,(LineHeight-FBtnWidth) div 2); inc(y,(LineHeight-FBtnWidth) div 2);
Item.NewBounds:=Bounds(AHintRect.Right-RightSpace-1,y,FBtnWidth,FBtnWidth); Item.NewBounds:=Bounds(AHintRect.Right-RightSpace-1,y,FBtnWidth,FBtnWidth);
r:=Item.CopyAllButton.BoundsRect; r:=Item.CopyAllButton.BoundsRect;
if not CompareRect(@r,@Item.NewBounds) then if not SameRect(@r,@Item.NewBounds) then
IdleConnected:=true; IdleConnected:=true;
end; end;
//debugln(['DrawHint ',y,' Line="',dbgstr(Line),'" LineHeight=',LineHeight,' ']); //debugln(['DrawHint ',y,' Line="',dbgstr(Line),'" LineHeight=',LineHeight,' ']);

View File

@ -3109,7 +3109,7 @@ end;
function SendAppMessage(Msg: Cardinal; WParam: WParam; LParam: LParam): Longint; function SendAppMessage(Msg: Cardinal; WParam: WParam; LParam: LParam): Longint;
begin begin
Result:=LCLProc.SendApplicationMessage(Msg,WParam,LParam); Result:=SendApplicationMessage(Msg,WParam,LParam);
end; end;
procedure MoveWindowOrg(dc: hdc; X, Y: Integer); procedure MoveWindowOrg(dc: hdc; X, Y: Integer);

View File

@ -1384,7 +1384,7 @@ begin
if [csLoading,csDestroying]*ComponentState<>[] then exit; if [csLoading,csDestroying]*ComponentState<>[] then exit;
CurBounds:=BoundsRect; CurBounds:=BoundsRect;
CurClientSize:=Point(ClientWidth,ClientHeight); CurClientSize:=Point(ClientWidth,ClientHeight);
if (not CompareRect(@FLastDoChangeBounds,@CurBounds)) if (not SameRect(@FLastDoChangeBounds,@CurBounds))
or (ComparePoints(CurClientSize,FLastDoChangeClientSize)<>0) then begin or (ComparePoints(CurClientSize,FLastDoChangeClientSize)<>0) then begin
if FormIsUpdating then begin if FormIsUpdating then begin
Include(FControlFlags,cfOnChangeBoundsNeeded); Include(FControlFlags,cfOnChangeBoundsNeeded);
@ -4137,7 +4137,7 @@ begin
end else end else
NewBaseParentClientSize:=FBaseParentClientSize; NewBaseParentClientSize:=FBaseParentClientSize;
if (not CompareRect(@NewBaseBounds,@FBaseBounds)) if (not SameRect(@NewBaseBounds,@FBaseBounds))
or (NewBaseParentClientSize.cx<>FBaseParentClientSize.cx) or (NewBaseParentClientSize.cx<>FBaseParentClientSize.cx)
or (NewBaseParentClientSize.cy<>FBaseParentClientSize.cy) or (NewBaseParentClientSize.cy<>FBaseParentClientSize.cy)
then begin then begin

View File

@ -189,7 +189,7 @@ end;
procedure TDragDockObject.MoveDockImage; procedure TDragDockObject.MoveDockImage;
begin begin
//Draw the form outlines when the position has changed //Draw the form outlines when the position has changed
if not CompareRect(@DockRect, @EraseDockRect) then if not SameRect(@DockRect, @EraseDockRect) then
begin begin
if HasOnDrawImage then if HasOnDrawImage then
OnDrawDockImage(Self, EraseDockRect, DockRect, disMove) OnDrawDockImage(Self, EraseDockRect, DockRect, disMove)

View File

@ -2277,7 +2277,7 @@ begin
if CurControl=nil then continue; if CurControl=nil then continue;
NewBounds:=ControlBox.NewControlBounds; NewBounds:=ControlBox.NewControlBounds;
OldBounds:=CurControl.BoundsRect; OldBounds:=CurControl.BoundsRect;
if not CompareRect(@NewBounds,@OldBounds) then begin if not SameRect(@NewBounds,@OldBounds) then begin
Result:=true; Result:=true;
CurControl.SetBoundsKeepBase(NewBounds.Left, CurControl.SetBoundsKeepBase(NewBounds.Left,
NewBounds.Top, NewBounds.Top,
@ -3045,7 +3045,7 @@ var
Control.SetBoundsKeepBase(NewLeft, NewTop, NewWidth, NewHeight); Control.SetBoundsKeepBase(NewLeft, NewTop, NewWidth, NewHeight);
//DebugLn(['DoPosition ',DbgSName(Control),' ',cfAutoSizeNeeded in Control.FControlFlags]); //DebugLn(['DoPosition ',DbgSName(Control),' ',cfAutoSizeNeeded in Control.FControlFlags]);
NewBounds:=Control.BoundsRect; NewBounds:=Control.BoundsRect;
BoundsMutated:=not CompareRect(@OldBounds,@NewBounds); BoundsMutated:=not SameRect(@OldBounds,@NewBounds);
if BoundsMutated then begin if BoundsMutated then begin
LastBoundsMutated:=Control; LastBoundsMutated:=Control;
LastBoundsMutatedOld:=OldBounds; LastBoundsMutatedOld:=OldBounds;
@ -3414,7 +3414,7 @@ begin
end; end;
// Important: change the BaseBounds too, otherwise the changes will be undone by AlignControls // Important: change the BaseBounds too, otherwise the changes will be undone by AlignControls
OldChildBounds:=AControl.BoundsRect; OldChildBounds:=AControl.BoundsRect;
if not CompareRect(@OldChildBounds,@NewChildBounds) then begin if not SameRect(@OldChildBounds,@NewChildBounds) then begin
//DebugLn(['TWinControl.DoAutoSize moving child: ',DbgSName(AControl),' Old=',dbgs(OldChildBounds),' New=',dbgs(NewChildBounds)]); //DebugLn(['TWinControl.DoAutoSize moving child: ',DbgSName(AControl),' Old=',dbgs(OldChildBounds),' New=',dbgs(NewChildBounds)]);
AControl.BoundsRect:=NewChildBounds; AControl.BoundsRect:=NewChildBounds;
//DebugLn(['TWinControl.DoAutoSize AFTER ',DbgSName(AControl),' ',dbgs(AControl.BoundsRect)]); //DebugLn(['TWinControl.DoAutoSize AFTER ',DbgSName(AControl),' ',dbgs(AControl.BoundsRect)]);
@ -3721,8 +3721,8 @@ begin
R := GetClientRect; R := GetClientRect;
AdjustClientRect(R); AdjustClientRect(R);
//if CheckPosition(Self) then //if CheckPosition(Self) then
//DebugLn(['TWinControl.DoAdjustClientRectChange ',DbgSName(Self),' new=',dbgs(r),' old=',dbgs(FAdjustClientRectRealized),' ',CompareRect(@r,@FAdjustClientRectRealized)]); //DebugLn(['TWinControl.DoAdjustClientRectChange ',DbgSName(Self),' new=',dbgs(r),' old=',dbgs(FAdjustClientRectRealized),' ',SameRect(@r,@FAdjustClientRectRealized)]);
if not CompareRect(@R, @FAdjustClientRectRealized) then if not SameRect(@R, @FAdjustClientRectRealized) then
begin begin
// client rect changed since last AlignControl // client rect changed since last AlignControl
{$IF defined(VerboseAllAutoSize) or defined(VerboseClientRectBugFix) or defined(VerboseIntfSizing) or defined(VerboseOnResize)} {$IF defined(VerboseAllAutoSize) or defined(VerboseClientRectBugFix) or defined(VerboseIntfSizing) or defined(VerboseOnResize)}
@ -6452,7 +6452,7 @@ begin
// some widgetsets updates their clientrect when the first child was moved // some widgetsets updates their clientrect when the first child was moved
// do a second pass if ClientRect changed // do a second pass if ClientRect changed
NewRect:=GetLogicalClientRect; NewRect:=GetLogicalClientRect;
if not CompareRect(@ARect,@NewRect) then if not SameRect(@ARect,@NewRect) then
AlignControls(AControl, NewRect); AlignControls(AControl, NewRect);
finally finally
EnableAlign; EnableAlign;
@ -6933,7 +6933,7 @@ begin
GetWindowSize(Handle, NewWidth, NewHeight); GetWindowSize(Handle, NewWidth, NewHeight);
NewBoundsRealized:=Bounds(Message.XPos, Message.YPos, NewWidth, NewHeight); NewBoundsRealized:=Bounds(Message.XPos, Message.YPos, NewWidth, NewHeight);
if CompareRect(@NewBoundsRealized,@FBoundsRealized) then exit; if SameRect(@NewBoundsRealized,@FBoundsRealized) then exit;
TopParent:=GetTopParent; TopParent:=GetTopParent;
if (TopParent is TWinControl) if (TopParent is TWinControl)
@ -7024,7 +7024,7 @@ begin
NewBoundsRealized := Bounds(NewLeft, NewTop, Message.Width, Message.Height); NewBoundsRealized := Bounds(NewLeft, NewTop, Message.Width, Message.Height);
OldClientSize := Size(0, 0); OldClientSize := Size(0, 0);
NewClientSize := Size(0, 0); NewClientSize := Size(0, 0);
if CompareRect(@NewBoundsRealized, @FBoundsRealized) then if SameRect(@NewBoundsRealized, @FBoundsRealized) then
begin begin
if not (wcfClientRectNeedsUpdate in FWinControlFlags) then if not (wcfClientRectNeedsUpdate in FWinControlFlags) then
begin begin
@ -7146,7 +7146,7 @@ begin
{$ENDIF} {$ENDIF}
//DebugLn('TWinControl.WMSize B ',Name,':',ClassName,' ',NewLeft,',',NewTop); //DebugLn('TWinControl.WMSize B ',Name,':',ClassName,' ',NewLeft,',',NewTop);
NewBoundsRealized := Bounds(NewLeft, NewTop, NewWidth, NewHeight); NewBoundsRealized := Bounds(NewLeft, NewTop, NewWidth, NewHeight);
if CompareRect(@NewBoundsRealized,@FBoundsRealized) if SameRect(@NewBoundsRealized,@FBoundsRealized)
and (not (wcfClientRectNeedsUpdate in FWinControlFlags)) then and (not (wcfClientRectNeedsUpdate in FWinControlFlags)) then
exit; exit;
@ -8118,7 +8118,7 @@ begin
OldBounds := BoundsRect; OldBounds := BoundsRect;
NewBounds := Bounds(ALeft, ATop, AWidth, AHeight); NewBounds := Bounds(ALeft, ATop, AWidth, AHeight);
if not CompareRect(@NewBounds, @OldBounds) then if not SameRect(@NewBounds, @OldBounds) then
begin begin
if [csDesigning,csDestroying,csLoading]*ComponentState=[csDesigning] then if [csDesigning,csDestroying,csLoading]*ComponentState=[csDesigning] then
CheckDesignBounds; CheckDesignBounds;
@ -8516,7 +8516,7 @@ begin
// this can trigger WMSize messages // this can trigger WMSize messages
TWSWinControlClass(WidgetSetClass).SetBounds(Self, Left, Top, Width, Height); TWSWinControlClass(WidgetSetClass).SetBounds(Self, Left, Top, Width, Height);
NewClientRect := ClientRect; NewClientRect := ClientRect;
if Visible and (not CompareRect(@OldClientRect,@NewClientRect)) then if Visible and (not SameRect(@OldClientRect,@NewClientRect)) then
begin begin
// the widgetset has changed the clientrect in an unexpected way // the widgetset has changed the clientrect in an unexpected way
{$IFDEF VerboseIntfSizing} {$IFDEF VerboseIntfSizing}
@ -8553,7 +8553,7 @@ begin
if HandleAllocated if HandleAllocated
and ([csLoading,csDestroying]*ComponentState=[]) and ([csLoading,csDestroying]*ComponentState=[])
and (not (csDestroyingHandle in ControlState)) and (not (csDestroyingHandle in ControlState))
and (not CompareRect(@NewBounds,@FBoundsRealized)) and (not SameRect(@NewBounds,@FBoundsRealized))
then begin then begin
// the new bounds were not yet sent to the InterfaceObject -> send them // the new bounds were not yet sent to the InterfaceObject -> send them
{$IFDEF CHECK_POSITION} {$IFDEF CHECK_POSITION}
@ -8579,7 +8579,7 @@ begin
if not HandleAllocated then debugln('not HandleAllocated'); if not HandleAllocated then debugln('not HandleAllocated');
if (csLoading in ComponentState) then debugln('csLoading'); if (csLoading in ComponentState) then debugln('csLoading');
if (csDestroying in ComponentState) then debugln('csDestroying'); if (csDestroying in ComponentState) then debugln('csDestroying');
if (CompareRect(@NewBounds,@FBoundsRealized)) then debugln('bounds not changed'); if (SameRect(@NewBounds,@FBoundsRealized)) then debugln('bounds not changed');
end; end;
{$ENDIF} {$ENDIF}
if not HandleAllocated then Check; if not HandleAllocated then Check;

View File

@ -113,6 +113,7 @@ procedure OwnerFormDesignerModified(AComponent: TComponent);
// Deprecated in version 2.3, 2023-06. // Deprecated in version 2.3, 2023-06.
procedure FreeThenNil(var obj); deprecated 'Use LazUtilities.FreeThenNil instead'; procedure FreeThenNil(var obj); deprecated 'Use LazUtilities.FreeThenNil instead';
function CompareRect(R1, R2: PRect): Boolean; deprecated 'Use GraphMath.SameRect instead';
function OffsetRect(var Rect: TRect; DX, DY: Integer): Boolean; deprecated 'Use Types.OffsetRect instead'; function OffsetRect(var Rect: TRect; DX, DY: Integer): Boolean; deprecated 'Use Types.OffsetRect instead';
procedure MoveRect(var ARect: TRect; x, y: Integer); deprecated 'Use GraphMath.MoveRect instead'; procedure MoveRect(var ARect: TRect; x, y: Integer); deprecated 'Use GraphMath.MoveRect instead';
procedure MoveRectToFit(var ARect: TRect; const MaxRect: TRect); deprecated 'Use GraphMath.MoveRectToFit instead'; procedure MoveRectToFit(var ARect: TRect; const MaxRect: TRect); deprecated 'Use GraphMath.MoveRectToFit instead';
@ -134,7 +135,6 @@ function RemoveAmpersands(const ASource: String): String;
function RemoveAmpersands(Src: PChar; var LineLength: Longint): PChar; function RemoveAmpersands(Src: PChar; var LineLength: Longint): PChar;
function CompareHandles(h1, h2: TLCLHandle): integer; function CompareHandles(h1, h2: TLCLHandle): integer;
function CompareRect(R1, R2: PRect): Boolean;
function ComparePoints(const p1, p2: TPoint): integer; function ComparePoints(const p1, p2: TPoint): integer;
function CompareCaret(const FirstCaret, SecondCaret: TPoint): integer; function CompareCaret(const FirstCaret, SecondCaret: TPoint): integer;
@ -835,6 +835,11 @@ begin
LazUtilities.FreeThenNil(obj); LazUtilities.FreeThenNil(obj);
end; end;
function CompareRect(R1, R2: PRect): Boolean;
begin
Result := GraphMath.SameRect(R1, R2);
end;
function OffsetRect(var Rect: TRect; DX, DY: Integer): Boolean; function OffsetRect(var Rect: TRect; DX, DY: Integer): Boolean;
begin begin
Result := Types.OffsetRect(Rect, DX, DY); Result := Types.OffsetRect(Rect, DX, DY);
@ -897,16 +902,6 @@ begin
Result:=0; Result:=0;
end; end;
function CompareRect(R1, R2: PRect): Boolean;
begin
Result:=(R1^.Left=R2^.Left) and (R1^.Top=R2^.Top) and
(R1^.Bottom=R2^.Bottom) and (R1^.Right=R2^.Right);
{if not Result then begin
DebugLn(' DIFFER: ',R1^.Left,',',R1^.Top,',',R1^.Right,',',R1^.Bottom
,' <> ',R2^.Left,',',R2^.Top,',',R2^.Right,',',R2^.Bottom);
end;}
end;
function ComparePoints(const p1, p2: TPoint): integer; function ComparePoints(const p1, p2: TPoint): integer;
begin begin
if p1.Y>p2.Y then if p1.Y>p2.Y then

View File

@ -99,9 +99,9 @@ interface
uses uses
Math, Types, Classes, SysUtils, typinfo, Math, Types, Classes, SysUtils, typinfo,
// LazUtils // LazUtils
LazLoggerBase, LazLoggerBase, LazTracer, GraphMath,
// LCL // LCL
LCLProc, LCLType, LCLIntf, LCLStrConsts, Graphics, Controls, ExtCtrls, Forms, LCLType, LCLIntf, Graphics, Controls, ExtCtrls, Forms,
Menus, Themes, ComCtrls, LMessages, LResources; Menus, Themes, ComCtrls, LMessages, LResources;
type type
@ -1573,7 +1573,7 @@ procedure TLazDockTree.MessageHandler(Sender: TControl; var Message: TLMessage);
NewMouseState.IsMouseDown := (GetKeyState(VK_LBUTTON) and $80) <> 0; NewMouseState.IsMouseDown := (GetKeyState(VK_LBUTTON) and $80) <> 0;
if not CompareMem(@FMouseState, @NewMouseState, SizeOf(NewMouseState)) then if not CompareMem(@FMouseState, @NewMouseState, SizeOf(NewMouseState)) then
begin begin
if not CompareRect(@FMouseState.Rect, @NewMouseState.Rect) then if not SameRect(@FMouseState.Rect, @NewMouseState.Rect) then
InvalidateRect(DockSite.Handle, @FMouseState.Rect, False); InvalidateRect(DockSite.Handle, @FMouseState.Rect, False);
FMouseState := NewMouseState; FMouseState := NewMouseState;
InvalidateRect(DockSite.Handle, @NewMouseState.Rect, False); InvalidateRect(DockSite.Handle, @NewMouseState.Rect, False);
@ -2006,7 +2006,7 @@ begin
end; end;
if not CompareMem(@FMouseState, @NewMouseState, SizeOf(NewMouseState)) then if not CompareMem(@FMouseState, @NewMouseState, SizeOf(NewMouseState)) then
begin begin
if not CompareRect(@FMouseState.Rect, @NewMouseState.Rect) then if not SameRect(@FMouseState.Rect, @NewMouseState.Rect) then
InvalidateRect(Handle, @FMouseState.Rect, False); InvalidateRect(Handle, @FMouseState.Rect, False);
FMouseState := NewMouseState; FMouseState := NewMouseState;
InvalidateRect(Handle, @NewMouseState.Rect, False); InvalidateRect(Handle, @NewMouseState.Rect, False);