Skip to content

Commit c532e96

Browse files
committed
Enhance Post Grab Actions button feedback and Freeze tool logic
Improve visual feedback for NextStepDropDownButton by updating background and foreground colors based on selection and hover state, including icon color. Always show Freeze button in GrabFrame unless image is static.
1 parent 1defbb2 commit c532e96

3 files changed

Lines changed: 45 additions & 12 deletions

File tree

Text-Grab/Views/FullscreenGrab.xaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,9 +273,12 @@
273273
Height="34"
274274
Margin="2,0"
275275
IsDefault="True"
276+
MouseEnter="NextStepDropDownButton_MouseEnter"
277+
MouseLeave="NextStepDropDownButton_MouseLeave"
278+
Style="{StaticResource SymbolDropDownButton}"
276279
ToolTip="Actions to perform after grabbing text...">
277280
<wpfui:DropDownButton.Icon>
278-
<wpfui:SymbolIcon Symbol="FlashFlow24" />
281+
<wpfui:SymbolIcon x:Name="NextStepSymbolIcon" Symbol="FlashFlow24" />
279282
</wpfui:DropDownButton.Icon>
280283
<wpfui:DropDownButton.Flyout>
281284
<ContextMenu

Text-Grab/Views/FullscreenGrab.xaml.cs

Lines changed: 38 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -301,21 +301,37 @@ internal static Dictionary<string, bool> BuildPostGrabActionSnapshot(
301301

302302
private void CheckIfAnyPostActionsSelected()
303303
{
304-
if (NextStepDropDownButton.Flyout is not ContextMenu flyoutMenu || !flyoutMenu.HasItems)
305-
return;
304+
bool hasCheckedAction = false;
306305

307-
foreach (MenuItem item in GetActionablePostGrabMenuItems(flyoutMenu))
306+
if (NextStepDropDownButton.Flyout is ContextMenu flyoutMenu && flyoutMenu.HasItems)
308307
{
309-
if (item.IsChecked)
308+
foreach (MenuItem item in GetActionablePostGrabMenuItems(flyoutMenu))
310309
{
311-
if (FindResource("DarkTeal") is SolidColorBrush tealButtonStyle)
312-
NextStepDropDownButton.Background = tealButtonStyle;
313-
return;
310+
if (item.IsChecked)
311+
{
312+
hasCheckedAction = true;
313+
break;
314+
}
314315
}
315316
}
316317

317-
if (FindResource("ControlFillColorDefaultBrush") is SolidColorBrush SymbolButtonStyle)
318-
NextStepDropDownButton.Background = SymbolButtonStyle;
318+
if (hasCheckedAction)
319+
{
320+
if (FindResource("DarkTeal") is SolidColorBrush tealButtonStyle)
321+
NextStepDropDownButton.Background = tealButtonStyle;
322+
NextStepDropDownButton.Foreground = Brushes.White;
323+
NextStepSymbolIcon.Foreground = Brushes.White;
324+
}
325+
else
326+
{
327+
if (FindResource("ControlFillColorDefaultBrush") is SolidColorBrush symbolButtonStyle)
328+
NextStepDropDownButton.Background = symbolButtonStyle;
329+
if (FindResource("TextFillColorPrimaryBrush") is SolidColorBrush textBrush)
330+
{
331+
NextStepDropDownButton.Foreground = textBrush;
332+
NextStepSymbolIcon.Foreground = textBrush;
333+
}
334+
}
319335
}
320336

321337
private static bool CheckIfCheckingOrUnchecking(object? sender)
@@ -535,6 +551,19 @@ private void FreezeMenuItem_Click(object? sender = null, RoutedEventArgs? e = nu
535551
WindowUtilities.FullscreenKeyDown(Key.F, isActive);
536552
}
537553

554+
private void NextStepDropDownButton_MouseEnter(object sender, MouseEventArgs e)
555+
{
556+
// Background fill on hover comes from the SymbolDropDownButton style; only the
557+
// icon/chevron foreground needs to be forced white here to stay legible on it.
558+
NextStepDropDownButton.Foreground = Brushes.White;
559+
NextStepSymbolIcon.Foreground = Brushes.White;
560+
}
561+
562+
private void NextStepDropDownButton_MouseLeave(object sender, MouseEventArgs e)
563+
{
564+
CheckIfAnyPostActionsSelected();
565+
}
566+
538567
private async void FreezeUnfreeze(bool Activate)
539568
{
540569
if (FreezeMenuItem.IsChecked is true)

Text-Grab/Views/GrabFrame.xaml.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2974,8 +2974,9 @@ private void ApplyBottomBarToolVisibility()
29742974
// Refresh / OCR Frame buttons swap based on Auto OCR state; that helper honors the hide preference.
29752975
SetRefreshOrOcrFrameBtnVis();
29762976

2977-
// Freeze is only offered when a live (non-static, non-frozen) frame is showing.
2978-
SetToolButtonVisibility(FreezeToggleButton, "Freeze", !isStaticImageSource && !IsFreezeMode);
2977+
// Freeze doubles as Unfreeze while frozen, so it must stay available in both
2978+
// states — only a static (already-frozen) image source makes it irrelevant.
2979+
SetToolButtonVisibility(FreezeToggleButton, "Freeze", !isStaticImageSource);
29792980

29802981
SetToolButtonVisibility(TranslateToggleButton, "Translate", translateToolAvailable);
29812982

0 commit comments

Comments
 (0)