const
{$IFDEF PAIDVERS}
SDLVersionInfo = 'colorscale_r1210_full';
IsLightEd = false;
{$ELSE}
SDLVersionInfo = 'colorscale_r1210_lighted';
IsLightEd = true;
{$ENDIF}
Release = 1210;
type
TMouseMoveInColorScaleEvent = procedure (Sender: TObject; InScale: boolean;
Shift: TShiftState;
rMousePos: double) of object;
TColScaleOrientation = (csoHorizontal, csoVertical);
TRenderEvent = procedure (Sender: TObject; Canvas: TCanvas) of object;
{$IFDEF GE_LEV29}
[ComponentPlatformsAttribute(pidWin32 or pidWin64 or pidWin64x)]
{$ENDIF}
TColorScale = class (TCustomControl)
private
FFrameSt : TFrameStyle;
FCaption : string;
FCaptColor : TColor;
FCaptPosX : integer;
FCaptPosY : integer;
FCaptSize : integer;
FCaptStyle : TFontStyles;
FSuppressPaint : boolean;
FColSclMin : double;
FColSclMax : double;
FCrossHair : TCrossHair;
FExtendColors : boolean;
FLeftButWasDown : boolean;
FMarginTop : integer;
FMarginBottom : integer;
FMarginLeft : integer;
FMarginRight : integer;
FMouseAction : TMouseActMode;
FMouseAnchorX : integer;
FMouseAnchorY : integer;
FAnchorSclLow : double;
FAnchorSclHigh : double;
FZoomPanMode : TZoomPanMode;
FFramedColors : boolean;
FColorLow : double;
FColorHigh : double;
FColScaleOrient : TColScaleOrientation;
FColorSclBkgd : TColor;
FColorScale : TColor;
FColBlackLine : TColor; { colors to draw the frame }
FColGrayLine : TColor; { -"- }
FColWhiteLine : TColor; { -"- }
FColorScheme : TColorScheme; { color scheme of frames }
FOnMMvInScale : TMouseMoveInColorScaleEvent;
FOnCrossHMove : TNotifyEvent;
FOnDataRendered : TRenderEvent;
FOnZoomPan : TZoomPanEvent;
FScale : TScale;
FGrafBmp : TBitMap;
function GetCrossHair: TCrossHair;
function GetMinTicks: integer;
procedure SetCrossHair (ch: TCrossHair);
procedure SetColorScheme (Value: TColorScheme);
procedure SetColorSclBkgd (Value: TColor);
procedure SetColorScale (Value: TColor);
procedure SetFrameStyle (value: TFrameStyle);
procedure SetCaptStyles (Value: TFontStyles);
procedure SetCaption (Value: string);
procedure SetCaptColor (Value: TColor);
procedure SetCaptPosX (Value: integer);
procedure SetCaptPosY (Value: integer);
procedure SetCaptSize (Value: integer);
procedure SetMarginTop (Value: integer);
procedure SetMarginBottom (Value: integer);
procedure SetMarginLeft (Value: integer);
procedure SetMarginRight (Value: integer);
procedure SetMinTicks (Value: integer);
procedure SetColSclMin (value: double);
procedure SetColSclMax (value: double);
procedure SetColorLow (value: double);
procedure SetColorHigh (value: double);
procedure SetColScaleOrientation (value: TColScaleOrientation);
procedure SetScaleDims;
procedure SetExtColors (value: boolean);
procedure SetFramedColors (value: boolean);
procedure SetSuppPaint (value: boolean);
procedure WMMouseMoveInScale (var Message: TWMMouse);
message WM_MOUSEMOVE;
protected
procedure ColorArrayChange(Sender: TObject);
procedure AssignTo (Dest: TPersistent); override;
procedure MouseMove (Shift: TShiftState; X,Y: integer); override;
procedure MouseDown (Button: TMouseButton;
Shift: TShiftState; X, Y: Integer); override;
procedure Paint; override;
procedure DoCrossHMoveEvent (WhichCH: TCrossHair);
procedure DoZoomPanEvent;
procedure MouseMoveInScale (InScale: boolean; Shift: TShiftState;
RMousePos: double);
public
ColorArray: TColorArray;
procedure Assign(Source: TPersistent); override;
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure SetBounds (ALeft, ATop, AWidth, AHeight: Integer); override;
procedure SetScaleRange (lowval, highval: double);
property SuppressPaint: boolean
read FSuppressPaint write SetSuppPaint;
function ColorToValue (cl: TColor): double;
procedure CopyToBitMap (ABitmap: TBitMap; PosX, PosY: integer);
function ValueToColor (v: double): TColor;
function ValueToPixel (v: double): integer;
published
property Align;
property Anchors;
property Caption: string read FCaption write SetCaption;
property CaptionColor: TColor read FCaptColor write SetCaptColor;
property CaptionPosX: integer
read FCaptPosX write SetCaptPosX default 10;
property CaptionPosY: integer
read FCaptPosY write SetCaptPosY default 10;
property CaptionSize: integer
read FCaptSize write SetCaptSize default 12;
property CaptionStyle: TFontStyles
read FCaptStyle write SetCaptStyles;
property ColorSclBkgd: TColor
read FColorSclBkgd write SetColorSclBkgd;
property ColorOfScale: TColor read FColorScale write SetColorScale;
property ColorScheme: TColorScheme
read FColorScheme write SetColorScheme;
property CrossHair: TCrossHair read GetCrossHair write SetCrossHair;
property Font;
property FrameStyle: TFrameStyle
read FFrameSt write SetFrameStyle;
property ScaleRangeHigh: double read FColSclMax write SetColSclMax;
property ScaleRangeLow: double read FColSclMin write SetColSclMin;
property ExtendColors: boolean read FExtendColors write SetExtColors;
property FramedColorScale: boolean
read FFramedColors write SetFramedColors;
property ColorHigh: double read FColorHigh write SetColorHigh;
property ColorLow: double read FColorLow write SetColorLow;
property MarginTop: integer read FMarginTop write SetMarginTop;
property MarginBottom: integer
read FMarginBottom write SetMarginBottom;
property MarginLeft: integer read FMarginLeft write SetMarginLeft;
property MarginRight: integer read FMarginRight write SetMarginRight;
property MinTicks: integer read GetMinTicks write SetMinTicks;
property MouseAction: TMouseActMode
read FMouseAction write FMouseAction;
property Orientation: TColScaleOrientation
read FColScaleOrient write SetColScaleOrientation;
property ParentFont;
property ParentShowHint;
property PopupMenu;
property ShowHint;
{$IFDEF GE_LEV17}
property StyleElements;
{$ENDIF}
property Visible;
property OnClick;
property OnCrossHairMove: TNotifyEvent
read FOnCrossHMove write FOnCrossHMove;
property OnDataRendered: TRenderEvent
read FOnDataRendered write FOnDataRendered;
property OnDblClick;
property OnMouseMove;
property OnMouseDown;
procedure MouseUp (Button: TMouseButton;
Shift: TShiftState; X, Y: Integer); override;
property OnMouseMoveInScale: TMouseMoveInColorScaleEvent
read FOnMMvInScale write FOnMMvInScale;
property OnMouseWheel;
property OnMouseWheelUp;
property OnMouseWheelDown;
property OnZoomPan: TZoomPanEvent
read FOnZoomPan write FOnZoomPan;
property OnKeyPress;
property OnKeyDown;
property OnKeyUp;
end;
procedure Register;
|