mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 18:57:19 +02:00
[Screen Ruler] Better error handling and reuse D3D device (#20223)
* [Screen Ruler] simplify lines calculation * [Screen Ruler] Add inches and centimeters support * [Chore] prefer x64 toolset to avoid hitting C1076 * [Screen Ruler] Allow making screenshots in non-continuous mode * [Screen Ruler] Use single d3d device for all ops * [Screen Ruler] remove gpu mutex and clean up screen capturing * [Screen Ruler] handle and log DXGI initialization failure * [Screen Ruler] Add unhandled exception handler * [Screen Ruler] comment out Units of Measure setting * [Screen Ruler] introduce a separate device dedicated for capturing
This commit is contained in:
@@ -14,6 +14,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
||||
public MeasureToolProperties()
|
||||
{
|
||||
ActivationShortcut = new HotkeySettings(true, false, false, true, 0x4D);
|
||||
UnitsOfMeasure = new IntProperty(0);
|
||||
PixelTolerance = new IntProperty(30);
|
||||
ContinuousCapture = true;
|
||||
DrawFeetOnCross = true;
|
||||
@@ -32,6 +33,8 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
||||
[JsonConverter(typeof(BoolPropertyJsonConverter))]
|
||||
public bool PerColorChannelEdgeDetection { get; set; }
|
||||
|
||||
public IntProperty UnitsOfMeasure { get; set; }
|
||||
|
||||
public IntProperty PixelTolerance { get; set; }
|
||||
|
||||
public StringProperty MeasureCrossColor { get; set; }
|
||||
|
||||
@@ -129,6 +129,23 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
public int UnitsOfMeasure
|
||||
{
|
||||
get
|
||||
{
|
||||
return Settings.Properties.UnitsOfMeasure.Value;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (Settings.Properties.UnitsOfMeasure.Value != value)
|
||||
{
|
||||
Settings.Properties.UnitsOfMeasure.Value = value;
|
||||
NotifyPropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int PixelTolerance
|
||||
{
|
||||
get
|
||||
|
||||
@@ -155,6 +155,18 @@
|
||||
<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_UnitsOfMeasure.Header" xml:space="preserve">
|
||||
<value>Units of measurement</value>
|
||||
</data>
|
||||
<data name="MeasureTool_UnitsOfMeasure_Pixels.Content" xml:space="preserve">
|
||||
<value>Pixels</value>
|
||||
</data>
|
||||
<data name="MeasureTool_UnitsOfMeasure_Inches.Content" xml:space="preserve">
|
||||
<value>Inches</value>
|
||||
</data>
|
||||
<data name="MeasureTool_UnitsOfMeasure_Centimeters.Content" xml:space="preserve">
|
||||
<value>Centimeters</value>
|
||||
</data>
|
||||
<data name="MeasureTool_PixelTolerance.Header" xml:space="preserve">
|
||||
<value>Pixel tolerance for edge detection</value>
|
||||
</data>
|
||||
|
||||
@@ -49,6 +49,7 @@
|
||||
IsOpen="{x:Bind Mode=OneWay, Path=ViewModel.ShowContinuousCaptureWarning}"
|
||||
IsTabStop="{x:Bind Mode=OneWay, Path=ViewModel.ShowContinuousCaptureWarning}"
|
||||
IsClosable="False" />
|
||||
|
||||
<controls:Setting x:Uid="MeasureTool_PerColorChannelEdgeDetection" Icon="">
|
||||
<controls:Setting.ActionContent>
|
||||
<ToggleSwitch
|
||||
@@ -56,6 +57,7 @@
|
||||
x:Uid="MeasureTool_PerColorChannelEdgeDetection_ToggleSwitch" />
|
||||
</controls:Setting.ActionContent>
|
||||
</controls:Setting>
|
||||
|
||||
<controls:Setting x:Uid="MeasureTool_PixelTolerance">
|
||||
<controls:Setting.ActionContent>
|
||||
<Slider Minimum="0"
|
||||
@@ -65,6 +67,16 @@
|
||||
</controls:Setting.ActionContent>
|
||||
</controls:Setting>
|
||||
|
||||
<!--<controls:Setting x:Uid="MeasureTool_UnitsOfMeasure" Icon="">
|
||||
<controls:Setting.ActionContent>
|
||||
<ComboBox SelectedIndex="{x:Bind Path=ViewModel.UnitsOfMeasure, Mode=TwoWay}" MinWidth="{StaticResource SettingActionControlMinWidth}">
|
||||
<ComboBoxItem x:Uid="MeasureTool_UnitsOfMeasure_Pixels" />
|
||||
<ComboBoxItem x:Uid="MeasureTool_UnitsOfMeasure_Inches" />
|
||||
<ComboBoxItem x:Uid="MeasureTool_UnitsOfMeasure_Centimeters" />
|
||||
</ComboBox>
|
||||
</controls:Setting.ActionContent>
|
||||
</controls:Setting>-->
|
||||
|
||||
<controls:Setting x:Uid="MeasureTool_DrawFeetOnCross">
|
||||
<controls:Setting.ActionContent>
|
||||
<ToggleSwitch IsOn="{x:Bind ViewModel.DrawFeetOnCross, Mode=TwoWay}" x:Uid="MeasureTool_DrawFeetOnCross_ToggleSwitch" />
|
||||
|
||||
Reference in New Issue
Block a user