anchordocking: restoretest: started treeview

git-svn-id: trunk@39714 -
This commit is contained in:
mattias 2013-01-01 18:14:59 +00:00
parent b7c00499cf
commit 1ac74567ac
5 changed files with 132 additions and 4 deletions

1
.gitattributes vendored
View File

@ -557,6 +557,7 @@ components/anchordocking/minide/unit1.lfm svneol=native#text/plain
components/anchordocking/minide/unit1.pas svneol=native#text/plain components/anchordocking/minide/unit1.pas svneol=native#text/plain
components/anchordocking/restoredebugger/ADRestoreDebugger.lpi svneol=native#text/plain components/anchordocking/restoredebugger/ADRestoreDebugger.lpi svneol=native#text/plain
components/anchordocking/restoredebugger/ADRestoreDebugger.lpr svneol=native#text/plain components/anchordocking/restoredebugger/ADRestoreDebugger.lpr svneol=native#text/plain
components/anchordocking/restoredebugger/adlayoutviewer.pas svneol=native#text/plain
components/anchordocking/restoredebugger/mainunit.lfm svneol=native#text/plain components/anchordocking/restoredebugger/mainunit.lfm svneol=native#text/plain
components/anchordocking/restoredebugger/mainunit.pas svneol=native#text/plain components/anchordocking/restoredebugger/mainunit.pas svneol=native#text/plain
components/chmhelp/README.txt svneol=native#text/plain components/chmhelp/README.txt svneol=native#text/plain

View File

@ -36,7 +36,7 @@
<PackageName Value="SynEdit"/> <PackageName Value="SynEdit"/>
</Item2> </Item2>
</RequiredPackages> </RequiredPackages>
<Units Count="2"> <Units Count="3">
<Unit0> <Unit0>
<Filename Value="ADRestoreDebugger.lpr"/> <Filename Value="ADRestoreDebugger.lpr"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
@ -50,6 +50,11 @@
<ResourceBaseClass Value="Form"/> <ResourceBaseClass Value="Form"/>
<UnitName Value="MainUnit"/> <UnitName Value="MainUnit"/>
</Unit1> </Unit1>
<Unit2>
<Filename Value="adlayoutviewer.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="ADLayoutViewer"/>
</Unit2>
</Units> </Units>
</ProjectOptions> </ProjectOptions>
<CompilerOptions> <CompilerOptions>

View File

@ -7,7 +7,7 @@ uses
cthreads, cthreads,
{$ENDIF}{$ENDIF} {$ENDIF}{$ENDIF}
Interfaces, // this includes the LCL widgetset Interfaces, // this includes the LCL widgetset
Forms, MainUnit, anchordockpkg Forms, MainUnit, anchordockpkg, adlayoutviewer
{ you can add units after this }; { you can add units after this };
begin begin

View File

@ -0,0 +1,106 @@
unit ADLayoutViewer;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, Controls, Graphics, AnchorDockStorage;
type
{ TADLayoutTreeView }
TADLayoutTreeView = class(TCustomControl)
private
FLayout: TAnchorDockLayoutTree;
FLayoutMaxX: integer;
FLayoutMaxY: integer;
FLayoutMinX: integer;
FLayoutMinY: integer;
FScale: double;
FScaledMaxX: integer;
FScaledMaxY: integer;
FScaledMinX: integer;
FScaledMinY: integer;
FScaledOffsetX: integer;
FScaledOffsetY: integer;
procedure SetScale(AValue: double);
procedure SetScaledOffsetX(AValue: integer);
procedure SetScaledOffsetY(AValue: integer);
procedure ComputeLayout;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure Paint; override;
procedure LayoutChanged; virtual;
property Layout: TAnchorDockLayoutTree read FLayout;
property Scale: double read FScale write SetScale;
property ScaledOffsetX: integer read FScaledOffsetX write SetScaledOffsetX;
property ScaledOffsetY: integer read FScaledOffsetY write SetScaledOffsetY;
property LayoutMinX: integer read FLayoutMinX;
property LayoutMinY: integer read FLayoutMinY;
property LayoutMaxX: integer read FLayoutMaxX;
property LayoutMaxY: integer read FLayoutMaxY;
property ScaledMinX: integer read FScaledMinX;
property ScaledMinY: integer read FScaledMinY;
property ScaledMaxX: integer read FScaledMaxX;
property ScaledMaxY: integer read FScaledMaxY;
end;
implementation
{ TADLayoutTreeView }
procedure TADLayoutTreeView.SetScale(AValue: double);
begin
if FScale=AValue then Exit;
FScale:=AValue;
end;
procedure TADLayoutTreeView.SetScaledOffsetX(AValue: integer);
begin
if FScaledOffsetX=AValue then Exit;
FScaledOffsetX:=AValue;
end;
procedure TADLayoutTreeView.SetScaledOffsetY(AValue: integer);
begin
if FScaledOffsetY=AValue then Exit;
FScaledOffsetY:=AValue;
end;
procedure TADLayoutTreeView.ComputeLayout;
begin
if FLayout=nil then exit;
end;
constructor TADLayoutTreeView.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
FLayout:=TAnchorDockLayoutTree.Create;
end;
destructor TADLayoutTreeView.Destroy;
begin
FreeAndNil(FLayout);
inherited Destroy;
end;
procedure TADLayoutTreeView.Paint;
begin
Canvas.Brush.Color:=clWhite;
Canvas.FillRect(0,0,ClientWidth,ClientHeight);
// call event
inherited Paint;
end;
procedure TADLayoutTreeView.LayoutChanged;
begin
ComputeLayout;
end;
end.

View File

@ -35,8 +35,8 @@ interface
uses uses
Classes, SysUtils, FileUtil, LazFileUtils, SynEdit, SynHighlighterXML, Classes, SysUtils, FileUtil, LazFileUtils, SynEdit, SynHighlighterXML,
AnchorDocking, AnchorDockStorage, Forms, Controls, Graphics, Dialogs, AnchorDocking, AnchorDockStorage, ADLayoutViewer, Forms, Controls, Graphics,
ComCtrls, ExtCtrls, Buttons, StdCtrls, XMLPropStorage; Dialogs, ComCtrls, ExtCtrls, Buttons, StdCtrls, XMLPropStorage;
type type
@ -66,6 +66,8 @@ type
FOriginalLayout: TAnchorDockLayoutTree; FOriginalLayout: TAnchorDockLayoutTree;
FSettings: TAnchorDockSettings; FSettings: TAnchorDockSettings;
public public
OriginalView: TADLayoutTreeView;
RestoredView: TADLayoutTreeView;
procedure OpenLayout(Filename: string); procedure OpenLayout(Filename: string);
procedure LoadSettingsFromOriginalSynedit; procedure LoadSettingsFromOriginalSynedit;
property Settings: TAnchorDockSettings read FSettings; property Settings: TAnchorDockSettings read FSettings;
@ -95,6 +97,20 @@ begin
OpenToolButton.Caption:='Open Config File'; OpenToolButton.Caption:='Open Config File';
OpenRecentToolButton.Caption:='Open Recent'; OpenRecentToolButton.Caption:='Open Recent';
OriginalView:=TADLayoutTreeView.Create(Self);
with OriginalView do begin
Name:='OriginalView';
Parent:=OriginalLayoutPanel;
Align:=alClient;
end;
RestoredView:=TADLayoutTreeView.Create(Self);
with RestoredView do begin
Name:='RestoredView';
Parent:=RestoredLayoutPanel;
Align:=alClient;
end;
if Paramcount>0 then if Paramcount>0 then
OpenLayout(ParamStrUTF8(1)); OpenLayout(ParamStrUTF8(1));
end; end;