Skip to content

Commit

Permalink
Align the tooltip, and change the text to what @cinnamon-msft wanted
Browse files Browse the repository at this point in the history
  • Loading branch information
zadjii-msft committed Feb 23, 2021
1 parent 05d48ca commit 764b07c
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 10 deletions.
14 changes: 12 additions & 2 deletions src/cascadia/TerminalSettingsEditor/Actions.cpp
Expand Up @@ -7,8 +7,10 @@
#include "ActionsPageNavigationState.g.cpp"
#include "EnumEntry.h"

using namespace winrt::Windows::UI::Xaml::Navigation;
using namespace winrt::Windows::Foundation;
using namespace winrt::Windows::System;
using namespace winrt::Windows::UI::Core;
using namespace winrt::Windows::UI::Xaml::Navigation;
using namespace winrt::Microsoft::Terminal::Settings::Model;

namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
Expand Down Expand Up @@ -45,7 +47,15 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
void Actions::_OpenSettingsClick(const IInspectable& /*sender*/,
const Windows::UI::Xaml::RoutedEventArgs& /*eventArgs*/)
{
_State.RequestOpenJson();
const CoreWindow window = CoreWindow::GetForCurrentThread();
const auto rAltState = window.GetKeyState(VirtualKey::RightMenu);
const auto lAltState = window.GetKeyState(VirtualKey::LeftMenu);
const bool altPressed = WI_IsFlagSet(lAltState, CoreVirtualKeyStates::Down) ||
WI_IsFlagSet(rAltState, CoreVirtualKeyStates::Down);

const auto target = altPressed ? SettingsTarget::DefaultsFile : SettingsTarget::SettingsFile;

_State.RequestOpenJson(target);
}

}
4 changes: 2 additions & 2 deletions src/cascadia/TerminalSettingsEditor/Actions.h
Expand Up @@ -15,9 +15,9 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
ActionsPageNavigationState(const Model::CascadiaSettings& settings) :
_Settings{ settings } {}

void RequestOpenJson()
void RequestOpenJson(const Model::SettingsTarget target)
{
_OpenJsonHandlers(nullptr, winrt::Microsoft::Terminal::Settings::Model::SettingsTarget::SettingsFile);
_OpenJsonHandlers(nullptr, target);
}

GETSET_PROPERTY(Model::CascadiaSettings, Settings, nullptr)
Expand Down
2 changes: 1 addition & 1 deletion src/cascadia/TerminalSettingsEditor/Actions.idl
Expand Up @@ -8,7 +8,7 @@ namespace Microsoft.Terminal.Settings.Editor
runtimeclass ActionsPageNavigationState
{
Microsoft.Terminal.Settings.Model.CascadiaSettings Settings;
void RequestOpenJson();
void RequestOpenJson(Microsoft.Terminal.Settings.Model.SettingsTarget target);
event Windows.Foundation.TypedEventHandler<Object, Microsoft.Terminal.Settings.Model.SettingsTarget> OpenJson;
};

Expand Down
6 changes: 5 additions & 1 deletion src/cascadia/TerminalSettingsEditor/Actions.xaml
Expand Up @@ -160,7 +160,11 @@ the MIT License. See LICENSE in the project root for license information. -->
<StackPanel Style="{StaticResource SettingsStackStyle}">
<TextBlock x:Uid="Globals_KeybindingsDisclaimer"
Style="{StaticResource DisclaimerStyle}"/>
<HyperlinkButton x:Uid="Globals_KeybindingsLink"

<!-- The Nav_OpenJSON resource just so happens to have a .Content
and .Tooltip that are _exactly_ what we're looking for here. -->

<HyperlinkButton x:Uid="Nav_OpenJSON"

This comment has been minimized.

Copy link
@DHowett

DHowett Feb 23, 2021

Member

thankgod

Click="_OpenSettingsClick" />

<!-- Keybindings -->
Expand Down
Expand Up @@ -193,10 +193,7 @@
<value>Automatically copy selection to clipboard</value>
</data>
<data name="Globals_KeybindingsDisclaimer.Text" xml:space="preserve">
<value>This is a list of the currently bound keys. Currently, these can only be edited in the settings file.</value>
</data>
<data name="Globals_KeybindingsLink.Content" xml:space="preserve">
<value>Open JSON settings</value>
<value>Below are the currently bound keys, which can be modified by editing the JSON settings file.</value>
</data>
<data name="Globals_DefaultProfile.Header" xml:space="preserve">
<value>Default profile</value>
Expand Down

0 comments on commit 764b07c

Please sign in to comment.