MMPANEL.INT 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289
  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 MMPanel;
  26. {$I COMPILER.INC}
  27. {$DEFINE FLOATCALC}
  28. interface
  29. uses
  30. {$IFDEF WIN32}
  31. Windows,
  32. {$ELSE}
  33. WinTypes,
  34. WinProcs,
  35. {$ENDIF}
  36. SysUtils,
  37. Messages,
  38. Classes,
  39. Graphics,
  40. Controls,
  41. Forms,
  42. Dialogs,
  43. ExtCtrls,
  44. Menus,
  45. MMObj,
  46. MMUtils,
  47. MMString,
  48. MMMath,
  49. MMMulDiv,
  50. MMMrkLst;
  51. type
  52. {-- TMMPanel ---------------------------------------------------------}
  53. TMMPanel = class(TMMCustomPanel)
  54. published
  55. property OnClick;
  56. property OnDblClick;
  57. property OnDragDrop;
  58. property OnDragOver;
  59. property OnEndDrag;
  60. property OnEnter;
  61. property OnExit;
  62. property OnMouseDown;
  63. property OnMouseMove;
  64. property OnMouseUp;
  65. property OnResize;
  66. {$IFDEF WIN32}
  67. property OnStartDrag;
  68. {$ENDIF}
  69. property Align;
  70. property Alignment;
  71. property Bevel;
  72. property DragCursor;
  73. property DragMode;
  74. property Enabled;
  75. property Caption;
  76. property Color;
  77. property Ctl3D;
  78. property Font;
  79. property ParentColor;
  80. property ParentCtl3D;
  81. property ParentFont;
  82. property ParentShowHint;
  83. property PopupMenu;
  84. property ShowHint;
  85. property TabOrder;
  86. property TabStop;
  87. property Visible;
  88. end;
  89. {-- TMMBorder --------------------------------------------------------}
  90. TMMBorder = class(TMMGraphicControl)
  91. public
  92. constructor Create(AOwner: TComponent); override;
  93. published
  94. property OnClick;
  95. property OnDblClick;
  96. property OnDragDrop;
  97. property OnDragOver;
  98. property OnEndDrag;
  99. property OnMouseDown;
  100. property OnMouseMove;
  101. property OnMouseUp;
  102. property Align;
  103. property Bevel;
  104. property DragCursor;
  105. property DragMode;
  106. property Enabled;
  107. property Color;
  108. property ParentColor;
  109. property ParentShowHint;
  110. property PopupMenu;
  111. property ShowHint;
  112. property Transparent;
  113. property Visible;
  114. property Width default 185;
  115. property Height default 41;
  116. end;
  117. type
  118. TMarkerShift = (mkNone, mkLocator, mkMarkerA, mkMarkerB, mkMarkerAB, mkMarkerBA,mkListMarker);
  119. TMarkerChangeEvent = procedure(Sender: TObject; var Value: Longint) of Object;
  120. TMarkersChangeEvent = procedure(Sender: TObject; Shift: TMarkerShift; var ValueA, ValueB: Longint) of Object;
  121. TRangeChangeEvent = procedure(Sender: TObject; Min, Max: Longint) of Object;
  122. {-- TMMCustomMarkerPanel --------------------------------------------}
  123. TMMCustomMarkerPanel = class(TMMCustomPanel)
  124. public
  125. constructor Create(AOwner: TComponent); override;
  126. destructor Destroy; override;
  127. function X_ToPixelNoLimit(X_Value: longint): Longint; virtual;
  128. function X_ToPixel(X_Value: longint): integer; virtual;
  129. function PixelTo_X(X: integer): Longint; virtual;
  130. function Y_ToPixelNoLimit(Y_Value: Longint): Longint; virtual;
  131. function Y_ToPixel(Y_Value: Longint): integer; virtual;
  132. function PixelTo_Y(Y: integer): Longint; virtual;
  133. function FindListMarker(X: integer): integer;
  134. function IsAnyMarker(X: integer): Boolean;
  135. function IsLocator(X: integer): Boolean;
  136. function IsMarkerA(X: integer): Boolean;
  137. function IsMarkerB(X: integer): Boolean;
  138. function IsListMarker(X: integer): Boolean;
  139. function IsGridX(X: integer; var Value: Longint): Boolean; virtual;
  140. function IsGridY(Y: integer; var Value: Longint): Boolean; virtual;
  141. procedure SetMinMax(Min, Max: Longint); virtual;
  142. procedure SetMinMaxY(Min, Max: Longint); virtual;
  143. procedure SetRangeAll(MinX, MaxX, MinY, MaxY, YBase: Longint); virtual;
  144. procedure SetDispAll(MinX, MaxX, MinY, MaxY: Longint); virtual;
  145. property MouseCapture;
  146. protected
  147. property OnTrackBegin: TNotifyEvent read FOnTrackBegin write FOnTrackBegin;
  148. property OnTrack: TNotifyEvent read FOnTrack write FOnTrack;
  149. property OnTrackEnd: TNotifyEvent read FOnTrackEnd write FOnTrackEnd;
  150. property OnHelpLocatorChanged: TMarkerChangeEvent read FOnHelpLocatorChanged write FOnHelpLocatorChanged;
  151. property OnLocatorChanged: TMarkerChangeEvent read FOnLocatorChanged write FOnLocatorChanged;
  152. property OnMarkerAChanged: TMarkerChangeEvent read FOnMarkerAChanged write FOnMarkerAChanged;
  153. property OnMarkerBChanged: TMarkerChangeEvent read FOnMarkerBChanged write FOnMarkerBChanged;
  154. property OnMarkersChanged: TMarkersChangeEvent read FOnMarkersChanged write FOnMarkersChanged;
  155. property OnRangeChanged: TRangeChangeEvent read FOnRangeChanged write FOnRangeChanged;
  156. property AutoScroll: Boolean read FAutoScroll write FAutoScroll default True;
  157. property UseHelpLocator: Boolean read FUseHelpLocator write SetUseHelpLocator default True;
  158. property UseLocator: Boolean read FUseLocator write SetUseLocator default True;
  159. property UseMarkers: Boolean read FUseMarkers write SetUseMarkers default False;
  160. property CorralLocator: Boolean read FCorralLocator write FCorralLocator default True;
  161. property HelpLocator: Longint read FHelpLocator write SetHelpLocator default -1;
  162. property Locator: Longint read FLocator write SetLocator default -1;
  163. property MarkerA: Longint read FMarkerA write SetMarkerA default -1;
  164. property MarkerB: Longint read FMarkerB write SetMarkerB default -1;
  165. property HelpLocatorColor : TColor index 0 read FHelpLocColor write SetColors default clSilver;
  166. property LocatorColor : TColor index 1 read FLocColor write SetColors default clLime;
  167. property MarkerAColor : TColor index 2 read FMarkAColor write SetColors default clRed;
  168. property MarkerBColor : TColor index 3 read FMarkBColor write SetColors default clRed;
  169. property GridColor: TColor index 4 read FGridColor write SetColors default clGray;
  170. property DrawSolid: Boolean read FDrawSolid write SetDrawSolid default False;
  171. property DrawGriff: Boolean read FDrawGriff write SetDrawGriff default False;
  172. property DrawGridX: Boolean read FDrawGridX write SetDrawGridX default False;
  173. property DrawGridY: Boolean read FDrawGridY write SetDrawGridY default False;
  174. property GridWidthX: Float read FGridWidthX write SetGridWidthX;
  175. property GridWidthY: Float read FGridWidthY write SetGridWidthY;
  176. property SnapToGrid: Boolean read FSnapToGrid write FSnapToGrid default False;
  177. property SnapRange: integer read FSnapRange write FSnapRange default 3;
  178. property RangeMinX: Longint read FRangeMinX write SetRangeMinX default 0;
  179. property RangeMaxX: Longint read FRangeMaxX write SetRangeMaxX default 1000;
  180. property RangeMinY: Longint read FRangeMinY write SetRangeMinY default 0;
  181. property RangeMaxY: Longint read FRangeMaxY write SetRangeMaxY default 1000;
  182. property BaseY: Longint read FBaseY write SetBaseY default 500;
  183. property DispMinX: Longint read FDispMinX write SetDispMinX default 0;
  184. property DispMaxX: Longint read FDispMaxX write SetDispMaxX default 1000;
  185. property DispMinY: Longint read FDispMinY write SetDispMinY default 0;
  186. property DispMaxY: Longint read FDispMaxY write SetDispMaxY default 1000;
  187. property MarkerList: TMMMarkerList read FMarkerList write SetMarkerList;
  188. end;
  189. {-- TMMMarkerPanel --------------------------------------------------}
  190. TMMMarkerPanel = class(TMMCustomMarkerPanel)
  191. public
  192. property MarkerList;
  193. published
  194. property OnClick;
  195. property OnDblClick;
  196. property OnDragDrop;
  197. property OnDragOver;
  198. property OnEndDrag;
  199. property OnEnter;
  200. property OnExit;
  201. property OnMouseDown;
  202. property OnMouseMove;
  203. property OnMouseUp;
  204. property OnResize;
  205. {$IFDEF WIN32}
  206. property OnStartDrag;
  207. {$ENDIF}
  208. property OnTrackBegin;
  209. property OnTrack;
  210. property OnTrackEnd;
  211. property OnHelpLocatorChanged;
  212. property OnLocatorChanged;
  213. property OnMarkerAChanged;
  214. property OnMarkerBChanged;
  215. property OnMarkersChanged;
  216. property OnRangeChanged;
  217. property Align;
  218. property Alignment;
  219. property Bevel;
  220. property DragCursor;
  221. property DragMode;
  222. property Enabled;
  223. property Color;
  224. property Ctl3D;
  225. property ParentFont;
  226. property ParentColor;
  227. property ParentCtl3D;
  228. property ParentShowHint;
  229. property PopupMenu;
  230. property ShowHint;
  231. property TabOrder;
  232. property TabStop;
  233. property Visible;
  234. property AutoScroll;
  235. property CorralLocator;
  236. property UseHelpLocator;
  237. property UseLocator;
  238. property UseMarkers;
  239. property HelpLocator;
  240. property Locator;
  241. property GridWidthX;
  242. property GridWidthY;
  243. property SnapToGrid;
  244. property SnapRange;
  245. property MarkerA;
  246. property MarkerB;
  247. property LocatorColor;
  248. property MarkerAColor;
  249. property MarkerBColor;
  250. property GridColor;
  251. property DrawSolid;
  252. property DrawGriff;
  253. property DrawGridX;
  254. property DrawGridY;
  255. property RangeMinX;
  256. property RangeMaxX;
  257. property RangeMinY;
  258. property RangeMaxY;
  259. property BaseY;
  260. property DispMinX;
  261. property DispMaxX;
  262. property DispMinY;
  263. property DispMaxY;
  264. end;
  265. implementation