// EdgeInspector_AppView.cpp : CEdgeInspector_AppView Ŭ·¡½ºÀÇ ±¸Çö // #include "stdafx.h" #include "EdgeInspector_App.h" #include "EdgeInspector_AppDoc.h" #include "EdgeInspector_AppView.h" #ifdef _DEBUG #define new DEBUG_NEW #endif // CEdgeInspector_AppView // CEdgeInspector_AppView »ý¼º/¼Ò¸ê IMPLEMENT_DYNCREATE(CEdgeInspector_AppView, CFormView) CEdgeInspector_AppView::CEdgeInspector_AppView() : CFormView(CEdgeInspector_AppView::IDD) { m_pViewMainStatus = NULL; m_pViewInformation = NULL; m_pViewDefect = NULL; m_pViewScanImage = NULL; m_pViewRecipeSetting = NULL; m_pViewLiveCam = NULL; m_pViewHWSetting = NULL; m_IV2M = NULL; m_eCurEntry = GLOBAL_DEFINE::EV_VIEW_End; m_eCurView = eView_End; m_pHardwareSetting = NULL; } CEdgeInspector_AppView::~CEdgeInspector_AppView() { if(NULL != m_pViewMainStatus) delete m_pViewMainStatus, m_pViewMainStatus = NULL; if(NULL != m_pViewInformation) delete m_pViewInformation, m_pViewInformation = NULL; if(NULL != m_pViewDefect) delete m_pViewDefect, m_pViewDefect = NULL; if(NULL != m_pViewScanImage) delete m_pViewScanImage, m_pViewScanImage = NULL; if(NULL != m_pViewRecipeSetting) delete m_pViewRecipeSetting, m_pViewRecipeSetting = NULL; if(NULL != m_pViewLiveCam) delete m_pViewLiveCam, m_pViewLiveCam = NULL; if(NULL != m_pViewHWSetting) delete m_pViewHWSetting, m_pViewHWSetting = NULL; } BOOL CEdgeInspector_AppView::PreCreateWindow(CREATESTRUCT& cs) { // TODO: CREATESTRUCT cs¸¦ ¼öÁ¤ÇÏ¿© ¿©±â¿¡¼­ // Window Ŭ·¡½º ¶Ç´Â ½ºÅ¸ÀÏÀ» ¼öÁ¤ÇÕ´Ï´Ù. return CFormView::PreCreateWindow(cs); } // CEdgeInspector_AppView Áø´Ü void CEdgeInspector_AppView::DoDataExchange(CDataExchange* pDX) { CFormView::DoDataExchange(pDX); UINT nViewID[] = {IDC_BTN_MAIN_INSINFOR, IDC_BTN_MAIN_DEFECTVIEW,IDC_BTN_MAIN_IMAGE_VIEW, IDC_BTN_MAIN_RECIPE_VIEW, IDC_BTN_MAIN_LIVE_CAM_VIEW, IDC_BTN_MAIN_HW_VIEW,IDC_BTN_MAIN_EXIT}; for(int i=0; iGetWindowRect(rtTemp); ScreenToClient(rtTemp); m_pViewMainStatus = new CViewMain_Status(); m_pViewMainStatus->Create(CViewMain_Status::IDD,this); m_pViewMainStatus->MoveWindow(rtTemp); m_pViewMainStatus->ShowWindow(SW_SHOW); GetDlgItem(IDC_STATIC_VIEW_AREA)->GetWindowRect(rtTemp); ScreenToClient(rtTemp); m_pViewInformation = new CViewMain_Information(); m_pViewInformation->Create(CViewMain_Information::IDD,this); m_pViewInformation->MoveWindow(rtTemp); //m_pViewInformation->ShowWindow(SW_SHOW); m_pViewInformation->ShowWindow(SW_HIDE); m_pViewDefect = new CViewMain_Defect(); m_pViewDefect->Create(CViewMain_Defect::IDD,this); m_pViewDefect->MoveWindow(rtTemp); m_pViewDefect->ShowWindow(SW_SHOW); //m_pViewDefect->ShowWindow(SW_HIDE); m_pViewScanImage = new CViewMain_ScanImage(); m_pViewScanImage->Create(CViewMain_ScanImage::IDD,this); m_pViewScanImage->MoveWindow(rtTemp); m_pViewScanImage->ShowWindow(SW_HIDE); m_pViewRecipeSetting = new CViewMain_Recipe(); m_pViewRecipeSetting->Create(CViewMain_Recipe::IDD,this); m_pViewRecipeSetting->MoveWindow(rtTemp); m_pViewRecipeSetting->ShowWindow(SW_HIDE); m_pViewLiveCam = new CViewMain_LiveCam(); m_pViewLiveCam->Create(CViewMain_LiveCam::IDD,this); m_pViewLiveCam->MoveWindow(rtTemp); m_pViewLiveCam->ShowWindow(SW_HIDE); m_pViewHWSetting = new CViewMain_HWSetting(); m_pViewHWSetting->Create(CViewMain_HWSetting::IDD,this); m_pViewHWSetting->MoveWindow(rtTemp); m_pViewHWSetting->ShowWindow(SW_HIDE); //SwitchView(GLOBAL_DEFINE::EV_VIEW_INFO); SwitchView(GLOBAL_DEFINE::EV_VIEW_DEFECT); } void CEdgeInspector_AppView::ClickMenuButton() { UINT nID = GetFocus()->GetDlgCtrlID(); GLOBAL_DEFINE::ENTRY_VIEW eEntry = GLOBAL_DEFINE::EV_VIEW_End; switch(nID){ case IDC_BTN_MAIN_INSINFOR: eEntry = GLOBAL_DEFINE::EV_VIEW_INFO; break; case IDC_BTN_MAIN_DEFECTVIEW: eEntry = GLOBAL_DEFINE::EV_VIEW_DEFECT; break; case IDC_BTN_MAIN_IMAGE_VIEW: eEntry = GLOBAL_DEFINE::EV_VIEW_IMAGE; break; case IDC_BTN_MAIN_RECIPE_VIEW: eEntry = GLOBAL_DEFINE::EV_VIEW_RECIPE; break; case IDC_BTN_MAIN_LIVE_CAM_VIEW: eEntry = GLOBAL_DEFINE::EV_VIEW_LIVE; break; case IDC_BTN_MAIN_HW_VIEW: eEntry = GLOBAL_DEFINE::EV_VIEW_HW; break; case IDC_BTN_MAIN_EXIT: eEntry = GLOBAL_DEFINE::EV_EXIT; break; } SwitchView(eEntry); } void CEdgeInspector_AppView::SwitchView(GLOBAL_DEFINE::ENTRY_VIEW eEntry) { if(GetCurEntry() == eEntry){ return; } if(GLOBAL_DEFINE::EV_EXIT != eEntry) SetButtonEnableAll(TRUE); UINT nViewID = 0; switch(eEntry){ case GLOBAL_DEFINE::EV_VIEW_INFO: nViewID = CViewMain_Information::IDD; SetButtonEnable(eView_InsInfo, FALSE); break; case GLOBAL_DEFINE::EV_VIEW_DEFECT: nViewID = CViewMain_Defect::IDD; SetButtonEnable(eView_DefectView, FALSE); break; case GLOBAL_DEFINE::EV_VIEW_IMAGE: nViewID = CViewMain_ScanImage::IDD; SetButtonEnable(eView_ImageView, FALSE); break; case GLOBAL_DEFINE::EV_VIEW_RECIPE: nViewID = CViewMain_Recipe::IDD; SetButtonEnable(eView_Recipe, FALSE); break; case GLOBAL_DEFINE::EV_VIEW_LIVE: nViewID = CViewMain_LiveCam::IDD; SetButtonEnable(eView_LiveCam, FALSE); break; case GLOBAL_DEFINE::EV_VIEW_HW: nViewID = CViewMain_HWSetting::IDD; SetButtonEnable(eView_HWSetting, FALSE); break; case GLOBAL_DEFINE::EV_EXIT: if(IDNO == AfxMessageBox(_T("Exit EdgeInspection Program?"), MB_YESNO | MB_ICONQUESTION)) return; if(m_IV2M != NULL) m_IV2M->CommandExitButtonClick(); GetParent()->PostMessageW(WM_USER_SYSTEM_CLOSE); return; default: return; } if(nViewID>0) { ChangeView(nViewID); SetCurEntry(eEntry); } } void CEdgeInspector_AppView::ChangeView(UINT nViewID) { UINT nShow; UINT eFrameView[] = {CViewMain_Information::IDD,CViewMain_Defect::IDD,CViewMain_ScanImage::IDD,CViewMain_Recipe::IDD,CViewMain_LiveCam::IDD,CViewMain_HWSetting::IDD}; for(int i=0; iShowWindow(nShow) : 0; break; case EV_VIEW_DEFECT: (m_pViewDefect != NULL) ? m_pViewDefect->ShowWindow(nShow) : 0; break; case EV_VIEW_IMAGE: (m_pViewScanImage != NULL) ? m_pViewScanImage->ShowWindow(nShow) : 0; break; case EV_VIEW_RECIPE: (m_pViewRecipeSetting != NULL) ? m_pViewRecipeSetting->ShowWindow(nShow) : 0; break; case EV_VIEW_LIVE: (m_pViewLiveCam != NULL) ? m_pViewLiveCam->ShowWindow(nShow) : 0; break; case EV_VIEW_HW: (m_pViewHWSetting != NULL) ? m_pViewHWSetting->ShowWindow(nShow) : 0; break; } } } void CEdgeInspector_AppView::SetButtonEnableAll(BOOL bEnable) { for(int i=0; i= eView_End) return; if(m_ctrlBtn[eSelView].GetEnabled() != bEnable){ m_ctrlBtn[eSelView].SetEnabled(bEnable); } if(!bEnable){ m_eCurView = eSelView; } } void CEdgeInspector_AppView::View_LicenseInfo() { if(m_pViewHWSetting == NULL) return; m_pViewHWSetting->View_LicenseInfo(); } void CEdgeInspector_AppView::SetV2M(IViewInterface2Parent* pV2M) { m_IV2M = pV2M; if(m_pViewDefect != NULL) m_pViewDefect->SetV2M(pV2M); if(m_pViewLiveCam != NULL) m_pViewLiveCam->SetV2M(pV2M); if(m_pViewRecipeSetting != NULL) m_pViewRecipeSetting->SetV2M(pV2M); if(m_pViewScanImage != NULL) m_pViewScanImage->SetV2M(pV2M); } void CEdgeInspector_AppView::SetGlassData(CGlass_Data *pGlass) { m_pGlassData = pGlass; if(m_pViewInformation != NULL) m_pViewInformation->UpdateView(); if(m_pViewRecipeSetting != NULL) m_pViewRecipeSetting->SetGlassData(pGlass); if(m_pViewDefect != NULL) m_pViewDefect->SetGlassData(pGlass); if(m_pViewLiveCam != NULL) m_pViewLiveCam->SetGlassData(pGlass); if(m_pViewScanImage != NULL) m_pViewScanImage->SetGlassData(pGlass); } void CEdgeInspector_AppView::SetTransferData(CTransfer_Data *pTrans) { //if(m_pViewInspectInfo != NULL) // m_pViewInspectInfo->SetTransferData(pTrans); } void CEdgeInspector_AppView::SetHardwareSetting(CHardwareSettings *pHW) { m_pHardwareSetting = pHW; if(m_pViewHWSetting != NULL) { m_pViewHWSetting->SetSettingParm(pHW); } if(m_pViewLiveCam != NULL) { m_pViewLiveCam->SetRecipe(m_pHardwareSetting); } if(m_pViewScanImage != NULL) { m_pViewScanImage->SetRecipe(pHW); } } void CEdgeInspector_AppView::SetRecipeSettings(CGlassRecipe *pRecipe) { m_pGlassRecipe = pRecipe; if(m_pViewRecipeSetting != NULL) m_pViewRecipeSetting->SetRecipe(m_pHardwareSetting,pRecipe); if(m_pViewDefect != NULL) m_pViewDefect->SetRecipe(m_pHardwareSetting); } void CEdgeInspector_AppView::ResetViewAll() { if(m_pViewInformation != NULL) m_pViewInformation->ResetView(); if(m_pViewDefect != NULL) m_pViewDefect->ResetView(); if(m_pViewScanImage != NULL) m_pViewScanImage->ResetView(); if(m_pViewRecipeSetting != NULL) m_pViewRecipeSetting->SetGlassData(NULL); } void CEdgeInspector_AppView::UpdateTransferData() { } void CEdgeInspector_AppView::ViewRefresh(PROG_MSG ProcMsg) { int iCam; switch(ProcMsg.nState) { case 1: if(m_pViewRecipeSetting != NULL) m_pViewRecipeSetting->ViewRefresh(ProcMsg); if(m_pViewScanImage != NULL) m_pViewScanImage->ViewRefresh(ProcMsg); break; case VIEW_REFRESH_INIT_VIEW: ResetViewAll(); break; case VIEW_REFRESH_ONESCAN_END: if(m_pHardwareSetting == NULL) return; if(m_pViewRecipeSetting == NULL) return; if(m_pViewScanImage == NULL) return; for(iCam=0;iCamm_pCameraSettings[iCam*2]; //GetCameraSettings(iCam,0); if(pCamera == NULL) continue; ProcMsg.nState = 2; ProcMsg.nSide = (int)iCam*2; //pCamera->m_eDimension; m_pViewRecipeSetting->ViewRefresh(ProcMsg); m_pViewScanImage->ViewRefresh(ProcMsg); } break; case VIEW_REFRESH_INSPECT_END: if(m_pHardwareSetting == NULL) return; if(m_pViewRecipeSetting == NULL) return; if(m_pViewScanImage == NULL) return; for(iCam=0;iCamm_pCameraSettings[iCam*2]; //m_pHardwareSetting->GetCameraSettings(iCam,0); if(pCamera == NULL) continue; ProcMsg.nState = 2; ProcMsg.nSide = (int)iCam*2; // (int)pCamera->m_eDimension; m_pViewRecipeSetting->ViewRefresh(ProcMsg); m_pViewScanImage->ViewRefresh(ProcMsg); pCamera = &m_pHardwareSetting->m_pCameraSettings[iCam*2 + 1]; // m_pHardwareSetting->GetCameraSettings(iCam,1); if(pCamera == NULL) continue; ProcMsg.nState = 2; ProcMsg.nSide = (int)iCam*2+1; // (int)pCamera->m_eDimension; m_pViewRecipeSetting->ViewRefresh(ProcMsg); m_pViewScanImage->ViewRefresh(ProcMsg); } break; } } void CEdgeInspector_AppView::RefreshDefect(CString strDefect) { if(m_pGlassData == NULL) return; MapDefect *pMapDefect = m_pGlassData->GetMapDefect_NG(); if(m_pViewDefect != NULL) { m_pViewDefect->SetDefectList(pMapDefect); m_pViewDefect->SetDefectPath(strDefect); } } void CEdgeInspector_AppView::InitView(Init_View_Command eVew) { switch(eVew) { case VIEW_RECIPE: ResetViewAll(); break; case VIEW_SCANIMAGE: // if(m_pViewInspectInfo != NULL) // { // m_pViewInspectInfo->ResetView(); // } if(m_pViewRecipeSetting != NULL) { m_pViewRecipeSetting->InitView(); } break; } }