#include "stdafx.h" #include "CFSSZDlg.h" LPCTSTR g_pszRoutePris[] = { _T("电缆外径"),_T("清册顺序"),NULL}; IMPLEMENT_DYNAMIC(CFSSZDlg, CDialog) CFSSZDlg::CFSSZDlg(CWnd *pParent /*=NULL*/) : CDialog(IDD_FSSZ_DLG, pParent) , m_dPathOnPoint(0.1) , m_nEquFrCol(0) , m_nEquToCol(0) , m_nCableLenCol(0) , m_nCableSpec(0) , m_nPathUserDo(FALSE) , m_nAssocNoorName(0) , m_dLenRever(2) , m_dBypassDis(1) , m_bHasSect(FALSE) , m_nCableSectCol(0) , m_dEquFindDis(2.5) , m_bIgoreFillUsed(FALSE) , m_nPathNosCol(0) { } CFSSZDlg::~CFSSZDlg() { } void CFSSZDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); DDX_Text(pDX, IDC_EDIT1, m_dPathOnPoint); DDX_CBIndex(pDX, IDC_COMBO1, m_nEquFrCol); DDX_CBIndex(pDX, IDC_COMBO6, m_nEquToCol); DDX_CBIndex(pDX, IDC_COMBO8, m_nCableLenCol); DDX_CBIndex(pDX, IDC_COMBO7, m_nCableSpec); DDX_Control(pDX, IDC_COMBO1, m_wndEquFrCombo); DDX_Control(pDX, IDC_COMBO6, m_wndEquToCombo); DDX_Control(pDX, IDC_COMBO8, m_wndCableLenCombo); DDX_Control(pDX, IDC_COMBO7, m_wndCableSpecCombo); DDX_Radio(pDX, IDC_RADIO1, m_nPathUserDo); DDX_Control(pDX, IDC_LIST1, m_wndRoutPriListBox); DDX_Radio(pDX, IDC_RADIO3, m_nAssocNoorName); DDX_Text(pDX, IDC_EDIT2, m_dLenRever); DDX_Text(pDX, IDC_EDIT3, m_dBypassDis); DDX_Check(pDX, IDC_CHECK2, m_bHasSect); DDX_Check(pDX,IDC_CHECK3, m_bIgoreFillUsed); DDX_Control(pDX, IDC_COMBO9, m_wndCableCoresCombo); DDX_CBIndex(pDX, IDC_COMBO9, m_nCableSectCol); DDX_Control(pDX, IDC_COMBO10, m_wndPathNosCombo); DDX_CBIndex(pDX, IDC_COMBO10, m_nPathNosCol); DDX_Text(pDX, IDC_EDIT4, m_dEquFindDis); } BEGIN_MESSAGE_MAP(CFSSZDlg, CDialog) ON_BN_CLICKED(IDOK, &CFSSZDlg::OnBnClickedOk) ON_BN_CLICKED(IDC_BUTTON1, &CFSSZDlg::OnBnClickedButton1) ON_BN_CLICKED(IDC_BUTTON3, &CFSSZDlg::OnBnClickedButton3) ON_BN_CLICKED(IDC_CHECK2, &CFSSZDlg::OnBnClickedCheck2) END_MESSAGE_MAP() BOOL CFSSZDlg::OnInitDialog() { CDialog::OnInitDialog(); m_wndCableSpecCombo.ResetContent(); m_wndCableCoresCombo.ResetContent(); for (int i = 0;i < m_arCols.GetSize();i++) { m_wndEquFrCombo.AddString(m_arCols.GetAt(i)); m_wndEquToCombo.AddString(m_arCols.GetAt(i)); m_wndCableLenCombo.AddString(m_arCols.GetAt(i)); m_wndCableSpecCombo.AddString(m_arCols.GetAt(i)); m_wndCableCoresCombo.AddString(m_arCols.GetAt(i)); m_wndPathNosCombo.AddString(m_arCols.GetAt(i)); } if (m_arPriSteps.IsEmpty()) { for (int i = 0;i < 33;i++) { if (g_pszRoutePris[i] == NULL) break; m_wndRoutPriListBox.AddString(g_pszRoutePris[i]); } } else { int nIndex = 0; for (int i = 0;i < m_arPriSteps.GetSize();i++) { nIndex = m_arPriSteps.GetAt(i); if (g_pszRoutePris[nIndex] != NULL) { m_wndRoutPriListBox.AddString(g_pszRoutePris[nIndex]); } } } UpdateData(FALSE); return TRUE; } void CFSSZDlg::OnBnClickedOk() { UpdateData(); if (m_dPathOnPoint < 0 || m_dBypassDis < 0) { AfxMessageBox(_T("误差间距不建议0或负值!")); return; } m_arPriSteps.RemoveAll(); CString sTxt; for (int i = 0;i < m_wndRoutPriListBox.GetCount();i++) { m_wndRoutPriListBox.GetText(i, sTxt); for (int ii = 0;ii < 33;ii++) { if (g_pszRoutePris[ii] == NULL) break; if (sTxt.CompareNoCase(g_pszRoutePris[ii]) == 0) m_arPriSteps.Add(ii); } } if (m_bHasSect) { m_nCableSectCol = m_nCableSpec; } CDialog::OnOK(); } //上移 void CFSSZDlg::OnBnClickedButton1() { int nSel = m_wndRoutPriListBox.GetCurSel(); if (nSel != -1) { if (nSel > 0) { CString sUp; m_wndRoutPriListBox.GetText(nSel - 1, sUp); CString sCur; m_wndRoutPriListBox.GetText(nSel, sCur); m_wndRoutPriListBox.DeleteString(nSel - 1); m_wndRoutPriListBox.InsertString(nSel, sUp); } } } //下移 void CFSSZDlg::OnBnClickedButton3() { int nSel = m_wndRoutPriListBox.GetCurSel(); if (nSel != -1) { if (nSel < m_wndRoutPriListBox.GetCount() - 1 ) { CString sDwn; m_wndRoutPriListBox.GetText(nSel + 1, sDwn); CString sCur; m_wndRoutPriListBox.GetText(nSel, sCur); m_wndRoutPriListBox.DeleteString(nSel); m_wndRoutPriListBox.InsertString(nSel + 1, sCur); } } } void CFSSZDlg::GetRoutePriStep(CUIntArray &arStep) { arStep.Append(m_arPriSteps); } void CFSSZDlg::SetRoutePriStep(CUIntArray &arPriSteps) { m_arPriSteps.Append(arPriSteps); } void CFSSZDlg::OnBnClickedCheck2() { UpdateData(); m_wndCableCoresCombo.EnableWindow(!m_bHasSect); } void CFSSZDlg::SetIgoreFillUsed(bool bIgoreFillUsed) { m_bIgoreFillUsed = bIgoreFillUsed ? TRUE: FALSE; }