|
@@ -47,7 +47,7 @@ type
|
|
procedure UpdateLabel;
|
|
procedure UpdateLabel;
|
|
function RoundZoom(AValue: single): single;
|
|
function RoundZoom(AValue: single): single;
|
|
public
|
|
public
|
|
- constructor Create(ALabelCurrentZoom: TLabel; AEditZoom: TEdit; ALayout: TCustomMainFormLayout);
|
|
|
|
|
|
+ constructor Create(ALabelCurrentZoom: TLabel; AEditZoom: TEdit);
|
|
destructor Destroy; override;
|
|
destructor Destroy; override;
|
|
procedure ZoomOriginal;
|
|
procedure ZoomOriginal;
|
|
procedure ZoomFit(AImageWidth,AImageHeight: integer);
|
|
procedure ZoomFit(AImageWidth,AImageHeight: integer);
|
|
@@ -57,6 +57,7 @@ type
|
|
procedure ClearPosition;
|
|
procedure ClearPosition;
|
|
procedure DoAction(const AName: string);
|
|
procedure DoAction(const AName: string);
|
|
function GetScaledArea(const AWorkArea: TRect; AImageWidth, AImageHeight: integer; var AViewOffset: TPoint): TRect;
|
|
function GetScaledArea(const AWorkArea: TRect; AImageWidth, AImageHeight: integer; var AViewOffset: TPoint): TRect;
|
|
|
|
+ property Layout: TCustomMainFormLayout read FLayout write FLayout;
|
|
property EditingZoom: boolean read GetEditingZoom write SetEditingZoom;
|
|
property EditingZoom: boolean read GetEditingZoom write SetEditingZoom;
|
|
property Factor: single read GetZoomFactor write SetZoomFactor;
|
|
property Factor: single read GetZoomFactor write SetZoomFactor;
|
|
property OnZoomChanged: TOnZoomChangedHandler read FOnZoomChangedHandler write FOnZoomChangedHandler;
|
|
property OnZoomChanged: TOnZoomChangedHandler read FOnZoomChangedHandler write FOnZoomChangedHandler;
|
|
@@ -193,11 +194,10 @@ begin
|
|
if not (Key in['0'..'9',#8]) then Key := #0;
|
|
if not (Key in['0'..'9',#8]) then Key := #0;
|
|
end;
|
|
end;
|
|
|
|
|
|
-constructor TZoom.Create(ALabelCurrentZoom: TLabel; AEditZoom: TEdit;
|
|
|
|
- ALayout: TCustomMainFormLayout);
|
|
|
|
|
|
+constructor TZoom.Create(ALabelCurrentZoom: TLabel; AEditZoom: TEdit);
|
|
begin
|
|
begin
|
|
inherited Create;
|
|
inherited Create;
|
|
- FLayout := ALayout;
|
|
|
|
|
|
+ FLayout := nil;
|
|
FLabelCurrentZoom := ALabelCurrentZoom;
|
|
FLabelCurrentZoom := ALabelCurrentZoom;
|
|
FLabelCurrentZoom.OnClick := @LabelCurrentZoom_Click;
|
|
FLabelCurrentZoom.OnClick := @LabelCurrentZoom_Click;
|
|
FEditZoom := AEditZoom;
|
|
FEditZoom := AEditZoom;
|
|
@@ -229,6 +229,7 @@ const pixelMargin = 0;
|
|
var zx,zy: single;
|
|
var zx,zy: single;
|
|
pictureArea: TRect;
|
|
pictureArea: TRect;
|
|
begin
|
|
begin
|
|
|
|
+ if FLayout = nil then exit;
|
|
pictureArea := FLayout.WorkArea;
|
|
pictureArea := FLayout.WorkArea;
|
|
if (AImageWidth = 0) or (AImageHeight = 0) or (pictureArea.right-pictureArea.Left <= pixelMargin)
|
|
if (AImageWidth = 0) or (AImageHeight = 0) or (pictureArea.right-pictureArea.Left <= pixelMargin)
|
|
or (pictureArea.Bottom-pictureArea.top <= pixelMargin) then exit;
|
|
or (pictureArea.Bottom-pictureArea.top <= pixelMargin) then exit;
|