dockmanager example: improved elasticsite

git-svn-id: trunk@22380 -
This commit is contained in:
dodi 2009-11-02 08:04:37 +00:00
parent ff0b2160a5
commit 03ecb24c02
6 changed files with 308 additions and 161 deletions

View File

@ -6,11 +6,11 @@ object DockingSite: TDockingSite
Caption = 'Dock Site'
ClientHeight = 163
ClientWidth = 255
LCLVersion = '0.9.27'
LCLVersion = '0.9.29'
Visible = True
object pnlLeft: TPanel
Left = 0
Height = 139
Height = 138
Top = 0
Width = 0
Align = alLeft
@ -19,7 +19,6 @@ object DockingSite: TDockingSite
DockSite = True
ParentColor = False
TabOrder = 0
UseDockManager = False
OnDockDrop = pnlLeftDockDrop
OnDockOver = pnlLeftDockOver
OnGetSiteInfo = pnlLeftGetSiteInfo
@ -27,22 +26,13 @@ object DockingSite: TDockingSite
end
object splitLeft: TSplitter
Left = 0
Height = 139
Height = 138
Top = 0
Width = 4
end
object buNewForm: TButton
Left = 96
Height = 20
Top = 16
Width = 62
Caption = 'New Form'
OnClick = buNewFormClick
TabOrder = 2
end
object pnlRight: TPanel
Left = 255
Height = 139
Height = 138
Top = 0
Width = 0
Align = alRight
@ -50,22 +40,22 @@ object DockingSite: TDockingSite
Color = clAqua
DockSite = True
ParentColor = False
TabOrder = 3
UseDockManager = False
TabOrder = 2
OnDockDrop = pnlLeftDockDrop
OnDockOver = pnlLeftDockOver
OnGetSiteInfo = pnlLeftGetSiteInfo
OnUnDock = pnlLeftUnDock
end
object pnlBottom: TPanel
Left = 0
Height = 0
Top = 143
Height = 1
Top = 142
Width = 255
Align = alBottom
AutoSize = True
Caption = 'pnlBottom'
DockSite = True
TabOrder = 4
UseDockManager = False
TabOrder = 3
OnDockDrop = pnlLeftDockDrop
OnDockOver = pnlLeftDockOver
OnGetSiteInfo = pnlLeftGetSiteInfo
@ -75,14 +65,14 @@ object DockingSite: TDockingSite
Cursor = crVSplit
Left = 0
Height = 4
Top = 139
Top = 138
Width = 255
Align = alBottom
ResizeAnchor = akBottom
end
object splitRight: TSplitter
Left = 251
Height = 139
Height = 138
Top = 0
Width = 4
Align = alRight
@ -95,4 +85,24 @@ object DockingSite: TDockingSite
Width = 255
Panels = <>
end
object Panel1: TPanel
Left = 4
Height = 138
Top = 0
Width = 247
Align = alClient
Caption = 'Client'
ClientHeight = 138
ClientWidth = 247
TabOrder = 7
object buNewForm: TButton
Left = 96
Height = 20
Top = 16
Width = 62
Caption = 'New Form'
OnClick = buNewFormClick
TabOrder = 0
end
end
end

View File

@ -3,28 +3,30 @@
LazarusResources.Add('TDockingSite','FORMDATA',[
'TPF0'#12'TDockingSite'#11'DockingSite'#4'Left'#3#128#1#6'Height'#3#163#0#3'T'
+'op'#3#157#0#5'Width'#3#255#0#7'Caption'#6#9'Dock Site'#12'ClientHeight'#3
+#163#0#11'ClientWidth'#3#255#0#10'LCLVersion'#6#6'0.9.27'#7'Visible'#9#0#6'T'
+'Panel'#7'pnlLeft'#4'Left'#2#0#6'Height'#3#139#0#3'Top'#2#0#5'Width'#2#0#5'A'
+#163#0#11'ClientWidth'#3#255#0#10'LCLVersion'#6#6'0.9.29'#7'Visible'#9#0#6'T'
+'Panel'#7'pnlLeft'#4'Left'#2#0#6'Height'#3#138#0#3'Top'#2#0#5'Width'#2#0#5'A'
+'lign'#7#6'alLeft'#7'Caption'#6#7'pnlLeft'#5'Color'#7#7'clWhite'#8'DockSite'
+#9#11'ParentColor'#8#8'TabOrder'#2#0#14'UseDockManager'#8#10'OnDockDrop'#7#15
+'pnlLeftDockDrop'#10'OnDockOver'#7#15'pnlLeftDockOver'#13'OnGetSiteInfo'#7#18
+'pnlLeftGetSiteInfo'#8'OnUnDock'#7#13'pnlLeftUnDock'#0#0#9'TSplitter'#9'spli'
+'tLeft'#4'Left'#2#0#6'Height'#3#139#0#3'Top'#2#0#5'Width'#2#4#0#0#7'TButton'
+#9'buNewForm'#4'Left'#2'`'#6'Height'#2#20#3'Top'#2#16#5'Width'#2'>'#7'Captio'
+'n'#6#8'New Form'#7'OnClick'#7#14'buNewFormClick'#8'TabOrder'#2#2#0#0#6'TPan'
+'el'#8'pnlRight'#4'Left'#3#255#0#6'Height'#3#139#0#3'Top'#2#0#5'Width'#2#0#5
+'Align'#7#7'alRight'#7'Caption'#6#8'pnlRight'#5'Color'#7#6'clAqua'#8'DockSit'
+'e'#9#11'ParentColor'#8#8'TabOrder'#2#3#14'UseDockManager'#8#10'OnDockDrop'#7
+#15'pnlLeftDockDrop'#10'OnDockOver'#7#15'pnlLeftDockOver'#13'OnGetSiteInfo'#7
+#18'pnlLeftGetSiteInfo'#0#0#6'TPanel'#9'pnlBottom'#4'Left'#2#0#6'Height'#2#0
+#3'Top'#3#143#0#5'Width'#3#255#0#5'Align'#7#8'alBottom'#7'Caption'#6#9'pnlBo'
+'ttom'#8'DockSite'#9#8'TabOrder'#2#4#14'UseDockManager'#8#10'OnDockDrop'#7#15
+'pnlLeftDockDrop'#10'OnDockOver'#7#15'pnlLeftDockOver'#13'OnGetSiteInfo'#7#18
+'pnlLeftGetSiteInfo'#8'OnUnDock'#7#13'pnlLeftUnDock'#0#0#9'TSplitter'#11'spl'
+'itBottom'#6'Cursor'#7#8'crVSplit'#4'Left'#2#0#6'Height'#2#4#3'Top'#3#139#0#5
+'Width'#3#255#0#5'Align'#7#8'alBottom'#12'ResizeAnchor'#7#8'akBottom'#0#0#9
+'TSplitter'#10'splitRight'#4'Left'#3#251#0#6'Height'#3#139#0#3'Top'#2#0#5'Wi'
+'dth'#2#4#5'Align'#7#7'alRight'#12'ResizeAnchor'#7#7'akRight'#0#0#10'TStatus'
+'Bar'#10'StatusBar1'#4'Left'#2#0#6'Height'#2#20#3'Top'#3#143#0#5'Width'#3#255
+#0#6'Panels'#14#0#0#0#0
+#9#11'ParentColor'#8#8'TabOrder'#2#0#10'OnDockDrop'#7#15'pnlLeftDockDrop'#10
+'OnDockOver'#7#15'pnlLeftDockOver'#13'OnGetSiteInfo'#7#18'pnlLeftGetSiteInfo'
+#8'OnUnDock'#7#13'pnlLeftUnDock'#0#0#9'TSplitter'#9'splitLeft'#4'Left'#2#0#6
+'Height'#3#138#0#3'Top'#2#0#5'Width'#2#4#0#0#6'TPanel'#8'pnlRight'#4'Left'#3
+#255#0#6'Height'#3#138#0#3'Top'#2#0#5'Width'#2#0#5'Align'#7#7'alRight'#7'Cap'
+'tion'#6#8'pnlRight'#5'Color'#7#6'clAqua'#8'DockSite'#9#11'ParentColor'#8#8
+'TabOrder'#2#2#10'OnDockDrop'#7#15'pnlLeftDockDrop'#10'OnDockOver'#7#15'pnlL'
+'eftDockOver'#13'OnGetSiteInfo'#7#18'pnlLeftGetSiteInfo'#8'OnUnDock'#7#13'pn'
+'lLeftUnDock'#0#0#6'TPanel'#9'pnlBottom'#4'Left'#2#0#6'Height'#2#1#3'Top'#3
+#142#0#5'Width'#3#255#0#5'Align'#7#8'alBottom'#8'AutoSize'#9#7'Caption'#6#9
+'pnlBottom'#8'DockSite'#9#8'TabOrder'#2#3#10'OnDockDrop'#7#15'pnlLeftDockDro'
+'p'#10'OnDockOver'#7#15'pnlLeftDockOver'#13'OnGetSiteInfo'#7#18'pnlLeftGetSi'
+'teInfo'#8'OnUnDock'#7#13'pnlLeftUnDock'#0#0#9'TSplitter'#11'splitBottom'#6
+'Cursor'#7#8'crVSplit'#4'Left'#2#0#6'Height'#2#4#3'Top'#3#138#0#5'Width'#3
+#255#0#5'Align'#7#8'alBottom'#12'ResizeAnchor'#7#8'akBottom'#0#0#9'TSplitter'
+#10'splitRight'#4'Left'#3#251#0#6'Height'#3#138#0#3'Top'#2#0#5'Width'#2#4#5
+'Align'#7#7'alRight'#12'ResizeAnchor'#7#7'akRight'#0#0#10'TStatusBar'#10'Sta'
+'tusBar1'#4'Left'#2#0#6'Height'#2#20#3'Top'#3#143#0#5'Width'#3#255#0#6'Panel'
+'s'#14#0#0#0#6'TPanel'#6'Panel1'#4'Left'#2#4#6'Height'#3#138#0#3'Top'#2#0#5
+'Width'#3#247#0#5'Align'#7#8'alClient'#7'Caption'#6#6'Client'#12'ClientHeigh'
+'t'#3#138#0#11'ClientWidth'#3#247#0#8'TabOrder'#2#7#0#7'TButton'#9'buNewForm'
+#4'Left'#2'`'#6'Height'#2#20#3'Top'#2#16#5'Width'#2'>'#7'Caption'#6#8'New Fo'
+'rm'#7'OnClick'#7#14'buNewFormClick'#8'TabOrder'#2#0#0#0#0#0
]);

View File

@ -6,14 +6,12 @@ unit fElastic;
Visible=False, because this would disallow to dock anything into them.
So the width/height of the panels is set to zero instead.
When a control is docked, the dock site is enlarged. Fine adjustment can be
made with the splitters beneath the controls.
When a first control is docked, the dock site is enlarged.
Fine adjustment can be made with the splitters beneath the controls.
When a control is undocked, the dock site is shrinked again.
When the last control is undocked, the dock site is shrinked again.
Planned extensions:
- allow to enlarge the form together with the dock sites, so that the form's
client area is unchanged.
- using an DockManager, so that more than only one control can be docked
into every panel.
*)
@ -21,6 +19,7 @@ Planned extensions:
(* Observed problems:
The right panel does not shrink.
Form doesn't shrink at the right side.
Object Inspector says: the bottom panel's OnGetSiteInfo method is incompatible
with other OnGetSiteInfo methods.
@ -32,11 +31,13 @@ interface
uses
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
ExtCtrls, StdCtrls, ComCtrls;
ExtCtrls, StdCtrls, ComCtrls,
EasyDockSite;
type
TDockingSite = class(TForm)
buNewForm: TButton;
Panel1: TPanel;
pnlBottom: TPanel;
pnlLeft: TPanel;
pnlRight: TPanel;
@ -53,11 +54,8 @@ type
var InfluenceRect: TRect; MousePos: TPoint; var CanDock: Boolean);
procedure pnlLeftUnDock(Sender: TObject; Client: TControl;
NewTarget: TWinControl; var Allow: Boolean);
private
{ private declarations }
public
{ public declarations }
end;
end;
var
DockingSite: TDockingSite;
@ -65,7 +63,7 @@ var
implementation
uses
fDockClient;
fDockClient; //test only
{ TDockingSite }
@ -78,35 +76,59 @@ procedure TDockingSite.pnlLeftDockDrop(Sender: TObject;
Source: TDragDockObject; X, Y: Integer);
var
w: integer;
r: TRect;
begin
(* Adjust docksite extent, if required.
H/V depending on align LR/TB.
Take 1/3 of the form's extent for the dock site.
When changed, ensure that the form layout is updated.
To come: enlarge the form as well, when docked outside.
*)
with Source do begin
if DragTarget.Align in [alLeft, alRight] then begin
w := self.Width div 3;
if DragTarget.Width < w then begin
//enlarge docksite
DisableAlign; //form(?)
DragTarget.Width := w;
if DragTarget.Align = alRight then
dec(DragTarget.Left, w);
if DragTarget.Align = alRight then begin
if AutoSize then begin
r := self.BoundsRect;
inc(r.Right, w);
BoundsRect := r;
end else begin
dec(DragTarget.Left, w);
dec(splitRight.Left, w);
end;
end else if AutoSize then begin
//enlarge left
r := BoundsRect;
dec(r.Left, w);
BoundsRect := r;
end;
EnableAlign;
end;
end else begin
w := self.Height div 3;
if DragTarget.Height < w then begin
//enlarge docksite
DisableAlign; //form(?)
DragTarget.Height := w;
if DragTarget.Align = alBottom then
dec(DragTarget.Top, w);
if DragTarget.Align = alBottom then begin
if AutoSize then begin
//dec(self.Left, w);
r := self.BoundsRect;
inc(r.Bottom, w);
BoundsRect := r;
inc(StatusBar1.Top, w);
end else begin
dec(splitBottom.Top, w);
dec(DragTarget.Top, w);
end;
end;
EnableAlign;
end;
end;
Control.Align := alClient;
//Control.Align := alClient;
end;
end;
@ -114,12 +136,15 @@ procedure TDockingSite.pnlLeftDockOver(Sender: TObject;
Source: TDragDockObject; X, Y: Integer; State: TDragState;
var Accept: Boolean);
begin
if Source.DragTarget = nil then
exit;
if State = dsDragMove then begin
Accept := True;
//make DockRect reflect the docking area
with Source do begin
StatusBar1.SimpleText := AlignNames[DropAlign];
DockRect := DragTarget.ClientRect;
{ TODO : AutoSize }
if DragTarget.Width <= 0 then begin
dec(DockRect.Left, 10);
inc(DockRect.Right, 20);
@ -145,37 +170,63 @@ procedure TDockingSite.pnlLeftUnDock(Sender: TObject; Client: TControl;
NewTarget: TWinControl; var Allow: Boolean);
var
Site: TWinControl absolute Sender;
wh: integer;
r: TRect;
begin
(* When the last client is undocked, shrink the dock site to zero extent.
Called *before* the dock client is removed.
*)
if Site.DockClientCount <= 1 then begin
//hide the dock site
//become empty, hide the dock site
DisableAlign;
case Site.Align of
alLeft:
begin
wh := Site.Width;
Site.Width := 0; //behaves as expected
if AutoSize then begin
r := BoundsRect;
inc(r.Left, wh);
BoundsRect := r;
end;
end;
alRight:
begin //problem: does NOT resize?
inc(Site.Left, Site.Width);
wh := Site.Width;
Site.Width := 0;
//moving the splitter too, seems to be required? Doesn't help :-(
splitRight.Left := Site.Left - splitRight.Width;
if AutoSize then begin
r := BoundsRect;
dec(r.Right, wh);
BoundsRect := r; //does not resize :-(
end else begin
inc(Site.Left, wh);
inc(splitRight.Left, wh); //doesn't help :-(
end;
end;
alBottom:
begin
inc(Site.Top, Site.Height);
wh := Site.Height;
Site.Height := 0;
if AutoSize then begin
r := BoundsRect;
dec(r.Bottom, wh);
BoundsRect := r;
dec(splitBottom.Top, wh);
dec(StatusBar1.Top, wh);
end else begin
inc(Site.Top, wh);
splitBottom.Top := Site.Top - splitBottom.Height - 10;
end;
end;
end;
EnableAlign;
//RecreateWnd(self); - doesn't help
end;
end;
initialization
{$I felastic.lrs}
DefaultDockTreeClass := TEasyTree;
end.

View File

@ -6,7 +6,6 @@
<General>
<MainUnit Value="0"/>
<TargetFileExt Value=".exe"/>
<Icon Value="0"/>
<UseXPManifest Value="True"/>
<ActiveEditorIndexAtStart Value="0"/>
</General>
@ -35,15 +34,15 @@
<PackageName Value="LCL"/>
</Item2>
</RequiredPackages>
<Units Count="6">
<Units Count="15">
<Unit0>
<Filename Value="project1.lpr"/>
<IsPartOfProject Value="True"/>
<UnitName Value="project1"/>
<CursorPos X="56" Y="10"/>
<CursorPos X="69" Y="10"/>
<TopLine Value="1"/>
<EditorIndex Value="4"/>
<UsageCount Value="25"/>
<EditorIndex Value="13"/>
<UsageCount Value="36"/>
<Loaded Value="True"/>
</Unit0>
<Unit1>
@ -52,10 +51,10 @@
<ComponentName Value="DockingSite"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="fElastic"/>
<CursorPos X="1" Y="121"/>
<TopLine Value="105"/>
<CursorPos X="64" Y="218"/>
<TopLine Value="127"/>
<EditorIndex Value="0"/>
<UsageCount Value="25"/>
<UsageCount Value="36"/>
<Loaded Value="True"/>
</Unit1>
<Unit2>
@ -66,155 +65,236 @@
<UnitName Value="fDockClient"/>
<CursorPos X="22" Y="24"/>
<TopLine Value="1"/>
<EditorIndex Value="5"/>
<UsageCount Value="25"/>
<EditorIndex Value="14"/>
<UsageCount Value="36"/>
<Loaded Value="True"/>
</Unit2>
<Unit3>
<Filename Value="..\..\..\lcl\include\wincontrol.inc"/>
<CursorPos X="1" Y="4956"/>
<TopLine Value="4932"/>
<EditorIndex Value="1"/>
<UsageCount Value="12"/>
<CursorPos X="30" Y="5223"/>
<TopLine Value="5199"/>
<EditorIndex Value="9"/>
<UsageCount Value="18"/>
<Loaded Value="True"/>
</Unit3>
<Unit4>
<Filename Value="..\..\..\lcl\include\dragmanager.inc"/>
<CursorPos X="1" Y="439"/>
<TopLine Value="415"/>
<EditorIndex Value="3"/>
<UsageCount Value="12"/>
<CursorPos X="1" Y="606"/>
<TopLine Value="582"/>
<EditorIndex Value="12"/>
<UsageCount Value="18"/>
<Loaded Value="True"/>
</Unit4>
<Unit5>
<Filename Value="..\..\..\lcl\include\control.inc"/>
<CursorPos X="1" Y="1125"/>
<TopLine Value="1101"/>
<EditorIndex Value="2"/>
<UsageCount Value="12"/>
<EditorIndex Value="11"/>
<UsageCount Value="18"/>
<Loaded Value="True"/>
</Unit5>
<Unit6>
<Filename Value="ftestpanels.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="Form1"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="fTestPanels"/>
<CursorPos X="1" Y="85"/>
<TopLine Value="43"/>
<EditorIndex Value="4"/>
<UsageCount Value="31"/>
<Loaded Value="True"/>
</Unit6>
<Unit7>
<Filename Value="..\..\..\lcl\extctrls.pp"/>
<UnitName Value="ExtCtrls"/>
<CursorPos X="23" Y="1094"/>
<TopLine Value="1070"/>
<EditorIndex Value="8"/>
<UsageCount Value="16"/>
<Loaded Value="True"/>
</Unit7>
<Unit8>
<Filename Value="..\..\..\lcl\controls.pp"/>
<UnitName Value="Controls"/>
<CursorPos X="14" Y="365"/>
<TopLine Value="404"/>
<EditorIndex Value="5"/>
<UsageCount Value="15"/>
<Loaded Value="True"/>
</Unit8>
<Unit9>
<Filename Value="..\package\easydocksite.pas"/>
<UnitName Value="EasyDockSite"/>
<CursorPos X="1" Y="641"/>
<TopLine Value="618"/>
<EditorIndex Value="1"/>
<UsageCount Value="11"/>
<Loaded Value="True"/>
</Unit9>
<Unit10>
<Filename Value="..\..\..\..\..\lazarus\fpc\2.2.4\source\rtl\inc\objpash.inc"/>
<CursorPos X="23" Y="151"/>
<TopLine Value="127"/>
<EditorIndex Value="10"/>
<UsageCount Value="11"/>
<Loaded Value="True"/>
</Unit10>
<Unit11>
<Filename Value="..\..\..\..\..\lazarus\fpc\2.2.4\source\rtl\objpas\classes\classesh.inc"/>
<CursorPos X="3" Y="355"/>
<TopLine Value="331"/>
<EditorIndex Value="7"/>
<UsageCount Value="11"/>
<Loaded Value="True"/>
</Unit11>
<Unit12>
<Filename Value="..\..\..\lcl\interfacebase.pp"/>
<UnitName Value="InterfaceBase"/>
<CursorPos X="3" Y="37"/>
<TopLine Value="13"/>
<EditorIndex Value="2"/>
<UsageCount Value="11"/>
<Loaded Value="True"/>
</Unit12>
<Unit13>
<Filename Value="..\..\..\lcl\include\docktree.inc"/>
<CursorPos X="3" Y="204"/>
<TopLine Value="178"/>
<EditorIndex Value="3"/>
<UsageCount Value="11"/>
<Loaded Value="True"/>
</Unit13>
<Unit14>
<Filename Value="..\..\..\lcl\ldocktree.pas"/>
<UnitName Value="LDockTree"/>
<CursorPos X="1" Y="2043"/>
<TopLine Value="2042"/>
<EditorIndex Value="6"/>
<UsageCount Value="11"/>
<Loaded Value="True"/>
</Unit14>
</Units>
<JumpHistory Count="30" HistoryIndex="29">
<Position1>
<Filename Value="felastic.pas"/>
<Caret Line="24" Column="19" TopLine="1"/>
<Filename Value="..\..\..\lcl\controls.pp"/>
<Caret Line="493" Column="28" TopLine="469"/>
</Position1>
<Position2>
<Filename Value="felastic.pas"/>
<Caret Line="13" Column="12" TopLine="1"/>
<Filename Value="..\..\..\lcl\interfacebase.pp"/>
<Caret Line="1" Column="1" TopLine="1"/>
</Position2>
<Position3>
<Filename Value="felastic.pas"/>
<Caret Line="17" Column="73" TopLine="1"/>
<Filename Value="..\..\..\lcl\include\docktree.inc"/>
<Caret Line="1" Column="1" TopLine="1"/>
</Position3>
<Position4>
<Filename Value="felastic.pas"/>
<Caret Line="35" Column="1" TopLine="1"/>
<Filename Value="..\..\..\lcl\interfacebase.pp"/>
<Caret Line="37" Column="3" TopLine="13"/>
</Position4>
<Position5>
<Filename Value="felastic.pas"/>
<Caret Line="36" Column="1" TopLine="1"/>
<Filename Value="..\..\..\lcl\controls.pp"/>
<Caret Line="495" Column="1" TopLine="469"/>
</Position5>
<Position6>
<Filename Value="..\..\..\lcl\include\wincontrol.inc"/>
<Caret Line="5033" Column="1" TopLine="5009"/>
<Filename Value="..\..\..\lcl\controls.pp"/>
<Caret Line="3663" Column="6" TopLine="3643"/>
</Position6>
<Position7>
<Filename Value="felastic.pas"/>
<Caret Line="18" Column="5" TopLine="1"/>
<Filename Value="..\..\..\lcl\controls.pp"/>
<Caret Line="488" Column="1" TopLine="488"/>
</Position7>
<Position8>
<Filename Value="felastic.pas"/>
<Caret Line="37" Column="18" TopLine="3"/>
<Filename Value="..\..\..\lcl\controls.pp"/>
<Caret Line="3665" Column="1" TopLine="3640"/>
</Position8>
<Position9>
<Filename Value="felastic.pas"/>
<Caret Line="44" Column="1" TopLine="3"/>
<Filename Value="..\..\..\lcl\ldocktree.pas"/>
<Caret Line="1" Column="1" TopLine="1"/>
</Position9>
<Position10>
<Filename Value="felastic.pas"/>
<Caret Line="37" Column="1" TopLine="3"/>
<Filename Value="..\package\easydocksite.pas"/>
<Caret Line="217" Column="58" TopLine="189"/>
</Position10>
<Position11>
<Filename Value="..\..\..\lcl\include\wincontrol.inc"/>
<Caret Line="3586" Column="1" TopLine="3553"/>
<Filename Value="..\package\easydocksite.pas"/>
<Caret Line="330" Column="17" TopLine="306"/>
</Position11>
<Position12>
<Filename Value="..\..\..\lcl\include\dragmanager.inc"/>
<Caret Line="120" Column="1" TopLine="96"/>
<Filename Value="..\..\..\lcl\ldocktree.pas"/>
<Caret Line="2044" Column="3" TopLine="2042"/>
</Position12>
<Position13>
<Filename Value="..\..\..\lcl\include\dragmanager.inc"/>
<Caret Line="128" Column="1" TopLine="104"/>
<Filename Value="..\..\..\lcl\ldocktree.pas"/>
<Caret Line="236" Column="1" TopLine="212"/>
</Position13>
<Position14>
<Filename Value="..\..\..\lcl\include\dragmanager.inc"/>
<Caret Line="439" Column="1" TopLine="415"/>
<Filename Value="..\..\..\lcl\ldocktree.pas"/>
<Caret Line="2043" Column="1" TopLine="2042"/>
</Position14>
<Position15>
<Filename Value="..\..\..\lcl\include\wincontrol.inc"/>
<Caret Line="3586" Column="1" TopLine="3562"/>
<Filename Value="..\..\..\lcl\ldocktree.pas"/>
<Caret Line="2042" Column="40" TopLine="2018"/>
</Position15>
<Position16>
<Filename Value="..\..\..\lcl\include\control.inc"/>
<Caret Line="1125" Column="1" TopLine="1101"/>
<Filename Value="..\..\..\lcl\ldocktree.pas"/>
<Caret Line="236" Column="49" TopLine="235"/>
</Position16>
<Position17>
<Filename Value="..\..\..\lcl\include\wincontrol.inc"/>
<Caret Line="4945" Column="1" TopLine="4921"/>
<Filename Value="..\..\..\lcl\ldocktree.pas"/>
<Caret Line="2043" Column="1" TopLine="2042"/>
</Position17>
<Position18>
<Filename Value="..\..\..\lcl\include\wincontrol.inc"/>
<Caret Line="4956" Column="1" TopLine="4932"/>
<Filename Value="felastic.pas"/>
<Caret Line="140" Column="15" TopLine="117"/>
</Position18>
<Position19>
<Filename Value="felastic.pas"/>
<Caret Line="46" Column="1" TopLine="3"/>
<Caret Line="141" Column="1" TopLine="117"/>
</Position19>
<Position20>
<Filename Value="felastic.pas"/>
<Caret Line="18" Column="5" TopLine="12"/>
<Filename Value="..\package\easydocksite.pas"/>
<Caret Line="659" Column="1" TopLine="612"/>
</Position20>
<Position21>
<Filename Value="felastic.pas"/>
<Caret Line="46" Column="34" TopLine="26"/>
<Filename Value="..\package\easydocksite.pas"/>
<Caret Line="641" Column="1" TopLine="618"/>
</Position21>
<Position22>
<Filename Value="felastic.pas"/>
<Caret Line="15" Column="22" TopLine="15"/>
<Caret Line="141" Column="1" TopLine="117"/>
</Position22>
<Position23>
<Filename Value="felastic.pas"/>
<Caret Line="25" Column="53" TopLine="1"/>
<Filename Value="..\..\..\lcl\include\control.inc"/>
<Caret Line="1125" Column="1" TopLine="1101"/>
</Position23>
<Position24>
<Filename Value="felastic.pas"/>
<Caret Line="90" Column="1" TopLine="90"/>
<Caret Line="133" Column="5" TopLine="117"/>
</Position24>
<Position25>
<Filename Value="felastic.pas"/>
<Caret Line="14" Column="14" TopLine="14"/>
<Caret Line="143" Column="1" TopLine="119"/>
</Position25>
<Position26>
<Filename Value="felastic.pas"/>
<Caret Line="22" Column="5" TopLine="14"/>
<Caret Line="146" Column="1" TopLine="122"/>
</Position26>
<Position27>
<Filename Value="felastic.pas"/>
<Caret Line="10" Column="48" TopLine="1"/>
<Caret Line="147" Column="1" TopLine="123"/>
</Position27>
<Position28>
<Filename Value="felastic.pas"/>
<Caret Line="27" Column="26" TopLine="1"/>
<Caret Line="148" Column="1" TopLine="124"/>
</Position28>
<Position29>
<Filename Value="felastic.pas"/>
<Caret Line="18" Column="20" TopLine="1"/>
<Caret Line="150" Column="1" TopLine="126"/>
</Position29>
<Position30>
<Filename Value="felastic.pas"/>
<Caret Line="48" Column="5" TopLine="1"/>
<Caret Line="136" Column="19" TopLine="117"/>
</Position30>
</JumpHistory>
</ProjectOptions>

View File

@ -7,7 +7,7 @@ uses
cthreads,
{$ENDIF}{$ENDIF}
Interfaces, // this includes the LCL widgetset
Forms, fElastic, EasyDockMgr, LResources, fDockClient
Forms, fElastic, EasyDockMgr, LResources, fDockClient, fTestPanels
{ you can add units after this };
{$IFDEF WINDOWS}{$R project1.rc}{$ENDIF}
@ -17,6 +17,7 @@ begin
Application.Initialize;
Application.CreateForm(TDockingSite, DockingSite);
Application.CreateForm(TDockingClient, DockingClient);
Application.CreateForm(TForm1, Form1);
Application.Run;
end.

View File

@ -214,7 +214,7 @@ type
{$IFDEF singleTab}
SingleTab: boolean; //always create notebook for alCustom?
{$ENDIF}
constructor Create(ADockSite: TWinControl);
constructor Create(ADockSite: TWinControl); override;
destructor Destroy; override;
{$IFDEF old}
procedure AdjustDockRect(Control: TControl; var ARect: TRect);
@ -327,7 +327,7 @@ begin
//FreeAndNil(DockSite.DockManager); - seems to be fixed
DockSite.DockManager := self;
//init node class - impossible due to visibility restrictions!
inherited Create; //(DockSite);
inherited Create(DockSite);
{$IFDEF singleTab}
//test: notebook with 1 tab in root zone
SingleTab := True;
@ -616,25 +616,28 @@ var
cy := (ZoneRect.Top + ZoneRect.Bottom) div 2;
w := ZoneRect.Right - ZoneRect.Left;
h := ZoneRect.Bottom - ZoneRect.Top;
//mouse position within k*k rectangles (squares)
dx := trunc((MousePos.x - cx) / w * k);
dy := trunc((MousePos.y - cy) / h * k);
izone := max(abs(dx), abs(dy)); //0..k
//map into 0=innermost (custom), 1=inner, 2=outer
if izone = 0 then begin
//zone := zInnermost;
dir := alCustom; //pages
end else begin
{ not yet: outer zones, meaning docking into parent zone
if izone >= k-1 then
zone := zOuter
else //if izone > 0 then
zone := zInner;
}
phi := arctan2(dy, dx);
zphi := trunc(radtodeg(phi)) div 45;
dir := cDir[zphi];
end;
if (w > 0) and (h > 0) then begin
//mouse position within k*k rectangles (squares)
dx := trunc((MousePos.x - cx) / w * k);
dy := trunc((MousePos.y - cy) / h * k);
izone := max(abs(dx), abs(dy)); //0..k
//map into 0=innermost (custom), 1=inner, 2=outer
if izone = 0 then begin
//zone := zInnermost;
dir := alCustom; //pages
end else begin
{ not yet: outer zones, meaning docking into parent zone
if izone >= k-1 then
zone := zOuter
else //if izone > 0 then
zone := zInner;
}
phi := arctan2(dy, dx);
zphi := trunc(radtodeg(phi)) div 45;
dir := cDir[zphi];
end;
end else
dir := alClient;
Result := dir;
end;