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.

116 lines
2.5 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: 25/11/2001
  6. // PROJECT:
  7. // SUBSYSTEM:
  8. // FILE: ZoomAreaWnd.cpp
  9. // AUTHOR: Sergey Chizhevskiy
  10. // OVERVIEW
  11. // ~~~~~~~~
  12. // Source file of ZoomAreaWnd.cpp
  13. //----------------------------------------------------------------------------
  14. #include "stdafx.h"
  15. #include "chicago.h"
  16. #include "ZoomAreaWnd.h"
  17. #include "WholeAreaWnd.h"
  18. #ifdef _DEBUG
  19. #undef THIS_FILE
  20. static char THIS_FILE[]=__FILE__;
  21. #define new DEBUG_NEW
  22. #endif
  23. BEGIN_MESSAGE_MAP( CZoomAreaWnd, CAreaSensorWnd )
  24. //{{AFX_MSG_MAP(CZoomAreaWnd)
  25. ON_WM_LBUTTONDOWN()
  26. ON_WM_LBUTTONUP()
  27. ON_WM_RBUTTONDOWN()
  28. ON_WM_MOUSEMOVE()
  29. //}}AFX_MSG_MAP
  30. END_MESSAGE_MAP()
  31. CZoomAreaWnd::CZoomAreaWnd()
  32. {
  33. m_pWholeAreaWnd = NULL;
  34. m_bMousePressed = FALSE;
  35. }
  36. CZoomAreaWnd::~CZoomAreaWnd()
  37. {
  38. }
  39. void CZoomAreaWnd::OnLButtonDown(UINT nFlags, CPoint point)
  40. {
  41. m_bMousePressed = TRUE;
  42. m_pMousePress = point;
  43. m_dwPressTime = GetTickCount();
  44. SetCapture();
  45. CAreaWnd ::OnLButtonDown(nFlags, point);
  46. }
  47. void CZoomAreaWnd::OnMouseMove(UINT nFlags, CPoint point)
  48. {
  49. if( m_bMousePressed )
  50. {
  51. CLgDPoint dp1 = WindowToArea( &m_pMousePress );
  52. CLgDPoint dp2 = WindowToArea( &point );
  53. m_dpShift += dp1 - dp2;
  54. SetShift( m_dpShift );
  55. m_pMousePress = point;
  56. }
  57. CAreaWnd ::OnMouseMove(nFlags, point);
  58. }
  59. void CZoomAreaWnd::OnLButtonUp(UINT nFlags, CPoint point)
  60. {
  61. if( GetTickCount() - m_dwPressTime < 200 )
  62. SetScale( m_dScale + 1.0, &WindowToArea( &point ) );
  63. m_bMousePressed = FALSE;
  64. ReleaseCapture();
  65. CAreaWnd ::OnLButtonUp(nFlags, point);
  66. }
  67. void CZoomAreaWnd::OnRButtonDown(UINT nFlags, CPoint point)
  68. {
  69. SetScale( m_dScale - 1.0, &WindowToArea( &point ) );
  70. CAreaWnd ::OnRButtonDown(nFlags, point);
  71. }
  72. CLgDRect CZoomAreaWnd::GetVisibleArea()
  73. {
  74. CRect WndRect;
  75. GetClientRect( &WndRect );
  76. return WindowToArea( &WndRect );
  77. }
  78. BOOL CZoomAreaWnd::SetActiveSensor( CSensor *pActiveSensor )
  79. {
  80. if( CAreaSensorWnd::SetActiveSensor( pActiveSensor ) )
  81. {
  82. if( m_pWholeAreaWnd )
  83. m_pWholeAreaWnd->SetActiveSensor( pActiveSensor );
  84. return TRUE;
  85. }
  86. return FALSE;
  87. }
  88. void CZoomAreaWnd::OnChangeViewParams()
  89. {
  90. CAreaSensorWnd::OnChangeViewParams();
  91. // notify main window about change
  92. if( m_pWholeAreaWnd )
  93. m_pWholeAreaWnd->InvalidateRect( NULL );
  94. }