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

📄 videoctrlbar.cpp

📁 很珍贵得视频编辑器原码及CODEC。需要安装下列CODEC.可播放多种格式的视频
💻 CPP
字号:
// VideoCtrlBar.cpp : implementation file
//

#include "stdafx.h"
#include "magicscissors.h"
#include "VideoCtrlBar.h"
#include "MagicScissorsDoc.h"
#include "MagicScissorsView.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CVideoCtrlBar dialog


CVideoCtrlBar::CVideoCtrlBar()
{
	m_nTotal = m_nCurr = 0;
	m_pView = NULL;
}

CVideoCtrlBar::~CVideoCtrlBar()
{

}


BEGIN_MESSAGE_MAP(CVideoCtrlBar, CDialogBar)
	//{{AFX_MSG_MAP(CVideoCtrlBar)
	ON_WM_CREATE()
	ON_WM_PAINT()
	ON_WM_SIZE()
	ON_MESSAGE(IDM_SCROLL,OnScroll)
	ON_MESSAGE(IDM_SCROLL_MOVE,OnScrollMove)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CVideoCtrlBar message handlers

int CVideoCtrlBar::OnCreate(LPCREATESTRUCT lpCreateStruct) 
{
	if (CDialogBar::OnCreate(lpCreateStruct) == -1)
		return -1;
	
	// TODO: Add your specialized creation code here	
	return 0;
}

void CVideoCtrlBar::OnPaint() 
{
	CPaintDC dc(this); // device context for painting
	
	// TODO: Add your message handler code here
	if( !m_Slider.GetSafeHwnd() )
	{
		CWnd* pWnd = GetDlgItem(IDC_VIDEO_SLIDER);
		m_Slider.SubclassWindow( pWnd->GetSafeHwnd() );
	}
	// Do not call CDialogBar::OnPaint() for painting messages
}

void CVideoCtrlBar::Init(int min, int max, CView* pView)
{
	SetRange(min, max);
	SetPos(0);
	m_Slider.Enable(TRUE);
	m_pView = pView;
	CString str;
	if( max == 0 )
		str = "";
	else
		str.Format( "%d / %d", m_nCurr, m_nTotal );
	GetDlgItem(IDC_FRAME_OUT)->SetWindowText( str );
}

void CVideoCtrlBar::OnSize(UINT nType, int cx, int cy) 
{

	CWnd* pWnd = GetDlgItem(IDC_VIDEO_SLIDER);
	if( pWnd )
		pWnd->SetWindowPos( &wndTop, 20, 7, cx-200, 13, SWP_SHOWWINDOW );
	pWnd = GetDlgItem(IDC_FRAME_OUT);
	if( pWnd )
		pWnd->SetWindowPos( &wndTop, cx-160, 7, 0, 0, SWP_NOSIZE );
	CDialogBar::OnSize(nType, cx, cy);	
	// TODO: Add your message handler code here	
}

void CVideoCtrlBar::SetRange(int min, int max)
{
	m_nTotal = max;
	m_Slider.SetRange(min,max);
}

void CVideoCtrlBar::SetPos(int n)
{
	m_nCurr = n;
	m_Slider.SetPos(n);
	CString str;
	str.Format( "%d / %d", m_nCurr, m_nTotal );
	GetDlgItem(IDC_FRAME_OUT)->SetWindowText( str );
}

int CVideoCtrlBar::GetPos()
{
	return m_Slider.GetPos();
}

void CVideoCtrlBar::OnScroll(WPARAM wParam, LPARAM lParam)
{
	m_nCurr = m_Slider.GetPos();
	CString str;
	str.Format( "%d / %d", m_nCurr, m_nTotal );
	GetDlgItem(IDC_FRAME_OUT)->SetWindowText( str );
	if( m_pView )
		((CMagicScissorsView*)m_pView)->OnChangeSlider(m_nCurr);
}

void CVideoCtrlBar::OnScrollMove(WPARAM wParam, LPARAM lParam)
{
	m_nCurr = m_Slider.GetPos();
	CString str;
	str.Format( "%d / %d", m_nCurr, m_nTotal );
	GetDlgItem(IDC_FRAME_OUT)->SetWindowText( str );	
}

void CVideoCtrlBar::EnableSlider(BOOL bEnable)
{
	if( bEnable )
		m_Slider.Enable(TRUE);
	else
		m_Slider.Enable(FALSE);
}

void CVideoCtrlBar::CloseVideo()
{
	m_nCurr = 0;
	m_Slider.SetPos(0);
	m_Slider.Enable(FALSE);
	CString str = "";
	GetDlgItem(IDC_FRAME_OUT)->SetWindowText( str );
}

void CVideoCtrlBar::SetSelect(int n)
{
	m_Slider.SetSelect(n);	
}

⌨️ 快捷键说明

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