more cleanup, 5 todo!s left
This commit is contained in:
parent
4912b65967
commit
888e1572d2
|
@ -94,56 +94,56 @@ namespace winrt::TerminalApp::implementation
|
|||
// the preview color changes, we only need to be able to restore the last one.
|
||||
_restorePreviewFuncs.clear();
|
||||
|
||||
_ApplyToActiveControls([&](const auto& control) {
|
||||
// Get the settings of the focused control and stash them
|
||||
const auto& controlSettings = control.Settings().as<TerminalSettings>();
|
||||
// Make sure to recurse up to the root - if you're doing
|
||||
// this while you're currently previewing a SetColorScheme
|
||||
// action, then the parent of the control's settings is _the
|
||||
// last preview TerminalSettings we inserted! We don't want
|
||||
// to save that one!
|
||||
auto originalSettings = controlSettings.GetParent();
|
||||
while (originalSettings.GetParent() != nullptr)
|
||||
{
|
||||
originalSettings = originalSettings.GetParent();
|
||||
}
|
||||
// Create a new child for those settings
|
||||
TerminalSettingsCreateResult fake{ originalSettings };
|
||||
const auto& childStruct = TerminalSettings::CreateWithParent(fake);
|
||||
// Modify the child to have the applied color scheme
|
||||
childStruct.DefaultSettings().ApplyColorScheme(scheme);
|
||||
|
||||
// Insert that new child as the parent of the control's settings
|
||||
controlSettings.SetParent(childStruct.DefaultSettings());
|
||||
control.UpdateControlSettings(controlSettings);
|
||||
|
||||
// Take a copy of the inputs, since they are pointers anyways.
|
||||
_restorePreviewFuncs.emplace_back([=]() {
|
||||
//// Get the runtime settings of the focused control
|
||||
//const auto& controlSettings{ control.Settings().as<TerminalSettings>() };
|
||||
|
||||
//// Get the control's root settings, the ones that we actually
|
||||
//// assigned to it.
|
||||
//auto parentSettings{ controlSettings.GetParent() };
|
||||
//while (parentSettings.GetParent() != nullptr)
|
||||
_ApplyToActiveControls([&](const auto& /*control*/) {
|
||||
// // Get the settings of the focused control and stash them
|
||||
// const auto& controlSettings = control.Settings().as<TerminalSettings>();
|
||||
// // Make sure to recurse up to the root - if you're doing
|
||||
// // this while you're currently previewing a SetColorScheme
|
||||
// // action, then the parent of the control's settings is _the
|
||||
// // last preview TerminalSettings we inserted! We don't want
|
||||
// // to save that one!
|
||||
// auto originalSettings = controlSettings.GetParent();
|
||||
// while (originalSettings.GetParent() != nullptr)
|
||||
// {
|
||||
// parentSettings = parentSettings.GetParent();
|
||||
// originalSettings = originalSettings.GetParent();
|
||||
// }
|
||||
// // Create a new child for those settings
|
||||
// TerminalSettingsCreateResult fake{ originalSettings };
|
||||
// const auto& childStruct = TerminalSettings::CreateWithParent(fake);
|
||||
// // Modify the child to have the applied color scheme
|
||||
// childStruct.DefaultSettings().ApplyColorScheme(scheme);
|
||||
|
||||
//// If the root settings are the same as the ones we stashed,
|
||||
//// then reset the parent of the runtime settings to the stashed
|
||||
//// settings. This condition might be false if the settings
|
||||
//// hot-reloaded while the palette was open. In that case, we
|
||||
//// don't want to reset the settings to what they were _before_
|
||||
//// the hot-reload.
|
||||
//if (originalSettings == parentSettings)
|
||||
//{
|
||||
// // Set the original settings as the parent of the control's settings
|
||||
// control.Settings().as<TerminalSettings>().SetParent(originalSettings);
|
||||
//}
|
||||
// // Insert that new child as the parent of the control's settings
|
||||
// controlSettings.SetParent(childStruct.DefaultSettings());
|
||||
// control.UpdateControlSettings(controlSettings);
|
||||
|
||||
control.UpdateControlSettings(control.Settings());
|
||||
});
|
||||
// // Take a copy of the inputs, since they are pointers anyways.
|
||||
// _restorePreviewFuncs.emplace_back([=]() {
|
||||
// //// Get the runtime settings of the focused control
|
||||
// //const auto& controlSettings{ control.Settings().as<TerminalSettings>() };
|
||||
|
||||
// //// Get the control's root settings, the ones that we actually
|
||||
// //// assigned to it.
|
||||
// //auto parentSettings{ controlSettings.GetParent() };
|
||||
// //while (parentSettings.GetParent() != nullptr)
|
||||
// //{
|
||||
// // parentSettings = parentSettings.GetParent();
|
||||
// //}
|
||||
|
||||
// //// If the root settings are the same as the ones we stashed,
|
||||
// //// then reset the parent of the runtime settings to the stashed
|
||||
// //// settings. This condition might be false if the settings
|
||||
// //// hot-reloaded while the palette was open. In that case, we
|
||||
// //// don't want to reset the settings to what they were _before_
|
||||
// //// the hot-reload.
|
||||
// //if (originalSettings == parentSettings)
|
||||
// //{
|
||||
// // // Set the original settings as the parent of the control's settings
|
||||
// // control.Settings().as<TerminalSettings>().SetParent(originalSettings);
|
||||
// //}
|
||||
|
||||
// control.UpdateControlSettings(control.Settings());
|
||||
// });
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1310,15 +1310,6 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
|||
}
|
||||
}
|
||||
|
||||
// void ControlCore::SetBackgroundOpacity(const double opacity)
|
||||
// {
|
||||
// if (_renderEngine)
|
||||
// {
|
||||
// auto lock = _terminal->LockForWriting();
|
||||
// _renderEngine->SetDefaultTextBackgroundOpacity(::base::saturated_cast<float>(opacity));
|
||||
// }
|
||||
// }
|
||||
|
||||
// Method Description:
|
||||
// - Asynchronously close our connection. The Connection will likely wait
|
||||
// until the attached process terminates before Close returns. If that's
|
||||
|
|
|
@ -58,7 +58,6 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
|||
|
||||
void UpdateSettings(const Control::IControlSettings& settings, const IControlAppearance& newAppearance);
|
||||
void ApplyAppearance(const bool& focused);
|
||||
// void UpdateAppearance(const Control::IControlAppearance& newAppearance);
|
||||
Control::IControlSettings Settings()
|
||||
{
|
||||
auto l = std::unique_lock<til::ticket_lock>{ _settingsLock };
|
||||
|
@ -81,7 +80,6 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
|||
uint16_t FontWeight() const noexcept;
|
||||
|
||||
til::color BackgroundColor() const;
|
||||
// void SetBackgroundOpacity(const double opacity);
|
||||
|
||||
void SendInput(const winrt::hstring& wstr);
|
||||
void PasteText(const winrt::hstring& hstr);
|
||||
|
|
|
@ -281,8 +281,6 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
|||
return;
|
||||
}
|
||||
|
||||
// _core.UpdateSettings(settings); // TODO!
|
||||
|
||||
// Update our control settings
|
||||
_ApplyUISettings();
|
||||
}
|
||||
|
@ -2362,15 +2360,20 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
|||
|
||||
IControlSettings TermControl::Settings() const
|
||||
{
|
||||
// TODO! maybe get rid of
|
||||
// We still need this in a couple places:
|
||||
// - Pane.cpp uses this for parsing out the StartingTitle, Commandline,
|
||||
// etc for Pane::GetTerminalArgsForPane.
|
||||
// - TerminalTab::_CreateToolTipTitle uses the ProfileName for the
|
||||
// tooltip for the tab.
|
||||
//
|
||||
// These both happen on the UI thread right now. In the future, when we
|
||||
// have to hop across the process boundary to get at the core settings,
|
||||
// it may make sense to cache these values inside the TermControl
|
||||
// itself, so it can do the hop once when it's first setup, rather than
|
||||
// when it's needed by the UI thread.
|
||||
return _core.Settings();
|
||||
}
|
||||
|
||||
IControlAppearance TermControl::UnfocusedAppearance() const
|
||||
{
|
||||
return _core.UnfocusedAppearance();
|
||||
}
|
||||
|
||||
Windows::Foundation::IReference<winrt::Windows::UI::Color> TermControl::TabColor() noexcept
|
||||
{
|
||||
// NOTE TO FUTURE READERS: TabColor is down in the Core for the
|
||||
|
|
|
@ -32,6 +32,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
|||
|
||||
winrt::fire_and_forget UpdateControlSettings(Control::IControlSettings settings);
|
||||
winrt::fire_and_forget UpdateControlSettings(Control::IControlSettings settings, Control::IControlAppearance unfocusedAppearance);
|
||||
IControlSettings Settings() const;
|
||||
|
||||
hstring GetProfileName() const;
|
||||
|
||||
|
@ -91,11 +92,6 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
|||
Windows::UI::Xaml::Automation::Peers::AutomationPeer OnCreateAutomationPeer();
|
||||
const Windows::UI::Xaml::Thickness GetPadding();
|
||||
|
||||
IControlSettings Settings() const;
|
||||
// void Settings(IControlSettings newSettings);
|
||||
IControlAppearance UnfocusedAppearance() const;
|
||||
// void UnfocusedAppearance(IControlAppearance newSettings);
|
||||
|
||||
static Windows::Foundation::Size GetProposedDimensions(IControlSettings const& settings, const uint32_t dpi);
|
||||
static Windows::Foundation::Size GetProposedDimensions(const winrt::Windows::Foundation::Size& initialSizeInChars,
|
||||
const int32_t& fontSize,
|
||||
|
|
|
@ -26,7 +26,6 @@ namespace Microsoft.Terminal.Control
|
|||
void UpdateControlSettings(IControlSettings settings, IControlAppearance unfocusedAppearance);
|
||||
|
||||
Microsoft.Terminal.Control.IControlSettings Settings { get; };
|
||||
Microsoft.Terminal.Control.IControlAppearance UnfocusedAppearance { get; };
|
||||
|
||||
event FontSizeChangedEventArgs FontSizeChanged;
|
||||
event Windows.Foundation.TypedEventHandler<Object, TitleChangedEventArgs> TitleChanged;
|
||||
|
|
Loading…
Reference in a new issue