|
|
@ -43,6 +43,7 @@ using System.Xml; |
|
|
|
using System.Linq; |
|
|
|
using System.Linq; |
|
|
|
using System.Collections; |
|
|
|
using System.Collections; |
|
|
|
using System.Collections.Specialized; |
|
|
|
using System.Collections.Specialized; |
|
|
|
|
|
|
|
using System.Collections.ObjectModel; |
|
|
|
|
|
|
|
|
|
|
|
namespace AvalonDock |
|
|
|
namespace AvalonDock |
|
|
|
{ |
|
|
|
{ |
|
|
@ -400,13 +401,30 @@ namespace AvalonDock |
|
|
|
|
|
|
|
|
|
|
|
void DocumentsSourceCollectionChanged(object sender, NotifyCollectionChangedEventArgs e) |
|
|
|
void DocumentsSourceCollectionChanged(object sender, NotifyCollectionChangedEventArgs e) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (e.Action == NotifyCollectionChangedAction.Reset) |
|
|
|
if (e.Action == NotifyCollectionChangedAction.Reset) |
|
|
|
{ |
|
|
|
{ |
|
|
|
DocumentContent[] docs = this.Documents; |
|
|
|
DocumentContent[] docs = this.Documents; |
|
|
|
|
|
|
|
ObservableCollection<DocumentContent> documentsToClose = new ObservableCollection<DocumentContent>(); |
|
|
|
foreach (DocumentContent doc in docs) |
|
|
|
|
|
|
|
doc.Close(); |
|
|
|
foreach (DocumentContent doc in docs) |
|
|
|
} |
|
|
|
{ |
|
|
|
|
|
|
|
if (doc.Parent is DocumentPane) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if ((doc.Parent as DocumentPane).IsMainDocumentPane == false) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
documentsToClose.Add(doc); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach (DocumentContent doc in documentsToClose) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
doc.InternalClose(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach (DocumentContent doc in docs) |
|
|
|
|
|
|
|
doc.InternalClose(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (MainDocumentPane == null) |
|
|
|
if (MainDocumentPane == null) |
|
|
|
return; |
|
|
|
return; |
|
|
@ -458,6 +476,16 @@ namespace AvalonDock |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (child is DocumentPane) |
|
|
|
if (child is DocumentPane) |
|
|
|
return child as DocumentPane; |
|
|
|
return child as DocumentPane; |
|
|
|
|
|
|
|
//if (child is DockablePane)
|
|
|
|
|
|
|
|
//{
|
|
|
|
|
|
|
|
// DocumentPane doc = new DocumentPane();
|
|
|
|
|
|
|
|
// DockablePane dockablePane = child as DockablePane;
|
|
|
|
|
|
|
|
// while (dockablePane.Items.Count > 0)
|
|
|
|
|
|
|
|
// {
|
|
|
|
|
|
|
|
// doc.Items.Add((dockablePane.Items[0] as DockableContent).DetachFromContainerPane());
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// return doc;
|
|
|
|
|
|
|
|
//}
|
|
|
|
if (child is ResizingPanel) |
|
|
|
if (child is ResizingPanel) |
|
|
|
{ |
|
|
|
{ |
|
|
|
DocumentPane foundDocPane = GetMainDocumentPane(child as ResizingPanel); |
|
|
|
DocumentPane foundDocPane = GetMainDocumentPane(child as ResizingPanel); |
|
|
@ -1707,7 +1735,10 @@ namespace AvalonDock |
|
|
|
/// <param name="content">Content to show</param>
|
|
|
|
/// <param name="content">Content to show</param>
|
|
|
|
public void Show(DockableContent content) |
|
|
|
public void Show(DockableContent content) |
|
|
|
{ |
|
|
|
{ |
|
|
|
Show(content, DockableContentState.Docked); |
|
|
|
if (content.SavedStateAndPosition != null) |
|
|
|
|
|
|
|
Show(content, content.SavedStateAndPosition.State); |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
Show(content, DockableContentState.Docked); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
@ -1954,20 +1985,44 @@ namespace AvalonDock |
|
|
|
else if (desideredState == DockableContentState.DockableWindow || |
|
|
|
else if (desideredState == DockableContentState.DockableWindow || |
|
|
|
desideredState == DockableContentState.FloatingWindow) |
|
|
|
desideredState == DockableContentState.FloatingWindow) |
|
|
|
{ |
|
|
|
{ |
|
|
|
DockablePane newHostpane = new DockablePane(); |
|
|
|
DockablePane newHostpane = null; |
|
|
|
newHostpane.Items.Add(content); |
|
|
|
FloatingDockablePane prevHostpane = null; |
|
|
|
content.SetStateToDock(); |
|
|
|
if (content.SavedStateAndPosition != null && content.SavedStateAndPosition.ContainerPane != null && content.SavedStateAndPosition.ContainerPane is FloatingDockablePane) |
|
|
|
|
|
|
|
{ |
|
|
|
//ResizingPanel.SetResizeWidth(newHostpane, 200);
|
|
|
|
prevHostpane = content.SavedStateAndPosition.ContainerPane as FloatingDockablePane; |
|
|
|
//ResizingPanel.SetResizeWidth(newHostpane, 500);
|
|
|
|
if (!prevHostpane.Items.Contains(content)) |
|
|
|
|
|
|
|
prevHostpane.Items.Add(content); |
|
|
|
DockableFloatingWindow floatingWindow = new DockableFloatingWindow(this, newHostpane); |
|
|
|
} |
|
|
|
floatingWindow.WindowStartupLocation = WindowStartupLocation.CenterOwner; |
|
|
|
else |
|
|
|
floatingWindow.Width = 200; |
|
|
|
{ |
|
|
|
floatingWindow.Height = 500; |
|
|
|
newHostpane = new DockablePane(); |
|
|
|
floatingWindow.Owner = Window.GetWindow(this); |
|
|
|
newHostpane.Items.Add(content); |
|
|
|
RegisterFloatingWindow(floatingWindow); |
|
|
|
} |
|
|
|
floatingWindow.Show(); |
|
|
|
|
|
|
|
|
|
|
|
content.SetStateToDock(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (prevHostpane != null) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
DockableFloatingWindow floatingWindow = new DockableFloatingWindow(this, content); |
|
|
|
|
|
|
|
floatingWindow.WindowStartupLocation = WindowStartupLocation.Manual; |
|
|
|
|
|
|
|
floatingWindow.Top = prevHostpane.FloatingWindow.Top; |
|
|
|
|
|
|
|
floatingWindow.Left = prevHostpane.FloatingWindow.Left; |
|
|
|
|
|
|
|
floatingWindow.Width = prevHostpane.FloatingWindow.Width; |
|
|
|
|
|
|
|
floatingWindow.Height = prevHostpane.FloatingWindow.Height; |
|
|
|
|
|
|
|
floatingWindow.Owner = Window.GetWindow(this); |
|
|
|
|
|
|
|
RegisterFloatingWindow(floatingWindow); |
|
|
|
|
|
|
|
floatingWindow.Show(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else if (newHostpane != null) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
DockableFloatingWindow floatingWindow = new DockableFloatingWindow(this, newHostpane); |
|
|
|
|
|
|
|
floatingWindow.WindowStartupLocation = WindowStartupLocation.CenterScreen; |
|
|
|
|
|
|
|
floatingWindow.Width = 200; |
|
|
|
|
|
|
|
floatingWindow.Height = 500; |
|
|
|
|
|
|
|
floatingWindow.Owner = Window.GetWindow(this); |
|
|
|
|
|
|
|
RegisterFloatingWindow(floatingWindow); |
|
|
|
|
|
|
|
floatingWindow.Show(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
else if (desideredState == DockableContentState.Document) |
|
|
|
else if (desideredState == DockableContentState.Document) |
|
|
@ -2743,7 +2798,14 @@ namespace AvalonDock |
|
|
|
void RestoreDocumentPaneLayout(XmlElement childElement, out DocumentPane mainExistingDocumentPane, out DocumentPaneResizingPanel existingDocumentPanel, DockableContent[] dockableContents) |
|
|
|
void RestoreDocumentPaneLayout(XmlElement childElement, out DocumentPane mainExistingDocumentPane, out DocumentPaneResizingPanel existingDocumentPanel, DockableContent[] dockableContents) |
|
|
|
{ |
|
|
|
{ |
|
|
|
mainExistingDocumentPane = (Content is DocumentPane) ? Content as DocumentPane : GetMainDocumentPane(Content as ResizingPanel); |
|
|
|
mainExistingDocumentPane = (Content is DocumentPane) ? Content as DocumentPane : GetMainDocumentPane(Content as ResizingPanel); |
|
|
|
existingDocumentPanel = mainExistingDocumentPane.GetParentDocumentPaneResizingPanel(); |
|
|
|
if (mainExistingDocumentPane != null) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
existingDocumentPanel = mainExistingDocumentPane.GetParentDocumentPaneResizingPanel(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
existingDocumentPanel = null; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (existingDocumentPanel != null) |
|
|
|
if (existingDocumentPanel != null) |
|
|
|
{ |
|
|
|
{ |
|
|
|