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.

101 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()//<2F><>Ӧ<EFBFBD><D3A6>Ϣ
END_MESSAGE_MAP()
#define ID_DRAW_TIMER 1//<2F><><EFBFBD><EFBFBD>timer ID
#define DRAW_TIME_DELAY 100 //<2F><><EFBFBD><EFBFBD>timer <20><><EFBFBD><EFBFBD>ʱ
#define DRAW_TIME_DELAY2 4000 //<2F><><EFBFBD><EFBFBD>timer <20><><EFBFBD><EFBFBD>ʱ
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();
//<2F><><EFBFBD><EFBFBD><EFBFBD>϶<EFBFBD><CFB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>,<2C>ػ<EFBFBD>
SetTimer(ID_DRAW_TIMER,DRAW_TIME_DELAY2,NULL);
}
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);
}
//<2F><><EFBFBD>ڷ<EFBFBD>ģ̬<C4A3>Ի<EFBFBD><D4BB><EFBFBD><EFBFBD>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>
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()
{
gLogMgr->WriteDebugLog("CDlgLayerViewShowReDraw");
CDC *pDC = GetCDC();
gModuleDeviceMgr.Draw(pDC);
gModuleDrawMgr.Draw(pDC);
gLayer.Draw(pDC);
}