-
Notifications
You must be signed in to change notification settings - Fork 10
/
_defines.pas
844 lines (721 loc) · 18.9 KB
/
_defines.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
unit _Defines;
(******
DN/2 Plugin Interface - consts & type defines
Copyright (C) 2002 Aleksej Kozlov (Cat)
2:5030/1326.13
******)
{&Delphi-}
{&Use32+}
interface
uses
{$IFDEF WIN32}Windows, {$ENDIF}
VpSysLow
;
const
{ TStream access modes }
stCreate = $FFFF { $DC0B }; { Create new file }
stOpenRead = Open_Access_ReadOnly or open_share_DenyNone;
{ Read access only }
stOpenWrite = Open_Access_WriteOnly or open_share_DenyNone;
{ Write access only }
stOpen = Open_Access_ReadWrite or open_share_DenyNone;
{ Read and write access }
stOpenPacked = Open_Access_ReadWrite+1;
{ Read access only, packed files too }
{ File share mode constants }
fmClean = $FF00; { Mask to clean low byte of file mode constatns }
fmOpenMode = $FFF0;
{ Mask to apply fmReadOnly/fmWriteOnly/fmReadWrite }
fmReadOnly = Open_Access_ReadOnly; { Open read-only file }
fmWriteOnly = Open_Access_WriteOnly; { Open file for write only }
fmReadWrite = Open_Access_ReadWrite;
{ Open file as for read, as for write }
fmPacked = Open_Access_ReadWrite+1; { Open a packed file, if can }
fmDeny = $FF0F; { Mask to apply fmDenyXXX }
fmDenyAll = Open_Share_DenyReadWrite; { Exclusive file use }
fmDenyWrite = Open_Share_DenyWrite; { Deny write access }
fmDenyRead = Open_Share_DenyRead; { Deny read access }
fmDenyNone = open_share_DenyNone; { Deny no access }
fmDenyChild = open_share_DenyNone; { Don't give right's to child }
{ TStream error codes }
stOK = 0; { No error }
stError = -1; { Access error }
stInitError = -2; { Cannot initialize stream }
stReadError = -3; { Read beyond end of stream }
stWriteError = -4; { Cannot expand stream }
stGetError = -5; { Get of unregistered object type }
stPutError = -6; { Put of unregistered object type }
stSeekError = -7; { Stream seek error }
stOpenError = -8; { Stream open error }
{ Event codes }
evMouseDown = $0001;
evMouseUp = $0002;
evMouseMove = $0004;
evMouseAuto = $0008;
evKeyDown = $0010;
evCommand = $0100;
evBroadcast = $0200;
{ Event masks }
evNothing = $0000;
evMouse = $000F;
evKeyboard = $0010;
evMessage = $FF00;
{ Message box classes }
mfWarning = $0000; { Display a Warning box }
mfError = $0001; { Dispaly a Error box }
mfInformation = $0002; { Display an Information Box }
mfConfirmation = $0003; { Display a Confirmation Box }
mfQuery = $0004;
mfAbout = $0005;
mfSysError = $0006;
{ Message box button flags }
mfYesButton = $0100; { Put a Yes button into the dialog }
mfOKButton = $0200; { Put an OK button into the dialog }
mfNoButton = $0400; { Put a No button into the dialog }
mfCancelButton = $8000; { Put a Cancel button into the dialog }
mfNextDButton = $0800;
mfAppendButton = $1000;
mf2YesButton = $2000;
mfAllButton = $4000;
mfYesNoCancel = mfYesButton+mfNoButton+mfCancelButton;
{ Standard Yes, No, Cancel dialog }
mfYesNoConfirm = mfYesButton+mfNoButton+mfConfirmation;
{ Standard Yes, No confirmation }
mfOKCancel = mfOKButton+mfCancelButton;
{ Standard OK, Cancel dialog }
{ TView State masks }
sfVisible = $0001;
sfCursorVis = $0002;
sfCursorIns = $0004;
sfShadow = $0008;
sfActive = $0010;
sfSelected = $0020;
sfFocused = $0040;
sfDragging = $0080;
sfDisabled = $0100;
sfModal = $0200;
sfDefault = $0400;
sfExposed = $0800;
{ TView Option masks }
ofSelectable = $0001;
ofTopSelect = $0002;
ofFirstClick = $0004;
ofFramed = $0008;
ofPreProcess = $0010;
ofPostProcess = $0020;
ofBuffered = $0040;
ofTileable = $0080;
ofCenterX = $0100;
ofCenterY = $0200;
ofCentered = $0300;
ofValidate = $0400;
ofSecurity = $0800;
ofVersion = $3000;
ofVersion10 = $0000;
ofVersion20 = $1000;
{ TView GrowMode masks }
gfGrowLoX = $01;
gfGrowLoY = $02;
gfGrowHiX = $04;
gfGrowHiY = $08;
gfGrowAll = $0F;
gfGrowRel = $10;
{ TView DragMode masks }
dmDragMove = $01;
dmDragGrow = $02;
dmLimitLoX = $10;
dmLimitLoY = $20;
dmLimitHiX = $40;
dmLimitHiY = $80;
dmLimitAll = $F0;
{ TView Help context codes }
hcNoContext = 0;
hcDragging = 1;
{ TScrollBar part codes }
sbLeftArrow = 0;
sbRightArrow = 1;
sbPageLeft = 2;
sbPageRight = 3;
sbUpArrow = 4;
sbDownArrow = 5;
sbPageUp = 6;
sbPageDown = 7;
sbIndicator = 8;
{ TScrollBar options for TWindow.StandardScrollBar }
sbHorizontal = $0000;
sbVertical = $0001;
sbHandleKeyboard = $0002;
{ TWindow Flags masks }
wfMove = $01;
wfGrow = $02;
wfClose = $04;
wfZoom = $08;
wfMaxi = $10;
{ TWindow number constants }
wnNoNumber = 255;
{ TWindow palette entries }
wpBlueWindow = 0;
wpCyanWindow = 1;
wpGrayWindow = 2;
{ TDialog palette entires }
dpRedDialog = 1;
dpCyanDialog = 2;
dpGrayDialog = 3;
{ TButton flags }
bfNormal = $00;
bfDefault = $01;
bfLeftJust = $02;
bfBroadcast = $04;
bfGrabFocus = $08;
{ TMultiCheckboxes flags }
{ hibyte = number of bits }
{ lobyte = bit mask }
cfOneBit = $0101;
cfTwoBits = $0203;
cfFourBits = $040F;
cfEightBits = $08FF;
const
ArcFirst = 100;
arcLast = 249;
const
MaxBytes = 128*1024*1024;
MaxWords = MaxBytes div SizeOf(Word);
MaxPtrs = MaxBytes div SizeOf(Pointer);
type
TRegExpStatus =
(
resOK,
resCanceled,
resNilArgument,
resInvalidArgument,
resRegExpTooBig,
resOutOfSpace,
resCorruptedProgram,
resUnmatchedParenthesis,
resJunkOnEnd,
resStarPlusOperandCouldBeEmpty,
resNestedStarQuotePlus,
resInvalidEscape,
resInvalidPredefinedExp,
resUndefinedPredefinedExp,
resStackOverflow,
resInvalidSetRange,
resUnmatchedSquareBracket,
resInternalUrp,
resOperatorFollowsNothing,
resTrailingBackSlash,
resInternalDisaster,
resNoExpression,
resMemoryCorruption,
resCorruptedPointers,
resInternalFoulup,
resDuplicatedTaggedExp,
resInvalidTaggedExp,
resComplexBracesNotImplemented,
resInvalidBraces,
resLoopStackExceeded,
resLoopWithoutEntry
);
type
Str2 = String[2];
PStr2 = ^Str2;
Str3 = String[3];
PStr3 = ^Str3;
Str4 = String[4];
PStr4 = ^Str4;
Str5 = String[5];
PStr5 = ^Str5;
Str6 = String[6];
PStr6 = ^Str6;
Str8 = String[8];
PStr8 = ^Str8;
Str12 = String[12];
PStr12 = ^Str12;
Str40 = String[40];
PStr40 = ^Str40;
Str50 = String[50];
PStr50 = ^Str50;
PString = ^String;
PLongString = ^LongString;
LongString = AnsiString;
AsciiZ = packed array[0..255] of Char;
PCharSet = ^TCharSet;
TCharSet = set of Char;
TCommandSet = set of Byte;
PPalette = ^TPalette;
TPalette = String;
TMenuStr = String[81];
type
AInt = SmallInt;
AWord = SmallWord;
TSize = Comp;
PByteArray = ^TByteArray;
TByteArray = packed array[0..0] of Byte;
PWordArray = ^TWordArray;
TWordArray = packed array[0..0] of Word;
PAWordArray = ^TAWordArray;
TAWordArray = packed array[0..0] of AWord;
PIntegerArray = ^TIntegerArray;
TIntegerArray = packed array[0..0] of Integer;
PPointerArray = ^TPointerArray;
TPointerArray = packed array[0..0] of Pointer;
PPCharArray = ^TPCharArray;
TPCharArray = packed array[0..0] of PChar;
PVideoBuf = ^TVideoBuf;
TVideoBuf = packed array[0..3999] of AWord;
PDrawBuffer = ^TDrawBuffer;
TDrawBuffer = packed array[0..255] of AWord;
PByte = ^Byte;
PLongInt = ^LongInt;
PPointer = ^Pointer;
TSelectMode = (NormalSelect, EnterSelect, LeaveSelect);
TPhase = (phFocused, phPreProcess, phPostProcess);
type
PSItem = ^TSItem;
TSItem = packed record
Value: PString;
Next: PSItem;
end;
PStreamRec = ^TStreamRec;
TStreamRec = packed record
ObjType: Word;
VmtLink: Pointer;
Load: Pointer;
Store: Pointer;
Next: PStreamRec;
end;
PPoint = ^TPoint;
TPoint = object
X, Y: LongInt;
function Equals(P: TPoint): Boolean;
function EqualsXY(AX, AY: LongInt): Boolean;
procedure Assign(AX, AY: LongInt);
function isLE(P: TPoint): Boolean; {less then or equal}
function isGE(P: TPoint): Boolean; {great thean or equal}
end;
TRect = object
A, B: TPoint;
procedure Assign(XA, YA, XB, YB: LongInt);
procedure Copy(R: TRect);
procedure Move(ADX, ADY: LongInt);
procedure Grow(ADX, ADY: LongInt);
procedure Intersect(R: TRect);
procedure Union(R: TRect);
function Contains(P: TPoint): Boolean;
function Equals(R: TRect): Boolean;
function Empty: Boolean;
end;
PEvent = ^TEvent;
TEvent = packed record
What: Word;
case Word of
evNothing:
();
evMouse:
(
Buttons: Byte;
Double: Boolean;
Where: TPoint
);
evKeyDown:
(
case Integer of
0:
(KeyCode: Word);
1:
(
CharCode: Char;
ScanCode: Byte;
ShiftCode: Byte;
)
);
evMessage:
(
Command: Word;
case Word of
0:
(InfoPtr: Pointer);
1:
(InfoLong: LongInt);
2:
(InfoWord: Word);
3:
(InfoInt: Integer);
4:
(InfoByte: Byte);
5:
(InfoChar: Char)
);
end;
TEventTimer = packed record
StartTics: LongInt;
ExpireTics: LongInt;
end;
PMenu = ^TMenu;
PMenuItem = ^TMenuItem;
TMenuItem = packed record
Next: PMenuItem;
Name: PString;
Command: Word;
Flags: Byte;
KeyCode: Word;
HelpCtx: Word;
Param: PString;
SubMenu: PMenu;
end;
TMenu = packed record
Items: PMenuItem;
Default: PMenuItem;
end;
PStatusItem = ^TStatusItem;
TStatusItem = packed record
Next: PStatusItem;
Text: PString;
KeyCode: Word;
Command: Word;
end;
PStatusDef = ^TStatusDef;
TStatusDef = packed record
Next: PStatusDef;
Min, Max: Word;
Items: PStatusItem;
end;
{&Cdecl+}
THandleCommandProc = procedure (Command, ObjType: SmallWord;
const PluginName: ShortString; DNFuncs, DNMethods: Pointer;
var _Finalization: Pointer);
TFormatsCountProc = function : Word;
TArchiveSignProc = function (Id: Word): Str4;
TCreateArchiveObjectProc = function (Id: Word): Pointer;
TDetectCreateArchiveObjectProc = function : Pointer;
{&Cdecl-}
PEventCatcherInfo = ^TEventCatcherInfo;
TEventCatcherInfo = packed record
FirstCatchedCommand: Word;
LastCatchedCommand: Word;
FirstObjType: Word;
LastObjType: Word;
PluginPath: String[8];
Reserved: packed array[0..2] of Byte;
LibHandle: Integer;
Entry: THandleCommandProc;
end;
PEventCatcherArray = ^TEventCatcherArray;
TEventCatcherArray = packed array[1..1] of TEventCatcherInfo;
PArchiveViewerInfo = ^TArchiveViewerInfo;
TArchiveViewerInfo = packed record
FirstTag: Byte;
PluginPath: String[8];
Reserved: SmallWord;
LibHandle: Integer;
FormatsCount: TFormatsCountProc;
ArchiveSign: TArchiveSignProc;
CreateArchiveObject: TCreateArchiveObjectProc;
DetectCreateArchiveObject: TDetectCreateArchiveObjectProc;
end;
PArchiveViewerArray = ^TArchiveViewerArray;
TArchiveViewerArray = packed array[ArcFirst-1..arcLast+1] of
PArchiveViewerInfo;
TEditorEventHook = function (var Event: TEvent; Editor: Pointer)
: Boolean;
PFillColorsData = ^TFillColorsData;
TFillColorsData = packed record
DrawBuffer: Pointer;
StrNum, StartPos, EndPos: LongInt;
end;
PIndexArray = ^TIndexArray;
TIndexArray = packed array[0..65520 div SizeOf(LongInt)-1] of LongInt;
PIdxResource = ^TIdxResource;
TIdxResource = packed record
NotForYou1: Pointer;
NotForYou2: Boolean;
Stream: Pointer;
Index: PIndexArray;
Count: AInt;
end;
lSearchRec = packed record
Handle: LongInt;
NameLStr: Pointer;
Attr: Byte;
Time: LongInt;
Size: TSize;
Name: ShortString;
Filler: packed array[0..3] of Char;
{$IFDEF OS2}
//JO: ¨¬ ¨¥! à §¬¥à FindBuf ¤®«¦¥ ¡ëâì ᮣ« ᮢ á à §¬¥à®¬ «®£¨ç®©
// ¯¥à¥¬¥®© ¢ VpSysLo2.TOSSearchRecNew
FindBuf: array[0..8*1024-1] of Byte;
FindCount: Integer;
FindPtr: Pointer;
{$ENDIF}
{$IFDEF WIN32}
ShortName: ShortString;
ExcludeAttr: LongInt;
FindData: TWin32FindData;
{$ENDIF}
{$IFDEF DPMI32}
attr_must: Byte;
dos_dta: packed record
fill: packed array[1..21] of Byte;
Attr: Byte;
Time: LongInt;
Size: LongInt;
Name: packed array[0..12] of Char;
end;
{$ENDIF}
{$IFDEF LINUX}
FindDir: packed array[0..255] of Char;
FindName: ShortString;
FindAttr: LongInt;
{$ENDIF}
CreationTime: LongInt;
LastAccessTime: LongInt;
FullSize: TSize;
FullName: ShortString;
{$IFDEF OS2}
PrevName: ShortString;
{$ENDIF}
end;
TCRLF = (cfNone, cfCRLF, cfCR, cfLF);
PEditOptions = ^TEditOptions;
TEditOptions = packed record
AutoIndent: Boolean;
AutoBrackets: Boolean;
BackUnIndents: Boolean;
HiLite: Boolean;
HiliteLine: Boolean;
HiliteColumn: Boolean;
JustifyOnWrap: Boolean;
AutoWrap: Boolean;
LeftMargin: Word;
RightMargin: Word;
Paragraph: Word;
ForcedCRLF: TCRLF;
SmartTab: Boolean;
end;
TPosArray = packed array[1..9] of TPoint;
TKeyMap = (kmNone, kmAscii, kmAnsi, kmKoi8r);
TXlat = array[Char] of Char;
PHighliteParams = ^THighliteParams;
THighliteParams = packed record
GenFlags: Word;
HexFlags: Word;
DecFlags: Word;
OctFlagsQ: Word;
OctFlagsO: Word;
BinFlags: Word;
StrFlags: Word;
RulesBuffer: packed array[1..$800] of Char;
end;
PDiz = ^TDIZ;
TDIZ = packed record
Owner: PString;
DIZ: PString;
Line: LongInt;
isDisposable: Boolean;
end;
TUseLFN = {$IFDEF OS2}True {$ELSE}False {$ENDIF}..True;
TShortName = String[12];
TFlName = array[TUseLFN] of TShortName;
TDate4 = packed record
Minute, Hour, Day, Month: Byte;
end;
PFileRec = ^TFileRec;
TFileRec = packed record
Size: TSize;
PSize: TSize;
Owner: PString;
DIZ: PDiz;
Yr: Word;
YrCreat: Word;
YrLAcc: Word;
TType: Byte;
Attr: Word;
Second: Byte;
SecondCreat: Byte;
SecondLAcc: Byte;
Selected: Boolean;
UsageCount: Byte;
FDate, FDateCreat, FDateLAcc: LongInt;
FlName: TFlName;
// Dummy: array[1..SizeOf(ShortString)-SizeOf(TShortName)] of Char;
end;
TMakeListRec = packed record
FileName: String;
Header: String;
HeaderMode: Word;
Action: String;
Footer: String;
FooterMode: Word;
Options: Word;
end;
PUserParams = ^TUserParams;
tUserParams = packed record
Active, Passive: PFileRec;
ActiveList, PassiveList: String;
end;
TQuickSearchData = packed record
Mask: String;
NumExt: Word;
ExtD: Word;
end;
TDiskInfoRec = packed record
Title: PString;
Dir: PString;
Files: PString;
Free: PString;
Total: PString;
VolumeID: PString;
SerialNo: PString;
FileSys: PString;
DirInfo: Pointer {PCollection};
Limit: TPoint;
InfoFile: Byte;
end;
TDriveType = (dtUndefined, dtDisk, dtFind, dtTemp, dtList, dtArcFind,
dtArc, dtNet, dtLink, dtArvid);
TAvdType = (avdTdr, avdAvt);
TLineType = (ltNormal, ltFullScreen, ltWindow, ltTimer);
TTdrHeader = packed record
FileTableOfs: LongInt;
DirTableOfs: LongInt;
PosTableOfs: LongInt;
FileTableLen: LongInt;
DirTableLen: LongInt;
PosTableLen: LongInt;
TapeFmt: AWord;
TapeID: AWord;
TapeLen: AWord;
RecordLen: AWord;
NewRecordSector: LongInt;
DescTableOfs: LongInt;
Res01: array[1..16] of Byte;
DescTableLen: LongInt;
Res02: array[1..16] of Byte;
LastNewRecordSector: LongInt;
Res03: array[1..36] of Byte;
end;
TAvtHeader = packed record
signature: array[1..4] of Char;
AvtFmt: LongInt;
CheckSum: LongInt;
AfterLastCell: LongInt;
FreeCell: LongInt;
RootDirCell: LongInt;
NewSector: LongInt;
LastNewSector: LongInt;
AvtMediaCell: LongInt;
Undefined1: LongInt;
end;
PMenuStringsRet = ^TMenuStringsRet;
TMenuStringsRet = packed record
Reserved0: Integer;
Count: Byte;
Cacheable: Boolean;
Reserved1: SmallWord;
Strings1: PPCharArray;
Strings2: PPCharArray;
Keys: PIntegerArray;
Reserved2: Integer;
Reserved3: Integer;
Reserved4: Integer;
end;
implementation
function TPoint.Equals(P: TPoint): Boolean;
begin
Equals := (X = P.X) and (Y = P.Y);
end;
function TPoint.EqualsXY(AX, AY: LongInt): Boolean;
begin
EqualsXY := (X = AX) and (Y = AY);
end;
procedure TPoint.Assign(AX, AY: LongInt);
begin
X := AX;
Y := AY;
end;
function TPoint.isLE(P: TPoint): Boolean;
begin
isLE := (Y = P.Y) and (X <= P.X) or (Y < P.Y);
end;
function TPoint.isGE(P: TPoint): Boolean;
begin
isGE := (Y = P.Y) and (X >= P.X) or (Y > P.Y);
end;
procedure TRect.Assign(XA, YA, XB, YB: LongInt);
begin
A.X := XA;
A.Y := YA;
B.X := XB;
B.Y := YB;
end;
procedure TRect.Copy(R: TRect);
begin
A := R.A;
B := R.B;
end;
procedure TRect.Move(ADX, ADY: LongInt);
begin
Inc(A.X, ADX);
Inc(A.Y, ADY);
Inc(B.X, ADX);
Inc(B.Y, ADY);
end;
procedure TRect.Grow(ADX, ADY: LongInt);
begin
Dec(A.X, ADX);
Dec(A.Y, ADY);
Inc(B.X, ADX);
Inc(B.Y, ADY);
if (A.X >= B.X) or (A.Y >= B.Y) then
begin
A.X := 0;
A.Y := 0;
B.X := 0;
B.Y := 0;
end;
end;
procedure TRect.Intersect(R: TRect);
begin
if (R.A.X > A.X) then
A.X := R.A.X;
if (R.A.Y > A.Y) then
A.Y := R.A.Y;
if (R.B.X < B.X) then
B.X := R.B.X;
if (R.B.Y < B.Y) then
B.Y := R.B.Y;
if (A.X >= B.X) or (A.Y >= B.Y) then
begin
A.X := 0;
A.Y := 0;
B.X := 0;
B.Y := 0;
end;
end;
procedure TRect.Union(R: TRect);
begin
if (R.A.X < A.X) then
A.X := R.A.X;
if (R.A.Y < A.Y) then
A.Y := R.A.Y;
if (R.B.X > B.X) then
B.X := R.B.X;
if (R.B.Y > B.Y) then
B.Y := R.B.Y;
end;
function TRect.Contains(P: TPoint): Boolean;
begin
Contains := (P.X >= A.X) and (P.X < B.X) and
(P.Y >= A.Y) and (P.Y < B.Y);
end;
function TRect.Equals(R: TRect): Boolean;
begin
Equals := (A.X = R.A.X) and (A.Y = R.A.Y) and
(B.X = R.B.X) and (B.Y = R.B.Y);
end;
function TRect.Empty: Boolean;
begin
Empty := (A.X >= B.X) or (A.Y >= B.Y);
end;
end.