⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rangedlg.cpp

📁 VC++视频开发实例集锦(包括“远程视频监控”"语音识别系统"等13个经典例子)
💻 CPP
字号:
// 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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -