📄 adframe.cpp
字号:
// ADFrame.cpp : implementation file
//
#include "stdafx.h"
#include "USB.h"
#include "ADFrame.h"
#include "Main.h"
#include "USBDigitView.h"
#include "USBWaveView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
extern Control_Mode m_Control;
/////////////////////////////////////////////////////////////////////////////
// CADFrame
IMPLEMENT_DYNCREATE(CADFrame, CMDIChildWnd)
CADFrame::CADFrame()
{
}
CADFrame::~CADFrame()
{
}
BEGIN_MESSAGE_MAP(CADFrame, CMDIChildWnd)
//{{AFX_MSG_MAP(CADFrame)
ON_WM_CREATE()
ON_CBN_SELCHANGE(IDC_COMBO_FirstChannel, OnSelchangeCOMBOFirstChannel)
ON_CBN_SELCHANGE(IDC_COMBO_GAINS, OnSelchangeComboGains)
ON_CBN_SELCHANGE(IDC_COMBO_LastChannel, OnSelchangeCOMBOLastChannel)
ON_CBN_SELCHANGE(IDC_COMBO_TriggerMode, OnSelchangeCOMBOTriggerMode)
ON_EN_CHANGE(IDC_EDIT_Frequence, OnChangeEDITFrequence)
ON_WM_CLOSE()
ON_WM_CANCELMODE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CADFrame message handlers
BOOL CADFrame::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Add your specialized code here and/or call the base class
if( !CMDIChildWnd::PreCreateWindow(cs) )
return FALSE;
return CMDIChildWnd::PreCreateWindow(cs);
}
int CADFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CMDIChildWnd::OnCreate(lpCreateStruct) == -1)
return -1;
// TODO: Add your specialized creation code here
if (!m_wndShowStatus.Create(this, IDD_ADDIG,
CBRS_TOP | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_HIDE_INPLACE,
CG_ID_VIEW_TOP))
{
TRACE0("Failed to create dialog bar m_wndSetupDlg\n");
return -1; // fail to create
} // CBRS_TOP 指定该对话框条将放在父窗口顶部
m_wndShowStatus.EnableDocking(CBRS_ALIGN_TOP | CBRS_ALIGN_BOTTOM);
EnableDocking(CBRS_ALIGN_ANY); // 按CBRS_TOP的方式放置该控件
DockControlBar(&m_wndShowStatus);
CEdit* pEditfrequecy=(CEdit*)m_wndShowStatus.GetDlgItem(IDC_EDIT_Frequence);
pEditfrequecy->SetWindowText("25000");
CButton* pBtnStop =(CButton*)m_wndShowStatus.GetDlgItem(IDC_BTN_STOP);
pBtnStop->EnableWindow(FALSE);
CComboBox* pComFirst =(CComboBox*)m_wndShowStatus.GetDlgItem(IDC_COMBO_FirstChannel);
pComFirst->SetCurSel(0);
CComboBox* pComLast =(CComboBox*)m_wndShowStatus.GetDlgItem(IDC_COMBO_LastChannel);
pComLast->SetCurSel(15);
CComboBox* pComGains =(CComboBox*)m_wndShowStatus.GetDlgItem(IDC_COMBO_GAINS);
pComGains->SetCurSel(0);
CComboBox* pComTriger =(CComboBox*)m_wndShowStatus.GetDlgItem(IDC_COMBO_TriggerMode);
pComTriger->SetCurSel(0);
m_Control.FirstChannel=0;
m_Control.LastChannel=15;
m_Control.Gains=0;
m_Control.GroundingMode=0;
if (!m_wndShowStatus2.Create(this, IDD_STATUS,
CBRS_BOTTOM | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_HIDE_INPLACE,
CG_ID_VIEW_BOTTOM))
{
TRACE0("Failed to create dialog bar m_wndShowStatus1\n");
return -1; // fail to create
}
m_wndShowStatus2.EnableDocking(CBRS_ALIGN_BOTTOM | CBRS_ALIGN_TOP);
EnableDocking(CBRS_ALIGN_ANY);
DockControlBar(&m_wndShowStatus2);
if (!m_wndShowStatus3.Create(this, IDD_CONTROL,
CBRS_RIGHT,
CG_ID_VIEW_RIGHT))
{
TRACE0("Failed to create dialog bar m_wndShowStatus1\n");
return -1; // fail to create
}
m_wndShowStatus3.EnableDocking(CBRS_ALIGN_BOTTOM | CBRS_ALIGN_TOP);
EnableDocking(CBRS_ALIGN_ANY);
DockControlBar(&m_wndShowStatus3);
return 0;
}
BOOL CADFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
// TODO: Add your specialized code here and/or call the base class
if(!m_wndSplitter.CreateStatic(this,1,2))
{
TRACE0("Failed to CreateStaticSplitter\n");
return FALSE;
}
if (!m_wndSplitter.CreateView(0, 0,
RUNTIME_CLASS(CUSBDigitView), CSize(300, 100), pContext))
{//数字列表创建显示
TRACE0("Failed to create first pane\n");
return FALSE;
}
if (!m_wndSplitter.CreateView(0, 1,
RUNTIME_CLASS(CUSBWaveView), CSize(0, 100), pContext))
{//数字列表创建显示
TRACE0("Failed to create first pane\n");
return FALSE;
}
//m_wndSplitter.SetActivePane(1,2);
return TRUE;//CMDIChildWnd::OnCreateClient(lpcs, pContext);//TRUE;//
}
void CADFrame::ActivateFrame(int nCmdShow)
{
// TODO: Add your specialized code here and/or call the base class
nCmdShow = SW_SHOWMAXIMIZED; // 使子帧窗口最大化
CMDIChildWnd::ActivateFrame(nCmdShow);
}
void CADFrame::OnSelchangeCOMBOFirstChannel()
{
// TODO: Add your control notification handler code here
CComboBox* pCombox=(CComboBox*)(m_wndShowStatus.GetDlgItem(IDC_COMBO_FirstChannel));
CString str;
pCombox->GetWindowText(str);
/*
LONG Channel = pCombox->GetCurSel();
if(Channel>m_Control.LastChannel)
{
MessageBox("首通道不能大于末通道","提醒您...",MB_ICONSTOP);
pCombox->SetCurSel(m_Control.FirstChannel);
}
else
m_Control.FirstChannel=Channel;
*/
m_Control.FirstChannel =atol(str);
}
void CADFrame::OnSelchangeComboGains()
{
// TODO: Add your control notification handler code here
}
void CADFrame::OnSelchangeCOMBOLastChannel()
{
// TODO: Add your control notification handler code here
CComboBox* pCombox=(CComboBox*)(m_wndShowStatus.GetDlgItem(IDC_COMBO_LastChannel));
CString str;
pCombox->GetWindowText(str);
m_Control.LastChannel =atol(str);
}
void CADFrame::OnSelchangeCOMBOTriggerMode()
{
// TODO: Add your control notification handler code here
CComboBox* pCombox=(CComboBox*)(m_wndShowStatus.GetDlgItem(IDC_COMBO_TriggerMode));
CString str;
pCombox->GetWindowText(str);
if(str=="内触发")
{
m_Control.GroundingMode =0;
}
else
{
m_Control.GroundingMode =1;
}
}
void CADFrame::OnChangeEDITFrequence()
{
// TODO: If this is a RICHEDIT control, the control will not
// send this notification unless you override the CMDIChildWnd::OnInitDialog()
// function and call CRichEditCtrl().SetEventMask()
// with the ENM_CHANGE flag ORed into the mask.
// TODO: Add your control notification handler code here
long frenquenc;
long var_middle;
CEdit* pEdit=(CEdit*)(m_wndShowStatus.GetDlgItem(IDC_EDIT_Frequence));
CString str;
pEdit->GetWindowText(str);
frenquenc=atol(str);
if((frenquenc>400000) | (frenquenc<=0))
{
MessageBox("采样频率介于0-400000之间","提醒您...",MB_ICONSTOP);
pEdit->SetWindowText("250000");
}
else
{
var_middle=4000000/frenquenc;
m_Control.Frequency=4000000/var_middle;
}
}
void CADFrame::OnClose()
{
// TODO: Add your message handler code here and/or call default
CMDIChildWnd::OnClose();
}
void CADFrame::OnCancelMode()
{
CMDIChildWnd::OnCancelMode();
// TODO: Add your message handler code here
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -