/
usimplegraph.pas
12396 lines (11424 loc) · 375 KB
/
usimplegraph.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
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
{------------------------------------------------------------------------------
TEvsSimpleGraph is a port of TSimpleGraph 2.8 to Freepascal and lazarus.
I have eliminated a number of properties and methods that I felt that have no
usefulnes other of perhaps eye candy. In no perticula order
TMemoryHandleStream -- used exclusively to copying from and to the clipboard\
NOT USED on lazarus.
TMetafile -- since metafile is windows specific I removed it from the code.
TEvsSimpleGraph.........................
GetAsMetafile -- no metafile class so this got booted.
Transparent -- removed the property there is no need for a transparent
graph editor.
WMWindowPosChanging -- it had transparent specific code only. Removed.
wmPaint -- Since the override does not really override the ancestor
methods there was no reason to keep it. the code in a form
or an other is still there and can be enabled with a define
I keep it as a testing ground when I try to find other ways
of doing things in a more cross platform way. For a release
software this should be removed.
WMPrint -- This uses a lot of code that has no binding in lclintf it
will be removed, and replaced by the print method.
print -- has to be tested it makes assumption about the Paint structure data
that are not true in freepascal. Since it uses Tcanvas to print
it should be easy to test.
TransformRgn -- Has no alternative outside windows. Needs to be replaced or removed.
This and the abilities the code is using can be replicated on QT and GTK2
but I do not see any support for them in lcl and I have to dig down to the api level.
QT4Pas does not surface the call to return the region rectangles so I am stack there
Need to ask for help on the forums/lists.
GTK2 headers probably have the required apis but I haven't spend to much
time looking at this point.
TGraphScrollBar -- Needs to eliminate all calls to flatSB api.
-- FlatSB api removed.
All scroll related bugshave been ironed out it should
work all 3 platforms.
-- On platforms Qt, GTK2 there is no autoscrolling when the mouse
reaches the screen edges I need to investigate why.
-- The scroll in to view does not work either. I need to check it.
Zooming -- zoom does not work.
although it has no meaningful usage inside the designer
it can be used to create an overview window and to stretch
a design for printing. Needs to be implemented in the
long run but I'm thinking on removing it for the 1st release.
-- Use the mouse wheel to zoom.
Background -- There are a number of problems with the background it
will be removed for the first version and be re enabled
after the first release. Make sure to support it on loading
from the original authors files discarding the contents.
HitTest -- Its used to select the mouse cursor to show the various
modes there are problems with the current implementation.
All problems solved except one GTK does not support ptInRegion
it always returns false. I need to either re-enable it my self
or file a bug report on the bug tracker.
-----------------------------------------------------------------------------------------------------------
ENHANCEMENTS
TGraphObjectList -- Change the behavior from an array based list to a double
linked list.
TGraphLayer -- Add support for layers
1) Maintain a seperate list of object on each layer.
2) Maintain a top/bottom index for the object in each layer.
3) Encapsulating the Graphlist inside each layer
changing simpleGraph to hold a list of layers only.
Requires to change the properties that access objects
by index and the count property.
Regions -- regions are here to stay. I'm not going to give up on
that speed for something else for now.
TextDraw -- Extend existing canvas with extra methods for text manipulation
make sure that they can be used for most widgsets.
Must support
-- Rotation : in any angle (floating point) around
any random center.
-- alignment : Any kind of alignment that windows support
including RTL placement.
-- Measurement : Retreive the most used measurements for
the selected font style and alignment.
eg rect, width, height etc of the formated
text. Even if that means it has to be rendered
on an invisible canvas and retrieve the
info from there.
Clipboard support for metafile images has been removed.
ORIGINAL AUTHOR
------------------------------------------------------------------------------
TSimpleGraph v2.80
by Kambiz R. Khojasteh
kambiz@delphiarea.com
http://www.delphiarea.com
------------------------------------------------------------------------------}
unit uSimpleGraph;
{$mode objfpc}
{.$MODE DELPHI}
{$RangeChecks off}
{$DEFINE DEBUG}
{$H+}
interface
//{$MESSAGE HINT|WARN|ERROR|FATAL 'text string' }. a small reminder.
//The following Define is for testing purposes to see what needs to be converted
//from windows specific code
{$IFDEF LCLWIN32}
{$DEFINE WIN}
{$ENDIF}
{.$DEFINE CANVAS_TEXTDRAW} //replace the api calls with canvas only calls
{$DEFINE SUBCLASS} // required for the scroll bars to work correctly.
{$IFDEF WIN}
{.$DEFINE METAFILE_SUPPORT}
{$DEFINE WIN_TRANSFORM} //required for windows it speeds things up considerably.
{$ENDIF}
uses
Classes, SysUtils, Types, Controls, Forms, Menus,
LMessages, LCLIntf, LCLType, LCLProc, GraphType, Graphics
{$IFDEF WIN } ,Windows {$ENDIF}
{$IFDEF DBGFRM } ,UFrmDebug {$ENDIF}
;
{%REGION Const}
const
// Custom Cursors
crHandFlat = 51;
crHandGrab = 52;
crHandPnt = 53;
crXHair1 = 54;
crXHair2 = 55;
crXHair3 = 56;
crXHairLink = 57;
// Default Graph Hit Test Flags
GHT_NOWHERE = $00000000;
GHT_TRANSPARENT = $00000001;
GHT_LEFT = $00000002;
GHT_TOP = $00000004;
GHT_RIGHT = $00000008;
GHT_BOTTOM = $00000010;
GHT_TOPLEFT = $00000020;
GHT_TOPRIGHT = $00000040;
GHT_BOTTOMLEFT = $00000080;
GHT_BOTTOMRIGHT = $00000100;
GHT_CLIENT = $00000200;
GHT_CAPTION = $00000400;
GHT_POINT = $00000800; // High word contains the point's index
GHT_LINE = $00001000; // High word contains the line's index
GHT_BODY_MASK = GHT_CLIENT or GHT_CAPTION;
GHT_SIDES_MASK = GHT_LEFT or GHT_TOP or GHT_RIGHT or GHT_BOTTOM or
GHT_TOPLEFT or GHT_TOPRIGHT or GHT_BOTTOMLEFT or
GHT_BOTTOMRIGHT;
{$IFDEF FPC}
ETO_RTLREADING = 128; //needed
{$ENDIF}
{%ENDREGION}
type
TEvsSimpleGraph = class;
TEvsGraphObjectList = class;
TEvsGraphObject = class;
TEvsGraphLink = class;
TEvsGraphNode = class;
TEvsGraphLayer = class;
TEvsGraphCanvas = class;
TCanvasClass = class of TCanvas;
TControlCanvasClass = class of TControlCanvas;
TPoints = array of TPoint;
EEvsGraphStreamError = class(EStreamError);
EEvsGraphInvalidOperation = class(EInvalidOperation);
EEvsPointListError = class(EListError);
EEvsSimpleGraphException = class(Exception);
TGridSize = 4..128;
TMarkerSize = 3..9;
TZoom = 5..36863;
TEvsObjectSide = (osLeft, osTop, osRight, osBottom);
TEvsObjectSides = set of TEvsObjectSide;
TEvsGraphObjectListAction = (glAdded, glRemoved, glReordered);
TEvsGraphObjectListEvent = procedure(Sender: TObject; GraphObject: TEvsGraphObject;
Action: TEvsGraphObjectListAction) of object;
TListEnumState = record
Current : integer;
Dir : integer;
end;
{$IFDEF FPC}
TWMPrint = packed record
Msg: Cardinal;
DC: HDC;
Flags: Cardinal;
Result: Integer;
end;
TWMPrintClient = TWMPrint;
{$ENDIF}
{$IFNDEF WIN}
{$MESSAGE WARN 'Region Specific structures copied from windows unit'}
XFORM = record
eM11 : Single;
eM12 : Single;
eM21 : Single;
eM22 : Single;
eDx : Single;
eDy : Single;
end;
LPXFORM = ^XFORM;
_XFORM = XFORM;
TXFORM = XFORM;
PXFORM = ^XFORM;
{$ENDIF}
TRotationAngle = -36000..36000;
{ IEvsTransformable }
IEvsTransformable = interface
['{A74B6CBE-CF84-49F6-8096-009E241795C1}']
//function GetAngle :TAngle;
Function GetOffsetX :Single;
Function GetOffsetY :Single;
Function GetScaleX :Single;
Function GetScaleY :Single;
function GetXForm :TXForm;
//procedure SetAngle (aValue :TAngle);
Procedure SetOffsetX(aValue :Single);
Procedure SetOffsetY(aValue :Single);
Procedure SetScaleX (aValue :Single);
Procedure SetScaleY (aValue :Single);
Function DPToLP(const aPoint:TPoint) :TPoint;
Function LPToDP(const aPoint:TPoint) :TPoint;
procedure SetXForm(aValue :TXForm);
Property OffsetX :Single read GetOffsetX write SetOffsetX;
Property OffsetY :Single read GetOffsetY write SetOffsetY;
Property ScaleX :Single read GetScaleX write SetScaleX;
Property ScaleY :Single read GetScaleY write SetScaleY;
property XForm :TXForm read GetXForm write SetXForm;
//Property Ange :TAngle read GetAngle write SetAngle; // in degrees (-360.00..360.00).
end;
TEvsGraphObjectState =(osCreating, osDestroying, osLoading, osReading, osWriting, osUpdating, osDragging, osDragDisabled, osConverting );
TEvsGraphObjectStates = set of TEvsGraphObjectState;
TEvsGraphChangeFlag = (gcView, gcData, gcText, gcPlacement, gcDependency);
TEvsGraphChangeFlags = set of TEvsGraphChangeFlag;
TEvsGraphDependencyChangeFlag = (gdcChanged, gdcRemoved);
TEvsGraphObjectOption = (goLinkable, goSelectable, goShowCaption);
TEvsGraphObjectOptions = set of TEvsGraphObjectOption;
TEvsGraphLinkOption = (gloFixedStartPoint, gloFixedEndPoint, gloFixedBreakPoints, gloFixedAnchorStartPoint, gloFixedAnchorEndPoint);
TEvsGraphLinkOptions = set of TEvsGraphLinkOption;
TEvsLinkBeginEndStyle = (lsNone, lsArrow, lsArrowSimple, lsCircle, lsDiamond);
TEvsLinkNormalizeOptions = set of (lnoDeleteSamePoint, lnoDeleteSameAngle);
TEvsLinkChangeMode = (lcmNone, lcmInsertPoint, lcmRemovePoint, lcmMovePoint, lcmMovePolyline);
TEvsGraphNodeOption = (gnoMovable, gnoResizable, gnoShowBackground);
TEvsGraphNodeOptions = set of TEvsGraphNodeOption;
TEvsGraphBoundsKind = (bkGraph, bkSelected, bkDragging);
TEvsGraphCommandMode = (cmViewOnly, cmPan, cmEdit, cmInsertNode, cmInsertLink);
TEvsGraphDrawOrder = (doDefault, doNodesOnTop, doLinksOnTop);
TEvsGraphClipboardFormat = (cfNative, cfMetafile, cfBitmap);
TEvsGraphClipboardFormats = set of TEvsGraphClipboardFormat;
TEvsGraphZoomOrigin = (zoTopLeft, zoCenter, zoCursor, zoCursorCenter);
TEvsHAlignOption = (haNoChange, haLeft, haCenter, haRight, haSpaceEqually);
TEvsVAlignOption = (vaNoChange, vaTop, vaCenter, vaBottom, vaSpaceEqually);
TEvsResizeOption = (roNoChange, roSmallest, roLargest);
TEvsGraphNotifyEvent = procedure(Graph: TEvsSimpleGraph; GraphObject: TEvsGraphObject) of object;
TEvsGraphContextPopupEvent = procedure(Graph: TEvsSimpleGraph; GraphObject: TEvsGraphObject;
const MousePos: TPoint; var Handled: boolean) of object;
TEvsGraphDrawEvent = procedure(Graph: TEvsSimpleGraph; Canvas: TCanvas) of object;
TEvsGraphObjectDrawEvent = procedure(Graph: TEvsSimpleGraph; GraphObject: TEvsGraphObject;
Canvas: TCanvas) of object;
TEvsGraphInfoTipEvent = procedure(Graph: TEvsSimpleGraph; GraphObject: TEvsGraphObject;
var InfoTip: string) of object;
TEvsGraphHookEvent = procedure(Graph: TEvsSimpleGraph; GraphObject: TEvsGraphObject;
Link: TEvsGraphLink; Index: integer) of object;
TEvsGraphCanHookEvent = procedure(Graph: TEvsSimpleGraph; GraphObject: TEvsGraphObject;
Link: TEvsGraphLink; Index: integer; var CanHook: boolean) of object;
TEvsGraphCanLinkEvent = procedure(Graph: TEvsSimpleGraph; Link: TEvsGraphLink;
Source, Target: TEvsGraphObject; var CanLink: boolean) of object;
TEvsCanMoveResizeNodeEvent = procedure(Graph: TEvsSimpleGraph; Node: TEvsGraphNode;
var NewLeft, NewTop, NewWidth, NewHeight: integer;
var CanMove, CanResize: boolean) of object;
TEvsGraphNodeResizeEvent = procedure(Graph: TEvsSimpleGraph; Node: TEvsGraphNode) of object;
TEvsGraphCanRemoveEvent = procedure(Graph: TEvsSimpleGraph; GraphObject: TEvsGraphObject;
var CanRemove: boolean) of object;
TEvsGraphBeginDragEvent = procedure(Graph: TEvsSimpleGraph; GraphObject: TEvsGraphObject;
HT: DWORD) of object;
TEvsGraphEndDragEvent = procedure(Graph: TEvsSimpleGraph; GraphObject: TEvsGraphObject;
HT: DWORD; Cancelled: boolean) of object;
TEvsGraphStreamEvent = procedure(Graph: TEvsSimpleGraph; GraphObject: TEvsGraphObject;
Stream: TStream) of object;
TEvsGraphForEachMethod = function(GraphObject: TEvsGraphObject;
UserData: integer): boolean of object;
TEvsGraphObjectClass = class of TEvsGraphObject;
TEvsGraphNodeClass = class of TEvsGraphNode;
TEvsGraphLinkClass = class of TEvsGraphLink;
TEvsGraphLayerClass = class of TEvsGraphLayer;
TEvsGraphCanvasClass = class of TEvsGraphCanvas;
TEvsCanvasRecall = class(TObject)
private
FPen :TPen;
FFont :TFont;
FBrush :TBrush;
FCopyMode :TCopyMode;
FTextFlags :TTextStyle;
FReference :TCanvas;
procedure SetReference(Value: TCanvas);
public
constructor Create(AReference: TCanvas);
destructor Destroy; override;
procedure Store;
procedure Retrieve;
property Reference: TCanvas read fReference write SetReference;
end;
{ TEvsPenRecall }
TEvsPenRecall = class
private
FBackup : TPen;
FReference : TPen;
procedure SetReference(aValue:TPen);
public
constructor Create(AReference: TPen);
destructor Destroy; override;
procedure Store;
procedure Retrieve;
property Reference: TPen read fReference write SetReference;
end;
{ TEvsBrushRecall }
TEvsBrushRecall = class
private
FBackup : TBrush;
FReference : TBrush;
procedure SetReference(aValue : TBrush);
public
constructor Create(AReference: TBrush);
destructor Destroy; override;
procedure Store;
procedure Retrieve;
property Reference: TBrush read fReference write SetReference;
end;
{ TEvsCompatibleCanvas }
TEvsCompatibleCanvas = class(TCanvas)
public
constructor Create;
destructor Destroy; override;
end;
TEvsGraphStreamableObject = class(TComponent)
private
FID: DWORD;
FG: TEvsGraphObject;
FDummy: integer;
published
property ID: DWORD read fID write fID;
property G: TEvsGraphObject read fG write fG stored True;
property Left: integer read fDummy write fDummy stored False;
property Top: integer read fDummy write fDummy stored False;
property Tag stored False;
property Name stored False;
end;
{ TEvsCustomCanvas }
TEvsCustomCanvas = class(TCanvas)
private
FOffsetX : Double;
FOffsetY : Double;
FScaleX : Double;
FScaleY : Double;
procedure SetOffsetX(aValue : Double);
procedure SetOffsetY(aValue : Double);
procedure SetScaleX (aValue : Double);
procedure SetScaleY (aValue : Double);
protected
// Those two procedures do not get the translated coordinates if overriden
// must be translated before doing any drawing.
procedure DoMoveTo(x, y : integer); override;
procedure DoLine(x1, y1, x2, y2 : integer); override;
procedure DoArc(ALeft, ATop, ARight, ABottom, Angle16Deg, Angle16DegLength: Integer); virtual;
procedure DoArc(ALeft, ATop, ARight, ABottom, SX, SY, EX, EY: Integer); virtual;
procedure DoBrushCopy (ADestRect: TRect; ABitmap: Graphics.TBitmap; ASourceRect: TRect; ATransparentColor: TColor); virtual;
procedure DoChord (X1, Y1, X2, Y2, Angle16Deg, Angle16DegLength: Integer); virtual;overload;
procedure DoChord (X1, Y1, X2, Y2, SX, SY, EX, EY: Integer); virtual;overload;
procedure DoCopyRect (const Dest: TRect; SrcCanvas: TCanvas; const Source: TRect); virtual;
procedure DoDraw (X,Y: Integer; SrcGraphic: TGraphic); virtual;
procedure DoDrawFocusRect(const ARect: TRect); virtual;
procedure DoStretchDraw (const DestRect: TRect; SrcGraphic: TGraphic); virtual;
procedure DoEllipse (x1, y1, x2, y2: Integer); virtual;
procedure DoFillRect (const ARect: TRect); virtual;
procedure DoFloodFill (X, Y: Integer; FillColor: TColor; FillStyle: TFillStyle); virtual;
procedure DoFrame3d (var ARect: TRect; const FrameWidth: integer; const Style: TGraphicsBevelCut); virtual;
procedure DoFrame (const ARect: TRect); virtual;
procedure DoFrameRect (const ARect: TRect); virtual;
procedure DoGradientFill (ARect: TRect; AStart, AStop: TColor; ADirection: TGradientDirection); virtual;
procedure DoRadialPie (X1, Y1, X2, Y2, StartAngle16Deg, Angle16DegLength: Integer); override;
procedure DoPie (EllipseX1,EllipseY1,EllipseX2,EllipseY2,StartX,StartY,EndX,EndY: Integer); virtual;
procedure DoRectangle (X1,Y1,X2,Y2: Integer); virtual;
procedure DoRoundRect (X1, Y1, X2, Y2: Integer; RX,RY: Integer); virtual;
procedure DoTextOut (X,Y: Integer; const Text: String); virtual;
procedure DoTextRect (ARect: TRect; X, Y: integer; const Text: string;const Style: TTextStyle); virtual;
procedure DoPolyBezier(Points: PPoint; NumPts: Integer; Filled : boolean = False;Continuous: boolean = False); override;
procedure DoPolygon (Points: PPoint; NumPts: Integer; Winding: boolean = False); virtual;
procedure DoPolyline (Points: PPoint; NumPts: Integer); virtual;
procedure TranslateCoordinates(var InCoords : Array of TPOINT); virtual; overload;
procedure TranslateCoordinates(var InCoords : PPOINT; NumPoints:Integer); virtual; overload;
public
procedure Arc (ALeft, ATop, ARight, ABottom, Angle16Deg, Angle16DegLength: Integer); override;
procedure Arc (ALeft, ATop, ARight, ABottom, SX, SY, EX, EY: Integer); override;
procedure BrushCopy (ADestRect: TRect; ABitmap: Graphics.TBitmap; ASourceRect: TRect; ATransparentColor: TColor); override;
procedure Chord (x1, y1, x2, y2, Angle16Deg, Angle16DegLength: Integer); override;
procedure Chord (x1, y1, x2, y2, SX, SY, EX, EY: Integer); override;
procedure CopyRect (const Dest: TRect; SrcCanvas: TCanvas; const Source: TRect); override;
procedure Draw (X,Y: Integer; SrcGraphic: TGraphic); override;
procedure DrawFocusRect(const ARect: TRect); override;
procedure StretchDraw (const DestRect: TRect; SrcGraphic: TGraphic); override;
procedure Ellipse (x1, y1, x2, y2: Integer); override;
procedure FillRect (const ARect: TRect); override;
procedure FloodFill (X, Y: Integer; FillColor: TColor; FillStyle: TFillStyle); override;
procedure Frame3d (var ARect: TRect; const FrameWidth: integer; const Style: TGraphicsBevelCut); override;
procedure Frame (const ARect: TRect); override;
procedure FrameRect (const ARect: TRect); override;
procedure GradientFill (ARect: TRect; AStart, AStop: TColor; ADirection: TGradientDirection);
procedure RadialPie (x1, y1, x2, y2, StartAngle16Deg, Angle16DegLength: Integer); override;
procedure Pie (EllipseX1,EllipseY1,EllipseX2,EllipseY2,StartX,StartY,EndX,EndY: Integer); override;
procedure Rectangle (X1,Y1,X2,Y2: Integer); override;
procedure RoundRect (X1, Y1, X2, Y2: Integer; RX,RY: Integer); override;
procedure TextOut (X,Y: Integer; const Text: String); override;
procedure TextRect (ARect: TRect; X, Y: integer; const Text: string;const Style: TTextStyle); override;
procedure PolyBezier(Points: PPoint; NumPts: Integer; Filled : boolean = False;Continuous: boolean = False); override;
procedure Polygon (Points: PPoint; NumPts: Integer; Winding: boolean = False); override;
procedure Polyline (Points: PPoint; NumPts: Integer); override;
function DPToLP (const aPoint:TPoint):TPoint; virtual;
function LPToDP (const aPoint :TPoint):TPoint; virtual;
public
constructor Create; virtual;
procedure Assign(Source :TPersistent); override;
procedure SetTransformation(XScale, YScale, DX, DY : Double); virtual;
procedure ClearTransformation; virtual;
public
property OffsetX : Double read FOffsetX write SetOffsetX;
property OffsetY : Double read FOffsetY write SetOffsetY;
property ScaleX : Double read FScaleX write SetScaleX;
property ScaleY : Double read FScaleY write SetScaleY;
end;
//{$INTERFACE CORBA}
//IEvsCoordinateTranslation = interface
// ['{D173501F-C8D5-4FE6-80DE-1F0FF958BB37}']
// procedure SetOffset(constref aOffSetX:Double; constref aOffSetY:Double);
// procedure SetScale(constref aScaleX:Double; constref aScaleY:Double);
//end;
//
TEvsCustomCanvasClass = class of TEvsCustomCanvas;
{ TEvsGraphCanvas }
TEvsGraphCanvas = class(TControlCanvas) //add extra functionality to existing canvas and use different renderers as well eg(GDI+)
private
FOffsetX :Double;
FOffsetY :Double;
FScaleX :Double;
FScaleY :Double;
procedure SetOffsetX(aValue :Double);
procedure SetOffsetY(aValue :Double);
procedure SetScaleX (aValue :Double);
procedure SetScaleY (aValue :Double);
protected
procedure TranslateCoordinates(var InCoords :Array of TPOINT); virtual; overload;
procedure TranslateCoordinates(var InCoords :PPOINT; NumPoints :Integer); virtual; overload;
//function TranslatePoints(const InCoords :PPOINT; aNumPts :Integer):PPOINT;
procedure DoMoveTo(x, y :Integer); override;
procedure DoLineTo(x, y :Integer); override;
procedure DoLine(x1, y1, x2, y2 :Integer); override;
procedure ReplaceCanvas(const aControl :TCustomControl);
public
procedure Arc (ALeft, ATop, ARight, ABottom, Angle16Deg, Angle16DegLength :Integer); override;
procedure Arc (ALeft, ATop, ARight, ABottom, SX, SY, EX, EY: Integer); override;
procedure BrushCopy (ADestRect :TRect; ABitmap :Graphics.TBitmap; ASourceRect :TRect; ATransparentColor :TColor); override;
procedure Chord (x1, y1, x2, y2, Angle16Deg, Angle16DegLength :Integer); override;
procedure Chord (x1, y1, x2, y2, SX, SY, EX, EY :Integer); override;
procedure CopyRect (const Dest :TRect; SrcCanvas :TCanvas; const Source :TRect); override;
procedure Draw (X,Y :Integer; SrcGraphic :TGraphic); override;
procedure DrawFocusRect(const ARect :TRect); override;
procedure StretchDraw (const DestRect :TRect; SrcGraphic :TGraphic); override;
procedure Ellipse (x1, y1, x2, y2 :Integer); override;
procedure FillRect (const ARect :TRect); override;
procedure FloodFill (X, Y :Integer; FillColor :TColor; FillStyle :TFillStyle); override;
procedure Frame3d (var ARect: TRect; const FrameWidth: integer; const Style :TGraphicsBevelCut); override;
procedure Frame (const ARect :TRect); override;
procedure FrameRect (const ARect :TRect); override;
procedure GradientFill (ARect :TRect; AStart, AStop :TColor; ADirection :TGradientDirection);
procedure RadialPie (x1, y1, x2, y2, StartAngle16Deg, Angle16DegLength :Integer); override;
procedure Pie (EllipseX1,EllipseY1,EllipseX2,EllipseY2,StartX,StartY,EndX,EndY :Integer); override;
procedure Rectangle (X1,Y1,X2,Y2 :Integer); override;
procedure RoundRect (X1, Y1, X2, Y2 :Integer; RX,RY :Integer); override;
procedure TextOut (X,Y :Integer; const Text :String); override;
procedure TextRect (aRect :TRect; X, Y :Integer; const Text :String;const Style :TTextStyle); override;
procedure PolyBezier(Points :PPoint; NumPts :Integer; Filled :Boolean = False; Continuous :Boolean = False); override;
procedure Polygon (Points :PPoint; NumPts :Integer; Winding :Boolean = False); override;
procedure Polyline (Points :PPoint; NumPts :Integer); override;
procedure CLtoGP(var Points :Array of TPoint);{$IFNDEF DEBUG}inline;{$ENDIF}//to model coordinates
procedure GPtoCL(var Points :Array of TPoint);{$IFNDEF DEBUG}inline;{$ENDIF}//to logical coordinates
public
constructor Create; virtual; overload;
constructor Create(aCanvas :TCanvas); Virtual; overload;
constructor Create(aControl:TControl); Virtual; overload;
procedure Assign(Source :TPersistent); override;
property OffsetX :Double read FOffsetX write SetOffsetX;
property OffsetY :Double read FOffsetY write SetOffsetY;
property ScaleX :Double read FScaleX write SetScaleX;
property ScaleY :Double read FScaleY write SetScaleY;
end;
{ TEvsGraphLayer }
// a layer keeps track only the top, bottom indexies in the graphlist
TEvsGraphLayer = class(TPersistent) //under heavy construction.
private
FBottom,
FTop :Integer;
FTitle :String;
FName :String;
FID :Integer;
FLocked :Boolean;
FPrintable :Boolean;
FVisible :Boolean;
function GetCount: Integer;
procedure SetID(AValue :Integer);
procedure SetLocked(AValue :Boolean);
procedure SetPrintable(AValue :Boolean);
procedure SetTitle(aValue :String);
procedure SetVisible(AValue :Boolean);
protected
function CanAdd (const aObject :TEvsGraphObject):Boolean;
function CanRemove(const aObject :TEvsGraphObject):Boolean;
procedure SlideUp (Count :Integer);
procedure SlideDown(Count :Integer);
function Add(Const aObject :TEvsGraphObject):Integer;//-1 unable to add, >-1 the object's new ZOrder
procedure Remove(const OldZOrder, NewZOrder :Integer);
property Top :Integer read FTOP;
property Bottom :Integer read FBottom;
property Count :Integer read GetCount;
property Name :String read FName write FName;
public
property ID :Integer read FID write SetID;
Property Title :string read FTitle write SetTitle;
property Locked :Boolean read FLocked write SetLocked;
Property Printable :Boolean read FPrintable write SetPrintable;
Property Visible :Boolean read FVisible write SetVisible;
end;
{ TEvsGraphLayerList }
TEvsGraphLayerList = class
strict private
FList : TFPList;
FLastID: QWord;
function GetCount: Integer;
function GetLayer(Index: Integer): TEvsGraphLayer;
protected
procedure PackIDs;
function UniqueName(const prefix :String):String;
function ByID(const aID:integer):TEvsGraphLayer;
function ByName(const aName:String):TEvsGraphLayer;
public
constructor Create;
destructor Destroy; override;
procedure Clear;
function New:TEvsGraphLayer;
function Delete(Index :Integer):Boolean; overload;
function Delete(Layer :TEvsGraphLayer):Boolean; overload;
property Count:Integer read GetCount;
property Layers[Index :Integer]:TEvsGraphLayer read GetLayer;
end;
TEvsGraphScrollBar = class(TPersistent) //NEEDS WORK ON 3 METHODS
private
fOwner :TEvsSimpleGraph;
fIncrement :TScrollBarInc;
fPageIncrement :TScrollBarInc;
fPosition :Integer;
fRange :Integer;
fCalcRange :Integer;
fKind :TScrollBarKind;
fMargin :Word;
fVisible :Boolean;
fTracking :Boolean;
fSmooth :Boolean;
fDelay :Integer;
fButtonSize :Integer;
fColor :TColor;
fParentColor :Boolean;
fSize :Integer;
fStyle :TScrollBarStyle;
fThumbSize :Integer;
fPageDiv :Integer;
fLineDiv :Integer;
fUpdateNeeded :Boolean;
FLastMsgPos :Integer;
procedure DoSetRange(Value: Integer);
function InternalGetScrollPos: integer;
procedure SetButtonSize(AValue: integer);
procedure SetColor(AValue: TColor);
procedure SetParentColor(Value: boolean);
procedure SetPosition(AValue: Integer);
procedure SetSize(Value: integer); //NEEDS WORK
procedure SetStyle(Value: TScrollBarStyle);
procedure SetThumbSize(Value: integer);
procedure SetVisible(AValue: boolean);
function IsIncrementStored: boolean;
protected
constructor Create(AOwner: TEvsSimpleGraph; AKind: TScrollBarKind);
function ControlSize(ControlSB, AssumeSB: Boolean): Integer;
procedure CalcAutoRange;
procedure Update(ControlSB, AssumeSB: Boolean); //NEEDS WORK
function NeedsScrollBarVisible: Boolean;
procedure ScrollMessage(var Msg: TLMScroll);
public
procedure Assign(Source: TPersistent); override;
procedure ChangeBiDiPosition;
function IsScrollBarVisible: boolean; //NEEDS WORK
property Kind: TScrollBarKind read fKind;
property ScrollPos: integer read InternalGetScrollPos;
property Range: integer read fRange;
property Owner: TEvsSimpleGraph read fOwner;
published
property Position :Integer read fPosition write SetPosition default 0;
property Margin :Word read fMargin write fMargin default 0;
property ButtonSize :integer read fButtonSize write SetButtonSize default 0;
property Color :TColor read fColor write SetColor default clBtnHighlight;
property Increment :TScrollBarInc read fIncrement write fIncrement stored IsIncrementStored default 8;
property ParentColor :boolean read fParentColor write SetParentColor default True;
property Smooth :boolean read fSmooth write fSmooth default False; //JKOZ SMOOTH
property Size :integer read fSize write SetSize default 0;
property Style :TScrollBarStyle read fStyle write SetStyle default ssRegular;
property ThumbSize :integer read fThumbSize write SetThumbSize default 0;
property Tracking :boolean read fTracking write fTracking default False;
property Visible :boolean read fVisible write SetVisible default True;
end;
TEvsGraphObjectListEnumerator = class
private
FGraphList :TEvsGraphObjectList;
FBaseClass :TEvsGraphObjectClass;
FPosition :Integer;
FReverse :Boolean;
protected
procedure Reset;
public
constructor Create(aList: TEvsGraphObjectList);
function Filter(const aBaseClass:TEvsGraphObjectClass):TEvsGraphObjectListEnumerator;
function GetCurrent :TEvsGraphObject;
function MoveNext :Boolean;
function GetEnumerator :TEvsGraphObjectListEnumerator;
function Reverse :TEvsGraphObjectListEnumerator;
property Current :TEvsGraphObject read GetCurrent;
end;
TEvsGraphObjectList = class(TPersistent)
private
FItems :Array of TEvsGraphObject;
FCount :Integer;
FCapacity :Integer;
FOnChange :TEvsGraphObjectListEvent;
FEnum :TListEnumState;
FEnumStack :Array of TListEnumState;
FEnumStackPos :Integer;
procedure SetCapacity(Value :Integer);
function GetItems(Index :Integer): TEvsGraphObject;
protected
procedure Grow;
function Replace(OldItem, NewItem :TEvsGraphObject) :Integer;
procedure AdjustDeleted(Index :Integer; var EnumState :TListEnumState);
procedure NotifyAction(Item :TEvsGraphObject; Action :TEvsGraphObjectListAction); virtual;
public
destructor Destroy; override;
procedure Clear;
function GetEnumerator :TEvsGraphObjectListEnumerator;
function GetReverseEnumerator :TEvsGraphObjectListEnumerator;
procedure Assign(Source :TPersistent); override;
function Add(Item :TEvsGraphObject) :Integer;
procedure Insert(Index :Integer; Item :TEvsGraphObject);
procedure Delete(Index :Integer);
function Remove(Item :TEvsGraphObject) :Integer;
procedure Move(CurIndex, NewIndex :Integer);
function IndexOf(Item :TEvsGraphObject) :Integer;
function First :TEvsGraphObject;
function Prior :TEvsGraphObject;
function Next :TEvsGraphObject;
function Last :TEvsGraphObject;
function Push :Boolean;
function Pop :Boolean;
property Count :Integer read FCount;
property Capacity:Integer read FCapacity write SetCapacity;
property Items[Index: integer]: TEvsGraphObject read GetItems; default;
property OnChange: TEvsGraphObjectListEvent read FOnChange write fOnChange;
end;
{ TEvsGraphObject }
TEvsGraphObject = class(TPersistent)
private
FID :DWord;
FOwner :TEvsSimpleGraph;
FBrush :TBrush;
FPen :TPen;
FText :String;
FHint :String;
FFont :TFont;
FParentFont :Boolean;
FOptions :TEvsGraphObjectOptions;
FVisible :Boolean;
FSelected :Boolean;
FStates :TEvsGraphObjectStates;
FDependentList :TEvsGraphObjectList;
FLinkInputList :TEvsGraphObjectList;
FLinkOutputList :TEvsGraphObjectList;
FTextToShow :String;
FTag :Integer;
FData :Pointer;
FHasCustomData :Boolean;
FVisualRect :TRect;
FVisualRectFlags :TEvsGraphChangeFlags;
UpdateCount :Integer;
PendingChanges :TEvsGraphChangeFlags;
DragDisableCount :Integer;
function GetLayer :TEvsGraphLayer;
function GetOwnerZoomFactor :Double;
procedure SetBrush(Value :TBrush);
procedure SetLayer(aValue :TEvsGraphLayer);
procedure SetPen (Value :TPen);
procedure SetText (const Value :String);
procedure SetHint (const Value :String);
procedure SetFont (Value :TFont);
procedure SetParentFont(Value :Boolean);
procedure SetVisible (Value :Boolean);
procedure SetSelected (Value :Boolean);
function GetZOrder: Integer;
procedure SetZOrder (Value :Integer);
procedure SetOptions(Value :TEvsGraphObjectOptions);
procedure SetHasCustomData(Value :Boolean);
function GetShowing :Boolean;
function GetDragging :Boolean;
function GetDependents (Index :Integer): TEvsGraphObject;
function GetLinkInputs (Index :Integer): TEvsGraphLink;
function GetLinkOutputs(Index :Integer): TEvsGraphLink;
function GetDependentCount :Integer;
function GetLinkInputCount :Integer;
function GetLinkOutputCount :Integer;
function IsFontStored :Boolean;
procedure ListChanged (Sender :TObject; GraphObject :TEvsGraphObject; Action :TEvsGraphObjectListAction);
procedure ReadCustomData (Stream :TStream);
procedure WriteCustomData(Stream :TStream);
protected
constructor CreateAsReplacement(AGraphObject :TEvsGraphObject); virtual;
constructor CreateFromStream(AOwner :TEvsSimpleGraph; AStream :TStream); virtual;
function GetOwner: TPersistent; override;
procedure DefineProperties(Filer :TFiler); override;
procedure Initialize; virtual;
procedure Loaded; virtual;
{$IFDEF DEBUG}
Public
{$ENDIF}
procedure ReplaceID(OldID, NewID: DWORD; const aStart:Integer =0); virtual;
{$IFDEF DEBUG}
protected
{$ENDIF}
procedure ReplaceObject(OldObject, NewObject :TEvsGraphObject); virtual;
procedure NotifyDependents(Flag :TEvsGraphDependencyChangeFlag); virtual;
procedure LookupDependencies; virtual;
procedure UpdateDependencies; virtual;
procedure UpdateDependencyTo(GraphObject :TEvsGraphObject;Flag :TEvsGraphDependencyChangeFlag); virtual;
function UpdateTextPlacement(Recalc :Boolean; dX, dY :Integer): Boolean; virtual;
procedure Changed(Flags :TEvsGraphChangeFlags); virtual;
procedure BoundsChanged(dX, dY, dCX, dCY :Integer); virtual;
procedure DependentChanged (GraphObject :TEvsGraphObject;Action :TEvsGraphObjectListAction); virtual;
procedure LinkInputChanged (GraphObject :TEvsGraphObject;Action :TEvsGraphObjectListAction); virtual;
procedure LinkOutputChanged(GraphObject :TEvsGraphObject;Action :TEvsGraphObjectListAction); virtual;
procedure ParentFontChanged; virtual;
function IsUpdateLocked: Boolean; virtual;
function NeighborhoodRadius: Integer; virtual;
function FixHookAnchor: TPoint; virtual; abstract;
function RelativeHookAnchor(RefPt :TPoint): TPoint; virtual; abstract;
procedure DrawControlPoint (aCanvas :TCanvas; const aPoint :TPoint; Enabled :Boolean); virtual;
procedure DrawControlPoints (aCanvas :TCanvas); virtual; abstract;
procedure DrawHighlight(aCanvas :TCanvas); virtual; abstract;
procedure DrawText (aCanvas :TCanvas); virtual; abstract;
procedure DrawBody (aCanvas :TCanvas); virtual; abstract;
procedure Draw (aCanvas :TCanvas); virtual;
procedure DrawState (aCanvas :TCanvas); virtual;
function IsVisibleOn(aCanvas :TCanvas): boolean; virtual;
procedure QueryVisualRect(out aRect :TRect); virtual; abstract;
function QueryHitTest(const aPoint :TPoint): DWORD; virtual;
function QueryCursor(HT :DWORD): TCursor; virtual;
function QueryMobility(HT :DWORD): TEvsObjectSides; virtual;
function OffsetHitTest(HT :DWORD; dX, dY :Integer): Boolean; virtual;
procedure SnapHitTestOffset(HT :DWORD; var dX, dY :Integer); virtual;
function BeginFollowDrag(HT :DWORD): Boolean; virtual;
function EndFollowDrag: Boolean; virtual;
procedure DisableDrag; virtual;
procedure EnableDrag; virtual;
procedure StyleChanged(Sender :TObject);
procedure MoveBy(dX, dY :Integer); virtual; abstract;
procedure MouseDown(Button :TMouseButton; Shift :TShiftState;const Pt :TPoint); virtual;
procedure MouseMove(Shift :TShiftState; const Pt :TPoint); virtual;
procedure MouseUp(Button :TMouseButton; Shift :TShiftState; const Pt :TPoint); virtual;
function KeyPress(var Key :Word; Shift :TShiftState): Boolean; virtual;
procedure SetBoundsRect(const Rect :TRect); virtual; abstract;
function GetBoundsRect: TRect; virtual; abstract;
function GetSelectedVisualRect: TRect; virtual;
protected
property TextToShow :String read FTextToShow write FTextToShow;
property DependentList :TEvsGraphObjectList read FDependentList;
property LinkInputList :TEvsGraphObjectList read FLinkInputList;
property LinkOutputList :TEvsGraphObjectList read FLinkOutputList;
property VisualRectFlags :TEvsGraphChangeFlags read FVisualRectFlags write FVisualRectFlags;
property ParentZoomFactor :Double read GetOwnerZoomFactor;
property Layer :TEvsGraphLayer read GetLayer write SetLayer;
public
constructor Create(AOwner: TEvsSimpleGraph); virtual;
destructor Destroy; override;
procedure AfterConstruction; override;
procedure BeforeDestruction; override;
procedure Assign(Source: TPersistent); override;
procedure AssignTo(Dest: TPersistent); override;
function ConvertTo(AnotherClass :TEvsGraphObjectClass): TEvsGraphObject; virtual;
procedure LoadFromStream(Stream :TStream); virtual;
procedure SaveToStream(Stream :TStream); virtual;
procedure BeginUpdate; virtual;
procedure EndUpdate; virtual;
procedure Invalidate; virtual;
procedure BringToFront; virtual;
procedure SendToBack; virtual;
class function IsLink: Boolean; virtual;
class function IsNode: Boolean; virtual;
function IsLocked: Boolean; virtual;
function Delete: Boolean; virtual;
function CanDelete: Boolean; virtual;
function HitTest(const Pt :TPoint): DWORD; virtual;
function ContainsPoint(X, Y :Integer): Boolean; virtual;
function ContainsRect(const Rect :TRect): Boolean; virtual;
function BeginDrag (const Pt :TPoint; HT :DWORD = $FFFFFFFF): Boolean; virtual;
function DragTo (const Pt :TPoint; SnapToGrid :Boolean): Boolean; virtual;
function DragBy (dX, dY :Integer; SnapToGrid :Boolean): Boolean; virtual;
function EndDrag (Accept :Boolean): Boolean; virtual;
property Dragging :Boolean read GetDragging;
property Showing :Boolean read GetShowing;
property ZOrder :Integer read GetZOrder write SetZOrder;
property Selected :Boolean read FSelected write SetSelected;
property BoundsRect :TRect read GetBoundsRect write SetBoundsRect;
property VisualRect :TRect read FVisualRect;
property States :TEvsGraphObjectStates read FStates;
property Owner :TEvsSimpleGraph read FOwner;
property SelectedVisualRect :TRect read GetSelectedVisualRect;
property DependentCount :Integer read GetDependentCount;
property LinkInputCount :Integer read GetLinkInputCount;
property LinkOutputCount :Integer read GetLinkOutputCount;
property Data :Pointer read FData write FData;
property ID :DWORD read FID;
property LinkInputs [Index: Integer]:TEvsGraphLink read GetLinkInputs;
property Dependents [Index: Integer]:TEvsGraphObject read GetDependents;
property LinkOutputs[Index: Integer]:TEvsGraphLink read GetLinkOutputs;
published
property Text :String read FText write SetText;
property Hint :String read FHint write SetHint;
property Brush :TBrush read FBrush write SetBrush;
property Pen :TPen read FPen write SetPen;
property Font :TFont read FFont write SetFont stored IsFontStored;
property ParentFont :Boolean read FParentFont write SetParentFont default True;
property Options :TEvsGraphObjectOptions read FOptions write SetOptions default [goLinkable, goSelectable, goShowCaption];
property Visible :Boolean read FVisible write SetVisible default True;
property Tag :Integer read FTag write FTag default 0;
property HasCustomData :Boolean read FHasCustomData write SetHasCustomData default False;
end;
{ TEvsGraphLink }
TEvsGraphLink = class(TEvsGraphObject)
private
FPoints :TPoints;
FPointCount :Integer;
FSource :TEvsGraphObject;
FTarget :TEvsGraphObject;
FTextPosition :Integer;
FTextSpacing :Integer;
FBeginStyle :TEvsLinkBeginEndStyle;
FBeginSize :Byte;
FEndStyle :TEvsLinkBeginEndStyle;
FEndSize :Byte;
FLinkOptions :TEvsGraphLinkOptions;
FTextRegion :HRGN;
FTextAngle :Double;
FTextCenter :TPoint;
FTextLine :Integer;
FChangeMode :TEvsLinkChangeMode;
FAcceptingHook :Boolean;
FHookingObject :TEvsGraphObject;
FMovingPoint :Integer;
FSourceID :DWORD;
FTargetID :DWORD;
FUpdatingEndPoints :Boolean;
FCheckingLink :Boolean;
procedure ReadArrowSize(Reader :TReader);
procedure ReadFromNode (Reader :TReader);
procedure ReadKind (Reader :TReader);
procedure ReadToNode (Reader :TReader);
procedure SetSource (Value :TEvsGraphObject);
procedure SetTarget (Value :TEvsGraphObject);
procedure SetLinkOptions (Value :TEvsGraphLinkOptions);
procedure SetTextPosition(Value :Integer);
procedure SetTextSpacing (Value :Integer); //DONE SPACING SUPPORT ON OTHER PLATFORMS??
procedure SetBeginStyle (Value :TEvsLinkBeginEndStyle);
procedure SetBeginSize (Value :Byte);
procedure SetEndStyle (Value :TEvsLinkBeginEndStyle);
procedure SetEndSize (Value :Byte);
function GetPoints (Index :Integer): TPoint;
procedure SetPoints (Index :Integer; const Value :TPoint);
procedure SetPolyline (const Value :TPoints);
procedure ReadSource (Reader :TReader);
procedure WriteSource (Writer :TWriter);
procedure ReadTarget (Reader :TReader);
procedure WriteTarget (Writer :TWriter);
procedure ReadPoints (Stream :TStream);
procedure WritePoints (Stream :TStream);
protected
procedure DefineProperties(Filer: TFiler); override;
procedure Loaded; override;
function FixHookAnchor: TPoint; override;
function RelativeHookAnchor(RefPt: TPoint): TPoint; override;
procedure ReplaceID(OldID, NewID :DWORD; const aStart :Integer=0); override;
procedure ReplaceObject(OldObject, NewObject: TEvsGraphObject); override;
procedure NotifyDependents(Flag :TEvsGraphDependencyChangeFlag); override;
procedure UpdateDependencyTo(GraphObject :TEvsGraphObject; Flag :TEvsGraphDependencyChangeFlag); override;
procedure UpdateDependencies; override;
procedure LookupDependencies; override;
function UpdateTextPlacement(Recalc :Boolean; dX, dY :Integer): Boolean; override; //WIN32ONLY
function CreateTextRegion: HRGN; virtual; //WIN32 OLNLY
function IndexOfLongestLine: Integer; virtual; //DONE
function IndexOfNearestLine(const Pt :TPoint; Neighborhood :Integer): integer; virtual; //DONE
procedure QueryVisualRect(out Rect :TRect); override; {$MESSAGE HINT 'REGION ALTERNATIVE'}
function QueryHitTest(const Pt :TPoint): DWORD; override; {$MESSAGE WARN 'REGION ALTERNATIVE'}
function QueryCursor(HT :DWORD): TCursor; override;
function QueryMobility(HT :DWORD): TEvsObjectSides; override;