VSRipFileDlg.cpp

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 // VSRipFileDlg.cpp : implementation file
00023 //
00024 
00025 #include "stdafx.h"
00026 #include "VSRip.h"
00027 #include <atlcoll.h>
00028 #include "..\..\..\include\winddk\devioctl.h"
00029 #include "..\..\..\include\winddk\ntddcdrm.h"
00030 #include "VSRipFileDlg.h"
00031 
00032 
00033 // CVSRipFileDlg dialog
00034 
00035 IMPLEMENT_DYNAMIC(CVSRipFileDlg, CVSRipPage)
00036 CVSRipFileDlg::CVSRipFileDlg(IVSFRipper* pVSFRipper, CWnd* pParent /*=NULL*/)
00037         : CVSRipPage(pVSFRipper, CVSRipFileDlg::IDD, pParent)
00038 {
00039 }
00040 
00041 CVSRipFileDlg::~CVSRipFileDlg()
00042 {
00043 }
00044 
00045 void CVSRipFileDlg::DoDataExchange(CDataExchange* pDX)
00046 {
00047         CVSRipPage::DoDataExchange(pDX);
00048         DDX_Text(pDX, IDC_EDIT1, m_infn);
00049         DDX_Text(pDX, IDC_EDIT2, m_outfn);
00050         DDX_Control(pDX, IDC_EDIT3, m_log);
00051 }
00052 
00053 BEGIN_MESSAGE_MAP(CVSRipFileDlg, CVSRipPage)
00054         ON_BN_CLICKED(IDC_BUTTON1, OnBnClickedButton1)
00055         ON_BN_CLICKED(IDC_BUTTON2, OnBnClickedButton2)
00056 END_MESSAGE_MAP()
00057 
00058 STDMETHODIMP CVSRipFileDlg::OnMessage(LPCTSTR msg)
00059 {
00060         if(CEdit* pLog = (CEdit*)CEdit::FromHandle(m_log.m_hWnd))
00061         {
00062                 CString str = msg;
00063                 str += _T("\r\n");
00064                 int len = pLog->GetWindowTextLength();
00065                 pLog->SetSel(len, len);
00066                 pLog->ReplaceSel(str);
00067         }
00068 
00069         return S_OK;
00070 }
00071 
00072 // CVSRipFileDlg message handlers
00073 
00074 void CVSRipFileDlg::OnBnClickedButton1()
00075 {
00076         CFileDialog fd(TRUE, NULL, NULL, 
00077                 OFN_EXPLORER|OFN_ENABLESIZING|OFN_PATHMUSTEXIST, 
00078                 _T("Video Title Set IFO file (*.ifo)|*.ifo|"), this, 0);
00079 
00080         if(fd.DoModal() == IDOK)
00081         {
00082                 m_log.SetWindowText(_T(""));
00083                 m_log.SetMargins(0, 0);
00084 
00085                 CString fn = fd.GetPathName();
00086                 if(FAILED(m_pVSFRipper->SetInput(fn))) fn.Empty();
00087                 m_infn = fn;
00088 
00089                 UpdateData(FALSE);
00090         }
00091 
00092 }
00093 
00094 void CVSRipFileDlg::OnBnClickedButton2()
00095 {
00096         CString fn = m_infn.Mid(m_infn.ReverseFind('\\')+1);
00097         int i = fn.ReverseFind('.');
00098         if(i > 0) fn = fn.Left(i);
00099 
00100         CFileDialog fd(FALSE, NULL, fn, 
00101                 OFN_EXPLORER|OFN_ENABLESIZING|OFN_OVERWRITEPROMPT|OFN_PATHMUSTEXIST, 
00102                 _T("VobSub index file (*.idx)|*.idx|"), this, 0);
00103 
00104         if(fd.DoModal() == IDOK)
00105         {
00106                 CString fn = fd.GetPathName();
00107                 if(FAILED(m_pVSFRipper->SetOutput(fn))) fn.Empty();
00108                 m_outfn = fn;
00109 
00110                 UpdateData(FALSE);
00111         }
00112 }

Generated on Tue Dec 13 14:47:05 2005 for guliverkli by  doxygen 1.4.5