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.

135 lines
3.7 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: PropertySensorWnd.cpp
  9. // AUTHOR: Sergey Chizhevskiy
  10. // OVERVIEW
  11. // ~~~~~~~~
  12. // Source file of PropertySensorWnd.cpp
  13. //----------------------------------------------------------------------------
  14. // PropertySensorWnd.cpp : implementation file
  15. //
  16. #include "stdafx.h"
  17. #include "chicago.h"
  18. #include "PropertySensorWnd.h"
  19. #include "..\..\LgLib\Version.h"
  20. #ifdef _DEBUG
  21. #define new DEBUG_NEW
  22. #undef THIS_FILE
  23. static char THIS_FILE[] = __FILE__;
  24. #endif
  25. /////////////////////////////////////////////////////////////////////////////
  26. // CPropertySensorWnd
  27. CPropertySensorWnd::CPropertySensorWnd()
  28. {
  29. m_bOddUpdate = FALSE;
  30. m_pSensor = NULL;
  31. m_OSVersionInfo.dwOSVersionInfoSize = sizeof( m_OSVersionInfo );
  32. ::GetVersionEx( &m_OSVersionInfo );
  33. LGLOG( LOG_LEVEL_MEDIUM, LOG_TYPE_INFO, this, _T("CPropertySensorWnd::CPropertySensorWnd") );
  34. }
  35. CPropertySensorWnd::~CPropertySensorWnd()
  36. {
  37. LGLOG( LOG_LEVEL_MEDIUM, LOG_TYPE_INFO, this, _T("CPropertySensorWnd::~CPropertySensorWnd") );
  38. }
  39. BEGIN_MESSAGE_MAP(CPropertySensorWnd, CWnd)
  40. //{{AFX_MSG_MAP(CPropertySensorWnd)
  41. ON_WM_PAINT()
  42. ON_WM_SIZE()
  43. //}}AFX_MSG_MAP
  44. END_MESSAGE_MAP()
  45. /////////////////////////////////////////////////////////////////////////////
  46. // CPropertySensorWnd message handlers
  47. BOOL CPropertySensorWnd::Create(CWnd *pParentWnd, int x, int y, int cx, int cy)
  48. {
  49. CString strClassName = ::AfxRegisterWndClass( CS_HREDRAW | CS_VREDRAW, ::LoadCursor( NULL, IDC_CROSS ), (HBRUSH)GetSysColorBrush( COLOR_BTNFACE ), NULL );
  50. CRect rect( x, y, x + cx, y + cy );
  51. if( !CWnd::Create( strClassName, "", WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_CHILD | WS_VISIBLE, rect, pParentWnd, 0 ) )
  52. {
  53. LGLOG( LOG_LEVEL_LOW, LOG_TYPE_ERROR, this, _T("CPropertySensorWnd::Create"), _T("CWnd::Create failed") );
  54. return FALSE;
  55. }
  56. LGLOG( LOG_LEVEL_MEDIUM, LOG_TYPE_INFO, this, _T("CPropertySensorWnd::Create"), _T("Succeeded") );
  57. return TRUE;
  58. }
  59. void CPropertySensorWnd::OnPaint()
  60. {
  61. LGLOG( LOG_LEVEL_REALTIME, LOG_TYPE_INFO, this, _T("CPropertySensorWnd::OnPaint"), _T("Started...") );
  62. CPaintDC dc(this);
  63. CRect rect;
  64. GetClientRect( &rect );
  65. OnDraw( &m_MemoryDC );
  66. dc.BitBlt( rect.left, rect.top, rect.Width(), rect.Height(), &m_MemoryDC, 0, 0, SRCCOPY );
  67. LGLOG( LOG_LEVEL_REALTIME, LOG_TYPE_INFO, this, _T("CPropertySensorWnd::OnPaint"), _T("Done") );
  68. }
  69. void CPropertySensorWnd::OnDraw( CDC *pDC )
  70. {
  71. CRect rect;
  72. GetClientRect( &rect );
  73. pDC->FillSolidRect( &rect, RGB(0,0,0) );
  74. pDC->DrawText( _T("Without visible representation"), &rect, DT_SINGLELINE | DT_CENTER | DT_VCENTER );
  75. }
  76. void CPropertySensorWnd::SetSensor(CSensor *pSensor)
  77. {
  78. // disconnect old one
  79. if( m_pSensor )
  80. m_pSensor->SetSensorPropertyWnd( NULL );
  81. m_pSensor = pSensor;
  82. // connect new one
  83. if( m_pSensor )
  84. m_pSensor->SetSensorPropertyWnd( this );
  85. if( GetSafeHwnd() && IsWindowVisible() )
  86. InvalidateRect( NULL, FALSE );
  87. }
  88. void CPropertySensorWnd::OnSize(UINT nType, int cx, int cy)
  89. {
  90. CWnd::OnSize( nType, cx, cy );
  91. m_MemoryDC.Create( cx, cy, ::GetSysColor( COLOR_BTNFACE ) );
  92. }
  93. void CPropertySensorWnd::UpdateInfo( BOOL bOddUpdate )
  94. {
  95. m_bOddUpdate = bOddUpdate;
  96. if( GetSafeHwnd() && IsWindowVisible() )
  97. InvalidateRect( NULL, FALSE );
  98. }
  99. void CPropertySensorWnd::FitRect( CRect ParentRect, CRect &ChildRect )
  100. {
  101. FitRectWithAspect( &ParentRect, &ChildRect, 1.0 );
  102. }
  103. void CPropertySensorWnd::OnUpdateSensorProperty()
  104. {
  105. }