Color picker tweaks (#5194)

* Adjustments on default keystroke and removing key string whihc really didn't do anything

* moving color picker into alphabetical order

* removing removed property

* adjusting comment based on feedback from martin

Co-authored-by: Clint Rutkas <crutkas@microsoft.com>
This commit is contained in:
Clint Rutkas
2020-07-23 15:53:12 -07:00
committed by GitHub
parent 84018f5b61
commit b6e5a5e655
7 changed files with 51 additions and 54 deletions

View File

@@ -17,8 +17,8 @@ namespace Microsoft.PowerToys.Settings.UI.Lib
{
public ColorPickerProperties()
{
ActivationShortcut = new HotkeySettings(false, true, false, false, "Break", 3);
ChangeCursor = true;
ActivationShortcut = new HotkeySettings(true, false, false, true, 0x43);
ChangeCursor = false;
}
public HotkeySettings ActivationShortcut { get; set; }

View File

@@ -2,9 +2,6 @@
// 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.Text;
using System.Text.Json;
using System.Text.Json.Serialization;
@@ -12,35 +9,28 @@ namespace Microsoft.PowerToys.Settings.UI.Lib
{
public class FZConfigProperties
{
public static readonly HotkeySettings DefaultHotkeyValue = new HotkeySettings(true, false, false, false, 0xc0);
public FZConfigProperties()
{
this.FancyzonesShiftDrag = new BoolProperty(ConfigDefaults.DefaultFancyzonesShiftDrag);
this.FancyzonesOverrideSnapHotkeys = new BoolProperty();
this.FancyzonesMouseSwitch = new BoolProperty();
this.FancyzonesMoveWindowsAcrossMonitors = new BoolProperty();
this.FancyzonesDisplayChangeMoveWindows = new BoolProperty();
this.FancyzonesZoneSetChangeMoveWindows = new BoolProperty();
this.FancyzonesAppLastZoneMoveWindows = new BoolProperty();
this.FancyzonesOpenWindowOnActiveMonitor = new BoolProperty();
this.FancyzonesRestoreSize = new BoolProperty();
this.UseCursorposEditorStartupscreen = new BoolProperty(ConfigDefaults.DefaultUseCursorposEditorStartupscreen);
this.FancyzonesShowOnAllMonitors = new BoolProperty();
this.FancyzonesZoneHighlightColor = new StringProperty(ConfigDefaults.DefaultFancyZonesZoneHighlightColor);
this.FancyzonesHighlightOpacity = new IntProperty(50);
this.FancyzonesEditorHotkey = new KeyboardKeysProperty(
new HotkeySettings()
{
Win = true,
Ctrl = false,
Alt = false,
Shift = false,
Key = "`",
Code = 192,
});
this.FancyzonesMakeDraggedWindowTransparent = new BoolProperty();
this.FancyzonesExcludedApps = new StringProperty();
this.FancyzonesInActiveColor = new StringProperty(ConfigDefaults.DefaultFancyZonesInActiveColor);
this.FancyzonesBorderColor = new StringProperty(ConfigDefaults.DefaultFancyzonesBorderColor);
FancyzonesShiftDrag = new BoolProperty(ConfigDefaults.DefaultFancyzonesShiftDrag);
FancyzonesOverrideSnapHotkeys = new BoolProperty();
FancyzonesMouseSwitch = new BoolProperty();
FancyzonesMoveWindowsAcrossMonitors = new BoolProperty();
FancyzonesDisplayChangeMoveWindows = new BoolProperty();
FancyzonesZoneSetChangeMoveWindows = new BoolProperty();
FancyzonesAppLastZoneMoveWindows = new BoolProperty();
FancyzonesOpenWindowOnActiveMonitor = new BoolProperty();
FancyzonesRestoreSize = new BoolProperty();
UseCursorposEditorStartupscreen = new BoolProperty(ConfigDefaults.DefaultUseCursorposEditorStartupscreen);
FancyzonesShowOnAllMonitors = new BoolProperty();
FancyzonesZoneHighlightColor = new StringProperty(ConfigDefaults.DefaultFancyZonesZoneHighlightColor);
FancyzonesHighlightOpacity = new IntProperty(50);
FancyzonesEditorHotkey = new KeyboardKeysProperty(DefaultHotkeyValue);
FancyzonesMakeDraggedWindowTransparent = new BoolProperty();
FancyzonesExcludedApps = new StringProperty();
FancyzonesInActiveColor = new StringProperty(ConfigDefaults.DefaultFancyZonesInActiveColor);
FancyzonesBorderColor = new StringProperty(ConfigDefaults.DefaultFancyzonesBorderColor);
}
[JsonPropertyName("fancyzones_shiftDrag")]

View File

@@ -12,27 +12,33 @@ namespace Microsoft.PowerToys.Settings.UI.Lib
{
public HotkeySettings()
{
this.Win = false;
this.Ctrl = false;
this.Alt = false;
this.Shift = false;
this.Key = string.Empty;
this.Code = 0;
Win = false;
Ctrl = false;
Alt = false;
Shift = false;
Code = 0;
}
public HotkeySettings(bool win, bool ctrl, bool alt, bool shift, string key, int code)
/// <summary>
/// Initializes a new instance of the <see cref="HotkeySettings"/> class.
/// </summary>
/// <param name="win">Should Windows key be used</param>
/// <param name="ctrl">Should Ctrl key be used</param>
/// <param name="alt">Should Alt key be used</param>
/// <param name="shift">Should Shift key be used</param>
/// <param name="code">Go to https://docs.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes to see list of v-keys</param>
public HotkeySettings(bool win, bool ctrl, bool alt, bool shift, int code)
{
Win = win;
Ctrl = ctrl;
Alt = alt;
Shift = shift;
Key = key;
Code = code;
}
public HotkeySettings Clone()
{
return new HotkeySettings(Win, Ctrl, Alt, Shift, Key, Code);
return new HotkeySettings(Win, Ctrl, Alt, Shift, Code);
}
[JsonPropertyName("win")]
@@ -47,9 +53,6 @@ namespace Microsoft.PowerToys.Settings.UI.Lib
[JsonPropertyName("shift")]
public bool Shift { get; set; }
[JsonPropertyName("key")]
public string Key { get; set; }
[JsonPropertyName("code")]
public int Code { get; set; }

View File

@@ -126,7 +126,6 @@ namespace Microsoft.PowerToys.Settings.UI.Controls
return;
default:
internalSettings.Code = matchValueCode;
internalSettings.Key = matchValueText;
break;
}
}

View File

@@ -420,7 +420,8 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
{
if (value.IsEmpty())
{
_editorHotkey = new HotkeySettings(true, false, false, false, "'", 192);
_editorHotkey = FZConfigProperties.DefaultHotkeyValue;
}
else
{

View File

@@ -69,10 +69,15 @@
<ComboBoxItem Content="RGB - RGB(100, 50, 75)"/>
</ComboBox>
<!--
Disabling this until we have a safer way to reset cursor as
we can hit a state where the cursor doesn't reset
<ToggleSwitch x:Uid="ColorPicker_ChangeCursor"
IsOn="{Binding ChangeCursor, Mode=TwoWay}"
Margin="{StaticResource MediumTopMargin}"
IsEnabled="{Binding IsEnabled}"/>
IsEnabled="{Binding IsEnabled}" />
-->
</StackPanel>
<StackPanel
x:Name="SidePanel"

View File

@@ -46,6 +46,12 @@
</winui:NavigationViewItem.Icon>
</winui:NavigationViewItem>
<winui:NavigationViewItem x:Uid="Shell_ColorPicker" helpers:NavHelper.NavigateTo="views:ColorPickerPage">
<winui:NavigationViewItem.Icon>
<FontIcon Glyph="&#xEF3C;"/>
</winui:NavigationViewItem.Icon>
</winui:NavigationViewItem>
<!-- TO DO: Update icon -->
<winui:NavigationViewItem x:Uid="Shell_FancyZones" helpers:NavHelper.NavigateTo="views:FancyZonesPage">
<winui:NavigationViewItem.Icon>
@@ -93,13 +99,6 @@
<FontIcon Glyph="&#xEDA7;"/>
</winui:NavigationViewItem.Icon>
</winui:NavigationViewItem>
<winui:NavigationViewItem x:Uid="Shell_ColorPicker" helpers:NavHelper.NavigateTo="views:ColorPickerPage">
<winui:NavigationViewItem.Icon>
<FontIcon Glyph="&#xEF3C;"/>
</winui:NavigationViewItem.Icon>
</winui:NavigationViewItem>
</winui:NavigationView.MenuItems>
<i:Interaction.Behaviors>
<behaviors:NavigationViewHeaderBehavior