www.pudn.com > src.rar > subresyncDlg.h
// subresyncDlg.h : header file // #if !defined(AFX_SUBRESYNCDLG_H__4673204F_D54C_43F2_BFF5_E4488A466F6C__INCLUDED_) #define AFX_SUBRESYNCDLG_H__4673204F_D54C_43F2_BFF5_E4488A466F6C__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 #include#include "../vobsub/vobsub.h" #include "afxwin.h" #include #include #include "ocrdll.h" class CharImg { public: CString m_str; int m_w, m_h; bool* m_p; // feature list int m_topbottom; CharImg(uint* p, int pitch, CRect r, int* left, int* right, int topbottom, CString str = _T("")); CharImg(FILE* f); ~CharImg(); bool Match(CharImg* img); bool Write(FILE* f); bool Read(FILE* f); }; class CharSegment { public: int* left; int* right; int h; int srow, erow; CharSegment(int* left, int* right, int h, int srow, int erow); ~CharSegment(); }; ///////////////////////////////////////////////////////////////////////////// // CSubresyncDlg dialog class CSubresyncDlg : public CDialog { // Construction public: CSubresyncDlg(CString fn, CWnd* pParent = NULL); // standard constructor virtual ~CSubresyncDlg(); bool Open(CString fn, int CharSet = DEFAULT_CHARSET, bool fAppend = false, int timeoff = 0); bool Save(CString fn, int type, bool fUnicode, bool fClearImgLetterDb = false, bool fOcrDll = false); enum {NONE = 0, VOBSUB, TEXTSUB, OCR}; // Dialog Data //{{AFX_DATA(CSubresyncDlg) enum { IDD = IDD_SUBRESYNC_DIALOG }; CListCtrl m_list; CButton m_saveasbtn; CButton m_resetbtn; CButton m_editbtn; CButton m_exitbtn; BOOL m_fRender; CButton m_previewchk; BOOL m_fUnlink; CButton m_unlinkchk; CComboBox m_vslangs; //}}AFX_DATA // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CSubresyncDlg) public: protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support //}}AFX_VIRTUAL // Implementation protected: HICON m_hIcon; CImageList m_icons; CSize m_orgwin, m_orgcli; int m_subimgperc; CDC m_subdc; CBitmap m_subimg; int m_subimgidx; int m_scalex, m_scaley; bool m_fSizing; int m_mode; double m_fps; int m_CharSet; CFont m_font; CString m_fn; typedef struct {int orgstart, newstart, orgend, newend; bool fChecked; int chkmode;} SubTime; CArray m_subtimes; CRenderedTextSubtitle m_rts; CVobSubFile m_file; CList m_savelist; int GetStartTime(int iItem); int GetEndTime(int iItem); void FormatTime(int iItem, TCHAR* buff, int time /* 0:start, 1:newstart, 2:preview */, bool fEnd); bool GetImageOfSelected(); bool GetVobSubImage(int idx); void UpdatePreview(); void UpdateStrings(); bool GetChecked(int iItem); void SetChecked(int iItem, bool fChecked); CRect m_subimgrect; void RearrangeControls(); void SetupLangCombo(); // OCR bool m_fOCRing; bool DoOCR(CSimpleTextSubtitle& sts, bool fClearImgLetterDb, bool fOcrDll); CRect m_curSegmRect; int m_srow, m_erow; int m_w, m_h; uint* m_p; CList m_cilist; CList m_cslist; void FreeCharImgList(); void FreeCharSegmentList(); void ClearSelectedLines(); void SetSelectedLine(int i); bool FindNextFilledRow(int& row); bool FindNextEmptyRow(int& row, int minrowheight); bool FindNextFilledCol(int* left); bool FindNextEmptyCol(int* right); CRect ClipChar(int* left, int* right); double GetGapBetweenTwoChars(CharSegment* cs1, CharSegment* cs2); int TopBottom(CRect r); bool LookupCharImg(CString& str, POSITION startpos, POSITION endpos, POSITION& newendpos); void CorrectSpellingErrors(CString& str); COcrDll m_od; // CComPtr m_pDet; // Generated message map functions //{{AFX_MSG(CSubresyncDlg) virtual BOOL OnInitDialog(); afx_msg void OnSysCommand(UINT nID, LPARAM lParam); afx_msg void OnPaint(); afx_msg HCURSOR OnQueryDragIcon(); afx_msg void OnEndlabeleditList1(NMHDR* pNMHDR, LRESULT* pResult); afx_msg void OnRclickList1(NMHDR* pNMHDR, LRESULT* pResult); afx_msg void OnOpen(); afx_msg void OnReset(); afx_msg void OnSave(); afx_msg void OnDropFiles(HDROP hDropInfo); afx_msg void OnNMDblclkList1(NMHDR *pNMHDR, LRESULT *pResult); afx_msg void OnBnClickedEditsub(); afx_msg void OnSize(UINT nType, int cx, int cy); afx_msg void OnGetMinMaxInfo(MINMAXINFO* lpMMI); virtual BOOL PreTranslateMessage(MSG* pMsg); afx_msg void OnLvnItemchangedList1(NMHDR *pNMHDR, LRESULT *pResult); afx_msg void OnBnClickedCheck1(); afx_msg void OnNMClickList1(NMHDR *pNMHDR, LRESULT *pResult); afx_msg void OnLButtonDown(UINT nFlags, CPoint point); afx_msg UINT OnNcHitTest(CPoint point); afx_msg BOOL OnEraseBkgnd(CDC* pDC); afx_msg void OnBnClickedCheck2(); afx_msg void OnCbnSelchangeCombo1(); afx_msg void OnLvnKeydownList1(NMHDR *pNMHDR, LRESULT *pResult); afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt); //}}AFX_MSG DECLARE_MESSAGE_MAP() }; //{{AFX_INSERT_LOCATION}} // Microsoft Visual C++ will insert additional declarations immediately before the previous line. #endif // !defined(AFX_SUBRESYNCDLG_H__4673204F_D54C_43F2_BFF5_E4488A466F6C__INCLUDED_)