Repository navigation
Snap to character grid when resizing window #3181
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Dustin L. Howett (MSFT) (DHowett-MSFT)
merged 29 commits into
microsoft:master
from
mcpiroman:2834-snap-to-char-grid
Jan 8, 2020
Merged
Changes from all commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
b8a5725
Kinda works, no splitted panes
mcpiroman 68f613b
Calc sizes more accurately
mcpiroman 5d0f1d3
General work, add resolution for children along resize axis
mcpiroman 90649b2
Partially fix child displacement
mcpiroman cbda911
Change child layout algorithm, now 100% correct
mcpiroman d69f8ed
Cache padding and scrollbar width, fix infinite loop
mcpiroman b732e74
(drastically) optimize layout algorithm ( O(n^m) -> O(n) )
mcpiroman 0ecbec5
Fix minimum pane size calculation
mcpiroman 3dcd00f
Style, comments, format; fix layout just after split
mcpiroman 583541d
Review changes
mcpiroman b00fef8
Fix rebase
mcpiroman 5e9b31c
Undo caching of padding and scrollbar size
mcpiroman bed02c5
Some review changes
mcpiroman 76d4945
Merge with master
mcpiroman 9a95e18
Fix height calculation in non client window
mcpiroman 11fcd51
Some additional comments I had time for
mcpiroman 8034bb4
Finish comment in pane.h
mcpiroman 14cc2d8
Merge with master 2
mcpiroman eb67b82
Things that should've gone with merge
mcpiroman b4febc8
Cleanup & format
mcpiroman cae3963
More comments
mcpiroman 63ed26a
Review refactor, partly fix border size calculations
mcpiroman b0097d2
Small PR changes
mcpiroman cb0186a
Move Pane.LayoutSizeNode.cpp out of lib folder
mcpiroman bada548
Merge with master 3
mcpiroman 24a88a5
Merge branch 'master' into 2834-snap-to-char-grid
mcpiroman 8cf35e8
Merge branch 'master' into 2834-snap-to-char-grid
mcpiroman b933528
Github apparently switched files to LF, so revert that
mcpiroman 1ebddfc
Some things that miniksa mentioned in #4068
mcpiroman File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| // Copyright (c) Microsoft Corporation. | ||
| // Licensed under the MIT license. | ||
|
|
||
| #include "pch.h" | ||
| #include "Pane.h" | ||
|
|
||
| Pane::LayoutSizeNode::LayoutSizeNode(const float minSize) : | ||
| size{ minSize }, | ||
| isMinimumSize{ true }, | ||
| firstChild{ nullptr }, | ||
| secondChild{ nullptr }, | ||
| nextFirstChild{ nullptr }, | ||
| nextSecondChild{ nullptr } | ||
| { | ||
| } | ||
|
|
||
| Pane::LayoutSizeNode::LayoutSizeNode(const LayoutSizeNode& other) : | ||
| size{ other.size }, | ||
| isMinimumSize{ other.isMinimumSize }, | ||
| firstChild{ other.firstChild ? std::make_unique<LayoutSizeNode>(*other.firstChild) : nullptr }, | ||
| secondChild{ other.secondChild ? std::make_unique<LayoutSizeNode>(*other.secondChild) : nullptr }, | ||
| nextFirstChild{ other.nextFirstChild ? std::make_unique<LayoutSizeNode>(*other.nextFirstChild) : nullptr }, | ||
| nextSecondChild{ other.nextSecondChild ? std::make_unique<LayoutSizeNode>(*other.nextSecondChild) : nullptr } | ||
| { | ||
| } | ||
|
|
||
| // Method Description: | ||
| // - Makes sure that this node and all its descendants equal the supplied node. | ||
| // This may be more efficient that copy construction since it will reuse its | ||
| // allocated children. | ||
| // Arguments: | ||
| // - other: Node to take the values from. | ||
| // Return Value: | ||
| // - itself | ||
| Pane::LayoutSizeNode& Pane::LayoutSizeNode::operator=(const LayoutSizeNode& other) | ||
| { | ||
| size = other.size; | ||
| isMinimumSize = other.isMinimumSize; | ||
|
|
||
| _AssignChildNode(firstChild, other.firstChild.get()); | ||
| _AssignChildNode(secondChild, other.secondChild.get()); | ||
| _AssignChildNode(nextFirstChild, other.nextFirstChild.get()); | ||
| _AssignChildNode(nextSecondChild, other.nextSecondChild.get()); | ||
|
|
||
| return *this; | ||
| } | ||
|
|
||
| // Method Description: | ||
| // - Performs assignment operation on a single child node reusing | ||
| // - current one if present. | ||
| // Arguments: | ||
| // - nodeField: Reference to our field holding concerned node. | ||
| // - other: Node to take the values from. | ||
| // Return Value: | ||
| // - <none> | ||
| void Pane::LayoutSizeNode::_AssignChildNode(std::unique_ptr<LayoutSizeNode>& nodeField, const LayoutSizeNode* const newNode) | ||
| { | ||
| if (newNode) | ||
| { | ||
| if (nodeField) | ||
| { | ||
| *nodeField = *newNode; | ||
| } | ||
| else | ||
| { | ||
| nodeField = std::make_unique<LayoutSizeNode>(*newNode); | ||
| } | ||
| } | ||
| else | ||
| { | ||
| nodeField.release(); | ||
| } | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.