?? speeds.cpp
字號:
// speeds.cpp : implementation file
//
#include "stdafx.h"
#include "mastercontrol.h"
#include "speeds.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// speeds property page
IMPLEMENT_DYNCREATE(speeds, CPropertyPage)
speeds::speeds() : CPropertyPage(speeds::IDD)
{
//{{AFX_DATA_INIT(speeds)
m_XAcc = 1.0;
m_XDec = 1.0;
m_XMaxIps = 4.0;
m_YAcc = 1.0;
m_YDec = 1.0;
m_YMaxIps = 4.0;
m_XMinIps = 1.0;
m_YMinIps = 1.0;
m_ZAcc = 1.0;
m_ZDec = 1.0;
m_ZMaxIps = 4.0;
m_ZMinIps = 1.0;
m_ZMaxCut = 0.0;
m_YMaxCut = 0.0;
m_XMaxCut = 0.0;
//}}AFX_DATA_INIT
XRamp = FALSE;
YRamp = FALSE;
ZRamp = FALSE;
CString buffer;
buffer = AfxGetApp( )->GetProfileString("Preferences", "m_XAcc" , " 1.0");
m_XAcc = atof( (LPCTSTR) buffer);
buffer = AfxGetApp( )->GetProfileString("Preferences", "m_XDec" , " 1.0");
m_XDec = atof( (LPCTSTR) buffer);
buffer = AfxGetApp( )->GetProfileString("Preferences", "m_XMaxIps" , " 4.0");
m_XMaxIps = atof( (LPCTSTR) buffer);
buffer = AfxGetApp( )->GetProfileString("Preferences", "m_YAcc" , " 1.0");
m_YAcc = atof( (LPCTSTR) buffer);
buffer = AfxGetApp( )->GetProfileString("Preferences", "m_YDec" , " 1.0");
m_YDec = atof( (LPCTSTR) buffer);
buffer = AfxGetApp( )->GetProfileString("Preferences", "m_YMaxIps" , " 4.0");
m_YMaxIps = atof( (LPCTSTR) buffer);
buffer = AfxGetApp( )->GetProfileString("Preferences", "m_XMinIps" , " 4.0");
m_XMinIps = atof( (LPCTSTR) buffer);
buffer = AfxGetApp( )->GetProfileString("Preferences", "m_YMinIps" , " 2.0");
m_YMinIps = atof( (LPCTSTR) buffer);
buffer = AfxGetApp( )->GetProfileString("Preferences", "m_YMaxCut" , " 1.0");
m_YMaxCut = atof( (LPCTSTR) buffer);
buffer = AfxGetApp( )->GetProfileString("Preferences", "m_XMaxCut" , " 1.0");
m_XMaxCut = atof( (LPCTSTR) buffer);
buffer = AfxGetApp( )->GetProfileString("Preferences", "m_ZMaxCut" , " 1.0");
m_ZMaxCut = atof( (LPCTSTR) buffer);
buffer = AfxGetApp( )->GetProfileString("Preferences", "m_ZAcc" , " 1.0");
m_ZAcc = atof( (LPCTSTR) buffer);
buffer = AfxGetApp( )->GetProfileString("Preferences", "m_ZDec" , " 1.0");
m_ZDec = atof( (LPCTSTR) buffer);
buffer = AfxGetApp( )->GetProfileString("Preferences", "m_ZMaxIps" , " 4.0");
m_ZMaxIps = atof( (LPCTSTR) buffer);
buffer = AfxGetApp( )->GetProfileString("Preferences", "m_ZMinIps" , " 1.0");
m_ZMinIps = atof( (LPCTSTR) buffer);
XRamp = (BOOL) AfxGetApp( )->GetProfileInt("Preferences", "XRamp" , 0 ); // false by default
YRamp = (BOOL) AfxGetApp( )->GetProfileInt("Preferences", "YRamp" , 0 ); // false by default
ZRamp = (BOOL) AfxGetApp( )->GetProfileInt("Preferences", "ZRamp" , 0 ); // false by default
}
speeds::~speeds()
{
}
void speeds::DoDataExchange(CDataExchange* pDX)
{
CPropertyPage::DoDataExchange(pDX);
//{{AFX_DATA_MAP(speeds)
DDX_Text(pDX, IDC_XACC, m_XAcc);
DDX_Text(pDX, IDC_XDEC, m_XDec);
DDX_Text(pDX, IDC_XMAXIPS, m_XMaxIps);
DDX_Text(pDX, IDC_YACC, m_YAcc);
DDX_Text(pDX, IDC_YDEC, m_YDec);
DDX_Text(pDX, IDC_YMAXIPS, m_YMaxIps);
DDX_Text(pDX, IDC_XMINIPS, m_XMinIps);
DDX_Text(pDX, IDC_YMINIPS, m_YMinIps);
DDX_Text(pDX, IDC_ZACC, m_ZAcc);
DDX_Text(pDX, IDC_ZDEC, m_ZDec);
DDX_Text(pDX, IDC_ZMAXIPS, m_ZMaxIps);
DDX_Text(pDX, IDC_ZMINIPS, m_ZMinIps);
DDX_Text(pDX, IDC_ZMAXIPSCUT, m_ZMaxCut);
DDX_Text(pDX, IDC_YMAXIPSCUT, m_YMaxCut);
DDX_Text(pDX, IDC_XMAXIPSCUT, m_XMaxCut);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(speeds, CPropertyPage)
//{{AFX_MSG_MAP(speeds)
ON_WM_PAINT()
ON_BN_CLICKED(IDC_XRAMP, OnXramp)
ON_BN_CLICKED(IDC_YRAMP, OnYramp)
ON_BN_CLICKED(IDC_ZRAMP, OnZramp)
ON_EN_UPDATE(IDC_XMAXIPS, OnUpdateXmaxips)
ON_EN_UPDATE(IDC_XMINIPS, OnUpdateXminips)
ON_EN_UPDATE(IDC_XACC, OnUpdateXacc)
ON_EN_UPDATE(IDC_XDEC, OnUpdateXdec)
ON_EN_UPDATE(IDC_YACC, OnUpdateYacc)
ON_EN_UPDATE(IDC_YDEC, OnUpdateYdec)
ON_EN_UPDATE(IDC_YMAXIPS, OnUpdateYmaxips)
ON_EN_UPDATE(IDC_YMINIPS, OnUpdateYminips)
ON_EN_UPDATE(IDC_ZACC, OnUpdateZacc)
ON_EN_UPDATE(IDC_ZDEC, OnUpdateZdec)
ON_EN_UPDATE(IDC_ZMAXIPS, OnUpdateZmaxips)
ON_EN_UPDATE(IDC_ZMINIPS, OnUpdateZminips)
ON_EN_UPDATE(IDC_XMAXIPSCUT, OnUpdateXmaxipscut)
ON_EN_UPDATE(IDC_YMAXIPSCUT, OnUpdateYmaxipscut)
ON_EN_UPDATE(IDC_ZMAXIPSCUT, OnUpdateZmaxipscut)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// speeds message handlers
BOOL speeds::OnSetActive()
{
BOOL value = CPropertyPage::OnSetActive();
return value;
}
void speeds::OnPaint()
{
CPaintDC dc(this); // device context for painting
CEdit *xacc = (CEdit*)GetDlgItem(IDC_XACC);
CEdit *xdec = (CEdit*)GetDlgItem(IDC_XDEC);
CButton *XRampbutton = (CButton*)GetDlgItem( IDC_XRAMP );
if( XRamp )
{
XRampbutton->SetCheck( 1 );
xacc->EnableWindow(TRUE);
xdec->EnableWindow(TRUE);
}
else
{
XRampbutton->SetCheck( 0 );
xacc->EnableWindow(FALSE);
xdec->EnableWindow(FALSE);
}
CButton *YRampbutton = (CButton*)GetDlgItem( IDC_YRAMP );
CEdit *yacc = (CEdit*)GetDlgItem(IDC_YACC);
CEdit *ydec = (CEdit*)GetDlgItem(IDC_YDEC);
if( YRamp )
{
YRampbutton->SetCheck( 1 );
yacc->EnableWindow(TRUE);
ydec->EnableWindow(TRUE);
}
else
{
YRampbutton->SetCheck( 0 );
yacc->EnableWindow(FALSE);
ydec->EnableWindow(FALSE);
}
CButton *ZRampbutton = (CButton*)GetDlgItem( IDC_ZRAMP );
CEdit *zacc = (CEdit*)GetDlgItem(IDC_ZACC);
CEdit *zdec = (CEdit*)GetDlgItem(IDC_ZDEC);
if( ZRamp )
{
ZRampbutton->SetCheck( 1 );
zacc->EnableWindow(TRUE);
zdec->EnableWindow(TRUE);
}
else
{
ZRampbutton->SetCheck( 0 );
zacc->EnableWindow(FALSE);
zdec->EnableWindow(FALSE);
}
}
void speeds::OnXramp()
{
SetModified(TRUE);
XRamp = !XRamp;
CButton *XRampbutton = (CButton*)GetDlgItem( IDC_XRAMP );
CEdit *xacc = (CEdit*)GetDlgItem(IDC_XACC);
CEdit *xdec = (CEdit*)GetDlgItem(IDC_XDEC);
if( XRamp )
{
XRampbutton->SetCheck( 1 );
xacc->EnableWindow(TRUE);
xdec->EnableWindow(TRUE);
}
else
{
XRampbutton->SetCheck( 0 );
xacc->EnableWindow(FALSE);
xdec->EnableWindow(FALSE);
}
}
void speeds::OnYramp()
{
SetModified(TRUE);
YRamp = !YRamp;
CButton *YRampbutton = (CButton*)GetDlgItem( IDC_YRAMP );
CEdit *yacc = (CEdit*)GetDlgItem(IDC_YACC);
CEdit *ydec = (CEdit*)GetDlgItem(IDC_YDEC);
if( YRamp )
{
YRampbutton->SetCheck( 1 );
yacc->EnableWindow(TRUE);
ydec->EnableWindow(TRUE);
}
else
{
YRampbutton->SetCheck( 0 );
yacc->EnableWindow(FALSE);
ydec->EnableWindow(FALSE);
}
}
void speeds::OnZramp()
{
SetModified(TRUE);
ZRamp = !ZRamp;
CButton *ZRampbutton = (CButton*)GetDlgItem( IDC_ZRAMP );
CEdit *zacc = (CEdit*)GetDlgItem(IDC_ZACC);
CEdit *zdec = (CEdit*)GetDlgItem(IDC_ZDEC);
if( ZRamp )
{
ZRampbutton->SetCheck( 1 );
zacc->EnableWindow(TRUE);
zdec->EnableWindow(TRUE);
}
else
{
ZRampbutton->SetCheck( 0 );
zacc->EnableWindow(FALSE);
zdec->EnableWindow(FALSE);
}
}
BOOL speeds::OnKillActive()
{
UpdateData(TRUE);
CString dummy;
CString value;
value = _gcvt( m_XAcc, 8, dummy.GetBuffer(25));
AfxGetApp( )->WriteProfileString("Preferences", "m_XAcc" , (LPCTSTR) dummy);
value = _gcvt( m_XDec, 8, dummy.GetBuffer(25) );
AfxGetApp( )->WriteProfileString("Preferences", "m_XDec" , (LPCTSTR) dummy);
value = _gcvt( m_XMaxIps, 8, dummy.GetBuffer(25) );
AfxGetApp( )->WriteProfileString("Preferences", "m_XMaxIps" , (LPCTSTR) dummy);
value = _gcvt( m_YAcc, 8, dummy.GetBuffer(25) );
AfxGetApp( )->WriteProfileString("Preferences", "m_YAcc" , (LPCTSTR) dummy);
value = _gcvt( m_YDec, 8, dummy.GetBuffer(25) );
AfxGetApp( )->WriteProfileString("Preferences", "m_YDec" , (LPCTSTR) dummy);
value = _gcvt( m_YMaxCut, 8,dummy.GetBuffer(25) );
AfxGetApp( )->WriteProfileString("Preferences", "m_YMaxCut" ,(LPCTSTR) dummy);
value = _gcvt( m_XMaxCut, 8,dummy.GetBuffer(25) );
AfxGetApp( )->WriteProfileString("Preferences", "m_XMaxCut" ,(LPCTSTR) dummy);
value = _gcvt( m_ZMaxCut, 8,dummy.GetBuffer(25) );
AfxGetApp( )->WriteProfileString("Preferences", "m_ZMaxCut" ,(LPCTSTR) dummy);
value = _gcvt( m_YMaxIps, 8,dummy.GetBuffer(25) );
AfxGetApp( )->WriteProfileString("Preferences", "m_YMaxIps" ,(LPCTSTR) dummy);
value = _gcvt( m_XMinIps, 8, dummy.GetBuffer(25) );
AfxGetApp( )->WriteProfileString("Preferences", "m_XMinIps" , (LPCTSTR) dummy);
value = _gcvt( m_YMinIps, 8, dummy.GetBuffer(25) );
AfxGetApp( )->WriteProfileString("Preferences", "m_YMinIps" , (LPCTSTR) dummy);
value = _gcvt( m_ZAcc, 8, dummy.GetBuffer(25) );
AfxGetApp( )->WriteProfileString("Preferences", "m_ZAcc" , (LPCTSTR) dummy);
value = _gcvt( m_ZDec, 8, dummy.GetBuffer(25) );
AfxGetApp( )->WriteProfileString("Preferences", "m_ZDec" , (LPCTSTR) dummy);
value = _gcvt( m_ZMaxIps, 8, dummy.GetBuffer(25) );
AfxGetApp( )->WriteProfileString("Preferences", "m_ZMaxIps" , (LPCTSTR) dummy);
value = _gcvt( m_ZMinIps, 8,dummy.GetBuffer(25) );
AfxGetApp( )->WriteProfileString("Preferences", "m_ZMinIps" , (LPCTSTR) dummy);
//Booleans
AfxGetApp( )->WriteProfileInt("Preferences", "XRamp" , (int)XRamp ); // false by default
AfxGetApp( )->WriteProfileInt("Preferences", "YRamp" , (int)YRamp ); // false by default
AfxGetApp( )->WriteProfileInt("Preferences", "ZRamp" , (int)ZRamp ); // false by default
return CPropertyPage::OnKillActive();
}
BOOL speeds::OnApply()
{
UpdateData( TRUE );
return CPropertyPage::OnApply();
}
void speeds::OnUpdateXmaxips()
{
SetModified(TRUE);
}
void speeds::OnUpdateXminips()
{
SetModified(TRUE);
}
void speeds::OnChangeAutozspeed()
{
SetModified(TRUE);
}
void speeds::OnUpdateXacc()
{
SetModified(TRUE);
}
void speeds::OnUpdateXdec()
{
SetModified(TRUE);
}
void speeds::OnUpdateYacc()
{
SetModified(TRUE);
}
void speeds::OnUpdateYdec()
{
SetModified(TRUE);
}
void speeds::OnUpdateYmaxips()
{
SetModified(TRUE);
}
void speeds::OnUpdateYminips()
{
SetModified(TRUE);
}
void speeds::OnUpdateZacc()
{
SetModified(TRUE);
}
void speeds::OnUpdateZdec()
{
SetModified(TRUE);
}
void speeds::OnUpdateZmaxips()
{
SetModified(TRUE);
}
void speeds::OnUpdateZminips()
{
SetModified(TRUE);
}
void speeds::OnOK()
{
// TODO: Add your specialized code here and/or call the base class
OnKillActive();
CPropertyPage::OnOK();
}
void speeds::OnUpdateXmaxipscut()
{
SetModified(TRUE);
}
void speeds::OnUpdateYmaxipscut()
{
SetModified(TRUE);
}
void speeds::OnUpdateZmaxipscut()
{
SetModified(TRUE);
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -