Skip to content

Commit

Permalink
添加测试桩。
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoweihan committed Sep 22, 2017
1 parent b173dac commit c9de24b
Show file tree
Hide file tree
Showing 27 changed files with 844 additions and 464 deletions.
116 changes: 82 additions & 34 deletions Src/Edislab/Edislab Pro/ChartFigureDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@
#include "stdafx.h"
#include "Edislab Pro.h"
#include "ChartFigureDlg.h"
#include <boost/checked_delete.hpp>
#include "DlgChartSet.h"
#include "DlgTabPanel.h"
#include "Msg.h"
#include "Macro.h"
// ChartFigureDlg 对话框
#define TIMER_CHART_EVENT (1000011)
#define TIMER_CHART (300)

#define TIMER_AXIS_EVENT (1000)
#define TIMER_GAP (500)
IMPLEMENT_DYNAMIC(ChartFigureDlg, CBaseDialog)
ChartFigureDlg::ChartFigureDlg(CWnd* pParent /*=NULL*/)
: CBaseDialog(ChartFigureDlg::IDD, pParent),
Expand All @@ -22,11 +24,7 @@ ChartFigureDlg::ChartFigureDlg(CWnd* pParent /*=NULL*/)

ChartFigureDlg::~ChartFigureDlg()
{
if (m_charxy != NULL)
{
delete m_charxy;
m_charxy = NULL;
}
boost::checked_delete(m_charxy);
}

void ChartFigureDlg::DoDataExchange(CDataExchange* pDX)
Expand Down Expand Up @@ -66,16 +64,15 @@ BOOL ChartFigureDlg::OnInitDialog()
GetClientRect(rect);
CSize size(rect.Width(), rect.Height());
m_charxy->resize(size);
SetTimer(TIMER_CHART_EVENT, TIMER_CHART, NULL);
//SetTimer(TIMER_CHART_EVENT, TIMER_CHART, NULL);
SetTimer(TIMER_AXIS_EVENT,TIMER_GAP,NULL);
return TRUE; // return TRUE unless you set the focus to a control
// 异常: OCX 属性页应返回 FALSE
}
void ChartFigureDlg::OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimized)
{
CBaseDialog::OnActivate(nState, pWndOther, bMinimized);

// TODO: 在此处添加消息处理程序代码
TRACE("[GaugeDlg] OnActivate!\r\n");
}
// ChartFigureDlg 消息处理程序
void ChartFigureDlg::OnLButtonDown(UINT nFlags, CPoint point)
Expand All @@ -93,7 +90,7 @@ void ChartFigureDlg::OnLButtonDown(UINT nFlags, CPoint point)
{
pWnd->PostMessage(WM_NOTIFY_ACTIVE_WND_TYPE,2,0);
}
CWnd::OnLButtonDown(nFlags, point);
CBaseDialog::OnLButtonDown(nFlags, point);
}


Expand All @@ -106,7 +103,7 @@ void ChartFigureDlg::OnLButtonUp(UINT nFlags, CPoint point)
//Invalidate();
}
ReleaseCapture();
CWnd::OnLButtonUp(nFlags, point);
CBaseDialog::OnLButtonUp(nFlags, point);
}


Expand All @@ -120,7 +117,7 @@ BOOL ChartFigureDlg::OnMouseWheel(UINT nFlags, short zDelta, CPoint pt)
m_charxy->wheelEvent(pts, zDelta);
Invalidate();
}
return CWnd::OnMouseWheel(nFlags, zDelta, pt);
return CBaseDialog::OnMouseWheel(nFlags, zDelta, pt);
}


Expand All @@ -132,7 +129,7 @@ void ChartFigureDlg::OnMouseMove(UINT nFlags, CPoint point)
m_charxy->mouseMoveEvent(point);
//Invalidate();
}
CWnd::OnMouseMove(nFlags, point);
CBaseDialog::OnMouseMove(nFlags, point);
}


Expand Down Expand Up @@ -204,7 +201,7 @@ void ChartFigureDlg::OnPaint()

void ChartFigureDlg::OnSize(UINT nType, int cx, int cy)
{
CWnd::OnSize(nType, cx, cy);
CBaseDialog::OnSize(nType, cx, cy);

// TODO: 在此处添加消息处理程序代码
if (m_charxy)
Expand All @@ -217,27 +214,12 @@ void ChartFigureDlg::OnSize(UINT nType, int cx, int cy)

void ChartFigureDlg::OnSizing(UINT fwSide, LPRECT pRect)
{
CWnd::OnSizing(fwSide, pRect);
CBaseDialog::OnSizing(fwSide, pRect);

// TODO: 在此处添加消息处理程序代码
Invalidate();
//Invalidate();
}

void ChartFigureDlg::setChartMgr(ChartManager* mgr)
{
if (m_charxy)
{
m_charxy->setChartMgr(mgr);
}
}
const ChartManager* ChartFigureDlg::getChartMgr()
{
if (m_charxy)
{
return m_charxy->getChartMgr();
}
return NULL;
}
void ChartFigureDlg::updateData() const
{
if (m_charxy)
Expand Down Expand Up @@ -315,9 +297,6 @@ void ChartFigureDlg::OnChartSet()

void ChartFigureDlg::OnChartDel()
{
// TODO: Add your command handler code here
int a;
a = 0;
}


Expand Down Expand Up @@ -395,6 +374,14 @@ void ChartFigureDlg::OnTimer(UINT_PTR nIDEvent)
{
updateData();
}
if (TIMER_AXIS_EVENT == nIDEvent)
{
if (nullptr != m_charxy)
{
m_charxy->ResfreshAxisTitle();
m_charxy->paintEvent();
}
}
CBaseDialog::OnTimer(nIDEvent);
}

Expand All @@ -412,3 +399,64 @@ LRESULT ChartFigureDlg::NotifyActive( WPARAM wp,LPARAM lp )
}
return 0L;
}

void ChartFigureDlg::SetXAxisSensorID(const SENSOR_TYPE_KEY& XAxisID)
{
if (nullptr == m_charxy)
{
return;
}

m_charxy->setXID(XAxisID);
}

SENSOR_TYPE_KEY ChartFigureDlg::GetXAxisSensorID(void)
{
if (nullptr == m_charxy)
{
return SENSOR_TYPE_KEY();
}

return m_charxy->getXID();
}

void ChartFigureDlg::SetYAxisSensorID(const SENSOR_TYPE_KEY& YAxisID)
{
if (nullptr == m_charxy)
{
return;
}

m_charxy->setVisible(YAxisID,true);
}

void ChartFigureDlg::RestYAxisSensorID(void)
{
if (nullptr == m_charxy)
{
return;
}
m_charxy->ResetYAxisSensor();
}

bool ChartFigureDlg::IsYAxisSensorIDExist(const SENSOR_TYPE_KEY& YAxisID) const
{
if (nullptr == m_charxy)
{
return false;
}

return m_charxy->getVisible(YAxisID);
}

void ChartFigureDlg::NotifyControlsStartRefresh()
{
SetTimer(TIMER_CHART_EVENT,TIMER_CHART,NULL);
}

void ChartFigureDlg::NotifyControlsStopRefresh()
{
KillTimer(TIMER_CHART_EVENT);
}


20 changes: 11 additions & 9 deletions Src/Edislab/Edislab Pro/ChartFigureDlg.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#pragma once
#include "BaseDialog.h"
#include "ChartXY.h"
#include "Type.h"
// ChartFigureDlg 对话框
class ChartManager;
class ChartFigureDlg : public CBaseDialog
{
DECLARE_DYNAMIC(ChartFigureDlg)
Expand All @@ -21,17 +21,22 @@ class ChartFigureDlg : public CBaseDialog
public:
ChartXY* m_charxy;
CPoint m_ptContext;
void setChartMgr(ChartManager* mgr);
const ChartManager* getChartMgr();

//设置显示传感器的ID
void SetXAxisSensorID(const SENSOR_TYPE_KEY& XAxisID);
void SetYAxisSensorID(const SENSOR_TYPE_KEY& YAxisID);
void RestYAxisSensorID(void);
bool IsYAxisSensorIDExist(const SENSOR_TYPE_KEY& YAxisID) const;
SENSOR_TYPE_KEY GetXAxisSensorID(void);
//保存数据
int saveData()const;
//读取数据
int readData();

void updateData() const;

void ChartSet();
//通知相应的控件开始刷新
void NotifyControlsStartRefresh();
//通知相应的控件停止刷新
void NotifyControlsStopRefresh();
public:
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
Expand All @@ -51,11 +56,8 @@ class ChartFigureDlg : public CBaseDialog
afx_msg void OnChartShowAll();
virtual BOOL PreTranslateMessage(MSG* pMsg);
afx_msg void OnTimer(UINT_PTR nIDEvent);

//begin add by xiaowei.han

afx_msg LRESULT NotifyActive(WPARAM wp,LPARAM lp);

private:
BOOL m_bActiveFlag;
//end add by xiaowei.han
Expand Down
Loading

0 comments on commit c9de24b

Please sign in to comment.