Changeset 217 for Docking


Ignore:
Timestamp:
Mar 22, 2011, 11:32:28 AM (14 years ago)
Author:
george
Message:
  • Fixed: If control docked to panel owned by main form then it was possible to redock main form to conjoin form.
  • Modified: Header title is now painted to canvas instead of use of TLabel. This will be necessary to draw rotated text later.
  • Added: Length of header title is now reduced to not overlap to header buttons area.
Location:
Docking/CoolDocking
Files:
7 edited

Legend:

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

    r216 r217  
    4747      </Item4>
    4848    </RequiredPackages>
    49     <Units Count="50">
     49    <Units Count="51">
    5050      <Unit0>
    5151        <Filename Value="IDE.lpr"/>
    5252        <IsPartOfProject Value="True"/>
    5353        <UnitName Value="IDE"/>
    54         <EditorIndex Value="8"/>
    5554        <WindowIndex Value="0"/>
    5655        <TopLine Value="10"/>
    5756        <CursorPos X="1" Y="34"/>
    5857        <UsageCount Value="314"/>
    59         <Loaded Value="True"/>
    6058      </Unit0>
    6159      <Unit1>
     
    6765        <EditorIndex Value="1"/>
    6866        <WindowIndex Value="0"/>
    69         <TopLine Value="90"/>
    70         <CursorPos X="27" Y="102"/>
     67        <TopLine Value="171"/>
     68        <CursorPos X="32" Y="185"/>
    7169        <UsageCount Value="314"/>
    7270        <Loaded Value="True"/>
     
    108106      <Unit5>
    109107        <Filename Value="E:\Projekty2\FreePascalManager\trunk\Instance\1\Lazarus\lcl\include\control.inc"/>
    110         <EditorIndex Value="10"/>
    111         <WindowIndex Value="0"/>
    112         <TopLine Value="3934"/>
    113         <CursorPos X="1" Y="3955"/>
     108        <EditorIndex Value="12"/>
     109        <WindowIndex Value="0"/>
     110        <TopLine Value="2412"/>
     111        <CursorPos X="1" Y="2425"/>
    114112        <UsageCount Value="144"/>
    115113        <Loaded Value="True"/>
     
    223221        <Filename Value="..\..\UCDLayout.pas"/>
    224222        <UnitName Value="UCDLayout"/>
    225         <EditorIndex Value="13"/>
     223        <EditorIndex Value="15"/>
    226224        <WindowIndex Value="0"/>
    227225        <TopLine Value="361"/>
    228         <CursorPos X="44" Y="374"/>
     226        <CursorPos X="49" Y="376"/>
    229227        <UsageCount Value="49"/>
    230228        <Loaded Value="True"/>
     
    232230      <Unit17>
    233231        <Filename Value="E:\Projekty2\FreePascalManager\trunk\Instance\1\FPC\rtl\objpas\classes\classesh.inc"/>
    234         <WindowIndex Value="0"/>
    235         <TopLine Value="285"/>
    236         <CursorPos X="14" Y="298"/>
    237         <UsageCount Value="2"/>
     232        <EditorIndex Value="5"/>
     233        <WindowIndex Value="0"/>
     234        <TopLine Value="1883"/>
     235        <CursorPos X="10" Y="1896"/>
     236        <UsageCount Value="10"/>
     237        <Loaded Value="True"/>
    238238      </Unit17>
    239239      <Unit18>
     
    244244        <TopLine Value="22"/>
    245245        <CursorPos X="26" Y="32"/>
    246         <UsageCount Value="18"/>
     246        <UsageCount Value="19"/>
    247247        <Loaded Value="True"/>
    248248      </Unit18>
     
    250250        <Filename Value="E:\Projekty2\FreePascalManager\trunk\Instance\1\Lazarus\lcl\controls.pp"/>
    251251        <UnitName Value="Controls"/>
    252         <EditorIndex Value="6"/>
    253         <WindowIndex Value="0"/>
    254         <TopLine Value="512"/>
    255         <CursorPos X="26" Y="525"/>
     252        <EditorIndex Value="9"/>
     253        <WindowIndex Value="0"/>
     254        <TopLine Value="126"/>
     255        <CursorPos X="53" Y="130"/>
    256256        <UsageCount Value="124"/>
    257257        <Loaded Value="True"/>
     
    259259      <Unit20>
    260260        <Filename Value="E:\Projekty2\FreePascalManager\trunk\Instance\1\Lazarus\lcl\include\wincontrol.inc"/>
    261         <EditorIndex Value="9"/>
     261        <EditorIndex Value="11"/>
    262262        <WindowIndex Value="0"/>
    263263        <TopLine Value="6263"/>
     
    280280        <Filename Value="..\..\UCDCommon.pas"/>
    281281        <UnitName Value="UCDCommon"/>
    282         <EditorIndex Value="5"/>
     282        <EditorIndex Value="8"/>
    283283        <WindowIndex Value="0"/>
    284284        <TopLine Value="1"/>
    285         <CursorPos X="32" Y="12"/>
    286         <UsageCount Value="47"/>
     285        <CursorPos X="1" Y="78"/>
     286        <UsageCount Value="48"/>
    287287        <Loaded Value="True"/>
    288288      </Unit22>
     
    290290        <Filename Value="..\..\UCDPopupMenu.pas"/>
    291291        <UnitName Value="UCDPopupMenu"/>
    292         <WindowIndex Value="0"/>
    293         <TopLine Value="319"/>
    294         <CursorPos X="1" Y="335"/>
     292        <EditorIndex Value="7"/>
     293        <WindowIndex Value="0"/>
     294        <TopLine Value="219"/>
     295        <CursorPos X="18" Y="232"/>
    295296        <UsageCount Value="128"/>
     297        <Loaded Value="True"/>
    296298      </Unit23>
    297299      <Unit24>
    298300        <Filename Value="..\..\Managers\UCDManagerTabs.pas"/>
    299301        <UnitName Value="UCDManagerTabs"/>
    300         <EditorIndex Value="14"/>
    301         <WindowIndex Value="0"/>
    302         <TopLine Value="26"/>
    303         <CursorPos X="28" Y="36"/>
     302        <EditorIndex Value="16"/>
     303        <WindowIndex Value="0"/>
     304        <TopLine Value="243"/>
     305        <CursorPos X="44" Y="256"/>
    304306        <UsageCount Value="130"/>
    305307        <Loaded Value="True"/>
     
    308310        <Filename Value="..\..\Managers\UCDManagerRegions.pas"/>
    309311        <UnitName Value="UCDManagerRegions"/>
    310         <IsVisibleTab Value="True"/>
    311         <EditorIndex Value="7"/>
    312         <WindowIndex Value="0"/>
    313         <TopLine Value="231"/>
    314         <CursorPos X="12" Y="244"/>
     312        <EditorIndex Value="10"/>
     313        <WindowIndex Value="0"/>
     314        <TopLine Value="301"/>
     315        <CursorPos X="1" Y="314"/>
    315316        <UsageCount Value="129"/>
    316317        <Loaded Value="True"/>
     
    321322        <EditorIndex Value="0"/>
    322323        <WindowIndex Value="0"/>
    323         <TopLine Value="262"/>
    324         <CursorPos X="52" Y="272"/>
     324        <TopLine Value="235"/>
     325        <CursorPos X="1" Y="248"/>
    325326        <UsageCount Value="120"/>
    326327        <Loaded Value="True"/>
     
    341342        <Filename Value="..\..\UCDManager.pas"/>
    342343        <UnitName Value="UCDManager"/>
     344        <IsVisibleTab Value="True"/>
    343345        <EditorIndex Value="4"/>
    344346        <WindowIndex Value="0"/>
    345         <TopLine Value="84"/>
    346         <CursorPos X="5" Y="97"/>
     347        <TopLine Value="723"/>
     348        <CursorPos X="30" Y="744"/>
    347349        <UsageCount Value="105"/>
    348350        <Loaded Value="True"/>
     
    351353        <Filename Value="..\..\UCDConjoinForm.pas"/>
    352354        <UnitName Value="UCDConjoinForm"/>
    353         <EditorIndex Value="12"/>
     355        <EditorIndex Value="14"/>
    354356        <WindowIndex Value="0"/>
    355357        <TopLine Value="33"/>
     
    510512        <Filename Value="E:\Projekty2\FreePascalManager\trunk\Instance\1\Lazarus\lcl\stdctrls.pp"/>
    511513        <UnitName Value="StdCtrls"/>
    512         <EditorIndex Value="11"/>
     514        <EditorIndex Value="13"/>
    513515        <WindowIndex Value="0"/>
    514516        <TopLine Value="1447"/>
    515517        <CursorPos X="14" Y="1460"/>
    516         <UsageCount Value="11"/>
     518        <UsageCount Value="12"/>
    517519        <Loaded Value="True"/>
    518520      </Unit49>
     521      <Unit50>
     522        <Filename Value="E:\Projekty2\FreePascalManager\trunk\Instance\1\Lazarus\lcl\graphics.pp"/>
     523        <UnitName Value="Graphics"/>
     524        <EditorIndex Value="6"/>
     525        <WindowIndex Value="0"/>
     526        <TopLine Value="959"/>
     527        <CursorPos X="14" Y="1161"/>
     528        <UsageCount Value="10"/>
     529        <Loaded Value="True"/>
     530      </Unit50>
    519531    </Units>
    520532    <JumpHistory Count="30" HistoryIndex="29">
    521533      <Position1>
    522         <Filename Value="E:\Projekty2\FreePascalManager\trunk\Instance\1\Lazarus\lcl\include\control.inc"/>
    523         <Caret Line="3931" Column="1" TopLine="3916"/>
     534        <Filename Value="..\..\UCDPopupMenu.pas"/>
     535        <Caret Line="257" Column="16" TopLine="244"/>
    524536      </Position1>
    525537      <Position2>
    526         <Filename Value="E:\Projekty2\FreePascalManager\trunk\Instance\1\Lazarus\lcl\include\control.inc"/>
    527         <Caret Line="3932" Column="1" TopLine="3922"/>
     538        <Filename Value="..\..\Managers\UCDManagerRegions.pas"/>
     539        <Caret Line="126" Column="1" TopLine="113"/>
    528540      </Position2>
    529541      <Position3>
    530         <Filename Value="E:\Projekty2\FreePascalManager\trunk\Instance\1\Lazarus\lcl\include\control.inc"/>
    531         <Caret Line="3939" Column="1" TopLine="3922"/>
     542        <Filename Value="..\..\UCDManager.pas"/>
     543        <Caret Line="32" Column="19" TopLine="27"/>
    532544      </Position3>
    533545      <Position4>
    534         <Filename Value="E:\Projekty2\FreePascalManager\trunk\Instance\1\Lazarus\lcl\include\control.inc"/>
    535         <Caret Line="3942" Column="1" TopLine="3922"/>
     546        <Filename Value="..\..\Managers\UCDManagerRegions.pas"/>
     547        <Caret Line="18" Column="15" TopLine="5"/>
    536548      </Position4>
    537549      <Position5>
    538         <Filename Value="E:\Projekty2\FreePascalManager\trunk\Instance\1\Lazarus\lcl\include\control.inc"/>
    539         <Caret Line="3945" Column="1" TopLine="3924"/>
     550        <Filename Value="..\..\Managers\UCDManagerRegions.pas"/>
     551        <Caret Line="92" Column="1" TopLine="79"/>
    540552      </Position5>
    541553      <Position6>
    542         <Filename Value="E:\Projekty2\FreePascalManager\trunk\Instance\1\Lazarus\lcl\include\control.inc"/>
    543         <Caret Line="3946" Column="1" TopLine="3925"/>
     554        <Filename Value="..\..\Managers\UCDManagerTabsPopup.pas"/>
     555        <Caret Line="330" Column="44" TopLine="317"/>
    544556      </Position6>
    545557      <Position7>
    546         <Filename Value="E:\Projekty2\FreePascalManager\trunk\Instance\1\Lazarus\lcl\include\control.inc"/>
    547         <Caret Line="3948" Column="1" TopLine="3927"/>
     558        <Filename Value="..\..\UCDManager.pas"/>
     559        <Caret Line="668" Column="3" TopLine="657"/>
    548560      </Position7>
    549561      <Position8>
    550         <Filename Value="E:\Projekty2\FreePascalManager\trunk\Instance\1\Lazarus\lcl\include\control.inc"/>
    551         <Caret Line="3951" Column="1" TopLine="3930"/>
     562        <Filename Value="..\..\UCDManager.pas"/>
     563        <Caret Line="605" Column="1" TopLine="592"/>
    552564      </Position8>
    553565      <Position9>
    554         <Filename Value="E:\Projekty2\FreePascalManager\trunk\Instance\1\Lazarus\lcl\include\control.inc"/>
    555         <Caret Line="3952" Column="1" TopLine="3931"/>
     566        <Filename Value="..\..\UCDManager.pas"/>
     567        <Caret Line="679" Column="31" TopLine="665"/>
    556568      </Position9>
    557569      <Position10>
    558         <Filename Value="E:\Projekty2\FreePascalManager\trunk\Instance\1\Lazarus\lcl\include\control.inc"/>
    559         <Caret Line="3953" Column="1" TopLine="3932"/>
     570        <Filename Value="..\..\UCDPopupMenu.pas"/>
     571        <Caret Line="246" Column="16" TopLine="237"/>
    560572      </Position10>
    561573      <Position11>
    562         <Filename Value="E:\Projekty2\FreePascalManager\trunk\Instance\1\Lazarus\lcl\include\control.inc"/>
    563         <Caret Line="3954" Column="1" TopLine="3933"/>
     574        <Filename Value="..\..\UCDPopupMenu.pas"/>
     575        <Caret Line="232" Column="18" TopLine="219"/>
    564576      </Position11>
    565577      <Position12>
    566         <Filename Value="E:\Projekty2\FreePascalManager\trunk\Instance\1\Lazarus\lcl\include\control.inc"/>
    567         <Caret Line="3955" Column="1" TopLine="3934"/>
     578        <Filename Value="..\..\UCDManager.pas"/>
     579        <Caret Line="602" Column="20" TopLine="594"/>
    568580      </Position12>
    569581      <Position13>
    570         <Filename Value="..\..\Managers\UCDManagerRegions.pas"/>
    571         <Caret Line="220" Column="1" TopLine="215"/>
     582        <Filename Value="..\..\UCDManager.pas"/>
     583        <Caret Line="727" Column="11" TopLine="708"/>
    572584      </Position13>
    573585      <Position14>
    574         <Filename Value="..\..\Managers\UCDManagerRegions.pas"/>
    575         <Caret Line="221" Column="1" TopLine="215"/>
     586        <Filename Value="..\..\UCDManager.pas"/>
     587        <Caret Line="659" Column="17" TopLine="643"/>
    576588      </Position14>
    577589      <Position15>
    578         <Filename Value="..\..\Managers\UCDManagerRegions.pas"/>
    579         <Caret Line="222" Column="1" TopLine="215"/>
     590        <Filename Value="..\..\UCDManager.pas"/>
     591        <Caret Line="729" Column="32" TopLine="8"/>
    580592      </Position15>
    581593      <Position16>
    582         <Filename Value="..\..\Managers\UCDManagerRegions.pas"/>
    583         <Caret Line="225" Column="1" TopLine="215"/>
     594        <Filename Value="..\..\UCDManager.pas"/>
     595        <Caret Line="660" Column="14" TopLine="638"/>
    584596      </Position16>
    585597      <Position17>
    586         <Filename Value="..\..\Managers\UCDManagerRegions.pas"/>
    587         <Caret Line="226" Column="1" TopLine="215"/>
     598        <Filename Value="..\..\UCDManager.pas"/>
     599        <Caret Line="731" Column="70" TopLine="719"/>
    588600      </Position17>
    589601      <Position18>
    590         <Filename Value="..\..\Managers\UCDManagerRegions.pas"/>
    591         <Caret Line="229" Column="1" TopLine="215"/>
     602        <Filename Value="..\..\UCDManager.pas"/>
     603        <Caret Line="743" Column="47" TopLine="730"/>
    592604      </Position18>
    593605      <Position19>
    594         <Filename Value="..\..\Managers\UCDManagerRegions.pas"/>
    595         <Caret Line="231" Column="13" TopLine="215"/>
     606        <Filename Value="..\..\UCDManager.pas"/>
     607        <Caret Line="740" Column="9" TopLine="730"/>
    596608      </Position19>
    597609      <Position20>
    598         <Filename Value="..\..\Managers\UCDManagerRegions.pas"/>
    599         <Caret Line="232" Column="1" TopLine="215"/>
     610        <Filename Value="..\..\UCDManager.pas"/>
     611        <Caret Line="738" Column="1" TopLine="730"/>
    600612      </Position20>
    601613      <Position21>
    602         <Filename Value="..\..\Managers\UCDManagerRegions.pas"/>
    603         <Caret Line="233" Column="1" TopLine="215"/>
     614        <Filename Value="..\..\UCDManager.pas"/>
     615        <Caret Line="729" Column="1" TopLine="718"/>
    604616      </Position21>
    605617      <Position22>
    606         <Filename Value="..\..\Managers\UCDManagerRegions.pas"/>
    607         <Caret Line="243" Column="14" TopLine="220"/>
     618        <Filename Value="..\..\UCDManager.pas"/>
     619        <Caret Line="730" Column="1" TopLine="718"/>
    608620      </Position22>
    609621      <Position23>
    610         <Filename Value="..\..\Managers\UCDManagerRegions.pas"/>
    611         <Caret Line="201" Column="1" TopLine="188"/>
     622        <Filename Value="..\..\UCDManager.pas"/>
     623        <Caret Line="731" Column="33" TopLine="718"/>
    612624      </Position23>
    613625      <Position24>
    614         <Filename Value="..\..\Managers\UCDManagerRegions.pas"/>
    615         <Caret Line="203" Column="1" TopLine="188"/>
     626        <Filename Value="..\..\UCDManager.pas"/>
     627        <Caret Line="732" Column="3" TopLine="718"/>
    616628      </Position24>
    617629      <Position25>
    618         <Filename Value="..\..\Managers\UCDManagerRegions.pas"/>
    619         <Caret Line="230" Column="12" TopLine="217"/>
     630        <Filename Value="..\..\UCDManager.pas"/>
     631        <Caret Line="736" Column="1" TopLine="718"/>
    620632      </Position25>
    621633      <Position26>
    622634        <Filename Value="..\..\UCDManager.pas"/>
    623         <Caret Line="128" Column="24" TopLine="115"/>
     635        <Caret Line="729" Column="36" TopLine="718"/>
    624636      </Position26>
    625637      <Position27>
    626         <Filename Value="..\..\Managers\UCDManagerRegions.pas"/>
    627         <Caret Line="231" Column="15" TopLine="217"/>
     638        <Filename Value="..\..\UCDManager.pas"/>
     639        <Caret Line="740" Column="1" TopLine="719"/>
    628640      </Position27>
    629641      <Position28>
    630         <Filename Value="..\..\Managers\UCDManagerRegions.pas"/>
    631         <Caret Line="201" Column="18" TopLine="188"/>
     642        <Filename Value="..\..\UCDManager.pas"/>
     643        <Caret Line="744" Column="8" TopLine="723"/>
    632644      </Position28>
    633645      <Position29>
    634         <Filename Value="..\..\Managers\UCDManagerRegions.pas"/>
    635         <Caret Line="205" Column="34" TopLine="188"/>
     646        <Filename Value="..\..\UCDManager.pas"/>
     647        <Caret Line="739" Column="1" TopLine="723"/>
    636648      </Position29>
    637649      <Position30>
    638         <Filename Value="..\..\Managers\UCDManagerRegions.pas"/>
    639         <Caret Line="231" Column="5" TopLine="218"/>
     650        <Filename Value="..\..\UCDManager.pas"/>
     651        <Caret Line="740" Column="1" TopLine="723"/>
    640652      </Position30>
    641653    </JumpHistory>
     
    678690  </CompilerOptions>
    679691  <Debugging>
    680     <BreakPoints Count="1">
    681       <Item1>
    682         <Source Value="..\..\Managers\UCDManagerRegions.pas"/>
    683         <Line Value="202"/>
    684       </Item1>
    685     </BreakPoints>
    686692    <Watches Count="1">
    687693      <Item1>
  • Docking/CoolDocking/Managers/UCDManagerRegions.pas

    r216 r217  
    9090  PanelHeader.Header.ManagerItem := Self;
    9191  PanelHeader.Header.OnMouseDown := DockPanelMouseDown;
    92   PanelHeader.Header.Title.OnMouseDown := DockPanelMouseDown;
    9392  PanelHeader.Header.Icon.OnMouseDown := DockPanelMouseDown;
    9493
     
    123122begin
    124123  inherited SetHeaderPos(AValue);
    125   case AValue of
     124  if Assigned(DockSite.Parent) then
     125    TCDManager(DockSite.Parent.DockManager).UpdateClientSize;
     126(*  case AValue of
    126127    hpBottom, hpTop: FDockDirection := ddVertical;
    127128    hpLeft, hpRight: FDockDirection := ddHorizontal;
    128   end;
     129  end;*)
    129130end;
    130131
     
    172173  NewItem.PanelHeader.Parent := DockSite;
    173174
    174   NewItem.Control := Control;
     175  NewItem.Control := TWinControl(Control);
    175176  Control.AddHandlerOnVisibleChanged(NewItem.VisibleChange);
    176177  Control.Parent := NewItem.PanelHeader.ControlPanel;
     
    199200        // Direction change, create conjoin form
    200201        NewConjoinDockForm := CreateContainer(InsertAt);
    201         FreeParentIfEmpty := False;
    202         for I := DockSite.DockClientCount - 1 downto 0 do begin
    203           DockSite.DockClients[I].ManualDock(NewConjoinDockForm);
     202        try
     203          FreeParentIfEmpty := False;
     204          for I := DockSite.DockClientCount - 1 downto 0 do begin
     205            DockSite.DockClients[I].ManualDock(NewConjoinDockForm);
     206          end;
     207        finally
     208          FreeParentIfEmpty := True;
    204209        end;
    205         FreeParentIfEmpty := True;
    206210        NewConjoinDockForm.ManualDock(DockSite);
    207211        Control.ManualDock(DockSite, nil, InsertAt);
     
    308312    if Assigned(TWinControl(Control).DockManager) then
    309313      PanelHeader.Header.Visible := TCDManager(TWinControl(Control).DockManager).HeaderVisible;
    310     PanelHeader.Header.Title.Caption := TForm(Control).Caption;
    311314    PanelHeader.Visible := Control.Visible;
    312315    Paint(Self);
  • Docking/CoolDocking/Managers/UCDManagerTabs.pas

    r216 r217  
    254254      NewItem.IconImage.Picture.Assign((Control as TForm).Icon);
    255255
    256     NewItem.Control := Control;
     256    NewItem.Control := TWinControl(Control);
    257257    Control.AddHandlerOnVisibleChanged(NewItem.VisibleChange);
    258258    //AControl.Parent := NewItem.ClientAreaPanel;
     
    272272  if Assigned(ManagerItem) then begin
    273273    Control.RemoveHandlerOnVisibleChanged(ManagerItem.VisibleChange);
    274   end else raise Exception.Create(Format('Control %s not found in DockItems', [Control.Name]));
     274  end; //else raise Exception.Create(Format('Control %s not found in DockItems', [Control.Name]));
    275275
    276276  DockItems.Remove(ManagerItem);
  • Docking/CoolDocking/Managers/UCDManagerTabsPopup.pas

    r208 r217  
    246246    C.Align := alClient;
    247247    C.Parent := HeaderPanel.ControlPanel;
    248     HeaderPanel.Header.Title.Caption := C.Caption;
    249248    //AutoHide.Control.Align := alCustom;
    250249    //Pos := DockSite.ClientToScreen(Pos);
     
    328327      NewItem.IconImage.Picture.Assign((Control as TForm).Icon);
    329328
    330     NewItem.Control := Control;
     329    NewItem.Control := TWinControl(Control);
    331330    Control.AddHandlerOnVisibleChanged(NewItem.VisibleChange);
    332331    //AControl.Parent := NewItem.ClientAreaPanel;
  • Docking/CoolDocking/UCDCommon.pas

    r198 r217  
    7575
    7676function GetUniqueName(BaseName: string): string;
     77function HeaderPosToTabPos(HeaderPos: THeaderPos): TTabPosition;
    7778
    7879implementation
     
    8788end;
    8889
     90function HeaderPosToTabPos(HeaderPos: THeaderPos): TTabPosition;
     91begin
     92  case HeaderPos of
     93    hpBottom: Result := tpBottom;
     94    hpLeft: Result := tpLeft;
     95    hpTop: Result := tpTop;
     96    hpRight: Result := tpRight;
     97    hpAuto: Result := tpTop;
     98  end;
     99end;
    89100
    90101{ TCDManagerBase }
  • Docking/CoolDocking/UCDManager.pas

    r216 r217  
    77uses
    88  Classes, SysUtils, UCDCommon, Controls, Contnrs, Dialogs,
    9   UCDPopupMenu, LCLType, LMessages, Graphics, Buttons,
     9  UCDPopupMenu, LCLType, LCLIntf, LMessages, Graphics, Buttons,
    1010  UCDConjoinForm, Menus, StdCtrls, ExtCtrls, Forms;
    1111
     
    3030  TCDHeader = class(TPanel)
    3131  private
     32    MyFont: hFont;
    3233    procedure CloseButtonClick(Sender: TObject);
    3334    procedure PaintExecute(Sender: TObject);
     
    3536  public
    3637    Buttons: TObjectList; // TList<TCDHeaderButton>
    37     Title: TLabel;
    3838    Icon: TImage;
    3939    ManagerItem: TCDManagerItem;
     
    6767    procedure SetHideType(const AValue: TCDHideType);
    6868  public
    69     Control: TControl;
     69    Control: TWinControl;
    7070    Manager: TCDManager;
    7171    procedure DockPanelMouseDown(Sender: TObject; Button: TMouseButton;
     
    139139  end;
    140140
    141 function HeaderPosToTabPos(HeaderPos: THeaderPos): TTabPosition;
    142 
    143141
    144142implementation
     
    148146  UCDResource;
    149147
    150 function HeaderPosToTabPos(HeaderPos: THeaderPos): TTabPosition;
    151 begin
    152   case HeaderPos of
    153     hpBottom: Result := tpBottom;
    154     hpLeft: Result := tpLeft;
    155     hpTop: Result := tpTop;
    156     hpRight: Result := tpRight;
    157     hpAuto: Result := tpTop;
    158   end;
     148function CreateRotatedFont(F: TFont; Angle: Integer): Integer;
     149var
     150  LF: TLogFont;
     151begin
     152  FillChar(LF, SizeOf(LF), #0);
     153  with LF do begin
     154    lfHeight := F.Height;
     155    lfWidth := 0;
     156    lfEscapement := Angle * 10;
     157    lfOrientation := 0;
     158    if fsBold in F.Style then
     159      lfWeight := FW_BOLD
     160    else
     161      lfWeight := FW_NORMAL;
     162    lfItalic := Byte(fsItalic in F.Style);
     163    lfUnderline := Byte(fsUnderline in F.Style);
     164    lfStrikeOut := Byte(fsStrikeOut in F.Style);
     165    lfCharSet := DEFAULT_CHARSET;
     166    StrPCopy(lfFaceName, F.Name);
     167    lfQuality := DEFAULT_QUALITY;
     168    {everything else as default}
     169    lfOutPrecision := OUT_DEFAULT_PRECIS;
     170    lfClipPrecision := CLIP_DEFAULT_PRECIS;
     171    case F.Pitch of
     172      fpVariable: lfPitchAndFamily := VARIABLE_PITCH;
     173      fpFixed: lfPitchAndFamily := FIXED_PITCH;
     174    else
     175      lfPitchAndFamily := DEFAULT_PITCH;
     176    end;
     177  end;
     178  Result := CreateFontIndirect(LF);
    159179end;
    160180
     
    179199  if FHeaderPos=AValue then exit;
    180200  FHeaderPos:=AValue;
     201
    181202  //Paint(Self);
    182203end;
     
    580601  inherited Create(TheOwner);
    581602  OnPaint := PaintExecute;
    582 
    583   Title := TLabel.Create(Self);
    584   with Title do begin
    585     Parent := Self;
    586     Visible := True;
    587     Top := 4;
    588     Left := 6;
    589     BevelInner := bvNone;
    590     BevelOuter := bvNone;
    591   end;
     603  //MyFont := CreateRotatedFont(Canvas.Font, 90);
     604
    592605  Buttons := TObjectList.Create;
    593606
     
    642655var
    643656  Points: array of TPoint;
    644 begin
     657  TitleLeft: Integer;
     658  TitleWidth: Integer;
     659  TitleMaxWidth: Integer;
     660  I: Integer;
     661  Title: string;
     662  R: TRect;
     663begin
     664  with TCDManager(TWinControl(ManagerItem.Control).DockManager) do
     665  case HeaderPos of
     666    hpLeft: begin
     667      Align := alLeft;
     668      Width := GrabberSize;
     669    end;
     670    hpTop, hpAuto: begin
     671      Align := alTop;
     672      Height := GrabberSize;
     673    end;
     674    hpRight: begin
     675      Align := alRight;
     676      Width := GrabberSize;
     677    end;
     678    hpBottom: begin
     679      Align := alBottom;
     680      Height := GrabberSize;
     681    end;
     682  end;
     683
    645684  if (ManagerItem.Control as TWinControl).Focused then
    646   Title.Font.Style := Font.Style + [fsBold]
    647   else Title.Font.Style := Font.Style - [fsBold];
    648 
    649   if Icon.Picture.Width > 0 then Title.Left := 8 + Icon.Picture.Width
    650     else Title.Left := 6;
    651   Title.Caption := ManagerItem.Control.Caption;
     685  Canvas.Font.Style := Canvas.Font.Style + [fsBold]
     686  else Canvas.Font.Style := Canvas.Font.Style - [fsBold];
     687
    652688  RearrangeButtons;
    653689
     
    689725    Pen.Color := BorderColor;
    690726    Polyline(Points);
     727
     728    Canvas.Brush.Style := bsClear;
     729    TitleMaxWidth := Self.Width - 6;
     730    for I := 0 to Buttons.Count - 1 do
     731      if TCDHeaderButton(Buttons[I]).Visible then
     732        Dec(TitleMaxWidth, TCDHeaderButton(Buttons[I]).Icon.Width + 2);
     733    if Icon.Picture.Width > 0 then begin
     734      TitleLeft := 8 + Icon.Picture.Width;
     735      Dec(TitleMaxWidth, Icon.Picture.Width + 2)
     736    end else TitleLeft := 6;
     737
     738    //SelectObject(Canvas.Handle, MyFont);
     739    Title := ManagerItem.Control.Caption;
     740    if (TextWidth(Title) > TitleMaxWidth) then begin
     741      while (Length(Title) > 0) and (TextWidth(Title + '...') > TitleMaxWidth) do begin
     742        Delete(Title, Length(Title), 1);
     743      end;
     744      Title := Title + '...';
     745    end;
     746
     747    R := Rect(TitleLeft, 4, TitleLeft + TitleMaxWidth, 4 + TextHeight(Title));
     748    TextRect(R, TitleLeft, 4, Title);
    691749  end;
    692750end;
  • Docking/CoolDocking/UCDPopupMenu.pas

    r207 r217  
    230230    if InputQuery(SRenameWindow, SEnterNewWindowName, False, Value) then begin
    231231      ManagerItem.Control.Caption := Value;
    232       Title.Caption := Value;
     232      Invalidate;
    233233    end;
    234234  end;
     
    243243  if PopupComponent is TCDHeader then
    244244  with TCDHeader(PopupComponent) do begin
    245     TCDManager(Manager).HeaderPos := hpAuto;
     245    TCDManager(TWinControl(ManagerItem.Control).DockManager).HeaderPos := hpTop;
     246    Invalidate;
    246247  end;
    247248end;
     
    255256  if PopupComponent is TCDHeader then
    256257  with TCDHeader(PopupComponent) do begin
    257     TCDManager(Manager).HeaderPos := hpLeft;
     258    TCDManager(TWinControl(ManagerItem.Control).DockManager).HeaderPos := hpLeft;
     259    Invalidate;
    258260  end;
    259261end;
     
    267269  if PopupComponent is TCDHeader then
    268270  with TCDHeader(PopupComponent) do begin
    269     TCDManager(Manager).HeaderPos := hpRight;
     271    TCDManager(TWinControl(ManagerItem.Control).DockManager).HeaderPos := hpRight;
     272    Invalidate;
    270273  end;
    271274end;
     
    279282  if PopupComponent is TCDHeader then
    280283  with TCDHeader(PopupComponent) do begin
    281     TCDManager(Manager).HeaderPos := hpTop;
     284    TCDManager(TWinControl(ManagerItem.Control).DockManager).HeaderPos := hpTop;
     285    Invalidate;
    282286  end;
    283287end;
     
    291295  if PopupComponent is TCDHeader then
    292296  with TCDHeader(PopupComponent) do begin
    293     TCDManager(Manager).HeaderPos := hpBottom;
     297    TCDManager(TWinControl(ManagerItem.Control).DockManager).HeaderPos := hpBottom;
     298    Invalidate;
    294299  end;
    295300end;
Note: See TracChangeset for help on using the changeset viewer.