Ignore:
Timestamp:
Mar 10, 2011, 11:20:08 AM (14 years ago)
Author:
george
Message:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Docking/CoolDocking/UCoolDockLayout.pas

    r184 r185  
    2727    UndockSize: TPoint;
    2828    DockStyle: TDockStyle;
     29    Processed: Boolean;
    2930    procedure SaveToNode(Node: TDOMNode);
    3031    procedure LoadFromNode(Node: TDOMNode);
     
    391392            FormClass := TFormClass(FindClass('TCoolDockConjoinForm'));
    392393            if FormClass = TCoolDockConjoinForm then begin
    393               ParentComponent := TCoolDockConjoinForm.Create(Application);
     394              ParentComponent := TCoolDockManager(Form.DockManager).CreateContainer(alNone);
    394395              TCoolDockManager(TCoolDockConjoinForm(ParentComponent).Panel.DockManager).DockStyle := ParentLayoutItem.DockStyle;
    395396              ParentLayoutItem.Restore(TWinControl(ParentComponent));
     
    401402    if Assigned(ParentComponent) and (ParentComponent is TCoolDockConjoinForm) then
    402403      Form.ManualDock(TCoolDockConjoinForm(ParentComponent).Panel);
    403   end else
    404   if Assigned(Form.HostDockSite) then Form.ManualFloat(Rect.AsTRect);
     404  end;
     405  Processed := True;
    405406end;
    406407
     
    509510  I: Integer;
    510511begin
     512  // Undock all forms
     513  I := 0;
     514  while (I < Application.ComponentCount) do begin
     515    if (Application.Components[I] is TForm) then begin
     516      Form := (Application.Components[I] as TForm);
     517      if Assigned(Form.HostDockSite) then
     518        Form.ManualFloat(Rect(Form.Left, Form.Top, Form.Left + Form.Width, Form.Top + Form.Height));
     519    end;
     520    Inc(I);
     521  end;
     522
     523  for I := 0 to Items.Count - 1 do
     524  with TCoolDockLayoutItem(Items[I]) do
     525    Processed := False;
     526
    511527  for I := 0 to Items.Count - 1 do
    512528  with TCoolDockLayoutItem(Items[I]) do begin
    513529    Form := TForm(Application.FindComponent(Name));
    514     if Assigned(Form) then Restore(Form);
     530    if Assigned(Form) and (not Assigned(Form.HostDockSite)) and (not Processed) then Restore(Form);
    515531  end;
    516532end;
Note: See TracChangeset for help on using the changeset viewer.