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.

126 lines
2.9 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: VideoFrameWnd.cpp
  9. // AUTHOR: Sergey Chizhevskiy
  10. // OVERVIEW
  11. // ~~~~~~~~
  12. // Source file of VideoFrameWnd.cpp
  13. //----------------------------------------------------------------------------
  14. #include "stdafx.h"
  15. #include "chicago.h"
  16. #include "VideoFrameWnd.h"
  17. #include "..\..\LgLib\LgAux.h"
  18. #include "..\..\LgLib\Version.h"
  19. #ifdef _DEBUG
  20. #define new DEBUG_NEW
  21. #undef THIS_FILE
  22. static char THIS_FILE[] = __FILE__;
  23. #endif
  24. CVideoFrameWnd::CVideoFrameWnd()
  25. {
  26. m_pDDVideoWnd = NULL;
  27. LGLOG( LOG_LEVEL_MEDIUM, LOG_TYPE_INFO, this, _T("CVideoFrameWnd::CVideoFrameWnd") );
  28. }
  29. CVideoFrameWnd::~CVideoFrameWnd()
  30. {
  31. DestroyWindow();
  32. LGLOG( LOG_LEVEL_MEDIUM, LOG_TYPE_INFO, this, _T("CVideoFrameWnd::~CVideoFrameWnd") );
  33. }
  34. BEGIN_MESSAGE_MAP(CVideoFrameWnd, CWnd)
  35. //{{AFX_MSG_MAP(CVideoFrameWnd)
  36. ON_WM_SIZE()
  37. //}}AFX_MSG_MAP
  38. END_MESSAGE_MAP()
  39. BOOL CVideoFrameWnd::Create( CWnd *pParentWnd, int x, int y, int nWidth, int nHeight )
  40. {
  41. DestroyWindow();
  42. CString strClassName = ::AfxRegisterWndClass( CS_HREDRAW | CS_VREDRAW, ::LoadCursor( NULL, IDC_ARROW ), GetSysColorBrush( COLOR_BTNFACE ), NULL );
  43. CRect rect( x, y, x + nWidth, y + nHeight );
  44. if( !CWnd::Create( strClassName, "", WS_CHILD | WS_DLGFRAME | WS_CLIPSIBLINGS, rect, pParentWnd, 0 ) )
  45. {
  46. LGLOG( LOG_LEVEL_LOW, LOG_TYPE_ERROR, this, _T("CVideoFrameWnd::Create"), _T("CWnd::Create failed") );
  47. return FALSE;
  48. }
  49. /*
  50. TCHAR pText[MAX_PATH];
  51. _stprintf( pText, _T("INPUT %d"), i );
  52. if( !m_ppDDVideoWnd[i]->SetWindowText( pText ) )
  53. return FALSE;
  54. */
  55. LGLOG( LOG_LEVEL_MEDIUM, LOG_TYPE_INFO, this, _T("CVideoFrameWnd::Create"), _T("Succeeded") );
  56. return TRUE;
  57. }
  58. BOOL CVideoFrameWnd::DestroyWindow()
  59. {
  60. m_pDDVideoWnd = NULL;
  61. return CWnd::DestroyWindow();
  62. }
  63. void CVideoFrameWnd::OnSize(UINT nType, int cx, int cy)
  64. {
  65. LGLOG( LOG_LEVEL_HIGH, LOG_TYPE_INFO, this, _T("CVideoFrameWnd::OnSize"), _T("Started...") );
  66. CWnd::OnSize( nType, cx, cy );
  67. Reposition();
  68. LGLOG( LOG_LEVEL_HIGH, LOG_TYPE_INFO, this, _T("CVideoFrameWnd::OnSize"), _T("Done") );
  69. }
  70. BOOL CVideoFrameWnd::SetVideoWnd( CWnd *pDDVideoWnd )
  71. {
  72. if( !pDDVideoWnd )
  73. return FALSE;
  74. // if( m_pDDVideoWnd )
  75. // {
  76. // m_pDDVideoWnd->ShowWindow( SW_HIDE );
  77. // }
  78. m_pDDVideoWnd = pDDVideoWnd;
  79. m_pDDVideoWnd->SetParent( this );
  80. Reposition();
  81. m_pDDVideoWnd->ShowWindow( SW_SHOW );
  82. return TRUE;
  83. }
  84. void CVideoFrameWnd::Reposition()
  85. {
  86. if( !m_pDDVideoWnd )
  87. return;
  88. if( !GetSafeHwnd() )
  89. return;
  90. CRect clientRect;
  91. GetClientRect( clientRect );
  92. CRect frameRect;
  93. FitRectWithAspect( &clientRect, &frameRect, 4.0/3.0 );
  94. m_pDDVideoWnd->MoveWindow( &frameRect, TRUE );
  95. }