// opcreatecesptdlg.cpp : implementation file // #include "stdafx.h" #include "geomative.h" #include "opcreatecesptdlg.h" #include "SptRecord.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // COpCreateCESptDlg dialog extern HHOOK hHook; extern LRESULT __stdcall CBTHookProc(long nCode, WPARAM wParam, LPARAM lParam); extern bool IsExistSpecialChar(const CString &strFileName); extern bool bIsInteger(CString strTxt); extern bool bIsFloat(CString strTxt); extern int g_iUILanguage; extern int g_UIOffset; COpCreateCESptDlg::COpCreateCESptDlg(CScriptCE* const pNewScript, CLinkList* pMedLinkList, INT_PTR* pRet, CWnd* pParent/*=NULL*/) : CDialog(COpCreateCESptDlg::IDD, pParent) { //{{AFX_DATA_INIT(COpCreateCESptDlg) m_edDeDate = CTime::GetCurrentTime(); //}}AFX_DATA_INIT m_pRet = pRet; m_pNewScript = pNewScript; m_pMedLinkList = pMedLinkList; m_iCurTabSel = -1; } void COpCreateCESptDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(COpCreateCESptDlg) DDX_Control(pDX, IDC_SPT_CE_LIST, m_ceSptList); DDX_Control(pDX, IDC_SPT_SNAME, m_edSName); DDX_Control(pDX, IDC_SPT_SCDESC, m_edScDesc); DDX_Control(pDX, IDC_SPT_DEFINER, m_edDefiner); DDX_Control(pDX, IDC_SPT_CE_TAB, m_ceSptTab); DDX_DateTimeCtrl(pDX, IDC_SPT_DEDATE, m_edDeDate); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(COpCreateCESptDlg, CDialog) //{{AFX_MSG_MAP(COpCreateCESptDlg) ON_NOTIFY(TCN_SELCHANGE, IDC_SPT_CE_TAB, OnSelchangeSptCeTab) ON_BN_CLICKED(IDC_BTN_INS, OnBtnIns) ON_BN_CLICKED(IDC_BTN_UPD, OnBtnUpd) ON_BN_CLICKED(IDC_BTN_DEL, OnBtnDel) ON_NOTIFY(LVN_ITEMCHANGED, IDC_SPT_CE_LIST, OnItemchangedSptCeList) ON_WM_SIZE() ON_WM_SIZING() //}}AFX_MSG_MAP END_MESSAGE_MAP() //BEGIN_EASYSIZE_MAP(COpCreateCESptDlg) //EASYSIZE(IDC_STATIC_NAME, ES_BORDER, ES_KEEPSIZE, ES_BORDER, ES_BORDER, 0) //EASYSIZE(IDC_SPT_SNAME, ES_BORDER, ES_KEEPSIZE, ES_BORDER, ES_BORDER, 0) //EASYSIZE(IDC_STATIC_OPERATOR, ES_BORDER, ES_KEEPSIZE, ES_BORDER, ES_BORDER, 0) //EASYSIZE(IDC_SPT_DEFINER, ES_BORDER, ES_KEEPSIZE, ES_BORDER, ES_BORDER, 0) // EASYSIZE(IDC_STATIC_DATE, ES_KEEPSIZE, ES_KEEPSIZE, ES_BORDER, ES_BORDER, 0) // EASYSIZE(IDC_SPT_DEDATE, ES_KEEPSIZE, ES_KEEPSIZE, ES_BORDER, ES_BORDER, 0) // // EASYSIZE(IDC_STATIC_REMARK, ES_KEEPSIZE, ES_KEEPSIZE, ES_BORDER, ES_BORDER, 0) // EASYSIZE(IDC_SPT_SCDESC, ES_KEEPSIZE, ES_KEEPSIZE, ES_BORDER, ES_BORDER, 0) // EASYSIZE(IDC_SPT_CE_TAB, ES_BORDER, ES_BORDER, ES_BORDER, ES_KEEPSIZE, ES_HCENTER) // EASYSIZE(IDC_BTN_INS, ES_BORDER, ES_BORDER, ES_BORDER, ES_KEEPSIZE, ES_HCENTER) // EASYSIZE(IDC_BTN_UPD, ES_BORDER, ES_BORDER, ES_BORDER, ES_KEEPSIZE, ES_HCENTER) // EASYSIZE(IDC_BTN_DEL, ES_BORDER, ES_BORDER, ES_BORDER, ES_KEEPSIZE, ES_HCENTER) // EASYSIZE(IDOK, ES_BORDER, ES_BORDER, ES_BORDER, ES_KEEPSIZE, ES_HCENTER) // EASYSIZE(IDCANCEL, ES_BORDER, ES_BORDER, ES_BORDER, ES_KEEPSIZE, ES_HCENTER) //EASYSIZE(IDC_SPT_CE_LIST, ES_KEEPSIZE, ES_BORDER, ES_BORDER, ES_BORDER, 0) //END_EASYSIZE_MAP ///////////////////////////////////////////////////////////////////////////// // COpCreateCESptDlg message handlers BOOL COpCreateCESptDlg::OnInitDialog() { CDialog::OnInitDialog(); // TODO: Add extra initialization here InitUIByLanguage(g_iUILanguage); CString szLabel; CTabCtrl* pCESptTab = NULL; m_iCurTabSel = -1; int iAR = (int)VAL_ZERO; DWORD dwMedHandle = (DWORD)VAL_ZERO; CString strColTitle; int iColIndex = (int)VAL_ZERO; POSITION pos; CChannel* pChannel = NULL; this->m_edSName.SetLimitText(20); this->m_edDefiner.SetLimitText(20); this->m_edScDesc.SetLimitText(50); szLabel.Empty(); szLabel.LoadString(IDS_4PVES); ASSERT(!szLabel.IsEmpty()); m_ceSptTab.InsertItem(TAB_INDEX_4PVES, szLabel); szLabel.Empty(); szLabel.LoadString(IDS_DIPOLE); ASSERT(!szLabel.IsEmpty()); m_ceSptTab.InsertItem(TAB_INDEX_DIPOLE, szLabel); //新增加新的三极装置 szLabel.Empty(); szLabel.LoadString(IDS_3PVES); ASSERT(!szLabel.IsEmpty()); m_ceSptTab.InsertItem(TAB_INDEX_3PVES, szLabel); szLabel.Empty(); szLabel.LoadString(IDS_RECTGL); ASSERT(!szLabel.IsEmpty()); m_ceSptTab.InsertItem(TAB_INDEX_RECTGL, szLabel); szLabel.Empty(); szLabel.LoadString(IDS_CUSTOM); ASSERT(!szLabel.IsEmpty()); m_ceSptTab.InsertItem(TAB_INDEX_CUSTOM, szLabel); //added by lsq 20160624 //将原来的三维装置改名为联合剖面,改变了图的显示,其它的都不改变 szLabel = _T(_T("Composite Profiling")); // szLabel.LoadString(_T("Composite Profiling")); ASSERT(!szLabel.IsEmpty()); m_ceSptTab.InsertItem(TAB_INDEX_UNTIFY_PROFILE, szLabel); m_ceSpt4PVESDlg.Create(IDD_OP_CESPT_4PVES, GetDlgItem(IDC_SPT_CE_TAB)); m_ceSptDIPOLEDlg.Create(IDD_OP_CESPT_DIPOLE, GetDlgItem(IDC_SPT_CE_TAB)); m_ceSptNew3PDlg.Create(IDD_OP_CESPT_NEW_3P_VES, GetDlgItem(IDC_SPT_CE_TAB)); m_ceSptRECTGLDlg.Create(IDD_OP_CESPT_RECTGL, GetDlgItem(IDC_SPT_CE_TAB)); m_ceSptCUSTOMDlg.Create(IDD_OP_CESPT_CUSTOM, GetDlgItem(IDC_SPT_CE_TAB)); //IDD_OP_CESPT_3PVES,老的三极装置已经改成联合剖面 m_ceSpt3PVESDlg.Create(IDD_OP_CESPT_3PVES, GetDlgItem(IDC_SPT_CE_TAB)); pCESptTab = (CTabCtrl*)GetDlgItem(IDC_SPT_CE_TAB); if ((NULL != pCESptTab) && (VAL_ZERO != m_ceSptTab.GetSafeHwnd()) && (VAL_ZERO != m_ceSptTab.GetSafeHwnd())) { CRect rect; pCESptTab->GetClientRect(&rect); rect.top += 20; rect.bottom -= 7; rect.left += 4; rect.right -= 4; m_ceSpt4PVESDlg.MoveWindow(&rect); m_ceSptDIPOLEDlg.MoveWindow(&rect); m_ceSpt3PVESDlg.MoveWindow(&rect); m_ceSptRECTGLDlg.MoveWindow(&rect); m_ceSptCUSTOMDlg.MoveWindow(&rect); m_ceSptNew3PDlg.MoveWindow(&rect); } pCESptTab = NULL; m_ceSpt4PVESDlg.ShowWindow(true); m_ceSptDIPOLEDlg.ShowWindow(false); m_ceSpt3PVESDlg.ShowWindow(false); m_ceSptRECTGLDlg.ShowWindow(false); m_ceSptCUSTOMDlg.ShowWindow(false); m_ceSptNew3PDlg.ShowWindow(false); m_ceSptList.SetExtendedStyle(LVS_EX_FULLROWSELECT | LVS_EX_HEADERDRAGDROP | LVS_EX_ONECLICKACTIVATE | LVS_EX_GRIDLINES |LVS_EX_MULTIWORKAREAS); strColTitle.Empty(); strColTitle.LoadString(IDS_DB_SCRIPT_TSN); m_ceSptList.InsertColumn(iColIndex, strColTitle, LVCFMT_CENTER, 100); iColIndex++; strColTitle.Empty(); strColTitle.LoadString(IDS_DB_SCRIPT_a); m_ceSptList.InsertColumn(iColIndex, strColTitle, LVCFMT_CENTER, 100); iColIndex++; strColTitle.Empty(); strColTitle.LoadString(IDS_DB_SCRIPT_b); m_ceSptList.InsertColumn(iColIndex, strColTitle, LVCFMT_CENTER, 100); iColIndex++; strColTitle.Empty(); strColTitle.LoadString(IDS_DB_SCRIPT_x); m_ceSptList.InsertColumn(iColIndex, strColTitle, LVCFMT_CENTER, 100); iColIndex++; strColTitle.Empty(); strColTitle.LoadString(IDS_DB_SCRIPT_y); m_ceSptList.InsertColumn(iColIndex, strColTitle, LVCFMT_CENTER, 100); iColIndex++; strColTitle.Empty(); strColTitle.LoadString(IDS_DB_SCRIPT_K); m_ceSptList.InsertColumn(iColIndex, strColTitle, LVCFMT_RIGHT, 100); iColIndex++; strColTitle.Empty(); strColTitle.LoadString(IDS_DB_SCRIPT_N); m_ceSptList.InsertColumn(iColIndex, strColTitle, LVCFMT_CENTER, 100); pos = m_pNewScript->m_chaList.FindIndex(0); pChannel = (CChannel*)m_pNewScript->m_chaList.GetAt(pos); int iCurTab = m_ceSptTab.GetCurSel(); if (iCurTab == TAB_INDEX_UNTIFY_PROFILE) iAR = 33; else iAR = iCurTab + 17; dwMedHandle = m_handleProcessor.GenerateHandle(iAR, PZ_STYLE_MED_DEF); pChannel->m_pMedium = m_pMedLinkList->Find(dwMedHandle); //初始化EASYSIZE窗口自适应控件 // INIT_EASYSIZE; m_iCurTabSel = m_ceSptTab.GetCurSel(); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } BOOL COpCreateCESptDlg::Create(UINT nID, CWnd* pParentWnd) { // TODO: Add your specialized code here and/or call the base class pParentWnd->EnableWindow(FALSE); return CDialog::Create(IDD, pParentWnd); } void COpCreateCESptDlg::OnSelchangeSptCeTab(NMHDR* pNMHDR, LRESULT* pResult) { // TODO: Add your control notification handler code here int iAR = (int)VAL_ZERO; DWORD dwMedHandle = (DWORD)VAL_ZERO; POSITION pos; CChannel* pChannel = NULL; int iCurSel = VAL_MINUS_ONE; this->GetDlgItem(IDC_BTN_UPD)->EnableWindow(TRUE); ////////////////////////////////////////////////////////////////////////// if (m_iCurTabSel != m_ceSptTab.GetCurSel()) { if (m_ceSptList.GetItemCount() > 0) { int nRet = 0; if (LANG_ZHCN == g_iUILanguage) nRet = AfxMessageBox(_T("如果选择切换脚本类型,那么当前脚本中的所有在填的数据将被删除,是否依然进行切换?"), MB_YESNO | MB_ICONINFORMATION); else nRet = MessageBoxEx(NULL, _T("All data in the list would be deleted if you change script type!\r\nDo you want to change?"), STRING_MESSAGEBOXEX_TITLE, MB_YESNO | MB_ICONINFORMATION, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)); if (IDYES != nRet) { m_ceSptTab.SetCurSel(m_iCurTabSel); return; } } m_iCurTabSel = m_ceSptTab.GetCurSel(); } ////////////////////////////////////////////////////////////////////////// iCurSel = m_ceSptTab.GetCurSel(); switch (iCurSel) { case TAB_INDEX_4PVES: m_ceSpt4PVESDlg.ShowWindow(true); m_ceSptDIPOLEDlg.ShowWindow(false); m_ceSpt3PVESDlg.ShowWindow(false); m_ceSptRECTGLDlg.ShowWindow(false); m_ceSptCUSTOMDlg.ShowWindow(false); m_ceSptNew3PDlg.ShowWindow(false); break; case TAB_INDEX_DIPOLE: m_ceSpt4PVESDlg.ShowWindow(false); m_ceSptDIPOLEDlg.ShowWindow(true); m_ceSpt3PVESDlg.ShowWindow(false); m_ceSptRECTGLDlg.ShowWindow(false); m_ceSptCUSTOMDlg.ShowWindow(false); m_ceSptNew3PDlg.ShowWindow(false); break; case TAB_INDEX_3PVES: m_ceSpt4PVESDlg.ShowWindow(false); m_ceSptDIPOLEDlg.ShowWindow(false); m_ceSpt3PVESDlg.ShowWindow(false); m_ceSptRECTGLDlg.ShowWindow(false); m_ceSptCUSTOMDlg.ShowWindow(false); m_ceSptNew3PDlg.ShowWindow(true); break; case TAB_INDEX_RECTGL: m_ceSpt4PVESDlg.ShowWindow(false); m_ceSptDIPOLEDlg.ShowWindow(false); m_ceSpt3PVESDlg.ShowWindow(false); m_ceSptRECTGLDlg.ShowWindow(true); m_ceSptCUSTOMDlg.ShowWindow(false); m_ceSptNew3PDlg.ShowWindow(false); // this->GetDlgItem(IDC_BTN_UPD)->EnableWindow(FALSE); break; case TAB_INDEX_CUSTOM: m_ceSpt4PVESDlg.ShowWindow(false); m_ceSptDIPOLEDlg.ShowWindow(false); m_ceSpt3PVESDlg.ShowWindow(false); m_ceSptRECTGLDlg.ShowWindow(false); m_ceSptCUSTOMDlg.ShowWindow(true); m_ceSptNew3PDlg.ShowWindow(false); break; case TAB_INDEX_UNTIFY_PROFILE: m_ceSpt4PVESDlg.ShowWindow(false); m_ceSptDIPOLEDlg.ShowWindow(false); m_ceSpt3PVESDlg.ShowWindow(true); m_ceSptRECTGLDlg.ShowWindow(false); m_ceSptCUSTOMDlg.ShowWindow(false); m_ceSptNew3PDlg.ShowWindow(false); break; default: break; } m_ceSptTab.SetFocus(); pos = m_pNewScript->m_chaList.FindIndex(0); pChannel = (CChannel*)m_pNewScript->m_chaList.GetAt(pos); int iTabCel = m_ceSptTab.GetCurSel(); if (iTabCel == TAB_INDEX_UNTIFY_PROFILE) iAR = 33; else if(iTabCel == TAB_INDEX_CUSTOM) iAR = 21; else iAR = iTabCel + 17; dwMedHandle = m_handleProcessor.GenerateHandle(iAR, PZ_STYLE_MED_DEF); pChannel->m_pMedium = m_pMedLinkList->Find(dwMedHandle); pChannel->ClearSptRecList(); this->m_ceSptList.DeleteAllItems(); *pResult = 0; } void COpCreateCESptDlg::OnBtnIns() { // TODO: Add your control notification handler code here POSITION pos; CChannel* pChannel = NULL; CSptRecord* pSptRecord = NULL; pos = m_pNewScript->m_chaList.FindIndex(0); pChannel = (CChannel*)m_pNewScript->m_chaList.GetAt(pos); switch (m_ceSptTab.GetCurSel()) { case TAB_INDEX_4PVES: pSptRecord = new CSptRecord; Insert4PVESSptRec(pSptRecord, pChannel); break; case TAB_INDEX_DIPOLE: pSptRecord = new CSptRecord; InsertDipoleSptRec(pSptRecord, pChannel); break; case TAB_INDEX_3PVES: pSptRecord = new CSptRecord; InsertNew3PSptRec(pSptRecord, pChannel); break; case TAB_INDEX_RECTGL: InsertRECTGLSptRec(pChannel); break; case TAB_INDEX_CUSTOM: pSptRecord = new CSptRecord; InsertCUSTOMSptRec(pSptRecord, pChannel); break; case TAB_INDEX_UNTIFY_PROFILE: pSptRecord = new CSptRecord; InsertUnitProfileSptRec(pSptRecord, pChannel); break; default: break; } } void COpCreateCESptDlg::OnBtnUpd() { // TODO: Add your control notification handler code here int iSptRecIndex = (int)VAL_ZERO; POSITION pos = NULL; CChannel* pChannel = NULL; CSptRecord* pSptRecord = NULL; pos = NULL; pos = m_pNewScript->m_chaList.FindIndex(0); pChannel = (CChannel*)m_pNewScript->m_chaList.GetAt(pos); pos = NULL; pos = this->m_ceSptList.GetFirstSelectedItemPosition(); if (NULL != pos) { iSptRecIndex = this->m_ceSptList.GetNextSelectedItem(pos); } else { hHook = SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTHookProc,AfxGetInstanceHandle(),NULL); if (LANG_ZHCN == g_iUILanguage) MessageBox(_T("请选择脚本!")); else MessageBox(_T("Please select script record!")); return; } pSptRecord = (CSptRecord*)(this->m_ceSptList.GetItemData(iSptRecIndex)); switch (m_ceSptTab.GetCurSel()) { case TAB_INDEX_4PVES: Update4PVESSptRec(pSptRecord, pChannel); break; case TAB_INDEX_DIPOLE: UpdateDipoleSptRec(pSptRecord, pChannel); break; case TAB_INDEX_3PVES: UpdateNew3PVesSptRec(pSptRecord, pChannel); break; case TAB_INDEX_RECTGL: UpdateRECTGLSptRec(pSptRecord, pChannel); break; case TAB_INDEX_CUSTOM: UpdateCUSTOMSptRec(pSptRecord, pChannel); break; case TAB_INDEX_UNTIFY_PROFILE: UpdateUnityProfileSptRec(pSptRecord, pChannel); break; default: break; } } void COpCreateCESptDlg::OnBtnDel() { // TODO: Add your control notification handler code here if (NULL == m_ceSptList.GetFirstSelectedItemPosition()) { return; } int nRet = 0; if (LANG_ZHCN == g_iUILanguage) nRet = AfxMessageBox(_T("是否要删除?"), MB_YESNO); else nRet = MessageBoxEx(NULL, _T("Are you sure to delete?"), STRING_MESSAGEBOXEX_TITLE, MB_YESNO, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)); if (IDYES != nRet) return; POSITION pos = NULL; CString szValue = _T(""); int iTsn = (int)VAL_ZERO; CChannel* pChannel = NULL; CSptRecord* pSptRecord = NULL; pos = m_pNewScript->m_chaList.FindIndex(0); pChannel = (CChannel*)m_pNewScript->m_chaList.GetAt(pos); pos = NULL; DWORD dwTSN = 0; int iSptRecIndex = -1; while((pos = m_ceSptList.GetFirstSelectedItemPosition())) { iSptRecIndex = m_ceSptList.GetNextSelectedItem(pos); if(iSptRecIndex >= 0 && iSptRecIndex < m_ceSptList.GetItemCount()) { pSptRecord = (CSptRecord*)this->m_ceSptList.GetItemData(iSptRecIndex); switch (m_ceSptTab.GetCurSel()) { case TAB_INDEX_4PVES: Delete4PVESSptRec(pSptRecord, pChannel); break; case TAB_INDEX_DIPOLE: DeleteDipoleSptRec(pSptRecord, pChannel); break; case TAB_INDEX_3PVES: DeleteNew3PVESSptRec(pSptRecord, pChannel); break; case TAB_INDEX_RECTGL: DeleteRECTGLSptRec(pSptRecord, pChannel); break; case TAB_INDEX_CUSTOM: DeleteCUSTOMSptRec(pSptRecord, pChannel); break; case TAB_INDEX_UNTIFY_PROFILE: DeleteUnityProfileSptRec(pSptRecord, pChannel); break; default: break; } iTsn = (int)VAL_ONE; while (iTsn <= pChannel->m_sptRecArray.GetSize()) { ((CSptRecord*)pChannel->m_sptRecArray.GetAt(iTsn-1))->m_iTsn = iTsn; szValue.Empty(); szValue.Format(_T("%d"), iTsn); this->m_ceSptList.SetItemText(iTsn-1, 0, szValue); iTsn++; } } } } BOOL COpCreateCESptDlg::Insert4PVESSptRec(CSptRecord* pSptRecord, CChannel* pChannel) { int iIndex = (int)VAL_ZERO; CString szValue = _T(""); if (!this->m_ceSpt4PVESDlg.UpdateData(TRUE)) { hHook = SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTHookProc,AfxGetInstanceHandle(),NULL); if (LANG_ZHCN == g_iUILanguage) AfxMessageBox(_T("撤回CeSpt4PVESDialog数据失败")); else MessageBoxEx(NULL, _T("Retrieve CeSpt4PVESDialog data failed!"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)); return FALSE; } if (!bIsInteger(m_ceSpt4PVESDlg.m_strStacking)) { hHook = SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTHookProc,AfxGetInstanceHandle(),NULL); if (LANG_ZHCN == g_iUILanguage) AfxMessageBox(_T("迭代数错误,请输入一个1到255的正数")); else MessageBoxEx(NULL, _T("Stacking number input error;please input an integer from 1 to 255.!"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)); return FALSE; } m_ceSpt4PVESDlg.m_unIterNum = atoi(m_ceSpt4PVESDlg.m_strStacking); if (m_ceSpt4PVESDlg.m_unIterNum < 1 || m_ceSpt4PVESDlg.m_unIterNum > 255) { hHook = SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTHookProc,AfxGetInstanceHandle(),NULL); if (LANG_ZHCN == g_iUILanguage) AfxMessageBox(_T("迭代数错误,请输入一个1到255的正数")); else MessageBoxEx(NULL, _T("Stacking number input error!please input an integer from 1 to 255!"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)); return FALSE; } szValue.Empty(); this->m_ceSpt4PVESDlg.m_edA.GetWindowText(szValue); pSptRecord->m_fA = (float)(atof(szValue)*1.0); if (pSptRecord->m_fA <= 0) { hHook = SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTHookProc,AfxGetInstanceHandle(),NULL); if (LANG_ZHCN == g_iUILanguage) AfxMessageBox(_T("a的值须为正数")); else MessageBoxEx(NULL, _T("Please input a positive number on a"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)); this->m_ceSpt4PVESDlg.m_edA.SetFocus(); return FALSE; } szValue.Empty(); this->m_ceSpt4PVESDlg.m_edB.GetWindowText(szValue); pSptRecord->m_fB = (float)(atof(szValue)*1.0); if (pSptRecord->m_fB <= 0) { hHook = SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTHookProc,AfxGetInstanceHandle(),NULL); if (LANG_ZHCN == g_iUILanguage) AfxMessageBox(_T("b的值须为正数")); else MessageBoxEx(NULL, _T("Please input a positive number on b"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)); this->m_ceSpt4PVESDlg.m_edB.SetFocus(); return FALSE; } if (pSptRecord->m_fA <= pSptRecord->m_fB) { hHook = SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTHookProc,AfxGetInstanceHandle(),NULL); if (LANG_ZHCN == g_iUILanguage) AfxMessageBox(_T("a的值必须大于b.")); else MessageBoxEx(NULL, _T("The value of a must bigger than b."), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)); this->m_ceSpt4PVESDlg.m_edA.SetFocus(); return FALSE; } pSptRecord->m_iN = this->m_ceSpt4PVESDlg.m_unIterNum; pSptRecord->m_fK = fabs(pChannel->m_pMedium->CalculateCESptKVal(pSptRecord->m_fA, pSptRecord->m_fB, 0.0, 0.0)); pSptRecord->m_iTsn = pChannel->m_sptRecArray.GetSize() + 1; pChannel->m_sptRecArray.Add((void*)pSptRecord); iIndex = this->m_ceSptList.GetItemCount(); szValue.Empty(); szValue.Format(_T("%d"), pSptRecord->m_iTsn); this->m_ceSptList.InsertItem(iIndex, szValue); szValue.Empty(); szValue.Format(_T("%.2f"), pSptRecord->m_fA); this->m_ceSptList.SetItemText(iIndex, 1, szValue); szValue.Empty(); szValue.Format(_T("%.2f"), pSptRecord->m_fB); this->m_ceSptList.SetItemText(iIndex, 2, szValue); szValue.Empty(); szValue.Format(_T("%.2f"), pSptRecord->m_fX); this->m_ceSptList.SetItemText(iIndex, 3, szValue); szValue.Empty(); szValue.Format(_T("%.2f"), pSptRecord->m_fY); this->m_ceSptList.SetItemText(iIndex, 4, szValue); szValue.Empty(); szValue.Format(_T("%f"), pSptRecord->m_fK); this->m_ceSptList.SetItemText(iIndex, 5, szValue); szValue.Empty(); szValue.Format(_T("%d"), pSptRecord->m_iN); this->m_ceSptList.SetItemText(iIndex, 6, szValue); this->m_ceSptList.SetItemData(iIndex, (DWORD)pSptRecord); return TRUE; } BOOL COpCreateCESptDlg::InsertDipoleSptRec(CSptRecord* pSptRecord, CChannel* pChannel) { int iIndex = (int)VAL_ZERO; CString szValue = _T(""); if (!this->m_ceSptDIPOLEDlg.UpdateData(TRUE)) { hHook = SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTHookProc,AfxGetInstanceHandle(),NULL); if (LANG_ZHCN == g_iUILanguage) AfxMessageBox(_T("撤回CeSptDipoleDialog数据失败")); else MessageBoxEx(NULL, _T("Retrieve CeSptDipoleDialog data failed!"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)); return FALSE; } if (!bIsInteger(m_ceSptDIPOLEDlg.m_strStacking)) { hHook = SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTHookProc,AfxGetInstanceHandle(),NULL); if (LANG_ZHCN == g_iUILanguage) AfxMessageBox(_T("迭代数错误,请输入一个1到255的正数")); else MessageBoxEx(NULL, _T("Stacking number input error!please input an integer from 1 to 255!"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)); return FALSE; } m_ceSptDIPOLEDlg.m_unIterNum = atoi(m_ceSptDIPOLEDlg.m_strStacking); if (m_ceSptDIPOLEDlg.m_unIterNum < 1 || m_ceSptDIPOLEDlg.m_unIterNum > 255) { hHook = SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTHookProc,AfxGetInstanceHandle(),NULL); if (LANG_ZHCN == g_iUILanguage) AfxMessageBox(_T("迭代数错误,请输入一个1到255的正数")); else MessageBoxEx(NULL, _T("Stacking number input error!please input an integer from 1 to 255!"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)); return FALSE; } szValue.Empty(); this->m_ceSptDIPOLEDlg.m_edA.GetWindowText(szValue); pSptRecord->m_fA = (float)(atof(szValue)*1.0); if (pSptRecord->m_fA <= 0) { hHook = SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTHookProc,AfxGetInstanceHandle(),NULL); if (LANG_ZHCN == g_iUILanguage) AfxMessageBox(_T("a的值须为正数")); else MessageBoxEx(NULL, _T("Please input a positive number on a."), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)); this->m_ceSptDIPOLEDlg.m_edA.SetFocus(); return FALSE; } szValue.Empty(); this->m_ceSptDIPOLEDlg.m_edB.GetWindowText(szValue); pSptRecord->m_fB = (float)(atof(szValue)*1.0); if (pSptRecord->m_fB <= 0) { hHook = SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTHookProc,AfxGetInstanceHandle(),NULL); if (LANG_ZHCN == g_iUILanguage) AfxMessageBox(_T("b的值须为正数")); else MessageBoxEx(NULL, _T("Please input a positive number on b."), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)); this->m_ceSptDIPOLEDlg.m_edB.SetFocus(); return FALSE; } if (pSptRecord->m_fA >= pSptRecord->m_fB) { hHook = SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTHookProc,AfxGetInstanceHandle(),NULL); if (LANG_ZHCN == g_iUILanguage) AfxMessageBox(_T("a必须小于b.")); else MessageBoxEx(NULL, _T("The value of a must less than b."), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)); return FALSE; } pSptRecord->m_iN = this->m_ceSptDIPOLEDlg.m_unIterNum; pSptRecord->m_fK = fabs(pChannel->m_pMedium->CalculateCESptKVal(pSptRecord->m_fA, pSptRecord->m_fB, 0.0, 0.0)); pSptRecord->m_iTsn = pChannel->m_sptRecArray.GetSize() + 1; pChannel->m_sptRecArray.Add((void*)pSptRecord); iIndex = this->m_ceSptList.GetItemCount(); szValue.Empty(); szValue.Format(_T("%d"), pSptRecord->m_iTsn); this->m_ceSptList.InsertItem(iIndex, szValue); szValue.Empty(); szValue.Format(_T("%.2f"), pSptRecord->m_fA); this->m_ceSptList.SetItemText(iIndex, 1, szValue); szValue.Empty(); szValue.Format(_T("%.2f"), pSptRecord->m_fB); this->m_ceSptList.SetItemText(iIndex, 2, szValue); szValue.Empty(); szValue.Format(_T("%.2f"), pSptRecord->m_fX); this->m_ceSptList.SetItemText(iIndex, 3, szValue); szValue.Empty(); szValue.Format(_T("%.2f"), pSptRecord->m_fY); this->m_ceSptList.SetItemText(iIndex, 4, szValue); szValue.Empty(); szValue.Format(_T("%f"), pSptRecord->m_fK); this->m_ceSptList.SetItemText(iIndex, 5, szValue); szValue.Empty(); szValue.Format(_T("%d"), pSptRecord->m_iN); this->m_ceSptList.SetItemText(iIndex, 6, szValue); this->m_ceSptList.SetItemData(iIndex, (DWORD)pSptRecord); return TRUE; } BOOL COpCreateCESptDlg::InsertUnitProfileSptRec(CSptRecord* pSptRecord, CChannel* pChannel) { int iIndex = (int)VAL_ZERO; CString szValue = _T(""); if (!this->m_ceSpt3PVESDlg.UpdateData(TRUE)) { hHook = SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTHookProc,AfxGetInstanceHandle(),NULL); if (LANG_ZHCN == g_iUILanguage) AfxMessageBox(_T("撤回CesSptCompositeProflingDialog数据失败")); else MessageBoxEx(NULL, _T("Retrieve CesSptCompositeProflingDialog Data Failed!"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)); return FALSE; } if (!bIsInteger(m_ceSpt3PVESDlg.m_strStacking)) { hHook = SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTHookProc,AfxGetInstanceHandle(),NULL); if (LANG_ZHCN == g_iUILanguage) AfxMessageBox(_T("迭代数错误,请输入一个1到255的正数")); else MessageBoxEx(NULL, _T("Stacking number input error!please input an integer from 1 to 255!"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)); return FALSE; } m_ceSpt3PVESDlg.m_unIterNum = atoi(m_ceSpt3PVESDlg.m_strStacking); if (m_ceSpt3PVESDlg.m_unIterNum < 1 || m_ceSpt3PVESDlg.m_unIterNum > 255) { hHook = SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTHookProc,AfxGetInstanceHandle(),NULL); if (LANG_ZHCN == g_iUILanguage) AfxMessageBox(_T("迭代数错误,请输入一个1到255的正数")); else MessageBoxEx(NULL, _T("Stacking number input error!please input an integer from 1 to 255!"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)); return FALSE; } szValue.Empty(); this->m_ceSpt3PVESDlg.m_edA.GetWindowText(szValue); pSptRecord->m_fA = (float)(atof(szValue)*1.0); if (pSptRecord->m_fA <= 0 ) { hHook = SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTHookProc,AfxGetInstanceHandle(),NULL); if (LANG_ZHCN == g_iUILanguage) AfxMessageBox(_T("a的值须为正数")); else MessageBoxEx(NULL, _T("Please input a positive number on a"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)); this->m_ceSpt3PVESDlg.m_edA.SetFocus(); return FALSE; } szValue.Empty(); this->m_ceSpt3PVESDlg.m_edB.GetWindowText(szValue); pSptRecord->m_fB = (float)(atof(szValue)*1.0); if (pSptRecord->m_fB <= 0 ) { hHook = SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTHookProc,AfxGetInstanceHandle(),NULL); if (LANG_ZHCN == g_iUILanguage) AfxMessageBox(_T("b的值须为正数")); else MessageBoxEx(NULL, _T("Please input a positive number on b"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)); this->m_ceSpt3PVESDlg.m_edB.SetFocus(); return FALSE; } if (pSptRecord->m_fA <= pSptRecord->m_fB) { hHook = SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTHookProc,AfxGetInstanceHandle(),NULL); if (LANG_ZHCN == g_iUILanguage) AfxMessageBox(_T("a的值必须大于b.")); else MessageBoxEx(NULL, _T("The value of a must bigger than b."), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)); this->m_ceSpt3PVESDlg.m_edA.SetFocus(); return FALSE; } pSptRecord->m_iN = this->m_ceSpt3PVESDlg.m_unIterNum; pSptRecord->m_fK = fabs(pChannel->m_pMedium->CalculateCESptKVal(pSptRecord->m_fA, pSptRecord->m_fB, 0.0, 0.0)); pSptRecord->m_iTsn = pChannel->m_sptRecArray.GetSize() + 1; pChannel->m_sptRecArray.Add((void*)pSptRecord); iIndex = this->m_ceSptList.GetItemCount(); szValue.Empty(); szValue.Format(_T("%d"), pSptRecord->m_iTsn); this->m_ceSptList.InsertItem(iIndex, szValue); szValue.Empty(); szValue.Format(_T("%.2f"), pSptRecord->m_fA); this->m_ceSptList.SetItemText(iIndex, 1, szValue); szValue.Empty(); szValue.Format(_T("%.2f"), pSptRecord->m_fB); this->m_ceSptList.SetItemText(iIndex, 2, szValue); szValue.Empty(); szValue.Format(_T("%.2f"), pSptRecord->m_fX); this->m_ceSptList.SetItemText(iIndex, 3, szValue); szValue.Empty(); szValue.Format(_T("%.2f"), pSptRecord->m_fY); this->m_ceSptList.SetItemText(iIndex, 4, szValue); szValue.Empty(); szValue.Format(_T("%f"), pSptRecord->m_fK); this->m_ceSptList.SetItemText(iIndex, 5, szValue); szValue.Empty(); szValue.Format(_T("%d"), pSptRecord->m_iN); this->m_ceSptList.SetItemText(iIndex, 6, szValue); this->m_ceSptList.SetItemData(iIndex, (DWORD)pSptRecord); return TRUE; } BOOL COpCreateCESptDlg::InsertNew3PSptRec(CSptRecord* pSptRecord, CChannel* pChannel) { int iIndex = (int)VAL_ZERO; CString szValue = _T(""); if (!this->m_ceSptNew3PDlg.UpdateData(TRUE)) { hHook = SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTHookProc,AfxGetInstanceHandle(),NULL); if (LANG_ZHCN == g_iUILanguage) AfxMessageBox(_T("撤回CesSpt3PVesSptSDialog数据失败")); else MessageBoxEx(NULL, _T("Retrieve CesSpt3PVesSptSDialog Data Failed!"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)); return FALSE; } if (!bIsInteger(m_ceSptNew3PDlg.m_strStacking)) { hHook = SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTHookProc,AfxGetInstanceHandle(),NULL); if (LANG_ZHCN == g_iUILanguage) AfxMessageBox(_T("迭代数错误,请输入一个1到255的正数")); else MessageBoxEx(NULL, _T("Stacking number input error!please input an integer from 1 to 255!"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)); return FALSE; } m_ceSptNew3PDlg.m_unIterNum = atoi(m_ceSptNew3PDlg.m_strStacking); if (m_ceSptNew3PDlg.m_unIterNum < 1 || m_ceSptNew3PDlg.m_unIterNum > 255) { hHook = SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTHookProc,AfxGetInstanceHandle(),NULL); if (LANG_ZHCN == g_iUILanguage) AfxMessageBox(_T("迭代数错误,请输入一个1到255的正数")); else MessageBoxEx(NULL, _T("Stacking number input error!please input an integer from 1 to 255!"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)); return FALSE; } szValue.Empty(); this->m_ceSptNew3PDlg.m_edA.GetWindowText(szValue); pSptRecord->m_fA = (float)(atof(szValue)*1.0); if (pSptRecord->m_fA <= 0 ) { hHook = SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTHookProc,AfxGetInstanceHandle(),NULL); if (LANG_ZHCN == g_iUILanguage) AfxMessageBox(_T("a的值须为正数")); else MessageBoxEx(NULL, _T("Please input a positive number on a"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)); this->m_ceSptNew3PDlg.m_edA.SetFocus(); return FALSE; } szValue.Empty(); this->m_ceSptNew3PDlg.m_edB.GetWindowText(szValue); pSptRecord->m_fB = (float)(atof(szValue)*1.0); if (pSptRecord->m_fB <= 0 ) { hHook = SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTHookProc,AfxGetInstanceHandle(),NULL); if (LANG_ZHCN == g_iUILanguage) AfxMessageBox(_T("b的值须为正数")); else MessageBoxEx(NULL, _T("Please input a positive number on b"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)); this->m_ceSptNew3PDlg.m_edB.SetFocus(); return FALSE; } if (pSptRecord->m_fA <= pSptRecord->m_fB) { hHook = SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTHookProc,AfxGetInstanceHandle(),NULL); if (LANG_ZHCN == g_iUILanguage) AfxMessageBox(_T("a的值必须大于b.")); else MessageBoxEx(NULL, _T("The value of a must bigger than b."), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)); this->m_ceSptNew3PDlg.m_edA.SetFocus(); return FALSE; } pSptRecord->m_iN = this->m_ceSptNew3PDlg.m_unIterNum; pSptRecord->m_fK = fabs(pChannel->m_pMedium->CalculateCESptKVal(pSptRecord->m_fA, pSptRecord->m_fB, 0.0, 0.0)); pSptRecord->m_iTsn = pChannel->m_sptRecArray.GetSize() + 1; pChannel->m_sptRecArray.Add((void*)pSptRecord); iIndex = this->m_ceSptList.GetItemCount(); szValue.Empty(); szValue.Format(_T("%d"), pSptRecord->m_iTsn); this->m_ceSptList.InsertItem(iIndex, szValue); szValue.Empty(); szValue.Format(_T("%.2f"), pSptRecord->m_fA); this->m_ceSptList.SetItemText(iIndex, 1, szValue); szValue.Empty(); szValue.Format(_T("%.2f"), pSptRecord->m_fB); this->m_ceSptList.SetItemText(iIndex, 2, szValue); szValue.Empty(); szValue.Format(_T("%.2f"), pSptRecord->m_fX); this->m_ceSptList.SetItemText(iIndex, 3, szValue); szValue.Empty(); szValue.Format(_T("%.2f"), pSptRecord->m_fY); this->m_ceSptList.SetItemText(iIndex, 4, szValue); szValue.Empty(); szValue.Format(_T("%f"), pSptRecord->m_fK); this->m_ceSptList.SetItemText(iIndex, 5, szValue); szValue.Empty(); szValue.Format(_T("%d"), pSptRecord->m_iN); this->m_ceSptList.SetItemText(iIndex, 6, szValue); this->m_ceSptList.SetItemData(iIndex, (DWORD)pSptRecord); return TRUE; } // BOOL COpCreateCESptDlg::InsertRECTGLSptRec(CChannel* pChannel) // { // if (!m_ceSptRECTGLDlg.UpdateData(TRUE)) // { // hHook = SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTHookProc,AfxGetInstanceHandle(),NULL); // AfxMessageBox(_T("Retrieve CeSptRectDialog data failed!")); // return FALSE; // } // // if (!bIsInteger(m_ceSptRECTGLDlg.m_strStacking)) // { // hHook = SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTHookProc,AfxGetInstanceHandle(),NULL); // AfxMessageBox(_T("Stacking number input error!please input an integer from 1 to 255!")); // return FALSE; // } // m_ceSptRECTGLDlg.m_unIterNum = atoi(m_ceSptRECTGLDlg.m_strStacking); // // if (m_ceSptRECTGLDlg.m_unIterNum < 1 || m_ceSptRECTGLDlg.m_unIterNum > 255) // { // hHook = SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTHookProc,AfxGetInstanceHandle(),NULL); // AfxMessageBox(_T("Stacking number input error!please input an integer from 1 to 255!")); // return FALSE; // } // CSptRecord* pSptRecord = NULL; // // int iIndex = (int)VAL_ZERO; // CString szValue = _T(""); // // int iMaxCol = (int)VAL_ZERO; // int iMaxRow = (int)VAL_ZERO; // // int iCol = (int)VAL_ZERO; // int iRow = (int)VAL_ZERO; // // float fCenterX = (float)VAL_ZERO; // float fCenterY = (float)VAL_ZERO; // // float fColSpace = (float)VAL_ZERO; // float fRowSpace = (float)VAL_ZERO; // // szValue.Empty(); // this->m_ceSptRECTGLDlg.m_edMaxCol.GetWindowText(szValue); // // iMaxCol = atoi(szValue); // if (iMaxCol <= 0) // { // hHook = SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTHookProc,AfxGetInstanceHandle(),NULL); // AfxMessageBox(_T("Please input a positive number on Gridding.")); // this->m_ceSptRECTGLDlg.m_edMaxCol.SetFocus(); // return FALSE; // } // // szValue.Empty(); // this->m_ceSptRECTGLDlg.m_edMaxRow.GetWindowText(szValue); // // iMaxRow = atoi(szValue); // if (iMaxRow <= 0) // { // hHook = SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTHookProc,AfxGetInstanceHandle(),NULL); // AfxMessageBox(_T("Please input a positive number on Gridding.")); // this->m_ceSptRECTGLDlg.m_edMaxRow.SetFocus(); // return FALSE; // } // // szValue.Empty(); // this->m_ceSptRECTGLDlg.m_edRowSpace.GetWindowText(szValue); // // fRowSpace = (float)(atof(szValue) * 1.0); // // if (fRowSpace <= 0) // { // hHook = SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTHookProc,AfxGetInstanceHandle(),NULL); // AfxMessageBox(_T("Please input a positive number on Row spacing.")); // this->m_ceSptRECTGLDlg.m_edRowSpace.SetFocus(); // return FALSE; // } // // szValue.Empty(); // this->m_ceSptRECTGLDlg.m_edColSpace.GetWindowText(szValue); // // fColSpace = (float)(atof(szValue) * 1.0); // // if (fColSpace <= 0) // { // hHook = SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTHookProc,AfxGetInstanceHandle(),NULL); // MessageBox(_T("Please input a positive number on Col spacing.")); // this->m_ceSptRECTGLDlg.m_edColSpace.SetFocus(); // return FALSE; // } // // //////////////////////新增加对a 和 b的判断//////////////////////////////// // szValue.Empty(); // this->m_ceSptRECTGLDlg.m_edA.GetWindowText(szValue); // float fA = atof(szValue); // if (fA <= 0) // { // hHook = SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTHookProc,AfxGetInstanceHandle(),NULL); // MessageBox(_T("Please input a positive number on a.")); // this->m_ceSptRECTGLDlg.m_edA.SetFocus(); // return FALSE; // } // // szValue.Empty(); // this->m_ceSptRECTGLDlg.m_edB.GetWindowText(szValue); // float fB = atof(szValue); // if (fB <= 0) // { // hHook = SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTHookProc,AfxGetInstanceHandle(),NULL); // MessageBox(_T("Please input a positive number on b.")); // this->m_ceSptRECTGLDlg.m_edB.SetFocus(); // return FALSE; // } // ////////////////////////////////////////////////////////////////////////// // // if (0 == (iMaxCol % 2)) // { // fCenterX = (float)((iMaxCol - 1) / 2 * fColSpace + fColSpace / 2.0); // } // else // { // fCenterX = (float)(iMaxCol / 2 * fColSpace); // } // // if (0 == (iMaxRow % 2)) // { // fCenterY = (float)((iMaxRow - 1) / 2 * fRowSpace + fRowSpace / 2.0); // } // else // { // fCenterY = (float)(iMaxRow / 2 * fRowSpace); // } // // this->m_ceSptList.DeleteAllItems(); // pChannel->ClearSptRecList(); // // iRow = (int)VAL_ZERO; // while (iRow < iMaxRow) // { // iCol = (int)VAL_ZERO; // while (iCol < iMaxCol) // { // if (!this->m_ceSptRECTGLDlg.UpdateData(TRUE)) // { // AfxMessageBox(_T("Retrieve CeSptRectDialog data failed!")); // return FALSE; // } // // // // pSptRecord = NULL; // pSptRecord = new CSptRecord; // // szValue.Empty(); // this->m_ceSptRECTGLDlg.m_edA.GetWindowText(szValue); // // pSptRecord->m_fA = (float)(atof(szValue)*1.0); // // szValue.Empty(); // this->m_ceSptRECTGLDlg.m_edB.GetWindowText(szValue); // // pSptRecord->m_fB = (float)(atof(szValue)*1.0); // // pSptRecord->m_iTsn = iRow * iMaxCol + iCol + 1; // pSptRecord->m_iN = this->m_ceSptRECTGLDlg.m_unIterNum; // // pSptRecord->m_fX = (float)(iCol * fColSpace - fCenterX); // pSptRecord->m_fY = (float)((-1) * iRow * fRowSpace + fCenterY); // // pSptRecord->m_fK = fabs(pChannel->m_pMedium->CalculateCESptKVal(pSptRecord->m_fA, pSptRecord->m_fB, pSptRecord->m_fX, pSptRecord->m_fY)); // // pChannel->m_sptRecArray.Add((void*)pSptRecord); // // szValue.Empty(); // szValue.Format(_T("%d"), pSptRecord->m_iTsn); // this->m_ceSptList.InsertItem(pSptRecord->m_iTsn - 1, szValue); // // szValue.Empty(); // szValue.Format(_T("%.1f"), pSptRecord->m_fA); // this->m_ceSptList.SetItemText(pSptRecord->m_iTsn - 1, 1, szValue); // // szValue.Empty(); // szValue.Format(_T("%.1f"), pSptRecord->m_fB); // this->m_ceSptList.SetItemText(pSptRecord->m_iTsn - 1, 2, szValue); // // szValue.Empty(); // szValue.Format(_T("%.1f"), pSptRecord->m_fX); // this->m_ceSptList.SetItemText(pSptRecord->m_iTsn - 1, 3, szValue); // // szValue.Empty(); // szValue.Format(_T("%.1f"), pSptRecord->m_fY); // this->m_ceSptList.SetItemText(pSptRecord->m_iTsn - 1, 4, szValue); // // szValue.Empty(); // szValue.Format(_T("%f"), pSptRecord->m_fK); // this->m_ceSptList.SetItemText(pSptRecord->m_iTsn - 1, 5, szValue); // // szValue.Empty(); // szValue.Format(_T("%d"), pSptRecord->m_iN); // this->m_ceSptList.SetItemText(pSptRecord->m_iTsn - 1, 6, szValue); // // this->m_ceSptList.SetItemData(pSptRecord->m_iTsn - 1, (DWORD)pSptRecord); // // iCol ++; // } // // iRow ++; // } // // return TRUE; // } BOOL COpCreateCESptDlg::InsertRECTGLSptRec(CChannel* pChannel) { if (!m_ceSptRECTGLDlg.UpdateData(TRUE)) { hHook = SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTHookProc,AfxGetInstanceHandle(),NULL); if (LANG_ZHCN == g_iUILanguage) AfxMessageBox(_T("撤回CeSptRectDialog数据失败")); else MessageBoxEx(NULL, _T("Retrieve CeSptRectDialog data failed!"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)); return FALSE; } if (!bIsInteger(m_ceSptRECTGLDlg.m_strStacking)) { hHook = SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTHookProc,AfxGetInstanceHandle(),NULL); if (LANG_ZHCN == g_iUILanguage) AfxMessageBox(_T("迭代数错误,请输入一个1到255的正数")); else MessageBoxEx(NULL, _T("Stacking number input error!please input an integer from 1 to 255!"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)); return FALSE; } m_ceSptRECTGLDlg.m_unIterNum = atoi(m_ceSptRECTGLDlg.m_strStacking); if (m_ceSptRECTGLDlg.m_unIterNum < 1 || m_ceSptRECTGLDlg.m_unIterNum > 255) { hHook = SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTHookProc,AfxGetInstanceHandle(),NULL); if (LANG_ZHCN == g_iUILanguage) AfxMessageBox(_T("迭代数错误,请输入一个1到255的正数")); else MessageBoxEx(NULL, _T("Stacking number input error!please input an integer from 1 to 255!"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)); return FALSE; } CSptRecord* pSptRecord = NULL; CString szValue = _T(""); float fColSpace = (float)VAL_ZERO; float fRowSpace = (float)VAL_ZERO; szValue.Empty(); this->m_ceSptRECTGLDlg.m_edRowSpace.GetWindowText(szValue); if (!bIsFloat(szValue)) { if (LANG_ZHCN == g_iUILanguage) AfxMessageBox(_T("x的值输入错误")); else MessageBoxEx(NULL, _T("Please input a number on x."), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)); this->m_ceSptRECTGLDlg.m_edRowSpace.SetFocus(); return FALSE; } fRowSpace = (float)(atof(szValue) * 1.0); if(fabs(fRowSpace) > 100000) { if (LANG_ZHCN == g_iUILanguage) AfxMessageBox(_T("x的值超过最大限制")); else MessageBoxEx(NULL, _T("The value of X exceeds the maximum range."), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)); this->m_ceSptRECTGLDlg.m_edRowSpace.SetFocus(); return FALSE; } szValue.Empty(); this->m_ceSptRECTGLDlg.m_edColSpace.GetWindowText(szValue); if (!bIsFloat(szValue)) { if (LANG_ZHCN == g_iUILanguage) AfxMessageBox(_T("y的值输入错误")); else MessageBoxEx(NULL, _T("Please input a number on y."), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)); this->m_ceSptRECTGLDlg.m_edColSpace.SetFocus(); return FALSE; } fColSpace = (float)(atof(szValue) * 1.0); if(fabs(fColSpace) > 100000) { if (LANG_ZHCN == g_iUILanguage) AfxMessageBox(_T("y的值超过最大限制")); else MessageBoxEx(NULL, _T("The value of y exceeds the maximum range."), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)); this->m_ceSptRECTGLDlg.m_edColSpace.SetFocus(); return FALSE; } //////////////////////新增加对a 和 b的判断//////////////////////////////// szValue.Empty(); this->m_ceSptRECTGLDlg.m_edA.GetWindowText(szValue); float fA = atof(szValue); if (fA <= 0) { hHook = SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTHookProc,AfxGetInstanceHandle(),NULL); if (LANG_ZHCN == g_iUILanguage) MessageBox(_T("a的值须为正数!")); else MessageBoxEx(NULL, _T("Please input a positive number on a"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)); this->m_ceSptRECTGLDlg.m_edA.SetFocus(); return FALSE; } szValue.Empty(); this->m_ceSptRECTGLDlg.m_edB.GetWindowText(szValue); float fB = atof(szValue); if (fB <= 0) { hHook = SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTHookProc,AfxGetInstanceHandle(),NULL); if (LANG_ZHCN == g_iUILanguage) MessageBox(_T("b的值须为正数!")); else MessageBoxEx(NULL, _T("Please input a positive number on b"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)); this->m_ceSptRECTGLDlg.m_edB.SetFocus(); return FALSE; } ////////////////////////////////////////////////////////////////////////// pSptRecord = NULL; pSptRecord = new CSptRecord; szValue.Empty(); this->m_ceSptRECTGLDlg.m_edA.GetWindowText(szValue); pSptRecord->m_fA = (float)(atof(szValue)*1.0); szValue.Empty(); this->m_ceSptRECTGLDlg.m_edB.GetWindowText(szValue); pSptRecord->m_fB = (float)(atof(szValue)*1.0); pSptRecord->m_iTsn = pChannel->m_sptRecArray.GetSize() + 1; pSptRecord->m_iN = this->m_ceSptRECTGLDlg.m_unIterNum; pSptRecord->m_fX = fRowSpace; pSptRecord->m_fY = fColSpace; pSptRecord->m_fK = fabs(pChannel->m_pMedium->CalculateCESptKVal(pSptRecord->m_fA, pSptRecord->m_fB, pSptRecord->m_fX, pSptRecord->m_fY)); pChannel->m_sptRecArray.Add((void*)pSptRecord); int iIndex = this->m_ceSptList.GetItemCount(); szValue.Empty(); szValue.Format(_T("%d"), pSptRecord->m_iTsn); this->m_ceSptList.InsertItem(iIndex, szValue); szValue.Empty(); szValue.Format(_T("%.2f"), pSptRecord->m_fA); this->m_ceSptList.SetItemText(iIndex, 1, szValue); szValue.Empty(); szValue.Format(_T("%.2f"), pSptRecord->m_fB); this->m_ceSptList.SetItemText(iIndex, 2, szValue); szValue.Empty(); szValue.Format(_T("%.2f"), pSptRecord->m_fX); this->m_ceSptList.SetItemText(iIndex, 3, szValue); szValue.Empty(); szValue.Format(_T("%.2f"), pSptRecord->m_fY); this->m_ceSptList.SetItemText(iIndex, 4, szValue); szValue.Empty(); szValue.Format(_T("%f"), pSptRecord->m_fK); this->m_ceSptList.SetItemText(iIndex, 5, szValue); szValue.Empty(); szValue.Format(_T("%d"), pSptRecord->m_iN); this->m_ceSptList.SetItemText(iIndex, 6, szValue); this->m_ceSptList.SetItemData(iIndex, (DWORD)pSptRecord); return TRUE; } BOOL COpCreateCESptDlg::InsertCUSTOMSptRec(CSptRecord* pSptRecord, CChannel* pChannel) { int iIndex = (int)VAL_ZERO; CString szValue = _T(""); if (!this->m_ceSptCUSTOMDlg.UpdateData(TRUE)) { hHook = SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTHookProc,AfxGetInstanceHandle(),NULL); if (LANG_ZHCN == g_iUILanguage) AfxMessageBox(_T("撤回CeSptCustomDialog数据失败")); else MessageBoxEx(NULL, _T("Retrieve CeSptCustomDialog data failed!"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)); return FALSE; } if (!bIsInteger(m_ceSptCUSTOMDlg.m_strStacking)) { hHook = SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTHookProc,AfxGetInstanceHandle(),NULL); if (LANG_ZHCN == g_iUILanguage) AfxMessageBox(_T("迭代数错误,请输入一个1到255的正数")); else MessageBoxEx(NULL, _T("Stacking number input error!please input an integer from 1 to 255!"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)); return FALSE; } m_ceSptCUSTOMDlg.m_unIterNum = atoi(m_ceSptCUSTOMDlg.m_strStacking); if (m_ceSptCUSTOMDlg.m_unIterNum < 1 || m_ceSptCUSTOMDlg.m_unIterNum > 255) { hHook = SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTHookProc,AfxGetInstanceHandle(),NULL); if (LANG_ZHCN == g_iUILanguage) AfxMessageBox(_T("迭代数错误,请输入一个1到255的正数")); else MessageBoxEx(NULL, _T("Stacking number input error!please input an integer from 1 to 255!"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)); return FALSE; } szValue.Empty(); this->m_ceSptCUSTOMDlg.m_edA.GetWindowText(szValue); pSptRecord->m_fA = (float)(atof(szValue)*1.0); szValue.Empty(); this->m_ceSptCUSTOMDlg.m_edB.GetWindowText(szValue); pSptRecord->m_fB = (float)(atof(szValue)*1.0); szValue.Empty(); this->m_ceSptCUSTOMDlg.m_edX.GetWindowText(szValue); pSptRecord->m_fX = (float)(atof(szValue)*1.0); szValue.Empty(); this->m_ceSptCUSTOMDlg.m_edY.GetWindowText(szValue); pSptRecord->m_fY = (float)(atof(szValue)*1.0); szValue.Empty(); this->m_ceSptCUSTOMDlg.m_edK.GetWindowText(szValue); pSptRecord->m_fK = (float)(atof(szValue)*1.0); pSptRecord->m_iN = this->m_ceSptCUSTOMDlg.m_unIterNum; pSptRecord->m_iTsn = pChannel->m_sptRecArray.GetSize() + 1; pChannel->m_sptRecArray.Add((void*)pSptRecord); iIndex = this->m_ceSptList.GetItemCount(); szValue.Empty(); szValue.Format(_T("%d"), pSptRecord->m_iTsn); this->m_ceSptList.InsertItem(iIndex, szValue); szValue.Empty(); szValue.Format(_T("%.2f"), pSptRecord->m_fA); this->m_ceSptList.SetItemText(iIndex, 1, szValue); szValue.Empty(); szValue.Format(_T("%.2f"), pSptRecord->m_fB); this->m_ceSptList.SetItemText(iIndex, 2, szValue); szValue.Empty(); szValue.Format(_T("%.2f"), pSptRecord->m_fX); this->m_ceSptList.SetItemText(iIndex, 3, szValue); szValue.Empty(); szValue.Format(_T("%.2f"), pSptRecord->m_fY); this->m_ceSptList.SetItemText(iIndex, 4, szValue); szValue.Empty(); szValue.Format(_T("%f"), pSptRecord->m_fK); this->m_ceSptList.SetItemText(iIndex, 5, szValue); szValue.Empty(); szValue.Format(_T("%d"), pSptRecord->m_iN); this->m_ceSptList.SetItemText(iIndex, 6, szValue); this->m_ceSptList.SetItemData(iIndex, (DWORD)pSptRecord); return TRUE; } BOOL COpCreateCESptDlg::Update4PVESSptRec(CSptRecord* pSptRecord, CChannel* pChannel) { POSITION pos; int iIndex = (int)VAL_ZERO; CString szValue = _T(""); if (!this->m_ceSpt4PVESDlg.UpdateData(TRUE)) { hHook = SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTHookProc,AfxGetInstanceHandle(),NULL); if (LANG_ZHCN == g_iUILanguage) AfxMessageBox(_T("正在更新撤回CeSpt4PVESDialog数据失败!")); else MessageBoxEx(NULL, _T("Retrieve CeSpt4PVESDialog data failed when update!"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)); return FALSE; } if (!bIsInteger(m_ceSpt4PVESDlg.m_strStacking)) { hHook = SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTHookProc,AfxGetInstanceHandle(),NULL); if (LANG_ZHCN == g_iUILanguage) AfxMessageBox(_T("迭代数错误,请输入一个1到255的正数")); else MessageBoxEx(NULL, _T("Stacking number input error!please input an integer from 1 to 255!"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)); return FALSE; } m_ceSpt4PVESDlg.m_unIterNum = atoi(m_ceSpt4PVESDlg.m_strStacking); if (m_ceSpt4PVESDlg.m_unIterNum < 1 || m_ceSpt4PVESDlg.m_unIterNum > 255) { hHook = SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTHookProc,AfxGetInstanceHandle(),NULL); if (LANG_ZHCN == g_iUILanguage) AfxMessageBox(_T("迭代数错误,请输入一个1到255的正数")); else MessageBoxEx(NULL, _T("Stacking number input error!please input an integer from 1 to 255!"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)); return FALSE; } szValue.Empty(); this->m_ceSpt4PVESDlg.m_edA.GetWindowText(szValue); pSptRecord->m_fA = (float)(atof(szValue)*1.0); if (pSptRecord->m_fA <= 0) { hHook = SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTHookProc,AfxGetInstanceHandle(),NULL); if (LANG_ZHCN == g_iUILanguage) AfxMessageBox(_T("a的值须为正数")); else MessageBoxEx(NULL, _T("Please input a positive number on a"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)); this->m_ceSpt4PVESDlg.m_edA.SetFocus(); return FALSE; } szValue.Empty(); this->m_ceSpt4PVESDlg.m_edB.GetWindowText(szValue); pSptRecord->m_fB = (float)(atof(szValue)*1.0); if (pSptRecord->m_fB <= 0) { hHook = SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTHookProc,AfxGetInstanceHandle(),NULL); if (LANG_ZHCN == g_iUILanguage) AfxMessageBox(_T("b的值须为正数")); else MessageBoxEx(NULL, _T("Please input a positive number on b"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)); this->m_ceSpt4PVESDlg.m_edB.SetFocus(); return FALSE; } if (pSptRecord->m_fA <= pSptRecord->m_fB) { hHook = SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTHookProc,AfxGetInstanceHandle(),NULL); if (LANG_ZHCN == g_iUILanguage) AfxMessageBox(_T("a的值须大于b")); else MessageBoxEx(NULL, _T("The value of a must bigger than b."), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)); this->m_ceSpt4PVESDlg.m_edA.SetFocus(); return FALSE; } pSptRecord->m_iN = this->m_ceSpt4PVESDlg.m_unIterNum; pSptRecord->m_fK = fabs(pChannel->m_pMedium->CalculateCESptKVal(pSptRecord->m_fA, pSptRecord->m_fB, 0.0, 0.0)); iIndex = this->m_ceSptList.GetItemCount(); pos = this->m_ceSptList.GetFirstSelectedItemPosition(); iIndex = this->m_ceSptList.GetNextSelectedItem(pos); szValue.Empty(); szValue.Format(_T("%d"), pSptRecord->m_iTsn); this->m_ceSptList.SetItemText(iIndex, 0, szValue); szValue.Empty(); szValue.Format(_T("%.2f"), pSptRecord->m_fA); this->m_ceSptList.SetItemText(iIndex, 1, szValue); szValue.Empty(); szValue.Format(_T("%.2f"), pSptRecord->m_fB); this->m_ceSptList.SetItemText(iIndex, 2, szValue); szValue.Empty(); szValue.Format(_T("%.2f"), pSptRecord->m_fX); this->m_ceSptList.SetItemText(iIndex, 3, szValue); szValue.Empty(); szValue.Format(_T("%.2f"), pSptRecord->m_fY); this->m_ceSptList.SetItemText(iIndex, 4, szValue); szValue.Empty(); szValue.Format(_T("%f"), pSptRecord->m_fK); this->m_ceSptList.SetItemText(iIndex, 5, szValue); szValue.Empty(); szValue.Format(_T("%d"), pSptRecord->m_iN); this->m_ceSptList.SetItemText(iIndex, 6, szValue); return TRUE; } BOOL COpCreateCESptDlg::UpdateDipoleSptRec(CSptRecord* pSptRecord, CChannel* pChannel) { POSITION pos; int iIndex = (int)VAL_ZERO; CString szValue = _T(""); if (!this->m_ceSptDIPOLEDlg.UpdateData(TRUE)) { hHook = SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTHookProc,AfxGetInstanceHandle(),NULL); if (LANG_ZHCN == g_iUILanguage) AfxMessageBox(_T("正在更新撤回CeSptDipoleDialog数据失败")); else MessageBoxEx(NULL, _T("Retrieve CeSptDipoleDialog data failed when update!"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)); return FALSE; } if (!bIsInteger(m_ceSptDIPOLEDlg.m_strStacking)) { hHook = SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTHookProc,AfxGetInstanceHandle(),NULL); if (LANG_ZHCN == g_iUILanguage) AfxMessageBox(_T("迭代数错误,请输入一个1到255的正数")); else MessageBoxEx(NULL, _T("Stacking number input error!please input an integer from 1 to 255!"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)); return FALSE; } m_ceSptDIPOLEDlg.m_unIterNum = atoi(m_ceSptDIPOLEDlg.m_strStacking); if (m_ceSptDIPOLEDlg.m_unIterNum < 1 || m_ceSptDIPOLEDlg.m_unIterNum > 255) { hHook = SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTHookProc,AfxGetInstanceHandle(),NULL); if (LANG_ZHCN == g_iUILanguage) AfxMessageBox(_T("迭代数错误,请输入一个1到255的正数")); else MessageBoxEx(NULL, _T("Stacking number input error!please input an integer from 1 to 255!"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)); return FALSE; } szValue.Empty(); this->m_ceSptDIPOLEDlg.m_edA.GetWindowText(szValue); pSptRecord->m_fA = (float)(atof(szValue)*1.0); if (pSptRecord->m_fA <= 0) { hHook = SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTHookProc,AfxGetInstanceHandle(),NULL); if (LANG_ZHCN == g_iUILanguage) AfxMessageBox(_T("a的值须为正数")); else MessageBoxEx(NULL, _T("Please input a positive number on a"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)); this->m_ceSptDIPOLEDlg.m_edA.SetFocus(); return FALSE; } szValue.Empty(); this->m_ceSptDIPOLEDlg.m_edB.GetWindowText(szValue); pSptRecord->m_fB = (float)(atof(szValue)*1.0); if (pSptRecord->m_fB <= 0) { hHook = SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTHookProc,AfxGetInstanceHandle(),NULL); if (LANG_ZHCN == g_iUILanguage) AfxMessageBox(_T("b的值须为正数")); else MessageBoxEx(NULL, _T("Please input a positive number on b"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)); this->m_ceSptDIPOLEDlg.m_edB.SetFocus(); return FALSE; } if (pSptRecord->m_fA >= pSptRecord->m_fB) { hHook = SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTHookProc,AfxGetInstanceHandle(),NULL); if (LANG_ZHCN == g_iUILanguage) AfxMessageBox(_T("a必须小于b.")); else MessageBoxEx(NULL, _T("The value of a must less than b."), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)); return FALSE; } pSptRecord->m_iN = this->m_ceSptDIPOLEDlg.m_unIterNum; pSptRecord->m_fK = fabs(pChannel->m_pMedium->CalculateCESptKVal(pSptRecord->m_fA, pSptRecord->m_fB, 0.0, 0.0)); iIndex = this->m_ceSptList.GetItemCount(); pos = this->m_ceSptList.GetFirstSelectedItemPosition(); iIndex = this->m_ceSptList.GetNextSelectedItem(pos); szValue.Empty(); szValue.Format(_T("%d"), pSptRecord->m_iTsn); this->m_ceSptList.SetItemText(iIndex, 0, szValue); szValue.Empty(); szValue.Format(_T("%.2f"), pSptRecord->m_fA); this->m_ceSptList.SetItemText(iIndex, 1, szValue); szValue.Empty(); szValue.Format(_T("%.2f"), pSptRecord->m_fB); this->m_ceSptList.SetItemText(iIndex, 2, szValue); szValue.Empty(); szValue.Format(_T("%.2f"), pSptRecord->m_fX); this->m_ceSptList.SetItemText(iIndex, 3, szValue); szValue.Empty(); szValue.Format(_T("%.2f"), pSptRecord->m_fY); this->m_ceSptList.SetItemText(iIndex, 4, szValue); szValue.Empty(); szValue.Format(_T("%f"), pSptRecord->m_fK); this->m_ceSptList.SetItemText(iIndex, 5, szValue); szValue.Empty(); szValue.Format(_T("%d"), pSptRecord->m_iN); this->m_ceSptList.SetItemText(iIndex, 6, szValue); return TRUE; } BOOL COpCreateCESptDlg::UpdateRECTGLSptRec(CSptRecord* pSptRecord, CChannel* pChannel) { POSITION pos; int iIndex = (int)VAL_ZERO; if (!this->m_ceSptRECTGLDlg.UpdateData(TRUE)) { hHook = SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTHookProc,AfxGetInstanceHandle(),NULL); if (LANG_ZHCN == g_iUILanguage) AfxMessageBox(_T("正在更新撤回CesSptRectDialog数据失败!")); else MessageBoxEx(NULL, _T("Retrieve CesSptRectDialog data failed when update!"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)); return FALSE; } if (!bIsInteger(m_ceSptRECTGLDlg.m_strStacking)) { hHook = SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTHookProc,AfxGetInstanceHandle(),NULL); if (LANG_ZHCN == g_iUILanguage) AfxMessageBox(_T("迭代数错误,请输入一个1到255的正数")); else MessageBoxEx(NULL, _T("Stacking number input error!please input an integer from 1 to 255!"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)); return FALSE; } m_ceSptRECTGLDlg.m_unIterNum = atoi(m_ceSptRECTGLDlg.m_strStacking); if (m_ceSptRECTGLDlg.m_unIterNum < 1 || m_ceSptRECTGLDlg.m_unIterNum > 255) { hHook = SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTHookProc,AfxGetInstanceHandle(),NULL); if (LANG_ZHCN == g_iUILanguage) AfxMessageBox(_T("迭代数错误,请输入一个1到255的正数")); else MessageBoxEx(NULL, _T("Stacking number input error!please input an integer from 1 to 255!"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)); return FALSE; } CString szValue = _T(""); float fX = (float)VAL_ZERO; float fY = (float)VAL_ZERO; szValue.Empty(); this->m_ceSptRECTGLDlg.m_edRowSpace.GetWindowText(szValue); fX = (float)(atof(szValue) * 1.0); if (fX <= 0) { hHook = SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTHookProc,AfxGetInstanceHandle(),NULL); if (LANG_ZHCN == g_iUILanguage) AfxMessageBox(_T("x的值须为正数")); else MessageBoxEx(NULL, _T("Please input a positive number on x."), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)); this->m_ceSptRECTGLDlg.m_edRowSpace.SetFocus(); return FALSE; } szValue.Empty(); this->m_ceSptRECTGLDlg.m_edColSpace.GetWindowText(szValue); fY = (float)(atof(szValue) * 1.0); if (fY <= 0) { hHook = SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTHookProc,AfxGetInstanceHandle(),NULL); if (LANG_ZHCN == g_iUILanguage) AfxMessageBox(_T("y的值须为正数")); else MessageBoxEx(NULL, _T("Please input a positive number on y."), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)); this->m_ceSptRECTGLDlg.m_edColSpace.SetFocus(); return FALSE; } //////////////////////新增加对a 和 b的判断//////////////////////////////// szValue.Empty(); this->m_ceSptRECTGLDlg.m_edA.GetWindowText(szValue); float fA = atof(szValue); if (fA <= 0) { hHook = SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTHookProc,AfxGetInstanceHandle(),NULL); if (LANG_ZHCN == g_iUILanguage) MessageBox(_T("a的值须为正数!")); else MessageBoxEx(NULL, _T("Please input a positive number on a"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)); this->m_ceSptRECTGLDlg.m_edA.SetFocus(); return FALSE; } szValue.Empty(); this->m_ceSptRECTGLDlg.m_edB.GetWindowText(szValue); float fB = atof(szValue); if (fB <= 0) { hHook = SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTHookProc,AfxGetInstanceHandle(),NULL); if (LANG_ZHCN == g_iUILanguage) MessageBox(_T("b的值须为正数!")); else MessageBoxEx(NULL, _T("Please input a positive number on b"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)); this->m_ceSptRECTGLDlg.m_edB.SetFocus(); return FALSE; } //这里不需要对A和B之间大小做限制 // if (pSptRecord->m_fA <= pSptRecord->m_fB) // { // hHook = SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTHookProc,AfxGetInstanceHandle(),NULL); // AfxMessageBox(_T("The value of a must bigger than b.")); // this->m_ceSptRECTGLDlg.m_edA.SetFocus(); // return FALSE; // // } pSptRecord->m_fX = fX; pSptRecord->m_fY = fY; pSptRecord->m_fA = fA; pSptRecord->m_fB = fB; pSptRecord->m_iN = this->m_ceSptRECTGLDlg.m_unIterNum; pSptRecord->m_fK = fabs(pChannel->m_pMedium->CalculateCESptKVal(pSptRecord->m_fA, pSptRecord->m_fB, pSptRecord->m_fX, pSptRecord->m_fY)); pos = this->m_ceSptList.GetFirstSelectedItemPosition(); iIndex = this->m_ceSptList.GetNextSelectedItem(pos); szValue.Empty(); szValue.Format(_T("%d"), pSptRecord->m_iTsn); this->m_ceSptList.SetItemText(iIndex, 0, szValue); szValue.Empty(); szValue.Format(_T("%.2f"), pSptRecord->m_fA); this->m_ceSptList.SetItemText(iIndex, 1, szValue); szValue.Empty(); szValue.Format(_T("%.2f"), pSptRecord->m_fB); this->m_ceSptList.SetItemText(iIndex, 2, szValue); szValue.Empty(); szValue.Format(_T("%.2f"), pSptRecord->m_fX); this->m_ceSptList.SetItemText(iIndex, 3, szValue); szValue.Empty(); szValue.Format(_T("%.2f"), pSptRecord->m_fY); this->m_ceSptList.SetItemText(iIndex, 4, szValue); szValue.Empty(); szValue.Format(_T("%f"), pSptRecord->m_fK); this->m_ceSptList.SetItemText(iIndex, 5, szValue); szValue.Empty(); szValue.Format(_T("%d"), pSptRecord->m_iN); this->m_ceSptList.SetItemText(iIndex, 6, szValue); return TRUE; } BOOL COpCreateCESptDlg::UpdateNew3PVesSptRec(CSptRecord* pSptRecord, CChannel* pChannel) { POSITION pos; int iIndex = (int)VAL_ZERO; CString szValue = _T(""); if (!this->m_ceSptNew3PDlg.UpdateData(TRUE)) { hHook = SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTHookProc,AfxGetInstanceHandle(),NULL); if (LANG_ZHCN == g_iUILanguage) AfxMessageBox(_T("正在更新撤回CesSpt3PVESDialog数据失败")); else MessageBoxEx(NULL, _T("Retrieve CesSpt3PVESDialog data failed when update!"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)); return FALSE; } if (!bIsInteger(m_ceSptNew3PDlg.m_strStacking)) { hHook = SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTHookProc,AfxGetInstanceHandle(),NULL); if (LANG_ZHCN == g_iUILanguage) AfxMessageBox(_T("迭代数错误,请输入一个1到255的正数")); else MessageBoxEx(NULL, _T("Stacking number input error!please input an integer from 1 to 255!"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)); return FALSE; } m_ceSptNew3PDlg.m_unIterNum = atoi(m_ceSptNew3PDlg.m_strStacking); if (m_ceSptNew3PDlg.m_unIterNum < 1 || m_ceSptNew3PDlg.m_unIterNum > 255) { hHook = SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTHookProc,AfxGetInstanceHandle(),NULL); if (LANG_ZHCN == g_iUILanguage) AfxMessageBox(_T("迭代数错误,请输入一个1到255的正数")); else MessageBoxEx(NULL, _T("Stacking number input error!please input an integer from 1 to 255!"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)); return FALSE; } szValue.Empty(); this->m_ceSptNew3PDlg.m_edA.GetWindowText(szValue); pSptRecord->m_fA = (float)(atof(szValue)*1.0); if (pSptRecord->m_fA <= 0) { hHook = SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTHookProc,AfxGetInstanceHandle(),NULL); if (LANG_ZHCN == g_iUILanguage) AfxMessageBox(_T("a的值须为正数")); else MessageBoxEx(NULL, _T("Please input a positive number on a"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)); this->m_ceSptNew3PDlg.m_edA.SetFocus(); return FALSE; } szValue.Empty(); this->m_ceSptNew3PDlg.m_edB.GetWindowText(szValue); pSptRecord->m_fB = (float)(atof(szValue)*1.0); if (pSptRecord->m_fB <= 0) { hHook = SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTHookProc,AfxGetInstanceHandle(),NULL); if (LANG_ZHCN == g_iUILanguage) AfxMessageBox(_T("b的值须为正数")); else MessageBoxEx(NULL, _T("Please input a positive number on b"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)); this->m_ceSptNew3PDlg.m_edB.SetFocus(); return FALSE; } if (pSptRecord->m_fA <= pSptRecord->m_fB) { hHook = SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTHookProc,AfxGetInstanceHandle(),NULL); if (LANG_ZHCN == g_iUILanguage) AfxMessageBox(_T("a的值须大于b")); else MessageBoxEx(NULL, _T("The value of a must bigger than b."), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)); this->m_ceSptNew3PDlg.m_edA.SetFocus(); return FALSE; } pSptRecord->m_iN = this->m_ceSptNew3PDlg.m_unIterNum; pSptRecord->m_fK = fabs(pChannel->m_pMedium->CalculateCESptKVal(pSptRecord->m_fA, pSptRecord->m_fB, 0.0, 0.0)); iIndex = this->m_ceSptList.GetItemCount(); pos = this->m_ceSptList.GetFirstSelectedItemPosition(); iIndex = this->m_ceSptList.GetNextSelectedItem(pos); szValue.Empty(); szValue.Format(_T("%d"), pSptRecord->m_iTsn); this->m_ceSptList.SetItemText(iIndex, 0, szValue); szValue.Empty(); szValue.Format(_T("%.2f"), pSptRecord->m_fA); this->m_ceSptList.SetItemText(iIndex, 1, szValue); szValue.Empty(); szValue.Format(_T("%.2f"), pSptRecord->m_fB); this->m_ceSptList.SetItemText(iIndex, 2, szValue); szValue.Empty(); szValue.Format(_T("%.2f"), pSptRecord->m_fX); this->m_ceSptList.SetItemText(iIndex, 3, szValue); szValue.Empty(); szValue.Format(_T("%.2f"), pSptRecord->m_fY); this->m_ceSptList.SetItemText(iIndex, 4, szValue); szValue.Empty(); szValue.Format(_T("%f"), pSptRecord->m_fK); this->m_ceSptList.SetItemText(iIndex, 5, szValue); szValue.Empty(); szValue.Format(_T("%d"), pSptRecord->m_iN); this->m_ceSptList.SetItemText(iIndex, 6, szValue); return TRUE; } BOOL COpCreateCESptDlg::UpdateUnityProfileSptRec(CSptRecord* pSptRecord, CChannel* pChannel) { POSITION pos; int iIndex = (int)VAL_ZERO; CString szValue = _T(""); if (!this->m_ceSpt3PVESDlg.UpdateData(TRUE)) { hHook = SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTHookProc,AfxGetInstanceHandle(),NULL); if (LANG_ZHCN == g_iUILanguage) AfxMessageBox(_T("正在更新撤回CesSptCompositeProflingDialog数据失败")); else MessageBoxEx(NULL, _T("Retrieve CesSptCompositeProflingDialog data failed when update!"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)); return FALSE; } if (!bIsInteger(m_ceSpt3PVESDlg.m_strStacking)) { hHook = SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTHookProc,AfxGetInstanceHandle(),NULL); if (LANG_ZHCN == g_iUILanguage) AfxMessageBox(_T("迭代数错误,请输入一个1到255的正数")); else MessageBoxEx(NULL, _T("Stacking number input error!please input an integer from 1 to 255!"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)); return FALSE; } m_ceSpt3PVESDlg.m_unIterNum = atoi(m_ceSpt3PVESDlg.m_strStacking); if (m_ceSpt3PVESDlg.m_unIterNum < 1 || m_ceSpt3PVESDlg.m_unIterNum > 255) { hHook = SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTHookProc,AfxGetInstanceHandle(),NULL); if (LANG_ZHCN == g_iUILanguage) AfxMessageBox(_T("迭代数错误,请输入一个1到255的正数")); else MessageBoxEx(NULL, _T("Stacking number input error!please input an integer from 1 to 255!"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)); return FALSE; } szValue.Empty(); this->m_ceSpt3PVESDlg.m_edA.GetWindowText(szValue); pSptRecord->m_fA = (float)(atof(szValue)*1.0); if (pSptRecord->m_fA <= 0) { hHook = SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTHookProc,AfxGetInstanceHandle(),NULL); if (LANG_ZHCN == g_iUILanguage) AfxMessageBox(_T("a的值须为正数")); else MessageBoxEx(NULL, _T("Please input a positive number on a"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)); this->m_ceSpt3PVESDlg.m_edA.SetFocus(); return FALSE; } szValue.Empty(); this->m_ceSpt3PVESDlg.m_edB.GetWindowText(szValue); pSptRecord->m_fB = (float)(atof(szValue)*1.0); if (pSptRecord->m_fB <= 0) { hHook = SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTHookProc,AfxGetInstanceHandle(),NULL); if (LANG_ZHCN == g_iUILanguage) AfxMessageBox(_T("b的值须为正数")); else MessageBoxEx(NULL, _T("Please input a positive number on b"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)); this->m_ceSpt3PVESDlg.m_edB.SetFocus(); return FALSE; } if (pSptRecord->m_fA <= pSptRecord->m_fB) { hHook = SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTHookProc,AfxGetInstanceHandle(),NULL); if (LANG_ZHCN == g_iUILanguage) AfxMessageBox(_T("a的值须大于b")); else MessageBoxEx(NULL, _T("The value of a must bigger than b."), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)); this->m_ceSpt3PVESDlg.m_edA.SetFocus(); return FALSE; } pSptRecord->m_iN = this->m_ceSpt3PVESDlg.m_unIterNum; pSptRecord->m_fK = fabs(pChannel->m_pMedium->CalculateCESptKVal(pSptRecord->m_fA, pSptRecord->m_fB, 0.0, 0.0)); iIndex = this->m_ceSptList.GetItemCount(); pos = this->m_ceSptList.GetFirstSelectedItemPosition(); iIndex = this->m_ceSptList.GetNextSelectedItem(pos); szValue.Empty(); szValue.Format(_T("%d"), pSptRecord->m_iTsn); this->m_ceSptList.SetItemText(iIndex, 0, szValue); szValue.Empty(); szValue.Format(_T("%.2f"), pSptRecord->m_fA); this->m_ceSptList.SetItemText(iIndex, 1, szValue); szValue.Empty(); szValue.Format(_T("%.2f"), pSptRecord->m_fB); this->m_ceSptList.SetItemText(iIndex, 2, szValue); szValue.Empty(); szValue.Format(_T("%.2f"), pSptRecord->m_fX); this->m_ceSptList.SetItemText(iIndex, 3, szValue); szValue.Empty(); szValue.Format(_T("%.2f"), pSptRecord->m_fY); this->m_ceSptList.SetItemText(iIndex, 4, szValue); szValue.Empty(); szValue.Format(_T("%f"), pSptRecord->m_fK); this->m_ceSptList.SetItemText(iIndex, 5, szValue); szValue.Empty(); szValue.Format(_T("%d"), pSptRecord->m_iN); this->m_ceSptList.SetItemText(iIndex, 6, szValue); return TRUE; } // BOOL COpCreateCESptDlg::UpdateRECTGLSptRec(CSptRecord* pSptRecord, CChannel* pChannel) // { // return TRUE; // } BOOL COpCreateCESptDlg::UpdateCUSTOMSptRec(CSptRecord* pSptRecord, CChannel* pChannel) { POSITION pos; int iIndex = (int)VAL_ZERO; CString szValue = _T(""); if (!this->m_ceSptCUSTOMDlg.UpdateData(TRUE)) { hHook = SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTHookProc,AfxGetInstanceHandle(),NULL); if (LANG_ZHCN == g_iUILanguage) AfxMessageBox(_T("正在更新撤回CeSptCustomDialog数据失败!")); else MessageBoxEx(NULL, _T("Retrieve CeSptCustomDialog data failed when update!"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)); return FALSE; } if (!bIsInteger(m_ceSptCUSTOMDlg.m_strStacking)) { hHook = SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTHookProc,AfxGetInstanceHandle(),NULL); if (LANG_ZHCN == g_iUILanguage) AfxMessageBox(_T("迭代数错误,请输入一个1到255的正数")); else MessageBoxEx(NULL, _T("Stacking number input error!please input an integer from 1 to 255!"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)); return FALSE; } m_ceSptCUSTOMDlg.m_unIterNum = atoi(m_ceSptCUSTOMDlg.m_strStacking); if (m_ceSptCUSTOMDlg.m_unIterNum < 1 || m_ceSptCUSTOMDlg.m_unIterNum > 255) { hHook = SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTHookProc,AfxGetInstanceHandle(),NULL); if (LANG_ZHCN == g_iUILanguage) AfxMessageBox(_T("迭代数错误,请输入一个1到255的正数")); else MessageBoxEx(NULL, _T("Stacking number input error!please input an integer from 1 to 255!"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)); return FALSE; } szValue.Empty(); this->m_ceSptCUSTOMDlg.m_edA.GetWindowText(szValue); pSptRecord->m_fA = (float)(atof(szValue)*1.0); szValue.Empty(); this->m_ceSptCUSTOMDlg.m_edB.GetWindowText(szValue); pSptRecord->m_fB = (float)(atof(szValue)*1.0); szValue.Empty(); this->m_ceSptCUSTOMDlg.m_edX.GetWindowText(szValue); pSptRecord->m_fX = (float)(atof(szValue)*1.0); szValue.Empty(); this->m_ceSptCUSTOMDlg.m_edY.GetWindowText(szValue); pSptRecord->m_fY = (float)(atof(szValue)*1.0); szValue.Empty(); this->m_ceSptCUSTOMDlg.m_edK.GetWindowText(szValue); pSptRecord->m_fK = (float)(atof(szValue)*1.0); pSptRecord->m_iN = this->m_ceSptCUSTOMDlg.m_unIterNum; // pSptRecord->m_fK = pChannel->m_pMedium->CalculateCESptKVal(pSptRecord->m_fA, pSptRecord->m_fB, 0.0, 0.0); iIndex = this->m_ceSptList.GetItemCount(); pos = this->m_ceSptList.GetFirstSelectedItemPosition(); iIndex = this->m_ceSptList.GetNextSelectedItem(pos); szValue.Empty(); szValue.Format(_T("%d"), pSptRecord->m_iTsn); this->m_ceSptList.SetItemText(iIndex, 0, szValue); szValue.Empty(); szValue.Format(_T("%.2f"), pSptRecord->m_fA); this->m_ceSptList.SetItemText(iIndex, 1, szValue); szValue.Empty(); szValue.Format(_T("%.2f"), pSptRecord->m_fB); this->m_ceSptList.SetItemText(iIndex, 2, szValue); szValue.Empty(); szValue.Format(_T("%.2f"), pSptRecord->m_fX); this->m_ceSptList.SetItemText(iIndex, 3, szValue); szValue.Empty(); szValue.Format(_T("%.2f"), pSptRecord->m_fY); this->m_ceSptList.SetItemText(iIndex, 4, szValue); szValue.Empty(); szValue.Format(_T("%f"), pSptRecord->m_fK); this->m_ceSptList.SetItemText(iIndex, 5, szValue); szValue.Empty(); szValue.Format(_T("%d"), pSptRecord->m_iN); this->m_ceSptList.SetItemText(iIndex, 6, szValue); return TRUE; } BOOL COpCreateCESptDlg::Delete4PVESSptRec(CSptRecord* pSptRecord, CChannel* pChannel) { POSITION pos; int iIndex = (int)VAL_ZERO; pos = this->m_ceSptList.GetFirstSelectedItemPosition(); iIndex = this->m_ceSptList.GetNextSelectedItem(pos); delete pSptRecord; pChannel->m_sptRecArray.RemoveAt(iIndex); this->m_ceSptList.DeleteItem(iIndex); return TRUE; } BOOL COpCreateCESptDlg::DeleteDipoleSptRec(CSptRecord* pSptRecord, CChannel* pChannel) { POSITION pos; int iIndex = (int)VAL_ZERO; pos = this->m_ceSptList.GetFirstSelectedItemPosition(); iIndex = this->m_ceSptList.GetNextSelectedItem(pos); delete pSptRecord; pChannel->m_sptRecArray.RemoveAt(iIndex); this->m_ceSptList.DeleteItem(iIndex); return TRUE; } BOOL COpCreateCESptDlg::DeleteNew3PVESSptRec(CSptRecord* pSptRecord, CChannel* pChannel) { POSITION pos; int iIndex = (int)VAL_ZERO; pos = this->m_ceSptList.GetFirstSelectedItemPosition(); iIndex = this->m_ceSptList.GetNextSelectedItem(pos); delete pSptRecord; pChannel->m_sptRecArray.RemoveAt(iIndex); this->m_ceSptList.DeleteItem(iIndex); return TRUE; } BOOL COpCreateCESptDlg::DeleteUnityProfileSptRec(CSptRecord* pSptRecord, CChannel* pChannel) { POSITION pos; int iIndex = (int)VAL_ZERO; pos = this->m_ceSptList.GetFirstSelectedItemPosition(); iIndex = this->m_ceSptList.GetNextSelectedItem(pos); delete pSptRecord; pChannel->m_sptRecArray.RemoveAt(iIndex); this->m_ceSptList.DeleteItem(iIndex); return TRUE; } BOOL COpCreateCESptDlg::DeleteRECTGLSptRec(CSptRecord* pSptRecord, CChannel* pChannel) { POSITION pos; int iIndex = (int)VAL_ZERO; pos = this->m_ceSptList.GetFirstSelectedItemPosition(); iIndex = this->m_ceSptList.GetNextSelectedItem(pos); delete pSptRecord; pChannel->m_sptRecArray.RemoveAt(iIndex); this->m_ceSptList.DeleteItem(iIndex); return TRUE; } BOOL COpCreateCESptDlg::DeleteCUSTOMSptRec(CSptRecord* pSptRecord, CChannel* pChannel) { POSITION pos; int iIndex = (int)VAL_ZERO; pos = this->m_ceSptList.GetFirstSelectedItemPosition(); iIndex = this->m_ceSptList.GetNextSelectedItem(pos); delete pSptRecord; pChannel->m_sptRecArray.RemoveAt(iIndex); this->m_ceSptList.DeleteItem(iIndex); return TRUE; } void COpCreateCESptDlg::OnItemchangedSptCeList(NMHDR* pNMHDR, LRESULT* pResult) { NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR; CString strText = _T(""); // TODO: Add your control notification handler code here if (((pNMListView->uOldState & LVIS_SELECTED) == VAL_ZERO) && ((pNMListView->uNewState & LVIS_SELECTED) == LVIS_SELECTED)) { switch (m_ceSptTab.GetCurSel()) { case TAB_INDEX_4PVES: this->m_ceSpt4PVESDlg.m_edA.SetWindowText(_T("")); this->m_ceSpt4PVESDlg.m_edA.SetWindowText(this->m_ceSptList.GetItemText(pNMListView->iItem, 1)); this->m_ceSpt4PVESDlg.m_edB.SetWindowText(_T("")); this->m_ceSpt4PVESDlg.m_edB.SetWindowText(this->m_ceSptList.GetItemText(pNMListView->iItem, 2)); this->m_ceSpt4PVESDlg.m_unIterNum = atoi(this->m_ceSptList.GetItemText(pNMListView->iItem, 6)); strText.Empty(); strText.Format(_T("%d"),this->m_ceSpt4PVESDlg.m_unIterNum); this->m_ceSpt4PVESDlg.SetDlgItemText(IDC_4P_ITERNUM, strText.GetBuffer(0)); // this->m_ceSpt4PVESDlg.m_cbN.SetCurSel(atoi(this->m_ceSptList.GetItemText(pNMListView->iItem, 6)) - 1); break; case TAB_INDEX_DIPOLE: this->m_ceSptDIPOLEDlg.m_edA.SetWindowText(_T("")); this->m_ceSptDIPOLEDlg.m_edA.SetWindowText(this->m_ceSptList.GetItemText(pNMListView->iItem, 1)); this->m_ceSptDIPOLEDlg.m_edB.SetWindowText(_T("")); this->m_ceSptDIPOLEDlg.m_edB.SetWindowText(this->m_ceSptList.GetItemText(pNMListView->iItem, 2)); this->m_ceSptDIPOLEDlg.m_unIterNum = atoi(this->m_ceSptList.GetItemText(pNMListView->iItem, 6)); strText.Empty(); strText.Format(_T("%d"), this->m_ceSptDIPOLEDlg.m_unIterNum); this->m_ceSptDIPOLEDlg.SetDlgItemText(IDC_ITER_NUM, strText.GetBuffer(0)); // this->m_ceSptDIPOLEDlg.m_cbN.SetCurSel(atoi(this->m_ceSptList.GetItemText(pNMListView->iItem, 6)) - 1); break; case TAB_INDEX_3PVES: this->m_ceSptNew3PDlg.m_edA.SetWindowText(_T("")); this->m_ceSptNew3PDlg.m_edA.SetWindowText(this->m_ceSptList.GetItemText(pNMListView->iItem, 1)); this->m_ceSptNew3PDlg.m_edB.SetWindowText(_T("")); this->m_ceSptNew3PDlg.m_edB.SetWindowText(this->m_ceSptList.GetItemText(pNMListView->iItem, 2)); this->m_ceSptNew3PDlg.m_unIterNum = atoi(this->m_ceSptList.GetItemText(pNMListView->iItem, 6)); strText.Empty(); strText.Format(_T("%d"), this->m_ceSpt3PVESDlg.m_unIterNum); this->m_ceSptNew3PDlg.SetDlgItemText(IDC_ITER_NUM, strText.GetBuffer(0)); // this->m_ceSpt3PVESDlg.m_cbN.SetCurSel(atoi(this->m_ceSptList.GetItemText(pNMListView->iItem, 6)) - 1); break; case TAB_INDEX_RECTGL: this->m_ceSptRECTGLDlg.m_edA.SetWindowText(_T("")); this->m_ceSptRECTGLDlg.m_edA.SetWindowText(this->m_ceSptList.GetItemText(pNMListView->iItem, 1)); this->m_ceSptRECTGLDlg.m_edB.SetWindowText(_T("")); this->m_ceSptRECTGLDlg.m_edB.SetWindowText(this->m_ceSptList.GetItemText(pNMListView->iItem, 2)); this->m_ceSptRECTGLDlg.m_edRowSpace.SetWindowText(_T("")); this->m_ceSptRECTGLDlg.m_edRowSpace.SetWindowText(this->m_ceSptList.GetItemText(pNMListView->iItem, 3)); this->m_ceSptRECTGLDlg.m_edColSpace.SetWindowText(_T("")); this->m_ceSptRECTGLDlg.m_edColSpace.SetWindowText(this->m_ceSptList.GetItemText(pNMListView->iItem, 4)); this->m_ceSptRECTGLDlg.m_unIterNum = atoi(this->m_ceSptList.GetItemText(pNMListView->iItem, 6)); strText.Empty(); strText.Format(_T("%d"), this->m_ceSptRECTGLDlg.m_unIterNum); this->m_ceSptRECTGLDlg.SetDlgItemText(IDC_ITER_NUM, strText.GetBuffer(0)); break; case TAB_INDEX_CUSTOM: this->m_ceSptCUSTOMDlg.m_edA.SetWindowText(_T("")); this->m_ceSptCUSTOMDlg.m_edA.SetWindowText(this->m_ceSptList.GetItemText(pNMListView->iItem, 1)); this->m_ceSptCUSTOMDlg.m_edB.SetWindowText(_T("")); this->m_ceSptCUSTOMDlg.m_edB.SetWindowText(this->m_ceSptList.GetItemText(pNMListView->iItem, 2)); this->m_ceSptCUSTOMDlg.m_edX.SetWindowText(_T("")); this->m_ceSptCUSTOMDlg.m_edX.SetWindowText(this->m_ceSptList.GetItemText(pNMListView->iItem, 3)); this->m_ceSptCUSTOMDlg.m_edY.SetWindowText(_T("")); this->m_ceSptCUSTOMDlg.m_edY.SetWindowText(this->m_ceSptList.GetItemText(pNMListView->iItem, 4)); this->m_ceSptCUSTOMDlg.m_edK.SetWindowText(_T("")); this->m_ceSptCUSTOMDlg.m_edK.SetWindowText(this->m_ceSptList.GetItemText(pNMListView->iItem, 5)); this->m_ceSptCUSTOMDlg.m_unIterNum = atoi(this->m_ceSptList.GetItemText(pNMListView->iItem, 6)); strText.Empty(); strText.Format(_T("%d"),this->m_ceSptCUSTOMDlg.m_unIterNum); this->m_ceSptCUSTOMDlg.SetDlgItemText(IDC_ITER_NUM, strText.GetBuffer(0)); //this->m_ceSptCUSTOMDlg.m_cbN.SetCurSel(atoi(this->m_ceSptList.GetItemText(pNMListView->iItem, 6)) - 1); break; case TAB_INDEX_UNTIFY_PROFILE: this->m_ceSpt3PVESDlg.m_edA.SetWindowText(_T("")); this->m_ceSpt3PVESDlg.m_edA.SetWindowText(this->m_ceSptList.GetItemText(pNMListView->iItem, 1)); this->m_ceSpt3PVESDlg.m_edB.SetWindowText(_T("")); this->m_ceSpt3PVESDlg.m_edB.SetWindowText(this->m_ceSptList.GetItemText(pNMListView->iItem, 2)); this->m_ceSpt3PVESDlg.m_unIterNum = atoi(this->m_ceSptList.GetItemText(pNMListView->iItem, 6)); strText.Empty(); strText.Format(_T("%d"), this->m_ceSpt3PVESDlg.m_unIterNum); this->m_ceSpt3PVESDlg.SetDlgItemText(IDC_ITER_NUM, strText.GetBuffer(0)); // this->m_ceSpt3PVESDlg.m_cbN.SetCurSel(atoi(this->m_ceSptList.GetItemText(pNMListView->iItem, 6)) - 1); break; default: break; } } *pResult = 0; } void COpCreateCESptDlg::OnOK() { // TODO: Add extra validation here if (0 == m_ceSptList.GetItemCount()) { hHook = SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTHookProc,AfxGetInstanceHandle(),NULL); if (LANG_ZHCN == g_iUILanguage) AfxMessageBox(_T("请输入脚本信息")); else MessageBoxEx(NULL, _T("Please input script information firstly!"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)); return; } CString szSName = _T(""); CString szCaption = _T(""); this->GetDlgItem(IDC_SPT_SNAME)->GetWindowText(szSName); if (_T("") == szSName) { szCaption.Empty(); szCaption.LoadString(IDS_OP_LC_SCON_INPUT_SNAME+g_UIOffset); hHook = SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTHookProc,AfxGetInstanceHandle(),NULL); MessageBox(szCaption, NULL, MB_ICONWARNING); this->GetDlgItem(IDC_SPT_SNAME)->SetFocus(); } else { if (IsExistSpecialChar(szSName)) { if (LANG_ZHCN == g_iUILanguage) AfxMessageBox(_T("脚本名中含有特殊字符,请重新输入")); else MessageBoxEx(NULL, _T("There are some special charcter in script name,please rename it!"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)); return; } AfxGetMainWnd()->EnableWindow(); UpdateData(TRUE); *m_pRet = 1; this->EndModalLoop(*m_pRet); //结束非模态对话框模态循环 } // CDialog::OnOK(); } void COpCreateCESptDlg::OnCancel() { // TODO: Add extra cleanup here POSITION pos = m_pNewScript->m_chaList.FindIndex(0); CChannel* pChannel = (CChannel*)m_pNewScript->m_chaList.GetAt(pos); if (pChannel->m_sptRecArray.GetSize() == this->m_ceSptList.GetItemCount()) { pChannel->ClearSptRecList(); AfxGetMainWnd()->EnableWindow(); *m_pRet = 2; this->EndModalLoop(*m_pRet); //结束非模态对话框模态循环 } CDialog::OnCancel(); } BOOL COpCreateCESptDlg::PreTranslateMessage(MSG* pMsg) { // TODO: Add your specialized code here and/or call the base class if(pMsg->message==WM_KEYDOWN && pMsg->wParam==VK_RETURN) { return TRUE; } if(pMsg->message==WM_KEYDOWN && pMsg->wParam==VK_ESCAPE) { return TRUE; } return CDialog::PreTranslateMessage(pMsg); } void COpCreateCESptDlg::OnSize(UINT nType, int cx, int cy) { CDialog::OnSize(nType, cx, cy); // UPDATE_EASYSIZE; // TODO: Add your message handler code here } void COpCreateCESptDlg::OnSizing(UINT fwSide, LPRECT pRect) { CDialog::OnSizing(fwSide, pRect); // EASYSIZE_MINSIZE(280,250,fwSide,pRect); // TODO: Add your message handler code here } void COpCreateCESptDlg::InitUIByLanguage(int iLanguage) { if (LANG_ZHCN == iLanguage) { SetWindowText(_T("VES脚本")); GetDlgItem(IDC_STATIC_SPT_NAME)->SetWindowText(_T("*脚本名称:")); GetDlgItem(IDC_STATIC_SPT_OPERATOR)->SetWindowText(_T("操作员:")); GetDlgItem(IDC_STATIC_SPT_DATE)->SetWindowText(_T("日期:")); GetDlgItem(IDC_STATIC_SPT_REMARK)->SetWindowText(_T("备注:")); GetDlgItem(IDC_BTN_INS)->SetWindowText(_T("增加")); GetDlgItem(IDC_BTN_UPD)->SetWindowText(_T("修改")); GetDlgItem(IDC_BTN_DEL)->SetWindowText(_T("删除")); GetDlgItem(IDOK)->SetWindowText(_T("保存")); GetDlgItem(IDCANCEL)->SetWindowText(_T("取消")); } }