Old fashion design for PC-104
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

4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. //----------------------------------------------------------------------------
  2. // Laser Guard Ltd.
  3. // Copyright � 2000-2002. All Rights Reserved.
  4. // Version 1.0 01/01/2000
  5. // Last modification: 08/10/2003
  6. // PROJECT:
  7. // SUBSYSTEM:
  8. // FILE: LgUICameraVideoWnd.cpp
  9. // AUTHOR: Sergey Chizhevskiy
  10. // OVERVIEW
  11. // ~~~~~~~~
  12. // Source file of LgUICameraVideoWnd.cpp
  13. //----------------------------------------------------------------------------
  14. #include "stdafx.h"
  15. #include "LgUICameraVideoWnd.h"
  16. #include "LgUICameraEngine.h"
  17. #include "LgUICameraListWnd.h"
  18. #include "LgUICamera.h"
  19. CLgUICameraVideoWnd::CLgUICameraVideoWnd()
  20. {
  21. }
  22. CLgUICameraVideoWnd::~CLgUICameraVideoWnd()
  23. {
  24. DestroyWindow();
  25. }
  26. BEGIN_MESSAGE_MAP(CLgUICameraVideoWnd, CWnd)
  27. //{{AFX_MSG_MAP(CLgUICameraVideoWnd)
  28. ON_WM_PAINT()
  29. ON_WM_LBUTTONDOWN()
  30. //}}AFX_MSG_MAP
  31. END_MESSAGE_MAP()
  32. BOOL CLgUICameraVideoWnd::Create( CWnd *pParentWnd, int x, int y, int nWidth, int nHeight )
  33. {
  34. CString strClassName = ::AfxRegisterWndClass( CS_HREDRAW | CS_VREDRAW, ::LoadCursor( NULL, IDC_ARROW ), (HBRUSH)COLOR_WINDOW, NULL );
  35. CRect rect( x, y, x + nWidth, y + nHeight );
  36. if( !CWnd::Create( strClassName, "", WS_CHILD | WS_DLGFRAME | WS_CLIPSIBLINGS, rect, pParentWnd, 0 ) )
  37. return FALSE;
  38. return TRUE;
  39. }
  40. BOOL CLgUICameraVideoWnd::DestroyWindow()
  41. {
  42. CLgLink<CLgUICameraVideoWnd,CLgUICameraMainWnd>::Unlink();
  43. CLgLink<CLgUICameraVideoWnd,CLgUICameraListWnd>::Unlink();
  44. return CWnd::DestroyWindow();
  45. }
  46. void CLgUICameraVideoWnd::OnDraw( CDC *pDC )
  47. {
  48. CRect rect;
  49. GetClientRect( &rect );
  50. m_DIB.Draw( pDC->GetSafeHdc(), &rect );
  51. }
  52. void CLgUICameraVideoWnd::OnPaint()
  53. {
  54. CPaintDC dc( this );
  55. CLgUICamera *pCamera = GetVideoCamera();
  56. if( pCamera )
  57. pCamera->UICameraSampleGet();
  58. CRect rect;
  59. GetClientRect( &rect );
  60. dc.DrawText( "NO VIDEO", &rect, DT_SINGLELINE | DT_VCENTER | DT_CENTER);
  61. OnDraw( &dc );
  62. }
  63. void CLgUICameraVideoWnd::OnLButtonDown( UINT nFlags, CPoint point )
  64. {
  65. CLgUICameraListWnd *pListWnd = *this;
  66. if( pListWnd )
  67. pListWnd->SetActiveVideo( this );
  68. }
  69. void CLgUICameraVideoWnd::OnVideoStreamSample( CLgImageDIB *pDIB )
  70. {
  71. m_DIB.Create( (LPBITMAPINFO)*pDIB, *pDIB );
  72. CClientDC dc(this);
  73. OnDraw( &dc );
  74. // ask for next sample
  75. CLgUICamera *pCamera = GetVideoCamera();
  76. if( pCamera )
  77. pCamera->UICameraSampleGet();
  78. }