You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

105 lines
2.2 KiB
C++

#include "stdafx.h"
#include "LaiPuLaser.h"
#include "DlgLayerViewShow.h"
#include "afxdialogex.h"
#include "GlobalDrawMgr.h"
#include "Layer.h"
#include "ModuleDeviceMgr.h"
#include "ModuleDrawMgr.h"
#include "LogMgr.h"
IMPLEMENT_DYNAMIC(CDlgLayerViewShow, CDialogEx)
BEGIN_MESSAGE_MAP(CDlgLayerViewShow, CDialogEx)
ON_WM_TIMER()
ON_WM_COPYDATA()//响应消息
END_MESSAGE_MAP()
#define ID_DRAW_TIMER 1//绘制timer ID
#define DRAW_TIME_DELAY 100 //绘制timer 的延时
CDlgLayerViewShow::CDlgLayerViewShow(CWnd* pParent /*=NULL*/)
: CDialogEx(CDlgLayerViewShow::IDD, pParent)
{
}
CDlgLayerViewShow::~CDlgLayerViewShow()
{
gDraw->ResetView();
}
void CDlgLayerViewShow::DoDataExchange(CDataExchange* pDX)
{
CDialogEx::DoDataExchange(pDX);
}
BOOL CDlgLayerViewShow::OnInitDialog()
{
CDialogEx::OnInitDialog();
gDraw->SetViewToDlg();
UpdateData(FALSE);
SetTimer(ID_DRAW_TIMER,DRAW_TIME_DELAY,NULL);
return TRUE;
}
void CDlgLayerViewShow::OnTimer(UINT nIDEvent)
{
if(nIDEvent == ID_DRAW_TIMER)
{
KillTimer(ID_DRAW_TIMER);
ReDraw();
}
CDialog::OnTimer(nIDEvent);
}
BOOL CDlgLayerViewShow::OnCopyData(CWnd* pWnd, COPYDATASTRUCT* pCopyDataStruct)
{
CString strRecievedText = (LPCSTR)(pCopyDataStruct->lpData);
if("Invalidate"==strRecievedText)
{
SetTimer(ID_DRAW_TIMER,DRAW_TIME_DELAY,NULL);
}
return CDialogEx::OnCopyData(pWnd, pCopyDataStruct);
}
//用于非模态对话框自动销毁
void CDlgLayerViewShow::PostNcDestroy()
{
gDraw->ResetView();
CDialogEx::PostNcDestroy();
delete this;
}
void CDlgLayerViewShow::OnCancel()
{
//CDialogEx::OnCancel();
DestroyWindow();
}
HDC CDlgLayerViewShow::GetHDC()
{
return ::GetDC(GetSafeHwnd());
}
CDC* CDlgLayerViewShow::GetCDC()
{
return CDC::FromHandle(GetHDC());
}
void CDlgLayerViewShow::ReDraw()
{
CLogInfo LogInfo;
LogInfo.m_ClassName = "CDlgLayerViewShow";
LogInfo.m_FuncName = "ReDraw";
LogInfo.m_LogMsg = "Start";
gLogMgr->WriteLogInfo(LogInfo);
CDC *pDC = GetCDC();
gModuleDeviceMgr.Draw(pDC);
gModuleDrawMgr.Draw(pDC);
gLayer.Draw(pDC);
LogInfo.m_LogMsg = "End";
gLogMgr->WriteLogInfo(LogInfo);
}