// DlgSystemGantry.cpp : ±¸Çö ÆÄÀÏÀÔ´Ï´Ù.
|
//
|
|
#include "stdafx.h"
|
#include "ReviewSystemSetting.h"
|
#include "DlgSystemGantry.h"
|
#include "ReviewSystemSettingDlg.h"
|
#include "CHCommonControls/GridCellCombo.h"
|
#include "CHCommonControls/GridCellCheck.h"
|
#include "CHReviewSetting/GantryInfo.h"
|
|
|
|
// CDlgSystemGantry ´ëÈ »óÀÚÀÔ´Ï´Ù.
|
|
IMPLEMENT_DYNAMIC(CDlgSystemGantry, CDialog)
|
|
CDlgSystemGantry::CDlgSystemGantry(CWnd* pParent /*=NULL*/)
|
: CDialog(CDlgSystemGantry::IDD, pParent)
|
, m_nGantryIdx(0)
|
, m_nHeaderIdx(0)
|
{
|
|
}
|
|
CDlgSystemGantry::~CDlgSystemGantry()
|
{
|
}
|
|
void CDlgSystemGantry::DoDataExchange(CDataExchange* pDX)
|
{
|
CDialog::DoDataExchange(pDX);
|
DDX_Control(pDX, IDC_GRID_SYSTEM_GANTRY_INFO, m_ctrlGridGantryInfo);
|
DDX_Text(pDX, IDC_EDIT_SYS_SG_GANTRY_IDX, m_nGantryIdx);
|
DDX_Text(pDX, IDC_EDIT_SYS_SG_HEADER_IDX, m_nHeaderIdx);
|
}
|
|
|
BEGIN_MESSAGE_MAP(CDlgSystemGantry, CDialog)
|
ON_BN_CLICKED(IDC_BUTTON_SYS_SYSTEM_GANTRY_RESET, &CDlgSystemGantry::OnBnClickedButtonSysSystemGantryReset)
|
ON_BN_CLICKED(IDC_BUTTON_SYS_SYSTEM_GANTRY_APPLY, &CDlgSystemGantry::OnBnClickedButtonSysSystemGantryApply)
|
END_MESSAGE_MAP()
|
|
|
// CDlgSystemGantry ¸Þ½ÃÁö 󸮱âÀÔ´Ï´Ù.
|
|
BOOL CDlgSystemGantry::OnInitDialog()
|
{
|
CDialog::OnInitDialog();
|
|
// TODO: ¿©±â¿¡ Ãß°¡ ÃʱâÈ ÀÛ¾÷À» Ãß°¡ÇÕ´Ï´Ù.
|
InitGantryInfoGridControl();
|
FillGantryInfo();
|
|
return TRUE; // return TRUE unless you set the focus to a control
|
// ¿¹¿Ü: OCX ¼Ó¼º ÆäÀÌÁö´Â FALSE¸¦ ¹ÝÈ¯ÇØ¾ß ÇÕ´Ï´Ù.
|
}
|
|
BOOL CDlgSystemGantry::PreTranslateMessage(MSG* pMsg)
|
{
|
// TODO: ¿©±â¿¡ Ư¼öÈµÈ Äڵ带 Ãß°¡ ¹×/¶Ç´Â ±âº» Ŭ·¡½º¸¦ È£ÃâÇÕ´Ï´Ù.
|
if( pMsg->message == WM_KEYDOWN )
|
{
|
if(pMsg->wParam == VK_RETURN || pMsg->wParam == VK_ESCAPE )
|
{
|
::TranslateMessage(pMsg);
|
::DispatchMessage(pMsg);
|
return TRUE;
|
}
|
}
|
|
return CDialog::PreTranslateMessage(pMsg);
|
}
|
|
void CDlgSystemGantry::OnBnClickedButtonSysSystemGantryReset()
|
{
|
// TODO: ¿©±â¿¡ ÄÁÆ®·Ñ ¾Ë¸² 󸮱â Äڵ带 Ãß°¡ÇÕ´Ï´Ù.
|
int nRowIdx, nColIdx;
|
CString strItemText = _T("");
|
|
nRowIdx = 0;
|
nColIdx = 1;
|
|
//1. ±âÁØ °ÕÆ®¸®
|
CGridCellCheck *pCellCheck = (CGridCellCheck*)m_ctrlGridGantryInfo.GetCell(nRowIdx, nColIdx);
|
if(pCellCheck)
|
{
|
pCellCheck->SetCheck(FALSE);
|
}
|
|
//2. °ÕÆ®¸® ŸÀÔ
|
nRowIdx++;
|
strItemText = _T("");
|
m_ctrlGridGantryInfo.SetItemText(nRowIdx, nColIdx, strItemText);
|
|
//3. XÃà À̸§
|
nRowIdx++;
|
m_ctrlGridGantryInfo.SetItemText(nRowIdx, nColIdx, strItemText);
|
|
//3. Ãæµ¹ °Å¸®
|
nRowIdx++;
|
m_ctrlGridGantryInfo.SetItemText(nRowIdx, nColIdx, strItemText);
|
}
|
|
void CDlgSystemGantry::OnBnClickedButtonSysSystemGantryApply()
|
{
|
// TODO: ¿©±â¿¡ ÄÁÆ®·Ñ ¾Ë¸² 󸮱â Äڵ带 Ãß°¡ÇÕ´Ï´Ù.
|
UpdateData(TRUE);
|
CReviewSystemSettingDlg* pDlg = (CReviewSystemSettingDlg*)AfxGetMainWnd();
|
if (pDlg==NULL) return;
|
|
CGantryInfo *pGantryInfo = pDlg->GetSys_GantryInfo(m_nGantryIdx);
|
if (pGantryInfo==NULL) return;
|
|
|
int nRowIdx = 0;
|
int nColIdx = 1;
|
|
//1. ±âÁØ °ÕÆ®¸®
|
CGridCellCheck *pCellCheck = (CGridCellCheck*)m_ctrlGridGantryInfo.GetCell(nRowIdx, nColIdx);
|
if(pCellCheck)
|
{
|
pGantryInfo->m_bStandardGantry = pCellCheck->GetCheck();
|
}
|
|
//2. °ÕÆ®¸® ŸÀÔ
|
nRowIdx++;
|
CGridCellCombo *pCellCombo = (CGridCellCombo*)m_ctrlGridGantryInfo.GetCell(nRowIdx, nColIdx);
|
if(pCellCombo)
|
{
|
CStringArray strArrayOption;
|
CString strItemText = pCellCombo->GetText();
|
pCellCombo->GetOptions(strArrayOption);
|
int nArrayCount = (int)strArrayOption.GetCount();
|
for(int i=0; i<nArrayCount; i++)
|
{
|
CString strTemp = strArrayOption.GetAt(i);
|
if(strTemp.Compare(strItemText) == 0)
|
{
|
pGantryInfo->m_nGantryType = i;
|
break;
|
}
|
}
|
}
|
|
//3. XÃà À̸§
|
nRowIdx++;
|
CString strItemText = m_ctrlGridGantryInfo.GetItemText(nRowIdx, nColIdx);
|
pGantryInfo->m_strXAxisName = strItemText;
|
|
//4. Ãæµ¹ °Å¸®
|
nRowIdx++;
|
strItemText = m_ctrlGridGantryInfo.GetItemText(nRowIdx, nColIdx);
|
pGantryInfo->m_dCollisionDistance = _ttof(strItemText);
|
|
//pGantryInfo->SetHeaderInfoCount(1);
|
}
|
|
void CDlgSystemGantry::InitGantryInfoGridControl()
|
{
|
int i, nRowIdx, nColIdx, nRows, nCols, nFixRows, nFixCols, nMargin;
|
CString strTemp;
|
CRect rect;
|
|
nRows = SYSTEM_GANTRY_INFO_GRID_ROW_COUNT;
|
nCols = SYSTEM_GANTRY_INFO_GRID_COL_COUNT;
|
nFixRows = 0;
|
nFixCols = 1;
|
nRowIdx = 0;
|
nColIdx = 0;
|
nMargin = 5;
|
|
m_ctrlGridGantryInfo.GetWindowRect(&rect);
|
m_ctrlGridGantryInfo.GetDefaultCell(FALSE, FALSE)->SetBackClr(RGB(0xFF, 0xFF, 0xE0));
|
m_ctrlGridGantryInfo.SetRowCount(nRows);
|
m_ctrlGridGantryInfo.SetColumnCount(nCols);
|
m_ctrlGridGantryInfo.SetFixedRowCount(nFixRows);
|
m_ctrlGridGantryInfo.SetFixedColumnCount(nFixCols);
|
m_ctrlGridGantryInfo.SetColumnWidth(nColIdx++, 200);
|
m_ctrlGridGantryInfo.SetColumnWidth(nColIdx++, rect.Width() - nMargin - 200);
|
|
GV_ITEM Item;
|
CStringArray strArrayOption;
|
CGridCellCombo* pCellCombo = NULL;
|
|
nColIdx = 0;
|
Item.mask = GVIF_TEXT;
|
Item.row = nRowIdx;
|
Item.col = nColIdx;
|
strTemp.Format(_T("Standard Gantry"));//_T("±âÁØ °ÕÆ®¸®"));
|
Item.strText = strTemp;
|
m_ctrlGridGantryInfo.SetItem(&Item);
|
|
nRowIdx++;
|
Item.row = nRowIdx;
|
Item.col = nColIdx;
|
strTemp.Format(_T("Gantry Type"));//_T("°ÕÆ®¸® ŸÀÔ"));
|
Item.strText = strTemp;
|
m_ctrlGridGantryInfo.SetItem(&Item);
|
|
nRowIdx++;
|
Item.row = nRowIdx;
|
Item.col = nColIdx;
|
strTemp.Format(_T("X Axis Name"));//_T("XÃà À̸§"));
|
Item.strText = strTemp;
|
m_ctrlGridGantryInfo.SetItem(&Item);
|
|
nRowIdx++;
|
Item.row = nRowIdx;
|
Item.col = nColIdx;
|
strTemp.Format(_T("Collision Distance (mm)"));//_T("Ãæµ¹ °Å¸®(mm)"));
|
Item.strText = strTemp;
|
m_ctrlGridGantryInfo.SetItem(&Item);
|
|
//±âÁØ °ÕÆ®¸®
|
nRowIdx = 0;
|
nColIdx = 1;
|
Item.strText = _T("");
|
m_ctrlGridGantryInfo.SetCellType(nRowIdx, nColIdx, RUNTIME_CLASS(CGridCellCheck));
|
m_ctrlGridGantryInfo.SetItemState(nRowIdx, nColIdx, m_ctrlGridGantryInfo.GetItemState(nRowIdx, nColIdx) | GVIS_READONLY);
|
|
//°ÕÆ®¸® ŸÀÔ
|
nRowIdx++;
|
strArrayOption.RemoveAll();
|
for(i = 0; i < GANTRY_TYPE_COUNT; i++)
|
{
|
switch(i)
|
{
|
case GANTRY_TYPE_LEFT:
|
strTemp.Format(_T("Left Gantry"));
|
break;
|
case GANTRY_TYPE_RIGHT:
|
strTemp.Format(_T("Right Gantry"));
|
break;
|
case GANTRY_TYPE_SINGLE:
|
strTemp.Format(_T("Single Gantry"));
|
break;
|
default:
|
strTemp.Format(_T(""));
|
break;
|
}
|
|
strArrayOption.Add(strTemp);
|
}
|
m_ctrlGridGantryInfo.SetCellType(nRowIdx, nColIdx, RUNTIME_CLASS(CGridCellCombo));
|
pCellCombo = (CGridCellCombo*)m_ctrlGridGantryInfo.GetCell(nRowIdx, nColIdx);
|
pCellCombo->SetOptions(strArrayOption);
|
pCellCombo->SetStyle(CBS_DROPDOWN);
|
}
|
|
void CDlgSystemGantry::FillGantryInfo()
|
{
|
CReviewSystemSettingDlg* pDlg = (CReviewSystemSettingDlg*)AfxGetMainWnd();
|
if (pDlg==NULL) return;
|
|
CGantryInfo *pGantryInfo = pDlg->GetSys_GantryInfo(m_nGantryIdx);
|
if (pGantryInfo==NULL) return;
|
|
int nRowIdx = 0;
|
int nColIdx = 1;
|
|
//1. ±âÁØ °ÕÆ®¸®
|
CGridCellCheck *pCellCheck = (CGridCellCheck*)m_ctrlGridGantryInfo.GetCell(nRowIdx, nColIdx);
|
if(pCellCheck)
|
{
|
pCellCheck->SetCheck(pGantryInfo->m_bStandardGantry);
|
}
|
|
//2. °ÕÆ®¸® ŸÀÔ
|
nRowIdx++;
|
CStringArray strArrayOption;
|
CGridCellCombo *pCellCombo = (CGridCellCombo*)m_ctrlGridGantryInfo.GetCell(nRowIdx, nColIdx);
|
if(pCellCombo)
|
{
|
strArrayOption.RemoveAll();
|
pCellCombo->GetOptions(strArrayOption);
|
if(strArrayOption.GetSize() > 0 && pGantryInfo->m_nGantryType > -1)
|
{
|
CString strItemText = strArrayOption.GetAt(pGantryInfo->m_nGantryType);
|
m_ctrlGridGantryInfo.SetItemText(nRowIdx, nColIdx, strItemText);
|
}
|
}
|
|
//3. XÃà À̸§
|
nRowIdx++;
|
m_ctrlGridGantryInfo.SetItemText(nRowIdx, nColIdx, pGantryInfo->m_strXAxisName);
|
|
//4. Ãæµ¹ °Å¸®
|
nRowIdx++;
|
CString strTemp = _T("");
|
strTemp.Format(_T("%0.2lf"), pGantryInfo->m_dCollisionDistance);
|
m_ctrlGridGantryInfo.SetItemText(nRowIdx, nColIdx, strTemp);
|
|
}
|
|
void CDlgSystemGantry::UpdateDialogData(int nGantryIdx, int nHeaderIdx)
|
{
|
m_nGantryIdx = nGantryIdx;
|
m_nHeaderIdx = nHeaderIdx;
|
UpdateData(FALSE);
|
FillGantryInfo();
|
m_ctrlGridGantryInfo.Invalidate(FALSE);
|
}
|