PlayerSubresyncBar.h

00001 /* 
00002  *      Copyright (C) 2003-2005 Gabest
00003  *      http://www.gabest.org
00004  *
00005  *  This Program is free software; you can redistribute it and/or modify
00006  *  it under the terms of the GNU General Public License as published by
00007  *  the Free Software Foundation; either version 2, or (at your option)
00008  *  any later version.
00009  *   
00010  *  This Program is distributed in the hope that it will be useful,
00011  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00013  *  GNU General Public License for more details.
00014  *   
00015  *  You should have received a copy of the GNU General Public License
00016  *  along with GNU Make; see the file COPYING.  If not, write to
00017  *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 
00018  *  http://www.gnu.org/copyleft/gpl.html
00019  *
00020  */
00021 
00022 #pragma once
00023 
00024 #include <afxcview.h>
00025 #include "PlayerListCtrl.h"
00026 #include "..\..\subtitles\RTS.h"
00027 #include "..\..\subtitles\VobSubFile.h"
00028 
00029 // CPlayerSubresyncBar
00030 
00031 class CPlayerSubresyncBar : public CSizingControlBarG
00032 {
00033         DECLARE_DYNAMIC(CPlayerSubresyncBar)
00034 
00035 private:
00036         CPlayerListCtrl m_list;
00037 
00038         CFont m_font;
00039 
00040     CCritSec* m_pSubLock;
00041         CComPtr<ISubStream> m_pSubStream;
00042 
00043         int m_lastSegment;
00044         __int64 m_rt;
00045 
00046         enum 
00047         {
00048                 // TEXTSUB
00049                 COL_START=0, COL_END, COL_PREVSTART, COL_PREVEND, COL_TEXT, COL_STYLE, COL_FONT, COL_CHARSET, COL_UNICODE, COL_LAYER, COL_ACTOR, COL_EFFECT,
00050                 // VOBSUB
00051                 /* ........... same as TEXTSUB ............. */   COL_VOBID=COL_TEXT, COL_CELLID, COL_FORCED,
00052         };
00053 
00054         enum {NONE = 0, VOBSUB, TEXTSUB};
00055         int m_mode;
00056 
00057         bool m_fUnlink;
00058 
00059         typedef struct {int orgstart, newstart, orgend, newend;} SubTime;
00060         CArray<SubTime> m_subtimes;
00061 
00062 //      CRenderedTextSubtitle m_sts;
00063         CSimpleTextSubtitle m_sts;
00064 
00065         int GetStartTime(int iItem), GetEndTime(int iItem);
00066         void FormatTime(int iItem, TCHAR* buff, int time /* 0:start, 1:newstart, 2:preview */, bool fEnd);
00067 
00068         void UpdatePreview(), UpdateStrings();
00069 
00070         enum {TSMOD=1, TEMOD=2, TSADJ=4, TEADJ=8, TSEP=0x80000000};
00071 
00072         void GetCheck(int iItem, bool& fStartMod, bool& fEndMod, bool& fStartAdj, bool& fEndAdj);
00073         void SetCheck(int iItem, bool fStart, bool fEnd);
00074 
00075         bool ModStart(int iItem, int t, bool fReset = false);
00076         bool ModEnd(int iItem, int t, bool fReset = false);
00077 
00078 public:
00079         CPlayerSubresyncBar();
00080         virtual ~CPlayerSubresyncBar();
00081 
00082         BOOL Create(CWnd* pParentWnd, CCritSec* pSubLock);
00083 
00084         void SetTime(__int64 rt);
00085 
00086         void SetSubtitle(ISubStream* pSubStream, double fps);
00087         void ResetSubtitle();
00088         void SaveSubtitle();
00089 
00090 protected:
00091         virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
00092         virtual BOOL PreTranslateMessage(MSG* pMsg);
00093 
00094         DECLARE_MESSAGE_MAP()
00095 
00096 public:
00097         afx_msg void OnSize(UINT nType, int cx, int cy);
00098         afx_msg void OnBeginlabeleditList(NMHDR* pNMHDR, LRESULT* pResult);
00099         afx_msg void OnDolabeleditList(NMHDR* pNMHDR, LRESULT* pResult);
00100         afx_msg void OnEndlabeleditList(NMHDR* pNMHDR, LRESULT* pResult);
00101         afx_msg void OnRclickList(NMHDR* pNMHDR, LRESULT* pResult);
00102         afx_msg void OnNMDblclkList(NMHDR* pNMHDR, LRESULT* pResult);
00103         afx_msg void OnLvnKeydownList(NMHDR* pNMHDR, LRESULT* pResult);
00104         afx_msg void OnCustomdrawList(NMHDR* pNMHDR, LRESULT* pResult);
00105 };

Generated on Tue Dec 13 14:46:59 2005 for guliverkli by  doxygen 1.4.5