dockmanager example: cleanup workarounds for fixed bugs/features.

Controls now preserve their designed sizes.

git-svn-id: trunk@20367 -
This commit is contained in:
dodi 2009-06-03 10:12:13 +00:00
parent e24d4d50d0
commit 144b067c3e
9 changed files with 33 additions and 60 deletions

View File

@ -28,12 +28,15 @@
<LaunchingApplication PathPlusParams="\usr\X11R6\bin\xterm -T 'Lazarus Run Output' -e $(LazarusDir)\tools\runwait.sh $(TargetCmdLine)"/>
</local>
</RunParams>
<RequiredPackages Count="1">
<RequiredPackages Count="2">
<Item1>
<PackageName Value="LCL"/>
<PackageName Value="EasyDocking"/>
</Item1>
<Item2>
<PackageName Value="LCL"/>
</Item2>
</RequiredPackages>
<Units Count="7">
<Units Count="5">
<Unit0>
<Filename Value="easydocking.lpr"/>
<IsPartOfProject Value="True"/>
@ -56,29 +59,17 @@
<UnitName Value="fMain"/>
</Unit2>
<Unit3>
<Filename Value="easydocksite.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="EasyDockSite"/>
</Unit3>
<Unit4>
<Filename Value="fTree.pas"/>
<Filename Value="ftree.pas"/>
<ComponentName Value="DumpBox"/>
<HasResources Value="True"/>
<IsPartOfProject Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="fTree"/>
</Unit4>
<Unit5>
</Unit3>
<Unit4>
<Filename Value="BUGS.txt"/>
<IsPartOfProject Value="True"/>
</Unit5>
<Unit6>
<Filename Value="fdockbook.pas"/>
<ComponentName Value="EasyDockBook"/>
<IsPartOfProject Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="fDockBook"/>
</Unit6>
</Unit4>
</Units>
</ProjectOptions>
<CompilerOptions>

View File

@ -9,8 +9,7 @@ uses
Forms,
fMain in 'fmain.pas' {EasyDockMain},
fDockable in 'fdockable.pas' {Dockable},
EasyDockSite in 'easydocksite.pas',
fTree in 'ftree.pas', fdockbook;
fTree in 'ftree.pas';
{.$R *.res}

View File

@ -50,7 +50,7 @@ done? (unclear whether this is really fixed in the trunk)
{.$DEFINE handle_existing} //dock controls existing in the dock site?
{.$DEFINE splitter_color} //use colored splitter, for debugging?
{.$DEFINE NoDrop} //patched dragobject?
{$DEFINE NoDrop} //patched dragobject?
{.$DEFINE visibility} //handling of invisible clients deserves dock manager notification!
{.$DEFINE restore} //restore button?
{.$DEFINE singleTab} //allow to create notebooks with 1 tab (in the topzone)?
@ -352,7 +352,7 @@ function TEasyTree.ZoneFromPoint(SitePos: TPoint): TEasyZone;
var
zone: TEasyZone;
begin
(* Return zone in site client coordinates.
(* Return zone from site client coordinates.
*)
zone := FTopZone;
while zone <> nil do begin
@ -616,6 +616,9 @@ Signal results:
Unfortunately there exists no way to signal invalid docking attempts :-(
*)
{ TODO -cdocking : why is this method not called for a docksite with 1 client?
If exactly the client is moved over it?
}
//debug only
DockObj := ADockObject;

View File

@ -37,7 +37,6 @@ object EasyDockBook: TEasyDockBook
Top = 28
Width = 400
Align = alClient
Caption = 'pnlDock'
DockSite = True
TabOrder = 1
OnDockDrop = pnlDockDockDrop

View File

@ -11,7 +11,7 @@ LazarusResources.Add('TEasyDockBook','FORMDATA',[
+'ttom'#5'Color'#7#9'clBtnFace'#11'EdgeBorders'#11#5'ebTop'#8'ebBottom'#0#4'F'
+'lat'#8#10'Font.Style'#11#6'fsBold'#0#4'List'#9#11'ParentColor'#8#10'ParentF'
+'ont'#8#12'ShowCaptions'#9#8'TabOrder'#2#0#0#0#6'TPanel'#7'pnlDock'#4'Left'#2
+#0#6'Height'#3#16#1#3'Top'#2#28#5'Width'#3#144#1#5'Align'#7#8'alClient'#7'Ca'
+'ption'#6#7'pnlDock'#8'DockSite'#9#8'TabOrder'#2#1#10'OnDockDrop'#7#15'pnlDo'
+'ckDockDrop'#8'OnUnDock'#7#13'pnlDockUnDock'#0#0#0
+#0#6'Height'#3#16#1#3'Top'#2#28#5'Width'#3#144#1#5'Align'#7#8'alClient'#8'Do'
+'ckSite'#9#8'TabOrder'#2#1#10'OnDockDrop'#7#15'pnlDockDockDrop'#8'OnUnDock'#7
+#13'pnlDockUnDock'#0#0#0
]);

View File

@ -6,9 +6,6 @@ unit fDockBook;
The currently visible tab remains down.
A control can be undocked by dragging the associated tab.
This makes the tabs act as grab regions, for undocking forms.
ToDo:
Currently the buttons have a uniform (too small) size.
*)
{$mode objfpc}{$H+}
@ -84,22 +81,13 @@ procedure TEasyDockBook.pnlDockDockDrop(Sender: TObject; Source: TDragDockObject
var
btn: TTabButton;
begin
{ TODO : make buttons big enough for the text }
//Tabs.BeginUpdate; - doesn't help
btn := TTabButton.Create(Tabs);
btn.Control := Source.Control;
btn.Control.Align := alClient;
btn.Caption := GetDockCaption(btn.Control);
//btn.Caption := ' ' + GetDockCaption(btn.Control) + ' ';
//btn.AutoSize := True; - doesn't help
btn.OnClick := @ToolButton1Click;
btn.Down := True;
btn.Click;
//Tabs.EndUpdate;
{ this also doesn't help
Tabs.ShowCaptions := False;
Tabs.ShowCaptions := True;
}
end;
procedure TEasyDockBook.pnlDockUnDock(Sender: TObject; Client: TControl;
@ -161,17 +149,13 @@ constructor TTabButton.Create(TheOwner: TComponent);
var
i, last: integer;
begin
{ TODO : create as last button }
inherited Create(TheOwner);
//these properties must be set before Parent
//AllowAllUp := False;
Style := tbsCheck;
//self.Width := 100;
AutoSize := True;
Parent := TWinControl(TheOwner);
//these properties must be set after Parent
Grouped := True;
//AdjustSize; //doesn't help
end;
procedure TTabButton.MouseMove(Shift: TShiftState; X, Y: Integer);

View File

@ -1,7 +1,7 @@
object DumpBox: TDumpBox
Left = 436
Left = 366
Height = 440
Top = 562
Top = 501
Width = 635
ActiveControl = Memo1
Caption = 'DumpBox'
@ -9,10 +9,11 @@ object DumpBox: TDumpBox
ClientWidth = 635
Font.Height = -11
Font.Name = 'MS Sans Serif'
Position = poMainFormCenter
LCLVersion = '0.9.27'
object Memo1: TMemo
Left = 0
Height = 440
Top = 0
Width = 635
Align = alClient
Lines.Strings = (

View File

@ -1,9 +1,11 @@
{ This is an automatically generated lazarus resource file }
LazarusResources.Add('TDumpBox','FORMDATA',[
'TPF0'#8'TDumpBox'#7'DumpBox'#4'Left'#3#180#1#6'Height'#3#184#1#3'Top'#3'2'#2
'TPF0'#8'TDumpBox'#7'DumpBox'#4'Left'#3'n'#1#6'Height'#3#184#1#3'Top'#3#245#1
+#5'Width'#3'{'#2#13'ActiveControl'#7#5'Memo1'#7'Caption'#6#7'DumpBox'#12'Cli'
+'entHeight'#3#184#1#11'ClientWidth'#3'{'#2#11'Font.Height'#2#245#9'Font.Name'
+#6#13'MS Sans Serif'#8'Position'#7#16'poMainFormCenter'#10'LCLVersion'#6#6'0'
+'.9.27'#0#5'TMemo'#5'Memo1'#6'Height'#3#184#1#5'Width'#3'{'#2#5'Align'#7#8'a'
+'lClient'#13'Lines.Strings'#1#6#5'Memo1'#0#8'ReadOnly'#9#8'TabOrder'#2#0#8'W'
+'ordWrap'#8#0#0#0
+#6#13'MS Sans Serif'#10'LCLVersion'#6#6'0.9.27'#0#5'TMemo'#5'Memo1'#4'Left'#2
+#0#6'Height'#3#184#1#3'Top'#2#0#5'Width'#3'{'#2#5'Align'#7#8'alClient'#13'Li'
+'nes.Strings'#1#6#5'Memo1'#0#8'ReadOnly'#9#8'TabOrder'#2#0#8'WordWrap'#8#0#0
+#0
]);

View File

@ -52,11 +52,11 @@ const //zone decoration sizes
dButton = 14; //include some space for themes
dHeader = dButton + 2*dBorder; // 22 - dSizer; //splitter outside header!
//minimal (Delphi) header
GrabberSize = 12;
GrabberSize = 10; // 12;
dDDist = 1;
dDBorder = 1;
dDHeader = GrabberSize + dSizer; //?
dDButton = GrabberSize - 2*dDBorder; //10?
dDButton = GrabberSize - dBorder; // 2*dDBorder; //10?
(* Zone part map.
In portrait mode (header on top), the zone rectangle is adjusted according
@ -95,7 +95,7 @@ HeaderPartMap: array[TEasyHeaderStyle, TEasyZonePart] of TZonePartMap = (
{zpNowhere} (),
{zpClient} (dTop:dDHeader; dBottom:0),
{zpAll} (dTop:dSizer; dBottom:-dDHeader),
{zpCaption} (dTop:dSizer+dDBorder; dBottom:-dDButton; dLeft:dDBorder; dRight:dDBorder+dDButton),
{zpCaption} (dTop:dSizer+dDBorder; dBottom:-dDButton; dLeft:dDBorder; dRight:2*dDBorder+dDButton),
{zpSizer} (dTop:0; dBottom:-dSizer),
{$IFDEF restore}
{zpRestoreButton} (),
@ -358,17 +358,11 @@ begin
with DrawRect do begin
DrawRect := GetRectOfPart(ARect, AOrientation, zpCaption, AZone.HasSizer);
if AOrientation = doVertical then begin
//DrawCloseButton(Right-FGrabberSize+1, Top+1);
//DrawGrabberLine(Left+2, Top+3, Right-GrabberSize-2, Top+5);
//DrawGrabberLine(Left+2, Top+6, Right-GrabberSize-2, Top+8);
inc(Top, 1);
DrawGrabberLine(Left, Top, Right, Top+2);
inc(Top, 3);
DrawGrabberLine(Left, Top, Right, Top+2);
end else begin
//DrawCloseButton(Left+1, Top+1);
//DrawGrabberLine(Left+3, Top+GrabberSize+1, Left+5, Bottom-2);
//DrawGrabberLine(Left+6, Top+GrabberSize+1, Left+8, Bottom-2);
inc(Left, 1);
DrawGrabberLine(Left, Top, Left+2, Bottom);
inc(Left, 3);