Changeset 437 for Docking


Ignore:
Timestamp:
Nov 19, 2012, 2:34:58 PM (12 years ago)
Author:
chronos
Message:
  • Fixed: Better switching tabbed controls.
Location:
Docking/CoolDocking
Files:
3 added
12 edited

Legend:

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

    r430 r437  
    5151      DropCtl: TControl); override;
    5252    procedure RemoveControl(Control: TControl); override;
    53     constructor Create(ADockSite: TWinControl);
     53    constructor Create(ADockSite: TWinControl); override;
    5454    destructor Destroy; override;
    5555    procedure PaintSite(DC: HDC); override;
    5656    procedure Update; override;
    5757    procedure SetVisible(const AValue: Boolean); override;
    58     procedure ChangeVisible(Control: TWinControl; Visible: Boolean);
     58    procedure ChangeVisible(Control: TWinControl; Visible: Boolean); override;
    5959    property DockDirection: TCDDirection read FDockDirection
    6060      write FDockDirection;
     
    9393
    9494procedure TCDManagerRegionsItem.Paint(Sender: TObject);
    95 var
    96   I: Integer;
    97   R: TRect;
    9895begin
    9996  inherited Paint(Sender);
  • Docking/CoolDocking/Managers/UCDManagerTabs.pas

    r430 r437  
    88  Classes, Controls, ExtCtrls, ComCtrls, SysUtils, Dialogs, Contnrs,
    99  Menus, Forms, UCDCommon, UCDManager, UCDConjoinForm,
    10   LCLType, LMessages, Graphics;
     10  LCLType, Graphics;
    1111
    1212type
     
    3535    procedure TabControlMouseUp(Sender: TObject; Button: TMouseButton;
    3636      Shift: TShiftState; X, Y: Integer);
     37    procedure PageControlContextPopup(Sender: TObject; MousePos: TPoint;
     38      var Handled: Boolean);
     39    function FindTabSheet(TabSheet: TTabSheet): TCDManagerTabsItem;
     40  protected
     41    function GetHeaderPos: THeaderPos; override;
     42    function FindControlInPanels(Control: TControl): TCDManagerItem; override;
    3743    procedure InsertControlPanel(AControl: TControl; InsertAt: TAlign;
    3844      DropCtl: TControl); override;
    39     function FindControlInPanels(Control: TControl): TCDManagerItem; override;
    40     function GetHeaderPos: THeaderPos; override;
    41     function FindTabSheet(TabSheet: TTabSheet): TCDManagerTabsItem;
    42     procedure PageControlContextPopup(Sender: TObject; MousePos: TPoint;
    43       var Handled: Boolean);
     45    procedure InsertControlNoUpdate(Control: TControl; InsertAt: TAlign); virtual;
     46    procedure TabControlChange(Sender: TObject); virtual;
    4447  public
    4548    MouseDownSkip: Boolean;
     
    4952    procedure Update; override;
    5053    procedure SetHeaderPos(const AValue: THeaderPos); override;
    51     procedure InsertControlNoUpdate(Control: TControl; InsertAt: TAlign); virtual;
    5254    procedure RemoveControl(Control: TControl); override;
    5355    constructor Create(ADockSite: TWinControl); override;
    5456    destructor Destroy; override;
    55     procedure TabControlChange(Sender: TObject); virtual;
    5657    procedure PaintSite(DC: HDC); override;
    5758    procedure Switch(Index: Integer); override;
     
    8485  Temp: TControl;
    8586  Temp2: TControl;
     87  PI: Integer;
    8688begin
    8789  DebugLog('TCDManagerTabsItem.VisibleChange');
     
    9294      //TCDManagerTabsItem(DockItems[DockItems.IndexOf(
    9395      //  FindControlInPanels(TControl(Sender)))]).HideType := dhtPermanent;
    94     end else Update;
     96    end else begin
     97      TabSheet.TabVisible := False;
     98
     99      // Workaround for not showing current tab agter other tab is hidden
     100      PI := PageControl.PageIndex;
     101      PageControl.PageIndex := -1;
     102      PageControl.PageIndex := PI;
     103
     104      Update;
     105    end;
    95106  end;
    96107
     
    379390  LastIndex: Integer;
    380391begin
    381   LastIndex := PageControl.TabIndex;
     392  LastIndex := PageControl.PageIndex;
    382393  if FUpdateCount = 0 then begin
    383394  DebugLog('TCDManagerTabs.Update');
     
    426437    if PageControl.PageIndex = I then begin
    427438      TCDManager(Control.DockManager).DockSiteVisible := True;
    428       if not Control.Visible then Control.Show;
     439      if not Control.Visible then
     440        Control.Show;
    429441      //PageControl.TabIndex := I;
    430442    end else begin
     
    437449    //TCDClientPanel(FDockPanels[I]).DockPanelPaint(Self);
    438450  end;
    439   end;
    440   inherited;
    441   //ShowMessage(IntToStr(PageControl.TabIndex));
    442   PageControl.TabIndex := LastIndex;
     451  //PageControl.TabIndex := LastIndex;
     452  //if PageControl.PageIndex = PI then
     453  //  PageControl.PageIndex := -1; // Workaround for bug in LCL TPageControl.TabVisible not updating PageIndex properly
     454  end;
     455  inherited;
    443456end;
    444457
  • Docking/CoolDocking/Managers/UCDManagerTabsPopup.pas

    r335 r437  
    5656    SplitterMousePos: TPoint;
    5757    procedure PageControlResize(Sender: TObject);
    58     procedure InsertControlNoUpdate(Control: TControl; InsertAt: TAlign); override;
    5958    procedure SplitterMouseDown(Sender: TObject; Button: TMouseButton;
    6059      Shift: TShiftState; X, Y: Integer);
     
    6463      Shift: TShiftState; X, Y: Integer);
    6564    procedure UpdatePopupFormBounds;
     65    procedure PopupFormMouseLeave(Sender: TObject);
     66  protected
    6667    procedure TabControlChange(Sender: TObject); override;
    67     procedure PopupFormMouseLeave(Sender: TObject);
     68    procedure InsertControlNoUpdate(Control: TControl; InsertAt: TAlign); override;
    6869  public
    6970    AutoHideEnabled: Boolean;
     
    8485
    8586uses
    86   UCDClient, UCDManagerRegions;
     87  UCDManagerRegions;
    8788
    8889{ TCDManagerTabsPopupItem }
  • Docking/CoolDocking/UCDClient.pas

    r359 r437  
    88
    99uses
    10   Classes, SysUtils, Controls, LCLType, LMessages, Graphics, StdCtrls,
    11   Buttons, ExtCtrls, Contnrs, Forms, ComCtrls, Dialogs, Menus, FileUtil,
    12   UCDCustomize, DOM, XMLWrite, XMLRead, UCDCommon,
    13   DateUtils, UCDPopupMenu, UCDManager;
     10  Classes, SysUtils, Controls, Graphics,
     11  Buttons, ExtCtrls, Forms, Dialogs, Menus,
     12  UCDCustomize, UCDCommon;
    1413
    1514const
     
    2625    procedure SetDockable(const AValue: Boolean);
    2726    procedure SetFloatable(const AValue: Boolean);
     27  protected
    2828    procedure SetPanel(const AValue: TPanel); override;
    2929  public
  • Docking/CoolDocking/UCDCommon.pas

    r430 r437  
    6666    FPanel: TPanel;
    6767    procedure SetMaster(const AValue: TCDMasterBase);
    68   public
     68  protected
    6969    procedure SetPanel(const AValue: TPanel); virtual;
    7070  published
  • Docking/CoolDocking/UCDCustomize.pas

    r194 r437  
    11unit UCDCustomize;
    22
    3 {$mode Delphi}{$H+}
     3{$mode delphi}{$H+}
    44
    55interface
    66
    77uses
    8   Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
    9   ComCtrls, StdCtrls, Spin, UCDLayout, UCDCommon, UCDManager;
     8  Classes, LResources, Forms, Dialogs,
     9  ComCtrls, StdCtrls, Spin, UCDLayout, UCDCommon;
    1010
    1111type
     
    6464
    6565uses
    66   UCDClient, UCDMaster;
     66  UCDMaster;
    6767
    6868resourcestring
  • Docking/CoolDocking/UCDLayout.pas

    r335 r437  
    7373
    7474uses
    75   UCDClient, UCDManager, UCDConjoinForm;
     75  UCDManager, UCDConjoinForm;
    7676
    7777procedure Register;
  • Docking/CoolDocking/UCDManager.pas

    r430 r437  
    104104    procedure SetMoveDuration(const AValue: Integer);
    105105    procedure CloseHandler(Sender: TObject; var CloseAction: TCloseAction);
     106  protected
     107    procedure InsertControlPanel(Control: TControl; InsertAt: TAlign;
     108      DropCtl: TControl); virtual;
     109    function GetHeaderPos: THeaderPos; virtual;
     110    function FindControlInPanels(Control: TControl): TCDManagerItem; virtual;
    106111  public
    107112    Locked: Boolean;
     
    114119    procedure Switch(Index: Integer); virtual;
    115120    procedure ChangeVisible(Control: TWinControl; Visible: Boolean); virtual;
    116     procedure Assign(Source: TCDManager); virtual;
    117     procedure InsertControlPanel(Control: TControl; InsertAt: TAlign;
    118       DropCtl: TControl); virtual;
    119     function GetHeaderPos: THeaderPos; virtual;
     121    procedure Assign(Source: TPersistent); override;
    120122    procedure BringToFront; virtual;
    121123
     
    141143    function AutoFreeByControl: Boolean; override;
    142144
    143     function FindControlInPanels(Control: TControl): TCDManagerItem; virtual;
    144145    function CreateConjoinForm: TCDConjoinForm;
    145146    function CreateDockableForm: TCDPanelForm;
     
    364365function TCDManager.GetMoveDuration: Integer;
    365366begin
    366 
     367  Result := 0;
    367368end;
    368369
     
    379380
    380381constructor TCDManager.Create(ADockSite: TWinControl);
    381 var
    382   NewMenuItem: TMenuItem;
    383   NewMenuItem2: TMenuItem;
    384382begin
    385383  inherited Create(ADockSite);
     
    524522
    525523procedure TCDManager.ResetBounds(Force: Boolean);
    526 var
    527   I: Integer;
    528   Control: TControl;
    529   R: TRect;
    530524begin
    531525end;
     
    552546  NewConjoinDockForm := TCDConjoinForm.Create(Application);
    553547  NewConjoinDockForm.Name := GetUniqueName('ConjoinForm');
    554   NewConjoinDockForm.Visible := True;
     548  NewConjoinDockForm.Visible := False;
    555549  NewConjoinDockForm.BoundsRect := FDockSite.BoundsRect;
    556550  NewConjoinDockForm.CoolDockClient.Master := Self.Master;
     
    580574procedure TCDManager.SetDockStyle(const AValue: TCDStyleType);
    581575var
    582   I: Integer;
    583576  NewManager: TCDManager;
    584577begin
     
    646639end;
    647640
    648 procedure TCDManager.Assign(Source: TCDManager);
    649 begin
    650   FDockStyle := Source.FDockStyle;
    651   FDockSite := Source.FDockSite;
     641procedure TCDManager.Assign(Source: TPersistent);
     642begin
     643  if Source is TCDManager then begin
     644    FDockStyle := TCDManager(Source).FDockStyle;
     645    FDockSite := TCDManager(Source).FDockSite;
     646  end else inherited;
    652647end;
    653648
     
    718713  Points: array of TPoint;
    719714  TitleLeft: Integer;
    720   TitleWidth: Integer;
    721715  TitleMaxWidth: Integer;
    722716  I: Integer;
  • Docking/CoolDocking/UCDMaster.pas

    r354 r437  
    11unit UCDMaster;
    22
    3 {$mode objfpc}{$H+}
     3{$mode delphi}{$H+}
    44
    55interface
    66
    77uses
    8   Classes, SysUtils, UCDCommon, UCDManager;
     8  Classes, SysUtils, UCDCommon;
    99
    1010type
     
    6868
    6969destructor TCDMaster.Destroy;
    70 var
    71   I: Integer;
    7270begin
    7371  // Assigning nil to Client Master property cause unregistring client from list
  • Docking/CoolDocking/UCDPopupMenu.pas

    r218 r437  
    4444
    4545uses
    46   UCDClient, UCDManagerTabs, UCDCustomize, UCDManager;
     46  UCDManagerTabs, UCDCustomize, UCDManager;
    4747
    4848resourcestring
     
    9191  NewMenuItem: TMenuItem;
    9292  NewMenuItem2: TMenuItem;
    93   I: Integer;
    9493begin
    9594  inherited Create(nil);
     
    199198
    200199procedure TCDPopupMenu.PopupMenuCloseClick(Sender: TObject);
    201 var
    202   Control: TControl;
    203200begin
    204201  if PopupComponent is TPageControl then
  • Docking/CoolDocking/UCDResource.pas

    r197 r437  
    11unit UCDResource;
    22
    3 {$mode objfpc}{$H+}
     3{$mode delphi}{$H+}
    44
    55interface
  • Docking/CoolDocking/UCDWindowList.pas

    r197 r437  
    11unit UCDWindowList;
    22
    3 {$mode objfpc}{$H+}
     3{$mode delphi}{$H+}
    44
    55interface
Note: See TracChangeset for help on using the changeset viewer.