From c6d975df3220dd8d2d8c676321111803e891bfe2 Mon Sep 17 00:00:00 2001 From: MCpiroman Date: Sat, 4 Jan 2020 11:22:56 +0100 Subject: [PATCH] Initial PR fixes that won't tear things apart --- src/cascadia/TerminalApp/ActionArgs.idl | 4 ++-- src/cascadia/TerminalApp/LeafPane.cpp | 9 ++++++--- src/cascadia/TerminalApp/LeafPane.h | 9 +++++++-- src/cascadia/TerminalApp/Pane.h | 5 ++++- src/cascadia/TerminalApp/ParentPane.cpp | 5 +++-- src/cascadia/TerminalApp/ParentPane.h | 8 +++++++- src/cascadia/TerminalApp/Tab.cpp | 6 +++--- 7 files changed, 32 insertions(+), 14 deletions(-) diff --git a/src/cascadia/TerminalApp/ActionArgs.idl b/src/cascadia/TerminalApp/ActionArgs.idl index a3c2892f76db..ab7a6f3e92c9 100644 --- a/src/cascadia/TerminalApp/ActionArgs.idl +++ b/src/cascadia/TerminalApp/ActionArgs.idl @@ -25,8 +25,8 @@ namespace TerminalApp enum SplitState { - Vertical = 0, - Horizontal = 1 + Vertical, + Horizontal }; [default_interface] runtimeclass NewTerminalArgs { diff --git a/src/cascadia/TerminalApp/LeafPane.cpp b/src/cascadia/TerminalApp/LeafPane.cpp index 6f19eaa29b30..bbc5eb2565dd 100644 --- a/src/cascadia/TerminalApp/LeafPane.cpp +++ b/src/cascadia/TerminalApp/LeafPane.cpp @@ -1,3 +1,6 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + #include "pch.h" #include "LeafPane.h" #include "Profile.h" @@ -14,9 +17,9 @@ using namespace winrt::Microsoft::Terminal::TerminalConnection; using namespace winrt::TerminalApp; using namespace TerminalApp; -static const int PaneBorderSize = 2; -static const int CombinedPaneBorderSize = 2 * PaneBorderSize; -static const float Half = 0.50f; +static constexpr int PaneBorderSize = 2; +static constexpr int CombinedPaneBorderSize = 2 * PaneBorderSize; +static constexpr float Half = 0.50f; winrt::Windows::UI::Xaml::Media::SolidColorBrush LeafPane::s_focusedBorderBrush = { nullptr }; winrt::Windows::UI::Xaml::Media::SolidColorBrush LeafPane::s_unfocusedBorderBrush = { nullptr }; diff --git a/src/cascadia/TerminalApp/LeafPane.h b/src/cascadia/TerminalApp/LeafPane.h index 2792d9c7760a..9f45d43d6375 100644 --- a/src/cascadia/TerminalApp/LeafPane.h +++ b/src/cascadia/TerminalApp/LeafPane.h @@ -1,3 +1,6 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + #pragma once #include "Pane.h" #include "ParentPane.h" @@ -18,12 +21,14 @@ DEFINE_ENUM_FLAG_OPERATORS(Borders); class LeafPane : public Pane, public std::enable_shared_from_this { public: - struct SplitResult; - LeafPane(const GUID& profile, const winrt::Microsoft::Terminal::TerminalControl::TermControl& control, const bool lastFocused = false); ~LeafPane() override; + LeafPane(const LeafPane&) = delete; + LeafPane(LeafPane&&) = delete; + LeafPane& operator=(const LeafPane&) = delete; + LeafPane& operator=(LeafPane&&) = delete; std::shared_ptr FindActivePane() override; void PropagateToLeaves(std::function action) override; diff --git a/src/cascadia/TerminalApp/Pane.h b/src/cascadia/TerminalApp/Pane.h index 70207810df69..51e4284e41ea 100644 --- a/src/cascadia/TerminalApp/Pane.h +++ b/src/cascadia/TerminalApp/Pane.h @@ -19,7 +19,6 @@ // - Mike Griese (zadjii-msft) 16-May-2019 #pragma once -#include #include #include "../../cascadia/inc/cppwinrt_utils.h" @@ -30,6 +29,10 @@ class Pane { public: virtual ~Pane() = default; + Pane(const Pane&) = delete; + Pane(Pane&&) = delete; + Pane& operator=(const Pane&) = delete; + Pane& operator=(Pane&&) = delete; winrt::Windows::UI::Xaml::Controls::Grid GetRootElement() const; diff --git a/src/cascadia/TerminalApp/ParentPane.cpp b/src/cascadia/TerminalApp/ParentPane.cpp index 0d080467957c..6e53c56643f1 100644 --- a/src/cascadia/TerminalApp/ParentPane.cpp +++ b/src/cascadia/TerminalApp/ParentPane.cpp @@ -1,3 +1,6 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + #include "pch.h" #include "ParentPane.h" #include "Profile.h" @@ -9,8 +12,6 @@ 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; -using namespace winrt::Microsoft::Terminal::TerminalControl; -using namespace winrt::Microsoft::Terminal::TerminalConnection; using namespace winrt::TerminalApp; using namespace TerminalApp; diff --git a/src/cascadia/TerminalApp/ParentPane.h b/src/cascadia/TerminalApp/ParentPane.h index d9b5e44e12b8..4ff0e6052c27 100644 --- a/src/cascadia/TerminalApp/ParentPane.h +++ b/src/cascadia/TerminalApp/ParentPane.h @@ -1,15 +1,21 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + #pragma once #include "Pane.h" #include "LeafPane.h" #include #include "../../cascadia/inc/cppwinrt_utils.h" -#include class ParentPane : public Pane, public std::enable_shared_from_this { public: ParentPane(std::shared_ptr firstChild, std::shared_ptr secondChild, winrt::TerminalApp::SplitState splitState, float splitPosition, winrt::Windows::Foundation::Size currentSize); ~ParentPane() override; + ParentPane(const ParentPane&) = delete; + ParentPane(ParentPane&&) = delete; + ParentPane& operator=(const ParentPane&) = delete; + ParentPane& operator=(ParentPane&&) = delete; void InitializeChildren(); diff --git a/src/cascadia/TerminalApp/Tab.cpp b/src/cascadia/TerminalApp/Tab.cpp index c74fe2e3ed07..216de5943c0b 100644 --- a/src/cascadia/TerminalApp/Tab.cpp +++ b/src/cascadia/TerminalApp/Tab.cpp @@ -265,7 +265,7 @@ float Tab::CalcSnappedDimension(const bool widthOrHeight, const float dimension) // - void Tab::ResizeContent(const winrt::Windows::Foundation::Size& newSize) { - // NOTE: This _must_ be called on the root pane, so that it can propogate + // NOTE: This _must_ be called on the root pane, so that it can propagate // throughout the entire tree. _rootPane->ResizeContent(newSize); } @@ -279,7 +279,7 @@ void Tab::ResizeContent(const winrt::Windows::Foundation::Size& newSize) // - void Tab::ResizePane(const winrt::TerminalApp::Direction& direction) { - // NOTE: This _must_ be called on the root pane, so that it can propogate + // NOTE: This _must_ be called on the root pane, so that it can propagate // throughout the entire tree. if (const auto rootPaneAsParent = std::dynamic_pointer_cast(_rootPane)) @@ -297,7 +297,7 @@ void Tab::ResizePane(const winrt::TerminalApp::Direction& direction) // - void Tab::NavigateFocus(const winrt::TerminalApp::Direction& direction) { - // NOTE: This _must_ be called on the root pane, so that it can propogate + // NOTE: This _must_ be called on the root pane, so that it can propagate // throughout the entire tree. if (const auto rootPaneAsParent = std::dynamic_pointer_cast(_rootPane))