Skip to content

Commit 9b7c63e

Browse files
committed
Refactor post-grab action input gesture handling
Removed InputGestureText from ButtonInfo and related tests. Input gestures for post-grab actions are now set dynamically in FullscreenGrab.
1 parent e8a4b09 commit 9b7c63e

File tree

4 files changed

+9
-30
lines changed

4 files changed

+9
-30
lines changed

Tests/PostGrabActionManagerTests.cs

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -71,20 +71,6 @@ public void GetDefaultPostGrabActions_AllMarkedForFullscreenGrab()
7171
});
7272
}
7373

74-
[Fact]
75-
public void GetDefaultPostGrabActions_AllHaveInputGestureText()
76-
{
77-
// Arrange & Act
78-
List<ButtonInfo> actions = PostGrabActionManager.GetDefaultPostGrabActions();
79-
80-
// Assert
81-
Assert.All(actions, action =>
82-
{
83-
Assert.False(string.IsNullOrEmpty(action.InputGestureText));
84-
Assert.StartsWith("CTRL +", action.InputGestureText);
85-
});
86-
}
87-
8874
[Fact]
8975
public async Task ExecutePostGrabAction_CorrectGuid_TransformsText()
9076
{

Text-Grab/Models/ButtonInfo.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ public class ButtonInfo
2727
public bool IsRelevantForFullscreenGrab { get; set; } = false;
2828
public bool IsRelevantForEditWindow { get; set; } = true; // Default to true for backward compatibility
2929
public DefaultCheckState DefaultCheckState { get; set; } = DefaultCheckState.Off;
30-
public string InputGestureText { get; set; } = "";
3130

3231
public ButtonInfo()
3332
{
@@ -82,7 +81,7 @@ public ButtonInfo(string buttonText, string symbolText, string background, strin
8281
}
8382

8483
// Constructor for post-grab actions
85-
public ButtonInfo(string buttonText, string clickEvent, SymbolRegular symbolIcon, DefaultCheckState defaultCheckState, string inputGestureText = "")
84+
public ButtonInfo(string buttonText, string clickEvent, SymbolRegular symbolIcon, DefaultCheckState defaultCheckState)
8685
{
8786
ButtonText = buttonText;
8887
ClickEvent = clickEvent;
@@ -91,7 +90,6 @@ public ButtonInfo(string buttonText, string clickEvent, SymbolRegular symbolIcon
9190
IsRelevantForFullscreenGrab = true;
9291
IsRelevantForEditWindow = false;
9392
DefaultCheckState = defaultCheckState;
94-
InputGestureText = inputGestureText;
9593
}
9694

9795
public static List<ButtonInfo> DefaultButtonList { get; set; } =

Text-Grab/Utilities/PostGrabActionManager.cs

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,7 @@ public static List<ButtonInfo> GetDefaultPostGrabActions()
4444
buttonText: "Fix GUIDs",
4545
clickEvent: "CorrectGuid_Click",
4646
symbolIcon: SymbolRegular.Braces24,
47-
defaultCheckState: DefaultCheckState.Off,
48-
inputGestureText: "CTRL + 1"
47+
defaultCheckState: DefaultCheckState.Off
4948
)
5049
{
5150
OrderNumber = 6.1
@@ -54,8 +53,7 @@ public static List<ButtonInfo> GetDefaultPostGrabActions()
5453
buttonText: "Trim each line",
5554
clickEvent: "TrimEachLine_Click",
5655
symbolIcon: SymbolRegular.TextCollapse24,
57-
defaultCheckState: DefaultCheckState.Off,
58-
inputGestureText: "CTRL + 2"
56+
defaultCheckState: DefaultCheckState.Off
5957
)
6058
{
6159
OrderNumber = 6.2
@@ -64,8 +62,7 @@ public static List<ButtonInfo> GetDefaultPostGrabActions()
6462
buttonText: "Remove duplicate lines",
6563
clickEvent: "RemoveDuplicateLines_Click",
6664
symbolIcon: SymbolRegular.MultiselectLtr24,
67-
defaultCheckState: DefaultCheckState.Off,
68-
inputGestureText: "CTRL + 3"
65+
defaultCheckState: DefaultCheckState.Off
6966
)
7067
{
7168
OrderNumber = 6.3
@@ -74,8 +71,7 @@ public static List<ButtonInfo> GetDefaultPostGrabActions()
7471
buttonText: "Web Search",
7572
clickEvent: "WebSearch_Click",
7673
symbolIcon: SymbolRegular.GlobeSearch24,
77-
defaultCheckState: DefaultCheckState.Off,
78-
inputGestureText: "CTRL + 4"
74+
defaultCheckState: DefaultCheckState.Off
7975
)
8076
{
8177
OrderNumber = 6.4
@@ -84,8 +80,7 @@ public static List<ButtonInfo> GetDefaultPostGrabActions()
8480
buttonText: "Try to insert text",
8581
clickEvent: "Insert_Click",
8682
symbolIcon: SymbolRegular.ClipboardTaskAdd24,
87-
defaultCheckState: DefaultCheckState.Off,
88-
inputGestureText: "CTRL + 5"
83+
defaultCheckState: DefaultCheckState.Off
8984
)
9085
{
9186
OrderNumber = 6.5
@@ -94,8 +89,7 @@ public static List<ButtonInfo> GetDefaultPostGrabActions()
9489
buttonText: "Translate to system language",
9590
clickEvent: "Translate_Click",
9691
symbolIcon: SymbolRegular.LocalLanguage24,
97-
defaultCheckState: DefaultCheckState.Off,
98-
inputGestureText: "CTRL + 6"
92+
defaultCheckState: DefaultCheckState.Off
9993
)
10094
{
10195
OrderNumber = 6.6

Text-Grab/Views/FullscreenGrab.xaml.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,8 @@ private void LoadDynamicPostGrabActions()
279279
IsCheckable = true,
280280
Tag = action,
281281
IsChecked = PostGrabActionManager.GetCheckState(action),
282-
StaysOpenOnClick = stayOpen
282+
StaysOpenOnClick = stayOpen,
283+
InputGestureText = $"Ctrl+{index}"
283284
};
284285

285286
// Wire up click handler

0 commit comments

Comments
 (0)