diff options
author | Casimir666 <casimir666@users.sourceforge.net> | 2006-12-10 16:12:11 +0300 |
---|---|---|
committer | Casimir666 <casimir666@users.sourceforge.net> | 2006-12-10 16:12:11 +0300 |
commit | 43dd2e4e0e6a9f0ab8b8d5c667422256954c2a7a (patch) | |
tree | c9b511459f4afb42b1f94dc3b9c5738a54c48aad /src/apps/mplayerc/PlayerSubresyncBar.cpp | |
parent | f7d6f32d16de3c2da0569b77f0616b99f0a7b301 (diff) |
git-svn-id: https://mpc-hc.svn.sourceforge.net/svnroot/mpc-hc/trunk@27 10f7b99b-c216-0410-bff0-8a66a9350fd8
Diffstat (limited to 'src/apps/mplayerc/PlayerSubresyncBar.cpp')
-rw-r--r-- | src/apps/mplayerc/PlayerSubresyncBar.cpp | 51 |
1 files changed, 50 insertions, 1 deletions
diff --git a/src/apps/mplayerc/PlayerSubresyncBar.cpp b/src/apps/mplayerc/PlayerSubresyncBar.cpp index aa4ba19f0..c1e22f16b 100644 --- a/src/apps/mplayerc/PlayerSubresyncBar.cpp +++ b/src/apps/mplayerc/PlayerSubresyncBar.cpp @@ -197,7 +197,6 @@ void CPlayerSubresyncBar::ResetSubtitle() {
m_subtimes[i].newstart = m_subtimes[i].orgstart;
m_subtimes[i].newend = m_subtimes[i].orgend;
-
FormatTime(i, buff, 0, false);
m_list.InsertItem(i, buff, COL_START);
FormatTime(i, buff, 0, true);
@@ -1299,3 +1298,53 @@ bool CPlayerSubresyncBar::IsShortCut(MSG* pMsg) return false;
}
+
+
+int CPlayerSubresyncBar::FindNearestSub(__int64& rtPos, bool bForward)
+{
+ long lCurTime = rtPos / 10000 + (bForward ? 1 : -1);
+
+ if (lCurTime < m_subtimes[0].newstart)
+ {
+ rtPos = m_subtimes[0].newstart * 10000;
+ return 0;
+ }
+
+ for(int i = 1, j = m_sts.GetCount(); i < j; i++)
+ {
+ if ((lCurTime >= m_subtimes[i-1].newstart) && (lCurTime < m_subtimes[i].newstart))
+ {
+ rtPos = bForward ? (__int64)m_subtimes[i].newstart * 10000 : (__int64)m_subtimes[i-1].newstart * 10000;
+ return bForward ? i : i-1;
+ }
+ }
+
+ return -1;
+}
+
+
+bool CPlayerSubresyncBar::ShiftSubtitle(int nItem, long lValue, __int64& rtPos)
+{
+ bool bRet = false;
+
+ if ((nItem == 0) || (m_subtimes[nItem-1].newend < m_subtimes[nItem].newstart + lValue))
+ {
+ for (int i= nItem; i<m_sts.GetCount(); i++)
+ {
+ m_subtimes[i].newstart += lValue;
+ m_subtimes[i].newend += lValue;
+ m_subtimes[i].orgstart += lValue;
+ m_subtimes[i].orgend += lValue;
+ }
+ UpdatePreview();
+ SaveSubtitle();
+ bRet = true;
+ rtPos = m_subtimes[nItem].newstart * 10000;
+ }
+ return bRet;
+}
+
+bool CPlayerSubresyncBar::SaveToDisk()
+{
+ return m_sts.SaveAs (m_sts.m_path, m_sts.m_exttype);
+}
\ No newline at end of file |