2018-04-02 22:41:48 +00:00
|
|
|
{-----------------------------------------------------------------------------
|
|
|
|
The contents of this file are subject to the Mozilla Public License
|
|
|
|
Version 1.1 (the "License"); you may not use this file except in compliance
|
|
|
|
with the License. You may obtain a copy of the License at
|
|
|
|
http://www.mozilla.org/MPL/MPL-1.1.html
|
|
|
|
|
|
|
|
Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See the License for
|
|
|
|
the specific language governing rights and limitations under the License.
|
|
|
|
|
|
|
|
The Original Code is: JvgRuler.PAS, released on 2003-01-15.
|
|
|
|
|
|
|
|
The Initial Developer of the Original Code is Andrey V. Chudin, [chudin att yandex dott ru]
|
|
|
|
Portions created by Andrey V. Chudin are Copyright (C) 2003 Andrey V. Chudin.
|
|
|
|
All Rights Reserved.
|
|
|
|
|
|
|
|
Contributor(s):
|
|
|
|
Michael Beck [mbeck att bigfoot dott com].
|
|
|
|
|
|
|
|
You may retrieve the latest version of this file at the Project JEDI's JVCL home page,
|
|
|
|
located at http://jvcl.delphi-jedi.org
|
|
|
|
|
|
|
|
Known Issues:
|
|
|
|
-----------------------------------------------------------------------------}
|
|
|
|
// $Id$
|
|
|
|
|
|
|
|
unit JvRuler;
|
|
|
|
|
|
|
|
{$mode objfpc}{$H+}
|
|
|
|
|
|
|
|
interface
|
|
|
|
|
2020-04-24 20:47:11 +00:00
|
|
|
uses
|
2019-12-14 00:28:48 +00:00
|
|
|
LCLIntf, LCLType, LCLVersion, Types,
|
|
|
|
Classes, SysUtils, Graphics, Controls,
|
|
|
|
JvComponent;
|
|
|
|
|
|
|
|
const
|
2020-01-14 23:37:20 +00:00
|
|
|
DEFAULT_JVR_MAJOR_TICKLENGTH = 8;
|
|
|
|
DEFAULT_JVR_MINOR_TICKLENGTH = 3;
|
|
|
|
DEFAULT_JVR_MARKER_SIZE = 6;
|
2018-04-02 22:41:48 +00:00
|
|
|
|
|
|
|
type
|
|
|
|
TJvRulerUnit = (ruCentimeters, ruInches, ruPixels);
|
|
|
|
TJvRulerOrientation = (roHorizontal, roVertical);
|
|
|
|
|
|
|
|
TJvRuler = class(TJvGraphicControl)
|
|
|
|
private
|
|
|
|
FUseUnit: TJvRulerUnit;
|
|
|
|
FOrientation: TJvRulerOrientation;
|
|
|
|
FPosition: Double;
|
2019-12-14 00:28:48 +00:00
|
|
|
FTickColor: TColor;
|
|
|
|
FMarkerColor: TColor;
|
|
|
|
FMarkerFilled: Boolean;
|
|
|
|
FMarkerSize: Integer;
|
|
|
|
FMajorTickLength: Integer;
|
|
|
|
FMinorTickCount: Integer;
|
|
|
|
FMinorTickLength: Integer;
|
|
|
|
FShowBaseline: Boolean;
|
|
|
|
FShowPositionMarker: Boolean;
|
|
|
|
procedure SetMarkerColor(const Value: TColor);
|
|
|
|
procedure SetMarkerFilled(const Value: Boolean);
|
|
|
|
procedure SetMarkerSize(const Value: Integer);
|
|
|
|
procedure SetMajorTickLength(const Value: Integer);
|
|
|
|
procedure SetMinorTickCount(const Value: Integer);
|
|
|
|
procedure SetMinorTickLength(const Value: Integer);
|
|
|
|
procedure SetOrientation(const Value: TJvRulerOrientation);
|
2018-04-02 22:41:48 +00:00
|
|
|
procedure SetPosition(const Value: Double);
|
2019-12-14 00:28:48 +00:00
|
|
|
procedure SetShowBaseline(const Value: Boolean);
|
|
|
|
procedure SetShowPositionMarker(const Value: Boolean);
|
|
|
|
procedure SetTickColor(const Value: TColor);
|
|
|
|
procedure SetUseUnit(const Value: TJvRulerUnit);
|
2018-04-02 22:41:48 +00:00
|
|
|
protected
|
2019-12-14 00:28:48 +00:00
|
|
|
procedure DoAutoAdjustLayout(const AMode: TLayoutAdjustmentPolicy;
|
|
|
|
const AXProportion, AYProportion: Double); override;
|
|
|
|
class function GetControlClassDefaultSize: TSize; override;
|
2018-04-02 22:41:48 +00:00
|
|
|
procedure Paint; override;
|
|
|
|
public
|
|
|
|
constructor Create(AOwner: TComponent); override;
|
|
|
|
published
|
|
|
|
property Align;
|
2019-12-14 00:28:48 +00:00
|
|
|
property BorderSpacing;
|
2018-04-02 22:41:48 +00:00
|
|
|
property Font;
|
2019-12-14 00:28:48 +00:00
|
|
|
property MarkerColor: TColor read FMarkerColor write SetMarkerColor default clBlack;
|
|
|
|
property MarkerFilled: Boolean read FMarkerFilled write SetMarkerFilled default true;
|
2020-01-14 23:37:20 +00:00
|
|
|
property MarkerSize: Integer read FMarkerSize write SetMarkerSize default DEFAULT_JVR_MARKER_SIZE;
|
|
|
|
property MajorTickLength: Integer read FMajorTickLength write SetMajorTickLength default DEFAULT_JVR_MAJOR_TICKLENGTH;
|
2019-12-14 00:28:48 +00:00
|
|
|
property MinorTickCount: Integer read FMinorTickCount write SetMinorTickCount default 1;
|
2020-01-14 23:37:20 +00:00
|
|
|
property MinorTickLength: Integer read FMinorTickLength write SetMinorTicklength default DEFAULT_JVR_MINOR_TICKLENGTH;
|
2018-04-02 22:41:48 +00:00
|
|
|
property Orientation: TJvRulerOrientation read FOrientation write SetOrientation default roHorizontal;
|
|
|
|
property Position: Double read FPosition write SetPosition;
|
2019-12-14 00:28:48 +00:00
|
|
|
property ShowBaseline: Boolean read FShowBaseline write SetShowBaseLine default false;
|
|
|
|
property ShowPositionMarker: Boolean read FShowPositionMarker write SetShowPositionMarker default false;
|
|
|
|
property TickColor: TColor read FTickColor write SetTickColor default clBlack;
|
2018-04-02 22:41:48 +00:00
|
|
|
property UseUnit: TJvRulerUnit read FUseUnit write SetUseUnit default ruCentimeters;
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
implementation
|
|
|
|
|
2019-12-14 00:28:48 +00:00
|
|
|
uses
|
|
|
|
Math;
|
|
|
|
|
2018-04-02 22:41:48 +00:00
|
|
|
const
|
|
|
|
LogPixels: array [Boolean] of Integer = (LOGPIXELSY, LOGPIXELSX);
|
|
|
|
|
|
|
|
function InchesToPixels(DC: HDC; Value: Double; IsHorizontal: Boolean): Integer;
|
|
|
|
begin
|
|
|
|
Result := Round(Value * GetDeviceCaps(DC, LogPixels[IsHorizontal]));
|
|
|
|
end;
|
|
|
|
|
|
|
|
function CentimetersToPixels(DC: HDC; Value: Double; IsHorizontal: Boolean): Integer;
|
|
|
|
begin
|
|
|
|
Result := Round(Value * GetDeviceCaps(DC, LogPixels[IsHorizontal]) / 2.54);
|
|
|
|
end;
|
|
|
|
|
2019-12-14 00:28:48 +00:00
|
|
|
function IsMultipleOf(a, b: Double): Boolean;
|
|
|
|
var
|
|
|
|
c: Double;
|
|
|
|
begin
|
|
|
|
c := a / b;
|
|
|
|
Result := SameValue(c, round(c));
|
|
|
|
end;
|
|
|
|
|
2018-04-02 22:41:48 +00:00
|
|
|
|
|
|
|
//=== { TJvRuler } ===========================================================
|
|
|
|
|
|
|
|
constructor TJvRuler.Create(AOwner: TComponent);
|
|
|
|
begin
|
|
|
|
inherited Create(AOwner);
|
|
|
|
FOrientation := roHorizontal;
|
2019-12-14 00:28:48 +00:00
|
|
|
FTickColor := clBlack;
|
2018-04-02 22:41:48 +00:00
|
|
|
FUseUnit := ruCentimeters;
|
2019-12-14 00:28:48 +00:00
|
|
|
FMarkerFilled := true;
|
2020-01-14 23:37:20 +00:00
|
|
|
FMarkerSize := DEFAULT_JVR_MARKER_SIZE;
|
|
|
|
FMajorTickLength := DEFAULT_JVR_MAJOR_TICKLENGTH;
|
|
|
|
FMinorTickLength := DEFAULT_JVR_MINOR_TICKLENGTH;
|
2019-12-14 00:28:48 +00:00
|
|
|
FMinorTickCount := 1;
|
|
|
|
with GetControlClassDefaultSize do
|
|
|
|
SetInitialBounds(0, 0, CX, CY);
|
|
|
|
end;
|
|
|
|
|
|
|
|
procedure TJvRuler.DoAutoAdjustLayout(const AMode: TLayoutAdjustmentPolicy;
|
|
|
|
const AXProportion, AYProportion: Double);
|
|
|
|
var
|
|
|
|
proportion: Double;
|
|
|
|
begin
|
|
|
|
inherited;
|
|
|
|
if AMode in [lapAutoAdjustWithoutHorizontalScrolling, lapAutoAdjustForDPI] then
|
|
|
|
begin
|
|
|
|
case FOrientation of
|
|
|
|
roHorizontal: proportion := AYProportion;
|
|
|
|
roVertical: proportion := AXProportion;
|
|
|
|
end;
|
2020-01-14 23:37:20 +00:00
|
|
|
FMarkerSize := round(FMarkerSize * proportion);
|
|
|
|
FMajorTickLength := round(FMajorTickLength * proportion);
|
|
|
|
FMinorTicklength := round(FMinorTickLength * proportion);
|
2019-12-14 00:28:48 +00:00
|
|
|
end;
|
|
|
|
end;
|
|
|
|
|
|
|
|
class function TJvRuler.GetControlClassDefaultSize: TSize;
|
|
|
|
begin
|
|
|
|
Result.CX := 380;
|
|
|
|
Result.CY := 25;
|
|
|
|
end;
|
|
|
|
|
2018-04-02 22:41:48 +00:00
|
|
|
procedure TJvRuler.Paint;
|
|
|
|
const
|
2019-12-14 00:28:48 +00:00
|
|
|
MAJOR_DIST: array[TJvRulerUnit] of Double = (1.0, 1.0, 100.0);
|
2018-04-02 22:41:48 +00:00
|
|
|
var
|
|
|
|
X, Y: Double;
|
|
|
|
PX, PY, Pos: Integer;
|
|
|
|
S: string;
|
|
|
|
R: TRect;
|
|
|
|
ts: TTextStyle;
|
|
|
|
h, w: Integer;
|
2019-12-14 00:28:48 +00:00
|
|
|
delta: Double;
|
|
|
|
isLabeledTick: Boolean;
|
|
|
|
isLongTick: Boolean;
|
|
|
|
tickLength: Integer;
|
|
|
|
baselineOffset: Integer;
|
|
|
|
markerSizeL, markerSizeS: Integer;
|
|
|
|
Pts: array[0..2] of TPoint;
|
2018-04-02 22:41:48 +00:00
|
|
|
begin
|
|
|
|
w := inherited Width;
|
|
|
|
h := inherited Height;
|
2019-12-14 00:28:48 +00:00
|
|
|
ts := Canvas.TextStyle;
|
|
|
|
ts.SingleLine := true;
|
2018-04-02 22:41:48 +00:00
|
|
|
Canvas.Font := Font;
|
2019-12-14 00:28:48 +00:00
|
|
|
Canvas.Pen.Style := psSolid;
|
|
|
|
Canvas.Pen.Color := FTickColor;
|
2018-04-02 22:41:48 +00:00
|
|
|
X := 0;
|
|
|
|
Y := 0;
|
2019-12-14 00:28:48 +00:00
|
|
|
delta := MAJOR_DIST[FUseUnit] / (FMinorTickCount + 1);
|
|
|
|
case FUseUnit of
|
|
|
|
ruInches: Pos := InchesToPixels(Canvas.Handle, Position, Orientation = roHorizontal);
|
|
|
|
ruCentimeters: Pos := CentimetersToPixels(Canvas.Handle, Position, Orientation = roHorizontal);
|
|
|
|
ruPixels: Pos := Round(Position);
|
|
|
|
end;
|
|
|
|
|
|
|
|
// Draw baseline
|
|
|
|
baseLineOffset := 0;
|
|
|
|
if FShowBaseLine then
|
|
|
|
begin
|
|
|
|
case FOrientation of
|
|
|
|
roHorizontal: Canvas.Line(0, h-1, w, h-1);
|
|
|
|
roVertical: Canvas.Line(w-1, 0, w-1, h);
|
|
|
|
end;
|
|
|
|
baseLineOffset := 1;
|
|
|
|
end;
|
|
|
|
|
|
|
|
// Draw labels and ticks
|
|
|
|
while true do begin
|
2018-04-02 22:41:48 +00:00
|
|
|
case FUseUnit of
|
|
|
|
ruInches:
|
|
|
|
begin
|
|
|
|
PX := InchesToPixels(Canvas.Handle, X, True);
|
|
|
|
PY := InchesToPixels(Canvas.Handle, Y, False);
|
|
|
|
end;
|
|
|
|
ruCentimeters:
|
|
|
|
begin
|
|
|
|
PX := CentimetersToPixels(Canvas.Handle, X, True);
|
|
|
|
PY := CentimetersToPixels(Canvas.Handle, Y, False);
|
|
|
|
end;
|
2019-12-14 00:28:48 +00:00
|
|
|
ruPixels:
|
|
|
|
begin
|
2019-12-14 11:43:43 +00:00
|
|
|
PX := Round(X);
|
|
|
|
PY := Round(Y);
|
2019-12-14 00:28:48 +00:00
|
|
|
Pos := Round(Position);
|
|
|
|
end;
|
|
|
|
else
|
|
|
|
raise Exception.Create('Units not supported.');
|
|
|
|
end;
|
|
|
|
|
|
|
|
case Orientation of
|
|
|
|
roHorizontal: if PX > w then break;
|
|
|
|
roVertical: if PY > h then break;
|
2018-04-02 22:41:48 +00:00
|
|
|
end;
|
|
|
|
|
2019-12-14 00:28:48 +00:00
|
|
|
//SetBkMode(Canvas.Handle, TRANSPARENT);
|
|
|
|
with Canvas do begin
|
|
|
|
if Orientation = roHorizontal then
|
|
|
|
begin
|
|
|
|
isLabeledTick := IsMultipleOf(X, MAJOR_DIST[FUseUnit]) and (X <> 0);
|
|
|
|
if isLabeledTick then
|
2018-04-02 22:41:48 +00:00
|
|
|
begin
|
2019-12-14 00:28:48 +00:00
|
|
|
//R := Rect(PX - 10, 0, PX + 10, h);
|
|
|
|
if UseUnit = ruPixels then
|
|
|
|
S := IntToStr(PX)
|
|
|
|
else
|
2019-12-14 11:32:22 +00:00
|
|
|
S := IntToStr(Round(X));
|
2019-12-14 00:28:48 +00:00
|
|
|
R := Rect(PX - TextWidth(S), 0, PX + TextWidth(S), h);
|
|
|
|
ts.Alignment := taCenter;
|
|
|
|
TextRect(R, R.Left, R.Top, S, ts);
|
|
|
|
//Windows.DrawText(Handle, PChar(S), Length(S), R, DT_SINGLELINE or DT_CENTER);
|
|
|
|
end;
|
|
|
|
isLongTick := isLabeledTick or (IsMultipleOf(2*X, MAJOR_DIST[FUseUnit]) and (FMinorTickCount > 1));
|
|
|
|
tickLength := IfThen(isLongTick, FMajorTickLength, FMinorTickLength);
|
|
|
|
MoveTo(PX, h - baselineOffset - tickLength);
|
|
|
|
LineTo(PX, h - baselineOffset);
|
|
|
|
end else
|
|
|
|
begin
|
|
|
|
isLabeledTick := IsMultipleOf(Y, MAJOR_DIST[FUseUnit]) and (Y <> 0);
|
|
|
|
if isLabeledTick then
|
2018-04-02 22:41:48 +00:00
|
|
|
begin
|
2019-12-14 00:28:48 +00:00
|
|
|
if UseUnit = ruPixels then
|
|
|
|
S := IntToStr(PY)
|
|
|
|
else
|
2019-12-14 11:32:22 +00:00
|
|
|
S := IntToStr(Round(Y));
|
2019-12-14 00:28:48 +00:00
|
|
|
R := Rect(0, PY - TextHeight(S), w, PY + TextHeight(S));
|
|
|
|
ts.Layout := tlCenter;
|
|
|
|
TextRect(R, R.Left, R.Top, S, ts);
|
|
|
|
//Windows.DrawText(Handle, PChar(S), Length(S), R, DT_SINGLELINE or DT_VCENTER);
|
2018-04-02 22:41:48 +00:00
|
|
|
end;
|
2019-12-14 00:28:48 +00:00
|
|
|
isLongTick := isLabeledTick or (IsMultipleOf(2*Y, MAJOR_DIST[FUseUnit]) and (FMinorTickCount > 1));
|
|
|
|
tickLength := IfThen(isLongTick, FMajorTickLength, FMinorTickLength);
|
|
|
|
MoveTo(w - baselineOffset - tickLength, PY);
|
|
|
|
LineTo(w - baselineOffset, PY);
|
2018-04-02 22:41:48 +00:00
|
|
|
end;
|
2019-12-14 00:28:48 +00:00
|
|
|
X := X + delta;
|
|
|
|
Y := Y + delta;
|
|
|
|
end;
|
|
|
|
end;
|
2018-04-02 22:41:48 +00:00
|
|
|
|
2019-12-14 00:28:48 +00:00
|
|
|
// Draw Position marker
|
|
|
|
if FShowPositionMarker and (Position > 0.0) then
|
|
|
|
begin
|
|
|
|
markerSizeL := FMarkerSize;
|
|
|
|
markerSizeS := FMarkerSize div 2;
|
|
|
|
case Orientation of
|
|
|
|
roHorizontal:
|
|
|
|
begin
|
|
|
|
Pts[0] := Point(Pos - markerSizeS, h - markerSizeL - baseLineOffset);
|
|
|
|
Pts[1] := Point(Pos + markerSizeS, h - markerSizeL - baseLineOffset);
|
|
|
|
Pts[2] := Point(Pos, h - baselineOffset);
|
|
|
|
end;
|
|
|
|
roVertical:
|
|
|
|
begin
|
|
|
|
Pts[0] := Point(w - markerSizeL - baselineOffset, Pos - markerSizeS);
|
|
|
|
Pts[1] := Point(w - markerSizeL - baselineOffset, Pos + markerSizeS);
|
|
|
|
Pts[2] := Point(w - baselineOffset, Pos);
|
|
|
|
end;
|
|
|
|
end;
|
2018-04-02 22:41:48 +00:00
|
|
|
with Canvas do
|
2019-12-14 00:28:48 +00:00
|
|
|
begin
|
|
|
|
Pen.Color := FMarkerColor;
|
|
|
|
Brush.Color := FMarkerColor;
|
|
|
|
if FMarkerFilled then
|
|
|
|
Brush.Style := bsSolid
|
|
|
|
else
|
|
|
|
Brush.Style := bsClear;
|
|
|
|
Polygon(Pts);
|
|
|
|
end;
|
|
|
|
{
|
|
|
|
|
2018-04-02 22:41:48 +00:00
|
|
|
if Orientation = roHorizontal then
|
|
|
|
begin
|
2019-12-14 00:28:48 +00:00
|
|
|
MoveTo(Pos - markerSizeS, h - markerSizeL - baselineOffset);
|
|
|
|
LineTo(Pos + markerSizeS, h - markerSizeL - baselineOffset);
|
|
|
|
LineTo(Pos, h - baselineOffset);
|
|
|
|
LineTo(Pos - markerSizeS, h - markerSizeL - baselineOffset);
|
|
|
|
end else
|
2018-04-02 22:41:48 +00:00
|
|
|
begin
|
2019-12-14 00:28:48 +00:00
|
|
|
MoveTo(w - markerSizeL - baselineOffset, Pos - markerSizeS);
|
|
|
|
LineTo(w - markerSizeL - baselineOffset, Pos + markerSizeS);
|
|
|
|
LineTo(w - baselineOffset, Pos);
|
|
|
|
LineTo(w - markerSizeL - baselineOffset, Pos - markersizeS);
|
2018-04-02 22:41:48 +00:00
|
|
|
end;
|
2019-12-14 00:28:48 +00:00
|
|
|
}
|
|
|
|
end;
|
2018-04-02 22:41:48 +00:00
|
|
|
end;
|
|
|
|
|
2019-12-14 00:28:48 +00:00
|
|
|
procedure TJvRuler.SetMarkerColor(const Value: TColor);
|
2018-04-02 22:41:48 +00:00
|
|
|
begin
|
2019-12-14 00:28:48 +00:00
|
|
|
if FMarkerColor <> Value then
|
2018-04-02 22:41:48 +00:00
|
|
|
begin
|
2019-12-14 00:28:48 +00:00
|
|
|
FMarkerColor := Value;
|
|
|
|
Invalidate;
|
|
|
|
end;
|
|
|
|
end;
|
|
|
|
|
|
|
|
procedure TJvRuler.SetMarkerFilled(const Value: Boolean);
|
|
|
|
begin
|
|
|
|
if FMarkerFilled <> Value then
|
|
|
|
begin
|
|
|
|
FMarkerFilled := Value;
|
|
|
|
Invalidate;
|
|
|
|
end;
|
|
|
|
end;
|
|
|
|
|
|
|
|
procedure TJvRuler.SetMarkerSize(const Value: Integer);
|
|
|
|
begin
|
|
|
|
if FMarkerSize <> Value then
|
|
|
|
begin
|
|
|
|
FMarkerSize := abs(Value);
|
|
|
|
Invalidate;
|
|
|
|
end;
|
|
|
|
end;
|
|
|
|
|
|
|
|
procedure TJvRuler.SetMajorTickLength(const Value: Integer);
|
|
|
|
begin
|
|
|
|
if FMajorTickLength <> Value then
|
|
|
|
begin
|
|
|
|
FMajorTickLength := abs(Value);
|
2018-04-02 22:41:48 +00:00
|
|
|
Invalidate;
|
|
|
|
end;
|
|
|
|
end;
|
|
|
|
|
2019-12-14 00:28:48 +00:00
|
|
|
procedure TJvRuler.SetMinorTickCount(const Value: Integer);
|
|
|
|
begin
|
|
|
|
if FMinorTickCount <> Value then
|
|
|
|
begin
|
|
|
|
FMinorTickCount := abs(Value);
|
|
|
|
Invalidate;
|
|
|
|
end;
|
|
|
|
end;
|
|
|
|
|
|
|
|
procedure TJvRuler.SetMinorTickLength(const Value: Integer);
|
|
|
|
begin
|
|
|
|
if FMinorTickLength <> Value then
|
|
|
|
begin
|
|
|
|
FMinorTickLength := abs(Value);
|
|
|
|
Invalidate;
|
|
|
|
end;
|
|
|
|
end;
|
|
|
|
|
|
|
|
procedure TJvRuler.SetOrientation(const Value: TJvRulerOrientation);
|
2018-04-02 22:41:48 +00:00
|
|
|
begin
|
|
|
|
if FOrientation <> Value then
|
|
|
|
begin
|
|
|
|
FOrientation := Value;
|
2020-01-14 23:37:20 +00:00
|
|
|
if ([csDesigning, csLoading] * ComponentState = [csDesigning]) then
|
2018-04-02 22:41:48 +00:00
|
|
|
SetBounds(Left, Top, Height, Width);
|
|
|
|
Invalidate;
|
|
|
|
end;
|
|
|
|
end;
|
|
|
|
|
2019-12-14 00:28:48 +00:00
|
|
|
procedure TJvRuler.SetPosition(const Value: Double);
|
|
|
|
begin
|
|
|
|
if FPosition <> Value then
|
|
|
|
begin
|
|
|
|
FPosition := Value;
|
|
|
|
Invalidate;
|
|
|
|
end;
|
|
|
|
end;
|
|
|
|
|
|
|
|
procedure TJvRuler.SetShowBaseline(const Value: Boolean);
|
|
|
|
begin
|
|
|
|
if FShowBaseLine <> Value then
|
|
|
|
begin
|
|
|
|
FShowBaseLine := Value;
|
|
|
|
Invalidate;
|
|
|
|
end;
|
|
|
|
end;
|
|
|
|
|
|
|
|
procedure TJvRuler.SetShowPositionMarker(const Value: Boolean);
|
|
|
|
begin
|
|
|
|
if FShowPositionMarker <> Value then
|
|
|
|
begin
|
|
|
|
FShowPositionMarker := Value;
|
|
|
|
Invalidate;
|
|
|
|
end;
|
|
|
|
end;
|
|
|
|
|
|
|
|
procedure TJvRuler.SetTickColor(const Value: TColor);
|
|
|
|
begin
|
|
|
|
if FTickColor <> Value then
|
|
|
|
begin
|
|
|
|
FTickColor := Value;
|
|
|
|
Invalidate;
|
|
|
|
end;
|
|
|
|
end;
|
|
|
|
|
|
|
|
procedure TJvRuler.SetUseUnit(const Value: TJvRulerUnit);
|
2018-04-02 22:41:48 +00:00
|
|
|
begin
|
|
|
|
if FUseUnit <> Value then
|
|
|
|
begin
|
|
|
|
FUseUnit := Value;
|
|
|
|
Invalidate;
|
|
|
|
end;
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
end.
|