Implemented sorting of subtitles by start time.

Originally committed to SVN as r467.
This commit is contained in:
Rodrigo Braz Monteiro 2006-07-06 22:55:05 +00:00
parent 8f077dc4ee
commit 72abf003b1
2 changed files with 17 additions and 1 deletions

View File

@ -94,6 +94,7 @@ Please visit http://aegisub.net to download latest version
- Added hotkey to Audio's "play to end of file" (defaulting to "T"). (AMZ)
- Fixed the default resolution for video display and resolution resampler when the script's field is blank. (AMZ)
- Stopping audio playback will now stop video playback as well. (AMZ)
- Implemented sorting of subtitles by start time. (AMZ)
= 1.09 beta - 2006.01.16 ===========================

View File

@ -1161,7 +1161,22 @@ void FrameMain::OnSelect (wxCommandEvent &event) {
//////////////////
// Sort subtitles
void FrameMain::OnSort (wxCommandEvent &event) {
// TODO
// Ensure that StartMS is set properly
AssEntry *curEntry;
AssDialogue *curDiag;
int startMS = -1;
for (std::list<AssEntry*>::iterator cur = AssFile::top->Line.begin(); cur != AssFile::top->Line.end(); cur++) {
curEntry = *cur;
curDiag = AssEntry::GetAsDialogue(curEntry);
if (curDiag) startMS = curDiag->Start.GetMS();
curEntry->StartMS = startMS;
}
// Sort
AssFile::top->Line.sort(LessByPointedToValue<AssEntry>());
AssFile::top->FlagAsModified();
SubsBox->UpdateMaps();
SubsBox->CommitChanges();
}