//---------------------------------------------------------------------------- // Laser Guard Ltd. // Copyright © 2000-2002. All Rights Reserved. // Version 1.0 01/01/2000 // Last modification: 25/11/2001 // PROJECT: // SUBSYSTEM: // FILE: ZoomAreaWnd.cpp // AUTHOR: Sergey Chizhevskiy // OVERVIEW // ~~~~~~~~ // Source file of ZoomAreaWnd.cpp //---------------------------------------------------------------------------- #include "stdafx.h" #include "chicago.h" #include "ZoomAreaWnd.h" #include "WholeAreaWnd.h" #ifdef _DEBUG #undef THIS_FILE static char THIS_FILE[]=__FILE__; #define new DEBUG_NEW #endif BEGIN_MESSAGE_MAP( CZoomAreaWnd, CAreaSensorWnd ) //{{AFX_MSG_MAP(CZoomAreaWnd) ON_WM_LBUTTONDOWN() ON_WM_LBUTTONUP() ON_WM_RBUTTONDOWN() ON_WM_MOUSEMOVE() //}}AFX_MSG_MAP END_MESSAGE_MAP() CZoomAreaWnd::CZoomAreaWnd() { m_pWholeAreaWnd = NULL; m_bMousePressed = FALSE; } CZoomAreaWnd::~CZoomAreaWnd() { } void CZoomAreaWnd::OnLButtonDown(UINT nFlags, CPoint point) { m_bMousePressed = TRUE; m_pMousePress = point; m_dwPressTime = GetTickCount(); SetCapture(); CAreaWnd ::OnLButtonDown(nFlags, point); } void CZoomAreaWnd::OnMouseMove(UINT nFlags, CPoint point) { if( m_bMousePressed ) { CLgDPoint dp1 = WindowToArea( &m_pMousePress ); CLgDPoint dp2 = WindowToArea( &point ); m_dpShift += dp1 - dp2; SetShift( m_dpShift ); m_pMousePress = point; } CAreaWnd ::OnMouseMove(nFlags, point); } void CZoomAreaWnd::OnLButtonUp(UINT nFlags, CPoint point) { if( GetTickCount() - m_dwPressTime < 200 ) SetScale( m_dScale + 1.0, &WindowToArea( &point ) ); m_bMousePressed = FALSE; ReleaseCapture(); CAreaWnd ::OnLButtonUp(nFlags, point); } void CZoomAreaWnd::OnRButtonDown(UINT nFlags, CPoint point) { SetScale( m_dScale - 1.0, &WindowToArea( &point ) ); CAreaWnd ::OnRButtonDown(nFlags, point); } CLgDRect CZoomAreaWnd::GetVisibleArea() { CRect WndRect; GetClientRect( &WndRect ); return WindowToArea( &WndRect ); } BOOL CZoomAreaWnd::SetActiveSensor( CSensor *pActiveSensor ) { if( CAreaSensorWnd::SetActiveSensor( pActiveSensor ) ) { if( m_pWholeAreaWnd ) m_pWholeAreaWnd->SetActiveSensor( pActiveSensor ); return TRUE; } return FALSE; } void CZoomAreaWnd::OnChangeViewParams() { CAreaSensorWnd::OnChangeViewParams(); // notify main window about change if( m_pWholeAreaWnd ) m_pWholeAreaWnd->InvalidateRect( NULL ); }