2020-07-17 03:31:09 +02:00
|
|
|
|
/*++
|
|
|
|
|
Copyright (c) Microsoft Corporation
|
|
|
|
|
Licensed under the MIT license.
|
|
|
|
|
|
|
|
|
|
Module Name:
|
|
|
|
|
- TerminalSettingsSerializationHelpers.h
|
|
|
|
|
|
|
|
|
|
Abstract:
|
|
|
|
|
- Specializations of the JsonUtils helpers for things that might end up in a
|
|
|
|
|
settings document.
|
|
|
|
|
|
|
|
|
|
--*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include "pch.h"
|
|
|
|
|
|
|
|
|
|
#include "JsonUtils.h"
|
|
|
|
|
#include "SettingsTypes.h"
|
|
|
|
|
|
2020-08-07 16:46:52 +02:00
|
|
|
|
JSON_ENUM_MAPPER(::winrt::Microsoft::Terminal::TerminalControl::CursorStyle)
|
2020-07-17 03:31:09 +02:00
|
|
|
|
{
|
|
|
|
|
static constexpr std::array<pair_type, 5> mappings = {
|
|
|
|
|
pair_type{ "bar", ValueType::Bar },
|
|
|
|
|
pair_type{ "vintage", ValueType::Vintage },
|
|
|
|
|
pair_type{ "underscore", ValueType::Underscore },
|
|
|
|
|
pair_type{ "filledBox", ValueType::FilledBox },
|
|
|
|
|
pair_type{ "emptyBox", ValueType::EmptyBox }
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
JSON_ENUM_MAPPER(::winrt::Windows::UI::Xaml::Media::Stretch)
|
|
|
|
|
{
|
|
|
|
|
static constexpr std::array<pair_type, 4> mappings = {
|
|
|
|
|
pair_type{ "uniformToFill", ValueType::UniformToFill },
|
|
|
|
|
pair_type{ "none", ValueType::None },
|
|
|
|
|
pair_type{ "fill", ValueType::Fill },
|
|
|
|
|
pair_type{ "uniform", ValueType::Uniform }
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2020-08-07 16:46:52 +02:00
|
|
|
|
JSON_ENUM_MAPPER(::winrt::Microsoft::Terminal::TerminalControl::ScrollbarState)
|
2020-07-17 03:31:09 +02:00
|
|
|
|
{
|
|
|
|
|
static constexpr std::array<pair_type, 2> mappings = {
|
|
|
|
|
pair_type{ "visible", ValueType::Visible },
|
|
|
|
|
pair_type{ "hidden", ValueType::Hidden }
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2020-11-18 23:55:10 +01:00
|
|
|
|
JSON_FLAG_MAPPER(::winrt::Microsoft::Terminal::Settings::Model::BellStyle)
|
2020-10-16 00:27:27 +02:00
|
|
|
|
{
|
2020-11-18 23:55:10 +01:00
|
|
|
|
static constexpr std::array<pair_type, 4> mappings = {
|
|
|
|
|
pair_type{ "none", AllClear },
|
|
|
|
|
pair_type{ "audible", ValueType::Audible },
|
|
|
|
|
pair_type{ "visual", ValueType::Visual },
|
|
|
|
|
pair_type{ "all", AllSet },
|
2020-10-16 00:27:27 +02:00
|
|
|
|
};
|
2020-11-18 23:55:10 +01:00
|
|
|
|
|
|
|
|
|
auto FromJson(const Json::Value& json)
|
|
|
|
|
{
|
|
|
|
|
if (json.isBool())
|
|
|
|
|
{
|
|
|
|
|
return json.asBool() ? AllSet : AllClear;
|
|
|
|
|
}
|
|
|
|
|
return BaseFlagMapper::FromJson(json);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool CanConvert(const Json::Value& json)
|
|
|
|
|
{
|
|
|
|
|
return BaseFlagMapper::CanConvert(json) || json.isBool();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Json::Value ToJson(const ::winrt::Microsoft::Terminal::Settings::Model::BellStyle& bellStyle)
|
|
|
|
|
{
|
|
|
|
|
return BaseFlagMapper::ToJson(bellStyle);
|
|
|
|
|
}
|
2020-10-16 00:27:27 +02:00
|
|
|
|
};
|
|
|
|
|
|
2020-12-03 00:14:11 +01:00
|
|
|
|
JSON_ENUM_MAPPER(::winrt::Microsoft::Terminal::Settings::Model::ConvergedAlignment)
|
2020-07-17 03:31:09 +02:00
|
|
|
|
{
|
|
|
|
|
// reduce repetition
|
|
|
|
|
static constexpr std::array<pair_type, 9> mappings = {
|
2020-12-03 00:14:11 +01:00
|
|
|
|
pair_type{ "center", ValueType::Horizontal_Center | ValueType::Vertical_Center },
|
|
|
|
|
pair_type{ "topLeft", ValueType::Horizontal_Left | ValueType::Vertical_Top },
|
|
|
|
|
pair_type{ "bottomLeft", ValueType::Horizontal_Left | ValueType::Vertical_Bottom },
|
|
|
|
|
pair_type{ "left", ValueType::Horizontal_Left | ValueType::Vertical_Center },
|
|
|
|
|
pair_type{ "topRight", ValueType::Horizontal_Right | ValueType::Vertical_Top },
|
|
|
|
|
pair_type{ "bottomRight", ValueType::Horizontal_Right | ValueType::Vertical_Bottom },
|
|
|
|
|
pair_type{ "right", ValueType::Horizontal_Right | ValueType::Vertical_Center },
|
|
|
|
|
pair_type{ "top", ValueType::Horizontal_Center | ValueType::Vertical_Top },
|
|
|
|
|
pair_type{ "bottom", ValueType::Horizontal_Center | ValueType::Vertical_Bottom }
|
2020-07-17 03:31:09 +02:00
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2020-08-07 16:46:52 +02:00
|
|
|
|
JSON_ENUM_MAPPER(::winrt::Microsoft::Terminal::TerminalControl::TextAntialiasingMode)
|
2020-07-17 03:31:09 +02:00
|
|
|
|
{
|
|
|
|
|
static constexpr std::array<pair_type, 3> mappings = {
|
|
|
|
|
pair_type{ "grayscale", ValueType::Grayscale },
|
|
|
|
|
pair_type{ "cleartype", ValueType::Cleartype },
|
|
|
|
|
pair_type{ "aliased", ValueType::Aliased }
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// Type Description:
|
|
|
|
|
// - Helper for converting a user-specified closeOnExit value to its corresponding enum
|
2020-10-06 18:56:59 +02:00
|
|
|
|
JSON_ENUM_MAPPER(::winrt::Microsoft::Terminal::Settings::Model::CloseOnExitMode)
|
2020-07-17 03:31:09 +02:00
|
|
|
|
{
|
|
|
|
|
JSON_MAPPINGS(3) = {
|
|
|
|
|
pair_type{ "always", ValueType::Always },
|
|
|
|
|
pair_type{ "graceful", ValueType::Graceful },
|
|
|
|
|
pair_type{ "never", ValueType::Never },
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// Override mapping parser to add boolean parsing
|
2020-10-06 18:56:59 +02:00
|
|
|
|
::winrt::Microsoft::Terminal::Settings::Model::CloseOnExitMode FromJson(const Json::Value& json)
|
2020-07-17 03:31:09 +02:00
|
|
|
|
{
|
|
|
|
|
if (json.isBool())
|
|
|
|
|
{
|
|
|
|
|
return json.asBool() ? ValueType::Graceful : ValueType::Never;
|
|
|
|
|
}
|
|
|
|
|
return EnumMapper::FromJson(json);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool CanConvert(const Json::Value& json)
|
|
|
|
|
{
|
|
|
|
|
return EnumMapper::CanConvert(json) || json.isBool();
|
|
|
|
|
}
|
2020-08-11 21:50:13 +02:00
|
|
|
|
|
|
|
|
|
using EnumMapper::TypeDescription;
|
2020-07-17 03:31:09 +02:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// This specialization isn't using JSON_ENUM_MAPPER because we need to have a different
|
|
|
|
|
// value type (unsinged int) and return type (FontWeight struct). JSON_ENUM_MAPPER
|
|
|
|
|
// expects that the value type _is_ the return type.
|
|
|
|
|
template<>
|
2020-10-06 18:56:59 +02:00
|
|
|
|
struct ::Microsoft::Terminal::Settings::Model::JsonUtils::ConversionTrait<::winrt::Windows::UI::Text::FontWeight> :
|
|
|
|
|
public ::Microsoft::Terminal::Settings::Model::JsonUtils::EnumMapper<
|
2020-07-17 03:31:09 +02:00
|
|
|
|
unsigned int,
|
2020-10-06 18:56:59 +02:00
|
|
|
|
::Microsoft::Terminal::Settings::Model::JsonUtils::ConversionTrait<::winrt::Windows::UI::Text::FontWeight>>
|
2020-07-17 03:31:09 +02:00
|
|
|
|
{
|
|
|
|
|
// The original parser used the font weight getters Bold(), Normal(), etc.
|
|
|
|
|
// They were both cumbersome and *not constant expressions*
|
|
|
|
|
JSON_MAPPINGS(11) = {
|
|
|
|
|
pair_type{ "thin", 100u },
|
|
|
|
|
pair_type{ "extra-light", 200u },
|
|
|
|
|
pair_type{ "light", 300u },
|
|
|
|
|
pair_type{ "semi-light", 350u },
|
|
|
|
|
pair_type{ "normal", 400u },
|
|
|
|
|
pair_type{ "medium", 500u },
|
|
|
|
|
pair_type{ "semi-bold", 600u },
|
|
|
|
|
pair_type{ "bold", 700u },
|
|
|
|
|
pair_type{ "extra-bold", 800u },
|
|
|
|
|
pair_type{ "black", 900u },
|
|
|
|
|
pair_type{ "extra-black", 950u },
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// Override mapping parser to add boolean parsing
|
|
|
|
|
auto FromJson(const Json::Value& json)
|
|
|
|
|
{
|
|
|
|
|
unsigned int value{ 400 };
|
|
|
|
|
if (json.isUInt())
|
|
|
|
|
{
|
|
|
|
|
value = json.asUInt();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
value = BaseEnumMapper::FromJson(json);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
::winrt::Windows::UI::Text::FontWeight weight{
|
|
|
|
|
static_cast<uint16_t>(std::clamp(value, 100u, 990u))
|
|
|
|
|
};
|
|
|
|
|
return weight;
|
|
|
|
|
}
|
|
|
|
|
|
2020-11-17 01:37:19 +01:00
|
|
|
|
Json::Value ToJson(const ::winrt::Windows::UI::Text::FontWeight& val)
|
|
|
|
|
{
|
|
|
|
|
const auto weight{ val.Weight };
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
return BaseEnumMapper::ToJson(weight);
|
|
|
|
|
}
|
|
|
|
|
catch (SerializationError&)
|
|
|
|
|
{
|
|
|
|
|
return weight;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-07-17 03:31:09 +02:00
|
|
|
|
bool CanConvert(const Json::Value& json)
|
|
|
|
|
{
|
|
|
|
|
return BaseEnumMapper::CanConvert(json) || json.isUInt();
|
|
|
|
|
}
|
2020-08-11 21:50:13 +02:00
|
|
|
|
|
|
|
|
|
using EnumMapper::TypeDescription;
|
2020-07-17 03:31:09 +02:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
JSON_ENUM_MAPPER(::winrt::Windows::UI::Xaml::ElementTheme)
|
|
|
|
|
{
|
|
|
|
|
JSON_MAPPINGS(3) = {
|
|
|
|
|
pair_type{ "system", ValueType::Default },
|
|
|
|
|
pair_type{ "light", ValueType::Light },
|
|
|
|
|
pair_type{ "dark", ValueType::Dark },
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2020-10-06 18:56:59 +02:00
|
|
|
|
JSON_ENUM_MAPPER(::winrt::Microsoft::Terminal::Settings::Model::LaunchMode)
|
2020-07-17 03:31:09 +02:00
|
|
|
|
{
|
2020-10-15 00:19:51 +02:00
|
|
|
|
JSON_MAPPINGS(5) = {
|
2020-07-17 03:31:09 +02:00
|
|
|
|
pair_type{ "default", ValueType::DefaultMode },
|
|
|
|
|
pair_type{ "maximized", ValueType::MaximizedMode },
|
|
|
|
|
pair_type{ "fullscreen", ValueType::FullscreenMode },
|
2020-10-15 00:19:51 +02:00
|
|
|
|
pair_type{ "focus", ValueType::FocusMode },
|
|
|
|
|
pair_type{ "maximizedFocus", ValueType::MaximizedFocusMode },
|
2020-07-17 03:31:09 +02:00
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
JSON_ENUM_MAPPER(::winrt::Microsoft::UI::Xaml::Controls::TabViewWidthMode)
|
|
|
|
|
{
|
|
|
|
|
JSON_MAPPINGS(3) = {
|
|
|
|
|
pair_type{ "equal", ValueType::Equal },
|
|
|
|
|
pair_type{ "titleLength", ValueType::SizeToContent },
|
|
|
|
|
pair_type{ "compact", ValueType::Compact },
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2020-10-06 18:56:59 +02:00
|
|
|
|
JSON_ENUM_MAPPER(winrt::Microsoft::Terminal::Settings::Model::ExpandCommandType)
|
2020-08-19 19:33:19 +02:00
|
|
|
|
{
|
|
|
|
|
JSON_MAPPINGS(2) = {
|
|
|
|
|
pair_type{ "profiles", ValueType::Profiles },
|
|
|
|
|
pair_type{ "schemes", ValueType::ColorSchemes },
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
Add copyFormatting keybinding arg and array support (#6004)
Adds array support for the existing `copyFormatting` global setting.
This allows users to define which formats they would specifically like
to be copied.
A boolean value is still accepted and is translated to the following:
- `false` --> `"none"` or `[]`
- `true` --> `"all"` or `["html", "rtf"]`
This also adds `copyFormatting` as a keybinding arg for `copy`. As with
the global setting, a boolean value and array value is accepted.
CopyFormat is a WinRT enum where each accepted format is a flag.
Currently accepted formats include `html`, and `rtf`. A boolean value is
accepted and converted. `true` is a conjunction of all the formats.
`false` only includes plain text.
For the global setting, `null` is not accepted. We already have a
default value from before so no worries there.
For the keybinding arg, `null` (the default value) means that we just do
what the global arg says to do. Overall, the `copyFormatting` keybinding
arg is an override of the global setting **when using that keybinding**.
References #5212 - Spec for formatted copying
References #2690 - disable html copy
Validated behavior with every combination of values below:
- `copyFormatting` global: { `true`, `false`, `[]`, `["html"]` }
- `copyFormatting` copy arg:
{ `null`, `true`, `false`, `[]`, `[, "html"]`}
Closes #4191
Closes #5262
2020-08-15 03:02:24 +02:00
|
|
|
|
JSON_FLAG_MAPPER(::winrt::Microsoft::Terminal::TerminalControl::CopyFormat)
|
|
|
|
|
{
|
|
|
|
|
JSON_MAPPINGS(5) = {
|
|
|
|
|
pair_type{ "none", AllClear },
|
|
|
|
|
pair_type{ "html", ValueType::HTML },
|
|
|
|
|
pair_type{ "rtf", ValueType::RTF },
|
|
|
|
|
pair_type{ "all", AllSet },
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
auto FromJson(const Json::Value& json)
|
|
|
|
|
{
|
|
|
|
|
if (json.isBool())
|
|
|
|
|
{
|
|
|
|
|
return json.asBool() ? AllSet : AllClear;
|
|
|
|
|
}
|
|
|
|
|
return BaseFlagMapper::FromJson(json);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool CanConvert(const Json::Value& json)
|
|
|
|
|
{
|
|
|
|
|
return BaseFlagMapper::CanConvert(json) || json.isBool();
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2020-07-17 03:31:09 +02:00
|
|
|
|
// Type Description:
|
|
|
|
|
// - Helper for converting the initial position string into
|
|
|
|
|
// 2 coordinate values. We allow users to only provide one coordinate,
|
|
|
|
|
// thus, we use comma as the separator:
|
|
|
|
|
// (100, 100): standard input string
|
|
|
|
|
// (, 100), (100, ): if a value is missing, we set this value as a default
|
|
|
|
|
// (,): both x and y are set to default
|
|
|
|
|
// (abc, 100): if a value is not valid, we treat it as default
|
|
|
|
|
// (100, 100, 100): we only read the first two values, this is equivalent to (100, 100)
|
|
|
|
|
template<>
|
2020-10-06 18:56:59 +02:00
|
|
|
|
struct ::Microsoft::Terminal::Settings::Model::JsonUtils::ConversionTrait<::winrt::Microsoft::Terminal::Settings::Model::LaunchPosition>
|
2020-07-17 03:31:09 +02:00
|
|
|
|
{
|
2020-10-06 18:56:59 +02:00
|
|
|
|
::winrt::Microsoft::Terminal::Settings::Model::LaunchPosition FromJson(const Json::Value& json)
|
2020-07-17 03:31:09 +02:00
|
|
|
|
{
|
2020-10-06 18:56:59 +02:00
|
|
|
|
::winrt::Microsoft::Terminal::Settings::Model::LaunchPosition ret;
|
2020-07-17 03:31:09 +02:00
|
|
|
|
std::string initialPosition{ json.asString() };
|
|
|
|
|
static constexpr char singleCharDelim = ',';
|
|
|
|
|
std::stringstream tokenStream(initialPosition);
|
|
|
|
|
std::string token;
|
|
|
|
|
uint8_t initialPosIndex = 0;
|
|
|
|
|
|
|
|
|
|
// Get initial position values till we run out of delimiter separated values in the stream
|
|
|
|
|
// or we hit max number of allowable values (= 2)
|
|
|
|
|
// Non-numeral values or empty string will be caught as exception and we do not assign them
|
|
|
|
|
for (; std::getline(tokenStream, token, singleCharDelim) && (initialPosIndex < 2); initialPosIndex++)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
2020-08-28 05:49:16 +02:00
|
|
|
|
int64_t position = std::stol(token);
|
2020-07-17 03:31:09 +02:00
|
|
|
|
if (initialPosIndex == 0)
|
|
|
|
|
{
|
2020-08-28 05:49:16 +02:00
|
|
|
|
ret.X = position;
|
2020-07-17 03:31:09 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (initialPosIndex == 1)
|
|
|
|
|
{
|
2020-08-28 05:49:16 +02:00
|
|
|
|
ret.Y = position;
|
2020-07-17 03:31:09 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (...)
|
|
|
|
|
{
|
|
|
|
|
// Do nothing
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool CanConvert(const Json::Value& json)
|
|
|
|
|
{
|
|
|
|
|
return json.isString();
|
|
|
|
|
}
|
2020-08-11 21:50:13 +02:00
|
|
|
|
|
2020-10-06 18:56:59 +02:00
|
|
|
|
Json::Value ToJson(const ::winrt::Microsoft::Terminal::Settings::Model::LaunchPosition& val)
|
2020-09-17 20:27:46 +02:00
|
|
|
|
{
|
|
|
|
|
std::stringstream ss;
|
|
|
|
|
if (val.X)
|
|
|
|
|
{
|
|
|
|
|
ss << val.X.Value();
|
|
|
|
|
}
|
|
|
|
|
ss << ",";
|
|
|
|
|
if (val.Y)
|
|
|
|
|
{
|
|
|
|
|
ss << val.Y.Value();
|
|
|
|
|
}
|
|
|
|
|
return ss.str();
|
|
|
|
|
}
|
|
|
|
|
|
2020-08-11 21:50:13 +02:00
|
|
|
|
std::string TypeDescription() const
|
|
|
|
|
{
|
|
|
|
|
return "x, y";
|
|
|
|
|
}
|
2020-07-17 03:31:09 +02:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// Possible Direction values
|
2020-10-06 18:56:59 +02:00
|
|
|
|
JSON_ENUM_MAPPER(::winrt::Microsoft::Terminal::Settings::Model::Direction)
|
2020-07-17 03:31:09 +02:00
|
|
|
|
{
|
|
|
|
|
JSON_MAPPINGS(4) = {
|
|
|
|
|
pair_type{ "left", ValueType::Left },
|
|
|
|
|
pair_type{ "right", ValueType::Right },
|
|
|
|
|
pair_type{ "up", ValueType::Up },
|
|
|
|
|
pair_type{ "down", ValueType::Down },
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// Possible SplitState values
|
2020-10-06 18:56:59 +02:00
|
|
|
|
JSON_ENUM_MAPPER(::winrt::Microsoft::Terminal::Settings::Model::SplitState)
|
2020-07-17 03:31:09 +02:00
|
|
|
|
{
|
|
|
|
|
JSON_MAPPINGS(3) = {
|
|
|
|
|
pair_type{ "vertical", ValueType::Vertical },
|
|
|
|
|
pair_type{ "horizontal", ValueType::Horizontal },
|
|
|
|
|
pair_type{ "auto", ValueType::Automatic },
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// Possible SplitType values
|
2020-10-06 18:56:59 +02:00
|
|
|
|
JSON_ENUM_MAPPER(::winrt::Microsoft::Terminal::Settings::Model::SplitType)
|
2020-07-17 03:31:09 +02:00
|
|
|
|
{
|
|
|
|
|
JSON_MAPPINGS(1) = {
|
|
|
|
|
pair_type{ "duplicate", ValueType::Duplicate },
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2020-10-06 18:56:59 +02:00
|
|
|
|
JSON_ENUM_MAPPER(::winrt::Microsoft::Terminal::Settings::Model::SettingsTarget)
|
2020-07-17 03:31:09 +02:00
|
|
|
|
{
|
|
|
|
|
JSON_MAPPINGS(3) = {
|
|
|
|
|
pair_type{ "settingsFile", ValueType::SettingsFile },
|
|
|
|
|
pair_type{ "defaultsFile", ValueType::DefaultsFile },
|
|
|
|
|
pair_type{ "allFiles", ValueType::AllFiles },
|
|
|
|
|
};
|
|
|
|
|
};
|
2020-08-11 16:03:12 +02:00
|
|
|
|
|
|
|
|
|
JSON_ENUM_MAPPER(::winrt::Windows::System::VirtualKey)
|
|
|
|
|
{
|
|
|
|
|
JSON_MAPPINGS(3) = {
|
|
|
|
|
pair_type{ "ctrl", ValueType::Control },
|
|
|
|
|
pair_type{ "alt", ValueType::Menu },
|
|
|
|
|
pair_type{ "shift", ValueType::Shift },
|
|
|
|
|
};
|
|
|
|
|
};
|
2020-11-05 15:28:16 +01:00
|
|
|
|
|
|
|
|
|
JSON_ENUM_MAPPER(::winrt::Microsoft::Terminal::Settings::Model::TabSwitcherMode)
|
|
|
|
|
{
|
|
|
|
|
JSON_MAPPINGS(3) = {
|
|
|
|
|
pair_type{ "mru", ValueType::MostRecentlyUsed },
|
|
|
|
|
pair_type{ "inOrder", ValueType::InOrder },
|
|
|
|
|
pair_type{ "disabled", ValueType::Disabled },
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
auto FromJson(const Json::Value& json)
|
|
|
|
|
{
|
|
|
|
|
if (json.isBool())
|
|
|
|
|
{
|
|
|
|
|
return json.asBool() ? ValueType::MostRecentlyUsed : ValueType::Disabled;
|
|
|
|
|
}
|
|
|
|
|
return BaseEnumMapper::FromJson(json);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool CanConvert(const Json::Value& json)
|
|
|
|
|
{
|
|
|
|
|
return BaseEnumMapper::CanConvert(json) || json.isBool();
|
|
|
|
|
}
|
|
|
|
|
};
|
2020-11-25 23:09:27 +01:00
|
|
|
|
|
|
|
|
|
// Possible Direction values
|
|
|
|
|
JSON_ENUM_MAPPER(::winrt::Microsoft::Terminal::Settings::Model::MoveTabDirection)
|
|
|
|
|
{
|
|
|
|
|
JSON_MAPPINGS(2) = {
|
|
|
|
|
pair_type{ "forward", ValueType::Forward },
|
|
|
|
|
pair_type{ "backward", ValueType::Backward },
|
|
|
|
|
};
|
|
|
|
|
};
|
2020-12-03 17:15:31 +01:00
|
|
|
|
|
|
|
|
|
JSON_ENUM_MAPPER(::winrt::Microsoft::Terminal::Settings::Model::CommandPaletteLaunchMode)
|
|
|
|
|
{
|
|
|
|
|
JSON_MAPPINGS(2) = {
|
|
|
|
|
pair_type{ "action", ValueType::Action },
|
|
|
|
|
pair_type{ "commandLine", ValueType::CommandLine },
|
|
|
|
|
};
|
|
|
|
|
};
|