?? dlgfilesetting.cpp
字號:
// DlgFileSetting.cpp : implementation file
//
#include "stdafx.h"
#include "RADIO.h"
#include "DlgFileSetting.h"
#include "APPStatic.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CDlgFileSetting dialog
CDlgFileSetting::CDlgFileSetting(CWnd* pParent /*=NULL*/)
: CDialog(CDlgFileSetting::IDD, pParent)
{
//{{AFX_DATA_INIT(CDlgFileSetting)
m_dRadioFreq = 0.0;
m_strRadioFile = _T("");
m_strTrajFile = _T("");
m_strRadio = _T("");
//}}AFX_DATA_INIT
m_strRadioFile=_T("RADIO.dat");
m_dRadioFreq = 1.0;
}
void CDlgFileSetting::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDlgFileSetting)
DDX_Control(pDX, IDC_TRAJCOMBO, m_comboTraj);
DDX_Control(pDX, IDC_RADIOCOMBO, m_comboRadio);
DDX_Text(pDX, IDC_RADIOFRE, m_dRadioFreq);
DDX_Text(pDX, IDC_RADIONAME, m_strRadioFile);
DDX_CBString(pDX, IDC_TRAJCOMBO, m_strTrajFile);
DDX_CBString(pDX, IDC_RADIOCOMBO, m_strRadio);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CDlgFileSetting, CDialog)
//{{AFX_MSG_MAP(CDlgFileSetting)
ON_WM_DESTROY()
ON_CBN_EDITCHANGE(IDC_TRAJCOMBO, OnEditchangeTrajcombo)
ON_CBN_SELCHANGE(IDC_TRAJCOMBO, OnSelchangeTrajcombo)
ON_CBN_SELCHANGE(IDC_RADIOCOMBO, OnSelchangeRadiocombo)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDlgFileSetting message handlers
void CDlgFileSetting::OnDestroy()
{
CDialog::OnDestroy();
delete(this);
// TODO: Add your message handler code here
}
BOOL CDlgFileSetting::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
m_comboTraj.AddString("瀏覽...");
m_comboTraj.AddString(APPStatic::GetMainView()->GetDocument()->m_strTrajFileName);
m_comboTraj.SetCurSel(1);
m_comboRadio.AddString("瀏覽...");
m_comboRadio.AddString(APPStatic::GetMainView()->GetDocument()->m_strRadioFilePath);
m_comboRadio.SetCurSel(1);
UpdateData(TRUE);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CDlgFileSetting::OnEditchangeTrajcombo()
{
// TODO: Add your control notification handler code here
}
void CDlgFileSetting::OnSelchangeTrajcombo()
{
if(m_comboTraj.GetCurSel()==0){
CString strName;
CFileDialog fileDlg(TRUE,_T("cfg"),NULL,OFN_OVERWRITEPROMPT,
_T("Traj Files(*.dat)|*.dat|All Files (*.*)|*.*||"));
if(fileDlg.DoModal()==IDOK){
strName=fileDlg.GetPathName();
}
else{
m_comboTraj.SetCurSel(1);
return;
}
m_strTrajFile=strName;
m_comboTraj.AddString(strName);
m_comboTraj.SetCurSel(m_comboTraj.GetCount()-1);
}
}
void CDlgFileSetting::OnOK()
{
UpdateData(TRUE);
APPStatic::GetMainView()->GetDocument()->m_strTrajFileName=m_strTrajFile;
APPStatic::GetMainView()->GetDocument()->m_strRadioFilePath=m_strRadio;
APPStatic::GetMainView()->GetDocument()->m_strRadioFileNameWithoutPath=m_strRadioFile;
APPStatic::GetMainView()->GetDocument()->m_dRadioFreq=m_dRadioFreq;
CDialog::OnOK();
}
void CDlgFileSetting::OnSelchangeRadiocombo()
{
if(m_comboRadio.GetCurSel()==0){
CString strName;
CFileDialog fileDlg(TRUE,_T("cfg"),NULL,OFN_OVERWRITEPROMPT,
_T("Radio Files(*.dat)|*.dat|All Files (*.*)|*.*||"));
if(fileDlg.DoModal()==IDOK){
m_strRadioFile=fileDlg.GetFileName();
strName=fileDlg.GetPathName();
strName.Delete(strName.Find(fileDlg.GetFileName().GetBuffer(0)),fileDlg.GetFileName().GetLength());
UpdateData(FALSE);
}
else{
m_comboRadio.SetCurSel(1);
return;
}
m_strRadio=strName;
m_comboRadio.AddString(strName);
m_comboRadio.SetCurSel(m_comboRadio.GetCount()-1);
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -