[MouseJump]Reduce winforms dependency, thumbnail size settings, shortcut keys(#25487)

* [Mouse Jump] - reorganise existing NativeMethods (#25482)

* Mouse Jump] - reorganise Helper classes / main form code (#25482)

* Mouse Jump] - replace use of System.Windows.Forms.Screen with Native Methods (#25482)

* Mouse Jump] - replace use of System.Windows.Forms.SystemInformation with Native Methods (#25482)

* [Mouse Jump] - replace use of System.Windows.Forms.Cursor with Native Methods (#25482)

* [Mouse Jump] - improve popup responsiveness (#25484)

* [Mouse Jump] - fixed spellchecker errors (#25484)

* [Mouse Jump] - add settings card for thumbnail size (#24564)

* [Mouse Jump] - shortcut keys to jump to centres of screens (#25069)

* [Mouse Jump] - fix spelling (#25069)

* [Mouse Jump] - fix spelling - numpad (#25069)

* [Mouse Jump] - updated "thumbnail size" settings text (#24564)
This commit is contained in:
Michael Clayton
2023-04-24 16:15:07 +01:00
committed by GitHub
parent 467fcfee2d
commit fda75e48d5
75 changed files with 2336 additions and 588 deletions

View File

@@ -11,9 +11,13 @@ namespace Microsoft.PowerToys.Settings.UI.Library
[JsonPropertyName("activation_shortcut")]
public HotkeySettings ActivationShortcut { get; set; }
[JsonPropertyName("thumbnail_size")]
public MouseJumpThumbnailSize ThumbnailSize { get; set; }
public MouseJumpProperties()
{
ActivationShortcut = new HotkeySettings(true, false, false, true, 0x44);
ThumbnailSize = new MouseJumpThumbnailSize();
}
}
}

View File

@@ -0,0 +1,68 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using System.Text.Json.Serialization;
namespace Microsoft.PowerToys.Settings.UI.Library
{
public class MouseJumpThumbnailSize : INotifyPropertyChanged
{
private int _width;
private int _height;
[JsonPropertyName("width")]
public int Width
{
get
{
return _width;
}
set
{
var newWidth = Math.Max(0, value);
if (newWidth != _width)
{
_width = newWidth;
OnPropertyChanged();
}
}
}
[JsonPropertyName("height")]
public int Height
{
get
{
return _height;
}
set
{
var newHeight = Math.Max(0, value);
if (newHeight != _height)
{
_height = newHeight;
OnPropertyChanged();
}
}
}
public MouseJumpThumbnailSize()
{
Width = 1600;
Height = 1200;
}
public event PropertyChangedEventHandler PropertyChanged;
public void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
}

View File

@@ -3158,4 +3158,21 @@ Activate by holding the key for the character you want to add an accent to, then
<data name="PastePlain_ShortcutWarning.Title" xml:space="preserve">
<value>Using this shortcut may prevent non-text paste actions (e.g. images, files) or built-in paste plain text actions in other applications from functioning.</value>
</data>
<data name="MouseUtils_MouseJump_ThumbnailSize.Header" xml:space="preserve">
<value>Thumbnail Size</value>
</data>
<data name="MouseUtils_MouseJump_ThumbnailSize_Description_Prefix.Text" xml:space="preserve">
<value>Constrain thumbnail image size to a maximum of</value>
</data>
<data name="MouseUtils_MouseJump_ThumbnailSize_Description_Suffix.Text" xml:space="preserve">
<value>pixels</value>
</data>
<data name="MouseUtils_MouseJump_ThumbnailSize_Edit_Height.Header" xml:space="preserve">
<value>Maximum height (px)</value>
<comment>px = pixels</comment>
</data>
<data name="MouseUtils_MouseJump_ThumbnailSize_Edit_Width.Header" xml:space="preserve">
<value>Maximum width (px)</value>
<comment>px = pixels</comment>
</data>
</root>

View File

@@ -3,6 +3,7 @@
// See the LICENSE file in the project root for more information.
using System;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using global::PowerToys.GPOWrapper;
using Microsoft.PowerToys.Settings.UI.Library;
@@ -86,6 +87,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
}
MouseJumpSettingsConfig = mouseJumpSettingsRepository.SettingsConfig;
MouseJumpSettingsConfig.Properties.ThumbnailSize.PropertyChanged += MouseJumpThumbnailSizePropertyChanged;
if (mousePointerCrosshairsSettingsRepository == null)
{
@@ -599,6 +601,29 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
}
}
public MouseJumpThumbnailSize MouseJumpThumbnailSize
{
get
{
return MouseJumpSettingsConfig.Properties.ThumbnailSize;
}
set
{
if ((MouseJumpSettingsConfig.Properties.ThumbnailSize.Width != value?.Width)
&& (MouseJumpSettingsConfig.Properties.ThumbnailSize.Height != value?.Height))
{
MouseJumpSettingsConfig.Properties.ThumbnailSize = value;
NotifyMouseJumpPropertyChanged();
}
}
}
public void MouseJumpThumbnailSizePropertyChanged(object sender, PropertyChangedEventArgs e)
{
NotifyMouseJumpPropertyChanged(nameof(MouseJumpThumbnailSize));
}
public void NotifyMouseJumpPropertyChanged([CallerMemberName] string propertyName = null)
{
OnPropertyChanged(propertyName);

View File

@@ -229,6 +229,81 @@
MinWidth="{StaticResource SettingActionControlMinWidth}"
HotkeySettings="{x:Bind Path=ViewModel.MouseJumpActivationShortcut, Mode=TwoWay}" />
</labs:SettingsCard>
<labs:SettingsCard
x:Uid="MouseUtils_MouseJump_ThumbnailSize"
HeaderIcon="{ui:FontIcon FontFamily={StaticResource SymbolThemeFontFamily}, Glyph=&#xE740;}"
IsEnabled="{x:Bind ViewModel.IsMouseJumpEnabled, Mode=OneWay}">
<labs:SettingsCard.Description>
<StackPanel
Grid.Row="1"
Grid.Column="1"
Margin="0,4,0,0"
Orientation="Horizontal">
<TextBlock
x:Uid="MouseUtils_MouseJump_ThumbnailSize_Description_Prefix"
Margin="0,0,4,0"
Style="{ThemeResource SecondaryTextStyle}" />
<TextBlock
Margin="0,0,4,0"
FontWeight="SemiBold"
Style="{ThemeResource SecondaryTextStyle}"
Text="{x:Bind ViewModel.MouseJumpThumbnailSize.Width, Mode=OneWay}" />
<TextBlock
Margin="0,5,4,0"
AutomationProperties.AccessibilityView="Raw"
FontFamily="{ThemeResource SymbolThemeFontFamily}"
FontSize="10"
Foreground="{ThemeResource SystemBaseMediumColor}"
Style="{ThemeResource SecondaryTextStyle}"
Text="&#xE947;" />
<TextBlock
Margin="0,0,4,0"
FontWeight="SemiBold"
Style="{ThemeResource SecondaryTextStyle}"
Text="{x:Bind ViewModel.MouseJumpThumbnailSize.Height, Mode=OneWay}" />
<TextBlock
x:Uid="MouseUtils_MouseJump_ThumbnailSize_Description_Suffix"
Margin="0,0,4,0"
Foreground="{ThemeResource SystemBaseMediumColor}"
Style="{ThemeResource SecondaryTextStyle}" />
</StackPanel>
</labs:SettingsCard.Description>
<StackPanel
Grid.Column="2"
HorizontalAlignment="Right"
Orientation="Horizontal"
Spacing="8">
<Button
x:Uid="EditButton"
Width="40"
Height="36"
Content="&#xE70F;"
FontFamily="{ThemeResource SymbolThemeFontFamily}"
Style="{StaticResource SubtleButtonStyle}">
<ToolTipService.ToolTip>
<TextBlock x:Uid="EditTooltip" />
</ToolTipService.ToolTip>
<Button.Flyout>
<Flyout x:Uid="MouseJumpThumbnailSize_Edit">
<StackPanel Margin="0,12,0,0" Spacing="16">
<NumberBox
x:Uid="MouseUtils_MouseJump_ThumbnailSize_Edit_Width"
Width="140"
Minimum="160"
SpinButtonPlacementMode="Compact"
Value="{x:Bind ViewModel.MouseJumpThumbnailSize.Width, Mode=TwoWay}" />
<NumberBox
x:Uid="MouseUtils_MouseJump_ThumbnailSize_Edit_Height"
Width="140"
Minimum="120"
SpinButtonPlacementMode="Compact"
Value="{x:Bind ViewModel.MouseJumpThumbnailSize.Height, Mode=TwoWay}" />
</StackPanel>
</Flyout>
</Button.Flyout>
</Button>
</StackPanel>
</labs:SettingsCard>
</controls:SettingsGroup>
<controls:SettingsGroup x:Uid="MouseUtils_MousePointerCrosshairs">