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.
97 lines
2.4 KiB
97 lines
2.4 KiB
//----------------------------------------------------------------------------
|
|
// Laser Guard Ltd.
|
|
// Copyright © 2000-2002. All Rights Reserved.
|
|
// Version 1.0 01/01/2000
|
|
// Last modification: 08/10/2003
|
|
// PROJECT:
|
|
// SUBSYSTEM:
|
|
// FILE: LgUICameraVideoWnd.cpp
|
|
// AUTHOR: Sergey Chizhevskiy
|
|
// OVERVIEW
|
|
// ~~~~~~~~
|
|
// Source file of LgUICameraVideoWnd.cpp
|
|
//----------------------------------------------------------------------------
|
|
#include "stdafx.h"
|
|
#include "LgUICameraVideoWnd.h"
|
|
#include "LgUICameraEngine.h"
|
|
#include "LgUICameraListWnd.h"
|
|
#include "LgUICamera.h"
|
|
|
|
CLgUICameraVideoWnd::CLgUICameraVideoWnd()
|
|
{
|
|
}
|
|
|
|
CLgUICameraVideoWnd::~CLgUICameraVideoWnd()
|
|
{
|
|
DestroyWindow();
|
|
}
|
|
|
|
BEGIN_MESSAGE_MAP(CLgUICameraVideoWnd, CWnd)
|
|
//{{AFX_MSG_MAP(CLgUICameraVideoWnd)
|
|
ON_WM_PAINT()
|
|
ON_WM_LBUTTONDOWN()
|
|
//}}AFX_MSG_MAP
|
|
END_MESSAGE_MAP()
|
|
|
|
BOOL CLgUICameraVideoWnd::Create( CWnd *pParentWnd, int x, int y, int nWidth, int nHeight )
|
|
{
|
|
CString strClassName = ::AfxRegisterWndClass( CS_HREDRAW | CS_VREDRAW, ::LoadCursor( NULL, IDC_ARROW ), (HBRUSH)COLOR_WINDOW, NULL );
|
|
|
|
CRect rect( x, y, x + nWidth, y + nHeight );
|
|
|
|
if( !CWnd::Create( strClassName, "", WS_CHILD | WS_DLGFRAME | WS_CLIPSIBLINGS, rect, pParentWnd, 0 ) )
|
|
return FALSE;
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
BOOL CLgUICameraVideoWnd::DestroyWindow()
|
|
{
|
|
CLgLink<CLgUICameraVideoWnd,CLgUICameraMainWnd>::Unlink();
|
|
CLgLink<CLgUICameraVideoWnd,CLgUICameraListWnd>::Unlink();
|
|
|
|
return CWnd::DestroyWindow();
|
|
}
|
|
|
|
void CLgUICameraVideoWnd::OnDraw( CDC *pDC )
|
|
{
|
|
CRect rect;
|
|
GetClientRect( &rect );
|
|
|
|
m_DIB.Draw( pDC->GetSafeHdc(), &rect );
|
|
}
|
|
|
|
void CLgUICameraVideoWnd::OnPaint()
|
|
{
|
|
CPaintDC dc( this );
|
|
|
|
CLgUICamera *pCamera = GetVideoCamera();
|
|
if( pCamera )
|
|
pCamera->UICameraSampleGet();
|
|
|
|
CRect rect;
|
|
GetClientRect( &rect );
|
|
dc.DrawText( "NO VIDEO", &rect, DT_SINGLELINE | DT_VCENTER | DT_CENTER);
|
|
|
|
OnDraw( &dc );
|
|
}
|
|
|
|
void CLgUICameraVideoWnd::OnLButtonDown( UINT nFlags, CPoint point )
|
|
{
|
|
CLgUICameraListWnd *pListWnd = *this;
|
|
if( pListWnd )
|
|
pListWnd->SetActiveVideo( this );
|
|
}
|
|
|
|
void CLgUICameraVideoWnd::OnVideoStreamSample( CLgImageDIB *pDIB )
|
|
{
|
|
m_DIB.Create( (LPBITMAPINFO)*pDIB, *pDIB );
|
|
|
|
CClientDC dc(this);
|
|
OnDraw( &dc );
|
|
|
|
// ask for next sample
|
|
CLgUICamera *pCamera = GetVideoCamera();
|
|
if( pCamera )
|
|
pCamera->UICameraSampleGet();
|
|
}
|