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.

160 lines
4.0 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: WholeAreaWnd.cpp
  9. // AUTHOR: Sergey Chizhevskiy
  10. // OVERVIEW
  11. // ~~~~~~~~
  12. // Source file of WholeAreaWnd.cpp
  13. //----------------------------------------------------------------------------
  14. // WholeAreaWnd.cpp: implementation of the CWholeAreaWnd class.
  15. //
  16. //////////////////////////////////////////////////////////////////////
  17. #include "stdafx.h"
  18. #include "chicago.h"
  19. #include "WholeAreaWnd.h"
  20. #include "ZoomAreaWnd.h"
  21. #include "..\..\LgLib\Version.h"
  22. #ifdef _DEBUG
  23. #undef THIS_FILE
  24. static char THIS_FILE[]=__FILE__;
  25. #define new DEBUG_NEW
  26. #endif
  27. /*
  28. BEGIN_MESSAGE_MAP( CWholeAreaWnd, CAreaSensorWnd )
  29. //{{AFX_MSG_MAP(CWholeAreaWnd)
  30. ON_WM_LBUTTONDOWN()
  31. //}}AFX_MSG_MAP
  32. END_MESSAGE_MAP()
  33. CWholeAreaWnd::CWholeAreaWnd()
  34. {
  35. m_pZoomAreaWnd = NULL;
  36. }
  37. CWholeAreaWnd::~CWholeAreaWnd()
  38. {
  39. }
  40. void CWholeAreaWnd::OnLButtonDown(UINT nFlags, CPoint point)
  41. {
  42. m_pZoomAreaWnd->SetCenter( &WindowToArea( &point ) );
  43. CRect WndRect( point.x - 3, point.y - 3, point.x + 3, point.y + 3 );
  44. CLgDRect AreaRect( WindowToArea( &WndRect ) );
  45. CSensor *pActiveSensor = m_pSensorArray->GetSensor( AreaRect );
  46. if( pActiveSensor )
  47. {
  48. if( SetActiveSensor( pActiveSensor ) )
  49. {
  50. CWnd *pParent = GetParent();
  51. if( pParent )
  52. pParent->SendMessage( WM_SENSOR_SHOW, (WPARAM)m_pActiveSensor, (LPARAM)m_pActiveSensor );
  53. }
  54. }
  55. else
  56. {
  57. InvalidateRect( NULL );
  58. }
  59. CAreaWnd ::OnLButtonDown(nFlags, point);
  60. }
  61. */
  62. void CWholeAreaWnd::OnUIMapActivateObject( CLgUIMapObject* pActiveObject )
  63. {
  64. LGLOG( LOG_LEVEL_REALTIME, LOG_TYPE_INFO, this, _T("CWholeAreaWnd::OnUIMapActivateObject"), _T("Started...") );
  65. if( pActiveObject )
  66. {
  67. CWnd *pParent = GetParent();
  68. if( pParent )
  69. pParent->SendMessage( WM_SENSOR_SHOW, (WPARAM)pActiveObject, (LPARAM)pActiveObject );
  70. }
  71. LGLOG( LOG_LEVEL_REALTIME, LOG_TYPE_INFO, this, _T("CWholeAreaWnd::OnUIMapActivateObject"), _T("Done") );
  72. }
  73. /*
  74. void CWholeAreaWnd::OnDraw(CDC *pDC)
  75. {
  76. CAreaSensorWnd::OnDraw( pDC );
  77. if( m_pZoomAreaWnd )
  78. {
  79. CRect rect = AreaToWindow( &m_pZoomAreaWnd->GetVisibleArea() );
  80. DWORD pLine[2][4] = {{0,2,2,0},{2,0,0,2}};
  81. LOGBRUSH LogBrush;
  82. LogBrush.lbStyle = BS_SOLID;
  83. LogBrush.lbColor = RGB(0xFF,0xFF,0xFF);
  84. CPen pen( m_bOddUpdate ? PS_DOT : PS_DASH, 1, LogBrush.lbColor );
  85. // CPen pen( PS_USERSTYLE | PS_GEOMETRIC, 1, &LogBrush, 4, m_bOddUpdate ? pLine[0] : pLine[1] );
  86. CPen *pPen = pDC->SelectObject( &pen );
  87. int nROP2 = pDC->SetROP2( R2_XORPEN );
  88. int nBkColor = pDC->SetBkColor( 0 );
  89. pDC->MoveTo( rect.left, rect.top );
  90. pDC->LineTo( rect.right, rect.top );
  91. pDC->LineTo( rect.right, rect.bottom );
  92. pDC->LineTo( rect.left, rect.bottom );
  93. pDC->LineTo( rect.left, rect.top );
  94. pDC->SetROP2( nROP2 );
  95. pDC->SetBkColor( nBkColor );
  96. pDC->SelectObject( pPen );
  97. }
  98. }
  99. */
  100. /*
  101. void CWholeAreaWnd::OnDrawTimer( CDC *pDC )
  102. {
  103. CAreaSensorWnd::OnDrawTimer( pDC );
  104. if( m_pZoomAreaWnd )
  105. {
  106. CRect rect = AreaToWindow( &m_pZoomAreaWnd->GetVisibleArea() );
  107. COLORREF color[2] = { RGB(0xFF,0xFF,0xFF), RGB(0,0,0) };
  108. CPen pen( PS_DOT, 1, m_bOddUpdate ? color[0] : color[1] );
  109. CPen *pPen = pDC->SelectObject( &pen );
  110. int nBkColor = pDC->SetBkColor( m_bOddUpdate ? color[1] : color[0] );
  111. pDC->MoveTo( rect.left, rect.top );
  112. pDC->LineTo( rect.right, rect.top );
  113. pDC->LineTo( rect.right, rect.bottom );
  114. pDC->LineTo( rect.left, rect.bottom );
  115. pDC->LineTo( rect.left, rect.top );
  116. pDC->SetBkColor( nBkColor );
  117. pDC->SelectObject( pPen );
  118. }
  119. }
  120. BOOL CWholeAreaWnd::SetActiveSensor( CSensor *pActiveSensor )
  121. {
  122. if( CAreaSensorWnd::SetActiveSensor( pActiveSensor ) )
  123. {
  124. if( m_pZoomAreaWnd )
  125. m_pZoomAreaWnd->SetActiveSensor( pActiveSensor );
  126. return TRUE;
  127. }
  128. return FALSE;
  129. }
  130. */