Skip to content

Commit

Permalink
Initial AvalonDock Version 3.5 taken from this commit:
Browse files Browse the repository at this point in the history
  • Loading branch information
Dirkster99 committed Feb 14, 2019
1 parent 0ba57c1 commit 8982373
Show file tree
Hide file tree
Showing 29 changed files with 623 additions and 848 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ This program is provided to you under the terms of the Microsoft Public
internal static class _XceedVersionInfo
{
[System.Diagnostics.CodeAnalysis.SuppressMessage( "Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields" )]
public const string BaseVersion = "3.4";
public const string BaseVersion = "3.5";
[System.Diagnostics.CodeAnalysis.SuppressMessage( "Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields" )]
public const string Version = BaseVersion +
".0.0";
Expand Down
31 changes: 15 additions & 16 deletions source/Components/Xceed.Wpf.AvalonDock.Themes.Metro/Theme.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,8 @@
</Style>

<Style TargetType="avalonDockControls:AnchorablePaneTitle">
<Setter Property="BorderThickness"
Value="0,3,0,0"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate>
Expand Down Expand Up @@ -547,8 +549,6 @@
Value="True">
<Setter Property="BorderBrush"
Value="{DynamicResource AvalonDock_ThemeMetro_BaseColor3}" />
<Setter Property="BorderThickness"
Value="0,3,0,0" />
</DataTrigger>
<DataTrigger Binding="{Binding Model.IsActive, RelativeSource={RelativeSource Mode=Self}}"
Value="True">
Expand Down Expand Up @@ -598,7 +598,8 @@

<ControlTemplate x:Key="AvalonDock_ThemeMetro_AnchorSideTemplate"
TargetType="{x:Type avalonDockControls:LayoutAnchorSideControl}">
<ItemsControl ItemsSource="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Children}">
<ItemsControl ItemsSource="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Children}"
Background="{TemplateBinding Background}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel MinWidth="4"
Expand Down Expand Up @@ -1117,15 +1118,19 @@
Grid.Row="1" />
<ContentPresenter Content="{TemplateBinding RightSidePanel}"
Grid.Column="2"
Grid.Row="1" />
Grid.Row="0"
Grid.RowSpan="3" />
<ContentPresenter Content="{TemplateBinding LeftSidePanel}"
Grid.Column="0"
Grid.Row="1" />
Grid.Row="0"
Grid.RowSpan="3"/>
<ContentPresenter Content="{TemplateBinding TopSidePanel}"
Grid.Column="1"
Grid.Column="0"
Grid.ColumnSpan="3"
Grid.Row="0" />
<ContentPresenter Content="{TemplateBinding BottomSidePanel}"
Grid.Column="1"
Grid.Column="0"
Grid.ColumnSpan="3"
Grid.Row="2" />
<ContentPresenter x:Name="PART_AutoHideArea"
Content="{TemplateBinding AutoHideWindow}"
Expand Down Expand Up @@ -1162,7 +1167,7 @@
<Border Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}">
<ContentPresenter Content="{Binding LayoutItem.View, RelativeSource={RelativeSource TemplatedParent}}"
<ContentPresenter Content="{Binding LayoutItem.View.Content, RelativeSource={RelativeSource TemplatedParent}}"
ContentTemplate="{Binding LayoutItem.View.ContentTemplate, RelativeSource={RelativeSource TemplatedParent}}"
ContentTemplateSelector="{Binding LayoutItem.View.ContentTemplateSelector, RelativeSource={RelativeSource TemplatedParent}}" />
</Border>
Expand Down Expand Up @@ -1311,7 +1316,7 @@
</Border>
<ContentPresenter Grid.Row="1"
FlowDirection="{TemplateBinding FlowDirection}"
Content="{Binding LayoutItem.View, RelativeSource={RelativeSource TemplatedParent}}" />
Content="{Binding LayoutItem.View.Content, RelativeSource={RelativeSource TemplatedParent}}" />

<!--<ContentPresenter
Content="{Binding Model.Content, RelativeSource={RelativeSource TemplatedParent}}"
Expand Down Expand Up @@ -1558,7 +1563,7 @@
<Border x:Name="Header"
Padding="2,0,2,0"
TextElement.Foreground="{DynamicResource AvalonDock_ThemeMetro_BaseColor2}"
Background="{DynamicResource AvalonDock_ThemeMetro_BaseColor1}">
Background="{TemplateBinding Background}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
Expand Down Expand Up @@ -2055,11 +2060,5 @@

</Style>

<!--
Re-styling this in AvalonDock since the menu on the drop-down button for more documents is otherwise black
BugFix for Issue http://avalondock.codeplex.com/workitem/15743
-->
<Style TargetType="{x:Type avalonDockControls:ContextMenuEx}" BasedOn="{StaticResource {x:Type ContextMenu}}">
</Style>

</ResourceDictionary>
4 changes: 2 additions & 2 deletions source/Components/Xceed.Wpf.AvalonDock/AssemblyVersionInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ This program is provided to you under the terms of the Microsoft Public
internal static class _XceedVersionInfo
{
[System.Diagnostics.CodeAnalysis.SuppressMessage( "Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields" )]
public const string BaseVersion = "3.4";
public const string BaseVersion = "3.5";
[System.Diagnostics.CodeAnalysis.SuppressMessage( "Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields" )]
public const string Version = BaseVersion +
".0.11";
".0.0";
[System.Diagnostics.CodeAnalysis.SuppressMessage( "Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields" )]
public const string PublicKeyToken = "ba83ff368b7563c6";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,20 +153,23 @@ protected override void OnMouseLeave( System.Windows.Input.MouseEventArgs e )
var paneModel = pane.Model as LayoutAnchorablePane;
var manager = paneModel.Root.Manager;

// Get psotion of this visual on screen
var pos = this.PointToScreen(new Point(0, 0));

// Transform screen point to WPF device independent point
PresentationSource source = PresentationSource.FromVisual(this);
Point targetPoints = source.CompositionTarget.TransformFromDevice.Transform(pos);

// Log current delta between mouse and visual for use in drag cycle
var mousePosition = this.PointToScreenDPI(Mouse.GetPosition(this));

Point dragDelta = new Point(mousePosition.X - targetPoints.X,
mousePosition.Y - targetPoints.Y);

manager.StartDraggingFloatingWindowForPane( paneModel, dragDelta );
manager.StartDraggingFloatingWindowForPane( paneModel );
}
else
{
var model = this.Model;
if( model != null )
{
var root = model.Root;
if( root != null )
{
var manager = root.Manager;
if( manager != null )
{
manager.StartDraggingFloatingWindowForContent( model );
}
}
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,20 @@ static LayoutAnchorableFloatingWindowControl()
DefaultStyleKeyProperty.OverrideMetadata( typeof( LayoutAnchorableFloatingWindowControl ), new FrameworkPropertyMetadata( typeof( LayoutAnchorableFloatingWindowControl ) ) );
}

internal LayoutAnchorableFloatingWindowControl( LayoutAnchorableFloatingWindow model )
: base( model )
internal LayoutAnchorableFloatingWindowControl( LayoutAnchorableFloatingWindow model, bool isContentImmutable )
: base( model, isContentImmutable )
{
_model = model;
HideWindowCommand = new RelayCommand( ( p ) => OnExecuteHideWindowCommand( p ), ( p ) => CanExecuteHideWindowCommand( p ) );
CloseWindowCommand = new RelayCommand( ( p ) => OnExecuteCloseWindowCommand( p ), ( p ) => CanExecuteCloseWindowCommand( p ) );
UpdateThemeResources();
}

internal LayoutAnchorableFloatingWindowControl( LayoutAnchorableFloatingWindow model)
: base( model, false )
{
}

#endregion

#region Properties
Expand Down Expand Up @@ -139,8 +144,11 @@ protected override void OnInitialized( EventArgs e )
protected override void OnClosed( EventArgs e )
{
var root = Model.Root;
root.Manager.RemoveFloatingWindow( this );
root.CollectGarbage();
if( root != null )
{
root.Manager.RemoveFloatingWindow( this );
root.CollectGarbage();
}
if( _overlayWindow != null )
{
_overlayWindow.Close();
Expand All @@ -149,13 +157,11 @@ protected override void OnClosed( EventArgs e )

base.OnClosed( e );

if( !CloseInitiatedByUser )
if( !CloseInitiatedByUser && (root != null) )
{
root.FloatingWindows.Remove( _model );
}

SetBinding(VisibilityProperty, string.Empty);

_model.PropertyChanged -= new System.ComponentModel.PropertyChangedEventHandler( _model_PropertyChanged );
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,15 @@ internal override void Detach()
base.Detach();
}

protected override bool CanExecuteDockAsDocumentCommand()
{
var canExecute = base.CanExecuteDockAsDocumentCommand();
if( canExecute && ( _anchorable != null ) )
return _anchorable.CanDockAsTabbedDocument;

return canExecute;
}

protected override void Close()
{
if( ( _anchorable.Root != null ) && ( _anchorable.Root.Manager != null ) )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,32 +68,26 @@ public ILayoutElement Model

protected override void OnGotKeyboardFocus( System.Windows.Input.KeyboardFocusChangedEventArgs e )
{
if ((_model != null) && (_model.SelectedContent != null))
{
_model.SelectedContent.IsActive = true;
}

_model.SelectedContent.IsActive = true;

base.OnGotKeyboardFocus( e );
}

protected override void OnMouseLeftButtonDown( System.Windows.Input.MouseButtonEventArgs e )
{
base.OnMouseLeftButtonDown( e );

if( !e.Handled && ( _model != null ) && ( _model.SelectedContent != null ) )
{
if( !e.Handled && _model.SelectedContent != null )
_model.SelectedContent.IsActive = true;
}
}

protected override void OnMouseRightButtonDown( System.Windows.Input.MouseButtonEventArgs e )
{
base.OnMouseRightButtonDown( e );

if( !e.Handled && ( _model != null ) && ( _model.SelectedContent != null ) )
{
if( !e.Handled && _model.SelectedContent != null )
_model.SelectedContent.IsActive = true;
}

}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ public class LayoutAnchorableTabItem : Control

private bool _isMouseDown = false;
private static LayoutAnchorableTabItem _draggingItem = null;
private static bool _cancelMouseLeave = false;

#endregion

Expand Down Expand Up @@ -147,10 +146,6 @@ protected override void OnMouseMove( System.Windows.Input.MouseEventArgs e )
_isMouseDown = false;
_draggingItem = null;
}
else
{
_cancelMouseLeave = false;
}
}

protected override void OnMouseLeftButtonUp( System.Windows.Input.MouseButtonEventArgs e )
Expand All @@ -168,23 +163,20 @@ protected override void OnMouseLeave( System.Windows.Input.MouseEventArgs e )

if( _isMouseDown && e.LeftButton == MouseButtonState.Pressed )
{
// drag the item if the mouse leave is not canceled.
// Mouse leave should be canceled when selecting a new tab to prevent automatic undock when Panel size is Auto.
_draggingItem = !_cancelMouseLeave ? this : null;
_draggingItem = this;
}

_isMouseDown = false;
_cancelMouseLeave = false;
}

protected override void OnMouseEnter( MouseEventArgs e )
{
base.OnMouseEnter( e );

if (_draggingItem != null &&
_draggingItem != this && // Fix #1354 https://github.com/xceedsoftware/wpftoolkit/issues/1354
e.LeftButton == MouseButtonState.Pressed)
{
if( _draggingItem != null
&& _draggingItem != this
&& e.LeftButton == MouseButtonState.Pressed )
{
var model = Model;
var container = model.Parent as ILayoutContainer;
var containerPane = model.Parent as ILayoutPane;
Expand Down Expand Up @@ -222,11 +214,7 @@ internal static void ResetDraggingItem()
{
_draggingItem = null;
}
internal static void CancelMouseLeave()
{
_cancelMouseLeave = true;
}

#endregion
}
#endregion
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -164,16 +164,6 @@ protected override System.Runtime.InteropServices.HandleRef BuildWindowCore( Sys
return new HandleRef( this, _internalHwndSource.Handle );
}

protected override IntPtr WndProc( IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled )
{
if( msg == Win32Helper.WM_WINDOWPOSCHANGING )
{
if( _internalHost_ContentRendered )
Win32Helper.SetWindowPos( _internalHwndSource.Handle, Win32Helper.HWND_TOP, 0, 0, 0, 0, Win32Helper.SetWindowPosFlags.IgnoreMove | Win32Helper.SetWindowPosFlags.IgnoreResize );
}
return base.WndProc( hwnd, msg, wParam, lParam, ref handled );
}

protected override void DestroyWindowCore( System.Runtime.InteropServices.HandleRef hwnd )
{
if( _internalHwndSource != null )
Expand All @@ -184,11 +174,6 @@ protected override void DestroyWindowCore( System.Runtime.InteropServices.Handle
}
}

public override void OnApplyTemplate()
{
base.OnApplyTemplate();
}

protected override bool HasFocusWithinCore()
{
return false;
Expand Down Expand Up @@ -243,6 +228,7 @@ internal void Show( LayoutAnchorControl anchor )
Visibility = System.Windows.Visibility.Visible;
InvalidateMeasure();
UpdateWindowPos();
Win32Helper.BringWindowToTop( _internalHwndSource.Handle );
}

internal void Hide()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,18 @@ static LayoutDocumentFloatingWindowControl()
DefaultStyleKeyProperty.OverrideMetadata( typeof( LayoutDocumentFloatingWindowControl ), new FrameworkPropertyMetadata( typeof( LayoutDocumentFloatingWindowControl ) ) );
}

internal LayoutDocumentFloatingWindowControl( LayoutDocumentFloatingWindow model )
: base( model )
internal LayoutDocumentFloatingWindowControl( LayoutDocumentFloatingWindow model, bool isContentImmutable )
: base( model, isContentImmutable )
{
_model = model;
UpdateThemeResources();
}

internal LayoutDocumentFloatingWindowControl( LayoutDocumentFloatingWindow model )
: base( model, false )
{
}

#endregion

#region Properties
Expand Down
Loading

0 comments on commit 8982373

Please sign in to comment.