Mouse Utils - Mouse Highlighter (#14496)

* New PowerToys template

* Add CppWinRt to empty PowerToy

* Add Settings reference to empty PowerToy

* Use proper output dir

* Proper WindowsTargetPlatformVersion

* Add filters to vcxproj

* Proper resource file generation

* Add MouseHighlighter proof of concept code

* Abstract implementation into a struct

* Enable module

* Disable module

* Add enable module to settings page

* Can change the hotkey in settings

* Remove remaining boilerplate code

* Add logging

* Add telemetry

* Add Oobe entry

* Add installer instructions

* Add dll to pipelines

* fix spellchecker

* Add more configurability

* Make settings a bit prettier

* Fix spellchecker

* Fix wrong default fade timers

* Fix user facing strings

* Tweak default duration values

* Fix to appear in every virtual desktop

* [Mouse Highlighter] Show highlight on mouse drag (#14529)

* [Mouse Highlighter]show pointer on mouse drag

* fix spellchecker

* [MU] UI tweaks (#14544)

* UI tweaks

* Update Resources.resw

* Updated text strings

* fix spellcheck

Co-authored-by: Laute <Niels.Laute@philips.com>

* tweak default values

* PR feedback: use wstring_view

* PR feedback: Log error on json error

* PR feedback: don't throw 1

* PR feedback: fix copy-pasta leftColor->rightColor

* PR feedback:Add another error message on exception

* PR feedback: add todo to use commons/utils/json.h

Co-authored-by: Niels Laute <niels.laute@live.nl>
Co-authored-by: Laute <Niels.Laute@philips.com>
This commit is contained in:
Jaime Bernardo
2021-11-22 13:31:31 +00:00
committed by GitHub
parent 0dae5d0402
commit 2d5276f742
36 changed files with 1726 additions and 50 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

@@ -237,8 +237,11 @@
<Content Include="Assets\FluentIcons\FluentIconsAwake.png" />
<Content Include="Assets\FluentIcons\FluentIconsFancyZones.png" />
<Content Include="Assets\FluentIcons\FluentIconsFileExplorerPreview.png" />
<Content Include="Assets\FluentIcons\FluentIconsFindMyMouse.png" />
<Content Include="Assets\FluentIcons\FluentIconsImageResizer.png" />
<Content Include="Assets\FluentIcons\FluentIconsKeyboardManager.png" />
<Content Include="Assets\FluentIcons\FluentIconsMouseHighlighter.png" />
<Content Include="Assets\FluentIcons\FluentIconsMouseHighlighter.png" />
<Content Include="Assets\FluentIcons\FluentIconsMouseUtils.png" />
<Content Include="Assets\FluentIcons\FluentIconsPowerRename.png" />
<Content Include="Assets\FluentIcons\FluentIconsPowerToys.png" />

View File

@@ -18,6 +18,10 @@
Style="{ThemeResource OobeSubtitleStyle}" />
<toolkitcontrols:MarkdownTextBlock Background="Transparent" x:Uid="Oobe_MouseUtils_FindMyMouse_Description" />
<TextBlock x:Uid="Oobe_MouseUtils_MouseHighlighter"
Style="{ThemeResource OobeSubtitleStyle}" />
<toolkitcontrols:MarkdownTextBlock Background="Transparent" x:Uid="Oobe_MouseUtils_MouseHighlighter_Description" />
<StackPanel Orientation="Horizontal" Spacing="12" Margin="0,24,0,0">
<Button x:Uid="OOBE_Settings"
Click="SettingsLaunchButton_Click"/>

View File

@@ -655,11 +655,11 @@
<value>Shows a help overlay with Windows shortcuts.</value>
</data>
<data name="ShortcutGuide_PressTime.Header" xml:space="preserve">
<value>Press duration before showing (ms)</value>
<value>Press duration before showing</value>
<comment>pressing a key in milliseconds</comment>
</data>
<data name="ShortcutGuide_PressTime.Description" xml:space="preserve">
<value>How long to press the Windows key to activate the module</value>
<value>How long to press the Windows key to activate the module (in ms)</value>
</data>
<data name="ShortcutGuide_ActivationMethod.Header" xml:space="preserve">
<value>Activation method</value>
@@ -1247,7 +1247,7 @@ Made with 💗 by Microsoft and the PowerToys community.</value>
<value>Activation shortcut</value>
</data>
<data name="Activation_Shortcut.Description" xml:space="preserve">
<value>Customize the keyboard shortcut to activate this module</value>
<value>Customize the shortcut to activate this module</value>
</data>
<data name="Oobe_GetStarted.Text" xml:space="preserve">
<value>Let's get started!</value>
@@ -1627,9 +1627,17 @@ From there, simply click on a Markdown file, PDF file or SVG icon in the File Ex
<comment>Mouse as in the hardware peripheral</comment>
</data>
<data name="Oobe_MouseUtils_FindMyMouse_Description.Text" xml:space="preserve">
<value>Click twice on the Left Control key to focus on your mouse.</value>
<value>Press the left Ctrl key twice to focus the mouse pointer.</value>
<comment>Mouse as in the hardware peripheral. Key as in a keyboard key</comment>
</data>
<data name="Oobe_MouseUtils_MouseHighlighter.Text" xml:space="preserve">
<value>Mouse Highlighter</value>
<comment>Mouse as in the hardware peripheral.</comment>
</data>
<data name="Oobe_MouseUtils_MouseHighlighter_Description.Text" xml:space="preserve">
<value>Use a keyboard shortcut highlight left and right mouse clicks.</value>
<comment>Mouse as in the hardware peripheral.</comment>
</data>
<data name="Launch_Run.Content" xml:space="preserve">
<value>Launch PowerToys Run</value>
</data>
@@ -1709,18 +1717,67 @@ From there, simply click on a Markdown file, PDF file or SVG icon in the File Ex
<data name="MouseUtils.ModuleDescription" xml:space="preserve">
<value>A collection of mouse utilities.</value>
</data>
<data name="MouseUtils_FindMyMouse.Header" xml:space="preserve">
<value>Find My Mouse</value>
<comment>Refers to the utility name</comment>
</data>
<data name="MouseUtils_Enable_FindMyMouse.Header" xml:space="preserve">
<value>Enable Find My Mouse</value>
<comment>"Find My Mouse" is the name of the utility.</comment>
</data>
<data name="MouseUtils_Enable_FindMyMouse.Description" xml:space="preserve">
<value>Press the Left Control key twice to focus the mouse pointer.</value>
<comment>"Left Control" is a keyboard key.</comment>
<data name="MouseUtils_FindMyMouse_Description.Text" xml:space="preserve">
<value>Find My Mouse highlights the position of the cursor when pressing the left Ctrl key twice.</value>
<comment>"Ctrl" is a keyboard key. "Find My Mouse" is the name of the utility</comment>
</data>
<data name="MouseUtils_Prevent_Activation_On_Game_Mode.Content" xml:space="preserve">
<value>Do not activate when Game Mode is on</value>
<comment>"Game mode" is the Windows feature to prevent notification when playing a game.</comment>
</data>
<data name="MouseUtils_MouseHighlighter.Header" xml:space="preserve">
<value>Mouse Highlighter</value>
<comment>Refers to the utility name</comment>
</data>
<data name="MouseUtils_Enable_MouseHighlighter.Header" xml:space="preserve">
<value>Enable Mouse Highlighter</value>
<comment>"Find My Mouse" is the name of the utility.</comment>
</data>
<data name="MouseUtils_MouseHighlighter_Description.Text" xml:space="preserve">
<value>Mouse Highlighter mode will highlight mouse clicks.</value>
<comment>"Mouse Highlighter" is the name of the utility. Mouse is the hardware mouse.</comment>
</data>
<data name="MouseUtils_MouseHighlighter_ActivationShortcut.Header" xml:space="preserve">
<value>Activation shortcut</value>
</data>
<data name="MouseUtils_MouseHighlighter_ActivationShortcut.Description" xml:space="preserve">
<value>Customize the shortcut to turn on or off this mode</value>
<comment>"Mouse Highlighter" is the name of the utility. Mouse is the hardware mouse.</comment>
</data>
<data name="MouseUtils_MouseHighlighter_LeftButtonClickColor.Header" xml:space="preserve">
<value>Left button highlight color</value>
</data>
<data name="MouseUtils_MouseHighlighter_RightButtonClickColor.Header" xml:space="preserve">
<value>Right button highlight color</value>
</data>
<data name="MouseUtils_MouseHighlighter_HighlightOpacity.Header" xml:space="preserve">
<value>Opacity</value>
</data>
<data name="MouseUtils_MouseHighlighter_HighlightRadius.Header" xml:space="preserve">
<value>Radius</value>
</data>
<data name="MouseUtils_MouseHighlighter_FadeDelayMs.Header" xml:space="preserve">
<value>Fade delay</value>
</data>
<data name="MouseUtils_MouseHighlighter_FadeDelayMs.Description" xml:space="preserve">
<value>How long it takes before a highlight starts to disappear (in ms)</value>
</data>
<data name="MouseUtils_MouseHighlighter_FadeDurationMs.Header" xml:space="preserve">
<value>Fade duration</value>
</data>
<data name="MouseUtils_MouseHighlighter_FadeDurationMs.Description" xml:space="preserve">
<value>Duration of the disappear animation (in ms)</value>
</data>
<data name="FancyZones_Radio_Custom_Colors.Content" xml:space="preserve">
<value>Custom colors</value>
</data>

View File

@@ -13,22 +13,117 @@
ModuleImageSource="ms-appx:///Assets/Modules/MouseUtils.png">
<controls:SettingsPageControl.ModuleContent>
<StackPanel Orientation="Vertical">
<controls:SettingsGroup x:Uid="MouseUtils_FindMyMouse">
<TextBlock x:Uid="MouseUtils_FindMyMouse_Description" Margin="0,0,0,8" Foreground="{ThemeResource TextFillColorSecondaryBrush}" />
<controls:SettingExpander IsExpanded="True">
<controls:SettingExpander.Header>
<controls:Setting x:Uid="MouseUtils_Enable_FindMyMouse">
<controls:Setting.Icon>
<BitmapIcon UriSource="ms-appx:///Assets/FluentIcons/FluentIconsFindMyMouse.png" ShowAsMonochrome="False" />
</controls:Setting.Icon>
<controls:Setting.ActionContent>
<ToggleSwitch IsOn="{x:Bind ViewModel.IsFindMyMouseEnabled, Mode=TwoWay}" HorizontalAlignment="Right"/>
</controls:Setting.ActionContent>
</controls:Setting>
</controls:SettingExpander.Header>
<controls:SettingExpander.Content>
<CheckBox x:Uid="MouseUtils_Prevent_Activation_On_Game_Mode"
IsChecked="{x:Bind ViewModel.FindMyMouseDoNotActivateOnGameMode, Mode=TwoWay}"
Margin="{StaticResource ExpanderSettingMargin}"
IsEnabled="{x:Bind ViewModel.IsFindMyMouseEnabled, Mode=OneWay}" />
</controls:SettingExpander.Content>
</controls:SettingExpander>
</controls:SettingsGroup>
<controls:SettingsGroup x:Uid="MouseUtils_MouseHighlighter">
<TextBlock x:Uid="MouseUtils_MouseHighlighter_Description" Margin="0,0,0,8" Foreground="{ThemeResource TextFillColorSecondaryBrush}" />
<controls:Setting x:Uid="MouseUtils_Enable_MouseHighlighter">
<controls:Setting.Icon>
<BitmapIcon UriSource="ms-appx:///Assets/FluentIcons/FluentIconsMouseHighlighter.png" ShowAsMonochrome="False" />
</controls:Setting.Icon>
<controls:Setting.ActionContent>
<ToggleSwitch IsOn="{x:Bind ViewModel.IsMouseHighlighterEnabled, Mode=TwoWay}" HorizontalAlignment="Right"/>
</controls:Setting.ActionContent>
</controls:Setting>
<controls:SettingExpander IsExpanded="True">
<controls:SettingExpander.Header>
<controls:Setting x:Uid="MouseUtils_Enable_FindMyMouse" Icon="&#xF272;">
<controls:Setting.ActionContent>
<ToggleSwitch IsOn="{x:Bind ViewModel.IsFindMyMouseEnabled, Mode=TwoWay}" HorizontalAlignment="Right"/>
</controls:Setting.ActionContent>
</controls:Setting>
</controls:SettingExpander.Header>
<controls:SettingExpander.Content>
<CheckBox x:Uid="MouseUtils_Prevent_Activation_On_Game_Mode"
IsChecked="{x:Bind Mode=TwoWay, Path=ViewModel.FindMyMouseDoNotActivateOnGameMode}"
Margin="{StaticResource ExpanderSettingMargin}"
IsEnabled="{x:Bind ViewModel.IsFindMyMouseEnabled, Mode=OneWay}" />
</controls:SettingExpander.Content>
</controls:SettingExpander>
<controls:Setting x:Uid="MouseUtils_MouseHighlighter_ActivationShortcut" Icon="&#xEDA7;" IsEnabled="{x:Bind ViewModel.IsMouseHighlighterEnabled, Mode=OneWay}">
<controls:Setting.ActionContent>
<controls:ShortcutControl HotkeySettings="{x:Bind Path=ViewModel.MouseHighlighterActivationShortcut, Mode=TwoWay}"
MinWidth="{StaticResource SettingActionControlMinWidth}"/>
</controls:Setting.ActionContent>
</controls:Setting>
<controls:SettingExpander IsEnabled="{x:Bind ViewModel.IsMouseHighlighterEnabled, Mode=OneWay}" IsExpanded="True" >
<controls:SettingExpander.Header>
<controls:Setting x:Uid="ShortcutGuide_Appearance_Behavior" Icon="&#xE790;" />
</controls:SettingExpander.Header>
<controls:SettingExpander.Content>
<StackPanel>
<controls:Setting x:Uid="MouseUtils_MouseHighlighter_LeftButtonClickColor" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsMouseHighlighterEnabled}" Style="{StaticResource ExpanderContentSettingStyle}">
<controls:Setting.ActionContent>
<controls:ColorPickerButton SelectedColor="{x:Bind Path=ViewModel.MouseHighlighterLeftButtonClickColor, Mode=TwoWay}" />
</controls:Setting.ActionContent>
</controls:Setting>
<controls:Setting x:Uid="MouseUtils_MouseHighlighter_RightButtonClickColor" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsMouseHighlighterEnabled}" Style="{StaticResource ExpanderContentSettingStyle}">
<controls:Setting.ActionContent>
<controls:ColorPickerButton SelectedColor="{x:Bind Path=ViewModel.MouseHighlighterRightButtonClickColor, Mode=TwoWay}" />
</controls:Setting.ActionContent>
</controls:Setting>
<controls:Setting x:Uid="MouseUtils_MouseHighlighter_HighlightOpacity" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsMouseHighlighterEnabled}" Style="{StaticResource ExpanderContentSettingStyle}">
<controls:Setting.ActionContent>
<Slider Minimum="0"
Maximum="255"
MinWidth="{StaticResource SettingActionControlMinWidth}"
Value="{x:Bind Mode=TwoWay, Path=ViewModel.MouseHighlighterOpacity}"
HorizontalAlignment="Right"/>
</controls:Setting.ActionContent>
</controls:Setting>
<controls:Setting x:Uid="MouseUtils_MouseHighlighter_HighlightRadius" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsMouseHighlighterEnabled}" Style="{StaticResource ExpanderContentSettingStyle}">
<controls:Setting.ActionContent>
<muxc:NumberBox Minimum="5"
Value="{x:Bind Mode=TwoWay, Path=ViewModel.MouseHighlighterRadius}"
MinWidth="{StaticResource SettingActionControlMinWidth}"
SpinButtonPlacementMode="Compact"
HorizontalAlignment="Left"
SmallChange="1"
LargeChange="10"/>
</controls:Setting.ActionContent>
</controls:Setting>
<controls:Setting x:Uid="MouseUtils_MouseHighlighter_FadeDelayMs" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsMouseHighlighterEnabled}" Style="{StaticResource ExpanderContentSettingStyle}">
<controls:Setting.ActionContent>
<muxc:NumberBox Minimum="100"
Value="{x:Bind Mode=TwoWay, Path=ViewModel.MouseHighlighterFadeDelayMs}"
MinWidth="{StaticResource SettingActionControlMinWidth}"
SpinButtonPlacementMode="Compact"
HorizontalAlignment="Left"
SmallChange="10"
LargeChange="100"/>
</controls:Setting.ActionContent>
</controls:Setting>
<controls:Setting x:Uid="MouseUtils_MouseHighlighter_FadeDurationMs" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsMouseHighlighterEnabled}" Style="{StaticResource ExpanderContentSettingStyle}">
<controls:Setting.ActionContent>
<muxc:NumberBox Minimum="100"
Value="{x:Bind Mode=TwoWay, Path=ViewModel.MouseHighlighterFadeDurationMs}"
MinWidth="{StaticResource SettingActionControlMinWidth}"
SpinButtonPlacementMode="Compact"
HorizontalAlignment="Left"
SmallChange="10"
LargeChange="100"/>
</controls:Setting.ActionContent>
</controls:Setting>
</StackPanel>
</controls:SettingExpander.Content>
</controls:SettingExpander>
</controls:SettingsGroup>
</StackPanel>
</controls:SettingsPageControl.ModuleContent>
<controls:SettingsPageControl.PrimaryLinks>

View File

@@ -15,7 +15,7 @@ namespace Microsoft.PowerToys.Settings.UI.Views
public MouseUtilsPage()
{
var settingsUtils = new SettingsUtils();
ViewModel = new MouseUtilsViewModel(settingsUtils, SettingsRepository<GeneralSettings>.GetInstance(settingsUtils), SettingsRepository<FindMyMouseSettings>.GetInstance(settingsUtils), ShellPage.SendDefaultIPCMessage);
ViewModel = new MouseUtilsViewModel(settingsUtils, SettingsRepository<GeneralSettings>.GetInstance(settingsUtils), SettingsRepository<FindMyMouseSettings>.GetInstance(settingsUtils), SettingsRepository<MouseHighlighterSettings>.GetInstance(settingsUtils), ShellPage.SendDefaultIPCMessage);
DataContext = ViewModel;
InitializeComponent();
}