b140299e50
Co-authored-by: mrange <marten_range@hotmail.com> I loved the pixel shaders in #7058, but that PR needed a bit of polish to be ready for ingestion. This PR is almost _exactly_ that PR, with some small changes. * It adds a new pre-profile setting `"experimental.pixelShaderPath"`, which lets the user set a pixel shader to use with the Terminal. - CHANGED FROM #7058: It does _not_ add any built-in shaders. - CHANGED FROM #7058: it will _override_ `experimental.retroTerminalEffect` * It adds a bunch of sample shaders in `samples/shaders`. Included: - A NOP shader as a base to build from. - An "invert" shader that inverts the colors, as a simple example - An "grayscale" shader that converts all colors to grayscale, as a simple example - An "raster bars" shader that draws some colored bars on the screen with a drop shadow, as a more involved example - The original retro terminal effects, as a more involved example - It also includes a broken shader, as an example of what heppens when the shader fails to compile - CHANGED FROM #7058: It does _not_ add the "retroII" shader we were all worried about. * When a shader fails to be found or fails to compile, we'll display an error dialog to the user with a relevant error message. - CHANGED FROM #7058: Originally, #7058 would display "error bars" on the screen. I've removed that, and had the Terminal disable the shader entirely then. * Renames the `toggleRetroEffect` action to `toggleShaderEffect`. (`toggleRetroEffect` is now an alias to `toggleShaderEffect`). This action will turn the shader OR the retro effects on/off. `toggleShaderEffect` works the way you'd expect it to, but the mental math on _how_ is a little weird. The logic is basically: ``` useShader = shaderEffectsEnabled ? (pixelShaderProvided ? pixelShader : (retroEffectEnabled ? retroEffect : null ) ) : null ``` and `toggleShaderEffect` toggles `shaderEffectsEnabled`. * If you've got both a shader and retro enabled, `toggleShaderEffect` will toggle between the shader on/off. * If you've got a shader and retro disabled, `toggleShaderEffect` will toggle between the shader on/off. References #6191 References #7058 Closes #7013 Closes #3930 "Add setting to retro terminal shader to control blur radius, color" Closes #3929 "Add setting to retro terminal shader to enable drawing scanlines" - At this point, just roll your own version of the shader.
135 lines
5.5 KiB
C++
135 lines
5.5 KiB
C++
/*++
|
|
Copyright (c) Microsoft Corporation
|
|
Licensed under the MIT license.
|
|
|
|
Module Name:
|
|
- Profile.hpp
|
|
|
|
Abstract:
|
|
- A profile acts as a single set of terminal settings. Many tabs or panes could
|
|
exist side-by-side with different profiles simultaneously.
|
|
|
|
Author(s):
|
|
- Mike Griese - March 2019
|
|
|
|
--*/
|
|
#pragma once
|
|
|
|
#include "Profile.g.h"
|
|
#include "IInheritable.h"
|
|
|
|
#include "../inc/cppwinrt_utils.h"
|
|
#include "JsonUtils.h"
|
|
#include <DefaultSettings.h>
|
|
|
|
// fwdecl unittest classes
|
|
namespace SettingsModelLocalTests
|
|
{
|
|
class DeserializationTests;
|
|
class ProfileTests;
|
|
class ColorSchemeTests;
|
|
class KeyBindingsTests;
|
|
};
|
|
namespace TerminalAppUnitTests
|
|
{
|
|
class DynamicProfileTests;
|
|
class JsonTests;
|
|
};
|
|
|
|
// GUID used for generating GUIDs at runtime, for profiles that did not have a
|
|
// GUID specified manually.
|
|
constexpr GUID RUNTIME_GENERATED_PROFILE_NAMESPACE_GUID = { 0xf65ddb7e, 0x706b, 0x4499, { 0x8a, 0x50, 0x40, 0x31, 0x3c, 0xaf, 0x51, 0x0a } };
|
|
|
|
namespace winrt::Microsoft::Terminal::Settings::Model::implementation
|
|
{
|
|
struct Profile : ProfileT<Profile>, IInheritable<Profile>
|
|
{
|
|
public:
|
|
Profile();
|
|
Profile(guid guid);
|
|
static com_ptr<Profile> CloneInheritanceGraph(com_ptr<Profile> oldProfile, com_ptr<Profile> newProfile, std::unordered_map<void*, com_ptr<Profile>>& visited);
|
|
static com_ptr<Profile> CopySettings(com_ptr<Profile> source);
|
|
|
|
Json::Value GenerateStub() const;
|
|
static com_ptr<Profile> FromJson(const Json::Value& json);
|
|
bool ShouldBeLayered(const Json::Value& json) const;
|
|
void LayerJson(const Json::Value& json);
|
|
static bool IsDynamicProfileObject(const Json::Value& json);
|
|
Json::Value ToJson() const;
|
|
|
|
hstring EvaluatedStartingDirectory() const;
|
|
hstring ExpandedBackgroundImagePath() const;
|
|
static guid GetGuidOrGenerateForJson(const Json::Value& json) noexcept;
|
|
|
|
GETSET_SETTING(guid, Guid, _GenerateGuidForProfile(Name(), Source()));
|
|
GETSET_SETTING(hstring, Name, L"Default");
|
|
GETSET_SETTING(hstring, Source);
|
|
GETSET_SETTING(bool, Hidden, false);
|
|
GETSET_SETTING(guid, ConnectionType);
|
|
|
|
// Default Icon: Segoe MDL2 CommandPrompt icon
|
|
GETSET_SETTING(hstring, Icon, L"\uE756");
|
|
|
|
GETSET_SETTING(CloseOnExitMode, CloseOnExit, CloseOnExitMode::Graceful);
|
|
GETSET_SETTING(hstring, TabTitle);
|
|
GETSET_NULLABLE_SETTING(Windows::UI::Color, TabColor, nullptr);
|
|
GETSET_SETTING(bool, SuppressApplicationTitle, false);
|
|
|
|
GETSET_SETTING(bool, UseAcrylic, false);
|
|
GETSET_SETTING(double, AcrylicOpacity, 0.5);
|
|
GETSET_SETTING(Microsoft::Terminal::TerminalControl::ScrollbarState, ScrollState, Microsoft::Terminal::TerminalControl::ScrollbarState::Visible);
|
|
|
|
GETSET_SETTING(hstring, FontFace, DEFAULT_FONT_FACE);
|
|
GETSET_SETTING(int32_t, FontSize, DEFAULT_FONT_SIZE);
|
|
GETSET_SETTING(Windows::UI::Text::FontWeight, FontWeight, DEFAULT_FONT_WEIGHT);
|
|
GETSET_SETTING(hstring, Padding, DEFAULT_PADDING);
|
|
|
|
GETSET_SETTING(hstring, Commandline, L"cmd.exe");
|
|
GETSET_SETTING(hstring, StartingDirectory);
|
|
|
|
GETSET_SETTING(hstring, BackgroundImagePath);
|
|
GETSET_SETTING(double, BackgroundImageOpacity, 1.0);
|
|
GETSET_SETTING(Windows::UI::Xaml::Media::Stretch, BackgroundImageStretchMode, Windows::UI::Xaml::Media::Stretch::UniformToFill);
|
|
GETSET_SETTING(ConvergedAlignment, BackgroundImageAlignment, ConvergedAlignment::Horizontal_Center | ConvergedAlignment::Vertical_Center);
|
|
|
|
GETSET_SETTING(Microsoft::Terminal::TerminalControl::TextAntialiasingMode, AntialiasingMode, Microsoft::Terminal::TerminalControl::TextAntialiasingMode::Grayscale);
|
|
GETSET_SETTING(bool, RetroTerminalEffect, false);
|
|
GETSET_SETTING(hstring, PixelShaderPath, L"");
|
|
GETSET_SETTING(bool, ForceFullRepaintRendering, false);
|
|
GETSET_SETTING(bool, SoftwareRendering, false);
|
|
|
|
GETSET_SETTING(hstring, ColorSchemeName, L"Campbell");
|
|
|
|
GETSET_NULLABLE_SETTING(Windows::UI::Color, Foreground, nullptr);
|
|
GETSET_NULLABLE_SETTING(Windows::UI::Color, Background, nullptr);
|
|
GETSET_NULLABLE_SETTING(Windows::UI::Color, SelectionBackground, nullptr);
|
|
GETSET_NULLABLE_SETTING(Windows::UI::Color, CursorColor, nullptr);
|
|
|
|
GETSET_SETTING(int32_t, HistorySize, DEFAULT_HISTORY_SIZE);
|
|
GETSET_SETTING(bool, SnapOnInput, true);
|
|
GETSET_SETTING(bool, AltGrAliasing, true);
|
|
|
|
GETSET_SETTING(Microsoft::Terminal::TerminalControl::CursorStyle, CursorShape, Microsoft::Terminal::TerminalControl::CursorStyle::Bar);
|
|
GETSET_SETTING(uint32_t, CursorHeight, DEFAULT_CURSOR_HEIGHT);
|
|
|
|
GETSET_SETTING(Model::BellStyle, BellStyle, BellStyle::Audible);
|
|
|
|
private:
|
|
static std::wstring EvaluateStartingDirectory(const std::wstring& directory);
|
|
|
|
static guid _GenerateGuidForProfile(const hstring& name, const hstring& source) noexcept;
|
|
|
|
friend class SettingsModelLocalTests::DeserializationTests;
|
|
friend class SettingsModelLocalTests::ProfileTests;
|
|
friend class SettingsModelLocalTests::ColorSchemeTests;
|
|
friend class SettingsModelLocalTests::KeyBindingsTests;
|
|
friend class TerminalAppUnitTests::DynamicProfileTests;
|
|
friend class TerminalAppUnitTests::JsonTests;
|
|
};
|
|
}
|
|
|
|
namespace winrt::Microsoft::Terminal::Settings::Model::factory_implementation
|
|
{
|
|
BASIC_FACTORY(Profile);
|
|
}
|