much of this appearance code was unneeded
This commit is contained in:
parent
9eeea4a9d0
commit
5173ea30f5
|
@ -37,9 +37,6 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||||
_runtimeColorTable.at(index) = color;
|
_runtimeColorTable.at(index) = color;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::array<winrt::Microsoft::Terminal::Core::Color, 16> ColorTable() { return _ColorTable; }
|
|
||||||
void ColorTable(std::array<winrt::Microsoft::Terminal::Core::Color, 16> /*colors*/) {}
|
|
||||||
|
|
||||||
ControlAppearance(Control::IControlAppearance appearance)
|
ControlAppearance(Control::IControlAppearance appearance)
|
||||||
{
|
{
|
||||||
#define COPY_SETTING(type, name, ...) _##name = appearance.name();
|
#define COPY_SETTING(type, name, ...) _##name = appearance.name();
|
||||||
|
|
|
@ -244,7 +244,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||||
LOG_IF_FAILED(_renderEngine->SetWindowSize({ viewInPixels.Width(), viewInPixels.Height() }));
|
LOG_IF_FAILED(_renderEngine->SetWindowSize({ viewInPixels.Width(), viewInPixels.Height() }));
|
||||||
|
|
||||||
// Update DxEngine's SelectionBackground
|
// Update DxEngine's SelectionBackground
|
||||||
_renderEngine->SetSelectionBackground(til::color{ _settings->SelectionBackground() });
|
_renderEngine->SetSelectionBackground(til::color{ _settings->FocusedAppearance()->SelectionBackground() });
|
||||||
|
|
||||||
const auto vp = _renderEngine->GetViewportInCharacters(viewInPixels);
|
const auto vp = _renderEngine->GetViewportInCharacters(viewInPixels);
|
||||||
const auto width = vp.Width();
|
const auto width = vp.Width();
|
||||||
|
@ -267,11 +267,11 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||||
// We do this after we initially set the swapchain so as to avoid unnecessary callbacks (and locking problems)
|
// We do this after we initially set the swapchain so as to avoid unnecessary callbacks (and locking problems)
|
||||||
_renderEngine->SetCallback(std::bind(&ControlCore::_renderEngineSwapChainChanged, this));
|
_renderEngine->SetCallback(std::bind(&ControlCore::_renderEngineSwapChainChanged, this));
|
||||||
|
|
||||||
_renderEngine->SetRetroTerminalEffect(_settings->RetroTerminalEffect());
|
_renderEngine->SetRetroTerminalEffect(_settings->FocusedAppearance()->RetroTerminalEffect());
|
||||||
_renderEngine->SetPixelShaderPath(_settings->PixelShaderPath());
|
_renderEngine->SetPixelShaderPath(_settings->FocusedAppearance()->PixelShaderPath());
|
||||||
_renderEngine->SetForceFullRepaintRendering(_settings->ForceFullRepaintRendering());
|
_renderEngine->SetForceFullRepaintRendering(_settings->ForceFullRepaintRendering());
|
||||||
_renderEngine->SetSoftwareRendering(_settings->SoftwareRendering());
|
_renderEngine->SetSoftwareRendering(_settings->SoftwareRendering());
|
||||||
_renderEngine->SetIntenseIsBold(_settings->IntenseIsBold());
|
_renderEngine->SetIntenseIsBold(_settings->FocusedAppearance()->IntenseIsBold());
|
||||||
|
|
||||||
_updateAntiAliasingMode(_renderEngine.get());
|
_updateAntiAliasingMode(_renderEngine.get());
|
||||||
|
|
||||||
|
@ -475,7 +475,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||||
// specify a custom pixel shader, manually enable the legacy retro
|
// specify a custom pixel shader, manually enable the legacy retro
|
||||||
// effect first. This will ensure that a toggle off->on will still work,
|
// effect first. This will ensure that a toggle off->on will still work,
|
||||||
// even if they currently have retro effect off.
|
// even if they currently have retro effect off.
|
||||||
if (_settings->PixelShaderPath().empty() && !_renderEngine->GetRetroTerminalEffect())
|
if (_settings->FocusedAppearance()->PixelShaderPath().empty() && !_renderEngine->GetRetroTerminalEffect())
|
||||||
{
|
{
|
||||||
// SetRetroTerminalEffect to true will enable the effect. In this
|
// SetRetroTerminalEffect to true will enable the effect. In this
|
||||||
// case, the shader effect will already be disabled (because neither
|
// case, the shader effect will already be disabled (because neither
|
||||||
|
@ -597,7 +597,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||||
// GH#11285 - If the user is on Windows 10, and they wanted opacity, but
|
// GH#11285 - If the user is on Windows 10, and they wanted opacity, but
|
||||||
// didn't explicitly request acrylic, then opt them in to acrylic.
|
// didn't explicitly request acrylic, then opt them in to acrylic.
|
||||||
// On Windows 11+, this isn't needed, because we can have vintage opacity.
|
// On Windows 11+, this isn't needed, because we can have vintage opacity.
|
||||||
if (!IsVintageOpacityAvailable() && _settings->Opacity() < 1.0 && !_settings->UseAcrylic())
|
if (!IsVintageOpacityAvailable() && _settings->FocusedAppearance()->Opacity() < 1.0 && !_settings->UseAcrylic())
|
||||||
{
|
{
|
||||||
_runtimeUseAcrylic = true;
|
_runtimeUseAcrylic = true;
|
||||||
}
|
}
|
||||||
|
@ -660,7 +660,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||||
_renderEngine->SetSelectionBackground(til::color{ newAppearance->SelectionBackground() });
|
_renderEngine->SetSelectionBackground(til::color{ newAppearance->SelectionBackground() });
|
||||||
_renderEngine->SetRetroTerminalEffect(newAppearance->RetroTerminalEffect());
|
_renderEngine->SetRetroTerminalEffect(newAppearance->RetroTerminalEffect());
|
||||||
_renderEngine->SetPixelShaderPath(newAppearance->PixelShaderPath());
|
_renderEngine->SetPixelShaderPath(newAppearance->PixelShaderPath());
|
||||||
_renderEngine->SetIntenseIsBold(_settings->IntenseIsBold());
|
_renderEngine->SetIntenseIsBold(newAppearance->IntenseIsBold());
|
||||||
_renderer->TriggerRedrawAll();
|
_renderer->TriggerRedrawAll();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -993,7 +993,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||||
TextBuffer::GenHTML(bufferData,
|
TextBuffer::GenHTML(bufferData,
|
||||||
_actualFont.GetUnscaledSize().Y,
|
_actualFont.GetUnscaledSize().Y,
|
||||||
_actualFont.GetFaceName(),
|
_actualFont.GetFaceName(),
|
||||||
til::color{ _settings->DefaultBackground() }) :
|
til::color{ _settings->FocusedAppearance()->DefaultBackground() }) :
|
||||||
"";
|
"";
|
||||||
|
|
||||||
// convert to RTF format
|
// convert to RTF format
|
||||||
|
@ -1001,7 +1001,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||||
TextBuffer::GenRTF(bufferData,
|
TextBuffer::GenRTF(bufferData,
|
||||||
_actualFont.GetUnscaledSize().Y,
|
_actualFont.GetUnscaledSize().Y,
|
||||||
_actualFont.GetFaceName(),
|
_actualFont.GetFaceName(),
|
||||||
til::color{ _settings->DefaultBackground() }) :
|
til::color{ _settings->FocusedAppearance()->DefaultBackground() }) :
|
||||||
"";
|
"";
|
||||||
|
|
||||||
if (!_settings->CopyOnSelect())
|
if (!_settings->CopyOnSelect())
|
||||||
|
|
|
@ -170,7 +170,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||||
|
|
||||||
static bool IsVintageOpacityAvailable() noexcept;
|
static bool IsVintageOpacityAvailable() noexcept;
|
||||||
|
|
||||||
RUNTIME_SETTING(double, Opacity, _settings->Opacity());
|
RUNTIME_SETTING(double, Opacity, _settings->FocusedAppearance()->Opacity());
|
||||||
RUNTIME_SETTING(bool, UseAcrylic, _settings->UseAcrylic());
|
RUNTIME_SETTING(bool, UseAcrylic, _settings->UseAcrylic());
|
||||||
|
|
||||||
// -------------------------------- WinRT Events ---------------------------------
|
// -------------------------------- WinRT Events ---------------------------------
|
||||||
|
|
|
@ -15,7 +15,7 @@ using IFontAxesMap = winrt::Windows::Foundation::Collections::IMap<winrt::hstrin
|
||||||
|
|
||||||
namespace winrt::Microsoft::Terminal::Control::implementation
|
namespace winrt::Microsoft::Terminal::Control::implementation
|
||||||
{
|
{
|
||||||
struct ControlSettings : public winrt::implements<ControlSettings, Microsoft::Terminal::Control::IControlSettings, Microsoft::Terminal::Control::IControlAppearance, Microsoft::Terminal::Core::ICoreSettings, Microsoft::Terminal::Core::ICoreAppearance>
|
struct ControlSettings : public winrt::implements<ControlSettings, Microsoft::Terminal::Control::IControlSettings, Microsoft::Terminal::Core::ICoreSettings>
|
||||||
{
|
{
|
||||||
// Getters and setters for each *Setting member. We're not using
|
// Getters and setters for each *Setting member. We're not using
|
||||||
// WINRT_PROPERTY for these, because they actually exist inside the
|
// WINRT_PROPERTY for these, because they actually exist inside the
|
||||||
|
@ -53,21 +53,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||||
winrt::com_ptr<ControlAppearance> FocusedAppearance() { return _focusedAppearance; }
|
winrt::com_ptr<ControlAppearance> FocusedAppearance() { return _focusedAppearance; }
|
||||||
bool HasUnfocusedAppearance() { return _hasUnfocusedAppearance; }
|
bool HasUnfocusedAppearance() { return _hasUnfocusedAppearance; }
|
||||||
|
|
||||||
// Getters and setters for each Appearance member. We're not using
|
// NOTABLY: ControlSettings is not an Appearance. Make sure to get the
|
||||||
// WINRT_PROPERTY for these, because they actually exist inside the
|
// Appearance you actually want out of it.
|
||||||
// _focusedAppearance member. We don't need to reserve another member to
|
|
||||||
// hold them.
|
|
||||||
#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);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue