📄 dlgsetboxiradar.cpp
字号:
// DlgSetBoxiRadar.cpp : implementation file
//
#include "stdafx.h"
#include "videocapture.h"
#include "DlgSetBoxiRadar.h"
#include "VideoCaptureView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CDlgSetBoxiRadar dialog
CDlgSetBoxiRadar::CDlgSetBoxiRadar(CWnd* pParent /*=NULL*/)
: CDialog(CDlgSetBoxiRadar::IDD, pParent)
{
//{{AFX_DATA_INIT(CDlgSetBoxiRadar)
//}}AFX_DATA_INIT
}
void CDlgSetBoxiRadar::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDlgSetBoxiRadar)
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CDlgSetBoxiRadar, CDialog)
//{{AFX_MSG_MAP(CDlgSetBoxiRadar)
ON_BN_CLICKED(IDC_RADIO1, OnRadio1)
ON_BN_CLICKED(IDC_RADIO2, OnRadio2)
ON_BN_CLICKED(IDC_RADIO3, OnRadio3)
ON_BN_CLICKED(IDC_RADIO4, OnRadio4)
ON_BN_CLICKED(IDC_RADIO5, OnRadio5)
ON_BN_CLICKED(IDC_RADIO6, OnRadio6)
ON_BN_CLICKED(IDC_RADIO7, OnRadio7)
ON_BN_CLICKED(IDC_RADIO8, OnRadio8)
ON_BN_CLICKED(IDC_RADIO9, OnRadio9)
ON_BN_CLICKED(IDC_RADIO10, OnRadio10)
ON_EN_CHANGE(IDC_EDIT2, OnChangeEdit2)
ON_BN_CLICKED(IDC_RADIO11, OnRadio11)
ON_BN_CLICKED(IDC_RADIO12, OnRadio12)
ON_BN_CLICKED(IDC_RADIO13, OnRadio13)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDlgSetBoxiRadar message handlers
void CDlgSetBoxiRadar::SendRadarCtrl(int a,int j)
{
CVideoCaptureView* pView=CVideoCaptureView::GetView();
while(!pView)
pView=CVideoCaptureView::GetView();
pView->SetBoxiRadarCtrl(a,j);
}
void CDlgSetBoxiRadar::OnRadio1()
{
SendRadarCtrl(0);
}
void CDlgSetBoxiRadar::OnRadio2()
{
SendRadarCtrl(1);
}
void CDlgSetBoxiRadar::OnRadio3()
{
SendRadarCtrl(2);
}
void CDlgSetBoxiRadar::OnRadio4()
{
SendRadarCtrl(3);
}
void CDlgSetBoxiRadar::OnRadio5()
{
SendRadarCtrl(4);
}
void CDlgSetBoxiRadar::OnRadio6()
{
SendRadarCtrl(5);
}
void CDlgSetBoxiRadar::OnRadio7()
{
SendRadarCtrl(6);
}
void CDlgSetBoxiRadar::OnRadio8()
{
SendRadarCtrl(7);
}
void CDlgSetBoxiRadar::OnRadio9()
{
SendRadarCtrl(8);
}
void CDlgSetBoxiRadar::OnRadio10()
{
SendRadarCtrl(9);
}
void CDlgSetBoxiRadar::OnRadio11()
{
SendRadarCtrl(10);
}
void CDlgSetBoxiRadar::OnChangeEdit2()
{
CString str;
int a;
GetDlgItem(IDC_EDIT2)->GetWindowText(str);
if(str!="")
{
try
{
a=atoi(str);
}
catch (...) {
a=0;
}
if (a>5)
a=5;
else if (a<0)
a=0;
str.Format("%d",a);
// GetDlgItem(IDC_EDIT2)->SetWindowText(str);
SendRadarCtrl(11,a);
}
else
{
SendRadarCtrl(11,0);
}
}
BOOL CDlgSetBoxiRadar::OnInitDialog()
{
CDialog::OnInitDialog();
CVideoCaptureView* pView=CVideoCaptureView::GetView();
if(!pView)
return FALSE;
pView->RadarStatus.controlMode = GetPrivateProfileInt("RADAR","CONTROLMODE",2,".\\config.ini");
if(pView->RadarStatus.controlMode==2)
((CButton*)GetDlgItem(IDC_RADIO13))->SetCheck(TRUE);
else
((CButton*)GetDlgItem(IDC_RADIO12))->SetCheck(TRUE);
if(pView->RadarStatus.mode==1)
((CButton*)GetDlgItem(IDC_RADIO2))->SetCheck(TRUE);
else
{
pView->RadarStatus.mode=0;
((CButton*)GetDlgItem(IDC_RADIO1))->SetCheck(TRUE);
}
switch(pView->RadarStatus.SpeedMode) {
case 0:
((CButton*)GetDlgItem(IDC_RADIO4))->SetCheck(TRUE);
break;
case 1:
((CButton*)GetDlgItem(IDC_RADIO5))->SetCheck(TRUE);
break;
default:
((CButton*)GetDlgItem(IDC_RADIO3))->SetCheck(TRUE);
pView->RadarStatus.SpeedMode=2;
break;
}
CString str;
if (pView->RadarStatus.distance>5 || pView->RadarStatus.distance<0)
{
pView->RadarStatus.distance=0;
}
str.Format("%d",pView->RadarStatus.distance);
GetDlgItem(IDC_EDIT2)->SetWindowText(str);
switch(pView->RadarStatus.driveway) {
case 1:
((CButton*)GetDlgItem(IDC_RADIO7))->SetCheck(TRUE);
break;
case 2:
((CButton*)GetDlgItem(IDC_RADIO8))->SetCheck(TRUE);
break;
case 3:
((CButton*)GetDlgItem(IDC_RADIO9))->SetCheck(TRUE);
break;
/*case 4:
((CButton*)GetDlgItem(IDC_RADIO10))->SetCheck(TRUE);
break;
case 5:
((CButton*)GetDlgItem(IDC_RADIO11))->SetCheck(TRUE);
break;
*/
default:
((CButton*)GetDlgItem(IDC_RADIO6))->SetCheck(TRUE);
pView->RadarStatus.driveway=0;
break;
}
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CDlgSetBoxiRadar::OnRadio12()
{
// TODO: Add your control notification handler code here
SendRadarCtrl(14,2);
WritePrivateProfileString("RADAR","CONTROLMODE","1",".\\config.ini");
}
void CDlgSetBoxiRadar::OnRadio13()
{
SendRadarCtrl(14,4);
WritePrivateProfileString("RADAR","CONTROLMODE","2",".\\config.ini"); // TODO: Add your control notification handler code here
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -