mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-11-06 19:34:36 +01:00
+ Compatibility checks and code reformatting
This commit is contained in:
parent
ea7ed753c8
commit
01c02d63bb
@ -49,6 +49,7 @@ unit types;
|
||||
TBooleanDynArray = array of Boolean;
|
||||
TStringDynArray = array of AnsiString;
|
||||
TWideStringDynArray = array of WideString;
|
||||
|
||||
{$ifdef Win32}
|
||||
TPoint = Windows.TPoint;
|
||||
{$else}
|
||||
@ -92,6 +93,7 @@ unit types;
|
||||
|
||||
{$ifndef win32}
|
||||
const
|
||||
|
||||
STGTY_STORAGE = 1;
|
||||
STGTY_STREAM = 2;
|
||||
STGTY_LOCKBYTES = 3;
|
||||
@ -236,18 +238,23 @@ unit types;
|
||||
function UnionRect(var Rect : TRect; const R1,R2 : TRect) : Boolean;
|
||||
function IsRectEmpty(const Rect : TRect) : Boolean;
|
||||
function OffsetRect(var Rect : TRect;DX : Integer;DY : Integer) : Boolean;
|
||||
function CenterPoint(const Rect: TRect): TPoint;
|
||||
|
||||
{$endif ver1_0}
|
||||
|
||||
implementation
|
||||
|
||||
{$ifndef ver1_0}
|
||||
|
||||
function EqualRect(const r1,r2 : TRect) : Boolean;
|
||||
|
||||
begin
|
||||
EqualRect:=(r1.left=r2.left) and (r1.right=r2.right) and (r1.top=r2.top) and (r1.bottom=r2.bottom);
|
||||
end;
|
||||
|
||||
|
||||
function Rect(Left,Top,Right,Bottom : Integer) : TRect;
|
||||
|
||||
begin
|
||||
Rect.Left:=Left;
|
||||
Rect.Top:=Top;
|
||||
@ -255,7 +262,9 @@ unit types;
|
||||
Rect.Bottom:=Bottom;
|
||||
end;
|
||||
|
||||
|
||||
function Bounds(ALeft,ATop,AWidth,AHeight : Integer) : TRect;
|
||||
|
||||
begin
|
||||
Bounds.Left:=ALeft;
|
||||
Bounds.Top:=ATop;
|
||||
@ -263,18 +272,26 @@ unit types;
|
||||
Bounds.Bottom:=ATop+AHeight;
|
||||
end;
|
||||
|
||||
|
||||
function Point(x,y : Integer) : TPoint;
|
||||
|
||||
begin
|
||||
Point.x:=x;
|
||||
Point.y:=y;
|
||||
end;
|
||||
|
||||
function PtInRect(const Rect : TRect;const p : TPoint) : Boolean;
|
||||
|
||||
begin
|
||||
PtInRect:=(p.y>=Rect.Top) and (p.y<Rect.Bottom) and (p.x>=Rect.Left) and (p.x<Rect.Right);
|
||||
PtInRect:=(p.y>=Rect.Top) and
|
||||
(p.y<Rect.Bottom) and
|
||||
(p.x>=Rect.Left) and
|
||||
(p.x<Rect.Right);
|
||||
end;
|
||||
|
||||
|
||||
function IntersectRect(var Rect : TRect;const R1,R2 : TRect) : Boolean;
|
||||
|
||||
begin
|
||||
Rect:=R1;
|
||||
with R2 do
|
||||
@ -342,12 +359,26 @@ unit types;
|
||||
OffsetRect:=false;
|
||||
end;
|
||||
|
||||
function CenterPoint(const Rect: TRect): TPoint;
|
||||
|
||||
begin
|
||||
With Rect do
|
||||
begin
|
||||
Result.X:=(Left+Right) div 2;
|
||||
Result.Y:=(Top+Bottom) div 2;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
{$endif ver1_0}
|
||||
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.5 2003-10-05 19:10:03 florian
|
||||
Revision 1.6 2004-01-10 19:00:20 michael
|
||||
+ Compatibility checks and code reformatting
|
||||
|
||||
Revision 1.5 2003/10/05 19:10:03 florian
|
||||
* fixed some delphi compatibilty issues
|
||||
|
||||
Revision 1.4 2003/04/24 11:09:36 florian
|
||||
|
||||
Loading…
Reference in New Issue
Block a user