Serialize the pane to a Content string, instead of just the guid.

There's a lot of renaming, signature changes here. But StartupActions is a good mechanism for passing panes around, more or less.
This commit is contained in:
Mike Griese
2022-07-14 13:01:00 -05:00
parent ac62de78a2
commit cfe879da96
23 changed files with 165 additions and 100 deletions

View File

@@ -1037,23 +1037,25 @@ namespace winrt::Microsoft::Terminal::Remoting::implementation
return winrt::single_threaded_vector(std::move(vec));
}
void Monarch::RequestMovePane(winrt::hstring window,
winrt::guid contentGuid,
uint32_t tabIndex)
void Monarch::RequestMoveContent(winrt::hstring window,
winrt::hstring content,
uint32_t tabIndex)
{
auto windowId = _lookupPeasantIdForName(window);
if (windowId == 0)
{ /* TODO! try the name as an integer ID */
{
/* TODO! try the name as an integer ID */
return;
}
if (auto targetPeasant{ _getPeasant(windowId) })
{
auto request = winrt::make_self<implementation::AttachRequest>(contentGuid, tabIndex);
targetPeasant.AttachPaneToWindow(*request);
auto request = winrt::make_self<implementation::AttachRequest>(content, tabIndex);
targetPeasant.AttachContentToWindow(*request);
}
else
{ /*TODO! log */
{
/*TODO! log */
}
}
}

View File

@@ -60,7 +60,7 @@ namespace winrt::Microsoft::Terminal::Remoting::implementation
Windows::Foundation::Collections::IVectorView<winrt::Microsoft::Terminal::Remoting::PeasantInfo> GetPeasantInfos();
Windows::Foundation::Collections::IVector<winrt::hstring> GetAllWindowLayouts();
void RequestMovePane(winrt::hstring window, winrt::guid contentGuid, uint32_t tabIndex);
void RequestMoveContent(winrt::hstring window, winrt::hstring content, uint32_t tabIndex);
TYPED_EVENT(FindTargetWindowRequested, winrt::Windows::Foundation::IInspectable, winrt::Microsoft::Terminal::Remoting::FindTargetWindowArgs);
TYPED_EVENT(ShowNotificationIconRequested, winrt::Windows::Foundation::IInspectable, winrt::Windows::Foundation::IInspectable);

View File

@@ -60,7 +60,7 @@ namespace Microsoft.Terminal.Remoting
Windows.Foundation.Collections.IVectorView<PeasantInfo> GetPeasantInfos { get; };
Windows.Foundation.Collections.IVector<String> GetAllWindowLayouts();
void RequestMovePane(String window, Guid contentGuid, UInt32 tabIndex);
void RequestMoveContent(String window, String content, UInt32 tabIndex);
event Windows.Foundation.TypedEventHandler<Object, FindTargetWindowArgs> FindTargetWindowRequested;
event Windows.Foundation.TypedEventHandler<Object, Object> ShowNotificationIconRequested;

View File

@@ -276,7 +276,7 @@ namespace winrt::Microsoft::Terminal::Remoting::implementation
TraceLoggingKeyword(TIL_KEYWORD_TRACE));
}
void Peasant::AttachPaneToWindow(Remoting::AttachRequest request)
void Peasant::AttachContentToWindow(Remoting::AttachRequest request)
{
try
{
@@ -287,8 +287,7 @@ namespace winrt::Microsoft::Terminal::Remoting::implementation
LOG_CAUGHT_EXCEPTION();
}
TraceLoggingWrite(g_hRemotingProvider,
"Peasant_AttachPaneToWindow",
"Peasant_AttachContentToWindow",
TraceLoggingLevel(WINEVENT_LEVEL_VERBOSE),
TraceLoggingKeyword(TIL_KEYWORD_TRACE));
}

View File

@@ -15,13 +15,14 @@ namespace winrt::Microsoft::Terminal::Remoting::implementation
{
struct AttachRequest : public AttachRequestT<AttachRequest>
{
WINRT_PROPERTY(winrt::guid, ContentGuid);
WINRT_PROPERTY(winrt::hstring, Content);
WINRT_PROPERTY(uint32_t, TabIndex);
public:
AttachRequest(winrt::guid contentGuid,
AttachRequest(winrt::hstring content,
uint32_t tabIndex) :
_ContentGuid{ contentGuid }, _TabIndex{ tabIndex } {};
_Content{ content },
_TabIndex{ tabIndex } {};
};
struct Peasant : public PeasantT<Peasant>
@@ -44,7 +45,7 @@ namespace winrt::Microsoft::Terminal::Remoting::implementation
void RequestQuitAll();
void Quit();
void AttachPaneToWindow(Remoting::AttachRequest request);
void AttachContentToWindow(Remoting::AttachRequest request);
winrt::Microsoft::Terminal::Remoting::WindowActivatedArgs GetLastActivatedArgs();

View File

@@ -53,7 +53,7 @@ namespace Microsoft.Terminal.Remoting
}
[default_interface] runtimeclass AttachRequest {
Guid ContentGuid { get; };
String Content { get; };
UInt32 TabIndex { get; };
}
@@ -82,7 +82,7 @@ namespace Microsoft.Terminal.Remoting
void Quit();
String GetWindowLayout();
void AttachPaneToWindow(AttachRequest request);
void AttachContentToWindow(AttachRequest request);
event Windows.Foundation.TypedEventHandler<Object, WindowActivatedArgs> WindowActivated;

View File

@@ -789,12 +789,12 @@ namespace winrt::Microsoft::Terminal::Remoting::implementation
return nullptr;
}
winrt::fire_and_forget WindowManager::RequestMovePane(winrt::hstring window,
winrt::guid contentGuid,
uint32_t tabIndex)
winrt::fire_and_forget WindowManager::RequestMoveContent(winrt::hstring window,
winrt::hstring content,
uint32_t tabIndex)
{
co_await winrt::resume_background();
_monarch.RequestMovePane(window, contentGuid, tabIndex);
_monarch.RequestMoveContent(window, content, tabIndex);
}
}

View File

@@ -52,7 +52,7 @@ namespace winrt::Microsoft::Terminal::Remoting::implementation
void UpdateActiveTabTitle(winrt::hstring title);
Windows::Foundation::Collections::IVector<winrt::hstring> GetAllWindowLayouts();
winrt::fire_and_forget RequestMovePane(winrt::hstring window, winrt::guid contentGuid, uint32_t tabIndex);
winrt::fire_and_forget RequestMoveContent(winrt::hstring window, winrt::hstring content, uint32_t tabIndex);
TYPED_EVENT(FindTargetWindowRequested, winrt::Windows::Foundation::IInspectable, winrt::Microsoft::Terminal::Remoting::FindTargetWindowArgs);
TYPED_EVENT(BecameMonarch, winrt::Windows::Foundation::IInspectable, winrt::Windows::Foundation::IInspectable);

View File

@@ -25,7 +25,7 @@ namespace Microsoft.Terminal.Remoting
Windows.Foundation.Collections.IVectorView<PeasantInfo> GetPeasantInfos();
void RequestMovePane(String window, Guid contentGuid, UInt32 tabIndex);
void RequestMoveContent(String window, String content, UInt32 tabIndex);
event Windows.Foundation.TypedEventHandler<Object, FindTargetWindowArgs> FindTargetWindowRequested;
event Windows.Foundation.TypedEventHandler<Object, Object> BecameMonarch;

View File

@@ -1660,11 +1660,11 @@ namespace winrt::TerminalApp::implementation
return _settings.GlobalSettings().CurrentTheme();
}
void AppLogic::AttachPane(winrt::guid contentGuid, uint32_t tabIndex)
void AppLogic::AttachContent(winrt::hstring content, uint32_t tabIndex)
{
if (_root)
{
_root->AttachPane(contentGuid, tabIndex);
_root->AttachContent(content, tabIndex);
}
}
}

View File

@@ -124,7 +124,7 @@ namespace winrt::TerminalApp::implementation
bool GetAlwaysShowNotificationIcon();
bool GetShowTitleInTitlebar();
void AttachPane(winrt::guid contentGuid, uint32_t tabIndex);
void AttachContent(winrt::hstring content, uint32_t tabIndex);
winrt::Windows::Foundation::IAsyncOperation<winrt::Windows::UI::Xaml::Controls::ContentDialogResult> ShowDialog(winrt::Windows::UI::Xaml::Controls::ContentDialog dialog);
void DismissDialog();
@@ -224,7 +224,7 @@ namespace winrt::TerminalApp::implementation
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(RequestMovePane, Windows::Foundation::IInspectable, winrt::TerminalApp::RequestMovePaneArgs, _root, RequestMovePane);
FORWARDED_TYPED_EVENT(RequestMoveContent, Windows::Foundation::IInspectable, winrt::TerminalApp::RequestMoveContentArgs, _root, RequestMoveContent);
#ifdef UNIT_TESTING
friend class TerminalAppLocalTests::CommandlineTest;

View File

@@ -110,7 +110,7 @@ namespace TerminalApp
Microsoft.Terminal.Settings.Model.Theme Theme { get; };
FindTargetWindowResult FindTargetWindow(String[] args);
void AttachPane(Guid contentGuid, UInt32 tabIndex);
void AttachContent(String content, UInt32 tabIndex);
Windows.Foundation.Collections.IMapView<Microsoft.Terminal.Control.KeyChord, Microsoft.Terminal.Settings.Model.Command> GlobalHotkeys();
@@ -140,7 +140,7 @@ namespace TerminalApp
event Windows.Foundation.TypedEventHandler<Object, TerminalApp.SystemMenuChangeArgs> SystemMenuChangeRequested;
event Windows.Foundation.TypedEventHandler<Object, Microsoft.Terminal.Control.ShowWindowArgs> ShowWindowChanged;
event Windows.Foundation.TypedEventHandler<Object, RequestMovePaneArgs> RequestMovePane;
event Windows.Foundation.TypedEventHandler<Object, RequestMoveContentArgs> RequestMoveContent;
}
}

View File

@@ -119,7 +119,7 @@ Pane::Pane(std::shared_ptr<Pane> first,
// - <none>
// Return Value:
// - Arguments appropriate for a SplitPane or NewTab action
NewTerminalArgs Pane::GetTerminalArgsForPane() const
NewTerminalArgs Pane::GetTerminalArgsForPane(const bool asContent) const
{
// Leaves are the only things that have controls
assert(_IsLeaf());
@@ -164,6 +164,11 @@ NewTerminalArgs Pane::GetTerminalArgsForPane() const
// object. That would work for schemes set by the Terminal, but not ones set
// by VT, but that seems good enough.
if (asContent)
{
args.ContentGuid(_control.ContentGuid());
}
return args;
}
@@ -175,14 +180,15 @@ NewTerminalArgs Pane::GetTerminalArgsForPane() const
// Arguments:
// - currentId: the id to use for the current/first pane
// - nextId: the id to use for a new pane if we split
// - asContent: TODO!
// Return Value:
// - The state from building the startup actions, includes a vector of commands,
// the original root pane, the id of the focused pane, and the number of panes
// created.
Pane::BuildStartupState Pane::BuildStartupActions(uint32_t currentId, uint32_t nextId)
Pane::BuildStartupState Pane::BuildStartupActions(uint32_t currentId, uint32_t nextId, const bool asContent)
{
// if we are a leaf then all there is to do is defer to the parent.
if (_IsLeaf())
if (!asContent && _IsLeaf())
{
if (_lastActive)
{
@@ -195,7 +201,7 @@ Pane::BuildStartupState Pane::BuildStartupActions(uint32_t currentId, uint32_t n
auto buildSplitPane = [&](auto newPane) {
ActionAndArgs actionAndArgs;
actionAndArgs.Action(ShortcutAction::SplitPane);
const auto terminalArgs{ newPane->GetTerminalArgsForPane() };
const auto terminalArgs{ newPane->GetTerminalArgsForPane(asContent) };
// When creating a pane the split size is the size of the new pane
// and not position.
const auto splitDirection = _splitState == SplitState::Horizontal ? SplitDirection::Down : SplitDirection::Right;
@@ -205,6 +211,11 @@ Pane::BuildStartupState Pane::BuildStartupActions(uint32_t currentId, uint32_t n
return actionAndArgs;
};
if (asContent && _IsLeaf())
{
return { { buildSplitPane(shared_from_this()) }, shared_from_this(), currentId, 1 };
}
auto buildMoveFocus = [](auto direction) {
MoveFocusArgs args{ direction };

View File

@@ -91,8 +91,8 @@ public:
std::optional<uint32_t> focusedPaneId;
uint32_t panesCreated;
};
BuildStartupState BuildStartupActions(uint32_t currentId, uint32_t nextId);
winrt::Microsoft::Terminal::Settings::Model::NewTerminalArgs GetTerminalArgsForPane() const;
BuildStartupState BuildStartupActions(uint32_t currentId, uint32_t nextId, const bool asContent = false);
winrt::Microsoft::Terminal::Settings::Model::NewTerminalArgs GetTerminalArgsForPane(const bool asContent = false) const;
void UpdateSettings(const winrt::Microsoft::Terminal::Settings::Model::TerminalSettingsCreateResult& settings,
const winrt::Microsoft::Terminal::Settings::Model::Profile& profile);

View File

@@ -6,7 +6,7 @@
#include "TerminalPage.h"
#include "TerminalPage.g.cpp"
#include "RenameWindowRequestedArgs.g.cpp"
#include "RequestMovePaneArgs.g.cpp"
#include "RequestMoveContentArgs.g.cpp"
#include <filesystem>
@@ -1829,13 +1829,34 @@ namespace winrt::TerminalApp::implementation
if (!windowId.empty())
{
if (const auto& control{ _GetActiveControl() })
if (const auto terminalTab{ _GetFocusedTabImpl() })
{
const auto currentContentGuid{ control.ContentGuid() };
auto request = winrt::make_self<RequestMovePaneArgs>(currentContentGuid, args);
_RequestMovePaneHandlers(*this, *request);
return true;
if (const auto pane{ terminalTab->GetActivePane() })
{
auto startupActions = pane->BuildStartupActions(0, 1, true);
auto winRtActions{ winrt::single_threaded_vector<ActionAndArgs>(std::move(startupActions.args)) };
// Json::Value json{ Json::objectValue };
// SetValueForKey(json, "content", winRtActions);
// Json::StreamWriterBuilder wbuilder;
// auto str = Json::writeString(wbuilder, json);
auto str = ActionAndArgs::Serialize(winRtActions);
auto request = winrt::make_self<RequestMoveContentArgs>(args.Window(),
str,
args.TabIndex());
_RequestMoveContentHandlers(*this, *request);
return true;
}
}
//if (const auto& control{ _GetActiveControl() })
//{
// const auto currentContentGuid{ control.ContentGuid() };
// auto request = winrt::make_self<RequestMoveCoArgs>(currentContentGuid, args);
// _RequestMovePaneHandlers(*this, *request);
// return true;
//}
}
// If we are trying to move from the current tab to the current tab do nothing.
@@ -1868,47 +1889,55 @@ namespace winrt::TerminalApp::implementation
return true;
}
winrt::fire_and_forget TerminalPage::AttachPane(winrt::guid contentGuid, uint32_t tabIndex)
winrt::fire_and_forget TerminalPage::AttachContent(winrt::hstring content, uint32_t tabIndex)
{
contentGuid;
tabIndex;
co_await winrt::resume_background();
const auto contentProc = _AttachToContentProcess(contentGuid);
contentProc;
Settings::Model::NewTerminalArgs newTerminalArgs{ nullptr };
auto profile = _settings.GetProfileForArgs(newTerminalArgs);
auto controlSettings = TerminalSettings::CreateWithNewTerminalArgs(_settings, newTerminalArgs, *_bindings);
co_await winrt::resume_foreground(Dispatcher());
auto newControl = _InitControl(controlSettings, contentProc.Guid());
// Hookup our event handlers to the new terminal
_RegisterTerminalEvents(newControl);
auto resultPane = std::make_shared<Pane>(profile, newControl);
_UnZoomIfNeeded();
uint32_t realIndex = std::min(tabIndex, _tabs.Size() - 1);
// if (_tabs.Size() > tabIndex)
// {
auto targetTab = _GetTerminalTabImpl(_tabs.GetAt(realIndex));
targetTab->SplitPane(SplitDirection::Automatic, .5f, resultPane);
// After GH#6586, the control will no longer focus itself
// automatically when it's finished being laid out. Manually focus
// the control here instead.
if (_startupState == StartupState::Initialized)
/*
{
_GetActiveControl().Focus(FocusState::Programmatic);
}
// }
// else
// {
// realSplitType = tab.PreCalculateAutoSplit(availableSpace);
contentGuid;
tabIndex;
co_await winrt::resume_background();
const auto contentProc = _AttachToContentProcess(contentGuid);
contentProc;
// tab.SplitPane(realSplitType, splitSize, profile, newControl);
// }
Settings::Model::NewTerminalArgs newTerminalArgs{ nullptr };
auto profile = _settings.GetProfileForArgs(newTerminalArgs);
auto controlSettings = TerminalSettings::CreateWithNewTerminalArgs(_settings, newTerminalArgs, *_bindings);
co_await winrt::resume_foreground(Dispatcher());
auto newControl = _InitControl(controlSettings, contentProc.Guid());
// Hookup our event handlers to the new terminal
_RegisterTerminalEvents(newControl);
auto resultPane = std::make_shared<Pane>(profile, newControl);
_UnZoomIfNeeded();
uint32_t realIndex = std::min(tabIndex, _tabs.Size() - 1);
// if (_tabs.Size() > tabIndex)
// {
auto targetTab = _GetTerminalTabImpl(_tabs.GetAt(realIndex));
targetTab->SplitPane(SplitDirection::Automatic, .5f, resultPane);
// After GH#6586, the control will no longer focus itself
// automatically when it's finished being laid out. Manually focus
// the control here instead.
if (_startupState == StartupState::Initialized)
{
_GetActiveControl().Focus(FocusState::Programmatic);
}
// }
// else
// {
// realSplitType = tab.PreCalculateAutoSplit(availableSpace);
// tab.SplitPane(realSplitType, splitSize, profile, newControl);
// }
}
*/
content;
tabIndex;
co_await wil::resume_foreground(Dispatcher());
}
// Method Description:
// - Split the focused pane either horizontally or vertically, and place the

View File

@@ -8,7 +8,7 @@
#include "AppKeyBindings.h"
#include "AppCommandlineArgs.h"
#include "RenameWindowRequestedArgs.g.h"
#include "RequestMovePaneArgs.g.h"
#include "RequestMoveContentArgs.g.h"
#include "Toast.h"
#define DECLARE_ACTION_HANDLER(action) void _Handle##action(const IInspectable& sender, const Microsoft::Terminal::Settings::Model::ActionEventArgs& args);
@@ -51,16 +51,17 @@ namespace winrt::TerminalApp::implementation
_ProposedName{ name } {};
};
struct RequestMovePaneArgs : RequestMovePaneArgsT<RequestMovePaneArgs>
struct RequestMoveContentArgs : RequestMoveContentArgsT<RequestMoveContentArgs>
{
WINRT_PROPERTY(winrt::guid, ContentGuid);
WINRT_PROPERTY(Microsoft::Terminal::Settings::Model::MovePaneArgs, Args, nullptr);
WINRT_PROPERTY(winrt::hstring, Window);
WINRT_PROPERTY(winrt::hstring, Content);
WINRT_PROPERTY(uint32_t, TabIndex);
public:
RequestMovePaneArgs(const winrt::guid& g,
Microsoft::Terminal::Settings::Model::MovePaneArgs args) :
_ContentGuid{ g },
_Args{ args } {};
RequestMoveContentArgs(const winrt::hstring window, const winrt::hstring content, uint32_t tabIndex) :
_Window{ window },
_Content{ content },
_TabIndex{ tabIndex } {};
};
struct PreparedContent
@@ -157,7 +158,7 @@ namespace winrt::TerminalApp::implementation
void OpenSettingsUI();
void WindowActivated(const bool activated);
winrt::fire_and_forget AttachPane(winrt::guid contentGuid, uint32_t tabIndex);
winrt::fire_and_forget AttachContent(winrt::hstring content, uint32_t tabIndex);
WINRT_CALLBACK(PropertyChanged, Windows::UI::Xaml::Data::PropertyChangedEventHandler);
@@ -182,7 +183,7 @@ namespace winrt::TerminalApp::implementation
TYPED_EVENT(QuitRequested, IInspectable, IInspectable);
TYPED_EVENT(ShowWindowChanged, IInspectable, winrt::Microsoft::Terminal::Control::ShowWindowArgs)
TYPED_EVENT(RequestMovePane, Windows::Foundation::IInspectable, winrt::TerminalApp::RequestMovePaneArgs);
TYPED_EVENT(RequestMoveContent, Windows::Foundation::IInspectable, winrt::TerminalApp::RequestMoveContentArgs);
WINRT_OBSERVABLE_PROPERTY(winrt::Windows::UI::Xaml::Media::Brush, TitlebarBrush, _PropertyChangedHandlers, nullptr);

View File

@@ -10,10 +10,11 @@ namespace TerminalApp
{
String ProposedName { get; };
};
[default_interface] runtimeclass RequestMovePaneArgs
[default_interface] runtimeclass RequestMoveContentArgs
{
Microsoft.Terminal.Settings.Model.MovePaneArgs Args { get; };
Guid ContentGuid { get; };
String Window { get; };
String Content { get; };
UInt32 TabIndex { get; };
};
interface IDialogPresenter
@@ -49,7 +50,7 @@ namespace TerminalApp
String KeyboardServiceDisabledText { get; };
TaskbarState TaskbarState{ get; };
void AttachPane(Guid contentGuid, UInt32 tabIndex);
void AttachContent(String content, UInt32 tabIndex);
Windows.UI.Xaml.Media.Brush TitlebarBrush { get; };
void WindowActivated(Boolean activated);
@@ -71,7 +72,7 @@ namespace TerminalApp
event Windows.Foundation.TypedEventHandler<Object, Object> OpenSystemMenu;
event Windows.Foundation.TypedEventHandler<Object, Microsoft.Terminal.Control.ShowWindowArgs> ShowWindowChanged;
event Windows.Foundation.TypedEventHandler<Object, RequestMovePaneArgs> RequestMovePane;
event Windows.Foundation.TypedEventHandler<Object, RequestMoveContentArgs> RequestMoveContent;
}
}

View File

@@ -417,4 +417,14 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
const auto found = GeneratedActionNames.find(_Action);
return found != GeneratedActionNames.end() ? found->second : L"";
}
winrt::hstring ActionAndArgs::Serialize(winrt::Windows::Foundation::Collections::IVector<Model::ActionAndArgs> args)
{
Json::Value json{ Json::objectValue };
JsonUtils::SetValueForKey(json, "actions", args);
Json::StreamWriterBuilder wbuilder;
auto str = Json::writeString(wbuilder, json);
return winrt::to_hstring(str);
}
}

View File

@@ -16,6 +16,8 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
std::vector<SettingsLoadWarnings>& warnings);
static Json::Value ToJson(const Model::ActionAndArgs& val);
static winrt::hstring Serialize(winrt::Windows::Foundation::Collections::IVector<Model::ActionAndArgs> args);
ActionAndArgs() = default;
ActionAndArgs(ShortcutAction action);
ActionAndArgs(ShortcutAction action, IActionArgs args) :

View File

@@ -281,6 +281,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
static constexpr std::string_view SuppressApplicationTitleKey{ "suppressApplicationTitle" };
static constexpr std::string_view ColorSchemeKey{ "colorScheme" };
static constexpr std::string_view ElevateKey{ "elevate" };
static constexpr std::string_view ContentKey{ "__content" };
public:
hstring GenerateName() const;
@@ -299,7 +300,8 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
otherAsUs->_Profile == _Profile &&
otherAsUs->_SuppressApplicationTitle == _SuppressApplicationTitle &&
otherAsUs->_ColorScheme == _ColorScheme &&
otherAsUs->_Elevate == _Elevate;
otherAsUs->_Elevate == _Elevate &&
otherAsUs->_ContentGuid == _ContentGuid;
}
return false;
};
@@ -316,6 +318,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
JsonUtils::GetValueForKey(json, SuppressApplicationTitleKey, args->_SuppressApplicationTitle);
JsonUtils::GetValueForKey(json, ColorSchemeKey, args->_ColorScheme);
JsonUtils::GetValueForKey(json, ElevateKey, args->_Elevate);
JsonUtils::GetValueForKey(json, ContentKey, args->_ContentGuid);
return *args;
}
static Json::Value ToJson(const Model::NewTerminalArgs& val)
@@ -335,6 +338,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
JsonUtils::SetValueForKey(json, SuppressApplicationTitleKey, args->_SuppressApplicationTitle);
JsonUtils::SetValueForKey(json, ColorSchemeKey, args->_ColorScheme);
JsonUtils::SetValueForKey(json, ElevateKey, args->_Elevate);
JsonUtils::SetValueForKey(json, ContentKey, args->_ContentGuid);
return json;
}
Model::NewTerminalArgs Copy() const
@@ -349,6 +353,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
copy->_SuppressApplicationTitle = _SuppressApplicationTitle;
copy->_ColorScheme = _ColorScheme;
copy->_Elevate = _Elevate;
copy->_ContentGuid = _ContentGuid;
return *copy;
}
size_t Hash() const
@@ -368,6 +373,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
h.write(SuppressApplicationTitle());
h.write(ColorScheme());
h.write(Elevate());
h.write(ContentGuid());
}
};
}

View File

@@ -132,7 +132,7 @@ namespace Microsoft.Terminal.Settings.Model
// not modify whatever the profile's value is (either true or false)
Windows.Foundation.IReference<Boolean> Elevate;
Guid ContentGuid{ get; };
Guid ContentGuid{ get; set; };
Boolean Equals(NewTerminalArgs other);
String GenerateName();

View File

@@ -24,6 +24,8 @@ namespace Microsoft.Terminal.Settings.Model
ActionAndArgs();
ActionAndArgs(ShortcutAction action, IActionArgs args);
static String Serialize(IVector<ActionAndArgs> args);
IActionArgs Args;
ShortcutAction Action;
};

View File

@@ -332,7 +332,7 @@ void AppHost::_HandleCommandlineArgs()
// TODO! add revoker
peasant.AttachRequested([this](auto&&, Remoting::AttachRequest args) {
_logic.AttachPane(args.ContentGuid(), args.TabIndex());
_logic.AttachContent(args.Content(), args.TabIndex());
});
_logic.WindowName(peasant.WindowName());
@@ -430,8 +430,9 @@ void AppHost::Initialize()
_revokers.QuitRequested = _logic.QuitRequested(winrt::auto_revoke, { this, &AppHost::_RequestQuitAll });
_revokers.ShowWindowChanged = _logic.ShowWindowChanged(winrt::auto_revoke, { this, &AppHost::_ShowWindowChanged });
// TODO! revoker
_logic.RequestMovePane([this](auto&&, winrt::TerminalApp::RequestMovePaneArgs args) {
_windowManager.RequestMovePane(args.Args().Window(), args.ContentGuid(), args.Args().TabIndex());
// TODO! move to member method
_logic.RequestMoveContent([this](auto&&, winrt::TerminalApp::RequestMoveContentArgs args) {
_windowManager.RequestMoveContent(args.Window(), args.Content(), args.TabIndex());
});
// BODGY