From 72abf003b1f841c1b22a90cd97028ba21393bcdd Mon Sep 17 00:00:00 2001 From: Rodrigo Braz Monteiro Date: Thu, 6 Jul 2006 22:55:05 +0000 Subject: [PATCH] Implemented sorting of subtitles by start time. Originally committed to SVN as r467. --- core/changelog.txt | 1 + core/frame_main_events.cpp | 17 ++++++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/core/changelog.txt b/core/changelog.txt index ab55a5cb8..13b294fe8 100644 --- a/core/changelog.txt +++ b/core/changelog.txt @@ -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 =========================== diff --git a/core/frame_main_events.cpp b/core/frame_main_events.cpp index 62db99b01..7590531b7 100644 --- a/core/frame_main_events.cpp +++ b/core/frame_main_events.cpp @@ -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::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()); + AssFile::top->FlagAsModified(); + SubsBox->UpdateMaps(); + SubsBox->CommitChanges(); }