Changeset 354 for Docking/CoolDocking/Managers
- Timestamp:
- Apr 26, 2012, 9:12:02 AM (13 years ago)
- Location:
- Docking/CoolDocking/Managers
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
Docking/CoolDocking/Managers/UCDManagerRegions.pas
r218 r354 17 17 PanelHeader: TCDPanelHeader; 18 18 Splitter: TSplitter; 19 Align: TAlign; 19 20 procedure VisibleChange(Sender: TObject); override; 20 21 procedure Paint(Sender: TObject); override; … … 43 44 destructor Destroy; override; 44 45 procedure PaintSite(DC: HDC); override; 45 procedure Update ClientSize; override;46 procedure Update; override; 46 47 procedure SetVisible(const AValue: Boolean); override; 47 48 procedure ChangeVisible(Control: TWinControl; Visible: Boolean); … … 65 66 // TCDManagerRegionsItem(DockItems[DockItems.IndexOf(FindControlInPanels(TControl(Sender)))]).HideType := dhtPermanent; 66 67 //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); 68 73 end; 69 74 end; … … 130 135 inherited SetHeaderPos(AValue); 131 136 if Assigned(DockSite.Parent) then 132 TCDManager(DockSite.Parent.DockManager).Update ClientSize;137 TCDManager(DockSite.Parent.DockManager).Update; 133 138 (* case AValue of 134 139 hpBottom, hpTop: FDockDirection := ddVertical; … … 179 184 180 185 NewItem.PanelHeader.Parent := DockSite; 186 187 if DockItems.Count = 0 then NewItem.Align := alClient 188 else NewItem.Align := InsertAt; 181 189 182 190 NewItem.Control := TWinControl(Control); … … 219 227 Control.ManualDock(DockSite, nil, InsertAt); 220 228 NewConjoinDockForm.UpdateCaption; 221 Update ClientSize;229 Update; 222 230 Exit; 223 231 end; … … 225 233 InsertControlNoUpdate(Control, InsertAt); 226 234 end; 227 Update ClientSize;235 Update; 228 236 end; 229 237 … … 257 265 end; 258 266 inherited RemoveControl(Control); 259 if ClientCount > 1 then Update ClientSize;267 if ClientCount > 1 then Update; 260 268 end; 261 269 … … 271 279 for I := 0 to ADockSite.DockClientCount - 1 do 272 280 InsertControlNoUpdate(ADockSite.DockClients[I], alLeft); 273 Update ClientSize;281 Update; 274 282 end; 275 283 … … 291 299 end; 292 300 293 procedure TCDManagerRegions.Update ClientSize;301 procedure TCDManagerRegions.Update; 294 302 var 295 303 I: Integer; … … 299 307 VisibleControlsCount: Integer; 300 308 begin 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; 307 312 VisibleControlsCount := DockSite.VisibleDockClientCount; 308 313 if DockSite is TForm then 309 DockSite.Visible := VisibleControlsCount > 0;314 DockSite.Visible := (VisibleControlsCount > 0); 310 315 if VisibleControlsCount = 0 then VisibleControlsCount := 1; 311 316 … … 323 328 PanelHeader.Visible := Control.Visible; 324 329 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; 330 344 Splitter.Left := SplitterLeft; 331 345 Splitter.Top := SplitterTop; 332 346 Splitter.Parent := Self.DockSite; 333 Splitter.Align := BaseAlign; 334 Splitter.Visible := I < (DockItems.Count - 1); 347 Splitter.Visible := I <> (Trunc(DockItems.Count - 1) / 2); 335 348 Inc(SplitterLeft, Splitter.Width); 336 349 Inc(SplitterTop, Splitter.Height); 337 350 338 351 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; 343 354 end; 344 355 end; … … 349 360 begin 350 361 inherited; 351 for I := 0 to DockItems.Count - 1 do 362 try 363 BeginUpdate; 364 for I := 0 to DockItems.Count - 1 do 352 365 with TCDManagerRegionsItem(DockItems[I]) do begin 353 366 if AValue and (not Control.Visible) and (Control.Tag = Integer(dhtTemporal)) then begin … … 361 374 end; 362 375 //ClientAreaPanel.Show; 376 finally 377 EndUpdate; 378 end; 363 379 end; 364 380 -
Docking/CoolDocking/Managers/UCDManagerTabs.pas
r253 r354 44 44 TabImageList: TImageList; 45 45 PageControl: TPageControl; 46 procedure Update ClientSize; override;46 procedure Update; override; 47 47 procedure SetHeaderPos(const AValue: THeaderPos); override; 48 48 procedure InsertControlNoUpdate(Control: TControl; InsertAt: TAlign); virtual; … … 82 82 Temp2: TControl; 83 83 begin 84 DebugLog('TCDManagerTabsItem.VisibleChange'); 84 85 with TCDManagerTabs(Manager) do begin 85 86 if TControl(Sender).Visible then begin 86 Update ClientSize;87 Update; 87 88 Switch(DockItems.IndexOf(FindControlInPanels(TControl(Sender)))); 88 89 TCDManagerTabsItem(DockItems[DockItems.IndexOf( 89 90 FindControlInPanels(TControl(Sender)))]).HideType := dhtPermanent; 90 end else Update ClientSize;91 end else Update; 91 92 end; 92 93 … … 143 144 procedure TCDManagerTabs.TabControlChange(Sender: TObject); 144 145 begin 145 UpdateClientSize; 146 DebugLog('TCDManagerTabs.TabControlChange ' + IntToStr(PageControl.TabIndex)); 147 Update; 146 148 MouseDownSkip := True; 147 149 end; … … 189 191 OnChange := TabControlChange; 190 192 MultiLine := True; 193 AutoSize := True; 191 194 PopupMenu := Self.PopupMenu; 192 195 OnMouseLeave := TabControlMouseLeave; … … 225 228 procedure TCDManagerTabs.Switch(Index: Integer); 226 229 begin 230 DebugLog('TCDManagerTabs.Switch ' + IntToStr(Index)); 227 231 PageControl.TabIndex := Index; 228 232 end; … … 265 269 end; //else raise Exception.Create(Format('Control %s not found in DockItems', [Control.Name])); 266 270 267 ManagerItem.Control.Visible := False;271 //ManagerItem.Control.Visible := False; 268 272 ManagerItem.Control.Parent := nil; 269 273 DockItems.Remove(ManagerItem); … … 279 283 end else TCDManagerItem(DockItems[0]).Control.ManualFloat(Rect(Left, Top, Left + Width, Top + Height)); 280 284 ManualFloat(Rect(Left, Top, Left + Width, Top + Height)); 281 //Update ClientSize;285 //Update; 282 286 inherited RemoveControl(Control); 283 287 Free; … … 286 290 end; 287 291 //if ClientCount > 0 then 288 Update ClientSize;292 Update; 289 293 inherited RemoveControl(Control); 290 294 end; … … 341 345 inherited; 342 346 InsertControlNoUpdate(AControl, InsertAt); 343 Update ClientSize;344 end; 345 346 procedure TCDManagerTabs.Update ClientSize;347 Update; 348 end; 349 350 procedure TCDManagerTabs.Update; 347 351 var 348 352 I: Integer; … … 350 354 DeletedPage: TTabSheet; 351 355 begin 356 if FUpdateCount = 0 then begin 357 DebugLog('TCDManagerTabs.Update'); 352 358 for I := 0 to DockItems.Count - 1 do 353 359 with TCDManagerTabsItem(DockItems[I]) do begin … … 407 413 //TCDClientPanel(FDockPanels[I]).DockPanelPaint(Self); 408 414 end; 409 inherited UpdateClientSize; 415 end; 416 inherited; 410 417 end; 411 418
Note:
See TracChangeset
for help on using the changeset viewer.