Mouse Utils - Mouse Pointer Crosshair (#15633)

* Apply PowerToys template

* Add CppWinRt package

* Add Settings reference

* Use proper output dir

* Proper WindowsTargetPlatformVersion

* Add filters to vcxproj

* Proper resource file generation

* Remove boilerplate code

* Initial implementation of the mouse crosshair

* Add enable module to settings page

* Change hotkey in settings

* Add color, opacity, thickness settings

* Add telemetry

* Add Oobe entry

* Add installer instructions

* Add dll to pipelines

* Add crosshair borders

* Fix settings case

* Tweak defaults to make it look like the specs

* fix spellchecker

* Fix resources and binary info

* Correct composition tree comment typo

* Reduce argument copy

* Start disabled by default

* Add maximum to crosshair thickness and border size

* Set minimum border size of 0

* Fix comment

* Add maximum to radius

* Add comment for non-localizable strings

* Rename "Inclusive Mouse"-"Mouse Pointer Crosshair"
This commit is contained in:
Jaime Bernardo
2022-01-24 13:29:16 +00:00
committed by GitHub
parent 453bb613af
commit 2e8dfa73d2
27 changed files with 1622 additions and 4 deletions

View File

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

View File

@@ -1651,6 +1651,14 @@ From there, simply click on a Markdown file, PDF file or SVG icon in the File Ex
<value>Use a keyboard shortcut highlight left and right mouse clicks.</value>
<comment>Mouse as in the hardware peripheral.</comment>
</data>
<data name="Oobe_MouseUtils_MousePointerCrosshair.Text" xml:space="preserve">
<value>Mouse Pointer Crosshair</value>
<comment>Mouse as in the hardware peripheral.</comment>
</data>
<data name="Oobe_MouseUtils_MousePointerCrosshair_Description.Text" xml:space="preserve">
<value>Draw a crosshair centered around the mouse pointer.</value>
<comment>Mouse as in the hardware peripheral.</comment>
</data>
<data name="Launch_Run.Content" xml:space="preserve">
<value>Launch PowerToys Run</value>
</data>
@@ -1821,6 +1829,45 @@ From there, simply click on a Markdown file, PDF file or SVG icon in the File Ex
<value>Duration of the disappear animation (ms)</value>
<comment>ms = milliseconds</comment>
</data>
<data name="MouseUtils_MousePointerCrosshair.Header" xml:space="preserve">
<value>Mouse Pointer Crosshair</value>
<comment>Refers to the utility name</comment>
</data>
<data name="MouseUtils_MousePointerCrosshair.Description" xml:space="preserve">
<value>Mouse Pointer Crosshair draws a crosshair centered on the mouse pointer.</value>
<comment>"Mouse Pointer Crosshair" is the name of the utility. Mouse is the hardware mouse.</comment>
</data>
<data name="MouseUtils_Enable_MousePointerCrosshair.Header" xml:space="preserve">
<value>Enable Mouse Pointer Crosshair</value>
<comment>"Mouse Pointer Crosshair" is the name of the utility.</comment>
</data>
<data name="MouseUtils_MousePointerCrosshair_ActivationShortcut.Header" xml:space="preserve">
<value>Activation shortcut</value>
</data>
<data name="MouseUtils_MousePointerCrosshair_ActivationShortcut.Description" xml:space="preserve">
<value>Customize the shortcut to show/hide the crosshair</value>
</data>
<data name="MouseUtils_MousePointerCrosshair_CrosshairColor.Header" xml:space="preserve">
<value>Crosshair color</value>
</data>
<data name="MouseUtils_MousePointerCrosshair_CrosshairOpacity.Header" xml:space="preserve">
<value>Crosshair opacity (%)</value>
</data>
<data name="MouseUtils_MousePointerCrosshair_CrosshairRadius.Header" xml:space="preserve">
<value>Crosshair center radius (px)</value>
<comment>px = pixels</comment>
</data>
<data name="MouseUtils_MousePointerCrosshair_CrosshairThickness.Header" xml:space="preserve">
<value>Crosshair thickness (px)</value>
<comment>px = pixels</comment>
</data>
<data name="MouseUtils_MousePointerCrosshair_CrosshairBorderColor.Header" xml:space="preserve">
<value>Crosshair border color</value>
</data>
<data name="MouseUtils_MousePointerCrosshair_CrosshairBorderSize.Header" xml:space="preserve">
<value>Crosshair border size (px)</value>
<comment>px = pixels</comment>
</data>
<data name="FancyZones_Radio_Custom_Colors.Content" xml:space="preserve">
<value>Custom colors</value>
</data>

View File

@@ -175,7 +175,89 @@
</controls:SettingExpander.Content>
</controls:SettingExpander>
</controls:SettingsGroup>
<controls:SettingsGroup x:Uid="MouseUtils_MousePointerCrosshair">
<controls:Setting x:Uid="MouseUtils_Enable_MousePointerCrosshair" Icon="&#xE710;">
<!-- TODO: Uncomment once an icon is added.
<controls:Setting.Icon>
<BitmapIcon UriSource="ms-appx:///Assets/FluentIcons/FluentIconsMousePointerCrosshair.png" ShowAsMonochrome="False" />
</controls:Setting.Icon>
-->
<controls:Setting.ActionContent>
<ToggleSwitch IsOn="{x:Bind ViewModel.IsMousePointerCrosshairEnabled, Mode=TwoWay}" x:Uid="ToggleSwitch"/>
</controls:Setting.ActionContent>
</controls:Setting>
<controls:Setting x:Uid="MouseUtils_MousePointerCrosshair_ActivationShortcut" Icon="&#xEDA7;" IsEnabled="{x:Bind ViewModel.IsMousePointerCrosshairEnabled, Mode=OneWay}">
<controls:Setting.ActionContent>
<controls:ShortcutControl HotkeySettings="{x:Bind Path=ViewModel.MousePointerCrosshairActivationShortcut, Mode=TwoWay}"
MinWidth="{StaticResource SettingActionControlMinWidth}"/>
</controls:Setting.ActionContent>
</controls:Setting>
<controls:SettingExpander IsEnabled="{x:Bind ViewModel.IsMousePointerCrosshairEnabled, Mode=OneWay}" IsExpanded="False" >
<controls:SettingExpander.Header>
<controls:Setting x:Uid="ShortcutGuide_Appearance_Behavior" Icon="&#xE790;" />
</controls:SettingExpander.Header>
<controls:SettingExpander.Content>
<StackPanel>
<controls:Setting x:Uid="MouseUtils_MousePointerCrosshair_CrosshairColor" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsMousePointerCrosshairEnabled}" Style="{StaticResource ExpanderContentSettingStyle}">
<controls:Setting.ActionContent>
<controls:ColorPickerButton SelectedColor="{x:Bind Path=ViewModel.MousePointerCrosshairColor, Mode=TwoWay}" />
</controls:Setting.ActionContent>
</controls:Setting>
<controls:Setting x:Uid="MouseUtils_MousePointerCrosshair_CrosshairOpacity" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsMousePointerCrosshairEnabled}" Style="{StaticResource ExpanderContentSettingStyle}">
<controls:Setting.ActionContent>
<Slider Minimum="1"
Maximum="100"
MinWidth="{StaticResource SettingActionControlMinWidth}"
Value="{x:Bind Mode=TwoWay, Path=ViewModel.MousePointerCrosshairOpacity}"
HorizontalAlignment="Right"/>
</controls:Setting.ActionContent>
</controls:Setting>
<controls:Setting x:Uid="MouseUtils_MousePointerCrosshair_CrosshairRadius" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsMousePointerCrosshairEnabled}" Style="{StaticResource ExpanderContentSettingStyle}">
<controls:Setting.ActionContent>
<muxc:NumberBox Minimum="1"
Maximum="500"
Value="{x:Bind Mode=TwoWay, Path=ViewModel.MousePointerCrosshairRadius}"
MinWidth="{StaticResource SettingActionControlMinWidth}"
SpinButtonPlacementMode="Compact"
HorizontalAlignment="Left"
SmallChange="1"
LargeChange="10"/>
</controls:Setting.ActionContent>
</controls:Setting>
<controls:Setting x:Uid="MouseUtils_MousePointerCrosshair_CrosshairThickness" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsMousePointerCrosshairEnabled}" Style="{StaticResource ExpanderContentSettingStyle}">
<controls:Setting.ActionContent>
<muxc:NumberBox Minimum="1"
Maximum="50"
Value="{x:Bind Mode=TwoWay, Path=ViewModel.MousePointerCrosshairThickness}"
MinWidth="{StaticResource SettingActionControlMinWidth}"
SpinButtonPlacementMode="Compact"
HorizontalAlignment="Left"
SmallChange="1"
LargeChange="10"/>
</controls:Setting.ActionContent>
</controls:Setting>
<controls:Setting x:Uid="MouseUtils_MousePointerCrosshair_CrosshairBorderColor" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsMousePointerCrosshairEnabled}" Style="{StaticResource ExpanderContentSettingStyle}">
<controls:Setting.ActionContent>
<controls:ColorPickerButton SelectedColor="{x:Bind Path=ViewModel.MousePointerCrosshairBorderColor, Mode=TwoWay}" />
</controls:Setting.ActionContent>
</controls:Setting>
<controls:Setting x:Uid="MouseUtils_MousePointerCrosshair_CrosshairBorderSize" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsMousePointerCrosshairEnabled}" Style="{StaticResource ExpanderContentSettingStyle}">
<controls:Setting.ActionContent>
<muxc:NumberBox Minimum="0"
Maximum="50"
Value="{x:Bind Mode=TwoWay, Path=ViewModel.MousePointerCrosshairBorderSize}"
MinWidth="{StaticResource SettingActionControlMinWidth}"
SpinButtonPlacementMode="Compact"
HorizontalAlignment="Left"
SmallChange="1"
LargeChange="2"/>
</controls:Setting.ActionContent>
</controls:Setting>
</StackPanel>
</controls:SettingExpander.Content>
</controls:SettingExpander>
</controls:SettingsGroup>
</StackPanel>
</controls:SettingsPageControl.ModuleContent>
<controls:SettingsPageControl.PrimaryLinks>

View File

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