1260 lines
30 KiB
Plaintext
1260 lines
30 KiB
Plaintext
(* ImageEn Build 7.0.0.06.2637 @ 7-4-17 14:58:42.679 *)
|
|
(*
|
|
Copyright (c) 1998-2017 by Carlotta Calandra. All rights reserved.
|
|
Copyright (c) 2011-2017 by Xequte Software.
|
|
|
|
This software comes without express or implied warranty.
|
|
In no case shall the author be liable for any damage or unwanted behavior of any
|
|
computer hardware and/or software.
|
|
|
|
Author grants you the right to include the component
|
|
in your application, whether COMMERCIAL, SHAREWARE, or FREEWARE.
|
|
|
|
ImageEn, IEvolution and ImageEn ActiveX may not be included in any
|
|
commercial, shareware or freeware libraries or components.
|
|
|
|
www.ImageEn.com
|
|
*)
|
|
|
|
(*
|
|
File version 1006
|
|
Doc revision 1002
|
|
*)
|
|
|
|
unit rulerbox;
|
|
|
|
{$R-}
|
|
{$Q-}
|
|
|
|
{$I ie.inc}
|
|
|
|
|
|
interface
|
|
|
|
uses
|
|
Windows, Messages, SysUtils, Classes, Graphics, Controls,
|
|
{$ifdef IEHASTYPES} Types, {$endif}
|
|
iexRulers, iegdiplus;
|
|
|
|
|
|
type
|
|
{!!
|
|
<FS>TRulerBox
|
|
|
|
<FM>Description<FN>
|
|
TRulerBox is a ruler. It can be used to show the position of the cursor in a <A TImageEnView>.
|
|
|
|
<FM>Demo<FN>
|
|
<TABLE2>
|
|
<R> <C_IMG_DEMO> <C>\Demos\Other\RulerBox\DRulerBox.dpr </C> </R>
|
|
</TABLE>
|
|
|
|
<FM>Methods and Properties<FN>
|
|
<TABLE2>
|
|
<R> <C_IMG_PUBLISHED> <C><A TRulerBox.Background></C> </R>
|
|
<R> <C_IMG_PUBLISHED> <C><A TRulerBox.DotPerUnit></C> </R>
|
|
<R> <C_IMG_PUBLISHED> <C><A TRulerBox.FitInView></C> </R>
|
|
<R> <C_IMG_PUBLISHED> <C><A TRulerBox.Frequency></C> </R>
|
|
<R> <C_IMG_PUBLISHED> <C><A TRulerBox.GripBaseDim></C> </R>
|
|
<R> <C_IMG_PROPERTY> <C><A TRulerBox.GripsColor></C> </R>
|
|
<R> <C_IMG_PUBLISHED> <C><A TRulerBox.GripColorDefault></C> </R>
|
|
<R> <C_IMG_PROPERTY> <C><A TRulerBox.GripsCount></C> </R>
|
|
<R> <C_IMG_PUBLISHED> <C><A TRulerBox.GripsDir></C> </R>
|
|
<R> <C_IMG_PROPERTY> <C><A TRulerBox.GripsMax></C> </R>
|
|
<R> <C_IMG_PROPERTY> <C><A TRulerBox.GripsMin></C> </R>
|
|
<R> <C_IMG_PUBLISHED> <C><A TRulerBox.GripPenColor></C> </R>
|
|
<R> <C_IMG_PROPERTY> <C><A TRulerBox.GripsPos></C> </R>
|
|
<R> <C_IMG_PROPERTY> <C><A TRulerBox.GripsKind></C> </R>
|
|
<R> <C_IMG_PUBLISHED> <C><A TRulerBox.GripKindDefault></C> </R>
|
|
<R> <C_IMG_PUBLISHED> <C><A TRulerBox.HexLabels></C> </R>
|
|
<R> <C_IMG_PUBLISHED> <C><A TRulerBox.Inverted></C> </R>
|
|
<R> <C_IMG_PUBLISHED> <C><A TRulerBox.LabelFreq></C> </R>
|
|
<R> <C_IMG_PUBLISHED> <C><A TRulerBox.LabelPrecision></C> </R>
|
|
<R> <C_IMG_PUBLISHED> <C><A TRulerBox.LockUpdate></C> </R>
|
|
<R> <C_IMG_PUBLISHED> <C><A TRulerBox.MaxGripHeight></C> </R>
|
|
<R> <C_IMG_PUBLISHED> <C><A TRulerBox.MinLabelSpacing></C> </R>
|
|
<R> <C_IMG_PUBLISHED> <C><A TRulerBox.OffsetX></C> </R>
|
|
<R> <C_IMG_PUBLISHED> <C><A TRulerBox.OffsetY></C> </R>
|
|
<R> <C_IMG_PUBLISHED> <C><A TRulerBox.RulerColor></C> </R>
|
|
<R> <C_IMG_PUBLISHED> <C><A TRulerBox.RulerDir></C> </R>
|
|
<R> <C_IMG_PUBLISHED> <C><A TRulerBox.Ruler></C> </R>
|
|
<R> <C_IMG_PROPERTY> <C><A TRulerBox.ScrollRate></C> </R>
|
|
<R> <C_IMG_PROPERTY> <C><A TRulerBox.ShowBorder></C> </R>
|
|
<R> <C_IMG_PUBLISHED> <C><A TRulerBox.UnlockUpdate></C> </R>
|
|
<R> <C_IMG_PUBLISHED> <C><A TRulerBox.ViewMax></C> </R>
|
|
<R> <C_IMG_PUBLISHED> <C><A TRulerBox.ViewMin></C> </R>
|
|
<R> <C_IMG_PUBLISHED> <C><A TRulerBox.ViewPos></C> </R>
|
|
</TABLE>
|
|
|
|
<FM>Events<FN>
|
|
<TABLE2>
|
|
<R> <C_IMG_EVENT> <C><A TRulerBox.OnRulerClick></C> </R>
|
|
<R> <C_IMG_EVENT> <C><A TRulerBox.OnRulerGripClick></C> </R>
|
|
<R> <C_IMG_EVENT> <C><A TRulerBox.OnRulerGripDblClick></C> </R>
|
|
<R> <C_IMG_EVENT> <C><A TRulerBox.OnRulerPosChange></C> </R>
|
|
</TABLE>
|
|
!!}
|
|
{$ifdef IEHASPLATFORMATTRIBUTE}
|
|
[ComponentPlatformsAttribute(pidWin32 or pidWin64)]
|
|
{$endif}
|
|
TRulerBox = class(TCustomControl)
|
|
private
|
|
{ Private declarations }
|
|
fIERuler: TIERuler;
|
|
|
|
function GetGripsPos(i: integer): double;
|
|
procedure SetGripsPos(i: integer; p: double);
|
|
function GetGripsColor(i: integer): TColor;
|
|
procedure SetGripsColor(i: integer; p: TColor);
|
|
function GetGripsMin(i: integer): double;
|
|
procedure SetGripsMin(i: integer; v: double);
|
|
function GetGripsMax(i: integer): double;
|
|
procedure SetGripsMax(i: integer; v: double);
|
|
function GetViewMin: double;
|
|
procedure SetViewMin(v: double);
|
|
function GetViewMax: double;
|
|
procedure SetViewMax(v: double);
|
|
function GetViewPos: double;
|
|
procedure SetViewPos(v: double);
|
|
function GetDPU: double;
|
|
procedure SetDPU(v: double);
|
|
function GetOffsetX: integer;
|
|
procedure SetOffsetX(v: integer);
|
|
function GetOffsetY: integer;
|
|
procedure SetOffsetY(v: integer);
|
|
function GetMinLabelSpacing: integer;
|
|
procedure SetMinLabelSpacing(v: integer);
|
|
function GetFrequency: double;
|
|
procedure SetFrequency(v: double);
|
|
function GetLabelFreq: double;
|
|
procedure SetLabelFreq(v: double);
|
|
function GetRuler: boolean;
|
|
procedure SetRuler(v: boolean);
|
|
function GetRulerColor: TColor;
|
|
procedure SetRulerColor(v: TColor);
|
|
function GetRulerDir: TRulerDir;
|
|
procedure SetRulerDir(v: TRulerDir);
|
|
function GetBackground: TColor;
|
|
procedure SetBackground(bk: TColor);
|
|
function GetFitInView: boolean;
|
|
procedure SetFitInView(v: boolean);
|
|
function GetHexLabels: boolean;
|
|
procedure SetHexLabels(v: boolean);
|
|
function GetInverted: boolean;
|
|
procedure SetInverted(v: boolean);
|
|
function GetLabelPrecision: integer;
|
|
procedure SetLabelPrecision(v: integer);
|
|
function GetScrollRate: double;
|
|
procedure SetScrollRate(const Value: double);
|
|
|
|
function GetGripsCount: integer;
|
|
procedure SetGripsCount(v: integer);
|
|
function GetGripKindDefault: TGripKind;
|
|
procedure SetGripKindDefault(const Value: TGripKind);
|
|
function GetGripsKind(i: integer): TGripKind;
|
|
procedure SetGripsKind(i: integer; v: TGripKind);
|
|
function GetGripsDir: TGripsDir;
|
|
procedure SetGripsDir(v: TGripsDir);
|
|
function GetGripColorDefault: TColor;
|
|
procedure SetGripColorDefault(const Value: TColor);
|
|
function GetGripPenColor: TColor;
|
|
procedure SetGripPenColor(const Value: TColor);
|
|
function GetGripBaseDim: integer;
|
|
procedure SetGripBaseDim(v: integer);
|
|
function GetMaxGripHeight: integer;
|
|
procedure SetMaxGripHeight(const Value: integer);
|
|
|
|
function GetOnRulerClick: TRulerClickEvent;
|
|
procedure SetOnRulerClick(const Value: TRulerClickEvent);
|
|
function GetOnRulerGripClick: TRulerGripClickEvent;
|
|
procedure SetOnRulerGripClick(const Value: TRulerGripClickEvent);
|
|
function GetOnRulerGripDblClick: TRulerGripClickEvent;
|
|
procedure SetOnRulerGripDblClick(const Value: TRulerGripClickEvent);
|
|
function GetOnRulerPosChange: TRulerGripPosChangeEvent;
|
|
procedure SetOnRulerPosChange(const Value: TRulerGripPosChangeEvent);
|
|
function GetShowBorder: boolean;
|
|
procedure SetShowBorder(const Value: boolean);
|
|
protected
|
|
{ Protected declarations }
|
|
procedure WMSize(var Message: TWMSize); message WM_SIZE;
|
|
procedure WMEraseBkgnd(var Message: TMessage); message WM_ERASEBKGND;
|
|
procedure MouseMove(Shift: TShiftState; X, Y: Integer); override;
|
|
procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override;
|
|
procedure MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override;
|
|
procedure CMFontChanged(var Message: TMessage); message CM_FONTCHANGED;
|
|
public
|
|
{ Public declarations }
|
|
procedure Paint; override;
|
|
constructor Create(Owner: TComponent); override;
|
|
destructor Destroy; override;
|
|
procedure Update(); override;
|
|
procedure LockUpdate();
|
|
procedure UnlockUpdate();
|
|
property GripsPos[g: integer]: double read GetGripsPos write SetGripsPos; default;
|
|
property GripsColor[g: integer]: TColor read GetGripsColor write SetGripsColor;
|
|
property GripsKind[g: integer]: TGripKind read GetGripsKind write SetGripsKind;
|
|
property GripsMin[g: integer]: double read GetGripsMin write SetGripsMin;
|
|
property GripsMax[g: integer]: double read GetGripsMax write SetGripsMax;
|
|
|
|
property ScrollRate: double read GetScrollRate write SetScrollRate;
|
|
|
|
published
|
|
{ Published declarations }
|
|
property ViewPos: double read GetViewPos write SetViewPos;
|
|
property Background: TColor read GetBackground write SetBackground default clBtnFace;
|
|
property GripPenColor : TColor read GetGripPenColor write SetGripPenColor default clBlack;
|
|
property GripBaseDim: integer read GetGripBaseDim write SetGripBaseDim default 12;
|
|
property GripsDir: TGripsDir read GetGripsDir write SetGripsDir default gdUp;
|
|
property Ruler: boolean read GetRuler write SetRuler default true;
|
|
property DotPerUnit: double read GetDPU write SetDPU;
|
|
property Frequency: double read GetFrequency write SetFrequency;
|
|
property LabelFreq: double read GetLabelFreq write SetLabelFreq;
|
|
property RulerColor: TColor read GetRulerColor write SetRulerColor default clBtnFace;
|
|
property RulerDir: TRulerDir read GetRulerDir write SetRulerDir default rdHorizontal;
|
|
property ViewMin: double read GetViewMin write SetViewMin;
|
|
property ViewMax: double read GetViewMax write SetViewMax;
|
|
property LabelPrecision: integer read GetLabelPrecision write SetLabelPrecision default 3;
|
|
property MinLabelSpacing: integer read GetMinLabelSpacing write SetMinLabelSpacing default 30;
|
|
property GripKindDefault: TGripKind read GetGripKindDefault write SetGripKindDefault default gkTriangle;
|
|
property GripColorDefault: TColor read GetGripColorDefault write SetGripColorDefault default clBtnFace;
|
|
property OffsetX: integer read GetOffsetX write SetOffsetX default 0;
|
|
property OffsetY: integer read GetOffsetY write SetOffsetY default 0;
|
|
|
|
property Inverted: boolean read GetInverted write SetInverted default false;
|
|
property FitInView: boolean read GetFitInView write SetFitInView default false;
|
|
property GripsCount: integer read GetGripsCount write SetGripsCount default 1;
|
|
property HexLabels: boolean read GetHexLabels write SetHexLabels default false;
|
|
property ShowBorder: boolean read GetShowBorder write SetShowBorder default False;
|
|
|
|
property MaxGripHeight: integer read GetMaxGripHeight write SetMaxGripHeight;
|
|
|
|
property OnRulerPosChange: TRulerGripPosChangeEvent read GetOnRulerPosChange write SetOnRulerPosChange;
|
|
property OnRulerGripClick: TRulerGripClickEvent read GetOnRulerGripClick write SetOnRulerGripClick;
|
|
property OnRulerGripDblClick: TRulerGripClickEvent read GetOnRulerGripDblClick write SetOnRulerGripDblClick;
|
|
property OnRulerClick: TRulerClickEvent read GetOnRulerClick write SetOnRulerClick;
|
|
|
|
property Align;
|
|
property DragCursor;
|
|
property DragMode;
|
|
property Enabled;
|
|
property ParentShowHint;
|
|
property PopupMenu;
|
|
property ShowHint;
|
|
property Visible;
|
|
property OnClick;
|
|
property OnDblClick;
|
|
property OnDragDrop;
|
|
property OnDragOver;
|
|
property OnEndDrag;
|
|
property OnMouseDown;
|
|
property OnMouseMove;
|
|
property OnMouseUp;
|
|
property OnStartDrag;
|
|
property Width;
|
|
property Height;
|
|
property Font;
|
|
property MouseCapture;
|
|
end;
|
|
|
|
|
|
implementation
|
|
|
|
{$R-}
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////////////
|
|
// //
|
|
// TRULERBOX //
|
|
// //
|
|
/////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
constructor TRulerBox.Create(Owner: TComponent);
|
|
begin
|
|
inherited Create(Owner);
|
|
controlstyle := controlstyle + [csOpaque];
|
|
Height := 40;
|
|
Width := 300;
|
|
fIERuler := TIERuler.Create( Self );
|
|
Update();
|
|
end;
|
|
|
|
|
|
destructor TRulerBox.Destroy;
|
|
begin
|
|
FreeAndNil( fIERuler );
|
|
inherited;
|
|
end;
|
|
|
|
|
|
procedure TRulerBox.Update();
|
|
begin
|
|
fIERuler.Update();
|
|
end;
|
|
|
|
|
|
procedure TRulerBox.Paint;
|
|
begin
|
|
Canvas.Brush.Style := bsSolid;
|
|
Canvas.Brush.Color := fIERuler.Background;
|
|
Canvas.FillRect(Rect(0, 0, fIERuler.OffsetX, Height));
|
|
Canvas.FillRect(Rect(0, 0, Width, fIERuler.OffsetY));
|
|
fIERuler.DrawToCanvas( Canvas, 0, 0 );
|
|
end;
|
|
|
|
|
|
procedure TRulerBox.WMEraseBkgnd(var Message: TMessage);
|
|
begin
|
|
Message.Result := 0;
|
|
end;
|
|
|
|
|
|
procedure TRulerBox.WMSize(var Message: TWMSize);
|
|
begin
|
|
inherited;
|
|
fIERuler.UpdateSize( message.Width, message.Height );
|
|
end;
|
|
|
|
|
|
procedure TRulerBox.MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
|
begin
|
|
inherited;
|
|
fIERuler.HandleMouseDown( Button, Shift, X, Y );
|
|
end;
|
|
|
|
procedure TRulerBox.MouseMove(Shift: TShiftState; X, Y: Integer);
|
|
begin
|
|
inherited;
|
|
fIERuler.HandleMouseMove( Shift, X, Y );
|
|
end;
|
|
|
|
procedure TRulerBox.MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
|
begin
|
|
inherited;
|
|
fIERuler.HandleMouseUp( Button, Shift, X, Y );
|
|
end;
|
|
|
|
|
|
procedure TRulerBox.CMFontChanged(var Message: TMessage);
|
|
begin
|
|
fIERuler.Font.Assign( Font );
|
|
end;
|
|
|
|
|
|
{!!
|
|
<FS>TRulerBox.GripsMin
|
|
|
|
<FM>Declaration<FC>
|
|
property GripsMin[g: integer]: double;
|
|
|
|
<FM>Description<FN>
|
|
Specifies the minimum position of the grip, g.
|
|
|
|
!!}
|
|
function TRulerBox.GetGripsMin(i: integer): double;
|
|
begin
|
|
result := fIERuler.GripsMin[ i ];
|
|
end;
|
|
|
|
procedure TRulerBox.SetGripsMin(i: integer; v: double);
|
|
begin
|
|
fIERuler.GripsMin[ i ] := v;
|
|
end;
|
|
|
|
|
|
{!!
|
|
<FS>TRulerBox.GripsMax
|
|
|
|
<FM>Declaration<FC>
|
|
property GripsMax[g: integer]: double;
|
|
|
|
<FM>Description<FN>
|
|
Specifies the max position of the grip, g.
|
|
|
|
!!}
|
|
function TRulerBox.GetGripsMax(i: integer): double;
|
|
begin
|
|
result := fIERuler.GripsMax[ i ];
|
|
end;
|
|
|
|
procedure TRulerBox.SetGripsMax(i: integer; v: double);
|
|
begin
|
|
fIERuler.GripsMax[ i ] := v;
|
|
end;
|
|
|
|
|
|
{!!
|
|
<FS>TRulerBox.ViewMin
|
|
|
|
<FM>Declaration<FC>
|
|
property ViewMin: double;
|
|
|
|
<FM>Description<FN>
|
|
Specifies the minimum value for <A TRulerBox.ViewPos> property.
|
|
|
|
Default: 0
|
|
!!}
|
|
function TRulerBox.GetViewMin: double;
|
|
begin
|
|
result := fIERuler.ViewMin;
|
|
end;
|
|
|
|
procedure TRulerBox.SetViewMin(v: double);
|
|
begin
|
|
fIERuler.ViewMin := v;
|
|
end;
|
|
|
|
|
|
{!!
|
|
<FS>TRulerBox.ViewMax
|
|
|
|
<FM>Declaration<FC>
|
|
property ViewMax: double;
|
|
|
|
<FM>Description<FN>
|
|
pecifies the maximum value for <A TRulerBox.ViewPos> property.
|
|
|
|
Default: 0
|
|
!!}
|
|
function TRulerBox.GetViewMax: double;
|
|
begin
|
|
result := fIERuler.ViewMax;
|
|
end;
|
|
|
|
procedure TRulerBox.SetViewMax(v: double);
|
|
begin
|
|
fIERuler.ViewMax := v;
|
|
end;
|
|
|
|
|
|
{!!
|
|
<FS>TRulerBox.ViewPos
|
|
|
|
<FM>Declaration<FC>
|
|
property ViewPos: double;
|
|
|
|
<FM>Description<FN>
|
|
Specifies the initial position of the view (i.e. where 0 is within the view).
|
|
|
|
Default: 0
|
|
!!}
|
|
function TRulerBox.GetViewPos: double;
|
|
begin
|
|
result := fIERuler.ViewPos;
|
|
end;
|
|
|
|
procedure TRulerBox.SetViewPos(v: double);
|
|
begin
|
|
fIERuler.ViewPos := v;
|
|
end;
|
|
|
|
|
|
{!!
|
|
<FS>TRulerBox.DotPerUnit
|
|
|
|
<FM>Declaration<FC>
|
|
property DotPerUnit: double;
|
|
|
|
<FM>Description<FN>
|
|
Specifies the number of pixels per logical unit.
|
|
|
|
Default: 1
|
|
!!}
|
|
function TRulerBox.GetDPU: double;
|
|
begin
|
|
result := fIERuler.DotPerUnit;
|
|
end;
|
|
|
|
procedure TRulerBox.SetDPU(v: double);
|
|
begin
|
|
fIERuler.DotPerUnit := v;
|
|
end;
|
|
|
|
|
|
{!!
|
|
<FS>TRulerBox.OffsetX
|
|
|
|
<FM>Declaration<FC>
|
|
property OffsetX: integer;
|
|
|
|
<FM>Description<FN>
|
|
Specifies the horizontal offset where the ruler begins.
|
|
|
|
Default: 0
|
|
!!}
|
|
function TRulerBox.GetOffsetX: integer;
|
|
begin
|
|
result := fIERuler.OffsetX;
|
|
end;
|
|
|
|
procedure TRulerBox.SetOffsetX(v: integer);
|
|
begin
|
|
fIERuler.OffsetX := v;
|
|
end;
|
|
|
|
|
|
{!!
|
|
<FS>TRulerBox.OffsetY
|
|
|
|
<FM>Declaration<FC>
|
|
property OffsetY: integer;
|
|
|
|
<FM>Description<FN>
|
|
Specifies the vertical offset where the ruler begins.
|
|
|
|
Default: 0
|
|
!!}
|
|
function TRulerBox.GetOffsetY: integer;
|
|
begin
|
|
result := fIERuler.OffsetY;
|
|
end;
|
|
|
|
procedure TRulerBox.SetOffsetY(v: integer);
|
|
begin
|
|
fIERuler.OffsetY := v;
|
|
end;
|
|
|
|
|
|
{!!
|
|
<FS>TRulerBox.MinLabelSpacing
|
|
|
|
<FM>Declaration<FC>
|
|
property MinLabelSpacing: integer;
|
|
|
|
<FM>Description<FN>
|
|
Specifies the spacing between (center of) labels. To reduce crowding, labels positioned closer than this value are not shown.
|
|
If <FC>MinLabelSpacing<FN> is 0 then labels are always drawn.
|
|
|
|
Default: 30
|
|
!!}
|
|
function TRulerBox.GetMinLabelSpacing: integer;
|
|
begin
|
|
result := fIERuler.MinLabelSpacing;
|
|
end;
|
|
|
|
procedure TRulerBox.SetMinLabelSpacing(v: integer);
|
|
begin
|
|
fIERuler.MinLabelSpacing := v;
|
|
end;
|
|
|
|
|
|
{!!
|
|
<FS>TRulerBox.Frequency
|
|
|
|
<FM>Declaration<FC>
|
|
property Frequency: double;
|
|
|
|
<FM>Description<FN>
|
|
Specifies the number of logical units where ticks are shown.
|
|
|
|
Use <A TRulerBox.LabelFreq> to configure labels and longer tick marks.
|
|
|
|
Default: 10
|
|
!!}
|
|
function TRulerBox.GetFrequency: double;
|
|
begin
|
|
result := fIERuler.Frequency;
|
|
end;
|
|
|
|
procedure TRulerBox.SetFrequency(v: double);
|
|
begin
|
|
fIERuler.Frequency := v;
|
|
end;
|
|
|
|
|
|
{!!
|
|
<FS>TRulerBox.LabelFreq
|
|
|
|
<FM>Declaration<FC>
|
|
property LabelFreq: double;
|
|
|
|
<FM>Description<FN>
|
|
Specifies the number of logical units where to show labels (and longer tick marks).
|
|
|
|
Use <A TRulerBox.Frequency> to configure short tick marks.
|
|
|
|
Default: 40
|
|
!!}
|
|
function TRulerBox.GetLabelFreq: double;
|
|
begin
|
|
result := fIERuler.LabelFrequency;
|
|
end;
|
|
|
|
procedure TRulerBox.SetLabelFreq(v: double);
|
|
begin
|
|
fIERuler.LabelFrequency := v;
|
|
end;
|
|
|
|
|
|
{!!
|
|
<FS>TRulerBox.Ruler
|
|
|
|
<FM>Declaration<FC>
|
|
property Ruler: boolean;
|
|
|
|
<FM>Description<FN>
|
|
Specify whether a measurement block is drawn on the ruler.
|
|
|
|
Default: True
|
|
|
|
<FM>Example<FC>
|
|
// Show only grips
|
|
RulerBox1.Ruler := False;
|
|
|
|
!!}
|
|
function TRulerBox.GetRuler: boolean;
|
|
begin
|
|
result := fIERuler.ShowRuler;
|
|
end;
|
|
|
|
procedure TRulerBox.SetRuler(v: boolean);
|
|
begin
|
|
fIERuler.ShowRuler := v;
|
|
end;
|
|
|
|
|
|
{!!
|
|
<FS>TRulerBox.RulerColor
|
|
|
|
<FM>Declaration<FC>
|
|
property RulerColor: TColor;
|
|
|
|
<FM>Description<FN>
|
|
Specifies the color of the measurement block of the ruler.
|
|
|
|
Note: This value may be overridden if <A TIEImageEnGlobalSettings.EnableTheming> is enabled.
|
|
|
|
Default: clBtnFace
|
|
!!}
|
|
function TRulerBox.GetRulerColor: TColor;
|
|
begin
|
|
result := fIERuler.RulerColor;
|
|
end;
|
|
|
|
procedure TRulerBox.SetRulerColor(v: TColor);
|
|
begin
|
|
fIERuler.RulerColor := v;
|
|
end;
|
|
|
|
|
|
{!!
|
|
<FS>TRulerBox.RulerDir
|
|
|
|
<FM>Declaration<FC>
|
|
property RulerDir: <A TRulerDir>;
|
|
|
|
<FM>Description<FN>
|
|
Specifies the direction of the ruler (horizontal or vertical).
|
|
|
|
Default: rdHorizontal
|
|
|
|
<FM>Example<FC>
|
|
// Configure ruler along the top of a TImageEnView
|
|
RulerBox1.RulerDir := rdHorizontal;
|
|
|
|
// Configure ruler along the left of a TImageEnView
|
|
RulerBox1.RulerDir := rdVertical;
|
|
!!}
|
|
function TRulerBox.GetRulerDir: TRulerDir;
|
|
begin
|
|
result := fIERuler.RulerDir;
|
|
end;
|
|
|
|
procedure TRulerBox.SetRulerDir(v: TRulerDir);
|
|
begin
|
|
fIERuler.RulerDir := v;
|
|
end;
|
|
|
|
|
|
{!!
|
|
<FS>TRulerBox.Background
|
|
|
|
<FM>Declaration<FC>
|
|
property Background: TColor;
|
|
|
|
<FM>Description<FN>
|
|
Specifies the color of the background (non-ruler area).
|
|
|
|
Default: clBtnFace
|
|
!!}
|
|
// return -1 = none
|
|
function TRulerBox.GetBackground: TColor;
|
|
begin
|
|
result := fIERuler.Background;
|
|
end;
|
|
|
|
procedure TRulerBox.SetBackground(bk: TColor);
|
|
begin
|
|
fIERuler.Background := bk;
|
|
end;
|
|
|
|
{!!
|
|
<FS>TRulerBox.FitInView
|
|
|
|
<FM>Declaration<FC>
|
|
property FitInView: boolean;
|
|
|
|
<FM>Description<FN>
|
|
If enabled, <A TRulerBox.DotPerUnit> is automatically adjusted to ensure that the range of the ruler (from <A TRulerBox.ViewMin> to <A TRulerBox.ViewMax>) fits within the viewing area.
|
|
|
|
Default: False
|
|
!!}
|
|
function TRulerBox.GetFitInView: boolean;
|
|
begin
|
|
result := fIERuler.FitInView;
|
|
end;
|
|
|
|
procedure TRulerBox.SetFitInView(v: boolean);
|
|
begin
|
|
fIERuler.FitInView := v;
|
|
end;
|
|
|
|
|
|
{!!
|
|
<FS>TRulerBox.HexLabels
|
|
|
|
<FM>Declaration<FC>
|
|
property HexLabels: boolean;
|
|
|
|
<FM>Description<FN>
|
|
If HexLabels is True, the labels are shown in hexadecimal notation.
|
|
|
|
Default: False
|
|
!!}
|
|
function TRulerBox.GetHexLabels: boolean;
|
|
begin
|
|
result := fIERuler.HexLabels;
|
|
end;
|
|
|
|
procedure TRulerBox.SetHexLabels(v: boolean);
|
|
begin
|
|
fIERuler.HexLabels := v;
|
|
end;
|
|
|
|
|
|
{!!
|
|
<FS>TRulerBox.Inverted
|
|
|
|
<FM>Declaration<FC>
|
|
property Inverted: boolean;
|
|
|
|
<FM>Description<FN>
|
|
When true the ruler is painted from right to left.
|
|
|
|
Default: False.
|
|
!!}
|
|
function TRulerBox.GetInverted: boolean;
|
|
begin
|
|
result := fIERuler.Inverted;
|
|
end;
|
|
|
|
procedure TRulerBox.SetInverted(v: boolean);
|
|
begin
|
|
fIERuler.Inverted := v;
|
|
end;
|
|
|
|
|
|
{!!
|
|
<FS>TRulerBox.LabelPrecision
|
|
|
|
<FM>Declaration<FC>
|
|
property LabelPrecision: integer;
|
|
|
|
<FM>Description<FN>
|
|
Specifies the number of decimal places shown for values in the ruler.
|
|
|
|
Default: 3
|
|
!!}
|
|
function TRulerBox.GetLabelPrecision: integer;
|
|
begin
|
|
result := fIERuler.LabelPrecision;
|
|
end;
|
|
|
|
procedure TRulerBox.SetLabelPrecision(v: integer);
|
|
begin
|
|
fIERuler.LabelPrecision := v;
|
|
end;
|
|
|
|
|
|
{!!
|
|
<FS>TRulerBox.ScrollRate
|
|
|
|
<FM>Declaration<FC>
|
|
property ScrollRate: double;
|
|
|
|
<FM>Description<FN>
|
|
Specifies the scroll rate used when moving a grip out of ruler borders.
|
|
|
|
Default: 1.0
|
|
!!}
|
|
function TRulerBox.GetScrollRate: double;
|
|
begin
|
|
result := fIERuler.ScrollRate;
|
|
end;
|
|
|
|
procedure TRulerBox.SetScrollRate(const Value: double);
|
|
begin
|
|
fIERuler.ScrollRate := Value;
|
|
end;
|
|
|
|
|
|
{!!
|
|
<FS>TRulerBox.ShowBorder
|
|
|
|
<FM>Declaration<FC>
|
|
property ShowBorder: boolean;
|
|
|
|
<FM>Description<FN>
|
|
Specify whether a border is displayed below the ruler.
|
|
|
|
Default: False
|
|
!!}
|
|
function TRulerBox.GetShowBorder: boolean;
|
|
begin
|
|
Result := fIERuler.ShowBorder;
|
|
end;
|
|
|
|
procedure TRulerBox.SetShowBorder(const Value: boolean);
|
|
begin
|
|
fIERuler.ShowBorder := Value;
|
|
end;
|
|
|
|
|
|
{!!
|
|
<FS>TRulerBox.GripsPos
|
|
|
|
<FM>Declaration<FC>
|
|
property GripsPos[g: integer]: double;
|
|
|
|
<FM>Description<FN>
|
|
Specifies the current position of the grip, g.
|
|
!!}
|
|
function TRulerBox.GetGripsPos(i: integer): double;
|
|
begin
|
|
result := fIERuler.GripsPos[ i ];
|
|
end;
|
|
|
|
procedure TRulerBox.SetGripsPos(i: integer; p: double);
|
|
begin
|
|
fIERuler.GripsPos[ i ] := p;
|
|
end;
|
|
|
|
|
|
{!!
|
|
<FS>TRulerBox.GripsCount
|
|
|
|
<FM>Declaration<FC>
|
|
property GripsCount: integer;
|
|
|
|
<FM>Description<FN>
|
|
Specifies the number of the grips.
|
|
|
|
Default: 1
|
|
|
|
<FM>Examples<FC>
|
|
// Add twenty grips
|
|
RulerBox1.GripsCount := 20;
|
|
|
|
// Set default color of grips to clSilver, but clRed for grips > 10
|
|
RulerBox1.GripColorDefault := clSilver;
|
|
for i := 10 to RulerBox1.GripsCount - 1 do
|
|
RulerBox1.GripsColor[ i ] := clRed;
|
|
!!}
|
|
function TRulerBox.GetGripsCount: integer;
|
|
begin
|
|
result := fIERuler.GripsCount;
|
|
end;
|
|
|
|
procedure TRulerBox.SetGripsCount(v: integer);
|
|
begin
|
|
fIERuler.GripsCount := v;
|
|
end;
|
|
|
|
|
|
{!!
|
|
<FS>TRulerBox.GripKindDefault
|
|
|
|
<FM>Declaration<FC>
|
|
property GripKindDefault: <A TGripKind>;
|
|
|
|
<FM>Description<FN>
|
|
Specifies the default style for all grips.
|
|
This style will be assigned to any grips for which you have not set a custom style using <A TRulerBox.GripsKind>.
|
|
|
|
The width of the grip is specified by <A TRulerBox.GripBaseDim>.
|
|
|
|
Default: gkTriangle
|
|
|
|
<FM>Example<FC>
|
|
// Set default style of grips to gkTriangle, but gkArrow2 to grips > 10
|
|
RulerBox1.GripKindDefault := gkTriangle;
|
|
for i := 10 to RulerBox1.GripsCount - 1 do
|
|
RulerBox1.GripsKind[ i ] := gkArrow2;
|
|
!!}
|
|
function TRulerBox.GetGripKindDefault: TGripKind;
|
|
begin
|
|
result := fIERuler.GripKindDefault;
|
|
end;
|
|
|
|
procedure TRulerBox.SetGripKindDefault(const Value: TGripKind);
|
|
begin
|
|
fIERuler.GripKindDefault := Value;
|
|
end;
|
|
|
|
|
|
{!!
|
|
<FS>TRulerBox.GripsKind
|
|
|
|
<FM>Declaration<FC>
|
|
property GripsKind[g: integer]: <A TGripKind>;
|
|
|
|
<FM>Description<FN>
|
|
Specifies the style of the grip, g (triangle, arrow, etc).
|
|
|
|
Notes:
|
|
- The default style for grips is specified by <A TRulerBox.GripKindDefault>. Use <A TRulerBox.GripsKind> when you want individual grips with different styles.
|
|
- The width of the grip is specified by <A TRulerBox.GripBaseDim>.
|
|
|
|
<FM>Example<FC>
|
|
// Set default style of grips to gkTriangle, but gkArrow2 to grips > 10
|
|
RulerBox1.GripKindDefault := gkTriangle;
|
|
for i := 10 to RulerBox1.GripsCount - 1 do
|
|
RulerBox1.GripsKind[ i ] := gkArrow2;
|
|
!!}
|
|
function TRulerBox.GetGripsKind(i: integer): TGripKind;
|
|
begin
|
|
result := fIERuler.GripsKind[ i ];
|
|
end;
|
|
|
|
procedure TRulerBox.SetGripsKind(i: integer; v: TGripKind);
|
|
begin
|
|
fIERuler.GripsKind[ i ] := v;
|
|
end;
|
|
|
|
|
|
{!!
|
|
<FS>TRulerBox.GripsDir
|
|
|
|
<FM>Declaration<FC>
|
|
property GripsDir: <A TGripsDir>;
|
|
|
|
<FM>Description<FN>
|
|
Specifies the direction of the grips (up or down).
|
|
|
|
Note: On a vertical ruler, gdUp implies left, whereas gdDown is Right.
|
|
|
|
Default: gdUp
|
|
!!}
|
|
function TRulerBox.GetGripsDir: TGripsDir;
|
|
begin
|
|
Result := fIERuler.GripsDir;
|
|
end;
|
|
|
|
procedure TRulerBox.SetGripsDir(v: TGripsDir);
|
|
begin
|
|
fIERuler.GripsDir := v;
|
|
end;
|
|
|
|
|
|
{!!
|
|
<FS>TRulerBox.GripColorDefault
|
|
|
|
<FM>Declaration<FC>
|
|
property GripColorDefault: TColor;
|
|
|
|
<FM>Description<FN>
|
|
Specifies the brush color of all grips.
|
|
This color will be assigned to any grips for which you have not set a custom color using <A TRulerBox.GripsColor>.
|
|
|
|
Notes:
|
|
- You can set the pen color with <A TRulerBox.GripPenColor>
|
|
- This value may be overridden if <A TIEImageEnGlobalSettings.EnableTheming> is enabled.
|
|
|
|
Default: clBtnFace
|
|
|
|
<FM>Example<FC>
|
|
// Set default color of grips to clSilver, but clRed to grips > 10
|
|
RulerBox1.GripColorDefault := clSilver;
|
|
for i := 10 to RulerBox1.GripsCount - 1 do
|
|
RulerBox1.GripsColor[ i ] := clRed;
|
|
!!}
|
|
function TRulerBox.GetGripColorDefault: TColor;
|
|
begin
|
|
result := fIERuler.GripColorDefault;
|
|
end;
|
|
|
|
procedure TRulerBox.SetGripColorDefault(const Value: TColor);
|
|
begin
|
|
fIERuler.GripColorDefault := Value;
|
|
end;
|
|
|
|
|
|
{!!
|
|
<FS>TRulerBox.GripsColor
|
|
|
|
<FM>Declaration<FC>
|
|
property GripsColor[g: integer]: TColor;
|
|
|
|
<FM>Description<FN>
|
|
Specifies the brush color of the grip, g.
|
|
|
|
Note: The default color of all grips is set by <A TRulerBox.GripColorDefault>. Use <FC>GripsColor<FN> to assign custom colors to specific grips.
|
|
|
|
You can set the pen color with <A TRulerBox.GripPenColor>
|
|
|
|
<FM>Example<FC>
|
|
// Set default color of grips to clSilver, but clRed for grips > 10
|
|
RulerBox1.GripColorDefault := clSilver;
|
|
for i := 10 to RulerBox1.GripsCount - 1 do
|
|
RulerBox1.GripsColor[ i ] := clRed;
|
|
!!}
|
|
function TRulerBox.GetGripsColor(i: integer): TColor;
|
|
begin
|
|
result := fIERuler.GripsColor[ i ];
|
|
end;
|
|
|
|
procedure TRulerBox.SetGripsColor(i: integer; p: TColor);
|
|
begin
|
|
fIERuler.GripsColor[ i ] := p;
|
|
end;
|
|
|
|
|
|
{!!
|
|
<FS>TRulerBox.GripPenColor
|
|
|
|
<FM>Declaration<FC>
|
|
property GripPenColor: TColor;
|
|
|
|
<FM>Description<FN>
|
|
Specifies the pen (border) color of all grips.
|
|
|
|
Notes:
|
|
- The brush color is specified by <A TRulerBox.GripColorDefault>, or for individual grips with <A TRulerBox.GripsColor>.
|
|
- This value may be overridden if <A TIEImageEnGlobalSettings.EnableTheming> is enabled.
|
|
|
|
Default: clBlack
|
|
!!}
|
|
function TRulerBox.GetGripPenColor: TColor;
|
|
begin
|
|
result := fIERuler.GripPenColor;
|
|
end;
|
|
|
|
procedure TRulerBox.SetGripPenColor(const Value: TColor);
|
|
begin
|
|
fIERuler.GripPenColor := Value;
|
|
end;
|
|
|
|
|
|
{!!
|
|
<FS>TRulerBox.GripBaseDim
|
|
|
|
<FM>Declaration<FC>
|
|
property GripBaseDim: integer;
|
|
|
|
<FM>Description<FN>
|
|
Specifies the width of grip triangles in pixels.
|
|
|
|
Default: 12
|
|
|
|
See also: <A TRulerBox.GripsKind>
|
|
!!}
|
|
function TRulerBox.GetGripBaseDim: integer;
|
|
begin
|
|
result := fIERuler.GripBaseDim;
|
|
end;
|
|
|
|
procedure TRulerBox.SetGripBaseDim(v: integer);
|
|
begin
|
|
fIERuler.GripBaseDim := v;
|
|
end;
|
|
|
|
|
|
{!!
|
|
<FS>TRulerBox.MaxGripHeight
|
|
|
|
<FM>Declaration<FC>
|
|
property MaxGripHeight: integer;
|
|
|
|
<FM>Description<FN>
|
|
Specifies the maximum height of the grip.
|
|
|
|
Default: 15
|
|
!!}
|
|
function TRulerBox.GetMaxGripHeight: integer;
|
|
begin
|
|
result := fIERuler.MaxGripHeight;
|
|
end;
|
|
|
|
procedure TRulerBox.SetMaxGripHeight(const Value: integer);
|
|
begin
|
|
fIERuler.MaxGripHeight := Value;
|
|
end;
|
|
|
|
|
|
{!!
|
|
<FS>TRulerBox.LockUpdate
|
|
|
|
<FM>Declaration<FC>
|
|
procedure LockUpdate();
|
|
|
|
<FM>Description<FN>
|
|
Prevents redrawing of the control while you are setting many properties. Call <FC>LockUpdate<FN> before setting properties, and then <A TRulerBox.UnlockUpdate> to resume drawing.
|
|
|
|
Note: Multiple <FC>LockUpdate<FN> can be in use at once. The control will not be updated until an equal number of <A TRulerBox.UnlockUpdate> calls have been made.
|
|
|
|
<FM>Example<FC>
|
|
RulerBox1.LockUpdate();
|
|
RulerBox1.DotPerUnit := 1;
|
|
RulerBox1.Frequency := 20;
|
|
RulerBox1.LabelFreq := 100;
|
|
RulerBox1.UnlockUpdate();
|
|
!!}
|
|
procedure TRulerBox.LockUpdate();
|
|
begin
|
|
fIERuler.LockUpdate();
|
|
end;
|
|
|
|
{!!
|
|
<FS>TRulerBox.UnlockUpdate
|
|
|
|
<FM>Declaration<FC>
|
|
procedure UnlockUpdate();
|
|
|
|
<FM>Description<FN>
|
|
Prevents redrawing of the control while you are setting many properties. Call <A TRulerBox.LockUpdate> before setting properties, and then <FC>UnlockUpdate<FN> to resume drawing.
|
|
|
|
Note: Multiple <A TRulerBox.LockUpdate> can be in use at once. The control will not be updated until an equal number of <FC>UnlockUpdate<FN> calls have been made.
|
|
|
|
<FM>Example<FC>
|
|
RulerBox1.LockUpdate();
|
|
RulerBox1.DotPerUnit := 1;
|
|
RulerBox1.Frequency := 20;
|
|
RulerBox1.LabelFreq := 100;
|
|
RulerBox1.UnlockUpdate();
|
|
!!}
|
|
procedure TRulerBox.UnlockUpdate();
|
|
begin
|
|
fIERuler.UnlockUpdate();
|
|
end;
|
|
|
|
|
|
{!!
|
|
<FS>TRulerBox.OnRulerClick
|
|
|
|
<FM>Declaration<FC>
|
|
property OnRulerClick: <A TRulerClickEvent>;
|
|
|
|
<FM>Description<FN>
|
|
Occurs when the user clicks the ruler.
|
|
|
|
<FM>Example<FC>
|
|
procedure TForm1.RulerClick(Sender: TObject; RulerDir: TRulerDir; Ps: double);
|
|
begin
|
|
case RulerDir of
|
|
rdHorizontal : ShowMessage( 'Horizontal ruler clicked at: ' + FloatToStr( Ps ));
|
|
rdVertical : ShowMessage( 'Vertical ruler clicked at: ' + FloatToStr( Ps ));
|
|
end;
|
|
end;
|
|
!!}
|
|
function TRulerBox.GetOnRulerClick: TRulerClickEvent;
|
|
begin
|
|
result := fIERuler.fOnRulerClick;
|
|
end;
|
|
|
|
procedure TRulerBox.SetOnRulerClick(const Value: TRulerClickEvent);
|
|
begin
|
|
fIERuler.fOnRulerClick := Value;
|
|
end;
|
|
|
|
|
|
{!!
|
|
<FS>TRulerBox.OnRulerGripClick
|
|
|
|
<FM>Declaration<FC>
|
|
property OnRulerGripClick: <A TRulerGripClickEvent>;
|
|
|
|
<FM>Description<FN>
|
|
Occurs when the user clicks on a grip.
|
|
|
|
<FM>Example<FC>
|
|
procedure TForm1.RulerGripClick(Sender: TObject; RulerDir: TRulerDir; Grip: integer; GripPos: Double);
|
|
begin
|
|
case RulerDir of
|
|
rdHorizontal : ShowMessage( format( 'Grip %d clicked on horizontal ruler', [ Grip ]));
|
|
rdVertical : ShowMessage( format( 'Grip %d clicked on vertical ruler', [ Grip ]));
|
|
end;
|
|
end;
|
|
!!}
|
|
function TRulerBox.GetOnRulerGripClick: TRulerGripClickEvent;
|
|
begin
|
|
result := fIERuler.fOnRulerGripClick;
|
|
end;
|
|
|
|
procedure TRulerBox.SetOnRulerGripClick(const Value: TRulerGripClickEvent);
|
|
begin
|
|
fIERuler.fOnRulerGripClick := Value;
|
|
end;
|
|
|
|
|
|
{!!
|
|
<FS>TRulerBox.OnRulerGripDblClick
|
|
|
|
<FM>Declaration<FC>
|
|
property OnRulerGripDblClick: <A TRulerGripClickEvent>;
|
|
|
|
<FM>Description<FN>
|
|
Occurs when the user double-clicks a grip.
|
|
|
|
<FM>Example<FC>
|
|
procedure TForm1.RulerGripDblClick(Sender: TObject; RulerDir: TRulerDir; Grip: integer; GripPos: Double);
|
|
begin
|
|
case RulerDir of
|
|
rdHorizontal : ShowMessage( format( 'Grip %d double-clicked on horizontal ruler', [ Grip ]));
|
|
rdVertical : ShowMessage( format( 'Grip %d double-clicked on vertical ruler', [ Grip ]));
|
|
end;
|
|
end;
|
|
!!}
|
|
function TRulerBox.GetOnRulerGripDblClick: TRulerGripClickEvent;
|
|
begin
|
|
result := fIERuler.fOnRulerGripDblClick;
|
|
end;
|
|
|
|
procedure TRulerBox.SetOnRulerGripDblClick(const Value: TRulerGripClickEvent);
|
|
begin
|
|
fIERuler.fOnRulerGripDblClick := Value;
|
|
end;
|
|
|
|
|
|
{!!
|
|
<FS>TRulerBox.OnRulerPosChange
|
|
|
|
<FM>Declaration<FC>
|
|
property OnRulerPosChange: <A TRulerGripPosChangeEvent>;
|
|
|
|
<FM>Description<FN>
|
|
Occurs when <A TRulerBox.ViewPos> changes.
|
|
|
|
<FM>Example<FC>
|
|
procedure TForm1.RulerPosChange(Sender: TObject; RulerDir: TRulerDir; Grip: integer; NewPos: Double);
|
|
begin
|
|
case RulerDir of
|
|
rdHorizontal : ShowMessage( format( 'Grip %d moved on horizontal ruler', [ Grip ]));
|
|
rdVertical : ShowMessage( format( 'Grip %d moved on vertical ruler', [ Grip ]));
|
|
end;
|
|
end;
|
|
!!}
|
|
function TRulerBox.GetOnRulerPosChange: TRulerGripPosChangeEvent;
|
|
begin
|
|
result := fIERuler.fOnRulerGripPosChange;
|
|
end;
|
|
|
|
procedure TRulerBox.SetOnRulerPosChange(const Value: TRulerGripPosChangeEvent);
|
|
begin
|
|
fIERuler.fOnRulerGripPosChange := Value;
|
|
end;
|
|
|
|
|
|
end.
|
|
|