Made the style sorting code only append each style once even when multiple styles have the same name. Closes #922.

Originally committed to SVN as r3163.
This commit is contained in:
Thomas Goyne 2009-07-18 04:37:43 +00:00
parent 0fa0d9d17e
commit c02f953ee0

View file

@ -1084,17 +1084,17 @@ void DialogStyleManager::MoveStyles(bool storage, int type) {
} }
// Get sorted list // Get sorted list
wxArrayString stylNames; wxArrayString styleNames;
for (int i=0;i<nStyles;i++) stylNames.Add(srcStyls->at(i)->name.Lower()); for (int i=0; i < nStyles; i++) styleNames.Add(srcStyls->at(i)->name);
stylNames.Sort(); styleNames.Sort();
AssStyle *curStyl;
// Find each and copy it std::list<AssStyle *> styles(srcStyls->begin(), srcStyls->end());
for (int i=0;i<nStyles;i++) { for (int i = 0; i < nStyles; i++) {
for (int j=0;j<nStyles;j++) { for (std::list<AssStyle *>::iterator style = styles.begin(); style != styles.end(); style++) {
curStyl = srcStyls->at(j); if ((*style)->name == styleNames[i]) {
if (curStyl->name.Lower() == stylNames[i]) { styls.push_back(*style);
styls.push_back(curStyl); styles.erase(style);
break;
} }
} }
} }