#pragma once
#include <afxmt.h>
#include "../Data.h"



#define ECG_COLOR_GREEN			0x000
#define ECG_COLOR_YELLOW		0x100
#define ECG_COLOR_RED			0x200

#define	ECG_WAVE_BUFF_LENGTH	(256*32)
// CDataRecWave

class CDataRecWave : public CStatic
{
	DECLARE_DYNAMIC(CDataRecWave)

public:
	
	//在屏幕上单位长度的像素点个数
	static INT  m_i32ECGPixel;
	//波形的单位长度的数字量
	static INT  m_i32ECGValue;
	//在屏幕上单位长度的像素点个数
	static INT  m_i32RespPixel;
	//波形的单位长度的数字量
	static INT  m_i32RespValue;
	//在屏幕上单位长度的像素点个数
	static INT  m_i32PlethPixel;
	//波形的单位长度的数字量
	static INT  m_i32PlethValue;
	static INT m_i32Height;
	static INT  m_i32Width;
	CDataRecWave();
	virtual ~CDataRecWave();
	//绘制心电波形
	void Draw_Wave();
	void Erase();
	void copy_data(struct SAVE_DATA *st);
	void show_change();
	void Draw_ECG_Wave(INT x,INT y,INT type);
	void Draw_Resp_Wave(INT x, INT y);
	void Draw_Pleth_Wave(INT x, INT y);
protected:
	afx_msg void OnPaint();
	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
	afx_msg BOOL OnEraseBkgnd(CDC* pDC);
	DECLARE_MESSAGE_MAP()

private:
	CRect m_rectCtrl;			// 控件区域
	CRect m_rectValue;			// 显示数值区域
	CDC dcMem; //用于缓冲作图的内存DC 
	CBitmap bmp;
	INT m_i32Show;
	int m_i32LeadType;

	struct SAVE_DATA m_stSAVE_DATA;

	//上次画图的ｘｙ轴坐标
	int m_i32LastX, m_i32LastY;
	int m_i32EraseFlag;
	

	CCriticalSection m_CSWaveData;
	int m_u16TempX, m_i32EraseLast;

	CPen *penECGLine;
	CPen *penRespLine;
	CPen *penPlethLine;

	CPen *penErase;
	CFont font;
	CPoint *m_pCPonit;
	//CButton 
};


