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() public ColorPickerProperties()
{ {
ActivationShortcut = new HotkeySettings(false, true, false, false, "Break", 3); ActivationShortcut = new HotkeySettings(true, false, false, true, 0x43);
ChangeCursor = true; ChangeCursor = false;
} }
public HotkeySettings ActivationShortcut { get; set; } public HotkeySettings ActivationShortcut { get; set; }

View File

@@ -2,9 +2,6 @@
// The Microsoft Corporation licenses this file to you under the MIT license. // The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information. // 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;
using System.Text.Json.Serialization; using System.Text.Json.Serialization;
@@ -12,35 +9,28 @@ namespace Microsoft.PowerToys.Settings.UI.Lib
{ {
public class FZConfigProperties public class FZConfigProperties
{ {
public static readonly HotkeySettings DefaultHotkeyValue = new HotkeySettings(true, false, false, false, 0xc0);
public FZConfigProperties() public FZConfigProperties()
{ {
this.FancyzonesShiftDrag = new BoolProperty(ConfigDefaults.DefaultFancyzonesShiftDrag); FancyzonesShiftDrag = new BoolProperty(ConfigDefaults.DefaultFancyzonesShiftDrag);
this.FancyzonesOverrideSnapHotkeys = new BoolProperty(); FancyzonesOverrideSnapHotkeys = new BoolProperty();
this.FancyzonesMouseSwitch = new BoolProperty(); FancyzonesMouseSwitch = new BoolProperty();
this.FancyzonesMoveWindowsAcrossMonitors = new BoolProperty(); FancyzonesMoveWindowsAcrossMonitors = new BoolProperty();
this.FancyzonesDisplayChangeMoveWindows = new BoolProperty(); FancyzonesDisplayChangeMoveWindows = new BoolProperty();
this.FancyzonesZoneSetChangeMoveWindows = new BoolProperty(); FancyzonesZoneSetChangeMoveWindows = new BoolProperty();
this.FancyzonesAppLastZoneMoveWindows = new BoolProperty(); FancyzonesAppLastZoneMoveWindows = new BoolProperty();
this.FancyzonesOpenWindowOnActiveMonitor = new BoolProperty(); FancyzonesOpenWindowOnActiveMonitor = new BoolProperty();
this.FancyzonesRestoreSize = new BoolProperty(); FancyzonesRestoreSize = new BoolProperty();
this.UseCursorposEditorStartupscreen = new BoolProperty(ConfigDefaults.DefaultUseCursorposEditorStartupscreen); UseCursorposEditorStartupscreen = new BoolProperty(ConfigDefaults.DefaultUseCursorposEditorStartupscreen);
this.FancyzonesShowOnAllMonitors = new BoolProperty(); FancyzonesShowOnAllMonitors = new BoolProperty();
this.FancyzonesZoneHighlightColor = new StringProperty(ConfigDefaults.DefaultFancyZonesZoneHighlightColor); FancyzonesZoneHighlightColor = new StringProperty(ConfigDefaults.DefaultFancyZonesZoneHighlightColor);
this.FancyzonesHighlightOpacity = new IntProperty(50); FancyzonesHighlightOpacity = new IntProperty(50);
this.FancyzonesEditorHotkey = new KeyboardKeysProperty( FancyzonesEditorHotkey = new KeyboardKeysProperty(DefaultHotkeyValue);
new HotkeySettings() FancyzonesMakeDraggedWindowTransparent = new BoolProperty();
{ FancyzonesExcludedApps = new StringProperty();
Win = true, FancyzonesInActiveColor = new StringProperty(ConfigDefaults.DefaultFancyZonesInActiveColor);
Ctrl = false, FancyzonesBorderColor = new StringProperty(ConfigDefaults.DefaultFancyzonesBorderColor);
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);
} }
[JsonPropertyName("fancyzones_shiftDrag")] [JsonPropertyName("fancyzones_shiftDrag")]

View File

@@ -12,27 +12,33 @@ namespace Microsoft.PowerToys.Settings.UI.Lib
{ {
public HotkeySettings() public HotkeySettings()
{ {
this.Win = false; Win = false;
this.Ctrl = false; Ctrl = false;
this.Alt = false; Alt = false;
this.Shift = false; Shift = false;
this.Key = string.Empty; Code = 0;
this.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; Win = win;
Ctrl = ctrl; Ctrl = ctrl;
Alt = alt; Alt = alt;
Shift = shift; Shift = shift;
Key = key;
Code = code; Code = code;
} }
public HotkeySettings Clone() public HotkeySettings Clone()
{ {
return new HotkeySettings(Win, Ctrl, Alt, Shift, Key, Code); return new HotkeySettings(Win, Ctrl, Alt, Shift, Code);
} }
[JsonPropertyName("win")] [JsonPropertyName("win")]
@@ -47,9 +53,6 @@ namespace Microsoft.PowerToys.Settings.UI.Lib
[JsonPropertyName("shift")] [JsonPropertyName("shift")]
public bool Shift { get; set; } public bool Shift { get; set; }
[JsonPropertyName("key")]
public string Key { get; set; }
[JsonPropertyName("code")] [JsonPropertyName("code")]
public int Code { get; set; } public int Code { get; set; }

View File

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

View File

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

View File

@@ -69,10 +69,15 @@
<ComboBoxItem Content="RGB - RGB(100, 50, 75)"/> <ComboBoxItem Content="RGB - RGB(100, 50, 75)"/>
</ComboBox> </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" <ToggleSwitch x:Uid="ColorPicker_ChangeCursor"
IsOn="{Binding ChangeCursor, Mode=TwoWay}" IsOn="{Binding ChangeCursor, Mode=TwoWay}"
Margin="{StaticResource MediumTopMargin}" Margin="{StaticResource MediumTopMargin}"
IsEnabled="{Binding IsEnabled}"/> IsEnabled="{Binding IsEnabled}" />
-->
</StackPanel> </StackPanel>
<StackPanel <StackPanel
x:Name="SidePanel" x:Name="SidePanel"

View File

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