RangeDlg.cpp
上传用户:tuheem
上传日期:2007-05-01
资源大小:21889k
文件大小:3k
- // RangeDlg.cpp : implementation file
- //
- #include "stdafx.h"
- #include "XvidQuantsParser.h"
- #include "RangeDlg.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // CRangeDlg dialog
- CRangeDlg::CRangeDlg(CWnd* pParent /*=NULL*/)
- : CDialog(CRangeDlg::IDD, pParent)
- {
- //{{AFX_DATA_INIT(CRangeDlg)
- m_len = 0;
- m_start = 0;
- m_stop = 0;
- m_full = 0;
- //}}AFX_DATA_INIT
- }
- void CRangeDlg::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(CRangeDlg)
- DDX_Text(pDX, IDC_EDIT_LEN, m_len);
- DDX_Text(pDX, IDC_EDIT_START, m_start);
- DDX_Text(pDX, IDC_EDIT_STOP, m_stop);
- DDX_Text(pDX, IDC_EDIT_FULL, m_full);
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(CRangeDlg, CDialog)
- //{{AFX_MSG_MAP(CRangeDlg)
- ON_EN_UPDATE(IDC_EDIT_START, OnUpdateEditStart)
- ON_EN_UPDATE(IDC_EDIT_STOP, OnUpdateEditStop)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // CRangeDlg message handlers
- //------------------------------------------------------------------------------
- BOOL CRangeDlg::OnInitDialog()
- {
- CDialog::OnInitDialog();
-
- m_start = sframe;
- m_stop = eframe;
- m_len = eframe-sframe;
- m_full = fcount;
- UpdateData(FALSE);
-
- return TRUE; // return TRUE unless you set the focus to a control
- // EXCEPTION: OCX Property Pages should return FALSE
- }
- //------------------------------------------------------------------------------
- void CRangeDlg::SetStart(int start)
- {
- sframe = start;
- }
- //------------------------------------------------------------------------------
- int CRangeDlg::GetStart(void)
- {
- return sframe;
- }
- //------------------------------------------------------------------------------
- void CRangeDlg::SetEnd(int end)
- {
- eframe = end;
- }
- //------------------------------------------------------------------------------
- int CRangeDlg::GetEnd(void)
- {
- return eframe;
- }
- //------------------------------------------------------------------------------
- void CRangeDlg::SetFrameCount(int frames)
- {
- fcount = frames;
- }
- //------------------------------------------------------------------------------
- void CRangeDlg::OnUpdateEditStart()
- {
- UpdateData(TRUE);
- m_len = m_stop - m_start;
- UpdateData(FALSE);
- }
- //------------------------------------------------------------------------------
- void CRangeDlg::OnUpdateEditStop()
- {
- UpdateData(TRUE);
- m_len = m_stop - m_start;
- UpdateData(FALSE);
- }
- //------------------------------------------------------------------------------
- void CRangeDlg::OnOK()
- {
- UpdateData(TRUE);
- //As proof as i felt like doing at the moment...
- if (m_len > m_full)
- {
- AfxMessageBox("Invalid interval: Length of range is longer than full clip!");
- }
- else
- {
- if (m_len < 0)
- {
- AfxMessageBox("Invalid interval: Length of range is under 0 frames!");
- }
- else
- {
- if (m_stop > m_full)
- {
- AfxMessageBox("Invalid interval: End of range is after end of full clip!");
- }
- else
- {
- if (m_stop < 0 || m_start < 0)
- {
- AfxMessageBox("Invalid interval: Not good... Think a little...");
- }
- else
- {
- sframe = m_start;
- eframe = m_stop;
- }
- }
- }
- }
-
- CDialog::OnOK();
- }