Skip to content

Commit

Permalink
Initial PR fixes that won't tear things apart
Browse files Browse the repository at this point in the history
  • Loading branch information
mcpiroman committed Jan 11, 2020
1 parent 205b395 commit b5a04b1
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 14 deletions.
4 changes: 2 additions & 2 deletions src/cascadia/TerminalApp/ActionArgs.idl
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ namespace TerminalApp

enum SplitState
{
Vertical = 0,
Horizontal = 1
Vertical,
Horizontal
};

[default_interface] runtimeclass NewTerminalArgs {
Expand Down
9 changes: 6 additions & 3 deletions src/cascadia/TerminalApp/LeafPane.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

#include "pch.h"
#include "LeafPane.h"
#include "Profile.h"
Expand All @@ -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 };

Expand Down
9 changes: 7 additions & 2 deletions src/cascadia/TerminalApp/LeafPane.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

#pragma once
#include "Pane.h"
#include "ParentPane.h"
Expand All @@ -18,12 +21,14 @@ DEFINE_ENUM_FLAG_OPERATORS(Borders);
class LeafPane : public Pane, public std::enable_shared_from_this<LeafPane>
{
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<LeafPane> FindActivePane() override;
void PropagateToLeaves(std::function<void(LeafPane&)> action) override;
Expand Down
5 changes: 4 additions & 1 deletion src/cascadia/TerminalApp/Pane.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
// - Mike Griese (zadjii-msft) 16-May-2019

#pragma once
#include <functional>
#include <winrt/TerminalApp.h>
#include "../../cascadia/inc/cppwinrt_utils.h"

Expand All @@ -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;

Expand Down
5 changes: 3 additions & 2 deletions src/cascadia/TerminalApp/ParentPane.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

#include "pch.h"
#include "ParentPane.h"
#include "Profile.h"
Expand All @@ -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;

Expand Down
8 changes: 7 additions & 1 deletion src/cascadia/TerminalApp/ParentPane.h
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

#pragma once
#include "Pane.h"
#include "LeafPane.h"
#include <winrt/TerminalApp.h>
#include "../../cascadia/inc/cppwinrt_utils.h"
#include <winrt/Microsoft.Terminal.TerminalControl.h>

class ParentPane : public Pane, public std::enable_shared_from_this<ParentPane>
{
public:
ParentPane(std::shared_ptr<LeafPane> firstChild, std::shared_ptr<LeafPane> 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();

Expand Down
6 changes: 3 additions & 3 deletions src/cascadia/TerminalApp/Tab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ float Tab::CalcSnappedDimension(const bool widthOrHeight, const float dimension)
// - <none>
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);
}
Expand All @@ -280,7 +280,7 @@ void Tab::ResizeContent(const winrt::Windows::Foundation::Size& newSize)
// - <none>
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<ParentPane>(_rootPane))
Expand All @@ -298,7 +298,7 @@ void Tab::ResizePane(const winrt::TerminalApp::Direction& direction)
// - <none>
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<ParentPane>(_rootPane))
Expand Down

0 comments on commit b5a04b1

Please sign in to comment.