dockmanager example: MakeSite starts to work, but deserves more considerations

git-svn-id: trunk@22887 -
This commit is contained in:
dodi 2009-12-01 09:07:17 +00:00
parent 456e38d5f8
commit 69cdb386e1
9 changed files with 2189 additions and 2169 deletions

View File

@ -6,9 +6,8 @@
<General> <General>
<MainUnit Value="0"/> <MainUnit Value="0"/>
<TargetFileExt Value=".exe"/> <TargetFileExt Value=".exe"/>
<Icon Value="0"/>
<UseXPManifest Value="True"/> <UseXPManifest Value="True"/>
<ActiveEditorIndexAtStart Value="8"/> <ActiveEditorIndexAtStart Value="1"/>
</General> </General>
<VersionInfo> <VersionInfo>
<ProjectVersion Value=""/> <ProjectVersion Value=""/>
@ -33,14 +32,14 @@
<PackageName Value="LCL"/> <PackageName Value="LCL"/>
</Item2> </Item2>
</RequiredPackages> </RequiredPackages>
<Units Count="42"> <Units Count="49">
<Unit0> <Unit0>
<Filename Value="MakeSite.lpr"/> <Filename Value="MakeSite.lpr"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="MakeSite"/> <UnitName Value="MakeSite"/>
<CursorPos X="51" Y="18"/> <CursorPos X="1" Y="14"/>
<TopLine Value="1"/> <TopLine Value="1"/>
<UsageCount Value="96"/> <UsageCount Value="101"/>
</Unit0> </Unit0>
<Unit1> <Unit1>
<Filename Value="fmastersite.pas"/> <Filename Value="fmastersite.pas"/>
@ -51,18 +50,18 @@
<CursorPos X="1" Y="52"/> <CursorPos X="1" Y="52"/>
<TopLine Value="28"/> <TopLine Value="28"/>
<EditorIndex Value="0"/> <EditorIndex Value="0"/>
<UsageCount Value="96"/> <UsageCount Value="101"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit1> </Unit1>
<Unit2> <Unit2>
<Filename Value="..\package\umakesite.pas"/> <Filename Value="..\package\umakesite.pas"/>
<UnitName Value="uMakeSite"/> <UnitName Value="uMakeSite"/>
<CursorPos X="39" Y="289"/> <CursorPos X="1" Y="480"/>
<TopLine Value="207"/> <TopLine Value="457"/>
<EditorIndex Value="3"/> <EditorIndex Value="4"/>
<UsageCount Value="81"/> <UsageCount Value="84"/>
<Bookmarks Count="1"> <Bookmarks Count="1">
<Item0 X="1" Y="331" ID="2"/> <Item0 X="1" Y="342" ID="2"/>
</Bookmarks> </Bookmarks>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit2> </Unit2>
@ -71,8 +70,8 @@
<UnitName Value="Controls"/> <UnitName Value="Controls"/>
<CursorPos X="15" Y="1790"/> <CursorPos X="15" Y="1790"/>
<TopLine Value="1767"/> <TopLine Value="1767"/>
<EditorIndex Value="10"/> <EditorIndex Value="8"/>
<UsageCount Value="46"/> <UsageCount Value="49"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit3> </Unit3>
<Unit4> <Unit4>
@ -88,17 +87,15 @@
<HasResources Value="True"/> <HasResources Value="True"/>
<ResourceBaseClass Value="Form"/> <ResourceBaseClass Value="Form"/>
<UnitName Value="fElasticSite"/> <UnitName Value="fElasticSite"/>
<CursorPos X="1" Y="82"/> <CursorPos X="5" Y="340"/>
<TopLine Value="63"/> <TopLine Value="295"/>
<UsageCount Value="23"/> <UsageCount Value="23"/>
</Unit5> </Unit5>
<Unit6> <Unit6>
<Filename Value="..\..\..\..\..\lazarus\fpc\2.2.4\source\rtl\objpas\classes\classesh.inc"/> <Filename Value="..\..\..\..\..\lazarus\fpc\2.2.4\source\rtl\objpas\classes\classesh.inc"/>
<CursorPos X="15" Y="822"/> <CursorPos X="15" Y="822"/>
<TopLine Value="798"/> <TopLine Value="798"/>
<EditorIndex Value="6"/> <UsageCount Value="21"/>
<UsageCount Value="20"/>
<Loaded Value="True"/>
</Unit6> </Unit6>
<Unit7> <Unit7>
<Filename Value="fclientform.pas"/> <Filename Value="fclientform.pas"/>
@ -109,7 +106,7 @@
<UnitName Value="fClientForm"/> <UnitName Value="fClientForm"/>
<CursorPos X="10" Y="38"/> <CursorPos X="10" Y="38"/>
<TopLine Value="12"/> <TopLine Value="12"/>
<UsageCount Value="96"/> <UsageCount Value="101"/>
</Unit7> </Unit7>
<Unit8> <Unit8>
<Filename Value="..\..\..\lcl\include\winapih.inc"/> <Filename Value="..\..\..\lcl\include\winapih.inc"/>
@ -132,12 +129,12 @@
<Unit11> <Unit11>
<Filename Value="..\package\easydocksite.pas"/> <Filename Value="..\package\easydocksite.pas"/>
<UnitName Value="EasyDockSite"/> <UnitName Value="EasyDockSite"/>
<CursorPos X="1" Y="1011"/> <CursorPos X="49" Y="1142"/>
<TopLine Value="988"/> <TopLine Value="1112"/>
<EditorIndex Value="4"/> <EditorIndex Value="5"/>
<UsageCount Value="45"/> <UsageCount Value="48"/>
<Bookmarks Count="1"> <Bookmarks Count="1">
<Item0 X="1" Y="1051" ID="1"/> <Item0 X="1" Y="1059" ID="1"/>
</Bookmarks> </Bookmarks>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit11> </Unit11>
@ -146,9 +143,7 @@
<UnitName Value="Forms"/> <UnitName Value="Forms"/>
<CursorPos X="17" Y="647"/> <CursorPos X="17" Y="647"/>
<TopLine Value="624"/> <TopLine Value="624"/>
<EditorIndex Value="1"/> <UsageCount Value="42"/>
<UsageCount Value="41"/>
<Loaded Value="True"/>
</Unit12> </Unit12>
<Unit13> <Unit13>
<Filename Value="..\..\..\lcl\include\customform.inc"/> <Filename Value="..\..\..\lcl\include\customform.inc"/>
@ -187,10 +182,10 @@
<HasResources Value="True"/> <HasResources Value="True"/>
<ResourceBaseClass Value="Form"/> <ResourceBaseClass Value="Form"/>
<UnitName Value="fFloatingSite"/> <UnitName Value="fFloatingSite"/>
<CursorPos X="1" Y="14"/> <CursorPos X="33" Y="145"/>
<TopLine Value="1"/> <TopLine Value="140"/>
<EditorIndex Value="2"/> <EditorIndex Value="3"/>
<UsageCount Value="43"/> <UsageCount Value="46"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit18> </Unit18>
<Unit19> <Unit19>
@ -199,10 +194,10 @@
<HasResources Value="True"/> <HasResources Value="True"/>
<ResourceBaseClass Value="Form"/> <ResourceBaseClass Value="Form"/>
<UnitName Value="fDockBook"/> <UnitName Value="fDockBook"/>
<CursorPos X="1" Y="145"/> <CursorPos X="1" Y="1"/>
<TopLine Value="98"/> <TopLine Value="1"/>
<EditorIndex Value="8"/> <EditorIndex Value="7"/>
<UsageCount Value="41"/> <UsageCount Value="44"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit19> </Unit19>
<Unit20> <Unit20>
@ -252,15 +247,19 @@
</Unit25> </Unit25>
<Unit26> <Unit26>
<Filename Value="..\..\..\lcl\include\control.inc"/> <Filename Value="..\..\..\lcl\include\control.inc"/>
<CursorPos X="3" Y="3876"/> <CursorPos X="1" Y="2686"/>
<TopLine Value="3836"/> <TopLine Value="2660"/>
<UsageCount Value="25"/> <EditorIndex Value="2"/>
<UsageCount Value="26"/>
<Loaded Value="True"/>
</Unit26> </Unit26>
<Unit27> <Unit27>
<Filename Value="..\..\..\lcl\include\wincontrol.inc"/> <Filename Value="..\..\..\lcl\include\wincontrol.inc"/>
<CursorPos X="3" Y="6514"/> <CursorPos X="7" Y="5235"/>
<TopLine Value="6468"/> <TopLine Value="5228"/>
<UsageCount Value="25"/> <EditorIndex Value="6"/>
<UsageCount Value="26"/>
<Loaded Value="True"/>
</Unit27> </Unit27>
<Unit28> <Unit28>
<Filename Value="..\..\..\lcl\include\dragdock.inc"/> <Filename Value="..\..\..\lcl\include\dragdock.inc"/>
@ -278,9 +277,7 @@
<Filename Value="..\..\..\lcl\include\application.inc"/> <Filename Value="..\..\..\lcl\include\application.inc"/>
<CursorPos X="1" Y="2076"/> <CursorPos X="1" Y="2076"/>
<TopLine Value="2053"/> <TopLine Value="2053"/>
<EditorIndex Value="9"/> <UsageCount Value="27"/>
<UsageCount Value="26"/>
<Loaded Value="True"/>
</Unit30> </Unit30>
<Unit31> <Unit31>
<Filename Value="..\..\..\lcl\include\toolbutton.inc"/> <Filename Value="..\..\..\lcl\include\toolbutton.inc"/>
@ -296,44 +293,34 @@
</Unit32> </Unit32>
<Unit33> <Unit33>
<Filename Value="..\package\zoneheader.inc"/> <Filename Value="..\package\zoneheader.inc"/>
<CursorPos X="41" Y="168"/> <CursorPos X="1" Y="1"/>
<TopLine Value="145"/> <TopLine Value="1"/>
<EditorIndex Value="5"/> <UsageCount Value="19"/>
<UsageCount Value="17"/>
<Loaded Value="True"/>
</Unit33> </Unit33>
<Unit34> <Unit34>
<Filename Value="..\..\..\lcl\lclproc.pas"/> <Filename Value="..\..\..\lcl\lclproc.pas"/>
<UnitName Value="LCLProc"/> <UnitName Value="LCLProc"/>
<CursorPos X="1" Y="2109"/> <CursorPos X="1" Y="2109"/>
<TopLine Value="2086"/> <TopLine Value="2086"/>
<EditorIndex Value="11"/> <UsageCount Value="17"/>
<UsageCount Value="16"/>
<Loaded Value="True"/>
</Unit34> </Unit34>
<Unit35> <Unit35>
<Filename Value="..\..\..\..\..\lazarus\fpc\2.2.4\source\rtl\objpas\sysutils\sysstrh.inc"/> <Filename Value="..\..\..\..\..\lazarus\fpc\2.2.4\source\rtl\objpas\sysutils\sysstrh.inc"/>
<CursorPos X="29" Y="123"/> <CursorPos X="29" Y="123"/>
<TopLine Value="123"/> <TopLine Value="123"/>
<EditorIndex Value="12"/> <UsageCount Value="17"/>
<UsageCount Value="16"/>
<Loaded Value="True"/>
</Unit35> </Unit35>
<Unit36> <Unit36>
<Filename Value="..\..\..\..\..\lazarus\fpc\2.2.4\source\rtl\objpas\sysutils\sysstr.inc"/> <Filename Value="..\..\..\..\..\lazarus\fpc\2.2.4\source\rtl\objpas\sysutils\sysstr.inc"/>
<CursorPos X="11" Y="915"/> <CursorPos X="11" Y="915"/>
<TopLine Value="914"/> <TopLine Value="914"/>
<EditorIndex Value="13"/> <UsageCount Value="17"/>
<UsageCount Value="16"/>
<Loaded Value="True"/>
</Unit36> </Unit36>
<Unit37> <Unit37>
<Filename Value="..\..\..\..\..\lazarus\fpc\2.2.4\source\rtl\objpas\sysutils\sysformt.inc"/> <Filename Value="..\..\..\..\..\lazarus\fpc\2.2.4\source\rtl\objpas\sysutils\sysformt.inc"/>
<CursorPos X="12" Y="115"/> <CursorPos X="12" Y="115"/>
<TopLine Value="97"/> <TopLine Value="97"/>
<EditorIndex Value="14"/> <UsageCount Value="17"/>
<UsageCount Value="16"/>
<Loaded Value="True"/>
</Unit37> </Unit37>
<Unit38> <Unit38>
<Filename Value="..\..\..\lcl\ldockctrl.pas"/> <Filename Value="..\..\..\lcl\ldockctrl.pas"/>
@ -353,9 +340,7 @@
<Filename Value="..\..\..\..\..\lazarus\fpc\2.2.4\source\rtl\objpas\classes\streams.inc"/> <Filename Value="..\..\..\..\..\lazarus\fpc\2.2.4\source\rtl\objpas\classes\streams.inc"/>
<CursorPos X="3" Y="654"/> <CursorPos X="3" Y="654"/>
<TopLine Value="621"/> <TopLine Value="621"/>
<EditorIndex Value="7"/> <UsageCount Value="12"/>
<UsageCount Value="11"/>
<Loaded Value="True"/>
</Unit40> </Unit40>
<Unit41> <Unit41>
<Filename Value="..\..\..\lcl\lclmessageglue.pas"/> <Filename Value="..\..\..\lcl\lclmessageglue.pas"/>
@ -364,127 +349,173 @@
<TopLine Value="86"/> <TopLine Value="86"/>
<UsageCount Value="10"/> <UsageCount Value="10"/>
</Unit41> </Unit41>
<Unit42>
<Filename Value="..\..\..\lcl\graphtype.pp"/>
<UnitName Value="GraphType"/>
<CursorPos X="1" Y="1611"/>
<TopLine Value="1588"/>
<UsageCount Value="11"/>
</Unit42>
<Unit43>
<Filename Value="MakeSite.lrs"/>
<CursorPos X="1" Y="1"/>
<TopLine Value="1"/>
<UsageCount Value="10"/>
</Unit43>
<Unit44>
<Filename Value="..\..\..\lcl\interfaces\win32\win32callback.inc"/>
<CursorPos X="1" Y="1223"/>
<TopLine Value="1200"/>
<EditorIndex Value="1"/>
<UsageCount Value="11"/>
<Loaded Value="True"/>
</Unit44>
<Unit45>
<Filename Value="..\..\..\lcl\include\buttoncontrol.inc"/>
<CursorPos X="1" Y="73"/>
<TopLine Value="49"/>
<UsageCount Value="11"/>
</Unit45>
<Unit46>
<Filename Value="..\..\..\lcl\include\buttons.inc"/>
<CursorPos X="6" Y="158"/>
<TopLine Value="142"/>
<UsageCount Value="10"/>
</Unit46>
<Unit47>
<Filename Value="..\..\..\lcl\include\picture.inc"/>
<CursorPos X="1" Y="652"/>
<TopLine Value="629"/>
<UsageCount Value="11"/>
</Unit47>
<Unit48>
<Filename Value="..\..\..\lcl\graphics.pp"/>
<UnitName Value="Graphics"/>
<CursorPos X="3" Y="877"/>
<TopLine Value="890"/>
<UsageCount Value="10"/>
</Unit48>
</Units> </Units>
<JumpHistory Count="30" HistoryIndex="29"> <JumpHistory Count="30" HistoryIndex="29">
<Position1> <Position1>
<Filename Value="..\package\easydocksite.pas"/> <Filename Value="..\package\easydocksite.pas"/>
<Caret Line="994" Column="1" TopLine="971"/> <Caret Line="1098" Column="69" TopLine="1074"/>
</Position1> </Position1>
<Position2> <Position2>
<Filename Value="..\package\easydocksite.pas"/> <Filename Value="..\package\umakesite.pas"/>
<Caret Line="997" Column="1" TopLine="974"/> <Caret Line="207" Column="1" TopLine="184"/>
</Position2> </Position2>
<Position3> <Position3>
<Filename Value="..\package\easydocksite.pas"/> <Filename Value="fmastersite.pas"/>
<Caret Line="999" Column="1" TopLine="976"/> <Caret Line="52" Column="1" TopLine="28"/>
</Position3> </Position3>
<Position4> <Position4>
<Filename Value="..\package\easydocksite.pas"/> <Filename Value="..\package\easydocksite.pas"/>
<Caret Line="1008" Column="1" TopLine="985"/> <Caret Line="1021" Column="15" TopLine="1008"/>
</Position4> </Position4>
<Position5> <Position5>
<Filename Value="..\package\easydocksite.pas"/> <Filename Value="..\package\umakesite.pas"/>
<Caret Line="1009" Column="1" TopLine="986"/> <Caret Line="207" Column="1" TopLine="184"/>
</Position5> </Position5>
<Position6> <Position6>
<Filename Value="..\package\easydocksite.pas"/> <Filename Value="..\package\umakesite.pas"/>
<Caret Line="1010" Column="1" TopLine="987"/> <Caret Line="155" Column="7" TopLine="132"/>
</Position6> </Position6>
<Position7> <Position7>
<Filename Value="..\package\easydocksite.pas"/> <Filename Value="..\package\easydocksite.pas"/>
<Caret Line="1011" Column="1" TopLine="988"/> <Caret Line="155" Column="31" TopLine="132"/>
</Position7> </Position7>
<Position8> <Position8>
<Filename Value="..\package\umakesite.pas"/> <Filename Value="fmastersite.pas"/>
<Caret Line="296" Column="1" TopLine="273"/> <Caret Line="46" Column="17" TopLine="28"/>
</Position8> </Position8>
<Position9> <Position9>
<Filename Value="..\package\umakesite.pas"/> <Filename Value="..\package\umakesite.pas"/>
<Caret Line="304" Column="1" TopLine="281"/> <Caret Line="623" Column="48" TopLine="586"/>
</Position9> </Position9>
<Position10> <Position10>
<Filename Value="..\package\umakesite.pas"/> <Filename Value="fmastersite.pas"/>
<Caret Line="305" Column="1" TopLine="282"/> <Caret Line="52" Column="1" TopLine="28"/>
</Position10> </Position10>
<Position11> <Position11>
<Filename Value="..\package\umakesite.pas"/> <Filename Value="fmastersite.pas"/>
<Caret Line="306" Column="1" TopLine="283"/> <Caret Line="41" Column="20" TopLine="28"/>
</Position11> </Position11>
<Position12> <Position12>
<Filename Value="..\package\umakesite.pas"/> <Filename Value="..\package\umakesite.pas"/>
<Caret Line="289" Column="1" TopLine="266"/> <Caret Line="227" Column="20" TopLine="211"/>
</Position12> </Position12>
<Position13> <Position13>
<Filename Value="..\package\umakesite.pas"/> <Filename Value="..\package\umakesite.pas"/>
<Caret Line="290" Column="1" TopLine="267"/> <Caret Line="614" Column="10" TopLine="597"/>
</Position13> </Position13>
<Position14> <Position14>
<Filename Value="..\package\umakesite.pas"/> <Filename Value="..\package\umakesite.pas"/>
<Caret Line="291" Column="1" TopLine="268"/> <Caret Line="836" Column="38" TopLine="802"/>
</Position14> </Position14>
<Position15> <Position15>
<Filename Value="..\package\umakesite.pas"/> <Filename Value="..\package\umakesite.pas"/>
<Caret Line="292" Column="1" TopLine="269"/> <Caret Line="838" Column="33" TopLine="805"/>
</Position15> </Position15>
<Position16> <Position16>
<Filename Value="..\package\umakesite.pas"/> <Filename Value="..\package\umakesite.pas"/>
<Caret Line="293" Column="1" TopLine="270"/> <Caret Line="227" Column="20" TopLine="211"/>
</Position16> </Position16>
<Position17> <Position17>
<Filename Value="..\package\umakesite.pas"/> <Filename Value="..\package\umakesite.pas"/>
<Caret Line="294" Column="1" TopLine="271"/> <Caret Line="479" Column="1" TopLine="457"/>
</Position17> </Position17>
<Position18> <Position18>
<Filename Value="..\package\umakesite.pas"/> <Filename Value="..\package\umakesite.pas"/>
<Caret Line="295" Column="1" TopLine="272"/> <Caret Line="841" Column="46" TopLine="805"/>
</Position18> </Position18>
<Position19> <Position19>
<Filename Value="..\package\easydocksite.pas"/> <Filename Value="..\package\umakesite.pas"/>
<Caret Line="1006" Column="1" TopLine="983"/> <Caret Line="480" Column="16" TopLine="451"/>
</Position19> </Position19>
<Position20> <Position20>
<Filename Value="..\package\easydocksite.pas"/> <Filename Value="..\package\umakesite.pas"/>
<Caret Line="1008" Column="1" TopLine="985"/> <Caret Line="434" Column="13" TopLine="412"/>
</Position20> </Position20>
<Position21> <Position21>
<Filename Value="..\package\easydocksite.pas"/> <Filename Value="..\package\umakesite.pas"/>
<Caret Line="1009" Column="1" TopLine="986"/> <Caret Line="475" Column="12" TopLine="465"/>
</Position21> </Position21>
<Position22> <Position22>
<Filename Value="..\package\easydocksite.pas"/> <Filename Value="fmastersite.pas"/>
<Caret Line="1010" Column="1" TopLine="987"/> <Caret Line="52" Column="1" TopLine="28"/>
</Position22> </Position22>
<Position23> <Position23>
<Filename Value="..\package\easydocksite.pas"/> <Filename Value="..\package\umakesite.pas"/>
<Caret Line="1011" Column="1" TopLine="988"/> <Caret Line="480" Column="1" TopLine="457"/>
</Position23> </Position23>
<Position24> <Position24>
<Filename Value="..\package\umakesite.pas"/> <Filename Value="..\package\umakesite.pas"/>
<Caret Line="296" Column="1" TopLine="273"/> <Caret Line="482" Column="1" TopLine="459"/>
</Position24> </Position24>
<Position25> <Position25>
<Filename Value="..\package\umakesite.pas"/> <Filename Value="..\package\umakesite.pas"/>
<Caret Line="309" Column="1" TopLine="286"/> <Caret Line="483" Column="1" TopLine="460"/>
</Position25> </Position25>
<Position26> <Position26>
<Filename Value="..\package\umakesite.pas"/> <Filename Value="..\package\umakesite.pas"/>
<Caret Line="310" Column="1" TopLine="287"/> <Caret Line="497" Column="1" TopLine="474"/>
</Position26> </Position26>
<Position27> <Position27>
<Filename Value="..\package\umakesite.pas"/> <Filename Value="..\package\umakesite.pas"/>
<Caret Line="311" Column="1" TopLine="288"/> <Caret Line="480" Column="1" TopLine="457"/>
</Position27> </Position27>
<Position28> <Position28>
<Filename Value="fmastersite.pas"/> <Filename Value="..\package\easydocksite.pas"/>
<Caret Line="52" Column="1" TopLine="28"/> <Caret Line="1147" Column="21" TopLine="1112"/>
</Position28> </Position28>
<Position29> <Position29>
<Filename Value="..\package\umakesite.pas"/> <Filename Value="..\..\..\lcl\interfaces\win32\win32callback.inc"/>
<Caret Line="274" Column="1" TopLine="251"/> <Caret Line="1223" Column="1" TopLine="1200"/>
</Position29> </Position29>
<Position30> <Position30>
<Filename Value="..\package\fdockbook.pas"/> <Filename Value="..\package\easydocksite.pas"/>
<Caret Line="271" Column="1" TopLine="236"/> <Caret Line="1142" Column="49" TopLine="1112"/>
</Position30> </Position30>
</JumpHistory> </JumpHistory>
</ProjectOptions> </ProjectOptions>
@ -503,15 +534,11 @@
</Other> </Other>
</CompilerOptions> </CompilerOptions>
<Debugging> <Debugging>
<BreakPoints Count="2"> <BreakPoints Count="1">
<Item1> <Item1>
<Source Value="fmastersite.pas"/> <Source Value="fmastersite.pas"/>
<Line Value="52"/> <Line Value="52"/>
</Item1> </Item1>
<Item2>
<Source Value="..\package\umakesite.pas"/>
<Line Value="306"/>
</Item2>
</BreakPoints> </BreakPoints>
<Exceptions Count="3"> <Exceptions Count="3">
<Item1> <Item1>

View File

@ -7,12 +7,11 @@ uses
cthreads, cthreads,
{$ENDIF}{$ENDIF} {$ENDIF}{$ENDIF}
Interfaces, // this includes the LCL widgetset Interfaces, // this includes the LCL widgetset
Forms, fMasterSite, fclientform, EasyDockMgr, LResources; Forms, fMasterSite, fclientform, EasyDockMgr;
{$IFDEF WINDOWS}{$R MakeSite.rc}{$ENDIF} {$IFDEF WINDOWS}{$R MakeSite.rc}{$ENDIF}
begin begin
{$I MakeSite.lrs}
Application.Initialize; Application.Initialize;
Application.CreateForm(TMasterSite, MasterSite); Application.CreateForm(TMasterSite, MasterSite);
Application.Run; Application.Run;

File diff suppressed because it is too large Load Diff

View File

@ -17,7 +17,7 @@
<Description Value="EasyDocking Manager and Notebook"/> <Description Value="EasyDocking Manager and Notebook"/>
<License Value="LGPL"/> <License Value="LGPL"/>
<Version Major="1"/> <Version Major="1"/>
<Files Count="10"> <Files Count="7">
<Item1> <Item1>
<Filename Value="easydocksite.pas"/> <Filename Value="easydocksite.pas"/>
<UnitName Value="EasyDockSite"/> <UnitName Value="EasyDockSite"/>
@ -39,26 +39,13 @@
<UnitName Value="fFloatingSite"/> <UnitName Value="fFloatingSite"/>
</Item5> </Item5>
<Item6> <Item6>
<Filename Value="felasticsite.lfm"/>
<Type Value="LFM"/>
</Item6>
<Item7>
<Filename Value="felasticsite.lrs"/>
<Type Value="LRS"/>
</Item7>
<Item8>
<Filename Value="felasticsite.pas"/>
<HasRegisterProc Value="True"/>
<UnitName Value="fElasticSite"/>
</Item8>
<Item9>
<Filename Value="uminirestore.pas"/> <Filename Value="uminirestore.pas"/>
<UnitName Value="uMiniRestore"/> <UnitName Value="uMiniRestore"/>
</Item9> </Item6>
<Item10> <Item7>
<Filename Value="umakesite.pas"/> <Filename Value="umakesite.pas"/>
<UnitName Value="uMakeSite"/> <UnitName Value="uMakeSite"/>
</Item10> </Item7>
</Files> </Files>
<Type Value="RunAndDesignTime"/> <Type Value="RunAndDesignTime"/>
<RequiredPkgs Count="2"> <RequiredPkgs Count="2">

View File

@ -7,14 +7,13 @@ unit EasyDockMgr;
interface interface
uses uses
EasyDockSite, fDockBook, fFloatingSite, fElasticSite, uMiniRestore, EasyDockSite, fDockBook, fFloatingSite, uMiniRestore, uMakeSite,
uMakeSite, LazarusPackageIntf; LazarusPackageIntf;
implementation implementation
procedure Register; procedure Register;
begin begin
RegisterUnit('fElasticSite', @fElasticSite.Register);
end; end;
initialization initialization

View File

@ -202,7 +202,10 @@ type
TEasyTree = class(TEasyDockManager) TEasyTree = class(TEasyDockManager)
private private
FReplaceZone, {$IFDEF replace}
FReplaceZone: TEasyZone;
{$ELSE}
{$ENDIF}
FTopZone: TEasyZone; FTopZone: TEasyZone;
FSiteRect: TRect; //to detect changed site extent FSiteRect: TRect; //to detect changed site extent
procedure UpdateTree; procedure UpdateTree;
@ -212,11 +215,10 @@ type
procedure EndUpdate; override; procedure EndUpdate; override;
procedure PositionDockRect(Client, DropCtl: TControl; DropAlign: TAlign; procedure PositionDockRect(Client, DropCtl: TControl; DropAlign: TAlign;
var DockRect: TRect); override; var DockRect: TRect); override;
procedure SetReplacingControl(Control: TControl); override; //unused
{$ELSE} {$ELSE}
//in base class //in base class
procedure SetReplacingControl(Control: TControl); override;
{$ENDIF} {$ENDIF}
procedure SetReplacingControl(Control: TControl); override;
//extended interface //extended interface
//procedure ControlVisibilityChanged(Control: TControl; Visible: Boolean); override; //procedure ControlVisibilityChanged(Control: TControl; Visible: Boolean); override;
function ZoneFromPoint(SitePos: TPoint): TEasyZone; function ZoneFromPoint(SitePos: TPoint): TEasyZone;
@ -225,6 +227,7 @@ type
DropCtl: TControl); override; DropCtl: TControl); override;
procedure RemoveControl(Control: TControl); override; procedure RemoveControl(Control: TControl); override;
procedure ResetBounds(Force: Boolean); override; //site resized procedure ResetBounds(Force: Boolean); override; //site resized
function ReloadDockedControl(const AName: string): TControl; virtual;
procedure LoadFromStream(Stream: TStream); override; procedure LoadFromStream(Stream: TStream); override;
procedure SaveToStream(Stream: TStream); override; procedure SaveToStream(Stream: TStream); override;
protected //added protected //added
@ -1010,6 +1013,11 @@ begin
Stream.Write(ZoneRec, sizeof(ZoneRec)); Stream.Write(ZoneRec, sizeof(ZoneRec));
end; end;
function TEasyTree.ReloadDockedControl(const AName: string): TControl;
begin
TWinControlAccess(DockSite).ReloadDockedControl(ZoneName, Result);
end;
procedure TEasyTree.LoadFromStream(Stream: TStream); procedure TEasyTree.LoadFromStream(Stream: TStream);
function GetRec: integer; function GetRec: integer;
@ -1018,11 +1026,15 @@ procedure TEasyTree.LoadFromStream(Stream: TStream);
begin begin
Stream.Read(ZoneRec, SizeOf(ZoneRec)); Stream.Read(ZoneRec, SizeOf(ZoneRec));
NameLen := ZoneRec.NameLen; NameLen := ZoneRec.NameLen;
if NameLen > 0 then begin SetLength(ZoneName, NameLen);
SetLength(ZoneName, NameLen); if NameLen > 0 then
Stream.Read(ZoneName[1], NameLen); Stream.Read(ZoneName[1], NameLen);
end;
Result := ZoneRec.Level; Result := ZoneRec.Level;
//debug
if Result > 0 then
DebugLn('reload %s @%d [%d,%d]', [ZoneName, Result, ZoneRec.BottomRight.x, ZoneRec.BottomRight.y])
else
DebugLn('reload done');
end; end;
procedure MakeZone(InZone: TEasyZone; Level: byte); procedure MakeZone(InZone: TEasyZone; Level: byte);
@ -1038,6 +1050,7 @@ procedure TEasyTree.LoadFromStream(Stream: TStream);
if ZoneRec.Level = Level then begin if ZoneRec.Level = Level then begin
//create zone at Level in InZone //create zone at Level in InZone
if ZoneRec.NameLen > 0 then begin if ZoneRec.NameLen > 0 then begin
//we can NOT expect that Reload... is overridden!?
TWinControlAccess(DockSite).ReloadDockedControl(ZoneName, NewCtl); TWinControlAccess(DockSite).ReloadDockedControl(ZoneName, NewCtl);
fSkip := NewCtl = nil; fSkip := NewCtl = nil;
end else end else
@ -1049,6 +1062,7 @@ procedure TEasyTree.LoadFromStream(Stream: TStream);
NewZone.BR := ZoneRec.BottomRight; NewZone.BR := ZoneRec.BottomRight;
NewZone.ChildControl := NewCtl; NewZone.ChildControl := NewCtl;
InZone.InsertAfter(PrevZone, NewZone); InZone.InsertAfter(PrevZone, NewZone);
NewCtl.Visible := True;
PrevZone := NewZone; PrevZone := NewZone;
end; end;
//else skip zone without control - at Level!? //else skip zone without control - at Level!?
@ -1060,13 +1074,78 @@ procedure TEasyTree.LoadFromStream(Stream: TStream);
end; //until GetRec < Level; end; //until GetRec < Level;
end; end;
procedure MakeZones;
var
PrevZone, NewZone: TEasyZone;
PrevLvl, NewLvl: byte;
NewCtl: TControl;
begin
PrevZone := FTopZone;
PrevLvl := 1;
while GetRec > 0 do begin
NewLvl := ZoneRec.Level;
NewZone := TEasyZone.Create(self);
NewZone.Orientation := ZoneRec.Orientation;
NewZone.BR := ZoneRec.BottomRight;
if ZoneRec.NameLen > 0 then begin
//we can NOT expect that Reload... is overridden!?
NewCtl := ReloadDockedControl(ZoneName);
//do we need a control in any case?
if NewCtl = nil then begin
NewCtl := TPanel.Create(DockSite);
end;
try
DebugLn('try rename %s into %s', [NewCtl.Name, ZoneName]);
NewCtl.Name := ZoneName;
except
DebugLn('error rename');
end;
NewCtl.Caption := ZoneName;
if NewCtl <> nil then begin
{$IFDEF old}
NewCtl.Align := alNone;
NewCtl.Visible := True;
NewCtl.Parent := DockSite;
NewCtl.Width := ZoneRec.BottomRight.x;
NewCtl.Height := ZoneRec.BottomRight.y;
NewZone.ChildControl := NewCtl;
{$ELSE}
NewCtl.Visible := True;
NewZone.ChildControl := NewCtl;
SetReplacingControl(NewCtl);
NewCtl.ManualDock(DockSite);
NewCtl.Width := ZoneRec.BottomRight.x;
NewCtl.Height := ZoneRec.BottomRight.y;
{$ENDIF}
end;
end;
while NewLvl < PrevLvl do begin
PrevZone := PrevZone.Parent;
dec(PrevLvl);
end;
if NewLvl = PrevLvl then //add sibling
//PrevZone.AddSibling(NewZone, alRight)
PrevZone.Parent.InsertAfter(PrevZone, NewZone)
else begin //NewLvl > PrevLvl - make child
//InZone.InsertAfter(PrevZone, NewZone);
PrevZone.InsertAfter(nil, NewZone);
PrevLvl := NewLvl;
end;
PrevZone := NewZone;
end;
end;
begin begin
//read record //read record
if GetRec > 0 then begin if GetRec > 0 then begin
FTopZone.BR := ZoneRec.BottomRight; FTopZone.BR := ZoneRec.BottomRight;
MakeZone(FTopZone, 1); FTopZone.Orientation := ZoneRec.Orientation;
//if GetRec = 2 then MakeZone(FTopZone, 1);
MakeZones;
end; end;
//finish? //finish?
//remove all leafs without a child control?
ResetBounds(True);
end; end;
procedure TEasyTree.DumpToStream(Stream: TStream); procedure TEasyTree.DumpToStream(Stream: TStream);
@ -1136,21 +1215,16 @@ begin
WriteZone(FTopZone, 0); WriteZone(FTopZone, 0);
end; end;
{$IFDEF old}
procedure TEasyTree.SetReplacingControl(Control: TControl);
begin
//FReplacingControl := Control;
end;
{$ELSE}
procedure TEasyTree.SetReplacingControl(Control: TControl); procedure TEasyTree.SetReplacingControl(Control: TControl);
begin begin
(* The Control may have been undocked, until the replace request is handled. (* The Control may have been undocked, until the replace request is handled.
*) *)
inherited SetReplacingControl(Control); inherited SetReplacingControl(Control);
{$IFDEF replace}
FReplaceZone := FindControlZone(FTopZone, Control); FReplaceZone := FindControlZone(FTopZone, Control);
end; {$ELSE}
{$ENDIF} {$ENDIF}
end;
procedure TEasyTree.SetSingleCaption(Value: boolean); procedure TEasyTree.SetSingleCaption(Value: boolean);
begin begin
@ -1735,6 +1809,7 @@ end;
initialization initialization
{$I easy_dock_images.lrs} {$I easy_dock_images.lrs}
//DefaultDockManagerClass := TEasyTree;
CreateDockHeaderImages; CreateDockHeaderImages;
finalization finalization
DestroyDockHeaderImages; DestroyDockHeaderImages;

View File

@ -337,6 +337,6 @@ end;
initialization initialization
{$I felasticsite.lrs} {$I felasticsite.lrs}
DefaultDockManagerClass := TEasyTree; //DefaultDockManagerClass := TEasyTree;
end. end.

View File

@ -16,6 +16,8 @@ As with DockBook, closing docked forms results in Exceptions :-(
{$mode objfpc}{$H+} {$mode objfpc}{$H+}
{$DEFINE appdock}
interface interface
uses uses
@ -32,18 +34,32 @@ type
NewTarget: TWinControl; var Allow: Boolean); NewTarget: TWinControl; var Allow: Boolean);
protected protected
procedure Loaded; override; procedure Loaded; override;
{$IFDEF appdock}
{$ELSE}
procedure ReloadDockedControl(const AControlName: string;
var AControl: TControl); override;
{$ENDIF}
public public
procedure UpdateCaption(without: TControl); procedure UpdateCaption(without: TControl);
end; end;
var var
FloatingSite: TFloatingSite; //FloatingSite: TFloatingSite;
DockGrip: TPicture;
implementation implementation
uses uses
LCLproc, //debugging only LCLproc, //debugging only
EasyDockSite; //our DockManager EasyDockSite, //our DockManager
uMakeSite;
type
{$IFDEF appdock}
TOurDockManager = TAppDockManager;
{$ELSE}
TOurDockManager = TEasyTree;
{$ENDIF}
{ TFloatingSite } { TFloatingSite }
@ -143,8 +159,12 @@ begin
(* select and configure the docking manager. (* select and configure the docking manager.
*) *)
inherited Loaded; inherited Loaded;
if DockGrip = nil then begin
DockGrip := TPicture.Create; //(Application);
DockGrip.Assign(self.Image1.Picture);
end;
if DockManager = nil then if DockManager = nil then
DockManager := TEasyTree.Create(self); DockManager := TOurDockManager.Create(self);
if DockManager is TEasyTree then begin if DockManager is TEasyTree then begin
//adjust as desired (order required!?) //adjust as desired (order required!?)
TEasyTree(DockManager).HideSingleCaption := True; //only show headers for multiple clients TEasyTree(DockManager).HideSingleCaption := True; //only show headers for multiple clients
@ -152,6 +172,20 @@ begin
end; end;
end; end;
{$IFDEF appdock}
{$ELSE}
procedure TFloatingSite.ReloadDockedControl(const AControlName: string;
var AControl: TControl);
begin
inherited ReloadDockedControl(AControlName, AControl);
if AControl = nil then begin
AControl := TForm.Create(Application);
//make dock client
//if uMakeSite...
end;
end;
{$ENDIF}
initialization initialization
{$I ffloatingsite.lrs} {$I ffloatingsite.lrs}

View File

@ -50,6 +50,11 @@ type
public public
end; end;
TAppDockManager = class(TEasyTree)
protected
function ReloadDockedControl(const AName: string): TControl; override;
end;
(* The owner of all docksites (if ownSites is defined), (* The owner of all docksites (if ownSites is defined),
and of all dockable window grips (if ownGrips is defined) and of all dockable window grips (if ownGrips is defined)
*) *)
@ -59,36 +64,87 @@ type
X, Y: Integer); X, Y: Integer);
procedure FormEndDock(Sender, Target: TObject; X, Y: Integer); procedure FormEndDock(Sender, Target: TObject; X, Y: Integer);
protected //utilities protected //utilities
function ReloadForm(const AName: string): TCustomForm; virtual; function ReloadForm(const AName: string): TWinControl; virtual;
function WrapDockable(Client: TControl): TFloatingSite; function WrapDockable(Client: TControl): TFloatingSite;
private private
LastSite: TFloatingSite; //LastSite: TFloatingSite; //last floating site created
LastPanel: TPanel; //last elastic panel created
public public
Factory: TWinControl; //generic owner Factory: TWinControl; //generic owner
constructor Create(AOwner: TComponent); override;
procedure AddElasticSites(AForm: TCustomForm; Sides: sDockSides); procedure AddElasticSites(AForm: TCustomForm; Sides: sDockSides);
function CreateDockable(const AName: string; fMultiInst: boolean; fWrap: boolean = True): TCustomForm; function CreateDockable(const AName: string; fMultiInst: boolean; fWrap: boolean = True): TWinControl;
procedure DumpSites; procedure DumpSites;
//persistence
procedure LoadFromStream(Stream: TStream); procedure LoadFromStream(Stream: TStream);
procedure SaveToStream(Stream: TStream); procedure SaveToStream(Stream: TStream);
end; end;
function ReloadDockedControl(const ControlName: string; Site: TWinControl): TControl;
function ReloadDockSite(const SiteName, ParentName: string; Aligned: TAlign): TWinControl;
var
DockMaster: TDockMaster; //for access by docksites on Reload...
implementation implementation
uses uses
LCLIntf, LCLProc; LCLIntf, LCLProc;
//fMasterSite,
type type
TWinControlAccess = class(TWinControl) TWinControlAccess = class(TWinControl)
end; end;
TControlAccess = class(TControl)
end;
const const //what characters are acceptable, for unique names?
PanelNames: array[TAlign] of string = ( PanelNames: array[TAlign] of string = (
'', '', //alNone, alTop, '', '', //alNone, alTop,
'pnlBottom', 'pnlLeft', 'pnlRight', '_Elastic_Bottom_', '_Elastic_Left_', '_Elastic_Right_',
'', '' //alClient, alCustom '', '' //alClient, alCustom
); );
function ReloadDockedControl(const ControlName: string; Site: TWinControl): TControl;
var
wc: TWinControlAccess absolute Result;
ctl: TControlAccess absolute Result;
begin
(* Reload a previously docked control for Site and make it dockable.
Notebooks are assumed to be owned by the Site.
Forms are assumed to be owned by Application???
Others are assumed to be owned by ???
*)
Result := nil;
if (DockMaster <> nil) and (DockMaster.Factory <> nil) then begin
TWinControlAccess(DockMaster.Factory).ReLoadDockedControl(ControlName, Result);
//if Result <> nil then exit; //done
end;
if Result = nil then begin
//create something
end;
if ctl.DragKind <> dkDock then begin
//make it dockable
{$IFDEF new}
if Result is TCustomForm then
MakeDockable(Result)
else
{$ELSE}
{$ENDIF}
begin
ctl.DragKind := dkDock;
ctl.DragMode := dmAutomatic;
end;
end;
end;
function ReloadDockSite(const SiteName, ParentName: string; Aligned: TAlign): TWinControl;
begin
(* Create a DockSite.
When ParentName='' then creste a TFloatingSite,
else create an elastic panel within the given parent.
*)
end;
{ TDockMaster } { TDockMaster }
procedure TDockMaster.AddElasticSites(AForm: TCustomForm; Sides: sDockSides); procedure TDockMaster.AddElasticSites(AForm: TCustomForm; Sides: sDockSides);
@ -111,12 +167,13 @@ begin
{$ELSE} {$ELSE}
pnl := TDockPanel.Create(AForm); //owned by? pnl := TDockPanel.Create(AForm); //owned by?
{$ENDIF} {$ENDIF}
LastPanel := pnl; //for reload layout
pnl.Name := PanelNames[side]; pnl.Name := PanelNames[side];
pnl.Parent := AForm; pnl.Parent := AForm;
pnl.Align := side; pnl.Align := side;
pnl.BorderWidth := 1; pnl.BorderWidth := 1;
//pnl.BorderStyle := bsSingle; // does not properly handle the size //pnl.BorderStyle := bsSingle; // does not properly handle the size
dm := TEasyTree.Create(pnl); dm := TAppDockManager.Create(pnl);
dm.SetStyle(hsForm); dm.SetStyle(hsForm);
pnl.DockSite := True; pnl.DockSite := True;
pnl.UseDockManager := True; pnl.UseDockManager := True;
@ -142,8 +199,17 @@ begin
end; end;
end; end;
constructor TDockMaster.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
DebugLn('dockmgr=%s', [DefaultDockManagerClass.ClassName]);
DefaultDockManagerClass := TAppDockManager;
if DockMaster = nil then
DockMaster := self;
end;
function TDockMaster.CreateDockable(const AName: string; function TDockMaster.CreateDockable(const AName: string;
fMultiInst: boolean; fWrap: boolean): TCustomForm; fMultiInst: boolean; fWrap: boolean): TWinControl;
var var
img: TImage; img: TImage;
r: TRect; r: TRect;
@ -154,7 +220,7 @@ begin
Used also to restore a layout. Used also to restore a layout.
Options (to come or to be removed) Options (to come or to be removed)
fMultiInst allows to auto-create new versions (if True), fMultiInst allows to auto-create new instances (if True),
otherwise an already existing instance is returned. (really returned?) otherwise an already existing instance is returned. (really returned?)
*) *)
//get the form //get the form
@ -173,19 +239,24 @@ Options (to come or to be removed)
Site := WrapDockable(Result); Site := WrapDockable(Result);
end; end;
//create a docking handle - should become a component? //create a docking handle - should become a component?
if LastSite <> nil then begin //problem: find grabber picture!? img := TImage.Create(Result); //we could own the img, and be notified when its parent becomes nil
img := TImage.Create(Result); //we could own the img, and be notified when its parent becomes nil img.Parent := Result;
img.Parent := Result; img.Align := alNone;
img.Align := alNone; img.Anchors := [akTop, akRight];
img.Anchors := [akTop, akRight]; r := Result.ClientRect;
r := Result.ClientRect; r.bottom := 16;
r.bottom := 16; r.Left := r.Right - 16;
r.Left := r.Right - 16; img.BoundsRect := r;
img.BoundsRect := r; if DockGrip <> nil then //problem: find grabber picture!?
img.Picture := LastSite.Image1.Picture; try
img.OnMouseMove := @DockHandleMouseMove; img.Picture := DockGrip;
img.Visible := True; except
end; DebugLn('exception loading picture');
end;
//else???
img.OnMouseMove := @DockHandleMouseMove;
img.Visible := True;
//make visible, so that it can be docked without problems
Result.Visible := True; Result.Visible := True;
end; end;
@ -211,6 +282,7 @@ end;
type type
RSiteRec = packed record RSiteRec = packed record
Bounds: TRect; Bounds: TRect;
Align: TAlign;
NameLen: byte; //+name NameLen: byte; //+name
end; end;
var var
@ -220,8 +292,12 @@ var
procedure TDockMaster.LoadFromStream(Stream: TStream); procedure TDockMaster.LoadFromStream(Stream: TStream);
var var
ctl, pre: TControl; ctl, pre: TControl;
site: TFloatingSite; site: TWinControl;
host: TForm;
hcomp: TComponent absolute host;
nb: TEasyBook; nb: TEasyBook;
hostname: string;
i: integer;
procedure MakeForm; procedure MakeForm;
begin begin
@ -236,6 +312,10 @@ var
SetLength(SiteName, SiteRec.NameLen); SetLength(SiteName, SiteRec.NameLen);
if Result and (SiteRec.NameLen > 0) then if Result and (SiteRec.NameLen > 0) then
Stream.Read(SiteName[1], SiteRec.NameLen); Stream.Read(SiteName[1], SiteRec.NameLen);
if Result then
DebugLn('reload site %s', [SiteName])
else
DebugLn('reload site done');
end; end;
begin begin
@ -269,28 +349,44 @@ Notebooks?
end; end;
{$ELSE} {$ELSE}
{$ENDIF} {$ENDIF}
//restore all DockSites Stream.Position := 0; //rewind!
//all floating sites //restore all floating sites
while ReadSite do begin while ReadSite do begin
site := TFloatingSite.Create(self); if SiteRec.NameLen = 0 then begin
site.Name := SiteName; //floating site
site := TFloatingSite.Create(self);
end else begin
//hosted panel - find parent form
if Factory = nil then
hcomp := Application.FindComponent(SiteName)
else begin
hcomp := Factory.FindComponent(SiteName);
//hcomp := Factory.ReloadDockedControl(SiteName); - reload form!?
end;
if (hcomp = nil) or not (hcomp is TWinControl) then
host := TForm.Create(Application);
AddElasticSites(host, [SiteRec.Align]);
site := LastPanel;
end;
site.BoundsRect := SiteRec.Bounds; site.BoundsRect := SiteRec.Bounds;
if site.DockManager = nil then
TAppDockManager.Create(site);
site.DockManager.LoadFromStream(Stream); site.DockManager.LoadFromStream(Stream);
end; end;
//all ElasticSites - to come
end; end;
procedure TDockMaster.SaveToStream(Stream: TStream); procedure TDockMaster.SaveToStream(Stream: TStream);
procedure SaveSite(Site: TWinControl); procedure SaveSite(Site: TWinControl; const AName: string);
begin begin
(* what if a site doesn't have an DockManager? (* what if a site doesn't have an DockManager?
*) *)
SiteRec.Bounds := Site.BoundsRect; SiteRec.Bounds := Site.BoundsRect;
SiteName := Site.Name; SiteName := AName;
SiteRec.Align := Site.Align;
SiteRec.NameLen := Length(SiteName); SiteRec.NameLen := Length(SiteName);
Stream.Write(SiteRec, sizeof(SiteRec)); Stream.Write(SiteRec, sizeof(SiteRec));
if SiteName <> '' then if AName <> '' then
Stream.Write(SiteName[1], Length(SiteName)); Stream.Write(SiteName[1], Length(SiteName));
Site.DockManager.SaveToStream(Stream); Site.DockManager.SaveToStream(Stream);
end; end;
@ -302,8 +398,14 @@ var
begin begin
for i := 0 to ComponentCount - 1 do begin for i := 0 to ComponentCount - 1 do begin
cmp := Components[i]; cmp := Components[i];
if (cmp is TWinControl) and wc.DockSite then if (cmp is TWinControl) and wc.DockSite then begin
SaveSite(wc); if wc.Parent = nil then
SaveSite(wc, '') //save top level sites
else begin
//elastic site - not yet
//SaveSite(wc, {wc.Name + '@' +} wc.Parent.Name); //elastic site
end;
end;
end; end;
//end marker //end marker
SiteRec.Bounds.Right := -1; SiteRec.Bounds.Right := -1;
@ -311,20 +413,47 @@ begin
Stream.Write(SiteRec, sizeof(SiteRec)); Stream.Write(SiteRec, sizeof(SiteRec));
end; end;
function TDockMaster.ReloadForm(const AName: string): TCustomForm; function TDockMaster.ReloadForm(const AName: string): TWinControl;
var var
basename, instname: string; basename, instname: string;
i, l, instno: integer; fc: TWinControlClass;
fc: TFormClass;
fo: TComponent; //form owner fo: TComponent; //form owner
ctl: TControl; ctl: TControl;
cmp: TComponent absolute Result;
const const
digits = ['0'..'9']; digits = ['0'..'9'];
procedure SplitName;
var
i, l, instno: integer;
begin
//find the instance number, if present
instno := 0;
l := Length(AName);
i := l;
while AName[i] in digits do
dec(i);
//i now is the position of the last non-digit in the name
//extract the instance number
basename := Copy(AName, 1, i);
while i < l do begin
inc(i);
instno := instno * 10 + ord(AName[i])-ord('0');
end;
//single/multi instance?
if instno = 0 then
instno := 1; //default instance number for forms
//lookup existing instance
instname := basename + IntToStr(instno);
end;
begin begin
(* Get a form from the Factory, or search/create it. (* Get a form from the Factory, or search/create it.
The name is split into basename and instance number. The name is split into basename and instance number.
A component of T<basename> is created (and named AName - automatic!). A component of T<basename> is created (and named AName - automatic!).
Result type? (a TWinControl is sufficient as a DockSite)
*) *)
Result := nil; Result := nil;
//check if Factory can provide the form //check if Factory can provide the form
@ -343,34 +472,24 @@ begin
fo := Self; //we own the forms fo := Self; //we own the forms
{$ENDIF} {$ENDIF}
if AName = '' then begin if AName = '' then begin
//if True then begin
//test! //test!
//Result := TFloatingSite.Create(fo); //named Form1, Form2...
Result := TForm.Create(fo); //named Form1, Form2... Result := TForm.Create(fo); //named Form1, Form2...
end else begin end else begin
//find the instance number, if present cmp := fo.FindComponent(AName); //(instname);
instno := 0; //if Result <> nil then
l := Length(AName); if assigned(cmp) then begin
i := l; if cmp is TWinControl then
while AName[i] in digits do begin exit;
dec(i); cmp.Free; //we NEED at least a TWinControl, of exactly the given name
end; end;
//i now is the position of the last non-digit in the name
//extract the instance number
basename := Copy(AName, 1, i);
while i < l do begin
inc(i);
instno := instno * 10 + ord(AName[i])-ord('0');
end;
if instno = 0 then
instno := 1; //default instance number for forms
//lookup existing instance
instname := basename + IntToStr(instno);
if fo.FindComponent(instname) <> nil then
exit;
//create new instance //create new instance
SplitName;
basename := 'T' + basename; basename := 'T' + basename;
fc := TFormClass(GetClass(basename)); //must be registered class name! fc := nil;
if not assigned(fc) then fc := TWinControlClass(GetClass(basename)); //must be registered class name!
exit; assert(assigned(fc), 'class not registered');
Result := fc.Create(fo); Result := fc.Create(fo);
if Result.Name <> AName then if Result.Name <> AName then
Result.Name := AName; //??? Result.Name := AName; //???
@ -386,7 +505,7 @@ begin
{$ELSE} {$ELSE}
Site := TFloatingSite.Create(Application); //the new site Site := TFloatingSite.Create(Application); //the new site
{$ENDIF} {$ENDIF}
LastSite := Site; //LastSite := Site;
Site.BoundsRect := Client.BoundsRect; //the new position and extension Site.BoundsRect := Client.BoundsRect; //the new position and extension
Client.Align := alClient; Client.Align := alClient;
Client.Visible := True; //otherwise docking may be rejected Client.Visible := True; //otherwise docking may be rejected
@ -461,7 +580,7 @@ const
for j := 0 to Site.DockClientCount - 1 do begin for j := 0 to Site.DockClientCount - 1 do begin
ctl := site.DockClients[j]; ctl := site.DockClients[j];
s := OrientString[ctl.DockOrientation]; s := OrientString[ctl.DockOrientation];
DebugLn(' %s.Client=%s@%s (%d,%d)[%d,%d]', [SiteName(ASite), SiteName(ctl), s, DebugLn(' %s.Client=%s.%s@%s (%d,%d)[%d,%d]', [SiteName(ASite), ctl.Owner.Name, SiteName(ctl), s,
ctl.Left, ctl.Top, ctl.Width, ctl.Height]); ctl.Left, ctl.Top, ctl.Width, ctl.Height]);
//if ctl is TFloatingSite then //if ctl is TFloatingSite then
if (ctl is TWinControl) and wc.DockSite then if (ctl is TWinControl) and wc.DockSite then
@ -491,55 +610,17 @@ begin
DebugLn('--- dump sites ---'); DebugLn('--- dump sites ---');
for i := 0 to ComponentCount - 1 do begin for i := 0 to ComponentCount - 1 do begin
cmp := Components[i]; cmp := Components[i];
{$IFnDEF old}
if (cmp is TWinControl) and wc.DockSite then if (cmp is TWinControl) and wc.DockSite then
DumpSite(wc) DumpSite(wc)
else if ctl is TControl then begin else if ctl is TControl then begin
DebugLn('Client=%s in %s (%d,%d)[%d,%d]', [SiteName(ctl), SiteName(ctl.HostDockSite), DebugLn('Client=%s in %s (%d,%d)[%d,%d]', [SiteName(ctl), SiteName(ctl.HostDockSite),
ctl.Left, ctl.Top, ctl.Width, ctl.Height]); ctl.Left, ctl.Top, ctl.Width, ctl.Height]);
end; end;
{$ELSE} end;
if cmp is TWinControl then begin DebugLn('--- dump forms ---');
//path for i := 0 to Application.ComponentCount - 1 do begin
Site := TWinControl(cmp); cmp := Application.Components[i];
if Site.DockSite then begin DebugLn('%s: %s', [cmp.Name, cmp.ClassName]);
//reached only when ownSites is defined!
ctl := Site;
s := Format('Site=%s (%d,%d)[%d,%d]', [SiteName(ctl),
ctl.Left, ctl.Top, ctl.Width, ctl.Height]);
while ctl <> nil do begin
hds := ctl.HostDockSite <> nil;
if hds then begin
Site := ctl.HostDockSite;
if Site <> nil then
n := ' in ' + SiteName(Site) + '@' + OrientString[ctl.DockOrientation];
end else begin
Site := ctl.Parent;
if Site <> nil then
n := ' at ' + SiteName(Site) + '@' + AlignString[ctl.Align];
end;
if Site = nil then
break;
s := s + n;
ctl := Site;
end;
DebugLn(s);
//clients
Site := TWinControl(cmp);
for j := 0 to site.DockClientCount - 1 do begin
ctl := site.DockClients[j];
s := OrientString[ctl.DockOrientation];
DebugLn(' Client=%s@%s (%d,%d)[%d,%d]', [SiteName(ctl), s,
ctl.Left, ctl.Top, ctl.Width, ctl.Height]);
//if ctl is TFloatingSite then
end;
end else begin
ctl := Site;
DebugLn('Client=%s in %s (%d,%d)[%d,%d]', [SiteName(ctl), SiteName(ctl.HostDockSite),
ctl.Left, ctl.Top, ctl.Width, ctl.Height]);
end;
end;
{$ENDIF}
end; end;
DebugLn('--- end dump ---'); DebugLn('--- end dump ---');
end; end;
@ -747,5 +828,24 @@ begin
end; end;
end; end;
{ TAppDockManager }
function TAppDockManager.ReloadDockedControl(const AName: string): TControl;
begin
if False then
Result:=inherited ReloadDockedControl(AName); //asking DockSite (very bad idea)
if assigned(DockMaster) then begin
Result := DockMaster.CreateDockable(AName, True, False);
end else begin
//Owner.FindComponent(AControlName) as TControl;
Result := Application.FindComponent(AName) as TControl;
end;
if Result <> nil then
DebugLn('Reloaded %s.%s', [Result.Owner.Name, Result.Name]);
end;
initialization
RegisterClass(TFloatingSite);
DefaultDockManagerClass := TAppDockManager;
end. end.