Ignore:
Timestamp:
Mar 9, 2011, 10:56:47 AM (14 years ago)
Author:
george
Message:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Docking/CoolDocking/UCoolDocking.pas

    r180 r181  
    1313  DateUtils, UCoolDockStyleTabs, UCoolDockStyleRegions, UCoolDockStylePopupTabs,
    1414  UCoolDockStylePopupRegions, UCoolDockStyle, UCoolDockClientPanel,
    15   UCoolDockPopupMenu, UCoolDockLayout;
     15  UCoolDockPopupMenu;
    1616
    1717const
     
    2222
    2323  TCoolDockManager = class;
    24   TCoolDockCustomize = class;
    2524  TCoolDockClient = class;
    2625  TCoolDockMaster = class;
     
    2827  { TCoolDockConjoinForm }
    2928
    30   TCoolDockConjoinForm = class(TForm)
     29  TCoolDockConjoinForm = class(TCoolDockConjoinFormBase)
     30  public
    3131    Panel: TPanel;
    3232    CoolDockClient: TCoolDockClient;
     
    3636    destructor Destroy; override;
    3737  private
     38    procedure SetName(const NewName: TComponentName); override;
    3839    procedure PanelVisibleChange(Sender: TObject);
    3940  end;
     
    107108  { TCoolDockMaster }
    108109
    109   TCoolDockMaster = class(TComponent)
     110  TCoolDockMaster = class(TCoolDockMasterBase)
    110111  private
    111     FCoolDockCustomize: TCoolDockCustomize;
    112112    FDefaultHeaderPos: THeaderPos;
    113113    FDefaultMoveSpeed: Integer;
     
    117117    FClients: TObjectList;
    118118    function GetClient(Index: Integer): TCoolDockClient;
    119     procedure SetCustomize(const AValue: TCoolDockCustomize);
    120119    procedure SetShowIcons(const AValue: Boolean);
    121120    procedure SetTabsEnabled(const AValue: Boolean);
     
    138137    property DefaultMoveSpeed: Integer read FDefaultMoveSpeed
    139138      write FDefaultMoveSpeed;
    140     property Customize: TCoolDockCustomize read FCoolDockCustomize
    141       write SetCustomize;
    142139    property ShowIcons: Boolean read FShowIcons
    143140      write SetShowIcons;
     
    168165  end;
    169166
    170   { TCoolDockCustomize }
    171 
    172   TCoolDockCustomize = class(TComponent)
    173   private
    174     FLayoutList: TCoolDockLayoutList;
    175     FMaster: TCoolDockMaster;
    176     Form: TCoolDockCustomizeForm;
    177     procedure SetLayoutList(const AValue: TCoolDockLayoutList);
    178     procedure SetMaster(const AValue: TCoolDockMaster);
    179   public
    180     function Execute: Boolean;
    181     constructor Create(AOwner: TComponent); override;
    182     destructor Destroy; override;
    183   published
    184     property Master: TCoolDockMaster read FMaster write SetMaster;
    185     property LayoutList: TCoolDockLayoutList read FLayoutList write SetLayoutList;
    186   end;
    187167
    188168procedure Register;
     
    198178  RegisterComponents('CoolDocking', [TCoolDockClient]);
    199179  RegisterComponents('CoolDocking', [TCoolDockCustomize]);
     180end;
     181
     182function GetUniqueName(BaseName: string): string;
     183var
     184  I: Integer;
     185begin
     186  I := 1;
     187  while Assigned(FindGlobalComponent(BaseName + IntToStr(I))) do Inc(I);
     188  Result := BaseName + IntToStr(I);
    200189end;
    201190
     
    481470begin
    482471  NewConjoinDockForm := TCoolDockConjoinForm.Create(Application);
     472  NewConjoinDockForm.Name := GetUniqueName('ConjoinForm');
    483473  NewConjoinDockForm.Visible := True;
    484474  NewConjoinDockForm.BoundsRect := FDockSite.BoundsRect;
     
    566556constructor TCoolDockConjoinForm.Create(TheOwner: TComponent);
    567557begin
    568   inherited Create(TheOwner);
     558  inherited CreateNew(TheOwner);
    569559  Panel := TPanel.Create(Self);
    570560  with Panel do begin
    571561    Parent := Self;
    572     Name := Parent.Name + '_Panel';
    573562    Caption := '';
    574563    DockSite := True;
     
    582571  with CoolDockClient do begin
    583572    Panel := Self.Panel;
    584     Name := Owner.Name + '_CoolDockClient';
    585573  end;
    586574  OnShow := FormShow;
     
    596584end;
    597585
     586procedure TCoolDockConjoinForm.SetName(const NewName: TComponentName);
     587begin
     588  inherited SetName(NewName);
     589  Panel.Name := Name + '_Panel';
     590  Panel.Caption := '';
     591  CoolDockClient.Name := Name + '_CoolDockClient';
     592end;
     593
    598594procedure TCoolDockConjoinForm.PanelVisibleChange(Sender: TObject);
    599595begin
     
    607603  if FTabsEnabled = AValue then Exit;
    608604  FTabsEnabled := AValue;
    609 end;
    610 
    611 procedure TCoolDockMaster.SetCustomize(const AValue: TCoolDockCustomize
    612   );
    613 var
    614   OldCustomize: TCoolDockCustomize;
    615 begin
    616   if FCoolDockCustomize = AValue then Exit;
    617   OldCustomize := FCoolDockCustomize;
    618   FCoolDockCustomize := AValue;
    619   if Assigned(AValue) then begin
    620     FCoolDockCustomize.Master := Self;
    621   end else begin
    622     OldCustomize.Master := nil;
    623   end;
    624605end;
    625606
     
    773754  end;
    774755end;
    775 
    776 { TCoolDockCustomize }
    777 
    778 procedure TCoolDockCustomize.SetMaster(const AValue: TCoolDockMaster);
    779 var
    780   OldMaster: TCoolDockMaster;
    781 begin
    782   if FMaster = AValue then Exit;
    783   OldMaster := FMaster;
    784   FMaster := AValue;
    785   if Assigned(AValue) then begin
    786     FMaster.Customize := Self;
    787   end else begin
    788     OldMaster.Customize := nil;
    789   end;
    790 end;
    791 
    792 procedure TCoolDockCustomize.SetLayoutList(const AValue: TCoolDockLayoutList);
    793 begin
    794   if FLayoutList=AValue then exit;
    795   FLayoutList:=AValue;
    796 end;
    797 
    798 function TCoolDockCustomize.Execute: Boolean;
    799 begin
    800   Form := TCoolDockCustomizeForm.Create(Self);
    801   if Assigned(Master) then begin
    802     Form.SpinEdit1.Value := Master.DefaultMoveSpeed;
    803     Form.ComboBox1.ItemIndex := Integer(Master.DefaultTabsPos);
    804     Form.ComboBox2.ItemIndex := Integer(Master.DefaultHeaderPos);
    805     Form.LayoutList := FLayoutList;
    806   end;
    807   Form.ShowModal;
    808   if Assigned(Master) then begin
    809     Master.DefaultMoveSpeed := Form.SpinEdit1.Value;
    810     Master.DefaultTabsPos := THeaderPos(Form.ComboBox1.ItemIndex);
    811     Master.DefaultHeaderPos := THeaderPos(Form.ComboBox2.ItemIndex);
    812   end;
    813   Form.Free;
    814   Result := True;
    815 end;
    816 
    817 constructor TCoolDockCustomize.Create(AOwner: TComponent);
    818 begin
    819   inherited Create(AOwner);
    820 end;
    821 
    822 destructor TCoolDockCustomize.Destroy;
    823 begin
    824   Master := nil;
    825   inherited Destroy;
    826 end;
    827 
    828756
    829757{ TCoolDockClient }
     
    916844end;
    917845
     846initialization
     847
     848RegisterClass(TCoolDockConjoinForm);
     849
     850finalization
     851
     852UnRegisterClass(TCoolDockConjoinForm);
     853
    918854
    919855end.
Note: See TracChangeset for help on using the changeset viewer.