Conversation
|
@cinnamon-msft Are all of these in the order you want? Or should I reorder any of them? I could introduce custom ordering, if you want. |
|
@msftbot make sure @DHowett signs off on this |
|
Hello @zadjii-msft! Because you've given me some instructions on how to help merge this pull request, I'll be modifying my merge approach. Here's how I understand your requirements for merging this pull request:
If this doesn't seem right to you, you can tell me to cancel these instructions and use the auto-merge policy that has been configured for this repository. Try telling me "forget everything I just told you". |
|
I'm tagging Dustin here, for the issue we discussed about sorting |
|
I don't mind this that much. Fortunately we're not stashing a copy. The vector is created, sorted, and then |
| std::sort(begin(name##List), end(name##List), EnumEntryComparator<enumType>()); \ | ||
| _##name##List = winrt::single_threaded_observable_vector<winrt::Microsoft::Terminal::Settings::Editor::EnumEntry>(std::move(name##List)); | ||
|
|
||
| #define INITIALIZE_BINDABLE_ENUM_SETTING_REVERSE_ORDER(name, enumMappingsName, enumType, resourceSectionAndType, resourceProperty) \ |
There was a problem hiding this comment.
I'm sure that we could refactor these macros so there was one base macro that could sort either direction, and then INITIALIZE_BINDABLE_ENUM_SETTING and INITIALIZE_BINDABLE_ENUM_SETTING_REVERSE_ORDER would just pass the correct arg to the base macro, but ¯\_(ツ)_/¯
|
Hello @zadjii-msft! Because this pull request has the 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 (
|
Sorts the list of `EnumEntry`s that is used to create combo boxes and radio buttons in the Settings UI. `INITIALIZE_BINDABLE_ENUM_SETTING` sorts the list in increasing order of the enum values, whereas `INITIALIZE_BINDABLE_ENUM_SETTING_REVERSE_ORDER` does so in decreasing order. ## References microsoft#6800 - Settings UI Epic I attempted sorting the `IObservableVector<EnumEntry>` using `std::sort`, but I would get an error in `winrt::Windows::Foundation::swap` (`C2665`). So instead, I did the following approach: - (unchanged) we're converting the `IMap` from EnumMappings into (1) a map of localized strings and (2) the list for XAML controls - instead of storing `EnumEntry`s to the `IObservableVector` directly, store it to a `std::vector` - sort the vector using `std::sort` - _now_ initialize the `IObservableVector` using the sorted `std::vector` This uses the value of the associated enum to determine a sorting order. Since we want the "negative" value (i.e. "none" or "hidden") to be last, I use `EnumEntryComparator` and `EnumEntryReverseComparator` to determine whether we want increasing or decreasing order respectively. `INITIALIZE_BINDABLE_ENUM_SETTING_REVERSE_ORDER` is a copy of `INITIALIZE_BINDABLE_ENUM_SETTING`, except it uses `EnumEntryReverseComparator` to sort in decreasing order. Closes microsoft#8758










Sorts the list of
EnumEntrys that is used to create combo boxes andradio buttons in the Settings UI.
INITIALIZE_BINDABLE_ENUM_SETTINGsorts the list in increasing order of the enum values, whereas
INITIALIZE_BINDABLE_ENUM_SETTING_REVERSE_ORDERdoes so in decreasingorder.
References
#6800 - Settings UI Epic
I attempted sorting the
IObservableVector<EnumEntry>usingstd::sort, but I would get an error inwinrt::Windows::Foundation::swap(C2665). So instead, I did thefollowing approach:
IMapfrom EnumMappings into (1) amap of localized strings and (2) the list for XAML controls
EnumEntrys to theIObservableVectordirectly,store it to a
std::vectorstd::sortIObservableVectorusing the sortedstd::vectorThis uses the value of the associated enum to determine a sorting order.
Since we want the "negative" value (i.e. "none" or "hidden") to be last,
I use
EnumEntryComparatorandEnumEntryReverseComparatortodetermine whether we want increasing or decreasing order respectively.
INITIALIZE_BINDABLE_ENUM_SETTING_REVERSE_ORDERis a copy ofINITIALIZE_BINDABLE_ENUM_SETTING, except it usesEnumEntryReverseComparatorto sort in decreasing order.Closes #8758