mirror of
https://github.com/microsoft/terminal.git
synced 2026-04-12 17:21:03 +00:00
Compare commits
6 Commits
dev/lhecke
...
dev/duhowe
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fafe65d6c1 | ||
|
|
ce4417971d | ||
|
|
95e31ddde6 | ||
|
|
c72c0f5f89 | ||
|
|
072ba2d88f | ||
|
|
dd34262f78 |
@@ -10,7 +10,7 @@
|
||||
|
||||
using namespace Microsoft::Console;
|
||||
using namespace winrt::Microsoft::Terminal;
|
||||
using namespace winrt::Microsoft::Terminal::Settings::Model::implementation;
|
||||
using namespace MTSM::implementation;
|
||||
using namespace WEX::Logging;
|
||||
using namespace WEX::TestExecution;
|
||||
using namespace WEX::Common;
|
||||
|
||||
@@ -8,9 +8,9 @@
|
||||
#include "TestUtils.h"
|
||||
|
||||
using namespace Microsoft::Console;
|
||||
using namespace winrt::Microsoft::Terminal::Settings::Model;
|
||||
using namespace winrt::Microsoft::Terminal::Control;
|
||||
using namespace winrt::Windows::Foundation::Collections;
|
||||
using namespace MTSM;
|
||||
using namespace MTControl;
|
||||
using namespace WFC;
|
||||
using namespace WEX::Logging;
|
||||
using namespace WEX::TestExecution;
|
||||
using namespace WEX::Common;
|
||||
|
||||
@@ -15,9 +15,9 @@ using namespace Microsoft::Console;
|
||||
using namespace WEX::Logging;
|
||||
using namespace WEX::TestExecution;
|
||||
using namespace WEX::Common;
|
||||
using namespace winrt::Microsoft::Terminal::Settings::Model;
|
||||
using namespace winrt::Microsoft::Terminal::Control;
|
||||
using VirtualKeyModifiers = winrt::Windows::System::VirtualKeyModifiers;
|
||||
using namespace MTSM;
|
||||
using namespace MTControl;
|
||||
using VirtualKeyModifiers = WS::VirtualKeyModifiers;
|
||||
|
||||
namespace SettingsModelLocalTests
|
||||
{
|
||||
@@ -107,7 +107,7 @@ namespace SettingsModelLocalTests
|
||||
return winrt::make_self<implementation::CascadiaSettings>(userJSON, inboxJSON);
|
||||
}
|
||||
|
||||
static void _logCommandNames(winrt::Windows::Foundation::Collections::IMapView<winrt::hstring, Command> commands, const int indentation = 1)
|
||||
static void _logCommandNames(WFC::IMapView<winrt::hstring, Command> commands, const int indentation = 1)
|
||||
{
|
||||
if (indentation == 1)
|
||||
{
|
||||
|
||||
@@ -10,12 +10,12 @@
|
||||
#include "TestUtils.h"
|
||||
|
||||
using namespace Microsoft::Console;
|
||||
using namespace winrt::Microsoft::Terminal::Settings::Model;
|
||||
using namespace winrt::Microsoft::Terminal::Control;
|
||||
using namespace MTSM;
|
||||
using namespace MTControl;
|
||||
using namespace WEX::Logging;
|
||||
using namespace WEX::TestExecution;
|
||||
using namespace WEX::Common;
|
||||
using VirtualKeyModifiers = winrt::Windows::System::VirtualKeyModifiers;
|
||||
using VirtualKeyModifiers = WS::VirtualKeyModifiers;
|
||||
|
||||
namespace SettingsModelLocalTests
|
||||
{
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
using namespace Microsoft::Console;
|
||||
using namespace winrt::Microsoft::Terminal;
|
||||
using namespace winrt::Microsoft::Terminal::Settings::Model::implementation;
|
||||
using namespace MTSM::implementation;
|
||||
using namespace WEX::Logging;
|
||||
using namespace WEX::TestExecution;
|
||||
using namespace WEX::Common;
|
||||
@@ -56,7 +56,7 @@ namespace SettingsModelLocalTests
|
||||
|
||||
const auto& entries = settings->GlobalSettings().NewTabMenu();
|
||||
VERIFY_ARE_EQUAL(1u, entries.Size());
|
||||
VERIFY_ARE_EQUAL(winrt::Microsoft::Terminal::Settings::Model::NewTabMenuEntryType::RemainingProfiles, entries.GetAt(0).Type());
|
||||
VERIFY_ARE_EQUAL(MTSM::NewTabMenuEntryType::RemainingProfiles, entries.GetAt(0).Type());
|
||||
}
|
||||
catch (const SettingsException& ex)
|
||||
{
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include <defaults.h>
|
||||
|
||||
using namespace Microsoft::Console;
|
||||
using namespace winrt::Microsoft::Terminal::Settings::Model;
|
||||
using namespace MTSM;
|
||||
using namespace WEX::Logging;
|
||||
using namespace WEX::TestExecution;
|
||||
using namespace WEX::Common;
|
||||
|
||||
@@ -13,8 +13,8 @@ using namespace Microsoft::Console;
|
||||
using namespace WEX::Logging;
|
||||
using namespace WEX::TestExecution;
|
||||
using namespace WEX::Common;
|
||||
using namespace winrt::Microsoft::Terminal::Settings::Model;
|
||||
using namespace winrt::Microsoft::Terminal::Control;
|
||||
using namespace MTSM;
|
||||
using namespace MTControl;
|
||||
|
||||
namespace SettingsModelLocalTests
|
||||
{
|
||||
|
||||
@@ -13,8 +13,8 @@ using namespace Microsoft::Console;
|
||||
using namespace WEX::Logging;
|
||||
using namespace WEX::TestExecution;
|
||||
using namespace WEX::Common;
|
||||
using namespace winrt::Microsoft::Terminal::Settings::Model;
|
||||
using namespace winrt::Microsoft::Terminal::Control;
|
||||
using namespace MTSM;
|
||||
using namespace MTControl;
|
||||
|
||||
namespace SettingsModelLocalTests
|
||||
{
|
||||
|
||||
@@ -23,10 +23,10 @@ public:
|
||||
// - kc: The key chord to look up the bound ActionAndArgs for.
|
||||
// Return Value:
|
||||
// - The ActionAndArgs bound to the given key, or nullptr if nothing is bound to it.
|
||||
static const winrt::Microsoft::Terminal::Settings::Model::ActionAndArgs GetActionAndArgs(const winrt::Microsoft::Terminal::Settings::Model::ActionMap& actionMap,
|
||||
const winrt::Microsoft::Terminal::Control::KeyChord& kc)
|
||||
static const MTSM::ActionAndArgs GetActionAndArgs(const MTSM::ActionMap& actionMap,
|
||||
const MTControl::KeyChord& kc)
|
||||
{
|
||||
using VirtualKeyModifiers = winrt::Windows::System::VirtualKeyModifiers;
|
||||
using VirtualKeyModifiers = WS::VirtualKeyModifiers;
|
||||
|
||||
std::wstring buffer{ L"" };
|
||||
if (WI_IsFlagSet(kc.Modifiers(), VirtualKeyModifiers::Control))
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
using namespace Microsoft::Console;
|
||||
using namespace winrt::Microsoft::Terminal;
|
||||
using namespace winrt::Microsoft::Terminal::Settings::Model::implementation;
|
||||
using namespace MTSM::implementation;
|
||||
using namespace WEX::Logging;
|
||||
using namespace WEX::TestExecution;
|
||||
using namespace WEX::Common;
|
||||
@@ -75,12 +75,12 @@ namespace SettingsModelLocalTests
|
||||
|
||||
VERIFY_IS_NOT_NULL(theme->TabRow());
|
||||
VERIFY_IS_NOT_NULL(theme->TabRow().Background());
|
||||
VERIFY_ARE_EQUAL(Settings::Model::ThemeColorType::Color, theme->TabRow().Background().ColorType());
|
||||
VERIFY_ARE_EQUAL(MTSM::ThemeColorType::Color, theme->TabRow().Background().ColorType());
|
||||
VERIFY_ARE_EQUAL(rgba(0xff, 0xff, 0x88, 0x00), theme->TabRow().Background().Color());
|
||||
VERIFY_ARE_EQUAL(rgba(0xff, 0x88, 0x44, 0xff), theme->TabRow().UnfocusedBackground().Color());
|
||||
|
||||
VERIFY_IS_NOT_NULL(theme->Window());
|
||||
VERIFY_ARE_EQUAL(winrt::Windows::UI::Xaml::ElementTheme::Light, theme->Window().RequestedTheme());
|
||||
VERIFY_ARE_EQUAL(WUX::ElementTheme::Light, theme->Window().RequestedTheme());
|
||||
VERIFY_ARE_EQUAL(true, theme->Window().UseMica());
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ namespace SettingsModelLocalTests
|
||||
VERIFY_ARE_EQUAL(L"empty", theme->Name());
|
||||
VERIFY_IS_NULL(theme->TabRow());
|
||||
VERIFY_IS_NULL(theme->Window());
|
||||
VERIFY_ARE_EQUAL(winrt::Windows::UI::Xaml::ElementTheme::Default, theme->RequestedTheme());
|
||||
VERIFY_ARE_EQUAL(WUX::ElementTheme::Default, theme->RequestedTheme());
|
||||
}
|
||||
|
||||
void ThemeTests::ParseNoWindowTheme()
|
||||
@@ -117,11 +117,11 @@ namespace SettingsModelLocalTests
|
||||
|
||||
VERIFY_IS_NOT_NULL(theme->TabRow());
|
||||
VERIFY_IS_NOT_NULL(theme->TabRow().Background());
|
||||
VERIFY_ARE_EQUAL(Settings::Model::ThemeColorType::Color, theme->TabRow().Background().ColorType());
|
||||
VERIFY_ARE_EQUAL(MTSM::ThemeColorType::Color, theme->TabRow().Background().ColorType());
|
||||
VERIFY_ARE_EQUAL(rgb(0x11, 0x22, 0x33), theme->TabRow().Background().Color());
|
||||
|
||||
VERIFY_IS_NULL(theme->Window());
|
||||
VERIFY_ARE_EQUAL(winrt::Windows::UI::Xaml::ElementTheme::Default, theme->RequestedTheme());
|
||||
VERIFY_ARE_EQUAL(WUX::ElementTheme::Default, theme->RequestedTheme());
|
||||
}
|
||||
|
||||
void ThemeTests::ParseNullWindowTheme()
|
||||
@@ -143,11 +143,11 @@ namespace SettingsModelLocalTests
|
||||
|
||||
VERIFY_IS_NOT_NULL(theme->TabRow());
|
||||
VERIFY_IS_NOT_NULL(theme->TabRow().Background());
|
||||
VERIFY_ARE_EQUAL(Settings::Model::ThemeColorType::Color, theme->TabRow().Background().ColorType());
|
||||
VERIFY_ARE_EQUAL(MTSM::ThemeColorType::Color, theme->TabRow().Background().ColorType());
|
||||
VERIFY_ARE_EQUAL(rgb(0x11, 0x22, 0x33), theme->TabRow().Background().Color());
|
||||
|
||||
VERIFY_IS_NULL(theme->Window());
|
||||
VERIFY_ARE_EQUAL(winrt::Windows::UI::Xaml::ElementTheme::Default, theme->RequestedTheme());
|
||||
VERIFY_ARE_EQUAL(WUX::ElementTheme::Default, theme->RequestedTheme());
|
||||
}
|
||||
|
||||
void ThemeTests::ParseThemeWithNullThemeColor()
|
||||
@@ -251,7 +251,7 @@ namespace SettingsModelLocalTests
|
||||
const auto settings{ winrt::make_self<CascadiaSettings>(settingsString, DefaultJson) };
|
||||
|
||||
VERIFY_ARE_EQUAL(1u, settings->Warnings().Size());
|
||||
VERIFY_ARE_EQUAL(Settings::Model::SettingsLoadWarnings::UnknownTheme, settings->Warnings().GetAt(0));
|
||||
VERIFY_ARE_EQUAL(MTSM::SettingsLoadWarnings::UnknownTheme, settings->Warnings().GetAt(0));
|
||||
|
||||
const auto& themes{ settings->GlobalSettings().Themes() };
|
||||
{
|
||||
|
||||
@@ -22,7 +22,7 @@ Author(s):
|
||||
// This is inexplicable, but for whatever reason, cppwinrt conflicts with the
|
||||
// SDK definition of this function, so the only fix is to undef it.
|
||||
// from WinBase.h
|
||||
// Windows::UI::Xaml::Media::Animation::IStoryboard::GetCurrentTime
|
||||
// WUXMedia::Animation::IStoryboard::GetCurrentTime
|
||||
#ifdef GetCurrentTime
|
||||
#undef GetCurrentTime
|
||||
#endif
|
||||
@@ -70,3 +70,4 @@ Author(s):
|
||||
#include "../../inc/DefaultSettings.h"
|
||||
|
||||
#include <cppwinrt_utils.h>
|
||||
#include <WinRTNamespaceAliases.h>
|
||||
|
||||
@@ -15,8 +15,8 @@ using namespace WEX::Common;
|
||||
using namespace WEX::TestExecution;
|
||||
|
||||
using namespace winrt;
|
||||
using namespace winrt::Microsoft::Terminal::Settings::Model;
|
||||
using namespace winrt::TerminalApp;
|
||||
using namespace MTSM;
|
||||
using namespace MTApp;
|
||||
using namespace ::TerminalApp;
|
||||
|
||||
namespace winrt
|
||||
@@ -1571,7 +1571,7 @@ namespace TerminalAppLocalTests
|
||||
void CommandlineTest::TestSimpleExecuteCommandlineAction()
|
||||
{
|
||||
ExecuteCommandlineArgs args{ L"new-tab" };
|
||||
auto actions = winrt::TerminalApp::implementation::TerminalPage::ConvertExecuteCommandlineToActions(args);
|
||||
auto actions = MTApp::implementation::TerminalPage::ConvertExecuteCommandlineToActions(args);
|
||||
VERIFY_ARE_EQUAL(1u, actions.size());
|
||||
auto actionAndArgs = actions.at(0);
|
||||
VERIFY_ARE_EQUAL(ShortcutAction::NewTab, actionAndArgs.Action());
|
||||
@@ -1590,7 +1590,7 @@ namespace TerminalAppLocalTests
|
||||
void CommandlineTest::TestMultipleCommandExecuteCommandlineAction()
|
||||
{
|
||||
ExecuteCommandlineArgs args{ L"new-tab ; split-pane" };
|
||||
auto actions = winrt::TerminalApp::implementation::TerminalPage::ConvertExecuteCommandlineToActions(args);
|
||||
auto actions = MTApp::implementation::TerminalPage::ConvertExecuteCommandlineToActions(args);
|
||||
VERIFY_ARE_EQUAL(2u, actions.size());
|
||||
{
|
||||
auto actionAndArgs = actions.at(0);
|
||||
@@ -1626,7 +1626,7 @@ namespace TerminalAppLocalTests
|
||||
{
|
||||
// -H and -V cannot be combined.
|
||||
ExecuteCommandlineArgs args{ L"split-pane -H -V" };
|
||||
auto actions = winrt::TerminalApp::implementation::TerminalPage::ConvertExecuteCommandlineToActions(args);
|
||||
auto actions = MTApp::implementation::TerminalPage::ConvertExecuteCommandlineToActions(args);
|
||||
VERIFY_ARE_EQUAL(0u, actions.size());
|
||||
}
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@ HRESULT RunOnUIThread(const TFunction& function)
|
||||
|
||||
auto invokeResult = E_FAIL;
|
||||
|
||||
auto asyncAction = d.RunAsync(winrt::Windows::UI::Core::CoreDispatcherPriority::Normal,
|
||||
auto asyncAction = d.RunAsync(WUC::CoreDispatcherPriority::Normal,
|
||||
[&invokeResult, &function]() {
|
||||
invokeResult = WEX::SafeInvoke([&]() -> bool { function(); return true; });
|
||||
});
|
||||
|
||||
@@ -10,8 +10,8 @@ using namespace Microsoft::Console;
|
||||
using namespace WEX::Logging;
|
||||
using namespace WEX::TestExecution;
|
||||
using namespace WEX::Common;
|
||||
using namespace winrt::Microsoft::Terminal::Settings::Model;
|
||||
using namespace winrt::Microsoft::Terminal::Control;
|
||||
using namespace MTSM;
|
||||
using namespace MTControl;
|
||||
|
||||
namespace TerminalAppLocalTests
|
||||
{
|
||||
@@ -31,10 +31,10 @@ namespace TerminalAppLocalTests
|
||||
void FilteredCommandTests::VerifyHighlighting()
|
||||
{
|
||||
auto result = RunOnUIThread([]() {
|
||||
const auto paletteItem{ winrt::make<winrt::TerminalApp::implementation::CommandLinePaletteItem>(L"AAAAAABBBBBBCCC") };
|
||||
const auto paletteItem{ winrt::make<MTApp::implementation::CommandLinePaletteItem>(L"AAAAAABBBBBBCCC") };
|
||||
{
|
||||
Log::Comment(L"Testing command name segmentation with no filter");
|
||||
const auto filteredCommand = winrt::make_self<winrt::TerminalApp::implementation::FilteredCommand>(paletteItem);
|
||||
const auto filteredCommand = winrt::make_self<MTApp::implementation::FilteredCommand>(paletteItem);
|
||||
auto segments = filteredCommand->_computeHighlightedName().Segments();
|
||||
VERIFY_ARE_EQUAL(segments.Size(), 1u);
|
||||
VERIFY_ARE_EQUAL(segments.GetAt(0).TextSegment(), L"AAAAAABBBBBBCCC");
|
||||
@@ -42,7 +42,7 @@ namespace TerminalAppLocalTests
|
||||
}
|
||||
{
|
||||
Log::Comment(L"Testing command name segmentation with empty filter");
|
||||
const auto filteredCommand = winrt::make_self<winrt::TerminalApp::implementation::FilteredCommand>(paletteItem);
|
||||
const auto filteredCommand = winrt::make_self<MTApp::implementation::FilteredCommand>(paletteItem);
|
||||
filteredCommand->_Filter = L"";
|
||||
auto segments = filteredCommand->_computeHighlightedName().Segments();
|
||||
VERIFY_ARE_EQUAL(segments.Size(), 1u);
|
||||
@@ -51,7 +51,7 @@ namespace TerminalAppLocalTests
|
||||
}
|
||||
{
|
||||
Log::Comment(L"Testing command name segmentation with filter equals to the string");
|
||||
const auto filteredCommand = winrt::make_self<winrt::TerminalApp::implementation::FilteredCommand>(paletteItem);
|
||||
const auto filteredCommand = winrt::make_self<MTApp::implementation::FilteredCommand>(paletteItem);
|
||||
filteredCommand->_Filter = L"AAAAAABBBBBBCCC";
|
||||
auto segments = filteredCommand->_computeHighlightedName().Segments();
|
||||
VERIFY_ARE_EQUAL(segments.Size(), 1u);
|
||||
@@ -60,7 +60,7 @@ namespace TerminalAppLocalTests
|
||||
}
|
||||
{
|
||||
Log::Comment(L"Testing command name segmentation with filter with first character matching");
|
||||
const auto filteredCommand = winrt::make_self<winrt::TerminalApp::implementation::FilteredCommand>(paletteItem);
|
||||
const auto filteredCommand = winrt::make_self<MTApp::implementation::FilteredCommand>(paletteItem);
|
||||
filteredCommand->_Filter = L"A";
|
||||
auto segments = filteredCommand->_computeHighlightedName().Segments();
|
||||
VERIFY_ARE_EQUAL(segments.Size(), 2u);
|
||||
@@ -71,7 +71,7 @@ namespace TerminalAppLocalTests
|
||||
}
|
||||
{
|
||||
Log::Comment(L"Testing command name segmentation with filter with other case");
|
||||
const auto filteredCommand = winrt::make_self<winrt::TerminalApp::implementation::FilteredCommand>(paletteItem);
|
||||
const auto filteredCommand = winrt::make_self<MTApp::implementation::FilteredCommand>(paletteItem);
|
||||
filteredCommand->_Filter = L"a";
|
||||
auto segments = filteredCommand->_computeHighlightedName().Segments();
|
||||
VERIFY_ARE_EQUAL(segments.Size(), 2u);
|
||||
@@ -82,7 +82,7 @@ namespace TerminalAppLocalTests
|
||||
}
|
||||
{
|
||||
Log::Comment(L"Testing command name segmentation with filter matching several characters");
|
||||
const auto filteredCommand = winrt::make_self<winrt::TerminalApp::implementation::FilteredCommand>(paletteItem);
|
||||
const auto filteredCommand = winrt::make_self<MTApp::implementation::FilteredCommand>(paletteItem);
|
||||
filteredCommand->_Filter = L"ab";
|
||||
auto segments = filteredCommand->_computeHighlightedName().Segments();
|
||||
VERIFY_ARE_EQUAL(segments.Size(), 4u);
|
||||
@@ -97,7 +97,7 @@ namespace TerminalAppLocalTests
|
||||
}
|
||||
{
|
||||
Log::Comment(L"Testing command name segmentation with non matching filter");
|
||||
const auto filteredCommand = winrt::make_self<winrt::TerminalApp::implementation::FilteredCommand>(paletteItem);
|
||||
const auto filteredCommand = winrt::make_self<MTApp::implementation::FilteredCommand>(paletteItem);
|
||||
filteredCommand->_Filter = L"abcd";
|
||||
auto segments = filteredCommand->_computeHighlightedName().Segments();
|
||||
VERIFY_ARE_EQUAL(segments.Size(), 1u);
|
||||
@@ -112,17 +112,17 @@ namespace TerminalAppLocalTests
|
||||
void FilteredCommandTests::VerifyWeight()
|
||||
{
|
||||
auto result = RunOnUIThread([]() {
|
||||
const auto paletteItem{ winrt::make<winrt::TerminalApp::implementation::CommandLinePaletteItem>(L"AAAAAABBBBBBCCC") };
|
||||
const auto paletteItem{ winrt::make<MTApp::implementation::CommandLinePaletteItem>(L"AAAAAABBBBBBCCC") };
|
||||
{
|
||||
Log::Comment(L"Testing weight of command with no filter");
|
||||
const auto filteredCommand = winrt::make_self<winrt::TerminalApp::implementation::FilteredCommand>(paletteItem);
|
||||
const auto filteredCommand = winrt::make_self<MTApp::implementation::FilteredCommand>(paletteItem);
|
||||
filteredCommand->_HighlightedName = filteredCommand->_computeHighlightedName();
|
||||
auto weight = filteredCommand->_computeWeight();
|
||||
VERIFY_ARE_EQUAL(weight, 0);
|
||||
}
|
||||
{
|
||||
Log::Comment(L"Testing weight of command with empty filter");
|
||||
const auto filteredCommand = winrt::make_self<winrt::TerminalApp::implementation::FilteredCommand>(paletteItem);
|
||||
const auto filteredCommand = winrt::make_self<MTApp::implementation::FilteredCommand>(paletteItem);
|
||||
filteredCommand->_Filter = L"";
|
||||
filteredCommand->_HighlightedName = filteredCommand->_computeHighlightedName();
|
||||
auto weight = filteredCommand->_computeWeight();
|
||||
@@ -130,7 +130,7 @@ namespace TerminalAppLocalTests
|
||||
}
|
||||
{
|
||||
Log::Comment(L"Testing weight of command with filter equals to the string");
|
||||
const auto filteredCommand = winrt::make_self<winrt::TerminalApp::implementation::FilteredCommand>(paletteItem);
|
||||
const auto filteredCommand = winrt::make_self<MTApp::implementation::FilteredCommand>(paletteItem);
|
||||
filteredCommand->_Filter = L"AAAAAABBBBBBCCC";
|
||||
filteredCommand->_HighlightedName = filteredCommand->_computeHighlightedName();
|
||||
auto weight = filteredCommand->_computeWeight();
|
||||
@@ -138,7 +138,7 @@ namespace TerminalAppLocalTests
|
||||
}
|
||||
{
|
||||
Log::Comment(L"Testing weight of command with filter with first character matching");
|
||||
const auto filteredCommand = winrt::make_self<winrt::TerminalApp::implementation::FilteredCommand>(paletteItem);
|
||||
const auto filteredCommand = winrt::make_self<MTApp::implementation::FilteredCommand>(paletteItem);
|
||||
filteredCommand->_Filter = L"A";
|
||||
filteredCommand->_HighlightedName = filteredCommand->_computeHighlightedName();
|
||||
auto weight = filteredCommand->_computeWeight();
|
||||
@@ -146,7 +146,7 @@ namespace TerminalAppLocalTests
|
||||
}
|
||||
{
|
||||
Log::Comment(L"Testing weight of command with filter with other case");
|
||||
const auto filteredCommand = winrt::make_self<winrt::TerminalApp::implementation::FilteredCommand>(paletteItem);
|
||||
const auto filteredCommand = winrt::make_self<MTApp::implementation::FilteredCommand>(paletteItem);
|
||||
filteredCommand->_Filter = L"a";
|
||||
filteredCommand->_HighlightedName = filteredCommand->_computeHighlightedName();
|
||||
auto weight = filteredCommand->_computeWeight();
|
||||
@@ -154,7 +154,7 @@ namespace TerminalAppLocalTests
|
||||
}
|
||||
{
|
||||
Log::Comment(L"Testing weight of command with filter matching several characters");
|
||||
const auto filteredCommand = winrt::make_self<winrt::TerminalApp::implementation::FilteredCommand>(paletteItem);
|
||||
const auto filteredCommand = winrt::make_self<MTApp::implementation::FilteredCommand>(paletteItem);
|
||||
filteredCommand->_Filter = L"ab";
|
||||
filteredCommand->_HighlightedName = filteredCommand->_computeHighlightedName();
|
||||
auto weight = filteredCommand->_computeWeight();
|
||||
@@ -168,45 +168,45 @@ namespace TerminalAppLocalTests
|
||||
void FilteredCommandTests::VerifyCompare()
|
||||
{
|
||||
auto result = RunOnUIThread([]() {
|
||||
const auto paletteItem{ winrt::make<winrt::TerminalApp::implementation::CommandLinePaletteItem>(L"AAAAAABBBBBBCCC") };
|
||||
const auto paletteItem2{ winrt::make<winrt::TerminalApp::implementation::CommandLinePaletteItem>(L"BBBBBCCC") };
|
||||
const auto paletteItem{ winrt::make<MTApp::implementation::CommandLinePaletteItem>(L"AAAAAABBBBBBCCC") };
|
||||
const auto paletteItem2{ winrt::make<MTApp::implementation::CommandLinePaletteItem>(L"BBBBBCCC") };
|
||||
{
|
||||
Log::Comment(L"Testing comparison of commands with no filter");
|
||||
const auto filteredCommand = winrt::make_self<winrt::TerminalApp::implementation::FilteredCommand>(paletteItem);
|
||||
const auto filteredCommand2 = winrt::make_self<winrt::TerminalApp::implementation::FilteredCommand>(paletteItem2);
|
||||
const auto filteredCommand = winrt::make_self<MTApp::implementation::FilteredCommand>(paletteItem);
|
||||
const auto filteredCommand2 = winrt::make_self<MTApp::implementation::FilteredCommand>(paletteItem2);
|
||||
|
||||
VERIFY_ARE_EQUAL(filteredCommand->Weight(), filteredCommand2->Weight());
|
||||
VERIFY_IS_TRUE(winrt::TerminalApp::implementation::FilteredCommand::Compare(*filteredCommand, *filteredCommand2));
|
||||
VERIFY_IS_TRUE(MTApp::implementation::FilteredCommand::Compare(*filteredCommand, *filteredCommand2));
|
||||
}
|
||||
{
|
||||
Log::Comment(L"Testing comparison of commands with empty filter");
|
||||
const auto filteredCommand = winrt::make_self<winrt::TerminalApp::implementation::FilteredCommand>(paletteItem);
|
||||
const auto filteredCommand = winrt::make_self<MTApp::implementation::FilteredCommand>(paletteItem);
|
||||
filteredCommand->_Filter = L"";
|
||||
filteredCommand->_HighlightedName = filteredCommand->_computeHighlightedName();
|
||||
filteredCommand->_Weight = filteredCommand->_computeWeight();
|
||||
|
||||
const auto filteredCommand2 = winrt::make_self<winrt::TerminalApp::implementation::FilteredCommand>(paletteItem2);
|
||||
const auto filteredCommand2 = winrt::make_self<MTApp::implementation::FilteredCommand>(paletteItem2);
|
||||
filteredCommand2->_Filter = L"";
|
||||
filteredCommand2->_HighlightedName = filteredCommand2->_computeHighlightedName();
|
||||
filteredCommand2->_Weight = filteredCommand2->_computeWeight();
|
||||
|
||||
VERIFY_ARE_EQUAL(filteredCommand->Weight(), filteredCommand2->Weight());
|
||||
VERIFY_IS_TRUE(winrt::TerminalApp::implementation::FilteredCommand::Compare(*filteredCommand, *filteredCommand2));
|
||||
VERIFY_IS_TRUE(MTApp::implementation::FilteredCommand::Compare(*filteredCommand, *filteredCommand2));
|
||||
}
|
||||
{
|
||||
Log::Comment(L"Testing comparison of commands with different weights");
|
||||
const auto filteredCommand = winrt::make_self<winrt::TerminalApp::implementation::FilteredCommand>(paletteItem);
|
||||
const auto filteredCommand = winrt::make_self<MTApp::implementation::FilteredCommand>(paletteItem);
|
||||
filteredCommand->_Filter = L"B";
|
||||
filteredCommand->_HighlightedName = filteredCommand->_computeHighlightedName();
|
||||
filteredCommand->_Weight = filteredCommand->_computeWeight();
|
||||
|
||||
const auto filteredCommand2 = winrt::make_self<winrt::TerminalApp::implementation::FilteredCommand>(paletteItem2);
|
||||
const auto filteredCommand2 = winrt::make_self<MTApp::implementation::FilteredCommand>(paletteItem2);
|
||||
filteredCommand2->_Filter = L"B";
|
||||
filteredCommand2->_HighlightedName = filteredCommand2->_computeHighlightedName();
|
||||
filteredCommand2->_Weight = filteredCommand2->_computeWeight();
|
||||
|
||||
VERIFY_IS_TRUE(filteredCommand->Weight() < filteredCommand2->Weight()); // Second command gets more points due to the beginning of the word
|
||||
VERIFY_IS_FALSE(winrt::TerminalApp::implementation::FilteredCommand::Compare(*filteredCommand, *filteredCommand2));
|
||||
VERIFY_IS_FALSE(MTApp::implementation::FilteredCommand::Compare(*filteredCommand, *filteredCommand2));
|
||||
}
|
||||
});
|
||||
|
||||
@@ -216,14 +216,14 @@ namespace TerminalAppLocalTests
|
||||
void FilteredCommandTests::VerifyCompareIgnoreCase()
|
||||
{
|
||||
auto result = RunOnUIThread([]() {
|
||||
const auto paletteItem{ winrt::make<winrt::TerminalApp::implementation::CommandLinePaletteItem>(L"a") };
|
||||
const auto paletteItem2{ winrt::make<winrt::TerminalApp::implementation::CommandLinePaletteItem>(L"B") };
|
||||
const auto paletteItem{ winrt::make<MTApp::implementation::CommandLinePaletteItem>(L"a") };
|
||||
const auto paletteItem2{ winrt::make<MTApp::implementation::CommandLinePaletteItem>(L"B") };
|
||||
{
|
||||
const auto filteredCommand = winrt::make_self<winrt::TerminalApp::implementation::FilteredCommand>(paletteItem);
|
||||
const auto filteredCommand2 = winrt::make_self<winrt::TerminalApp::implementation::FilteredCommand>(paletteItem2);
|
||||
const auto filteredCommand = winrt::make_self<MTApp::implementation::FilteredCommand>(paletteItem);
|
||||
const auto filteredCommand2 = winrt::make_self<MTApp::implementation::FilteredCommand>(paletteItem2);
|
||||
|
||||
VERIFY_ARE_EQUAL(filteredCommand->Weight(), filteredCommand2->Weight());
|
||||
VERIFY_IS_TRUE(winrt::TerminalApp::implementation::FilteredCommand::Compare(*filteredCommand, *filteredCommand2));
|
||||
VERIFY_IS_TRUE(MTApp::implementation::FilteredCommand::Compare(*filteredCommand, *filteredCommand2));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -10,9 +10,9 @@ using namespace Microsoft::Console;
|
||||
using namespace WEX::Logging;
|
||||
using namespace WEX::TestExecution;
|
||||
using namespace WEX::Common;
|
||||
using namespace winrt::TerminalApp;
|
||||
using namespace winrt::Microsoft::Terminal::Settings::Model;
|
||||
using namespace winrt::Microsoft::Terminal::Control;
|
||||
using namespace MTApp;
|
||||
using namespace MTSM;
|
||||
using namespace MTControl;
|
||||
|
||||
namespace TerminalAppLocalTests
|
||||
{
|
||||
@@ -77,7 +77,7 @@ namespace TerminalAppLocalTests
|
||||
}
|
||||
|
||||
private:
|
||||
void _logCommandNames(winrt::Windows::Foundation::Collections::IMapView<winrt::hstring, Command> commands, const int indentation = 1)
|
||||
void _logCommandNames(WFC::IMapView<winrt::hstring, Command> commands, const int indentation = 1)
|
||||
{
|
||||
if (indentation == 1)
|
||||
{
|
||||
@@ -164,7 +164,7 @@ namespace TerminalAppLocalTests
|
||||
VERIFY_ARE_EQUAL(L"${profile.name}", realArgs.TerminalArgs().Profile());
|
||||
}
|
||||
|
||||
auto expandedCommands = winrt::TerminalApp::implementation::TerminalPage::_ExpandCommands(nameMap, settings.ActiveProfiles().GetView(), settings.GlobalSettings().ColorSchemes());
|
||||
auto expandedCommands = MTApp::implementation::TerminalPage::_ExpandCommands(nameMap, settings.ActiveProfiles().GetView(), settings.GlobalSettings().ColorSchemes());
|
||||
_logCommandNames(expandedCommands.GetView());
|
||||
|
||||
VERIFY_ARE_EQUAL(0u, settings.Warnings().Size());
|
||||
@@ -287,7 +287,7 @@ namespace TerminalAppLocalTests
|
||||
VERIFY_ARE_EQUAL(L"${profile.name}", realArgs.TerminalArgs().Profile());
|
||||
}
|
||||
|
||||
auto expandedCommands = winrt::TerminalApp::implementation::TerminalPage::_ExpandCommands(nameMap, settings.ActiveProfiles().GetView(), settings.GlobalSettings().ColorSchemes());
|
||||
auto expandedCommands = MTApp::implementation::TerminalPage::_ExpandCommands(nameMap, settings.ActiveProfiles().GetView(), settings.GlobalSettings().ColorSchemes());
|
||||
_logCommandNames(expandedCommands.GetView());
|
||||
|
||||
VERIFY_ARE_EQUAL(0u, settings.Warnings().Size());
|
||||
@@ -412,7 +412,7 @@ namespace TerminalAppLocalTests
|
||||
VERIFY_ARE_EQUAL(L"${profile.name}", realArgs.TerminalArgs().Profile());
|
||||
}
|
||||
|
||||
auto expandedCommands = winrt::TerminalApp::implementation::TerminalPage::_ExpandCommands(nameMap, settings.ActiveProfiles().GetView(), settings.GlobalSettings().ColorSchemes());
|
||||
auto expandedCommands = MTApp::implementation::TerminalPage::_ExpandCommands(nameMap, settings.ActiveProfiles().GetView(), settings.GlobalSettings().ColorSchemes());
|
||||
_logCommandNames(expandedCommands.GetView());
|
||||
|
||||
VERIFY_ARE_EQUAL(0u, settings.Warnings().Size());
|
||||
@@ -527,7 +527,7 @@ namespace TerminalAppLocalTests
|
||||
VERIFY_ARE_EQUAL(0u, settings.Warnings().Size());
|
||||
VERIFY_ARE_EQUAL(3u, settings.ActiveProfiles().Size());
|
||||
|
||||
auto expandedCommands = winrt::TerminalApp::implementation::TerminalPage::_ExpandCommands(settings.ActionMap().NameMap(), settings.ActiveProfiles().GetView(), settings.GlobalSettings().ColorSchemes());
|
||||
auto expandedCommands = MTApp::implementation::TerminalPage::_ExpandCommands(settings.ActionMap().NameMap(), settings.ActiveProfiles().GetView(), settings.GlobalSettings().ColorSchemes());
|
||||
_logCommandNames(expandedCommands.GetView());
|
||||
|
||||
VERIFY_ARE_EQUAL(0u, settings.Warnings().Size());
|
||||
@@ -621,7 +621,7 @@ namespace TerminalAppLocalTests
|
||||
VERIFY_ARE_EQUAL(0u, settings.Warnings().Size());
|
||||
VERIFY_ARE_EQUAL(3u, settings.ActiveProfiles().Size());
|
||||
|
||||
auto expandedCommands = winrt::TerminalApp::implementation::TerminalPage::_ExpandCommands(settings.ActionMap().NameMap(), settings.ActiveProfiles().GetView(), settings.GlobalSettings().ColorSchemes());
|
||||
auto expandedCommands = MTApp::implementation::TerminalPage::_ExpandCommands(settings.ActionMap().NameMap(), settings.ActiveProfiles().GetView(), settings.GlobalSettings().ColorSchemes());
|
||||
_logCommandNames(expandedCommands.GetView());
|
||||
|
||||
VERIFY_ARE_EQUAL(0u, settings.Warnings().Size());
|
||||
@@ -744,7 +744,7 @@ namespace TerminalAppLocalTests
|
||||
VERIFY_ARE_EQUAL(0u, settings.Warnings().Size());
|
||||
VERIFY_ARE_EQUAL(3u, settings.ActiveProfiles().Size());
|
||||
|
||||
auto expandedCommands = winrt::TerminalApp::implementation::TerminalPage::_ExpandCommands(settings.ActionMap().NameMap(), settings.ActiveProfiles().GetView(), settings.GlobalSettings().ColorSchemes());
|
||||
auto expandedCommands = MTApp::implementation::TerminalPage::_ExpandCommands(settings.ActionMap().NameMap(), settings.ActiveProfiles().GetView(), settings.GlobalSettings().ColorSchemes());
|
||||
_logCommandNames(expandedCommands.GetView());
|
||||
|
||||
VERIFY_ARE_EQUAL(0u, settings.Warnings().Size());
|
||||
@@ -880,7 +880,7 @@ namespace TerminalAppLocalTests
|
||||
VERIFY_ARE_EQUAL(0u, settings.Warnings().Size());
|
||||
VERIFY_ARE_EQUAL(3u, settings.ActiveProfiles().Size());
|
||||
|
||||
auto expandedCommands = winrt::TerminalApp::implementation::TerminalPage::_ExpandCommands(settings.ActionMap().NameMap(), settings.ActiveProfiles().GetView(), settings.GlobalSettings().ColorSchemes());
|
||||
auto expandedCommands = MTApp::implementation::TerminalPage::_ExpandCommands(settings.ActionMap().NameMap(), settings.ActiveProfiles().GetView(), settings.GlobalSettings().ColorSchemes());
|
||||
_logCommandNames(expandedCommands.GetView());
|
||||
|
||||
VERIFY_ARE_EQUAL(0u, settings.Warnings().Size());
|
||||
@@ -982,7 +982,7 @@ namespace TerminalAppLocalTests
|
||||
VERIFY_ARE_EQUAL(0u, settings.Warnings().Size());
|
||||
VERIFY_ARE_EQUAL(3u, settings.ActiveProfiles().Size());
|
||||
|
||||
auto expandedCommands = winrt::TerminalApp::implementation::TerminalPage::_ExpandCommands(settings.ActionMap().NameMap(), settings.ActiveProfiles().GetView(), settings.GlobalSettings().ColorSchemes());
|
||||
auto expandedCommands = MTApp::implementation::TerminalPage::_ExpandCommands(settings.ActionMap().NameMap(), settings.ActiveProfiles().GetView(), settings.GlobalSettings().ColorSchemes());
|
||||
_logCommandNames(expandedCommands.GetView());
|
||||
|
||||
VERIFY_ARE_EQUAL(0u, settings.Warnings().Size());
|
||||
@@ -1205,7 +1205,7 @@ namespace TerminalAppLocalTests
|
||||
VERIFY_ARE_EQUAL(L"${scheme.name}", realArgs.TerminalArgs().Profile());
|
||||
}
|
||||
|
||||
auto expandedCommands = winrt::TerminalApp::implementation::TerminalPage::_ExpandCommands(nameMap, settings.ActiveProfiles().GetView(), settings.GlobalSettings().ColorSchemes());
|
||||
auto expandedCommands = MTApp::implementation::TerminalPage::_ExpandCommands(nameMap, settings.ActiveProfiles().GetView(), settings.GlobalSettings().ColorSchemes());
|
||||
_logCommandNames(expandedCommands.GetView());
|
||||
|
||||
VERIFY_ARE_EQUAL(3u, expandedCommands.Size());
|
||||
|
||||
@@ -13,27 +13,20 @@
|
||||
|
||||
using namespace Microsoft::Console;
|
||||
using namespace TerminalApp;
|
||||
using namespace winrt::TerminalApp;
|
||||
using namespace winrt::Microsoft::Terminal::Settings::Model;
|
||||
using namespace MTApp;
|
||||
using namespace MTSM;
|
||||
|
||||
using namespace WEX::Logging;
|
||||
using namespace WEX::TestExecution;
|
||||
using namespace WEX::Common;
|
||||
|
||||
using namespace winrt::Windows::ApplicationModel::DataTransfer;
|
||||
using namespace winrt::Windows::Foundation::Collections;
|
||||
using namespace winrt::Windows::System;
|
||||
using namespace winrt::Windows::UI::Xaml;
|
||||
using namespace winrt::Windows::UI::Xaml::Controls;
|
||||
using namespace winrt::Windows::UI::Core;
|
||||
using namespace winrt::Windows::UI::Text;
|
||||
|
||||
namespace winrt
|
||||
{
|
||||
namespace MUX = Microsoft::UI::Xaml;
|
||||
namespace WUX = Windows::UI::Xaml;
|
||||
using IInspectable = Windows::Foundation::IInspectable;
|
||||
}
|
||||
using namespace WFC;
|
||||
using namespace WS;
|
||||
using namespace WUX;
|
||||
using namespace WUXC;
|
||||
using namespace WUC;
|
||||
using namespace WUT;
|
||||
|
||||
namespace TerminalAppLocalTests
|
||||
{
|
||||
@@ -107,9 +100,9 @@ namespace TerminalAppLocalTests
|
||||
}
|
||||
|
||||
private:
|
||||
void _initializeTerminalPage(winrt::com_ptr<winrt::TerminalApp::implementation::TerminalPage>& page,
|
||||
void _initializeTerminalPage(winrt::com_ptr<MTApp::implementation::TerminalPage>& page,
|
||||
CascadiaSettings initialSettings);
|
||||
winrt::com_ptr<winrt::TerminalApp::implementation::TerminalPage> _commonSetup();
|
||||
winrt::com_ptr<MTApp::implementation::TerminalPage> _commonSetup();
|
||||
};
|
||||
|
||||
template<typename TFunction>
|
||||
@@ -139,7 +132,7 @@ namespace TerminalAppLocalTests
|
||||
{
|
||||
// Verify we can create a WinRT type we authored
|
||||
// Just creating it is enough to know that everything is working.
|
||||
winrt::Microsoft::Terminal::TerminalConnection::EchoConnection conn{};
|
||||
MTConnection::EchoConnection conn{};
|
||||
VERIFY_IS_NOT_NULL(conn);
|
||||
// We're doing this test separately from the TryCreateSettingsType test,
|
||||
// to ensure both dependent binaries (TerminalSettings and
|
||||
@@ -155,13 +148,13 @@ namespace TerminalAppLocalTests
|
||||
VERIFY_IS_NOT_NULL(v, L"Ensure we have a current view");
|
||||
// Verify we can create a some XAML objects
|
||||
// Just creating all of them is enough to know that everything is working.
|
||||
winrt::Windows::UI::Xaml::Controls::UserControl controlRoot;
|
||||
WUXC::UserControl controlRoot;
|
||||
VERIFY_IS_NOT_NULL(controlRoot, L"Try making a UserControl");
|
||||
winrt::Windows::UI::Xaml::Controls::Grid root;
|
||||
WUXC::Grid root;
|
||||
VERIFY_IS_NOT_NULL(root, L"Try making a Grid");
|
||||
winrt::Windows::UI::Xaml::Controls::SwapChainPanel swapChainPanel;
|
||||
WUXC::SwapChainPanel swapChainPanel;
|
||||
VERIFY_IS_NOT_NULL(swapChainPanel, L"Try making a SwapChainPanel");
|
||||
winrt::Windows::UI::Xaml::Controls::Primitives::ScrollBar scrollBar;
|
||||
WUXC::Primitives::ScrollBar scrollBar;
|
||||
VERIFY_IS_NOT_NULL(scrollBar, L"Try making a ScrollBar");
|
||||
});
|
||||
|
||||
@@ -170,10 +163,10 @@ namespace TerminalAppLocalTests
|
||||
|
||||
void TabTests::CreateSimpleTerminalXamlType()
|
||||
{
|
||||
winrt::com_ptr<winrt::TerminalApp::implementation::MinMaxCloseControl> mmcc{ nullptr };
|
||||
winrt::com_ptr<MTApp::implementation::MinMaxCloseControl> mmcc{ nullptr };
|
||||
|
||||
auto result = RunOnUIThread([&mmcc]() {
|
||||
mmcc = winrt::make_self<winrt::TerminalApp::implementation::MinMaxCloseControl>();
|
||||
mmcc = winrt::make_self<MTApp::implementation::MinMaxCloseControl>();
|
||||
VERIFY_IS_NOT_NULL(mmcc);
|
||||
});
|
||||
VERIFY_SUCCEEDED(result);
|
||||
@@ -181,10 +174,10 @@ namespace TerminalAppLocalTests
|
||||
|
||||
void TabTests::CreateTerminalMuxXamlType()
|
||||
{
|
||||
winrt::com_ptr<winrt::TerminalApp::implementation::TabRowControl> tabRowControl{ nullptr };
|
||||
winrt::com_ptr<MTApp::implementation::TabRowControl> tabRowControl{ nullptr };
|
||||
|
||||
auto result = RunOnUIThread([&tabRowControl]() {
|
||||
tabRowControl = winrt::make_self<winrt::TerminalApp::implementation::TabRowControl>();
|
||||
tabRowControl = winrt::make_self<MTApp::implementation::TabRowControl>();
|
||||
VERIFY_IS_NOT_NULL(tabRowControl);
|
||||
});
|
||||
VERIFY_SUCCEEDED(result);
|
||||
@@ -192,10 +185,10 @@ namespace TerminalAppLocalTests
|
||||
|
||||
void TabTests::CreateTerminalPage()
|
||||
{
|
||||
winrt::com_ptr<winrt::TerminalApp::implementation::TerminalPage> page{ nullptr };
|
||||
winrt::com_ptr<MTApp::implementation::TerminalPage> page{ nullptr };
|
||||
|
||||
auto result = RunOnUIThread([&page]() {
|
||||
page = winrt::make_self<winrt::TerminalApp::implementation::TerminalPage>();
|
||||
page = winrt::make_self<MTApp::implementation::TerminalPage>();
|
||||
VERIFY_IS_NOT_NULL(page);
|
||||
});
|
||||
VERIFY_SUCCEEDED(result);
|
||||
@@ -226,7 +219,7 @@ namespace TerminalAppLocalTests
|
||||
// - initialSettings: a CascadiaSettings to initialize the TerminalPage with.
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void TabTests::_initializeTerminalPage(winrt::com_ptr<winrt::TerminalApp::implementation::TerminalPage>& page,
|
||||
void TabTests::_initializeTerminalPage(winrt::com_ptr<MTApp::implementation::TerminalPage>& page,
|
||||
CascadiaSettings initialSettings)
|
||||
{
|
||||
// This is super wacky, but we can't just initialize the
|
||||
@@ -237,12 +230,12 @@ namespace TerminalAppLocalTests
|
||||
// Instead, create the winrt object, then get a com_ptr to the
|
||||
// implementation _from_ the winrt object. This seems to work, even if
|
||||
// it's weird.
|
||||
winrt::TerminalApp::TerminalPage projectedPage{ nullptr };
|
||||
MTApp::TerminalPage projectedPage{ nullptr };
|
||||
|
||||
Log::Comment(NoThrowString().Format(L"Construct the TerminalPage"));
|
||||
auto result = RunOnUIThread([&projectedPage, &page, initialSettings]() {
|
||||
projectedPage = winrt::TerminalApp::TerminalPage();
|
||||
page.copy_from(winrt::get_self<winrt::TerminalApp::implementation::TerminalPage>(projectedPage));
|
||||
projectedPage = MTApp::TerminalPage();
|
||||
page.copy_from(winrt::get_self<MTApp::implementation::TerminalPage>(projectedPage));
|
||||
page->_settings = initialSettings;
|
||||
});
|
||||
VERIFY_SUCCEEDED(result);
|
||||
@@ -276,11 +269,11 @@ namespace TerminalAppLocalTests
|
||||
page->_startupActions.Append(newTabAction);
|
||||
Log::Comment(L"Added a single newTab action");
|
||||
|
||||
auto app = ::winrt::Windows::UI::Xaml::Application::Current();
|
||||
auto app = WUX::Application::Current();
|
||||
|
||||
winrt::TerminalApp::TerminalPage pp = *page;
|
||||
winrt::Windows::UI::Xaml::Window::Current().Content(pp);
|
||||
winrt::Windows::UI::Xaml::Window::Current().Activate();
|
||||
MTApp::TerminalPage pp = *page;
|
||||
WUX::Window::Current().Content(pp);
|
||||
WUX::Window::Current().Activate();
|
||||
});
|
||||
VERIFY_SUCCEEDED(result);
|
||||
|
||||
@@ -334,7 +327,7 @@ namespace TerminalAppLocalTests
|
||||
// Instead, create the winrt object, then get a com_ptr to the
|
||||
// implementation _from_ the winrt object. This seems to work, even if
|
||||
// it's weird.
|
||||
winrt::com_ptr<winrt::TerminalApp::implementation::TerminalPage> page{ nullptr };
|
||||
winrt::com_ptr<MTApp::implementation::TerminalPage> page{ nullptr };
|
||||
_initializeTerminalPage(page, settings0);
|
||||
|
||||
auto result = RunOnUIThread([&page]() {
|
||||
@@ -399,7 +392,7 @@ namespace TerminalAppLocalTests
|
||||
// Instead, create the winrt object, then get a com_ptr to the
|
||||
// implementation _from_ the winrt object. This seems to work, even if
|
||||
// it's weird.
|
||||
winrt::com_ptr<winrt::TerminalApp::implementation::TerminalPage> page{ nullptr };
|
||||
winrt::com_ptr<MTApp::implementation::TerminalPage> page{ nullptr };
|
||||
_initializeTerminalPage(page, settings0);
|
||||
|
||||
auto result = RunOnUIThread([&page]() {
|
||||
@@ -486,7 +479,7 @@ namespace TerminalAppLocalTests
|
||||
// Instead, create the winrt object, then get a com_ptr to the
|
||||
// implementation _from_ the winrt object. This seems to work, even if
|
||||
// it's weird.
|
||||
winrt::com_ptr<winrt::TerminalApp::implementation::TerminalPage> page{ nullptr };
|
||||
winrt::com_ptr<MTApp::implementation::TerminalPage> page{ nullptr };
|
||||
_initializeTerminalPage(page, settings0);
|
||||
|
||||
auto result = RunOnUIThread([&page]() {
|
||||
@@ -551,7 +544,7 @@ namespace TerminalAppLocalTests
|
||||
// - <none>
|
||||
// Return Value:
|
||||
// - The initialized TerminalPage, ready to use.
|
||||
winrt::com_ptr<winrt::TerminalApp::implementation::TerminalPage> TabTests::_commonSetup()
|
||||
winrt::com_ptr<MTApp::implementation::TerminalPage> TabTests::_commonSetup()
|
||||
{
|
||||
static constexpr std::wstring_view settingsJson0{ LR"(
|
||||
{
|
||||
@@ -668,7 +661,7 @@ namespace TerminalAppLocalTests
|
||||
// Instead, create the winrt object, then get a com_ptr to the
|
||||
// implementation _from_ the winrt object. This seems to work, even if
|
||||
// it's weird.
|
||||
winrt::com_ptr<winrt::TerminalApp::implementation::TerminalPage> page{ nullptr };
|
||||
winrt::com_ptr<MTApp::implementation::TerminalPage> page{ nullptr };
|
||||
_initializeTerminalPage(page, settings0);
|
||||
|
||||
auto result = RunOnUIThread([&page]() {
|
||||
@@ -1225,9 +1218,9 @@ namespace TerminalAppLocalTests
|
||||
VERIFY_ARE_EQUAL(L"a", page->_mruTabs.GetAt(3).Title());
|
||||
});
|
||||
|
||||
const auto palette = winrt::get_self<winrt::TerminalApp::implementation::CommandPalette>(page->CommandPalette());
|
||||
const auto palette = winrt::get_self<MTApp::implementation::CommandPalette>(page->CommandPalette());
|
||||
|
||||
VERIFY_ARE_EQUAL(winrt::TerminalApp::implementation::CommandPaletteMode::TabSwitchMode, palette->_currentMode, L"Verify we are in the tab switcher mode");
|
||||
VERIFY_ARE_EQUAL(MTApp::implementation::CommandPaletteMode::TabSwitchMode, palette->_currentMode, L"Verify we are in the tab switcher mode");
|
||||
// At this point, the contents of the command palette's _mruTabs list is
|
||||
// still the _old_ ordering (d, c, b, a). The ordering is only updated
|
||||
// in TerminalPage::_SelectNextTab, but as we saw before, the palette
|
||||
@@ -1242,14 +1235,14 @@ namespace TerminalAppLocalTests
|
||||
END_TEST_METHOD_PROPERTIES()
|
||||
|
||||
auto page = _commonSetup();
|
||||
page->RenameWindowRequested([&page](auto&&, const winrt::TerminalApp::RenameWindowRequestedArgs args) {
|
||||
page->RenameWindowRequested([&page](auto&&, const MTApp::RenameWindowRequestedArgs args) {
|
||||
// In the real terminal, this would bounce up to the monarch and
|
||||
// come back down. Instead, immediately call back and set the name.
|
||||
page->WindowName(args.ProposedName());
|
||||
});
|
||||
|
||||
auto windowNameChanged = false;
|
||||
page->PropertyChanged([&page, &windowNameChanged](auto&&, const winrt::WUX::Data::PropertyChangedEventArgs& args) mutable {
|
||||
page->PropertyChanged([&page, &windowNameChanged](auto&&, const WUX::Data::PropertyChangedEventArgs& args) mutable {
|
||||
if (args.PropertyName() == L"WindowNameForDisplay")
|
||||
{
|
||||
windowNameChanged = true;
|
||||
@@ -1280,7 +1273,7 @@ namespace TerminalAppLocalTests
|
||||
|
||||
auto windowNameChanged = false;
|
||||
|
||||
page->PropertyChanged([&page, &windowNameChanged](auto&&, const winrt::WUX::Data::PropertyChangedEventArgs& args) mutable {
|
||||
page->PropertyChanged([&page, &windowNameChanged](auto&&, const WUX::Data::PropertyChangedEventArgs& args) mutable {
|
||||
if (args.PropertyName() == L"WindowNameForDisplay")
|
||||
{
|
||||
windowNameChanged = true;
|
||||
|
||||
@@ -22,7 +22,7 @@ Author(s):
|
||||
// This is inexplicable, but for whatever reason, cppwinrt conflicts with the
|
||||
// SDK definition of this function, so the only fix is to undef it.
|
||||
// from WinBase.h
|
||||
// Windows::UI::Xaml::Media::Animation::IStoryboard::GetCurrentTime
|
||||
// WUXMedia::Animation::IStoryboard::GetCurrentTime
|
||||
#ifdef GetCurrentTime
|
||||
#undef GetCurrentTime
|
||||
#endif
|
||||
@@ -74,3 +74,4 @@ Author(s):
|
||||
#include "../../inc/DefaultSettings.h"
|
||||
|
||||
#include <cppwinrt_utils.h>
|
||||
#include <WinRTNamespaceAliases.h>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include "CommandlineArgs.g.cpp"
|
||||
using namespace winrt;
|
||||
using namespace winrt::Microsoft::Terminal;
|
||||
using namespace winrt::Windows::Foundation;
|
||||
using namespace WF;
|
||||
|
||||
namespace winrt::Microsoft::Terminal::Remoting::implementation
|
||||
{
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace winrt::Microsoft::Terminal::Remoting::implementation
|
||||
struct GetWindowLayoutArgs : public GetWindowLayoutArgsT<GetWindowLayoutArgs>
|
||||
{
|
||||
WINRT_PROPERTY(winrt::hstring, WindowLayoutJson, L"");
|
||||
WINRT_PROPERTY(winrt::Windows::Foundation::IAsyncOperation<winrt::hstring>, WindowLayoutJsonAsync, nullptr)
|
||||
WINRT_PROPERTY(WF::IAsyncOperation<winrt::hstring>, WindowLayoutJsonAsync, nullptr)
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
using namespace winrt;
|
||||
using namespace winrt::Microsoft::Terminal;
|
||||
using namespace winrt::Windows::Foundation;
|
||||
using namespace WF;
|
||||
using namespace ::Microsoft::Console;
|
||||
|
||||
namespace winrt::Microsoft::Terminal::Remoting::implementation
|
||||
@@ -134,8 +134,8 @@ namespace winrt::Microsoft::Terminal::Remoting::implementation
|
||||
// - <none> used
|
||||
// Return Value:
|
||||
// - <none>
|
||||
winrt::fire_and_forget Monarch::_handleQuitAll(const winrt::Windows::Foundation::IInspectable& /*sender*/,
|
||||
const winrt::Windows::Foundation::IInspectable& /*args*/)
|
||||
winrt::fire_and_forget Monarch::_handleQuitAll(const WF::IInspectable& /*sender*/,
|
||||
const WF::IInspectable& /*args*/)
|
||||
{
|
||||
// Let the process hosting the monarch run any needed logic before
|
||||
// closing all windows.
|
||||
@@ -230,7 +230,7 @@ namespace winrt::Microsoft::Terminal::Remoting::implementation
|
||||
// - args: a bundle of the peasant ID, timestamp, and desktop ID, for the activated peasant
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void Monarch::_peasantWindowActivated(const winrt::Windows::Foundation::IInspectable& /*sender*/,
|
||||
void Monarch::_peasantWindowActivated(const WF::IInspectable& /*sender*/,
|
||||
const Remoting::WindowActivatedArgs& args)
|
||||
{
|
||||
HandleActivatePeasant(args);
|
||||
@@ -786,8 +786,8 @@ namespace winrt::Microsoft::Terminal::Remoting::implementation
|
||||
// - <unused>
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void Monarch::_identifyWindows(const winrt::Windows::Foundation::IInspectable& /*sender*/,
|
||||
const winrt::Windows::Foundation::IInspectable& /*args*/)
|
||||
void Monarch::_identifyWindows(const WF::IInspectable& /*sender*/,
|
||||
const WF::IInspectable& /*args*/)
|
||||
{
|
||||
// Notify all the peasants to display their ID.
|
||||
const auto callback = [&](const auto& /*id*/, const auto& p) {
|
||||
@@ -816,7 +816,7 @@ namespace winrt::Microsoft::Terminal::Remoting::implementation
|
||||
// indicating if the request was successful.
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void Monarch::_renameRequested(const winrt::Windows::Foundation::IInspectable& /*sender*/,
|
||||
void Monarch::_renameRequested(const WF::IInspectable& /*sender*/,
|
||||
const winrt::Microsoft::Terminal::Remoting::RenameRequestArgs& args)
|
||||
{
|
||||
auto successfullyRenamed = false;
|
||||
@@ -943,7 +943,7 @@ namespace winrt::Microsoft::Terminal::Remoting::implementation
|
||||
// - <none>
|
||||
// Return Value:
|
||||
// - A map of peasant IDs to their names.
|
||||
Windows::Foundation::Collections::IVectorView<PeasantInfo> Monarch::GetPeasantInfos()
|
||||
WFC::IVectorView<PeasantInfo> Monarch::GetPeasantInfos()
|
||||
{
|
||||
std::vector<PeasantInfo> names;
|
||||
{
|
||||
@@ -1017,7 +1017,7 @@ namespace winrt::Microsoft::Terminal::Remoting::implementation
|
||||
// - <none>
|
||||
// Return Value:
|
||||
// - The collection of window layouts from each peasant.
|
||||
Windows::Foundation::Collections::IVector<winrt::hstring> Monarch::GetAllWindowLayouts()
|
||||
WFC::IVector<winrt::hstring> Monarch::GetAllWindowLayouts()
|
||||
{
|
||||
std::vector<winrt::hstring> vec;
|
||||
auto callback = [&](const auto& /*id*/, const auto& p) {
|
||||
|
||||
@@ -57,15 +57,15 @@ namespace winrt::Microsoft::Terminal::Remoting::implementation
|
||||
|
||||
void SummonAllWindows();
|
||||
bool DoesQuakeWindowExist();
|
||||
Windows::Foundation::Collections::IVectorView<winrt::Microsoft::Terminal::Remoting::PeasantInfo> GetPeasantInfos();
|
||||
Windows::Foundation::Collections::IVector<winrt::hstring> GetAllWindowLayouts();
|
||||
WFC::IVectorView<winrt::Microsoft::Terminal::Remoting::PeasantInfo> GetPeasantInfos();
|
||||
WFC::IVector<winrt::hstring> GetAllWindowLayouts();
|
||||
|
||||
TYPED_EVENT(FindTargetWindowRequested, winrt::Windows::Foundation::IInspectable, winrt::Microsoft::Terminal::Remoting::FindTargetWindowArgs);
|
||||
TYPED_EVENT(ShowNotificationIconRequested, winrt::Windows::Foundation::IInspectable, winrt::Windows::Foundation::IInspectable);
|
||||
TYPED_EVENT(HideNotificationIconRequested, winrt::Windows::Foundation::IInspectable, winrt::Windows::Foundation::IInspectable);
|
||||
TYPED_EVENT(WindowCreated, winrt::Windows::Foundation::IInspectable, winrt::Windows::Foundation::IInspectable);
|
||||
TYPED_EVENT(WindowClosed, winrt::Windows::Foundation::IInspectable, winrt::Windows::Foundation::IInspectable);
|
||||
TYPED_EVENT(QuitAllRequested, winrt::Windows::Foundation::IInspectable, winrt::Microsoft::Terminal::Remoting::QuitAllRequestedArgs);
|
||||
TYPED_EVENT(FindTargetWindowRequested, WF::IInspectable, winrt::Microsoft::Terminal::Remoting::FindTargetWindowArgs);
|
||||
TYPED_EVENT(ShowNotificationIconRequested, WF::IInspectable, WF::IInspectable);
|
||||
TYPED_EVENT(HideNotificationIconRequested, WF::IInspectable, WF::IInspectable);
|
||||
TYPED_EVENT(WindowCreated, WF::IInspectable, WF::IInspectable);
|
||||
TYPED_EVENT(WindowClosed, WF::IInspectable, WF::IInspectable);
|
||||
TYPED_EVENT(QuitAllRequested, WF::IInspectable, winrt::Microsoft::Terminal::Remoting::QuitAllRequestedArgs);
|
||||
|
||||
private:
|
||||
uint64_t _ourPID;
|
||||
@@ -89,7 +89,7 @@ namespace winrt::Microsoft::Terminal::Remoting::implementation
|
||||
uint64_t _getMostRecentPeasantID(bool limitToCurrentDesktop, const bool ignoreQuakeWindow);
|
||||
uint64_t _lookupPeasantIdForName(std::wstring_view name);
|
||||
|
||||
void _peasantWindowActivated(const winrt::Windows::Foundation::IInspectable& sender,
|
||||
void _peasantWindowActivated(const WF::IInspectable& sender,
|
||||
const winrt::Microsoft::Terminal::Remoting::WindowActivatedArgs& args);
|
||||
void _doHandleActivatePeasant(const winrt::com_ptr<winrt::Microsoft::Terminal::Remoting::implementation::WindowActivatedArgs>& args);
|
||||
void _clearOldMruEntries(const std::unordered_set<uint64_t>& peasantIds);
|
||||
@@ -97,14 +97,14 @@ namespace winrt::Microsoft::Terminal::Remoting::implementation
|
||||
void _forAllPeasantsIgnoringTheDead(std::function<void(const winrt::Microsoft::Terminal::Remoting::IPeasant&, const uint64_t)> callback,
|
||||
std::function<void(const uint64_t)> errorCallback);
|
||||
|
||||
void _identifyWindows(const winrt::Windows::Foundation::IInspectable& sender,
|
||||
const winrt::Windows::Foundation::IInspectable& args);
|
||||
void _identifyWindows(const WF::IInspectable& sender,
|
||||
const WF::IInspectable& args);
|
||||
|
||||
void _renameRequested(const winrt::Windows::Foundation::IInspectable& sender,
|
||||
void _renameRequested(const WF::IInspectable& sender,
|
||||
const winrt::Microsoft::Terminal::Remoting::RenameRequestArgs& args);
|
||||
|
||||
winrt::fire_and_forget _handleQuitAll(const winrt::Windows::Foundation::IInspectable& sender,
|
||||
const winrt::Windows::Foundation::IInspectable& args);
|
||||
winrt::fire_and_forget _handleQuitAll(const WF::IInspectable& sender,
|
||||
const WF::IInspectable& args);
|
||||
|
||||
// Method Description:
|
||||
// - Helper for doing something on each and every peasant.
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
using namespace winrt;
|
||||
using namespace winrt::Microsoft::Terminal;
|
||||
using namespace winrt::Windows::Foundation;
|
||||
using namespace WF;
|
||||
using namespace ::Microsoft::Console;
|
||||
|
||||
namespace winrt::Microsoft::Terminal::Remoting::implementation
|
||||
|
||||
@@ -41,17 +41,17 @@ namespace winrt::Microsoft::Terminal::Remoting::implementation
|
||||
WINRT_PROPERTY(winrt::hstring, WindowName);
|
||||
WINRT_PROPERTY(winrt::hstring, ActiveTabTitle);
|
||||
|
||||
TYPED_EVENT(WindowActivated, winrt::Windows::Foundation::IInspectable, winrt::Microsoft::Terminal::Remoting::WindowActivatedArgs);
|
||||
TYPED_EVENT(ExecuteCommandlineRequested, winrt::Windows::Foundation::IInspectable, winrt::Microsoft::Terminal::Remoting::CommandlineArgs);
|
||||
TYPED_EVENT(IdentifyWindowsRequested, winrt::Windows::Foundation::IInspectable, winrt::Windows::Foundation::IInspectable);
|
||||
TYPED_EVENT(DisplayWindowIdRequested, winrt::Windows::Foundation::IInspectable, winrt::Windows::Foundation::IInspectable);
|
||||
TYPED_EVENT(RenameRequested, winrt::Windows::Foundation::IInspectable, winrt::Microsoft::Terminal::Remoting::RenameRequestArgs);
|
||||
TYPED_EVENT(SummonRequested, winrt::Windows::Foundation::IInspectable, winrt::Microsoft::Terminal::Remoting::SummonWindowBehavior);
|
||||
TYPED_EVENT(ShowNotificationIconRequested, winrt::Windows::Foundation::IInspectable, winrt::Windows::Foundation::IInspectable);
|
||||
TYPED_EVENT(HideNotificationIconRequested, winrt::Windows::Foundation::IInspectable, winrt::Windows::Foundation::IInspectable);
|
||||
TYPED_EVENT(QuitAllRequested, winrt::Windows::Foundation::IInspectable, winrt::Windows::Foundation::IInspectable);
|
||||
TYPED_EVENT(QuitRequested, winrt::Windows::Foundation::IInspectable, winrt::Windows::Foundation::IInspectable);
|
||||
TYPED_EVENT(GetWindowLayoutRequested, winrt::Windows::Foundation::IInspectable, winrt::Microsoft::Terminal::Remoting::GetWindowLayoutArgs);
|
||||
TYPED_EVENT(WindowActivated, WF::IInspectable, winrt::Microsoft::Terminal::Remoting::WindowActivatedArgs);
|
||||
TYPED_EVENT(ExecuteCommandlineRequested, WF::IInspectable, winrt::Microsoft::Terminal::Remoting::CommandlineArgs);
|
||||
TYPED_EVENT(IdentifyWindowsRequested, WF::IInspectable, WF::IInspectable);
|
||||
TYPED_EVENT(DisplayWindowIdRequested, WF::IInspectable, WF::IInspectable);
|
||||
TYPED_EVENT(RenameRequested, WF::IInspectable, winrt::Microsoft::Terminal::Remoting::RenameRequestArgs);
|
||||
TYPED_EVENT(SummonRequested, WF::IInspectable, winrt::Microsoft::Terminal::Remoting::SummonWindowBehavior);
|
||||
TYPED_EVENT(ShowNotificationIconRequested, WF::IInspectable, WF::IInspectable);
|
||||
TYPED_EVENT(HideNotificationIconRequested, WF::IInspectable, WF::IInspectable);
|
||||
TYPED_EVENT(QuitAllRequested, WF::IInspectable, WF::IInspectable);
|
||||
TYPED_EVENT(QuitRequested, WF::IInspectable, WF::IInspectable);
|
||||
TYPED_EVENT(GetWindowLayoutRequested, WF::IInspectable, winrt::Microsoft::Terminal::Remoting::GetWindowLayoutArgs);
|
||||
|
||||
private:
|
||||
Peasant(const uint64_t testPID);
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace winrt::Microsoft::Terminal::Remoting::implementation
|
||||
_WindowName{ other.WindowName() },
|
||||
_ShouldCreateWindow{ other.ShouldCreateWindow() } {};
|
||||
|
||||
WINRT_PROPERTY(Windows::Foundation::IReference<uint64_t>, Id);
|
||||
WINRT_PROPERTY(WF::IReference<uint64_t>, Id);
|
||||
WINRT_PROPERTY(winrt::hstring, WindowName);
|
||||
WINRT_PROPERTY(bool, ShouldCreateWindow, true);
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace winrt::Microsoft::Terminal::Remoting::implementation
|
||||
{
|
||||
struct QuitAllRequestedArgs : public QuitAllRequestedArgsT<QuitAllRequestedArgs>
|
||||
{
|
||||
WINRT_PROPERTY(winrt::Windows::Foundation::IAsyncAction, BeforeQuitAllAction, nullptr)
|
||||
WINRT_PROPERTY(WF::IAsyncAction, BeforeQuitAllAction, nullptr)
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace winrt::Microsoft::Terminal::Remoting::implementation
|
||||
WINRT_PROPERTY(bool, OnCurrentDesktop, false);
|
||||
WINRT_PROPERTY(SummonWindowBehavior, SummonBehavior);
|
||||
|
||||
WINRT_PROPERTY(Windows::Foundation::IReference<uint64_t>, WindowID);
|
||||
WINRT_PROPERTY(WF::IReference<uint64_t>, WindowID);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -28,14 +28,14 @@ namespace winrt::Microsoft::Terminal::Remoting::implementation
|
||||
{
|
||||
WINRT_PROPERTY(uint64_t, PeasantID, 0);
|
||||
WINRT_PROPERTY(winrt::guid, DesktopID);
|
||||
WINRT_PROPERTY(winrt::Windows::Foundation::DateTime, ActivatedTime, {});
|
||||
WINRT_PROPERTY(WF::DateTime, ActivatedTime, {});
|
||||
WINRT_PROPERTY(uint64_t, Hwnd, 0);
|
||||
|
||||
public:
|
||||
WindowActivatedArgs(uint64_t peasantID,
|
||||
uint64_t hwnd,
|
||||
winrt::guid desktopID,
|
||||
winrt::Windows::Foundation::DateTime timestamp) :
|
||||
WF::DateTime timestamp) :
|
||||
_PeasantID{ peasantID },
|
||||
_Hwnd{ hwnd },
|
||||
_DesktopID{ desktopID },
|
||||
@@ -43,7 +43,7 @@ namespace winrt::Microsoft::Terminal::Remoting::implementation
|
||||
|
||||
WindowActivatedArgs(uint64_t peasantID,
|
||||
winrt::guid desktopID,
|
||||
winrt::Windows::Foundation::DateTime timestamp) :
|
||||
WF::DateTime timestamp) :
|
||||
WindowActivatedArgs(peasantID, 0, desktopID, timestamp){};
|
||||
|
||||
WindowActivatedArgs(const Remoting::WindowActivatedArgs& other) :
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
using namespace winrt;
|
||||
using namespace winrt::Microsoft::Terminal;
|
||||
using namespace winrt::Windows::Foundation;
|
||||
using namespace WF;
|
||||
using namespace ::Microsoft::Console;
|
||||
|
||||
namespace winrt::Microsoft::Terminal::Remoting::implementation
|
||||
@@ -97,7 +97,7 @@ namespace winrt::Microsoft::Terminal::Remoting::implementation
|
||||
|
||||
// You can emulate the monarch dying by: starting a terminal, sticking a
|
||||
// breakpoint in
|
||||
// TerminalApp!winrt::TerminalApp::implementation::AppLogic::_doFindTargetWindow,
|
||||
// TerminalApp!MTApp::implementation::AppLogic::_doFindTargetWindow,
|
||||
// starting a defterm, and when that BP gets hit, kill the original
|
||||
// monarch, and see what happens here.
|
||||
|
||||
@@ -697,7 +697,7 @@ namespace winrt::Microsoft::Terminal::Remoting::implementation
|
||||
return _peasant;
|
||||
}
|
||||
|
||||
void WindowManager::_raiseFindTargetWindowRequested(const winrt::Windows::Foundation::IInspectable& sender,
|
||||
void WindowManager::_raiseFindTargetWindowRequested(const WF::IInspectable& sender,
|
||||
const winrt::Microsoft::Terminal::Remoting::FindTargetWindowArgs& args)
|
||||
{
|
||||
_FindTargetWindowRequestedHandlers(sender, args);
|
||||
@@ -721,7 +721,7 @@ namespace winrt::Microsoft::Terminal::Remoting::implementation
|
||||
_monarch.SummonAllWindows();
|
||||
}
|
||||
|
||||
Windows::Foundation::Collections::IVectorView<winrt::Microsoft::Terminal::Remoting::PeasantInfo> WindowManager::GetPeasantInfos()
|
||||
WFC::IVectorView<winrt::Microsoft::Terminal::Remoting::PeasantInfo> WindowManager::GetPeasantInfos()
|
||||
{
|
||||
// We should only get called when we're the monarch since the monarch
|
||||
// is the only one that knows about all peasants.
|
||||
@@ -789,7 +789,7 @@ namespace winrt::Microsoft::Terminal::Remoting::implementation
|
||||
winrt::get_self<implementation::Peasant>(_peasant)->ActiveTabTitle(title);
|
||||
}
|
||||
|
||||
Windows::Foundation::Collections::IVector<winrt::hstring> WindowManager::GetAllWindowLayouts()
|
||||
WFC::IVector<winrt::hstring> WindowManager::GetAllWindowLayouts()
|
||||
{
|
||||
if (_monarch)
|
||||
{
|
||||
|
||||
@@ -42,23 +42,23 @@ namespace winrt::Microsoft::Terminal::Remoting::implementation
|
||||
|
||||
void SummonAllWindows();
|
||||
uint64_t GetNumberOfPeasants();
|
||||
Windows::Foundation::Collections::IVectorView<winrt::Microsoft::Terminal::Remoting::PeasantInfo> GetPeasantInfos();
|
||||
WFC::IVectorView<winrt::Microsoft::Terminal::Remoting::PeasantInfo> GetPeasantInfos();
|
||||
|
||||
winrt::fire_and_forget RequestShowNotificationIcon();
|
||||
winrt::fire_and_forget RequestHideNotificationIcon();
|
||||
winrt::fire_and_forget RequestQuitAll();
|
||||
bool DoesQuakeWindowExist();
|
||||
void UpdateActiveTabTitle(winrt::hstring title);
|
||||
Windows::Foundation::Collections::IVector<winrt::hstring> GetAllWindowLayouts();
|
||||
WFC::IVector<winrt::hstring> GetAllWindowLayouts();
|
||||
|
||||
TYPED_EVENT(FindTargetWindowRequested, winrt::Windows::Foundation::IInspectable, winrt::Microsoft::Terminal::Remoting::FindTargetWindowArgs);
|
||||
TYPED_EVENT(BecameMonarch, winrt::Windows::Foundation::IInspectable, winrt::Windows::Foundation::IInspectable);
|
||||
TYPED_EVENT(WindowCreated, winrt::Windows::Foundation::IInspectable, winrt::Windows::Foundation::IInspectable);
|
||||
TYPED_EVENT(WindowClosed, winrt::Windows::Foundation::IInspectable, winrt::Windows::Foundation::IInspectable);
|
||||
TYPED_EVENT(ShowNotificationIconRequested, winrt::Windows::Foundation::IInspectable, winrt::Windows::Foundation::IInspectable);
|
||||
TYPED_EVENT(HideNotificationIconRequested, winrt::Windows::Foundation::IInspectable, winrt::Windows::Foundation::IInspectable);
|
||||
TYPED_EVENT(QuitAllRequested, winrt::Windows::Foundation::IInspectable, winrt::Microsoft::Terminal::Remoting::QuitAllRequestedArgs);
|
||||
TYPED_EVENT(GetWindowLayoutRequested, winrt::Windows::Foundation::IInspectable, winrt::Microsoft::Terminal::Remoting::GetWindowLayoutArgs);
|
||||
TYPED_EVENT(FindTargetWindowRequested, WF::IInspectable, winrt::Microsoft::Terminal::Remoting::FindTargetWindowArgs);
|
||||
TYPED_EVENT(BecameMonarch, WF::IInspectable, WF::IInspectable);
|
||||
TYPED_EVENT(WindowCreated, WF::IInspectable, WF::IInspectable);
|
||||
TYPED_EVENT(WindowClosed, WF::IInspectable, WF::IInspectable);
|
||||
TYPED_EVENT(ShowNotificationIconRequested, WF::IInspectable, WF::IInspectable);
|
||||
TYPED_EVENT(HideNotificationIconRequested, WF::IInspectable, WF::IInspectable);
|
||||
TYPED_EVENT(QuitAllRequested, WF::IInspectable, winrt::Microsoft::Terminal::Remoting::QuitAllRequestedArgs);
|
||||
TYPED_EVENT(GetWindowLayoutRequested, WF::IInspectable, winrt::Microsoft::Terminal::Remoting::GetWindowLayoutArgs);
|
||||
|
||||
private:
|
||||
bool _shouldCreateWindow{ false };
|
||||
@@ -82,7 +82,7 @@ namespace winrt::Microsoft::Terminal::Remoting::implementation
|
||||
bool _performElection();
|
||||
void _createPeasantThread();
|
||||
void _waitOnMonarchThread();
|
||||
void _raiseFindTargetWindowRequested(const winrt::Windows::Foundation::IInspectable& sender,
|
||||
void _raiseFindTargetWindowRequested(const WF::IInspectable& sender,
|
||||
const winrt::Microsoft::Terminal::Remoting::FindTargetWindowArgs& args);
|
||||
|
||||
void _proposeToMonarch(const Remoting::CommandlineArgs& args,
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// This is inexplicable, but for whatever reason, cppwinrt conflicts with the
|
||||
// SDK definition of this function, so the only fix is to undef it.
|
||||
// from WinBase.h
|
||||
// Windows::UI::Xaml::Media::Animation::IStoryboard::GetCurrentTime
|
||||
// WUXMedia::Animation::IStoryboard::GetCurrentTime
|
||||
#ifdef GetCurrentTime
|
||||
#undef GetCurrentTime
|
||||
#endif
|
||||
@@ -52,3 +52,4 @@ TRACELOGGING_DECLARE_PROVIDER(g_hRemotingProvider);
|
||||
#include "til.h"
|
||||
|
||||
#include <cppwinrt_utils.h>
|
||||
#include <WinRTNamespaceAliases.h>
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
// This is inexplicable, but for whatever reason, cppwinrt conflicts with the
|
||||
// SDK definition of this function, so the only fix is to undef it.
|
||||
// from WinBase.h
|
||||
// Windows::UI::Xaml::Media::Animation::IStoryboard::GetCurrentTime
|
||||
// WUXMedia::Animation::IStoryboard::GetCurrentTime
|
||||
#ifdef GetCurrentTime
|
||||
#undef GetCurrentTime
|
||||
#endif
|
||||
|
||||
@@ -8,17 +8,17 @@
|
||||
#include "ActionPaletteItem.g.cpp"
|
||||
|
||||
using namespace winrt;
|
||||
using namespace winrt::TerminalApp;
|
||||
using namespace winrt::Windows::UI::Core;
|
||||
using namespace winrt::Windows::UI::Xaml;
|
||||
using namespace winrt::Windows::System;
|
||||
using namespace winrt::Windows::Foundation;
|
||||
using namespace winrt::Windows::Foundation::Collections;
|
||||
using namespace winrt::Microsoft::Terminal::Settings::Model;
|
||||
using namespace MTApp;
|
||||
using namespace WUC;
|
||||
using namespace WUX;
|
||||
using namespace WS;
|
||||
using namespace WF;
|
||||
using namespace WFC;
|
||||
using namespace MTSM;
|
||||
|
||||
namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
ActionPaletteItem::ActionPaletteItem(const Microsoft::Terminal::Settings::Model::Command& command) :
|
||||
ActionPaletteItem::ActionPaletteItem(const MTSM::Command& command) :
|
||||
_Command(command)
|
||||
{
|
||||
Name(command.Name());
|
||||
@@ -27,7 +27,7 @@ namespace winrt::TerminalApp::implementation
|
||||
|
||||
_commandChangedRevoker = command.PropertyChanged(winrt::auto_revoke, [weakThis{ get_weak() }](auto& sender, auto& e) {
|
||||
auto item{ weakThis.get() };
|
||||
auto senderCommand{ sender.try_as<Microsoft::Terminal::Settings::Model::Command>() };
|
||||
auto senderCommand{ sender.try_as<MTSM::Command>() };
|
||||
|
||||
if (item && senderCommand)
|
||||
{
|
||||
|
||||
@@ -11,12 +11,12 @@ namespace winrt::TerminalApp::implementation
|
||||
struct ActionPaletteItem : ActionPaletteItemT<ActionPaletteItem, PaletteItem>
|
||||
{
|
||||
ActionPaletteItem() = default;
|
||||
ActionPaletteItem(const Microsoft::Terminal::Settings::Model::Command& command);
|
||||
ActionPaletteItem(const MTSM::Command& command);
|
||||
|
||||
WINRT_PROPERTY(Microsoft::Terminal::Settings::Model::Command, Command, nullptr);
|
||||
WINRT_PROPERTY(MTSM::Command, Command, nullptr);
|
||||
|
||||
private:
|
||||
Windows::UI::Xaml::Data::INotifyPropertyChanged::PropertyChanged_revoker _commandChangedRevoker;
|
||||
WUX::Data::INotifyPropertyChanged::PropertyChanged_revoker _commandChangedRevoker;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -9,25 +9,25 @@
|
||||
#include <LibraryResources.h>
|
||||
|
||||
using namespace winrt;
|
||||
using namespace winrt::Windows::Foundation::Collections;
|
||||
using namespace winrt::Windows::UI::Xaml;
|
||||
using namespace winrt::Windows::UI::Xaml::Controls;
|
||||
using namespace winrt::Windows::UI::Core;
|
||||
using namespace winrt::Windows::System;
|
||||
using namespace WFC;
|
||||
using namespace WUX;
|
||||
using namespace WUXC;
|
||||
using namespace WUC;
|
||||
using namespace WS;
|
||||
using namespace winrt::Windows::ApplicationModel::DataTransfer;
|
||||
using namespace winrt::Windows::UI::Text;
|
||||
using namespace WUT;
|
||||
using namespace winrt::Microsoft::Terminal;
|
||||
using namespace winrt::Microsoft::Terminal::Control;
|
||||
using namespace winrt::Microsoft::Terminal::TerminalConnection;
|
||||
using namespace winrt::Microsoft::Terminal::Settings::Model;
|
||||
using namespace MTControl;
|
||||
using namespace MTConnection;
|
||||
using namespace MTSM;
|
||||
using namespace ::TerminalApp;
|
||||
using namespace ::Microsoft::Console;
|
||||
using namespace std::chrono_literals;
|
||||
namespace winrt
|
||||
{
|
||||
namespace MUX = Microsoft::UI::Xaml;
|
||||
namespace WUX = Windows::UI::Xaml;
|
||||
using IInspectable = Windows::Foundation::IInspectable;
|
||||
namespace MUX = MUX;
|
||||
namespace WUX = WUX;
|
||||
using IInspectable = WF::IInspectable;
|
||||
}
|
||||
|
||||
namespace winrt::TerminalApp::implementation
|
||||
@@ -92,7 +92,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// - args: The SetColorScheme args with the name of the scheme to use.
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void TerminalPage::_PreviewColorScheme(const Settings::Model::SetColorSchemeArgs& args)
|
||||
void TerminalPage::_PreviewColorScheme(const MTSM::SetColorSchemeArgs& args)
|
||||
{
|
||||
if (const auto& scheme{ _settings.GlobalSettings().ColorSchemes().TryLookup(args.SchemeName()) })
|
||||
{
|
||||
@@ -118,7 +118,7 @@ namespace winrt::TerminalApp::implementation
|
||||
}
|
||||
}
|
||||
|
||||
void TerminalPage::_PreviewAdjustOpacity(const Settings::Model::AdjustOpacityArgs& args)
|
||||
void TerminalPage::_PreviewAdjustOpacity(const MTSM::AdjustOpacityArgs& args)
|
||||
{
|
||||
const auto backup = _restorePreviewFuncs.empty();
|
||||
|
||||
@@ -140,7 +140,7 @@ namespace winrt::TerminalApp::implementation
|
||||
});
|
||||
}
|
||||
|
||||
void TerminalPage::_PreviewAction(const Settings::Model::ActionAndArgs& args)
|
||||
void TerminalPage::_PreviewAction(const MTSM::ActionAndArgs& args)
|
||||
{
|
||||
switch (args.Action())
|
||||
{
|
||||
@@ -179,7 +179,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void TerminalPage::_PreviewActionHandler(const IInspectable& /*sender*/,
|
||||
const Microsoft::Terminal::Settings::Model::Command& args)
|
||||
const MTSM::Command& args)
|
||||
{
|
||||
if (args == nullptr || args.ActionAndArgs() == nullptr)
|
||||
{
|
||||
|
||||
@@ -3,11 +3,11 @@
|
||||
namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
template<typename D, typename... I>
|
||||
struct App_baseWithProvider : public App_base<D, ::winrt::Windows::UI::Xaml::Markup::IXamlMetadataProvider>
|
||||
struct App_baseWithProvider : public App_base<D, WUXMarkup::IXamlMetadataProvider>
|
||||
{
|
||||
using IXamlType = ::winrt::Windows::UI::Xaml::Markup::IXamlType;
|
||||
using IXamlType = WUXMarkup::IXamlType;
|
||||
|
||||
IXamlType GetXamlType(const ::winrt::Windows::UI::Xaml::Interop::TypeName& type)
|
||||
IXamlType GetXamlType(const WUX::Interop::TypeName& type)
|
||||
{
|
||||
return _appProvider.GetXamlType(type);
|
||||
}
|
||||
@@ -17,14 +17,14 @@ namespace winrt::TerminalApp::implementation
|
||||
return _appProvider.GetXamlType(fullName);
|
||||
}
|
||||
|
||||
::winrt::com_array<::winrt::Windows::UI::Xaml::Markup::XmlnsDefinition> GetXmlnsDefinitions()
|
||||
::winrt::com_array<WUXMarkup::XmlnsDefinition> GetXmlnsDefinitions()
|
||||
{
|
||||
return _appProvider.GetXmlnsDefinitions();
|
||||
}
|
||||
|
||||
private:
|
||||
bool _contentLoaded{ false };
|
||||
winrt::TerminalApp::XamlMetaDataProvider _appProvider;
|
||||
MTApp::XamlMetaDataProvider _appProvider;
|
||||
};
|
||||
|
||||
template<typename D, typename... I>
|
||||
|
||||
@@ -7,10 +7,10 @@
|
||||
|
||||
using namespace winrt;
|
||||
using namespace winrt::Windows::ApplicationModel::Activation;
|
||||
using namespace winrt::Windows::Foundation;
|
||||
using namespace winrt::Windows::UI::Xaml;
|
||||
using namespace winrt::Windows::UI::Xaml::Controls;
|
||||
using namespace winrt::Windows::UI::Xaml::Navigation;
|
||||
using namespace WF;
|
||||
using namespace WUX;
|
||||
using namespace WUXC;
|
||||
using namespace WUX::Navigation;
|
||||
|
||||
namespace xaml = ::winrt::Windows::UI::Xaml;
|
||||
|
||||
@@ -23,12 +23,12 @@ namespace winrt::TerminalApp::implementation
|
||||
// Disable XAML's automatic backplating of text when in High Contrast
|
||||
// mode: we want full control of and responsibility for the foreground
|
||||
// and background colors that we draw in XAML.
|
||||
HighContrastAdjustment(::winrt::Windows::UI::Xaml::ApplicationHighContrastAdjustment::None);
|
||||
HighContrastAdjustment(WUX::ApplicationHighContrastAdjustment::None);
|
||||
}
|
||||
|
||||
void App::Initialize()
|
||||
{
|
||||
const auto dispatcherQueue = winrt::Windows::System::DispatcherQueue::GetForCurrentThread();
|
||||
const auto dispatcherQueue = WS::DispatcherQueue::GetForCurrentThread();
|
||||
if (!dispatcherQueue)
|
||||
{
|
||||
_windowsXamlManager = xaml::Hosting::WindowsXamlManager::InitializeForCurrentThread();
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace winrt::TerminalApp::implementation
|
||||
void OnLaunched(const Windows::ApplicationModel::Activation::LaunchActivatedEventArgs&);
|
||||
void Initialize();
|
||||
|
||||
TerminalApp::AppLogic Logic();
|
||||
MTApp::AppLogic Logic();
|
||||
|
||||
void Close();
|
||||
|
||||
@@ -27,8 +27,8 @@ namespace winrt::TerminalApp::implementation
|
||||
|
||||
private:
|
||||
bool _isUwp = false;
|
||||
winrt::Windows::UI::Xaml::Hosting::WindowsXamlManager _windowsXamlManager = nullptr;
|
||||
winrt::Windows::Foundation::Collections::IVector<winrt::Windows::UI::Xaml::Markup::IXamlMetadataProvider> _providers = winrt::single_threaded_vector<Windows::UI::Xaml::Markup::IXamlMetadataProvider>();
|
||||
WUX::Hosting::WindowsXamlManager _windowsXamlManager = nullptr;
|
||||
WFC::IVector<WUXMarkup::IXamlMetadataProvider> _providers = winrt::single_threaded_vector<WUXMarkup::IXamlMetadataProvider>();
|
||||
bool _bIsClosed = false;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -10,21 +10,21 @@
|
||||
#include "Utils.h"
|
||||
|
||||
using namespace winrt::Windows::ApplicationModel::DataTransfer;
|
||||
using namespace winrt::Windows::UI::Xaml;
|
||||
using namespace winrt::Windows::UI::Text;
|
||||
using namespace winrt::Windows::UI::Core;
|
||||
using namespace winrt::Windows::Foundation::Collections;
|
||||
using namespace winrt::Windows::System;
|
||||
using namespace WUX;
|
||||
using namespace WUT;
|
||||
using namespace WUC;
|
||||
using namespace WFC;
|
||||
using namespace WS;
|
||||
using namespace winrt::Microsoft::Terminal;
|
||||
using namespace winrt::Microsoft::Terminal::Settings::Model;
|
||||
using namespace winrt::Microsoft::Terminal::Control;
|
||||
using namespace winrt::Microsoft::Terminal::TerminalConnection;
|
||||
using namespace MTSM;
|
||||
using namespace MTControl;
|
||||
using namespace MTConnection;
|
||||
using namespace ::TerminalApp;
|
||||
|
||||
namespace winrt
|
||||
{
|
||||
namespace MUX = Microsoft::UI::Xaml;
|
||||
using IInspectable = Windows::Foundation::IInspectable;
|
||||
namespace MUX = MUX;
|
||||
using IInspectable = WF::IInspectable;
|
||||
}
|
||||
|
||||
namespace winrt::TerminalApp::implementation
|
||||
@@ -618,7 +618,7 @@ namespace winrt::TerminalApp::implementation
|
||||
void TerminalPage::_HandleSetTabColor(const IInspectable& /*sender*/,
|
||||
const ActionEventArgs& args)
|
||||
{
|
||||
Windows::Foundation::IReference<Windows::UI::Color> tabColor;
|
||||
WF::IReference<Windows::UI::Color> tabColor;
|
||||
|
||||
if (const auto& realArgs = args.ActionArgs().try_as<SetTabColorArgs>())
|
||||
{
|
||||
@@ -721,7 +721,7 @@ namespace winrt::TerminalApp::implementation
|
||||
}
|
||||
|
||||
// Since _RemoveTabs is asynchronous, create a snapshot of the tabs we want to remove
|
||||
std::vector<winrt::TerminalApp::TabBase> tabsToRemove;
|
||||
std::vector<MTApp::TabBase> tabsToRemove;
|
||||
if (index > 0)
|
||||
{
|
||||
std::copy(begin(_tabs), begin(_tabs) + index, std::back_inserter(tabsToRemove));
|
||||
@@ -760,7 +760,7 @@ namespace winrt::TerminalApp::implementation
|
||||
}
|
||||
|
||||
// Since _RemoveTabs is asynchronous, create a snapshot of the tabs we want to remove
|
||||
std::vector<winrt::TerminalApp::TabBase> tabsToRemove;
|
||||
std::vector<MTApp::TabBase> tabsToRemove;
|
||||
std::copy(begin(_tabs) + index + 1, end(_tabs), std::back_inserter(tabsToRemove));
|
||||
_RemoveTabs(tabsToRemove);
|
||||
|
||||
@@ -954,7 +954,7 @@ namespace winrt::TerminalApp::implementation
|
||||
}
|
||||
}
|
||||
|
||||
_UpdateTeachingTipTheme(WindowRenamer().try_as<winrt::Windows::UI::Xaml::FrameworkElement>());
|
||||
_UpdateTeachingTipTheme(WindowRenamer().try_as<WUX::FrameworkElement>());
|
||||
|
||||
// BODGY: GH#12021
|
||||
//
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include "TerminalSettingsModel/ModelSerializationHelpers.h"
|
||||
#include <LibraryResources.h>
|
||||
|
||||
using namespace winrt::Microsoft::Terminal::Settings::Model;
|
||||
using namespace MTSM;
|
||||
using namespace TerminalApp;
|
||||
|
||||
// Either a ; at the start of a line, or a ; preceded by any non-\ char.
|
||||
@@ -941,12 +941,12 @@ std::optional<uint32_t> AppCommandlineArgs::GetPersistedLayoutIdx() const noexce
|
||||
std::nullopt;
|
||||
}
|
||||
|
||||
std::optional<winrt::Microsoft::Terminal::Settings::Model::LaunchMode> AppCommandlineArgs::GetLaunchMode() const noexcept
|
||||
std::optional<MTSM::LaunchMode> AppCommandlineArgs::GetLaunchMode() const noexcept
|
||||
{
|
||||
return _launchMode;
|
||||
}
|
||||
|
||||
std::optional<winrt::Microsoft::Terminal::Settings::Model::LaunchPosition> AppCommandlineArgs::GetPosition() const noexcept
|
||||
std::optional<MTSM::LaunchPosition> AppCommandlineArgs::GetPosition() const noexcept
|
||||
{
|
||||
return _position;
|
||||
}
|
||||
@@ -1027,7 +1027,7 @@ int AppCommandlineArgs::ParseArgs(winrt::array_view<const winrt::hstring>& args)
|
||||
// - args: ExecuteCommandlineArgs describing the command line to parse
|
||||
// Return Value:
|
||||
// - 0 if the commandline was successfully parsed
|
||||
int AppCommandlineArgs::ParseArgs(const winrt::Microsoft::Terminal::Settings::Model::ExecuteCommandlineArgs& args)
|
||||
int AppCommandlineArgs::ParseArgs(const MTSM::ExecuteCommandlineArgs& args)
|
||||
{
|
||||
if (!args || args.Commandline().empty())
|
||||
{
|
||||
|
||||
@@ -34,17 +34,17 @@ public:
|
||||
static std::vector<Commandline> BuildCommands(winrt::array_view<const winrt::hstring>& args);
|
||||
|
||||
void ValidateStartupCommands();
|
||||
std::vector<winrt::Microsoft::Terminal::Settings::Model::ActionAndArgs>& GetStartupActions();
|
||||
std::vector<MTSM::ActionAndArgs>& GetStartupActions();
|
||||
bool IsHandoffListener() const noexcept;
|
||||
const std::string& GetExitMessage();
|
||||
bool ShouldExitEarly() const noexcept;
|
||||
|
||||
std::optional<uint32_t> GetPersistedLayoutIdx() const noexcept;
|
||||
std::optional<winrt::Microsoft::Terminal::Settings::Model::LaunchMode> GetLaunchMode() const noexcept;
|
||||
std::optional<winrt::Microsoft::Terminal::Settings::Model::LaunchPosition> GetPosition() const noexcept;
|
||||
std::optional<MTSM::LaunchMode> GetLaunchMode() const noexcept;
|
||||
std::optional<MTSM::LaunchPosition> GetPosition() const noexcept;
|
||||
std::optional<til::size> GetSize() const noexcept;
|
||||
|
||||
int ParseArgs(const winrt::Microsoft::Terminal::Settings::Model::ExecuteCommandlineArgs& args);
|
||||
int ParseArgs(const MTSM::ExecuteCommandlineArgs& args);
|
||||
void DisableHelpInExitMessage();
|
||||
void FullResetState();
|
||||
|
||||
@@ -100,8 +100,8 @@ private:
|
||||
std::string _startingColorScheme;
|
||||
bool _suppressApplicationTitle{ false };
|
||||
|
||||
winrt::Microsoft::Terminal::Settings::Model::FocusDirection _moveFocusDirection{ winrt::Microsoft::Terminal::Settings::Model::FocusDirection::None };
|
||||
winrt::Microsoft::Terminal::Settings::Model::FocusDirection _swapPaneDirection{ winrt::Microsoft::Terminal::Settings::Model::FocusDirection::None };
|
||||
MTSM::FocusDirection _moveFocusDirection{ MTSM::FocusDirection::None };
|
||||
MTSM::FocusDirection _swapPaneDirection{ MTSM::FocusDirection::None };
|
||||
|
||||
// _commandline will contain the command line with which we'll be spawning a new terminal
|
||||
std::vector<std::string> _commandline;
|
||||
@@ -120,11 +120,11 @@ private:
|
||||
// Are you adding more args here? Make sure to reset them in _resetStateToDefault
|
||||
|
||||
const Commandline* _currentCommandline{ nullptr };
|
||||
std::optional<winrt::Microsoft::Terminal::Settings::Model::LaunchMode> _launchMode{ std::nullopt };
|
||||
std::optional<winrt::Microsoft::Terminal::Settings::Model::LaunchPosition> _position{ std::nullopt };
|
||||
std::optional<MTSM::LaunchMode> _launchMode{ std::nullopt };
|
||||
std::optional<MTSM::LaunchPosition> _position{ std::nullopt };
|
||||
std::optional<til::size> _size{ std::nullopt };
|
||||
bool _isHandoffListener{ false };
|
||||
std::vector<winrt::Microsoft::Terminal::Settings::Model::ActionAndArgs> _startupActions;
|
||||
std::vector<MTSM::ActionAndArgs> _startupActions;
|
||||
std::string _exitMessage;
|
||||
bool _shouldExitEarly{ false };
|
||||
|
||||
@@ -132,7 +132,7 @@ private:
|
||||
std::string _windowTarget{};
|
||||
// Are you adding more args or attributes here? If they are not reset in _resetStateToDefault, make sure to reset them in FullResetState
|
||||
|
||||
winrt::Microsoft::Terminal::Settings::Model::NewTerminalArgs _getNewTerminalArgs(NewTerminalSubcommand& subcommand);
|
||||
MTSM::NewTerminalArgs _getNewTerminalArgs(NewTerminalSubcommand& subcommand);
|
||||
void _addNewTerminalArgs(NewTerminalSubcommand& subcommand);
|
||||
void _buildParser();
|
||||
void _buildNewTabParser();
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
#include "AppKeyBindings.g.cpp"
|
||||
|
||||
using namespace winrt::Microsoft::Terminal;
|
||||
using namespace winrt::TerminalApp;
|
||||
using namespace winrt::Microsoft::Terminal::Control;
|
||||
using namespace MTApp;
|
||||
using namespace MTControl;
|
||||
|
||||
namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
@@ -26,12 +26,12 @@ namespace winrt::TerminalApp::implementation
|
||||
return _actionMap.IsKeyChordExplicitlyUnbound(kc);
|
||||
}
|
||||
|
||||
void AppKeyBindings::SetDispatch(const winrt::TerminalApp::ShortcutActionDispatch& dispatch)
|
||||
void AppKeyBindings::SetDispatch(const MTApp::ShortcutActionDispatch& dispatch)
|
||||
{
|
||||
_dispatch = dispatch;
|
||||
}
|
||||
|
||||
void AppKeyBindings::SetActionMap(const winrt::Microsoft::Terminal::Settings::Model::IActionMapView& actionMap)
|
||||
void AppKeyBindings::SetActionMap(const MTSM::IActionMapView& actionMap)
|
||||
{
|
||||
_actionMap = actionMap;
|
||||
}
|
||||
|
||||
@@ -18,16 +18,16 @@ namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
AppKeyBindings() = default;
|
||||
|
||||
bool TryKeyChord(const winrt::Microsoft::Terminal::Control::KeyChord& kc);
|
||||
bool IsKeyChordExplicitlyUnbound(const winrt::Microsoft::Terminal::Control::KeyChord& kc);
|
||||
bool TryKeyChord(const MTControl::KeyChord& kc);
|
||||
bool IsKeyChordExplicitlyUnbound(const MTControl::KeyChord& kc);
|
||||
|
||||
void SetDispatch(const winrt::TerminalApp::ShortcutActionDispatch& dispatch);
|
||||
void SetActionMap(const Microsoft::Terminal::Settings::Model::IActionMapView& actionMap);
|
||||
void SetDispatch(const MTApp::ShortcutActionDispatch& dispatch);
|
||||
void SetActionMap(const MTSM::IActionMapView& actionMap);
|
||||
|
||||
private:
|
||||
winrt::Microsoft::Terminal::Settings::Model::IActionMapView _actionMap{ nullptr };
|
||||
MTSM::IActionMapView _actionMap{ nullptr };
|
||||
|
||||
winrt::TerminalApp::ShortcutActionDispatch _dispatch{ nullptr };
|
||||
MTApp::ShortcutActionDispatch _dispatch{ nullptr };
|
||||
|
||||
friend class TerminalAppLocalTests::SettingsTests;
|
||||
};
|
||||
|
||||
@@ -16,19 +16,19 @@
|
||||
|
||||
using namespace winrt::Windows::ApplicationModel;
|
||||
using namespace winrt::Windows::ApplicationModel::DataTransfer;
|
||||
using namespace winrt::Windows::UI::Xaml;
|
||||
using namespace winrt::Windows::UI::Xaml::Controls;
|
||||
using namespace winrt::Windows::UI::Core;
|
||||
using namespace winrt::Windows::System;
|
||||
using namespace WUX;
|
||||
using namespace WUXC;
|
||||
using namespace WUC;
|
||||
using namespace WS;
|
||||
using namespace winrt::Microsoft::Terminal;
|
||||
using namespace winrt::Microsoft::Terminal::Control;
|
||||
using namespace winrt::Microsoft::Terminal::Settings::Model;
|
||||
using namespace MTControl;
|
||||
using namespace MTSM;
|
||||
using namespace ::TerminalApp;
|
||||
|
||||
namespace winrt
|
||||
{
|
||||
namespace MUX = Microsoft::UI::Xaml;
|
||||
using IInspectable = Windows::Foundation::IInspectable;
|
||||
namespace MUX = MUX;
|
||||
using IInspectable = WF::IInspectable;
|
||||
}
|
||||
|
||||
static constexpr std::wstring_view StartupTaskName = L"StartTerminalOnLoginTask";
|
||||
@@ -128,7 +128,7 @@ static Documents::Run _BuildErrorRun(const winrt::hstring& text, const ResourceD
|
||||
if (resources.HasKey(key))
|
||||
{
|
||||
auto g = resources.Lookup(key);
|
||||
auto brush = g.try_as<winrt::Windows::UI::Xaml::Media::Brush>();
|
||||
auto brush = g.try_as<WUXMedia::Brush>();
|
||||
textRun.Foreground(brush);
|
||||
}
|
||||
|
||||
@@ -145,7 +145,7 @@ namespace winrt::TerminalApp::implementation
|
||||
AppLogic* AppLogic::Current() noexcept
|
||||
try
|
||||
{
|
||||
if (auto currentXamlApp{ winrt::Windows::UI::Xaml::Application::Current().try_as<winrt::TerminalApp::App>() })
|
||||
if (auto currentXamlApp{ WUX::Application::Current().try_as<MTApp::App>() })
|
||||
{
|
||||
if (auto appLogicPointer{ winrt::get_self<AppLogic>(currentXamlApp.Logic()) })
|
||||
{
|
||||
@@ -169,7 +169,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// - HR E_INVALIDARG if the app isn't up and running.
|
||||
const CascadiaSettings AppLogic::CurrentAppSettings()
|
||||
{
|
||||
auto appLogic{ ::winrt::TerminalApp::implementation::AppLogic::Current() };
|
||||
auto appLogic{ MTApp::implementation::AppLogic::Current() };
|
||||
THROW_HR_IF_NULL(E_INVALIDARG, appLogic);
|
||||
return appLogic->GetSettings();
|
||||
}
|
||||
@@ -189,7 +189,7 @@ namespace winrt::TerminalApp::implementation
|
||||
_isElevated = ::Microsoft::Console::Utils::IsElevated();
|
||||
_root = winrt::make_self<TerminalPage>();
|
||||
|
||||
_reloadSettings = std::make_shared<ThrottledFuncTrailing<>>(winrt::Windows::System::DispatcherQueue::GetForCurrentThread(), std::chrono::milliseconds(100), [weakSelf = get_weak()]() {
|
||||
_reloadSettings = std::make_shared<ThrottledFuncTrailing<>>(WS::DispatcherQueue::GetForCurrentThread(), std::chrono::milliseconds(100), [weakSelf = get_weak()]() {
|
||||
if (auto self{ weakSelf.get() })
|
||||
{
|
||||
self->ReloadSettings();
|
||||
@@ -369,7 +369,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// - dialog: the dialog object that is going to show up
|
||||
// Return value:
|
||||
// - an IAsyncOperation with the dialog result
|
||||
winrt::Windows::Foundation::IAsyncOperation<ContentDialogResult> AppLogic::ShowDialog(winrt::Windows::UI::Xaml::Controls::ContentDialog dialog)
|
||||
WF::IAsyncOperation<ContentDialogResult> AppLogic::ShowDialog(WUXC::ContentDialog dialog)
|
||||
{
|
||||
// DON'T release this lock in a wil::scope_exit. The scope_exit will get
|
||||
// called when we await, which is not what we want.
|
||||
@@ -399,14 +399,14 @@ namespace winrt::TerminalApp::implementation
|
||||
// theme on each element up to the root. We're relying a bit on Xaml's implementation
|
||||
// details here, but it does have the desired effect.
|
||||
// It's not enough to set the theme on the dialog alone.
|
||||
auto themingLambda{ [this](const Windows::Foundation::IInspectable& sender, const RoutedEventArgs&) {
|
||||
auto themingLambda{ [this](const WF::IInspectable& sender, const RoutedEventArgs&) {
|
||||
auto theme{ _settings.GlobalSettings().CurrentTheme() };
|
||||
auto requestedTheme{ theme.RequestedTheme() };
|
||||
auto element{ sender.try_as<winrt::Windows::UI::Xaml::FrameworkElement>() };
|
||||
auto element{ sender.try_as<WUX::FrameworkElement>() };
|
||||
while (element)
|
||||
{
|
||||
element.RequestedTheme(requestedTheme);
|
||||
element = element.Parent().try_as<winrt::Windows::UI::Xaml::FrameworkElement>();
|
||||
element = element.Parent().try_as<WUX::FrameworkElement>();
|
||||
}
|
||||
} };
|
||||
|
||||
@@ -453,7 +453,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// Make sure the lines of text wrap
|
||||
warningsTextBlock.TextWrapping(TextWrapping::Wrap);
|
||||
|
||||
winrt::Windows::UI::Xaml::Documents::Run errorRun;
|
||||
WUX::Documents::Run errorRun;
|
||||
const auto errorLabel = GetLibraryResourceString(contentKey);
|
||||
errorRun.Text(errorLabel);
|
||||
warningsTextBlock.Inlines().Append(errorRun);
|
||||
@@ -463,13 +463,13 @@ namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
if (!_settingsLoadExceptionText.empty())
|
||||
{
|
||||
warningsTextBlock.Inlines().Append(_BuildErrorRun(_settingsLoadExceptionText, ::winrt::Windows::UI::Xaml::Application::Current().as<::winrt::TerminalApp::App>().Resources()));
|
||||
warningsTextBlock.Inlines().Append(_BuildErrorRun(_settingsLoadExceptionText, WUX::Application::Current().as<MTApp::App>().Resources()));
|
||||
warningsTextBlock.Inlines().Append(Documents::LineBreak{});
|
||||
}
|
||||
}
|
||||
|
||||
// Add a note that we're using the default settings in this case.
|
||||
winrt::Windows::UI::Xaml::Documents::Run usingDefaultsRun;
|
||||
WUX::Documents::Run usingDefaultsRun;
|
||||
const auto usingDefaultsText = RS_(L"UsingDefaultSettingsText");
|
||||
usingDefaultsRun.Text(usingDefaultsText);
|
||||
warningsTextBlock.Inlines().Append(Documents::LineBreak{});
|
||||
@@ -507,7 +507,7 @@ namespace winrt::TerminalApp::implementation
|
||||
const auto warningText = _GetWarningText(warning);
|
||||
if (!warningText.empty())
|
||||
{
|
||||
warningsTextBlock.Inlines().Append(_BuildErrorRun(warningText, ::winrt::Windows::UI::Xaml::Application::Current().as<::winrt::TerminalApp::App>().Resources()));
|
||||
warningsTextBlock.Inlines().Append(_BuildErrorRun(warningText, WUX::Application::Current().as<MTApp::App>().Resources()));
|
||||
warningsTextBlock.Inlines().Append(Documents::LineBreak{});
|
||||
}
|
||||
}
|
||||
@@ -611,7 +611,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// - <none>
|
||||
// Return Value:
|
||||
// - a point containing the requested dimensions in pixels.
|
||||
winrt::Windows::Foundation::Size AppLogic::GetLaunchDimensions(uint32_t dpi)
|
||||
WF::Size AppLogic::GetLaunchDimensions(uint32_t dpi)
|
||||
{
|
||||
if (!_loadedInitialSettings)
|
||||
{
|
||||
@@ -619,7 +619,7 @@ namespace winrt::TerminalApp::implementation
|
||||
ReloadSettings();
|
||||
}
|
||||
|
||||
winrt::Windows::Foundation::Size proposedSize{};
|
||||
WF::Size proposedSize{};
|
||||
|
||||
const auto scale = static_cast<float>(dpi) / static_cast<float>(USER_DEFAULT_SCREEN_DPI);
|
||||
if (const auto layout = _root->LoadPersistedLayout(_settings))
|
||||
@@ -767,7 +767,7 @@ namespace winrt::TerminalApp::implementation
|
||||
return _settings.GlobalSettings().CenterOnLaunch() && !_appArgs.GetPosition().has_value();
|
||||
}
|
||||
|
||||
winrt::Windows::UI::Xaml::ElementTheme AppLogic::GetRequestedTheme()
|
||||
WUX::ElementTheme AppLogic::GetRequestedTheme()
|
||||
{
|
||||
return Theme().RequestedTheme();
|
||||
}
|
||||
@@ -1100,7 +1100,7 @@ namespace winrt::TerminalApp::implementation
|
||||
|
||||
UIElement AppLogic::GetRoot() noexcept
|
||||
{
|
||||
return _root.as<winrt::Windows::UI::Xaml::Controls::Control>();
|
||||
return _root.as<WUXC::Control>();
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
@@ -1163,7 +1163,7 @@ namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
// Manually bubble the OnDirectKeyEvent event up through the focus tree.
|
||||
auto xamlRoot{ _root->XamlRoot() };
|
||||
auto focusedObject{ Windows::UI::Xaml::Input::FocusManager::GetFocusedElement(xamlRoot) };
|
||||
auto focusedObject{ WUX::Input::FocusManager::GetFocusedElement(xamlRoot) };
|
||||
do
|
||||
{
|
||||
if (auto keyListener{ focusedObject.try_as<IDirectKeyListener>() })
|
||||
@@ -1175,7 +1175,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// otherwise, keep walking. bubble the event manually.
|
||||
}
|
||||
|
||||
if (auto focusedElement{ focusedObject.try_as<Windows::UI::Xaml::FrameworkElement>() })
|
||||
if (auto focusedElement{ focusedObject.try_as<WUX::FrameworkElement>() })
|
||||
{
|
||||
focusedObject = focusedElement.Parent();
|
||||
|
||||
@@ -1183,7 +1183,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// Use the VisualTreeHelper's GetParent as a fallback.
|
||||
if (!focusedObject)
|
||||
{
|
||||
focusedObject = winrt::Windows::UI::Xaml::Media::VisualTreeHelper::GetParent(focusedElement);
|
||||
focusedObject = WUXMedia::VisualTreeHelper::GetParent(focusedElement);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1223,7 +1223,7 @@ namespace winrt::TerminalApp::implementation
|
||||
}
|
||||
}
|
||||
|
||||
winrt::TerminalApp::TaskbarState AppLogic::TaskbarState()
|
||||
MTApp::TaskbarState AppLogic::TaskbarState()
|
||||
{
|
||||
if (_root)
|
||||
{
|
||||
@@ -1232,7 +1232,7 @@ namespace winrt::TerminalApp::implementation
|
||||
return {};
|
||||
}
|
||||
|
||||
winrt::Windows::UI::Xaml::Media::Brush AppLogic::TitlebarBrush()
|
||||
WUXMedia::Brush AppLogic::TitlebarBrush()
|
||||
{
|
||||
if (_root)
|
||||
{
|
||||
@@ -1365,7 +1365,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// - WindowingBehaviorUseAnyExisting: We should handle the args "in the current
|
||||
// window ON ANY DESKTOP"
|
||||
// - anything else: We should handle the commandline in the window with the given ID.
|
||||
TerminalApp::FindTargetWindowResult AppLogic::FindTargetWindow(array_view<const winrt::hstring> args)
|
||||
MTApp::FindTargetWindowResult AppLogic::FindTargetWindow(array_view<const winrt::hstring> args)
|
||||
{
|
||||
if (!_loadedInitialSettings)
|
||||
{
|
||||
@@ -1377,8 +1377,8 @@ namespace winrt::TerminalApp::implementation
|
||||
}
|
||||
|
||||
// The main body of this function is a static helper, to facilitate unit-testing
|
||||
TerminalApp::FindTargetWindowResult AppLogic::_doFindTargetWindow(array_view<const winrt::hstring> args,
|
||||
const Microsoft::Terminal::Settings::Model::WindowingMode& windowingBehavior)
|
||||
MTApp::FindTargetWindowResult AppLogic::_doFindTargetWindow(array_view<const winrt::hstring> args,
|
||||
const MTSM::WindowingMode& windowingBehavior)
|
||||
{
|
||||
::TerminalApp::AppCommandlineArgs appArgs;
|
||||
const auto result = appArgs.ParseArgs(args);
|
||||
@@ -1533,7 +1533,7 @@ namespace winrt::TerminalApp::implementation
|
||||
return _settings.GlobalSettings().AutoHideWindow();
|
||||
}
|
||||
|
||||
Windows::Foundation::Collections::IMapView<Microsoft::Terminal::Control::KeyChord, Microsoft::Terminal::Settings::Model::Command> AppLogic::GlobalHotkeys()
|
||||
WFC::IMapView<MTControl::KeyChord, MTSM::Command> AppLogic::GlobalHotkeys()
|
||||
{
|
||||
return _settings.GlobalSettings().ActionMap().GlobalHotkeys();
|
||||
}
|
||||
@@ -1561,7 +1561,7 @@ namespace winrt::TerminalApp::implementation
|
||||
}
|
||||
}
|
||||
|
||||
void AppLogic::SaveWindowLayoutJsons(const Windows::Foundation::Collections::IVector<hstring>& layouts)
|
||||
void AppLogic::SaveWindowLayoutJsons(const WFC::IVector<hstring>& layouts)
|
||||
{
|
||||
std::vector<WindowLayout> converted;
|
||||
converted.reserve(layouts.Size());
|
||||
@@ -1683,7 +1683,7 @@ namespace winrt::TerminalApp::implementation
|
||||
return _settings.GlobalSettings().ShowTitleInTitlebar();
|
||||
}
|
||||
|
||||
Microsoft::Terminal::Settings::Model::Theme AppLogic::Theme()
|
||||
MTSM::Theme AppLogic::Theme()
|
||||
{
|
||||
if (!_loadedInitialSettings)
|
||||
{
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
public:
|
||||
static AppLogic* Current() noexcept;
|
||||
static const Microsoft::Terminal::Settings::Model::CascadiaSettings CurrentAppSettings();
|
||||
static const MTSM::CascadiaSettings CurrentAppSettings();
|
||||
|
||||
AppLogic();
|
||||
~AppLogic() = default;
|
||||
@@ -64,7 +64,7 @@ namespace winrt::TerminalApp::implementation
|
||||
bool IsElevated() const noexcept;
|
||||
void ReloadSettings();
|
||||
|
||||
[[nodiscard]] Microsoft::Terminal::Settings::Model::CascadiaSettings GetSettings() const noexcept;
|
||||
[[nodiscard]] MTSM::CascadiaSettings GetSettings() const noexcept;
|
||||
|
||||
void Quit();
|
||||
|
||||
@@ -72,7 +72,7 @@ namespace winrt::TerminalApp::implementation
|
||||
bool HasSettingsStartupActions() const noexcept;
|
||||
int32_t SetStartupCommandline(array_view<const winrt::hstring> actions);
|
||||
int32_t ExecuteCommandline(array_view<const winrt::hstring> actions, const winrt::hstring& cwd);
|
||||
TerminalApp::FindTargetWindowResult FindTargetWindow(array_view<const winrt::hstring> actions);
|
||||
MTApp::FindTargetWindowResult FindTargetWindow(array_view<const winrt::hstring> actions);
|
||||
winrt::hstring ParseCommandlineMessage();
|
||||
bool ShouldExitEarly();
|
||||
|
||||
@@ -86,7 +86,7 @@ namespace winrt::TerminalApp::implementation
|
||||
bool ShouldImmediatelyHandoffToElevated();
|
||||
void HandoffToElevated();
|
||||
hstring GetWindowLayoutJson(Microsoft::Terminal::Settings::Model::LaunchPosition position);
|
||||
void SaveWindowLayoutJsons(const Windows::Foundation::Collections::IVector<hstring>& layouts);
|
||||
void SaveWindowLayoutJsons(const WFC::IVector<hstring>& layouts);
|
||||
void IdentifyWindow();
|
||||
void RenameFailed();
|
||||
winrt::hstring WindowName();
|
||||
@@ -98,16 +98,16 @@ namespace winrt::TerminalApp::implementation
|
||||
bool IsQuakeWindow() const noexcept;
|
||||
void RequestExitFullscreen();
|
||||
|
||||
Windows::Foundation::Size GetLaunchDimensions(uint32_t dpi);
|
||||
WF::Size GetLaunchDimensions(uint32_t dpi);
|
||||
bool CenterOnLaunch();
|
||||
TerminalApp::InitialPosition GetInitialPosition(int64_t defaultInitialX, int64_t defaultInitialY);
|
||||
winrt::Windows::UI::Xaml::ElementTheme GetRequestedTheme();
|
||||
Microsoft::Terminal::Settings::Model::LaunchMode GetLaunchMode();
|
||||
WUX::ElementTheme GetRequestedTheme();
|
||||
MTSM::LaunchMode GetLaunchMode();
|
||||
bool GetShowTabsInTitlebar();
|
||||
bool GetInitialAlwaysOnTop();
|
||||
float CalcSnappedDimension(const bool widthOrHeight, const float dimension) const;
|
||||
|
||||
Windows::UI::Xaml::UIElement GetRoot() noexcept;
|
||||
WUX::UIElement GetRoot() noexcept;
|
||||
|
||||
void SetInboundListener();
|
||||
|
||||
@@ -118,34 +118,34 @@ namespace winrt::TerminalApp::implementation
|
||||
void CloseWindow(Microsoft::Terminal::Settings::Model::LaunchPosition position);
|
||||
void WindowVisibilityChanged(const bool showOrHide);
|
||||
|
||||
winrt::TerminalApp::TaskbarState TaskbarState();
|
||||
winrt::Windows::UI::Xaml::Media::Brush TitlebarBrush();
|
||||
MTApp::TaskbarState TaskbarState();
|
||||
WUXMedia::Brush TitlebarBrush();
|
||||
void WindowActivated(const bool activated);
|
||||
|
||||
bool GetMinimizeToNotificationArea();
|
||||
bool GetAlwaysShowNotificationIcon();
|
||||
bool GetShowTitleInTitlebar();
|
||||
|
||||
winrt::Windows::Foundation::IAsyncOperation<winrt::Windows::UI::Xaml::Controls::ContentDialogResult> ShowDialog(winrt::Windows::UI::Xaml::Controls::ContentDialog dialog);
|
||||
WF::IAsyncOperation<WUXC::ContentDialogResult> ShowDialog(WUXC::ContentDialog dialog);
|
||||
void DismissDialog();
|
||||
|
||||
Windows::Foundation::Collections::IMapView<Microsoft::Terminal::Control::KeyChord, Microsoft::Terminal::Settings::Model::Command> GlobalHotkeys();
|
||||
WFC::IMapView<MTControl::KeyChord, MTSM::Command> GlobalHotkeys();
|
||||
|
||||
Microsoft::Terminal::Settings::Model::Theme Theme();
|
||||
MTSM::Theme Theme();
|
||||
|
||||
// -------------------------------- WinRT Events ---------------------------------
|
||||
// PropertyChanged is surprisingly not a typed event, so we'll define that one manually.
|
||||
// Usually we'd just do
|
||||
// WINRT_CALLBACK(PropertyChanged, Windows::UI::Xaml::Data::PropertyChangedEventHandler);
|
||||
// WINRT_CALLBACK(PropertyChanged, WUX::Data::PropertyChangedEventHandler);
|
||||
//
|
||||
// But what we're doing here is exposing the Page's PropertyChanged _as
|
||||
// our own event_. It's a FORWARDED_CALLBACK, essentially.
|
||||
winrt::event_token PropertyChanged(Windows::UI::Xaml::Data::PropertyChangedEventHandler const& handler) { return _root->PropertyChanged(handler); }
|
||||
winrt::event_token PropertyChanged(WUX::Data::PropertyChangedEventHandler const& handler) { return _root->PropertyChanged(handler); }
|
||||
void PropertyChanged(winrt::event_token const& token) { _root->PropertyChanged(token); }
|
||||
|
||||
TYPED_EVENT(RequestedThemeChanged, winrt::Windows::Foundation::IInspectable, winrt::Microsoft::Terminal::Settings::Model::Theme);
|
||||
TYPED_EVENT(SettingsChanged, winrt::Windows::Foundation::IInspectable, winrt::Windows::Foundation::IInspectable);
|
||||
TYPED_EVENT(SystemMenuChangeRequested, winrt::Windows::Foundation::IInspectable, winrt::TerminalApp::SystemMenuChangeArgs);
|
||||
TYPED_EVENT(RequestedThemeChanged, WF::IInspectable, MTSM::Theme);
|
||||
TYPED_EVENT(SettingsChanged, WF::IInspectable, WF::IInspectable);
|
||||
TYPED_EVENT(SystemMenuChangeRequested, WF::IInspectable, MTApp::SystemMenuChangeArgs);
|
||||
|
||||
private:
|
||||
bool _isUwp{ false };
|
||||
@@ -157,7 +157,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// ALSO: If you add any UIElements as roots here, make sure they're
|
||||
// updated in _ApplyTheme. The root currently is _root.
|
||||
winrt::com_ptr<TerminalPage> _root{ nullptr };
|
||||
Microsoft::Terminal::Settings::Model::CascadiaSettings _settings{ nullptr };
|
||||
MTSM::CascadiaSettings _settings{ nullptr };
|
||||
|
||||
winrt::hstring _settingsLoadExceptionText;
|
||||
HRESULT _settingsLoadedResult = S_OK;
|
||||
@@ -166,7 +166,7 @@ namespace winrt::TerminalApp::implementation
|
||||
uint64_t _numOpenWindows{ 0 };
|
||||
|
||||
std::shared_mutex _dialogLock;
|
||||
winrt::Windows::UI::Xaml::Controls::ContentDialog _dialog;
|
||||
WUXC::ContentDialog _dialog;
|
||||
|
||||
::TerminalApp::AppCommandlineArgs _appArgs;
|
||||
::TerminalApp::AppCommandlineArgs _settingsAppArgs;
|
||||
@@ -179,8 +179,8 @@ namespace winrt::TerminalApp::implementation
|
||||
winrt::com_ptr<LanguageProfileNotifier> _languageProfileNotifier;
|
||||
wil::unique_folder_change_reader_nothrow _reader;
|
||||
|
||||
static TerminalApp::FindTargetWindowResult _doFindTargetWindow(winrt::array_view<const hstring> args,
|
||||
const Microsoft::Terminal::Settings::Model::WindowingMode& windowingBehavior);
|
||||
static MTApp::FindTargetWindowResult _doFindTargetWindow(winrt::array_view<const hstring> args,
|
||||
const MTSM::WindowingMode& windowingBehavior);
|
||||
|
||||
void _ShowLoadErrorsDialog(const winrt::hstring& titleKey, const winrt::hstring& contentKey, HRESULT settingsLoadedResult);
|
||||
void _ShowLoadWarningsDialog();
|
||||
@@ -190,7 +190,7 @@ namespace winrt::TerminalApp::implementation
|
||||
void _RefreshThemeRoutine();
|
||||
fire_and_forget _ApplyStartupTaskStateChange();
|
||||
|
||||
void _OnLoaded(const IInspectable& sender, const Windows::UI::Xaml::RoutedEventArgs& eventArgs);
|
||||
void _OnLoaded(const IInspectable& sender, const WUX::RoutedEventArgs& eventArgs);
|
||||
|
||||
[[nodiscard]] HRESULT _TryLoadSettings() noexcept;
|
||||
void _ProcessLazySettingsChanges();
|
||||
@@ -200,28 +200,28 @@ namespace winrt::TerminalApp::implementation
|
||||
|
||||
bool _hasCommandLineArguments{ false };
|
||||
bool _hasSettingsStartupActions{ false };
|
||||
std::vector<Microsoft::Terminal::Settings::Model::SettingsLoadWarnings> _warnings;
|
||||
std::vector<MTSM::SettingsLoadWarnings> _warnings;
|
||||
|
||||
// These are events that are handled by the TerminalPage, but are
|
||||
// exposed through the AppLogic. This macro is used to forward the event
|
||||
// directly to them.
|
||||
FORWARDED_TYPED_EVENT(SetTitleBarContent, winrt::Windows::Foundation::IInspectable, winrt::Windows::UI::Xaml::UIElement, _root, SetTitleBarContent);
|
||||
FORWARDED_TYPED_EVENT(TitleChanged, winrt::Windows::Foundation::IInspectable, winrt::hstring, _root, TitleChanged);
|
||||
FORWARDED_TYPED_EVENT(LastTabClosed, winrt::Windows::Foundation::IInspectable, winrt::TerminalApp::LastTabClosedEventArgs, _root, LastTabClosed);
|
||||
FORWARDED_TYPED_EVENT(FocusModeChanged, winrt::Windows::Foundation::IInspectable, winrt::Windows::Foundation::IInspectable, _root, FocusModeChanged);
|
||||
FORWARDED_TYPED_EVENT(FullscreenChanged, winrt::Windows::Foundation::IInspectable, winrt::Windows::Foundation::IInspectable, _root, FullscreenChanged);
|
||||
FORWARDED_TYPED_EVENT(ChangeMaximizeRequested, winrt::Windows::Foundation::IInspectable, winrt::Windows::Foundation::IInspectable, _root, ChangeMaximizeRequested);
|
||||
FORWARDED_TYPED_EVENT(AlwaysOnTopChanged, winrt::Windows::Foundation::IInspectable, winrt::Windows::Foundation::IInspectable, _root, AlwaysOnTopChanged);
|
||||
FORWARDED_TYPED_EVENT(RaiseVisualBell, winrt::Windows::Foundation::IInspectable, winrt::Windows::Foundation::IInspectable, _root, RaiseVisualBell);
|
||||
FORWARDED_TYPED_EVENT(SetTaskbarProgress, winrt::Windows::Foundation::IInspectable, winrt::Windows::Foundation::IInspectable, _root, SetTaskbarProgress);
|
||||
FORWARDED_TYPED_EVENT(IdentifyWindowsRequested, Windows::Foundation::IInspectable, Windows::Foundation::IInspectable, _root, IdentifyWindowsRequested);
|
||||
FORWARDED_TYPED_EVENT(RenameWindowRequested, Windows::Foundation::IInspectable, winrt::TerminalApp::RenameWindowRequestedArgs, _root, RenameWindowRequested);
|
||||
FORWARDED_TYPED_EVENT(IsQuakeWindowChanged, Windows::Foundation::IInspectable, Windows::Foundation::IInspectable, _root, IsQuakeWindowChanged);
|
||||
FORWARDED_TYPED_EVENT(SummonWindowRequested, Windows::Foundation::IInspectable, Windows::Foundation::IInspectable, _root, SummonWindowRequested);
|
||||
FORWARDED_TYPED_EVENT(CloseRequested, Windows::Foundation::IInspectable, Windows::Foundation::IInspectable, _root, CloseRequested);
|
||||
FORWARDED_TYPED_EVENT(OpenSystemMenu, Windows::Foundation::IInspectable, Windows::Foundation::IInspectable, _root, OpenSystemMenu);
|
||||
FORWARDED_TYPED_EVENT(QuitRequested, Windows::Foundation::IInspectable, Windows::Foundation::IInspectable, _root, QuitRequested);
|
||||
FORWARDED_TYPED_EVENT(ShowWindowChanged, Windows::Foundation::IInspectable, winrt::Microsoft::Terminal::Control::ShowWindowArgs, _root, ShowWindowChanged);
|
||||
FORWARDED_TYPED_EVENT(SetTitleBarContent, WF::IInspectable, WUX::UIElement, _root, SetTitleBarContent);
|
||||
FORWARDED_TYPED_EVENT(TitleChanged, WF::IInspectable, winrt::hstring, _root, TitleChanged);
|
||||
FORWARDED_TYPED_EVENT(LastTabClosed, WF::IInspectable, MTApp::LastTabClosedEventArgs, _root, LastTabClosed);
|
||||
FORWARDED_TYPED_EVENT(FocusModeChanged, WF::IInspectable, WF::IInspectable, _root, FocusModeChanged);
|
||||
FORWARDED_TYPED_EVENT(FullscreenChanged, WF::IInspectable, WF::IInspectable, _root, FullscreenChanged);
|
||||
FORWARDED_TYPED_EVENT(ChangeMaximizeRequested, WF::IInspectable, WF::IInspectable, _root, ChangeMaximizeRequested);
|
||||
FORWARDED_TYPED_EVENT(AlwaysOnTopChanged, WF::IInspectable, WF::IInspectable, _root, AlwaysOnTopChanged);
|
||||
FORWARDED_TYPED_EVENT(RaiseVisualBell, WF::IInspectable, WF::IInspectable, _root, RaiseVisualBell);
|
||||
FORWARDED_TYPED_EVENT(SetTaskbarProgress, WF::IInspectable, WF::IInspectable, _root, SetTaskbarProgress);
|
||||
FORWARDED_TYPED_EVENT(IdentifyWindowsRequested, WF::IInspectable, WF::IInspectable, _root, IdentifyWindowsRequested);
|
||||
FORWARDED_TYPED_EVENT(RenameWindowRequested, WF::IInspectable, MTApp::RenameWindowRequestedArgs, _root, RenameWindowRequested);
|
||||
FORWARDED_TYPED_EVENT(IsQuakeWindowChanged, WF::IInspectable, WF::IInspectable, _root, IsQuakeWindowChanged);
|
||||
FORWARDED_TYPED_EVENT(SummonWindowRequested, WF::IInspectable, WF::IInspectable, _root, SummonWindowRequested);
|
||||
FORWARDED_TYPED_EVENT(CloseRequested, WF::IInspectable, WF::IInspectable, _root, CloseRequested);
|
||||
FORWARDED_TYPED_EVENT(OpenSystemMenu, WF::IInspectable, WF::IInspectable, _root, OpenSystemMenu);
|
||||
FORWARDED_TYPED_EVENT(QuitRequested, WF::IInspectable, WF::IInspectable, _root, QuitRequested);
|
||||
FORWARDED_TYPED_EVENT(ShowWindowChanged, WF::IInspectable, MTControl::ShowWindowArgs, _root, ShowWindowChanged);
|
||||
|
||||
#ifdef UNIT_TESTING
|
||||
friend class TerminalAppLocalTests::CommandlineTest;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#include "ColorHelper.h"
|
||||
#include <limits>
|
||||
|
||||
using namespace winrt::TerminalApp;
|
||||
using namespace MTApp;
|
||||
|
||||
// Method Description:
|
||||
// Determines whether or not a given color is light
|
||||
|
||||
@@ -31,10 +31,10 @@ namespace winrt::TerminalApp::implementation
|
||||
// - sender: the rectangle that got clicked
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void ColorPickupFlyout::ColorButton_Click(const IInspectable& sender, const Windows::UI::Xaml::RoutedEventArgs&)
|
||||
void ColorPickupFlyout::ColorButton_Click(const IInspectable& sender, const WUX::RoutedEventArgs&)
|
||||
{
|
||||
auto button{ sender.as<Windows::UI::Xaml::Controls::Button>() };
|
||||
auto rectClr{ button.Background().as<Windows::UI::Xaml::Media::SolidColorBrush>() };
|
||||
auto button{ sender.as<WUXC::Button>() };
|
||||
auto rectClr{ button.Background().as<WUXMedia::SolidColorBrush>() };
|
||||
_ColorSelectedHandlers(rectClr.Color());
|
||||
Hide();
|
||||
}
|
||||
@@ -46,7 +46,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// - <none>
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void ColorPickupFlyout::ClearColorButton_Click(const IInspectable&, const Windows::UI::Xaml::RoutedEventArgs&)
|
||||
void ColorPickupFlyout::ClearColorButton_Click(const IInspectable&, const WUX::RoutedEventArgs&)
|
||||
{
|
||||
_ColorClearedHandlers();
|
||||
Hide();
|
||||
@@ -60,16 +60,16 @@ namespace winrt::TerminalApp::implementation
|
||||
// - <none>
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void ColorPickupFlyout::ShowColorPickerButton_Click(const Windows::Foundation::IInspectable&, const Windows::UI::Xaml::RoutedEventArgs&)
|
||||
void ColorPickupFlyout::ShowColorPickerButton_Click(const WF::IInspectable&, const WUX::RoutedEventArgs&)
|
||||
{
|
||||
auto visibility = customColorPanel().Visibility();
|
||||
if (visibility == winrt::Windows::UI::Xaml::Visibility::Collapsed)
|
||||
if (visibility == WUX::Visibility::Collapsed)
|
||||
{
|
||||
customColorPanel().Visibility(winrt::Windows::UI::Xaml::Visibility::Visible);
|
||||
customColorPanel().Visibility(WUX::Visibility::Visible);
|
||||
}
|
||||
else
|
||||
{
|
||||
customColorPanel().Visibility(winrt::Windows::UI::Xaml::Visibility::Collapsed);
|
||||
customColorPanel().Visibility(WUX::Visibility::Collapsed);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,14 +80,14 @@ namespace winrt::TerminalApp::implementation
|
||||
// - <none>
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void ColorPickupFlyout::CustomColorButton_Click(const Windows::Foundation::IInspectable&, const Windows::UI::Xaml::RoutedEventArgs&)
|
||||
void ColorPickupFlyout::CustomColorButton_Click(const WF::IInspectable&, const WUX::RoutedEventArgs&)
|
||||
{
|
||||
auto color = customColorPicker().Color();
|
||||
_ColorSelectedHandlers(color);
|
||||
Hide();
|
||||
}
|
||||
|
||||
void ColorPickupFlyout::ColorPicker_ColorChanged(const Microsoft::UI::Xaml::Controls::ColorPicker&, const Microsoft::UI::Xaml::Controls::ColorChangedEventArgs& args)
|
||||
void ColorPickupFlyout::ColorPicker_ColorChanged(const MUXC::ColorPicker&, const MUXC::ColorChangedEventArgs& args)
|
||||
{
|
||||
_ColorSelectedHandlers(args.NewColor());
|
||||
}
|
||||
|
||||
@@ -7,11 +7,11 @@ namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
ColorPickupFlyout();
|
||||
|
||||
void ColorButton_Click(const Windows::Foundation::IInspectable& sender, const Windows::UI::Xaml::RoutedEventArgs& args);
|
||||
void ShowColorPickerButton_Click(const Windows::Foundation::IInspectable& sender, const Windows::UI::Xaml::RoutedEventArgs& args);
|
||||
void CustomColorButton_Click(const Windows::Foundation::IInspectable& sender, const Windows::UI::Xaml::RoutedEventArgs& args);
|
||||
void ClearColorButton_Click(const Windows::Foundation::IInspectable& sender, const Windows::UI::Xaml::RoutedEventArgs& args);
|
||||
void ColorPicker_ColorChanged(const Microsoft::UI::Xaml::Controls::ColorPicker&, const Microsoft::UI::Xaml::Controls::ColorChangedEventArgs& args);
|
||||
void ColorButton_Click(const WF::IInspectable& sender, const WUX::RoutedEventArgs& args);
|
||||
void ShowColorPickerButton_Click(const WF::IInspectable& sender, const WUX::RoutedEventArgs& args);
|
||||
void CustomColorButton_Click(const WF::IInspectable& sender, const WUX::RoutedEventArgs& args);
|
||||
void ClearColorButton_Click(const WF::IInspectable& sender, const WUX::RoutedEventArgs& args);
|
||||
void ColorPicker_ColorChanged(const MUXC::ColorPicker&, const MUXC::ColorChangedEventArgs& args);
|
||||
|
||||
WINRT_CALLBACK(ColorCleared, TerminalApp::ColorClearedArgs);
|
||||
WINRT_CALLBACK(ColorSelected, TerminalApp::ColorSelectedArgs);
|
||||
|
||||
@@ -8,13 +8,13 @@
|
||||
#include "CommandLinePaletteItem.g.cpp"
|
||||
|
||||
using namespace winrt;
|
||||
using namespace winrt::TerminalApp;
|
||||
using namespace winrt::Windows::UI::Core;
|
||||
using namespace winrt::Windows::UI::Xaml;
|
||||
using namespace winrt::Windows::System;
|
||||
using namespace winrt::Windows::Foundation;
|
||||
using namespace winrt::Windows::Foundation::Collections;
|
||||
using namespace winrt::Microsoft::Terminal::Settings::Model;
|
||||
using namespace MTApp;
|
||||
using namespace WUC;
|
||||
using namespace WUX;
|
||||
using namespace WS;
|
||||
using namespace WF;
|
||||
using namespace WFC;
|
||||
using namespace MTSM;
|
||||
|
||||
namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
|
||||
@@ -11,14 +11,14 @@
|
||||
#include "CommandPalette.g.cpp"
|
||||
|
||||
using namespace winrt;
|
||||
using namespace winrt::TerminalApp;
|
||||
using namespace winrt::Windows::UI::Core;
|
||||
using namespace winrt::Windows::UI::Xaml;
|
||||
using namespace winrt::Windows::UI::Xaml::Controls;
|
||||
using namespace winrt::Windows::System;
|
||||
using namespace winrt::Windows::Foundation;
|
||||
using namespace winrt::Windows::Foundation::Collections;
|
||||
using namespace winrt::Microsoft::Terminal::Settings::Model;
|
||||
using namespace MTApp;
|
||||
using namespace WUC;
|
||||
using namespace WUX;
|
||||
using namespace WUXC;
|
||||
using namespace WS;
|
||||
using namespace WF;
|
||||
using namespace WFC;
|
||||
using namespace MTSM;
|
||||
|
||||
namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
@@ -30,12 +30,12 @@ namespace winrt::TerminalApp::implementation
|
||||
_itemTemplateSelector = Resources().Lookup(winrt::box_value(L"PaletteItemTemplateSelector")).try_as<PaletteItemTemplateSelector>();
|
||||
_listItemTemplate = Resources().Lookup(winrt::box_value(L"ListItemTemplate")).try_as<DataTemplate>();
|
||||
|
||||
_filteredActions = winrt::single_threaded_observable_vector<winrt::TerminalApp::FilteredCommand>();
|
||||
_nestedActionStack = winrt::single_threaded_vector<winrt::TerminalApp::FilteredCommand>();
|
||||
_currentNestedCommands = winrt::single_threaded_vector<winrt::TerminalApp::FilteredCommand>();
|
||||
_allCommands = winrt::single_threaded_vector<winrt::TerminalApp::FilteredCommand>();
|
||||
_tabActions = winrt::single_threaded_vector<winrt::TerminalApp::FilteredCommand>();
|
||||
_mruTabActions = winrt::single_threaded_vector<winrt::TerminalApp::FilteredCommand>();
|
||||
_filteredActions = winrt::single_threaded_observable_vector<MTApp::FilteredCommand>();
|
||||
_nestedActionStack = winrt::single_threaded_vector<MTApp::FilteredCommand>();
|
||||
_currentNestedCommands = winrt::single_threaded_vector<MTApp::FilteredCommand>();
|
||||
_allCommands = winrt::single_threaded_vector<MTApp::FilteredCommand>();
|
||||
_tabActions = winrt::single_threaded_vector<MTApp::FilteredCommand>();
|
||||
_mruTabActions = winrt::single_threaded_vector<MTApp::FilteredCommand>();
|
||||
|
||||
_switchToMode(CommandPaletteMode::ActionMode);
|
||||
|
||||
@@ -155,7 +155,7 @@ namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
if (const auto container = _filteredActionsView().ContainerFromIndex(0))
|
||||
{
|
||||
if (const auto item = container.try_as<winrt::Windows::UI::Xaml::Controls::ListViewItem>())
|
||||
if (const auto item = container.try_as<WUXC::ListViewItem>())
|
||||
{
|
||||
const auto itemHeight = ::base::saturated_cast<int>(item.ActualHeight());
|
||||
const auto listHeight = ::base::saturated_cast<int>(_filteredActionsView().ActualHeight());
|
||||
@@ -223,17 +223,17 @@ namespace winrt::TerminalApp::implementation
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void CommandPalette::_selectedCommandChanged(const IInspectable& /*sender*/,
|
||||
const Windows::UI::Xaml::RoutedEventArgs& /*args*/)
|
||||
const WUX::RoutedEventArgs& /*args*/)
|
||||
{
|
||||
const auto selectedCommand = _filteredActionsView().SelectedItem();
|
||||
const auto filteredCommand{ selectedCommand.try_as<winrt::TerminalApp::FilteredCommand>() };
|
||||
const auto filteredCommand{ selectedCommand.try_as<MTApp::FilteredCommand>() };
|
||||
if (_currentMode == CommandPaletteMode::TabSwitchMode)
|
||||
{
|
||||
_switchToTab(filteredCommand);
|
||||
}
|
||||
else if (_currentMode == CommandPaletteMode::ActionMode && filteredCommand != nullptr)
|
||||
{
|
||||
if (const auto actionPaletteItem{ filteredCommand.Item().try_as<winrt::TerminalApp::ActionPaletteItem>() })
|
||||
if (const auto actionPaletteItem{ filteredCommand.Item().try_as<MTApp::ActionPaletteItem>() })
|
||||
{
|
||||
_PreviewActionHandlers(*this, actionPaletteItem.Command());
|
||||
}
|
||||
@@ -252,14 +252,14 @@ namespace winrt::TerminalApp::implementation
|
||||
}
|
||||
|
||||
void CommandPalette::_previewKeyDownHandler(const IInspectable& /*sender*/,
|
||||
const Windows::UI::Xaml::Input::KeyRoutedEventArgs& e)
|
||||
const WUX::Input::KeyRoutedEventArgs& e)
|
||||
{
|
||||
const auto key = e.OriginalKey();
|
||||
const auto scanCode = e.KeyStatus().ScanCode;
|
||||
const auto coreWindow = CoreWindow::GetForCurrentThread();
|
||||
const auto ctrlDown = WI_IsFlagSet(coreWindow.GetKeyState(winrt::Windows::System::VirtualKey::Control), CoreVirtualKeyStates::Down);
|
||||
const auto altDown = WI_IsFlagSet(coreWindow.GetKeyState(winrt::Windows::System::VirtualKey::Menu), CoreVirtualKeyStates::Down);
|
||||
const auto shiftDown = WI_IsFlagSet(coreWindow.GetKeyState(winrt::Windows::System::VirtualKey::Shift), CoreVirtualKeyStates::Down);
|
||||
const auto ctrlDown = WI_IsFlagSet(coreWindow.GetKeyState(WS::VirtualKey::Control), CoreVirtualKeyStates::Down);
|
||||
const auto altDown = WI_IsFlagSet(coreWindow.GetKeyState(WS::VirtualKey::Menu), CoreVirtualKeyStates::Down);
|
||||
const auto shiftDown = WI_IsFlagSet(coreWindow.GetKeyState(WS::VirtualKey::Shift), CoreVirtualKeyStates::Down);
|
||||
|
||||
// Some keypresses such as Tab, Return, Esc, and Arrow Keys are ignored by controls because
|
||||
// they're not considered input key presses. While they don't raise KeyDown events,
|
||||
@@ -270,7 +270,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// a really widely used keyboard navigation key.
|
||||
if (_currentMode == CommandPaletteMode::TabSwitchMode && _actionMap)
|
||||
{
|
||||
winrt::Microsoft::Terminal::Control::KeyChord kc{ ctrlDown, altDown, shiftDown, false, static_cast<int32_t>(key), static_cast<int32_t>(scanCode) };
|
||||
MTControl::KeyChord kc{ ctrlDown, altDown, shiftDown, false, static_cast<int32_t>(key), static_cast<int32_t>(scanCode) };
|
||||
if (const auto cmd{ _actionMap.GetActionByKeyChord(kc) })
|
||||
{
|
||||
if (cmd.ActionAndArgs().Action() == ShortcutAction::PrevTab)
|
||||
@@ -332,7 +332,7 @@ namespace winrt::TerminalApp::implementation
|
||||
}
|
||||
|
||||
const auto selectedCommand = _filteredActionsView().SelectedItem();
|
||||
const auto filteredCommand = selectedCommand.try_as<winrt::TerminalApp::FilteredCommand>();
|
||||
const auto filteredCommand = selectedCommand.try_as<MTApp::FilteredCommand>();
|
||||
_dispatchCommand(filteredCommand);
|
||||
e.Handled(true);
|
||||
}
|
||||
@@ -371,7 +371,7 @@ namespace winrt::TerminalApp::implementation
|
||||
}
|
||||
else if (key == VirtualKey::Right && _currentMode == CommandPaletteMode::CommandlineMode)
|
||||
{
|
||||
if (const auto command{ _filteredActionsView().SelectedItem().try_as<winrt::TerminalApp::FilteredCommand>() })
|
||||
if (const auto command{ _filteredActionsView().SelectedItem().try_as<MTApp::FilteredCommand>() })
|
||||
{
|
||||
_searchBox().Text(command.Item().Name());
|
||||
_searchBox().Select(_searchBox().Text().size(), 0);
|
||||
@@ -401,7 +401,7 @@ namespace winrt::TerminalApp::implementation
|
||||
}
|
||||
|
||||
void CommandPalette::_keyUpHandler(const IInspectable& /*sender*/,
|
||||
const Windows::UI::Xaml::Input::KeyRoutedEventArgs& e)
|
||||
const WUX::Input::KeyRoutedEventArgs& e)
|
||||
{
|
||||
if (_currentMode == CommandPaletteMode::TabSwitchMode)
|
||||
{
|
||||
@@ -420,14 +420,14 @@ namespace winrt::TerminalApp::implementation
|
||||
void CommandPalette::_anchorKeyUpHandler()
|
||||
{
|
||||
const auto coreWindow = CoreWindow::GetForCurrentThread();
|
||||
const auto ctrlDown = WI_IsFlagSet(coreWindow.GetKeyState(winrt::Windows::System::VirtualKey::Control), CoreVirtualKeyStates::Down);
|
||||
const auto altDown = WI_IsFlagSet(coreWindow.GetKeyState(winrt::Windows::System::VirtualKey::Menu), CoreVirtualKeyStates::Down);
|
||||
const auto shiftDown = WI_IsFlagSet(coreWindow.GetKeyState(winrt::Windows::System::VirtualKey::Shift), CoreVirtualKeyStates::Down);
|
||||
const auto ctrlDown = WI_IsFlagSet(coreWindow.GetKeyState(WS::VirtualKey::Control), CoreVirtualKeyStates::Down);
|
||||
const auto altDown = WI_IsFlagSet(coreWindow.GetKeyState(WS::VirtualKey::Menu), CoreVirtualKeyStates::Down);
|
||||
const auto shiftDown = WI_IsFlagSet(coreWindow.GetKeyState(WS::VirtualKey::Shift), CoreVirtualKeyStates::Down);
|
||||
|
||||
if (!ctrlDown && !altDown && !shiftDown)
|
||||
{
|
||||
const auto selectedCommand = _filteredActionsView().SelectedItem();
|
||||
if (const auto filteredCommand = selectedCommand.try_as<winrt::TerminalApp::FilteredCommand>())
|
||||
if (const auto filteredCommand = selectedCommand.try_as<MTApp::FilteredCommand>())
|
||||
{
|
||||
_dispatchCommand(filteredCommand);
|
||||
}
|
||||
@@ -442,8 +442,8 @@ namespace winrt::TerminalApp::implementation
|
||||
// - <unused>
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void CommandPalette::_rootPointerPressed(const Windows::Foundation::IInspectable& /*sender*/,
|
||||
const Windows::UI::Xaml::Input::PointerRoutedEventArgs& /*e*/)
|
||||
void CommandPalette::_rootPointerPressed(const WF::IInspectable& /*sender*/,
|
||||
const WUX::Input::PointerRoutedEventArgs& /*e*/)
|
||||
{
|
||||
if (Visibility() != Visibility::Collapsed)
|
||||
{
|
||||
@@ -465,8 +465,8 @@ namespace winrt::TerminalApp::implementation
|
||||
// - <unused>
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void CommandPalette::_lostFocusHandler(const Windows::Foundation::IInspectable& /*sender*/,
|
||||
const Windows::UI::Xaml::RoutedEventArgs& /*args*/)
|
||||
void CommandPalette::_lostFocusHandler(const WF::IInspectable& /*sender*/,
|
||||
const WUX::RoutedEventArgs& /*args*/)
|
||||
{
|
||||
const auto flyout = _searchBox().ContextFlyout();
|
||||
if (flyout && flyout.IsOpen())
|
||||
@@ -490,7 +490,7 @@ namespace winrt::TerminalApp::implementation
|
||||
}
|
||||
|
||||
// Go up to the next ancestor
|
||||
focusedElementOrAncestor = winrt::Windows::UI::Xaml::Media::VisualTreeHelper::GetParent(focusedElementOrAncestor);
|
||||
focusedElementOrAncestor = WUXMedia::VisualTreeHelper::GetParent(focusedElementOrAncestor);
|
||||
}
|
||||
|
||||
// We got to the root (the element with no parent) and didn't meet this palette on the path.
|
||||
@@ -506,8 +506,8 @@ namespace winrt::TerminalApp::implementation
|
||||
// - e: the PointerRoutedEventArgs that we want to mark as handled
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void CommandPalette::_backdropPointerPressed(const Windows::Foundation::IInspectable& /*sender*/,
|
||||
const Windows::UI::Xaml::Input::PointerRoutedEventArgs& e)
|
||||
void CommandPalette::_backdropPointerPressed(const WF::IInspectable& /*sender*/,
|
||||
const WUX::Input::PointerRoutedEventArgs& e)
|
||||
{
|
||||
e.Handled(true);
|
||||
}
|
||||
@@ -520,17 +520,17 @@ namespace winrt::TerminalApp::implementation
|
||||
// - e: an ItemClickEventArgs who's ClickedItem() will be the command that was clicked on.
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void CommandPalette::_listItemClicked(const Windows::Foundation::IInspectable& /*sender*/,
|
||||
const Windows::UI::Xaml::Controls::ItemClickEventArgs& e)
|
||||
void CommandPalette::_listItemClicked(const WF::IInspectable& /*sender*/,
|
||||
const WUXC::ItemClickEventArgs& e)
|
||||
{
|
||||
const auto selectedCommand = e.ClickedItem();
|
||||
if (const auto filteredCommand = selectedCommand.try_as<winrt::TerminalApp::FilteredCommand>())
|
||||
if (const auto filteredCommand = selectedCommand.try_as<MTApp::FilteredCommand>())
|
||||
{
|
||||
_dispatchCommand(filteredCommand);
|
||||
}
|
||||
}
|
||||
|
||||
void CommandPalette::_listItemSelectionChanged(const Windows::Foundation::IInspectable& /*sender*/, const Windows::UI::Xaml::Controls::SelectionChangedEventArgs& e)
|
||||
void CommandPalette::_listItemSelectionChanged(const WF::IInspectable& /*sender*/, const WUXC::SelectionChangedEventArgs& e)
|
||||
{
|
||||
// We don't care about...
|
||||
// - CommandlineMode: it doesn't have any selectable items in the list view
|
||||
@@ -542,9 +542,9 @@ namespace winrt::TerminalApp::implementation
|
||||
if (const auto selectedList = e.AddedItems(); selectedList.Size() > 0)
|
||||
{
|
||||
const auto selectedCommand = selectedList.GetAt(0);
|
||||
if (const auto filteredCmd = selectedCommand.try_as<TerminalApp::FilteredCommand>())
|
||||
if (const auto filteredCmd = selectedCommand.try_as<MTApp::FilteredCommand>())
|
||||
{
|
||||
if (const auto paletteItem = filteredCmd.Item().try_as<TerminalApp::PaletteItem>())
|
||||
if (const auto paletteItem = filteredCmd.Item().try_as<MTApp::PaletteItem>())
|
||||
{
|
||||
automationPeer.RaiseNotificationEvent(
|
||||
Automation::Peers::AutomationNotificationKind::ItemAdded,
|
||||
@@ -566,8 +566,8 @@ namespace winrt::TerminalApp::implementation
|
||||
// - sender: the button that got clicked
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void CommandPalette::_moveBackButtonClicked(const Windows::Foundation::IInspectable& /*sender*/,
|
||||
const Windows::UI::Xaml::RoutedEventArgs&)
|
||||
void CommandPalette::_moveBackButtonClicked(const WF::IInspectable& /*sender*/,
|
||||
const WUX::RoutedEventArgs&)
|
||||
{
|
||||
_PreviewActionHandlers(*this, nullptr);
|
||||
_searchBox().Focus(FocusState::Programmatic);
|
||||
@@ -579,7 +579,7 @@ namespace winrt::TerminalApp::implementation
|
||||
if (_nestedActionStack.Size() > 0)
|
||||
{
|
||||
const auto newPreviousAction{ _nestedActionStack.GetAt(_nestedActionStack.Size() - 1) };
|
||||
const auto actionPaletteItem{ newPreviousAction.Item().try_as<winrt::TerminalApp::ActionPaletteItem>() };
|
||||
const auto actionPaletteItem{ newPreviousAction.Item().try_as<MTApp::ActionPaletteItem>() };
|
||||
|
||||
ParentCommandName(actionPaletteItem.Command().Name());
|
||||
_updateCurrentNestedCommands(actionPaletteItem.Command());
|
||||
@@ -640,7 +640,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// - <none>
|
||||
// Return Value:
|
||||
// - A list of Commands to filter.
|
||||
Collections::IVector<winrt::TerminalApp::FilteredCommand> CommandPalette::_commandsToFilter()
|
||||
Collections::IVector<MTApp::FilteredCommand> CommandPalette::_commandsToFilter()
|
||||
{
|
||||
switch (_currentMode)
|
||||
{
|
||||
@@ -671,7 +671,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// - command: the Command to dispatch. This might be null.
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void CommandPalette::_dispatchCommand(const winrt::TerminalApp::FilteredCommand& filteredCommand)
|
||||
void CommandPalette::_dispatchCommand(const MTApp::FilteredCommand& filteredCommand)
|
||||
{
|
||||
if (_currentMode == CommandPaletteMode::CommandlineMode)
|
||||
{
|
||||
@@ -684,7 +684,7 @@ namespace winrt::TerminalApp::implementation
|
||||
}
|
||||
else if (filteredCommand)
|
||||
{
|
||||
if (const auto actionPaletteItem{ filteredCommand.Item().try_as<winrt::TerminalApp::ActionPaletteItem>() })
|
||||
if (const auto actionPaletteItem{ filteredCommand.Item().try_as<MTApp::ActionPaletteItem>() })
|
||||
{
|
||||
if (actionPaletteItem.Command().HasNestedCommands())
|
||||
{
|
||||
@@ -760,11 +760,11 @@ namespace winrt::TerminalApp::implementation
|
||||
// - filteredCommand - Selected filtered command - might be null
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void CommandPalette::_switchToTab(const winrt::TerminalApp::FilteredCommand& filteredCommand)
|
||||
void CommandPalette::_switchToTab(const MTApp::FilteredCommand& filteredCommand)
|
||||
{
|
||||
if (filteredCommand)
|
||||
{
|
||||
if (const auto tabPaletteItem{ filteredCommand.Item().try_as<winrt::TerminalApp::TabPaletteItem>() })
|
||||
if (const auto tabPaletteItem{ filteredCommand.Item().try_as<MTApp::TabPaletteItem>() })
|
||||
{
|
||||
if (const auto tab{ tabPaletteItem.Tab() })
|
||||
{
|
||||
@@ -780,7 +780,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// - filteredCommand - Selected filtered command - might be null
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void CommandPalette::_dispatchCommandline(const winrt::TerminalApp::FilteredCommand& command)
|
||||
void CommandPalette::_dispatchCommandline(const MTApp::FilteredCommand& command)
|
||||
{
|
||||
const auto filteredCommand = command ? command : _buildCommandLineCommand(winrt::hstring(_getTrimmedInput()));
|
||||
if (filteredCommand.has_value())
|
||||
@@ -794,7 +794,7 @@ namespace winrt::TerminalApp::implementation
|
||||
TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES),
|
||||
TelemetryPrivacyDataTag(PDT_ProductAndServiceUsage));
|
||||
|
||||
if (const auto commandLinePaletteItem{ filteredCommand.value().Item().try_as<winrt::TerminalApp::CommandLinePaletteItem>() })
|
||||
if (const auto commandLinePaletteItem{ filteredCommand.value().Item().try_as<MTApp::CommandLinePaletteItem>() })
|
||||
{
|
||||
_CommandLineExecutionRequestedHandlers(*this, commandLinePaletteItem.CommandLine());
|
||||
_close();
|
||||
@@ -802,7 +802,7 @@ namespace winrt::TerminalApp::implementation
|
||||
}
|
||||
}
|
||||
|
||||
std::optional<TerminalApp::FilteredCommand> CommandPalette::_buildCommandLineCommand(const hstring& commandLine)
|
||||
std::optional<MTApp::FilteredCommand> CommandPalette::_buildCommandLineCommand(const hstring& commandLine)
|
||||
{
|
||||
if (commandLine.empty())
|
||||
{
|
||||
@@ -841,7 +841,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void CommandPalette::_filterTextChanged(const IInspectable& /*sender*/,
|
||||
const Windows::UI::Xaml::RoutedEventArgs& /*args*/)
|
||||
const WUX::RoutedEventArgs& /*args*/)
|
||||
{
|
||||
if (_currentMode == CommandPaletteMode::CommandlineMode)
|
||||
{
|
||||
@@ -932,12 +932,12 @@ namespace winrt::TerminalApp::implementation
|
||||
}
|
||||
}
|
||||
|
||||
Collections::IObservableVector<winrt::TerminalApp::FilteredCommand> CommandPalette::FilteredActions()
|
||||
Collections::IObservableVector<MTApp::FilteredCommand> CommandPalette::FilteredActions()
|
||||
{
|
||||
return _filteredActions;
|
||||
}
|
||||
|
||||
void CommandPalette::SetActionMap(const Microsoft::Terminal::Settings::Model::IActionMapView& actionMap)
|
||||
void CommandPalette::SetActionMap(const MTSM::IActionMapView& actionMap)
|
||||
{
|
||||
_actionMap = actionMap;
|
||||
}
|
||||
@@ -947,7 +947,7 @@ namespace winrt::TerminalApp::implementation
|
||||
_allCommands.Clear();
|
||||
for (const auto& action : actions)
|
||||
{
|
||||
auto actionPaletteItem{ winrt::make<winrt::TerminalApp::implementation::ActionPaletteItem>(action) };
|
||||
auto actionPaletteItem{ winrt::make<MTApp::implementation::ActionPaletteItem>(action) };
|
||||
auto filteredCommand{ winrt::make<FilteredCommand>(actionPaletteItem) };
|
||||
_allCommands.Append(filteredCommand);
|
||||
}
|
||||
@@ -970,13 +970,13 @@ namespace winrt::TerminalApp::implementation
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void CommandPalette::_bindTabs(
|
||||
const Windows::Foundation::Collections::IObservableVector<winrt::TerminalApp::TabBase>& source,
|
||||
const Windows::Foundation::Collections::IVector<winrt::TerminalApp::FilteredCommand>& target)
|
||||
const WFC::IObservableVector<MTApp::TabBase>& source,
|
||||
const WFC::IVector<MTApp::FilteredCommand>& target)
|
||||
{
|
||||
target.Clear();
|
||||
for (const auto& tab : source)
|
||||
{
|
||||
auto tabPaletteItem{ winrt::make<winrt::TerminalApp::implementation::TabPaletteItem>(tab) };
|
||||
auto tabPaletteItem{ winrt::make<MTApp::implementation::TabPaletteItem>(tab) };
|
||||
auto filteredCommand{ winrt::make<FilteredCommand>(tabPaletteItem) };
|
||||
target.Append(filteredCommand);
|
||||
}
|
||||
@@ -1071,9 +1071,9 @@ namespace winrt::TerminalApp::implementation
|
||||
// - A collection that will receive the filtered actions
|
||||
// Return Value:
|
||||
// - <none>
|
||||
std::vector<winrt::TerminalApp::FilteredCommand> CommandPalette::_collectFilteredActions()
|
||||
std::vector<MTApp::FilteredCommand> CommandPalette::_collectFilteredActions()
|
||||
{
|
||||
std::vector<winrt::TerminalApp::FilteredCommand> actions;
|
||||
std::vector<MTApp::FilteredCommand> actions;
|
||||
|
||||
winrt::hstring searchText{ _getTrimmedInput() };
|
||||
|
||||
@@ -1162,13 +1162,13 @@ namespace winrt::TerminalApp::implementation
|
||||
// - parentCommand: the command with an optional list of nested commands.
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void CommandPalette::_updateCurrentNestedCommands(const winrt::Microsoft::Terminal::Settings::Model::Command& parentCommand)
|
||||
void CommandPalette::_updateCurrentNestedCommands(const MTSM::Command& parentCommand)
|
||||
{
|
||||
_currentNestedCommands.Clear();
|
||||
for (const auto& nameAndCommand : parentCommand.NestedCommands())
|
||||
{
|
||||
const auto action = nameAndCommand.Value();
|
||||
auto nestedActionPaletteItem{ winrt::make<winrt::TerminalApp::implementation::ActionPaletteItem>(action) };
|
||||
auto nestedActionPaletteItem{ winrt::make<MTApp::implementation::ActionPaletteItem>(action) };
|
||||
auto nestedFilteredCommand{ winrt::make<FilteredCommand>(nestedActionPaletteItem) };
|
||||
_currentNestedCommands.Append(nestedFilteredCommand);
|
||||
}
|
||||
@@ -1229,8 +1229,8 @@ namespace winrt::TerminalApp::implementation
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void CommandPalette::_choosingItemContainer(
|
||||
const Windows::UI::Xaml::Controls::ListViewBase& /*sender*/,
|
||||
const Windows::UI::Xaml::Controls::ChoosingItemContainerEventArgs& args)
|
||||
const WUXC::ListViewBase& /*sender*/,
|
||||
const WUXC::ChoosingItemContainerEventArgs& args)
|
||||
{
|
||||
const auto dataTemplate = _itemTemplateSelector.SelectTemplate(args.Item());
|
||||
const auto itemContainer = args.ItemContainer();
|
||||
@@ -1278,8 +1278,8 @@ namespace winrt::TerminalApp::implementation
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void CommandPalette::_containerContentChanging(
|
||||
const Windows::UI::Xaml::Controls::ListViewBase& /*sender*/,
|
||||
const Windows::UI::Xaml::Controls::ContainerContentChangingEventArgs& args)
|
||||
const WUXC::ListViewBase& /*sender*/,
|
||||
const WUXC::ContainerContentChangingEventArgs& args)
|
||||
{
|
||||
const auto itemContainer = args.ItemContainer();
|
||||
if (args.InRecycleQueue() && itemContainer && itemContainer.ContentTemplate())
|
||||
@@ -1297,17 +1297,17 @@ namespace winrt::TerminalApp::implementation
|
||||
// - Reads the list of recent commands from the persistent application state
|
||||
// Return Value:
|
||||
// - The list of FilteredCommand representing the ones stored in the state
|
||||
IVector<TerminalApp::FilteredCommand> CommandPalette::_loadRecentCommands()
|
||||
IVector<MTApp::FilteredCommand> CommandPalette::_loadRecentCommands()
|
||||
{
|
||||
const auto recentCommands = ApplicationState::SharedInstance().RecentCommands();
|
||||
// If this is the first time we've opened the commandline mode and
|
||||
// there aren't any recent commands, then just return an empty vector.
|
||||
if (!recentCommands)
|
||||
{
|
||||
return single_threaded_vector<TerminalApp::FilteredCommand>();
|
||||
return single_threaded_vector<MTApp::FilteredCommand>();
|
||||
}
|
||||
|
||||
std::vector<TerminalApp::FilteredCommand> parsedCommands;
|
||||
std::vector<MTApp::FilteredCommand> parsedCommands;
|
||||
parsedCommands.reserve(std::min(recentCommands.Size(), CommandLineHistoryLength));
|
||||
|
||||
for (const auto& c : recentCommands)
|
||||
|
||||
@@ -27,11 +27,11 @@ namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
CommandPalette();
|
||||
|
||||
Windows::Foundation::Collections::IObservableVector<winrt::TerminalApp::FilteredCommand> FilteredActions();
|
||||
WFC::IObservableVector<MTApp::FilteredCommand> FilteredActions();
|
||||
|
||||
void SetCommands(const Windows::Foundation::Collections::IVector<Microsoft::Terminal::Settings::Model::Command>& actions);
|
||||
void SetTabs(const Windows::Foundation::Collections::IObservableVector<winrt::TerminalApp::TabBase>& tabs, const Windows::Foundation::Collections::IObservableVector<winrt::TerminalApp::TabBase>& mruTabs);
|
||||
void SetActionMap(const Microsoft::Terminal::Settings::Model::IActionMapView& actionMap);
|
||||
void SetCommands(const WFC::IVector<MTSM::Command>& actions);
|
||||
void SetTabs(const WFC::IObservableVector<MTApp::TabBase>& tabs, const WFC::IObservableVector<MTApp::TabBase>& mruTabs);
|
||||
void SetActionMap(const MTSM::IActionMapView& actionMap);
|
||||
|
||||
bool OnDirectKeyEvent(const uint32_t vkey, const uint8_t scanCode, const bool down);
|
||||
|
||||
@@ -42,11 +42,11 @@ namespace winrt::TerminalApp::implementation
|
||||
void ScrollToTop();
|
||||
void ScrollToBottom();
|
||||
|
||||
void EnableCommandPaletteMode(Microsoft::Terminal::Settings::Model::CommandPaletteLaunchMode const launchMode);
|
||||
void EnableTabSwitcherMode(const uint32_t startIdx, Microsoft::Terminal::Settings::Model::TabSwitcherMode tabSwitcherMode);
|
||||
void EnableCommandPaletteMode(MTSM::CommandPaletteLaunchMode const launchMode);
|
||||
void EnableTabSwitcherMode(const uint32_t startIdx, MTSM::TabSwitcherMode tabSwitcherMode);
|
||||
void EnableTabSearchMode();
|
||||
|
||||
WINRT_CALLBACK(PropertyChanged, Windows::UI::Xaml::Data::PropertyChangedEventHandler);
|
||||
WINRT_CALLBACK(PropertyChanged, WUX::Data::PropertyChangedEventHandler);
|
||||
WINRT_OBSERVABLE_PROPERTY(winrt::hstring, NoMatchesText, _PropertyChangedHandlers);
|
||||
WINRT_OBSERVABLE_PROPERTY(winrt::hstring, SearchBoxPlaceholderText, _PropertyChangedHandlers);
|
||||
WINRT_OBSERVABLE_PROPERTY(winrt::hstring, PrefixCharacter, _PropertyChangedHandlers);
|
||||
@@ -54,53 +54,53 @@ namespace winrt::TerminalApp::implementation
|
||||
WINRT_OBSERVABLE_PROPERTY(winrt::hstring, ParentCommandName, _PropertyChangedHandlers);
|
||||
WINRT_OBSERVABLE_PROPERTY(winrt::hstring, ParsedCommandLineText, _PropertyChangedHandlers);
|
||||
|
||||
TYPED_EVENT(SwitchToTabRequested, winrt::TerminalApp::CommandPalette, winrt::TerminalApp::TabBase);
|
||||
TYPED_EVENT(CommandLineExecutionRequested, winrt::TerminalApp::CommandPalette, winrt::hstring);
|
||||
TYPED_EVENT(DispatchCommandRequested, winrt::TerminalApp::CommandPalette, Microsoft::Terminal::Settings::Model::Command);
|
||||
TYPED_EVENT(PreviewAction, Windows::Foundation::IInspectable, Microsoft::Terminal::Settings::Model::Command);
|
||||
TYPED_EVENT(SwitchToTabRequested, MTApp::CommandPalette, MTApp::TabBase);
|
||||
TYPED_EVENT(CommandLineExecutionRequested, MTApp::CommandPalette, winrt::hstring);
|
||||
TYPED_EVENT(DispatchCommandRequested, MTApp::CommandPalette, MTSM::Command);
|
||||
TYPED_EVENT(PreviewAction, WF::IInspectable, MTSM::Command);
|
||||
|
||||
private:
|
||||
friend struct CommandPaletteT<CommandPalette>; // for Xaml to bind events
|
||||
|
||||
Windows::Foundation::Collections::IVector<winrt::TerminalApp::FilteredCommand> _allCommands{ nullptr };
|
||||
Windows::Foundation::Collections::IVector<winrt::TerminalApp::FilteredCommand> _currentNestedCommands{ nullptr };
|
||||
Windows::Foundation::Collections::IObservableVector<winrt::TerminalApp::FilteredCommand> _filteredActions{ nullptr };
|
||||
Windows::Foundation::Collections::IVector<winrt::TerminalApp::FilteredCommand> _nestedActionStack{ nullptr };
|
||||
WFC::IVector<MTApp::FilteredCommand> _allCommands{ nullptr };
|
||||
WFC::IVector<MTApp::FilteredCommand> _currentNestedCommands{ nullptr };
|
||||
WFC::IObservableVector<MTApp::FilteredCommand> _filteredActions{ nullptr };
|
||||
WFC::IVector<MTApp::FilteredCommand> _nestedActionStack{ nullptr };
|
||||
|
||||
Windows::Foundation::Collections::IVector<winrt::TerminalApp::FilteredCommand> _commandsToFilter();
|
||||
WFC::IVector<MTApp::FilteredCommand> _commandsToFilter();
|
||||
|
||||
bool _lastFilterTextWasEmpty{ true };
|
||||
|
||||
void _filterTextChanged(const Windows::Foundation::IInspectable& sender,
|
||||
const Windows::UI::Xaml::RoutedEventArgs& args);
|
||||
void _previewKeyDownHandler(const Windows::Foundation::IInspectable& sender,
|
||||
const Windows::UI::Xaml::Input::KeyRoutedEventArgs& e);
|
||||
void _filterTextChanged(const WF::IInspectable& sender,
|
||||
const WUX::RoutedEventArgs& args);
|
||||
void _previewKeyDownHandler(const WF::IInspectable& sender,
|
||||
const WUX::Input::KeyRoutedEventArgs& e);
|
||||
|
||||
void _keyUpHandler(const Windows::Foundation::IInspectable& sender,
|
||||
const Windows::UI::Xaml::Input::KeyRoutedEventArgs& e);
|
||||
void _keyUpHandler(const WF::IInspectable& sender,
|
||||
const WUX::Input::KeyRoutedEventArgs& e);
|
||||
|
||||
void _selectedCommandChanged(const Windows::Foundation::IInspectable& sender,
|
||||
const Windows::UI::Xaml::RoutedEventArgs& args);
|
||||
void _selectedCommandChanged(const WF::IInspectable& sender,
|
||||
const WUX::RoutedEventArgs& args);
|
||||
|
||||
void _updateUIForStackChange();
|
||||
|
||||
void _rootPointerPressed(const Windows::Foundation::IInspectable& sender, const Windows::UI::Xaml::Input::PointerRoutedEventArgs& e);
|
||||
void _rootPointerPressed(const WF::IInspectable& sender, const WUX::Input::PointerRoutedEventArgs& e);
|
||||
|
||||
void _lostFocusHandler(const Windows::Foundation::IInspectable& sender, const Windows::UI::Xaml::RoutedEventArgs& args);
|
||||
void _lostFocusHandler(const WF::IInspectable& sender, const WUX::RoutedEventArgs& args);
|
||||
|
||||
void _backdropPointerPressed(const Windows::Foundation::IInspectable& sender, const Windows::UI::Xaml::Input::PointerRoutedEventArgs& e);
|
||||
void _backdropPointerPressed(const WF::IInspectable& sender, const WUX::Input::PointerRoutedEventArgs& e);
|
||||
|
||||
void _listItemClicked(const Windows::Foundation::IInspectable& sender, const Windows::UI::Xaml::Controls::ItemClickEventArgs& e);
|
||||
void _listItemClicked(const WF::IInspectable& sender, const WUXC::ItemClickEventArgs& e);
|
||||
|
||||
void _listItemSelectionChanged(const Windows::Foundation::IInspectable& sender, const Windows::UI::Xaml::Controls::SelectionChangedEventArgs& e);
|
||||
void _listItemSelectionChanged(const WF::IInspectable& sender, const WUXC::SelectionChangedEventArgs& e);
|
||||
|
||||
void _moveBackButtonClicked(const Windows::Foundation::IInspectable& sender, const Windows::UI::Xaml::RoutedEventArgs&);
|
||||
void _moveBackButtonClicked(const WF::IInspectable& sender, const WUX::RoutedEventArgs&);
|
||||
|
||||
void _updateFilteredActions();
|
||||
|
||||
void _updateCurrentNestedCommands(const winrt::Microsoft::Terminal::Settings::Model::Command& parentCommand);
|
||||
void _updateCurrentNestedCommands(const MTSM::Command& parentCommand);
|
||||
|
||||
std::vector<winrt::TerminalApp::FilteredCommand> _collectFilteredActions();
|
||||
std::vector<MTApp::FilteredCommand> _collectFilteredActions();
|
||||
|
||||
void _close();
|
||||
|
||||
@@ -110,23 +110,23 @@ namespace winrt::TerminalApp::implementation
|
||||
std::wstring _getTrimmedInput();
|
||||
void _evaluatePrefix();
|
||||
|
||||
Microsoft::Terminal::Settings::Model::IActionMapView _actionMap{ nullptr };
|
||||
MTSM::IActionMapView _actionMap{ nullptr };
|
||||
|
||||
// Tab Switcher
|
||||
Windows::Foundation::Collections::IVector<winrt::TerminalApp::FilteredCommand> _tabActions{ nullptr };
|
||||
Windows::Foundation::Collections::IVector<winrt::TerminalApp::FilteredCommand> _mruTabActions{ nullptr };
|
||||
Microsoft::Terminal::Settings::Model::TabSwitcherMode _tabSwitcherMode;
|
||||
WFC::IVector<MTApp::FilteredCommand> _tabActions{ nullptr };
|
||||
WFC::IVector<MTApp::FilteredCommand> _mruTabActions{ nullptr };
|
||||
MTSM::TabSwitcherMode _tabSwitcherMode;
|
||||
uint32_t _switcherStartIdx;
|
||||
|
||||
void _bindTabs(const Windows::Foundation::Collections::IObservableVector<winrt::TerminalApp::TabBase>& source, const Windows::Foundation::Collections::IVector<winrt::TerminalApp::FilteredCommand>& target);
|
||||
void _bindTabs(const WFC::IObservableVector<MTApp::TabBase>& source, const WFC::IVector<MTApp::FilteredCommand>& target);
|
||||
void _anchorKeyUpHandler();
|
||||
|
||||
winrt::Windows::UI::Xaml::Controls::ListView::SizeChanged_revoker _sizeChangedRevoker;
|
||||
WUXC::ListView::SizeChanged_revoker _sizeChangedRevoker;
|
||||
|
||||
void _dispatchCommand(const winrt::TerminalApp::FilteredCommand& command);
|
||||
void _dispatchCommandline(const winrt::TerminalApp::FilteredCommand& command);
|
||||
void _switchToTab(const winrt::TerminalApp::FilteredCommand& command);
|
||||
static std::optional<winrt::TerminalApp::FilteredCommand> _buildCommandLineCommand(const winrt::hstring& commandLine);
|
||||
void _dispatchCommand(const MTApp::FilteredCommand& command);
|
||||
void _dispatchCommandline(const MTApp::FilteredCommand& command);
|
||||
void _switchToTab(const MTApp::FilteredCommand& command);
|
||||
static std::optional<MTApp::FilteredCommand> _buildCommandLineCommand(const winrt::hstring& commandLine);
|
||||
|
||||
void _dismissPalette();
|
||||
|
||||
@@ -134,15 +134,15 @@ namespace winrt::TerminalApp::implementation
|
||||
uint32_t _getNumVisibleItems();
|
||||
|
||||
static constexpr uint32_t CommandLineHistoryLength = 20;
|
||||
static Windows::Foundation::Collections::IVector<winrt::TerminalApp::FilteredCommand> _loadRecentCommands();
|
||||
static WFC::IVector<MTApp::FilteredCommand> _loadRecentCommands();
|
||||
static void _updateRecentCommands(const winrt::hstring& command);
|
||||
::TerminalApp::AppCommandlineArgs _appArgs;
|
||||
|
||||
void _choosingItemContainer(const Windows::UI::Xaml::Controls::ListViewBase& sender, const Windows::UI::Xaml::Controls::ChoosingItemContainerEventArgs& args);
|
||||
void _containerContentChanging(const Windows::UI::Xaml::Controls::ListViewBase& sender, const Windows::UI::Xaml::Controls::ContainerContentChangingEventArgs& args);
|
||||
winrt::TerminalApp::PaletteItemTemplateSelector _itemTemplateSelector{ nullptr };
|
||||
std::unordered_map<Windows::UI::Xaml::DataTemplate, std::unordered_set<Windows::UI::Xaml::Controls::Primitives::SelectorItem>> _listViewItemsCache;
|
||||
Windows::UI::Xaml::DataTemplate _listItemTemplate;
|
||||
void _choosingItemContainer(const WUXC::ListViewBase& sender, const WUXC::ChoosingItemContainerEventArgs& args);
|
||||
void _containerContentChanging(const WUXC::ListViewBase& sender, const WUXC::ContainerContentChangingEventArgs& args);
|
||||
MTApp::PaletteItemTemplateSelector _itemTemplateSelector{ nullptr };
|
||||
std::unordered_map<WUX::DataTemplate, std::unordered_set<WUXC::Primitives::SelectorItem>> _listViewItemsCache;
|
||||
WUX::DataTemplate _listItemTemplate;
|
||||
|
||||
friend class TerminalAppLocalTests::TabTests;
|
||||
};
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
#include "pch.h"
|
||||
#include "DebugTapConnection.h"
|
||||
|
||||
using namespace ::winrt::Microsoft::Terminal::TerminalConnection;
|
||||
using namespace ::winrt::Windows::Foundation;
|
||||
using namespace MTConnection;
|
||||
using namespace WF;
|
||||
namespace winrt::Microsoft::TerminalApp::implementation
|
||||
{
|
||||
// DebugInputTapConnection is an implementation detail of DebugTapConnection.
|
||||
@@ -19,7 +19,7 @@ namespace winrt::Microsoft::TerminalApp::implementation
|
||||
_wrappedConnection{ std::move(wrappedConnection) }
|
||||
{
|
||||
}
|
||||
void Initialize(const Windows::Foundation::Collections::ValueSet& /*settings*/) {}
|
||||
void Initialize(const WFC::ValueSet& /*settings*/) {}
|
||||
~DebugInputTapConnection() = default;
|
||||
winrt::fire_and_forget Start()
|
||||
{
|
||||
@@ -129,7 +129,7 @@ namespace winrt::Microsoft::TerminalApp::implementation
|
||||
}
|
||||
|
||||
// Wire us up so that we can forward input through
|
||||
void DebugTapConnection::SetInputTap(const Microsoft::Terminal::TerminalConnection::ITerminalConnection& inputTap)
|
||||
void DebugTapConnection::SetInputTap(const MTConnection::ITerminalConnection& inputTap)
|
||||
{
|
||||
_inputSide = inputTap;
|
||||
}
|
||||
|
||||
@@ -9,32 +9,32 @@
|
||||
namespace winrt::Microsoft::TerminalApp::implementation
|
||||
{
|
||||
class DebugInputTapConnection;
|
||||
class DebugTapConnection : public winrt::implements<DebugTapConnection, winrt::Microsoft::Terminal::TerminalConnection::ITerminalConnection>
|
||||
class DebugTapConnection : public winrt::implements<DebugTapConnection, MTConnection::ITerminalConnection>
|
||||
{
|
||||
public:
|
||||
explicit DebugTapConnection(Microsoft::Terminal::TerminalConnection::ITerminalConnection wrappedConnection);
|
||||
void Initialize(const Windows::Foundation::Collections::ValueSet& /*settings*/){};
|
||||
explicit DebugTapConnection(MTConnection::ITerminalConnection wrappedConnection);
|
||||
void Initialize(const WFC::ValueSet& /*settings*/){};
|
||||
~DebugTapConnection();
|
||||
void Start();
|
||||
void WriteInput(const hstring& data);
|
||||
void Resize(uint32_t rows, uint32_t columns);
|
||||
void Close();
|
||||
winrt::Microsoft::Terminal::TerminalConnection::ConnectionState State() const noexcept;
|
||||
MTConnection::ConnectionState State() const noexcept;
|
||||
|
||||
void SetInputTap(const Microsoft::Terminal::TerminalConnection::ITerminalConnection& inputTap);
|
||||
void SetInputTap(const MTConnection::ITerminalConnection& inputTap);
|
||||
|
||||
WINRT_CALLBACK(TerminalOutput, winrt::Microsoft::Terminal::TerminalConnection::TerminalOutputHandler);
|
||||
WINRT_CALLBACK(TerminalOutput, MTConnection::TerminalOutputHandler);
|
||||
|
||||
TYPED_EVENT(StateChanged, winrt::Microsoft::Terminal::TerminalConnection::ITerminalConnection, winrt::Windows::Foundation::IInspectable);
|
||||
TYPED_EVENT(StateChanged, MTConnection::ITerminalConnection, WF::IInspectable);
|
||||
|
||||
private:
|
||||
void _PrintInput(const hstring& data);
|
||||
void _OutputHandler(const hstring str);
|
||||
|
||||
winrt::Microsoft::Terminal::TerminalConnection::ITerminalConnection::TerminalOutput_revoker _outputRevoker;
|
||||
winrt::Microsoft::Terminal::TerminalConnection::ITerminalConnection::StateChanged_revoker _stateChangedRevoker;
|
||||
winrt::weak_ref<Microsoft::Terminal::TerminalConnection::ITerminalConnection> _wrappedConnection;
|
||||
winrt::weak_ref<Microsoft::Terminal::TerminalConnection::ITerminalConnection> _inputSide;
|
||||
MTConnection::ITerminalConnection::TerminalOutput_revoker _outputRevoker;
|
||||
MTConnection::ITerminalConnection::StateChanged_revoker _stateChangedRevoker;
|
||||
winrt::weak_ref<MTConnection::ITerminalConnection> _wrappedConnection;
|
||||
winrt::weak_ref<MTConnection::ITerminalConnection> _inputSide;
|
||||
|
||||
til::latch _start{ 1 };
|
||||
|
||||
@@ -42,4 +42,4 @@ namespace winrt::Microsoft::TerminalApp::implementation
|
||||
};
|
||||
}
|
||||
|
||||
std::tuple<winrt::Microsoft::Terminal::TerminalConnection::ITerminalConnection, winrt::Microsoft::Terminal::TerminalConnection::ITerminalConnection> OpenDebugTapConnection(winrt::Microsoft::Terminal::TerminalConnection::ITerminalConnection baseConnection);
|
||||
std::tuple<MTConnection::ITerminalConnection, MTConnection::ITerminalConnection> OpenDebugTapConnection(MTConnection::ITerminalConnection baseConnection);
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include "EmptyStringVisibilityConverter.g.cpp"
|
||||
|
||||
using namespace winrt::Windows;
|
||||
using namespace winrt::Windows::UI::Xaml;
|
||||
using namespace WUX;
|
||||
|
||||
namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
@@ -19,7 +19,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// Return Value:
|
||||
// - Visible if the object was a string and wasn't the empty string.
|
||||
Foundation::IInspectable EmptyStringVisibilityConverter::Convert(const Foundation::IInspectable& value,
|
||||
const Windows::UI::Xaml::Interop::TypeName& /* targetType */,
|
||||
const WUX::Interop::TypeName& /* targetType */,
|
||||
const Foundation::IInspectable& /* parameter */,
|
||||
const hstring& /* language */)
|
||||
{
|
||||
@@ -29,7 +29,7 @@ namespace winrt::TerminalApp::implementation
|
||||
|
||||
// unused for one-way bindings
|
||||
Foundation::IInspectable EmptyStringVisibilityConverter::ConvertBack(const Foundation::IInspectable& /* value */,
|
||||
const Windows::UI::Xaml::Interop::TypeName& /* targetType */,
|
||||
const WUX::Interop::TypeName& /* targetType */,
|
||||
const Foundation::IInspectable& /* parameter */,
|
||||
const hstring& /* language */)
|
||||
{
|
||||
|
||||
@@ -8,15 +8,15 @@ namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
EmptyStringVisibilityConverter() = default;
|
||||
|
||||
Windows::Foundation::IInspectable Convert(const Windows::Foundation::IInspectable& value,
|
||||
const Windows::UI::Xaml::Interop::TypeName& targetType,
|
||||
const Windows::Foundation::IInspectable& parameter,
|
||||
const hstring& language);
|
||||
WF::IInspectable Convert(const WF::IInspectable& value,
|
||||
const WUX::Interop::TypeName& targetType,
|
||||
const WF::IInspectable& parameter,
|
||||
const hstring& language);
|
||||
|
||||
Windows::Foundation::IInspectable ConvertBack(const Windows::Foundation::IInspectable& value,
|
||||
const Windows::UI::Xaml::Interop::TypeName& targetType,
|
||||
const Windows::Foundation::IInspectable& parameter,
|
||||
const hstring& language);
|
||||
WF::IInspectable ConvertBack(const WF::IInspectable& value,
|
||||
const WUX::Interop::TypeName& targetType,
|
||||
const WF::IInspectable& parameter,
|
||||
const hstring& language);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -9,19 +9,19 @@
|
||||
#include "FilteredCommand.g.cpp"
|
||||
|
||||
using namespace winrt;
|
||||
using namespace winrt::TerminalApp;
|
||||
using namespace winrt::Windows::UI::Core;
|
||||
using namespace winrt::Windows::UI::Xaml;
|
||||
using namespace winrt::Windows::System;
|
||||
using namespace winrt::Windows::Foundation;
|
||||
using namespace winrt::Windows::Foundation::Collections;
|
||||
using namespace winrt::Microsoft::Terminal::Settings::Model;
|
||||
using namespace MTApp;
|
||||
using namespace WUC;
|
||||
using namespace WUX;
|
||||
using namespace WS;
|
||||
using namespace WF;
|
||||
using namespace WFC;
|
||||
using namespace MTSM;
|
||||
|
||||
namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
// This class is a wrapper of PaletteItem, that is used as an item of a filterable list in CommandPalette.
|
||||
// It manages a highlighted text that is computed by matching search filter characters to item name
|
||||
FilteredCommand::FilteredCommand(const winrt::TerminalApp::PaletteItem& item) :
|
||||
FilteredCommand::FilteredCommand(const MTApp::PaletteItem& item) :
|
||||
_Item(item),
|
||||
_Filter(L""),
|
||||
_Weight(0)
|
||||
@@ -70,9 +70,9 @@ namespace winrt::TerminalApp::implementation
|
||||
//
|
||||
// Return Value:
|
||||
// - The HighlightedText object initialized with the segments computed according to the algorithm above.
|
||||
winrt::TerminalApp::HighlightedText FilteredCommand::_computeHighlightedName()
|
||||
MTApp::HighlightedText FilteredCommand::_computeHighlightedName()
|
||||
{
|
||||
const auto segments = winrt::single_threaded_observable_vector<winrt::TerminalApp::HighlightedTextSegment>();
|
||||
const auto segments = winrt::single_threaded_observable_vector<MTApp::HighlightedTextSegment>();
|
||||
auto commandName = _Item.Name();
|
||||
auto isProcessingMatchedSegment = false;
|
||||
uint32_t nextOffsetToReport = 0;
|
||||
@@ -225,7 +225,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// - other: another instance of FilteredCommand interface
|
||||
// Return Value:
|
||||
// - Returns true if the first is "bigger" (aka should appear first)
|
||||
int FilteredCommand::Compare(const winrt::TerminalApp::FilteredCommand& first, const winrt::TerminalApp::FilteredCommand& second)
|
||||
int FilteredCommand::Compare(const MTApp::FilteredCommand& first, const MTApp::FilteredCommand& second)
|
||||
{
|
||||
auto firstWeight{ first.Weight() };
|
||||
auto secondWeight{ second.Weight() };
|
||||
|
||||
@@ -17,22 +17,22 @@ namespace winrt::TerminalApp::implementation
|
||||
struct FilteredCommand : FilteredCommandT<FilteredCommand>
|
||||
{
|
||||
FilteredCommand() = default;
|
||||
FilteredCommand(const winrt::TerminalApp::PaletteItem& item);
|
||||
FilteredCommand(const MTApp::PaletteItem& item);
|
||||
|
||||
void UpdateFilter(const winrt::hstring& filter);
|
||||
|
||||
static int Compare(const winrt::TerminalApp::FilteredCommand& first, const winrt::TerminalApp::FilteredCommand& second);
|
||||
static int Compare(const MTApp::FilteredCommand& first, const MTApp::FilteredCommand& second);
|
||||
|
||||
WINRT_CALLBACK(PropertyChanged, Windows::UI::Xaml::Data::PropertyChangedEventHandler);
|
||||
WINRT_OBSERVABLE_PROPERTY(winrt::TerminalApp::PaletteItem, Item, _PropertyChangedHandlers, nullptr);
|
||||
WINRT_CALLBACK(PropertyChanged, WUX::Data::PropertyChangedEventHandler);
|
||||
WINRT_OBSERVABLE_PROPERTY(MTApp::PaletteItem, Item, _PropertyChangedHandlers, nullptr);
|
||||
WINRT_OBSERVABLE_PROPERTY(winrt::hstring, Filter, _PropertyChangedHandlers);
|
||||
WINRT_OBSERVABLE_PROPERTY(winrt::TerminalApp::HighlightedText, HighlightedName, _PropertyChangedHandlers);
|
||||
WINRT_OBSERVABLE_PROPERTY(MTApp::HighlightedText, HighlightedName, _PropertyChangedHandlers);
|
||||
WINRT_OBSERVABLE_PROPERTY(int, Weight, _PropertyChangedHandlers);
|
||||
|
||||
private:
|
||||
winrt::TerminalApp::HighlightedText _computeHighlightedName();
|
||||
MTApp::HighlightedText _computeHighlightedName();
|
||||
int _computeWeight();
|
||||
Windows::UI::Xaml::Data::INotifyPropertyChanged::PropertyChanged_revoker _itemChangedRevoker;
|
||||
WUX::Data::INotifyPropertyChanged::PropertyChanged_revoker _itemChangedRevoker;
|
||||
|
||||
friend class TerminalAppLocalTests::FilteredCommandTests;
|
||||
};
|
||||
|
||||
@@ -7,14 +7,14 @@
|
||||
#include "HighlightedText.g.cpp"
|
||||
|
||||
using namespace winrt;
|
||||
using namespace winrt::TerminalApp;
|
||||
using namespace winrt::Windows::UI::Core;
|
||||
using namespace winrt::Windows::UI::Xaml;
|
||||
using namespace winrt::Windows::System;
|
||||
using namespace winrt::Windows::UI::Text;
|
||||
using namespace winrt::Windows::Foundation;
|
||||
using namespace winrt::Windows::Foundation::Collections;
|
||||
using namespace winrt::Microsoft::Terminal::Settings::Model;
|
||||
using namespace MTApp;
|
||||
using namespace WUC;
|
||||
using namespace WUX;
|
||||
using namespace WS;
|
||||
using namespace WUT;
|
||||
using namespace WF;
|
||||
using namespace WFC;
|
||||
using namespace MTSM;
|
||||
|
||||
namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
@@ -24,7 +24,7 @@ namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
}
|
||||
|
||||
HighlightedText::HighlightedText(const Windows::Foundation::Collections::IObservableVector<winrt::TerminalApp::HighlightedTextSegment>& segments) :
|
||||
HighlightedText::HighlightedText(const WFC::IObservableVector<MTApp::HighlightedTextSegment>& segments) :
|
||||
_Segments(segments)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace winrt::TerminalApp::implementation
|
||||
HighlightedTextSegment() = default;
|
||||
HighlightedTextSegment(const winrt::hstring& text, bool isHighlighted);
|
||||
|
||||
WINRT_CALLBACK(PropertyChanged, Windows::UI::Xaml::Data::PropertyChangedEventHandler);
|
||||
WINRT_CALLBACK(PropertyChanged, WUX::Data::PropertyChangedEventHandler);
|
||||
WINRT_OBSERVABLE_PROPERTY(winrt::hstring, TextSegment, _PropertyChangedHandlers);
|
||||
WINRT_OBSERVABLE_PROPERTY(bool, IsHighlighted, _PropertyChangedHandlers);
|
||||
};
|
||||
@@ -21,10 +21,10 @@ namespace winrt::TerminalApp::implementation
|
||||
struct HighlightedText : HighlightedTextT<HighlightedText>
|
||||
{
|
||||
HighlightedText() = default;
|
||||
HighlightedText(const Windows::Foundation::Collections::IObservableVector<winrt::TerminalApp::HighlightedTextSegment>& segments);
|
||||
HighlightedText(const WFC::IObservableVector<MTApp::HighlightedTextSegment>& segments);
|
||||
|
||||
WINRT_CALLBACK(PropertyChanged, Windows::UI::Xaml::Data::PropertyChangedEventHandler);
|
||||
WINRT_OBSERVABLE_PROPERTY(Windows::Foundation::Collections::IObservableVector<winrt::TerminalApp::HighlightedTextSegment>, Segments, _PropertyChangedHandlers);
|
||||
WINRT_CALLBACK(PropertyChanged, WUX::Data::PropertyChangedEventHandler);
|
||||
WINRT_OBSERVABLE_PROPERTY(WFC::IObservableVector<MTApp::HighlightedTextSegment>, Segments, _PropertyChangedHandlers);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -8,14 +8,14 @@
|
||||
#include "HighlightedTextControl.g.cpp"
|
||||
|
||||
using namespace winrt;
|
||||
using namespace winrt::TerminalApp;
|
||||
using namespace winrt::Windows::UI::Core;
|
||||
using namespace winrt::Windows::UI::Xaml;
|
||||
using namespace winrt::Windows::System;
|
||||
using namespace winrt::Windows::UI::Text;
|
||||
using namespace winrt::Windows::Foundation;
|
||||
using namespace winrt::Windows::Foundation::Collections;
|
||||
using namespace winrt::Microsoft::Terminal::Settings::Model;
|
||||
using namespace MTApp;
|
||||
using namespace WUC;
|
||||
using namespace WUX;
|
||||
using namespace WS;
|
||||
using namespace WUT;
|
||||
using namespace WF;
|
||||
using namespace WFC;
|
||||
using namespace MTSM;
|
||||
|
||||
namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
@@ -24,8 +24,8 @@ namespace winrt::TerminalApp::implementation
|
||||
// (https://docs.microsoft.com/en-us/windows/uwp/xaml-platform/custom-dependency-properties)
|
||||
DependencyProperty HighlightedTextControl::_textProperty = DependencyProperty::Register(
|
||||
L"Text",
|
||||
xaml_typename<winrt::TerminalApp::HighlightedText>(),
|
||||
xaml_typename<winrt::TerminalApp::HighlightedTextControl>(),
|
||||
xaml_typename<MTApp::HighlightedText>(),
|
||||
xaml_typename<MTApp::HighlightedTextControl>(),
|
||||
PropertyMetadata(nullptr, HighlightedTextControl::_onTextChanged));
|
||||
|
||||
HighlightedTextControl::HighlightedTextControl()
|
||||
@@ -49,12 +49,12 @@ namespace winrt::TerminalApp::implementation
|
||||
return _textView();
|
||||
}
|
||||
|
||||
winrt::TerminalApp::HighlightedText HighlightedTextControl::Text()
|
||||
MTApp::HighlightedText HighlightedTextControl::Text()
|
||||
{
|
||||
return winrt::unbox_value<winrt::TerminalApp::HighlightedText>(GetValue(_textProperty));
|
||||
return winrt::unbox_value<MTApp::HighlightedText>(GetValue(_textProperty));
|
||||
}
|
||||
|
||||
void HighlightedTextControl::Text(const winrt::TerminalApp::HighlightedText& value)
|
||||
void HighlightedTextControl::Text(const MTApp::HighlightedText& value)
|
||||
{
|
||||
SetValue(_textProperty, winrt::box_value(value));
|
||||
}
|
||||
@@ -67,8 +67,8 @@ namespace winrt::TerminalApp::implementation
|
||||
// The new value is expected to be an instance of HighlightedText
|
||||
void HighlightedTextControl::_onTextChanged(const DependencyObject& o, const DependencyPropertyChangedEventArgs& e)
|
||||
{
|
||||
const auto control = o.try_as<winrt::TerminalApp::HighlightedTextControl>();
|
||||
const auto highlightedText = e.NewValue().try_as<winrt::TerminalApp::HighlightedText>();
|
||||
const auto control = o.try_as<MTApp::HighlightedTextControl>();
|
||||
const auto highlightedText = e.NewValue().try_as<MTApp::HighlightedText>();
|
||||
|
||||
if (control && highlightedText)
|
||||
{
|
||||
|
||||
@@ -13,16 +13,16 @@ namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
HighlightedTextControl();
|
||||
|
||||
static Windows::UI::Xaml::DependencyProperty TextProperty();
|
||||
static WUX::DependencyProperty TextProperty();
|
||||
|
||||
winrt::TerminalApp::HighlightedText Text();
|
||||
void Text(const winrt::TerminalApp::HighlightedText& value);
|
||||
MTApp::HighlightedText Text();
|
||||
void Text(const MTApp::HighlightedText& value);
|
||||
|
||||
Windows::UI::Xaml::Controls::TextBlock TextView();
|
||||
WUXC::TextBlock TextView();
|
||||
|
||||
private:
|
||||
static Windows::UI::Xaml::DependencyProperty _textProperty;
|
||||
static void _onTextChanged(const Windows::UI::Xaml::DependencyObject& o, const Windows::UI::Xaml::DependencyPropertyChangedEventArgs& e);
|
||||
static WUX::DependencyProperty _textProperty;
|
||||
static void _onTextChanged(const WUX::DependencyObject& o, const WUX::DependencyPropertyChangedEventArgs& e);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
#include <WtExeUtils.h>
|
||||
|
||||
using namespace winrt::Microsoft::Terminal::Settings::Model;
|
||||
using namespace MTSM;
|
||||
|
||||
// This property key isn't already defined in propkey.h, but is used by UWP Jumplist to determine the icon of the jumplist item.
|
||||
// IShellLink's SetIconLocation isn't going to read "ms-appx://" icon paths, so we'll need to use this to set the icon.
|
||||
@@ -112,7 +112,7 @@ winrt::fire_and_forget Jumplist::UpdateJumplist(const CascadiaSettings& settings
|
||||
// - profiles - The profiles to add to the jumplist
|
||||
// Return Value:
|
||||
// - S_OK or HRESULT failure code.
|
||||
void Jumplist::_updateProfiles(IObjectCollection* jumplistItems, winrt::Windows::Foundation::Collections::IVectorView<Profile> profiles)
|
||||
void Jumplist::_updateProfiles(IObjectCollection* jumplistItems, WFC::IVectorView<Profile> profiles)
|
||||
{
|
||||
// It's easier to clear the list and re-add everything. The settings aren't
|
||||
// updated often, and there likely isn't a huge amount of items to add.
|
||||
|
||||
@@ -18,9 +18,9 @@ struct IShellLinkW;
|
||||
class Jumplist
|
||||
{
|
||||
public:
|
||||
static winrt::fire_and_forget UpdateJumplist(const winrt::Microsoft::Terminal::Settings::Model::CascadiaSettings& settings) noexcept;
|
||||
static winrt::fire_and_forget UpdateJumplist(const MTSM::CascadiaSettings& settings) noexcept;
|
||||
|
||||
private:
|
||||
static void _updateProfiles(IObjectCollection* jumplistItems, winrt::Windows::Foundation::Collections::IVectorView<winrt::Microsoft::Terminal::Settings::Model::Profile> profiles);
|
||||
static void _updateProfiles(IObjectCollection* jumplistItems, WFC::IVectorView<MTSM::Profile> profiles);
|
||||
static winrt::com_ptr<IShellLinkW> _createShellLink(const std::wstring_view name, const std::wstring_view path, const std::wstring_view args);
|
||||
};
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include "pch.h"
|
||||
#include "LanguageProfileNotifier.h"
|
||||
|
||||
using namespace winrt::TerminalApp::implementation;
|
||||
using namespace MTApp::implementation;
|
||||
|
||||
LanguageProfileNotifier::LanguageProfileNotifier(std::function<void()>&& callback) :
|
||||
_callback{ std::move(callback) },
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include "MinMaxCloseControl.g.cpp"
|
||||
#include <LibraryResources.h>
|
||||
|
||||
using namespace winrt::Windows::UI::Xaml;
|
||||
using namespace WUX;
|
||||
|
||||
namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
@@ -27,7 +27,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// Get our dispatcher. This will get us the same dispatcher as
|
||||
// Dispatcher(), but it's a DispatcherQueue, so we can use it with
|
||||
// ThrottledFunc
|
||||
auto dispatcher = winrt::Windows::System::DispatcherQueue::GetForCurrentThread();
|
||||
auto dispatcher = WS::DispatcherQueue::GetForCurrentThread();
|
||||
|
||||
InitializeComponent();
|
||||
|
||||
@@ -66,18 +66,18 @@ namespace winrt::TerminalApp::implementation
|
||||
|
||||
// These event handlers simply forward each buttons click events up to the
|
||||
// events we've exposed.
|
||||
void MinMaxCloseControl::_MinimizeClick(const winrt::Windows::Foundation::IInspectable& /*sender*/,
|
||||
void MinMaxCloseControl::_MinimizeClick(const WF::IInspectable& /*sender*/,
|
||||
const RoutedEventArgs& e)
|
||||
{
|
||||
_MinimizeClickHandlers(*this, e);
|
||||
}
|
||||
|
||||
void MinMaxCloseControl::_MaximizeClick(const winrt::Windows::Foundation::IInspectable& /*sender*/,
|
||||
void MinMaxCloseControl::_MaximizeClick(const WF::IInspectable& /*sender*/,
|
||||
const RoutedEventArgs& e)
|
||||
{
|
||||
_MaximizeClickHandlers(*this, e);
|
||||
}
|
||||
void MinMaxCloseControl::_CloseClick(const winrt::Windows::Foundation::IInspectable& /*sender*/,
|
||||
void MinMaxCloseControl::_CloseClick(const WF::IInspectable& /*sender*/,
|
||||
const RoutedEventArgs& e)
|
||||
{
|
||||
_CloseClickHandlers(*this, e);
|
||||
|
||||
@@ -21,18 +21,18 @@ namespace winrt::TerminalApp::implementation
|
||||
void PressButton(CaptionButton button);
|
||||
void ReleaseButtons();
|
||||
|
||||
void _MinimizeClick(const winrt::Windows::Foundation::IInspectable& sender,
|
||||
const winrt::Windows::UI::Xaml::RoutedEventArgs& e);
|
||||
void _MaximizeClick(const winrt::Windows::Foundation::IInspectable& sender,
|
||||
const winrt::Windows::UI::Xaml::RoutedEventArgs& e);
|
||||
void _CloseClick(const winrt::Windows::Foundation::IInspectable& sender,
|
||||
const winrt::Windows::UI::Xaml::RoutedEventArgs& e);
|
||||
void _MinimizeClick(const WF::IInspectable& sender,
|
||||
const WUX::RoutedEventArgs& e);
|
||||
void _MaximizeClick(const WF::IInspectable& sender,
|
||||
const WUX::RoutedEventArgs& e);
|
||||
void _CloseClick(const WF::IInspectable& sender,
|
||||
const WUX::RoutedEventArgs& e);
|
||||
|
||||
TYPED_EVENT(MinimizeClick, TerminalApp::MinMaxCloseControl, winrt::Windows::UI::Xaml::RoutedEventArgs);
|
||||
TYPED_EVENT(MaximizeClick, TerminalApp::MinMaxCloseControl, winrt::Windows::UI::Xaml::RoutedEventArgs);
|
||||
TYPED_EVENT(CloseClick, TerminalApp::MinMaxCloseControl, winrt::Windows::UI::Xaml::RoutedEventArgs);
|
||||
TYPED_EVENT(MinimizeClick, MTApp::MinMaxCloseControl, WUX::RoutedEventArgs);
|
||||
TYPED_EVENT(MaximizeClick, MTApp::MinMaxCloseControl, WUX::RoutedEventArgs);
|
||||
TYPED_EVENT(CloseClick, MTApp::MinMaxCloseControl, WUX::RoutedEventArgs);
|
||||
|
||||
std::shared_ptr<ThrottledFuncTrailing<winrt::Windows::UI::Xaml::Controls::Button>> _displayToolTip{ nullptr };
|
||||
std::shared_ptr<ThrottledFuncTrailing<WUXC::Button>> _displayToolTip{ nullptr };
|
||||
std::optional<CaptionButton> _lastPressedButton{ std::nullopt };
|
||||
};
|
||||
}
|
||||
|
||||
@@ -7,11 +7,11 @@
|
||||
#include "PaletteItem.g.cpp"
|
||||
|
||||
using namespace winrt;
|
||||
using namespace winrt::Windows::UI::Xaml;
|
||||
using namespace winrt::Windows::UI::Core;
|
||||
using namespace winrt::Microsoft::Terminal::Control;
|
||||
using namespace winrt::Microsoft::Terminal::Settings::Model;
|
||||
using namespace winrt::Windows::System;
|
||||
using namespace WUX;
|
||||
using namespace WUC;
|
||||
using namespace MTControl;
|
||||
using namespace MTSM;
|
||||
using namespace WS;
|
||||
|
||||
namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
|
||||
@@ -9,9 +9,9 @@ namespace winrt::TerminalApp::implementation
|
||||
struct PaletteItem : PaletteItemT<PaletteItem>
|
||||
{
|
||||
public:
|
||||
Windows::UI::Xaml::Controls::IconElement ResolvedIcon();
|
||||
WUXC::IconElement ResolvedIcon();
|
||||
|
||||
WINRT_CALLBACK(PropertyChanged, Windows::UI::Xaml::Data::PropertyChangedEventHandler);
|
||||
WINRT_CALLBACK(PropertyChanged, WUX::Data::PropertyChangedEventHandler);
|
||||
|
||||
WINRT_OBSERVABLE_PROPERTY(winrt::hstring, Name, _PropertyChangedHandlers);
|
||||
WINRT_OBSERVABLE_PROPERTY(winrt::hstring, Icon, _PropertyChangedHandlers);
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
Windows::UI::Xaml::DataTemplate PaletteItemTemplateSelector::SelectTemplateCore(const winrt::Windows::Foundation::IInspectable& item, const winrt::Windows::UI::Xaml::DependencyObject& /*container*/)
|
||||
WUX::DataTemplate PaletteItemTemplateSelector::SelectTemplateCore(const WF::IInspectable& item, const WUX::DependencyObject& /*container*/)
|
||||
{
|
||||
return SelectTemplateCore(item);
|
||||
}
|
||||
@@ -22,15 +22,15 @@ namespace winrt::TerminalApp::implementation
|
||||
// - item - an instance of filtered command to render
|
||||
// Return Value:
|
||||
// - data template to use for rendering
|
||||
Windows::UI::Xaml::DataTemplate PaletteItemTemplateSelector::SelectTemplateCore(const winrt::Windows::Foundation::IInspectable& item)
|
||||
WUX::DataTemplate PaletteItemTemplateSelector::SelectTemplateCore(const WF::IInspectable& item)
|
||||
{
|
||||
if (const auto filteredCommand{ item.try_as<winrt::TerminalApp::FilteredCommand>() })
|
||||
if (const auto filteredCommand{ item.try_as<MTApp::FilteredCommand>() })
|
||||
{
|
||||
if (filteredCommand.Item().try_as<winrt::TerminalApp::TabPaletteItem>())
|
||||
if (filteredCommand.Item().try_as<MTApp::TabPaletteItem>())
|
||||
{
|
||||
return TabItemTemplate();
|
||||
}
|
||||
else if (const auto actionPaletteItem{ filteredCommand.Item().try_as<winrt::TerminalApp::ActionPaletteItem>() })
|
||||
else if (const auto actionPaletteItem{ filteredCommand.Item().try_as<MTApp::ActionPaletteItem>() })
|
||||
{
|
||||
if (actionPaletteItem.Command().HasNestedCommands())
|
||||
{
|
||||
|
||||
@@ -11,12 +11,12 @@ namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
PaletteItemTemplateSelector() = default;
|
||||
|
||||
Windows::UI::Xaml::DataTemplate SelectTemplateCore(const winrt::Windows::Foundation::IInspectable&, const winrt::Windows::UI::Xaml::DependencyObject&);
|
||||
Windows::UI::Xaml::DataTemplate SelectTemplateCore(const winrt::Windows::Foundation::IInspectable&);
|
||||
WUX::DataTemplate SelectTemplateCore(const WF::IInspectable&, const WUX::DependencyObject&);
|
||||
WUX::DataTemplate SelectTemplateCore(const WF::IInspectable&);
|
||||
|
||||
WINRT_PROPERTY(winrt::Windows::UI::Xaml::DataTemplate, TabItemTemplate);
|
||||
WINRT_PROPERTY(winrt::Windows::UI::Xaml::DataTemplate, NestedItemTemplate);
|
||||
WINRT_PROPERTY(winrt::Windows::UI::Xaml::DataTemplate, GeneralItemTemplate);
|
||||
WINRT_PROPERTY(WUX::DataTemplate, TabItemTemplate);
|
||||
WINRT_PROPERTY(WUX::DataTemplate, NestedItemTemplate);
|
||||
WINRT_PROPERTY(WUX::DataTemplate, GeneralItemTemplate);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -9,16 +9,16 @@
|
||||
|
||||
#include <Mmsystem.h>
|
||||
|
||||
using namespace winrt::Windows::Foundation;
|
||||
using namespace WF;
|
||||
using namespace winrt::Windows::Graphics::Display;
|
||||
using namespace winrt::Windows::UI;
|
||||
using namespace winrt::Windows::UI::Xaml;
|
||||
using namespace winrt::Windows::UI::Core;
|
||||
using namespace winrt::Windows::UI::Xaml::Media;
|
||||
using namespace winrt::Microsoft::Terminal::Settings::Model;
|
||||
using namespace winrt::Microsoft::Terminal::Control;
|
||||
using namespace winrt::Microsoft::Terminal::TerminalConnection;
|
||||
using namespace winrt::TerminalApp;
|
||||
using namespace WUX;
|
||||
using namespace WUC;
|
||||
using namespace WUXMedia;
|
||||
using namespace MTSM;
|
||||
using namespace MTControl;
|
||||
using namespace MTConnection;
|
||||
using namespace MTApp;
|
||||
using namespace TerminalApp;
|
||||
|
||||
static const int PaneBorderSize = 2;
|
||||
@@ -31,10 +31,10 @@ static const int CombinedPaneBorderSize = 2 * PaneBorderSize;
|
||||
// 200ms was chosen because it's quick enough that it doesn't break your
|
||||
// flow, but not too quick to see
|
||||
static const int AnimationDurationInMilliseconds = 200;
|
||||
static const Duration AnimationDuration = DurationHelper::FromTimeSpan(winrt::Windows::Foundation::TimeSpan(std::chrono::milliseconds(AnimationDurationInMilliseconds)));
|
||||
static const Duration AnimationDuration = DurationHelper::FromTimeSpan(WF::TimeSpan(std::chrono::milliseconds(AnimationDurationInMilliseconds)));
|
||||
|
||||
winrt::Windows::UI::Xaml::Media::SolidColorBrush Pane::s_focusedBorderBrush = { nullptr };
|
||||
winrt::Windows::UI::Xaml::Media::SolidColorBrush Pane::s_unfocusedBorderBrush = { nullptr };
|
||||
WUXMedia::SolidColorBrush Pane::s_focusedBorderBrush = { nullptr };
|
||||
WUXMedia::SolidColorBrush Pane::s_unfocusedBorderBrush = { nullptr };
|
||||
|
||||
Pane::Pane(const Profile& profile, const TermControl& control, const bool lastFocused) :
|
||||
_control{ control },
|
||||
@@ -148,7 +148,7 @@ NewTerminalArgs Pane::GetTerminalArgsForPane() const
|
||||
c = til::color(controlSettings.TabColor().Value());
|
||||
}
|
||||
|
||||
args.TabColor(winrt::Windows::Foundation::IReference<winrt::Windows::UI::Color>(c));
|
||||
args.TabColor(WF::IReference<winrt::Windows::UI::Color>(c));
|
||||
}
|
||||
|
||||
// TODO:GH#9800 - we used to be able to persist the color scheme that a
|
||||
@@ -979,8 +979,8 @@ Pane::PaneNeighborSearch Pane::_FindPaneAndNeighbor(const std::shared_ptr<Pane>
|
||||
// - <none>
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void Pane::_ControlConnectionStateChangedHandler(const winrt::Windows::Foundation::IInspectable& /*sender*/,
|
||||
const winrt::Windows::Foundation::IInspectable& /*args*/)
|
||||
void Pane::_ControlConnectionStateChangedHandler(const WF::IInspectable& /*sender*/,
|
||||
const WF::IInspectable& /*args*/)
|
||||
{
|
||||
std::unique_lock lock{ _createCloseLock };
|
||||
// It's possible that this event handler started being executed, then before
|
||||
@@ -1031,8 +1031,8 @@ void Pane::_ControlConnectionStateChangedHandler(const winrt::Windows::Foundatio
|
||||
}
|
||||
}
|
||||
|
||||
void Pane::_CloseTerminalRequestedHandler(const winrt::Windows::Foundation::IInspectable& /*sender*/,
|
||||
const winrt::Windows::Foundation::IInspectable& /*args*/)
|
||||
void Pane::_CloseTerminalRequestedHandler(const WF::IInspectable& /*sender*/,
|
||||
const WF::IInspectable& /*args*/)
|
||||
{
|
||||
std::unique_lock lock{ _createCloseLock };
|
||||
|
||||
@@ -1051,7 +1051,7 @@ void Pane::_CloseTerminalRequestedHandler(const winrt::Windows::Foundation::IIns
|
||||
Close();
|
||||
}
|
||||
|
||||
winrt::fire_and_forget Pane::_playBellSound(winrt::Windows::Foundation::Uri uri)
|
||||
winrt::fire_and_forget Pane::_playBellSound(WF::Uri uri)
|
||||
{
|
||||
auto weakThis{ weak_from_this() };
|
||||
|
||||
@@ -1113,8 +1113,8 @@ winrt::fire_and_forget Pane::_playBellSound(winrt::Windows::Foundation::Uri uri)
|
||||
// has the 'visual' flag set
|
||||
// Arguments:
|
||||
// - <unused>
|
||||
void Pane::_ControlWarningBellHandler(const winrt::Windows::Foundation::IInspectable& /*sender*/,
|
||||
const winrt::Windows::Foundation::IInspectable& /*eventArgs*/)
|
||||
void Pane::_ControlWarningBellHandler(const WF::IInspectable& /*sender*/,
|
||||
const WF::IInspectable& /*eventArgs*/)
|
||||
{
|
||||
if (!_IsLeaf())
|
||||
{
|
||||
@@ -1125,14 +1125,14 @@ void Pane::_ControlWarningBellHandler(const winrt::Windows::Foundation::IInspect
|
||||
// We don't want to do anything if nothing is set, so check for that first
|
||||
if (static_cast<int>(_profile.BellStyle()) != 0)
|
||||
{
|
||||
if (WI_IsFlagSet(_profile.BellStyle(), winrt::Microsoft::Terminal::Settings::Model::BellStyle::Audible))
|
||||
if (WI_IsFlagSet(_profile.BellStyle(), MTSM::BellStyle::Audible))
|
||||
{
|
||||
// Audible is set, play the sound
|
||||
auto sounds{ _profile.BellSound() };
|
||||
if (sounds && sounds.Size() > 0)
|
||||
{
|
||||
winrt::hstring soundPath{ wil::ExpandEnvironmentStringsW<std::wstring>(sounds.GetAt(rand() % sounds.Size()).c_str()) };
|
||||
winrt::Windows::Foundation::Uri uri{ soundPath };
|
||||
WF::Uri uri{ soundPath };
|
||||
_playBellSound(uri);
|
||||
}
|
||||
else
|
||||
@@ -1142,13 +1142,13 @@ void Pane::_ControlWarningBellHandler(const winrt::Windows::Foundation::IInspect
|
||||
}
|
||||
}
|
||||
|
||||
if (WI_IsFlagSet(_profile.BellStyle(), winrt::Microsoft::Terminal::Settings::Model::BellStyle::Window))
|
||||
if (WI_IsFlagSet(_profile.BellStyle(), MTSM::BellStyle::Window))
|
||||
{
|
||||
_control.BellLightOn();
|
||||
}
|
||||
|
||||
// raise the event with the bool value corresponding to the taskbar flag
|
||||
_PaneRaiseBellHandlers(nullptr, WI_IsFlagSet(_profile.BellStyle(), winrt::Microsoft::Terminal::Settings::Model::BellStyle::Taskbar));
|
||||
_PaneRaiseBellHandlers(nullptr, WI_IsFlagSet(_profile.BellStyle(), MTSM::BellStyle::Taskbar));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1161,11 +1161,11 @@ void Pane::_ControlWarningBellHandler(const winrt::Windows::Foundation::IInspect
|
||||
// - <unused>
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void Pane::_ControlGotFocusHandler(const winrt::Windows::Foundation::IInspectable& sender,
|
||||
void Pane::_ControlGotFocusHandler(const WF::IInspectable& sender,
|
||||
const RoutedEventArgs& /* args */)
|
||||
{
|
||||
auto f = FocusState::Programmatic;
|
||||
if (const auto o = sender.try_as<winrt::Windows::UI::Xaml::Controls::Control>())
|
||||
if (const auto o = sender.try_as<WUXC::Control>())
|
||||
{
|
||||
f = o.FocusState();
|
||||
}
|
||||
@@ -1176,7 +1176,7 @@ void Pane::_ControlGotFocusHandler(const winrt::Windows::Foundation::IInspectabl
|
||||
// - Called when our control loses focus. We'll use this to trigger our LostFocus
|
||||
// callback. The tab that's hosting us should have registered a callback which
|
||||
// can be used to update its own internal focus state
|
||||
void Pane::_ControlLostFocusHandler(const winrt::Windows::Foundation::IInspectable& /* sender */,
|
||||
void Pane::_ControlLostFocusHandler(const WF::IInspectable& /* sender */,
|
||||
const RoutedEventArgs& /* args */)
|
||||
{
|
||||
_LostFocusHandlers(shared_from_this());
|
||||
@@ -2277,7 +2277,7 @@ void Pane::_SetupEntranceAnimation()
|
||||
std::optional<std::optional<SplitDirection>> Pane::PreCalculateCanSplit(const std::shared_ptr<Pane> target,
|
||||
SplitDirection splitType,
|
||||
const float splitSize,
|
||||
const winrt::Windows::Foundation::Size availableSpace) const
|
||||
const WF::Size availableSpace) const
|
||||
{
|
||||
if (target.get() == this)
|
||||
{
|
||||
@@ -3101,7 +3101,7 @@ float Pane::_ClampSplitPosition(const bool widthOrHeight, const float requestedV
|
||||
// - requestedTheme: this should be the currently active Theme for the app
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void Pane::SetupResources(const winrt::Windows::UI::Xaml::ElementTheme& requestedTheme)
|
||||
void Pane::SetupResources(const WUX::ElementTheme& requestedTheme)
|
||||
{
|
||||
const auto res = Application::Current().Resources();
|
||||
const auto accentColorKey = winrt::box_value(L"SystemAccentColor");
|
||||
@@ -3129,7 +3129,7 @@ void Pane::SetupResources(const winrt::Windows::UI::Xaml::ElementTheme& requeste
|
||||
// the requestedTheme, not just the value from the resources (which
|
||||
// might not respect the settings' requested theme)
|
||||
auto obj = ThemeLookup(res, requestedTheme, unfocusedBorderBrushKey);
|
||||
s_unfocusedBorderBrush = obj.try_as<winrt::Windows::UI::Xaml::Media::SolidColorBrush>();
|
||||
s_unfocusedBorderBrush = obj.try_as<WUXMedia::SolidColorBrush>();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -3169,12 +3169,12 @@ bool Pane::ContainsReadOnly() const
|
||||
// - states: a vector that will receive all the states of all leaves in the tree
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void Pane::CollectTaskbarStates(std::vector<winrt::TerminalApp::TaskbarState>& states)
|
||||
void Pane::CollectTaskbarStates(std::vector<MTApp::TaskbarState>& states)
|
||||
{
|
||||
if (_IsLeaf())
|
||||
{
|
||||
auto tbState{ winrt::make<winrt::TerminalApp::implementation::TaskbarState>(_control.TaskbarState(),
|
||||
_control.TaskbarProgress()) };
|
||||
auto tbState{ winrt::make<MTApp::implementation::TaskbarState>(_control.TaskbarState(),
|
||||
_control.TaskbarProgress()) };
|
||||
states.push_back(tbState);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -54,8 +54,8 @@ enum class SplitState : int
|
||||
class Pane : public std::enable_shared_from_this<Pane>
|
||||
{
|
||||
public:
|
||||
Pane(const winrt::Microsoft::Terminal::Settings::Model::Profile& profile,
|
||||
const winrt::Microsoft::Terminal::Control::TermControl& control,
|
||||
Pane(const MTSM::Profile& profile,
|
||||
const MTControl::TermControl& control,
|
||||
const bool lastFocused = false);
|
||||
|
||||
Pane(std::shared_ptr<Pane> first,
|
||||
@@ -65,19 +65,19 @@ public:
|
||||
const bool lastFocused = false);
|
||||
|
||||
std::shared_ptr<Pane> GetActivePane();
|
||||
winrt::Microsoft::Terminal::Control::TermControl GetLastFocusedTerminalControl();
|
||||
winrt::Microsoft::Terminal::Control::TermControl GetTerminalControl();
|
||||
winrt::Microsoft::Terminal::Settings::Model::Profile GetFocusedProfile();
|
||||
MTControl::TermControl GetLastFocusedTerminalControl();
|
||||
MTControl::TermControl GetTerminalControl();
|
||||
MTSM::Profile GetFocusedProfile();
|
||||
|
||||
// Method Description:
|
||||
// - If this is a leaf pane, return its profile.
|
||||
// - If this is a branch/root pane, return nullptr.
|
||||
winrt::Microsoft::Terminal::Settings::Model::Profile GetProfile() const
|
||||
MTSM::Profile GetProfile() const
|
||||
{
|
||||
return _profile;
|
||||
}
|
||||
|
||||
winrt::Windows::UI::Xaml::Controls::Grid GetRootElement();
|
||||
WUXC::Grid GetRootElement();
|
||||
|
||||
bool WasLastFocused() const noexcept;
|
||||
void UpdateVisuals();
|
||||
@@ -86,39 +86,39 @@ public:
|
||||
|
||||
struct BuildStartupState
|
||||
{
|
||||
std::vector<winrt::Microsoft::Terminal::Settings::Model::ActionAndArgs> args;
|
||||
std::vector<MTSM::ActionAndArgs> args;
|
||||
std::shared_ptr<Pane> firstPane;
|
||||
std::optional<uint32_t> focusedPaneId;
|
||||
uint32_t panesCreated;
|
||||
};
|
||||
BuildStartupState BuildStartupActions(uint32_t currentId, uint32_t nextId);
|
||||
winrt::Microsoft::Terminal::Settings::Model::NewTerminalArgs GetTerminalArgsForPane() const;
|
||||
MTSM::NewTerminalArgs GetTerminalArgsForPane() const;
|
||||
|
||||
void UpdateSettings(const winrt::Microsoft::Terminal::Settings::Model::TerminalSettingsCreateResult& settings,
|
||||
const winrt::Microsoft::Terminal::Settings::Model::Profile& profile);
|
||||
bool ResizePane(const winrt::Microsoft::Terminal::Settings::Model::ResizeDirection& direction);
|
||||
void UpdateSettings(const MTSM::TerminalSettingsCreateResult& settings,
|
||||
const MTSM::Profile& profile);
|
||||
bool ResizePane(const MTSM::ResizeDirection& direction);
|
||||
std::shared_ptr<Pane> NavigateDirection(const std::shared_ptr<Pane> sourcePane,
|
||||
const winrt::Microsoft::Terminal::Settings::Model::FocusDirection& direction,
|
||||
const MTSM::FocusDirection& direction,
|
||||
const std::vector<uint32_t>& mruPanes);
|
||||
bool SwapPanes(std::shared_ptr<Pane> first, std::shared_ptr<Pane> second);
|
||||
|
||||
std::shared_ptr<Pane> NextPane(const std::shared_ptr<Pane> pane);
|
||||
std::shared_ptr<Pane> PreviousPane(const std::shared_ptr<Pane> pane);
|
||||
|
||||
std::pair<std::shared_ptr<Pane>, std::shared_ptr<Pane>> Split(winrt::Microsoft::Terminal::Settings::Model::SplitDirection splitType,
|
||||
std::pair<std::shared_ptr<Pane>, std::shared_ptr<Pane>> Split(MTSM::SplitDirection splitType,
|
||||
const float splitSize,
|
||||
std::shared_ptr<Pane> pane);
|
||||
bool ToggleSplitOrientation();
|
||||
float CalcSnappedDimension(const bool widthOrHeight, const float dimension) const;
|
||||
std::optional<std::optional<winrt::Microsoft::Terminal::Settings::Model::SplitDirection>> PreCalculateCanSplit(const std::shared_ptr<Pane> target,
|
||||
winrt::Microsoft::Terminal::Settings::Model::SplitDirection splitType,
|
||||
const float splitSize,
|
||||
const winrt::Windows::Foundation::Size availableSpace) const;
|
||||
std::optional<std::optional<MTSM::SplitDirection>> PreCalculateCanSplit(const std::shared_ptr<Pane> target,
|
||||
MTSM::SplitDirection splitType,
|
||||
const float splitSize,
|
||||
const WF::Size availableSpace) const;
|
||||
void Shutdown();
|
||||
void Close();
|
||||
|
||||
std::shared_ptr<Pane> AttachPane(std::shared_ptr<Pane> pane,
|
||||
winrt::Microsoft::Terminal::Settings::Model::SplitDirection splitType);
|
||||
MTSM::SplitDirection splitType);
|
||||
std::shared_ptr<Pane> DetachPane(std::shared_ptr<Pane> pane);
|
||||
|
||||
int GetLeafPaneCount() const noexcept;
|
||||
@@ -136,7 +136,7 @@ public:
|
||||
|
||||
bool ContainsReadOnly() const;
|
||||
|
||||
static void SetupResources(const winrt::Windows::UI::Xaml::ElementTheme& requestedTheme);
|
||||
static void SetupResources(const WUX::ElementTheme& requestedTheme);
|
||||
|
||||
// Method Description:
|
||||
// - A helper method for ad-hoc recursion on a pane tree. Walks the pane
|
||||
@@ -195,16 +195,16 @@ public:
|
||||
});
|
||||
}
|
||||
|
||||
void CollectTaskbarStates(std::vector<winrt::TerminalApp::TaskbarState>& states);
|
||||
void CollectTaskbarStates(std::vector<MTApp::TaskbarState>& states);
|
||||
|
||||
WINRT_CALLBACK(ClosedByParent, winrt::delegate<>);
|
||||
WINRT_CALLBACK(Closed, winrt::Windows::Foundation::EventHandler<winrt::Windows::Foundation::IInspectable>);
|
||||
WINRT_CALLBACK(Closed, WF::EventHandler<WF::IInspectable>);
|
||||
|
||||
using gotFocusArgs = winrt::delegate<std::shared_ptr<Pane>, winrt::Windows::UI::Xaml::FocusState>;
|
||||
using gotFocusArgs = winrt::delegate<std::shared_ptr<Pane>, WUX::FocusState>;
|
||||
|
||||
WINRT_CALLBACK(GotFocus, gotFocusArgs);
|
||||
WINRT_CALLBACK(LostFocus, winrt::delegate<std::shared_ptr<Pane>>);
|
||||
WINRT_CALLBACK(PaneRaiseBell, winrt::Windows::Foundation::EventHandler<bool>);
|
||||
WINRT_CALLBACK(PaneRaiseBell, WF::EventHandler<bool>);
|
||||
WINRT_CALLBACK(Detached, winrt::delegate<std::shared_ptr<Pane>>);
|
||||
|
||||
private:
|
||||
@@ -214,20 +214,20 @@ private:
|
||||
struct SnapChildrenSizeResult;
|
||||
struct LayoutSizeNode;
|
||||
|
||||
winrt::Windows::UI::Xaml::Controls::Grid _root{};
|
||||
winrt::Windows::UI::Xaml::Controls::Border _borderFirst{};
|
||||
winrt::Windows::UI::Xaml::Controls::Border _borderSecond{};
|
||||
static winrt::Windows::UI::Xaml::Media::SolidColorBrush s_focusedBorderBrush;
|
||||
static winrt::Windows::UI::Xaml::Media::SolidColorBrush s_unfocusedBorderBrush;
|
||||
WUXC::Grid _root{};
|
||||
WUXC::Border _borderFirst{};
|
||||
WUXC::Border _borderSecond{};
|
||||
static WUXMedia::SolidColorBrush s_focusedBorderBrush;
|
||||
static WUXMedia::SolidColorBrush s_unfocusedBorderBrush;
|
||||
|
||||
#pragma region Properties that need to be transferred between child / parent panes upon splitting / closing
|
||||
std::shared_ptr<Pane> _firstChild{ nullptr };
|
||||
std::shared_ptr<Pane> _secondChild{ nullptr };
|
||||
SplitState _splitState{ SplitState::None };
|
||||
float _desiredSplitPosition;
|
||||
winrt::Microsoft::Terminal::Control::TermControl _control{ nullptr };
|
||||
winrt::Microsoft::Terminal::TerminalConnection::ConnectionState _connectionState{ winrt::Microsoft::Terminal::TerminalConnection::ConnectionState::NotConnected };
|
||||
winrt::Microsoft::Terminal::Settings::Model::Profile _profile{ nullptr };
|
||||
MTControl::TermControl _control{ nullptr };
|
||||
MTConnection::ConnectionState _connectionState{ MTConnection::ConnectionState::NotConnected };
|
||||
MTSM::Profile _profile{ nullptr };
|
||||
bool _isDefTermSession{ false };
|
||||
#pragma endregion
|
||||
|
||||
@@ -241,8 +241,8 @@ private:
|
||||
winrt::event_token _warningBellToken{ 0 };
|
||||
winrt::event_token _closeTerminalRequestedToken{ 0 };
|
||||
|
||||
winrt::Windows::UI::Xaml::UIElement::GotFocus_revoker _gotFocusRevoker;
|
||||
winrt::Windows::UI::Xaml::UIElement::LostFocus_revoker _lostFocusRevoker;
|
||||
WUX::UIElement::GotFocus_revoker _gotFocusRevoker;
|
||||
WUX::UIElement::LostFocus_revoker _lostFocusRevoker;
|
||||
|
||||
std::shared_mutex _createCloseLock{};
|
||||
|
||||
@@ -258,7 +258,7 @@ private:
|
||||
void _SetupChildCloseHandlers();
|
||||
bool _HasChild(const std::shared_ptr<Pane> child);
|
||||
|
||||
std::pair<std::shared_ptr<Pane>, std::shared_ptr<Pane>> _Split(winrt::Microsoft::Terminal::Settings::Model::SplitDirection splitType,
|
||||
std::pair<std::shared_ptr<Pane>, std::shared_ptr<Pane>> _Split(MTSM::SplitDirection splitType,
|
||||
const float splitSize,
|
||||
std::shared_ptr<Pane> newPane);
|
||||
|
||||
@@ -268,17 +268,17 @@ private:
|
||||
void _UpdateBorders();
|
||||
Borders _GetCommonBorders();
|
||||
|
||||
bool _Resize(const winrt::Microsoft::Terminal::Settings::Model::ResizeDirection& direction);
|
||||
bool _Resize(const MTSM::ResizeDirection& direction);
|
||||
|
||||
std::shared_ptr<Pane> _FindParentOfPane(const std::shared_ptr<Pane> pane);
|
||||
std::pair<PanePoint, PanePoint> _GetOffsetsForPane(const PanePoint parentOffset) const;
|
||||
bool _IsAdjacent(const PanePoint firstOffset, const PanePoint secondOffset, const winrt::Microsoft::Terminal::Settings::Model::FocusDirection& direction) const;
|
||||
PaneNeighborSearch _FindNeighborForPane(const winrt::Microsoft::Terminal::Settings::Model::FocusDirection& direction,
|
||||
bool _IsAdjacent(const PanePoint firstOffset, const PanePoint secondOffset, const MTSM::FocusDirection& direction) const;
|
||||
PaneNeighborSearch _FindNeighborForPane(const MTSM::FocusDirection& direction,
|
||||
PaneNeighborSearch searchResult,
|
||||
const bool focusIsSecondSide,
|
||||
const PanePoint offset);
|
||||
PaneNeighborSearch _FindPaneAndNeighbor(const std::shared_ptr<Pane> sourcePane,
|
||||
const winrt::Microsoft::Terminal::Settings::Model::FocusDirection& direction,
|
||||
const MTSM::FocusDirection& direction,
|
||||
const PanePoint offset);
|
||||
|
||||
void _CloseChild(const bool closeFirst, const bool isDetaching);
|
||||
@@ -286,26 +286,26 @@ private:
|
||||
|
||||
void _Focus();
|
||||
void _FocusFirstChild();
|
||||
void _ControlConnectionStateChangedHandler(const winrt::Windows::Foundation::IInspectable& sender, const winrt::Windows::Foundation::IInspectable& /*args*/);
|
||||
void _ControlWarningBellHandler(const winrt::Windows::Foundation::IInspectable& sender,
|
||||
const winrt::Windows::Foundation::IInspectable& e);
|
||||
void _ControlGotFocusHandler(const winrt::Windows::Foundation::IInspectable& sender,
|
||||
const winrt::Windows::UI::Xaml::RoutedEventArgs& e);
|
||||
void _ControlLostFocusHandler(const winrt::Windows::Foundation::IInspectable& sender,
|
||||
const winrt::Windows::UI::Xaml::RoutedEventArgs& e);
|
||||
void _CloseTerminalRequestedHandler(const winrt::Windows::Foundation::IInspectable& sender, const winrt::Windows::Foundation::IInspectable& /*args*/);
|
||||
void _ControlConnectionStateChangedHandler(const WF::IInspectable& sender, const WF::IInspectable& /*args*/);
|
||||
void _ControlWarningBellHandler(const WF::IInspectable& sender,
|
||||
const WF::IInspectable& e);
|
||||
void _ControlGotFocusHandler(const WF::IInspectable& sender,
|
||||
const WUX::RoutedEventArgs& e);
|
||||
void _ControlLostFocusHandler(const WF::IInspectable& sender,
|
||||
const WUX::RoutedEventArgs& e);
|
||||
void _CloseTerminalRequestedHandler(const WF::IInspectable& sender, const WF::IInspectable& /*args*/);
|
||||
|
||||
std::pair<float, float> _CalcChildrenSizes(const float fullSize) const;
|
||||
SnapChildrenSizeResult _CalcSnappedChildrenSizes(const bool widthOrHeight, const float fullSize) const;
|
||||
SnapSizeResult _CalcSnappedDimension(const bool widthOrHeight, const float dimension) const;
|
||||
void _AdvanceSnappedDimension(const bool widthOrHeight, LayoutSizeNode& sizeNode) const;
|
||||
winrt::Windows::Foundation::Size _GetMinSize() const;
|
||||
WF::Size _GetMinSize() const;
|
||||
LayoutSizeNode _CreateMinSizeTree(const bool widthOrHeight) const;
|
||||
float _ClampSplitPosition(const bool widthOrHeight, const float requestedValue, const float totalSize) const;
|
||||
|
||||
SplitState _convertAutomaticOrDirectionalSplitState(const winrt::Microsoft::Terminal::Settings::Model::SplitDirection& splitType) const;
|
||||
SplitState _convertAutomaticOrDirectionalSplitState(const MTSM::SplitDirection& splitType) const;
|
||||
|
||||
winrt::fire_and_forget _playBellSound(winrt::Windows::Foundation::Uri uri);
|
||||
winrt::fire_and_forget _playBellSound(WF::Uri uri);
|
||||
|
||||
// Function Description:
|
||||
// - Returns true if the given direction can be used with the given split
|
||||
@@ -393,6 +393,6 @@ private:
|
||||
void _AssignChildNode(std::unique_ptr<LayoutSizeNode>& nodeField, const LayoutSizeNode* const newNode);
|
||||
};
|
||||
|
||||
friend struct winrt::TerminalApp::implementation::TerminalTab;
|
||||
friend struct MTApp::implementation::TerminalTab;
|
||||
friend class ::TerminalAppLocalTests::TabTests;
|
||||
};
|
||||
|
||||
@@ -8,23 +8,17 @@
|
||||
#include "Utils.h"
|
||||
|
||||
using namespace winrt;
|
||||
using namespace winrt::Windows::UI::Xaml;
|
||||
using namespace winrt::Windows::UI::Core;
|
||||
using namespace winrt::Microsoft::Terminal::Control;
|
||||
using namespace winrt::Microsoft::Terminal::Settings::Model;
|
||||
using namespace WUX;
|
||||
using namespace WUC;
|
||||
using namespace MTControl;
|
||||
using namespace MTSM;
|
||||
using namespace winrt::Microsoft::Terminal::Settings::Editor;
|
||||
using namespace winrt::Windows::System;
|
||||
|
||||
namespace winrt
|
||||
{
|
||||
namespace MUX = Microsoft::UI::Xaml;
|
||||
namespace WUX = Windows::UI::Xaml;
|
||||
}
|
||||
using namespace WS;
|
||||
|
||||
namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
SettingsTab::SettingsTab(MainPage settingsUI,
|
||||
winrt::Windows::UI::Xaml::ElementTheme requestedTheme)
|
||||
WUX::ElementTheme requestedTheme)
|
||||
{
|
||||
Content(settingsUI);
|
||||
_requestedTheme = requestedTheme;
|
||||
@@ -112,7 +106,7 @@ namespace winrt::TerminalApp::implementation
|
||||
}
|
||||
}
|
||||
|
||||
winrt::Windows::UI::Xaml::Media::Brush SettingsTab::_BackgroundBrush()
|
||||
WUXMedia::Brush SettingsTab::_BackgroundBrush()
|
||||
{
|
||||
// Look up the color we should use for the settings tab item from our
|
||||
// resources. This should only be used for when "terminalBackground" is
|
||||
@@ -121,6 +115,6 @@ namespace winrt::TerminalApp::implementation
|
||||
// You can't just do a Application::Current().Resources().TryLookup
|
||||
// lookup, cause the app theme never changes! Do the hacky version
|
||||
// instead.
|
||||
return ThemeLookup(Application::Current().Resources(), _requestedTheme, key).try_as<winrt::Windows::UI::Xaml::Media::Brush>();
|
||||
return ThemeLookup(Application::Current().Resources(), _requestedTheme, key).try_as<WUXMedia::Brush>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,19 +25,19 @@ namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
public:
|
||||
SettingsTab(winrt::Microsoft::Terminal::Settings::Editor::MainPage settingsUI,
|
||||
winrt::Windows::UI::Xaml::ElementTheme requestedTheme);
|
||||
WUX::ElementTheme requestedTheme);
|
||||
|
||||
void UpdateSettings(Microsoft::Terminal::Settings::Model::CascadiaSettings settings);
|
||||
void Focus(winrt::Windows::UI::Xaml::FocusState focusState) override;
|
||||
void UpdateSettings(MTSM::CascadiaSettings settings);
|
||||
void Focus(WUX::FocusState focusState) override;
|
||||
|
||||
std::vector<Microsoft::Terminal::Settings::Model::ActionAndArgs> BuildStartupActions() const override;
|
||||
std::vector<MTSM::ActionAndArgs> BuildStartupActions() const override;
|
||||
|
||||
private:
|
||||
winrt::Windows::UI::Xaml::ElementTheme _requestedTheme;
|
||||
WUX::ElementTheme _requestedTheme;
|
||||
|
||||
void _MakeTabViewItem() override;
|
||||
winrt::fire_and_forget _CreateIcon();
|
||||
|
||||
virtual winrt::Windows::UI::Xaml::Media::Brush _BackgroundBrush() override;
|
||||
virtual WUXMedia::Brush _BackgroundBrush() override;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
#include "ShortcutActionDispatch.g.cpp"
|
||||
|
||||
using namespace winrt::Microsoft::Terminal;
|
||||
using namespace winrt::Microsoft::Terminal::Settings::Model;
|
||||
using namespace winrt::TerminalApp;
|
||||
using namespace MTSM;
|
||||
using namespace MTApp;
|
||||
|
||||
#define ACTION_CASE(action) \
|
||||
case ShortcutAction::action: \
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace TerminalAppLocalTests
|
||||
class KeyBindingsTests;
|
||||
}
|
||||
|
||||
#define DECLARE_ACTION(action) TYPED_EVENT(action, TerminalApp::ShortcutActionDispatch, Microsoft::Terminal::Settings::Model::ActionEventArgs);
|
||||
#define DECLARE_ACTION(action) TYPED_EVENT(action, MTApp::ShortcutActionDispatch, MTSM::ActionEventArgs);
|
||||
|
||||
namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
@@ -21,7 +21,7 @@ namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
ShortcutActionDispatch() = default;
|
||||
|
||||
bool DoAction(const Microsoft::Terminal::Settings::Model::ActionAndArgs& actionAndArgs);
|
||||
bool DoAction(const MTSM::ActionAndArgs& actionAndArgs);
|
||||
|
||||
#define ON_ALL_ACTIONS(action) DECLARE_ACTION(action);
|
||||
ALL_SHORTCUT_ACTIONS
|
||||
|
||||
@@ -9,17 +9,11 @@
|
||||
#include "ColorHelper.h"
|
||||
|
||||
using namespace winrt;
|
||||
using namespace winrt::Windows::UI::Xaml;
|
||||
using namespace winrt::Windows::UI::Core;
|
||||
using namespace winrt::Microsoft::Terminal::Control;
|
||||
using namespace winrt::Microsoft::Terminal::Settings::Model;
|
||||
using namespace winrt::Windows::System;
|
||||
|
||||
namespace winrt
|
||||
{
|
||||
namespace MUX = Microsoft::UI::Xaml;
|
||||
namespace WUX = Windows::UI::Xaml;
|
||||
}
|
||||
using namespace WUX;
|
||||
using namespace WUC;
|
||||
using namespace MTControl;
|
||||
using namespace MTSM;
|
||||
using namespace WS;
|
||||
|
||||
namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
@@ -67,7 +61,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// - flyout - the menu flyout to which the close items must be appended
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void TabBase::_AppendCloseMenuItems(winrt::Windows::UI::Xaml::Controls::MenuFlyout flyout)
|
||||
void TabBase::_AppendCloseMenuItems(WUXC::MenuFlyout flyout)
|
||||
{
|
||||
auto weakThis{ get_weak() };
|
||||
|
||||
@@ -165,12 +159,12 @@ namespace winrt::TerminalApp::implementation
|
||||
_UpdateSwitchToTabKeyChord();
|
||||
}
|
||||
|
||||
void TabBase::SetDispatch(const winrt::TerminalApp::ShortcutActionDispatch& dispatch)
|
||||
void TabBase::SetDispatch(const MTApp::ShortcutActionDispatch& dispatch)
|
||||
{
|
||||
_dispatch = dispatch;
|
||||
}
|
||||
|
||||
void TabBase::SetActionMap(const Microsoft::Terminal::Settings::Model::IActionMapView& actionMap)
|
||||
void TabBase::SetActionMap(const MTSM::IActionMapView& actionMap)
|
||||
{
|
||||
_actionMap = actionMap;
|
||||
_UpdateSwitchToTabKeyChord();
|
||||
@@ -236,7 +230,7 @@ namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
auto keyChordRun = WUX::Documents::Run();
|
||||
keyChordRun.Text(_keyChord);
|
||||
keyChordRun.FontStyle(winrt::Windows::UI::Text::FontStyle::Italic);
|
||||
keyChordRun.FontStyle(WUT::FontStyle::Italic);
|
||||
textBlock.Inlines().Append(WUX::Documents::LineBreak{});
|
||||
textBlock.Inlines().Append(keyChordRun);
|
||||
}
|
||||
@@ -254,7 +248,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// - <none>
|
||||
void TabBase::_MakeTabViewItem()
|
||||
{
|
||||
TabViewItem(::winrt::MUX::Controls::TabViewItem{});
|
||||
TabViewItem(MUX::Controls::TabViewItem{});
|
||||
|
||||
// GH#3609 If the tab was tapped, and no one else was around to handle
|
||||
// it, then ask our parent to toss focus into the active control.
|
||||
@@ -271,8 +265,8 @@ namespace winrt::TerminalApp::implementation
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
void TabBase::ThemeColor(const winrt::Microsoft::Terminal::Settings::Model::ThemeColor& focused,
|
||||
const winrt::Microsoft::Terminal::Settings::Model::ThemeColor& unfocused,
|
||||
void TabBase::ThemeColor(const MTSM::ThemeColor& focused,
|
||||
const MTSM::ThemeColor& unfocused,
|
||||
const til::color& tabRowColor)
|
||||
{
|
||||
_themeColor = focused;
|
||||
|
||||
@@ -15,26 +15,26 @@ namespace winrt::TerminalApp::implementation
|
||||
struct TabBase : TabBaseT<TabBase>
|
||||
{
|
||||
public:
|
||||
virtual void Focus(winrt::Windows::UI::Xaml::FocusState focusState) = 0;
|
||||
winrt::Windows::UI::Xaml::FocusState FocusState() const noexcept;
|
||||
virtual void Focus(WUX::FocusState focusState) = 0;
|
||||
WUX::FocusState FocusState() const noexcept;
|
||||
|
||||
virtual void Shutdown();
|
||||
void SetDispatch(const winrt::TerminalApp::ShortcutActionDispatch& dispatch);
|
||||
void SetDispatch(const MTApp::ShortcutActionDispatch& dispatch);
|
||||
|
||||
void UpdateTabViewIndex(const uint32_t idx, const uint32_t numTabs);
|
||||
void SetActionMap(const Microsoft::Terminal::Settings::Model::IActionMapView& actionMap);
|
||||
virtual std::vector<Microsoft::Terminal::Settings::Model::ActionAndArgs> BuildStartupActions() const = 0;
|
||||
void SetActionMap(const MTSM::IActionMapView& actionMap);
|
||||
virtual std::vector<MTSM::ActionAndArgs> BuildStartupActions() const = 0;
|
||||
|
||||
virtual std::optional<winrt::Windows::UI::Color> GetTabColor();
|
||||
void ThemeColor(const winrt::Microsoft::Terminal::Settings::Model::ThemeColor& focused,
|
||||
const winrt::Microsoft::Terminal::Settings::Model::ThemeColor& unfocused,
|
||||
void ThemeColor(const MTSM::ThemeColor& focused,
|
||||
const MTSM::ThemeColor& unfocused,
|
||||
const til::color& tabRowColor);
|
||||
|
||||
WINRT_CALLBACK(RequestFocusActiveControl, winrt::delegate<void()>);
|
||||
|
||||
WINRT_CALLBACK(Closed, winrt::Windows::Foundation::EventHandler<winrt::Windows::Foundation::IInspectable>);
|
||||
WINRT_CALLBACK(CloseRequested, winrt::Windows::Foundation::EventHandler<winrt::Windows::Foundation::IInspectable>);
|
||||
WINRT_CALLBACK(PropertyChanged, Windows::UI::Xaml::Data::PropertyChangedEventHandler);
|
||||
WINRT_CALLBACK(Closed, WF::EventHandler<WF::IInspectable>);
|
||||
WINRT_CALLBACK(CloseRequested, WF::EventHandler<WF::IInspectable>);
|
||||
WINRT_CALLBACK(PropertyChanged, WUX::Data::PropertyChangedEventHandler);
|
||||
|
||||
// The TabViewIndex is the index this Tab object resides in TerminalPage's _tabs vector.
|
||||
WINRT_PROPERTY(uint32_t, TabViewIndex, 0);
|
||||
@@ -44,20 +44,20 @@ namespace winrt::TerminalApp::implementation
|
||||
WINRT_OBSERVABLE_PROPERTY(winrt::hstring, Title, _PropertyChangedHandlers);
|
||||
WINRT_OBSERVABLE_PROPERTY(winrt::hstring, Icon, _PropertyChangedHandlers);
|
||||
WINRT_OBSERVABLE_PROPERTY(bool, ReadOnly, _PropertyChangedHandlers, false);
|
||||
WINRT_PROPERTY(winrt::Microsoft::UI::Xaml::Controls::TabViewItem, TabViewItem, nullptr);
|
||||
WINRT_PROPERTY(MUXC::TabViewItem, TabViewItem, nullptr);
|
||||
|
||||
WINRT_OBSERVABLE_PROPERTY(winrt::Windows::UI::Xaml::FrameworkElement, Content, _PropertyChangedHandlers, nullptr);
|
||||
WINRT_OBSERVABLE_PROPERTY(WUX::FrameworkElement, Content, _PropertyChangedHandlers, nullptr);
|
||||
|
||||
protected:
|
||||
winrt::Windows::UI::Xaml::FocusState _focusState{ winrt::Windows::UI::Xaml::FocusState::Unfocused };
|
||||
winrt::Windows::UI::Xaml::Controls::MenuFlyoutItem _closeOtherTabsMenuItem{};
|
||||
winrt::Windows::UI::Xaml::Controls::MenuFlyoutItem _closeTabsAfterMenuItem{};
|
||||
winrt::TerminalApp::ShortcutActionDispatch _dispatch;
|
||||
Microsoft::Terminal::Settings::Model::IActionMapView _actionMap{ nullptr };
|
||||
WUX::FocusState _focusState{ WUX::FocusState::Unfocused };
|
||||
WUXC::MenuFlyoutItem _closeOtherTabsMenuItem{};
|
||||
WUXC::MenuFlyoutItem _closeTabsAfterMenuItem{};
|
||||
MTApp::ShortcutActionDispatch _dispatch;
|
||||
MTSM::IActionMapView _actionMap{ nullptr };
|
||||
winrt::hstring _keyChord{};
|
||||
|
||||
winrt::Microsoft::Terminal::Settings::Model::ThemeColor _themeColor{ nullptr };
|
||||
winrt::Microsoft::Terminal::Settings::Model::ThemeColor _unfocusedThemeColor{ nullptr };
|
||||
MTSM::ThemeColor _themeColor{ nullptr };
|
||||
MTSM::ThemeColor _unfocusedThemeColor{ nullptr };
|
||||
til::color _tabRowColor;
|
||||
|
||||
virtual void _CreateContextMenu();
|
||||
@@ -65,7 +65,7 @@ namespace winrt::TerminalApp::implementation
|
||||
|
||||
virtual void _MakeTabViewItem();
|
||||
|
||||
void _AppendCloseMenuItems(winrt::Windows::UI::Xaml::Controls::MenuFlyout flyout);
|
||||
void _AppendCloseMenuItems(WUXC::MenuFlyout flyout);
|
||||
void _EnableCloseMenuItems();
|
||||
void _CloseTabsAfter();
|
||||
void _CloseOtherTabs();
|
||||
@@ -76,7 +76,7 @@ namespace winrt::TerminalApp::implementation
|
||||
void _ApplyTabColorOnUIThread(const winrt::Windows::UI::Color& color);
|
||||
void _ClearTabBackgroundColor();
|
||||
void _RefreshVisualState();
|
||||
virtual winrt::Windows::UI::Xaml::Media::Brush _BackgroundBrush() = 0;
|
||||
virtual WUXMedia::Brush _BackgroundBrush() = 0;
|
||||
|
||||
friend class ::TerminalAppLocalTests::TabTests;
|
||||
};
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include "TabHeaderControl.g.cpp"
|
||||
|
||||
using namespace winrt;
|
||||
using namespace winrt::Microsoft::UI::Xaml;
|
||||
using namespace MUX;
|
||||
|
||||
namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
@@ -23,10 +23,10 @@ namespace winrt::TerminalApp::implementation
|
||||
|
||||
// GH#9632 - mark navigation buttons as handled.
|
||||
// This should prevent the tab view to use this key for navigation between tabs
|
||||
if (e.OriginalKey() == Windows::System::VirtualKey::Down ||
|
||||
e.OriginalKey() == Windows::System::VirtualKey::Up ||
|
||||
e.OriginalKey() == Windows::System::VirtualKey::Left ||
|
||||
e.OriginalKey() == Windows::System::VirtualKey::Right)
|
||||
if (e.OriginalKey() == WS::VirtualKey::Down ||
|
||||
e.OriginalKey() == WS::VirtualKey::Up ||
|
||||
e.OriginalKey() == WS::VirtualKey::Left ||
|
||||
e.OriginalKey() == WS::VirtualKey::Right)
|
||||
{
|
||||
e.Handled(true);
|
||||
}
|
||||
@@ -36,15 +36,15 @@ namespace winrt::TerminalApp::implementation
|
||||
// remove the TextBox from the UI tree, then the following KeyUp
|
||||
// will bubble to the NewTabButton, which we don't want to have
|
||||
// happen.
|
||||
HeaderRenamerTextBox().KeyUp([&](auto&&, const Windows::UI::Xaml::Input::KeyRoutedEventArgs& e) {
|
||||
HeaderRenamerTextBox().KeyUp([&](auto&&, const WUX::Input::KeyRoutedEventArgs& e) {
|
||||
if (_receivedKeyDown)
|
||||
{
|
||||
if (e.OriginalKey() == Windows::System::VirtualKey::Enter)
|
||||
if (e.OriginalKey() == WS::VirtualKey::Enter)
|
||||
{
|
||||
// User is done making changes, close the rename box
|
||||
_CloseRenameBox();
|
||||
}
|
||||
else if (e.OriginalKey() == Windows::System::VirtualKey::Escape)
|
||||
else if (e.OriginalKey() == WS::VirtualKey::Escape)
|
||||
{
|
||||
// User wants to discard the changes they made,
|
||||
// set _renameCancelled to true and close the rename box
|
||||
@@ -64,7 +64,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// - true if the renamer is open.
|
||||
bool TabHeaderControl::InRename()
|
||||
{
|
||||
return Windows::UI::Xaml::Visibility::Visible == HeaderRenamerTextBox().Visibility();
|
||||
return WUX::Visibility::Visible == HeaderRenamerTextBox().Visibility();
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
@@ -75,12 +75,12 @@ namespace winrt::TerminalApp::implementation
|
||||
_receivedKeyDown = false;
|
||||
_renameCancelled = false;
|
||||
|
||||
HeaderTextBlock().Visibility(Windows::UI::Xaml::Visibility::Collapsed);
|
||||
HeaderRenamerTextBox().Visibility(Windows::UI::Xaml::Visibility::Visible);
|
||||
HeaderTextBlock().Visibility(WUX::Visibility::Collapsed);
|
||||
HeaderRenamerTextBox().Visibility(WUX::Visibility::Visible);
|
||||
|
||||
HeaderRenamerTextBox().Text(Title());
|
||||
HeaderRenamerTextBox().SelectAll();
|
||||
HeaderRenamerTextBox().Focus(Windows::UI::Xaml::FocusState::Programmatic);
|
||||
HeaderRenamerTextBox().Focus(WUX::FocusState::Programmatic);
|
||||
|
||||
TraceLoggingWrite(
|
||||
g_hTerminalAppProvider, // handle to TerminalApp tracelogging provider
|
||||
@@ -94,8 +94,8 @@ namespace winrt::TerminalApp::implementation
|
||||
// - Event handler for when the rename box loses focus
|
||||
// - When the rename box loses focus, we send a request for the title change depending
|
||||
// on whether the rename was cancelled
|
||||
void TabHeaderControl::RenameBoxLostFocusHandler(const Windows::Foundation::IInspectable& /*sender*/,
|
||||
const Windows::UI::Xaml::RoutedEventArgs& /*e*/)
|
||||
void TabHeaderControl::RenameBoxLostFocusHandler(const WF::IInspectable& /*sender*/,
|
||||
const WUX::RoutedEventArgs& /*e*/)
|
||||
{
|
||||
// If the context menu associated with the renamer text box is open we know it gained the focus.
|
||||
// In this case we ignore this event (we will regain the focus once the menu will be closed).
|
||||
@@ -128,10 +128,10 @@ namespace winrt::TerminalApp::implementation
|
||||
// - Hides the rename box and displays the title text block
|
||||
void TabHeaderControl::_CloseRenameBox()
|
||||
{
|
||||
if (HeaderRenamerTextBox().Visibility() == Windows::UI::Xaml::Visibility::Visible)
|
||||
if (HeaderRenamerTextBox().Visibility() == WUX::Visibility::Visible)
|
||||
{
|
||||
HeaderRenamerTextBox().Visibility(Windows::UI::Xaml::Visibility::Collapsed);
|
||||
HeaderTextBlock().Visibility(Windows::UI::Xaml::Visibility::Visible);
|
||||
HeaderRenamerTextBox().Visibility(WUX::Visibility::Collapsed);
|
||||
HeaderTextBlock().Visibility(WUX::Visibility::Visible);
|
||||
_RenameEndedHandlers(*this, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,19 +14,19 @@ namespace winrt::TerminalApp::implementation
|
||||
TabHeaderControl();
|
||||
void BeginRename();
|
||||
|
||||
void RenameBoxLostFocusHandler(const winrt::Windows::Foundation::IInspectable& sender,
|
||||
const winrt::Windows::UI::Xaml::RoutedEventArgs& e);
|
||||
void RenameBoxLostFocusHandler(const WF::IInspectable& sender,
|
||||
const WUX::RoutedEventArgs& e);
|
||||
|
||||
bool InRename();
|
||||
|
||||
WINRT_CALLBACK(TitleChangeRequested, TerminalApp::TitleChangeRequestedArgs);
|
||||
|
||||
WINRT_CALLBACK(PropertyChanged, Windows::UI::Xaml::Data::PropertyChangedEventHandler);
|
||||
WINRT_CALLBACK(PropertyChanged, WUX::Data::PropertyChangedEventHandler);
|
||||
WINRT_OBSERVABLE_PROPERTY(winrt::hstring, Title, _PropertyChangedHandlers);
|
||||
WINRT_OBSERVABLE_PROPERTY(double, RenamerMaxWidth, _PropertyChangedHandlers);
|
||||
WINRT_OBSERVABLE_PROPERTY(winrt::TerminalApp::TerminalTabStatus, TabStatus, _PropertyChangedHandlers);
|
||||
WINRT_OBSERVABLE_PROPERTY(MTApp::TerminalTabStatus, TabStatus, _PropertyChangedHandlers);
|
||||
|
||||
TYPED_EVENT(RenameEnded, winrt::Windows::Foundation::IInspectable, winrt::Windows::Foundation::IInspectable);
|
||||
TYPED_EVENT(RenameEnded, WF::IInspectable, WF::IInspectable);
|
||||
|
||||
private:
|
||||
bool _receivedKeyDown{ false };
|
||||
|
||||
@@ -25,30 +25,23 @@
|
||||
#include <shlobj.h>
|
||||
|
||||
using namespace winrt;
|
||||
using namespace winrt::Windows::Foundation::Collections;
|
||||
using namespace winrt::Windows::UI::Xaml;
|
||||
using namespace winrt::Windows::UI::Xaml::Controls;
|
||||
using namespace winrt::Windows::UI::Core;
|
||||
using namespace winrt::Windows::System;
|
||||
using namespace WFC;
|
||||
using namespace WUX;
|
||||
using namespace WUXC;
|
||||
using namespace WUC;
|
||||
using namespace WS;
|
||||
using namespace winrt::Windows::ApplicationModel::DataTransfer;
|
||||
using namespace winrt::Windows::UI::Text;
|
||||
using namespace WUT;
|
||||
using namespace winrt::Windows::Storage;
|
||||
using namespace winrt::Windows::Storage::Pickers;
|
||||
using namespace winrt::Windows::Storage::Provider;
|
||||
using namespace winrt::Microsoft::Terminal;
|
||||
using namespace winrt::Microsoft::Terminal::Control;
|
||||
using namespace winrt::Microsoft::Terminal::TerminalConnection;
|
||||
using namespace winrt::Microsoft::Terminal::Settings::Model;
|
||||
using namespace MTControl;
|
||||
using namespace MTConnection;
|
||||
using namespace MTSM;
|
||||
using namespace ::TerminalApp;
|
||||
using namespace ::Microsoft::Console;
|
||||
|
||||
namespace winrt
|
||||
{
|
||||
namespace MUX = Microsoft::UI::Xaml;
|
||||
namespace WUX = Windows::UI::Xaml;
|
||||
using IInspectable = Windows::Foundation::IInspectable;
|
||||
}
|
||||
|
||||
namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
// Method Description:
|
||||
@@ -63,7 +56,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// - existingConnection: An optional connection that is already established to a PTY
|
||||
// for this tab to host instead of creating one.
|
||||
// If not defined, the tab will create the connection.
|
||||
HRESULT TerminalPage::_OpenNewTab(const NewTerminalArgs& newTerminalArgs, winrt::Microsoft::Terminal::TerminalConnection::ITerminalConnection existingConnection)
|
||||
HRESULT TerminalPage::_OpenNewTab(const NewTerminalArgs& newTerminalArgs, MTConnection::ITerminalConnection existingConnection)
|
||||
try
|
||||
{
|
||||
const auto profile{ _settings.GetProfileForArgs(newTerminalArgs) };
|
||||
@@ -462,7 +455,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// - Removes the tab (both TerminalControl and XAML) after prompting for approval
|
||||
// Arguments:
|
||||
// - tab: the tab to remove
|
||||
winrt::Windows::Foundation::IAsyncAction TerminalPage::_HandleCloseTabRequested(winrt::TerminalApp::TabBase tab)
|
||||
WF::IAsyncAction TerminalPage::_HandleCloseTabRequested(MTApp::TabBase tab)
|
||||
{
|
||||
if (tab.ReadOnly())
|
||||
{
|
||||
@@ -486,7 +479,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// - Removes the tab (both TerminalControl and XAML)
|
||||
// Arguments:
|
||||
// - tab: the tab to remove
|
||||
void TerminalPage::_RemoveTab(const winrt::TerminalApp::TabBase& tab)
|
||||
void TerminalPage::_RemoveTab(const MTApp::TabBase& tab)
|
||||
{
|
||||
uint32_t tabIndex{};
|
||||
if (!_tabs.IndexOf(tab, tabIndex))
|
||||
@@ -585,7 +578,7 @@ namespace winrt::TerminalApp::implementation
|
||||
|
||||
// Method Description:
|
||||
// - Sets focus to the tab to the right or left the currently selected tab.
|
||||
void TerminalPage::_SelectNextTab(const bool bMoveRight, const Windows::Foundation::IReference<Microsoft::Terminal::Settings::Model::TabSwitcherMode>& customTabSwitcherMode)
|
||||
void TerminalPage::_SelectNextTab(const bool bMoveRight, const WF::IReference<MTSM::TabSwitcherMode>& customTabSwitcherMode)
|
||||
{
|
||||
const auto index{ _GetFocusedTabIndex().value_or(0) };
|
||||
const auto tabSwitchMode = customTabSwitcherMode ? customTabSwitcherMode.Value() : _settings.GlobalSettings().TabSwitcherMode();
|
||||
@@ -653,7 +646,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// - tab - tab to select
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void TerminalPage::_OnSwitchToTabRequested(const IInspectable& /*sender*/, const winrt::TerminalApp::TabBase& tab)
|
||||
void TerminalPage::_OnSwitchToTabRequested(const IInspectable& /*sender*/, const MTApp::TabBase& tab)
|
||||
{
|
||||
uint32_t index{};
|
||||
if (_tabs.IndexOf(tab, index))
|
||||
@@ -682,7 +675,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// Method Description:
|
||||
// - returns the currently focused tab. This might return null,
|
||||
// so make sure to check the result!
|
||||
winrt::TerminalApp::TabBase TerminalPage::_GetFocusedTab() const noexcept
|
||||
MTApp::TabBase TerminalPage::_GetFocusedTab() const noexcept
|
||||
{
|
||||
if (auto index{ _GetFocusedTabIndex() })
|
||||
{
|
||||
@@ -706,7 +699,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// Method Description:
|
||||
// - returns a tab corresponding to a view item. This might return null,
|
||||
// so make sure to check the result!
|
||||
winrt::TerminalApp::TabBase TerminalPage::_GetTabByTabViewItem(const Microsoft::UI::Xaml::Controls::TabViewItem& tabViewItem) const noexcept
|
||||
MTApp::TabBase TerminalPage::_GetTabByTabViewItem(const MUXC::TabViewItem& tabViewItem) const noexcept
|
||||
{
|
||||
uint32_t tabIndexFromControl{};
|
||||
if (_tabView.TabItems().IndexOf(tabViewItem, tabIndexFromControl))
|
||||
@@ -727,7 +720,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// - tab: tab to focus.
|
||||
// Return Value:
|
||||
// - <none>
|
||||
winrt::fire_and_forget TerminalPage::_SetFocusedTab(const winrt::TerminalApp::TabBase tab)
|
||||
winrt::fire_and_forget TerminalPage::_SetFocusedTab(const MTApp::TabBase tab)
|
||||
{
|
||||
// GH#1117: This is a workaround because _tabView.SelectedIndex(tabIndex)
|
||||
// sometimes set focus to an incorrect tab after removing some tabs
|
||||
@@ -752,7 +745,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// - pane: the pane that is about to be closed.
|
||||
// Return Value:
|
||||
// - bool indicating whether the (read-only) pane can be closed.
|
||||
winrt::Windows::Foundation::IAsyncOperation<bool> TerminalPage::_PaneConfirmCloseReadOnly(std::shared_ptr<Pane> pane)
|
||||
WF::IAsyncOperation<bool> TerminalPage::_PaneConfirmCloseReadOnly(std::shared_ptr<Pane> pane)
|
||||
{
|
||||
if (pane->ContainsReadOnly())
|
||||
{
|
||||
@@ -826,7 +819,7 @@ namespace winrt::TerminalApp::implementation
|
||||
else if (auto index{ _GetFocusedTabIndex() })
|
||||
{
|
||||
const auto tab{ _tabs.GetAt(*index) };
|
||||
if (tab.try_as<TerminalApp::SettingsTab>())
|
||||
if (tab.try_as<MTApp::SettingsTab>())
|
||||
{
|
||||
_HandleCloseTabRequested(tab);
|
||||
}
|
||||
@@ -883,7 +876,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// - Closes provided tabs one by one
|
||||
// Arguments:
|
||||
// - tabs - tabs to remove
|
||||
winrt::fire_and_forget TerminalPage::_RemoveTabs(const std::vector<winrt::TerminalApp::TabBase> tabs)
|
||||
winrt::fire_and_forget TerminalPage::_RemoveTabs(const std::vector<MTApp::TabBase> tabs)
|
||||
{
|
||||
for (auto& tab : tabs)
|
||||
{
|
||||
@@ -900,16 +893,16 @@ namespace winrt::TerminalApp::implementation
|
||||
// Arguments:
|
||||
// - sender: the control that originated this event
|
||||
// - eventArgs: the event's constituent arguments
|
||||
void TerminalPage::_OnTabItemsChanged(const IInspectable& /*sender*/, const Windows::Foundation::Collections::IVectorChangedEventArgs& eventArgs)
|
||||
void TerminalPage::_OnTabItemsChanged(const IInspectable& /*sender*/, const WFC::IVectorChangedEventArgs& eventArgs)
|
||||
{
|
||||
if (_rearranging)
|
||||
{
|
||||
if (eventArgs.CollectionChange() == Windows::Foundation::Collections::CollectionChange::ItemRemoved)
|
||||
if (eventArgs.CollectionChange() == WFC::CollectionChange::ItemRemoved)
|
||||
{
|
||||
_rearrangeFrom = eventArgs.Index();
|
||||
}
|
||||
|
||||
if (eventArgs.CollectionChange() == Windows::Foundation::Collections::CollectionChange::ItemInserted)
|
||||
if (eventArgs.CollectionChange() == WFC::CollectionChange::ItemInserted)
|
||||
{
|
||||
_rearrangeTo = eventArgs.Index();
|
||||
}
|
||||
@@ -924,7 +917,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// Arguments:
|
||||
// - sender: the control that originated this event (TabViewItem)
|
||||
// - eventArgs: the event's constituent arguments
|
||||
void TerminalPage::_OnTabClick(const IInspectable& sender, const Windows::UI::Xaml::Input::PointerRoutedEventArgs& eventArgs)
|
||||
void TerminalPage::_OnTabClick(const IInspectable& sender, const WUX::Input::PointerRoutedEventArgs& eventArgs)
|
||||
{
|
||||
if (eventArgs.GetCurrentPoint(*this).Properties().IsMiddleButtonPressed())
|
||||
{
|
||||
@@ -941,7 +934,7 @@ namespace winrt::TerminalApp::implementation
|
||||
}
|
||||
}
|
||||
|
||||
void TerminalPage::_UpdatedSelectedTab(const winrt::TerminalApp::TabBase& tab)
|
||||
void TerminalPage::_UpdatedSelectedTab(const MTApp::TabBase& tab)
|
||||
{
|
||||
// Unfocus all the tabs.
|
||||
for (auto tab : _tabs)
|
||||
@@ -990,7 +983,7 @@ namespace winrt::TerminalApp::implementation
|
||||
CATCH_LOG();
|
||||
}
|
||||
|
||||
void TerminalPage::_UpdateBackground(const winrt::Microsoft::Terminal::Settings::Model::Profile& profile)
|
||||
void TerminalPage::_UpdateBackground(const MTSM::Profile& profile)
|
||||
{
|
||||
if (profile && _settings.GlobalSettings().UseBackgroundImageForWindow())
|
||||
{
|
||||
@@ -1041,7 +1034,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// - tab: tab to bump.
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void TerminalPage::_UpdateMRUTab(const winrt::TerminalApp::TabBase& tab)
|
||||
void TerminalPage::_UpdateMRUTab(const MTApp::TabBase& tab)
|
||||
{
|
||||
uint32_t mruIndex;
|
||||
if (_mruTabs.IndexOf(tab, mruIndex))
|
||||
@@ -1141,7 +1134,7 @@ namespace winrt::TerminalApp::implementation
|
||||
void TerminalPage::_RemoveAllTabs()
|
||||
{
|
||||
// Since _RemoveTabs is asynchronous, create a snapshot of the tabs we want to remove
|
||||
std::vector<winrt::TerminalApp::TabBase> tabsToRemove;
|
||||
std::vector<MTApp::TabBase> tabsToRemove;
|
||||
std::copy(begin(_tabs), end(_tabs), std::back_inserter(tabsToRemove));
|
||||
_RemoveTabs(tabsToRemove);
|
||||
}
|
||||
|
||||
@@ -9,17 +9,17 @@
|
||||
#include "TabPaletteItem.g.cpp"
|
||||
|
||||
using namespace winrt;
|
||||
using namespace winrt::TerminalApp;
|
||||
using namespace winrt::Windows::UI::Core;
|
||||
using namespace winrt::Windows::UI::Xaml;
|
||||
using namespace winrt::Windows::System;
|
||||
using namespace winrt::Windows::Foundation;
|
||||
using namespace winrt::Windows::Foundation::Collections;
|
||||
using namespace winrt::Microsoft::Terminal::Settings::Model;
|
||||
using namespace MTApp;
|
||||
using namespace WUC;
|
||||
using namespace WUX;
|
||||
using namespace WS;
|
||||
using namespace WF;
|
||||
using namespace WFC;
|
||||
using namespace MTSM;
|
||||
|
||||
namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
TabPaletteItem::TabPaletteItem(const winrt::TerminalApp::TabBase& tab) :
|
||||
TabPaletteItem::TabPaletteItem(const MTApp::TabBase& tab) :
|
||||
_tab(tab)
|
||||
{
|
||||
Name(tab.Title());
|
||||
@@ -27,7 +27,7 @@ namespace winrt::TerminalApp::implementation
|
||||
|
||||
_tabChangedRevoker = tab.PropertyChanged(winrt::auto_revoke, [weakThis{ get_weak() }](auto& sender, auto& e) {
|
||||
auto item{ weakThis.get() };
|
||||
auto senderTab{ sender.try_as<winrt::TerminalApp::TabBase>() };
|
||||
auto senderTab{ sender.try_as<MTApp::TabBase>() };
|
||||
|
||||
if (item && senderTab)
|
||||
{
|
||||
@@ -43,7 +43,7 @@ namespace winrt::TerminalApp::implementation
|
||||
}
|
||||
});
|
||||
|
||||
if (const auto terminalTab{ tab.try_as<winrt::TerminalApp::TerminalTab>() })
|
||||
if (const auto terminalTab{ tab.try_as<MTApp::TerminalTab>() })
|
||||
{
|
||||
const auto status = terminalTab.TabStatus();
|
||||
TabStatus(status);
|
||||
@@ -52,7 +52,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// Sometimes nested bindings do not get updated,
|
||||
// thus let's notify property changed on TabStatus when one of its properties changes
|
||||
auto item{ weakThis.get() };
|
||||
item->_PropertyChangedHandlers(*item, Windows::UI::Xaml::Data::PropertyChangedEventArgs{ L"TabStatus" });
|
||||
item->_PropertyChangedHandlers(*item, WUX::Data::PropertyChangedEventArgs{ L"TabStatus" });
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,19 +11,19 @@ namespace winrt::TerminalApp::implementation
|
||||
struct TabPaletteItem : TabPaletteItemT<TabPaletteItem, PaletteItem>
|
||||
{
|
||||
TabPaletteItem() = default;
|
||||
TabPaletteItem(const winrt::TerminalApp::TabBase& tab);
|
||||
TabPaletteItem(const MTApp::TabBase& tab);
|
||||
|
||||
winrt::TerminalApp::TabBase Tab() const noexcept
|
||||
MTApp::TabBase Tab() const noexcept
|
||||
{
|
||||
return _tab.get();
|
||||
}
|
||||
|
||||
WINRT_OBSERVABLE_PROPERTY(winrt::TerminalApp::TerminalTabStatus, TabStatus, _PropertyChangedHandlers);
|
||||
WINRT_OBSERVABLE_PROPERTY(MTApp::TerminalTabStatus, TabStatus, _PropertyChangedHandlers);
|
||||
|
||||
private:
|
||||
winrt::weak_ref<winrt::TerminalApp::TabBase> _tab;
|
||||
Windows::UI::Xaml::Data::INotifyPropertyChanged::PropertyChanged_revoker _tabChangedRevoker;
|
||||
Windows::UI::Xaml::Data::INotifyPropertyChanged::PropertyChanged_revoker _tabStatusChangedRevoker;
|
||||
winrt::weak_ref<MTApp::TabBase> _tab;
|
||||
WUX::Data::INotifyPropertyChanged::PropertyChanged_revoker _tabChangedRevoker;
|
||||
WUX::Data::INotifyPropertyChanged::PropertyChanged_revoker _tabStatusChangedRevoker;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -10,14 +10,8 @@
|
||||
using namespace winrt::Windows::ApplicationModel::DataTransfer;
|
||||
|
||||
using namespace winrt;
|
||||
using namespace winrt::Microsoft::UI::Xaml;
|
||||
using namespace winrt::Windows::UI::Text;
|
||||
|
||||
namespace winrt
|
||||
{
|
||||
namespace MUX = Microsoft::UI::Xaml;
|
||||
namespace WUX = Windows::UI::Xaml;
|
||||
}
|
||||
using namespace MUX;
|
||||
using namespace WUT;
|
||||
|
||||
namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
@@ -38,7 +32,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// - Bound in Drag&Drop of the Xaml editor to the [+] button.
|
||||
// Arguments:
|
||||
// <unused>
|
||||
void TabRowControl::OnNewTabButtonDrop(const IInspectable&, const winrt::Windows::UI::Xaml::DragEventArgs&)
|
||||
void TabRowControl::OnNewTabButtonDrop(const IInspectable&, const WUX::DragEventArgs&)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -48,7 +42,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// Arguments:
|
||||
// - <unused>
|
||||
// - e: DragEventArgs which hold the items
|
||||
void TabRowControl::OnNewTabButtonDragOver(const IInspectable&, const winrt::Windows::UI::Xaml::DragEventArgs& e)
|
||||
void TabRowControl::OnNewTabButtonDragOver(const IInspectable&, const WUX::DragEventArgs& e)
|
||||
{
|
||||
// We can only handle drag/dropping StorageItems (files).
|
||||
// If the format on the clipboard is anything else, returning
|
||||
|
||||
@@ -13,11 +13,11 @@ namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
TabRowControl();
|
||||
|
||||
void OnNewTabButtonClick(const Windows::Foundation::IInspectable& sender, const Microsoft::UI::Xaml::Controls::SplitButtonClickEventArgs& args);
|
||||
void OnNewTabButtonDrop(const winrt::Windows::Foundation::IInspectable& sender, const winrt::Windows::UI::Xaml::DragEventArgs& e);
|
||||
void OnNewTabButtonDragOver(const winrt::Windows::Foundation::IInspectable& sender, const winrt::Windows::UI::Xaml::DragEventArgs& e);
|
||||
void OnNewTabButtonClick(const WF::IInspectable& sender, const MUXC::SplitButtonClickEventArgs& args);
|
||||
void OnNewTabButtonDrop(const WF::IInspectable& sender, const WUX::DragEventArgs& e);
|
||||
void OnNewTabButtonDragOver(const WF::IInspectable& sender, const WUX::DragEventArgs& e);
|
||||
|
||||
WINRT_CALLBACK(PropertyChanged, Windows::UI::Xaml::Data::PropertyChangedEventHandler);
|
||||
WINRT_CALLBACK(PropertyChanged, WUX::Data::PropertyChangedEventHandler);
|
||||
WINRT_OBSERVABLE_PROPERTY(bool, ShowElevationShield, _PropertyChangedHandlers, false);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace winrt::TerminalApp::implementation
|
||||
return 6;
|
||||
}
|
||||
|
||||
int TaskbarState::ComparePriority(const winrt::TerminalApp::TaskbarState& lhs, const winrt::TerminalApp::TaskbarState& rhs)
|
||||
int TaskbarState::ComparePriority(const MTApp::TaskbarState& lhs, const MTApp::TaskbarState& rhs)
|
||||
{
|
||||
return lhs.Priority() < rhs.Priority();
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace winrt::TerminalApp::implementation
|
||||
TaskbarState();
|
||||
TaskbarState(const uint64_t dispatchTypesState, const uint64_t progress);
|
||||
|
||||
static int ComparePriority(const winrt::TerminalApp::TaskbarState& lhs, const winrt::TerminalApp::TaskbarState& rhs);
|
||||
static int ComparePriority(const MTApp::TaskbarState& lhs, const MTApp::TaskbarState& rhs);
|
||||
|
||||
uint64_t Priority() const;
|
||||
|
||||
|
||||
@@ -22,18 +22,18 @@
|
||||
#include "Utils.h"
|
||||
|
||||
using namespace winrt;
|
||||
using namespace winrt::Microsoft::Terminal::Control;
|
||||
using namespace winrt::Microsoft::Terminal::Settings::Model;
|
||||
using namespace winrt::Microsoft::Terminal::TerminalConnection;
|
||||
using namespace MTControl;
|
||||
using namespace MTSM;
|
||||
using namespace MTConnection;
|
||||
using namespace winrt::Microsoft::Terminal;
|
||||
using namespace winrt::Windows::ApplicationModel::DataTransfer;
|
||||
using namespace winrt::Windows::Foundation::Collections;
|
||||
using namespace winrt::Windows::System;
|
||||
using namespace winrt::Windows::System;
|
||||
using namespace winrt::Windows::UI::Core;
|
||||
using namespace winrt::Windows::UI::Text;
|
||||
using namespace winrt::Windows::UI::Xaml::Controls;
|
||||
using namespace winrt::Windows::UI::Xaml;
|
||||
using namespace WFC;
|
||||
using namespace WS;
|
||||
using namespace WS;
|
||||
using namespace WUC;
|
||||
using namespace WUT;
|
||||
using namespace WUXC;
|
||||
using namespace WUX;
|
||||
using namespace ::TerminalApp;
|
||||
using namespace ::Microsoft::Console;
|
||||
using namespace ::Microsoft::Terminal::Core;
|
||||
@@ -41,19 +41,11 @@ using namespace std::chrono_literals;
|
||||
|
||||
#define HOOKUP_ACTION(action) _actionDispatch->action({ this, &TerminalPage::_Handle##action });
|
||||
|
||||
namespace winrt
|
||||
{
|
||||
namespace MUX = Microsoft::UI::Xaml;
|
||||
namespace WUX = Windows::UI::Xaml;
|
||||
using IInspectable = Windows::Foundation::IInspectable;
|
||||
using VirtualKeyModifiers = Windows::System::VirtualKeyModifiers;
|
||||
}
|
||||
|
||||
namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
TerminalPage::TerminalPage() :
|
||||
_tabs{ winrt::single_threaded_observable_vector<TerminalApp::TabBase>() },
|
||||
_mruTabs{ winrt::single_threaded_observable_vector<TerminalApp::TabBase>() },
|
||||
_tabs{ winrt::single_threaded_observable_vector<MTApp::TabBase>() },
|
||||
_mruTabs{ winrt::single_threaded_observable_vector<MTApp::TabBase>() },
|
||||
_startupActions{ winrt::single_threaded_vector<ActionAndArgs>() },
|
||||
_hostingHwnd{}
|
||||
{
|
||||
@@ -159,11 +151,11 @@ namespace winrt::TerminalApp::implementation
|
||||
auto result = false;
|
||||
|
||||
// GH#2455 - Make sure to try/catch calls to Application::Current,
|
||||
// because that _won't_ be an instance of TerminalApp::App in the
|
||||
// because that _won't_ be an instance of MTApp::App in the
|
||||
// LocalTests
|
||||
try
|
||||
{
|
||||
result = ::winrt::Windows::UI::Xaml::Application::Current().as<::winrt::TerminalApp::App>().Logic().IsElevated();
|
||||
result = WUX::Application::Current().as<MTApp::App>().Logic().IsElevated();
|
||||
}
|
||||
CATCH_LOG();
|
||||
return result;
|
||||
@@ -230,14 +222,14 @@ namespace winrt::TerminalApp::implementation
|
||||
// our TabView, to match the tab.showCloseButton property in the theme.
|
||||
if (const auto theme = _settings.GlobalSettings().CurrentTheme())
|
||||
{
|
||||
const auto visibility = theme.Tab() ? theme.Tab().ShowCloseButton() : Settings::Model::TabCloseButtonVisibility::Always;
|
||||
const auto visibility = theme.Tab() ? theme.Tab().ShowCloseButton() : MTSM::TabCloseButtonVisibility::Always;
|
||||
|
||||
switch (visibility)
|
||||
{
|
||||
case Settings::Model::TabCloseButtonVisibility::Never:
|
||||
case MTSM::TabCloseButtonVisibility::Never:
|
||||
_tabView.CloseButtonOverlayMode(MUX::Controls::TabViewCloseButtonOverlayMode::Auto);
|
||||
break;
|
||||
case Settings::Model::TabCloseButtonVisibility::Hover:
|
||||
case MTSM::TabCloseButtonVisibility::Hover:
|
||||
_tabView.CloseButtonOverlayMode(MUX::Controls::TabViewCloseButtonOverlayMode::OnPointerOver);
|
||||
break;
|
||||
default:
|
||||
@@ -259,7 +251,7 @@ namespace winrt::TerminalApp::implementation
|
||||
page->_OpenNewTerminalViaDropdown(NewTerminalArgs());
|
||||
}
|
||||
});
|
||||
_newTabButton.Drop([weakThis{ get_weak() }](const Windows::Foundation::IInspectable&, winrt::Windows::UI::Xaml::DragEventArgs e) {
|
||||
_newTabButton.Drop([weakThis{ get_weak() }](const WF::IInspectable&, WUX::DragEventArgs e) {
|
||||
if (auto page{ weakThis.get() })
|
||||
{
|
||||
page->NewTerminalByDrop(e);
|
||||
@@ -470,9 +462,9 @@ namespace winrt::TerminalApp::implementation
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
winrt::fire_and_forget TerminalPage::NewTerminalByDrop(winrt::Windows::UI::Xaml::DragEventArgs& e)
|
||||
winrt::fire_and_forget TerminalPage::NewTerminalByDrop(WUX::DragEventArgs& e)
|
||||
{
|
||||
Windows::Foundation::Collections::IVectorView<Windows::Storage::IStorageItem> items;
|
||||
WFC::IVectorView<Windows::Storage::IStorageItem> items;
|
||||
try
|
||||
{
|
||||
items = co_await e.DataView().GetStorageItemsAsync();
|
||||
@@ -507,7 +499,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// - command - command to dispatch
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void TerminalPage::_OnDispatchCommandRequested(const IInspectable& /*sender*/, const Microsoft::Terminal::Settings::Model::Command& command)
|
||||
void TerminalPage::_OnDispatchCommandRequested(const IInspectable& /*sender*/, const MTSM::Command& command)
|
||||
{
|
||||
const auto& actionAndArgs = command.ActionAndArgs();
|
||||
_actionDispatch->DoAction(actionAndArgs);
|
||||
@@ -590,7 +582,7 @@ namespace winrt::TerminalApp::implementation
|
||||
|
||||
try
|
||||
{
|
||||
winrt::Microsoft::Terminal::TerminalConnection::ConptyConnection::StartInboundListener();
|
||||
MTConnection::ConptyConnection::StartInboundListener();
|
||||
}
|
||||
// If we failed to start the listener, it will throw.
|
||||
// We don't want to fail fast here because if a peasant has some trouble with
|
||||
@@ -617,7 +609,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// nt -d .` from inside another directory to work as expected.
|
||||
// Return Value:
|
||||
// - <none>
|
||||
winrt::fire_and_forget TerminalPage::ProcessStartupActions(Windows::Foundation::Collections::IVector<ActionAndArgs> actions,
|
||||
winrt::fire_and_forget TerminalPage::ProcessStartupActions(WFC::IVector<ActionAndArgs> actions,
|
||||
const bool initial,
|
||||
const winrt::hstring cwd)
|
||||
{
|
||||
@@ -731,7 +723,7 @@ namespace winrt::TerminalApp::implementation
|
||||
return CascadiaSettings::ApplicationVersion();
|
||||
}
|
||||
|
||||
void TerminalPage::_SendFeedbackOnClick(const IInspectable& /*sender*/, const Windows::UI::Xaml::Controls::ContentDialogButtonClickEventArgs& /*eventArgs*/)
|
||||
void TerminalPage::_SendFeedbackOnClick(const IInspectable& /*sender*/, const WUXC::ContentDialogButtonClickEventArgs& /*eventArgs*/)
|
||||
{
|
||||
#if defined(WT_BRANDING_RELEASE)
|
||||
ShellExecute(nullptr, nullptr, L"https://go.microsoft.com/fwlink/?linkid=2125419", nullptr, nullptr, SW_SHOW);
|
||||
@@ -740,7 +732,7 @@ namespace winrt::TerminalApp::implementation
|
||||
#endif
|
||||
}
|
||||
|
||||
void TerminalPage::_ThirdPartyNoticesOnClick(const IInspectable& /*sender*/, const Windows::UI::Xaml::RoutedEventArgs& /*eventArgs*/)
|
||||
void TerminalPage::_ThirdPartyNoticesOnClick(const IInspectable& /*sender*/, const WUX::RoutedEventArgs& /*eventArgs*/)
|
||||
{
|
||||
std::filesystem::path currentPath{ wil::GetModuleFileNameW<std::wstring>(nullptr) };
|
||||
currentPath.replace_filename(L"NOTICE.html");
|
||||
@@ -750,7 +742,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// Method Description:
|
||||
// - Helper to show a content dialog
|
||||
// - We only open a content dialog if there isn't one open already
|
||||
winrt::Windows::Foundation::IAsyncOperation<ContentDialogResult> TerminalPage::_ShowDialogHelper(const std::wstring_view& name)
|
||||
WF::IAsyncOperation<ContentDialogResult> TerminalPage::_ShowDialogHelper(const std::wstring_view& name)
|
||||
{
|
||||
if (auto presenter{ _dialogPresenter.get() })
|
||||
{
|
||||
@@ -765,7 +757,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// If cancel is clicked, the dialog will close.
|
||||
// - Only one dialog can be visible at a time. If another dialog is visible
|
||||
// when this is called, nothing happens. See _ShowDialog for details
|
||||
winrt::Windows::Foundation::IAsyncOperation<ContentDialogResult> TerminalPage::_ShowQuitDialog()
|
||||
WF::IAsyncOperation<ContentDialogResult> TerminalPage::_ShowQuitDialog()
|
||||
{
|
||||
return _ShowDialogHelper(L"QuitDialog");
|
||||
}
|
||||
@@ -777,14 +769,14 @@ namespace winrt::TerminalApp::implementation
|
||||
// all the tabs and shut down and app. If cancel is clicked, the dialog will close
|
||||
// - Only one dialog can be visible at a time. If another dialog is visible
|
||||
// when this is called, nothing happens. See _ShowDialog for details
|
||||
winrt::Windows::Foundation::IAsyncOperation<ContentDialogResult> TerminalPage::_ShowCloseWarningDialog()
|
||||
WF::IAsyncOperation<ContentDialogResult> TerminalPage::_ShowCloseWarningDialog()
|
||||
{
|
||||
return _ShowDialogHelper(L"CloseAllDialog");
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
// - Displays a dialog for warnings found while closing the terminal tab marked as read-only
|
||||
winrt::Windows::Foundation::IAsyncOperation<ContentDialogResult> TerminalPage::_ShowCloseReadOnlyDialog()
|
||||
WF::IAsyncOperation<ContentDialogResult> TerminalPage::_ShowCloseReadOnlyDialog()
|
||||
{
|
||||
return _ShowDialogHelper(L"CloseReadOnlyDialog");
|
||||
}
|
||||
@@ -797,7 +789,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// of a command.
|
||||
// - Only one dialog can be visible at a time. If another dialog is visible
|
||||
// when this is called, nothing happens. See _ShowDialog for details
|
||||
winrt::Windows::Foundation::IAsyncOperation<ContentDialogResult> TerminalPage::_ShowMultiLinePasteWarningDialog()
|
||||
WF::IAsyncOperation<ContentDialogResult> TerminalPage::_ShowMultiLinePasteWarningDialog()
|
||||
{
|
||||
return _ShowDialogHelper(L"MultiLinePasteDialog");
|
||||
}
|
||||
@@ -808,7 +800,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// paste it but pressed the paste shortcut by accident.
|
||||
// - Only one dialog can be visible at a time. If another dialog is visible
|
||||
// when this is called, nothing happens. See _ShowDialog for details
|
||||
winrt::Windows::Foundation::IAsyncOperation<ContentDialogResult> TerminalPage::_ShowLargePasteWarningDialog()
|
||||
WF::IAsyncOperation<ContentDialogResult> TerminalPage::_ShowLargePasteWarningDialog()
|
||||
{
|
||||
return _ShowDialogHelper(L"LargePasteDialog");
|
||||
}
|
||||
@@ -841,12 +833,12 @@ namespace winrt::TerminalApp::implementation
|
||||
// add static items
|
||||
{
|
||||
// GH#2455 - Make sure to try/catch calls to Application::Current,
|
||||
// because that _won't_ be an instance of TerminalApp::App in the
|
||||
// because that _won't_ be an instance of MTApp::App in the
|
||||
// LocalTests
|
||||
auto isUwp = false;
|
||||
try
|
||||
{
|
||||
isUwp = ::winrt::Windows::UI::Xaml::Application::Current().as<::winrt::TerminalApp::App>().Logic().IsUwp();
|
||||
isUwp = WUX::Application::Current().as<MTApp::App>().Logic().IsUwp();
|
||||
}
|
||||
CATCH_LOG();
|
||||
|
||||
@@ -1219,7 +1211,7 @@ namespace winrt::TerminalApp::implementation
|
||||
}
|
||||
}
|
||||
|
||||
winrt::fire_and_forget TerminalPage::_RemoveOnCloseRoutine(Microsoft::UI::Xaml::Controls::TabViewItem tabViewItem, winrt::com_ptr<TerminalPage> page)
|
||||
winrt::fire_and_forget TerminalPage::_RemoveOnCloseRoutine(MUXC::TabViewItem tabViewItem, winrt::com_ptr<TerminalPage> page)
|
||||
{
|
||||
co_await wil::resume_foreground(page->_tabView.Dispatcher());
|
||||
|
||||
@@ -1236,32 +1228,32 @@ namespace winrt::TerminalApp::implementation
|
||||
// - the terminal settings
|
||||
// Return value:
|
||||
// - the desired connection
|
||||
TerminalConnection::ITerminalConnection TerminalPage::_CreateConnectionFromSettings(Profile profile,
|
||||
TerminalSettings settings)
|
||||
MTConnection::ITerminalConnection TerminalPage::_CreateConnectionFromSettings(Profile profile,
|
||||
TerminalSettings settings)
|
||||
{
|
||||
TerminalConnection::ITerminalConnection connection{ nullptr };
|
||||
MTConnection::ITerminalConnection connection{ nullptr };
|
||||
|
||||
auto connectionType = profile.ConnectionType();
|
||||
winrt::guid sessionGuid{};
|
||||
|
||||
if (connectionType == TerminalConnection::AzureConnection::ConnectionType() &&
|
||||
TerminalConnection::AzureConnection::IsAzureConnectionAvailable())
|
||||
if (connectionType == MTConnection::AzureConnection::ConnectionType() &&
|
||||
MTConnection::AzureConnection::IsAzureConnectionAvailable())
|
||||
{
|
||||
// TODO GH#4661: Replace this with directly using the AzCon when our VT is better
|
||||
std::filesystem::path azBridgePath{ wil::GetModuleFileNameW<std::wstring>(nullptr) };
|
||||
azBridgePath.replace_filename(L"TerminalAzBridge.exe");
|
||||
connection = TerminalConnection::ConptyConnection();
|
||||
auto valueSet = TerminalConnection::ConptyConnection::CreateSettings(azBridgePath.wstring(),
|
||||
L".",
|
||||
L"Azure",
|
||||
nullptr,
|
||||
settings.InitialRows(),
|
||||
settings.InitialCols(),
|
||||
winrt::guid());
|
||||
connection = MTConnection::ConptyConnection();
|
||||
auto valueSet = MTConnection::ConptyConnection::CreateSettings(azBridgePath.wstring(),
|
||||
L".",
|
||||
L"Azure",
|
||||
nullptr,
|
||||
settings.InitialRows(),
|
||||
settings.InitialCols(),
|
||||
winrt::guid());
|
||||
|
||||
if constexpr (Feature_VtPassthroughMode::IsEnabled())
|
||||
{
|
||||
valueSet.Insert(L"passthroughMode", Windows::Foundation::PropertyValue::CreateBoolean(settings.VtPassthrough()));
|
||||
valueSet.Insert(L"passthroughMode", WF::PropertyValue::CreateBoolean(settings.VtPassthrough()));
|
||||
}
|
||||
|
||||
connection.Initialize(valueSet);
|
||||
@@ -1301,16 +1293,16 @@ namespace winrt::TerminalApp::implementation
|
||||
newWorkingDirectory = winrt::hstring{ cwd.wstring() };
|
||||
}
|
||||
|
||||
auto conhostConn = TerminalConnection::ConptyConnection();
|
||||
auto valueSet = TerminalConnection::ConptyConnection::CreateSettings(settings.Commandline(),
|
||||
newWorkingDirectory,
|
||||
settings.StartingTitle(),
|
||||
envMap.GetView(),
|
||||
settings.InitialRows(),
|
||||
settings.InitialCols(),
|
||||
winrt::guid());
|
||||
auto conhostConn = MTConnection::ConptyConnection();
|
||||
auto valueSet = MTConnection::ConptyConnection::CreateSettings(settings.Commandline(),
|
||||
newWorkingDirectory,
|
||||
settings.StartingTitle(),
|
||||
envMap.GetView(),
|
||||
settings.InitialRows(),
|
||||
settings.InitialCols(),
|
||||
winrt::guid());
|
||||
|
||||
valueSet.Insert(L"passthroughMode", Windows::Foundation::PropertyValue::CreateBoolean(settings.VtPassthrough()));
|
||||
valueSet.Insert(L"passthroughMode", WF::PropertyValue::CreateBoolean(settings.VtPassthrough()));
|
||||
|
||||
conhostConn.Initialize(valueSet);
|
||||
|
||||
@@ -1403,7 +1395,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// - e: the KeyRoutedEventArgs containing info about the keystroke.
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void TerminalPage::_KeyDownHandler(const Windows::Foundation::IInspectable& /*sender*/, const Windows::UI::Xaml::Input::KeyRoutedEventArgs& e)
|
||||
void TerminalPage::_KeyDownHandler(const WF::IInspectable& /*sender*/, const WUX::Input::KeyRoutedEventArgs& e)
|
||||
{
|
||||
const auto keyStatus = e.KeyStatus();
|
||||
const auto vkey = gsl::narrow_cast<WORD>(e.OriginalKey());
|
||||
@@ -1863,7 +1855,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// Only save the content size because the tab size will be added on load.
|
||||
const auto contentWidth = ::base::saturated_cast<float>(_tabContent.ActualWidth());
|
||||
const auto contentHeight = ::base::saturated_cast<float>(_tabContent.ActualHeight());
|
||||
const winrt::Windows::Foundation::Size windowSize{ contentWidth, contentHeight };
|
||||
const WF::Size windowSize{ contentWidth, contentHeight };
|
||||
|
||||
layout.InitialSize(windowSize);
|
||||
|
||||
@@ -1911,7 +1903,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// Arguments:
|
||||
// - scrollDirection: ScrollUp will move the viewport up, ScrollDown will move the viewport down
|
||||
// - rowsToScroll: a number of lines to move the viewport. If not provided we will use a system default.
|
||||
void TerminalPage::_Scroll(ScrollDirection scrollDirection, const Windows::Foundation::IReference<uint32_t>& rowsToScroll)
|
||||
void TerminalPage::_Scroll(ScrollDirection scrollDirection, const WF::IReference<uint32_t>& rowsToScroll)
|
||||
{
|
||||
if (const auto terminalTab{ _GetFocusedTabImpl() })
|
||||
{
|
||||
@@ -2054,7 +2046,7 @@ namespace winrt::TerminalApp::implementation
|
||||
}
|
||||
const auto contentWidth = ::base::saturated_cast<float>(_tabContent.ActualWidth());
|
||||
const auto contentHeight = ::base::saturated_cast<float>(_tabContent.ActualHeight());
|
||||
const winrt::Windows::Foundation::Size availableSpace{ contentWidth, contentHeight };
|
||||
const WF::Size availableSpace{ contentWidth, contentHeight };
|
||||
|
||||
const auto realSplitType = tab.PreCalculateCanSplit(splitDirection, splitSize, availableSpace);
|
||||
if (!realSplitType)
|
||||
@@ -2171,26 +2163,26 @@ namespace winrt::TerminalApp::implementation
|
||||
// Return Value:
|
||||
// - a string representation of the key modifiers for the shortcut
|
||||
//NOTE: This needs to be localized with https://github.com/microsoft/terminal/issues/794 if XAML framework issue not resolved before then
|
||||
static std::wstring _FormatOverrideShortcutText(VirtualKeyModifiers modifiers)
|
||||
static std::wstring _FormatOverrideShortcutText(WS::VirtualKeyModifiers modifiers)
|
||||
{
|
||||
std::wstring buffer{ L"" };
|
||||
|
||||
if (WI_IsFlagSet(modifiers, VirtualKeyModifiers::Control))
|
||||
if (WI_IsFlagSet(modifiers, WS::VirtualKeyModifiers::Control))
|
||||
{
|
||||
buffer += L"Ctrl+";
|
||||
}
|
||||
|
||||
if (WI_IsFlagSet(modifiers, VirtualKeyModifiers::Shift))
|
||||
if (WI_IsFlagSet(modifiers, WS::VirtualKeyModifiers::Shift))
|
||||
{
|
||||
buffer += L"Shift+";
|
||||
}
|
||||
|
||||
if (WI_IsFlagSet(modifiers, VirtualKeyModifiers::Menu))
|
||||
if (WI_IsFlagSet(modifiers, WS::VirtualKeyModifiers::Menu))
|
||||
{
|
||||
buffer += L"Alt+";
|
||||
}
|
||||
|
||||
if (WI_IsFlagSet(modifiers, VirtualKeyModifiers::Windows))
|
||||
if (WI_IsFlagSet(modifiers, WS::VirtualKeyModifiers::Windows))
|
||||
{
|
||||
buffer += L"Win+";
|
||||
}
|
||||
@@ -2211,10 +2203,10 @@ namespace winrt::TerminalApp::implementation
|
||||
if (keyChord.Vkey() != VK_OEM_COMMA)
|
||||
{
|
||||
// use the XAML shortcut to give us the automatic capabilities
|
||||
auto menuShortcut = Windows::UI::Xaml::Input::KeyboardAccelerator{};
|
||||
auto menuShortcut = WUX::Input::KeyboardAccelerator{};
|
||||
|
||||
// TODO: Modify this when https://github.com/microsoft/terminal/issues/877 is resolved
|
||||
menuShortcut.Key(static_cast<Windows::System::VirtualKey>(keyChord.Vkey()));
|
||||
menuShortcut.Key(static_cast<WS::VirtualKey>(keyChord.Vkey()));
|
||||
|
||||
// add the modifiers to the shortcut
|
||||
menuShortcut.Modifiers(keyChord.Modifiers());
|
||||
@@ -2403,11 +2395,11 @@ namespace winrt::TerminalApp::implementation
|
||||
CATCH_LOG();
|
||||
}
|
||||
|
||||
void TerminalPage::_OpenHyperlinkHandler(const IInspectable /*sender*/, const Microsoft::Terminal::Control::OpenHyperlinkEventArgs eventArgs)
|
||||
void TerminalPage::_OpenHyperlinkHandler(const IInspectable /*sender*/, const MTControl::OpenHyperlinkEventArgs eventArgs)
|
||||
{
|
||||
try
|
||||
{
|
||||
auto parsed = winrt::Windows::Foundation::Uri(eventArgs.Uri().c_str());
|
||||
auto parsed = WF::Uri(eventArgs.Uri().c_str());
|
||||
if (_IsUriSupported(parsed))
|
||||
{
|
||||
ShellExecute(nullptr, L"open", eventArgs.Uri().c_str(), nullptr, nullptr, SW_SHOWNORMAL);
|
||||
@@ -2451,7 +2443,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// - The parsed URI
|
||||
// Return value:
|
||||
// - True if we support it, false otherwise
|
||||
bool TerminalPage::_IsUriSupported(const winrt::Windows::Foundation::Uri& parsedUri)
|
||||
bool TerminalPage::_IsUriSupported(const WF::Uri& parsedUri)
|
||||
{
|
||||
if (parsedUri.SchemeName() == L"http" || parsedUri.SchemeName() == L"https")
|
||||
{
|
||||
@@ -2479,7 +2471,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// Important! Don't take this eventArgs by reference, we need to extend the
|
||||
// lifetime of it to the other side of the co_await!
|
||||
winrt::fire_and_forget TerminalPage::_ControlNoticeRaisedHandler(const IInspectable /*sender*/,
|
||||
const Microsoft::Terminal::Control::NoticeEventArgs eventArgs)
|
||||
const MTControl::NoticeEventArgs eventArgs)
|
||||
{
|
||||
auto weakThis = get_weak();
|
||||
co_await wil::resume_foreground(Dispatcher());
|
||||
@@ -2533,7 +2525,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// - formats: dictate which formats need to be copied
|
||||
// Return Value:
|
||||
// - true iff we we able to copy text (if a selection was active)
|
||||
bool TerminalPage::_CopyText(const bool singleLine, const Windows::Foundation::IReference<CopyFormat>& formats)
|
||||
bool TerminalPage::_CopyText(const bool singleLine, const WF::IReference<CopyFormat>& formats)
|
||||
{
|
||||
if (const auto& control{ _GetActiveControl() })
|
||||
{
|
||||
@@ -2558,7 +2550,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// Arguments:
|
||||
// - sender (not used)
|
||||
// - args: the arguments specifying how to set the display status to ShowWindow for our window handle
|
||||
winrt::fire_and_forget TerminalPage::_ShowWindowChangedHandler(const IInspectable /*sender*/, const Microsoft::Terminal::Control::ShowWindowArgs args)
|
||||
winrt::fire_and_forget TerminalPage::_ShowWindowChangedHandler(const IInspectable /*sender*/, const MTControl::ShowWindowArgs args)
|
||||
{
|
||||
co_await resume_foreground(Dispatcher());
|
||||
_ShowWindowChangedHandlers(*this, args);
|
||||
@@ -2670,8 +2662,8 @@ namespace winrt::TerminalApp::implementation
|
||||
// connection, then we'll return nullptr. Otherwise, we'll return a new
|
||||
// Pane for this connection.
|
||||
std::shared_ptr<Pane> TerminalPage::_MakePane(const NewTerminalArgs& newTerminalArgs,
|
||||
const winrt::TerminalApp::TabBase& sourceTab,
|
||||
TerminalConnection::ITerminalConnection existingConnection)
|
||||
const MTApp::TabBase& sourceTab,
|
||||
MTConnection::ITerminalConnection existingConnection)
|
||||
{
|
||||
TerminalSettingsCreateResult controlSettings{ nullptr };
|
||||
Profile profile{ nullptr };
|
||||
@@ -2710,7 +2702,7 @@ namespace winrt::TerminalApp::implementation
|
||||
connection.Resize(controlSettings.DefaultSettings().InitialRows(), controlSettings.DefaultSettings().InitialCols());
|
||||
}
|
||||
|
||||
TerminalConnection::ITerminalConnection debugConnection{ nullptr };
|
||||
MTConnection::ITerminalConnection debugConnection{ nullptr };
|
||||
if (_settings.GlobalSettings().DebugFeaturesEnabled())
|
||||
{
|
||||
const auto window = CoreWindow::GetForCurrentThread();
|
||||
@@ -2758,7 +2750,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// - newAppearance
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void TerminalPage::_SetBackgroundImage(const winrt::Microsoft::Terminal::Settings::Model::IAppearanceConfig& newAppearance)
|
||||
void TerminalPage::_SetBackgroundImage(const MTSM::IAppearanceConfig& newAppearance)
|
||||
{
|
||||
if (!_settings.GlobalSettings().UseBackgroundImageForWindow())
|
||||
{
|
||||
@@ -2773,10 +2765,10 @@ namespace winrt::TerminalApp::implementation
|
||||
return;
|
||||
}
|
||||
|
||||
Windows::Foundation::Uri imageUri{ nullptr };
|
||||
WF::Uri imageUri{ nullptr };
|
||||
try
|
||||
{
|
||||
imageUri = Windows::Foundation::Uri{ path };
|
||||
imageUri = WF::Uri{ path };
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
@@ -2880,7 +2872,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// Force the TerminalTab to re-grab its currently active control's title.
|
||||
terminalTab->UpdateTitle();
|
||||
}
|
||||
else if (auto settingsTab = tab.try_as<TerminalApp::SettingsTab>())
|
||||
else if (auto settingsTab = tab.try_as<MTApp::SettingsTab>())
|
||||
{
|
||||
settingsTab.UpdateSettings(_settings);
|
||||
}
|
||||
@@ -2932,16 +2924,16 @@ namespace winrt::TerminalApp::implementation
|
||||
// at once
|
||||
if (const auto theme = _settings.GlobalSettings().CurrentTheme())
|
||||
{
|
||||
const auto visibility = theme.Tab() ? theme.Tab().ShowCloseButton() : Settings::Model::TabCloseButtonVisibility::Always;
|
||||
const auto visibility = theme.Tab() ? theme.Tab().ShowCloseButton() : MTSM::TabCloseButtonVisibility::Always;
|
||||
|
||||
for (const auto& tab : _tabs)
|
||||
{
|
||||
switch (visibility)
|
||||
{
|
||||
case Settings::Model::TabCloseButtonVisibility::Never:
|
||||
case MTSM::TabCloseButtonVisibility::Never:
|
||||
tab.TabViewItem().IsClosable(false);
|
||||
break;
|
||||
case Settings::Model::TabCloseButtonVisibility::Hover:
|
||||
case MTSM::TabCloseButtonVisibility::Hover:
|
||||
tab.TabViewItem().IsClosable(true);
|
||||
break;
|
||||
default:
|
||||
@@ -2952,10 +2944,10 @@ namespace winrt::TerminalApp::implementation
|
||||
|
||||
switch (visibility)
|
||||
{
|
||||
case Settings::Model::TabCloseButtonVisibility::Never:
|
||||
case MTSM::TabCloseButtonVisibility::Never:
|
||||
_tabView.CloseButtonOverlayMode(MUX::Controls::TabViewCloseButtonOverlayMode::Auto);
|
||||
break;
|
||||
case Settings::Model::TabCloseButtonVisibility::Hover:
|
||||
case MTSM::TabCloseButtonVisibility::Hover:
|
||||
_tabView.CloseButtonOverlayMode(MUX::Controls::TabViewCloseButtonOverlayMode::OnPointerOver);
|
||||
break;
|
||||
default:
|
||||
@@ -3073,12 +3065,12 @@ namespace winrt::TerminalApp::implementation
|
||||
}
|
||||
}
|
||||
|
||||
winrt::TerminalApp::IDialogPresenter TerminalPage::DialogPresenter() const
|
||||
MTApp::IDialogPresenter TerminalPage::DialogPresenter() const
|
||||
{
|
||||
return _dialogPresenter.get();
|
||||
}
|
||||
|
||||
void TerminalPage::DialogPresenter(winrt::TerminalApp::IDialogPresenter dialogPresenter)
|
||||
void TerminalPage::DialogPresenter(MTApp::IDialogPresenter dialogPresenter)
|
||||
{
|
||||
_dialogPresenter = dialogPresenter;
|
||||
}
|
||||
@@ -3095,9 +3087,9 @@ namespace winrt::TerminalApp::implementation
|
||||
// Return Value:
|
||||
// - A TaskbarState object representing the combined taskbar state and
|
||||
// progress percentage of all our tabs.
|
||||
winrt::TerminalApp::TaskbarState TerminalPage::TaskbarState() const
|
||||
MTApp::TaskbarState TerminalPage::TaskbarState() const
|
||||
{
|
||||
auto state{ winrt::make<winrt::TerminalApp::implementation::TaskbarState>() };
|
||||
auto state{ winrt::make<MTApp::implementation::TaskbarState>() };
|
||||
|
||||
for (const auto& tab : _tabs)
|
||||
{
|
||||
@@ -3329,8 +3321,8 @@ namespace winrt::TerminalApp::implementation
|
||||
|
||||
const auto defaultBackgroundKey = winrt::box_value(L"TabViewItemHeaderBackground");
|
||||
const auto defaultForegroundKey = winrt::box_value(L"SystemControlForegroundBaseHighBrush");
|
||||
winrt::Windows::UI::Xaml::Media::SolidColorBrush backgroundBrush;
|
||||
winrt::Windows::UI::Xaml::Media::SolidColorBrush foregroundBrush;
|
||||
WUXMedia::SolidColorBrush backgroundBrush;
|
||||
WUXMedia::SolidColorBrush foregroundBrush;
|
||||
|
||||
// TODO: Related to GH#3917 - I think if the system is set to "Dark"
|
||||
// theme, but the app is set to light theme, then this lookup still
|
||||
@@ -3340,21 +3332,21 @@ namespace winrt::TerminalApp::implementation
|
||||
if (res.HasKey(defaultBackgroundKey))
|
||||
{
|
||||
auto obj = res.Lookup(defaultBackgroundKey);
|
||||
backgroundBrush = obj.try_as<winrt::Windows::UI::Xaml::Media::SolidColorBrush>();
|
||||
backgroundBrush = obj.try_as<WUXMedia::SolidColorBrush>();
|
||||
}
|
||||
else
|
||||
{
|
||||
backgroundBrush = winrt::Windows::UI::Xaml::Media::SolidColorBrush{ winrt::Windows::UI::Colors::Black() };
|
||||
backgroundBrush = WUXMedia::SolidColorBrush{ winrt::Windows::UI::Colors::Black() };
|
||||
}
|
||||
|
||||
if (res.HasKey(defaultForegroundKey))
|
||||
{
|
||||
auto obj = res.Lookup(defaultForegroundKey);
|
||||
foregroundBrush = obj.try_as<winrt::Windows::UI::Xaml::Media::SolidColorBrush>();
|
||||
foregroundBrush = obj.try_as<WUXMedia::SolidColorBrush>();
|
||||
}
|
||||
else
|
||||
{
|
||||
foregroundBrush = winrt::Windows::UI::Xaml::Media::SolidColorBrush{ winrt::Windows::UI::Colors::White() };
|
||||
foregroundBrush = WUXMedia::SolidColorBrush{ winrt::Windows::UI::Colors::White() };
|
||||
}
|
||||
|
||||
_newTabButton.Background(backgroundBrush);
|
||||
@@ -3525,7 +3517,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// GH#8767 - let unhandled keys in the SUI try to run commands too.
|
||||
sui.KeyDown({ this, &TerminalPage::_KeyDownHandler });
|
||||
|
||||
sui.OpenJson([weakThis{ get_weak() }](auto&& /*s*/, winrt::Microsoft::Terminal::Settings::Model::SettingsTarget e) {
|
||||
sui.OpenJson([weakThis{ get_weak() }](auto&& /*s*/, MTSM::SettingsTarget e) {
|
||||
if (auto page{ weakThis.get() })
|
||||
{
|
||||
page->_LaunchSettings(e);
|
||||
@@ -3596,9 +3588,9 @@ namespace winrt::TerminalApp::implementation
|
||||
// Return Value:
|
||||
// - If the tab is a TerminalTab, a com_ptr to the implementation type.
|
||||
// If the tab is not a TerminalTab, nullptr
|
||||
winrt::com_ptr<TerminalTab> TerminalPage::_GetTerminalTabImpl(const TerminalApp::TabBase& tab)
|
||||
winrt::com_ptr<TerminalTab> TerminalPage::_GetTerminalTabImpl(const MTApp::TabBase& tab)
|
||||
{
|
||||
if (auto terminalTab = tab.try_as<TerminalApp::TerminalTab>())
|
||||
if (auto terminalTab = tab.try_as<MTApp::TerminalTab>())
|
||||
{
|
||||
winrt::com_ptr<TerminalTab> tabImpl;
|
||||
tabImpl.copy_from(winrt::get_self<TerminalTab>(terminalTab));
|
||||
@@ -3661,10 +3653,10 @@ namespace winrt::TerminalApp::implementation
|
||||
// - Displays a info popup guiding the user into setting their default terminal.
|
||||
void TerminalPage::ShowSetAsDefaultInfoBar() const
|
||||
{
|
||||
if (::winrt::Windows::UI::Xaml::Application::Current().try_as<::winrt::TerminalApp::App>() == nullptr)
|
||||
if (WUX::Application::Current().try_as<MTApp::App>() == nullptr)
|
||||
{
|
||||
// Just ignore this in the tests (where the Application::Current()
|
||||
// is not a TerminalApp::App)
|
||||
// is not a MTApp::App)
|
||||
return;
|
||||
}
|
||||
if (!CascadiaSettings::IsDefaultTerminalAvailable() || _IsMessageDismissed(InfoBarMessage::SetAsDefault))
|
||||
@@ -3697,7 +3689,7 @@ namespace winrt::TerminalApp::implementation
|
||||
auto isUwp = false;
|
||||
try
|
||||
{
|
||||
isUwp = ::winrt::Windows::UI::Xaml::Application::Current().as<::winrt::TerminalApp::App>().Logic().IsUwp();
|
||||
isUwp = WUX::Application::Current().as<MTApp::App>().Logic().IsUwp();
|
||||
}
|
||||
CATCH_LOG();
|
||||
|
||||
@@ -3800,14 +3792,14 @@ namespace winrt::TerminalApp::implementation
|
||||
// - element: The TeachingTip to set the theme on.
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void TerminalPage::_UpdateTeachingTipTheme(winrt::Windows::UI::Xaml::FrameworkElement element)
|
||||
void TerminalPage::_UpdateTeachingTipTheme(WUX::FrameworkElement element)
|
||||
{
|
||||
auto theme{ _settings.GlobalSettings().CurrentTheme() };
|
||||
auto requestedTheme{ theme.RequestedTheme() };
|
||||
while (element)
|
||||
{
|
||||
element.RequestedTheme(requestedTheme);
|
||||
element = element.Parent().try_as<winrt::Windows::UI::Xaml::FrameworkElement>();
|
||||
element = element.Parent().try_as<WUX::FrameworkElement>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3840,7 +3832,7 @@ namespace winrt::TerminalApp::implementation
|
||||
tip.Closed({ page->get_weak(), &TerminalPage::_FocusActiveControl });
|
||||
}
|
||||
}
|
||||
_UpdateTeachingTipTheme(WindowIdToast().try_as<winrt::Windows::UI::Xaml::FrameworkElement>());
|
||||
_UpdateTeachingTipTheme(WindowIdToast().try_as<WUX::FrameworkElement>());
|
||||
|
||||
if (page->_windowIdToast != nullptr)
|
||||
{
|
||||
@@ -3975,7 +3967,7 @@ namespace winrt::TerminalApp::implementation
|
||||
tip.Closed({ page->get_weak(), &TerminalPage::_FocusActiveControl });
|
||||
}
|
||||
}
|
||||
_UpdateTeachingTipTheme(RenameFailedToast().try_as<winrt::Windows::UI::Xaml::FrameworkElement>());
|
||||
_UpdateTeachingTipTheme(RenameFailedToast().try_as<WUX::FrameworkElement>());
|
||||
|
||||
if (page->_windowRenameFailedToast != nullptr)
|
||||
{
|
||||
@@ -4031,10 +4023,10 @@ namespace winrt::TerminalApp::implementation
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void TerminalPage::_WindowRenamerKeyDown(const IInspectable& /*sender*/,
|
||||
const winrt::Windows::UI::Xaml::Input::KeyRoutedEventArgs& e)
|
||||
const WUX::Input::KeyRoutedEventArgs& e)
|
||||
{
|
||||
const auto key = e.OriginalKey();
|
||||
if (key == Windows::System::VirtualKey::Enter)
|
||||
if (key == WS::VirtualKey::Enter)
|
||||
{
|
||||
_renamerPressedEnter = true;
|
||||
}
|
||||
@@ -4048,15 +4040,15 @@ namespace winrt::TerminalApp::implementation
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void TerminalPage::_WindowRenamerKeyUp(const IInspectable& sender,
|
||||
const winrt::Windows::UI::Xaml::Input::KeyRoutedEventArgs& e)
|
||||
const WUX::Input::KeyRoutedEventArgs& e)
|
||||
{
|
||||
const auto key = e.OriginalKey();
|
||||
if (key == Windows::System::VirtualKey::Enter && _renamerPressedEnter)
|
||||
if (key == WS::VirtualKey::Enter && _renamerPressedEnter)
|
||||
{
|
||||
// User is done making changes, close the rename box
|
||||
_WindowRenamerActionClick(sender, nullptr);
|
||||
}
|
||||
else if (key == Windows::System::VirtualKey::Escape)
|
||||
else if (key == WS::VirtualKey::Escape)
|
||||
{
|
||||
// User wants to discard the changes they made
|
||||
WindowRenamerTextBox().Text(WindowName());
|
||||
@@ -4184,7 +4176,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// - <none>
|
||||
winrt::fire_and_forget TerminalPage::_ConnectionStateChangedHandler(const IInspectable& sender, const IInspectable& /*args*/) const
|
||||
{
|
||||
if (const auto coreState{ sender.try_as<winrt::Microsoft::Terminal::Control::ICoreState>() })
|
||||
if (const auto coreState{ sender.try_as<MTControl::ICoreState>() })
|
||||
{
|
||||
const auto newConnectionState = coreState.ConnectionState();
|
||||
if (newConnectionState == ConnectionState::Failed && !_IsMessageDismissed(InfoBarMessage::CloseOnExitInfo))
|
||||
@@ -4363,7 +4355,7 @@ namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
return control.BackgroundBrush();
|
||||
}
|
||||
else if (auto settingsTab = _GetFocusedTab().try_as<TerminalApp::SettingsTab>())
|
||||
else if (auto settingsTab = _GetFocusedTab().try_as<MTApp::SettingsTab>())
|
||||
{
|
||||
return settingsTab.Content().try_as<Settings::Editor::MainPage>().BackgroundBrush();
|
||||
}
|
||||
@@ -4406,13 +4398,13 @@ namespace winrt::TerminalApp::implementation
|
||||
_SetNewTabButtonColor(bgColor, bgColor);
|
||||
}
|
||||
|
||||
void TerminalPage::_updateTabCloseButton(const winrt::Microsoft::UI::Xaml::Controls::TabViewItem& tabViewItem)
|
||||
void TerminalPage::_updateTabCloseButton(const MUXC::TabViewItem& tabViewItem)
|
||||
{
|
||||
// Update the state of the close button to match the current theme.
|
||||
// IMPORTANT: Should be called AFTER the tab view item is added to the TabView.
|
||||
if (const auto theme = _settings.GlobalSettings().CurrentTheme())
|
||||
{
|
||||
const auto visibility = theme.Tab() ? theme.Tab().ShowCloseButton() : Settings::Model::TabCloseButtonVisibility::Always;
|
||||
const auto visibility = theme.Tab() ? theme.Tab().ShowCloseButton() : MTSM::TabCloseButtonVisibility::Always;
|
||||
|
||||
// Update both the tab item's IsClosable, but also the TabView's
|
||||
// CloseButtonOverlayMode here. Because the TabViewItem was created
|
||||
@@ -4422,11 +4414,11 @@ namespace winrt::TerminalApp::implementation
|
||||
// TabView will re-apply the value.
|
||||
switch (visibility)
|
||||
{
|
||||
case Settings::Model::TabCloseButtonVisibility::Never:
|
||||
case MTSM::TabCloseButtonVisibility::Never:
|
||||
tabViewItem.IsClosable(false);
|
||||
_tabView.CloseButtonOverlayMode(MUX::Controls::TabViewCloseButtonOverlayMode::Auto);
|
||||
break;
|
||||
case Settings::Model::TabCloseButtonVisibility::Hover:
|
||||
case MTSM::TabCloseButtonVisibility::Hover:
|
||||
tabViewItem.IsClosable(true);
|
||||
_tabView.CloseButtonOverlayMode(MUX::Controls::TabViewCloseButtonOverlayMode::OnPointerOver);
|
||||
break;
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include "RenameWindowRequestedArgs.g.h"
|
||||
#include "Toast.h"
|
||||
|
||||
#define DECLARE_ACTION_HANDLER(action) void _Handle##action(const IInspectable& sender, const Microsoft::Terminal::Settings::Model::ActionEventArgs& args);
|
||||
#define DECLARE_ACTION_HANDLER(action) void _Handle##action(const IInspectable& sender, const MTSM::ActionEventArgs& args);
|
||||
|
||||
static constexpr uint32_t DefaultRowsToScroll{ 3 };
|
||||
static constexpr std::wstring_view TabletInputServiceKey{ L"TabletInputService" };
|
||||
@@ -59,18 +59,18 @@ namespace winrt::TerminalApp::implementation
|
||||
// put it in our inheritance graph. https://github.com/microsoft/microsoft-ui-xaml/issues/3331
|
||||
STDMETHODIMP Initialize(HWND hwnd);
|
||||
|
||||
void SetSettings(Microsoft::Terminal::Settings::Model::CascadiaSettings settings, bool needRefreshUI);
|
||||
void SetSettings(MTSM::CascadiaSettings settings, bool needRefreshUI);
|
||||
|
||||
void Create();
|
||||
|
||||
bool ShouldUsePersistedLayout(Microsoft::Terminal::Settings::Model::CascadiaSettings& settings) const;
|
||||
bool ShouldImmediatelyHandoffToElevated(const Microsoft::Terminal::Settings::Model::CascadiaSettings& settings) const;
|
||||
void HandoffToElevated(const Microsoft::Terminal::Settings::Model::CascadiaSettings& settings);
|
||||
std::optional<uint32_t> LoadPersistedLayoutIdx(Microsoft::Terminal::Settings::Model::CascadiaSettings& settings) const;
|
||||
winrt::Microsoft::Terminal::Settings::Model::WindowLayout LoadPersistedLayout(Microsoft::Terminal::Settings::Model::CascadiaSettings& settings) const;
|
||||
Microsoft::Terminal::Settings::Model::WindowLayout GetWindowLayout();
|
||||
bool ShouldUsePersistedLayout(MTSM::CascadiaSettings& settings) const;
|
||||
bool ShouldImmediatelyHandoffToElevated(const MTSM::CascadiaSettings& settings) const;
|
||||
void HandoffToElevated(const MTSM::CascadiaSettings& settings);
|
||||
std::optional<uint32_t> LoadPersistedLayoutIdx(MTSM::CascadiaSettings& settings) const;
|
||||
MTSM::WindowLayout LoadPersistedLayout(MTSM::CascadiaSettings& settings) const;
|
||||
MTSM::WindowLayout GetWindowLayout();
|
||||
|
||||
winrt::fire_and_forget NewTerminalByDrop(winrt::Windows::UI::Xaml::DragEventArgs& e);
|
||||
winrt::fire_and_forget NewTerminalByDrop(WUX::DragEventArgs& e);
|
||||
|
||||
hstring Title();
|
||||
|
||||
@@ -96,15 +96,15 @@ namespace winrt::TerminalApp::implementation
|
||||
void Maximized(bool newMaximized);
|
||||
void RequestSetMaximized(bool newMaximized);
|
||||
|
||||
void SetStartupActions(std::vector<Microsoft::Terminal::Settings::Model::ActionAndArgs>& actions);
|
||||
void SetStartupActions(std::vector<MTSM::ActionAndArgs>& actions);
|
||||
|
||||
void SetInboundListener(bool isEmbedding);
|
||||
static std::vector<Microsoft::Terminal::Settings::Model::ActionAndArgs> ConvertExecuteCommandlineToActions(const Microsoft::Terminal::Settings::Model::ExecuteCommandlineArgs& args);
|
||||
static std::vector<MTSM::ActionAndArgs> ConvertExecuteCommandlineToActions(const MTSM::ExecuteCommandlineArgs& args);
|
||||
|
||||
winrt::TerminalApp::IDialogPresenter DialogPresenter() const;
|
||||
void DialogPresenter(winrt::TerminalApp::IDialogPresenter dialogPresenter);
|
||||
MTApp::IDialogPresenter DialogPresenter() const;
|
||||
void DialogPresenter(MTApp::IDialogPresenter dialogPresenter);
|
||||
|
||||
winrt::TerminalApp::TaskbarState TaskbarState() const;
|
||||
MTApp::TaskbarState TaskbarState() const;
|
||||
|
||||
void ShowKeyboardServiceWarning() const;
|
||||
void ShowSetAsDefaultInfoBar() const;
|
||||
@@ -113,7 +113,7 @@ namespace winrt::TerminalApp::implementation
|
||||
winrt::fire_and_forget IdentifyWindow();
|
||||
winrt::fire_and_forget RenameFailed();
|
||||
|
||||
winrt::fire_and_forget ProcessStartupActions(Windows::Foundation::Collections::IVector<Microsoft::Terminal::Settings::Model::ActionAndArgs> actions,
|
||||
winrt::fire_and_forget ProcessStartupActions(WFC::IVector<MTSM::ActionAndArgs> actions,
|
||||
const bool initial,
|
||||
const winrt::hstring cwd = L"");
|
||||
|
||||
@@ -138,29 +138,29 @@ namespace winrt::TerminalApp::implementation
|
||||
|
||||
bool OnDirectKeyEvent(const uint32_t vkey, const uint8_t scanCode, const bool down);
|
||||
|
||||
WINRT_CALLBACK(PropertyChanged, Windows::UI::Xaml::Data::PropertyChangedEventHandler);
|
||||
WINRT_CALLBACK(PropertyChanged, WUX::Data::PropertyChangedEventHandler);
|
||||
|
||||
// -------------------------------- WinRT Events ---------------------------------
|
||||
TYPED_EVENT(TitleChanged, IInspectable, winrt::hstring);
|
||||
TYPED_EVENT(LastTabClosed, IInspectable, winrt::TerminalApp::LastTabClosedEventArgs);
|
||||
TYPED_EVENT(SetTitleBarContent, IInspectable, winrt::Windows::UI::Xaml::UIElement);
|
||||
TYPED_EVENT(LastTabClosed, IInspectable, MTApp::LastTabClosedEventArgs);
|
||||
TYPED_EVENT(SetTitleBarContent, IInspectable, WUX::UIElement);
|
||||
TYPED_EVENT(FocusModeChanged, IInspectable, IInspectable);
|
||||
TYPED_EVENT(FullscreenChanged, IInspectable, IInspectable);
|
||||
TYPED_EVENT(ChangeMaximizeRequested, IInspectable, IInspectable);
|
||||
TYPED_EVENT(AlwaysOnTopChanged, IInspectable, IInspectable);
|
||||
TYPED_EVENT(RaiseVisualBell, IInspectable, IInspectable);
|
||||
TYPED_EVENT(SetTaskbarProgress, IInspectable, IInspectable);
|
||||
TYPED_EVENT(Initialized, IInspectable, winrt::Windows::UI::Xaml::RoutedEventArgs);
|
||||
TYPED_EVENT(Initialized, IInspectable, WUX::RoutedEventArgs);
|
||||
TYPED_EVENT(IdentifyWindowsRequested, IInspectable, IInspectable);
|
||||
TYPED_EVENT(RenameWindowRequested, Windows::Foundation::IInspectable, winrt::TerminalApp::RenameWindowRequestedArgs);
|
||||
TYPED_EVENT(RenameWindowRequested, WF::IInspectable, MTApp::RenameWindowRequestedArgs);
|
||||
TYPED_EVENT(IsQuakeWindowChanged, IInspectable, IInspectable);
|
||||
TYPED_EVENT(SummonWindowRequested, IInspectable, IInspectable);
|
||||
TYPED_EVENT(CloseRequested, IInspectable, IInspectable);
|
||||
TYPED_EVENT(OpenSystemMenu, IInspectable, IInspectable);
|
||||
TYPED_EVENT(QuitRequested, IInspectable, IInspectable);
|
||||
TYPED_EVENT(ShowWindowChanged, IInspectable, winrt::Microsoft::Terminal::Control::ShowWindowArgs)
|
||||
TYPED_EVENT(ShowWindowChanged, IInspectable, MTControl::ShowWindowArgs)
|
||||
|
||||
WINRT_OBSERVABLE_PROPERTY(winrt::Windows::UI::Xaml::Media::Brush, TitlebarBrush, _PropertyChangedHandlers, nullptr);
|
||||
WINRT_OBSERVABLE_PROPERTY(WUXMedia::Brush, TitlebarBrush, _PropertyChangedHandlers, nullptr);
|
||||
|
||||
private:
|
||||
friend struct TerminalPageT<TerminalPage>; // for Xaml to bind events
|
||||
@@ -172,21 +172,21 @@ namespace winrt::TerminalApp::implementation
|
||||
// ALSO: If you add any UIElements as roots here, make sure they're
|
||||
// updated in App::_ApplyTheme. The roots currently is _tabRow
|
||||
// (which is a root when the tabs are in the titlebar.)
|
||||
Microsoft::UI::Xaml::Controls::TabView _tabView{ nullptr };
|
||||
TerminalApp::TabRowControl _tabRow{ nullptr };
|
||||
Windows::UI::Xaml::Controls::Grid _tabContent{ nullptr };
|
||||
Microsoft::UI::Xaml::Controls::SplitButton _newTabButton{ nullptr };
|
||||
winrt::TerminalApp::ColorPickupFlyout _tabColorPicker{ nullptr };
|
||||
MUXC::TabView _tabView{ nullptr };
|
||||
MTApp::TabRowControl _tabRow{ nullptr };
|
||||
WUXC::Grid _tabContent{ nullptr };
|
||||
MUXC::SplitButton _newTabButton{ nullptr };
|
||||
MTApp::ColorPickupFlyout _tabColorPicker{ nullptr };
|
||||
|
||||
Microsoft::Terminal::Settings::Model::CascadiaSettings _settings{ nullptr };
|
||||
MTSM::CascadiaSettings _settings{ nullptr };
|
||||
|
||||
Windows::Foundation::Collections::IObservableVector<TerminalApp::TabBase> _tabs;
|
||||
Windows::Foundation::Collections::IObservableVector<TerminalApp::TabBase> _mruTabs;
|
||||
static winrt::com_ptr<TerminalTab> _GetTerminalTabImpl(const TerminalApp::TabBase& tab);
|
||||
WFC::IObservableVector<MTApp::TabBase> _tabs;
|
||||
WFC::IObservableVector<MTApp::TabBase> _mruTabs;
|
||||
static winrt::com_ptr<TerminalTab> _GetTerminalTabImpl(const MTApp::TabBase& tab);
|
||||
|
||||
void _UpdateTabIndices();
|
||||
|
||||
TerminalApp::SettingsTab _settingsTab{ nullptr };
|
||||
MTApp::SettingsTab _settingsTab{ nullptr };
|
||||
|
||||
bool _isInFocusMode{ false };
|
||||
bool _isFullscreen{ false };
|
||||
@@ -206,64 +206,64 @@ namespace winrt::TerminalApp::implementation
|
||||
bool _activated{ false };
|
||||
bool _visible{ true };
|
||||
|
||||
std::vector<std::vector<Microsoft::Terminal::Settings::Model::ActionAndArgs>> _previouslyClosedPanesAndTabs{};
|
||||
std::vector<std::vector<MTSM::ActionAndArgs>> _previouslyClosedPanesAndTabs{};
|
||||
|
||||
uint32_t _systemRowsToScroll{ DefaultRowsToScroll };
|
||||
|
||||
// use a weak reference to prevent circular dependency with AppLogic
|
||||
winrt::weak_ref<winrt::TerminalApp::IDialogPresenter> _dialogPresenter;
|
||||
winrt::weak_ref<MTApp::IDialogPresenter> _dialogPresenter;
|
||||
|
||||
winrt::com_ptr<AppKeyBindings> _bindings{ winrt::make_self<implementation::AppKeyBindings>() };
|
||||
winrt::com_ptr<ShortcutActionDispatch> _actionDispatch{ winrt::make_self<implementation::ShortcutActionDispatch>() };
|
||||
|
||||
winrt::Windows::UI::Xaml::Controls::Grid::LayoutUpdated_revoker _layoutUpdatedRevoker;
|
||||
WUXC::Grid::LayoutUpdated_revoker _layoutUpdatedRevoker;
|
||||
StartupState _startupState{ StartupState::NotInitialized };
|
||||
|
||||
Windows::Foundation::Collections::IVector<Microsoft::Terminal::Settings::Model::ActionAndArgs> _startupActions;
|
||||
WFC::IVector<MTSM::ActionAndArgs> _startupActions;
|
||||
bool _shouldStartInboundListener{ false };
|
||||
bool _isEmbeddingInboundListener{ false };
|
||||
|
||||
std::shared_ptr<Toast> _windowIdToast{ nullptr };
|
||||
std::shared_ptr<Toast> _windowRenameFailedToast{ nullptr };
|
||||
|
||||
winrt::Windows::UI::Xaml::Controls::TextBox::LayoutUpdated_revoker _renamerLayoutUpdatedRevoker;
|
||||
WUXC::TextBox::LayoutUpdated_revoker _renamerLayoutUpdatedRevoker;
|
||||
int _renamerLayoutCount{ 0 };
|
||||
bool _renamerPressedEnter{ false };
|
||||
|
||||
winrt::Windows::Foundation::IAsyncOperation<winrt::Windows::UI::Xaml::Controls::ContentDialogResult> _ShowDialogHelper(const std::wstring_view& name);
|
||||
WF::IAsyncOperation<WUXC::ContentDialogResult> _ShowDialogHelper(const std::wstring_view& name);
|
||||
|
||||
void _ShowAboutDialog();
|
||||
winrt::Windows::Foundation::IAsyncOperation<winrt::Windows::UI::Xaml::Controls::ContentDialogResult> _ShowQuitDialog();
|
||||
winrt::Windows::Foundation::IAsyncOperation<winrt::Windows::UI::Xaml::Controls::ContentDialogResult> _ShowCloseWarningDialog();
|
||||
winrt::Windows::Foundation::IAsyncOperation<winrt::Windows::UI::Xaml::Controls::ContentDialogResult> _ShowCloseReadOnlyDialog();
|
||||
winrt::Windows::Foundation::IAsyncOperation<winrt::Windows::UI::Xaml::Controls::ContentDialogResult> _ShowMultiLinePasteWarningDialog();
|
||||
winrt::Windows::Foundation::IAsyncOperation<winrt::Windows::UI::Xaml::Controls::ContentDialogResult> _ShowLargePasteWarningDialog();
|
||||
WF::IAsyncOperation<WUXC::ContentDialogResult> _ShowQuitDialog();
|
||||
WF::IAsyncOperation<WUXC::ContentDialogResult> _ShowCloseWarningDialog();
|
||||
WF::IAsyncOperation<WUXC::ContentDialogResult> _ShowCloseReadOnlyDialog();
|
||||
WF::IAsyncOperation<WUXC::ContentDialogResult> _ShowMultiLinePasteWarningDialog();
|
||||
WF::IAsyncOperation<WUXC::ContentDialogResult> _ShowLargePasteWarningDialog();
|
||||
|
||||
void _CreateNewTabFlyout();
|
||||
std::vector<winrt::Windows::UI::Xaml::Controls::MenuFlyoutItemBase> _CreateNewTabFlyoutItems(winrt::Windows::Foundation::Collections::IVector<Microsoft::Terminal::Settings::Model::NewTabMenuEntry> entries);
|
||||
winrt::Windows::UI::Xaml::Controls::IconElement _CreateNewTabFlyoutIcon(const winrt::hstring& icon);
|
||||
winrt::Windows::UI::Xaml::Controls::MenuFlyoutItem _CreateNewTabFlyoutProfile(const Microsoft::Terminal::Settings::Model::Profile profile, int profileIndex);
|
||||
std::vector<WUXC::MenuFlyoutItemBase> _CreateNewTabFlyoutItems(WFC::IVector<MTSM::NewTabMenuEntry> entries);
|
||||
WUXC::IconElement _CreateNewTabFlyoutIcon(const winrt::hstring& icon);
|
||||
WUXC::MenuFlyoutItem _CreateNewTabFlyoutProfile(const MTSM::Profile profile, int profileIndex);
|
||||
|
||||
void _OpenNewTabDropdown();
|
||||
HRESULT _OpenNewTab(const Microsoft::Terminal::Settings::Model::NewTerminalArgs& newTerminalArgs, winrt::Microsoft::Terminal::TerminalConnection::ITerminalConnection existingConnection = nullptr);
|
||||
HRESULT _OpenNewTab(const MTSM::NewTerminalArgs& newTerminalArgs, MTConnection::ITerminalConnection existingConnection = nullptr);
|
||||
void _CreateNewTabFromPane(std::shared_ptr<Pane> pane, uint32_t insertPosition = -1);
|
||||
winrt::Microsoft::Terminal::TerminalConnection::ITerminalConnection _CreateConnectionFromSettings(Microsoft::Terminal::Settings::Model::Profile profile, Microsoft::Terminal::Settings::Model::TerminalSettings settings);
|
||||
MTConnection::ITerminalConnection _CreateConnectionFromSettings(MTSM::Profile profile, MTSM::TerminalSettings settings);
|
||||
|
||||
winrt::fire_and_forget _OpenNewWindow(const Microsoft::Terminal::Settings::Model::NewTerminalArgs newTerminalArgs);
|
||||
winrt::fire_and_forget _OpenNewWindow(const MTSM::NewTerminalArgs newTerminalArgs);
|
||||
|
||||
void _OpenNewTerminalViaDropdown(const Microsoft::Terminal::Settings::Model::NewTerminalArgs newTerminalArgs);
|
||||
void _OpenNewTerminalViaDropdown(const MTSM::NewTerminalArgs newTerminalArgs);
|
||||
|
||||
bool _displayingCloseDialog{ false };
|
||||
void _SettingsButtonOnClick(const IInspectable& sender, const Windows::UI::Xaml::RoutedEventArgs& eventArgs);
|
||||
void _CommandPaletteButtonOnClick(const IInspectable& sender, const Windows::UI::Xaml::RoutedEventArgs& eventArgs);
|
||||
void _AboutButtonOnClick(const IInspectable& sender, const Windows::UI::Xaml::RoutedEventArgs& eventArgs);
|
||||
void _ThirdPartyNoticesOnClick(const IInspectable& sender, const Windows::UI::Xaml::RoutedEventArgs& eventArgs);
|
||||
void _SendFeedbackOnClick(const IInspectable& sender, const Windows::UI::Xaml::Controls::ContentDialogButtonClickEventArgs& eventArgs);
|
||||
void _SettingsButtonOnClick(const IInspectable& sender, const WUX::RoutedEventArgs& eventArgs);
|
||||
void _CommandPaletteButtonOnClick(const IInspectable& sender, const WUX::RoutedEventArgs& eventArgs);
|
||||
void _AboutButtonOnClick(const IInspectable& sender, const WUX::RoutedEventArgs& eventArgs);
|
||||
void _ThirdPartyNoticesOnClick(const IInspectable& sender, const WUX::RoutedEventArgs& eventArgs);
|
||||
void _SendFeedbackOnClick(const IInspectable& sender, const WUXC::ContentDialogButtonClickEventArgs& eventArgs);
|
||||
|
||||
void _KeyDownHandler(const Windows::Foundation::IInspectable& sender, const Windows::UI::Xaml::Input::KeyRoutedEventArgs& e);
|
||||
void _KeyDownHandler(const WF::IInspectable& sender, const WUX::Input::KeyRoutedEventArgs& e);
|
||||
static ::Microsoft::Terminal::Core::ControlKeyStates _GetPressedModifierKeys() noexcept;
|
||||
static void _ClearKeyboardState(const WORD vkey, const WORD scanCode) noexcept;
|
||||
void _HookupKeyBindings(const Microsoft::Terminal::Settings::Model::IActionMapView& actionMap) noexcept;
|
||||
void _HookupKeyBindings(const MTSM::IActionMapView& actionMap) noexcept;
|
||||
void _RegisterActionCallbacks();
|
||||
|
||||
void _UpdateTitle(const TerminalTab& tab);
|
||||
@@ -271,11 +271,11 @@ namespace winrt::TerminalApp::implementation
|
||||
void _UpdateTabView();
|
||||
void _UpdateTabWidthMode();
|
||||
void _UpdateCommandsForPalette();
|
||||
void _SetBackgroundImage(const winrt::Microsoft::Terminal::Settings::Model::IAppearanceConfig& newAppearance);
|
||||
void _SetBackgroundImage(const MTSM::IAppearanceConfig& newAppearance);
|
||||
|
||||
static winrt::Windows::Foundation::Collections::IMap<winrt::hstring, Microsoft::Terminal::Settings::Model::Command> _ExpandCommands(Windows::Foundation::Collections::IMapView<winrt::hstring, Microsoft::Terminal::Settings::Model::Command> commandsToExpand,
|
||||
Windows::Foundation::Collections::IVectorView<Microsoft::Terminal::Settings::Model::Profile> profiles,
|
||||
Windows::Foundation::Collections::IMapView<winrt::hstring, Microsoft::Terminal::Settings::Model::ColorScheme> schemes);
|
||||
static WFC::IMap<winrt::hstring, MTSM::Command> _ExpandCommands(WFC::IMapView<winrt::hstring, MTSM::Command> commandsToExpand,
|
||||
WFC::IVectorView<MTSM::Profile> profiles,
|
||||
WFC::IMapView<winrt::hstring, MTSM::ColorScheme> schemes);
|
||||
|
||||
void _DuplicateFocusedTab();
|
||||
void _DuplicateTab(const TerminalTab& tab);
|
||||
@@ -283,13 +283,13 @@ namespace winrt::TerminalApp::implementation
|
||||
void _SplitTab(TerminalTab& tab);
|
||||
winrt::fire_and_forget _ExportTab(const TerminalTab& tab, winrt::hstring filepath);
|
||||
|
||||
winrt::Windows::Foundation::IAsyncAction _HandleCloseTabRequested(winrt::TerminalApp::TabBase tab);
|
||||
WF::IAsyncAction _HandleCloseTabRequested(MTApp::TabBase tab);
|
||||
void _CloseTabAtIndex(uint32_t index);
|
||||
void _RemoveTab(const winrt::TerminalApp::TabBase& tab);
|
||||
winrt::fire_and_forget _RemoveTabs(const std::vector<winrt::TerminalApp::TabBase> tabs);
|
||||
void _RemoveTab(const MTApp::TabBase& tab);
|
||||
winrt::fire_and_forget _RemoveTabs(const std::vector<MTApp::TabBase> tabs);
|
||||
|
||||
void _InitializeTab(winrt::com_ptr<TerminalTab> newTabImpl, uint32_t insertPosition = -1);
|
||||
void _RegisterTerminalEvents(Microsoft::Terminal::Control::TermControl term);
|
||||
void _RegisterTerminalEvents(MTControl::TermControl term);
|
||||
void _RegisterTabEvents(TerminalTab& hostingTab);
|
||||
|
||||
void _DismissTabContextMenus();
|
||||
@@ -297,10 +297,10 @@ namespace winrt::TerminalApp::implementation
|
||||
bool _HasMultipleTabs() const;
|
||||
void _RemoveAllTabs();
|
||||
|
||||
void _SelectNextTab(const bool bMoveRight, const Windows::Foundation::IReference<Microsoft::Terminal::Settings::Model::TabSwitcherMode>& customTabSwitcherMode);
|
||||
void _SelectNextTab(const bool bMoveRight, const WF::IReference<MTSM::TabSwitcherMode>& customTabSwitcherMode);
|
||||
bool _SelectTab(uint32_t tabIndex);
|
||||
bool _MoveFocus(const Microsoft::Terminal::Settings::Model::FocusDirection& direction);
|
||||
bool _SwapPane(const Microsoft::Terminal::Settings::Model::FocusDirection& direction);
|
||||
bool _MoveFocus(const MTSM::FocusDirection& direction);
|
||||
bool _SwapPane(const MTSM::FocusDirection& direction);
|
||||
bool _MovePane(const uint32_t tabIdx);
|
||||
|
||||
template<typename F>
|
||||
@@ -323,79 +323,79 @@ namespace winrt::TerminalApp::implementation
|
||||
return false;
|
||||
}
|
||||
|
||||
winrt::Microsoft::Terminal::Control::TermControl _GetActiveControl();
|
||||
MTControl::TermControl _GetActiveControl();
|
||||
std::optional<uint32_t> _GetFocusedTabIndex() const noexcept;
|
||||
TerminalApp::TabBase _GetFocusedTab() const noexcept;
|
||||
MTApp::TabBase _GetFocusedTab() const noexcept;
|
||||
winrt::com_ptr<TerminalTab> _GetFocusedTabImpl() const noexcept;
|
||||
TerminalApp::TabBase _GetTabByTabViewItem(const Microsoft::UI::Xaml::Controls::TabViewItem& tabViewItem) const noexcept;
|
||||
MTApp::TabBase _GetTabByTabViewItem(const MUXC::TabViewItem& tabViewItem) const noexcept;
|
||||
|
||||
void _HandleClosePaneRequested(std::shared_ptr<Pane> pane);
|
||||
winrt::fire_and_forget _SetFocusedTab(const winrt::TerminalApp::TabBase tab);
|
||||
winrt::fire_and_forget _SetFocusedTab(const MTApp::TabBase tab);
|
||||
winrt::fire_and_forget _CloseFocusedPane();
|
||||
void _ClosePanes(weak_ref<TerminalTab> weakTab, std::vector<uint32_t> paneIds);
|
||||
winrt::Windows::Foundation::IAsyncOperation<bool> _PaneConfirmCloseReadOnly(std::shared_ptr<Pane> pane);
|
||||
void _AddPreviouslyClosedPaneOrTab(std::vector<Microsoft::Terminal::Settings::Model::ActionAndArgs>&& args);
|
||||
WF::IAsyncOperation<bool> _PaneConfirmCloseReadOnly(std::shared_ptr<Pane> pane);
|
||||
void _AddPreviouslyClosedPaneOrTab(std::vector<MTSM::ActionAndArgs>&& args);
|
||||
|
||||
winrt::fire_and_forget _RemoveOnCloseRoutine(Microsoft::UI::Xaml::Controls::TabViewItem tabViewItem, winrt::com_ptr<TerminalPage> page);
|
||||
winrt::fire_and_forget _RemoveOnCloseRoutine(MUXC::TabViewItem tabViewItem, winrt::com_ptr<TerminalPage> page);
|
||||
|
||||
void _Scroll(ScrollDirection scrollDirection, const Windows::Foundation::IReference<uint32_t>& rowsToScroll);
|
||||
void _Scroll(ScrollDirection scrollDirection, const WF::IReference<uint32_t>& rowsToScroll);
|
||||
|
||||
void _SplitPane(const Microsoft::Terminal::Settings::Model::SplitDirection splitType,
|
||||
void _SplitPane(const MTSM::SplitDirection splitType,
|
||||
const float splitSize,
|
||||
std::shared_ptr<Pane> newPane);
|
||||
void _SplitPane(TerminalTab& tab,
|
||||
const Microsoft::Terminal::Settings::Model::SplitDirection splitType,
|
||||
const MTSM::SplitDirection splitType,
|
||||
const float splitSize,
|
||||
std::shared_ptr<Pane> newPane);
|
||||
void _ResizePane(const Microsoft::Terminal::Settings::Model::ResizeDirection& direction);
|
||||
void _ResizePane(const MTSM::ResizeDirection& direction);
|
||||
void _ToggleSplitOrientation();
|
||||
|
||||
void _ScrollPage(ScrollDirection scrollDirection);
|
||||
void _ScrollToBufferEdge(ScrollDirection scrollDirection);
|
||||
void _SetAcceleratorForMenuItem(Windows::UI::Xaml::Controls::MenuFlyoutItem& menuItem, const winrt::Microsoft::Terminal::Control::KeyChord& keyChord);
|
||||
void _SetAcceleratorForMenuItem(WUXC::MenuFlyoutItem& menuItem, const MTControl::KeyChord& keyChord);
|
||||
|
||||
winrt::fire_and_forget _CopyToClipboardHandler(const IInspectable sender, const winrt::Microsoft::Terminal::Control::CopyToClipboardEventArgs copiedData);
|
||||
winrt::fire_and_forget _CopyToClipboardHandler(const IInspectable sender, const MTControl::CopyToClipboardEventArgs copiedData);
|
||||
winrt::fire_and_forget _PasteFromClipboardHandler(const IInspectable sender,
|
||||
const Microsoft::Terminal::Control::PasteFromClipboardEventArgs eventArgs);
|
||||
const MTControl::PasteFromClipboardEventArgs eventArgs);
|
||||
|
||||
void _OpenHyperlinkHandler(const IInspectable sender, const Microsoft::Terminal::Control::OpenHyperlinkEventArgs eventArgs);
|
||||
bool _IsUriSupported(const winrt::Windows::Foundation::Uri& parsedUri);
|
||||
void _OpenHyperlinkHandler(const IInspectable sender, const MTControl::OpenHyperlinkEventArgs eventArgs);
|
||||
bool _IsUriSupported(const WF::Uri& parsedUri);
|
||||
|
||||
void _ShowCouldNotOpenDialog(winrt::hstring reason, winrt::hstring uri);
|
||||
bool _CopyText(const bool singleLine, const Windows::Foundation::IReference<Microsoft::Terminal::Control::CopyFormat>& formats);
|
||||
bool _CopyText(const bool singleLine, const WF::IReference<MTControl::CopyFormat>& formats);
|
||||
|
||||
winrt::fire_and_forget _SetTaskbarProgressHandler(const IInspectable sender, const IInspectable eventArgs);
|
||||
|
||||
void _PasteText();
|
||||
|
||||
winrt::fire_and_forget _ControlNoticeRaisedHandler(const IInspectable sender, const Microsoft::Terminal::Control::NoticeEventArgs eventArgs);
|
||||
winrt::fire_and_forget _ControlNoticeRaisedHandler(const IInspectable sender, const MTControl::NoticeEventArgs eventArgs);
|
||||
void _ShowControlNoticeDialog(const winrt::hstring& title, const winrt::hstring& message);
|
||||
|
||||
fire_and_forget _LaunchSettings(const Microsoft::Terminal::Settings::Model::SettingsTarget target);
|
||||
fire_and_forget _LaunchSettings(const MTSM::SettingsTarget target);
|
||||
|
||||
void _TabDragStarted(const IInspectable& sender, const IInspectable& eventArgs);
|
||||
void _TabDragCompleted(const IInspectable& sender, const IInspectable& eventArgs);
|
||||
|
||||
void _OnTabClick(const IInspectable& sender, const Windows::UI::Xaml::Input::PointerRoutedEventArgs& eventArgs);
|
||||
void _OnTabSelectionChanged(const IInspectable& sender, const Windows::UI::Xaml::Controls::SelectionChangedEventArgs& eventArgs);
|
||||
void _OnTabItemsChanged(const IInspectable& sender, const Windows::Foundation::Collections::IVectorChangedEventArgs& eventArgs);
|
||||
void _OnTabCloseRequested(const IInspectable& sender, const Microsoft::UI::Xaml::Controls::TabViewTabCloseRequestedEventArgs& eventArgs);
|
||||
void _OnTabClick(const IInspectable& sender, const WUX::Input::PointerRoutedEventArgs& eventArgs);
|
||||
void _OnTabSelectionChanged(const IInspectable& sender, const WUXC::SelectionChangedEventArgs& eventArgs);
|
||||
void _OnTabItemsChanged(const IInspectable& sender, const WFC::IVectorChangedEventArgs& eventArgs);
|
||||
void _OnTabCloseRequested(const IInspectable& sender, const MUXC::TabViewTabCloseRequestedEventArgs& eventArgs);
|
||||
void _OnFirstLayout(const IInspectable& sender, const IInspectable& eventArgs);
|
||||
void _UpdatedSelectedTab(const winrt::TerminalApp::TabBase& tab);
|
||||
void _UpdateBackground(const winrt::Microsoft::Terminal::Settings::Model::Profile& profile);
|
||||
void _UpdatedSelectedTab(const MTApp::TabBase& tab);
|
||||
void _UpdateBackground(const MTSM::Profile& profile);
|
||||
|
||||
void _OnDispatchCommandRequested(const IInspectable& sender, const Microsoft::Terminal::Settings::Model::Command& command);
|
||||
void _OnDispatchCommandRequested(const IInspectable& sender, const MTSM::Command& command);
|
||||
void _OnCommandLineExecutionRequested(const IInspectable& sender, const winrt::hstring& commandLine);
|
||||
void _OnSwitchToTabRequested(const IInspectable& sender, const winrt::TerminalApp::TabBase& tab);
|
||||
void _OnSwitchToTabRequested(const IInspectable& sender, const MTApp::TabBase& tab);
|
||||
|
||||
void _Find(const TerminalTab& tab);
|
||||
|
||||
winrt::Microsoft::Terminal::Control::TermControl _InitControl(const winrt::Microsoft::Terminal::Settings::Model::TerminalSettingsCreateResult& settings,
|
||||
const winrt::Microsoft::Terminal::TerminalConnection::ITerminalConnection& connection);
|
||||
MTControl::TermControl _InitControl(const MTSM::TerminalSettingsCreateResult& settings,
|
||||
const MTConnection::ITerminalConnection& connection);
|
||||
|
||||
std::shared_ptr<Pane> _MakePane(const Microsoft::Terminal::Settings::Model::NewTerminalArgs& newTerminalArgs = nullptr,
|
||||
const winrt::TerminalApp::TabBase& sourceTab = nullptr,
|
||||
winrt::Microsoft::Terminal::TerminalConnection::ITerminalConnection existingConnection = nullptr);
|
||||
std::shared_ptr<Pane> _MakePane(const MTSM::NewTerminalArgs& newTerminalArgs = nullptr,
|
||||
const MTApp::TabBase& sourceTab = nullptr,
|
||||
MTConnection::ITerminalConnection existingConnection = nullptr);
|
||||
|
||||
void _RefreshUIForSettingsReload();
|
||||
|
||||
@@ -413,54 +413,54 @@ namespace winrt::TerminalApp::implementation
|
||||
static int _ComputeScrollDelta(ScrollDirection scrollDirection, const uint32_t rowsToScroll);
|
||||
static uint32_t _ReadSystemRowsToScroll();
|
||||
|
||||
void _UpdateMRUTab(const winrt::TerminalApp::TabBase& tab);
|
||||
void _UpdateMRUTab(const MTApp::TabBase& tab);
|
||||
|
||||
void _TryMoveTab(const uint32_t currentTabIndex, const int32_t suggestedNewTabIndex);
|
||||
|
||||
bool _shouldMouseVanish{ false };
|
||||
bool _isMouseHidden{ false };
|
||||
Windows::UI::Core::CoreCursor _defaultPointerCursor{ nullptr };
|
||||
WUC::CoreCursor _defaultPointerCursor{ nullptr };
|
||||
void _HidePointerCursorHandler(const IInspectable& sender, const IInspectable& eventArgs);
|
||||
void _RestorePointerCursorHandler(const IInspectable& sender, const IInspectable& eventArgs);
|
||||
|
||||
void _PreviewAction(const Microsoft::Terminal::Settings::Model::ActionAndArgs& args);
|
||||
void _PreviewActionHandler(const IInspectable& sender, const Microsoft::Terminal::Settings::Model::Command& args);
|
||||
void _PreviewAction(const MTSM::ActionAndArgs& args);
|
||||
void _PreviewActionHandler(const IInspectable& sender, const MTSM::Command& args);
|
||||
void _EndPreview();
|
||||
void _RunRestorePreviews();
|
||||
void _PreviewColorScheme(const Microsoft::Terminal::Settings::Model::SetColorSchemeArgs& args);
|
||||
void _PreviewAdjustOpacity(const Microsoft::Terminal::Settings::Model::AdjustOpacityArgs& args);
|
||||
winrt::Microsoft::Terminal::Settings::Model::ActionAndArgs _lastPreviewedAction{ nullptr };
|
||||
void _PreviewColorScheme(const MTSM::SetColorSchemeArgs& args);
|
||||
void _PreviewAdjustOpacity(const MTSM::AdjustOpacityArgs& args);
|
||||
MTSM::ActionAndArgs _lastPreviewedAction{ nullptr };
|
||||
std::vector<std::function<void()>> _restorePreviewFuncs{};
|
||||
|
||||
HRESULT _OnNewConnection(const winrt::Microsoft::Terminal::TerminalConnection::ConptyConnection& connection);
|
||||
void _HandleToggleInboundPty(const IInspectable& sender, const Microsoft::Terminal::Settings::Model::ActionEventArgs& args);
|
||||
HRESULT _OnNewConnection(const MTConnection::ConptyConnection& connection);
|
||||
void _HandleToggleInboundPty(const IInspectable& sender, const MTSM::ActionEventArgs& args);
|
||||
|
||||
void _WindowRenamerActionClick(const IInspectable& sender, const IInspectable& eventArgs);
|
||||
void _RequestWindowRename(const winrt::hstring& newName);
|
||||
void _WindowRenamerKeyDown(const IInspectable& sender, const winrt::Windows::UI::Xaml::Input::KeyRoutedEventArgs& e);
|
||||
void _WindowRenamerKeyUp(const IInspectable& sender, const winrt::Windows::UI::Xaml::Input::KeyRoutedEventArgs& e);
|
||||
void _WindowRenamerKeyDown(const IInspectable& sender, const WUX::Input::KeyRoutedEventArgs& e);
|
||||
void _WindowRenamerKeyUp(const IInspectable& sender, const WUX::Input::KeyRoutedEventArgs& e);
|
||||
|
||||
void _UpdateTeachingTipTheme(winrt::Windows::UI::Xaml::FrameworkElement element);
|
||||
void _UpdateTeachingTipTheme(WUX::FrameworkElement element);
|
||||
|
||||
winrt::Microsoft::Terminal::Settings::Model::Profile GetClosestProfileForDuplicationOfProfile(const winrt::Microsoft::Terminal::Settings::Model::Profile& profile) const noexcept;
|
||||
MTSM::Profile GetClosestProfileForDuplicationOfProfile(const MTSM::Profile& profile) const noexcept;
|
||||
|
||||
bool _maybeElevate(const winrt::Microsoft::Terminal::Settings::Model::NewTerminalArgs& newTerminalArgs,
|
||||
const winrt::Microsoft::Terminal::Settings::Model::TerminalSettingsCreateResult& controlSettings,
|
||||
const winrt::Microsoft::Terminal::Settings::Model::Profile& profile);
|
||||
void _OpenElevatedWT(winrt::Microsoft::Terminal::Settings::Model::NewTerminalArgs newTerminalArgs);
|
||||
bool _maybeElevate(const MTSM::NewTerminalArgs& newTerminalArgs,
|
||||
const MTSM::TerminalSettingsCreateResult& controlSettings,
|
||||
const MTSM::Profile& profile);
|
||||
void _OpenElevatedWT(MTSM::NewTerminalArgs newTerminalArgs);
|
||||
|
||||
winrt::fire_and_forget _ConnectionStateChangedHandler(const winrt::Windows::Foundation::IInspectable& sender, const winrt::Windows::Foundation::IInspectable& args) const;
|
||||
void _CloseOnExitInfoDismissHandler(const winrt::Windows::Foundation::IInspectable& sender, const winrt::Windows::Foundation::IInspectable& args) const;
|
||||
void _KeyboardServiceWarningInfoDismissHandler(const winrt::Windows::Foundation::IInspectable& sender, const winrt::Windows::Foundation::IInspectable& args) const;
|
||||
void _SetAsDefaultDismissHandler(const winrt::Windows::Foundation::IInspectable& sender, const winrt::Windows::Foundation::IInspectable& args);
|
||||
void _SetAsDefaultOpenSettingsHandler(const winrt::Windows::Foundation::IInspectable& sender, const winrt::Windows::Foundation::IInspectable& args);
|
||||
static bool _IsMessageDismissed(const winrt::Microsoft::Terminal::Settings::Model::InfoBarMessage& message);
|
||||
static void _DismissMessage(const winrt::Microsoft::Terminal::Settings::Model::InfoBarMessage& message);
|
||||
winrt::fire_and_forget _ConnectionStateChangedHandler(const WF::IInspectable& sender, const WF::IInspectable& args) const;
|
||||
void _CloseOnExitInfoDismissHandler(const WF::IInspectable& sender, const WF::IInspectable& args) const;
|
||||
void _KeyboardServiceWarningInfoDismissHandler(const WF::IInspectable& sender, const WF::IInspectable& args) const;
|
||||
void _SetAsDefaultDismissHandler(const WF::IInspectable& sender, const WF::IInspectable& args);
|
||||
void _SetAsDefaultOpenSettingsHandler(const WF::IInspectable& sender, const WF::IInspectable& args);
|
||||
static bool _IsMessageDismissed(const MTSM::InfoBarMessage& message);
|
||||
static void _DismissMessage(const MTSM::InfoBarMessage& message);
|
||||
|
||||
void _updateThemeColors();
|
||||
void _updateTabCloseButton(const winrt::Microsoft::UI::Xaml::Controls::TabViewItem& tabViewItem);
|
||||
void _updateTabCloseButton(const MUXC::TabViewItem& tabViewItem);
|
||||
|
||||
winrt::fire_and_forget _ShowWindowChangedHandler(const IInspectable sender, const winrt::Microsoft::Terminal::Control::ShowWindowArgs args);
|
||||
winrt::fire_and_forget _ShowWindowChangedHandler(const IInspectable sender, const MTControl::ShowWindowArgs args);
|
||||
|
||||
#pragma region ActionHandlers
|
||||
// These are all defined in AppActionHandlers.cpp
|
||||
|
||||
@@ -11,18 +11,12 @@
|
||||
#include "AppLogic.h"
|
||||
|
||||
using namespace winrt;
|
||||
using namespace winrt::Windows::UI::Xaml;
|
||||
using namespace winrt::Windows::UI::Core;
|
||||
using namespace winrt::Microsoft::Terminal::Control;
|
||||
using namespace winrt::Microsoft::Terminal::Settings::Model;
|
||||
using namespace winrt::Microsoft::UI::Xaml::Controls;
|
||||
using namespace winrt::Windows::System;
|
||||
|
||||
namespace winrt
|
||||
{
|
||||
namespace MUX = Microsoft::UI::Xaml;
|
||||
namespace WUX = Windows::UI::Xaml;
|
||||
}
|
||||
using namespace WUX;
|
||||
using namespace WUC;
|
||||
using namespace MTControl;
|
||||
using namespace MTSM;
|
||||
using namespace MUXC;
|
||||
using namespace WS;
|
||||
|
||||
namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
@@ -111,7 +105,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// - Removes the bell indicator from the tab header
|
||||
// Arguments:
|
||||
// - sender, e: not used
|
||||
void TerminalTab::_BellIndicatorTimerTick(const Windows::Foundation::IInspectable& /*sender*/, const Windows::Foundation::IInspectable& /*e*/)
|
||||
void TerminalTab::_BellIndicatorTimerTick(const WF::IInspectable& /*sender*/, const WF::IInspectable& /*e*/)
|
||||
{
|
||||
ShowBellIndicator(false);
|
||||
// Just do a sanity check that the timer still exists before we stop it
|
||||
@@ -155,8 +149,8 @@ namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
// Make sure to try/catch this, because the LocalTests won't be
|
||||
// able to use this helper.
|
||||
const auto settings{ winrt::TerminalApp::implementation::AppLogic::CurrentAppSettings() };
|
||||
if (settings.GlobalSettings().TabWidthMode() == winrt::Microsoft::UI::Xaml::Controls::TabViewWidthMode::SizeToContent)
|
||||
const auto settings{ MTApp::implementation::AppLogic::CurrentAppSettings() };
|
||||
if (settings.GlobalSettings().TabWidthMode() == MUXC::TabViewWidthMode::SizeToContent)
|
||||
{
|
||||
tab->_headerControl.RenamerMaxWidth(HeaderRenameBoxWidthTitleLength);
|
||||
}
|
||||
@@ -656,7 +650,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// - colorPicker: The color picker that we should attach to ourselves
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void TerminalTab::AttachColorPicker(TerminalApp::ColorPickupFlyout& colorPicker)
|
||||
void TerminalTab::AttachColorPicker(MTApp::ColorPickupFlyout& colorPicker)
|
||||
{
|
||||
auto weakThis{ get_weak() };
|
||||
|
||||
@@ -926,7 +920,7 @@ namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
if (tab->_focusState != FocusState::Unfocused)
|
||||
{
|
||||
if (const auto termControl{ sender.try_as<winrt::Microsoft::Terminal::Control::TermControl>() })
|
||||
if (const auto termControl{ sender.try_as<MTControl::TermControl>() })
|
||||
{
|
||||
termControl.Focus(FocusState::Pointer);
|
||||
}
|
||||
@@ -949,14 +943,14 @@ namespace winrt::TerminalApp::implementation
|
||||
// Return Value:
|
||||
// - A TaskbarState object representing the combined taskbar state and
|
||||
// progress percentage of all our panes.
|
||||
winrt::TerminalApp::TaskbarState TerminalTab::GetCombinedTaskbarState() const
|
||||
MTApp::TaskbarState TerminalTab::GetCombinedTaskbarState() const
|
||||
{
|
||||
std::vector<winrt::TerminalApp::TaskbarState> states;
|
||||
std::vector<MTApp::TaskbarState> states;
|
||||
if (_rootPane)
|
||||
{
|
||||
_rootPane->CollectTaskbarStates(states);
|
||||
}
|
||||
return states.empty() ? winrt::make<winrt::TerminalApp::implementation::TaskbarState>() :
|
||||
return states.empty() ? winrt::make<MTApp::implementation::TaskbarState>() :
|
||||
*std::min_element(states.begin(), states.end(), TerminalApp::implementation::TaskbarState::ComparePriority);
|
||||
}
|
||||
|
||||
@@ -1439,7 +1433,7 @@ namespace winrt::TerminalApp::implementation
|
||||
_RecalculateAndApplyTabColor();
|
||||
}
|
||||
|
||||
winrt::Windows::UI::Xaml::Media::Brush TerminalTab::_BackgroundBrush()
|
||||
WUXMedia::Brush TerminalTab::_BackgroundBrush()
|
||||
{
|
||||
Media::Brush terminalBrush{ nullptr };
|
||||
if (const auto& c{ GetActiveTerminalControl() })
|
||||
@@ -1484,7 +1478,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// or it will return the split direction with automatic converted to a cardinal direction.
|
||||
std::optional<SplitDirection> TerminalTab::PreCalculateCanSplit(SplitDirection splitType,
|
||||
const float splitSize,
|
||||
winrt::Windows::Foundation::Size availableSpace) const
|
||||
WF::Size availableSpace) const
|
||||
{
|
||||
return _rootPane->PreCalculateCanSplit(_activePane, splitType, splitSize, availableSpace).value_or(std::nullopt);
|
||||
}
|
||||
|
||||
@@ -26,10 +26,10 @@ namespace winrt::TerminalApp::implementation
|
||||
// Called after construction to perform the necessary setup, which relies on weak_ptr
|
||||
void Initialize();
|
||||
|
||||
winrt::Microsoft::Terminal::Control::TermControl GetActiveTerminalControl() const;
|
||||
winrt::Microsoft::Terminal::Settings::Model::Profile GetFocusedProfile() const noexcept;
|
||||
MTControl::TermControl GetActiveTerminalControl() const;
|
||||
MTSM::Profile GetFocusedProfile() const noexcept;
|
||||
|
||||
void Focus(winrt::Windows::UI::Xaml::FocusState focusState) override;
|
||||
void Focus(WUX::FocusState focusState) override;
|
||||
|
||||
winrt::fire_and_forget Scroll(const int delta);
|
||||
|
||||
@@ -37,9 +37,9 @@ namespace winrt::TerminalApp::implementation
|
||||
std::shared_ptr<Pane> DetachPane();
|
||||
void AttachPane(std::shared_ptr<Pane> pane);
|
||||
|
||||
void AttachColorPicker(winrt::TerminalApp::ColorPickupFlyout& colorPicker);
|
||||
void AttachColorPicker(MTApp::ColorPickupFlyout& colorPicker);
|
||||
|
||||
void SplitPane(winrt::Microsoft::Terminal::Settings::Model::SplitDirection splitType,
|
||||
void SplitPane(MTSM::SplitDirection splitType,
|
||||
const float splitSize,
|
||||
std::shared_ptr<Pane> newPane);
|
||||
|
||||
@@ -51,13 +51,13 @@ namespace winrt::TerminalApp::implementation
|
||||
winrt::fire_and_forget ActivateBellIndicatorTimer();
|
||||
|
||||
float CalcSnappedDimension(const bool widthOrHeight, const float dimension) const;
|
||||
std::optional<winrt::Microsoft::Terminal::Settings::Model::SplitDirection> PreCalculateCanSplit(winrt::Microsoft::Terminal::Settings::Model::SplitDirection splitType,
|
||||
const float splitSize,
|
||||
winrt::Windows::Foundation::Size availableSpace) const;
|
||||
std::optional<MTSM::SplitDirection> PreCalculateCanSplit(MTSM::SplitDirection splitType,
|
||||
const float splitSize,
|
||||
WF::Size availableSpace) const;
|
||||
|
||||
void ResizePane(const winrt::Microsoft::Terminal::Settings::Model::ResizeDirection& direction);
|
||||
bool NavigateFocus(const winrt::Microsoft::Terminal::Settings::Model::FocusDirection& direction);
|
||||
bool SwapPane(const winrt::Microsoft::Terminal::Settings::Model::FocusDirection& direction);
|
||||
void ResizePane(const MTSM::ResizeDirection& direction);
|
||||
bool NavigateFocus(const MTSM::FocusDirection& direction);
|
||||
bool SwapPane(const MTSM::FocusDirection& direction);
|
||||
bool FocusPane(const uint32_t id);
|
||||
|
||||
void UpdateSettings();
|
||||
@@ -82,17 +82,17 @@ namespace winrt::TerminalApp::implementation
|
||||
void EnterZoom();
|
||||
void ExitZoom();
|
||||
|
||||
std::vector<Microsoft::Terminal::Settings::Model::ActionAndArgs> BuildStartupActions() const override;
|
||||
std::vector<MTSM::ActionAndArgs> BuildStartupActions() const override;
|
||||
|
||||
int GetLeafPaneCount() const noexcept;
|
||||
|
||||
void TogglePaneReadOnly();
|
||||
std::shared_ptr<Pane> GetActivePane() const;
|
||||
winrt::TerminalApp::TaskbarState GetCombinedTaskbarState() const;
|
||||
MTApp::TaskbarState GetCombinedTaskbarState() const;
|
||||
|
||||
std::shared_ptr<Pane> GetRootPane() const { return _rootPane; }
|
||||
|
||||
winrt::TerminalApp::TerminalTabStatus TabStatus()
|
||||
MTApp::TerminalTabStatus TabStatus()
|
||||
{
|
||||
return _tabStatus;
|
||||
}
|
||||
@@ -113,10 +113,10 @@ namespace winrt::TerminalApp::implementation
|
||||
|
||||
winrt::hstring _lastIconPath{};
|
||||
std::optional<winrt::Windows::UI::Color> _runtimeTabColor{};
|
||||
winrt::TerminalApp::TabHeaderControl _headerControl{};
|
||||
winrt::TerminalApp::TerminalTabStatus _tabStatus{};
|
||||
MTApp::TabHeaderControl _headerControl{};
|
||||
MTApp::TerminalTabStatus _tabStatus{};
|
||||
|
||||
winrt::TerminalApp::ColorPickupFlyout _tabColorPickup{ nullptr };
|
||||
MTApp::ColorPickupFlyout _tabColorPickup{ nullptr };
|
||||
winrt::event_token _colorSelectedToken;
|
||||
winrt::event_token _colorClearedToken;
|
||||
winrt::event_token _pickerClosedToken;
|
||||
@@ -142,14 +142,14 @@ namespace winrt::TerminalApp::implementation
|
||||
|
||||
winrt::hstring _runtimeTabText{};
|
||||
bool _inRename{ false };
|
||||
winrt::Windows::UI::Xaml::Controls::TextBox::LayoutUpdated_revoker _tabRenameBoxLayoutUpdatedRevoker;
|
||||
WUXC::TextBox::LayoutUpdated_revoker _tabRenameBoxLayoutUpdatedRevoker;
|
||||
|
||||
winrt::TerminalApp::ShortcutActionDispatch _dispatch;
|
||||
MTApp::ShortcutActionDispatch _dispatch;
|
||||
|
||||
void _Setup();
|
||||
|
||||
std::optional<Windows::UI::Xaml::DispatcherTimer> _bellIndicatorTimer;
|
||||
void _BellIndicatorTimerTick(const Windows::Foundation::IInspectable& sender, const Windows::Foundation::IInspectable& e);
|
||||
std::optional<WUX::DispatcherTimer> _bellIndicatorTimer;
|
||||
void _BellIndicatorTimerTick(const WF::IInspectable& sender, const WF::IInspectable& e);
|
||||
|
||||
void _MakeTabViewItem() override;
|
||||
|
||||
@@ -158,8 +158,8 @@ namespace winrt::TerminalApp::implementation
|
||||
void _CreateContextMenu() override;
|
||||
virtual winrt::hstring _CreateToolTipTitle() override;
|
||||
|
||||
void _DetachEventHandlersFromControl(const uint32_t paneId, const winrt::Microsoft::Terminal::Control::TermControl& control);
|
||||
void _AttachEventHandlersToControl(const uint32_t paneId, const winrt::Microsoft::Terminal::Control::TermControl& control);
|
||||
void _DetachEventHandlersFromControl(const uint32_t paneId, const MTControl::TermControl& control);
|
||||
void _AttachEventHandlersToControl(const uint32_t paneId, const MTControl::TermControl& control);
|
||||
void _AttachEventHandlersToPane(std::shared_ptr<Pane> pane);
|
||||
|
||||
void _UpdateActivePane(std::shared_ptr<Pane> pane);
|
||||
@@ -172,7 +172,7 @@ namespace winrt::TerminalApp::implementation
|
||||
|
||||
void _DuplicateTab();
|
||||
|
||||
virtual winrt::Windows::UI::Xaml::Media::Brush _BackgroundBrush() override;
|
||||
virtual WUXMedia::Brush _BackgroundBrush() override;
|
||||
|
||||
friend class ::TerminalAppLocalTests::TabTests;
|
||||
};
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
TerminalTabStatus() = default;
|
||||
|
||||
WINRT_CALLBACK(PropertyChanged, Windows::UI::Xaml::Data::PropertyChangedEventHandler);
|
||||
WINRT_CALLBACK(PropertyChanged, WUX::Data::PropertyChangedEventHandler);
|
||||
WINRT_OBSERVABLE_PROPERTY(bool, IsPaneZoomed, _PropertyChangedHandlers);
|
||||
WINRT_OBSERVABLE_PROPERTY(bool, IsProgressRingActive, _PropertyChangedHandlers);
|
||||
WINRT_OBSERVABLE_PROPERTY(bool, IsProgressRingIndeterminate, _PropertyChangedHandlers);
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// This is how you register a PropertyChanged event for the Background
|
||||
// property of a Grid. The Background property is defined in the base
|
||||
// class Panel.
|
||||
const auto bgProperty{ winrt::Windows::UI::Xaml::Controls::Panel::BackgroundProperty() };
|
||||
const auto bgProperty{ WUXC::Panel::BackgroundProperty() };
|
||||
RegisterPropertyChangedCallback(bgProperty, [weakThis = get_weak(), bgProperty](auto& /*sender*/, auto& e) {
|
||||
if (auto self{ weakThis.get() })
|
||||
{
|
||||
@@ -63,7 +63,7 @@ namespace winrt::TerminalApp::implementation
|
||||
}
|
||||
|
||||
void TitlebarControl::Root_SizeChanged(const IInspectable& /*sender*/,
|
||||
const Windows::UI::Xaml::SizeChangedEventArgs& /*e*/)
|
||||
const WUX::SizeChangedEventArgs& /*e*/)
|
||||
{
|
||||
const auto windowWidth = ActualWidth();
|
||||
const auto minMaxCloseWidth = MinMaxCloseControl().ActualWidth();
|
||||
@@ -94,17 +94,17 @@ namespace winrt::TerminalApp::implementation
|
||||
}
|
||||
}
|
||||
|
||||
void TitlebarControl::Maximize_Click(const winrt::Windows::Foundation::IInspectable& /*sender*/, const winrt::Windows::UI::Xaml::RoutedEventArgs& /*e*/)
|
||||
void TitlebarControl::Maximize_Click(const WF::IInspectable& /*sender*/, const WUX::RoutedEventArgs& /*e*/)
|
||||
{
|
||||
_OnMaximizeOrRestore(HTMAXBUTTON);
|
||||
}
|
||||
|
||||
void TitlebarControl::DragBar_DoubleTapped(const winrt::Windows::Foundation::IInspectable& /*sender*/, const winrt::Windows::UI::Xaml::Input::DoubleTappedRoutedEventArgs& /*e*/)
|
||||
void TitlebarControl::DragBar_DoubleTapped(const WF::IInspectable& /*sender*/, const WUX::Input::DoubleTappedRoutedEventArgs& /*e*/)
|
||||
{
|
||||
_OnMaximizeOrRestore(HTCAPTION);
|
||||
}
|
||||
|
||||
void TitlebarControl::Minimize_Click(const winrt::Windows::Foundation::IInspectable& /*sender*/, const winrt::Windows::UI::Xaml::RoutedEventArgs& /*e*/)
|
||||
void TitlebarControl::Minimize_Click(const WF::IInspectable& /*sender*/, const WUX::RoutedEventArgs& /*e*/)
|
||||
{
|
||||
if (_window)
|
||||
{
|
||||
@@ -112,7 +112,7 @@ namespace winrt::TerminalApp::implementation
|
||||
}
|
||||
}
|
||||
|
||||
void TitlebarControl::Close_Click(const winrt::Windows::Foundation::IInspectable& /*sender*/, const winrt::Windows::UI::Xaml::RoutedEventArgs& /*e*/)
|
||||
void TitlebarControl::Close_Click(const WF::IInspectable& /*sender*/, const WUX::RoutedEventArgs& /*e*/)
|
||||
{
|
||||
::PostMessage(_window, WM_SYSCOMMAND, SC_CLOSE, 0);
|
||||
}
|
||||
@@ -165,15 +165,15 @@ namespace winrt::TerminalApp::implementation
|
||||
MinMaxCloseControl().ReleaseButtons();
|
||||
}
|
||||
|
||||
void TitlebarControl::_backgroundChanged(winrt::Windows::UI::Xaml::Media::Brush brush)
|
||||
void TitlebarControl::_backgroundChanged(WUXMedia::Brush brush)
|
||||
{
|
||||
// Loosely cribbed from TerminalPage::_SetNewTabButtonColor
|
||||
til::color c;
|
||||
if (auto acrylic = brush.try_as<winrt::Windows::UI::Xaml::Media::AcrylicBrush>())
|
||||
if (auto acrylic = brush.try_as<WUXMedia::AcrylicBrush>())
|
||||
{
|
||||
c = acrylic.TintColor();
|
||||
}
|
||||
else if (auto solidColor = brush.try_as<winrt::Windows::UI::Xaml::Media::SolidColorBrush>())
|
||||
else if (auto solidColor = brush.try_as<WUXMedia::SolidColorBrush>())
|
||||
{
|
||||
c = solidColor.Color();
|
||||
}
|
||||
@@ -183,8 +183,8 @@ namespace winrt::TerminalApp::implementation
|
||||
}
|
||||
|
||||
const auto isBrightColor = ColorHelper::IsBrightColor(c);
|
||||
MinMaxCloseControl().RequestedTheme(isBrightColor ? winrt::Windows::UI::Xaml::ElementTheme::Light :
|
||||
winrt::Windows::UI::Xaml::ElementTheme::Dark);
|
||||
MinMaxCloseControl().RequestedTheme(isBrightColor ? WUX::ElementTheme::Light :
|
||||
WUX::ElementTheme::Dark);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -21,18 +21,18 @@ namespace winrt::TerminalApp::implementation
|
||||
void Content(IInspectable content);
|
||||
|
||||
void SetWindowVisualState(WindowVisualState visualState);
|
||||
void Root_SizeChanged(const IInspectable& sender, const Windows::UI::Xaml::SizeChangedEventArgs& e);
|
||||
void Root_SizeChanged(const IInspectable& sender, const WUX::SizeChangedEventArgs& e);
|
||||
|
||||
void Minimize_Click(const winrt::Windows::Foundation::IInspectable& sender, const winrt::Windows::UI::Xaml::RoutedEventArgs& e);
|
||||
void Maximize_Click(const winrt::Windows::Foundation::IInspectable& sender, const winrt::Windows::UI::Xaml::RoutedEventArgs& e);
|
||||
void Close_Click(const winrt::Windows::Foundation::IInspectable& sender, const winrt::Windows::UI::Xaml::RoutedEventArgs& e);
|
||||
void DragBar_DoubleTapped(const winrt::Windows::Foundation::IInspectable& sender, const winrt::Windows::UI::Xaml::Input::DoubleTappedRoutedEventArgs& e);
|
||||
void Minimize_Click(const WF::IInspectable& sender, const WUX::RoutedEventArgs& e);
|
||||
void Maximize_Click(const WF::IInspectable& sender, const WUX::RoutedEventArgs& e);
|
||||
void Close_Click(const WF::IInspectable& sender, const WUX::RoutedEventArgs& e);
|
||||
void DragBar_DoubleTapped(const WF::IInspectable& sender, const WUX::Input::DoubleTappedRoutedEventArgs& e);
|
||||
|
||||
private:
|
||||
void _OnMaximizeOrRestore(byte flag);
|
||||
HWND _window{ nullptr }; // non-owning handle; should not be freed in the dtor.
|
||||
|
||||
void _backgroundChanged(winrt::Windows::UI::Xaml::Media::Brush brush);
|
||||
void _backgroundChanged(WUXMedia::Brush brush);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -5,13 +5,13 @@
|
||||
|
||||
#include "Toast.h"
|
||||
|
||||
using namespace winrt::Windows::Foundation;
|
||||
using namespace winrt::Windows::UI::Core;
|
||||
using namespace winrt::Windows::UI::Xaml;
|
||||
using namespace WF;
|
||||
using namespace WUC;
|
||||
using namespace WUX;
|
||||
|
||||
constexpr const auto ToastDuration = std::chrono::milliseconds(3000);
|
||||
|
||||
Toast::Toast(const winrt::Microsoft::UI::Xaml::Controls::TeachingTip& tip) :
|
||||
Toast::Toast(const MUXC::TeachingTip& tip) :
|
||||
_tip{ tip }
|
||||
{
|
||||
_timer.Interval(ToastDuration);
|
||||
|
||||
@@ -29,10 +29,10 @@ myToast->Open();
|
||||
class Toast : public std::enable_shared_from_this<Toast>
|
||||
{
|
||||
public:
|
||||
Toast(const winrt::Microsoft::UI::Xaml::Controls::TeachingTip& tip);
|
||||
Toast(const MUXC::TeachingTip& tip);
|
||||
void Open();
|
||||
|
||||
private:
|
||||
winrt::Microsoft::UI::Xaml::Controls::TeachingTip _tip;
|
||||
winrt::Windows::UI::Xaml::DispatcherTimer _timer;
|
||||
MUXC::TeachingTip _tip;
|
||||
WUX::DispatcherTimer _timer;
|
||||
};
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
// This is inexplicable, but for whatever reason, cppwinrt conflicts with the
|
||||
// SDK definition of this function, so the only fix is to undef it.
|
||||
// from WinBase.h
|
||||
// Windows::UI::Xaml::Media::Animation::IStoryboard::GetCurrentTime
|
||||
// WUXMedia::Animation::IStoryboard::GetCurrentTime
|
||||
#ifdef GetCurrentTime
|
||||
#undef GetCurrentTime
|
||||
#endif
|
||||
@@ -83,3 +83,4 @@ TRACELOGGING_DECLARE_PROVIDER(g_hTerminalAppProvider);
|
||||
|
||||
#include <cppwinrt_utils.h>
|
||||
#include <wil/cppwinrt_helpers.h> // must go after the CoreDispatcher type is defined
|
||||
#include <WinRTNamespaceAliases.h>
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
#include "ConsoleInputReader.h"
|
||||
|
||||
using namespace winrt;
|
||||
using namespace winrt::Windows::Foundation;
|
||||
using namespace winrt::Microsoft::Terminal::TerminalConnection;
|
||||
using namespace WF;
|
||||
using namespace MTConnection;
|
||||
|
||||
static til::size GetConsoleScreenSize(HANDLE outputHandle)
|
||||
{
|
||||
@@ -97,9 +97,9 @@ int wmain(int /*argc*/, wchar_t** /*argv*/)
|
||||
const auto size = GetConsoleScreenSize(conOut);
|
||||
|
||||
AzureConnection azureConn{};
|
||||
winrt::Windows::Foundation::Collections::ValueSet vs{};
|
||||
vs.Insert(L"initialRows", winrt::Windows::Foundation::PropertyValue::CreateUInt32(gsl::narrow_cast<uint32_t>(size.height)));
|
||||
vs.Insert(L"initialCols", winrt::Windows::Foundation::PropertyValue::CreateUInt32(gsl::narrow_cast<uint32_t>(size.width)));
|
||||
WFC::ValueSet vs{};
|
||||
vs.Insert(L"initialRows", WF::PropertyValue::CreateUInt32(gsl::narrow_cast<uint32_t>(size.height)));
|
||||
vs.Insert(L"initialCols", WF::PropertyValue::CreateUInt32(gsl::narrow_cast<uint32_t>(size.width)));
|
||||
azureConn.Initialize(vs);
|
||||
|
||||
const auto state = RunConnectionToCompletion(azureConn, conOut, conIn);
|
||||
|
||||
@@ -40,3 +40,4 @@ Abstract:
|
||||
#include <wil/win32_helpers.h>
|
||||
|
||||
#include <cppwinrt_utils.h>
|
||||
#include <WinRTNamespaceAliases.h>
|
||||
|
||||
@@ -71,12 +71,12 @@ namespace winrt::Microsoft::Terminal::TerminalConnection::implementation
|
||||
return (AzureClientID != L"0");
|
||||
}
|
||||
|
||||
void AzureConnection::Initialize(const Windows::Foundation::Collections::ValueSet& settings)
|
||||
void AzureConnection::Initialize(const WFC::ValueSet& settings)
|
||||
{
|
||||
if (settings)
|
||||
{
|
||||
_initialRows = gsl::narrow<til::CoordType>(winrt::unbox_value_or<uint32_t>(settings.TryLookup(L"initialRows").try_as<Windows::Foundation::IPropertyValue>(), _initialRows));
|
||||
_initialCols = gsl::narrow<til::CoordType>(winrt::unbox_value_or<uint32_t>(settings.TryLookup(L"initialCols").try_as<Windows::Foundation::IPropertyValue>(), _initialCols));
|
||||
_initialRows = gsl::narrow<til::CoordType>(winrt::unbox_value_or<uint32_t>(settings.TryLookup(L"initialRows").try_as<WF::IPropertyValue>(), _initialRows));
|
||||
_initialCols = gsl::narrow<til::CoordType>(winrt::unbox_value_or<uint32_t>(settings.TryLookup(L"initialCols").try_as<WF::IPropertyValue>(), _initialCols));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -432,7 +432,7 @@ namespace winrt::Microsoft::Terminal::TerminalConnection::implementation
|
||||
{
|
||||
auto oldVersionEncountered = false;
|
||||
auto vault = PasswordVault();
|
||||
winrt::Windows::Foundation::Collections::IVectorView<PasswordCredential> credList;
|
||||
WFC::IVectorView<PasswordCredential> credList;
|
||||
// FindAllByResource throws an exception if there are no credentials stored under the given resource so we wrap it in a try-catch block
|
||||
try
|
||||
{
|
||||
@@ -990,7 +990,7 @@ namespace winrt::Microsoft::Terminal::TerminalConnection::implementation
|
||||
void AzureConnection::_RemoveCredentials()
|
||||
{
|
||||
PasswordVault vault;
|
||||
winrt::Windows::Foundation::Collections::IVectorView<PasswordCredential> credList;
|
||||
WFC::IVectorView<PasswordCredential> credList;
|
||||
// FindAllByResource throws an exception if there are no credentials stored under the given resource so we wrap it in a try-catch block
|
||||
try
|
||||
{
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace winrt::Microsoft::Terminal::TerminalConnection::implementation
|
||||
static bool IsAzureConnectionAvailable() noexcept;
|
||||
|
||||
AzureConnection() = default;
|
||||
void Initialize(const Windows::Foundation::Collections::ValueSet& settings);
|
||||
void Initialize(const WFC::ValueSet& settings);
|
||||
|
||||
void Start();
|
||||
void WriteInput(const hstring& data);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user