Changeset 182 for Docking/CoolDocking/UCoolDocking.pas
- Timestamp:
- Mar 9, 2011, 2:11:40 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Docking/CoolDocking/UCoolDocking.pas
r181 r182 40 40 end; 41 41 42 // TObjectList<TCoolDockClientPanel>43 42 44 43 { TCoolDockPanels } 45 44 45 // TCoolDockPanels = TObjectList<TCoolDockClientPanel> 46 46 TCoolDockPanels = class(TObjectList) 47 47 destructor Destroy; override; … … 50 50 { TCoolDockManager } 51 51 52 TCoolDockManager = class(T DockManager)52 TCoolDockManager = class(TCoolDockManagerBase) 53 53 private 54 54 FMaster: TCoolDockMaster; … … 104 104 property HeaderPos: THeaderPos read GetHeaderPos write SetHeaderPos; 105 105 property Visible: Boolean write SetVisible; 106 property DockDirection: TDockDirection read FDockDirection 107 write FDockDirection; 106 108 end; 107 109 … … 120 122 procedure SetTabsEnabled(const AValue: Boolean); 121 123 public 122 procedure SaveLayoutToStream(Stream: TStream);123 procedure LoadLayoutFromStream(Stream: TStream);124 procedure SaveLayoutToFile(FileName: string);125 procedure LoadLayoutFromFile(FileName: string);126 124 constructor Create(AOwner: TComponent); override; 127 125 destructor Destroy; override; … … 332 330 Control.Parent := NewPanel.ClientAreaPanel; 333 331 Control.Align := alClient; 334 FDockPanels.Add(NewPanel); 332 if (InsertAt = alTop) or (InsertAt = alLeft) then 333 FDockPanels.Insert(0, NewPanel) 334 else FDockPanels.Add(NewPanel); 335 335 UpdateClientSize; 336 336 end; … … 550 550 with TCoolDockManager(Panel.DockManager) do 551 551 for I := 0 to DockPanels.Count - 1 do 552 if Assigned(TCoolDockClientPanel(DockPanels[I]).Control) then 553 TCoolDockClientPanel(DockPanels[I]).Control.Hide; 552 if Assigned(TCoolDockClientPanel(DockPanels[I]).Control) then begin 553 TCoolDockClientPanel(DockPanels[I]).Control.Tag := Integer(dhtTemporal); 554 TCoolDockClientPanel(DockPanels[I]).Control.Hide; 555 end; 554 556 end; 555 557 … … 614 616 if FShowIcons = AValue then Exit; 615 617 FShowIcons := AValue; 616 end;617 618 procedure TCoolDockMaster.SaveLayoutToStream(Stream: TStream);619 var620 Doc: TXMLDocument;621 RootNode: TDOMNode;622 NewNode: TDOMNode;623 NewNode2: TDOMNode;624 I: Integer;625 begin626 Doc := TXMLDocument.Create;627 with Doc do try628 RootNode := CreateElement('DockLayout');629 AppendChild(RootNode);630 with RootNode do begin631 for I := 0 to Application.ComponentCount - 1 do begin632 if Application.Components[I] is TForm then633 with Application.Components[I] as TForm do634 if Assigned(HostDockSite) then635 begin636 NewNode := OwnerDocument.CreateElement('Form');637 638 if HostDockSite.Parent is TForm then begin639 NewNode2 := OwnerDocument.CreateElement('ParentFormName');640 NewNode2.TextContent := UTF8Decode(HostDockSite.Parent.Name);641 NewNode.AppendChild(NewNode2);642 643 NewNode2 := OwnerDocument.CreateElement('ParentFormClassName');644 NewNode2.TextContent := UTF8Decode(HostDockSite.Parent.ClassName);645 NewNode.AppendChild(NewNode2);646 end;647 648 NewNode2 := OwnerDocument.CreateElement('Name');649 NewNode2.TextContent := UTF8Decode(Name);650 NewNode.AppendChild(NewNode2);651 652 NewNode2 := OwnerDocument.CreateElement('Caption');653 NewNode2.TextContent := UTF8Decode(Caption);654 NewNode.AppendChild(NewNode2);655 656 NewNode2 := OwnerDocument.CreateElement('Width');657 NewNode2.TextContent := IntToStr(Width);658 NewNode.AppendChild(NewNode2);659 660 NewNode2 := OwnerDocument.CreateElement('Height');661 NewNode2.TextContent := IntToStr(Height);662 NewNode.AppendChild(NewNode2);663 664 NewNode2 := OwnerDocument.CreateElement('UndockWidth');665 NewNode2.TextContent := IntToStr(UndockWidth);666 NewNode.AppendChild(NewNode2);667 668 NewNode2 := OwnerDocument.CreateElement('UndockHeight');669 NewNode2.TextContent := IntToStr(UndockHeight);670 NewNode.AppendChild(NewNode2);671 672 NewNode2 := OwnerDocument.CreateElement('FormState');673 NewNode2.TextContent := IntToStr(Integer(FormState));674 NewNode.AppendChild(NewNode2);675 676 NewNode2 := OwnerDocument.CreateElement('Visible');677 NewNode2.TextContent := IntToStr(Integer(Visible));678 NewNode.AppendChild(NewNode2);679 680 AppendChild(NewNode);681 end;682 end;683 end;684 WriteXMLFile(Doc, Stream);685 finally686 Free;687 end;688 end;689 690 procedure TCoolDockMaster.LoadLayoutFromStream(Stream: TStream);691 begin692 693 end;694 695 procedure TCoolDockMaster.SaveLayoutToFile(FileName: string);696 var697 LayoutFile: TFileStream;698 begin699 try700 if FileExistsUTF8(FileName) then701 LayoutFile := TFileStream.Create(FileName, fmOpenReadWrite)702 else LayoutFile := TFileStream.Create(FileName, fmCreate);703 SaveLayoutToStream(LayoutFile);704 finally705 LayoutFile.Free;706 end;707 end;708 709 procedure TCoolDockMaster.LoadLayoutFromFile(FileName: string);710 var711 LayoutFile: TFileStream;712 begin713 LayoutFile := TFileStream.Create(FileName, fmOpenRead);714 try715 LoadLayoutFromStream(LayoutFile);716 finally717 Free;718 end;719 618 end; 720 619
Note:
See TracChangeset
for help on using the changeset viewer.