From 890c9c00b836f7d4ff4cfdee060e058a46fb87e5 Mon Sep 17 00:00:00 2001 From: haven1433 Date: Fri, 4 Nov 2022 08:51:42 -0500 Subject: [PATCH] add focus box when switching tabs to help the user see which part of the screen they should focus on --- src/HexManiac.Core/ViewModels/ViewPort.cs | 6 +++++- src/HexManiac.WPF/Controls/MapTab.xaml.cs | 3 +++ src/HexManiac.WPF/Controls/TabView.xaml | 4 ++-- src/HexManiac.WPF/Controls/TabView.xaml.cs | 15 +++++++++++++++ src/HexManiac.WPF/Windows/MainWindow.xaml | 3 ++- src/HexManiac.WPF/Windows/MainWindow.xaml.cs | 5 +++++ 6 files changed, 32 insertions(+), 4 deletions(-) diff --git a/src/HexManiac.Core/ViewModels/ViewPort.cs b/src/HexManiac.Core/ViewModels/ViewPort.cs index 92f7261e..1c6b18a4 100644 --- a/src/HexManiac.Core/ViewModels/ViewPort.cs +++ b/src/HexManiac.Core/ViewModels/ViewPort.cs @@ -240,7 +240,10 @@ namespace HavenSoft.HexManiac.Core.ViewModels { args = new TabChangeRequestedEventArgs(this); RequestTabChange?.Invoke(mapper, args); - if (args.RequestAccepted) selection.SetJumpBackTab(mapper); + if (args.RequestAccepted) { + selection.SetJumpBackTab(mapper); + FocusToolPanel.Raise(this); + } }); }, TaskContinuationOptions.ExecuteSynchronously); } @@ -919,6 +922,7 @@ namespace HavenSoft.HexManiac.Core.ViewModels { public event EventHandler RequestTabChange; public event EventHandler RequestDelayedWork; public event EventHandler RequestMenuClose; + public event EventHandler FocusToolPanel; #pragma warning restore 0067 public Shortcuts Shortcuts { get; } diff --git a/src/HexManiac.WPF/Controls/MapTab.xaml.cs b/src/HexManiac.WPF/Controls/MapTab.xaml.cs index 034381f9..ba4a1415 100644 --- a/src/HexManiac.WPF/Controls/MapTab.xaml.cs +++ b/src/HexManiac.WPF/Controls/MapTab.xaml.cs @@ -13,6 +13,8 @@ namespace HavenSoft.HexManiac.WPF.Controls { private MapEditorViewModel ViewModel => (MapEditorViewModel)DataContext; private new ToolTip ToolTip => (ToolTip)base.ToolTip; + public event EventHandler FocusElement; + public MapTab() { InitializeComponent(); DataContextChanged += UpdateDataContext; @@ -158,6 +160,7 @@ namespace HavenSoft.HexManiac.WPF.Controls { private void ButtonLeave(object sender, MouseEventArgs e) { UpdateTooltipContent(NoTooltip); + if (ViewModel == null) return; ViewModel.ShowHighlightCursor = false; } diff --git a/src/HexManiac.WPF/Controls/TabView.xaml b/src/HexManiac.WPF/Controls/TabView.xaml index 7be92011..17074dc1 100644 --- a/src/HexManiac.WPF/Controls/TabView.xaml +++ b/src/HexManiac.WPF/Controls/TabView.xaml @@ -138,7 +138,7 @@ - +