Ignore:
Timestamp:
Apr 26, 2012, 9:12:02 AM (13 years ago)
Author:
chronos
Message:
  • Added: CoolDocking text logging support.
  • Added: CoolDocking update locking on TCDManager descendants update. This fixes tab disappear if tab with regions style conjoinform was switched to another tab.
  • Modified: CoolDocking regions style item layout changed to support aligned forms. Only one region is aligned as alClient. Rest contained regions are aligned to borders.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Docking/CoolDocking/Managers/UCDManagerRegions.pas

    r218 r354  
    1717    PanelHeader: TCDPanelHeader;
    1818    Splitter: TSplitter;
     19    Align: TAlign;
    1920    procedure VisibleChange(Sender: TObject); override;
    2021    procedure Paint(Sender: TObject); override;
     
    4344    destructor Destroy; override;
    4445    procedure PaintSite(DC: HDC); override;
    45     procedure UpdateClientSize; override;
     46    procedure Update; override;
    4647    procedure SetVisible(const AValue: Boolean); override;
    4748    procedure ChangeVisible(Control: TWinControl; Visible: Boolean);
     
    6566    //  TCDManagerRegionsItem(DockItems[DockItems.IndexOf(FindControlInPanels(TControl(Sender)))]).HideType := dhtPermanent;
    6667    //end;
    67     UpdateClientSize;
     68    Update;
     69
     70    // if any region is visible, show parent docksite
     71    //if DockSite is TForm then
     72    //  DockSite.Visible := (DockSite.VisibleDockClientCount > 0);
    6873  end;
    6974end;
     
    130135  inherited SetHeaderPos(AValue);
    131136  if Assigned(DockSite.Parent) then
    132     TCDManager(DockSite.Parent.DockManager).UpdateClientSize;
     137    TCDManager(DockSite.Parent.DockManager).Update;
    133138(*  case AValue of
    134139    hpBottom, hpTop: FDockDirection := ddVertical;
     
    179184
    180185  NewItem.PanelHeader.Parent := DockSite;
     186
     187  if DockItems.Count = 0 then NewItem.Align := alClient
     188    else NewItem.Align := InsertAt;
    181189
    182190  NewItem.Control := TWinControl(Control);
     
    219227        Control.ManualDock(DockSite, nil, InsertAt);
    220228        NewConjoinDockForm.UpdateCaption;
    221         UpdateClientSize;
     229        Update;
    222230        Exit;
    223231      end;
     
    225233    InsertControlNoUpdate(Control, InsertAt);
    226234  end;
    227   UpdateClientSize;
     235  Update;
    228236end;
    229237
     
    257265  end;
    258266  inherited RemoveControl(Control);
    259   if ClientCount > 1 then UpdateClientSize;
     267  if ClientCount > 1 then Update;
    260268end;
    261269
     
    271279  for I := 0 to ADockSite.DockClientCount - 1 do
    272280    InsertControlNoUpdate(ADockSite.DockClients[I], alLeft);
    273   UpdateClientSize;
     281  Update;
    274282end;
    275283
     
    291299end;
    292300
    293 procedure TCDManagerRegions.UpdateClientSize;
     301procedure TCDManagerRegions.Update;
    294302var
    295303  I: Integer;
     
    299307  VisibleControlsCount: Integer;
    300308begin
    301   inherited UpdateClientSize;
    302   if FDockDirection = ddHorizontal then
    303     BaseAlign := alLeft else BaseAlign := alTop;
    304 
    305   SplitterLeft := 0;
    306   SplitterTop := 0;
     309  if FUpdateCount = 0 then begin
     310  DebugLog('TCDManagerRegions.UpdateClientSize');
     311  inherited;
    307312  VisibleControlsCount := DockSite.VisibleDockClientCount;
    308313  if DockSite is TForm then
    309     DockSite.Visible := VisibleControlsCount > 0;
     314    DockSite.Visible := (VisibleControlsCount > 0);
    310315  if VisibleControlsCount = 0 then VisibleControlsCount := 1;
    311316
     
    323328    PanelHeader.Visible := Control.Visible;
    324329    Paint(Self);
    325     if I < (DockItems.Count - 1) then PanelHeader.Align := BaseAlign
    326       else PanelHeader.Align := alClient;
    327 
    328     Inc(SplitterLeft, PanelHeader.Width);
    329     Inc(SplitterTop, PanelHeader.Height);
     330    if FDockDirection = ddHorizontal then
     331      BaseAlign := alLeft else BaseAlign := alTop;
     332
     333    if I < Trunc((DockItems.Count - 1) / 2) then BaseAlign := BaseAlign
     334        else if I = Trunc((DockItems.Count - 1) / 2) then BaseAlign := alClient
     335        else if I > Trunc((DockItems.Count - 1) / 2) then begin
     336          if BaseAlign = alTop then BaseAlign := alBottom
     337          else if BaseAlign = alLeft then BaseAlign := alRight;
     338        end;
     339    PanelHeader.Align := BaseAlign;
     340
     341    Splitter.Align := BaseAlign;
     342    SplitterLeft := PanelHeader.Left;
     343    SplitterTop := PanelHeader.Top;
    330344    Splitter.Left := SplitterLeft;
    331345    Splitter.Top := SplitterTop;
    332346    Splitter.Parent := Self.DockSite;
    333     Splitter.Align := BaseAlign;
    334     Splitter.Visible := I < (DockItems.Count - 1);
     347    Splitter.Visible := I <> (Trunc(DockItems.Count - 1) / 2);
    335348    Inc(SplitterLeft, Splitter.Width);
    336349    Inc(SplitterTop, Splitter.Height);
    337350
    338351    Paint(Self);
    339     if I < (DockItems.Count - 1) then begin
    340       if DockDirection = ddHorizontal then PanelHeader.Align := alLeft
    341         else PanelHeader.Align := alTop;
    342     end else PanelHeader.Align := alClient;
     352    PanelHeader.Align := BaseAlign;
     353  end;
    343354  end;
    344355end;
     
    349360begin
    350361  inherited;
    351   for I := 0 to DockItems.Count - 1 do
     362  try
     363    BeginUpdate;
     364    for I := 0 to DockItems.Count - 1 do
    352365      with TCDManagerRegionsItem(DockItems[I]) do begin
    353366        if AValue and (not Control.Visible) and (Control.Tag = Integer(dhtTemporal))  then begin
     
    361374      end;
    362375        //ClientAreaPanel.Show;
     376  finally
     377    EndUpdate;
     378  end;
    363379end;
    364380
Note: See TracChangeset for help on using the changeset viewer.