VideoDlg.cpp
上传用户:popouu88
上传日期:2013-02-11
资源大小:2894k
文件大小:4k
源码类别:

IP电话/视频会议

开发平台:

Visual C++

  1. // VideoDlg.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "Control.h"
  5. #include "VideoDlg.h"
  6. #include "ComPelcod.h"
  7. #ifdef _DEBUG
  8. #define new DEBUG_NEW
  9. #undef THIS_FILE
  10. static char THIS_FILE[] = __FILE__;
  11. #endif
  12. extern CControlApp theApp;
  13. /////////////////////////////////////////////////////////////////////////////
  14. // CVideoDlg dialog
  15. CVideoDlg::CVideoDlg(CWnd* pParent /*=NULL*/)
  16. : CDialog(CVideoDlg::IDD, pParent)
  17. {
  18. //{{AFX_DATA_INIT(CVideoDlg)
  19. //}}AFX_DATA_INIT
  20. this->user_id = 0;
  21. }
  22. void CVideoDlg::DoDataExchange(CDataExchange* pDX)
  23. {
  24. CDialog::DoDataExchange(pDX);
  25. //{{AFX_DATA_MAP(CVideoDlg)
  26. DDX_Control(pDX, IDC_SUB_IRIS, m_iris_sub);
  27. DDX_Control(pDX, IDC_ADD_IRIS, m_iris_add);
  28. DDX_Control(pDX, IDC_SUB_ZOOM, m_zoom_sub);
  29. DDX_Control(pDX, IDC_ADD_ZOOM, m_zoom_add);
  30. DDX_Control(pDX, IDC_SUB_FOCUS, m_focus_sub);
  31. DDX_Control(pDX, IDC_ADD_FOCUS, m_focus_add);
  32. DDX_Control(pDX, IDC_AUTO_BUTTON, m_auto);
  33. DDX_Control(pDX, IDC_RIGHT_BUTTON, m_right);
  34. DDX_Control(pDX, IDC_DOWN_BUTTON, m_down);
  35. DDX_Control(pDX, IDC_LEFT_BUTTON, m_left);
  36. DDX_Control(pDX, IDC_UP_BUTTON, m_up);
  37. DDX_Control(pDX, IDC_CONTROL_STATIC, m_ctrl_static);
  38. DDX_Control(pDX, IDC_VIDEO_STATIC, m_video);
  39. //}}AFX_DATA_MAP
  40. }
  41. BEGIN_MESSAGE_MAP(CVideoDlg, CDialog)
  42. //{{AFX_MSG_MAP(CVideoDlg)
  43. ON_WM_CTLCOLOR()
  44. ON_WM_SIZE()
  45. ON_WM_NCHITTEST()
  46. ON_BN_CLICKED(IDC_AUTO_BUTTON, OnAutoButton)
  47. ON_BN_CLICKED(IDC_BUTTON, OnButton)
  48. //}}AFX_MSG_MAP
  49. ON_MESSAGE( WM_UPDOWNBUTTON ,OnUpDownButton )
  50. END_MESSAGE_MAP()
  51. /////////////////////////////////////////////////////////////////////////////
  52. // CVideoDlg message handlers
  53. BOOL CVideoDlg::OnInitDialog() 
  54. {
  55. CDialog::OnInitDialog( );
  56.     //上
  57. this->m_up.action = UP;
  58. //左
  59. this->m_left.action = LEFT;
  60. //下
  61. this->m_down.action = DOWN;
  62. //右
  63. this->m_right.action = RIGHT;
  64. //调焦
  65. this->m_focus_add.action = FOCUS_LARGEN;
  66. this->m_focus_sub.action = FOCUS_LESSEN;
  67. //变倍
  68. this->m_zoom_add.action = ZOOM_LARGEN;
  69. this->m_zoom_sub.action = ZOOM_LESSEN;
  70. //光圈
  71. this->m_iris_add.action = IRIS_LARGEN;
  72. this->m_iris_sub.action = IRIS_LESSEN;
  73. return TRUE; 
  74. }
  75. UINT CVideoDlg::OnNcHitTest(CPoint point) 
  76. {
  77. UINT hitTest = CDialog::OnNcHitTest(point);
  78. return hitTest == HTCLIENT ? HTCAPTION : hitTest;
  79. }
  80. void CVideoDlg::PostNcDestroy( ) 
  81. {
  82. delete this;
  83. }
  84. LRESULT CVideoDlg::WindowProc(UINT message, WPARAM wParam, LPARAM lParam) 
  85. {
  86. if( message == WM_CLOSE )
  87. {
  88. this->DestroyWindow( );
  89. return 0;
  90. }
  91. return CDialog::WindowProc( message , wParam , lParam );
  92. }
  93. HBRUSH CVideoDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) 
  94. {
  95. static HBRUSH b = ::CreateSolidBrush( RGB( 214 , 239 , 255 ) );
  96. pDC->SetBkMode( TRANSPARENT );
  97. if( nCtlColor == CTLCOLOR_STATIC )
  98. {
  99. if( pWnd->GetSafeHwnd( ) == this->m_video.GetSafeHwnd( ) )
  100. {
  101. static HBRUSH bb = ::CreateSolidBrush( RGB( 10 , 10 , 10 ) );
  102. pDC->SetTextColor( RGB( 255 , 0 , 0 ) );
  103. return bb;
  104. }
  105. }
  106. return b;
  107. }
  108. void CVideoDlg::OnSize(UINT nType, int cx, int cy) 
  109. {
  110. CDialog::OnSize( nType , cx , cy );
  111. static int width = 0;
  112. if( this->m_ctrl_static )
  113. {
  114. if( ! width )
  115. {
  116. CRect rc;
  117. this->m_ctrl_static.GetWindowRect( &rc );
  118. width = rc.Width( ) + 5;
  119. }
  120. // this->m_ctrl_static.MoveWindow( 0 , 0 , width , cy );
  121. }
  122. if( this->m_video )
  123. this->m_video.MoveWindow(  width , 0 , cx - width , cy );
  124. this->Invalidate( );
  125. }
  126. void CVideoDlg::OnUpDownButton( WPARAM wParam , LPARAM lParam )
  127. {
  128. if( wParam )
  129. {
  130. if( this->m_auto.GetCheck( ) )
  131. {
  132. this->m_auto.SetCheck( 0 );
  133. }
  134. PPanelCommand cmd;
  135. cmd.assembleData( this->user_id , ( int )wParam , ( bool )lParam );
  136. theApp.GetTCP( ).Send( cmd.buffer );
  137. }
  138. }
  139. void CVideoDlg::OnAutoButton( ) 
  140. {
  141. PPanelCommand cmd;
  142. cmd.assembleData( this->user_id , AUTO , this->m_auto.GetCheck( ) );
  143. theApp.GetTCP( ).Send( cmd.buffer );
  144. }
  145. void CVideoDlg::OnButton() 
  146. {
  147. PPanelCommand cmd;
  148. cmd.assembleData( this->user_id , FULLSCREEN , 2 );
  149. theApp.GetTCP( ).Send( cmd.buffer );
  150. }