rangedlg.cpp

来自「Xvid Quants parser(XvidQP)用来分析编码Xvid AVI」· C++ 代码 · 共 153 行

CPP
153
字号
// 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();
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?