Sort the actor and effect fields. Closes #1715.

This commit is contained in:
Thomas Goyne 2014-03-05 15:26:50 -08:00
parent c9582fe7cf
commit cb8b107bd9

View file

@ -343,14 +343,20 @@ void SubsEditBox::PopulateList(wxComboBox *combo, boost::flyweight<std::string>
wxEventBlocker blocker(this); wxEventBlocker blocker(this);
std::unordered_set<std::string> values; std::unordered_set<std::string> values;
for (auto diag : c->ass->Line | agi::of_type<AssDialogue>()) for (auto const& line : c->ass->Line) {
values.insert(diag->*field); if (line.Group() != AssEntryGroup::DIALOGUE) continue;
values.erase(""); auto const& value = static_cast<const AssDialogue *>(&line)->*field;
if (!value.get().empty())
values.insert(value);
}
wxArrayString arrstr; wxArrayString arrstr;
arrstr.reserve(values.size()); arrstr.reserve(values.size());
transform(values.begin(), values.end(), std::back_inserter(arrstr), transform(values.begin(), values.end(), std::back_inserter(arrstr),
(wxString (*)(std::string const&))to_wx); (wxString (*)(std::string const&))to_wx);
arrstr.Sort();
combo->Freeze(); combo->Freeze();
long pos = combo->GetInsertionPoint(); long pos = combo->GetInsertionPoint();
wxString value = combo->GetValue(); wxString value = combo->GetValue();