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

View File

@ -9,8 +9,7 @@ uses
Forms, Forms,
fMain in 'fmain.pas' {EasyDockMain}, fMain in 'fmain.pas' {EasyDockMain},
fDockable in 'fdockable.pas' {Dockable}, fDockable in 'fdockable.pas' {Dockable},
EasyDockSite in 'easydocksite.pas', fTree in 'ftree.pas';
fTree in 'ftree.pas', fdockbook;
{.$R *.res} {.$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 handle_existing} //dock controls existing in the dock site?
{.$DEFINE splitter_color} //use colored splitter, for debugging? {.$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 visibility} //handling of invisible clients deserves dock manager notification!
{.$DEFINE restore} //restore button? {.$DEFINE restore} //restore button?
{.$DEFINE singleTab} //allow to create notebooks with 1 tab (in the topzone)? {.$DEFINE singleTab} //allow to create notebooks with 1 tab (in the topzone)?
@ -352,7 +352,7 @@ function TEasyTree.ZoneFromPoint(SitePos: TPoint): TEasyZone;
var var
zone: TEasyZone; zone: TEasyZone;
begin begin
(* Return zone in site client coordinates. (* Return zone from site client coordinates.
*) *)
zone := FTopZone; zone := FTopZone;
while zone <> nil do begin while zone <> nil do begin
@ -616,6 +616,9 @@ Signal results:
Unfortunately there exists no way to signal invalid docking attempts :-( 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 //debug only
DockObj := ADockObject; DockObj := ADockObject;

View File

@ -37,7 +37,6 @@ object EasyDockBook: TEasyDockBook
Top = 28 Top = 28
Width = 400 Width = 400
Align = alClient Align = alClient
Caption = 'pnlDock'
DockSite = True DockSite = True
TabOrder = 1 TabOrder = 1
OnDockDrop = pnlDockDockDrop 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' +'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' +'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 +'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' +#0#6'Height'#3#16#1#3'Top'#2#28#5'Width'#3#144#1#5'Align'#7#8'alClient'#8'Do'
+'ption'#6#7'pnlDock'#8'DockSite'#9#8'TabOrder'#2#1#10'OnDockDrop'#7#15'pnlDo' +'ckSite'#9#8'TabOrder'#2#1#10'OnDockDrop'#7#15'pnlDockDockDrop'#8'OnUnDock'#7
+'ckDockDrop'#8'OnUnDock'#7#13'pnlDockUnDock'#0#0#0 +#13'pnlDockUnDock'#0#0#0
]); ]);

View File

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

View File

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

View File

@ -1,9 +1,11 @@
{ This is an automatically generated lazarus resource file }
LazarusResources.Add('TDumpBox','FORMDATA',[ 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' +#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' +'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' +#6#13'MS Sans Serif'#10'LCLVersion'#6#6'0.9.27'#0#5'TMemo'#5'Memo1'#4'Left'#2
+'.9.27'#0#5'TMemo'#5'Memo1'#6'Height'#3#184#1#5'Width'#3'{'#2#5'Align'#7#8'a' +#0#6'Height'#3#184#1#3'Top'#2#0#5'Width'#3'{'#2#5'Align'#7#8'alClient'#13'Li'
+'lClient'#13'Lines.Strings'#1#6#5'Memo1'#0#8'ReadOnly'#9#8'TabOrder'#2#0#8'W' +'nes.Strings'#1#6#5'Memo1'#0#8'ReadOnly'#9#8'TabOrder'#2#0#8'WordWrap'#8#0#0
+'ordWrap'#8#0#0#0 +#0
]); ]);

View File

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