Skip to content
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

Make GlobalAppSettings a WinRT object #7349

Merged
8 commits merged into from
Aug 28, 2020
Merged

Conversation

carlos-zamora
Copy link
Member

@carlos-zamora carlos-zamora commented Aug 19, 2020

GlobalAppSettings is now a WinRT object in the TerminalApp project.

References

#7141 - GlobalAppSettings is a settings object
#885 - this new settings object will be moved to a new TerminalSettingsModel project

PR Checklist

  • Tests passed

Detailed Description of the Pull Request / Additional comments

This one was probably the easiest thus far.

The only weird thing is how we handle InitialPosition. Today, we lose a
little bit of fidelity when we convert from LaunchPosition (int) -->
Point (float) --> RECT (long). The current change converts
LaunchPosition (optional) --> InitialPosition (long) --> RECT
(long).

NOTE: Though I could use LaunchPosition to go directly from TermApp to
AppHost, I decided to introduce InitialPosition because LaunchPosition
will be a part of TerminalSettingsModel soon.

Validation Steps Performed

  • Tests passed
  • Deployment succeeded

@carlos-zamora carlos-zamora added Product-Terminal The new Windows Terminal. Issue-Task It's a feature request, but it doesn't really need a major design. Area-CodeHealth Issues related to code cleanliness, linting, rules, warnings, errors, static analysis, etc. labels Aug 19, 2020
@carlos-zamora carlos-zamora force-pushed the dev/cazamor/set/winrt-app-obj-prof branch from b8f476b to 1a20cb3 Compare August 20, 2020 06:21
@carlos-zamora carlos-zamora force-pushed the dev/cazamor/set/winrt-app-obj-glob branch from 37d6010 to 4b4dd7a Compare August 20, 2020 23:59
@carlos-zamora carlos-zamora force-pushed the dev/cazamor/set/winrt-app-obj-prof branch from 6051822 to 8396b2d Compare August 21, 2020 03:59
@carlos-zamora carlos-zamora force-pushed the dev/cazamor/set/winrt-app-obj-glob branch from 4b4dd7a to 5fe8795 Compare August 21, 2020 04:20
@carlos-zamora carlos-zamora force-pushed the dev/cazamor/set/winrt-app-obj-prof branch from 8396b2d to 32b9223 Compare August 21, 2020 20:34
@carlos-zamora carlos-zamora force-pushed the dev/cazamor/set/winrt-app-obj-glob branch 2 times, most recently from 269f005 to 58dcf17 Compare August 24, 2020 23:26
@carlos-zamora carlos-zamora marked this pull request as ready for review August 24, 2020 23:26
@carlos-zamora carlos-zamora requested a review from a team August 24, 2020 23:31
Copy link
Member

@zadjii-msft zadjii-msft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huh, none of these look blocking to me. Good work!

src/cascadia/TerminalApp/GlobalAppSettings.cpp Outdated Show resolved Hide resolved
@@ -27,73 +28,74 @@ namespace TerminalAppLocalTests
class ColorSchemeTests;
};

namespace TerminalApp
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

protip: hide whitespace changes

GETSET_PROPERTY(winrt::Microsoft::Terminal::TerminalControl::CopyFormat, CopyFormatting, 0);
GETSET_PROPERTY(bool, WarnAboutLargePaste, true);
GETSET_PROPERTY(bool, WarnAboutMultiLinePaste, true);
GETSET_PROPERTY(winrt::TerminalApp::LaunchPosition, InitialPosition, nullptr, nullptr);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm shocked that nullptr, nullptr worked here, but happy that it does

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clever macro. uses __VA_ARGS__ to splat "everything at the end"

proposedRect.left = gsl::narrow_cast<long>(initialPosition.X);
proposedRect.top = gsl::narrow_cast<long>(initialPosition.Y);
auto initialPos = _logic.GetInitialPosition(proposedRect.left, proposedRect.top);
proposedRect.left = static_cast<long>(initialPos.X);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

of course long !== int64_t. That's annoying

Copy link
Member

@DHowett DHowett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

only tiny nits!

GETSET_PROPERTY(winrt::Microsoft::Terminal::TerminalControl::CopyFormat, CopyFormatting, 0);
GETSET_PROPERTY(bool, WarnAboutLargePaste, true);
GETSET_PROPERTY(bool, WarnAboutMultiLinePaste, true);
GETSET_PROPERTY(winrt::TerminalApp::LaunchPosition, InitialPosition, nullptr, nullptr);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clever macro. uses __VA_ARGS__ to splat "everything at the end"

src/cascadia/TerminalApp/GlobalAppSettings.h Outdated Show resolved Hide resolved
src/cascadia/TerminalApp/GlobalAppSettings.idl Outdated Show resolved Hide resolved
src/cascadia/TerminalApp/Profile.idl Outdated Show resolved Hide resolved
@ghost ghost added the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Aug 27, 2020
@carlos-zamora carlos-zamora force-pushed the dev/cazamor/set/winrt-app-obj-glob branch from a150e15 to 6d5c578 Compare August 28, 2020 00:30
@ghost ghost removed the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Aug 28, 2020
@ghost ghost closed this Aug 28, 2020
@carlos-zamora carlos-zamora reopened this Aug 28, 2020
@carlos-zamora carlos-zamora changed the base branch from dev/cazamor/set/winrt-app-obj-prof to master August 28, 2020 01:13
@carlos-zamora carlos-zamora force-pushed the dev/cazamor/set/winrt-app-obj-glob branch from c8398bc to 7cd72aa Compare August 28, 2020 01:14
@carlos-zamora carlos-zamora added the AutoMerge Marked for automatic merge by the bot when requirements are met label Aug 28, 2020
@ghost
Copy link

ghost commented Aug 28, 2020

Hello @carlos-zamora!

Because this pull request has the AutoMerge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msftbot) and give me an instruction to get started! Learn more here.

@ghost ghost merged commit 7803efa into master Aug 28, 2020
@ghost ghost deleted the dev/cazamor/set/winrt-app-obj-glob branch August 28, 2020 03:49
@ghost
Copy link

ghost commented Sep 22, 2020

🎉Windows Terminal Preview v1.4.2652.0 has been released which incorporates this pull request.:tada:

Handy links:

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-CodeHealth Issues related to code cleanliness, linting, rules, warnings, errors, static analysis, etc. AutoMerge Marked for automatic merge by the bot when requirements are met Issue-Task It's a feature request, but it doesn't really need a major design. Product-Terminal The new Windows Terminal.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants