mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 02:36:19 +02:00
[MeasureTool]Add setting to specify the default measure style (#25645)
* MeasureTool: Add possibility to specify the default measure style * MeasureTool: Improve description of user setting * MeasureTool: Use enum value instead of magic number
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
// 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.
|
||||
|
||||
namespace Settings.UI.Library.Enumerations
|
||||
{
|
||||
public enum MeasureToolMeasureStyle
|
||||
{
|
||||
None,
|
||||
Bounds,
|
||||
Spacing,
|
||||
HorizontalSpacing,
|
||||
VerticalSpacing,
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
using Settings.UI.Library.Enumerations;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Library
|
||||
{
|
||||
@@ -18,6 +19,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
||||
DrawFeetOnCross = true;
|
||||
PerColorChannelEdgeDetection = false;
|
||||
MeasureCrossColor = new StringProperty("#FF4500");
|
||||
DefaultMeasureStyle = new IntProperty((int)MeasureToolMeasureStyle.None);
|
||||
}
|
||||
|
||||
public HotkeySettings ActivationShortcut { get; set; }
|
||||
@@ -37,6 +39,8 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
||||
|
||||
public StringProperty MeasureCrossColor { get; set; }
|
||||
|
||||
public IntProperty DefaultMeasureStyle { get; set; }
|
||||
|
||||
public override string ToString() => JsonSerializer.Serialize(this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -155,6 +155,27 @@
|
||||
<value>Customize the shortcut to bring up the command bar</value>
|
||||
<comment>"Screen Ruler" is the name of the utility</comment>
|
||||
</data>
|
||||
<data name="MeasureTool_DefaultMeasureStyle.Header" xml:space="preserve">
|
||||
<value>Default measure style</value>
|
||||
</data>
|
||||
<data name="MeasureTool_DefaultMeasureStyle.Description" xml:space="preserve">
|
||||
<value>The utility will start having the selected style activated</value>
|
||||
</data>
|
||||
<data name="MeasureTool_DefaultMeasureStyle_None.Content" xml:space="preserve">
|
||||
<value>None</value>
|
||||
</data>
|
||||
<data name="MeasureTool_DefaultMeasureStyle_Bounds.Content" xml:space="preserve">
|
||||
<value>Bounds</value>
|
||||
</data>
|
||||
<data name="MeasureTool_DefaultMeasureStyle_Spacing.Content" xml:space="preserve">
|
||||
<value>Spacing</value>
|
||||
</data>
|
||||
<data name="MeasureTool_DefaultMeasureStyle_Horizontal_Spacing.Content" xml:space="preserve">
|
||||
<value>Horizontal spacing</value>
|
||||
</data>
|
||||
<data name="MeasureTool_DefaultMeasureStyle_Vertical_Spacing.Content" xml:space="preserve">
|
||||
<value>Vertical spacing</value>
|
||||
</data>
|
||||
<data name="MeasureTool_UnitsOfMeasure.Header" xml:space="preserve">
|
||||
<value>Units of measurement</value>
|
||||
</data>
|
||||
|
||||
@@ -223,6 +223,23 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
public int DefaultMeasureStyle
|
||||
{
|
||||
get
|
||||
{
|
||||
return Settings.Properties.DefaultMeasureStyle.Value;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (Settings.Properties.DefaultMeasureStyle.Value != value)
|
||||
{
|
||||
Settings.Properties.DefaultMeasureStyle.Value = value;
|
||||
NotifyPropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void NotifyPropertyChanged([CallerMemberName] string propertyName = null)
|
||||
{
|
||||
OnPropertyChanged(propertyName);
|
||||
|
||||
@@ -39,6 +39,15 @@
|
||||
MinWidth="{StaticResource SettingActionControlMinWidth}"
|
||||
HotkeySettings="{x:Bind Path=ViewModel.ActivationShortcut, Mode=TwoWay}" />
|
||||
</labs:SettingsCard>
|
||||
<labs:SettingsCard x:Uid="MeasureTool_DefaultMeasureStyle">
|
||||
<ComboBox MinWidth="{StaticResource SettingActionControlMinWidth}" SelectedIndex="{x:Bind Path=ViewModel.DefaultMeasureStyle, Mode=TwoWay}">
|
||||
<ComboBoxItem x:Uid="MeasureTool_DefaultMeasureStyle_None"/>
|
||||
<ComboBoxItem x:Uid="MeasureTool_DefaultMeasureStyle_Bounds" />
|
||||
<ComboBoxItem x:Uid="MeasureTool_DefaultMeasureStyle_Spacing" />
|
||||
<ComboBoxItem x:Uid="MeasureTool_DefaultMeasureStyle_Horizontal_Spacing" />
|
||||
<ComboBoxItem x:Uid="MeasureTool_DefaultMeasureStyle_Vertical_Spacing" />
|
||||
</ComboBox>
|
||||
</labs:SettingsCard>
|
||||
|
||||
</controls:SettingsGroup>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user