| 1 |
/* --------------------------------------------------------------------- */ |
| 2 |
/* NeuroManager - A spike train analysis tool */ |
| 3 |
/* Copyright (c) 2005-2006 RIKEN, Japan. All rights reserved. */ |
| 4 |
/* http://satellite.sourceforge.jp/ */ |
| 5 |
/* --------------------------------------------------------------------- */ |
| 6 |
/* This program is free software; you can redistribute it and/or */ |
| 7 |
/* modify it under the terms of the GNU General Public License */ |
| 8 |
/* as published by the Free Software Foundation; either version 2 */ |
| 9 |
/* of the License, or (at your option) any later version. */ |
| 10 |
/* */ |
| 11 |
/* This program is distributed in the hope that it will be useful, */ |
| 12 |
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ |
| 13 |
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ |
| 14 |
/* GNU General Public License for more details. */ |
| 15 |
/* */ |
| 16 |
/* You should have received a copy of the GNU General Public License */ |
| 17 |
/* along with this program; see the file COPYING.txt. If not, write */ |
| 18 |
/* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth */ |
| 19 |
/* Floor, Boston, MA 02110-1301, USA. */ |
| 20 |
/* --------------------------------------------------------------------- */ |
| 21 |
|
| 22 |
/* $Id: DataView.h,v 1.39 2006/01/24 01:59:57 orrisroot Exp $ */ |
| 23 |
|
| 24 |
// DataView.h : interface of the CDataView class |
| 25 |
// |
| 26 |
|
| 27 |
#pragma once |
| 28 |
|
| 29 |
class CDataView : public CScrollView |
| 30 |
{ |
| 31 |
DECLARE_DYNCREATE( CDataView ) |
| 32 |
|
| 33 |
protected: |
| 34 |
// create from dynamic constraction only |
| 35 |
CDataView(); |
| 36 |
virtual ~CDataView(); |
| 37 |
|
| 38 |
public: |
| 39 |
#ifdef _DEBUG |
| 40 |
|
| 41 |
virtual void AssertValid() const; |
| 42 |
virtual void Dump( CDumpContext& dc ) const; |
| 43 |
#endif |
| 44 |
|
| 45 |
protected: |
| 46 |
// Overrides |
| 47 |
virtual void OnDraw( CDC* pDC ); |
| 48 |
DECLARE_MESSAGE_MAP() |
| 49 |
|
| 50 |
private: |
| 51 |
// system value |
| 52 |
CMutex *m_pMutex; |
| 53 |
UINT m_uixPad, m_uiyPad; // padding |
| 54 |
CPoint m_pointMousePress; // mouse point |
| 55 |
HCURSOR m_cursorDrag; // drag cursor |
| 56 |
CRect m_rectClient; // client rectangle |
| 57 |
double m_dMagnification; // magnification of X range ( 2^-10 - 2^10 ) |
| 58 |
QWORD m_qwLogicalXSize; // horizontal scrollbar size |
| 59 |
QWORD m_qwPhysicalXSize; // data length * mag + xpad * 2 |
| 60 |
QWORD m_qwPhysicalXPos; // left edge of data position |
| 61 |
double m_dPhysicalParLogicalXSize; // ratio = physical x / logical x |
| 62 |
// for drawing |
| 63 |
COLORREF m_colorForeground; // foreground pen / brush color |
| 64 |
COLORREF m_colorBackground; // background pen / brush color |
| 65 |
COLORREF m_colorAxis; // axis pen color |
| 66 |
CBrush m_brushBackground; // background brush |
| 67 |
CPen m_penForeground; // foreground pen |
| 68 |
CPen m_penBackground; // background pen |
| 69 |
CPen m_penAxis; // pen for axis |
| 70 |
// buffered drawing |
| 71 |
CDC m_memDC; // memory device context |
| 72 |
CBitmap m_bitmapBuffer; // buffered bitmap |
| 73 |
BOOL m_bResizeRequired; // require bitmap buffer resizing |
| 74 |
BOOL m_bRedrawRequired; // require redrawing |
| 75 |
BOOL m_bUseScrollDraw; // scrolling |
| 76 |
int m_iScrollDrawSize; // scroll size |
| 77 |
private: |
| 78 |
// user defined methods |
| 79 |
CFormView *GetDataViewProperties(); |
| 80 |
BOOL GetPaintRect( CRect &rcClip, int iView, int iTargetView, CRect &rcResult ); |
| 81 |
void _paintBackground( CDC *pDC, CRect *pRectDest ); |
| 82 |
void _paintAxis( CDC *pDC, CRect *pRectDest, UINT nView, UINT nTargetView, double ymin, double ymax ); |
| 83 |
void _paintData( CDC *pDC, CRect *pRectDest, UINT nView, UINT nTargetView, UINT nCh, double ymin, double ymax ); |
| 84 |
void Redraw( CDC* pDC, CRect *pRectDest ); |
| 85 |
QWORD GetCurrentDataPos() const; |
| 86 |
void UpdateScrollSizes( int cx, int cy ); |
| 87 |
void DataViewHScrollBy( int nPos ); |
| 88 |
void SetMagnification( double dMag ); |
| 89 |
void UpdatePropertiesTime(); |
| 90 |
public: |
| 91 |
void RedrawRequest(); |
| 92 |
// messages |
| 93 |
protected: |
| 94 |
virtual void OnUpdate( CView* /*pSender*/, LPARAM /*lHint*/, CObject* /*pHint*/ ); |
| 95 |
virtual BOOL OnScrollBy( CSize sizeScroll, BOOL bDoScroll = TRUE ); |
| 96 |
// virtual BOOL OnWndMsg(UINT message, WPARAM wParam, LPARAM lParam, LRESULT* pResult); |
| 97 |
public: |
| 98 |
afx_msg void OnSize( UINT nType, int cx, int cy ); |
| 99 |
afx_msg UINT OnGetDlgCode(); |
| 100 |
afx_msg void OnKeyDown( UINT nChar, UINT nRepCnt, UINT nFlags ); |
| 101 |
afx_msg void OnLButtonDown( UINT nFlags, CPoint point ); |
| 102 |
afx_msg void OnLButtonUp( UINT nFlags, CPoint point ); |
| 103 |
afx_msg void OnMouseMove( UINT nFlags, CPoint point ); |
| 104 |
afx_msg void OnHScroll( UINT nSBCode, UINT nPos, CScrollBar* pScrollBar ); |
| 105 |
afx_msg void OnMButtonDown( UINT nFlags, CPoint point ); |
| 106 |
afx_msg BOOL OnEraseBkgnd( CDC* pDC ); |
| 107 |
}; |
| 108 |
|
| 109 |
|