// AdvancedSettingsDlg.cpp : implementation file // #include "stdafx.h" #include "Perfstat_UI_Final.h" #include "AdvancedSettingsDlg.h" #include "afxdialogex.h" // CAdvancedSettingsDlg dialog IMPLEMENT_DYNAMIC(CAdvancedSettingsDlg, CDialogEx) CAdvancedSettingsDlg::CAdvancedSettingsDlg(CWnd* pParent /*=NULL*/) : CDialogEx(CAdvancedSettingsDlg::IDD, pParent) { m_pToolTipCtrl = NULL; } CAdvancedSettingsDlg::~CAdvancedSettingsDlg() { } void CAdvancedSettingsDlg::DoDataExchange(CDataExchange* pDX) { CDialogEx::DoDataExchange(pDX); } BEGIN_MESSAGE_MAP(CAdvancedSettingsDlg, CDialogEx) ON_EN_CHANGE(IDC_MFCEDITBROWSE1, &CAdvancedSettingsDlg::OnEnChangeMfceditbrowseSSHPrivateKey) ON_EN_CHANGE(IDC_EDIT_RASTRACE, &CAdvancedSettingsDlg::OnEnChangeEditRastrace) ON_EN_CHANGE(IDC_EDIT_PROFILES, &CAdvancedSettingsDlg::OnEnChangeEditProfiles) ON_EN_CHANGE(IDC_EDIT_INCLUDE, &CAdvancedSettingsDlg::OnEnChangeEditInclude) ON_EN_CHANGE(IDC_EDIT_EXCLUDE, &CAdvancedSettingsDlg::OnEnChangeEditExclude) ON_EN_CHANGE(IDC_EDIT_ENABLE, &CAdvancedSettingsDlg::OnEnChangeEditEnable) ON_EN_CHANGE(IDC_EDIT_LOGIN, &CAdvancedSettingsDlg::OnEnChangeEditLogin) ON_EN_CHANGE(IDC_EDIT_SKTRACE, &CAdvancedSettingsDlg::OnEnChangeEditSktrace) ON_BN_CLICKED(IDOK, &CAdvancedSettingsDlg::OnBnClickedOk) END_MESSAGE_MAP() // CAdvancedSettingsDlg message handlers BOOL CAdvancedSettingsDlg::OnInitDialog() { CDialogEx::OnInitDialog(); // TODO: Add extra initialization here InitToolTips(); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } void CAdvancedSettingsDlg :: InitToolTips() { EnableToolTips(); m_pToolTipCtrl = new CToolTipCtrl; m_pToolTipCtrl->Create( this ); CString strToolTip; CStatic* staticCtrl = NULL; int nStartID = IDC_STATIC_SSH_PRIVATE_KEY; int nStringTableID = IDS_TOOLTIP_SSH_PRIVATE_KEY; for(int nIndex = 0; nIndex < MAX_STATIC_CONTROLS_ADVANCED_SETTINGS; ++nIndex, ++nStartID, ++nStringTableID) { strToolTip.LoadStringW(nStringTableID); staticCtrl = (CStatic*)(GetDlgItem(nStartID)); m_pToolTipCtrl->AddTool( staticCtrl, strToolTip.AllocSysString()); } } BOOL CAdvancedSettingsDlg::PreTranslateMessage(MSG* pMsg) { // TODO: Add your specialized code here and/or call the base class if (m_pToolTipCtrl != NULL) { m_pToolTipCtrl->RelayEvent(pMsg); } return CDialogEx::PreTranslateMessage(pMsg); } void CAdvancedSettingsDlg::OnEnChangeMfceditbrowseSSHPrivateKey() { // TODO: If this is a RICHEDIT control, the control will not // send this notification unless you override the CDialogEx::OnInitDialog() // function and call CRichEditCtrl().SetEventMask() // with the ENM_CHANGE flag ORed into the mask. // TODO: Add your control notification handler code here GetDlgItemText(IDC_MFCEDITBROWSE1, m_strSSHPrivateKey); } void CAdvancedSettingsDlg::OnEnChangeEditRastrace() { // TODO: If this is a RICHEDIT control, the control will not // send this notification unless you override the CDialogEx::OnInitDialog() // function and call CRichEditCtrl().SetEventMask() // with the ENM_CHANGE flag ORed into the mask. // TODO: Add your control notification handler code here GetDlgItemText(IDC_EDIT_RASTRACE, m_strRastrace); } void CAdvancedSettingsDlg::OnEnChangeEditProfiles() { // TODO: If this is a RICHEDIT control, the control will not // send this notification unless you override the CDialogEx::OnInitDialog() // function and call CRichEditCtrl().SetEventMask() // with the ENM_CHANGE flag ORed into the mask. // TODO: Add your control notification handler code here GetDlgItemText(IDC_EDIT_PROFILES, m_strProfiles); } void CAdvancedSettingsDlg::OnEnChangeEditInclude() { // TODO: If this is a RICHEDIT control, the control will not // send this notification unless you override the CDialogEx::OnInitDialog() // function and call CRichEditCtrl().SetEventMask() // with the ENM_CHANGE flag ORed into the mask. // TODO: Add your control notification handler code here GetDlgItemText(IDC_EDIT_INCLUDE, m_strInclude); } void CAdvancedSettingsDlg::OnEnChangeEditExclude() { // TODO: If this is a RICHEDIT control, the control will not // send this notification unless you override the CDialogEx::OnInitDialog() // function and call CRichEditCtrl().SetEventMask() // with the ENM_CHANGE flag ORed into the mask. // TODO: Add your control notification handler code here GetDlgItemText(IDC_EDIT_EXCLUDE, m_strExclude); } void CAdvancedSettingsDlg::OnEnChangeEditEnable() { // TODO: If this is a RICHEDIT control, the control will not // send this notification unless you override the CDialogEx::OnInitDialog() // function and call CRichEditCtrl().SetEventMask() // with the ENM_CHANGE flag ORed into the mask. // TODO: Add your control notification handler code here GetDlgItemText(IDC_EDIT_ENABLE, m_strEnable); } void CAdvancedSettingsDlg::OnEnChangeEditLogin() { // TODO: If this is a RICHEDIT control, the control will not // send this notification unless you override the CDialogEx::OnInitDialog() // function and call CRichEditCtrl().SetEventMask() // with the ENM_CHANGE flag ORed into the mask. // TODO: Add your control notification handler code here GetDlgItemText(IDC_EDIT_LOGIN, m_strLogin); } void CAdvancedSettingsDlg::OnEnChangeEditSktrace() { // TODO: If this is a RICHEDIT control, the control will not // send this notification unless you override the CDialogEx::OnInitDialog() // function and call CRichEditCtrl().SetEventMask() // with the ENM_CHANGE flag ORed into the mask. // TODO: Add your control notification handler code here GetDlgItemText(IDC_EDIT_SKTRACE, m_strSKTrace); } CString CAdvancedSettingsDlg::GetSSHPrivateKey() const { return m_strSSHPrivateKey; } CString CAdvancedSettingsDlg :: GetRastrace() const { return m_strRastrace; } CString CAdvancedSettingsDlg :: GetProfiles() const { return m_strProfiles; } CString CAdvancedSettingsDlg :: GetInclude() const { return m_strInclude; } CString CAdvancedSettingsDlg :: GetExclude() const { return m_strExclude; } CString CAdvancedSettingsDlg :: GetEnable() const { return m_strEnable; } CString CAdvancedSettingsDlg :: GetLogin() const { return m_strLogin; } CString CAdvancedSettingsDlg :: GetSKTrace() const { return m_strSKTrace; } CString CAdvancedSettingsDlg :: GetStutter() const { return m_strStutter; } INT CAdvancedSettingsDlg :: GetStutterValue() const { return m_nStutter; } BOOL CAdvancedSettingsDlg :: GetQuiet() const { return m_bQuiet; } BOOL CAdvancedSettingsDlg :: GetDebug() const { return m_bDebug; } BOOL CAdvancedSettingsDlg :: GetPrintPreset() const { return m_bPrintPreset; } BOOL CAdvancedSettingsDlg :: GetLog() const { return m_bLog; } BOOL CAdvancedSettingsDlg :: GetSSH() const { return m_bSSH; } void CAdvancedSettingsDlg::OnBnClickedOk() { // TODO: Add your control notification handler code here // Check for multiple options in the edit boxes and append the string accordingly. ModifyString(IDC_EDIT_RASTRACE, _T(","), m_strRastrace); ModifyString(IDC_EDIT_PROFILES, _T(","), m_strProfiles); ModifyString(IDC_EDIT_INCLUDE, _T(";"), m_strInclude); ModifyString(IDC_EDIT_EXCLUDE, _T(";"), m_strExclude); ModifyString(IDC_EDIT_ENABLE, _T(","), m_strEnable); CDialogEx::OnOK(); } void CAdvancedSettingsDlg::ModifyString(int nControlID, \ const CString& strSeperator, \ CString& strMember) { CEdit* editBox = NULL; if((editBox = (CEdit*)(GetDlgItem(nControlID))) != NULL) { int nNumberOfLines = editBox->GetLineCount(); CString tmp = _T(""); strMember = tmp; for(int nIndex = 0; nIndex < nNumberOfLines; ++nIndex) { editBox->GetLine(nIndex, tmp.AllocSysString()); m_strRastrace += tmp; if(nIndex != (nNumberOfLines - 1)) { strMember += strSeperator; } } } } void CAdvancedSettingsDlg :: SetAdvancedSettings(ADVANCED_SETTINGS* advanced) { if(advanced == NULL) { return; } advanced->m_strSSHPrivateKey = m_strSSHPrivateKey; advanced->m_strRastrace = m_strRastrace; advanced->m_strProfiles = m_strProfiles; advanced->m_strEnable = m_strEnable; advanced->m_strInclude = m_strInclude; advanced->m_strExclude = m_strExclude; advanced->m_strLogin = m_strLogin; advanced->m_strSKTrace = m_strSKTrace; advanced->m_strStutter = m_strStutter; advanced->m_bQuiet = m_bQuiet; advanced->m_bPrintPreset = m_bPrintPreset; advanced->m_bDebug = m_bDebug; advanced->m_bLog = m_bLog; advanced->m_bSSH = m_bSSH; }