New color picker module - integrated from github.com/martinchrzan/Col… (#4778)

* New color picker module - integrated from github.com/martinchrzan/ColorPicker

* Trying to fix build in github

* Replaced icon in the settings to use font icon instead of path icon

* Closing ColorPicker.exe when PowerToys process closed, added color picker project into runner dependencies, restoring cursors on exit, added ManagedCommon as a dependency into installer

* User/ryanbod/fix colorpicker release (#5046)

* Changing configuration to x64 instead of AnyCPU.   The previous configuration was preventing the ManagedCommon binary from being loaded in Release.

* Updating MSI Installer with new icons (#4998)

* Adding missed dll into installer

* Fixed potential exception

* Creating settings.json on the first start when there are none, fixed default keyboard shortcut

* Added ColorPicker.exe.config into installer

* Start filewatcher after default settings file is created

* Fixing build

Co-authored-by: ryanbodrug-microsoft <56318517+ryanbodrug-microsoft@users.noreply.github.com>
This commit is contained in:
martinchrzan
2020-07-18 21:27:36 +02:00
committed by GitHub
parent d09253e532
commit bc301f269a
72 changed files with 3654 additions and 6 deletions

View File

@@ -0,0 +1,38 @@
// 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.Text.Json;
using System.Text.Json.Serialization;
namespace Microsoft.PowerToys.Settings.UI.Lib
{
public enum ColorRepresentationType
{
HEX = 0,
RGB = 1,
}
public class ColorPickerProperties
{
public ColorPickerProperties()
{
ActivationShortcut = new HotkeySettings(false, true, false, false, "Break", 3);
ChangeCursor = true;
}
public HotkeySettings ActivationShortcut { get; set; }
[JsonPropertyName("changecursor")]
[JsonConverter(typeof(BoolPropertyJsonConverter))]
public bool ChangeCursor { get; set; }
[JsonPropertyName("copiedcolorrepresentation")]
public ColorRepresentationType CopiedColorRepresentation { get; set; }
public override string ToString()
{
return JsonSerializer.Serialize(this);
}
}
}

View File

@@ -0,0 +1,38 @@
// 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.Text.Json;
namespace Microsoft.PowerToys.Settings.UI.Lib
{
public class ColorPickerSettings : BasePTModuleSettings
{
public const string ModuleName = "ColorPicker";
public ColorPickerProperties properties { get; set; }
public ColorPickerSettings()
{
properties = new ColorPickerProperties();
version = "1";
name = ModuleName;
}
public override string ToJsonString()
{
return JsonSerializer.Serialize(this);
}
public virtual void Save()
{
// Save settings to file
var options = new JsonSerializerOptions
{
WriteIndented = true,
};
SettingsUtils.SaveSettings(JsonSerializer.Serialize(this, options), ModuleName);
}
}
}

View File

@@ -96,6 +96,7 @@ namespace Microsoft.PowerToys.Settings.UI.Lib
}
private bool keyboardManager = true;
[JsonPropertyName("Keyboard Manager")]
public bool KeyboardManager
{
@@ -112,7 +113,7 @@ namespace Microsoft.PowerToys.Settings.UI.Lib
private bool powerLauncher = true;
[JsonPropertyName("PowerToys Run")]
[JsonPropertyName("PowerToys Run")]
public bool PowerLauncher
{
get => this.powerLauncher;
@@ -123,8 +124,24 @@ namespace Microsoft.PowerToys.Settings.UI.Lib
LogTelemetryEvent(value);
this.powerLauncher = value;
}
}
}
}
}
private bool colorPicker = true;
[JsonPropertyName("ColorPicker")]
public bool ColorPicker
{
get => this.colorPicker;
set
{
if (this.colorPicker != value)
{
LogTelemetryEvent(value);
this.colorPicker = value;
}
}
}
public string ToJsonString()
{
@@ -141,4 +158,4 @@ namespace Microsoft.PowerToys.Settings.UI.Lib
PowerToysTelemetry.Log.WriteEvent(dataEvent);
}
}
}
}