2608e94822
Introduces a new TerminalSettingsModel (TSM) project. This project is responsible for (de)serializing and exposing Windows Terminal's settings as WinRT objects. ## References #885: TSM epic #1564: Settings UI is dependent on this for data binding and settings access #6904: TSM Spec In the process of ripping out TSM from TerminalApp, a few other changes were made to make this possible: 1. AppLogic's `ApplicationDisplayName` and `ApplicationVersion` was moved to `CascadiaSettings` - These are defined as static functions. They also no longer check if `AppLogic::Current()` is nullptr. 2. `enum LaunchMode` was moved from TerminalApp to TSM 3. `AzureConnectionType` and `TelnetConnectionType` were moved from the profile generators to their respective TerminalConnections 4. CascadiaSettings' `SettingsPath` and `DefaultSettingsPath` are exposed as `hstring` instead of `std::filesystem::path` 5. `Command::ExpandCommands()` was exposed via the IDL - This required some of the warnings to be saved to an `IVector` instead of `std::vector`, among some other small changes. 6. The localization resources had to be split into two halves. - Resource file linked in init.cpp. Verified at runtime thanks to the StaticResourceLoader. 7. Added constructors to some `ActionArgs` 8. Utils.h/cpp were moved to `cascadia/inc`. `JsonKey()` was moved to `JsonUtils`. Both TermApp and TSM need access to Utils.h/cpp. A large amount of work includes moving to the new namespace (`TerminalApp` --> `Microsoft::Terminal::Settings::Model`). Fixing the tests had its own complications. Testing required us to split up TSM into a DLL and LIB, similar to TermApp. Discussion on creating a non-local test variant can be found in #7743. Closes #885
62 lines
1.9 KiB
C++
62 lines
1.9 KiB
C++
/*++
|
|
Copyright (c) Microsoft Corporation
|
|
Licensed under the MIT license.
|
|
|
|
Module Name:
|
|
- ColorScheme.hpp
|
|
|
|
Abstract:
|
|
- A color scheme is a single set of colors to use as the terminal colors. These
|
|
schemes are named, and can be used to quickly change all the colors of the
|
|
terminal to another scheme.
|
|
|
|
Author(s):
|
|
- Mike Griese - March 2019
|
|
|
|
--*/
|
|
#pragma once
|
|
#include "../../inc/conattrs.hpp"
|
|
#include "inc/cppwinrt_utils.h"
|
|
|
|
#include "ColorScheme.g.h"
|
|
|
|
// fwdecl unittest classes
|
|
namespace SettingsModelLocalTests
|
|
{
|
|
class SettingsTests;
|
|
class ColorSchemeTests;
|
|
};
|
|
|
|
namespace winrt::Microsoft::Terminal::Settings::Model::implementation
|
|
{
|
|
struct ColorScheme : ColorSchemeT<ColorScheme>
|
|
{
|
|
public:
|
|
ColorScheme();
|
|
ColorScheme(hstring name, Windows::UI::Color defaultFg, Windows::UI::Color defaultBg, Windows::UI::Color cursorColor);
|
|
|
|
static com_ptr<ColorScheme> FromJson(const Json::Value& json);
|
|
bool ShouldBeLayered(const Json::Value& json) const;
|
|
void LayerJson(const Json::Value& json);
|
|
|
|
Json::Value ToJson();
|
|
|
|
static std::optional<std::wstring> GetNameFromJson(const Json::Value& json);
|
|
|
|
com_array<Windows::UI::Color> Table() const noexcept;
|
|
void SetColorTableEntry(uint8_t index, const winrt::Windows::UI::Color& value) noexcept;
|
|
|
|
GETSET_PROPERTY(winrt::hstring, Name);
|
|
GETSET_COLORPROPERTY(Foreground); // defined in constructor
|
|
GETSET_COLORPROPERTY(Background); // defined in constructor
|
|
GETSET_COLORPROPERTY(SelectionBackground); // defined in constructor
|
|
GETSET_COLORPROPERTY(CursorColor); // defined in constructor
|
|
|
|
private:
|
|
std::array<til::color, COLOR_TABLE_SIZE> _table;
|
|
|
|
friend class SettingsModelLocalTests::SettingsTests;
|
|
friend class SettingsModelLocalTests::ColorSchemeTests;
|
|
};
|
|
}
|