| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152 |
- {========================================================================}
- {= (c) 1995-98 SwiftSoft Ronald Dittrich =}
- {========================================================================}
- {= All Rights Reserved =}
- {========================================================================}
- {= D 01099 Dresden = Tel.: +0351-8012255 =}
- {= Loewenstr.7a = info@swiftsoft.de =}
- {========================================================================}
- {= Actual versions on http://www.swiftsoft.de/mmtools.html =}
- {========================================================================}
- {= This code is for reference purposes only and may not be copied or =}
- {= distributed in any format electronic or otherwise except one copy =}
- {= for backup purposes. =}
- {= =}
- {= No Delphi Component Kit or Component individually or in a collection=}
- {= subclassed or otherwise from the code in this unit, or associated =}
- {= .pas, .dfm, .dcu, .asm or .obj files may be sold or distributed =}
- {= without express permission from SwiftSoft. =}
- {= =}
- {= For more licence informations please refer to the associated =}
- {= HelpFile. =}
- {========================================================================}
- {= $Date: 20.01.1998 - 18:00:00 $ =}
- {========================================================================}
- unit MMEnvelp;
- {$I COMPILER.INC}
- interface
- uses
- {$IFDEF WIN32}
- Windows,
- {$ELSE}
- WinProcs,
- WinTypes,
- {$ENDIF}
- SysUtils,
- Messages,
- Classes,
- Graphics,
- Controls,
- Forms,
- Dialogs,
- MMObj,
- MMDIBCv,
- MMPanel,
- MMUtils,
- MMString,
- MMMulDiv,
- MMMath,
- MMObjLst,
- MMPCMSup,
- MMNotify;
- type
- TMMEnvelopeKind = (ekRectangle, ekCircle, ekOwnerDraw);
- TMMEnvelopeDrawPoint = procedure(Sender: TObject; Canvas: TCanvas;
- Rect: TRect; Selected: Boolean) of object;
- TMMEnvelope = class;
- {-- TMMEnvelopePoint --------------------------------------------------}
- TMMEnvelopePoint = class(TObject)
- public
- X_Value : Longint;
- Y_Value : Longint;
- Selected: Boolean;
- constructor Create;
- constructor CreateEx(X,Y: integer; Sel: Boolean);
- procedure SetParams(X,Y: integer; Sel: Boolean);
- procedure Assign(Source: TObject);
- end;
- {-- TMMEnvelopePointList ----------------------------------------------}
- TMMEnvelopePointList = class(TObjectList)
- public
- procedure Assign(Source: TPersistent); override;
- property Items[Index: integer]: TMMEnvelopePoint read GetPoint write PutPoint; default;
- end;
- {-- TMMEnvelope -------------------------------------------------------}
- TMMEnvelope = class(TMMMarkerPanel)
- public
- ChangeList: TList;
- constructor Create(AOwner: TComponent); override;
- destructor Destroy; override;
- procedure SetRangeAll(MinX, MaxX, MinY, MaxY, YBase: Longint); override;
- { TODO: einige Eigenschaften verstecken }
- procedure Clear;
- procedure Reset;
- function AddPoint(aPoint: TMMEnvelopePoint; Align: Boolean): Boolean;
- procedure DelPoint(Index: integer);
- function LocatePoint(X_Value: Longint): integer;
- function FindPoint(X_Value: Longint): integer;
- function FindPointAtPos(X, Y: integer): integer;
- function QueryPoint(Point: TMMEnvelopePoint): Boolean;
- procedure DeleteSelected;
- procedure SelectAll(State: Boolean);
- procedure SelectRange(idxA, idxB: integer; State: Boolean);
- procedure SelectArea(Area: TRect; State: Boolean);
- procedure QueryPolyMove(var minX, maxX, minY, maxY: Longint);
- procedure PolyShift(DiffX, DiffY: Longint);
- procedure Scale(Factor: Float);
- property Count: integer read GetCount;
- property YValue[X_Value: Longint]: Longint read GetYValue;
- property Select[Index: integer]: Boolean read GetSelected write SetSelected;
- property CurrentIndex: integer read FCurIndex;
- property SelectedCount: integer read GetSelectedCount;
- published
- { Events }
- property OnClick;
- property OnDblClick;
- property OnMouseDown;
- property OnMouseMove;
- property OnMouseUp;
- property OnChange: TNotifyEvent read FOnChange write FOnChange;
- property OnDrawPoint: TMMEnvelopeDrawPoint read FOnDrawPoint write FOnDrawPoint;
- property Align;
- property Bevel;
- property Color default clBtnFace;
- property Width default 200;
- property Height default 100;
- property ParentShowHint;
- property ParentColor default False;
- property ShowHint;
- property Visible;
- property Enabled;
- property Kind: TMMEnvelopeKind read FKind write SetKind default ekRectangle;
- property MidLineColor: TColor index 0 read FMidLineColor write SetColors default clBlack;
- property LineColor: TColor index 1 read FLineColor write SetColors default clBlack;
- property PointColor: TColor index 2 read FPointColor write SetColors default clWhite;
- property SelectedColor: TColor index 3 read FSelectedColor write SetColors default clBlack;
- property PointSize: integer read FPointSize write SetPointSize default 6;
- property DrawMidLine: Boolean read FDrawMidLine write SetDrawMidLine default True;
- property MoveFirstPoint: Boolean index 0 read FMoveFirstPoint write SetMovePoints default True;
- property MoveLastPoint: Boolean index 1 read FMoveLastPoint write SetMovePoints default True;
- property Points: TMMEnvelopePointList read FPoints write SetPoints;
- end;
- implementation
|