You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
126 lines
2.9 KiB
126 lines
2.9 KiB
//----------------------------------------------------------------------------
|
|
// Laser Guard Ltd.
|
|
// Copyright © 2000-2002. All Rights Reserved.
|
|
// Version 1.0 01/01/2000
|
|
// Last modification: 08/10/2003
|
|
// PROJECT:
|
|
// SUBSYSTEM:
|
|
// FILE: VideoFrameWnd.cpp
|
|
// AUTHOR: Sergey Chizhevskiy
|
|
// OVERVIEW
|
|
// ~~~~~~~~
|
|
// Source file of VideoFrameWnd.cpp
|
|
//----------------------------------------------------------------------------
|
|
#include "stdafx.h"
|
|
#include "chicago.h"
|
|
#include "VideoFrameWnd.h"
|
|
#include "..\..\LgLib\LgAux.h"
|
|
#include "..\..\LgLib\Version.h"
|
|
|
|
#ifdef _DEBUG
|
|
#define new DEBUG_NEW
|
|
#undef THIS_FILE
|
|
static char THIS_FILE[] = __FILE__;
|
|
#endif
|
|
|
|
CVideoFrameWnd::CVideoFrameWnd()
|
|
{
|
|
m_pDDVideoWnd = NULL;
|
|
|
|
LGLOG( LOG_LEVEL_MEDIUM, LOG_TYPE_INFO, this, _T("CVideoFrameWnd::CVideoFrameWnd") );
|
|
}
|
|
|
|
CVideoFrameWnd::~CVideoFrameWnd()
|
|
{
|
|
DestroyWindow();
|
|
|
|
LGLOG( LOG_LEVEL_MEDIUM, LOG_TYPE_INFO, this, _T("CVideoFrameWnd::~CVideoFrameWnd") );
|
|
}
|
|
|
|
BEGIN_MESSAGE_MAP(CVideoFrameWnd, CWnd)
|
|
//{{AFX_MSG_MAP(CVideoFrameWnd)
|
|
ON_WM_SIZE()
|
|
//}}AFX_MSG_MAP
|
|
END_MESSAGE_MAP()
|
|
|
|
BOOL CVideoFrameWnd::Create( CWnd *pParentWnd, int x, int y, int nWidth, int nHeight )
|
|
{
|
|
DestroyWindow();
|
|
|
|
CString strClassName = ::AfxRegisterWndClass( CS_HREDRAW | CS_VREDRAW, ::LoadCursor( NULL, IDC_ARROW ), GetSysColorBrush( COLOR_BTNFACE ), NULL );
|
|
|
|
CRect rect( x, y, x + nWidth, y + nHeight );
|
|
|
|
if( !CWnd::Create( strClassName, "", WS_CHILD | WS_DLGFRAME | WS_CLIPSIBLINGS, rect, pParentWnd, 0 ) )
|
|
{
|
|
LGLOG( LOG_LEVEL_LOW, LOG_TYPE_ERROR, this, _T("CVideoFrameWnd::Create"), _T("CWnd::Create failed") );
|
|
return FALSE;
|
|
}
|
|
|
|
/*
|
|
TCHAR pText[MAX_PATH];
|
|
_stprintf( pText, _T("INPUT %d"), i );
|
|
|
|
if( !m_ppDDVideoWnd[i]->SetWindowText( pText ) )
|
|
return FALSE;
|
|
*/
|
|
|
|
LGLOG( LOG_LEVEL_MEDIUM, LOG_TYPE_INFO, this, _T("CVideoFrameWnd::Create"), _T("Succeeded") );
|
|
return TRUE;
|
|
}
|
|
|
|
BOOL CVideoFrameWnd::DestroyWindow()
|
|
{
|
|
m_pDDVideoWnd = NULL;
|
|
|
|
return CWnd::DestroyWindow();
|
|
}
|
|
|
|
void CVideoFrameWnd::OnSize(UINT nType, int cx, int cy)
|
|
{
|
|
LGLOG( LOG_LEVEL_HIGH, LOG_TYPE_INFO, this, _T("CVideoFrameWnd::OnSize"), _T("Started...") );
|
|
|
|
CWnd::OnSize( nType, cx, cy );
|
|
|
|
Reposition();
|
|
|
|
LGLOG( LOG_LEVEL_HIGH, LOG_TYPE_INFO, this, _T("CVideoFrameWnd::OnSize"), _T("Done") );
|
|
}
|
|
|
|
BOOL CVideoFrameWnd::SetVideoWnd( CWnd *pDDVideoWnd )
|
|
{
|
|
if( !pDDVideoWnd )
|
|
return FALSE;
|
|
|
|
// if( m_pDDVideoWnd )
|
|
// {
|
|
// m_pDDVideoWnd->ShowWindow( SW_HIDE );
|
|
// }
|
|
|
|
m_pDDVideoWnd = pDDVideoWnd;
|
|
|
|
m_pDDVideoWnd->SetParent( this );
|
|
|
|
Reposition();
|
|
|
|
m_pDDVideoWnd->ShowWindow( SW_SHOW );
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
void CVideoFrameWnd::Reposition()
|
|
{
|
|
if( !m_pDDVideoWnd )
|
|
return;
|
|
|
|
if( !GetSafeHwnd() )
|
|
return;
|
|
|
|
CRect clientRect;
|
|
GetClientRect( clientRect );
|
|
|
|
CRect frameRect;
|
|
FitRectWithAspect( &clientRect, &frameRect, 4.0/3.0 );
|
|
|
|
m_pDDVideoWnd->MoveWindow( &frameRect, TRUE );
|
|
}
|