Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v4.7 #504

Merged
merged 52 commits into from
Dec 21, 2024
Merged

v4.7 #504

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
5670628
update package
TheJoeFin Nov 14, 2024
4c01fdd
Merge branch 'dev' of https://github.com/TheJoeFin/Text-Grab into dev
TheJoeFin Nov 14, 2024
50baa87
Update packages
TheJoeFin Nov 21, 2024
b882750
Add initial idea of post capture actions
TheJoeFin Nov 21, 2024
1dba41b
Add Bing search as a post action
TheJoeFin Nov 21, 2024
c4c5fbe
Add ctrl shortcut to ETW bottom bar buttons
TheJoeFin Nov 28, 2024
0f05fe2
try a slightly different Per Monitor DPI tweak
TheJoeFin Sep 5, 2024
0344601
Scale down screens to make sure the window is actually intersecting them
TheJoeFin Sep 5, 2024
ee3d8ca
update packages
TheJoeFin Sep 17, 2024
8ac85ca
Update code formatting
TheJoeFin Sep 19, 2024
2bd5c45
Code style
TheJoeFin Sep 19, 2024
93f7adb
Update packages and WinSDK Package version
TheJoeFin Oct 14, 2024
4a2ab96
Update packages
TheJoeFin Oct 28, 2024
8eceb00
Add split after command in ETW
TheJoeFin Oct 28, 2024
93a438a
Add GUID correction method
TheJoeFin Oct 28, 2024
b783b35
Add web search actions
TheJoeFin Nov 8, 2024
092129a
Add web searches to bottom bar options
TheJoeFin Nov 8, 2024
a76869e
Initial work on basic word count
TheJoeFin Nov 8, 2024
0840154
Add back in using windows forms because it was never really removed
TheJoeFin Nov 12, 2024
c15fbca
Add Search GitHub button
TheJoeFin Nov 12, 2024
fa5ba1d
Update version
TheJoeFin Nov 12, 2024
9bc4def
update package
TheJoeFin Nov 14, 2024
4985c6b
Update packages
TheJoeFin Nov 21, 2024
f0d62ab
Add initial idea of post capture actions
TheJoeFin Nov 21, 2024
73c644d
Add Bing search as a post action
TheJoeFin Nov 21, 2024
917f055
Add ctrl shortcut to ETW bottom bar buttons
TheJoeFin Nov 28, 2024
9f0bd3e
Merge branch 'post-grab-actions' of https://github.com/TheJoeFin/Text…
TheJoeFin Dec 1, 2024
eaaad2e
Use ctrl + num to enable post grab actions
TheJoeFin Dec 1, 2024
d618630
Catch IndexOutOfRangeEx when picking word bound
TheJoeFin Dec 2, 2024
436edea
Add more post capture actions
TheJoeFin Dec 2, 2024
c9acdb4
Add Google and Duck Duck Go to Post action search
TheJoeFin Dec 3, 2024
43f2767
Make websearches a single line before searching
TheJoeFin Dec 3, 2024
1012e3c
Merge pull request #498 from TheJoeFin/post-grab-actions
TheJoeFin Dec 3, 2024
25b1330
Search history on QSL
TheJoeFin Dec 4, 2024
55d37c7
Add Grab Frames to QSL Searches too
TheJoeFin Dec 4, 2024
0a6ccfa
Better saving experinece
TheJoeFin Dec 10, 2024
84e3f87
Add icons to QSL to signify what the item is
TheJoeFin Dec 11, 2024
0d4c300
change icon of items to copy
TheJoeFin Dec 13, 2024
e0dae86
Add setting for search history
TheJoeFin Dec 14, 2024
3909ba0
Deleting history item deletes it
TheJoeFin Dec 14, 2024
7d5024a
Fix deleting and editing lookp values
TheJoeFin Dec 14, 2024
31bc59a
Add all text content at once and set the item source once
TheJoeFin Dec 14, 2024
1c311d0
Add a right click to QSL
TheJoeFin Dec 16, 2024
e05bdaa
Rename Lookup items to start uppercase
TheJoeFin Dec 19, 2024
0a2b7c4
Merge pull request #503 from TheJoeFin/search-history-from-qsl
TheJoeFin Dec 19, 2024
23fb0e2
code style cleanup
TheJoeFin Dec 20, 2024
f4fa5b7
Add web search Url model as a dynamic way to add new search providers
TheJoeFin Dec 20, 2024
f859c11
Default web search working on ETW
TheJoeFin Dec 20, 2024
8d8672e
Add default search to ButtonInfo and FSG
TheJoeFin Dec 20, 2024
f36b08d
Set default searcher in General settings
TheJoeFin Dec 20, 2024
b6484ed
Update versions to 4.7
TheJoeFin Dec 20, 2024
79e4212
Update packages
TheJoeFin Dec 20, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Tests/Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageReference Include="xunit" Version="2.9.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="3.0.0-pre.42">
<PackageReference Include="xunit.runner.visualstudio" Version="3.0.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down
2 changes: 1 addition & 1 deletion Text-Grab-Package/Package.appxmanifest
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<Identity
Name="40087JoeFinApps.TextGrab"
Publisher="CN=153F3B0F-BA3D-4964-8098-71AC78A1DF6A"
Version="4.6.0.0" />
Version="4.7.0.0" />

<Properties>
<DisplayName>Text Grab</DisplayName>
Expand Down
5 changes: 5 additions & 0 deletions Text-Grab-Package/Text-Grab-Package.wapproj
Original file line number Diff line number Diff line change
Expand Up @@ -161,5 +161,10 @@
<SkipGetTargetFrameworkProperties>True</SkipGetTargetFrameworkProperties>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<PackageReference Include="System.Net.Http" Version="4.3.4" />
<PackageReference Include="System.Private.Uri" Version="4.3.2" />
<PackageReference Include="System.Text.RegularExpressions" Version="4.3.1" />
</ItemGroup>
<Import Project="$(WapProjPath)\Microsoft.DesktopBridge.targets" />
</Project>
9 changes: 9 additions & 0 deletions Text-Grab/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,15 @@
<setting name="GrabFrameScrollBehavior" serializeAs="String">
<value>Resize</value>
</setting>
<setting name="LookupSearchHistory" serializeAs="String">
<value>True</value>
</setting>
<setting name="DefaultWebSearch" serializeAs="String">
<value />
</setting>
<setting name="WebSearchItemsJson" serializeAs="String">
<value />
</setting>
</Text_Grab.Properties.Settings>
</userSettings>
</configuration>
6 changes: 4 additions & 2 deletions Text-Grab/Controls/BottomBarSettings.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@
Margin="0,0,8,0"
d:Symbol="Diamond24"
FontSize="24"
Symbol="{Binding Path=SymbolIcon, Mode=TwoWay}" />
Symbol="{Binding Path=SymbolIcon,
Mode=TwoWay}" />
</Viewbox>
</DataTemplate>
</GridViewColumn.CellTemplate>
Expand Down Expand Up @@ -173,7 +174,8 @@
Margin="0,0,8,0"
d:Symbol="Diamond24"
FontSize="24"
Symbol="{Binding Path=SymbolIcon, Mode=TwoWay}" />
Symbol="{Binding Path=SymbolIcon,
Mode=TwoWay}" />
</Viewbox>
</DataTemplate>
</GridViewColumn.CellTemplate>
Expand Down
11 changes: 8 additions & 3 deletions Text-Grab/Controls/CollapsibleButton.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,28 @@
<ui:SymbolIcon
Margin="12,2"
d:Symbol="Diamond24"
Symbol="{Binding Path=ButtonSymbol, Mode=TwoWay, ElementName=CollapsibleButtonUserControl}" />
Symbol="{Binding Path=ButtonSymbol,
Mode=TwoWay,
ElementName=CollapsibleButtonUserControl}" />

<TextBlock
x:Name="ButtonTextBlock"
Grid.Column="1"
Margin="0,0,12,0"
VerticalAlignment="Center"
d:Text="Design Text"
Text="{Binding ElementName=CollapsibleButtonUserControl, Path=ButtonText, Mode=TwoWay}" />
Text="{Binding ElementName=CollapsibleButtonUserControl,
Path=ButtonText,
Mode=TwoWay}" />
</Grid>
<Button.ContextMenu>
<ContextMenu>
<MenuItem
Name="ChangeButtonLayout"
Click="ChangeButtonLayout_Click"
Header="Change Style"
IsEnabled="{Binding ElementName=CollapsibleButtonUserControl, Path=CanChangeStyle}" />
IsEnabled="{Binding ElementName=CollapsibleButtonUserControl,
Path=CanChangeStyle}" />
</ContextMenu>
</Button.ContextMenu>
</Button>
28 changes: 2 additions & 26 deletions Text-Grab/Models/ButtonInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -200,33 +200,9 @@ public ButtonInfo(string buttonText, string symbolText, string background, strin
new()
{
OrderNumber = 1.7,
ButtonText = "Google...",
ButtonText = "Web Search",
SymbolText = "",
Command = "GoogleSearchCmd",
SymbolIcon = SymbolRegular.GlobeSearch24
},
new()
{
OrderNumber = 1.8,
ButtonText = "Bing...",
SymbolText = "",
Command = "BingSearchCmd",
SymbolIcon = SymbolRegular.GlobeSearch24
},
new()
{
OrderNumber = 1.9,
ButtonText = "Duck Duck Go...",
SymbolText = "",
Command = "DuckDuckGoSearchCmd",
SymbolIcon = SymbolRegular.GlobeSearch24
},
new()
{
OrderNumber = 1.91,
ButtonText = "Search GitHub...",
SymbolText = "",
Command = "GitHubSearchCmd",
Command = "DefaultWebSearchCmd",
SymbolIcon = SymbolRegular.GlobeSearch24
},
new()
Expand Down
63 changes: 55 additions & 8 deletions Text-Grab/Models/LookupItem.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,37 @@
using System;
using Humanizer;
using System;

namespace Text_Grab.Models;

public enum LookupItemKind
{
Simple = 0,
EditWindow = 1,
GrabFrame = 2,
Link = 3,
}

public class LookupItem : IEquatable<LookupItem>
{
public string shortValue { get; set; } = string.Empty;
public string longValue { get; set; } = string.Empty;
public string ShortValue { get; set; } = string.Empty;
public string LongValue { get; set; } = string.Empty;

public Wpf.Ui.Controls.SymbolRegular UiSymbol
{
get
{
return Kind switch
{
LookupItemKind.Simple => Wpf.Ui.Controls.SymbolRegular.Copy20,
LookupItemKind.EditWindow => Wpf.Ui.Controls.SymbolRegular.Window24,
LookupItemKind.GrabFrame => Wpf.Ui.Controls.SymbolRegular.PanelBottom20,
LookupItemKind.Link => Wpf.Ui.Controls.SymbolRegular.Link24,
_ => Wpf.Ui.Controls.SymbolRegular.Copy20,
};
}
}

public LookupItemKind Kind { get; set; } = LookupItemKind.Simple;

public LookupItem()
{
Expand All @@ -14,13 +40,34 @@ public LookupItem()

public LookupItem(string sv, string lv)
{
shortValue = sv;
longValue = lv;
ShortValue = sv;
LongValue = lv;
}

public override string ToString() => $"{shortValue} {longValue}";
public LookupItem(HistoryInfo historyInfo)
{
ShortValue = historyInfo.CaptureDateTime.Humanize() + Environment.NewLine + historyInfo.CaptureDateTime.ToString("F");
LongValue = historyInfo.TextContent.Length > 100 ? historyInfo.TextContent[..100].Trim() + "…" : historyInfo.TextContent.Trim();

HistoryItem = historyInfo;

if (string.IsNullOrEmpty(historyInfo.ImagePath))
Kind = LookupItemKind.EditWindow;
else
Kind = LookupItemKind.GrabFrame;
}

public HistoryInfo? HistoryItem { get; set; }

public override string ToString()
{
if (HistoryItem is not null)
return $"{HistoryItem.CaptureDateTime:F} {HistoryItem.TextContent}";

return $"{ShortValue} {LongValue}";
}

public string ToCSVString() => $"{shortValue},{longValue}";
public string ToCSVString() => $"{ShortValue},{LongValue}";

public bool Equals(LookupItem? other)
{
Expand All @@ -32,4 +79,4 @@ public bool Equals(LookupItem? other)

return false;
}
}
}
98 changes: 98 additions & 0 deletions Text-Grab/Models/WebSearchUrlModel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
using Text_Grab.Utilities;

namespace Text_Grab.Models;

public record WebSearchUrlModel
{
public string Name { get; set; } = string.Empty;
public string Url { get; set; } = string.Empty;

private WebSearchUrlModel? defaultSearcher;

public WebSearchUrlModel DefaultSearcher
{
get
{
defaultSearcher ??= GetDefaultSearcher();
return defaultSearcher;
}
set
{
defaultSearcher = value;
SaveDefaultSearcher(defaultSearcher);
}
}

public override string ToString() => Name;

private List<WebSearchUrlModel> webSearchers = [];

public List<WebSearchUrlModel> WebSearchers
{
get
{
if (webSearchers.Count == 0)
webSearchers = GetWebSearchUrls();

return webSearchers;
}
set
{
webSearchers = value;
SaveWebSearchUrls(webSearchers);
}
}

private WebSearchUrlModel GetDefaultSearcher()
{
string searcherName = AppUtilities.TextGrabSettings.DefaultWebSearch;
if (string.IsNullOrWhiteSpace(searcherName))
return WebSearchers[0];

WebSearchUrlModel? searcher = WebSearchers
.FirstOrDefault(searcher => searcher.Name == searcherName);

return searcher ?? WebSearchers[0];
}

private void SaveDefaultSearcher(WebSearchUrlModel webSearchUrl)
{
AppUtilities.TextGrabSettings.DefaultWebSearch = webSearchUrl.Name;
AppUtilities.TextGrabSettings.Save();
}

private static List<WebSearchUrlModel> GetDefaultWebSearchUrls()
{
return
[
new() { Name = "Google", Url = "https://www.google.com/search?q=" },
new() { Name = "Bing", Url = "https://www.bing.com/search?q=" },
new() { Name = "DuckDuckGo", Url = "https://duckduckgo.com/?q=" },
new() { Name = "Brave", Url = "https://search.brave.com/search?q=" },
new() { Name = "GitHub Code", Url = "https://github.com/search?type=code&q=" },
new() { Name = "GitHub Repos", Url = "https://github.com/search?type=repositories&q=" },
];
}

public static List<WebSearchUrlModel> GetWebSearchUrls()
{
string json = AppUtilities.TextGrabSettings.WebSearchItemsJson;
if (string.IsNullOrWhiteSpace(json))
return GetDefaultWebSearchUrls();
List<WebSearchUrlModel>? webSearchUrls = JsonSerializer.Deserialize<List<WebSearchUrlModel>>(json);
if (webSearchUrls is null || webSearchUrls.Count == 0)
return GetDefaultWebSearchUrls();

return webSearchUrls;
}

public static void SaveWebSearchUrls(List<WebSearchUrlModel> webSearchUrls)
{
string json = JsonSerializer.Serialize(webSearchUrls);
AppUtilities.TextGrabSettings.WebSearchItemsJson = json;
AppUtilities.TextGrabSettings.Save();
}
}
21 changes: 20 additions & 1 deletion Text-Grab/Pages/GeneralSettings.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Text_Grab.Pages"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:models="clr-namespace:Text_Grab.Models"
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
Title="GeneralSettings"
d:DesignHeight="1450"
Expand All @@ -27,7 +28,7 @@
x:Name="VersionTextblock"
VerticalAlignment="Center"
Style="{StaticResource TextBodyNormal}"
Text="Version 4.6.0" />
Text="Version 4.7.0" />

<ui:HyperlinkButton
x:Name="OpenExeFolderButton"
Expand Down Expand Up @@ -212,6 +213,24 @@
Disabling may speed up results
</TextBlock>

<TextBlock
Margin="0,16,0,4"
FontSize="16"
Style="{StaticResource TextHeader}"
Text="Web Search Options" />
<ComboBox
x:Name="WebSearchersComboBox"
Width="300"
HorizontalAlignment="Left"
IsTextSearchCaseSensitive="False"
SelectionChanged="WebSearchersComboBox_SelectionChanged">
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding}" />
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>

<TextBlock
Margin="0,16,0,4"
FontSize="16"
Expand Down
Loading
Loading