mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-10 05:56:02 +02:00
dockmanager example: elasticsite now also reflects enlarged forms
git-svn-id: trunk@22394 -
This commit is contained in:
parent
929dc64acd
commit
5d7eca12b4
@ -1,7 +1,7 @@
|
||||
object DockingSite: TDockingSite
|
||||
Left = 384
|
||||
Left = 444
|
||||
Height = 163
|
||||
Top = 157
|
||||
Top = 156
|
||||
Width = 255
|
||||
Caption = 'Dock Site'
|
||||
ClientHeight = 163
|
||||
@ -52,7 +52,6 @@ object DockingSite: TDockingSite
|
||||
Top = 142
|
||||
Width = 255
|
||||
Align = alBottom
|
||||
AutoSize = True
|
||||
Caption = 'pnlBottom'
|
||||
DockSite = True
|
||||
TabOrder = 3
|
||||
@ -61,15 +60,6 @@ object DockingSite: TDockingSite
|
||||
OnGetSiteInfo = pnlLeftGetSiteInfo
|
||||
OnUnDock = pnlLeftUnDock
|
||||
end
|
||||
object splitBottom: TSplitter
|
||||
Cursor = crVSplit
|
||||
Left = 0
|
||||
Height = 4
|
||||
Top = 138
|
||||
Width = 255
|
||||
Align = alBottom
|
||||
ResizeAnchor = akBottom
|
||||
end
|
||||
object splitRight: TSplitter
|
||||
Left = 251
|
||||
Height = 138
|
||||
@ -94,7 +84,7 @@ object DockingSite: TDockingSite
|
||||
Caption = 'Client'
|
||||
ClientHeight = 138
|
||||
ClientWidth = 247
|
||||
TabOrder = 7
|
||||
TabOrder = 6
|
||||
object buNewForm: TButton
|
||||
Left = 96
|
||||
Height = 20
|
||||
@ -105,4 +95,13 @@ object DockingSite: TDockingSite
|
||||
TabOrder = 0
|
||||
end
|
||||
end
|
||||
object splitBottom: TSplitter
|
||||
Cursor = crVSplit
|
||||
Left = 0
|
||||
Height = 4
|
||||
Top = 138
|
||||
Width = 255
|
||||
Align = alBottom
|
||||
ResizeAnchor = akBottom
|
||||
end
|
||||
end
|
||||
|
@ -1,8 +1,8 @@
|
||||
{ This is an automatically generated lazarus resource file }
|
||||
|
||||
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
|
||||
'TPF0'#12'TDockingSite'#11'DockingSite'#4'Left'#3#188#1#6'Height'#3#163#0#3'T'
|
||||
+'op'#3#156#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.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'
|
||||
@ -15,18 +15,18 @@ LazarusResources.Add('TDockingSite','FORMDATA',[
|
||||
+'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
|
||||
+#142#0#5'Width'#3#255#0#5'Align'#7#8'alBottom'#7'Caption'#6#9'pnlBottom'#8'D'
|
||||
+'ockSite'#9#8'TabOrder'#2#3#10'OnDockDrop'#7#15'pnlLeftDockDrop'#10'OnDockOv'
|
||||
+'er'#7#15'pnlLeftDockOver'#13'OnGetSiteInfo'#7#18'pnlLeftGetSiteInfo'#8'OnUn'
|
||||
+'Dock'#7#13'pnlLeftUnDock'#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'ResizeAnch'
|
||||
+'or'#7#7'akRight'#0#0#10'TStatusBar'#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#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'alClie'
|
||||
+'nt'#7'Caption'#6#6'Client'#12'ClientHeight'#3#138#0#11'ClientWidth'#3#247#0
|
||||
+#8'TabOrder'#2#6#0#7'TButton'#9'buNewForm'#4'Left'#2'`'#6'Height'#2#20#3'Top'
|
||||
+#2#16#5'Width'#2'>'#7'Caption'#6#8'New Form'#7'OnClick'#7#14'buNewFormClick'
|
||||
+#8'TabOrder'#2#0#0#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'alBott'
|
||||
+'om'#12'ResizeAnchor'#7#8'akBottom'#0#0#0
|
||||
]);
|
||||
|
@ -41,8 +41,8 @@ type
|
||||
pnlBottom: TPanel;
|
||||
pnlLeft: TPanel;
|
||||
pnlRight: TPanel;
|
||||
splitLeft: TSplitter;
|
||||
splitBottom: TSplitter;
|
||||
splitLeft: TSplitter;
|
||||
splitRight: TSplitter;
|
||||
StatusBar1: TStatusBar;
|
||||
procedure buNewFormClick(Sender: TObject);
|
||||
@ -54,7 +54,11 @@ type
|
||||
var InfluenceRect: TRect; MousePos: TPoint; var CanDock: Boolean);
|
||||
procedure pnlLeftUnDock(Sender: TObject; Client: TControl;
|
||||
NewTarget: TWinControl; var Allow: Boolean);
|
||||
private
|
||||
FAutoExpand: boolean;
|
||||
public
|
||||
published
|
||||
property AutoExpand: boolean read FAutoExpand write FAutoExpand;
|
||||
end;
|
||||
|
||||
var
|
||||
@ -63,13 +67,22 @@ var
|
||||
implementation
|
||||
|
||||
uses
|
||||
fDockClient; //test only
|
||||
LCLIntf;
|
||||
|
||||
//uses fDockClient; //test only
|
||||
|
||||
{ TDockingSite }
|
||||
|
||||
procedure TDockingSite.buNewFormClick(Sender: TObject);
|
||||
var
|
||||
Client: TPanel;
|
||||
begin
|
||||
TDockingClient.Create(self);
|
||||
//TDockingClient.Create(self);
|
||||
Client := TPanel.Create(self);
|
||||
Client.DragMode := dmAutomatic;
|
||||
Client.DragKind := dkDock;
|
||||
Client.Visible := True;
|
||||
Client.ManualFloat(Rect(200,200, 400,400));
|
||||
end;
|
||||
|
||||
procedure TDockingSite.pnlLeftDockDrop(Sender: TObject;
|
||||
@ -77,12 +90,17 @@ procedure TDockingSite.pnlLeftDockDrop(Sender: TObject;
|
||||
var
|
||||
w: integer;
|
||||
r: TRect;
|
||||
Site: TWinControl absolute Sender;
|
||||
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.
|
||||
*)
|
||||
if (TWinControl(Source.DragTarget).DockClientCount > 1)
|
||||
or ((Site.Width > 1) and (Site.Height > 1)) //NoteBook!
|
||||
then
|
||||
exit; //no adjustments of the dock site required
|
||||
with Source do begin
|
||||
if DragTarget.Align in [alLeft, alRight] then begin
|
||||
w := self.Width div 3;
|
||||
@ -91,7 +109,7 @@ begin
|
||||
DisableAlign; //form(?)
|
||||
DragTarget.Width := w;
|
||||
if DragTarget.Align = alRight then begin
|
||||
if AutoSize then begin
|
||||
if AutoExpand then begin
|
||||
r := self.BoundsRect;
|
||||
inc(r.Right, w);
|
||||
BoundsRect := r;
|
||||
@ -99,7 +117,7 @@ begin
|
||||
dec(DragTarget.Left, w);
|
||||
dec(splitRight.Left, w);
|
||||
end;
|
||||
end else if AutoSize then begin
|
||||
end else if AutoExpand then begin
|
||||
//enlarge left
|
||||
r := BoundsRect;
|
||||
dec(r.Left, w);
|
||||
@ -114,7 +132,7 @@ begin
|
||||
DisableAlign; //form(?)
|
||||
DragTarget.Height := w;
|
||||
if DragTarget.Align = alBottom then begin
|
||||
if AutoSize then begin
|
||||
if AutoExpand then begin
|
||||
//dec(self.Left, w);
|
||||
r := self.BoundsRect;
|
||||
inc(r.Bottom, w);
|
||||
@ -135,28 +153,74 @@ end;
|
||||
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);
|
||||
end else if DragTarget.Height <= 0 then begin
|
||||
dec(DockRect.Top, 10);
|
||||
inc(DockRect.Bottom, 20);
|
||||
end;
|
||||
DockRect.TopLeft := TWinControl(DragTarget).ClientToScreen(DockRect.TopLeft);
|
||||
inc(DockRect.Bottom, DockRect.Top);
|
||||
inc(DockRect.Right, DockRect.Left);
|
||||
var
|
||||
r: TRect;
|
||||
|
||||
procedure Adjust(dw, dh: integer);
|
||||
begin
|
||||
(* r.TopLeft in screen coords, r.BottomRight is W/H(?)
|
||||
negative values mean expansion towards screen origin
|
||||
*)
|
||||
if dw <> 0 then begin
|
||||
r.Right := r.Left;
|
||||
inc(r.Bottom, r.Top);
|
||||
if dw > 0 then
|
||||
inc(r.Right, dw)
|
||||
else
|
||||
inc(r.Left, dw);
|
||||
end else begin
|
||||
r.Bottom := r.Top;
|
||||
inc(r.Right, r.Left);
|
||||
if dh > 0 then
|
||||
inc(r.Bottom, dh)
|
||||
else
|
||||
inc(r.Top, dh);
|
||||
end;
|
||||
end;
|
||||
|
||||
var
|
||||
Site: TWinControl; // absolute Sender;
|
||||
dw, dh: integer;
|
||||
dummy: boolean;
|
||||
begin
|
||||
(* This handler has to determine the intended DockRect,
|
||||
and the alignment within this rectangle.
|
||||
|
||||
This is impossible when the mouse leaves the InfluenceRect,
|
||||
i.e. when the site is not yet expanded :-(
|
||||
|
||||
For a shrinked site we only can display the intended DockRect,
|
||||
and signal alClient.
|
||||
*)
|
||||
if Source.DragTarget = nil then
|
||||
exit; //shit happens :-(
|
||||
if State = dsDragMove then begin
|
||||
TObject(Site) := Source.DragTarget;
|
||||
if Site.DockClientCount > 0 then
|
||||
exit; //everything should be okay
|
||||
//make DockRect reflect the docking area
|
||||
//with Source do begin
|
||||
//StatusBar1.SimpleText := AlignNames[Source.DropAlign];
|
||||
{$IFnDEF old}
|
||||
r := Site.BoundsRect; //XYWH
|
||||
r.TopLeft := Site.Parent.ClientToScreen(r.TopLeft);
|
||||
{$ELSE}
|
||||
GetWindowRect(TWinControl(Source.DragTarget).handle, r);
|
||||
//Site.GetSiteInfo(Site, r, Point(0,0), dummy);
|
||||
{$ENDIF}
|
||||
dw := Width div 3; //r.Right := r.Left + dw;
|
||||
dh := Height div 3; //r.Bottom := r.Top + dh;
|
||||
//determine inside/outside
|
||||
case Site.Align of
|
||||
alLeft: if AutoExpand then Adjust(-dw, 0) else Adjust(dw, 0);
|
||||
alRight: if AutoExpand then Adjust(dw, 0) else Adjust(-dw, 0);
|
||||
alBottom: if AutoExpand then Adjust(0, dh) else Adjust(0, -dh);
|
||||
else exit;
|
||||
end;
|
||||
Source.DockRect := r;
|
||||
//end;
|
||||
Accept := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TDockingSite.pnlLeftGetSiteInfo(Sender: TObject;
|
||||
@ -184,7 +248,7 @@ begin
|
||||
begin
|
||||
wh := Site.Width;
|
||||
Site.Width := 0; //behaves as expected
|
||||
if AutoSize then begin
|
||||
if AutoExpand then begin
|
||||
r := BoundsRect;
|
||||
inc(r.Left, wh);
|
||||
BoundsRect := r;
|
||||
@ -194,7 +258,7 @@ begin
|
||||
begin //problem: does NOT resize?
|
||||
wh := Site.Width;
|
||||
Site.Width := 0;
|
||||
if AutoSize then begin
|
||||
if AutoExpand then begin
|
||||
r := BoundsRect;
|
||||
dec(r.Right, wh);
|
||||
BoundsRect := r; //does not resize :-(
|
||||
@ -207,7 +271,7 @@ begin
|
||||
begin
|
||||
wh := Site.Height;
|
||||
Site.Height := 0;
|
||||
if AutoSize then begin
|
||||
if AutoExpand then begin
|
||||
r := BoundsRect;
|
||||
dec(r.Bottom, wh);
|
||||
BoundsRect := r;
|
||||
|
@ -34,16 +34,14 @@
|
||||
<PackageName Value="LCL"/>
|
||||
</Item2>
|
||||
</RequiredPackages>
|
||||
<Units Count="15">
|
||||
<Units Count="16">
|
||||
<Unit0>
|
||||
<Filename Value="project1.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="project1"/>
|
||||
<CursorPos X="69" Y="10"/>
|
||||
<CursorPos X="56" Y="10"/>
|
||||
<TopLine Value="1"/>
|
||||
<EditorIndex Value="13"/>
|
||||
<UsageCount Value="36"/>
|
||||
<Loaded Value="True"/>
|
||||
<UsageCount Value="41"/>
|
||||
</Unit0>
|
||||
<Unit1>
|
||||
<Filename Value="felastic.pas"/>
|
||||
@ -51,46 +49,46 @@
|
||||
<ComponentName Value="DockingSite"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<UnitName Value="fElastic"/>
|
||||
<CursorPos X="64" Y="218"/>
|
||||
<TopLine Value="127"/>
|
||||
<CursorPos X="10" Y="204"/>
|
||||
<TopLine Value="178"/>
|
||||
<EditorIndex Value="0"/>
|
||||
<UsageCount Value="36"/>
|
||||
<UsageCount Value="41"/>
|
||||
<Bookmarks Count="1">
|
||||
<Item0 X="1" Y="201" ID="1"/>
|
||||
</Bookmarks>
|
||||
<Loaded Value="True"/>
|
||||
</Unit1>
|
||||
<Unit2>
|
||||
<Filename Value="fdockclient.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<ComponentName Value="DockingClient"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<UnitName Value="fDockClient"/>
|
||||
<CursorPos X="22" Y="24"/>
|
||||
<TopLine Value="1"/>
|
||||
<EditorIndex Value="14"/>
|
||||
<UsageCount Value="36"/>
|
||||
<Loaded Value="True"/>
|
||||
<UsageCount Value="38"/>
|
||||
</Unit2>
|
||||
<Unit3>
|
||||
<Filename Value="..\..\..\lcl\include\wincontrol.inc"/>
|
||||
<CursorPos X="30" Y="5223"/>
|
||||
<TopLine Value="5199"/>
|
||||
<EditorIndex Value="9"/>
|
||||
<UsageCount Value="18"/>
|
||||
<CursorPos X="3" Y="5195"/>
|
||||
<TopLine Value="5186"/>
|
||||
<EditorIndex Value="6"/>
|
||||
<UsageCount Value="19"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit3>
|
||||
<Unit4>
|
||||
<Filename Value="..\..\..\lcl\include\dragmanager.inc"/>
|
||||
<CursorPos X="1" Y="606"/>
|
||||
<TopLine Value="582"/>
|
||||
<EditorIndex Value="12"/>
|
||||
<UsageCount Value="18"/>
|
||||
<EditorIndex Value="9"/>
|
||||
<UsageCount Value="19"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit4>
|
||||
<Unit5>
|
||||
<Filename Value="..\..\..\lcl\include\control.inc"/>
|
||||
<CursorPos X="1" Y="1125"/>
|
||||
<TopLine Value="1101"/>
|
||||
<EditorIndex Value="11"/>
|
||||
<UsageCount Value="18"/>
|
||||
<EditorIndex Value="8"/>
|
||||
<UsageCount Value="19"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit5>
|
||||
<Unit6>
|
||||
@ -102,7 +100,7 @@
|
||||
<CursorPos X="1" Y="85"/>
|
||||
<TopLine Value="43"/>
|
||||
<EditorIndex Value="4"/>
|
||||
<UsageCount Value="31"/>
|
||||
<UsageCount Value="36"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit6>
|
||||
<Unit7>
|
||||
@ -110,191 +108,191 @@
|
||||
<UnitName Value="ExtCtrls"/>
|
||||
<CursorPos X="23" Y="1094"/>
|
||||
<TopLine Value="1070"/>
|
||||
<EditorIndex Value="8"/>
|
||||
<UsageCount Value="16"/>
|
||||
<Loaded Value="True"/>
|
||||
<UsageCount Value="17"/>
|
||||
</Unit7>
|
||||
<Unit8>
|
||||
<Filename Value="..\..\..\lcl\controls.pp"/>
|
||||
<UnitName Value="Controls"/>
|
||||
<CursorPos X="14" Y="365"/>
|
||||
<TopLine Value="404"/>
|
||||
<CursorPos X="15" Y="1780"/>
|
||||
<TopLine Value="1756"/>
|
||||
<EditorIndex Value="5"/>
|
||||
<UsageCount Value="15"/>
|
||||
<UsageCount Value="16"/>
|
||||
<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"/>
|
||||
<CursorPos X="1" Y="694"/>
|
||||
<TopLine Value="694"/>
|
||||
<EditorIndex Value="2"/>
|
||||
<UsageCount Value="12"/>
|
||||
<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"/>
|
||||
<UsageCount Value="12"/>
|
||||
</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"/>
|
||||
<UsageCount Value="12"/>
|
||||
</Unit11>
|
||||
<Unit12>
|
||||
<Filename Value="..\..\..\lcl\interfacebase.pp"/>
|
||||
<UnitName Value="InterfaceBase"/>
|
||||
<CursorPos X="3" Y="37"/>
|
||||
<TopLine Value="13"/>
|
||||
<EditorIndex Value="2"/>
|
||||
<UsageCount Value="11"/>
|
||||
<EditorIndex Value="3"/>
|
||||
<UsageCount Value="12"/>
|
||||
<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"/>
|
||||
<UsageCount Value="12"/>
|
||||
</Unit13>
|
||||
<Unit14>
|
||||
<Filename Value="..\..\..\lcl\ldocktree.pas"/>
|
||||
<UnitName Value="LDockTree"/>
|
||||
<CursorPos X="1" Y="2043"/>
|
||||
<TopLine Value="2042"/>
|
||||
<EditorIndex Value="6"/>
|
||||
<UsageCount Value="11"/>
|
||||
<CursorPos X="15" Y="93"/>
|
||||
<TopLine Value="67"/>
|
||||
<EditorIndex Value="7"/>
|
||||
<UsageCount Value="12"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit14>
|
||||
<Unit15>
|
||||
<Filename Value="..\..\..\lcl\include\winapih.inc"/>
|
||||
<CursorPos X="10" Y="150"/>
|
||||
<TopLine Value="126"/>
|
||||
<EditorIndex Value="1"/>
|
||||
<UsageCount Value="10"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit15>
|
||||
</Units>
|
||||
<JumpHistory Count="30" HistoryIndex="29">
|
||||
<JumpHistory Count="30" HistoryIndex="28">
|
||||
<Position1>
|
||||
<Filename Value="..\..\..\lcl\controls.pp"/>
|
||||
<Caret Line="493" Column="28" TopLine="469"/>
|
||||
<Filename Value="felastic.pas"/>
|
||||
<Caret Line="140" Column="15" TopLine="117"/>
|
||||
</Position1>
|
||||
<Position2>
|
||||
<Filename Value="..\..\..\lcl\interfacebase.pp"/>
|
||||
<Caret Line="1" Column="1" TopLine="1"/>
|
||||
<Filename Value="felastic.pas"/>
|
||||
<Caret Line="141" Column="1" TopLine="117"/>
|
||||
</Position2>
|
||||
<Position3>
|
||||
<Filename Value="..\..\..\lcl\include\docktree.inc"/>
|
||||
<Caret Line="1" Column="1" TopLine="1"/>
|
||||
<Filename Value="..\package\easydocksite.pas"/>
|
||||
<Caret Line="659" Column="1" TopLine="612"/>
|
||||
</Position3>
|
||||
<Position4>
|
||||
<Filename Value="..\..\..\lcl\interfacebase.pp"/>
|
||||
<Caret Line="37" Column="3" TopLine="13"/>
|
||||
<Filename Value="..\package\easydocksite.pas"/>
|
||||
<Caret Line="641" Column="1" TopLine="618"/>
|
||||
</Position4>
|
||||
<Position5>
|
||||
<Filename Value="..\..\..\lcl\controls.pp"/>
|
||||
<Caret Line="495" Column="1" TopLine="469"/>
|
||||
<Filename Value="felastic.pas"/>
|
||||
<Caret Line="141" Column="1" TopLine="117"/>
|
||||
</Position5>
|
||||
<Position6>
|
||||
<Filename Value="..\..\..\lcl\controls.pp"/>
|
||||
<Caret Line="3663" Column="6" TopLine="3643"/>
|
||||
<Filename Value="..\..\..\lcl\include\control.inc"/>
|
||||
<Caret Line="1125" Column="1" TopLine="1101"/>
|
||||
</Position6>
|
||||
<Position7>
|
||||
<Filename Value="..\..\..\lcl\controls.pp"/>
|
||||
<Caret Line="488" Column="1" TopLine="488"/>
|
||||
<Filename Value="felastic.pas"/>
|
||||
<Caret Line="133" Column="5" TopLine="117"/>
|
||||
</Position7>
|
||||
<Position8>
|
||||
<Filename Value="..\..\..\lcl\controls.pp"/>
|
||||
<Caret Line="3665" Column="1" TopLine="3640"/>
|
||||
<Filename Value="felastic.pas"/>
|
||||
<Caret Line="143" Column="1" TopLine="119"/>
|
||||
</Position8>
|
||||
<Position9>
|
||||
<Filename Value="..\..\..\lcl\ldocktree.pas"/>
|
||||
<Caret Line="1" Column="1" TopLine="1"/>
|
||||
<Filename Value="felastic.pas"/>
|
||||
<Caret Line="146" Column="1" TopLine="122"/>
|
||||
</Position9>
|
||||
<Position10>
|
||||
<Filename Value="..\package\easydocksite.pas"/>
|
||||
<Caret Line="217" Column="58" TopLine="189"/>
|
||||
<Filename Value="felastic.pas"/>
|
||||
<Caret Line="147" Column="1" TopLine="123"/>
|
||||
</Position10>
|
||||
<Position11>
|
||||
<Filename Value="..\package\easydocksite.pas"/>
|
||||
<Caret Line="330" Column="17" TopLine="306"/>
|
||||
<Filename Value="felastic.pas"/>
|
||||
<Caret Line="148" Column="1" TopLine="124"/>
|
||||
</Position11>
|
||||
<Position12>
|
||||
<Filename Value="..\..\..\lcl\ldocktree.pas"/>
|
||||
<Caret Line="2044" Column="3" TopLine="2042"/>
|
||||
<Filename Value="felastic.pas"/>
|
||||
<Caret Line="150" Column="1" TopLine="126"/>
|
||||
</Position12>
|
||||
<Position13>
|
||||
<Filename Value="..\..\..\lcl\ldocktree.pas"/>
|
||||
<Caret Line="236" Column="1" TopLine="212"/>
|
||||
<Filename Value="felastic.pas"/>
|
||||
<Caret Line="136" Column="19" TopLine="117"/>
|
||||
</Position13>
|
||||
<Position14>
|
||||
<Filename Value="..\..\..\lcl\ldocktree.pas"/>
|
||||
<Caret Line="2043" Column="1" TopLine="2042"/>
|
||||
<Filename Value="felastic.pas"/>
|
||||
<Caret Line="218" Column="64" TopLine="171"/>
|
||||
</Position14>
|
||||
<Position15>
|
||||
<Filename Value="..\..\..\lcl\ldocktree.pas"/>
|
||||
<Caret Line="2042" Column="40" TopLine="2018"/>
|
||||
<Filename Value="felastic.pas"/>
|
||||
<Caret Line="77" Column="15" TopLine="57"/>
|
||||
</Position15>
|
||||
<Position16>
|
||||
<Filename Value="..\..\..\lcl\ldocktree.pas"/>
|
||||
<Caret Line="236" Column="49" TopLine="235"/>
|
||||
<Filename Value="felastic.pas"/>
|
||||
<Caret Line="75" Column="13" TopLine="51"/>
|
||||
</Position16>
|
||||
<Position17>
|
||||
<Filename Value="..\..\..\lcl\ldocktree.pas"/>
|
||||
<Caret Line="2043" Column="1" TopLine="2042"/>
|
||||
<Filename Value="felastic.pas"/>
|
||||
<Caret Line="76" Column="13" TopLine="51"/>
|
||||
</Position17>
|
||||
<Position18>
|
||||
<Filename Value="felastic.pas"/>
|
||||
<Caret Line="140" Column="15" TopLine="117"/>
|
||||
<Caret Line="71" Column="15" TopLine="51"/>
|
||||
</Position18>
|
||||
<Position19>
|
||||
<Filename Value="felastic.pas"/>
|
||||
<Caret Line="141" Column="1" TopLine="117"/>
|
||||
<Caret Line="75" Column="12" TopLine="51"/>
|
||||
</Position19>
|
||||
<Position20>
|
||||
<Filename Value="..\package\easydocksite.pas"/>
|
||||
<Caret Line="659" Column="1" TopLine="612"/>
|
||||
<Filename Value="felastic.pas"/>
|
||||
<Caret Line="78" Column="41" TopLine="51"/>
|
||||
</Position20>
|
||||
<Position21>
|
||||
<Filename Value="..\package\easydocksite.pas"/>
|
||||
<Caret Line="641" Column="1" TopLine="618"/>
|
||||
<Filename Value="felastic.pas"/>
|
||||
<Caret Line="77" Column="41" TopLine="51"/>
|
||||
</Position21>
|
||||
<Position22>
|
||||
<Filename Value="felastic.pas"/>
|
||||
<Caret Line="141" Column="1" TopLine="117"/>
|
||||
<Caret Line="105" Column="18" TopLine="71"/>
|
||||
</Position22>
|
||||
<Position23>
|
||||
<Filename Value="..\..\..\lcl\include\control.inc"/>
|
||||
<Caret Line="1125" Column="1" TopLine="1101"/>
|
||||
<Filename Value="felastic.pas"/>
|
||||
<Caret Line="261" Column="22" TopLine="236"/>
|
||||
</Position23>
|
||||
<Position24>
|
||||
<Filename Value="felastic.pas"/>
|
||||
<Caret Line="133" Column="5" TopLine="117"/>
|
||||
<Caret Line="61" Column="34" TopLine="25"/>
|
||||
</Position24>
|
||||
<Position25>
|
||||
<Filename Value="felastic.pas"/>
|
||||
<Caret Line="143" Column="1" TopLine="119"/>
|
||||
<Filename Value="..\..\..\lcl\controls.pp"/>
|
||||
<Caret Line="1159" Column="27" TopLine="1112"/>
|
||||
</Position25>
|
||||
<Position26>
|
||||
<Filename Value="felastic.pas"/>
|
||||
<Caret Line="146" Column="1" TopLine="122"/>
|
||||
<Caret Line="201" Column="22" TopLine="173"/>
|
||||
</Position26>
|
||||
<Position27>
|
||||
<Filename Value="felastic.pas"/>
|
||||
<Caret Line="147" Column="1" TopLine="123"/>
|
||||
<Caret Line="206" Column="1" TopLine="173"/>
|
||||
</Position27>
|
||||
<Position28>
|
||||
<Filename Value="felastic.pas"/>
|
||||
<Caret Line="148" Column="1" TopLine="124"/>
|
||||
<Caret Line="208" Column="11" TopLine="181"/>
|
||||
</Position28>
|
||||
<Position29>
|
||||
<Filename Value="felastic.pas"/>
|
||||
<Caret Line="150" Column="1" TopLine="126"/>
|
||||
<Caret Line="209" Column="18" TopLine="181"/>
|
||||
</Position29>
|
||||
<Position30>
|
||||
<Filename Value="felastic.pas"/>
|
||||
<Caret Line="136" Column="19" TopLine="117"/>
|
||||
<Filename Value="..\..\..\lcl\include\wincontrol.inc"/>
|
||||
<Caret Line="5195" Column="3" TopLine="5186"/>
|
||||
</Position30>
|
||||
</JumpHistory>
|
||||
</ProjectOptions>
|
||||
|
@ -7,7 +7,7 @@ uses
|
||||
cthreads,
|
||||
{$ENDIF}{$ENDIF}
|
||||
Interfaces, // this includes the LCL widgetset
|
||||
Forms, fElastic, EasyDockMgr, LResources, fDockClient, fTestPanels
|
||||
Forms, fElastic, EasyDockMgr, LResources, fTestPanels
|
||||
{ you can add units after this };
|
||||
|
||||
{$IFDEF WINDOWS}{$R project1.rc}{$ENDIF}
|
||||
@ -16,7 +16,6 @@ begin
|
||||
{$I project1.lrs}
|
||||
Application.Initialize;
|
||||
Application.CreateForm(TDockingSite, DockingSite);
|
||||
Application.CreateForm(TDockingClient, DockingClient);
|
||||
Application.CreateForm(TForm1, Form1);
|
||||
Application.Run;
|
||||
end.
|
||||
|
@ -216,6 +216,7 @@ type
|
||||
{$ENDIF}
|
||||
constructor Create(ADockSite: TWinControl); override;
|
||||
destructor Destroy; override;
|
||||
function DetectAlign(ZoneRect: TRect; MousePos: TPoint): TAlign;
|
||||
{$IFDEF old}
|
||||
procedure AdjustDockRect(Control: TControl; var ARect: TRect);
|
||||
{$ELSE}
|
||||
@ -590,11 +591,60 @@ begin
|
||||
ResetBounds(True); //splitters may have to be inserted
|
||||
end;
|
||||
|
||||
function TEasyTree.DetectAlign(ZoneRect: TRect; MousePos: TPoint): TAlign;
|
||||
var
|
||||
w, h, zphi: integer;
|
||||
cx, cy: integer;
|
||||
dx, dy: integer;
|
||||
phi: double;
|
||||
izone: integer;
|
||||
dir: TAlign;
|
||||
const
|
||||
k = 5; //matrix dimension
|
||||
//mapping octants into aligns, assuming k=5
|
||||
cDir: array[-4..4] of TAlign = (
|
||||
alLeft, alLeft, alTop, alTop, alRight, alBottom, alBottom, alLeft, alLeft
|
||||
);
|
||||
begin
|
||||
(* Determine alignment from the location of the mouse within ZoneRect.
|
||||
ZoneRect in screen TLBR coordinates, MousePos in screen coordinates.
|
||||
*)
|
||||
//center and extent of dock zone
|
||||
cx := (ZoneRect.Right + ZoneRect.Left) div 2;
|
||||
cy := (ZoneRect.Top + ZoneRect.Bottom) div 2;
|
||||
w := ZoneRect.Right - ZoneRect.Left;
|
||||
h := ZoneRect.Bottom - ZoneRect.Top;
|
||||
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;
|
||||
|
||||
procedure TEasyTree.PositionDockRect(ADockObject: TDragDockObject);
|
||||
var
|
||||
i: integer;
|
||||
zone: TEasyZone;
|
||||
|
||||
{$IFDEF old}
|
||||
function DetectAlign(ZoneRect: TRect; MousePos: TPoint): TAlign;
|
||||
var
|
||||
w, h, zphi: integer;
|
||||
@ -640,6 +690,9 @@ var
|
||||
dir := alClient;
|
||||
Result := dir;
|
||||
end;
|
||||
{$ELSE}
|
||||
//made method
|
||||
{$ENDIF}
|
||||
|
||||
var
|
||||
ZoneExtent: TPoint;
|
||||
|
@ -39,8 +39,8 @@
|
||||
</Unit0>
|
||||
<Unit1>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<ComponentName Value="Form1"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<ComponentName Value="Form1"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<UnitName Value="Unit1"/>
|
||||
</Unit1>
|
||||
|
Loading…
Reference in New Issue
Block a user