diff --git a/.gitattributes b/.gitattributes
index 11829c2831..43c8f5f7f5 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -2360,6 +2360,10 @@ examples/dockmanager/package/fdockbook.lfm svneol=native#text/plain
examples/dockmanager/package/fdockbook.lrs svneol=native#text/pascal
examples/dockmanager/package/fdockbook.pas svneol=native#text/pascal
examples/dockmanager/package/zoneheader.inc svneol=native#text/pascal
+examples/dockmanager/patches/FloatHostDockable.patch svneol=native#text/pascal
+examples/dockmanager/patches/NewClients.patch svneol=native#text/pascal
+examples/dockmanager/patches/README.txt svneol=native#text/plain
+examples/dockmanager/patches/ToolButtonAutoSizeAlign.patch svneol=native#text/pascal
examples/dockmanager/toolbar/README.txt svneol=native#text/plain
examples/dockmanager/toolbar/test1.lpi svneol=native#text/plain
examples/dockmanager/toolbar/test1.lpr svneol=native#text/plain
diff --git a/examples/dockmanager/easyedit/easyeditor.lpi b/examples/dockmanager/easyedit/easyeditor.lpi
index 42c45c35f1..d886ef1d0d 100644
--- a/examples/dockmanager/easyedit/easyeditor.lpi
+++ b/examples/dockmanager/easyedit/easyeditor.lpi
@@ -8,7 +8,7 @@
-
+
@@ -36,14 +36,14 @@
-
+
-
+
@@ -51,10 +51,10 @@
-
-
+
+
-
+
@@ -65,7 +65,7 @@
-
+
@@ -195,9 +195,11 @@
-
-
+
+
+
+
@@ -205,14 +207,26 @@
-
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
@@ -313,6 +327,22 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/examples/dockmanager/easyedit/editmain.lrs b/examples/dockmanager/easyedit/editmain.lrs
index 798e3bf1a8..2d9fd54613 100644
--- a/examples/dockmanager/easyedit/editmain.lrs
+++ b/examples/dockmanager/easyedit/editmain.lrs
@@ -1,3 +1,5 @@
+{ This is an automatically generated lazarus resource file }
+
LazarusResources.Add('TMainForm','FORMDATA',[
'TPF0'#9'TMainForm'#8'MainForm'#4'Left'#2#9#6'Height'#2'+'#3'Top'#2'g'#5'Widt'
+'h'#3#144#1#7'Caption'#6#8'MainForm'#4'Menu'#7#9'MainMenu1'#8'OnCreate'#7#10
diff --git a/examples/dockmanager/easyedit/editmain.pas b/examples/dockmanager/easyedit/editmain.pas
index f4eeb62105..675a8276bc 100644
--- a/examples/dockmanager/easyedit/editmain.pas
+++ b/examples/dockmanager/easyedit/editmain.pas
@@ -16,14 +16,24 @@ ToDo:
*)
{$mode objfpc}{$H+}
+{$DEFINE EditBook}
interface
uses
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
+{$IFDEF EditBook}
+ fEditBook,
+{$ELSE}
+{$ENDIF}
Menus, fDockBook, fEditForm, SynEdit;
type
+{$IFDEF EditBook}
+ TEditForm = TEditBook;
+{$ELSE}
+ TEditForm = TEasyDockBook;
+{$ENDIF}
TEasyEdit = TEditPage;
TMainForm = class(TForm)
@@ -39,7 +49,7 @@ type
private
//MyEdit: TEasyPages;
Editors: TList;
- CurForm: TEasyDockBook;
+ CurForm: TEditForm;
CurEdit: TEasyEdit;
public
function OpenFile(const AName: string): TObject;
@@ -75,6 +85,11 @@ end;
function TMainForm.OpenFile(const AName: string): TObject;
begin
+{$IFDEF EditBook}
+ if MRUEdit = nil then
+ MRUEdit := TEditForm.Create(self);
+ CurForm := MRUEdit;
+{$ELSE}
if Editors = nil then
Editors := TList.Create;
if Editors.Count = 0 then begin
@@ -83,6 +98,7 @@ begin
end;
if CurForm = nil then
pointer(CurForm) := Editors.Items[0];
+{$ENDIF}
//todo: load the file
CurEdit := TEasyEdit.Create(self);
//CurEdit.FloatingDockSiteClass := TEasyDockBook; //provisions there???
diff --git a/examples/dockmanager/easyedit/feditform.pas b/examples/dockmanager/easyedit/feditform.pas
index d9f90a4a1c..24eacb33c4 100644
--- a/examples/dockmanager/easyedit/feditform.pas
+++ b/examples/dockmanager/easyedit/feditform.pas
@@ -27,8 +27,7 @@ type
implementation
uses
- //EditMain;
- fDockBook;
+ EditMain;
{ TEditPage }
@@ -37,7 +36,9 @@ begin
inherited Create(AOwner);
DragKind := dkDock;
DragMode := dmAutomatic;
- FloatingDockSiteClass := TEasyDockBook;
+ //FloatingDockSiteClass := TEasyDockBook;
+ //FloatingDockSiteClass := TEditBook;
+ FloatingDockSiteClass := TEditForm;
end;
function TEditPage.GetDefaultDockCaption: string;
diff --git a/examples/dockmanager/patches/FloatHostDockable.patch b/examples/dockmanager/patches/FloatHostDockable.patch
new file mode 100644
index 0000000000..2f89027c49
--- /dev/null
+++ b/examples/dockmanager/patches/FloatHostDockable.patch
@@ -0,0 +1,13 @@
+Index: customdockform.inc
+===================================================================
+--- customdockform.inc (revision 20785)
++++ customdockform.inc (working copy)
+@@ -58,6 +58,8 @@
+ BorderStyle := bsSizeToolWin;
+ DockSite := True;
+ FormStyle := fsStayOnTop;
++ DragMode := dmAutomatic;
++ DragKind := dkDock;
+ end;
+
+ // included by forms.pp
diff --git a/examples/dockmanager/patches/NewClients.patch b/examples/dockmanager/patches/NewClients.patch
new file mode 100644
index 0000000000..63d84937a6
--- /dev/null
+++ b/examples/dockmanager/patches/NewClients.patch
@@ -0,0 +1,111 @@
+Index: controls.pp
+===================================================================
+--- controls.pp (revision 20785)
++++ controls.pp (working copy)
+@@ -1585,7 +1585,8 @@
+ FOnGetDockCaption: TGetDockCaptionEvent;
+ FWinControls: TFPList; // the child controls (only TWinControl, no TControl)
+ FDefWndProc: Pointer;
+- FDockClients: TFPList;
++ //FDockClients: TFPList;
++ FNewDockClients: TFPList;
+ FClientWidth: Integer;
+ FClientHeight: Integer;
+ FDockManager: TDockManager;
+@@ -1618,6 +1619,7 @@
+ function GetControlCount: Integer;
+ function GetDockClientCount: Integer;
+ function GetDockClients(Index: Integer): TControl;
++ function GetDockClientList: TFPList; virtual;
+ function GetHandle: HWND;
+ function GetIsResizing: boolean;
+ function GetTabOrder: TTabOrder;
+@@ -1727,6 +1729,7 @@
+ procedure SetDockManager(AMgr: TDockManager);
+ procedure DoFloatMsg(ADockSource: TDragDockObject); override;//CM_FLOAT
+ procedure DoGetDockCaption(AControl: TControl; var ACaption: String); virtual;
++ property FDockClients: TFPList read GetDockClientList;
+ protected
+ // mouse and keyboard
+ procedure DoEnter; dynamic;
+Index: include/wincontrol.inc
+===================================================================
+--- include/wincontrol.inc (revision 20785)
++++ include/wincontrol.inc (working copy)
+@@ -5935,6 +5935,26 @@
+ Result := 0;
+ end;
+
++{------------------------------------------------------------------------------
++ function TWinControl.GetVisibleDockClientCount: Integer;
++ ------------------------------------------------------------------------------}
++function TWinControl.GetVisibleDockClientCount: Integer;
++var
++ i: integer;
++ lst: TFPList;
++begin
++ Result := 0;
++ lst := FDockClients;
++ if lst=nil then exit;
++ for i:=lst.Count-1 downto 0 do
++ if TControl(lst[I]).Visible then inc(Result);
++end;
++
++function TWinControl.GetDockClientList: TFPList;
++begin
++ Result := FNewDockClients;
++end;
++
+ function TWinControl.GetDockClients(Index: Integer): TControl;
+ begin
+ if FDockClients<>nil then
+@@ -6054,7 +6074,8 @@
+ FreeThenNil(FDockManager)
+ else
+ FDockManager:=nil;
+- FreeThenNil(FDockClients);
++ //FreeThenNil(FDockClients);
++ FreeThenNil(FNewDockClients);
+ FreeThenNil(FTabList);
+ //DebugLn('[TWinControl.Destroy] D ',Name,':',ClassName);
+ inherited Destroy;
+@@ -7133,19 +7154,6 @@
+ end;
+
+ {------------------------------------------------------------------------------
+- function TWinControl.GetVisibleDockClientCount: Integer;
+- ------------------------------------------------------------------------------}
+-function TWinControl.GetVisibleDockClientCount: Integer;
+-var
+- i: integer;
+-begin
+- Result := 0;
+- if FDockClients=nil then exit;
+- for i:=FDockClients.Count-1 downto 0 do
+- if TControl(FDockClients[I]).Visible then inc(Result);
+-end;
+-
+-{------------------------------------------------------------------------------
+ procedure TWinControl.SetChildSizing(const AValue: TControlChildSizing);
+ ------------------------------------------------------------------------------}
+ procedure TWinControl.SetChildSizing(const AValue: TControlChildSizing);
+@@ -7165,14 +7173,10 @@
+ FDockSite := NewDockSite;
+ if not (csDesigning in ComponentState) then begin
+ DragManager.RegisterDockSite(Self,NewDockSite);
+- if not NewDockSite then begin
+- FreeAndNil(FDockClients);
+- FDockClients := nil;
+- DockManager := nil;
+- end
+- else begin
+- if FDockClients = nil then FDockClients := TFPList.Create;
+- DockManager := CreateDockManager;
++ if NewDockSite then begin
++ if FDockClients = nil then FNewDockClients := TFPList.Create;
++ if UseDockManager then
++ DockManager := CreateDockManager;
+ end;
+ end;
+ end;
+tc········
\ No newline at end of file
diff --git a/examples/dockmanager/patches/README.txt b/examples/dockmanager/patches/README.txt
new file mode 100644
index 0000000000..a1013a365b
--- /dev/null
+++ b/examples/dockmanager/patches/README.txt
@@ -0,0 +1,19 @@
+This directory contains some patches, which may not have found their way into the LCL.
+
+ToolButtonAutoSizeAlign.patch
+=============================
+1. makes toolbuttons preserve better their autosize width.
+2. adds new toolbuttons *after* the existing ones.
+
+Apply to improve the notebook behaviour and appearance.
+
+
+FloatHostDockable.patch
+=======================
+Makes the default floating host form dockable.
+
+
+NewClients.patch
+----------------
+Prevent loss of dock client management.
+Apply to increase application stability and dock site appearance.
\ No newline at end of file
diff --git a/examples/dockmanager/patches/ToolButtonAutoSizeAlign.patch b/examples/dockmanager/patches/ToolButtonAutoSizeAlign.patch
new file mode 100644
index 0000000000..0b3f9ac5bc
--- /dev/null
+++ b/examples/dockmanager/patches/ToolButtonAutoSizeAlign.patch
@@ -0,0 +1,28 @@
+Index: toolbutton.inc
+===================================================================
+--- toolbutton.inc (revision 20785)
++++ toolbutton.inc (working copy)
+@@ -853,7 +853,7 @@
+ FToolBar:=nil;
+ if AParent is TToolBar then
+ begin
+- if Style in [tbsButton,tbsDropDown,tbsCheck] then
++ if (Style in [tbsButton,tbsDropDown,tbsCheck]) and not AutoSize then
+ NewWidth:=TToolBar(AParent).ButtonWidth
+ else
+ NewWidth:=Width;
+@@ -869,8 +869,13 @@
+ begin
+ FToolBar:=TToolBar(Parent);
+ i := Index;
+- if i < 0 then
++ if i < 0 then begin
++ //move button last
++ i := FToolBar.ButtonCount - 1;
++ if i >= 0 then
++ Left := FToolBar.Buttons[i].Left + FToolBar.Buttons[i].Width;
+ FToolBar.AddButton(Self);
++ end;
+ UpdateVisibleToolbar;
+ end;
+ //DebugLn(['TToolButton.SetParent A ',Name,' NewIndex=',Index]);