|
// ReviewSystemSettingDlg.cpp : ±¸Çö ÆÄÀÏ
|
//
|
|
#include "stdafx.h"
|
#include "ReviewSystemSetting.h"
|
#include "ReviewSystemSettingDlg.h"
|
|
|
//#include "afxcmn.h"
|
#include "DlgSystem.h"
|
#include "DlgGlassType.h"
|
#include "DlgAlign.h"
|
#include "DlgSignal.h"
|
#include "DlgMotor.h"
|
#include "DlgNetwork.h"
|
|
#include "CHReviewSetting/Sys_SystemManager.h"
|
#include "CHReviewSetting/Sys_GlassTypeManager.h"
|
#include "CHReviewSetting/Sys_AlignManager.h"
|
#include "CHReviewSetting/Sys_SignalManager.h"
|
#include "CHReviewSetting/Sys_MotorManager.h"
|
#include "CHReviewSetting/Sys_NetworkManager.h"
|
#include "CHCommonClasses/MacroFile.h"
|
#include "DisplayMessage.h"
|
|
|
|
#ifdef _DEBUG
|
#define new DEBUG_NEW
|
#endif
|
|
|
// ÀÀ¿ë ÇÁ·Î±×·¥ Á¤º¸¿¡ »ç¿ëµÇ´Â CAboutDlg ´ëÈ »óÀÚÀÔ´Ï´Ù.
|
|
class CAboutDlg : public CDialog
|
{
|
public:
|
CAboutDlg();
|
|
// ´ëÈ »óÀÚ µ¥ÀÌÅÍÀÔ´Ï´Ù.
|
enum { IDD = IDD_ABOUTBOX };
|
|
protected:
|
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV Áö¿øÀÔ´Ï´Ù.
|
|
// ±¸ÇöÀÔ´Ï´Ù.
|
protected:
|
DECLARE_MESSAGE_MAP()
|
};
|
|
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
|
{
|
}
|
|
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
|
{
|
CDialog::DoDataExchange(pDX);
|
}
|
|
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
|
END_MESSAGE_MAP()
|
|
|
// CReviewSystemSettingDlg ´ëÈ »óÀÚ
|
|
|
|
|
CReviewSystemSettingDlg::CReviewSystemSettingDlg(CWnd* pParent /*=NULL*/)
|
: CDialog(CReviewSystemSettingDlg::IDD, pParent)
|
{
|
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
|
|
m_pDlgSystem = NULL;
|
m_pDlgGlassType = NULL;
|
m_pDlgAlign = NULL;
|
m_pDlgSignal = NULL;
|
m_pDlgMotor = NULL;
|
m_pDlgNetwork = NULL;
|
|
m_pSystemManager = NULL;
|
m_pGlassTypeManager = NULL;
|
m_pAlignManager = NULL;
|
m_pSignalManager = NULL;
|
m_pMotorManager = NULL;
|
m_pNetworkManager = NULL;
|
|
// init Log
|
new CDisplayMessage(_T("C:\\DIT_Review\\ReviewServerConfig\\Log"));
|
}
|
|
CReviewSystemSettingDlg::~CReviewSystemSettingDlg()
|
{
|
if(m_pDlgSystem)
|
{
|
delete m_pDlgSystem;
|
m_pDlgSystem = NULL;
|
}
|
|
if(m_pDlgGlassType)
|
{
|
delete m_pDlgGlassType;
|
m_pDlgGlassType = NULL;
|
}
|
|
if(m_pDlgAlign)
|
{
|
delete m_pDlgAlign;
|
m_pDlgAlign = NULL;
|
}
|
|
if(m_pDlgSignal)
|
{
|
delete m_pDlgSignal;
|
m_pDlgSignal = NULL;
|
}
|
|
if(m_pDlgMotor)
|
{
|
delete m_pDlgMotor;
|
m_pDlgMotor = NULL;
|
}
|
|
if(m_pDlgNetwork)
|
{
|
delete m_pDlgNetwork;
|
m_pDlgNetwork = NULL;
|
}
|
|
if(m_pSystemManager)
|
{
|
delete m_pSystemManager;
|
m_pSystemManager = NULL;
|
}
|
|
if(m_pGlassTypeManager)
|
{
|
delete m_pGlassTypeManager;
|
m_pGlassTypeManager = NULL;
|
}
|
|
if(m_pAlignManager)
|
{
|
delete m_pAlignManager;
|
m_pAlignManager = NULL;
|
}
|
|
if(m_pSignalManager)
|
{
|
delete m_pSignalManager;
|
m_pSignalManager = NULL;
|
}
|
|
if(m_pMotorManager)
|
{
|
delete m_pMotorManager;
|
m_pMotorManager = NULL;
|
}
|
|
if(m_pNetworkManager)
|
{
|
delete m_pNetworkManager;
|
m_pNetworkManager = NULL;
|
}
|
}
|
|
void CReviewSystemSettingDlg::DoDataExchange(CDataExchange* pDX)
|
{
|
CDialog::DoDataExchange(pDX);
|
DDX_Control(pDX, IDC_TAB_SYS_SETTING_MAIN_TAB, m_ctrlTabMain);
|
}
|
|
BEGIN_MESSAGE_MAP(CReviewSystemSettingDlg, CDialog)
|
ON_WM_SYSCOMMAND()
|
ON_WM_PAINT()
|
ON_WM_QUERYDRAGICON()
|
//}}AFX_MSG_MAP
|
ON_NOTIFY(TCN_SELCHANGE, IDC_TAB_SYS_SETTING_MAIN_TAB, &CReviewSystemSettingDlg::OnTcnSelchangeTabSysSettingMainTab)
|
ON_BN_CLICKED(IDC_BUTTON_SYS_SETTING_SAVE, &CReviewSystemSettingDlg::OnBnClickedButtonSysSettingSave)
|
ON_BN_CLICKED(IDCANCEL, &CReviewSystemSettingDlg::OnBnClickedCancel)
|
ON_WM_COPYDATA()
|
ON_BN_CLICKED(IDC_BUTTON_SIMULATION, &CReviewSystemSettingDlg::OnBnClickedButtonSimulation)
|
|
END_MESSAGE_MAP()
|
|
|
// CReviewSystemSettingDlg ¸Þ½ÃÁö 󸮱â
|
|
BOOL CReviewSystemSettingDlg::OnInitDialog()
|
{
|
CDialog::OnInitDialog();
|
|
// ½Ã½ºÅÛ ¸Þ´º¿¡ "Á¤º¸..." ¸Þ´º Ç׸ñÀ» Ãß°¡ÇÕ´Ï´Ù.
|
|
// IDM_ABOUTBOX´Â ½Ã½ºÅÛ ¸í·É ¹üÀ§¿¡ ÀÖ¾î¾ß ÇÕ´Ï´Ù.
|
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
|
ASSERT(IDM_ABOUTBOX < 0xF000);
|
|
CMenu* pSysMenu = GetSystemMenu(FALSE);
|
if (pSysMenu != NULL)
|
{
|
BOOL bNameValid;
|
CString strAboutMenu;
|
bNameValid = strAboutMenu.LoadString(IDS_ABOUTBOX);
|
ASSERT(bNameValid);
|
if (!strAboutMenu.IsEmpty())
|
{
|
pSysMenu->AppendMenu(MF_SEPARATOR);
|
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
|
}
|
}
|
|
// ÀÌ ´ëÈ »óÀÚÀÇ ¾ÆÀÌÄÜÀ» ¼³Á¤ÇÕ´Ï´Ù. ÀÀ¿ë ÇÁ·Î±×·¥ÀÇ ÁÖ Ã¢ÀÌ ´ëÈ »óÀÚ°¡ ¾Æ´Ò °æ¿ì¿¡´Â
|
// ÇÁ·¹ÀÓ¿öÅ©°¡ ÀÌ ÀÛ¾÷À» ÀÚµ¿À¸·Î ¼öÇàÇÕ´Ï´Ù.
|
SetIcon(m_hIcon, TRUE); // Å« ¾ÆÀÌÄÜÀ» ¼³Á¤ÇÕ´Ï´Ù.
|
SetIcon(m_hIcon, FALSE); // ÀÛÀº ¾ÆÀÌÄÜÀ» ¼³Á¤ÇÕ´Ï´Ù.
|
|
// TODO: ¿©±â¿¡ Ãß°¡ ÃʱâÈ ÀÛ¾÷À» Ãß°¡ÇÕ´Ï´Ù.
|
CreateReviewDirectory();
|
CreateManager();
|
ReadReviewSystemConfigFile();
|
CreateTabDlg();
|
InitTabControl();
|
|
g_pLog->DisplayMessage(_T("SystemSetting is Started!"));
|
|
return TRUE; // Æ÷Ä¿½º¸¦ ÄÁÆ®·Ñ¿¡ ¼³Á¤ÇÏÁö ¾ÊÀ¸¸é TRUE¸¦ ¹ÝȯÇÕ´Ï´Ù.
|
}
|
|
void CReviewSystemSettingDlg::OnSysCommand(UINT nID, LPARAM lParam)
|
{
|
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
|
{
|
CAboutDlg dlgAbout;
|
dlgAbout.DoModal();
|
}
|
else
|
{
|
CDialog::OnSysCommand(nID, lParam);
|
}
|
}
|
|
// ´ëÈ »óÀÚ¿¡ ÃÖ¼ÒÈ ´ÜÃ߸¦ Ãß°¡ÇÒ °æ¿ì ¾ÆÀÌÄÜÀ» ±×¸®·Á¸é
|
// ¾Æ·¡ Äڵ尡 ÇÊ¿äÇÕ´Ï´Ù. ¹®¼/ºä ¸ðµ¨À» »ç¿ëÇÏ´Â MFC ÀÀ¿ë ÇÁ·Î±×·¥ÀÇ °æ¿ì¿¡´Â
|
// ÇÁ·¹ÀÓ¿öÅ©¿¡¼ ÀÌ ÀÛ¾÷À» ÀÚµ¿À¸·Î ¼öÇàÇÕ´Ï´Ù.
|
|
void CReviewSystemSettingDlg::OnPaint()
|
{
|
if (IsIconic())
|
{
|
CPaintDC dc(this); // ±×¸®±â¸¦ À§ÇÑ µð¹ÙÀ̽º ÄÁÅØ½ºÆ®
|
|
SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(dc.GetSafeHdc()), 0);
|
|
// Ŭ¶óÀÌ¾ðÆ® »ç°¢Çü¿¡¼ ¾ÆÀÌÄÜÀ» °¡¿îµ¥¿¡ ¸ÂÃä´Ï´Ù.
|
int cxIcon = GetSystemMetrics(SM_CXICON);
|
int cyIcon = GetSystemMetrics(SM_CYICON);
|
CRect rect;
|
GetClientRect(&rect);
|
int x = (rect.Width() - cxIcon + 1) / 2;
|
int y = (rect.Height() - cyIcon + 1) / 2;
|
|
// ¾ÆÀÌÄÜÀ» ±×¸³´Ï´Ù.
|
dc.DrawIcon(x, y, m_hIcon);
|
}
|
else
|
{
|
CDialog::OnPaint();
|
}
|
}
|
|
// »ç¿ëÀÚ°¡ ÃÖ¼ÒÈµÈ Ã¢À» ²ô´Â µ¿¾È¿¡ Ä¿¼°¡ Ç¥½ÃµÇµµ·Ï ½Ã½ºÅÛ¿¡¼
|
// ÀÌ ÇÔ¼ö¸¦ È£ÃâÇÕ´Ï´Ù.
|
HCURSOR CReviewSystemSettingDlg::OnQueryDragIcon()
|
{
|
return static_cast<HCURSOR>(m_hIcon);
|
}
|
|
|
void CReviewSystemSettingDlg::OnTcnSelchangeTabSysSettingMainTab(NMHDR *pNMHDR, LRESULT *pResult)
|
{
|
// TODO: ¿©±â¿¡ ÄÁÆ®·Ñ ¾Ë¸² 󸮱â Äڵ带 Ãß°¡ÇÕ´Ï´Ù.
|
SystemMainTab nTabIdx;
|
|
nTabIdx = (SystemMainTab)m_ctrlTabMain.GetCurSel();
|
|
switch(nTabIdx)
|
{
|
case SYSTEM:
|
m_pDlgSystem->ShowWindow(SW_SHOW);
|
m_pDlgGlassType->ShowWindow(SW_HIDE);
|
m_pDlgAlign->ShowWindow(SW_HIDE);
|
m_pDlgSignal->ShowWindow(SW_HIDE);
|
m_pDlgMotor->ShowWindow(SW_HIDE);
|
m_pDlgNetwork->ShowWindow(SW_HIDE);
|
break;
|
case GLASS_TYPE:
|
m_pDlgSystem->ShowWindow(SW_HIDE);
|
m_pDlgGlassType->ShowWindow(SW_SHOW);
|
m_pDlgAlign->ShowWindow(SW_HIDE);
|
m_pDlgSignal->ShowWindow(SW_HIDE);
|
m_pDlgMotor->ShowWindow(SW_HIDE);
|
m_pDlgNetwork->ShowWindow(SW_HIDE);
|
break;
|
case ALIGN:
|
m_pDlgSystem->ShowWindow(SW_HIDE);
|
m_pDlgGlassType->ShowWindow(SW_HIDE);
|
m_pDlgAlign->ShowWindow(SW_SHOW);
|
m_pDlgSignal->ShowWindow(SW_HIDE);
|
m_pDlgMotor->ShowWindow(SW_HIDE);
|
m_pDlgNetwork->ShowWindow(SW_HIDE);
|
break;
|
case SIGNAL:
|
m_pDlgSystem->ShowWindow(SW_HIDE);
|
m_pDlgGlassType->ShowWindow(SW_HIDE);
|
m_pDlgAlign->ShowWindow(SW_HIDE);
|
m_pDlgSignal->ShowWindow(SW_SHOW);
|
m_pDlgMotor->ShowWindow(SW_HIDE);
|
m_pDlgNetwork->ShowWindow(SW_HIDE);
|
break;
|
case MOTOR:
|
m_pDlgSystem->ShowWindow(SW_HIDE);
|
m_pDlgGlassType->ShowWindow(SW_HIDE);
|
m_pDlgAlign->ShowWindow(SW_HIDE);
|
m_pDlgSignal->ShowWindow(SW_HIDE);
|
m_pDlgMotor->ShowWindow(SW_SHOW);
|
m_pDlgNetwork->ShowWindow(SW_HIDE);
|
break;
|
case NETWORK:
|
m_pDlgSystem->ShowWindow(SW_HIDE);
|
m_pDlgGlassType->ShowWindow(SW_HIDE);
|
m_pDlgAlign->ShowWindow(SW_HIDE);
|
m_pDlgSignal->ShowWindow(SW_HIDE);
|
m_pDlgMotor->ShowWindow(SW_HIDE);
|
m_pDlgNetwork->ShowWindow(SW_SHOW);
|
break;
|
default:
|
break;
|
}
|
|
*pResult = 0;
|
}
|
|
void CReviewSystemSettingDlg::CreateReviewDirectory()
|
{
|
CreateDirectory(_REVIEW_SERVER_BASE_PATH_, NULL);
|
CreateDirectory(_REVIEW_SERVER_CONFIG_PATH_, NULL);
|
}
|
|
void CReviewSystemSettingDlg::CreateManager()
|
{
|
m_pSystemManager = new CSys_SystemManager;
|
m_pGlassTypeManager = new CSys_GlassTypeManager;
|
m_pAlignManager = new CSys_AlignManager;
|
m_pSignalManager = new CSys_SignalManager;
|
m_pMotorManager = new CSys_MotorManager;
|
m_pNetworkManager = new CSys_NetworkManager;
|
}
|
|
void CReviewSystemSettingDlg::CreateTabDlg()
|
{
|
CRect rtCtrl;
|
|
m_ctrlTabMain.GetWindowRect(&rtCtrl);
|
ScreenToClient(&rtCtrl);
|
|
rtCtrl.DeflateRect(2, 22, 3, 2);
|
|
m_pDlgSystem = new CDlgSystem;
|
m_pDlgSystem->Create(CDlgSystem::IDD, this);
|
m_pDlgSystem->MoveWindow(rtCtrl);
|
m_pDlgSystem->ShowWindow(SW_SHOW);
|
|
m_pDlgGlassType = new CDlgGlassType;
|
m_pDlgGlassType->Create(CDlgGlassType::IDD, this);
|
m_pDlgGlassType->MoveWindow(rtCtrl);
|
|
m_pDlgAlign = new CDlgAlign;
|
m_pDlgAlign->Create(CDlgAlign::IDD, this);
|
m_pDlgAlign->MoveWindow(rtCtrl);
|
|
m_pDlgSignal = new CDlgSignal;
|
m_pDlgSignal->Create(CDlgSignal::IDD, this);
|
m_pDlgSignal->MoveWindow(rtCtrl);
|
|
m_pDlgMotor = new CDlgMotor;
|
m_pDlgMotor->Create(CDlgMotor::IDD, this);
|
m_pDlgMotor->MoveWindow(rtCtrl);
|
|
m_pDlgNetwork = new CDlgNetwork;
|
m_pDlgNetwork->Create(CDlgNetwork::IDD, this);
|
m_pDlgNetwork->MoveWindow(rtCtrl);
|
m_pDlgNetwork->SetDlgSystemCamera(m_pDlgSystem->GetDlgSystemCamera());
|
}
|
|
void CReviewSystemSettingDlg::InitTabControl()
|
{
|
int nIdx = 0;
|
m_ctrlTabMain.InsertItem(nIdx++, _T("Equipment Setting"));//_T("Àåºñ ¼³Á¤"));
|
m_ctrlTabMain.InsertItem(nIdx++, _T("Glass Type Setting"));//_T("±Û¶ó½º ŸÀÔ ¼³Á¤"));
|
m_ctrlTabMain.InsertItem(nIdx++, _T("Align Setting"));//_T("¾ó¶óÀÎ ¼³Á¤"));
|
m_ctrlTabMain.InsertItem(nIdx++, _T("Signal Setting"));//_T("Signal ¼³Á¤"));
|
m_ctrlTabMain.InsertItem(nIdx++, _T("Motor Setting"));//_T("¸ðÅÍ ¼³Á¤"));
|
m_ctrlTabMain.InsertItem(nIdx++, _T("Network Setting"));//_T("³×Æ®¿öÅ© ¼³Á¤"));
|
}
|
|
BOOL CReviewSystemSettingDlg::ReadReviewSystemConfigFile()
|
{
|
BOOL bReturn = TRUE;
|
CString strPath;
|
|
strPath = _REVIEW_SERVER_SYSTEM_SETTING_FILE_PATH_;
|
|
CMacroFile macroFile;
|
macroFile.Clear();
|
|
if (FALSE == macroFile.Read(strPath))
|
{
|
bReturn = FALSE;
|
}
|
else
|
{
|
if(m_pSystemManager)
|
{
|
m_pSystemManager->GetProfile(macroFile);
|
}
|
|
if(m_pGlassTypeManager)
|
{
|
m_pGlassTypeManager->GetProfile(macroFile);
|
}
|
|
if(m_pAlignManager)
|
{
|
m_pAlignManager->GetProfile(macroFile);
|
}
|
|
if(m_pSignalManager)
|
{
|
m_pSignalManager->GetProfile(macroFile);
|
}
|
|
if(m_pMotorManager)
|
{
|
m_pMotorManager->GetProfile(macroFile);
|
}
|
|
if(m_pNetworkManager)
|
{
|
m_pNetworkManager->GetProfile(macroFile);
|
}
|
}
|
return bReturn;
|
}
|
|
BOOL CReviewSystemSettingDlg::WriteReviewSystemConfigFile()
|
{
|
BOOL bReturn = TRUE;
|
CString strPath;
|
CMacroFile macroFile;
|
macroFile.Clear();
|
|
if(m_pSystemManager)
|
{
|
m_pSystemManager->SetProfile(macroFile);
|
}
|
|
if(m_pGlassTypeManager)
|
{
|
m_pGlassTypeManager->SetProfile(macroFile);
|
}
|
|
if(m_pAlignManager)
|
{
|
m_pAlignManager->SetProfile(macroFile);
|
}
|
|
if(m_pSignalManager)
|
{
|
m_pSignalManager->SetProfile(macroFile);
|
}
|
|
if(m_pMotorManager)
|
{
|
m_pMotorManager->SetProfile(macroFile);
|
}
|
|
if(m_pNetworkManager)
|
{
|
m_pNetworkManager->SetProfile(macroFile);
|
}
|
|
strPath = _REVIEW_SERVER_SYSTEM_SETTING_FILE_PATH_;
|
bReturn = macroFile.Write(strPath);
|
|
return bReturn;
|
}
|
|
#include "DlgLogIn.h"
|
|
void CReviewSystemSettingDlg::OnBnClickedButtonSysSettingSave()
|
{
|
BOOL bRet = WriteReviewSystemConfigFile();
|
|
if(bRet == TRUE)
|
{
|
// message
|
g_pLog->DisplayMessage(_T("Setting file is Saved!"));
|
|
COPYDATA_SYSTEM2REV copyData;
|
copyData.Message = MsgSystem2Rev_ChangeSysConfig;
|
SendData2ReviewSystem(©Data);
|
|
// make backup path
|
CString strBackupPath = _REVIEW_SERVER_CONFIG_PATH_;
|
strBackupPath = strBackupPath + _T("\\Backup\\");
|
CreateDirectory(strBackupPath, NULL);
|
|
// set backup file
|
CString strBackupFile = _T("");
|
CTime time = CTime::GetCurrentTime();
|
strBackupFile.Format(_T("%04d-%02d-%02d_%02d-%02d-%02d.cfg"), time.GetYear(), time.GetMonth(), time.GetDay(), time.GetHour(), time.GetMinute(), time.GetSecond());
|
|
// file copy to backup path
|
strBackupFile = strBackupPath + strBackupFile;
|
CopyFile(_REVIEW_SERVER_SYSTEM_SETTING_FILE_PATH_, strBackupFile, TRUE);
|
|
//LYW_#3344_CF AOI Review Config File ¹é¾÷ ±â´É °³¼± ADD START
|
strBackupPath = _REVIEW_SERVER_SYSTEM_SETTING_BACKUP_PATH_CPJT;
|
CreateDirectory(strBackupPath, NULL);
|
|
// set backup file
|
strBackupFile = _T("");
|
strBackupFile.Format(_T("%s\\SystemSetting.cfg"), strBackupPath);
|
|
CopyFile(_REVIEW_SERVER_SYSTEM_SETTING_FILE_PATH_, strBackupFile, FALSE);
|
//LYW_#3344_CF AOI Review Config File ¹é¾÷ ±â´É °³¼± ADD END
|
|
if (IDNO == AfxMessageBox(_T("Save complete. Do you want to close System Setting program?"), MB_YESNO | MB_ICONQUESTION))//_T("ÀúÀå ¿Ï·áµÇ¾ú½À´Ï´Ù. ½Ã½ºÅÛ ¼³Á¤ ÇÁ·Î±×·¥À» Á¾·áÇϽðڽÀ´Ï±î?"), MB_YESNO | MB_ICONQUESTION))
|
{
|
return;
|
}
|
else
|
{
|
g_pLog->DisplayMessage(_T("SystemSetting is Ended!"));
|
OnCancel();
|
}
|
}
|
else
|
{
|
AfxMessageBox(_T("Save Fail!"));//_T("ÀúÀå ½ÇÆÐÇÏ¿´½À´Ï´Ù."));
|
}
|
}
|
|
void CReviewSystemSettingDlg::OnBnClickedCancel()
|
{
|
// TODO: ¿©±â¿¡ ÄÁÆ®·Ñ ¾Ë¸² 󸮱â Äڵ带 Ãß°¡ÇÕ´Ï´Ù.
|
if (IDNO == AfxMessageBox(_T("Do you want to close System Setting program?"), MB_YESNO | MB_ICONQUESTION))//_T("½Ã½ºÅÛ ¼³Á¤ ÇÁ·Î±×·¥À» Á¾·áÇϽðڽÀ´Ï±î?"), MB_YESNO | MB_ICONQUESTION))
|
{
|
return;
|
}
|
else
|
{
|
OnCancel();
|
}
|
}
|
|
BOOL CReviewSystemSettingDlg::OnCopyData(CWnd* pWnd, COPYDATASTRUCT* pCopyDataStruct)
|
{
|
// TODO: ¿©±â¿¡ ¸Þ½ÃÁö 󸮱â Äڵ带 Ãß°¡ ¹×/¶Ç´Â ±âº»°ªÀ» È£ÃâÇÕ´Ï´Ù.
|
if (pCopyDataStruct->dwData == COPYDATA_SYSTEMSETTING2REVIEWSYSTEM)
|
{
|
COPYDATA_SYSTEM2REV* pCopyData = (COPYDATA_SYSTEM2REV*)pCopyDataStruct->lpData;
|
|
switch (pCopyData->Message)
|
{
|
case MsgRev2System_StandardCameraMotorPos:
|
m_DataSystem2Rev.dStandardCameraMotorPosX = pCopyData->dStandardCameraMotorPosX;
|
m_DataSystem2Rev.dStandardCameraMotorPosY = pCopyData->dStandardCameraMotorPosY;
|
break;
|
case MsgRev2System_FindAlignMark:
|
m_DataSystem2Rev.nFirstAlignFindPixelX = pCopyData->nFirstAlignFindPixelX;
|
m_DataSystem2Rev.nFirstAlignFindPixelY = pCopyData->nFirstAlignFindPixelY;
|
m_DataSystem2Rev.nSecondAlignFindPixelX = pCopyData->nSecondAlignFindPixelX;
|
m_DataSystem2Rev.nSecondAlignFindPixelY = pCopyData->nSecondAlignFindPixelY;
|
m_pDlgGlassType->SetFindAlignMark(m_DataSystem2Rev);
|
break;
|
}
|
}
|
|
return CDialog::OnCopyData(pWnd, pCopyDataStruct);
|
}
|
|
BOOL CReviewSystemSettingDlg::SendData2ReviewSystem(COPYDATA_SYSTEM2REV* pData)
|
{
|
HWND hWnd = ::FindWindow(NULL, _REVIEW_SYSTEM_TITLE_);
|
|
if (hWnd && pData)
|
{
|
COPYDATASTRUCT cds;
|
cds.dwData = COPYDATA_SYSTEMSETTING2REVIEWSYSTEM;
|
cds.cbData = sizeof(COPYDATA_SYSTEM2REV);
|
cds.lpData = pData;
|
|
::SendMessage(hWnd, WM_COPYDATA, 0, (LPARAM)(LPVOID)&cds);
|
|
return TRUE;
|
}
|
|
return FALSE;
|
}
|
|
CSys_SystemManager* CReviewSystemSettingDlg::GetSystemManager()
|
{
|
return m_pSystemManager;
|
}
|
|
CSystemInfo* CReviewSystemSettingDlg::GetSys_SystemInfo()
|
{
|
if (m_pSystemManager==NULL) return NULL;
|
|
return m_pSystemManager->GetSystemInfo();
|
}
|
|
CGantryInfo* CReviewSystemSettingDlg::GetSys_GantryInfo(int nGantryIdx)
|
{
|
if (m_pSystemManager==NULL) return NULL;
|
|
CSystemInfo *pSystemInfo = m_pSystemManager->GetSystemInfo();
|
if (pSystemInfo==NULL) return NULL;
|
|
return pSystemInfo->GetGantryInfo(nGantryIdx);
|
}
|
|
CHeaderInfo* CReviewSystemSettingDlg::GetSys_HeaderInfo(int nGantryIdx, int nHeaderIdx)
|
{
|
CGantryInfo *pGantryInfo = GetSys_GantryInfo(nGantryIdx);
|
if (pGantryInfo==NULL) return NULL;
|
|
return pGantryInfo->GetHeaderInfo(nHeaderIdx);
|
|
}
|
|
CCameraControlInfo_Plus* CReviewSystemSettingDlg::GetSys_CameraInfo(int nGantryIdx, int nHeaderIdx, int nCameraIdx)
|
{
|
CHeaderInfo *pHeaderInfo = GetSys_HeaderInfo(nGantryIdx, nHeaderIdx);
|
if (pHeaderInfo==NULL) return NULL;
|
|
return pHeaderInfo->GetCameraInfo(nCameraIdx);
|
}
|
|
CLightControlInfo* CReviewSystemSettingDlg::GetSys_LightInfo(int nGantryIdx, int nHeaderIdx, int nLightIdx)
|
{
|
CHeaderInfo *pHeaderInfo = GetSys_HeaderInfo(nGantryIdx, nHeaderIdx);
|
if (pHeaderInfo==NULL) return NULL;
|
|
return pHeaderInfo->GetLightInfo(nLightIdx);
|
}
|
|
CLensChangeControlInfo* CReviewSystemSettingDlg::GetSys_RevolverInfo(int nGantryIdx, int nHeaderIdx, int nRevolverIdx)
|
{
|
CHeaderInfo *pHeaderInfo = GetSys_HeaderInfo(nGantryIdx, nHeaderIdx);
|
if (pHeaderInfo==NULL) return NULL;
|
|
return pHeaderInfo->GetRevolverInfo(nRevolverIdx);
|
}
|
|
CAfmControlInfo* CReviewSystemSettingDlg::GetSys_AFMInfo(int nGantryIdx, int nHeaderIdx, int nAFMIdx)
|
{
|
CHeaderInfo *pHeaderInfo = GetSys_HeaderInfo(nGantryIdx, nHeaderIdx);
|
if (pHeaderInfo==NULL) return NULL;
|
|
return pHeaderInfo->GetAFMInfo(nAFMIdx);
|
}
|
|
CWsiControlInfo* CReviewSystemSettingDlg::GetSys_WSIInfo(int nGantryIdx, int nHeaderIdx, int nWSIIdx)
|
{
|
CHeaderInfo* pHeaderInfo = GetSys_HeaderInfo(nGantryIdx, nHeaderIdx);
|
if (pHeaderInfo==NULL) return NULL;
|
|
return pHeaderInfo->GetWsiInfo(nWSIIdx);
|
}
|
|
CMotorAxisAddr* CReviewSystemSettingDlg::GetMot_MotorAxisAddr(int nGantryIdx, int nAxisIdx)
|
{
|
CMotorGantryAddr *pGantryAddr = GetMot_MotorGantryAddr(nGantryIdx);
|
if (pGantryAddr==NULL) return NULL;
|
|
return pGantryAddr->GetMotorAxisAddr(nAxisIdx);
|
}
|
|
CMotorGantryAddr* CReviewSystemSettingDlg::GetMot_MotorGantryAddr(int nGantryIdx)
|
{
|
CMotorControlInfo *pMotorInfo = GetMot_MotorInfo();
|
if (pMotorInfo==NULL) return NULL;
|
|
return pMotorInfo->GetMotorGantryAddr(nGantryIdx);
|
|
}
|
|
|
|
COPYDATA_SYSTEM2REV* CReviewSystemSettingDlg::GetSystem2ReviewData()
|
{
|
return &m_DataSystem2Rev;
|
}
|
|
CSys_GlassTypeManager* CReviewSystemSettingDlg::GetGlassTypeManager()
|
{
|
return m_pGlassTypeManager;
|
}
|
|
CSys_AlignManager* CReviewSystemSettingDlg::GetAlignManager()
|
{
|
return m_pAlignManager;
|
}
|
|
CSys_SignalManager* CReviewSystemSettingDlg::GetSignalManager()
|
{
|
return m_pSignalManager;
|
}
|
|
CSys_MotorManager* CReviewSystemSettingDlg::GetMotorManager()
|
{
|
return m_pMotorManager;
|
}
|
|
CSys_NetworkManager* CReviewSystemSettingDlg::GetNetworkManager()
|
{
|
return m_pNetworkManager;
|
}
|
|
CMotorControlInfo* CReviewSystemSettingDlg::GetMot_MotorInfo()
|
{
|
if (m_pMotorManager) return m_pMotorManager->GetMotorInfo();
|
return NULL;
|
}
|
|
CNetworkInfo* CReviewSystemSettingDlg::GetNet_NetworkInfo()
|
{
|
if (m_pNetworkManager) return m_pNetworkManager->GetNetworkInfo();
|
return NULL;
|
}
|
|
CSignalControlInfo* CReviewSystemSettingDlg::GetSys_SignalInfo()
|
{
|
if (m_pSignalManager) return m_pSignalManager->GetSignalInfo();
|
return NULL;
|
}
|
|
|
void CReviewSystemSettingDlg::OnBnClickedButtonSimulation()
|
{
|
// CHM 0425
|
|
|
CReviewSystemSettingDlg* pDlg = (CReviewSystemSettingDlg*)AfxGetMainWnd();
|
if (pDlg==NULL) return;
|
|
|
//Equipment Setting
|
CSystemInfo *pSystemInfo = pDlg->GetSys_SystemInfo();
|
if (pSystemInfo==NULL) return;
|
for(int i =0 ; i<pSystemInfo->GetGantryInfoCount(); i++)
|
{
|
//------------------------------------------------------------------
|
CGantryInfo * pGantry = pSystemInfo->GetGantryInfo(i);
|
if(pGantry==NULL){return;};
|
|
CHeaderInfo* pHeaderinfo = pGantry->GetHeaderInfo(i);
|
if(pHeaderinfo==NULL){return;};
|
|
CCameraControlInfo_Plus* pCameraInfo =pHeaderinfo->GetCameraInfo(i);
|
if(pCameraInfo==NULL){return;};
|
|
CLightControlInfo* pLightControlInfo =pHeaderinfo->GetLightInfo(i);
|
if(pLightControlInfo==NULL){return;};
|
|
CLensChangeControlInfo * pLensChangeControlInfo = pHeaderinfo->GetRevolverInfo(i);
|
if(pLensChangeControlInfo==NULL){return;};
|
|
CAfmControlInfo *pAFMinfo = pHeaderinfo->GetAFMInfo(i);
|
if(pAFMinfo==NULL){return;};
|
//------------------------------------------------------------------
|
|
pCameraInfo->SetLibraryType(0); // Simulation
|
|
pLightControlInfo->SetControllerType(0);
|
|
pLensChangeControlInfo->SetControllerType(0);
|
|
pAFMinfo->SetControllerType(0);
|
}
|
|
//Align Setting
|
CSys_AlignManager* pAlignManager = pDlg->GetAlignManager();
|
if (pAlignManager==NULL) return;
|
|
for(int i=0 ;i<pAlignManager->GetAlignCameraInfoCount();i++)
|
{
|
CAlignCameraInfo * pAlgininfo=pAlignManager->GetAlignCameraInfo(i);
|
CCameraControlInfo_Plus* pCameraConrtolinfo =pAlgininfo->GetCameraControlInfo();
|
pCameraConrtolinfo->SetLibraryType(0);
|
}
|
|
//Signal Setting
|
CSignalControlInfo* pSignalinfo =pDlg->GetSys_SignalInfo();
|
if (pSignalinfo==NULL) return;
|
pSignalinfo->SetControllerType(0);
|
|
//Motor Setting
|
CMotorControlInfo * pMortorinfo = pDlg->GetMot_MotorInfo();
|
if (pMortorinfo==NULL) return;
|
pMortorinfo->SetControllerType(0);
|
UpdateData(FALSE);
|
|
}
|