mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-07 19:57:07 +02:00
[Mouse Jump] Customisable appearance - borders, margins, colours, etc - final part (#35521)
* [MouseJump] move Mouse Jump settings into separate control (#27511) * [MouseJump] added Mouse Jump style controls to Settings UI (#27511) * [MouseJump] added Mouse Jump style controls to Settings UI (#27511) * [MouseJump] removing unused MouseJumpUI code (#27511) * [MouseJump] whitespace (#27511) * [MouseJump] fix spellcheck (#27511) * [MouseJump] enabled "Copy to custom style" (#27511) * [MouseJump] fixing build (internal members -> public) (#27511) * [MouseJump] remove unused "using"s (#27511) * [MouseJump] use custom styles in preview image (#27511) * [MouseJump] fixing failing test (#27511) * [MouseJump] fixing failing test (#27511) * [MouseJump] fixing failing test (#27511) * [MouseJump] fixing failing test (#27511) * [MouseJump] delinting to trigger a build (#27511) * [MouseJump] updated settings preview image ("browser" header) (#27511) * [MouseJump] upgrade default "custom" style settings in config (#27511) * [MouseJump] fixed a glitch in settings upgrade (#27511) * [MouseJump] fixed spell checker (#27511) * [MouseJump] typo in resource strings (image -> images) (#27511) * Remove unused include
This commit is contained in:
@@ -0,0 +1,69 @@
|
||||
// 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 Microsoft.UI.Xaml.Data;
|
||||
using MouseJump.Common.Models.Settings;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Converters
|
||||
{
|
||||
public sealed partial class MouseJumpPreviewTypeConverter : IValueConverter
|
||||
{
|
||||
private static readonly PreviewType[] PreviewTypeOrder =
|
||||
[
|
||||
PreviewType.Compact, PreviewType.Bezelled, PreviewType.Custom,
|
||||
];
|
||||
|
||||
private static readonly PreviewType DefaultPreviewType = PreviewType.Bezelled;
|
||||
|
||||
// Receives a string as a parameter and returns an int representing the index
|
||||
// to select in the Segmented control on the Mouse Jump settings page
|
||||
public object Convert(object value, Type targetType, object parameter, string language)
|
||||
{
|
||||
var previewType = MouseJumpPreviewTypeConverter.DefaultPreviewType;
|
||||
|
||||
if (value is not string previewTypeName)
|
||||
{
|
||||
// the value isn't a string so just use the default preview type
|
||||
}
|
||||
else if (Enum.IsDefined(typeof(PreviewType), previewTypeName))
|
||||
{
|
||||
// there's a case-sensitive match for the value
|
||||
previewType = Enum.Parse<PreviewType>(previewTypeName);
|
||||
}
|
||||
else if (Enum.TryParse<PreviewType>(previewTypeName, true, out var previewTypeResult))
|
||||
{
|
||||
// there's a case-insensitive match for the value
|
||||
previewType = previewTypeResult;
|
||||
}
|
||||
|
||||
return Array.IndexOf(
|
||||
MouseJumpPreviewTypeConverter.PreviewTypeOrder,
|
||||
previewType);
|
||||
}
|
||||
|
||||
// Receives an int as a parameter that represents the selected index in the Segmented
|
||||
// control on the Mouse Jump settings page, and returns the name of the PreviewType enum
|
||||
// for that index.
|
||||
public object ConvertBack(object value, Type targetType, object parameter, string language)
|
||||
{
|
||||
var previewType = MouseJumpPreviewTypeConverter.DefaultPreviewType;
|
||||
|
||||
if (value is not int segmentedIndex)
|
||||
{
|
||||
// the value isn't an int so just use the default preview type
|
||||
}
|
||||
else if ((segmentedIndex < 0) || (segmentedIndex > MouseJumpPreviewTypeConverter.PreviewTypeOrder.Length))
|
||||
{
|
||||
// not a valid selected index so just use the default preview type
|
||||
}
|
||||
else
|
||||
{
|
||||
previewType = MouseJumpPreviewTypeConverter.PreviewTypeOrder[segmentedIndex];
|
||||
}
|
||||
|
||||
return previewType.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
src/settings-ui/Settings.UI/Images/MouseJump-Desktop.png
Normal file
BIN
src/settings-ui/Settings.UI/Images/MouseJump-Desktop.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 27 KiB |
@@ -49,6 +49,11 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Images\MouseJump-Desktop.png" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="CommunityToolkit.WinUI.Controls.Segmented" />
|
||||
<PackageReference Include="CommunityToolkit.WinUI.Controls.SettingsControls" />
|
||||
<PackageReference Include="CommunityToolkit.WinUI.Controls.Primitives" />
|
||||
<PackageReference Include="CommunityToolkit.WinUI.Animations" />
|
||||
@@ -84,6 +89,7 @@
|
||||
<ProjectReference Include="..\..\common\interop\PowerToys.Interop.vcxproj" />
|
||||
<ProjectReference Include="..\..\common\ManagedCommon\ManagedCommon.csproj" />
|
||||
<ProjectReference Include="..\..\common\ManagedTelemetry\Telemetry\ManagedTelemetry.csproj" />
|
||||
<ProjectReference Include="..\..\modules\MouseUtils\MouseJump.Common\MouseJump.Common.csproj" />
|
||||
<ProjectReference Include="..\Settings.UI.Library\Settings.UI.Library.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -122,6 +128,9 @@
|
||||
<Page Update="SettingsXAML\OOBE\Views\OobeWorkspaces.xaml">
|
||||
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
|
||||
</Page>
|
||||
<Page Update="SettingsXAML\Panels\MouseJumpPanel.xaml">
|
||||
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
|
||||
</Page>
|
||||
<Page Update="SettingsXAML\Views\WorkspacesPage.xaml">
|
||||
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
|
||||
</Page>
|
||||
|
||||
@@ -0,0 +1,252 @@
|
||||
<UserControl
|
||||
x:Class="Microsoft.PowerToys.Settings.UI.Panels.MouseJumpPanel"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls"
|
||||
xmlns:converters="using:Microsoft.PowerToys.Settings.UI.Converters"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:tkcontrols="using:CommunityToolkit.WinUI.Controls"
|
||||
xmlns:tkconverters="using:CommunityToolkit.WinUI.Converters"
|
||||
xmlns:ui="using:CommunityToolkit.WinUI"
|
||||
AutomationProperties.LandmarkType="Main"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<UserControl.Resources>
|
||||
<ResourceDictionary>
|
||||
<converters:MouseJumpPreviewTypeConverter x:Key="MouseJumpPreviewTypeConverter" />
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="ms-appx:///CommunityToolkit.WinUI.Controls.Segmented/Segmented/Segmented.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</UserControl.Resources>
|
||||
|
||||
<controls:SettingsGroup x:Uid="MouseUtils_MouseJump">
|
||||
|
||||
<tkcontrols:SettingsCard
|
||||
x:Uid="MouseUtils_Enable_MouseJump"
|
||||
HeaderIcon="{ui:BitmapIcon Source=/Assets/Settings/Icons/MouseJump.png}"
|
||||
IsEnabled="{x:Bind ViewModel.IsJumpEnabledGpoConfigured, Mode=OneWay, Converter={StaticResource BoolNegationConverter}}">
|
||||
<ToggleSwitch x:Uid="ToggleSwitch" IsOn="{x:Bind ViewModel.IsMouseJumpEnabled, Mode=TwoWay}" />
|
||||
</tkcontrols:SettingsCard>
|
||||
|
||||
<InfoBar
|
||||
x:Uid="GPO_SettingIsManaged"
|
||||
IsClosable="False"
|
||||
IsOpen="{x:Bind ViewModel.IsJumpEnabledGpoConfigured, Mode=OneWay}"
|
||||
IsTabStop="{x:Bind ViewModel.IsJumpEnabledGpoConfigured, Mode=OneWay}"
|
||||
Severity="Informational" />
|
||||
|
||||
<tkcontrols:SettingsCard
|
||||
x:Uid="MouseUtils_MouseJump_ActivationShortcut"
|
||||
HeaderIcon="{ui:FontIcon Glyph=}"
|
||||
IsEnabled="{x:Bind ViewModel.IsMouseJumpEnabled, Mode=OneWay}">
|
||||
<controls:ShortcutControl MinWidth="{StaticResource SettingActionControlMinWidth}" HotkeySettings="{x:Bind Path=ViewModel.MouseJumpActivationShortcut, Mode=TwoWay}" />
|
||||
</tkcontrols:SettingsCard>
|
||||
|
||||
<tkcontrols:SettingsCard
|
||||
x:Name="MouseUtils_MouseJump_ThumbnailSize"
|
||||
x:Uid="MouseUtils_MouseJump_ThumbnailSize"
|
||||
HeaderIcon="{ui:FontIcon Glyph=}"
|
||||
IsEnabled="{x:Bind ViewModel.IsMouseJumpEnabled, Mode=OneWay}">
|
||||
<tkcontrols: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="" />
|
||||
<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>
|
||||
</tkcontrols:SettingsCard.Description>
|
||||
<StackPanel
|
||||
Grid.Column="2"
|
||||
HorizontalAlignment="Right"
|
||||
Orientation="Horizontal"
|
||||
Spacing="8">
|
||||
<Button
|
||||
x:Uid="EditButton"
|
||||
Width="40"
|
||||
Height="36"
|
||||
Content=""
|
||||
FontFamily="{ThemeResource SymbolThemeFontFamily}"
|
||||
Style="{StaticResource SubtleButtonStyle}">
|
||||
<ToolTipService.ToolTip>
|
||||
<TextBlock x:Uid="EditTooltip" />
|
||||
</ToolTipService.ToolTip>
|
||||
<Button.Flyout>
|
||||
<Flyout x:Uid="MouseJumpThumbnailSize_Edit" ShouldConstrainToRootBounds="False">
|
||||
<StackPanel 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>
|
||||
</tkcontrols:SettingsCard>
|
||||
|
||||
<tkcontrols:SettingsExpander
|
||||
x:Uid="MouseUtils_MouseJump_Appearance"
|
||||
HeaderIcon="{ui:FontIcon Glyph=}"
|
||||
IsEnabled="{x:Bind ViewModel.IsMouseJumpEnabled, Mode=OneWay}"
|
||||
IsExpanded="False">
|
||||
<tkcontrols:SettingsExpander.Items>
|
||||
<tkcontrols:SettingsCard
|
||||
x:Name="MouseUtils_MouseJump_PreviewImage"
|
||||
MinHeight="300"
|
||||
MaxHeight="300"
|
||||
Loaded="PreviewImage_Loaded">
|
||||
<Grid
|
||||
MinHeight="283"
|
||||
MaxHeight="283"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch">
|
||||
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
|
||||
<Image Source="{x:Bind Path=ViewModel.MouseJumpPreviewImage, Mode=OneWay}" Stretch="None" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</tkcontrols:SettingsCard>
|
||||
<tkcontrols:SettingsCard x:Name="MouseUtils_MouseJump_PreviewType" x:Uid="MouseUtils_MouseJump_PreviewType">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<tkcontrols:Segmented
|
||||
x:Name="PreviewTypeSetting"
|
||||
SelectedIndex="{x:Bind ViewModel.MouseJumpPreviewType, Mode=TwoWay, Converter={StaticResource MouseJumpPreviewTypeConverter}}"
|
||||
SelectionChanged="PreviewTypeSetting_SelectionChanged"
|
||||
SelectionMode="Single"
|
||||
Style="{StaticResource ButtonSegmentedStyle}">
|
||||
<tkcontrols:SegmentedItem>
|
||||
<TextBlock x:Uid="MouseUtils_MouseJump_PreviewType_Compact" />
|
||||
</tkcontrols:SegmentedItem>
|
||||
<tkcontrols:SegmentedItem>
|
||||
<TextBlock x:Uid="MouseUtils_MouseJump_PreviewType_Bezelled" />
|
||||
</tkcontrols:SegmentedItem>
|
||||
<tkcontrols:SegmentedItem>
|
||||
<TextBlock x:Uid="MouseUtils_MouseJump_PreviewType_Custom" />
|
||||
</tkcontrols:SegmentedItem>
|
||||
</tkcontrols:Segmented>
|
||||
<Button
|
||||
x:Name="CopyStyleToCustom"
|
||||
x:Uid="MouseUtils_MouseJump_CopyStyle"
|
||||
Margin="20,0,0,0"
|
||||
Click="CopyStyleToCustom_Click"
|
||||
IsEnabled="{Binding SelectedIndex, ElementName=PreviewTypeSetting}" />
|
||||
</StackPanel>
|
||||
</tkcontrols:SettingsCard>
|
||||
<tkcontrols:SettingsCard x:Name="MouseUtils_MouseJump_BackgroundColor1" x:Uid="MouseUtils_MouseJump_BackgroundColor1">
|
||||
<controls:ColorPickerButton SelectedColor="{x:Bind Path=ViewModel.MouseJumpBackgroundColor1, Mode=TwoWay}" />
|
||||
</tkcontrols:SettingsCard>
|
||||
<tkcontrols:SettingsCard x:Name="MouseUtils_MouseJump_BackgroundColor2" x:Uid="MouseUtils_MouseJump_BackgroundColor2">
|
||||
<controls:ColorPickerButton SelectedColor="{x:Bind Path=ViewModel.MouseJumpBackgroundColor2, Mode=TwoWay}" />
|
||||
</tkcontrols:SettingsCard>
|
||||
<tkcontrols:SettingsCard x:Name="MouseUtils_MouseJump_BorderThickness" x:Uid="MouseUtils_MouseJump_BorderThickness">
|
||||
<NumberBox
|
||||
MinWidth="{StaticResource SettingActionControlMinWidth}"
|
||||
LargeChange="1"
|
||||
Maximum="25"
|
||||
Minimum="0"
|
||||
SmallChange="1"
|
||||
SpinButtonPlacementMode="Compact"
|
||||
Value="{x:Bind ViewModel.MouseJumpBorderThickness, Mode=TwoWay}" />
|
||||
</tkcontrols:SettingsCard>
|
||||
<tkcontrols:SettingsCard x:Name="MouseUtils_MouseJump_BorderColor" x:Uid="MouseUtils_MouseJump_BorderColor">
|
||||
<controls:ColorPickerButton SelectedColor="{x:Bind Path=ViewModel.MouseJumpBorderColor, Mode=TwoWay}" />
|
||||
</tkcontrols:SettingsCard>
|
||||
<tkcontrols:SettingsCard x:Name="MouseUtils_MouseJump_Border3dDepth" x:Uid="MouseUtils_MouseJump_Border3dDepth">
|
||||
<NumberBox
|
||||
MinWidth="{StaticResource SettingActionControlMinWidth}"
|
||||
LargeChange="1"
|
||||
Maximum="25"
|
||||
Minimum="0"
|
||||
SmallChange="1"
|
||||
SpinButtonPlacementMode="Compact"
|
||||
Value="{x:Bind ViewModel.MouseJumpBorder3dDepth, Mode=TwoWay}" />
|
||||
</tkcontrols:SettingsCard>
|
||||
<tkcontrols:SettingsCard x:Name="MouseUtils_MouseJump_BorderPadding" x:Uid="MouseUtils_MouseJump_BorderPadding">
|
||||
<NumberBox
|
||||
MinWidth="{StaticResource SettingActionControlMinWidth}"
|
||||
LargeChange="1"
|
||||
Maximum="25"
|
||||
Minimum="0"
|
||||
SmallChange="1"
|
||||
SpinButtonPlacementMode="Compact"
|
||||
Value="{x:Bind ViewModel.MouseJumpBorderPadding, Mode=TwoWay}" />
|
||||
</tkcontrols:SettingsCard>
|
||||
<tkcontrols:SettingsCard x:Name="MouseUtils_MouseJump_BezelThickness" x:Uid="MouseUtils_MouseJump_BezelThickness">
|
||||
<NumberBox
|
||||
MinWidth="{StaticResource SettingActionControlMinWidth}"
|
||||
LargeChange="1"
|
||||
Maximum="25"
|
||||
Minimum="0"
|
||||
SmallChange="1"
|
||||
SpinButtonPlacementMode="Compact"
|
||||
Value="{x:Bind ViewModel.MouseJumpBezelThickness, Mode=TwoWay}" />
|
||||
</tkcontrols:SettingsCard>
|
||||
<tkcontrols:SettingsCard x:Name="MouseUtils_MouseJump_BezelColor" x:Uid="MouseUtils_MouseJump_BezelColor">
|
||||
<controls:ColorPickerButton SelectedColor="{x:Bind Path=ViewModel.MouseJumpBezelColor, Mode=TwoWay}" />
|
||||
</tkcontrols:SettingsCard>
|
||||
<tkcontrols:SettingsCard x:Name="MouseUtils_MouseJump_Bezel3dDepth" x:Uid="MouseUtils_MouseJump_Bezel3dDepth">
|
||||
<NumberBox
|
||||
MinWidth="{StaticResource SettingActionControlMinWidth}"
|
||||
LargeChange="1"
|
||||
Maximum="25"
|
||||
Minimum="0"
|
||||
SmallChange="1"
|
||||
SpinButtonPlacementMode="Compact"
|
||||
Value="{x:Bind ViewModel.MouseJumpBezel3dDepth, Mode=TwoWay}" />
|
||||
</tkcontrols:SettingsCard>
|
||||
<tkcontrols:SettingsCard x:Name="MouseUtils_MouseJump_ScreenMargin" x:Uid="MouseUtils_MouseJump_ScreenMargin">
|
||||
<NumberBox
|
||||
MinWidth="{StaticResource SettingActionControlMinWidth}"
|
||||
LargeChange="1"
|
||||
Maximum="25"
|
||||
Minimum="0"
|
||||
SmallChange="1"
|
||||
SpinButtonPlacementMode="Compact"
|
||||
Value="{x:Bind ViewModel.MouseJumpScreenMargin, Mode=TwoWay}" />
|
||||
</tkcontrols:SettingsCard>
|
||||
<tkcontrols:SettingsCard x:Name="MouseUtils_MouseJump_ScreenColor1" x:Uid="MouseUtils_MouseJump_ScreenColor1">
|
||||
<controls:ColorPickerButton SelectedColor="{x:Bind Path=ViewModel.MouseJumpScreenColor1, Mode=TwoWay}" />
|
||||
</tkcontrols:SettingsCard>
|
||||
<tkcontrols:SettingsCard x:Name="MouseUtils_MouseJump_ScreenColor2" x:Uid="MouseUtils_MouseJump_ScreenColor2">
|
||||
<controls:ColorPickerButton SelectedColor="{x:Bind Path=ViewModel.MouseJumpScreenColor2, Mode=TwoWay}" />
|
||||
</tkcontrols:SettingsCard>
|
||||
</tkcontrols:SettingsExpander.Items>
|
||||
</tkcontrols:SettingsExpander>
|
||||
</controls:SettingsGroup>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,159 @@
|
||||
// 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.Collections.Generic;
|
||||
using System.Linq;
|
||||
using CommunityToolkit.WinUI;
|
||||
using CommunityToolkit.WinUI.Controls;
|
||||
using Microsoft.PowerToys.Settings.UI.ViewModels;
|
||||
using Microsoft.UI.Xaml;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
using MouseJump.Common.Helpers;
|
||||
using MouseJump.Common.Models.Settings;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Panels
|
||||
{
|
||||
public sealed partial class MouseJumpPanel : UserControl
|
||||
{
|
||||
internal MouseUtilsViewModel ViewModel { get; set; }
|
||||
|
||||
public MouseJumpPanel()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void PreviewImage_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
bool TryFindFrameworkElement(SettingsCard settingsCard, string partName, out FrameworkElement result)
|
||||
{
|
||||
result = settingsCard.FindDescendants()
|
||||
.OfType<FrameworkElement>()
|
||||
.FirstOrDefault(
|
||||
x => x.Name == partName);
|
||||
return result is not null;
|
||||
}
|
||||
|
||||
/*
|
||||
apply a variation of the "Left" VisualState for SettingsCards
|
||||
to center the preview image in the true center of the card
|
||||
see https://github.com/CommunityToolkit/Windows/blob/9c7642ff35eaaa51a404f9bcd04b10c7cf851921/components/SettingsControls/src/SettingsCard/SettingsCard.xaml#L334-L347
|
||||
*/
|
||||
|
||||
var settingsCard = (SettingsCard)sender;
|
||||
|
||||
var partNames = new List<string>
|
||||
{
|
||||
"PART_HeaderIconPresenterHolder",
|
||||
"PART_DescriptionPresenter",
|
||||
"PART_HeaderPresenter",
|
||||
"PART_ActionIconPresenter",
|
||||
};
|
||||
foreach (var partName in partNames)
|
||||
{
|
||||
if (!TryFindFrameworkElement(settingsCard, partName, out var element))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
element.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
|
||||
if (TryFindFrameworkElement(settingsCard, "PART_ContentPresenter", out var content))
|
||||
{
|
||||
Grid.SetRow(content, 1);
|
||||
Grid.SetColumn(content, 1);
|
||||
content.HorizontalAlignment = HorizontalAlignment.Center;
|
||||
}
|
||||
}
|
||||
|
||||
private void PreviewTypeSetting_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
// hide or display controls based on whether the "Custom" preview type is selected
|
||||
var selectedPreviewType = this.GetSelectedPreviewType();
|
||||
var customPreviewTypeSelected = selectedPreviewType == PreviewType.Custom;
|
||||
this.CopyStyleToCustom.IsEnabled = !customPreviewTypeSelected;
|
||||
var customControlVisibility = customPreviewTypeSelected
|
||||
? Visibility.Visible
|
||||
: Visibility.Collapsed;
|
||||
this.MouseUtils_MouseJump_BackgroundColor1.Visibility = customControlVisibility;
|
||||
this.MouseUtils_MouseJump_BackgroundColor2.Visibility = customControlVisibility;
|
||||
this.MouseUtils_MouseJump_BorderThickness.Visibility = customControlVisibility;
|
||||
this.MouseUtils_MouseJump_BorderColor.Visibility = customControlVisibility;
|
||||
this.MouseUtils_MouseJump_Border3dDepth.Visibility = customControlVisibility;
|
||||
this.MouseUtils_MouseJump_BorderPadding.Visibility = customControlVisibility;
|
||||
this.MouseUtils_MouseJump_BezelThickness.Visibility = customControlVisibility;
|
||||
this.MouseUtils_MouseJump_BezelColor.Visibility = customControlVisibility;
|
||||
this.MouseUtils_MouseJump_Bezel3dDepth.Visibility = customControlVisibility;
|
||||
this.MouseUtils_MouseJump_ScreenMargin.Visibility = customControlVisibility;
|
||||
this.MouseUtils_MouseJump_ScreenColor1.Visibility = customControlVisibility;
|
||||
this.MouseUtils_MouseJump_ScreenColor2.Visibility = customControlVisibility;
|
||||
}
|
||||
|
||||
private /* async */ void CopyStyleToCustom_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
/*
|
||||
var resourceLoader = ResourceLoaderInstance.ResourceLoader;
|
||||
var messageBox = this.MouseUtils_MouseJump_CopyToCustomStyle_MessageBox;
|
||||
messageBox.Title = resourceLoader.GetString("MouseUtils_MouseJump_CopyToCustomStyle_MessageBox_Title");
|
||||
messageBox.PrimaryButtonText = resourceLoader.GetString("MouseUtils_MouseJump_CopyToCustomStyle_MessageBox_PrimaryButtonText");
|
||||
messageBox.PrimaryButtonCommand = new RelayCommand(this.MouseUtils_MouseJump_CopyToCustomStyle_MessageBox_PrimaryButtonCommand);
|
||||
// await messageBox.ShowAsync();
|
||||
*/
|
||||
this.MouseUtils_MouseJump_CopyToCustomStyle_MessageBox_PrimaryButtonCommand();
|
||||
}
|
||||
|
||||
private void MouseUtils_MouseJump_CopyToCustomStyle_MessageBox_PrimaryButtonCommand()
|
||||
{
|
||||
var selectedPreviewType = this.GetSelectedPreviewType();
|
||||
var selectedPreviewStyle = selectedPreviewType switch
|
||||
{
|
||||
PreviewType.Compact => StyleHelper.CompactPreviewStyle,
|
||||
PreviewType.Bezelled => StyleHelper.BezelledPreviewStyle,
|
||||
PreviewType.Custom => StyleHelper.BezelledPreviewStyle,
|
||||
_ => throw new InvalidOperationException(),
|
||||
};
|
||||
|
||||
// convert the color into a string.
|
||||
// note that we have to replace Named and System colors with their ARGB equivalents
|
||||
// so that serialization returns an ARGB string rather than the Named or System color *name*.
|
||||
this.ViewModel.MouseJumpPreviewType = selectedPreviewType.ToString();
|
||||
this.ViewModel.MouseJumpBackgroundColor1 = ConfigHelper.SerializeToConfigColorString(
|
||||
ConfigHelper.ToUnnamedColor(selectedPreviewStyle.CanvasStyle.BackgroundStyle.Color1));
|
||||
this.ViewModel.MouseJumpBackgroundColor2 = ConfigHelper.SerializeToConfigColorString(
|
||||
ConfigHelper.ToUnnamedColor(selectedPreviewStyle.CanvasStyle.BackgroundStyle.Color2));
|
||||
this.ViewModel.MouseJumpBorderThickness = (int)selectedPreviewStyle.CanvasStyle.BorderStyle.Top;
|
||||
this.ViewModel.MouseJumpBorderColor = ConfigHelper.SerializeToConfigColorString(
|
||||
ConfigHelper.ToUnnamedColor(selectedPreviewStyle.CanvasStyle.BorderStyle.Color));
|
||||
this.ViewModel.MouseJumpBorder3dDepth = (int)selectedPreviewStyle.CanvasStyle.BorderStyle.Depth;
|
||||
this.ViewModel.MouseJumpBorderPadding = (int)selectedPreviewStyle.CanvasStyle.PaddingStyle.Top;
|
||||
this.ViewModel.MouseJumpBezelThickness = (int)selectedPreviewStyle.ScreenStyle.BorderStyle.Top;
|
||||
this.ViewModel.MouseJumpBezelColor = ConfigHelper.SerializeToConfigColorString(
|
||||
ConfigHelper.ToUnnamedColor(selectedPreviewStyle.ScreenStyle.BorderStyle.Color));
|
||||
this.ViewModel.MouseJumpBezel3dDepth = (int)selectedPreviewStyle.ScreenStyle.BorderStyle.Depth;
|
||||
this.ViewModel.MouseJumpScreenMargin = (int)selectedPreviewStyle.ScreenStyle.MarginStyle.Top;
|
||||
this.ViewModel.MouseJumpScreenColor1 = ConfigHelper.SerializeToConfigColorString(
|
||||
ConfigHelper.ToUnnamedColor(selectedPreviewStyle.ScreenStyle.BackgroundStyle.Color1));
|
||||
this.ViewModel.MouseJumpScreenColor2 = ConfigHelper.SerializeToConfigColorString(
|
||||
ConfigHelper.ToUnnamedColor(selectedPreviewStyle.ScreenStyle.BackgroundStyle.Color2));
|
||||
}
|
||||
|
||||
private PreviewType GetSelectedPreviewType()
|
||||
{
|
||||
// this needs to match the order of the SegmentedItems in the "Preview Type" Segmented control
|
||||
var previewTypeOrder = new PreviewType[]
|
||||
{
|
||||
PreviewType.Compact, PreviewType.Bezelled, PreviewType.Custom,
|
||||
};
|
||||
|
||||
var selectedIndex = this.PreviewTypeSetting.SelectedIndex;
|
||||
if ((selectedIndex < 0) || (selectedIndex >= previewTypeOrder.Length))
|
||||
{
|
||||
throw new InvalidOperationException();
|
||||
}
|
||||
|
||||
return previewTypeOrder[selectedIndex];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@
|
||||
xmlns:converters="using:Microsoft.PowerToys.Settings.UI.Converters"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:panels="using:Microsoft.PowerToys.Settings.UI.Panels"
|
||||
xmlns:tkcontrols="using:CommunityToolkit.WinUI.Controls"
|
||||
xmlns:tkconverters="using:CommunityToolkit.WinUI.Converters"
|
||||
xmlns:ui="using:CommunityToolkit.WinUI"
|
||||
@@ -245,101 +246,7 @@
|
||||
</tkcontrols:SettingsExpander>
|
||||
</controls:SettingsGroup>
|
||||
|
||||
<controls:SettingsGroup x:Uid="MouseUtils_MouseJump">
|
||||
<tkcontrols:SettingsCard
|
||||
x:Uid="MouseUtils_Enable_MouseJump"
|
||||
HeaderIcon="{ui:BitmapIcon Source=/Assets/Settings/Icons/MouseJump.png}"
|
||||
IsEnabled="{x:Bind ViewModel.IsJumpEnabledGpoConfigured, Mode=OneWay, Converter={StaticResource BoolNegationConverter}}">
|
||||
<ToggleSwitch x:Uid="ToggleSwitch" IsOn="{x:Bind ViewModel.IsMouseJumpEnabled, Mode=TwoWay}" />
|
||||
</tkcontrols:SettingsCard>
|
||||
<InfoBar
|
||||
x:Uid="GPO_SettingIsManaged"
|
||||
IsClosable="False"
|
||||
IsOpen="{x:Bind ViewModel.IsJumpEnabledGpoConfigured, Mode=OneWay}"
|
||||
IsTabStop="{x:Bind ViewModel.IsJumpEnabledGpoConfigured, Mode=OneWay}"
|
||||
Severity="Informational" />
|
||||
<tkcontrols:SettingsCard
|
||||
x:Uid="MouseUtils_MouseJump_ActivationShortcut"
|
||||
HeaderIcon="{ui:FontIcon Glyph=}"
|
||||
IsEnabled="{x:Bind ViewModel.IsMouseJumpEnabled, Mode=OneWay}">
|
||||
<controls:ShortcutControl MinWidth="{StaticResource SettingActionControlMinWidth}" HotkeySettings="{x:Bind Path=ViewModel.MouseJumpActivationShortcut, Mode=TwoWay}" />
|
||||
</tkcontrols:SettingsCard>
|
||||
<tkcontrols:SettingsCard
|
||||
x:Uid="MouseUtils_MouseJump_ThumbnailSize"
|
||||
HeaderIcon="{ui:FontIcon Glyph=}"
|
||||
IsEnabled="{x:Bind ViewModel.IsMouseJumpEnabled, Mode=OneWay}">
|
||||
<tkcontrols: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="" />
|
||||
<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>
|
||||
</tkcontrols:SettingsCard.Description>
|
||||
<StackPanel
|
||||
Grid.Column="2"
|
||||
HorizontalAlignment="Right"
|
||||
Orientation="Horizontal"
|
||||
Spacing="8">
|
||||
<Button
|
||||
x:Uid="EditButton"
|
||||
Width="40"
|
||||
Height="36"
|
||||
Content=""
|
||||
FontFamily="{ThemeResource SymbolThemeFontFamily}"
|
||||
Style="{StaticResource SubtleButtonStyle}">
|
||||
<ToolTipService.ToolTip>
|
||||
<TextBlock x:Uid="EditTooltip" />
|
||||
</ToolTipService.ToolTip>
|
||||
<Button.Flyout>
|
||||
<Flyout x:Uid="MouseJumpThumbnailSize_Edit" ShouldConstrainToRootBounds="False">
|
||||
<StackPanel 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>
|
||||
</tkcontrols:SettingsCard>
|
||||
</controls:SettingsGroup>
|
||||
<panels:MouseJumpPanel x:Name="MouseUtils_MouseJump_Panel" x:Uid="MouseUtils_MouseJump_Panel" />
|
||||
|
||||
<controls:SettingsGroup x:Uid="MouseUtils_MousePointerCrosshairs">
|
||||
<tkcontrols:SettingsCard
|
||||
|
||||
@@ -46,6 +46,8 @@ namespace Microsoft.PowerToys.Settings.UI.Views
|
||||
|
||||
DataContext = ViewModel;
|
||||
InitializeComponent();
|
||||
|
||||
this.MouseUtils_MouseJump_Panel.ViewModel = ViewModel;
|
||||
}
|
||||
|
||||
public void RefreshEnabledState()
|
||||
|
||||
@@ -4124,13 +4124,17 @@ Activate by holding the key for the character you want to add an accent to, then
|
||||
<value>Launch Registry Preview</value>
|
||||
<comment>"Registry Preview" is the name of the utility</comment>
|
||||
</data>
|
||||
<data name="MouseUtils_MouseJump.Header" xml:space="preserve">
|
||||
<value>Mouse Jump</value>
|
||||
<comment>Refers to the utility name</comment>
|
||||
</data>
|
||||
<data name="MouseUtils_MouseJump.Description" xml:space="preserve">
|
||||
<value>Quickly move the mouse pointer long distances.</value>
|
||||
<comment>"Mouse Jump" is the name of the utility. Mouse is the hardware mouse.</comment>
|
||||
</data>
|
||||
<data name="MouseUtils_MouseJump.Header" xml:space="preserve">
|
||||
<value>Mouse Jump</value>
|
||||
<comment>Refers to the utility name</comment>
|
||||
<data name="MouseUtils_Enable_MouseJump.Header" xml:space="preserve">
|
||||
<value>Enable Mouse Jump</value>
|
||||
<comment>"Mouse Jump" is the name of the utility.</comment>
|
||||
</data>
|
||||
<data name="MouseUtils_MouseJump_ActivationShortcut.Description" xml:space="preserve">
|
||||
<value>Customize the shortcut to turn on or off this mode</value>
|
||||
@@ -4138,9 +4142,124 @@ Activate by holding the key for the character you want to add an accent to, then
|
||||
<data name="MouseUtils_MouseJump_ActivationShortcut.Header" xml:space="preserve">
|
||||
<value>Activation shortcut</value>
|
||||
</data>
|
||||
<data name="MouseUtils_Enable_MouseJump.Header" xml:space="preserve">
|
||||
<value>Enable Mouse Jump</value>
|
||||
<comment>"Mouse Jump" is the name of the utility.</comment>
|
||||
<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>
|
||||
<data name="MouseUtils_MouseJump_Appearance.Header" xml:space="preserve">
|
||||
<value>Appearance</value>
|
||||
</data>
|
||||
<data name="MouseUtils_MouseJump_PreviewType.Header" xml:space="preserve">
|
||||
<value>Preview style</value>
|
||||
</data>
|
||||
<data name="MouseUtils_MouseJump_PreviewType.Description" xml:space="preserve">
|
||||
<value>Select a predefined style, or apply a custom one</value>
|
||||
</data>
|
||||
<data name="MouseUtils_MouseJump_PreviewType_Compact.Text" xml:space="preserve">
|
||||
<value>Compact</value>
|
||||
</data>
|
||||
<data name="MouseUtils_MouseJump_PreviewType_Bezelled.Text" xml:space="preserve">
|
||||
<value>Bezelled</value>
|
||||
</data>
|
||||
<data name="MouseUtils_MouseJump_PreviewType_Custom.Text" xml:space="preserve">
|
||||
<value>Custom</value>
|
||||
</data>
|
||||
<data name="MouseUtils_MouseJump_CopyStyle.Content" xml:space="preserve">
|
||||
<value>Copy to Custom preview style</value>
|
||||
</data>
|
||||
<data name="MouseUtils_MouseJump_BackgroundColor1.Header" xml:space="preserve">
|
||||
<value>Background color 1</value>
|
||||
</data>
|
||||
<data name="MouseUtils_MouseJump_BackgroundColor1.Description" xml:space="preserve">
|
||||
<value>The start color for the background gradient fill on the preview image</value>
|
||||
</data>
|
||||
<data name="MouseUtils_MouseJump_BackgroundColor2.Header" xml:space="preserve">
|
||||
<value>Background color 2</value>
|
||||
</data>
|
||||
<data name="MouseUtils_MouseJump_BackgroundColor2.Description" xml:space="preserve">
|
||||
<value>The end color for the background gradient fill on the preview image</value>
|
||||
</data>
|
||||
<data name="MouseUtils_MouseJump_BorderThickness.Header" xml:space="preserve">
|
||||
<value>Border thickness</value>
|
||||
</data>
|
||||
<data name="MouseUtils_MouseJump_BorderThickness.Description" xml:space="preserve">
|
||||
<value>The thickness (in pixels) of the border that surrounds the preview image</value>
|
||||
</data>
|
||||
<data name="MouseUtils_MouseJump_BorderColor.Header" xml:space="preserve">
|
||||
<value>Border color</value>
|
||||
</data>
|
||||
<data name="MouseUtils_MouseJump_BorderColor.Description" xml:space="preserve">
|
||||
<value>The color of the border that surrounds the preview image</value>
|
||||
</data>
|
||||
<data name="MouseUtils_MouseJump_Border3dDepth.Header" xml:space="preserve">
|
||||
<value>Border 3D depth</value>
|
||||
</data>
|
||||
<data name="MouseUtils_MouseJump_Border3dDepth.Description" xml:space="preserve">
|
||||
<value>The width (in pixels) of the 3d effect on the border that surrounds the preview image</value>
|
||||
</data>
|
||||
<data name="MouseUtils_MouseJump_BorderPadding.Header" xml:space="preserve">
|
||||
<value>Border padding</value>
|
||||
</data>
|
||||
<data name="MouseUtils_MouseJump_BorderPadding.Description" xml:space="preserve">
|
||||
<value>The amount of padding to draw between the border that surrounds the main preview image and the screen images</value>
|
||||
</data>
|
||||
<data name="MouseUtils_MouseJump_BezelThickness.Header" xml:space="preserve">
|
||||
<value>Bezel thickness</value>
|
||||
</data>
|
||||
<data name="MouseUtils_MouseJump_BezelThickness.Description" xml:space="preserve">
|
||||
<value>The thickness (in pixels) of the border that surrounds the individual screen images</value>
|
||||
</data>
|
||||
<data name="MouseUtils_MouseJump_BezelColor.Header" xml:space="preserve">
|
||||
<value>Bezel color</value>
|
||||
</data>
|
||||
<data name="MouseUtils_MouseJump_BezelColor.Description" xml:space="preserve">
|
||||
<value>The color of the border that surrounds the individual screen images</value>
|
||||
</data>
|
||||
<data name="MouseUtils_MouseJump_Bezel3dDepth.Header" xml:space="preserve">
|
||||
<value>Bezel 3D depth</value>
|
||||
</data>
|
||||
<data name="MouseUtils_MouseJump_Bezel3dDepth.Description" xml:space="preserve">
|
||||
<value>The width (in pixels) of the 3d effect on the border that surrounds individual screen images</value>
|
||||
</data>
|
||||
<data name="MouseUtils_MouseJump_ScreenMargin.Header" xml:space="preserve">
|
||||
<value>Screen spacing</value>
|
||||
</data>
|
||||
<data name="MouseUtils_MouseJump_ScreenMargin.Description" xml:space="preserve">
|
||||
<value>The width (in pixels) of the margin drawn between individual screen images</value>
|
||||
</data>
|
||||
<data name="MouseUtils_MouseJump_ScreenColor1.Header" xml:space="preserve">
|
||||
<value>Screen color 1</value>
|
||||
</data>
|
||||
<data name="MouseUtils_MouseJump_ScreenColor1.Description" xml:space="preserve">
|
||||
<value>The start color for the background gradient fill on individual screen images</value>
|
||||
</data>
|
||||
<data name="MouseUtils_MouseJump_ScreenColor2.Header" xml:space="preserve">
|
||||
<value>Screen color 2</value>
|
||||
</data>
|
||||
<data name="MouseUtils_MouseJump_ScreenColor2.Description" xml:space="preserve">
|
||||
<value>The end color for the background gradient fill on individual screen images</value>
|
||||
</data>
|
||||
<data name="MouseUtils_MouseJump_CopyToCustomStyle_MessageBox_Title" xml:space="preserve">
|
||||
<value>Copy to Custom preview style</value>
|
||||
</data>
|
||||
<data name="MouseUtils_MouseJump_CopyToCustomStyle_MessageBox_Text" xml:space="preserve">
|
||||
<value>This will replace the current settings in the Custom preview style.</value>
|
||||
</data>
|
||||
<data name="MouseUtils_MouseJump_CopyToCustomStyle_MessageBox_PrimaryButtonText" xml:space="preserve">
|
||||
<value>Copy</value>
|
||||
</data>
|
||||
<data name="Hosts_Toggle_LoopbackDuplicates.Description" xml:space="preserve">
|
||||
<value>127.0.0.1, ::1, ...</value>
|
||||
@@ -4168,23 +4287,6 @@ Activate by holding the key for the character you want to add an accent to, then
|
||||
<data name="AdvancedPaste_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>
|
||||
<data name="Oobe_Peek.Description" xml:space="preserve">
|
||||
<value>A lightning fast file preview feature for Windows.</value>
|
||||
<comment>{Locked="Windows"}</comment>
|
||||
|
||||
@@ -14,7 +14,7 @@ using Microsoft.PowerToys.Settings.Utilities;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
{
|
||||
public class MouseUtilsViewModel : Observable
|
||||
public partial class MouseUtilsViewModel : Observable
|
||||
{
|
||||
private ISettingsUtils SettingsUtils { get; set; }
|
||||
|
||||
@@ -24,8 +24,6 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
|
||||
private MouseHighlighterSettings MouseHighlighterSettingsConfig { get; set; }
|
||||
|
||||
private MouseJumpSettings MouseJumpSettingsConfig { get; set; }
|
||||
|
||||
private MousePointerCrosshairsSettings MousePointerCrosshairsSettingsConfig { get; set; }
|
||||
|
||||
public MouseUtilsViewModel(ISettingsUtils settingsUtils, ISettingsRepository<GeneralSettings> settingsRepository, ISettingsRepository<FindMyMouseSettings> findMyMouseSettingsRepository, ISettingsRepository<MouseHighlighterSettings> mouseHighlighterSettingsRepository, ISettingsRepository<MouseJumpSettings> mouseJumpSettingsRepository, ISettingsRepository<MousePointerCrosshairsSettings> mousePointerCrosshairsSettingsRepository, Func<string, int> ipcMSGCallBackFunc)
|
||||
@@ -80,10 +78,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
_highlightFadeDurationMs = MouseHighlighterSettingsConfig.Properties.HighlightFadeDurationMs.Value;
|
||||
_highlighterAutoActivate = MouseHighlighterSettingsConfig.Properties.AutoActivate.Value;
|
||||
|
||||
ArgumentNullException.ThrowIfNull(mouseJumpSettingsRepository);
|
||||
|
||||
MouseJumpSettingsConfig = mouseJumpSettingsRepository.SettingsConfig;
|
||||
MouseJumpSettingsConfig.Properties.ThumbnailSize.PropertyChanged += MouseJumpThumbnailSizePropertyChanged;
|
||||
this.InitializeMouseJumpSettings(mouseJumpSettingsRepository);
|
||||
|
||||
ArgumentNullException.ThrowIfNull(mousePointerCrosshairsSettingsRepository);
|
||||
|
||||
@@ -138,17 +133,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
_isMouseHighlighterEnabled = GeneralSettingsConfig.Enabled.MouseHighlighter;
|
||||
}
|
||||
|
||||
_jumpEnabledGpoRuleConfiguration = GPOWrapper.GetConfiguredMouseJumpEnabledValue();
|
||||
if (_jumpEnabledGpoRuleConfiguration == GpoRuleConfigured.Disabled || _jumpEnabledGpoRuleConfiguration == GpoRuleConfigured.Enabled)
|
||||
{
|
||||
// Get the enabled state from GPO.
|
||||
_jumpEnabledStateIsGPOConfigured = true;
|
||||
_isMouseJumpEnabled = _jumpEnabledGpoRuleConfiguration == GpoRuleConfigured.Enabled;
|
||||
}
|
||||
else
|
||||
{
|
||||
_isMouseJumpEnabled = GeneralSettingsConfig.Enabled.MouseJump;
|
||||
}
|
||||
this.InitializeMouseJumpEnabledValues();
|
||||
|
||||
_mousePointerCrosshairsEnabledGpoRuleConfiguration = GPOWrapper.GetConfiguredMousePointerCrosshairsEnabledValue();
|
||||
if (_mousePointerCrosshairsEnabledGpoRuleConfiguration == GpoRuleConfigured.Disabled || _mousePointerCrosshairsEnabledGpoRuleConfiguration == GpoRuleConfigured.Enabled)
|
||||
@@ -657,87 +642,6 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
SettingsUtils.SaveSettings(MouseHighlighterSettingsConfig.ToJsonString(), MouseHighlighterSettings.ModuleName);
|
||||
}
|
||||
|
||||
public bool IsMouseJumpEnabled
|
||||
{
|
||||
get => _isMouseJumpEnabled;
|
||||
set
|
||||
{
|
||||
if (_jumpEnabledStateIsGPOConfigured)
|
||||
{
|
||||
// If it's GPO configured, shouldn't be able to change this state.
|
||||
return;
|
||||
}
|
||||
|
||||
if (_isMouseJumpEnabled != value)
|
||||
{
|
||||
_isMouseJumpEnabled = value;
|
||||
|
||||
GeneralSettingsConfig.Enabled.MouseJump = value;
|
||||
OnPropertyChanged(nameof(_isMouseJumpEnabled));
|
||||
|
||||
OutGoingGeneralSettings outgoing = new OutGoingGeneralSettings(GeneralSettingsConfig);
|
||||
SendConfigMSG(outgoing.ToString());
|
||||
|
||||
NotifyMouseJumpPropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsJumpEnabledGpoConfigured
|
||||
{
|
||||
get => _jumpEnabledStateIsGPOConfigured;
|
||||
}
|
||||
|
||||
public HotkeySettings MouseJumpActivationShortcut
|
||||
{
|
||||
get
|
||||
{
|
||||
return MouseJumpSettingsConfig.Properties.ActivationShortcut;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (MouseJumpSettingsConfig.Properties.ActivationShortcut != value)
|
||||
{
|
||||
MouseJumpSettingsConfig.Properties.ActivationShortcut = value ?? MouseJumpSettingsConfig.Properties.DefaultActivationShortcut;
|
||||
NotifyMouseJumpPropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
SndMouseJumpSettings outsettings = new SndMouseJumpSettings(MouseJumpSettingsConfig);
|
||||
SndModuleSettings<SndMouseJumpSettings> ipcMessage = new SndModuleSettings<SndMouseJumpSettings>(outsettings);
|
||||
SendConfigMSG(ipcMessage.ToJsonString());
|
||||
SettingsUtils.SaveSettings(MouseJumpSettingsConfig.ToJsonString(), MouseJumpSettings.ModuleName);
|
||||
}
|
||||
|
||||
public bool IsMousePointerCrosshairsEnabled
|
||||
{
|
||||
get => _isMousePointerCrosshairsEnabled;
|
||||
@@ -1017,10 +921,6 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
private int _highlightFadeDurationMs;
|
||||
private bool _highlighterAutoActivate;
|
||||
|
||||
private GpoRuleConfigured _jumpEnabledGpoRuleConfiguration;
|
||||
private bool _jumpEnabledStateIsGPOConfigured;
|
||||
private bool _isMouseJumpEnabled;
|
||||
|
||||
private GpoRuleConfigured _mousePointerCrosshairsEnabledGpoRuleConfiguration;
|
||||
private bool _mousePointerCrosshairsEnabledStateIsGPOConfigured;
|
||||
private bool _isMousePointerCrosshairsEnabled;
|
||||
|
||||
@@ -0,0 +1,513 @@
|
||||
// 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.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using global::PowerToys.GPOWrapper;
|
||||
using Microsoft.PowerToys.Settings.UI.Library;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.Helpers;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.Interfaces;
|
||||
using Microsoft.UI.Xaml.Media;
|
||||
using Microsoft.UI.Xaml.Media.Imaging;
|
||||
using MouseJump.Common.Helpers;
|
||||
using MouseJump.Common.Imaging;
|
||||
using MouseJump.Common.Models.Drawing;
|
||||
using MouseJump.Common.Models.Settings;
|
||||
using MouseJump.Common.Models.Styles;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
{
|
||||
public partial class MouseUtilsViewModel : Observable
|
||||
{
|
||||
private GpoRuleConfigured _jumpEnabledGpoRuleConfiguration;
|
||||
private bool _jumpEnabledStateIsGPOConfigured;
|
||||
private bool _isMouseJumpEnabled;
|
||||
|
||||
internal MouseJumpSettings MouseJumpSettingsConfig { get; set; }
|
||||
|
||||
private void InitializeMouseJumpSettings(ISettingsRepository<MouseJumpSettings> mouseJumpSettingsRepository)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(mouseJumpSettingsRepository);
|
||||
this.MouseJumpSettingsConfig = mouseJumpSettingsRepository.SettingsConfig;
|
||||
this.MouseJumpSettingsConfig.Properties.ThumbnailSize.PropertyChanged += this.MouseJumpThumbnailSizePropertyChanged;
|
||||
}
|
||||
|
||||
private void InitializeMouseJumpEnabledValues()
|
||||
{
|
||||
_jumpEnabledGpoRuleConfiguration = GPOWrapper.GetConfiguredMouseJumpEnabledValue();
|
||||
if (_jumpEnabledGpoRuleConfiguration == GpoRuleConfigured.Disabled || _jumpEnabledGpoRuleConfiguration == GpoRuleConfigured.Enabled)
|
||||
{
|
||||
// Get the enabled state from GPO.
|
||||
_jumpEnabledStateIsGPOConfigured = true;
|
||||
_isMouseJumpEnabled = _jumpEnabledGpoRuleConfiguration == GpoRuleConfigured.Enabled;
|
||||
}
|
||||
else
|
||||
{
|
||||
_isMouseJumpEnabled = GeneralSettingsConfig.Enabled.MouseJump;
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsMouseJumpEnabled
|
||||
{
|
||||
get => _isMouseJumpEnabled;
|
||||
set
|
||||
{
|
||||
if (_jumpEnabledStateIsGPOConfigured)
|
||||
{
|
||||
// If it's GPO configured, shouldn't be able to change this state.
|
||||
return;
|
||||
}
|
||||
|
||||
if (_isMouseJumpEnabled != value)
|
||||
{
|
||||
_isMouseJumpEnabled = value;
|
||||
|
||||
GeneralSettingsConfig.Enabled.MouseJump = value;
|
||||
OnPropertyChanged(nameof(_isMouseJumpEnabled));
|
||||
|
||||
OutGoingGeneralSettings outgoing = new OutGoingGeneralSettings(GeneralSettingsConfig);
|
||||
SendConfigMSG(outgoing.ToString());
|
||||
|
||||
NotifyMouseJumpPropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsJumpEnabledGpoConfigured
|
||||
{
|
||||
get => _jumpEnabledStateIsGPOConfigured;
|
||||
}
|
||||
|
||||
public HotkeySettings MouseJumpActivationShortcut
|
||||
{
|
||||
get
|
||||
{
|
||||
return MouseJumpSettingsConfig.Properties.ActivationShortcut;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (MouseJumpSettingsConfig.Properties.ActivationShortcut != value)
|
||||
{
|
||||
MouseJumpSettingsConfig.Properties.ActivationShortcut = value ?? MouseJumpSettingsConfig.Properties.DefaultActivationShortcut;
|
||||
NotifyMouseJumpPropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static Bitmap LoadImageResource(string filename)
|
||||
{
|
||||
var assembly = Assembly.GetExecutingAssembly();
|
||||
var assemblyName = new AssemblyName(assembly.FullName ?? throw new InvalidOperationException());
|
||||
var resourceName = $"Microsoft.{assemblyName.Name}.{filename.Replace("/", ".")}";
|
||||
var resourceNames = assembly.GetManifestResourceNames();
|
||||
if (!resourceNames.Contains(resourceName))
|
||||
{
|
||||
throw new InvalidOperationException($"Embedded resource '{resourceName}' does not exist.");
|
||||
}
|
||||
|
||||
var stream = assembly.GetManifestResourceStream(resourceName)
|
||||
?? throw new InvalidOperationException();
|
||||
var image = (Bitmap)Image.FromStream(stream);
|
||||
return image;
|
||||
}
|
||||
|
||||
private static Lazy<Bitmap> MouseJumpDesktopImage => new(
|
||||
() => MouseUtilsViewModel.LoadImageResource("UI/Images/MouseJump-Desktop.png")
|
||||
);
|
||||
|
||||
public ImageSource MouseJumpPreviewImage
|
||||
{
|
||||
get
|
||||
{
|
||||
// keep these in sync with the layout of "Images\MouseJump-Desktop.png"
|
||||
var screens = new List<RectangleInfo>()
|
||||
{
|
||||
/*
|
||||
these magic numbers are the pixel dimensions of the individual screens on the
|
||||
fake desktop image - "Images\MouseJump-Desktop.png" - used to generate the
|
||||
preview image in the Settings UI properties page for Mouse Jump. if you update
|
||||
the fake desktop image be sure to update these values as well.
|
||||
*/
|
||||
new(635, 172, 272, 168),
|
||||
new(0, 0, 635, 339),
|
||||
};
|
||||
var desktopSize = LayoutHelper.GetCombinedScreenBounds(screens).Size;
|
||||
/*
|
||||
magic number 283 is the content height left in the settings card after removing the top and bottom chrome:
|
||||
|
||||
300px settings card height - 1px top border - 7px top margin - 8px bottom margin - 1px bottom border = 283px image height
|
||||
|
||||
this ensures we get a preview image scaled at 100% so borders etc are shown at exact pixel sizes in the preview
|
||||
*/
|
||||
var canvasSize = new SizeInfo(desktopSize.Width, 283).Clamp(desktopSize);
|
||||
|
||||
var previewType = Enum.TryParse<PreviewType>(this.MouseJumpPreviewType, true, out var previewTypeResult)
|
||||
? previewTypeResult
|
||||
: PreviewType.Bezelled;
|
||||
var previewStyle = previewType switch
|
||||
{
|
||||
PreviewType.Compact => StyleHelper.CompactPreviewStyle.WithCanvasSize(desktopSize),
|
||||
PreviewType.Bezelled => StyleHelper.BezelledPreviewStyle.WithCanvasSize(desktopSize),
|
||||
PreviewType.Custom => new PreviewStyle(
|
||||
canvasSize: canvasSize,
|
||||
canvasStyle: new(
|
||||
marginStyle: new(0),
|
||||
borderStyle: new(
|
||||
color: ConfigHelper.DeserializeFromConfigColorString(
|
||||
this.MouseJumpBorderColor),
|
||||
all: this.MouseJumpBorderThickness,
|
||||
depth: this.MouseJumpBorder3dDepth
|
||||
),
|
||||
paddingStyle: new(
|
||||
all: this.MouseJumpBorderPadding
|
||||
),
|
||||
backgroundStyle: new(
|
||||
color1: ConfigHelper.DeserializeFromConfigColorString(
|
||||
this.MouseJumpBackgroundColor1),
|
||||
color2: ConfigHelper.DeserializeFromConfigColorString(
|
||||
this.MouseJumpBackgroundColor2)
|
||||
)
|
||||
),
|
||||
screenStyle: new(
|
||||
marginStyle: new(
|
||||
all: this.MouseJumpScreenMargin
|
||||
),
|
||||
borderStyle: new(
|
||||
color: ConfigHelper.DeserializeFromConfigColorString(
|
||||
this.MouseJumpBezelColor),
|
||||
all: this.MouseJumpBezelThickness,
|
||||
depth: this.MouseJumpBezel3dDepth
|
||||
),
|
||||
paddingStyle: new(0),
|
||||
backgroundStyle: new(
|
||||
color1: ConfigHelper.DeserializeFromConfigColorString(
|
||||
this.MouseJumpScreenColor1),
|
||||
color2: ConfigHelper.DeserializeFromConfigColorString(
|
||||
this.MouseJumpScreenColor2)
|
||||
)
|
||||
)),
|
||||
_ => throw new InvalidOperationException(
|
||||
$"Unhandled {nameof(MouseJumpPreviewType)} '{previewType}'"),
|
||||
};
|
||||
|
||||
var previewLayout = LayoutHelper.GetPreviewLayout(
|
||||
previewStyle: previewStyle,
|
||||
screens: screens,
|
||||
activatedLocation: new(0, 0));
|
||||
|
||||
var desktopImage = MouseUtilsViewModel.MouseJumpDesktopImage.Value;
|
||||
var imageCopyService = new StaticImageRegionCopyService(desktopImage);
|
||||
using var previewImage = DrawingHelper.RenderPreview(
|
||||
previewLayout,
|
||||
imageCopyService);
|
||||
|
||||
// save the image to a memory stream
|
||||
using var stream = new MemoryStream();
|
||||
previewImage.Save(stream, ImageFormat.Png);
|
||||
stream.Position = 0;
|
||||
|
||||
// load the memory stream into a bitmap image
|
||||
var bitmap = new BitmapImage();
|
||||
var rnd = stream.AsRandomAccessStream();
|
||||
bitmap.DecodePixelWidth = previewImage.Width;
|
||||
bitmap.DecodePixelHeight = previewImage.Height;
|
||||
bitmap.SetSource(rnd);
|
||||
return bitmap;
|
||||
}
|
||||
}
|
||||
|
||||
public string MouseJumpPreviewType
|
||||
{
|
||||
get
|
||||
{
|
||||
return MouseJumpSettingsConfig.Properties.PreviewType;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (value != MouseJumpSettingsConfig.Properties.PreviewType)
|
||||
{
|
||||
MouseJumpSettingsConfig.Properties.PreviewType = value;
|
||||
NotifyMouseJumpPropertyChanged();
|
||||
NotifyMouseJumpPropertyChanged(nameof(this.MouseJumpPreviewImage));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string MouseJumpBackgroundColor1
|
||||
{
|
||||
get
|
||||
{
|
||||
var value = MouseJumpSettingsConfig.Properties.BackgroundColor1;
|
||||
value = (value != null) ? SettingsUtilities.ToRGBHex(value) : "#000000";
|
||||
return value;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
value = (value != null) ? SettingsUtilities.ToRGBHex(value) : "#000000";
|
||||
if (!value.Equals(MouseJumpSettingsConfig.Properties.BackgroundColor1, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
MouseJumpSettingsConfig.Properties.BackgroundColor1 = value;
|
||||
NotifyMouseJumpPropertyChanged();
|
||||
NotifyMouseJumpPropertyChanged(nameof(this.MouseJumpPreviewImage));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string MouseJumpBackgroundColor2
|
||||
{
|
||||
get
|
||||
{
|
||||
var value = MouseJumpSettingsConfig.Properties.BackgroundColor2;
|
||||
value = (value != null) ? SettingsUtilities.ToRGBHex(value) : "#000000";
|
||||
return value;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
value = (value != null) ? SettingsUtilities.ToRGBHex(value) : "#000000";
|
||||
if (!value.Equals(MouseJumpSettingsConfig.Properties.BackgroundColor2, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
MouseJumpSettingsConfig.Properties.BackgroundColor2 = value;
|
||||
NotifyMouseJumpPropertyChanged();
|
||||
NotifyMouseJumpPropertyChanged(nameof(this.MouseJumpPreviewImage));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int MouseJumpBorderThickness
|
||||
{
|
||||
get
|
||||
{
|
||||
return MouseJumpSettingsConfig.Properties.BorderThickness;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (value != MouseJumpSettingsConfig.Properties.BorderThickness)
|
||||
{
|
||||
MouseJumpSettingsConfig.Properties.BorderThickness = value;
|
||||
NotifyMouseJumpPropertyChanged();
|
||||
NotifyMouseJumpPropertyChanged(nameof(this.MouseJumpPreviewImage));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string MouseJumpBorderColor
|
||||
{
|
||||
get
|
||||
{
|
||||
var value = MouseJumpSettingsConfig.Properties.BorderColor;
|
||||
value = (value != null) ? SettingsUtilities.ToRGBHex(value) : "#000000";
|
||||
return value;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
value = (value != null) ? SettingsUtilities.ToRGBHex(value) : "#000000";
|
||||
if (!value.Equals(MouseJumpSettingsConfig.Properties.BorderColor, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
MouseJumpSettingsConfig.Properties.BorderColor = value;
|
||||
NotifyMouseJumpPropertyChanged();
|
||||
NotifyMouseJumpPropertyChanged(nameof(this.MouseJumpPreviewImage));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int MouseJumpBorder3dDepth
|
||||
{
|
||||
get
|
||||
{
|
||||
return MouseJumpSettingsConfig.Properties.Border3dDepth;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (value != MouseJumpSettingsConfig.Properties.Border3dDepth)
|
||||
{
|
||||
MouseJumpSettingsConfig.Properties.Border3dDepth = value;
|
||||
NotifyMouseJumpPropertyChanged();
|
||||
NotifyMouseJumpPropertyChanged(nameof(this.MouseJumpPreviewImage));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int MouseJumpBorderPadding
|
||||
{
|
||||
get
|
||||
{
|
||||
return MouseJumpSettingsConfig.Properties.BorderPadding;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (value != MouseJumpSettingsConfig.Properties.BorderPadding)
|
||||
{
|
||||
MouseJumpSettingsConfig.Properties.BorderPadding = value;
|
||||
NotifyMouseJumpPropertyChanged();
|
||||
NotifyMouseJumpPropertyChanged(nameof(this.MouseJumpPreviewImage));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int MouseJumpBezelThickness
|
||||
{
|
||||
get
|
||||
{
|
||||
return MouseJumpSettingsConfig.Properties.BezelThickness;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (value != MouseJumpSettingsConfig.Properties.BezelThickness)
|
||||
{
|
||||
MouseJumpSettingsConfig.Properties.BezelThickness = value;
|
||||
NotifyMouseJumpPropertyChanged();
|
||||
NotifyMouseJumpPropertyChanged(nameof(this.MouseJumpPreviewImage));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string MouseJumpBezelColor
|
||||
{
|
||||
get
|
||||
{
|
||||
var value = MouseJumpSettingsConfig.Properties.BezelColor;
|
||||
value = (value != null) ? SettingsUtilities.ToRGBHex(value) : "#000000";
|
||||
return value;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
value = (value != null) ? SettingsUtilities.ToRGBHex(value) : "#000000";
|
||||
if (!value.Equals(MouseJumpSettingsConfig.Properties.BezelColor, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
MouseJumpSettingsConfig.Properties.BezelColor = value;
|
||||
NotifyMouseJumpPropertyChanged();
|
||||
NotifyMouseJumpPropertyChanged(nameof(this.MouseJumpPreviewImage));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int MouseJumpBezel3dDepth
|
||||
{
|
||||
get
|
||||
{
|
||||
return MouseJumpSettingsConfig.Properties.Bezel3dDepth;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (value != MouseJumpSettingsConfig.Properties.Bezel3dDepth)
|
||||
{
|
||||
MouseJumpSettingsConfig.Properties.Bezel3dDepth = value;
|
||||
NotifyMouseJumpPropertyChanged();
|
||||
NotifyMouseJumpPropertyChanged(nameof(this.MouseJumpPreviewImage));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int MouseJumpScreenMargin
|
||||
{
|
||||
get
|
||||
{
|
||||
return MouseJumpSettingsConfig.Properties.ScreenMargin;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (value != MouseJumpSettingsConfig.Properties.ScreenMargin)
|
||||
{
|
||||
MouseJumpSettingsConfig.Properties.ScreenMargin = value;
|
||||
NotifyMouseJumpPropertyChanged();
|
||||
NotifyMouseJumpPropertyChanged(nameof(this.MouseJumpPreviewImage));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string MouseJumpScreenColor1
|
||||
{
|
||||
get
|
||||
{
|
||||
var value = MouseJumpSettingsConfig.Properties.ScreenColor1;
|
||||
value = (value != null) ? SettingsUtilities.ToRGBHex(value) : "#000000";
|
||||
return value;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
value = (value != null) ? SettingsUtilities.ToRGBHex(value) : "#000000";
|
||||
if (!value.Equals(MouseJumpSettingsConfig.Properties.ScreenColor1, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
MouseJumpSettingsConfig.Properties.ScreenColor1 = value;
|
||||
NotifyMouseJumpPropertyChanged();
|
||||
NotifyMouseJumpPropertyChanged(nameof(this.MouseJumpPreviewImage));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string MouseJumpScreenColor2
|
||||
{
|
||||
get
|
||||
{
|
||||
var value = MouseJumpSettingsConfig.Properties.ScreenColor2;
|
||||
value = (value != null) ? SettingsUtilities.ToRGBHex(value) : "#000000";
|
||||
return value;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
value = (value != null) ? SettingsUtilities.ToRGBHex(value) : "#000000";
|
||||
if (!value.Equals(MouseJumpSettingsConfig.Properties.ScreenColor2, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
MouseJumpSettingsConfig.Properties.ScreenColor2 = value;
|
||||
NotifyMouseJumpPropertyChanged();
|
||||
NotifyMouseJumpPropertyChanged(nameof(this.MouseJumpPreviewImage));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void MouseJumpThumbnailSizePropertyChanged(object sender, PropertyChangedEventArgs e)
|
||||
{
|
||||
NotifyMouseJumpPropertyChanged(nameof(MouseJumpThumbnailSize));
|
||||
}
|
||||
|
||||
public void NotifyMouseJumpPropertyChanged([CallerMemberName] string propertyName = null)
|
||||
{
|
||||
OnPropertyChanged(propertyName);
|
||||
|
||||
SndMouseJumpSettings outsettings = new SndMouseJumpSettings(MouseJumpSettingsConfig);
|
||||
SndModuleSettings<SndMouseJumpSettings> ipcMessage = new SndModuleSettings<SndMouseJumpSettings>(outsettings);
|
||||
SendConfigMSG(ipcMessage.ToJsonString());
|
||||
SettingsUtils.SaveSettings(MouseJumpSettingsConfig.ToJsonString(), MouseJumpSettings.ModuleName);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user