First CR review change
This commit is contained in:
parent
bdfd5d41a6
commit
65e62a0fd3
|
@ -16,7 +16,6 @@ using namespace winrt::Microsoft::Terminal;
|
|||
using namespace winrt::Microsoft::Terminal::Settings;
|
||||
using namespace winrt::Microsoft::Terminal::TerminalControl;
|
||||
using namespace ::TerminalApp;
|
||||
using namespace winrt::TerminalApp;
|
||||
|
||||
namespace winrt
|
||||
{
|
||||
|
@ -29,9 +28,7 @@ namespace winrt::TerminalApp::implementation
|
|||
App::App() :
|
||||
_settings{},
|
||||
_loadedInitialSettings{ false },
|
||||
_settingsLoadedResult{ S_OK },
|
||||
_dialogLock{},
|
||||
_resourceLoader{ L"TerminalApp/Resources" }
|
||||
_settingsLoadedResult{ S_OK }
|
||||
{
|
||||
// For your own sanity, it's better to do setup outside the ctor.
|
||||
// If you do any setup in the ctor that ends up throwing an exception,
|
||||
|
@ -71,14 +68,14 @@ namespace winrt::TerminalApp::implementation
|
|||
// Remove the TabView from the page. We'll hang on to it, we need to
|
||||
// put it in the titlebar.
|
||||
uint32_t index = 0;
|
||||
TerminalApp::TabRowControl* tabRow = terminalPage->GetTabRow();
|
||||
if (terminalPage->Root().Children().IndexOf(*tabRow, index))
|
||||
TerminalApp::TabRowControl tabRow = terminalPage->GetTabRow();
|
||||
if (terminalPage->Root().Children().IndexOf(tabRow, index))
|
||||
{
|
||||
terminalPage->Root().Children().RemoveAt(index);
|
||||
}
|
||||
|
||||
// Inform the host that our titlebar content has changed.
|
||||
_setTitleBarContentHandlers(*this, *tabRow);
|
||||
_setTitleBarContentHandlers(*this, tabRow);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -273,8 +270,6 @@ namespace winrt::TerminalApp::implementation
|
|||
_settingsLoadedResult = _TryLoadSettings(false);
|
||||
|
||||
auto terminalPage = _root.as<TerminalPage>();
|
||||
// Update the settings in TerminalPage
|
||||
terminalPage->SetSettings(_settings.get());
|
||||
|
||||
if (FAILED(_settingsLoadedResult))
|
||||
{
|
||||
|
@ -290,6 +285,9 @@ namespace winrt::TerminalApp::implementation
|
|||
// Here, we successfully reloaded the settings, and created a new
|
||||
// TerminalSettings object.
|
||||
|
||||
// Update the settings in TerminalPage
|
||||
terminalPage->SetSettings(_settings.get());
|
||||
|
||||
// Inform Page to update the UI
|
||||
terminalPage->RefreshUIAfterSettingsReloaded();
|
||||
|
||||
|
|
|
@ -54,7 +54,6 @@ namespace winrt::TerminalApp::implementation
|
|||
HRESULT _settingsLoadedResult;
|
||||
|
||||
bool _loadedInitialSettings;
|
||||
std::shared_mutex _dialogLock;
|
||||
|
||||
ScopedResourceLoader _resourceLoader;
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
namespace TerminalApp
|
||||
{
|
||||
delegate void LastTabClosedEventArgs();
|
||||
[default_interface] runtimeclass App : Microsoft.Toolkit.Win32.UI.XamlHost.XamlApplication
|
||||
{
|
||||
App();
|
||||
|
|
|
@ -36,7 +36,6 @@ namespace winrt
|
|||
namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
TerminalPage::TerminalPage() :
|
||||
_settings{ nullptr },
|
||||
_tabs{},
|
||||
_dialogLock{}
|
||||
{
|
||||
|
@ -1172,9 +1171,9 @@ namespace winrt::TerminalApp::implementation
|
|||
_ShowAboutDialog();
|
||||
}
|
||||
|
||||
TerminalApp::TabRowControl* TerminalPage::GetTabRow()
|
||||
TerminalApp::TabRowControl TerminalPage::GetTabRow()
|
||||
{
|
||||
return &_tabRow;
|
||||
return _tabRow;
|
||||
}
|
||||
|
||||
// -------------------------------- WinRT Events ---------------------------------
|
||||
|
|
|
@ -35,7 +35,7 @@ namespace winrt::TerminalApp::implementation
|
|||
|
||||
void ShowOkDialog(const winrt::hstring& titleKey, const winrt::hstring& contentKey);
|
||||
|
||||
TerminalApp::TabRowControl* GetTabRow(); // This is a work-around because the winrt events are not working in Page
|
||||
TerminalApp::TabRowControl GetTabRow(); // This is a work-around because the winrt events are not working in Page
|
||||
|
||||
// -------------------------------- WinRT Events ---------------------------------
|
||||
DECLARE_EVENT(TitleChanged, _titleChangeHandlers, winrt::Microsoft::Terminal::TerminalControl::TitleChangedEventArgs);
|
||||
|
@ -47,7 +47,7 @@ namespace winrt::TerminalApp::implementation
|
|||
Windows::UI::Xaml::Controls::Grid _tabContent{ nullptr };
|
||||
Windows::UI::Xaml::Controls::SplitButton _newTabButton{ nullptr };
|
||||
|
||||
::TerminalApp::CascadiaSettings* _settings;
|
||||
::TerminalApp::CascadiaSettings* _settings{ nullptr };
|
||||
|
||||
std::vector<std::shared_ptr<Tab>> _tabs;
|
||||
|
||||
|
@ -61,29 +61,38 @@ namespace winrt::TerminalApp::implementation
|
|||
|
||||
void _RegisterTerminalEvents(Microsoft::Terminal::TerminalControl::TermControl term, std::shared_ptr<Tab> hostingTab);
|
||||
|
||||
// Todo: add more event implementations here
|
||||
// MSFT:20641986: Add keybindings for New Window
|
||||
fire_and_forget _ShowDialog(const IInspectable& titleElement,
|
||||
const IInspectable& contentElement,
|
||||
const winrt::hstring& closeButtonText);
|
||||
void _ShowAboutDialog();
|
||||
|
||||
void _UpdateTitle(std::shared_ptr<Tab> tab);
|
||||
void _UpdateTabIcon(std::shared_ptr<Tab> tab);
|
||||
void _UpdateTabView();
|
||||
|
||||
void _DuplicateTabViewItem();
|
||||
void _SelectNextTab(const bool bMoveRight);
|
||||
void _SelectTab(const int tabIndex);
|
||||
void _MoveFocus(const Direction& direction);
|
||||
void _CloseFocusedTab();
|
||||
void _CloseFocusedPane();
|
||||
|
||||
winrt::Microsoft::Terminal::TerminalControl::TermControl _GetFocusedControl();
|
||||
int _GetFocusedTabIndex() const;
|
||||
void _SetFocusedTabIndex(int tabIndex);
|
||||
|
||||
void _RemoveTabViewItem(const IInspectable& tabViewItem);
|
||||
|
||||
// Todo: add more event implementations here
|
||||
// MSFT:20641986: Add keybindings for New Window
|
||||
void _Scroll(int delta);
|
||||
void _SplitVertical(const std::optional<GUID>& profileGuid);
|
||||
void _SplitHorizontal(const std::optional<GUID>& profileGuid);
|
||||
void _SplitPane(const Pane::SplitState splitType, const std::optional<GUID>& profileGuid);
|
||||
void _ResizePane(const Direction& direction);
|
||||
void _ScrollPage(int delta);
|
||||
void _SelectTab(const int tabIndex);
|
||||
void _OpenSettings();
|
||||
fire_and_forget LaunchSettings();
|
||||
fire_and_forget _ShowDialog(const IInspectable& titleElement,
|
||||
const IInspectable& contentElement,
|
||||
const winrt::hstring& closeButtonText);
|
||||
void _ShowAboutDialog();
|
||||
static Windows::UI::Xaml::Controls::IconElement _GetIconFromProfile(const ::TerminalApp::Profile& profile);
|
||||
void _SetAcceleratorForMenuItem(Windows::UI::Xaml::Controls::MenuFlyoutItem& menuItem, const winrt::Microsoft::Terminal::Settings::KeyChord& keyChord);
|
||||
|
||||
|
@ -94,17 +103,12 @@ namespace winrt::TerminalApp::implementation
|
|||
void _PasteText();
|
||||
static fire_and_forget PasteFromClipboard(winrt::Microsoft::Terminal::TerminalControl::PasteFromClipboardEventArgs eventArgs);
|
||||
|
||||
void _RemoveTabViewItem(const IInspectable& tabViewItem);
|
||||
|
||||
winrt::Microsoft::Terminal::TerminalControl::TermControl _GetFocusedControl();
|
||||
int _GetFocusedTabIndex() const;
|
||||
void _SetFocusedTabIndex(int tabIndex);
|
||||
|
||||
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 _OnContentSizeChanged(const IInspectable& /*sender*/, Windows::UI::Xaml::SizeChangedEventArgs const& e);
|
||||
void _OnTabClosing(const IInspectable& sender, const Microsoft::UI::Xaml::Controls::TabViewTabClosingEventArgs& eventArgs);
|
||||
|
||||
void _SettingsButtonOnClick(const IInspectable& sender, const Windows::UI::Xaml::RoutedEventArgs& eventArgs);
|
||||
void _FeedbackButtonOnClick(const IInspectable& sender, const Windows::UI::Xaml::RoutedEventArgs& eventArgs);
|
||||
void _AboutButtonOnClick(const IInspectable& sender, const Windows::UI::Xaml::RoutedEventArgs& eventArgs);
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
import "..\App.idl";
|
||||
|
||||
namespace TerminalApp
|
||||
{
|
||||
delegate void LastTabClosedEventArgs();
|
||||
[default_interface] runtimeclass TerminalPage : Windows.UI.Xaml.Controls.Page
|
||||
{
|
||||
TerminalPage();
|
||||
|
|
Loading…
Reference in a new issue