MMENVELP.INT 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. {========================================================================}
  2. {= (c) 1995-98 SwiftSoft Ronald Dittrich =}
  3. {========================================================================}
  4. {= All Rights Reserved =}
  5. {========================================================================}
  6. {= D 01099 Dresden = Tel.: +0351-8012255 =}
  7. {= Loewenstr.7a = info@swiftsoft.de =}
  8. {========================================================================}
  9. {= Actual versions on http://www.swiftsoft.de/mmtools.html =}
  10. {========================================================================}
  11. {= This code is for reference purposes only and may not be copied or =}
  12. {= distributed in any format electronic or otherwise except one copy =}
  13. {= for backup purposes. =}
  14. {= =}
  15. {= No Delphi Component Kit or Component individually or in a collection=}
  16. {= subclassed or otherwise from the code in this unit, or associated =}
  17. {= .pas, .dfm, .dcu, .asm or .obj files may be sold or distributed =}
  18. {= without express permission from SwiftSoft. =}
  19. {= =}
  20. {= For more licence informations please refer to the associated =}
  21. {= HelpFile. =}
  22. {========================================================================}
  23. {= $Date: 20.01.1998 - 18:00:00 $ =}
  24. {========================================================================}
  25. unit MMEnvelp;
  26. {$I COMPILER.INC}
  27. interface
  28. uses
  29. {$IFDEF WIN32}
  30. Windows,
  31. {$ELSE}
  32. WinProcs,
  33. WinTypes,
  34. {$ENDIF}
  35. SysUtils,
  36. Messages,
  37. Classes,
  38. Graphics,
  39. Controls,
  40. Forms,
  41. Dialogs,
  42. MMObj,
  43. MMDIBCv,
  44. MMPanel,
  45. MMUtils,
  46. MMString,
  47. MMMulDiv,
  48. MMMath,
  49. MMObjLst,
  50. MMPCMSup,
  51. MMNotify;
  52. type
  53. TMMEnvelopeKind = (ekRectangle, ekCircle, ekOwnerDraw);
  54. TMMEnvelopeDrawPoint = procedure(Sender: TObject; Canvas: TCanvas;
  55. Rect: TRect; Selected: Boolean) of object;
  56. TMMEnvelope = class;
  57. {-- TMMEnvelopePoint --------------------------------------------------}
  58. TMMEnvelopePoint = class(TObject)
  59. public
  60. X_Value : Longint;
  61. Y_Value : Longint;
  62. Selected: Boolean;
  63. constructor Create;
  64. constructor CreateEx(X,Y: integer; Sel: Boolean);
  65. procedure SetParams(X,Y: integer; Sel: Boolean);
  66. procedure Assign(Source: TObject);
  67. end;
  68. {-- TMMEnvelopePointList ----------------------------------------------}
  69. TMMEnvelopePointList = class(TObjectList)
  70. public
  71. procedure Assign(Source: TPersistent); override;
  72. property Items[Index: integer]: TMMEnvelopePoint read GetPoint write PutPoint; default;
  73. end;
  74. {-- TMMEnvelope -------------------------------------------------------}
  75. TMMEnvelope = class(TMMMarkerPanel)
  76. public
  77. ChangeList: TList;
  78. constructor Create(AOwner: TComponent); override;
  79. destructor Destroy; override;
  80. procedure SetRangeAll(MinX, MaxX, MinY, MaxY, YBase: Longint); override;
  81. { TODO: einige Eigenschaften verstecken }
  82. procedure Clear;
  83. procedure Reset;
  84. function AddPoint(aPoint: TMMEnvelopePoint; Align: Boolean): Boolean;
  85. procedure DelPoint(Index: integer);
  86. function LocatePoint(X_Value: Longint): integer;
  87. function FindPoint(X_Value: Longint): integer;
  88. function FindPointAtPos(X, Y: integer): integer;
  89. function QueryPoint(Point: TMMEnvelopePoint): Boolean;
  90. procedure DeleteSelected;
  91. procedure SelectAll(State: Boolean);
  92. procedure SelectRange(idxA, idxB: integer; State: Boolean);
  93. procedure SelectArea(Area: TRect; State: Boolean);
  94. procedure QueryPolyMove(var minX, maxX, minY, maxY: Longint);
  95. procedure PolyShift(DiffX, DiffY: Longint);
  96. procedure Scale(Factor: Float);
  97. property Count: integer read GetCount;
  98. property YValue[X_Value: Longint]: Longint read GetYValue;
  99. property Select[Index: integer]: Boolean read GetSelected write SetSelected;
  100. property CurrentIndex: integer read FCurIndex;
  101. property SelectedCount: integer read GetSelectedCount;
  102. published
  103. { Events }
  104. property OnClick;
  105. property OnDblClick;
  106. property OnMouseDown;
  107. property OnMouseMove;
  108. property OnMouseUp;
  109. property OnChange: TNotifyEvent read FOnChange write FOnChange;
  110. property OnDrawPoint: TMMEnvelopeDrawPoint read FOnDrawPoint write FOnDrawPoint;
  111. property Align;
  112. property Bevel;
  113. property Color default clBtnFace;
  114. property Width default 200;
  115. property Height default 100;
  116. property ParentShowHint;
  117. property ParentColor default False;
  118. property ShowHint;
  119. property Visible;
  120. property Enabled;
  121. property Kind: TMMEnvelopeKind read FKind write SetKind default ekRectangle;
  122. property MidLineColor: TColor index 0 read FMidLineColor write SetColors default clBlack;
  123. property LineColor: TColor index 1 read FLineColor write SetColors default clBlack;
  124. property PointColor: TColor index 2 read FPointColor write SetColors default clWhite;
  125. property SelectedColor: TColor index 3 read FSelectedColor write SetColors default clBlack;
  126. property PointSize: integer read FPointSize write SetPointSize default 6;
  127. property DrawMidLine: Boolean read FDrawMidLine write SetDrawMidLine default True;
  128. property MoveFirstPoint: Boolean index 0 read FMoveFirstPoint write SetMovePoints default True;
  129. property MoveLastPoint: Boolean index 1 read FMoveLastPoint write SetMovePoints default True;
  130. property Points: TMMEnvelopePointList read FPoints write SetPoints;
  131. end;
  132. implementation