// DlgSideNotchSetting.cpp : 备泅 颇老涝聪促. // #include "stdafx.h" #include "EdgeInspector_App.h" #include "DlgSideNotchSetting.h" #include "afxdialogex.h" #include "Global_Define.h" // CDlgSideNotchSetting 措拳 惑磊涝聪促. IMPLEMENT_DYNAMIC(CDlgSideNotchSetting, CDialogEx) CDlgSideNotchSetting::CDlgSideNotchSetting(CWnd* pParent /*=NULL*/) : CDialogEx(CDlgSideNotchSetting::IDD, pParent) { m_pDlgRecipe = NULL; m_pGlassData = NULL; m_pRecipeImageViewer = NULL; m_pSelectSideIdx = NULL; m_pSelectLangType = NULL; m_nSelectNotchIdx = -1; m_nSelectNotchCircleIdx = -1; } CDlgSideNotchSetting::~CDlgSideNotchSetting() { } void CDlgSideNotchSetting::DoDataExchange(CDataExchange* pDX) { DDX_Control(pDX, IDC_NOTCH_LIST, m_NotchList); DDX_Control(pDX, IDC_NOTCH_INSPECT_PARAM, m_NotchList_Inspect_Param); DDX_Control(pDX, IDC_NOTCH_MEASURE_SETTING, m_NotchList_Measure_Param); DDX_Control(pDX, IDC_NOTCH_CIRCLE_SETTING, m_NotchList_Circle_Param); CDialogEx::DoDataExchange(pDX); } BEGIN_MESSAGE_MAP(CDlgSideNotchSetting, CDialogEx) ON_NOTIFY(NM_CLICK, IDC_NOTCH_LIST, &CDlgSideNotchSetting::OnGridClickSelectNotch) ON_NOTIFY(NM_CLICK, IDC_NOTCH_CIRCLE_SETTING, &CDlgSideNotchSetting::OnGridClickSelectNotchCircle) END_MESSAGE_MAP() BOOL CDlgSideNotchSetting::PreTranslateMessage(MSG* pMsg) { if( pMsg->message == WM_KEYDOWN ) { if(pMsg->wParam == VK_RETURN || pMsg->wParam == VK_ESCAPE ) { ::TranslateMessage(pMsg); ::DispatchMessage(pMsg); return TRUE; // DO NOT process further } } return CDialog::PreTranslateMessage(pMsg); } void CDlgSideNotchSetting::SetDlgRecipe(CGlassRecipe* pDlgRecipe) { m_pDlgRecipe = pDlgRecipe; UpdateRecipe(FALSE); } void CDlgSideNotchSetting::UpdateRecipe(BOOL bGetData) { // Title if(m_pSelectSideIdx != NULL) { CString strTemp; strTemp.Format(_T("[%s] Notch Setting - Notch No.[%d]"), g_SideName[(int) *(m_pSelectSideIdx)], m_nSelectNotchIdx+1); SetDlgItemText(IDC_STATIC_TITLE, strTemp); strTemp.Format(_T("[%s] Notch - Circle No.[%d]"), g_SideName[(int) *(m_pSelectSideIdx)], m_nSelectNotchCircleIdx+1); SetDlgItemText(IDC_STATIC_TITLE_CIRCLE, strTemp); } if(bGetData == FALSE) { Fill_SideNotch_List(bGetData); Fill_SideNotch_Inspect_Param(bGetData); Fill_SideNotch_Measure_Param(bGetData); Fill_SideNotch_Circle_Param(bGetData); } else { Fill_SideNotch_List(bGetData); Fill_SideNotch_Inspect_Param(bGetData); Fill_SideNotch_Measure_Param(bGetData); Fill_SideNotch_Circle_Param(bGetData); } } void CDlgSideNotchSetting::Init_SideNotch_List() { if (m_NotchList.GetSafeHwnd() == NULL) return; int nRows = 1; int nCols = 1 + 1; int nFixRows = 1; int nFixCols = 0; int nRowIdx = 0; int nColIdx = 0; m_NotchList.DeleteAllItems(); m_NotchList.SetVirtualMode(FALSE); m_NotchList.GetDefaultCell(TRUE, FALSE)->SetBackClr(g_nGridFixCellColor); m_NotchList.GetDefaultCell(FALSE, TRUE)->SetBackClr(g_nGridFixCellColor); m_NotchList.GetDefaultCell(FALSE, FALSE)->SetBackClr(g_nGridCellColor); m_NotchList.SetFixedTextColor(g_nGridFixFontColor); m_NotchList.SetRowCount(nRows); m_NotchList.SetColumnCount(nCols); m_NotchList.SetFixedRowCount(nFixRows); m_NotchList.SetFixedColumnCount(nFixCols); CFont *pFont = m_NotchList.GetFont(); if (pFont) { LOGFONT lf; pFont->GetLogFont(&lf); lf.lfItalic = 0; lf.lfHeight = 14; lf.lfWeight = FW_BOLD; _tcscpy_s(lf.lfFaceName, _T("Arial")); m_NotchList.GetDefaultCell(FALSE, TRUE)->SetFont(&lf); m_NotchList.GetDefaultCell(TRUE, FALSE)->SetFont(&lf); m_NotchList.GetDefaultCell(FALSE, FALSE)->SetFont(&lf); m_NotchList.GetDefaultCell(TRUE, TRUE)->SetFont(&lf); } // Col m_NotchList.SetColumnWidth(nColIdx, 100); m_NotchList.SetItemText(nRowIdx, nColIdx++, _T("No.")); m_NotchList.SetColumnWidth(nColIdx, 120); m_NotchList.SetItemText(nRowIdx, nColIdx++, _T("Use (0:OFF/1:ON)")); m_NotchList.SetFixedRowSelection(FALSE); m_NotchList.SetFixedColumnSelection(FALSE); m_NotchList.EnableSelection(TRUE); m_NotchList.SetEditable(TRUE); m_NotchList.SetRowResize(FALSE); m_NotchList.SetColumnResize(FALSE); m_NotchList.ExpandColumnsToFit(TRUE); } void CDlgSideNotchSetting::Fill_SideNotch_List(BOOL bGetData) { if(m_NotchList.GetSafeHwnd() == NULL) return; if(m_pDlgRecipe == NULL || m_pSelectSideIdx == NULL) return; int nSideIdx = *(m_pSelectSideIdx); if(nSideIdx < 0 || eRcp_SideRD_End <= nSideIdx) return; CSIDE_PARM* pParam = &m_pDlgRecipe->m_SideParam[nSideIdx]; CString strTemp; int nRow = 0; int nCol = 0; if(bGetData == FALSE) { int nNotchCount = pParam->m_nNotchCount; m_NotchList.SetRowCount(nNotchCount + 1); for(int i=0; iSetState(GVIS_READONLY); if(m_nSelectNotchIdx != i) m_NotchList.GetCell(nRow, nCol)->SetBackClr(g_nGridCellColor_NonSelect); else m_NotchList.GetCell(nRow, nCol)->SetBackClr(g_nGridCellColor); m_NotchList.SetItemText(nRow, nCol++, strTemp); // 2. On/Off strTemp.Format(_T("%d"), pParam->m_NotchPrm[i].m_bNotch_Use); if(pParam->m_NotchPrm[i].m_bNotch_Use == TRUE) m_NotchList.GetCell(nRow, nCol)->SetBackClr(RGB(50,255,50)); else m_NotchList.GetCell(nRow, nCol)->SetBackClr(RGB(255,50,50)); m_NotchList.SetItemText(nRow, nCol++, strTemp); } m_NotchList.Invalidate(); } else { int nNotchCount = m_NotchList.GetRowCount() - 1; pParam->m_nNotchCount = nNotchCount; for(int i=0; im_NotchPrm[i].m_bNotch_Use = (_wtoi(strTemp) == 0) ? FALSE : TRUE; } } } void CDlgSideNotchSetting::Init_SideNotch_Inspect_Param() { if (m_NotchList_Inspect_Param.GetSafeHwnd() == NULL) return; int nRows = 14 + 1; int nCols = 2 + 1; int nFixRows = 1; int nFixCols = 1; int nRowIdx = 0; int nColIdx = 0; m_NotchList_Inspect_Param.DeleteAllItems(); m_NotchList_Inspect_Param.SetVirtualMode(FALSE); m_NotchList_Inspect_Param.GetDefaultCell(TRUE, FALSE)->SetBackClr(g_nGridFixCellColor); m_NotchList_Inspect_Param.GetDefaultCell(FALSE, TRUE)->SetBackClr(g_nGridFixCellColor); m_NotchList_Inspect_Param.GetDefaultCell(FALSE, FALSE)->SetBackClr(g_nGridCellColor); m_NotchList_Inspect_Param.SetFixedTextColor(g_nGridFixFontColor); m_NotchList_Inspect_Param.SetRowCount(nRows); m_NotchList_Inspect_Param.SetColumnCount(nCols); m_NotchList_Inspect_Param.SetFixedRowCount(nFixRows); m_NotchList_Inspect_Param.SetFixedColumnCount(nFixCols); CFont *pFont = m_NotchList_Inspect_Param.GetFont(); if (pFont) { LOGFONT lf; pFont->GetLogFont(&lf); lf.lfItalic = 0; lf.lfHeight = 14; lf.lfWeight = FW_BOLD; _tcscpy_s(lf.lfFaceName, _T("Arial")); m_NotchList_Inspect_Param.GetDefaultCell(FALSE, TRUE)->SetFont(&lf); m_NotchList_Inspect_Param.GetDefaultCell(TRUE, FALSE)->SetFont(&lf); m_NotchList_Inspect_Param.GetDefaultCell(FALSE, FALSE)->SetFont(&lf); m_NotchList_Inspect_Param.GetDefaultCell(TRUE, TRUE)->SetFont(&lf); } // Col m_NotchList_Inspect_Param.SetColumnWidth(nColIdx, 50); m_NotchList_Inspect_Param.SetItemText(nRowIdx, nColIdx++, _T("No.")); m_NotchList_Inspect_Param.SetColumnWidth(nColIdx, 170); m_NotchList_Inspect_Param.SetItemText(nRowIdx, nColIdx++, _T("Parameter")); m_NotchList_Inspect_Param.SetColumnWidth(nColIdx, 170); m_NotchList_Inspect_Param.SetItemText(nRowIdx, nColIdx++, _T("Set Value")); // Row CString strTemp; std::vector vecParams; strTemp.Format(_T("Grind Threshold")); vecParams.push_back(strTemp); strTemp.Format(_T("Glass Threshold")); vecParams.push_back(strTemp); strTemp.Format(_T("Smooth Filter")); vecParams.push_back(strTemp); strTemp.Format(_T("Referecne Line Threshold")); vecParams.push_back(strTemp); strTemp.Format(_T("Notch Center Offset")); vecParams.push_back(strTemp); strTemp.Format(_T("Use Notch Defect")); vecParams.push_back(strTemp); strTemp.Format(_T("Inspect Threshold (″)")); vecParams.push_back(strTemp); strTemp.Format(_T("Inspect Offset")); vecParams.push_back(strTemp); strTemp.Format(_T("Inspect dilate")); vecParams.push_back(strTemp); strTemp.Format(_T("Min Size X(um)")); vecParams.push_back(strTemp); strTemp.Format(_T("Min Size Y(um)")); vecParams.push_back(strTemp); strTemp.Format(_T("Judge Size X(um)")); vecParams.push_back(strTemp); strTemp.Format(_T("Judge Size Y(um)")); vecParams.push_back(strTemp); strTemp.Format(_T("Judge Filter (0:NG/1:OR/2:AND)")); vecParams.push_back(strTemp); CLanguageControl* pLanguageControl = g_pStatus->m_pLanguageControl; if(pLanguageControl != NULL) { for(int i=0; iGetString(*(m_pSelectLangType), vecParams[i]); if(strParam.IsEmpty() || strParam.GetLength() == 0) continue; vecParams[i] = strParam; } nColIdx = 0; nRowIdx = 1; for(int i=0; iSetState(GVIS_READONLY); m_NotchList_Inspect_Param.SetItemText(nRowIdx, nColIdx++, strTemp); // 2. Parameter Name m_NotchList_Inspect_Param.GetCell(nRowIdx, nColIdx)->SetState(GVIS_READONLY); m_NotchList_Inspect_Param.SetItemText(nRowIdx++, nColIdx, vecParams[i]); } } m_NotchList_Inspect_Param.SetFixedRowSelection(FALSE); m_NotchList_Inspect_Param.SetFixedColumnSelection(FALSE); m_NotchList_Inspect_Param.EnableSelection(TRUE); m_NotchList_Inspect_Param.SetEditable(TRUE); m_NotchList_Inspect_Param.SetRowResize(FALSE); m_NotchList_Inspect_Param.SetColumnResize(FALSE); m_NotchList_Inspect_Param.ExpandColumnsToFit(TRUE); } void CDlgSideNotchSetting::Fill_SideNotch_Inspect_Param(BOOL bGetData) { if(m_NotchList_Inspect_Param.GetSafeHwnd() == NULL) return; if(m_nSelectNotchIdx < 0 || MAX_SIDE_NOTCH_COUNT <= m_nSelectNotchIdx) return; if(m_pDlgRecipe == NULL || m_pSelectSideIdx == NULL) return; int nSideIdx = *(m_pSelectSideIdx); if(nSideIdx < 0 || eRcp_SideRD_End <= nSideIdx) return; CSIDE_PARM* pParam = &m_pDlgRecipe->m_SideParam[nSideIdx]; CNOTCH_PARM* pNotchParam = &pParam->m_NotchPrm[m_nSelectNotchIdx]; CString strTemp; int nRow = 0; int nCol = 0; if(bGetData == FALSE) { int nSetNotchCount = pParam->m_nNotchCount; if(nSetNotchCount == 0 || m_nSelectNotchIdx < 0 || MAX_SIDE_NOTCH_COUNT <= m_nSelectNotchIdx) { m_NotchList_Inspect_Param.SetRowCount(1); m_NotchList_Inspect_Param.Invalidate(); return; } else { Init_SideNotch_Inspect_Param(); } nRow = 1; nCol = 2; // 1. Grinder Threshold strTemp.Format(_T("%d"), pNotchParam->m_nGrind_Threshold); m_NotchList_Inspect_Param.SetItemText(nRow++, nCol, strTemp); // 2. Glass Threshold strTemp.Format(_T("%d"), pNotchParam->m_nGlass_Threshold); m_NotchList_Inspect_Param.SetItemText(nRow++, nCol, strTemp); // 3. Smooth Filter strTemp.Format(_T("%d"), pNotchParam->m_nSmooth_Filter); m_NotchList_Inspect_Param.SetItemText(nRow++, nCol, strTemp); // 4. Reference Line Threshold strTemp.Format(_T("%d"), pNotchParam->m_nReferece_Line_Threshold); m_NotchList_Inspect_Param.SetItemText(nRow++, nCol, strTemp); // 4. Notch Center Offset strTemp.Format(_T("%d"), pNotchParam->m_nNotchCenter_Offset_pxl); m_NotchList_Inspect_Param.SetItemText(nRow++, nCol, strTemp); // 5. Inspect Defect Use strTemp.Format(_T("%d"), pNotchParam->m_bNotch_Inspect_Defect_Use); if(pNotchParam->m_bNotch_Inspect_Defect_Use == TRUE) m_NotchList_Inspect_Param.GetCell(nRow, nCol)->SetBackClr(RGB(50,255,50)); else m_NotchList_Inspect_Param.GetCell(nRow, nCol)->SetBackClr(RGB(255,50,50)); m_NotchList_Inspect_Param.SetItemText(nRow++, nCol, strTemp); // 6. Inspect Threshold strTemp.Format(_T("%d"), pNotchParam->m_nNotch_Inspect_Defect_Threshold); if(pNotchParam->m_bNotch_Inspect_Defect_Use == FALSE) m_NotchList_Inspect_Param.GetCell(nRow, nCol)->SetBackClr(g_nGridCellColor_NonSelect); else m_NotchList_Inspect_Param.GetCell(nRow, nCol)->SetBackClr(g_nGridCellColor); m_NotchList_Inspect_Param.SetItemText(nRow++, nCol, strTemp); // 7. Inspect Offset strTemp.Format(_T("%d"), pNotchParam->m_nNotch_Inspect_Defect_Offset); if(pNotchParam->m_bNotch_Inspect_Defect_Use == FALSE) m_NotchList_Inspect_Param.GetCell(nRow, nCol)->SetBackClr(g_nGridCellColor_NonSelect); else m_NotchList_Inspect_Param.GetCell(nRow, nCol)->SetBackClr(g_nGridCellColor); m_NotchList_Inspect_Param.SetItemText(nRow++, nCol, strTemp); // 8. Inspect dilate strTemp.Format(_T("%d"), pNotchParam->m_nNotch_Inspect_Defect_dilate); if (pNotchParam->m_bNotch_Inspect_Defect_Use == FALSE) m_NotchList_Inspect_Param.GetCell(nRow, nCol)->SetBackClr(g_nGridCellColor_NonSelect); else m_NotchList_Inspect_Param.GetCell(nRow, nCol)->SetBackClr(g_nGridCellColor); m_NotchList_Inspect_Param.SetItemText(nRow++, nCol, strTemp); // 8. Defect Min X strTemp.Format(_T("%d"), pNotchParam->m_nNotch_Inspect_Defect_Min_X_um); if (pNotchParam->m_bNotch_Inspect_Defect_Use == FALSE) m_NotchList_Inspect_Param.GetCell(nRow, nCol)->SetBackClr(g_nGridCellColor_NonSelect); else m_NotchList_Inspect_Param.GetCell(nRow, nCol)->SetBackClr(g_nGridCellColor); m_NotchList_Inspect_Param.SetItemText(nRow++, nCol, strTemp); // 9. Defect Min Y strTemp.Format(_T("%d"), pNotchParam->m_nNotch_Inspect_Defect_Min_Y_um); if (pNotchParam->m_bNotch_Inspect_Defect_Use == FALSE) m_NotchList_Inspect_Param.GetCell(nRow, nCol)->SetBackClr(g_nGridCellColor_NonSelect); else m_NotchList_Inspect_Param.GetCell(nRow, nCol)->SetBackClr(g_nGridCellColor); m_NotchList_Inspect_Param.SetItemText(nRow++, nCol, strTemp); // 10. Defect Judge X strTemp.Format(_T("%d"), pNotchParam->m_nNotch_Inspect_Defect_Judge_X_um); if(pNotchParam->m_bNotch_Inspect_Defect_Use == FALSE) m_NotchList_Inspect_Param.GetCell(nRow, nCol)->SetBackClr(g_nGridCellColor_NonSelect); else m_NotchList_Inspect_Param.GetCell(nRow, nCol)->SetBackClr(g_nGridCellColor); m_NotchList_Inspect_Param.SetItemText(nRow++, nCol, strTemp); // 11. Defect Judge Y strTemp.Format(_T("%d"), pNotchParam->m_nNotch_Inspect_Defect_Judge_Y_um); if(pNotchParam->m_bNotch_Inspect_Defect_Use == FALSE) m_NotchList_Inspect_Param.GetCell(nRow, nCol)->SetBackClr(g_nGridCellColor_NonSelect); else m_NotchList_Inspect_Param.GetCell(nRow, nCol)->SetBackClr(g_nGridCellColor); m_NotchList_Inspect_Param.SetItemText(nRow++, nCol, strTemp); // 12. Defect Judge And strTemp.Format(_T("%d"), pNotchParam->m_nNotch_Inspect_Defect_Judge_And); if(pNotchParam->m_bNotch_Inspect_Defect_Use == FALSE) m_NotchList_Inspect_Param.GetCell(nRow, nCol)->SetBackClr(g_nGridCellColor_NonSelect); else m_NotchList_Inspect_Param.GetCell(nRow, nCol)->SetBackClr(g_nGridCellColor); m_NotchList_Inspect_Param.SetItemText(nRow++, nCol, strTemp); m_NotchList_Inspect_Param.Invalidate(); } else { nRow = 1; nCol = 2; // 1. Grinder Threshold strTemp = m_NotchList_Inspect_Param.GetItemText(nRow++, nCol); pNotchParam->m_nGrind_Threshold = _wtoi(strTemp); // 2. Glass Threshold strTemp = m_NotchList_Inspect_Param.GetItemText(nRow++, nCol); pNotchParam->m_nGlass_Threshold = _wtoi(strTemp); // 3. Smooth Filter strTemp = m_NotchList_Inspect_Param.GetItemText(nRow++, nCol); pNotchParam->m_nSmooth_Filter = _wtoi(strTemp); // 4. Reference Line Threshold strTemp = m_NotchList_Inspect_Param.GetItemText(nRow++, nCol); pNotchParam->m_nReferece_Line_Threshold = _wtoi(strTemp); // 4. Notch Center Offset strTemp = m_NotchList_Inspect_Param.GetItemText(nRow++, nCol); pNotchParam->m_nNotchCenter_Offset_pxl = _wtoi(strTemp); // 5. Inspect Defect Use strTemp = m_NotchList_Inspect_Param.GetItemText(nRow++, nCol); pNotchParam->m_bNotch_Inspect_Defect_Use = (_wtoi(strTemp) == 0) ? FALSE : TRUE; // 6. Inspect Defect Threshold strTemp = m_NotchList_Inspect_Param.GetItemText(nRow++, nCol); pNotchParam->m_nNotch_Inspect_Defect_Threshold = _wtoi(strTemp); // 7. Inspect Offset strTemp = m_NotchList_Inspect_Param.GetItemText(nRow++, nCol); pNotchParam->m_nNotch_Inspect_Defect_Offset = _wtoi(strTemp); // 7. Inspect dilate strTemp = m_NotchList_Inspect_Param.GetItemText(nRow++, nCol); pNotchParam->m_nNotch_Inspect_Defect_dilate = _wtoi(strTemp); // 8. Defect Min X strTemp = m_NotchList_Inspect_Param.GetItemText(nRow++, nCol); pNotchParam->m_nNotch_Inspect_Defect_Min_X_um = _wtoi(strTemp); // 9. Defect Min Y strTemp = m_NotchList_Inspect_Param.GetItemText(nRow++, nCol); pNotchParam->m_nNotch_Inspect_Defect_Min_Y_um = _wtoi(strTemp); // 10. Defect Judge X strTemp = m_NotchList_Inspect_Param.GetItemText(nRow++, nCol); pNotchParam->m_nNotch_Inspect_Defect_Judge_X_um = _wtoi(strTemp); // 11. Defect Judge Y strTemp = m_NotchList_Inspect_Param.GetItemText(nRow++, nCol); pNotchParam->m_nNotch_Inspect_Defect_Judge_Y_um = _wtoi(strTemp); // 12. Defect Judge And strTemp = m_NotchList_Inspect_Param.GetItemText(nRow++, nCol); pNotchParam->m_nNotch_Inspect_Defect_Judge_And = _wtoi(strTemp); } } void CDlgSideNotchSetting::Init_SideNotch_Measure_Param() { if (m_NotchList_Measure_Param.GetSafeHwnd() == NULL) return; int nRows = MAX_SIDE_NOTCH_MEASURE_COUNT + 1; int nCols = 8 + 1; int nFixRows = 1; int nFixCols = 1; int nRowIdx = 0; int nColIdx = 0; m_NotchList_Measure_Param.DeleteAllItems(); m_NotchList_Measure_Param.SetVirtualMode(FALSE); m_NotchList_Measure_Param.GetDefaultCell(TRUE, FALSE)->SetBackClr(g_nGridFixCellColor); m_NotchList_Measure_Param.GetDefaultCell(FALSE, TRUE)->SetBackClr(g_nGridFixCellColor); m_NotchList_Measure_Param.GetDefaultCell(FALSE, FALSE)->SetBackClr(g_nGridCellColor); m_NotchList_Measure_Param.SetFixedTextColor(g_nGridFixFontColor); m_NotchList_Measure_Param.SetRowCount(nRows); m_NotchList_Measure_Param.SetColumnCount(nCols); m_NotchList_Measure_Param.SetFixedRowCount(nFixRows); m_NotchList_Measure_Param.SetFixedColumnCount(nFixCols); CFont *pFont = m_NotchList_Measure_Param.GetFont(); if (pFont) { LOGFONT lf; pFont->GetLogFont(&lf); lf.lfItalic = 0; lf.lfHeight = 14; lf.lfWeight = FW_BOLD; _tcscpy_s(lf.lfFaceName, _T("Arial")); m_NotchList_Measure_Param.GetDefaultCell(FALSE, TRUE)->SetFont(&lf); m_NotchList_Measure_Param.GetDefaultCell(TRUE, FALSE)->SetFont(&lf); m_NotchList_Measure_Param.GetDefaultCell(FALSE, FALSE)->SetFont(&lf); m_NotchList_Measure_Param.GetDefaultCell(TRUE, TRUE)->SetFont(&lf); } // Col m_NotchList_Measure_Param.SetItemText(nRowIdx, nColIdx++, _T("No.")); m_NotchList_Measure_Param.SetColumnWidth(nColIdx, 50); m_NotchList_Measure_Param.SetItemText(nRowIdx, nColIdx++, _T("Use Dim.(0:OFF/1:ON)")); m_NotchList_Measure_Param.SetColumnWidth(nColIdx, 70); m_NotchList_Measure_Param.SetItemText(nRowIdx, nColIdx++, _T("Std(mm)")); m_NotchList_Measure_Param.SetColumnWidth(nColIdx, 70); m_NotchList_Measure_Param.SetItemText(nRowIdx, nColIdx++, _T("Min(mm)")); m_NotchList_Measure_Param.SetColumnWidth(nColIdx, 70); m_NotchList_Measure_Param.SetItemText(nRowIdx, nColIdx++, _T("Max(mm)")); m_NotchList_Measure_Param.SetColumnWidth(nColIdx, 70); m_NotchList_Measure_Param.SetItemText(nRowIdx, nColIdx++, _T("Use Cham.(0:OFF/1:ON)")); m_NotchList_Measure_Param.SetColumnWidth(nColIdx, 70); m_NotchList_Measure_Param.SetItemText(nRowIdx, nColIdx++, _T("Std(mm)")); m_NotchList_Measure_Param.SetColumnWidth(nColIdx, 70); m_NotchList_Measure_Param.SetItemText(nRowIdx, nColIdx++, _T("Min(mm)")); m_NotchList_Measure_Param.SetColumnWidth(nColIdx, 70); m_NotchList_Measure_Param.SetItemText(nRowIdx, nColIdx++, _T("Max(mm)")); m_NotchList_Measure_Param.SetFixedRowSelection(FALSE); m_NotchList_Measure_Param.SetFixedColumnSelection(FALSE); m_NotchList_Measure_Param.EnableSelection(TRUE); m_NotchList_Measure_Param.SetEditable(TRUE); m_NotchList_Measure_Param.SetRowResize(FALSE); m_NotchList_Measure_Param.SetColumnResize(FALSE); m_NotchList_Measure_Param.ExpandColumnsToFit(TRUE); } void CDlgSideNotchSetting::Fill_SideNotch_Measure_Param(BOOL bGetData) { if(m_NotchList_Measure_Param.GetSafeHwnd() == NULL) return; if(m_nSelectNotchIdx < 0 || MAX_SIDE_NOTCH_COUNT <= m_nSelectNotchIdx) return; if(m_pDlgRecipe == NULL || m_pSelectSideIdx == NULL) return; int nSideIdx = *(m_pSelectSideIdx); if(nSideIdx < 0 || eRcp_SideRD_End <= nSideIdx) return; CSIDE_PARM* pParam = &m_pDlgRecipe->m_SideParam[nSideIdx]; CNOTCH_PARM* pNotchParam = &pParam->m_NotchPrm[m_nSelectNotchIdx]; CString strTemp; int nRow = 0; int nCol = 0; if(bGetData == FALSE) { int nSetNotchCount = pParam->m_nNotchCount; if(nSetNotchCount == 0 || m_nSelectNotchIdx < 0 || MAX_SIDE_NOTCH_COUNT <= m_nSelectNotchIdx) { m_NotchList_Measure_Param.SetRowCount(1); m_NotchList_Measure_Param.Invalidate(); return; } else { Init_SideNotch_Measure_Param(); } for(int i=0; im_bNotch_Dimension_Use[i]); if(pNotchParam->m_bNotch_Dimension_Use[i] == FALSE) m_NotchList_Measure_Param.GetCell(nRow, nCol)->SetBackClr(g_nGridCellColor_NonSelect); else m_NotchList_Measure_Param.GetCell(nRow, nCol)->SetBackClr(g_nGridCellColor); m_NotchList_Measure_Param.SetItemText(nRow, nCol++, strTemp); strTemp.Format(_T("%.3f"), pNotchParam->m_dNotch_Dimension_STD_mm[i]); if(pNotchParam->m_bNotch_Dimension_Use[i] == FALSE) m_NotchList_Measure_Param.GetCell(nRow, nCol)->SetBackClr(g_nGridCellColor_NonSelect); else m_NotchList_Measure_Param.GetCell(nRow, nCol)->SetBackClr(g_nGridCellColor); m_NotchList_Measure_Param.SetItemText(nRow, nCol++, strTemp); strTemp.Format(_T("%.3f"), pNotchParam->m_dNotch_Dimension_Diff_MIN_mm[i]); if(pNotchParam->m_bNotch_Dimension_Use[i] == FALSE) m_NotchList_Measure_Param.GetCell(nRow, nCol)->SetBackClr(g_nGridCellColor_NonSelect); else m_NotchList_Measure_Param.GetCell(nRow, nCol)->SetBackClr(g_nGridCellColor); m_NotchList_Measure_Param.SetItemText(nRow, nCol++, strTemp); strTemp.Format(_T("%.3f"), pNotchParam->m_dNotch_Dimension_Diff_MAX_mm[i]); if(pNotchParam->m_bNotch_Dimension_Use[i] == FALSE) m_NotchList_Measure_Param.GetCell(nRow, nCol)->SetBackClr(g_nGridCellColor_NonSelect); else m_NotchList_Measure_Param.GetCell(nRow, nCol)->SetBackClr(g_nGridCellColor); m_NotchList_Measure_Param.SetItemText(nRow, nCol++, strTemp); strTemp.Format(_T("%d"), pNotchParam->m_bNotch_Chamfer_Use[i]); if(pNotchParam->m_bNotch_Chamfer_Use[i] == FALSE) m_NotchList_Measure_Param.GetCell(nRow, nCol)->SetBackClr(g_nGridCellColor_NonSelect); else m_NotchList_Measure_Param.GetCell(nRow, nCol)->SetBackClr(g_nGridCellColor); m_NotchList_Measure_Param.SetItemText(nRow, nCol++, strTemp); strTemp.Format(_T("%.3f"), pNotchParam->m_dNotch_Chamfer_STD_mm[i]); if(pNotchParam->m_bNotch_Chamfer_Use[i] == FALSE) m_NotchList_Measure_Param.GetCell(nRow, nCol)->SetBackClr(g_nGridCellColor_NonSelect); else m_NotchList_Measure_Param.GetCell(nRow, nCol)->SetBackClr(g_nGridCellColor); m_NotchList_Measure_Param.SetItemText(nRow, nCol++, strTemp); strTemp.Format(_T("%.3f"), pNotchParam->m_dNotch_Chamfer_Diff_MIN_mm[i]); if(pNotchParam->m_bNotch_Chamfer_Use[i] == FALSE) m_NotchList_Measure_Param.GetCell(nRow, nCol)->SetBackClr(g_nGridCellColor_NonSelect); else m_NotchList_Measure_Param.GetCell(nRow, nCol)->SetBackClr(g_nGridCellColor); m_NotchList_Measure_Param.SetItemText(nRow, nCol++, strTemp); strTemp.Format(_T("%.3f"), pNotchParam->m_dNotch_Chamfer_Diff_MAX_mm[i]); if(pNotchParam->m_bNotch_Chamfer_Use[i] == FALSE) m_NotchList_Measure_Param.GetCell(nRow, nCol)->SetBackClr(g_nGridCellColor_NonSelect); else m_NotchList_Measure_Param.GetCell(nRow, nCol)->SetBackClr(g_nGridCellColor); m_NotchList_Measure_Param.SetItemText(nRow, nCol++, strTemp); } m_NotchList_Measure_Param.Invalidate(); } else { for(int i=0; im_bNotch_Dimension_Use[i] = (_wtoi(strTemp) == 0) ? FALSE : TRUE; strTemp = m_NotchList_Measure_Param.GetItemText(nRow, nCol++); pNotchParam->m_dNotch_Dimension_STD_mm[i] = _wtof(strTemp); strTemp = m_NotchList_Measure_Param.GetItemText(nRow, nCol++); pNotchParam->m_dNotch_Dimension_Diff_MIN_mm[i] = _wtof(strTemp); strTemp = m_NotchList_Measure_Param.GetItemText(nRow, nCol++); pNotchParam->m_dNotch_Dimension_Diff_MAX_mm[i] = _wtof(strTemp); strTemp = m_NotchList_Measure_Param.GetItemText(nRow, nCol++); pNotchParam->m_bNotch_Chamfer_Use[i] = (_wtoi(strTemp) == 0) ? FALSE : TRUE; strTemp = m_NotchList_Measure_Param.GetItemText(nRow, nCol++); pNotchParam->m_dNotch_Chamfer_STD_mm[i] = _wtof(strTemp); strTemp = m_NotchList_Measure_Param.GetItemText(nRow, nCol++); pNotchParam->m_dNotch_Chamfer_Diff_MIN_mm[i] = _wtof(strTemp); strTemp = m_NotchList_Measure_Param.GetItemText(nRow, nCol++); pNotchParam->m_dNotch_Chamfer_Diff_MAX_mm[i] = _wtof(strTemp); } } } void CDlgSideNotchSetting::Fill_SideNotch_Measure_Param_CurrentResult() { if(m_NotchList_Measure_Param.GetSafeHwnd() == NULL) return; if(m_nSelectNotchIdx < 0 || MAX_SIDE_NOTCH_COUNT <= m_nSelectNotchIdx) return; if(m_pDlgRecipe == NULL || m_pSelectSideIdx == NULL) return; int nSideIdx = *(m_pSelectSideIdx); if(nSideIdx < 0 || eRcp_SideRD_End <= nSideIdx) return; int nSelectNotchIdx = m_nSelectNotchIdx; if(nSelectNotchIdx < 0 || MAX_SIDE_NOTCH_COUNT <= nSelectNotchIdx) return; CSIDE_PARM* pParam = &m_pDlgRecipe->m_SideParam[nSideIdx]; CNOTCH_PARM* pNotchParam = &pParam->m_NotchPrm[m_nSelectNotchIdx]; CString strTemp; for(int i=0; im_bNotch_Dimension_Use[i]); if(pNotchParam->m_bNotch_Dimension_Use[i] == FALSE) m_NotchList_Measure_Param.GetCell(nRow, nCol)->SetBackClr(g_nGridCellColor_NonSelect); else m_NotchList_Measure_Param.GetCell(nRow, nCol)->SetBackClr(g_nGridCellColor); m_NotchList_Measure_Param.SetItemText(nRow, nCol++, strTemp); strTemp.Format(_T("%.3f"), m_pGlassData->GetSideData((DimensionDir) nSideIdx)->m_dNotch_Dimension_Edge_Result_um[nSelectNotchIdx][i] / 1000.0); if(pNotchParam->m_bNotch_Dimension_Use[i] == FALSE) m_NotchList_Measure_Param.GetCell(nRow, nCol)->SetBackClr(g_nGridCellColor_NonSelect); else m_NotchList_Measure_Param.GetCell(nRow, nCol)->SetBackClr(g_nGridCellColor); m_NotchList_Measure_Param.SetItemText(nRow, nCol++, strTemp); strTemp.Format(_T("%.3f"), pNotchParam->m_dNotch_Dimension_Diff_MIN_mm[i]); if(pNotchParam->m_bNotch_Dimension_Use[i] == FALSE) m_NotchList_Measure_Param.GetCell(nRow, nCol)->SetBackClr(g_nGridCellColor_NonSelect); else m_NotchList_Measure_Param.GetCell(nRow, nCol)->SetBackClr(g_nGridCellColor); m_NotchList_Measure_Param.SetItemText(nRow, nCol++, strTemp); strTemp.Format(_T("%.3f"), pNotchParam->m_dNotch_Dimension_Diff_MAX_mm[i]); if(pNotchParam->m_bNotch_Dimension_Use[i] == FALSE) m_NotchList_Measure_Param.GetCell(nRow, nCol)->SetBackClr(g_nGridCellColor_NonSelect); else m_NotchList_Measure_Param.GetCell(nRow, nCol)->SetBackClr(g_nGridCellColor); m_NotchList_Measure_Param.SetItemText(nRow, nCol++, strTemp); strTemp.Format(_T("%d"), pNotchParam->m_bNotch_Chamfer_Use[i]); if(pNotchParam->m_bNotch_Chamfer_Use[i] == FALSE) m_NotchList_Measure_Param.GetCell(nRow, nCol)->SetBackClr(g_nGridCellColor_NonSelect); else m_NotchList_Measure_Param.GetCell(nRow, nCol)->SetBackClr(g_nGridCellColor); m_NotchList_Measure_Param.SetItemText(nRow, nCol++, strTemp); strTemp.Format(_T("%.3f"), m_pGlassData->GetSideData((DimensionDir) nSideIdx)->m_dNotch_Chamfer_Edge_Result_um[nSelectNotchIdx][i] / 1000.0); if(pNotchParam->m_bNotch_Chamfer_Use[i] == FALSE) m_NotchList_Measure_Param.GetCell(nRow, nCol)->SetBackClr(g_nGridCellColor_NonSelect); else m_NotchList_Measure_Param.GetCell(nRow, nCol)->SetBackClr(g_nGridCellColor); m_NotchList_Measure_Param.SetItemText(nRow, nCol++, strTemp); strTemp.Format(_T("%.3f"), pNotchParam->m_dNotch_Chamfer_Diff_MIN_mm[i]); if(pNotchParam->m_bNotch_Chamfer_Use[i] == FALSE) m_NotchList_Measure_Param.GetCell(nRow, nCol)->SetBackClr(g_nGridCellColor_NonSelect); else m_NotchList_Measure_Param.GetCell(nRow, nCol)->SetBackClr(g_nGridCellColor); m_NotchList_Measure_Param.SetItemText(nRow, nCol++, strTemp); strTemp.Format(_T("%.3f"), pNotchParam->m_dNotch_Chamfer_Diff_MAX_mm[i]); if(pNotchParam->m_bNotch_Chamfer_Use[i] == FALSE) m_NotchList_Measure_Param.GetCell(nRow, nCol)->SetBackClr(g_nGridCellColor_NonSelect); else m_NotchList_Measure_Param.GetCell(nRow, nCol)->SetBackClr(g_nGridCellColor); m_NotchList_Measure_Param.SetItemText(nRow, nCol++, strTemp); } m_NotchList_Measure_Param.Invalidate(); } void CDlgSideNotchSetting::Init_SideNotch_Circle_Param() { if (m_NotchList_Circle_Param.GetSafeHwnd() == NULL) return; int nRows = 1; int nCols = 4 + 1; int nFixRows = 1; int nFixCols = 1; int nRowIdx = 0; int nColIdx = 0; m_NotchList_Circle_Param.DeleteAllItems(); m_NotchList_Circle_Param.SetVirtualMode(FALSE); m_NotchList_Circle_Param.GetDefaultCell(TRUE, FALSE)->SetBackClr(g_nGridFixCellColor); m_NotchList_Circle_Param.GetDefaultCell(FALSE, TRUE)->SetBackClr(g_nGridFixCellColor); m_NotchList_Circle_Param.GetDefaultCell(FALSE, FALSE)->SetBackClr(g_nGridCellColor); m_NotchList_Circle_Param.SetFixedTextColor(g_nGridFixFontColor); m_NotchList_Circle_Param.SetRowCount(nRows); m_NotchList_Circle_Param.SetColumnCount(nCols); m_NotchList_Circle_Param.SetFixedRowCount(nFixRows); m_NotchList_Circle_Param.SetFixedColumnCount(nFixCols); CFont *pFont = m_NotchList_Circle_Param.GetFont(); if (pFont) { LOGFONT lf; pFont->GetLogFont(&lf); lf.lfItalic = 0; lf.lfHeight = 14; lf.lfWeight = FW_BOLD; _tcscpy_s(lf.lfFaceName, _T("Arial")); m_NotchList_Circle_Param.GetDefaultCell(FALSE, TRUE)->SetFont(&lf); m_NotchList_Circle_Param.GetDefaultCell(TRUE, FALSE)->SetFont(&lf); m_NotchList_Circle_Param.GetDefaultCell(FALSE, FALSE)->SetFont(&lf); m_NotchList_Circle_Param.GetDefaultCell(TRUE, TRUE)->SetFont(&lf); } // Col m_NotchList_Circle_Param.SetItemText(nRowIdx, nColIdx++, _T("No.")); m_NotchList_Circle_Param.SetColumnWidth(nColIdx, 50); m_NotchList_Circle_Param.SetItemText(nRowIdx, nColIdx++, _T("Use (0:OFF/1:ON)")); m_NotchList_Circle_Param.SetColumnWidth(nColIdx, 70); m_NotchList_Circle_Param.SetItemText(nRowIdx, nColIdx++, _T("Radius(mm)")); m_NotchList_Circle_Param.SetColumnWidth(nColIdx, 70); m_NotchList_Circle_Param.SetItemText(nRowIdx, nColIdx++, _T("Min(mm)")); m_NotchList_Circle_Param.SetColumnWidth(nColIdx, 70); m_NotchList_Circle_Param.SetItemText(nRowIdx, nColIdx++, _T("Max(mm)")); m_NotchList_Circle_Param.SetColumnWidth(nColIdx, 70); m_NotchList_Circle_Param.SetFixedRowSelection(FALSE); m_NotchList_Circle_Param.SetFixedColumnSelection(FALSE); m_NotchList_Circle_Param.EnableSelection(TRUE); m_NotchList_Circle_Param.SetEditable(TRUE); m_NotchList_Circle_Param.SetRowResize(FALSE); m_NotchList_Circle_Param.SetColumnResize(FALSE); m_NotchList_Circle_Param.ExpandColumnsToFit(TRUE); } void CDlgSideNotchSetting::Fill_SideNotch_Circle_Param(BOOL bGetData) { if(m_NotchList_Circle_Param.GetSafeHwnd() == NULL) return; if(m_nSelectNotchIdx < 0 || MAX_SIDE_NOTCH_COUNT <= m_nSelectNotchIdx) return; if(m_pDlgRecipe == NULL || m_pSelectSideIdx == NULL) return; int nSideIdx = *(m_pSelectSideIdx); if(nSideIdx < 0 || eRcp_SideRD_End <= nSideIdx) return; CSIDE_PARM* pParam = &m_pDlgRecipe->m_SideParam[nSideIdx]; CNOTCH_PARM* pNotchParam = &pParam->m_NotchPrm[m_nSelectNotchIdx]; CString strTemp; int nRow = 0; int nCol = 0; if(bGetData == FALSE) { int nSetNotchCount = pParam->m_nNotchCount; if(nSetNotchCount == 0 || m_nSelectNotchIdx < 0 || MAX_SIDE_NOTCH_COUNT <= m_nSelectNotchIdx) { m_NotchList_Circle_Param.SetRowCount(1); m_NotchList_Circle_Param.Invalidate(); return; } else { Init_SideNotch_Circle_Param(); } int nCircleCount = pNotchParam->m_nNotch_Circle_Count; m_NotchList_Circle_Param.SetRowCount(nCircleCount + 1); for(int i=0; im_bNotch_Circle_Use[i]); if(pNotchParam->m_bNotch_Circle_Use[i] == FALSE) m_NotchList_Circle_Param.GetCell(nRow, nCol)->SetBackClr(g_nGridCellColor_NonSelect); else m_NotchList_Circle_Param.GetCell(nRow, nCol)->SetBackClr(g_nGridCellColor); m_NotchList_Circle_Param.SetItemText(nRow, nCol++, strTemp); strTemp.Format(_T("%.3f"), pNotchParam->m_dNotch_Circle_Spec_Radius_um[i] / 1000.0); if(pNotchParam->m_bNotch_Circle_Use[i] == FALSE) m_NotchList_Circle_Param.GetCell(nRow, nCol)->SetBackClr(g_nGridCellColor_NonSelect); else m_NotchList_Circle_Param.GetCell(nRow, nCol)->SetBackClr(g_nGridCellColor); m_NotchList_Circle_Param.SetItemText(nRow, nCol++, strTemp); strTemp.Format(_T("%.3f"), pNotchParam->m_dNotch_Circle_Spec_Radius_Min_um[i] / 1000.0); if(pNotchParam->m_bNotch_Circle_Use[i] == FALSE) m_NotchList_Circle_Param.GetCell(nRow, nCol)->SetBackClr(g_nGridCellColor_NonSelect); else m_NotchList_Circle_Param.GetCell(nRow, nCol)->SetBackClr(g_nGridCellColor); m_NotchList_Circle_Param.SetItemText(nRow, nCol++, strTemp); strTemp.Format(_T("%.3f"), pNotchParam->m_dNotch_Circle_Spec_Radius_Max_um[i] / 1000.0); if(pNotchParam->m_bNotch_Circle_Use[i] == FALSE) m_NotchList_Circle_Param.GetCell(nRow, nCol)->SetBackClr(g_nGridCellColor_NonSelect); else m_NotchList_Circle_Param.GetCell(nRow, nCol)->SetBackClr(g_nGridCellColor); m_NotchList_Circle_Param.SetItemText(nRow, nCol++, strTemp); } m_NotchList_Circle_Param.Invalidate(); } else { int nCircleCount = pNotchParam->m_nNotch_Circle_Count; for(int i=0; im_bNotch_Circle_Use[i] = (_wtoi(strTemp) == 0) ? FALSE : TRUE; strTemp = m_NotchList_Circle_Param.GetItemText(nRow, nCol++); pNotchParam->m_dNotch_Circle_Spec_Radius_um[i] = _wtof(strTemp) * 1000.0; strTemp = m_NotchList_Circle_Param.GetItemText(nRow, nCol++); pNotchParam->m_dNotch_Circle_Spec_Radius_Min_um[i] = _wtof(strTemp) * 1000.0; strTemp = m_NotchList_Circle_Param.GetItemText(nRow, nCol++); pNotchParam->m_dNotch_Circle_Spec_Radius_Max_um[i] = _wtof(strTemp) * 1000.0; } } } BOOL CDlgSideNotchSetting::OnInitDialog() { CDialogEx::OnInitDialog(); Init_SideNotch_List(); Init_SideNotch_Inspect_Param(); Init_SideNotch_Measure_Param(); Init_SideNotch_Circle_Param(); return TRUE; } BEGIN_EVENTSINK_MAP(CDlgSideNotchSetting, CDialogEx) ON_EVENT(CDlgSideNotchSetting, IDC_BUTTON_ADD_NOTCH, DISPID_CLICK, CDlgSideNotchSetting::ClickButtonAdd, VTS_NONE) ON_EVENT(CDlgSideNotchSetting, IDC_BUTTON_MODIFY_NOTCH, DISPID_CLICK, CDlgSideNotchSetting::ClickButtonModify, VTS_NONE) ON_EVENT(CDlgSideNotchSetting, IDC_BUTTON_DEL_NOTCH, DISPID_CLICK, CDlgSideNotchSetting::ClickButtonDel, VTS_NONE) ON_EVENT(CDlgSideNotchSetting, IDC_BUTTON_GET_NOTCH_RESULT, DISPID_CLICK, CDlgSideNotchSetting::ClickButtonGetSideNotchResult, VTS_NONE) ON_EVENT(CDlgSideNotchSetting, IDC_BUTTON_ADD_NOTCH_CIRCLE, DISPID_CLICK, CDlgSideNotchSetting::ClickButtonAdd_NotchCircle, VTS_NONE) ON_EVENT(CDlgSideNotchSetting, IDC_BUTTON_MODIFY_NOTCH_CIRCLE, DISPID_CLICK, CDlgSideNotchSetting::ClickButtonModify_NotchCircle, VTS_NONE) ON_EVENT(CDlgSideNotchSetting, IDC_BUTTON_DEL_NOTCH_CIRCLE, DISPID_CLICK, CDlgSideNotchSetting::ClickButtonDel_NotchCircle, VTS_NONE) END_EVENTSINK_MAP() void CDlgSideNotchSetting::ClickButtonAdd() { if(m_pDlgRecipe == NULL || m_pSelectSideIdx == NULL) return; int nSideIdx = *(m_pSelectSideIdx); if(nSideIdx < 0 || eRcp_SideRD_End <= nSideIdx) return; CSIDE_PARM* pParam = &m_pDlgRecipe->m_SideParam[nSideIdx]; int nAddIdx = pParam->m_nNotchCount; if(nAddIdx < 0 || MAX_SIDE_NOTCH_COUNT <= nAddIdx) { CString strMsg; strMsg.Format(_T("Max Notch Count : %d ea"), MAX_SIDE_NOTCH_COUNT); AfxMessageBox(strMsg); return; } if(m_pGlassData == NULL || m_pRecipeImageViewer == NULL) return; CSide_Data* pSideData = m_pGlassData->GetSideData((DimensionDir) nSideIdx); if(pSideData == NULL) return; if(pSideData->m_bFindGlassStartLine == FALSE || pSideData->m_nGlassStartLine == -1) { AfxMessageBox(_T("Check Glass Start Line..")); return; } if(pSideData->m_bTopMark_Find == FALSE || pSideData->m_bBotMark_Find == FALSE) { AfxMessageBox(_T("Check Mark Find..")); return; } pParam->m_NotchPrm[nAddIdx].Reset(); pParam->m_NotchPrm[nAddIdx].m_nGlassStartLine_pxl = pSideData->m_nGlassStartLine; pParam->m_NotchPrm[nAddIdx].m_ptTopMarkPos = pSideData->m_ptTopMark_FindResult; pParam->m_NotchPrm[nAddIdx].m_ptBotMarkPos = pSideData->m_ptBotMark_FindResult; pParam->m_NotchPrm[nAddIdx].m_rtNotch_Area_pxl = m_pRecipeImageViewer->GetManualMeasureRect(); pParam->m_nNotchCount = nAddIdx + 1; // Draw Exception pSideData->m_rtNotchArea_pxl[nAddIdx] = pParam->m_NotchPrm[nAddIdx].m_rtNotch_Area_pxl; pSideData->m_nNotchCount++; m_pRecipeImageViewer->Invalidate(); // Add Index.. m_nSelectNotchIdx = nAddIdx; UpdateRecipe(FALSE); } void CDlgSideNotchSetting::ClickButtonModify() { if(m_pDlgRecipe == NULL || m_pSelectSideIdx == NULL) return; int nSideIdx = *(m_pSelectSideIdx); if(nSideIdx < 0 || eRcp_SideRD_End <= nSideIdx) return; CSIDE_PARM* pParam = &m_pDlgRecipe->m_SideParam[nSideIdx]; int nNotchCount = pParam->m_nNotchCount; CCellID FocusedID = m_NotchList.GetFocusCell(); int nModifyIdx = FocusedID.row - 1; if(nModifyIdx < 0 || nNotchCount <= nModifyIdx) { AfxMessageBox(_T("Select Error")); return; } CString strTemp; strTemp.Format(_T("Modify [%d] Notch Area ?"), nModifyIdx+1); if(IDYES != AfxMessageBox(strTemp, MB_YESNO)) return; if(m_pGlassData == NULL || m_pRecipeImageViewer == NULL) return; CSide_Data* pSideData = m_pGlassData->GetSideData((DimensionDir) nSideIdx); if(pSideData == NULL) return; if(pSideData->m_bFindGlassStartLine == FALSE || pSideData->m_nGlassStartLine == -1) { AfxMessageBox(_T("Check Glass Start Line..")); return; } if(pSideData->m_bTopMark_Find == FALSE || pSideData->m_bBotMark_Find == FALSE) { AfxMessageBox(_T("Check Mark Find..")); return; } pParam->m_NotchPrm[nModifyIdx].m_nGlassStartLine_pxl = pSideData->m_nGlassStartLine; pParam->m_NotchPrm[nModifyIdx].m_ptTopMarkPos = pSideData->m_ptTopMark_FindResult; pParam->m_NotchPrm[nModifyIdx].m_ptBotMarkPos = pSideData->m_ptBotMark_FindResult; pParam->m_NotchPrm[nModifyIdx].m_rtNotch_Area_pxl = m_pRecipeImageViewer->GetManualMeasureRect(); // Draw Exception pSideData->m_rtNotchArea_pxl[nModifyIdx] = pParam->m_NotchPrm[nModifyIdx].m_rtNotch_Area_pxl; m_pRecipeImageViewer->Invalidate(); UpdateRecipe(FALSE); } void CDlgSideNotchSetting::ClickButtonDel() { if(m_pDlgRecipe == NULL || m_pSelectSideIdx == NULL) return; int nSideIdx = *(m_pSelectSideIdx); if(nSideIdx < 0 || eRcp_SideRD_End <= nSideIdx) return; CSIDE_PARM* pParam = &m_pDlgRecipe->m_SideParam[nSideIdx]; int nNotchCount = pParam->m_nNotchCount; CCellID FocusedID = m_NotchList.GetFocusCell(); int nDelIdx = FocusedID.row - 1; if(nDelIdx < 0 || nNotchCount <= nDelIdx) { AfxMessageBox(_T("Select Error")); return; } CString strTemp; strTemp.Format(_T("Delete [%d] Notch Area ?"), nDelIdx+1); if(IDYES != AfxMessageBox(strTemp, MB_YESNO)) return; int nPosIdx = 0; for(int i=0; im_NotchPrm[nPosIdx] = pParam->m_NotchPrm[i]; nPosIdx++; } pParam->m_nNotchCount = nNotchCount - 1; UpdateRecipe(FALSE); } void CDlgSideNotchSetting::ClickButtonGetSideNotchResult() { if(m_pGlassData == NULL) return; if(IDYES != AfxMessageBox(_T("Set Current Result ?"), MB_YESNO)) return; if(m_nSelectNotchIdx < 0 || MAX_SIDE_NOTCH_COUNT <= m_nSelectNotchIdx) { AfxMessageBox(_T("Select Notch..")); return; } Fill_SideNotch_Measure_Param_CurrentResult(); } void CDlgSideNotchSetting::OnGridClickSelectNotch(NMHDR *pNotifyStruct, LRESULT* pResult) { NM_GRIDVIEW* pItem = (NM_GRIDVIEW*)pNotifyStruct; int nSelectPosition = pItem->iRow - 1; if(nSelectPosition < 0 || MAX_SIDE_NOTCH_COUNT <= nSelectPosition) return; UpdateRecipe(TRUE); m_nSelectNotchIdx = nSelectPosition; UpdateRecipe(FALSE); } void CDlgSideNotchSetting::OnGridClickSelectNotchCircle(NMHDR *pNotifyStruct, LRESULT* pResult) { NM_GRIDVIEW* pItem = (NM_GRIDVIEW*)pNotifyStruct; int nSelectPosition = pItem->iRow - 1; if(nSelectPosition < 0 || MAX_SIDE_NOTCH_CIRCLE_COUNT <= nSelectPosition) return; m_nSelectNotchCircleIdx = nSelectPosition; CString strTemp; strTemp.Format(_T("[%s] Notch - Circle No.[%d]"), g_SideName[(int) *(m_pSelectSideIdx)], m_nSelectNotchCircleIdx+1); SetDlgItemText(IDC_STATIC_TITLE_CIRCLE, strTemp); } void CDlgSideNotchSetting::ClickButtonAdd_NotchCircle() { if(m_pDlgRecipe == NULL || m_pSelectSideIdx == NULL) return; int nSideIdx = *(m_pSelectSideIdx); if(nSideIdx < 0 || eRcp_SideRD_End <= nSideIdx) return; int nNotchIdx = m_nSelectNotchIdx; if(nNotchIdx < 0 || MAX_SIDE_NOTCH_COUNT <= nNotchIdx) return; CSIDE_PARM* pParam = &m_pDlgRecipe->m_SideParam[nSideIdx]; CNOTCH_PARM* pNotchParam = &m_pDlgRecipe->m_SideParam[nSideIdx].m_NotchPrm[nNotchIdx]; int nAddIdx = pNotchParam->m_nNotch_Circle_Count; if(nAddIdx < 0 || MAX_SIDE_NOTCH_CIRCLE_COUNT <= nAddIdx) { CString strMsg; strMsg.Format(_T("Max Notch Circle Count : %d ea"), MAX_SIDE_NOTCH_CIRCLE_COUNT); AfxMessageBox(strMsg); return; } if(m_pGlassData == NULL || m_pRecipeImageViewer == NULL) return; CSide_Data* pSideData = m_pGlassData->GetSideData((DimensionDir) nSideIdx); if(pSideData == NULL) return; if(pSideData->m_bFindGlassStartLine == FALSE || pSideData->m_nGlassStartLine == -1) { AfxMessageBox(_T("Check Glass Start Line..")); return; } if(pSideData->m_bTopMark_Find == FALSE || pSideData->m_bBotMark_Find == FALSE) { AfxMessageBox(_T("Check Mark Find..")); return; } pNotchParam->m_bNotch_Circle_Use[nAddIdx] = TRUE; pNotchParam->m_ptNotch_Circle_TopMarkPos[nAddIdx] = pSideData->m_ptTopMark_FindResult; pNotchParam->m_ptNotch_Circle_BotMarkPos[nAddIdx] = pSideData->m_ptBotMark_FindResult; pNotchParam->m_rtNotch_Circle_Area_pxl[nAddIdx] = m_pRecipeImageViewer->GetManualMeasureRect(); pNotchParam->m_dNotch_Circle_Spec_Radius_um[nAddIdx]; pNotchParam->m_dNotch_Circle_Spec_Radius_Min_um[nAddIdx]; pNotchParam->m_dNotch_Circle_Spec_Radius_Max_um[nAddIdx]; pNotchParam->m_nNotch_Circle_Count = nAddIdx + 1; // Draw Exception pSideData->m_rtNotchCircleArea_pxl[m_nSelectNotchIdx][nAddIdx] = pNotchParam->m_rtNotch_Circle_Area_pxl[nAddIdx]; pSideData->m_nNotchCircleCount[m_nSelectNotchIdx]++; m_pRecipeImageViewer->Invalidate(); UpdateRecipe(FALSE); } void CDlgSideNotchSetting::ClickButtonModify_NotchCircle() { if(m_pDlgRecipe == NULL || m_pSelectSideIdx == NULL) return; int nSideIdx = *(m_pSelectSideIdx); if(nSideIdx < 0 || eRcp_SideRD_End <= nSideIdx) return; int nNotchIdx = m_nSelectNotchIdx; if(nNotchIdx < 0 || MAX_SIDE_NOTCH_COUNT <= nNotchIdx) return; CSIDE_PARM* pParam = &m_pDlgRecipe->m_SideParam[nSideIdx]; CNOTCH_PARM* pNotchParam = &m_pDlgRecipe->m_SideParam[nSideIdx].m_NotchPrm[nNotchIdx]; int nNotchCircleCount = pNotchParam->m_nNotch_Circle_Count; CCellID FocusedID = m_NotchList_Circle_Param.GetFocusCell(); int nModifyIdx = FocusedID.row - 1; if(nModifyIdx < 0 || nNotchCircleCount <= nModifyIdx) { AfxMessageBox(_T("Select Error")); return; } CString strTemp; strTemp.Format(_T("Modify [%d] Notch Circle Area ?"), nModifyIdx+1); if(IDYES != AfxMessageBox(strTemp, MB_YESNO)) return; if(m_pGlassData == NULL || m_pRecipeImageViewer == NULL) return; CSide_Data* pSideData = m_pGlassData->GetSideData((DimensionDir) nSideIdx); if(pSideData == NULL) return; if(pSideData->m_bFindGlassStartLine == FALSE || pSideData->m_nGlassStartLine == -1) { AfxMessageBox(_T("Check Glass Start Line..")); return; } if(pSideData->m_bTopMark_Find == FALSE || pSideData->m_bBotMark_Find == FALSE) { AfxMessageBox(_T("Check Mark Find..")); return; } pNotchParam->m_rtNotch_Circle_Area_pxl[nModifyIdx] = m_pRecipeImageViewer->GetManualMeasureRect(); // Draw Exception pNotchParam->m_ptNotch_Circle_TopMarkPos[nModifyIdx] = pSideData->m_ptTopMark_FindResult; pNotchParam->m_ptNotch_Circle_BotMarkPos[nModifyIdx] = pSideData->m_ptBotMark_FindResult; pSideData->m_rtNotchCircleArea_pxl[m_nSelectNotchIdx][nModifyIdx] = pNotchParam->m_rtNotch_Circle_Area_pxl[nModifyIdx]; pSideData->m_nNotchCircleCount[m_nSelectNotchIdx] = nNotchCircleCount; m_pRecipeImageViewer->Invalidate(); UpdateRecipe(FALSE); } void CDlgSideNotchSetting::ClickButtonDel_NotchCircle() { if(m_pDlgRecipe == NULL || m_pSelectSideIdx == NULL) return; int nSideIdx = *(m_pSelectSideIdx); if(nSideIdx < 0 || eRcp_SideRD_End <= nSideIdx) return; int nNotchIdx = m_nSelectNotchIdx; if(nNotchIdx < 0 || MAX_SIDE_NOTCH_COUNT <= nNotchIdx) return; CSIDE_PARM* pParam = &m_pDlgRecipe->m_SideParam[nSideIdx]; CNOTCH_PARM* pNotchParam = &m_pDlgRecipe->m_SideParam[nSideIdx].m_NotchPrm[nNotchIdx]; int nNotchCircleCount = pNotchParam->m_nNotch_Circle_Count; CCellID FocusedID = m_NotchList_Circle_Param.GetFocusCell(); int nDelIdx = FocusedID.row - 1; if(nDelIdx < 0 || nNotchCircleCount <= nDelIdx) { AfxMessageBox(_T("Select Error")); return; } CString strTemp; strTemp.Format(_T("Delete [%d] Notch Circle Area ?"), nDelIdx+1); if(IDYES != AfxMessageBox(strTemp, MB_YESNO)) return; int nPosIdx = 0; for(int i=0; im_bNotch_Circle_Use[nPosIdx] = pNotchParam->m_bNotch_Circle_Use[i]; pNotchParam->m_ptNotch_Circle_TopMarkPos[nPosIdx] = pNotchParam->m_ptNotch_Circle_TopMarkPos[i]; pNotchParam->m_ptNotch_Circle_BotMarkPos[nPosIdx] = pNotchParam->m_ptNotch_Circle_BotMarkPos[i]; pNotchParam->m_rtNotch_Circle_Area_pxl[nPosIdx] = pNotchParam->m_rtNotch_Circle_Area_pxl[i]; pNotchParam->m_dNotch_Circle_Spec_Radius_um[nPosIdx] = pNotchParam->m_dNotch_Circle_Spec_Radius_um[i]; pNotchParam->m_dNotch_Circle_Spec_Radius_Min_um[nPosIdx] = pNotchParam->m_dNotch_Circle_Spec_Radius_Min_um[i]; pNotchParam->m_dNotch_Circle_Spec_Radius_Max_um[nPosIdx] = pNotchParam->m_dNotch_Circle_Spec_Radius_Max_um[i]; nPosIdx++; } pNotchParam->m_nNotch_Circle_Count = nNotchCircleCount - 1; UpdateRecipe(FALSE); }