this is wild

This commit is contained in:
Mike Griese 2021-09-23 16:46:05 -05:00
parent 981d8cc9c8
commit d6989ec9d1
4 changed files with 25 additions and 23 deletions

View file

@ -27,7 +27,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
// All of these settings are defined in IControlSettings.
#define CONTROL_APPEARANCE_SETTINGS(X) \
X(til::color, SelectionBackground, DEFAULT_FOREGROUND) \
X(double, Opacity, .5) \
X(double, Opacity, 1.0) \
X(winrt::hstring, BackgroundImage) \
X(double, BackgroundImageOpacity, 1.0) \
X(winrt::Windows::UI::Xaml::Media::Stretch, BackgroundImageStretchMode, winrt::Windows::UI::Xaml::Media::Stretch::UniformToFill) \
@ -55,13 +55,13 @@ namespace winrt::Microsoft::Terminal::Control::implementation
std::array<winrt::Microsoft::Terminal::Core::Color, 16> ColorTable() { return _ColorTable; }
void ColorTable(std::array<winrt::Microsoft::Terminal::Core::Color, 16> /*colors*/) {}
// ControlSettings()
// {
// const auto campbellSpan = ::Microsoft::Console::Utils::CampbellColorTable();
// std::transform(campbellSpan.begin(), campbellSpan.end(), _ColorTable.begin(), [](auto&& color) {
// return static_cast<winrt::Microsoft::Terminal::Core::Color>(til::color{ color });
// });
// }
ControlAppearance(Control::IControlAppearance appearance)
{
#define COPY_SETTING(type, name, ...) _##name = appearance.name();
CORE_APPEARANCE_SETTINGS(COPY_SETTING)
CONTROL_APPEARANCE_SETTINGS(COPY_SETTING)
#undef COPY_SETTING
}
};
}

View file

@ -24,7 +24,6 @@ namespace winrt::Microsoft::Terminal::Control::implementation
X(bool, AltGrAliasing, true) \
X(winrt::hstring, WordDelimiters, DEFAULT_WORD_DELIMITERS) \
X(bool, CopyOnSelect, false) \
X(bool, InputServiceWarning, true) \
X(bool, FocusFollowMouse, false) \
X(winrt::Windows::Foundation::IReference<winrt::Microsoft::Terminal::Core::Color>, TabColor, nullptr) \
X(winrt::Windows::Foundation::IReference<winrt::Microsoft::Terminal::Core::Color>, StartingTabColor, nullptr) \
@ -62,7 +61,24 @@ namespace winrt::Microsoft::Terminal::Control::implementation
CONTROL_SETTINGS(CONTROL_SETTINGS_GEN)
#undef CONTROL_SETTINGS_GEN
private:
winrt::com_ptr<ControlAppearance> _unfocusedAppearance{ nullptr };
winrt::com_ptr<ControlAppearance> _focusedAppearance{ nullptr };
public:
ControlSettings(Control::IControlSettings settings, Control::IControlAppearance unfocusedAppearance)
{
_focusedAppearance = winrt::make_self<implementation::ControlAppearance>(settings);
_unfocusedAppearance = unfocusedAppearance ?
winrt::make_self<implementation::ControlAppearance>(unfocusedAppearance) :
_focusedAppearance;
#define COPY_SETTING(type, name, ...) _##name = settings.name();
CORE_SETTINGS(COPY_SETTING)
CONTROL_SETTINGS(COPY_SETTING)
#undef COPY_SETTING
}
winrt::com_ptr<ControlAppearance> UnfocusedAppearance()
{
return _unfocusedAppearance;
@ -71,18 +87,6 @@ namespace winrt::Microsoft::Terminal::Control::implementation
{
return _focusedAppearance;
};
private:
winrt::com_ptr<ControlAppearance> _unfocusedAppearance{ nullptr };
winrt::com_ptr<ControlAppearance> _focusedAppearance{ nullptr };
// ControlSettings()
// {
// const auto campbellSpan = ::Microsoft::Console::Utils::CampbellColorTable();
// std::transform(campbellSpan.begin(), campbellSpan.end(), _ColorTable.begin(), [](auto&& color) {
// return static_cast<winrt::Microsoft::Terminal::Core::Color>(til::color{ color });
// });
// }
};
}

View file

@ -95,7 +95,6 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
INHERITABLE_SETTING(Model::TerminalSettings, uint32_t, CursorHeight, DEFAULT_CURSOR_HEIGHT);
INHERITABLE_SETTING(Model::TerminalSettings, hstring, WordDelimiters, DEFAULT_WORD_DELIMITERS);
INHERITABLE_SETTING(Model::TerminalSettings, bool, CopyOnSelect, false);
INHERITABLE_SETTING(Model::TerminalSettings, bool, InputServiceWarning, true);
INHERITABLE_SETTING(Model::TerminalSettings, bool, FocusFollowMouse, false);
INHERITABLE_SETTING(Model::TerminalSettings, bool, TrimBlockSelection, false);
INHERITABLE_SETTING(Model::TerminalSettings, bool, DetectURLs, true);

View file

@ -35,7 +35,6 @@ namespace ControlUnitTests
WINRT_PROPERTY(uint32_t, CursorHeight, DEFAULT_CURSOR_HEIGHT);
WINRT_PROPERTY(winrt::hstring, WordDelimiters, DEFAULT_WORD_DELIMITERS);
WINRT_PROPERTY(bool, CopyOnSelect, false);
WINRT_PROPERTY(bool, InputServiceWarning, true);
WINRT_PROPERTY(bool, FocusFollowMouse, false);
WINRT_PROPERTY(winrt::Windows::Foundation::IReference<winrt::Microsoft::Terminal::Core::Color>, TabColor, nullptr);