Index: Core/Common/src/Core.Common.Gui/Forms/MainWindow/MainWindow.xaml.cs
===================================================================
diff -u -ra5e4ebcce8619e8154972b937bfde6495ade4836 -r72408e2d8ef5bb38ad16ee9c6ec9c3b8607fe54e
--- Core/Common/src/Core.Common.Gui/Forms/MainWindow/MainWindow.xaml.cs (.../MainWindow.xaml.cs) (revision a5e4ebcce8619e8154972b937bfde6495ade4836)
+++ Core/Common/src/Core.Common.Gui/Forms/MainWindow/MainWindow.xaml.cs (.../MainWindow.xaml.cs) (revision 72408e2d8ef5bb38ad16ee9c6ec9c3b8607fe54e)
@@ -46,11 +46,6 @@
public partial class MainWindow : IMainWindow, IDisposable, ISynchronizeInvoke
{
///
- /// Remember last active contextual tab per view.
- ///
- private readonly IDictionary lastActiveContextTabNamePerViewType = new Dictionary();
-
- ///
/// Class to help with hybrid winforms - WPF applications. Provides UI handle to
/// ensure common UI functionality such as maximizing works as expected.
///
@@ -66,18 +61,6 @@
private IEnumerable ribbonCommandHandlers;
- ///
- /// This is used when user selects non-contextual tab explicitly. Then we won't
- /// activate contextual tab on the next view activation.
- ///
- private bool activateContextualTab;
-
- ///
- /// Used when contextual tab was activated and we switch back to view which does
- /// not support contextual tabs.
- ///
- private string lastNonContextualTab;
-
private IGui gui;
///
@@ -201,8 +184,6 @@
if (viewController?.ViewHost != null)
{
viewController.ViewHost.ViewClosed += OnViewClosed;
- viewController.ViewHost.ActiveDocumentViewChanged += OnActiveDocumentViewChanged;
- viewController.ViewHost.ActiveDocumentViewChanging += OnActiveDocumentViewChanging;
}
}
@@ -214,8 +195,6 @@
if (viewController?.ViewHost != null)
{
viewController.ViewHost.ViewClosed -= OnViewClosed;
- viewController.ViewHost.ActiveDocumentViewChanged -= OnActiveDocumentViewChanged;
- viewController.ViewHost.ActiveDocumentViewChanging -= OnActiveDocumentViewChanging;
}
}
@@ -319,37 +298,6 @@
SetGui(null);
}
- private void OnActiveDocumentViewChanging(object sender, EventArgs e)
- {
- if (Ribbon.SelectedTabItem != null && !Ribbon.SelectedTabItem.IsContextual)
- {
- lastNonContextualTab = Ribbon.SelectedTabItem.Header.ToString();
- }
-
- // remember active contextual tab per view type, when view is activated back - activate contextual item
- IView activeDocumentView = viewController.ViewHost.ActiveDocumentView;
- if (Ribbon.SelectedTabItem != null && activeDocumentView != null)
- {
- if (Ribbon.SelectedTabItem.IsContextual)
- {
- lastActiveContextTabNamePerViewType[activeDocumentView.GetType()] = Ribbon.SelectedTabItem.Header.ToString();
- activateContextualTab = true;
- }
- else
- {
- // user has clicked on non-contextual tab before switching active view
- if (lastActiveContextTabNamePerViewType.ContainsKey(activeDocumentView.GetType()))
- {
- activateContextualTab = false;
- }
- }
- }
- else
- {
- activateContextualTab = true;
- }
- }
-
private void OnViewClosed(object sender, ViewChangeEventArgs e)
{
if (ReferenceEquals(e.View, propertyGrid))
@@ -363,35 +311,6 @@
}
}
- private void OnActiveDocumentViewChanged(object sender, EventArgs e)
- {
- // activate contextual tab which was active for this view type
- IView activeDocumentView = viewController.ViewHost.ActiveDocumentView;
- if (activateContextualTab && Ribbon.SelectedTabItem != null && activeDocumentView != null
- && Ribbon.Tabs.Any(t => t.IsContextual && t.Visibility == Visibility.Visible))
- {
- string lastActiveTabForActiveDocumentView;
- if (lastActiveContextTabNamePerViewType.TryGetValue(activeDocumentView.GetType(), out lastActiveTabForActiveDocumentView))
- {
- RibbonTabItem tab = Ribbon.Tabs.First(t => t.Header.ToString() == lastActiveTabForActiveDocumentView);
- if (tab.IsVisible)
- {
- Ribbon.SelectedTabItem = tab;
- }
- }
- else // activate first contextual group tab
- {
- RibbonTabItem tab = Ribbon.Tabs.FirstOrDefault(t => t.IsContextual && t.Visibility == Visibility.Visible);
- Ribbon.SelectedTabItem = tab;
- }
- }
- else if (!string.IsNullOrEmpty(lastNonContextualTab)) // reactivate last non-contextual tab
- {
- RibbonTabItem tab = Ribbon.Tabs.First(t => t.Header.ToString() == lastNonContextualTab);
- Ribbon.SelectedTabItem = tab;
- }
- }
-
private void UpdateToolWindowButtonState()
{
if (viewController.ViewHost != null)