ConvertChapDlg.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 // ConvertChapDlg.cpp : implementation file
00023 //
00024 
00025 #include "stdafx.h"
00026 #include "mplayerc.h"
00027 #include "ConvertChapDlg.h"
00028 
00029 // CConvertChapDlg dialog
00030 
00031 CConvertChapDlg::CConvertChapDlg(CWnd* pParent /*=NULL*/)
00032         : CResizableDialog(CConvertChapDlg::IDD, pParent)
00033         , m_time(_T(""))
00034         , m_name(_T(""))
00035 {
00036 }
00037 
00038 CConvertChapDlg::~CConvertChapDlg()
00039 {
00040 }
00041 
00042 void CConvertChapDlg::DoDataExchange(CDataExchange* pDX)
00043 {
00044         __super::DoDataExchange(pDX);
00045         DDX_Text(pDX, IDC_EDIT1, m_time);
00046         DDX_Text(pDX, IDC_EDIT2, m_name);
00047 }
00048 
00049 BEGIN_MESSAGE_MAP(CConvertChapDlg, CResizableDialog)
00050         ON_UPDATE_COMMAND_UI(IDOK, OnUpdateOK)
00051 END_MESSAGE_MAP()
00052 
00053 
00054 // CConvertChapDlg message handlers
00055 
00056 BOOL CConvertChapDlg::OnInitDialog()
00057 {
00058         __super::OnInitDialog();
00059 
00060         AddAnchor(IDC_EDIT1, TOP_LEFT);
00061         AddAnchor(IDC_EDIT2, TOP_LEFT, TOP_RIGHT);
00062         AddAnchor(IDOK, BOTTOM_CENTER);
00063         AddAnchor(IDCANCEL, BOTTOM_CENTER);
00064 
00065         CRect r;
00066         GetWindowRect(r);
00067         CSize s = r.Size();
00068         SetMinTrackSize(s);
00069         s.cx = 1000;
00070         SetMaxTrackSize(s);
00071 
00072         UpdateData(FALSE);
00073 
00074         return TRUE;  // return TRUE unless you set the focus to a control
00075         // EXCEPTION: OCX Property Pages should return FALSE
00076 }
00077 
00078 void CConvertChapDlg::OnOK()
00079 {
00080         UpdateData();
00081 
00082         __super::OnOK();
00083 }
00084 
00085 void CConvertChapDlg::OnUpdateOK(CCmdUI* pCmdUI)
00086 {
00087         CString str;
00088         GetDlgItem(IDC_EDIT1)->GetWindowText(str);
00089         int i;
00090         pCmdUI->Enable(3 == _stscanf(str, _T("%d:%d:%d"), &i, &i, &i)
00091                 && GetDlgItem(IDC_EDIT2)->GetWindowTextLength() > 0);
00092 }

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