This works better than it has any business doing. Plemty of bugs, but a good enough start

This commit is contained in:
Mike Griese 2021-09-28 13:00:52 -05:00
parent c7536edfa8
commit c26dd6b1db
3 changed files with 21 additions and 3 deletions

View file

@ -32,6 +32,11 @@ namespace winrt::Microsoft::Terminal::Control::implementation
CORE_APPEARANCE_SETTINGS(COPY_SETTING)
CONTROL_APPEARANCE_SETTINGS(COPY_SETTING)
#undef COPY_SETTING
for (int32_t i = 0; i < _ColorTable.size(); i++)
{
_ColorTable[i] = appearance.GetColorTableEntry(i);
}
}
};
}

View file

@ -15,7 +15,7 @@ using IFontAxesMap = winrt::Windows::Foundation::Collections::IMap<winrt::hstrin
namespace winrt::Microsoft::Terminal::Control::implementation
{
struct ControlSettings
struct ControlSettings : public winrt::implements<ControlSettings, Microsoft::Terminal::Control::IControlSettings, Microsoft::Terminal::Control::IControlAppearance, Microsoft::Terminal::Core::ICoreSettings, Microsoft::Terminal::Core::ICoreAppearance>
{
#define SETTINGS_GEN(type, name, ...) WINRT_PROPERTY(type, name, __VA_ARGS__);
CORE_SETTINGS(SETTINGS_GEN)
@ -42,5 +42,18 @@ namespace winrt::Microsoft::Terminal::Control::implementation
winrt::com_ptr<ControlAppearance> UnfocusedAppearance() { return _unfocusedAppearance; }
winrt::com_ptr<ControlAppearance> FocusedAppearance() { return _focusedAppearance; }
#define APPEARANCE_GEN(type, name, ...) \
type name() const noexcept { return _focusedAppearance->name(); } \
void name(const type& value) noexcept { _focusedAppearance->name(value); }
CORE_APPEARANCE_SETTINGS(APPEARANCE_GEN)
CONTROL_APPEARANCE_SETTINGS(APPEARANCE_GEN)
#undef APPEARANCE_GEN
winrt::Microsoft::Terminal::Core::Color GetColorTableEntry(int32_t index) noexcept
{
return _focusedAppearance->GetColorTableEntry(index);
}
};
}

View file

@ -274,7 +274,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
return;
}
_core.UpdateSettings(newSettings); // TODO!
_core.UpdateSettings(newSettings.try_as<IControlSettings>()); // TODO!
// Update our control settings
_ApplyUISettings(newSettings);
@ -2373,7 +2373,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
void TermControl::UnfocusedAppearance(IControlAppearance newAppearance)
{
_settings = winrt::make_self<ControlSettings>(_settings, newAppearance);
_settings = winrt::make_self<ControlSettings>(_settings.try_as<IControlSettings>(), newAppearance);
}
Windows::Foundation::IReference<winrt::Windows::UI::Color> TermControl::TabColor() noexcept