Add a ShortcutAction for toggling retro terminal effect (#6691)
Pretty straightforward. `toggleRetroEffect` will work to toggle the retro terminal effect on/off. * Made possible by contributions from #6551, _and viewers like you_
This commit is contained in:
parent
436fac6afa
commit
396cbbb151
|
@ -28,6 +28,7 @@ static constexpr std::string_view SplitPaneKey{ "splitPane" };
|
|||
static constexpr std::string_view ResizePaneKey{ "resizePane" };
|
||||
static constexpr std::string_view MoveFocusKey{ "moveFocus" };
|
||||
static constexpr std::string_view FindKey{ "find" };
|
||||
static constexpr std::string_view ToggleRetroEffectKey{ "toggleRetroEffect" };
|
||||
static constexpr std::string_view ToggleFullscreenKey{ "toggleFullscreen" };
|
||||
static constexpr std::string_view SetTabColorKey{ "setTabColor" };
|
||||
static constexpr std::string_view OpenTabColorPickerKey{ "openTabColorPicker" };
|
||||
|
@ -71,6 +72,7 @@ namespace winrt::TerminalApp::implementation
|
|||
{ ResizePaneKey, ShortcutAction::ResizePane },
|
||||
{ MoveFocusKey, ShortcutAction::MoveFocus },
|
||||
{ OpenSettingsKey, ShortcutAction::OpenSettings },
|
||||
{ ToggleRetroEffectKey, ShortcutAction::ToggleRetroEffect },
|
||||
{ ToggleFullscreenKey, ShortcutAction::ToggleFullscreen },
|
||||
{ SplitPaneKey, ShortcutAction::SplitPane },
|
||||
{ SetTabColorKey, ShortcutAction::SetTabColor },
|
||||
|
|
|
@ -231,6 +231,14 @@ namespace winrt::TerminalApp::implementation
|
|||
args.Handled(true);
|
||||
}
|
||||
|
||||
void TerminalPage::_HandleToggleRetroEffect(const IInspectable& /*sender*/,
|
||||
const TerminalApp::ActionEventArgs& args)
|
||||
{
|
||||
const auto termControl = _GetActiveControl();
|
||||
termControl.ToggleRetroEffect();
|
||||
args.Handled(true);
|
||||
}
|
||||
|
||||
void TerminalPage::_HandleToggleFullscreen(const IInspectable& /*sender*/,
|
||||
const TerminalApp::ActionEventArgs& args)
|
||||
{
|
||||
|
|
|
@ -154,6 +154,11 @@ namespace winrt::TerminalApp::implementation
|
|||
_ResetFontSizeHandlers(*this, *eventArgs);
|
||||
break;
|
||||
}
|
||||
case ShortcutAction::ToggleRetroEffect:
|
||||
{
|
||||
_ToggleRetroEffectHandlers(*this, *eventArgs);
|
||||
break;
|
||||
}
|
||||
case ShortcutAction::ToggleFullscreen:
|
||||
{
|
||||
_ToggleFullscreenHandlers(*this, *eventArgs);
|
||||
|
|
|
@ -46,6 +46,7 @@ namespace winrt::TerminalApp::implementation
|
|||
TYPED_EVENT(ResizePane, TerminalApp::ShortcutActionDispatch, TerminalApp::ActionEventArgs);
|
||||
TYPED_EVENT(Find, TerminalApp::ShortcutActionDispatch, TerminalApp::ActionEventArgs);
|
||||
TYPED_EVENT(MoveFocus, TerminalApp::ShortcutActionDispatch, TerminalApp::ActionEventArgs);
|
||||
TYPED_EVENT(ToggleRetroEffect, TerminalApp::ShortcutActionDispatch, TerminalApp::ActionEventArgs);
|
||||
TYPED_EVENT(ToggleFullscreen, TerminalApp::ShortcutActionDispatch, TerminalApp::ActionEventArgs);
|
||||
TYPED_EVENT(ToggleCommandPalette, TerminalApp::ShortcutActionDispatch, TerminalApp::ActionEventArgs);
|
||||
TYPED_EVENT(SetTabColor, TerminalApp::ShortcutActionDispatch, TerminalApp::ActionEventArgs);
|
||||
|
|
|
@ -31,6 +31,7 @@ namespace TerminalApp
|
|||
ResizePane,
|
||||
MoveFocus,
|
||||
Find,
|
||||
ToggleRetroEffect,
|
||||
ToggleFullscreen,
|
||||
SetTabColor,
|
||||
OpenTabColorPicker,
|
||||
|
@ -73,6 +74,7 @@ namespace TerminalApp
|
|||
event Windows.Foundation.TypedEventHandler<ShortcutActionDispatch, ActionEventArgs> ResizePane;
|
||||
event Windows.Foundation.TypedEventHandler<ShortcutActionDispatch, ActionEventArgs> Find;
|
||||
event Windows.Foundation.TypedEventHandler<ShortcutActionDispatch, ActionEventArgs> MoveFocus;
|
||||
event Windows.Foundation.TypedEventHandler<ShortcutActionDispatch, ActionEventArgs> ToggleRetroEffect;
|
||||
event Windows.Foundation.TypedEventHandler<ShortcutActionDispatch, ActionEventArgs> ToggleFullscreen;
|
||||
event Windows.Foundation.TypedEventHandler<ShortcutActionDispatch, ActionEventArgs> ToggleCommandPalette;
|
||||
event Windows.Foundation.TypedEventHandler<ShortcutActionDispatch, ActionEventArgs> SetTabColor;
|
||||
|
|
|
@ -841,6 +841,7 @@ namespace winrt::TerminalApp::implementation
|
|||
_actionDispatch->AdjustFontSize({ this, &TerminalPage::_HandleAdjustFontSize });
|
||||
_actionDispatch->Find({ this, &TerminalPage::_HandleFind });
|
||||
_actionDispatch->ResetFontSize({ this, &TerminalPage::_HandleResetFontSize });
|
||||
_actionDispatch->ToggleRetroEffect({ this, &TerminalPage::_HandleToggleRetroEffect });
|
||||
_actionDispatch->ToggleFullscreen({ this, &TerminalPage::_HandleToggleFullscreen });
|
||||
_actionDispatch->ToggleCommandPalette({ this, &TerminalPage::_HandleToggleCommandPalette });
|
||||
_actionDispatch->SetTabColor({ this, &TerminalPage::_HandleSetTabColor });
|
||||
|
|
|
@ -205,6 +205,7 @@ namespace winrt::TerminalApp::implementation
|
|||
void _HandleAdjustFontSize(const IInspectable& sender, const TerminalApp::ActionEventArgs& args);
|
||||
void _HandleFind(const IInspectable& sender, const TerminalApp::ActionEventArgs& args);
|
||||
void _HandleResetFontSize(const IInspectable& sender, const TerminalApp::ActionEventArgs& args);
|
||||
void _HandleToggleRetroEffect(const IInspectable& sender, const TerminalApp::ActionEventArgs& args);
|
||||
void _HandleToggleFullscreen(const IInspectable& sender, const TerminalApp::ActionEventArgs& args);
|
||||
void _HandleSetTabColor(const IInspectable& sender, const TerminalApp::ActionEventArgs& args);
|
||||
void _HandleOpenTabColorPicker(const IInspectable& sender, const TerminalApp::ActionEventArgs& args);
|
||||
|
|
|
@ -297,6 +297,11 @@ namespace winrt::Microsoft::Terminal::TerminalControl::implementation
|
|||
}
|
||||
}
|
||||
}
|
||||
void TermControl::ToggleRetroEffect()
|
||||
{
|
||||
auto lock = _terminal->LockForWriting();
|
||||
_renderEngine->SetRetroTerminalEffects(!_renderEngine->GetRetroTerminalEffects());
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
// - Style our UI elements based on the values in our _settings, and set up
|
||||
|
|
|
@ -78,6 +78,8 @@ namespace winrt::Microsoft::Terminal::TerminalControl::implementation
|
|||
void AdjustFontSize(int fontSizeDelta);
|
||||
void ResetFontSize();
|
||||
|
||||
void ToggleRetroEffect();
|
||||
|
||||
winrt::fire_and_forget RenderEngineSwapChainChanged();
|
||||
void _AttachDxgiSwapChainToXaml(IDXGISwapChain1* swapChain);
|
||||
winrt::fire_and_forget _RendererEnteredErrorState();
|
||||
|
|
|
@ -68,5 +68,7 @@ namespace Microsoft.Terminal.TerminalControl
|
|||
|
||||
void AdjustFontSize(Int32 fontSizeDelta);
|
||||
void ResetFontSize();
|
||||
|
||||
void ToggleRetroEffect();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -785,6 +785,11 @@ void DxEngine::SetCallback(std::function<void()> pfn)
|
|||
_pfn = pfn;
|
||||
}
|
||||
|
||||
bool DxEngine::GetRetroTerminalEffects() const noexcept
|
||||
{
|
||||
return _retroTerminalEffects;
|
||||
}
|
||||
|
||||
void DxEngine::SetRetroTerminalEffects(bool enable) noexcept
|
||||
try
|
||||
{
|
||||
|
|
|
@ -56,6 +56,7 @@ namespace Microsoft::Console::Render
|
|||
|
||||
void SetCallback(std::function<void()> pfn);
|
||||
|
||||
bool GetRetroTerminalEffects() const noexcept;
|
||||
void SetRetroTerminalEffects(bool enable) noexcept;
|
||||
|
||||
void SetForceFullRepaintRendering(bool enable) noexcept;
|
||||
|
|
Loading…
Reference in a new issue