// DlgSystemAFM.cpp : ±¸Çö ÆÄÀÏÀÔ´Ï´Ù.
|
//
|
|
#include "stdafx.h"
|
#include "ReviewSystemSetting.h"
|
#include "DlgSystemAFM.h"
|
#include "ReviewSystemSettingDlg.h"
|
#include "CHCommonControls/GridCellCombo.h"
|
#include "CHCommonControls/GridCellCheck.h"
|
#include "CHReviewSetting/GantryInfo.h"
|
#include "CHReviewSetting/SystemInfo.h"
|
|
// CDlgSystemAFM ´ëÈ »óÀÚÀÔ´Ï´Ù.
|
|
IMPLEMENT_DYNAMIC(CDlgSystemAFM, CDialog)
|
|
CDlgSystemAFM::CDlgSystemAFM(CWnd* pParent /*=NULL*/)
|
: CDialog(CDlgSystemAFM::IDD, pParent)
|
, m_nGantryIdx(0)
|
, m_nHeaderIdx(0)
|
{
|
m_nAFMCount = 0;
|
}
|
|
CDlgSystemAFM::~CDlgSystemAFM()
|
{
|
}
|
|
void CDlgSystemAFM::DoDataExchange(CDataExchange* pDX)
|
{
|
DDX_Control(pDX, IDC_GRID_SYSTEM_AFM_INFO, m_ctrlGridAFMInfo);
|
DDX_Text(pDX, IDC_EDIT_SYS_SL_GANTRY_IDX, m_nGantryIdx);
|
DDX_Text(pDX, IDC_EDIT_SYS_SL_HEADER_IDX, m_nHeaderIdx);
|
CDialog::DoDataExchange(pDX);
|
}
|
|
BEGIN_MESSAGE_MAP(CDlgSystemAFM, CDialog)
|
ON_BN_CLICKED(IDOK, &CDlgSystemAFM::OnBnClickedOk)
|
ON_BN_CLICKED(IDCANCEL, &CDlgSystemAFM::OnBnClickedCancel)
|
ON_BN_CLICKED(IDC_BUTTON_SYS_SYSTEM_AFM_RESET, &CDlgSystemAFM::OnBnClickedButtonSysSystemAfmReset)
|
ON_BN_CLICKED(IDC_BUTTON_SYS_SYSTEM_AFM_APPLY, &CDlgSystemAFM::OnBnClickedButtonSysSystemAfmApply)
|
END_MESSAGE_MAP()
|
|
|
// CDlgSystemAFM ¸Þ½ÃÁö 󸮱âÀÔ´Ï´Ù.
|
void CDlgSystemAFM::OnBnClickedOk()
|
{
|
// TODO: ¿©±â¿¡ ÄÁÆ®·Ñ ¾Ë¸² 󸮱â Äڵ带 Ãß°¡ÇÕ´Ï´Ù.
|
// OnOK();
|
}
|
|
void CDlgSystemAFM::OnBnClickedCancel()
|
{
|
// TODO: ¿©±â¿¡ ÄÁÆ®·Ñ ¾Ë¸² 󸮱â Äڵ带 Ãß°¡ÇÕ´Ï´Ù.
|
// OnCancel();
|
}
|
|
void CDlgSystemAFM::InitAFMInfoGridControl()
|
{
|
int nRowIdx, nColIdx, nRows, nCols, nFixRows, nFixCols;
|
CString strTemp;
|
|
nRows = AFM_INFO_GRID_ROW_COUNT;
|
nCols = m_nAFMCount + 1;
|
nFixRows = 1;
|
nFixCols = 1;
|
nRowIdx = 0;
|
nColIdx = 0;
|
|
m_ctrlGridAFMInfo.GetDefaultCell(FALSE, FALSE)->SetBackClr(RGB(0xFF, 0xFF, 0xE0));
|
m_ctrlGridAFMInfo.SetRowCount(nRows);
|
m_ctrlGridAFMInfo.SetColumnCount(nCols);
|
m_ctrlGridAFMInfo.SetFixedRowCount(nFixRows);
|
m_ctrlGridAFMInfo.SetFixedColumnCount(nFixCols);
|
|
GV_ITEM Item;
|
|
Item.mask = GVIF_TEXT;
|
Item.row = nRowIdx++;
|
Item.col = nColIdx;
|
strTemp.Format(_T("Index")); //_T("À妽º"));
|
Item.strText = strTemp;
|
m_ctrlGridAFMInfo.SetItem(&Item);
|
|
Item.row = nRowIdx++;
|
Item.col = nColIdx;
|
strTemp.Format(_T("Total Index")); //_T("ÅäÅ» À妽º"));
|
Item.strText = strTemp;
|
m_ctrlGridAFMInfo.SetItem(&Item);
|
|
Item.row = nRowIdx++;
|
Item.col = nColIdx;
|
strTemp.Format(_T("Name")); //_T("AFM À̸§"));
|
Item.strText = strTemp;
|
m_ctrlGridAFMInfo.SetItem(&Item);
|
|
Item.row = nRowIdx++;
|
Item.col = nColIdx;
|
strTemp.Format(_T("Controller Type")); //_T("ÄÁÆ®·Ñ·¯ ŸÀÔ"));
|
Item.strText = strTemp;
|
m_ctrlGridAFMInfo.SetItem(&Item);
|
|
Item.row = nRowIdx++;
|
Item.col = nColIdx;
|
strTemp.Format(_T("Connection Infomation")); //_T("¿¬°á Á¤º¸"));
|
Item.strText = strTemp;
|
m_ctrlGridAFMInfo.SetItem(&Item);
|
|
Item.row = nRowIdx++;
|
Item.col = nColIdx;
|
strTemp.Format(_T("Default Jog Speed (mm/s)")); //_T("±âº» Á¶±× ¼Óµµ"));
|
Item.strText = strTemp;
|
m_ctrlGridAFMInfo.SetItem(&Item);
|
|
Item.row = nRowIdx++;
|
Item.col = nColIdx;
|
strTemp.Format(_T("Maximum Jog Speed (mm/s)")); //_T("ÃÖ´ë Á¶±× ¼Óµµ"));
|
Item.strText = strTemp;
|
m_ctrlGridAFMInfo.SetItem(&Item);
|
|
Item.row = nRowIdx++;
|
Item.col = nColIdx;
|
strTemp.Format(_T("Minimum Jog Speed (mm/s)")); //_T("ÃÖ¼Ò Á¶±× ¼Óµµ"));
|
Item.strText = strTemp;
|
m_ctrlGridAFMInfo.SetItem(&Item);
|
|
m_ctrlGridAFMInfo.AutoSize();
|
}
|
|
void CDlgSystemAFM::FillAFMInfo()
|
{
|
ChangeAFMCountAFMInfoGridControl();
|
|
CReviewSystemSettingDlg* pDlg = (CReviewSystemSettingDlg*)AfxGetMainWnd();
|
if (pDlg==NULL) return;
|
|
CHeaderInfo *pHeaderInfo = pDlg->GetSys_HeaderInfo(m_nGantryIdx, m_nHeaderIdx);
|
if (pHeaderInfo==NULL) return;
|
|
CGridCellCombo* pCellCombo = NULL;
|
CStringArray strArrayOption;
|
CString strItemText = _T("");
|
|
int nColIdx = 1;
|
int nAFMCount = pHeaderInfo->GetAFMInfoCount();
|
|
for(int i=0; i<nAFMCount; i++)
|
{
|
int nRowIdx = 1;
|
|
CAfmControlInfo *pAFMInfo = pHeaderInfo->GetAFMInfo(i);
|
if (pAFMInfo==NULL) continue;
|
|
// 1. ÅäÅ» À妽º
|
strItemText.Format(_T("%d"), pAFMInfo->GetIndex());
|
m_ctrlGridAFMInfo.SetItemText(nRowIdx, nColIdx, strItemText);
|
|
// 2. AFM À̸§
|
nRowIdx++;
|
strItemText.Format(_T("%s"), pAFMInfo->GetName());
|
m_ctrlGridAFMInfo.SetItemText(nRowIdx, nColIdx, strItemText);
|
|
// 3. ÄÁÆ®·Ñ·¯ ŸÀÔ
|
nRowIdx++;
|
CGridCellCombo *pCellCombo = (CGridCellCombo*)m_ctrlGridAFMInfo.GetCell(nRowIdx, nColIdx);
|
if(pCellCombo)
|
{
|
strArrayOption.RemoveAll();
|
pCellCombo->GetOptions(strArrayOption);
|
|
if(strArrayOption.GetSize() > 0 && pAFMInfo->GetControllerType() > -1)
|
{
|
strItemText = strArrayOption.GetAt(pAFMInfo->GetControllerType());
|
m_ctrlGridAFMInfo.SetItemText(nRowIdx, nColIdx, strItemText);
|
}
|
}
|
|
// 4. ¿¬°á Á¤º¸
|
nRowIdx++;
|
m_ctrlGridAFMInfo.SetItemText(nRowIdx, nColIdx, pAFMInfo->GetConnectionPort());
|
|
// 5. ±âº» Á¶±× ¼Óµµ
|
nRowIdx++;
|
strItemText.Format(_T("%f"), pAFMInfo->GetDefaultJogSpeed());
|
m_ctrlGridAFMInfo.SetItemText(nRowIdx, nColIdx, strItemText);
|
|
// 6. ÃÖ´ë Á¶±× ¼Óµµ
|
nRowIdx++;
|
strItemText.Format(_T("%f"), pAFMInfo->GetMaxJogSpeed());
|
m_ctrlGridAFMInfo.SetItemText(nRowIdx, nColIdx, strItemText);
|
|
// 7. ÃÖ¼Ò Á¶±× ¼Óµµ
|
nRowIdx++;
|
strItemText.Format(_T("%f"), pAFMInfo->GetMinJogSpeed());
|
m_ctrlGridAFMInfo.SetItemText(nRowIdx, nColIdx, strItemText);
|
|
nColIdx++;
|
}
|
}
|
|
void CDlgSystemAFM::ResetAFMInfoGrid()
|
{
|
int i, j, nRowIdx, nColIdx;
|
CString strItemText;
|
CGridCellCheck* pCellCheck = NULL;
|
|
nRowIdx = 0;
|
nColIdx = 0;
|
strItemText = _T("");
|
|
for(i = 0; i < m_nAFMCount; i++)
|
{
|
nRowIdx = 1;
|
nColIdx++;
|
|
for(j = 0; j < AFM_INFO_GRID_ROW_COUNT - 1; j++)
|
{
|
m_ctrlGridAFMInfo.SetItemText(nRowIdx++, nColIdx, strItemText);
|
}
|
}
|
}
|
|
void CDlgSystemAFM::ChangeAFMCountAFMInfoGridControl()
|
{
|
int i, j, nRowIdx, nColIdx;
|
int nWidth, nMargin, nDataColumnWidth;
|
CString strTemp;
|
CRect rect;
|
|
m_ctrlGridAFMInfo.GetWindowRect(&rect);
|
m_ctrlGridAFMInfo.SetColumnCount(m_nAFMCount + 1);
|
nWidth = m_ctrlGridAFMInfo.GetColumnWidth(0);
|
|
nMargin = 5;
|
nDataColumnWidth = rect.Width() - nWidth - nMargin;
|
|
if(m_nAFMCount > 0)
|
{
|
GV_ITEM Item;
|
CStringArray strArrayOption;
|
CGridCellCombo* pCellCombo = NULL;
|
|
nColIdx = 1;
|
nDataColumnWidth = nDataColumnWidth / m_nAFMCount;
|
|
for(i = 0; i < m_nAFMCount; i++)
|
{
|
m_ctrlGridAFMInfo.SetColumnWidth(i + 1, nDataColumnWidth);
|
|
//AFM À妽º
|
nRowIdx = 0;
|
Item.mask = GVIF_TEXT;
|
Item.row = nRowIdx;
|
Item.col = nColIdx;
|
strTemp.Format(_T("%02d"), i);
|
Item.strText = strTemp;
|
m_ctrlGridAFMInfo.SetItem(&Item);
|
|
nRowIdx++;
|
nRowIdx++;
|
|
// 3. ÄÁÆ®·Ñ·¯ ŸÀÔ
|
nRowIdx++;
|
strArrayOption.RemoveAll();
|
|
for(j = 0; j < AfmController_Count; j++)
|
{
|
switch(j)
|
{
|
case AfmController_Wegu:
|
strTemp.Format(_T("Wegu AFM"));
|
break;
|
case AfmController_Dit:
|
strTemp.Format(_T("DIT AFM"));
|
break;
|
case AfmController_MsgLaf:
|
strTemp.Format(_T("MSG AFM"));
|
break;
|
case AfmController_Simulation:
|
strTemp.Format(_T("Simulation"));
|
break;
|
default:
|
strTemp.Format(_T(""));
|
break;
|
}
|
|
strArrayOption.Add(strTemp);
|
}
|
m_ctrlGridAFMInfo.SetCellType(nRowIdx, nColIdx, RUNTIME_CLASS(CGridCellCombo));
|
pCellCombo = (CGridCellCombo*)m_ctrlGridAFMInfo.GetCell(nRowIdx, nColIdx);
|
pCellCombo->SetOptions(strArrayOption);
|
pCellCombo->SetStyle(CBS_DROPDOWN);
|
|
nColIdx++;
|
}
|
}
|
}
|
|
void CDlgSystemAFM::UpdateDialogData(int nGantryIdx, int nHeaderIdx, int nAFMCount)
|
{
|
m_nGantryIdx = nGantryIdx;
|
m_nHeaderIdx = nHeaderIdx;
|
m_nAFMCount = nAFMCount;
|
|
UpdateData(FALSE);
|
FillAFMInfo();
|
m_ctrlGridAFMInfo.Invalidate(FALSE);
|
}
|
|
void CDlgSystemAFM::OnBnClickedButtonSysSystemAfmReset()
|
{
|
ResetAFMInfoGrid();
|
}
|
|
void CDlgSystemAFM::OnBnClickedButtonSysSystemAfmApply()
|
{
|
UpdateData(TRUE);
|
|
CReviewSystemSettingDlg* pDlg = (CReviewSystemSettingDlg*)AfxGetMainWnd();
|
if (pDlg==NULL) return;
|
|
CHeaderInfo *pHeaderInfo = pDlg->GetSys_HeaderInfo(m_nGantryIdx, m_nHeaderIdx);
|
if (pHeaderInfo==NULL) return;
|
|
CStringArray strArrayOption;
|
CString strItemText = _T("");
|
int nColIdx = 1;
|
int nRevolverCount = pHeaderInfo->GetAFMInfoCount();
|
|
for(int i=0; i<nRevolverCount; i++)
|
{
|
int nRowIdx = 1;
|
CAfmControlInfo* pAFMInfo = pHeaderInfo->GetAFMInfo(i);
|
pAFMInfo->Reset();
|
|
// 1. ÅäÅ» À妽º
|
strItemText = m_ctrlGridAFMInfo.GetItemText(nRowIdx, nColIdx);
|
pAFMInfo->SetIndex(_ttoi(strItemText));
|
|
// 2. AFM À̸§
|
nRowIdx++;
|
strItemText = m_ctrlGridAFMInfo.GetItemText(nRowIdx, nColIdx);
|
pAFMInfo->SetName(strItemText);
|
|
// 3. ÄÁÆ®·Ñ·¯ ŸÀÔ
|
nRowIdx++;
|
CGridCellCombo *pCellCombo = (CGridCellCombo*)m_ctrlGridAFMInfo.GetCell(nRowIdx, nColIdx);
|
if(pCellCombo)
|
{
|
strArrayOption.RemoveAll();
|
strItemText = pCellCombo->GetText();
|
pCellCombo->GetOptions(strArrayOption);
|
int nArrayCount = (int)strArrayOption.GetCount();
|
for(int j=0; j<nArrayCount; j++)
|
{
|
CString strTemp = strArrayOption.GetAt(j);
|
if(strTemp.Compare(strItemText) == 0)
|
{
|
pAFMInfo->SetControllerType(j);
|
break;
|
}
|
}
|
}
|
|
// 4. ¿¬°á Á¤º¸
|
nRowIdx++;
|
strItemText = m_ctrlGridAFMInfo.GetItemText(nRowIdx, nColIdx);
|
pAFMInfo->SetConnectionPort(strItemText);
|
|
// 5. ±âº» Á¶±× ¼Óµµ
|
nRowIdx++;
|
strItemText = m_ctrlGridAFMInfo.GetItemText(nRowIdx, nColIdx);
|
pAFMInfo->SetDefaultJogSpeed(_ttoi(strItemText));
|
|
// 6. ÃÖ´ë Á¶±× ¼Óµµ
|
nRowIdx++;
|
strItemText = m_ctrlGridAFMInfo.GetItemText(nRowIdx, nColIdx);
|
pAFMInfo->SetMaxJogSpeed(_ttof(strItemText));
|
|
// 7. ÃÖ¼Ò Á¶±× ¼Óµµ
|
nRowIdx++;
|
strItemText = m_ctrlGridAFMInfo.GetItemText(nRowIdx, nColIdx);
|
pAFMInfo->SetMinJogSpeed(_ttof(strItemText));
|
|
nColIdx++;
|
}
|
}
|
|
BOOL CDlgSystemAFM::OnInitDialog()
|
{
|
CDialog::OnInitDialog();
|
|
// TODO: ¿©±â¿¡ Ãß°¡ ÃʱâÈ ÀÛ¾÷À» Ãß°¡ÇÕ´Ï´Ù.
|
InitAFMInfoGridControl();
|
FillAFMInfo();
|
|
return TRUE; // return TRUE unless you set the focus to a control
|
// ¿¹¿Ü: OCX ¼Ó¼º ÆäÀÌÁö´Â FALSE¸¦ ¹ÝÈ¯ÇØ¾ß ÇÕ´Ï´Ù.
|
}
|