void COScopeCtrl::OnMouseMove(UINT nFlags, CPoint point) { CWnd::OnMouseMove(nFlags, point); if ((nFlags & MK_LBUTTON) == 0) { if (m_uLastMouseFlags & MK_LBUTTON) { // Mouse button was released -> explicitly clear the tooltip. CWnd* pwndParent = GetParent(); if (pwndParent) pwndParent->SendMessage(UM_OSCOPEPOSITION, 0, (LPARAM)(LPCTSTR)_T("")); } m_uLastMouseFlags = nFlags; return; } m_uLastMouseFlags = nFlags; // If that check is not there, it may lead to 100% CPU usage because Windows (Vista?) // keeps sending mouse messages even if the mouse does not move but when the mouse // button stays pressed. if (point == m_ptLastMousePos) return; m_ptLastMousePos = point; CRect plotRect; GetPlotRect(plotRect); if (!plotRect.PtInRect(point)) return; CWnd* pwndParent = GetParent(); if (pwndParent) { int yValue = -1; int plotHeight = plotRect.Height(); if (plotHeight > 0) { int yPixel = plotHeight - (point.y - plotRect.top); yValue = (int)(m_PlotData[0].dLowerLimit + yPixel * m_PlotData[0].dRange / plotHeight); } int mypos = (plotRect.Width() - point.x) + plotRect.left; int shownsecs = plotRect.Width() * thePrefs.GetTrafficOMeterInterval(); float apixel = (float)shownsecs / (float)plotRect.Width(); CString strInfo; //Xman Maella Statistik-Zoom //zz_fly :: moved from CStatisticsDlg::OnOscopePositionMsg() /* DWORD dwTime = (DWORD)(mypos * apixel); */ DWORD dwTime = (DWORD)(mypos * apixel) / thePrefs.GetZoomFactor(); //Xman end time_t tNow = time(NULL) - dwTime; TCHAR szDate[128]; _tcsftime(szDate, _countof(szDate), thePrefs.GetDateTimeFormat4Log(), localtime(&tNow)); strInfo.Format(_T("%s: %u @ %s ") + GetResString(IDS_TIMEBEFORE), m_str.YUnits, yValue, szDate, CastSecondsToLngHM(dwTime)); pwndParent->SendMessage(UM_OSCOPEPOSITION, 0, (LPARAM)(LPCTSTR)strInfo); } }
//----------------------------------------------------------------------------- // Draws the chart //----------------------------------------------------------------------------- void CXYChart::OnDraw( CDC *pDC, CRect destRect, CRect updateRect ) { CString string; int i; CAxis *axis; CSize axisDims; CSize trim(0,0); CRect plotRect, normalPlotRect, normalDestRect; double xRange[] = {1e30, -1e30}, yRange[]={1e30,-1e30}; updateRect.NormalizeRect(); normalDestRect = destRect; // Check to see that we are even in the update region normalDestRect.NormalizeRect(); normalDestRect.IntersectRect( normalDestRect, updateRect ); if( normalDestRect.IsRectEmpty() ) return; // Make sure our ranges are set // Get ranges for plotting GetPlotRange( xRange, yRange ); // Get the size of our plotting rectangle plotRect = GetPlotRect( pDC, destRect ); // Draw the basic structures for the plot DrawPlotBasics( pDC, destRect, plotRect ); // Draw the title DrawPlotTitle( pDC, destRect, plotRect ); normalPlotRect = plotRect; normalPlotRect.NormalizeRect(); updateRect.IntersectRect( updateRect, normalPlotRect ); if( updateRect.IsRectEmpty() == FALSE ) { // Draw each data set DrawDataSet( pDC, plotRect, xRange, yRange ); } // Draw the axes for( i = 0; i < m_AxisCount; i++ ) { axis = m_Axes[i]; axis->OnDraw( pDC, destRect, plotRect ); } CChart::OnDraw( pDC, destRect ); }