Stick to the standard order of sections when inserting lines

This commit is contained in:
Thomas Goyne 2012-12-09 15:44:03 -08:00
parent 205d408f3e
commit 96b3656742
3 changed files with 5 additions and 5 deletions

View File

@ -26,19 +26,19 @@
wxString const& AssEntry::GroupHeader(bool ssa) const { wxString const& AssEntry::GroupHeader(bool ssa) const {
static wxString ass_headers[] = { static wxString ass_headers[] = {
"[Script Info]", "[Script Info]",
"[Events]",
"[V4+ Styles]", "[V4+ Styles]",
"[Fonts]", "[Fonts]",
"[Graphics]", "[Graphics]",
"[Events]",
"" ""
}; };
static wxString ssa_headers[] = { static wxString ssa_headers[] = {
"[Script Info]", "[Script Info]",
"[Events]",
"[V4 Styles]", "[V4 Styles]",
"[Fonts]", "[Fonts]",
"[Graphics]", "[Graphics]",
"[Events]",
"" ""
}; };

View File

@ -40,10 +40,10 @@
enum AssEntryGroup { enum AssEntryGroup {
ENTRY_INFO = 0, ENTRY_INFO = 0,
ENTRY_DIALOGUE,
ENTRY_STYLE, ENTRY_STYLE,
ENTRY_FONT, ENTRY_FONT,
ENTRY_GRAPHIC, ENTRY_GRAPHIC,
ENTRY_DIALOGUE,
ENTRY_GROUP_MAX ENTRY_GROUP_MAX
}; };

View File

@ -274,13 +274,13 @@ void AssFile::InsertLine(AssEntry *entry) {
entryIter it = Line.end(); entryIter it = Line.end();
do { do {
--it; --it;
if (it->Group() == entry->Group()) { if (it->Group() <= entry->Group()) {
Line.insert(++it, *entry); Line.insert(++it, *entry);
return; return;
} }
} while (it != Line.begin()); } while (it != Line.begin());
Line.push_back(*entry); Line.push_front(*entry);
} }
void AssFile::InsertAttachment(wxString filename) { void AssFile::InsertAttachment(wxString filename) {