Skip to content

Commit

Permalink
V4.3.0 Released
Browse files Browse the repository at this point in the history
  • Loading branch information
XceedBoucherS committed Mar 25, 2022
1 parent 64115ba commit a20eb81
Show file tree
Hide file tree
Showing 102 changed files with 3,606 additions and 402 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
KeyboardNavigation.TabIndex="1"
KeyboardNavigation.DirectionalNavigation="Cycle"/>
<avalonDockControls:DropDownButton x:Name="MenuDropDownButton"
Style="{StaticResource {x:Static ToolBar.ToggleButtonStyleKey}}"
Style="{DynamicResource {x:Static ToolBar.ToggleButtonStyleKey}}"
Focusable="False"
VerticalAlignment="Center"
Grid.Column="1">
Expand Down Expand Up @@ -473,7 +473,7 @@

<avalonDockControls:DropDownButton x:Name="MenuDropDownButton"
VerticalAlignment="Center"
Style="{StaticResource {x:Static ToolBar.ToggleButtonStyleKey}}"
Style="{DynamicResource {x:Static ToolBar.ToggleButtonStyleKey}}"
Focusable="False"
Grid.Column="1"
Padding="-1"
Expand All @@ -489,7 +489,7 @@
Grid.Column="2"
Focusable="False"
Padding="-1"
Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}"
Style="{DynamicResource {x:Static ToolBar.ButtonStyleKey}}"
VerticalAlignment="Center"
HorizontalAlignment="Center"
Command="{Binding Path=LayoutItem.AutoHideCommand, RelativeSource={RelativeSource TemplatedParent}}"
Expand All @@ -503,7 +503,7 @@
Grid.Column="3"
Focusable="False"
Padding="-1"
Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}"
Style="{DynamicResource {x:Static ToolBar.ButtonStyleKey}}"
VerticalAlignment="Center"
HorizontalAlignment="Center"
Command="{Binding Path=LayoutItem.HideCommand, RelativeSource={RelativeSource TemplatedParent}}"
Expand Down Expand Up @@ -1181,7 +1181,7 @@
ContentTemplateSelector="{Binding Root.Manager.DocumentHeaderTemplateSelector, Mode=OneWay}" />
<!-- Close button should be moved out to the container style -->
<Button x:Name="DocumentCloseButton"
Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}"
Style="{DynamicResource {x:Static ToolBar.ButtonStyleKey}}"
VerticalAlignment="Center"
HorizontalAlignment="Center"
Grid.Column="2"
Expand Down Expand Up @@ -1355,7 +1355,7 @@

<avalonDockControls:DropDownButton x:Name="ContextMenuDropdownButton"
shell:WindowChrome.IsHitTestVisibleInChrome="True"
Style="{StaticResource {x:Static ToolBar.ToggleButtonStyleKey}}"
Style="{DynamicResource {x:Static ToolBar.ToggleButtonStyleKey}}"
Focusable="False"
Grid.Column="1"
VerticalAlignment="Center"
Expand All @@ -1376,7 +1376,7 @@
shell:WindowChrome.IsHitTestVisibleInChrome="True"
Focusable="False"
Visibility="{Binding IsMaximized, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource InverseBoolToVisibilityConverter}}"
Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}"
Style="{DynamicResource {x:Static ToolBar.ButtonStyleKey}}"
Command="{x:Static shell:SystemCommands.MaximizeWindowCommand}"
CommandParameter="{Binding RelativeSource={RelativeSource TemplatedParent}}"
ToolTip="{x:Static avalonDockProperties:Resources.Window_Maximize}"
Expand All @@ -1391,7 +1391,7 @@
shell:WindowChrome.IsHitTestVisibleInChrome="True"
Focusable="False"
Visibility="{Binding IsMaximized, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource BoolToVisibilityConverter}}"
Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}"
Style="{DynamicResource {x:Static ToolBar.ButtonStyleKey}}"
Command="{x:Static shell:SystemCommands.RestoreWindowCommand}"
CommandParameter="{Binding RelativeSource={RelativeSource TemplatedParent}}"
ToolTip="{x:Static avalonDockProperties:Resources.Window_Restore}"
Expand All @@ -1405,7 +1405,7 @@
<Button x:Name="PART_PinClose"
shell:WindowChrome.IsHitTestVisibleInChrome="True"
Focusable="False"
Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}"
Style="{DynamicResource {x:Static ToolBar.ButtonStyleKey}}"
Visibility="{Binding Path=IsEnabled, RelativeSource={RelativeSource Self}, Mode=OneWay, Converter={StaticResource BoolToVisibilityConverter}}"
Command="{Binding Path=RootDocumentLayoutItem.CloseCommand, RelativeSource={RelativeSource TemplatedParent}}"
ToolTip="{x:Static avalonDockProperties:Resources.Document_Close}"
Expand Down Expand Up @@ -1539,7 +1539,7 @@
<avalonDockControls:DropDownButton x:Name="SinglePaneContextMenu"
shell:WindowChrome.IsHitTestVisibleInChrome="True"
Visibility="{Binding Path=Model.IsSinglePane, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource BoolToVisibilityConverter}}"
Style="{StaticResource {x:Static ToolBar.ToggleButtonStyleKey}}"
Style="{DynamicResource {x:Static ToolBar.ToggleButtonStyleKey}}"
Focusable="False"
Grid.Column="1"
VerticalAlignment="Center"
Expand All @@ -1560,7 +1560,7 @@
shell:WindowChrome.IsHitTestVisibleInChrome="True"
Focusable="False"
Visibility="{Binding IsMaximized, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource InverseBoolToVisibilityConverter}}"
Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}"
Style="{DynamicResource {x:Static ToolBar.ButtonStyleKey}}"
VerticalAlignment="Center"
HorizontalAlignment="Center"
VerticalContentAlignment="Center"
Expand All @@ -1579,7 +1579,7 @@
shell:WindowChrome.IsHitTestVisibleInChrome="True"
Focusable="False"
Visibility="{Binding IsMaximized, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource BoolToVisibilityConverter}}"
Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}"
Style="{DynamicResource {x:Static ToolBar.ButtonStyleKey}}"
VerticalAlignment="Center"
HorizontalAlignment="Center"
Command="{x:Static shell:SystemCommands.RestoreWindowCommand}"
Expand All @@ -1595,7 +1595,7 @@
<Button x:Name="PART_PinClose"
shell:WindowChrome.IsHitTestVisibleInChrome="True"
Focusable="False"
Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}"
Style="{DynamicResource {x:Static ToolBar.ButtonStyleKey}}"
VerticalAlignment="Center"
HorizontalAlignment="Center"
Visibility="{Binding Path=IsEnabled, RelativeSource={RelativeSource Self}, Mode=OneWay, Converter={StaticResource BoolToVisibilityConverter}}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ internal class AutoHideWindowManager

private DockingManager _manager;
private WeakReference _currentAutohiddenAnchor = null;
private DispatcherTimer _closingTimer = null;
private DispatcherTimer _closeTimer = null;

#endregion
Expand All @@ -36,9 +37,15 @@ internal class AutoHideWindowManager
internal AutoHideWindowManager( DockingManager manager )
{
_manager = manager;
this.SetupClosingTimer();
this.SetupCloseTimer();
}

internal void UpdateCloseTimerInterval( int newValue )
{
_closeTimer.Interval = TimeSpan.FromMilliseconds( newValue );
}

#endregion

#region Private Methods
Expand All @@ -47,10 +54,11 @@ public void ShowAutoHideWindow( LayoutAnchorControl anchor )
{
if( _currentAutohiddenAnchor.GetValueOrDefault<LayoutAnchorControl>() != anchor )
{
StopCloseTimer();
this.StopClosingTimer();
this.StopCloseTimer();
_currentAutohiddenAnchor = new WeakReference( anchor );
_manager.AutoHideWindow.Show( anchor );
StartCloseTimer();
this.StartClosingTimer();
}
}

Expand All @@ -59,24 +67,55 @@ public void HideAutoWindow( LayoutAnchorControl anchor = null )
if( anchor == null ||
anchor == _currentAutohiddenAnchor.GetValueOrDefault<LayoutAnchorControl>() )
{
StopCloseTimer();
this.StopClosingTimer();
this.StopCloseTimer();
}
else
System.Diagnostics.Debug.Assert( false );
}

private void SetupClosingTimer()
{
_closingTimer = new DispatcherTimer( DispatcherPriority.Background );
_closingTimer.Interval = TimeSpan.FromMilliseconds( 50 );
_closingTimer.Tick += ( s, e ) =>
{
if( _manager.AutoHideWindow.IsWin32MouseOver
|| ( ( LayoutAnchorable )_manager.AutoHideWindow.Model ).IsActive
|| _manager.AutoHideWindow.IsResizing )
return;
this.StopClosingTimer();
this.StartCloseTimer();
};
}

private void StartClosingTimer()
{
_closingTimer.Start();
}

private void StopClosingTimer()
{
_closingTimer.Stop();
}

private void SetupCloseTimer()
{
_closeTimer = new DispatcherTimer( DispatcherPriority.Background );
_closeTimer.Interval = TimeSpan.FromMilliseconds( 1500 );
_closeTimer.Interval = TimeSpan.FromMilliseconds( _manager.AutoHideWindowClosingTimer );
_closeTimer.Tick += ( s, e ) =>
{
if( _manager.AutoHideWindow.IsWin32MouseOver ||
( ( LayoutAnchorable )_manager.AutoHideWindow.Model ).IsActive ||
_manager.AutoHideWindow.IsResizing )
if( _manager.AutoHideWindow.IsWin32MouseOver
|| ( ( LayoutAnchorable )_manager.AutoHideWindow.Model ).IsActive
|| _manager.AutoHideWindow.IsResizing )
{
_closeTimer.Stop();
this.StartClosingTimer();
return;
}
StopCloseTimer();
this.StopCloseTimer();
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
using Xceed.Wpf.AvalonDock.Layout;
using System.Windows.Media;
using System.Windows.Threading;
using System.Reflection;

namespace Xceed.Wpf.AvalonDock.Controls
{
Expand Down Expand Up @@ -56,7 +57,40 @@ internal static void SetupFocusManagement( DockingManager manager )
_windowHandler.Attach();

if( Application.Current != null )
Application.Current.Exit += new ExitEventHandler( Current_Exit );
{
var currentDispatcher = Application.Current.Dispatcher;
if( currentDispatcher != null )
{
if( currentDispatcher.CheckAccess() )
{
Application.Current.Exit += new ExitEventHandler( Current_Exit );
}
else
{
var disableProcessingCountFieldInfo = typeof( Dispatcher ).GetField( "_disableProcessingCount", BindingFlags.Instance | BindingFlags.NonPublic );
if( disableProcessingCountFieldInfo != null )
{
var disableProcessingCountFieldInfoValue = disableProcessingCountFieldInfo.GetValue( currentDispatcher );
if( ( disableProcessingCountFieldInfoValue != null ) && ( disableProcessingCountFieldInfoValue is int ) )
{
var action = new Action( () => Application.Current.Exit += new ExitEventHandler( Current_Exit ) );

if( ( int )disableProcessingCountFieldInfoValue == 0 )
{
// in sync
currentDispatcher.Invoke( DispatcherPriority.Normal, action );
}
else
{
// in async.
currentDispatcher.BeginInvoke( DispatcherPriority.Normal, action );
}
}
}
}
}

}
}

manager.PreviewGotKeyboardFocus += new KeyboardFocusChangedEventHandler( manager_PreviewGotKeyboardFocus );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -331,26 +331,50 @@ protected override void InitDefaultCommands()
base.InitDefaultCommands();
}

protected override void ClearDefaultCommands()
{
_defaultHideCommand = null;
_defaultAutoHideCommand = null;
_defaultDockCommand = null;

base.ClearDefaultCommands();
}

protected override void ClearDefaultBindings()
{
if( HideCommand == _defaultHideCommand )
if( this.HideCommand == _defaultHideCommand )
{
BindingOperations.ClearBinding( this, HideCommandProperty );
if( AutoHideCommand == _defaultAutoHideCommand )
this.HideCommand = null;
}
if( this.AutoHideCommand == _defaultAutoHideCommand )
{
BindingOperations.ClearBinding( this, AutoHideCommandProperty );
if( DockCommand == _defaultDockCommand )
this.AutoHideCommand = null;
}
if( this.DockCommand == _defaultDockCommand )
{
BindingOperations.ClearBinding( this, DockCommandProperty );
this.DockCommand = null;
}

base.ClearDefaultBindings();
}

protected override void SetDefaultBindings()
{
if( HideCommand == null )
if( this.HideCommand == null )
{
this.SetCurrentValue( LayoutAnchorableItem.HideCommandProperty, _defaultHideCommand );
if( AutoHideCommand == null )
}
if( this.AutoHideCommand == null )
{
this.SetCurrentValue( LayoutAnchorableItem.AutoHideCommandProperty, _defaultAutoHideCommand );
if( DockCommand == null )
}
if( this.DockCommand == null )
{
this.SetCurrentValue( LayoutAnchorableItem.DockCommandProperty, _defaultDockCommand );
}

this.SetCurrentValue( LayoutAnchorableItem.VisibilityProperty, _anchorable.IsVisible ? Visibility.Visible : System.Windows.Visibility.Hidden );
base.SetDefaultBindings();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ protected override void OnVisibilityChanged()





internal override void Attach( LayoutContent model )
{
_document = model as LayoutDocument;
Expand Down

0 comments on commit a20eb81

Please sign in to comment.