mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-18 01:39:25 +02:00
anchordocking: restoretest: zoom
git-svn-id: trunk@39763 -
This commit is contained in:
parent
b0a41e34b9
commit
83842a0123
@ -28,13 +28,16 @@
|
||||
<LaunchingApplication PathPlusParams="/usr/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
|
||||
</local>
|
||||
</RunParams>
|
||||
<RequiredPackages Count="2">
|
||||
<RequiredPackages Count="3">
|
||||
<Item1>
|
||||
<PackageName Value="AnchorDocking"/>
|
||||
<PackageName Value="LCL"/>
|
||||
</Item1>
|
||||
<Item2>
|
||||
<PackageName Value="SynEdit"/>
|
||||
<PackageName Value="AnchorDocking"/>
|
||||
</Item2>
|
||||
<Item3>
|
||||
<PackageName Value="SynEdit"/>
|
||||
</Item3>
|
||||
</RequiredPackages>
|
||||
<Units Count="3">
|
||||
<Unit0>
|
||||
|
@ -5,8 +5,8 @@ unit ADLayoutViewer;
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, types, math, Controls, Graphics, AnchorDockStorage,
|
||||
LazLogger;
|
||||
Classes, SysUtils, types, math, Controls, Graphics, ComCtrls,
|
||||
AnchorDockStorage, LazLogger;
|
||||
|
||||
type
|
||||
TADLTVMonitor = class
|
||||
@ -17,16 +17,21 @@ type
|
||||
X, Y: integer;
|
||||
end;
|
||||
|
||||
{ TADLayoutTreeView }
|
||||
{ TADCustomLayoutTreeView }
|
||||
|
||||
TADLayoutTreeView = class(TCustomControl)
|
||||
TADCustomLayoutTreeView = class(TCustomControl)
|
||||
private
|
||||
FLayout: TAnchorDockLayoutTree;
|
||||
FScaleMax: double;
|
||||
FScaleMin: double;
|
||||
FScale: double;
|
||||
FBounds: TRect;
|
||||
FScaledBounds: TRect;
|
||||
FScaledScroll: TPoint;
|
||||
FMonitors: array of TADLTVMonitor;
|
||||
FZoomTrackbar: TCustomTrackBar;
|
||||
FOldZoombarOnChange: TNotifyEvent;
|
||||
FIgnoreZoomTrackbarChange: boolean;
|
||||
function GetLayoutMaxX: integer;
|
||||
function GetLayoutMaxY: integer;
|
||||
function GetLayoutMinX: integer;
|
||||
@ -38,12 +43,20 @@ type
|
||||
function GetScaledMinY: integer;
|
||||
function GetScaledOffsetX: integer;
|
||||
function GetScaledOffsetY: integer;
|
||||
procedure SetScaleMax(AValue: double);
|
||||
procedure SetScaleMin(AValue: double);
|
||||
procedure SetScale(AValue: double);
|
||||
procedure SetScaledOffsetX(AValue: integer);
|
||||
procedure SetScaledOffsetY(AValue: integer);
|
||||
procedure ComputeLayout;
|
||||
procedure ClearMonitors;
|
||||
function FindMonitor(Monitor: integer): TADLTVMonitor;
|
||||
procedure SetZoomTrackbar(AValue: TCustomTrackBar);
|
||||
procedure UpdateZoomTrackBar;
|
||||
procedure ZoomTrackbarChange(Sender: TObject);
|
||||
protected
|
||||
procedure Notification(AComponent: TComponent; Operation: TOperation);
|
||||
override;
|
||||
public
|
||||
constructor Create(AOwner: TComponent); override;
|
||||
destructor Destroy; override;
|
||||
@ -64,90 +77,135 @@ type
|
||||
property ScaledMaxY: integer read GetScaledMaxY;
|
||||
function MonitorCount: integer;
|
||||
property Monitors[Index: integer]: TADLTVMonitor read GetMonitors;
|
||||
property ZoomTrackbar: TCustomTrackBar read FZoomTrackbar write SetZoomTrackbar;
|
||||
function ScaleToZoomTrackBarPos(aScale: double): integer;
|
||||
function ZoomTrackBarPosToScale(p: integer): double;
|
||||
property ScaleMin: double read FScaleMin write SetScaleMin;
|
||||
property ScaleMax: double read FScaleMax write SetScaleMax;
|
||||
end;
|
||||
|
||||
TADLayoutTreeView = class(TADCustomLayoutTreeView)
|
||||
published
|
||||
property Scale: double read FScale write SetScale;
|
||||
property ScaledOffsetX: integer read GetScaledOffsetX write SetScaledOffsetX;
|
||||
property ScaledOffsetY: integer read GetScaledOffsetY write SetScaledOffsetY;
|
||||
property ZoomTrackbar: TCustomTrackBar read FZoomTrackbar write SetZoomTrackbar;
|
||||
property ScaleMin: double read FScaleMin write SetScaleMin;
|
||||
property ScaleMax: double read FScaleMax write SetScaleMax;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
{ TADLayoutTreeView }
|
||||
{ TADCustomLayoutTreeView }
|
||||
|
||||
procedure TADLayoutTreeView.SetScale(AValue: double);
|
||||
procedure TADCustomLayoutTreeView.SetScale(AValue: double);
|
||||
begin
|
||||
AValue:=Min(ScaleMax,Max(AValue,ScaleMin));
|
||||
if FScale=AValue then Exit;
|
||||
FScale:=AValue;
|
||||
FScaledBounds:=ScaleRect(FBounds);
|
||||
UpdateZoomTrackBar;
|
||||
Invalidate;
|
||||
end;
|
||||
|
||||
function TADLayoutTreeView.GetLayoutMaxX: integer;
|
||||
procedure TADCustomLayoutTreeView.ZoomTrackbarChange(Sender: TObject);
|
||||
begin
|
||||
if not FIgnoreZoomTrackbarChange then
|
||||
Scale:=ZoomTrackBarPosToScale(ZoomTrackbar.Position);
|
||||
if Assigned(FOldZoombarOnChange) then
|
||||
FOldZoombarOnChange(Sender);
|
||||
end;
|
||||
|
||||
function TADCustomLayoutTreeView.GetLayoutMaxX: integer;
|
||||
begin
|
||||
Result:=FBounds.Right;
|
||||
end;
|
||||
|
||||
function TADLayoutTreeView.GetLayoutMaxY: integer;
|
||||
function TADCustomLayoutTreeView.GetLayoutMaxY: integer;
|
||||
begin
|
||||
Result:=FBounds.Bottom;
|
||||
end;
|
||||
|
||||
function TADLayoutTreeView.GetLayoutMinX: integer;
|
||||
function TADCustomLayoutTreeView.GetLayoutMinX: integer;
|
||||
begin
|
||||
Result:=FBounds.Left;
|
||||
end;
|
||||
|
||||
function TADLayoutTreeView.GetLayoutMinY: integer;
|
||||
function TADCustomLayoutTreeView.GetLayoutMinY: integer;
|
||||
begin
|
||||
Result:=FBounds.Top;
|
||||
end;
|
||||
|
||||
function TADLayoutTreeView.GetMonitors(Index: integer): TADLTVMonitor;
|
||||
function TADCustomLayoutTreeView.GetMonitors(Index: integer): TADLTVMonitor;
|
||||
begin
|
||||
Result:=FMonitors[Index];
|
||||
end;
|
||||
|
||||
function TADLayoutTreeView.GetScaledMaxX: integer;
|
||||
function TADCustomLayoutTreeView.GetScaledMaxX: integer;
|
||||
begin
|
||||
Result:=FScaledBounds.Right;
|
||||
end;
|
||||
|
||||
function TADLayoutTreeView.GetScaledMaxY: integer;
|
||||
function TADCustomLayoutTreeView.GetScaledMaxY: integer;
|
||||
begin
|
||||
Result:=FScaledBounds.Bottom;
|
||||
end;
|
||||
|
||||
function TADLayoutTreeView.GetScaledMinX: integer;
|
||||
function TADCustomLayoutTreeView.GetScaledMinX: integer;
|
||||
begin
|
||||
Result:=FScaledBounds.Left;
|
||||
end;
|
||||
|
||||
function TADLayoutTreeView.GetScaledMinY: integer;
|
||||
function TADCustomLayoutTreeView.GetScaledMinY: integer;
|
||||
begin
|
||||
Result:=FScaledBounds.Top;
|
||||
end;
|
||||
|
||||
function TADLayoutTreeView.GetScaledOffsetX: integer;
|
||||
function TADCustomLayoutTreeView.GetScaledOffsetX: integer;
|
||||
begin
|
||||
Result:=FScaledScroll.X;
|
||||
end;
|
||||
|
||||
function TADLayoutTreeView.GetScaledOffsetY: integer;
|
||||
function TADCustomLayoutTreeView.GetScaledOffsetY: integer;
|
||||
begin
|
||||
Result:=FScaledScroll.Y;
|
||||
end;
|
||||
|
||||
procedure TADLayoutTreeView.SetScaledOffsetX(AValue: integer);
|
||||
procedure TADCustomLayoutTreeView.SetScaleMax(AValue: double);
|
||||
// must be >=1.0
|
||||
begin
|
||||
AValue:=Max(AValue,1.0);
|
||||
if FScaleMax=AValue then Exit;
|
||||
FScaleMax:=AValue;
|
||||
Scale:=Min(ScaleMax,Max(Scale,ScaleMin));
|
||||
UpdateZoomTrackBar;
|
||||
end;
|
||||
|
||||
procedure TADCustomLayoutTreeView.SetScaleMin(AValue: double);
|
||||
// must be between 0.00001 and 1.0
|
||||
begin
|
||||
AValue:=Min(1.0,Max(AValue,0.00001));
|
||||
if FScaleMin=AValue then Exit;
|
||||
FScaleMin:=AValue;
|
||||
Scale:=Min(ScaleMax,Max(Scale,ScaleMin));
|
||||
UpdateZoomTrackBar;
|
||||
end;
|
||||
|
||||
procedure TADCustomLayoutTreeView.SetScaledOffsetX(AValue: integer);
|
||||
begin
|
||||
if FScaledScroll.X=AValue then Exit;
|
||||
FScaledScroll.X:=AValue;
|
||||
Invalidate;
|
||||
end;
|
||||
|
||||
procedure TADLayoutTreeView.SetScaledOffsetY(AValue: integer);
|
||||
procedure TADCustomLayoutTreeView.SetScaledOffsetY(AValue: integer);
|
||||
begin
|
||||
if FScaledScroll.Y=AValue then Exit;
|
||||
FScaledScroll.Y:=AValue;
|
||||
Invalidate;
|
||||
end;
|
||||
|
||||
procedure TADLayoutTreeView.ComputeLayout;
|
||||
procedure TADCustomLayoutTreeView.ComputeLayout;
|
||||
|
||||
procedure ComputeMonitors(Node: TAnchorDockLayoutTreeNode);
|
||||
var
|
||||
@ -242,7 +300,7 @@ begin
|
||||
FScaledBounds:=ScaleRect(FBounds);
|
||||
end;
|
||||
|
||||
procedure TADLayoutTreeView.ClearMonitors;
|
||||
procedure TADCustomLayoutTreeView.ClearMonitors;
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
@ -250,7 +308,7 @@ begin
|
||||
SetLength(FMonitors,0);
|
||||
end;
|
||||
|
||||
function TADLayoutTreeView.FindMonitor(Monitor: integer): TADLTVMonitor;
|
||||
function TADCustomLayoutTreeView.FindMonitor(Monitor: integer): TADLTVMonitor;
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
@ -261,21 +319,63 @@ begin
|
||||
Result:=nil;
|
||||
end;
|
||||
|
||||
constructor TADLayoutTreeView.Create(AOwner: TComponent);
|
||||
procedure TADCustomLayoutTreeView.SetZoomTrackbar(AValue: TCustomTrackBar);
|
||||
begin
|
||||
if FZoomTrackbar=AValue then Exit;
|
||||
if ZoomTrackbar<>nil then begin
|
||||
ZoomTrackbar.OnChange:=FOldZoombarOnChange;
|
||||
end;
|
||||
FZoomTrackbar:=AValue;
|
||||
if ZoomTrackbar<>nil then begin
|
||||
FreeNotification(ZoomTrackbar);
|
||||
fOldZoombarOnChange:=ZoomTrackbar.OnChange;
|
||||
ZoomTrackbar.OnChange:=@ZoomTrackbarChange;
|
||||
UpdateZoomTrackBar;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TADCustomLayoutTreeView.UpdateZoomTrackBar;
|
||||
var
|
||||
OldChange: Boolean;
|
||||
begin
|
||||
OldChange:=FIgnoreZoomTrackbarChange;
|
||||
try
|
||||
FIgnoreZoomTrackbarChange:=true;
|
||||
//debugln(['TADCustomLayoutTreeView.UpdateZoomTrackBar Scale=',Scale,' Zoom=',ScaleToZoomTrackBarPos(Scale)]);
|
||||
ZoomTrackbar.Position:=ScaleToZoomTrackBarPos(Scale);
|
||||
finally
|
||||
FIgnoreZoomTrackbarChange:=OldChange;
|
||||
end;
|
||||
ZoomTrackbar.Caption:='';
|
||||
end;
|
||||
|
||||
procedure TADCustomLayoutTreeView.Notification(AComponent: TComponent;
|
||||
Operation: TOperation);
|
||||
begin
|
||||
inherited Notification(AComponent, Operation);
|
||||
if Operation=opRemove then begin
|
||||
if AComponent=ZoomTrackbar then
|
||||
ZoomTrackbar:=nil;
|
||||
end;
|
||||
end;
|
||||
|
||||
constructor TADCustomLayoutTreeView.Create(AOwner: TComponent);
|
||||
begin
|
||||
inherited Create(AOwner);
|
||||
FLayout:=TAnchorDockLayoutTree.Create;
|
||||
FScale:=0.25;
|
||||
FScaleMin:=1/20;
|
||||
FScaleMax:=5;
|
||||
end;
|
||||
|
||||
destructor TADLayoutTreeView.Destroy;
|
||||
destructor TADCustomLayoutTreeView.Destroy;
|
||||
begin
|
||||
FreeAndNil(FLayout);
|
||||
ClearMonitors;
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
procedure TADLayoutTreeView.Paint;
|
||||
procedure TADCustomLayoutTreeView.Paint;
|
||||
|
||||
procedure DrawContent(Node: TAnchorDockLayoutTreeNode;
|
||||
OriginX, OriginY: integer);
|
||||
@ -367,7 +467,7 @@ begin
|
||||
inherited Paint;
|
||||
end;
|
||||
|
||||
function TADLayoutTreeView.ScaleRect(const r: TRect): TRect;
|
||||
function TADCustomLayoutTreeView.ScaleRect(const r: TRect): TRect;
|
||||
begin
|
||||
Result.Left:=floor(r.Left*Scale)+FScaledScroll.X;
|
||||
Result.Top:=floor(r.Top*Scale)+FScaledScroll.Y;
|
||||
@ -375,15 +475,47 @@ begin
|
||||
Result.Bottom:=ceil(r.Bottom*Scale)+FScaledScroll.Y;
|
||||
end;
|
||||
|
||||
procedure TADLayoutTreeView.LayoutChanged;
|
||||
procedure TADCustomLayoutTreeView.LayoutChanged;
|
||||
begin
|
||||
ComputeLayout;
|
||||
end;
|
||||
|
||||
function TADLayoutTreeView.MonitorCount: integer;
|
||||
function TADCustomLayoutTreeView.MonitorCount: integer;
|
||||
begin
|
||||
Result:=length(FMonitors);
|
||||
end;
|
||||
|
||||
function TADCustomLayoutTreeView.ScaleToZoomTrackBarPos(aScale: double
|
||||
): integer;
|
||||
var
|
||||
lnMinPos, lnMaxPos, lnPos, Percent: Double;
|
||||
begin
|
||||
// ZoomTrackbar.Min corresponds to ln(ScaleMin)
|
||||
// ZoomTrackbar.Max corresponds to ln(ScaleMax)
|
||||
lnMinPos:=ln(ScaleMin);
|
||||
lnMaxPos:=ln(ScaleMax);
|
||||
lnPos:=ln(aScale);
|
||||
Percent:=(lnPos-lnMinPos)/(lnMaxPos-lnMinPos);
|
||||
Result:=ZoomTrackbar.Min+round(Percent*(ZoomTrackbar.Max-ZoomTrackbar.Min));
|
||||
//debugln(['TADCustomLayoutTreeView.ScaleToZoomTrackBarPos ScaleMin=',ScaleMin,' ScaleMax=',ScaleMax,' lnMinPos=',lnMinPos,' lnMaxPos=',lnMaxPos,' lnPos=',lnPos,' Percent=',Percent,' TrackBar=Min=',ZoomTrackbar.Min,',Max=',ZoomTrackbar.Max,' Result=',Result]);
|
||||
// avoid out of bounds due to rounding errors
|
||||
Result:=Min(ZoomTrackbar.Max,Max(ZoomTrackbar.Min,Result));
|
||||
end;
|
||||
|
||||
function TADCustomLayoutTreeView.ZoomTrackBarPosToScale(p: integer): double;
|
||||
var
|
||||
lnMinPos, lnMaxPos, lnPos, Percent: Double;
|
||||
begin
|
||||
// ZoomTrackbar.Min corresponds to ln(ScaleMin)
|
||||
// ZoomTrackbar.Max corresponds to ln(ScaleMax)
|
||||
lnMinPos:=ln(ScaleMin);
|
||||
lnMaxPos:=ln(ScaleMax);
|
||||
Percent:=(p-ZoomTrackbar.Min)/(ZoomTrackbar.Max-ZoomTrackbar.Min);
|
||||
lnPos:=lnMinPos+Percent*(lnMaxPos-lnMinPos);
|
||||
Result:=exp(lnPos);
|
||||
// avoid out of bounds due to rounding errors
|
||||
Result:=Max(lnMinPos,Min(lnMaxPos,Result));
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
|
@ -1103,46 +1103,6 @@ object ADRestDbg: TADRestDbg
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
ResizeAnchor = akTop
|
||||
end
|
||||
object OriginalLayoutToolBar: TToolBar
|
||||
AnchorSideLeft.Control = SplitterXMLLayout
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = MainToolBar
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = Owner
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 336
|
||||
Height = 26
|
||||
Top = 32
|
||||
Width = 373
|
||||
Align = alNone
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Left = 6
|
||||
BorderSpacing.Top = 6
|
||||
BorderSpacing.Right = 6
|
||||
Caption = 'OriginalLayoutToolBar'
|
||||
Flat = False
|
||||
TabOrder = 6
|
||||
end
|
||||
object RestoredLayoutToolBar: TToolBar
|
||||
AnchorSideLeft.Control = SplitterXMLLayout
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = SplitterBetweenLayouts
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = Owner
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 336
|
||||
Height = 26
|
||||
Top = 296
|
||||
Width = 373
|
||||
Align = alNone
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Left = 6
|
||||
BorderSpacing.Top = 6
|
||||
BorderSpacing.Right = 6
|
||||
Caption = 'RestoredLayoutToolBar'
|
||||
Flat = False
|
||||
TabOrder = 7
|
||||
end
|
||||
object OriginalLayoutPanel: TPanel
|
||||
AnchorSideLeft.Control = SplitterXMLLayout
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
@ -1152,15 +1112,15 @@ object ADRestDbg: TADRestDbg
|
||||
AnchorSideRight.Side = asrBottom
|
||||
AnchorSideBottom.Control = SplitterBetweenLayouts
|
||||
Left = 336
|
||||
Height = 221
|
||||
Top = 58
|
||||
Height = 201
|
||||
Top = 78
|
||||
Width = 373
|
||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||
BorderSpacing.Left = 6
|
||||
BorderSpacing.Right = 6
|
||||
BorderSpacing.Bottom = 6
|
||||
Caption = 'OriginalLayoutPanel'
|
||||
TabOrder = 8
|
||||
TabOrder = 6
|
||||
end
|
||||
object RestoredLayoutPanel: TPanel
|
||||
AnchorSideLeft.Control = SplitterXMLLayout
|
||||
@ -1172,15 +1132,102 @@ object ADRestDbg: TADRestDbg
|
||||
AnchorSideBottom.Control = Owner
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 336
|
||||
Height = 239
|
||||
Top = 322
|
||||
Height = 219
|
||||
Top = 342
|
||||
Width = 373
|
||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||
BorderSpacing.Left = 6
|
||||
BorderSpacing.Right = 6
|
||||
BorderSpacing.Bottom = 6
|
||||
Caption = 'RestoredLayoutPanel'
|
||||
TabOrder = 7
|
||||
end
|
||||
object OriginalLayoutToolBar: TPanel
|
||||
AnchorSideLeft.Control = SplitterXMLLayout
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = MainToolBar
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = Owner
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 336
|
||||
Height = 46
|
||||
Top = 32
|
||||
Width = 373
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
AutoSize = True
|
||||
BorderSpacing.Left = 6
|
||||
BorderSpacing.Top = 6
|
||||
BorderSpacing.Right = 6
|
||||
ClientHeight = 46
|
||||
ClientWidth = 373
|
||||
TabOrder = 8
|
||||
object OriginalZoomTrackBar: TTrackBar
|
||||
Left = 1
|
||||
Height = 44
|
||||
Top = 1
|
||||
Width = 100
|
||||
Max = 30
|
||||
OnChange = OriginalZoomTrackBarChange
|
||||
Position = 0
|
||||
ScalePos = trLeft
|
||||
ShowSelRange = False
|
||||
TabOrder = 0
|
||||
end
|
||||
object OriginalZoomLabel: TLabel
|
||||
AnchorSideLeft.Control = OriginalZoomTrackBar
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = OriginalZoomTrackBar
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 101
|
||||
Height = 15
|
||||
Top = 16
|
||||
Width = 103
|
||||
Caption = 'OriginalZoomLabel'
|
||||
ParentColor = False
|
||||
end
|
||||
end
|
||||
object RestoredLayoutToolBar: TPanel
|
||||
AnchorSideLeft.Control = SplitterXMLLayout
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = SplitterBetweenLayouts
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = Owner
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 336
|
||||
Height = 46
|
||||
Top = 296
|
||||
Width = 373
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
AutoSize = True
|
||||
BorderSpacing.Left = 6
|
||||
BorderSpacing.Top = 6
|
||||
BorderSpacing.Right = 6
|
||||
ClientHeight = 46
|
||||
ClientWidth = 373
|
||||
TabOrder = 9
|
||||
object RestoredZoomTrackBar: TTrackBar
|
||||
Left = 1
|
||||
Height = 44
|
||||
Top = 1
|
||||
Width = 100
|
||||
Max = 30
|
||||
OnChange = RestoredZoomTrackBarChange
|
||||
Position = 0
|
||||
ScalePos = trLeft
|
||||
TabOrder = 0
|
||||
end
|
||||
object RestoredZoomLabel: TLabel
|
||||
AnchorSideLeft.Control = RestoredZoomTrackBar
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = RestoredZoomTrackBar
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 101
|
||||
Height = 15
|
||||
Top = 16
|
||||
Width = 111
|
||||
Caption = 'RestoredZoomLabel'
|
||||
ParentColor = False
|
||||
end
|
||||
end
|
||||
object SynXMLSyn1: TSynXMLSyn
|
||||
DefaultFilter = 'XML Document (*.xml,*.xsd,*.xsl,*.xslt,*.dtd)|*.xml;*.xsd;*.xsl;*.xslt;*.dtd'
|
||||
|
@ -46,9 +46,13 @@ type
|
||||
TADRestDbg = class(TForm)
|
||||
OriginalFileLabel: TLabel;
|
||||
OriginalLayoutPanel: TPanel;
|
||||
OriginalLayoutToolBar: TPanel;
|
||||
OriginalZoomTrackBar: TTrackBar;
|
||||
RestoredFileLabel: TLabel;
|
||||
RestoredLayoutPanel: TPanel;
|
||||
RestoredLayoutToolBar: TToolBar;
|
||||
RestoredLayoutToolBar: TPanel;
|
||||
RestoredZoomLabel: TLabel;
|
||||
RestoredZoomTrackBar: TTrackBar;
|
||||
SplitterXMLLayout: TSplitter;
|
||||
SplitterBetweenXML: TSplitter;
|
||||
OriginalSynEdit: TSynEdit;
|
||||
@ -58,12 +62,14 @@ type
|
||||
MainToolBar: TToolBar;
|
||||
OpenToolButton: TToolButton;
|
||||
OpenRecentToolButton: TToolButton;
|
||||
OriginalLayoutToolBar: TToolBar;
|
||||
OriginalZoomLabel: TLabel;
|
||||
procedure FormClose(Sender: TObject; var {%H-}CloseAction: TCloseAction);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure FormDestroy(Sender: TObject);
|
||||
procedure OpenRecentToolButtonClick(Sender: TObject);
|
||||
procedure OpenToolButtonClick(Sender: TObject);
|
||||
procedure OriginalZoomTrackBarChange(Sender: TObject);
|
||||
procedure RestoredZoomTrackBarChange(Sender: TObject);
|
||||
private
|
||||
FConfigFilename: string;
|
||||
FOriginalFilename: string;
|
||||
@ -113,6 +119,7 @@ begin
|
||||
Name:='OriginalView';
|
||||
Parent:=OriginalLayoutPanel;
|
||||
Align:=alClient;
|
||||
ZoomTrackbar:=OriginalZoomTrackBar;
|
||||
end;
|
||||
|
||||
RestoredView:=TADLayoutTreeView.Create(Self);
|
||||
@ -120,6 +127,7 @@ begin
|
||||
Name:='RestoredView';
|
||||
Parent:=RestoredLayoutPanel;
|
||||
Align:=alClient;
|
||||
ZoomTrackbar:=RestoredZoomTrackBar;
|
||||
end;
|
||||
|
||||
LoadConfig;
|
||||
@ -148,6 +156,16 @@ begin
|
||||
ShowMessage('not implemented yet');
|
||||
end;
|
||||
|
||||
procedure TADRestDbg.OriginalZoomTrackBarChange(Sender: TObject);
|
||||
begin
|
||||
OriginalZoomLabel.Caption:=FloatToStrF(OriginalView.Scale,ffGeneral,6,3);
|
||||
end;
|
||||
|
||||
procedure TADRestDbg.RestoredZoomTrackBarChange(Sender: TObject);
|
||||
begin
|
||||
RestoredZoomLabel.Caption:=FloatToStrF(RestoredView.Scale,ffGeneral,6,3);
|
||||
end;
|
||||
|
||||
function TADRestDbg.GetOriginalLayout: TAnchorDockLayoutTree;
|
||||
begin
|
||||
Result:=OriginalView.Layout;
|
||||
|
Loading…
Reference in New Issue
Block a user