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.

256 lines
7.7 KiB
C++

#include "stdafx.h"
#include "MyDlgView.h"
#include "GlobalFunction.h"
#include "GlobalDrawMgr.h"
IMPLEMENT_DYNAMIC(CMyDlgView, CDialogEx)
BEGIN_MESSAGE_MAP(CMyDlgView, CDialogEx)
ON_WM_CTLCOLOR()
END_MESSAGE_MAP()
CMyDlgView *gChildPCS = NULL;
CMyDlgView *gChildWorkPrepare = NULL;
CMyDlgView *gChildWorkWaferCnt = NULL;
CMyDlgView *gChildRecipe = NULL;
CMyDlgView *gChildLaserPathState = NULL;
CMyDlgView *gChildLaserDeviceState = NULL;
CMyDlgView *gChildRobot = NULL;
CMyDlgView *gChildIOState = NULL;
CMyDlgView *gChildLaserPowCheck = NULL;
CMyDlgView *gChildDeviceMaintenance = NULL;
CMyDlgView *gChildSysParaSet = NULL;
CMyDlgView *gChildEventLog = NULL;
CMyDlgView *gChildWaferHistory = NULL;
CMyDlgView *gChildCheckHistory = NULL;
CMyDlgView *gDlgChildRealTimeDataHistory = NULL;
CMyDlgView *gDlgChildBeamDataHistory = NULL;
CMyDlgView *gDlgChildConfigHistory = NULL;
CMyDlgView *gDlgChildJobHistory = NULL;
CMyDlgView *gChildParaHistory = NULL;
CMyDlgView *gDlgChildLoginHistory = NULL;
CMyDlgView *gChildDataAnalysis = NULL;
CMyDlgView *gChildAlarmLog = NULL;
CMyDlgView *gChildPCS_WaferInfo = NULL;
CMyDlgView *gChildPCS_WaferTransfer = NULL;
CMyDlgView *gChildPCS_AnnealCh = NULL;
CMyDlgView::CMyDlgView(UINT nIDTemplate, CWnd* pParent /*=NULL*/)
: CDialogEx(nIDTemplate, pParent)
{
m_IDD = nIDTemplate;
m_pCurActiveView = NULL;//<2F><>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>view
m_bFirstOpen = true;//<2F>Ƿ<EFBFBD><C7B7><EFBFBD>һ<EFBFBD>δ<EFBFBD><CEB4><EFBFBD>
}
CMyDlgView::~CMyDlgView()
{
}
BOOL CMyDlgView::OnInitDialog()
{
CDialogEx::OnInitDialog();
SetTextCtrlItemID();
return TRUE;
}
void CMyDlgView::SetItemText(int ID,CString Str,bool bFillEdit)
{
//<2F>仯ʱ<E4BBAF><CAB1>ˢ<EFBFBD><CBA2>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˸
if(IsDlgItemStrChange(ID,Str,m_DlgItemStrVec))
{
if(bFillEdit)
Str += " ";//<2F>ѿؼ<D1BF><D8BC><EFBFBD><EFBFBD><EFBFBD>
GetDlgItem(ID)->SetWindowText(Str);
}
}
HBRUSH CMyDlgView::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
if(m_CtrlColorIDSet.count(pWnd->GetDlgCtrlID()))
{
CFont font;
font.CreatePointFont(gDraw->GetEditFontSize(),"Arial");
pDC->SelectObject(&font);
pDC->SetTextColor(gDraw->GetEditTextColor());//<2F><><EFBFBD>ñ༭<C3B1><E0BCAD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɫ
//pDC-> SetBkMode(TRANSPARENT);//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E5B1B3>Ϊ͸<CEAA><CDB8>
pDC->SetBkColor(gDraw->GetEditBkColor());//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E5B1B3><EFBFBD><EFBFBD>ɫ
return (HBRUSH)::GetStockObject(RGB_BLACK);//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>RGB_BLACK
}
return hbr;
}
//<2F>ػ<EFBFBD>һ<EFBFBD><D2BB><EFBFBD>ּ<EFBFBD><D6BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
BOOL CMyDlgView::PreTranslateMessage(MSG* pMsg)
{
if(pMsg->message==WM_KEYDOWN)
{
char c = pMsg->wParam;
if(c==VK_RETURN || c==VK_ESCAPE)
{
return TRUE;
}
}
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҽ<EFBFBD>
if( pMsg->message == WM_RBUTTONUP )
return TRUE;
return CDialogEx::PreTranslateMessage(pMsg);
}
CMyDlgView *CMyDlgView::GetChildView(EChildViewType ChildViewType)
{
CMyDlgView *pChildView = NULL;
switch(ChildViewType)
{
case _ChildView_PCS:
pChildView = gChildPCS;
break;
case _ChildView_WorkPrepare:
pChildView = gChildWorkPrepare;
break;
case _ChildView_WorkWaferCnt:
pChildView = gChildWorkWaferCnt;
break;
case _ChildView_Recipe:
pChildView = gChildRecipe;
break;
case _ChildView_LaserPathState:
pChildView = gChildLaserPathState;
break;
case _ChildView_LaserDeviceState:
pChildView = gChildLaserDeviceState;
break;
case _ChildView_Robot:
pChildView = gChildRobot;
break;
case _ChildView_IOState:
pChildView = gChildIOState;
break;
case _ChildView_DeviceMaintenance:
pChildView = gChildDeviceMaintenance;
break;
case _ChildView_LaserPowCheck:
pChildView = gChildLaserPowCheck;
break;
case _ChildView_SysParaSet:
pChildView = gChildSysParaSet;
break;
case _ChildView_EventLog:
pChildView = gChildEventLog;
break;
case _ChildView_WaferHistory:
pChildView = gChildWaferHistory;
break;
case _ChildView_CheckHistory:
pChildView = gChildCheckHistory;
break;
case _ChildView_RealTimeDataHistory:
pChildView = gDlgChildRealTimeDataHistory;
break;
case _ChildView_BeamDataHistory:
pChildView = gDlgChildBeamDataHistory;
break;
case _ChildView_ConfigHistory:
pChildView = gDlgChildConfigHistory;
break;
case _ChildView_JobHistory:
pChildView = gDlgChildJobHistory;
break;
case _ChildView_ParHistory:
pChildView = gChildParaHistory;
break;
case _ChildView_LoginHistory:
pChildView = gDlgChildLoginHistory;
break;
case _ChildView_DataAnalysis:
pChildView = gChildDataAnalysis;
break;
case _ChildView_PCS_WaferInfo:
pChildView = gChildPCS_WaferInfo;
break;
case _ChildView_PCS_WaferTransfer:
pChildView = gChildPCS_WaferTransfer;
break;
case _ChildView_PCS_AnnealCh:
pChildView = gChildPCS_AnnealCh;
break;
case _ChildView_AlarmLog:
pChildView = gChildAlarmLog;
break;
default:
break;
}
return pChildView;
}
//<2F><><EFBFBD>õ<EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>view
void CMyDlgView::SetActiveView(EChildViewType ChildViewType)
{
//<2F><>ʾ<EFBFBD><CABE>ǰ<EFBFBD><C7B0>view
CMyDlgView *pActiveView = GetChildView(ChildViewType);
if(pActiveView == m_pCurActiveView)
{
if(pActiveView != NULL)
{
//û<>б<D0B1><E4BBAF>ʱ<EFBFBD><CAB1>ҲҪˢ<D2AA><CBA2>
pActiveView->OnViewOpen();
}
return;
}
//<2F><><EFBFBD><EFBFBD>֮ǰ<D6AE><C7B0>
if(m_pCurActiveView != NULL)
{
m_pCurActiveView->ShowWindow(SW_HIDE);
}
if(pActiveView != NULL)
{
pActiveView->SetParent(this);
pActiveView->ShowWindow(SW_SHOW);
pActiveView->OnViewOpen();
// <20><><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>
pActiveView->MoveWindow(m_rChildRect.left, m_rChildRect.top,m_rChildRect.right - m_rChildRect.left, m_rChildRect.bottom - m_rChildRect.top, TRUE);
}
m_pCurActiveView = pActiveView;
m_CurChildViewType = ChildViewType;
}
//չ<><D5B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>нڵ<D0BD>
void CMyDlgView::ExpandTree(CTreeCtrl* pTreeCtrl,HTREEITEM hItem)
{
HTREEITEM hChild,hNext,hParent;
if((!hItem)||(!pTreeCtrl))
return;
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>չ<EFBFBD><D5B9><EFBFBD>ڵ<EFBFBD>
pTreeCtrl->Expand(hItem,TVE_EXPAND);
hChild = pTreeCtrl->GetNextItem(hItem,TVGN_CHILD);
if(hChild)
{//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӽڵ㣬չ<E3A3AC><D5B9><EFBFBD>ӽڵ<D3BD>
ExpandTree(pTreeCtrl,hChild);
}
else
{//û<><C3BB><EFBFBD>ӽڵ㣬Ѱ<E3A3AC><D1B0><EFBFBD><EFBFBD><EFBFBD>ֵܽڵ<DCBD>
hNext = pTreeCtrl->GetNextItem(hItem,TVGN_NEXT);
if(hNext)
{//<2F><><EFBFBD><EFBFBD><EFBFBD>ֵܽڵ<DCBD>
ExpandTree(pTreeCtrl,hNext);
}
else
{//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵܽڵ㣬<DAB5><E3A3AC><EFBFBD><EFBFBD><EFBFBD>Ҹ<EFBFBD><D2B8>ڵ<EFBFBD>
hParent = pTreeCtrl->GetParentItem(hItem);
hNext = pTreeCtrl->GetNextItem(hParent,TVGN_NEXT);
if(hNext)
ExpandTree(pTreeCtrl,hNext);
}
}
}