//---------------------------------------------------------------------------- // Laser Guard Ltd. // Copyright © 2000-2002. All Rights Reserved. // Version 1.0 01/01/2000 // Last modification: 27/10/2003 // PROJECT: // SUBSYSTEM: // FILE: LgSubVideoDlg.cpp // AUTHOR: Sergey Chizhevskiy // OVERVIEW // ~~~~~~~~ // Source file of LgSubVideoDlg.cpp //---------------------------------------------------------------------------- #include "stdafx.h" #include "lglibreport.h" #include "LgSubVideoDlg.h" #include "LgReportDlg.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif CLgSubVideoDlg::CLgSubVideoDlg(CWnd* pParent /*=NULL*/) : CDialog(CLgSubVideoDlg::IDD, pParent) { //{{AFX_DATA_INIT(CLgSubVideoDlg) // NOTE: the ClassWizard will add member initialization here //}}AFX_DATA_INIT m_pReportDlg = NULL; m_bDirty = TRUE; } void CLgSubVideoDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CLgSubVideoDlg) // NOTE: the ClassWizard will add DDX and DDV calls here //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CLgSubVideoDlg, CDialog) //{{AFX_MSG_MAP(CLgSubVideoDlg) ON_WM_PAINT() ON_WM_SIZE() //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CLgSubVideoDlg message handlers BOOL CLgSubVideoDlg::Create(CLgReportDlg *pReportDlg, CWnd *pParentWnd, CRect *pRect ) { m_pReportDlg = pReportDlg; if( !CDialog::Create( IDD, pParentWnd ) ) return FALSE; ShowWindow( SW_SHOW ); CRect rect; if( pRect ) rect = *pRect; else pParentWnd->GetClientRect( &rect ); MoveWindow( &rect ); return TRUE; } void CLgSubVideoDlg::OnPaint() { CPaintDC dc(this); dc.BitBlt( 0, 0, m_MemoryDC.GetSize().cx, m_MemoryDC.GetSize().cy, &m_MemoryDC, 0, 0, SRCCOPY ); } void CLgSubVideoDlg::OnSize(UINT nType, int cx, int cy) { CDialog::OnSize(nType, cx, cy); m_MemoryDC.Create( cx, cy ); } BOOL CLgSubVideoDlg::Draw( CLgImageJPEG *pJpeg ) { if( !pJpeg && !m_bDirty ) return TRUE; CSize size = m_MemoryDC.GetSize(); if( !pJpeg ) m_MemoryDC.Create( size.cx, size.cy ); else { CLgImageDIB dib; if( dib.Create( pJpeg ) ) { CRect rect( 0, 0, size.cx, size.cy ); dib.Draw( m_MemoryDC.GetSafeHdc(), &rect ); m_bDirty = TRUE; } } CClientDC dc( this ); dc.BitBlt( 0, 0, m_MemoryDC.GetSize().cx, m_MemoryDC.GetSize().cy, &m_MemoryDC, 0, 0, SRCCOPY ); return TRUE; }