-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Fix broken reset button on some profile settings #12275
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -115,6 +115,22 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation | |
Opacity(1.0); | ||
} | ||
} | ||
else if (viewModelProperty == L"AntialiasingMode") | ||
{ | ||
_NotifyChanges(L"CurrentAntiAliasingMode"); | ||
} | ||
else if (viewModelProperty == L"CloseOnExit") | ||
{ | ||
_NotifyChanges(L"CurrentCloseOnExitMode"); | ||
} | ||
else if (viewModelProperty == L"BellStyle") | ||
{ | ||
_NotifyChanges(L"IsBellStyleFlagSet"); | ||
} | ||
else if (viewModelProperty == L"ScrollState") | ||
{ | ||
_NotifyChanges(L"CurrentScrollState"); | ||
} | ||
Comment on lines
+118
to
+133
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This got moved over from This is step 2 of my PR description. |
||
}); | ||
|
||
// Do the same for the starting directory | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -77,12 +77,6 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation | |
void DeleteUnfocusedAppearance(); | ||
bool AtlasEngineAvailable() const noexcept; | ||
|
||
WINRT_PROPERTY(bool, IsBaseLayer, false); | ||
WINRT_PROPERTY(IHostedInWindow, WindowRoot, nullptr); | ||
GETSET_BINDABLE_ENUM_SETTING(AntiAliasingMode, Microsoft::Terminal::Control::TextAntialiasingMode, _profile, AntialiasingMode); | ||
GETSET_BINDABLE_ENUM_SETTING(CloseOnExitMode, Microsoft::Terminal::Settings::Model::CloseOnExitMode, _profile, CloseOnExit); | ||
GETSET_BINDABLE_ENUM_SETTING(ScrollState, Microsoft::Terminal::Control::ScrollbarState, _profile, ScrollState); | ||
|
||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_profile, Guid); | ||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_profile, ConnectionType); | ||
OBSERVABLE_PROJECTED_SETTING(_profile, Name); | ||
|
@@ -110,6 +104,12 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation | |
OBSERVABLE_PROJECTED_SETTING(_profile, BellStyle); | ||
OBSERVABLE_PROJECTED_SETTING(_profile, UseAtlasEngine); | ||
|
||
WINRT_PROPERTY(bool, IsBaseLayer, false); | ||
WINRT_PROPERTY(IHostedInWindow, WindowRoot, nullptr); | ||
GETSET_BINDABLE_ENUM_SETTING(AntiAliasingMode, Microsoft::Terminal::Control::TextAntialiasingMode, AntialiasingMode); | ||
GETSET_BINDABLE_ENUM_SETTING(CloseOnExitMode, Microsoft::Terminal::Settings::Model::CloseOnExitMode, CloseOnExit); | ||
GETSET_BINDABLE_ENUM_SETTING(ScrollState, Microsoft::Terminal::Control::ScrollbarState, ScrollState); | ||
Comment on lines
+109
to
+111
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Had to move this down so that it could find the getters/setters defined in the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you want to leave a comment that says "don't shuffle this section up or you're gonna have a bad time?" There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Eh, if somebody moves them, the errors are pretty clear. So I think it's fine. |
||
|
||
TYPED_EVENT(DeleteProfile, Editor::ProfileViewModel, Editor::DeleteProfileEventArgs); | ||
|
||
private: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -57,23 +57,6 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation | |
// These changes should force us to update our own set of "Current<Setting>" members, | ||
// and propagate those changes to the UI | ||
_ViewModelChangedRevoker = _Profile.PropertyChanged(winrt::auto_revoke, [=](auto&&, const PropertyChangedEventArgs& args) { | ||
const auto settingName{ args.PropertyName() }; | ||
if (settingName == L"AntialiasingMode") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh yeah look the case mismatch was over here too. Ah well. |
||
{ | ||
_PropertyChangedHandlers(*this, PropertyChangedEventArgs{ L"CurrentAntiAliasingMode" }); | ||
} | ||
else if (settingName == L"CloseOnExit") | ||
{ | ||
_PropertyChangedHandlers(*this, PropertyChangedEventArgs{ L"CurrentCloseOnExitMode" }); | ||
} | ||
else if (settingName == L"BellStyle") | ||
{ | ||
_PropertyChangedHandlers(*this, PropertyChangedEventArgs{ L"IsBellStyleFlagSet" }); | ||
} | ||
else if (settingName == L"ScrollState") | ||
{ | ||
_PropertyChangedHandlers(*this, PropertyChangedEventArgs{ L"CurrentScrollState" }); | ||
} | ||
_previewControl.UpdateControlSettings(_Profile.TermSettings(), _Profile.TermSettings()); | ||
}); | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,29 +49,29 @@ | |
// of EnumEntries so that we may display all possible values of the given | ||
// enum type and its localized names. It also provides a getter and setter | ||
// for the setting we wish to bind to. | ||
#define GETSET_BINDABLE_ENUM_SETTING(name, enumType, settingsModelName, settingNameInModel) \ | ||
public: \ | ||
winrt::Windows::Foundation::Collections::IObservableVector<winrt::Microsoft::Terminal::Settings::Editor::EnumEntry> name##List() \ | ||
{ \ | ||
return _##name##List; \ | ||
} \ | ||
\ | ||
winrt::Windows::Foundation::IInspectable Current##name() \ | ||
{ \ | ||
return winrt::box_value<winrt::Microsoft::Terminal::Settings::Editor::EnumEntry>(_##name##Map.Lookup(settingsModelName.settingNameInModel())); \ | ||
} \ | ||
\ | ||
void Current##name(const winrt::Windows::Foundation::IInspectable& enumEntry) \ | ||
{ \ | ||
if (auto ee = enumEntry.try_as<winrt::Microsoft::Terminal::Settings::Editor::EnumEntry>()) \ | ||
{ \ | ||
auto setting = winrt::unbox_value<enumType>(ee.EnumValue()); \ | ||
settingsModelName.settingNameInModel(setting); \ | ||
} \ | ||
} \ | ||
\ | ||
private: \ | ||
winrt::Windows::Foundation::Collections::IObservableVector<winrt::Microsoft::Terminal::Settings::Editor::EnumEntry> _##name##List; \ | ||
#define GETSET_BINDABLE_ENUM_SETTING(name, enumType, viewModelSettingGetSet) \ | ||
public: \ | ||
winrt::Windows::Foundation::Collections::IObservableVector<winrt::Microsoft::Terminal::Settings::Editor::EnumEntry> name##List() \ | ||
{ \ | ||
return _##name##List; \ | ||
} \ | ||
\ | ||
winrt::Windows::Foundation::IInspectable Current##name() \ | ||
{ \ | ||
return winrt::box_value<winrt::Microsoft::Terminal::Settings::Editor::EnumEntry>(_##name##Map.Lookup(viewModelSettingGetSet())); \ | ||
} \ | ||
\ | ||
void Current##name(const winrt::Windows::Foundation::IInspectable& enumEntry) \ | ||
{ \ | ||
if (auto ee = enumEntry.try_as<winrt::Microsoft::Terminal::Settings::Editor::EnumEntry>()) \ | ||
{ \ | ||
auto setting = winrt::unbox_value<enumType>(ee.EnumValue()); \ | ||
viewModelSettingGetSet(setting); \ | ||
} \ | ||
} \ | ||
Comment on lines
+52
to
+71
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This change is what I was talking about in step 1 of my PR description. |
||
\ | ||
private: \ | ||
winrt::Windows::Foundation::Collections::IObservableVector<winrt::Microsoft::Terminal::Settings::Editor::EnumEntry> _##name##List; \ | ||
winrt::Windows::Foundation::Collections::IMap<enumType, winrt::Microsoft::Terminal::Settings::Editor::EnumEntry> _##name##Map; | ||
|
||
// This macro defines a dependency property for a WinRT class. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just double checking... the property is "Antialiasing" (with the "A" of "aliasing") being lowercase while the Notification string is "AntiAliasing" (with a capital "A")?
It may very well have already been like that and you just copy/pasted... but I'm just checking as it stood out to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I was actually really surprised this worked haha.