Browse Source

Update AvalonDock to 1.2.2154.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@4269 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 16 years ago
parent
commit
8396a39d9c
  1. 1
      src/Libraries/AvalonDock/AvalonDock.csproj
  2. 25
      src/Libraries/AvalonDock/DeserializationCallbackEventArgs.cs
  3. 8
      src/Libraries/AvalonDock/DockableContent.cs
  4. 6
      src/Libraries/AvalonDock/DockablePane.cs
  5. 140
      src/Libraries/AvalonDock/DockingManager.cs
  6. 24
      src/Libraries/AvalonDock/FloatingWindow.cs
  7. 2
      src/Libraries/AvalonDock/Properties/AssemblyInfo.cs
  8. 4
      src/Libraries/AvalonDock/ResizingPanel.cs

1
src/Libraries/AvalonDock/AvalonDock.csproj

@ -76,6 +76,7 @@ @@ -76,6 +76,7 @@
<Compile Include="AlignedImage.cs" />
<Compile Include="AvalonDockBrushes.cs" />
<Compile Include="ContextMenuElement.cs" />
<Compile Include="DeserializationCallbackEventArgs.cs" />
<Compile Include="DockableContent.cs" />
<Compile Include="DockableFloatingWindow.cs" />
<Compile Include="DockablePane.cs" />

25
src/Libraries/AvalonDock/DeserializationCallbackEventArgs.cs

@ -0,0 +1,25 @@ @@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace AvalonDock
{
public class DeserializationCallbackEventArgs : EventArgs
{
public DeserializationCallbackEventArgs(string contentName)
{
Name = contentName;
}
/// <summary>
/// Gets the name of the content to deserialize
/// </summary>
public string Name { get; protected set; }
/// <summary>
/// Gets/Sets the content manually deserialized
/// </summary>
public DockableContent Content { get; set; }
}
}

8
src/Libraries/AvalonDock/DockableContent.cs

@ -156,6 +156,8 @@ namespace AvalonDock @@ -156,6 +156,8 @@ namespace AvalonDock
public readonly double Width;
public readonly double Height;
public readonly AnchorStyle Anchor = AnchorStyle.None;
public DockableContentStateAndPosition(
DockableContent cntToSave)
{
@ -163,6 +165,12 @@ namespace AvalonDock @@ -163,6 +165,12 @@ namespace AvalonDock
ChildIndex = ContainerPane.Items.IndexOf(cntToSave);
Width = ContainerPane.ActualWidth;
Height = ContainerPane.ActualHeight;
DockablePane dockablePane = ContainerPane as DockablePane;
if (dockablePane != null)
{
Anchor = dockablePane.Anchor;
}
}
}

6
src/Libraries/AvalonDock/DockablePane.cs

@ -47,6 +47,10 @@ namespace AvalonDock @@ -47,6 +47,10 @@ namespace AvalonDock
/// </summary>
public enum AnchorStyle
{
/// <summary>
/// No anchor style, while content is hosted in a <see cref="DocumentPane"/> or a <see cref="FloatingWindow"/>
/// </summary>
None,
/// <summary>
/// Top border anchor
/// </summary>
@ -135,7 +139,7 @@ namespace AvalonDock @@ -135,7 +139,7 @@ namespace AvalonDock
// Using a DependencyProperty as the backing store for Anchor. This enables animation, styling, binding, etc...
public static readonly DependencyPropertyKey AnchorPropertyKey =
DependencyProperty.RegisterAttachedReadOnly("Anchor", typeof(AnchorStyle), typeof(DockablePane), new UIPropertyMetadata(AnchorStyle.Left));
DependencyProperty.RegisterAttachedReadOnly("Anchor", typeof(AnchorStyle), typeof(DockablePane), new UIPropertyMetadata(AnchorStyle.None));
public override void OnApplyTemplate()

140
src/Libraries/AvalonDock/DockingManager.cs

@ -213,8 +213,8 @@ namespace AvalonDock @@ -213,8 +213,8 @@ namespace AvalonDock
}
set
{
if (_activeDocument != value &&
value.ContainerPane is DocumentPane)
if (_activeDocument != value/* &&
value.ContainerPane is DocumentPane*/)
{
List<ManagedContent> listOfAllDocuments = FindContents<ManagedContent>();
listOfAllDocuments.ForEach((ManagedContent cnt) =>
@ -685,6 +685,9 @@ namespace AvalonDock @@ -685,6 +685,9 @@ namespace AvalonDock
//remove the pane from its original children collection
FrameworkElement parentElement = paneToAnchor.Parent as FrameworkElement;
if (anchor == AnchorStyle.None)
anchor = AnchorStyle.Right;
//Change anchor border according to FlowDirection
if (FlowDirection == FlowDirection.RightToLeft)
{
@ -801,6 +804,9 @@ namespace AvalonDock @@ -801,6 +804,9 @@ namespace AvalonDock
/// <param name="anchor"></param>
public void Anchor(Pane paneToAnchor, Pane relativePane, AnchorStyle anchor)
{
if (anchor == AnchorStyle.None)
anchor = AnchorStyle.Right;
//Change anchor border according to FlowDirection
if (FlowDirection == FlowDirection.RightToLeft)
{
@ -832,6 +838,9 @@ namespace AvalonDock @@ -832,6 +838,9 @@ namespace AvalonDock
/// <param name="anchor"></param>
public void Anchor(DockablePane paneToAnchor, DocumentPane relativePane, AnchorStyle anchor)
{
if (anchor == AnchorStyle.None)
anchor = AnchorStyle.Right;
//get a reference to the resizingpanel container of relativePane
ResizingPanel relativePaneContainer = LogicalTreeHelper.GetParent(relativePane) as ResizingPanel;
DocumentPaneResizingPanel relativeDocumentPaneContainer = relativePane.GetParentDocumentPaneResizingPanel();
@ -981,6 +990,9 @@ namespace AvalonDock @@ -981,6 +990,9 @@ namespace AvalonDock
/// <param name="anchor"></param>
public void Anchor(DocumentPane paneToAnchor, DocumentPane relativePane, AnchorStyle anchor)
{
if (anchor == AnchorStyle.None)
anchor = AnchorStyle.Right;
//get a reference to the resizingpanel container of relativePane
ResizingPanel relativePaneContainer = LogicalTreeHelper.GetParent(relativePane) as ResizingPanel;
DocumentPaneResizingPanel relativeDocumentPaneContainer = relativePane.GetParentDocumentPaneResizingPanel();
@ -1083,6 +1095,9 @@ namespace AvalonDock @@ -1083,6 +1095,9 @@ namespace AvalonDock
/// <param name="anchor"></param>
public void Anchor(DockablePane paneToAnchor, DockablePane relativePane, AnchorStyle anchor)
{
if (anchor == AnchorStyle.None)
anchor = AnchorStyle.Right;
//get a refernce to the resizingpanel container of relativePane
ResizingPanel relativePaneContainer = LogicalTreeHelper.GetParent(relativePane) as ResizingPanel;
Orientation requestedOrientation =
@ -1536,7 +1551,7 @@ namespace AvalonDock @@ -1536,7 +1551,7 @@ namespace AvalonDock
/// <param name="desideredState">State desidered</param>
public void Show(DockableContent content, DockableContentState desideredState)
{
Show(content, desideredState, AnchorStyle.Right);
Show(content, desideredState, AnchorStyle.None);
}
/// <summary>
@ -1696,6 +1711,14 @@ namespace AvalonDock @@ -1696,6 +1711,14 @@ namespace AvalonDock
DockablePane newHostpane = new DockablePane();
newHostpane.Items.Add(content);
if (desideredAnchor == AnchorStyle.None &&
content.SavedStateAndPosition != null &&
content.SavedStateAndPosition.Anchor != AnchorStyle.None)
desideredAnchor = content.SavedStateAndPosition.Anchor;
if (desideredAnchor == AnchorStyle.None)
desideredAnchor = AnchorStyle.Right;
if (desideredAnchor == AnchorStyle.Left ||
desideredAnchor == AnchorStyle.Right)
{
@ -1705,7 +1728,8 @@ namespace AvalonDock @@ -1705,7 +1728,8 @@ namespace AvalonDock
!double.IsNaN(content.SavedStateAndPosition.Width))
w = content.SavedStateAndPosition.Width;
//ResizingPanel.SetResizeWidth(newHostpane, w);
ResizingPanel.SetResizeWidth(newHostpane, new GridLength(w));
ResizingPanel.SetEffectiveSize(newHostpane, new Size(w, 0.0));
}
else
{
@ -1715,7 +1739,8 @@ namespace AvalonDock @@ -1715,7 +1739,8 @@ namespace AvalonDock
!double.IsNaN(content.SavedStateAndPosition.Height))
h = content.SavedStateAndPosition.Height;
//ResizingPanel.SetResizeHeight(newHostpane, h);
ResizingPanel.SetResizeHeight(newHostpane, new GridLength(h));
ResizingPanel.SetEffectiveSize(newHostpane, new Size(0.0, h));
}
Anchor(newHostpane, desideredAnchor);
@ -2474,13 +2499,18 @@ namespace AvalonDock @@ -2474,13 +2499,18 @@ namespace AvalonDock
{
if (content.State == DockableContentState.AutoHide)
{
if ((content.Parent as DockablePane).Items.Count == 1)
DockablePane parentContainer = content.Parent as DockablePane;
if (parentContainer != null &&
parentContainer.Items.Count == 1)
ToggleAutoHide(content.Parent as DockablePane);
}
if (content.State == DockableContentState.DockableWindow ||
content.State == DockableContentState.FloatingWindow)
{
if ((content.Parent as DockablePane).Items.Count == 1)
DockablePane parentContainer = content.Parent as DockablePane;
if (parentContainer != null &&
parentContainer.Items.Count == 1)
{
FloatingWindow floatingWindow = Window.GetWindow(content) as FloatingWindow;
floatingWindow.Close();
@ -2493,6 +2523,11 @@ namespace AvalonDock @@ -2493,6 +2523,11 @@ namespace AvalonDock
content.DetachFromContainerPane();
}
public delegate void DeserializationCallbackHandler(object sender, DeserializationCallbackEventArgs e);
public DeserializationCallbackHandler DeserializationCallback { get; set; }
void ShowAllHiddenContents()
{
while (_hiddenContents.Count > 0)
@ -2502,7 +2537,7 @@ namespace AvalonDock @@ -2502,7 +2537,7 @@ namespace AvalonDock
}
}
void RestoreDocumentPaneLayout(XmlElement childElement, out DocumentPane mainExistingDocumentPane, out DocumentPaneResizingPanel existingDocumentPanel)
void RestoreDocumentPaneLayout(XmlElement childElement, out DocumentPane mainExistingDocumentPane, out DocumentPaneResizingPanel existingDocumentPanel, DockableContent[] dockableContents)
{
mainExistingDocumentPane = (Content is DocumentPane) ? Content as DocumentPane : GetMainDocumentPane(Content as ResizingPanel);
existingDocumentPanel = mainExistingDocumentPane.GetParentDocumentPaneResizingPanel();
@ -2534,17 +2569,36 @@ namespace AvalonDock @@ -2534,17 +2569,36 @@ namespace AvalonDock
{
if (contentElement.HasAttribute("Name"))
{
foreach (DockableContent content in DockableContents)
DockableContent foundContent = null;
string contentName = contentElement.GetAttribute("Name");
foreach (DockableContent content in dockableContents)
{
if (content.Name == contentElement.GetAttribute("Name"))
if (content.Name == contentName)
{
DetachContentFromDockingManager(content);
mainExistingDocumentPane.Items.Add(content);
content.SetStateToDocument();
content.RestoreLayout(contentElement);
foundContent = content;
break;
}
}
if (foundContent == null &&
DeserializationCallback != null)
{
DeserializationCallbackEventArgs e = new DeserializationCallbackEventArgs(contentName);
DeserializationCallback(this, e);
foundContent = e.Content;
}
if (foundContent != null)
{
DetachContentFromDockingManager(foundContent);
mainExistingDocumentPane.Items.Add(foundContent);
foundContent.SetStateToDocument();
//call custom layout persistence method
foundContent.RestoreLayout(contentElement);
}
}
}
}
@ -2593,24 +2647,40 @@ namespace AvalonDock @@ -2593,24 +2647,40 @@ namespace AvalonDock
{
if (contentElement.HasAttribute("Name"))
{
DockableContent foundContent = null;
string contentName = contentElement.GetAttribute("Name");
foreach (DockableContent content in dockableContents)
{
if (content.Name == contentElement.GetAttribute("Name"))
if (content.Name == contentName)
{
DetachContentFromDockingManager(content);
pane.Items.Add(content);
content.SetStateToDock();
if (contentElement.HasAttribute("AutoHide") &&
XmlConvert.ToBoolean(contentElement.GetAttribute("AutoHide")) &&
pane.Items.Count == 1)
toggleAutoHide = true;
//call custom layout persistence method
content.RestoreLayout(contentElement);
foundContent = content;
break;
}
}
if (foundContent == null &&
DeserializationCallback != null)
{
DeserializationCallbackEventArgs e = new DeserializationCallbackEventArgs(contentName);
DeserializationCallback(this, e);
foundContent = e.Content;
}
if (foundContent != null)
{
DetachContentFromDockingManager(foundContent);
pane.Items.Add(foundContent);
foundContent.SetStateToDock();
if (contentElement.HasAttribute("AutoHide") &&
XmlConvert.ToBoolean(contentElement.GetAttribute("AutoHide")) &&
pane.Items.Count == 1)
toggleAutoHide = true;
//call custom layout persistence method
foundContent.RestoreLayout(contentElement);
}
}
}
if (pane.Items.Count > 0)
@ -2629,7 +2699,7 @@ namespace AvalonDock @@ -2629,7 +2699,7 @@ namespace AvalonDock
DocumentPaneResizingPanel existingDocumentPanel = null;
DocumentPane mainExistingDocumentPane = null;
RestoreDocumentPaneLayout(childElement, out mainExistingDocumentPane, out existingDocumentPanel);
RestoreDocumentPaneLayout(childElement, out mainExistingDocumentPane, out existingDocumentPanel, dockableContents);
if (existingDocumentPanel != null)
{
@ -2723,7 +2793,7 @@ namespace AvalonDock @@ -2723,7 +2793,7 @@ namespace AvalonDock
DocumentPaneResizingPanel existingDocumentPanel = null;
DocumentPane mainExistingDocumentPane = null;
RestoreDocumentPaneLayout(rootElement, out mainExistingDocumentPane, out existingDocumentPanel);
RestoreDocumentPaneLayout(rootElement, out mainExistingDocumentPane, out existingDocumentPanel, actualContents);
if (existingDocumentPanel != null)
{
@ -2776,14 +2846,24 @@ namespace AvalonDock @@ -2776,14 +2846,24 @@ namespace AvalonDock
foreach (XmlElement contentElement in paneElement.ChildNodes)
{
#region Find the content to transfer
string contentToFindName = contentElement.GetAttribute("Name");
foreach (DockableContent content in actualContents)
{
if (contentElement.GetAttribute("Name") == content.Name)
if (contentToFindName == content.Name)
{
contentToTransfer = content;
break;
}
}
}
if (contentToTransfer == null &&
DeserializationCallback != null)
{
DeserializationCallbackEventArgs e = new DeserializationCallbackEventArgs(contentToFindName);
DeserializationCallback(this, e);
contentToTransfer = e.Content;
}
#endregion

24
src/Libraries/AvalonDock/FloatingWindow.cs

@ -117,6 +117,29 @@ namespace AvalonDock @@ -117,6 +117,29 @@ namespace AvalonDock
}
#region Active Content Management
ManagedContent lastActiveContent = null;
protected override void OnActivated(EventArgs e)
{
if (Manager != null)
{
lastActiveContent = Manager.ActiveContent;
Manager.ActiveContent = HostedPane.SelectedItem as ManagedContent;
}
base.OnActivated(e);
}
protected override void OnDeactivated(EventArgs e)
{
if (Manager != null && lastActiveContent != null)
{
Manager.ActiveContent = lastActiveContent;
}
base.OnDeactivated(e);
}
#endregion
public abstract Pane ClonePane();
@ -368,7 +391,6 @@ namespace AvalonDock @@ -368,7 +391,6 @@ namespace AvalonDock
}
#endregion
#region INotifyPropertyChanged Members
public event PropertyChangedEventHandler PropertyChanged;

2
src/Libraries/AvalonDock/Properties/AssemblyInfo.cs

@ -59,4 +59,4 @@ using System.Runtime.InteropServices; @@ -59,4 +59,4 @@ using System.Runtime.InteropServices;
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.2.2104")]
[assembly: AssemblyVersion("1.2.2154")]

4
src/Libraries/AvalonDock/ResizingPanel.cs

@ -789,7 +789,7 @@ namespace AvalonDock @@ -789,7 +789,7 @@ namespace AvalonDock
#if DEBUG
Debug.Assert(_splitterList.Count == Children.Count / 2);
i = 0;
while (true)
while (Children.Count > 0)
{
Debug.Assert(Children[i] != null);
Debug.Assert(!(Children[i] is ResizingPanelSplitter));
@ -799,7 +799,7 @@ namespace AvalonDock @@ -799,7 +799,7 @@ namespace AvalonDock
Debug.Assert((Children[i] is ResizingPanelSplitter));
i++;
}
#endif
splitterListIsDirty = false;

Loading…
Cancel
Save