Changeset 430 for Docking


Ignore:
Timestamp:
Oct 17, 2012, 1:24:58 PM (12 years ago)
Author:
chronos
Message:
  • Fixed: CoolDock show wrong tab focused if tab was invisible.
Location:
Docking/CoolDocking
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • Docking/CoolDocking/Demo/IDE/IDE.lpi

    r354 r430  
    309309        <Filename Value="..\..\Managers\UCDManagerRegions.pas"/>
    310310        <UnitName Value="UCDManagerRegions"/>
     311        <IsVisibleTab Value="True"/>
    311312        <EditorIndex Value="9"/>
    312313        <WindowIndex Value="0"/>
    313         <TopLine Value="10"/>
    314         <CursorPos X="43" Y="16"/>
     314        <TopLine Value="177"/>
     315        <CursorPos X="42" Y="192"/>
    315316        <UsageCount Value="129"/>
    316317        <Loaded Value="True"/>
     
    319320        <Filename Value="..\..\Managers\UCDManagerTabsPopup.pas"/>
    320321        <UnitName Value="UCDManagerTabsPopup"/>
    321         <IsVisibleTab Value="True"/>
    322322        <EditorIndex Value="0"/>
    323323        <WindowIndex Value="0"/>
    324324        <TopLine Value="348"/>
    325         <CursorPos X="3" Y="351"/>
     325        <CursorPos X="25" Y="351"/>
    326326        <UsageCount Value="120"/>
    327327        <Loaded Value="True"/>
     
    355355        <WindowIndex Value="0"/>
    356356        <TopLine Value="33"/>
    357         <CursorPos X="1" Y="46"/>
     357        <CursorPos X="16" Y="40"/>
    358358        <UsageCount Value="164"/>
    359359        <Loaded Value="True"/>
     
    574574      <Position1>
    575575        <Filename Value="..\..\UCDPopupMenu.pas"/>
    576         <Caret Line="245" Column="28" TopLine="232"/>
     576        <Caret Line="304" Column="9" TopLine="299"/>
    577577      </Position1>
    578578      <Position2>
    579579        <Filename Value="..\..\UCDPopupMenu.pas"/>
    580         <Caret Line="258" Column="28" TopLine="245"/>
     580        <Caret Line="313" Column="18" TopLine="300"/>
    581581      </Position2>
    582582      <Position3>
    583         <Filename Value="..\..\UCDPopupMenu.pas"/>
    584         <Caret Line="271" Column="28" TopLine="258"/>
     583        <Filename Value="..\..\UCDManager.pas"/>
     584        <Caret Line="79" Column="66" TopLine="61"/>
    585585      </Position3>
    586586      <Position4>
    587         <Filename Value="..\..\UCDPopupMenu.pas"/>
    588         <Caret Line="284" Column="28" TopLine="271"/>
     587        <Filename Value="..\..\Managers\UCDManagerTabs.pas"/>
     588        <Caret Line="21" Column="62" TopLine="4"/>
    589589      </Position4>
    590590      <Position5>
    591         <Filename Value="..\..\UCDPopupMenu.pas"/>
    592         <Caret Line="297" Column="28" TopLine="284"/>
     591        <Filename Value="..\..\Managers\UCDManagerTabs.pas"/>
     592        <Caret Line="16" Column="35" TopLine="8"/>
    593593      </Position5>
    594594      <Position6>
    595         <Filename Value="..\..\UCDPopupMenu.pas"/>
    596         <Caret Line="304" Column="9" TopLine="299"/>
     595        <Filename Value="..\..\Managers\UCDManagerTabs.pas"/>
     596        <Caret Line="21" Column="1" TopLine="8"/>
    597597      </Position6>
    598598      <Position7>
    599         <Filename Value="..\..\UCDPopupMenu.pas"/>
    600         <Caret Line="313" Column="18" TopLine="300"/>
     599        <Filename Value="..\..\Managers\UCDManagerRegions.pas"/>
     600        <Caret Line="23" Column="1" TopLine="8"/>
    601601      </Position7>
    602602      <Position8>
    603         <Filename Value="..\..\UCDManager.pas"/>
    604         <Caret Line="79" Column="66" TopLine="61"/>
     603        <Filename Value="..\..\Managers\UCDManagerRegions.pas"/>
     604        <Caret Line="117" Column="39" TopLine="114"/>
    605605      </Position8>
    606606      <Position9>
    607         <Filename Value="..\..\Managers\UCDManagerTabs.pas"/>
    608         <Caret Line="21" Column="62" TopLine="4"/>
     607        <Filename Value="..\..\Managers\UCDManagerRegions.pas"/>
     608        <Caret Line="16" Column="43" TopLine="10"/>
    609609      </Position9>
    610610      <Position10>
    611         <Filename Value="..\..\Managers\UCDManagerTabs.pas"/>
    612         <Caret Line="16" Column="35" TopLine="8"/>
     611        <Filename Value="..\..\Managers\UCDManagerTabsPopup.pas"/>
     612        <Caret Line="252" Column="15" TopLine="235"/>
    613613      </Position10>
    614614      <Position11>
    615         <Filename Value="..\..\Managers\UCDManagerTabs.pas"/>
    616         <Caret Line="21" Column="1" TopLine="8"/>
     615        <Filename Value="..\..\Managers\UCDManagerTabsPopup.pas"/>
     616        <Caret Line="251" Column="13" TopLine="235"/>
    617617      </Position11>
    618618      <Position12>
    619         <Filename Value="..\..\Managers\UCDManagerRegions.pas"/>
    620         <Caret Line="23" Column="1" TopLine="8"/>
     619        <Filename Value="UMainForm.pas"/>
     620        <Caret Line="188" Column="7" TopLine="172"/>
    621621      </Position12>
    622622      <Position13>
    623         <Filename Value="..\..\Managers\UCDManagerRegions.pas"/>
    624         <Caret Line="117" Column="39" TopLine="114"/>
     623        <Filename Value="UMainForm.pas"/>
     624        <Caret Line="167" Column="1" TopLine="150"/>
    625625      </Position13>
    626626      <Position14>
    627         <Filename Value="..\..\Managers\UCDManagerRegions.pas"/>
    628         <Caret Line="16" Column="43" TopLine="10"/>
     627        <Filename Value="UMainForm.pas"/>
     628        <Caret Line="163" Column="73" TopLine="150"/>
    629629      </Position14>
    630630      <Position15>
    631         <Filename Value="..\..\Managers\UCDManagerTabsPopup.pas"/>
    632         <Caret Line="252" Column="15" TopLine="235"/>
     631        <Filename Value="UMainForm.pas"/>
     632        <Caret Line="183" Column="79" TopLine="162"/>
    633633      </Position15>
    634634      <Position16>
    635         <Filename Value="..\..\Managers\UCDManagerTabsPopup.pas"/>
    636         <Caret Line="251" Column="13" TopLine="235"/>
     635        <Filename Value="..\..\Managers\UCDManagerTabs.pas"/>
     636        <Caret Line="395" Column="1" TopLine="373"/>
    637637      </Position16>
    638638      <Position17>
    639         <Filename Value="UMainForm.pas"/>
    640         <Caret Line="188" Column="7" TopLine="172"/>
     639        <Filename Value="..\..\Managers\UCDManagerTabs.pas"/>
     640        <Caret Line="170" Column="1" TopLine="157"/>
    641641      </Position17>
    642642      <Position18>
    643         <Filename Value="UMainForm.pas"/>
    644         <Caret Line="167" Column="1" TopLine="150"/>
     643        <Filename Value="UProjectManagerForm.pas"/>
     644        <Caret Line="6" Column="50" TopLine="4"/>
    645645      </Position18>
    646646      <Position19>
    647647        <Filename Value="UMainForm.pas"/>
    648         <Caret Line="163" Column="73" TopLine="150"/>
     648        <Caret Line="183" Column="79" TopLine="162"/>
    649649      </Position19>
    650650      <Position20>
    651         <Filename Value="UMainForm.pas"/>
    652         <Caret Line="183" Column="79" TopLine="162"/>
     651        <Filename Value="H:\Lazarus\1.1_2.6.0\lcl\include\wincontrol.inc"/>
     652        <Caret Line="6782" Column="32" TopLine="6763"/>
    653653      </Position20>
    654654      <Position21>
    655         <Filename Value="..\..\Managers\UCDManagerTabs.pas"/>
    656         <Caret Line="395" Column="1" TopLine="373"/>
     655        <Filename Value="UMainForm.pas"/>
     656        <Caret Line="163" Column="32" TopLine="153"/>
    657657      </Position21>
    658658      <Position22>
    659         <Filename Value="..\..\Managers\UCDManagerTabs.pas"/>
    660         <Caret Line="170" Column="1" TopLine="157"/>
     659        <Filename Value="H:\Lazarus\1.1_2.6.0\lcl\include\control.inc"/>
     660        <Caret Line="5315" Column="1" TopLine="5302"/>
    661661      </Position22>
    662662      <Position23>
    663         <Filename Value="UProjectManagerForm.pas"/>
    664         <Caret Line="6" Column="50" TopLine="4"/>
     663        <Filename Value="..\..\Managers\UCDManagerTabsPopup.pas"/>
     664        <Caret Line="361" Column="1" TopLine="348"/>
    665665      </Position23>
    666666      <Position24>
    667         <Filename Value="UMainForm.pas"/>
    668         <Caret Line="183" Column="79" TopLine="162"/>
     667        <Filename Value="H:\Lazarus\1.1_2.6.0\lcl\include\wincontrol.inc"/>
     668        <Caret Line="7889" Column="1" TopLine="7876"/>
    669669      </Position24>
    670670      <Position25>
    671         <Filename Value="H:\Lazarus\1.1_2.6.0\lcl\include\wincontrol.inc"/>
    672         <Caret Line="6782" Column="32" TopLine="6763"/>
     671        <Filename Value="..\..\Managers\UCDManagerTabsPopup.pas"/>
     672        <Caret Line="361" Column="1" TopLine="348"/>
    673673      </Position25>
    674674      <Position26>
    675         <Filename Value="UMainForm.pas"/>
    676         <Caret Line="163" Column="32" TopLine="153"/>
     675        <Filename Value="..\..\UCDConjoinForm.pas"/>
     676        <Caret Line="44" Column="7" TopLine="33"/>
    677677      </Position26>
    678678      <Position27>
    679         <Filename Value="H:\Lazarus\1.1_2.6.0\lcl\include\control.inc"/>
    680         <Caret Line="5315" Column="1" TopLine="5302"/>
     679        <Filename Value="..\..\UCDConjoinForm.pas"/>
     680        <Caret Line="42" Column="6" TopLine="33"/>
    681681      </Position27>
    682682      <Position28>
    683         <Filename Value="..\..\Managers\UCDManagerTabsPopup.pas"/>
    684         <Caret Line="361" Column="1" TopLine="348"/>
     683        <Filename Value="..\..\UCDConjoinForm.pas"/>
     684        <Caret Line="54" Column="40" TopLine="33"/>
    685685      </Position28>
    686686      <Position29>
    687         <Filename Value="H:\Lazarus\1.1_2.6.0\lcl\include\wincontrol.inc"/>
    688         <Caret Line="7889" Column="1" TopLine="7876"/>
     687        <Filename Value="..\..\UCDConjoinForm.pas"/>
     688        <Caret Line="52" Column="37" TopLine="33"/>
    689689      </Position29>
    690690      <Position30>
    691         <Filename Value="..\..\Managers\UCDManagerTabsPopup.pas"/>
    692         <Caret Line="361" Column="1" TopLine="348"/>
     691        <Filename Value="..\..\UCDConjoinForm.pas"/>
     692        <Caret Line="40" Column="16" TopLine="33"/>
    693693      </Position30>
    694694    </JumpHistory>
     
    731731  </CompilerOptions>
    732732  <Debugging>
    733     <BreakPoints Count="2">
     733    <BreakPoints Count="3">
    734734      <Item1>
    735735        <Kind Value="bpkSource"/>
     
    746746        <Line Value="371"/>
    747747      </Item2>
     748      <Item3>
     749        <Kind Value="bpkSource"/>
     750        <WatchScope Value="wpsLocal"/>
     751        <WatchKind Value="wpkWrite"/>
     752        <Source Value="..\..\UCDConjoinForm.pas"/>
     753        <Line Value="41"/>
     754      </Item3>
    748755    </BreakPoints>
    749756    <Watches Count="1">
  • Docking/CoolDocking/Managers/UCDManagerRegions.pas

    r365 r430  
    2222    procedure Paint(Sender: TObject); override;
    2323    procedure PanelResize(Sender: TObject);
    24     constructor Create;
     24    constructor Create; override;
    2525    destructor Destroy; override;
    2626    procedure SetControl(const AValue: TWinControl); override;
     
    3434    FDockItems: TObjectList; // TList<TCDManagerRegionsItem>
    3535    FLastVisibleItemsCount: Integer;
    36     function GetHeaderPos: THeaderPos; override;
    37     procedure SetHeaderPos(const AValue: THeaderPos); override;
    3836    function GetDirection(InsertAt: TAlign): TCDDirection;
    3937    procedure ResizePanels;
     
    4341  protected
    4442    FDockDirection: TCDDirection;
     43    procedure SetHeaderPos(const AValue: THeaderPos); override;
    4544  public
    4645    //Panels: TObjectList; // TObjectList<TCDStyleRegionsPanel>
     46    function GetHeaderPos: THeaderPos; override;
    4747    procedure BringToFront; override;
    4848    function FindControlInPanels(Control: TControl): TCDManagerItem; override;
     
    136136  PanelHeader.Free;
    137137  Splitter.Parent := nil;
    138   Splitter.Free;
     138  FreeAndNil(Splitter);
    139139  if Assigned(Control) then Control.Parent := nil;
    140   inherited Destroy;
     140  inherited;
    141141end;
    142142
    143143procedure TCDManagerRegionsItem.SetControl(const AValue: TWinControl);
    144144begin
    145   inherited SetControl(AValue);
     145  inherited;
    146146  PanelHeader.Header.Control := AValue;
    147147end;
     
    365365        TCDManagerItem(DockItems[0]).Control.ManualDock(HostDockSite);
    366366      end else TCDManagerItem(DockItems[0]).Control.ManualFloat(Rect(Left, Top, Left + Width, Top + Height));
    367       ManualFloat(Rect(Left, Top, Left + Width, Top + Height));
    368       inherited RemoveControl(Control);
    369       Free;
     367      if FreeIfEmpty then ManualFloat(Rect(Left, Top, Left + Width, Top + Height));
     368      inherited;
     369      if FreeIfEmpty then Free;
    370370      Exit;
    371371    end;
    372372  end;
    373   inherited RemoveControl(Control);
     373  inherited;
    374374  if ClientCount > 1 then Update;
    375375end;
  • Docking/CoolDocking/Managers/UCDManagerTabs.pas

    r373 r430  
    7575destructor TCDManagerTabsItem.Destroy;
    7676begin
    77   IconImage.Free;
    78   inherited Destroy;
     77  FreeAndNil(IconImage);
     78  inherited;
    7979end;
    8080
     
    211211destructor TCDManagerTabs.Destroy;
    212212begin
    213   FDockItems.Free;
    214   PageControl.Free;
    215   TabImageList.Free;
    216   inherited Destroy;
     213  FreeAndNil(FDockItems);
     214  FreeAndNil(PageControl);
     215  FreeAndNil(TabImageList);
     216  inherited;
    217217end;
    218218
     
    221221  I: Integer;
    222222begin
    223   inherited PaintSite(DC);
     223  inherited;
    224224  //PageControl.Invalidate;
    225225end;
     
    281281        TCDManagerItem(DockItems[0]).Control.ManualDock(HostDockSite);
    282282      end else TCDManagerItem(DockItems[0]).Control.ManualFloat(Rect(Left, Top, Left + Width, Top + Height));
    283       ManualFloat(Rect(Left, Top, Left + Width, Top + Height));
     283      if FreeIfEmpty then ManualFloat(Rect(Left, Top, Left + Width, Top + Height));
    284284      //Update;
    285       inherited RemoveControl(Control);
    286       Free;
     285      inherited;
     286      if FreeIfEmpty then Free;
    287287      Exit;
    288288    end;
     
    290290  //if ClientCount > 0 then
    291291  Update;
    292   inherited RemoveControl(Control);
     292  inherited;
    293293end;
    294294
     
    330330procedure TCDManagerTabs.BringToFront;
    331331begin
    332   inherited BringToFront;
     332  inherited;
    333333  Update;
    334334end;
     
    377377  NewTabSheet: TTabSheet;
    378378  DeletedPage: TTabSheet;
    379 begin
     379  LastIndex: Integer;
     380begin
     381  LastIndex := PageControl.TabIndex;
    380382  if FUpdateCount = 0 then begin
    381383  DebugLog('TCDManagerTabs.Update');
     
    425427      TCDManager(Control.DockManager).DockSiteVisible := True;
    426428      if not Control.Visible then Control.Show;
     429      //PageControl.TabIndex := I;
    427430    end else begin
    428431      TCDManager(Control.DockManager).DockSiteVisible := False;
     
    436439  end;
    437440  inherited;
     441  //ShowMessage(IntToStr(PageControl.TabIndex));
     442  PageControl.TabIndex := LastIndex;
    438443end;
    439444
  • Docking/CoolDocking/UCDCommon.pas

    r355 r430  
    66
    77uses
    8   Classes, SysUtils, Forms, Controls, Contnrs, StdCtrls, ExtCtrls, ComCtrls;
     8  Classes, SysUtils, Forms, Controls, Contnrs, ExtCtrls, ComCtrls;
    99
    1010type
     
    2828
    2929  TCDConjoinFormBase = class(TForm)
     30  public
    3031    constructor Create(TheOwner: TComponent); override;
    3132  end;
  • Docking/CoolDocking/UCDConjoinForm.pas

    r355 r430  
    1212
    1313  TCDConjoinForm = class(TCDConjoinFormBase)
     14  protected
     15    procedure SetName(const NewName: TComponentName); override;
    1416  public
     17    FreeIfEmpty: Boolean;
    1518    CoolDockClient: TCDClientBase;
    1619    UpdateCaptionEnable: Boolean;
     
    2023    constructor Create(TheOwner: TComponent); override;
    2124    destructor Destroy; override;
    22   private
    23     procedure SetName(const NewName: TComponentName); override;
    2425  end;
    2526
     
    4849    if Assigned(HostDockSite) and (HostDockSite is TCDConjoinForm) then
    4950      TCDConjoinForm(HostDockSite).UpdateCaption;
     51    //if Assigned(HostDockSite) and (HostDockSite is TCDConjoinForm) then
     52      TCDManager(DockManager).Update;
    5053  end;
    5154end;
     
    5760
    5861procedure TCDConjoinForm.FormHide(Sender: TObject);
    59 var
    60   I: Integer;
    6162begin
    6263  TCDManager(DockManager).Visible := False;
     
    6566constructor TCDConjoinForm.Create(TheOwner: TComponent);
    6667begin
    67   inherited CreateNew(TheOwner);
     68  inherited;
    6869  CoolDockClient := TCDClient.Create(Self);
    6970  with TCDClient(CoolDockClient) do begin
     
    7374  OnHide := FormHide;
    7475  UpdateCaptionEnable := True;
     76  FreeIfEmpty := True;
    7577end;
    7678
  • Docking/CoolDocking/UCDManager.pas

    r365 r430  
    6060    property HeaderPos: THeaderPos read FHeaderPos write SetHeaderPos;
    6161    property HeaderVisible: Boolean read GetHeaderVisible write SetHeaderVisible;
    62     constructor Create(TheOwner: TComponent);
     62    constructor Create(TheOwner: TComponent); override;
    6363    destructor Destroy; override;
    6464  end;
     
    8989    FUpdateCount: Integer;
    9090    FDockStyle: TCDStyleType;
     91    procedure SetHeaderPos(const AValue: THeaderPos); virtual;
    9192  private
    9293    FDockSite: TWinControl;
     
    116117    procedure InsertControlPanel(Control: TControl; InsertAt: TAlign;
    117118      DropCtl: TControl); virtual;
    118     procedure SetHeaderPos(const AValue: THeaderPos); virtual;
    119119    function GetHeaderPos: THeaderPos; virtual;
    120120    procedure BringToFront; virtual;
     
    552552  NewConjoinDockForm := TCDConjoinForm.Create(Application);
    553553  NewConjoinDockForm.Name := GetUniqueName('ConjoinForm');
    554   //NewConjoinDockForm.Visible := True;
     554  NewConjoinDockForm.Visible := True;
    555555  NewConjoinDockForm.BoundsRect := FDockSite.BoundsRect;
    556556  NewConjoinDockForm.CoolDockClient.Master := Self.Master;
Note: See TracChangeset for help on using the changeset viewer.