-
Notifications
You must be signed in to change notification settings - Fork 8.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add actions missing in schema, descriptions for
toggleRetroEffect
(#…
…6806) ## Summary of the Pull Request In the wake of #6635, a couple things got missed in merges: * `toggleRetroEffect` didn't get into the schema, nor did `renameTab` or `commandPalette`. * `toggleRetroEffect` also didn't get a name Furthermore, I thought it might be a good idea to start sticking commands into `bindings` even without `keys`. So I tried doing that for `opentabColorPicker` and `toggleRetroEffect`, and found immediately that the labels for the key chord still appear even when the text is empty. So I added some XAML magic to hide those when the text is empty. ## References * #6762 * #6691 * #6557 * #6635 ## PR Checklist * [x] Closes #6762 * [x] I work here * [x] Tests added/passed * [n/a] Requires documentation to be updated ## Detailed Description of the Pull Request / Additional comments * See also: https://docs.microsoft.com/en-us/windows/uwp/data-binding/data-binding-quickstart#formatting-or-converting-data-values-for-display - make sure to switch to C++/WinRT at the top! ## Validation Steps Performed Removed all my manual actions, ran the Terminal: 
- Loading branch information
1 parent
29f0690
commit 5bc31a1
Showing
10 changed files
with
113 additions
and
3 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
|
@@ -1147,6 +1147,7 @@ IUI | |
IUia | ||
IUnknown | ||
ivalid | ||
IValue | ||
IVector | ||
IWait | ||
iwch | ||
|
This file contains 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 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
38 changes: 38 additions & 0 deletions
38
src/cascadia/TerminalApp/CommandKeyChordVisibilityConverter.cpp
This file contains 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,38 @@ | ||
#include "pch.h" | ||
#include "CommandKeyChordVisibilityConverter.h" | ||
#include "CommandKeyChordVisibilityConverter.g.cpp" | ||
|
||
using namespace winrt::Windows; | ||
using namespace winrt::Windows::UI::Xaml; | ||
|
||
namespace winrt::TerminalApp::implementation | ||
{ | ||
// Method Description: | ||
// - Attempt to convert something into another type. For the | ||
// CommandKeyChordVisibilityConverter, we're gonna check if `value` is a | ||
// string, and try and convert it into a Visibility value. If the input | ||
// param wasn't a string, or was the empty string, we'll return | ||
// Visibility::Collapsed. Otherwise, we'll return Visible. | ||
|
||
// Arguments: | ||
// - value: the input object to attempt to convert into a Visibility. | ||
// Return Value: | ||
// - Visible if the object was a string and wasn't the empty string. | ||
Foundation::IInspectable CommandKeyChordVisibilityConverter::Convert(Foundation::IInspectable const& value, | ||
Windows::UI::Xaml::Interop::TypeName const& /* targetType */, | ||
Foundation::IInspectable const& /* parameter */, | ||
hstring const& /* language */) | ||
{ | ||
const auto& name = winrt::unbox_value_or<hstring>(value, L""); | ||
return winrt::box_value(name.empty() ? Visibility::Collapsed : Visibility::Visible); | ||
} | ||
|
||
// unused for one-way bindings | ||
Foundation::IInspectable CommandKeyChordVisibilityConverter::ConvertBack(Foundation::IInspectable const& /* value */, | ||
Windows::UI::Xaml::Interop::TypeName const& /* targetType */, | ||
Foundation::IInspectable const& /* parameter */, | ||
hstring const& /* language */) | ||
{ | ||
throw hresult_not_implemented(); | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
src/cascadia/TerminalApp/CommandKeyChordVisibilityConverter.h
This file contains 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,27 @@ | ||
#pragma once | ||
|
||
#include "CommandKeyChordVisibilityConverter.g.h" | ||
#include "..\inc\cppwinrt_utils.h" | ||
|
||
namespace winrt::TerminalApp::implementation | ||
{ | ||
struct CommandKeyChordVisibilityConverter : CommandKeyChordVisibilityConverterT<CommandKeyChordVisibilityConverter> | ||
{ | ||
CommandKeyChordVisibilityConverter() = default; | ||
|
||
Windows::Foundation::IInspectable Convert(Windows::Foundation::IInspectable const& value, | ||
Windows::UI::Xaml::Interop::TypeName const& targetType, | ||
Windows::Foundation::IInspectable const& parameter, | ||
hstring const& language); | ||
|
||
Windows::Foundation::IInspectable ConvertBack(Windows::Foundation::IInspectable const& value, | ||
Windows::UI::Xaml::Interop::TypeName const& targetType, | ||
Windows::Foundation::IInspectable const& parameter, | ||
hstring const& language); | ||
}; | ||
} | ||
|
||
namespace winrt::TerminalApp::factory_implementation | ||
{ | ||
BASIC_FACTORY(CommandKeyChordVisibilityConverter); | ||
} |
19 changes: 19 additions & 0 deletions
19
src/cascadia/TerminalApp/CommandKeyChordVisibilityConverter.idl
This file contains 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,19 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT license. | ||
|
||
namespace TerminalApp | ||
{ | ||
// See https://docs.microsoft.com/en-us/windows/uwp/data-binding/data-binding-quickstart | ||
|
||
// We use the default attribute to declare IValueConverter as the default | ||
// interface. In the listing, CommandKeyChordVisibilityConverter has only a | ||
// constructor, and no methods, so no default interface is generated for it. | ||
// The default attribute is optimal if you won't be adding instance members | ||
// to CommandKeyChordVisibilityConverter, because no QueryInterface will be | ||
// required to call the IValueConverter methods | ||
runtimeclass CommandKeyChordVisibilityConverter : [default] Windows.UI.Xaml.Data.IValueConverter | ||
{ | ||
CommandKeyChordVisibilityConverter(); | ||
}; | ||
|
||
} |
This file contains 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 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 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 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