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

// CDataRecWave

class CECGRespSpo2Trend : public CStatic
{
	DECLARE_DYNAMIC(CECGRespSpo2Trend)

public:
	CDC dcMem; //用于缓冲作图的内存DC 
	CBitmap bmp;
	//在屏幕上单位长度的像素点个数
	static INT  m_i32HRH;
	//波形的单位长度的数字量
	static INT  m_i32HRL;
	//在屏幕上单位长度的像素点个数
	static INT  m_i32RespPixel;
	//波形的单位长度的数字量
	static INT  m_i32RespValue;
	//在屏幕上单位长度的像素点个数
	static INT  m_i32Spo2H;
	//波形的单位长度的数字量
	static INT  m_i32Spo2L;
	static INT m_i32X, m_i32Y;
	static INT m_i32Height;
	static INT  m_i32Width;
	CECGRespSpo2Trend();
	virtual ~CECGRespSpo2Trend();
	
	void Erase();
	void add_data(UINT8 *wave, INT l, INT16 rr, INT16 hr, INT16 spo2);
	void show_change();
	void time_change();
	void draw();
	afx_msg void OnDestroy();
	
protected:
	afx_msg void OnPaint();
	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
	afx_msg BOOL OnEraseBkgnd(CDC* pDC);
	afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
	DECLARE_MESSAGE_MAP()

private:
	CRect m_rectCtrl;			// 控件区域
	CRect m_rectValue;			// 显示数值区域


	CDC dcMemBK; //用于缓冲作图的内存DC 
	CBitmap bmpBK;

	CDC dcMemBK2; //用于缓冲作图的内存DC 
	CBitmap bmpBK2;

	CFont font;
	CFont fontSet;

	INT m_i32Show;
	INT m_i32Time;


	CPen *penECGLine;
	CPen *penRespLine;
	CPen *penSpo2Line;
	CPen *penBK, *penGrid;
	INT16 *m_pi16HRBuf;
	INT m_i32HRBufW, m_i32HRBufR, m_i32HRBufL;
	INT16 *m_pi16Spo2;
	INT m_i32Spo2BufW, m_i32Spo2BufR, m_i32Spo2BufL;
	INT16 *m_pi16RR;
	INT m_i32RRBufW, m_i32RRBufR, m_i32RRBufL;
	UINT16 m_u16HRNum;
	CPoint *m_pCPonit;
	INT16 *m_pRespWaveBuff1;
	INT m_i32RespWaveBuffW1, m_i32RespWaveBuffR1, m_i32RespWaveBuffL1;
	INT16 *m_pRespWaveBuff2;
	INT m_i32RespWaveBuffW2, m_i32RespWaveBuffR2, m_i32RespWaveBuffL2;
	UINT16 m_u16RespWaveSum, m_u16RespWaveNum;
	//绘制心电波形
	void Draw_Wave();
	void Draw_HR();
	void Draw_Spo2();
	void Draw_RR();
	void Draw_Time();
};


