Browse Source

Update AvalonDock to 1.2.2632

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@4925 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 17 years ago
parent
commit
252a8c3ee7
  1. 51
      src/Libraries/AvalonDock/DockableContent.cs
  2. 17
      src/Libraries/AvalonDock/DockingManager.cs
  3. 11
      src/Libraries/AvalonDock/DocumentContent.cs
  4. 2
      src/Libraries/AvalonDock/DocumentFloatingWindow.cs
  5. 34
      src/Libraries/AvalonDock/DocumentPane.cs
  6. 19
      src/Libraries/AvalonDock/HelperFunc.cs
  7. 10
      src/Libraries/AvalonDock/OverlayWindow.cs
  8. 2
      src/Libraries/AvalonDock/Properties/AssemblyInfo.cs
  9. 13
      src/Libraries/AvalonDock/ResizingPanel.cs

51
src/Libraries/AvalonDock/DockableContent.cs

@ -137,7 +137,7 @@ namespace AvalonDock @@ -137,7 +137,7 @@ namespace AvalonDock
/// <summary>
/// Dockable to a border of a <see cref="DockingManager"/> and into a <see cref="DocumentPane"/>
/// </summary>
Dockable = DockableToBorders | Document,
Dockable = DockableToBorders | Document | Floating,
/// <summary>
/// Dockable to a border of a <see cref="DockingManager"/> and into a <see cref="DocumentPane"/> but not in autohidden mode (WinForms controls)
@ -159,6 +159,20 @@ namespace AvalonDock @@ -159,6 +159,20 @@ namespace AvalonDock
public readonly AnchorStyle Anchor = AnchorStyle.None;
public DockableContentStateAndPosition(
Pane containerPane,
int childIndex,
double width,
double height,
AnchorStyle anchor)
{
ContainerPane = containerPane;
ChildIndex = childIndex;
Width = width;
Height = height;
Anchor = anchor;
}
public DockableContentStateAndPosition(
DockableContent cntToSave)
{
ContainerPane = cntToSave.ContainerPane;
@ -485,6 +499,19 @@ namespace AvalonDock @@ -485,6 +499,19 @@ namespace AvalonDock
storeWriter.WriteAttributeString(
"FloatingWindowSize", new SizeConverter().ConvertToInvariantString(FloatingWindowSize));
}
if (SavedStateAndPosition != null)
{
storeWriter.WriteAttributeString(
"ChildIndex", SavedStateAndPosition.ChildIndex.ToString());
storeWriter.WriteAttributeString(
"Width", SavedStateAndPosition.Width.ToString());
storeWriter.WriteAttributeString(
"Height", SavedStateAndPosition.Height.ToString());
storeWriter.WriteAttributeString(
"Anchor", SavedStateAndPosition.Anchor.ToString());
}
}
/// <summary>
@ -496,6 +523,28 @@ namespace AvalonDock @@ -496,6 +523,28 @@ namespace AvalonDock
{
if (contentElement.HasAttribute("FloatingWindowSize"))
FloatingWindowSize = (Size)(new SizeConverter()).ConvertFromInvariantString(contentElement.GetAttribute("FloatingWindowSize"));
Size effectiveSize = new Size(0d, 0d);
if (contentElement.HasAttribute("EffectiveSize"))
{
// Store
effectiveSize = (Size)(new SizeConverter()).ConvertFromInvariantString(contentElement.GetAttribute("EffectiveSize"));
}
ResizingPanel.SetEffectiveSize(this, effectiveSize);
if (contentElement.HasAttribute("ChildIndex"))
{
_savedStateAndPosition = new DockableContentStateAndPosition(
ContainerPane,
int.Parse(contentElement.GetAttribute("ChildIndex")),
double.Parse(contentElement.GetAttribute("Width")),
double.Parse(contentElement.GetAttribute("Height")),
(AnchorStyle) Enum.Parse(typeof(AnchorStyle), contentElement.GetAttribute("Anchor"))
);
}
}
#endregion
}

17
src/Libraries/AvalonDock/DockingManager.cs

@ -543,6 +543,11 @@ namespace AvalonDock @@ -543,6 +543,11 @@ namespace AvalonDock
}
}
}
else
{
_mainDocumentPane = value;
}
}
}
@ -1746,7 +1751,11 @@ namespace AvalonDock @@ -1746,7 +1751,11 @@ namespace AvalonDock
if (content.ContainerPane.GetManager() == null)
{
//disconnect the parent pane from previous panel
((Panel)content.ContainerPane.Parent).Children.Remove(content.ContainerPane);
//((Panel)content.ContainerPane.Parent).Children.Remove(content.ContainerPane);
if (content.ContainerPane.Parent != null)
{
((Panel)content.ContainerPane.Parent).Children.Remove(content.ContainerPane);
}
Anchor(content.ContainerPane, desideredAnchor);
}
@ -2482,7 +2491,10 @@ namespace AvalonDock @@ -2482,7 +2491,10 @@ namespace AvalonDock
void SaveLayout(XmlWriter xmlWriter, DockableContent content)
{
Debug.Assert(!string.IsNullOrEmpty(content.Name));
Debug.Assert(!string.IsNullOrEmpty(content.Name),
"DockableContent must have a Name to save its content.\n" +
"Click Ignore to skip this element and continue with save."
);
if (!string.IsNullOrEmpty(content.Name))
{
@ -2960,6 +2972,7 @@ namespace AvalonDock @@ -2960,6 +2972,7 @@ namespace AvalonDock
&& hiddenContent.State != DockableContentState.Hidden)
{
Hide(hiddenContent);
hiddenContent.RestoreLayout(hiddenContentElement);
}
}
}

11
src/Libraries/AvalonDock/DocumentContent.cs

@ -158,6 +158,16 @@ namespace AvalonDock @@ -158,6 +158,16 @@ namespace AvalonDock
base.OnDragMouseLeave(sender, e);
}
public override void OnApplyTemplate()
{
base.OnApplyTemplate();
if (DragEnabledArea != null)
{
DragEnabledArea.InputBindings.Add(new InputBinding(ApplicationCommands.Close, new MouseGesture(MouseAction.MiddleClick)));
}
}
/// <summary>
/// Event fired when the document is about to be closed
/// </summary>
@ -205,6 +215,7 @@ namespace AvalonDock @@ -205,6 +215,7 @@ namespace AvalonDock
}
if (manager != null)
{
if (manager.ActiveDocument == this)

2
src/Libraries/AvalonDock/DocumentFloatingWindow.cs

@ -348,6 +348,8 @@ namespace AvalonDock @@ -348,6 +348,8 @@ namespace AvalonDock
DocumentContent docContent = this.HostedPane.Items[0] as DocumentContent;
if (!docContent.Close())
e.Cancel = true;
else
this.HostedPane.Items.Remove(docContent);
}
base.OnClosing(e);

34
src/Libraries/AvalonDock/DocumentPane.cs

@ -331,6 +331,8 @@ namespace AvalonDock @@ -331,6 +331,8 @@ namespace AvalonDock
{
_optionsContextMenuPlacementTarget = GetTemplateChild("PART_ShowContextMenuButton") as UIElement;
base.OnApplyTemplate();
}
@ -390,14 +392,32 @@ namespace AvalonDock @@ -390,14 +392,32 @@ namespace AvalonDock
internal void CheckContentsEmpty()
{
if (IsMainDocumentPane.HasValue &&
!IsMainDocumentPane.Value &&
Items.Count == 0)
if (Items.Count == 0)
{
ResizingPanel containerPanel = Parent as ResizingPanel;
if (containerPanel != null)
containerPanel.RemoveChild(this);
}
bool isMainDocPaneToBeClose = IsMainDocumentPane.HasValue &&
IsMainDocumentPane.Value;
if (isMainDocPaneToBeClose)
{
DockingManager manager = GetManager();
DocumentPane candidateNewMainDocPane = manager.FindAnotherLogicalChildContained<DocumentPane>(this);
if (candidateNewMainDocPane != null)
{
ResizingPanel containerPanel = Parent as ResizingPanel;
if (containerPanel != null)
containerPanel.RemoveChild(this);
manager.MainDocumentPane = candidateNewMainDocPane;
}
}
else
{
ResizingPanel containerPanel = Parent as ResizingPanel;
if (containerPanel != null)
containerPanel.RemoveChild(this);
}
}
}

19
src/Libraries/AvalonDock/HelperFunc.cs

@ -105,7 +105,6 @@ namespace AvalonDock @@ -105,7 +105,6 @@ namespace AvalonDock
if (child is DependencyObject)
{
T childFound = (child as DependencyObject).GetLogicalChildContained<T>();
if (childFound != null)
return childFound;
@ -115,6 +114,24 @@ namespace AvalonDock @@ -115,6 +114,24 @@ namespace AvalonDock
return null;
}
public static T FindAnotherLogicalChildContained<T>(this DependencyObject obj, UIElement childToExclude) where T : DependencyObject
{
foreach (object child in LogicalTreeHelper.GetChildren(obj))
{
if (child is T && child != childToExclude)
return child as T;
if (child is DependencyObject)
{
T childFound = (child as DependencyObject).FindAnotherLogicalChildContained<T>(childToExclude);
if (childFound != null)
return childFound;
}
}
return null;
}
public static DockablePane FindChildDockablePane(this DockingManager manager, AnchorStyle desideredAnchor)
{
foreach (UIElement childObject in LogicalTreeHelper.GetChildren(manager))

10
src/Libraries/AvalonDock/OverlayWindow.cs

@ -201,10 +201,12 @@ namespace AvalonDock @@ -201,10 +201,12 @@ namespace AvalonDock
else
owdPaneInto.Enabled = !(_manager.DragPaneServices.FloatingWindow is DocumentFloatingWindow);
owdPaneBottom.Enabled = owdPaneInto.Enabled;
owdPaneTop.Enabled = owdPaneInto.Enabled;
owdPaneLeft.Enabled = owdPaneInto.Enabled;
owdPaneRight.Enabled = owdPaneInto.Enabled;
int destPaneChildCount = pane.Items.Count;
owdPaneBottom.Enabled = owdPaneInto.Enabled && destPaneChildCount > 0;
owdPaneTop.Enabled = owdPaneInto.Enabled && destPaneChildCount > 0;
owdPaneLeft.Enabled = owdPaneInto.Enabled && destPaneChildCount > 0;
owdPaneRight.Enabled = owdPaneInto.Enabled && destPaneChildCount > 0;
CurrentDropPane = pane;
}

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.2515")]
[assembly: AssemblyVersion("1.2.2632")]

13
src/Libraries/AvalonDock/ResizingPanel.cs

@ -264,6 +264,19 @@ namespace AvalonDock @@ -264,6 +264,19 @@ namespace AvalonDock
}
availableSize = newAvailSize;
}
//Thx to TMx
else if (availableSize.Height == double.PositiveInfinity &&
Orientation == Orientation.Vertical)
{
Size newAvailSize = new Size();
foreach (FrameworkElement child in visibleChildren)
{
child.Measure(newAvailSize);
newAvailSize.Width = Math.Max(child.DesiredSize.Width, newAvailSize.Width);
newAvailSize.Height += child.DesiredSize.Height;
}
availableSize = newAvailSize;
}
var splitters = from FrameworkElement child in visibleChildren
where child is ResizingPanelSplitter

Loading…
Cancel
Save