📄 bottomdlg.cpp
字号:
// BottomDlg.cpp : implementation file
//
#include "stdafx.h"
#include "WanGuan.h"
#include "BottomDlg.h"
#include "WanGuanView.h"
#include "MainFrm.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CBottomDlg dialog
CBottomDlg::CBottomDlg(CWnd* pParent /*=NULL*/)
: CDialog(CBottomDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CBottomDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void CBottomDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CBottomDlg)
DDX_Control(pDX, IDC_SLIDER1, m_SliderSpeed);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CBottomDlg, CDialog)
//{{AFX_MSG_MAP(CBottomDlg)
ON_BN_CLICKED(IDC_BUTTONPLAY, OnButtonplay)
ON_BN_CLICKED(IDC_BUTTONPAUSE, OnButtonpause)
ON_WM_HSCROLL()
ON_BN_CLICKED(IDC_BUTTONGUANXING, OnButtonguanxing)
ON_BN_CLICKED(IDC_BUTTONMACHINE, OnButtonmachine)
ON_BN_CLICKED(IDC_BUTTONBIGGER, OnButtonbigger)
ON_BN_CLICKED(IDC_BUTTONSMALLER, OnButtonsmaller)
ON_BN_CLICKED(IDC_BUTTONROTATE, OnButtonrotate)
ON_BN_CLICKED(IDC_BUTTONMOVE, OnButtonmove)
ON_BN_CLICKED(IDC_BUTTONRESET, OnButtonreset)
ON_BN_CLICKED(IDC_BUTTONCREATEGUANXING, OnButtoncreateguanxing)
ON_BN_CLICKED(IDC_BUTTONFANGZHEN, OnButtonfangzhen)
ON_BN_CLICKED(IDC_BUTTONSTOP, OnButtonstop)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CBottomDlg message handlers
BOOL CBottomDlg::OnInitDialog()
{
CDialog::OnInitDialog();
MoveWindow(0,648,1024,120);
DlgGuanXingPar=new CDlgGuanXingPar;
DlgGuanXingPar->Create(IDD_DIALOGGUANXINGPAR,this);
DlgMachengPar=new CDlgMachinePar;
DlgMachengPar->Create(IDD_DIALOGMACHINEPAR,this);
// TODO: Add extra initialization here
ButtonPlay.AutoLoad(IDC_BUTTONPLAY, this);
ButtonPause.AutoLoad(IDC_BUTTONPAUSE, this);
ButtonStop.AutoLoad(IDC_BUTTONSTOP, this);
ButtonPlay.EnableWindow(FALSE);
ButtonPause.EnableWindow(FALSE);
ButtonStop.EnableWindow(FALSE);
m_SliderSpeed.SetPos(20);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CBottomDlg::OnButtonplay()
{
// TODO: Add your control notification handler code here
CWanGuanView * pView=(CWanGuanView*)GetWanGuanView();
pView->bSingleB=FALSE;
pView->SetTimer(1,1,NULL);
}
CView * CBottomDlg::GetWanGuanView()
{
CWanGuanApp *pApp = (CWanGuanApp *)AfxGetApp();
CMainFrame *pFrame = (CMainFrame *)pApp->m_pMainWnd;
CView *pView = (CView *)pFrame->m_wndSplitter.GetPane(0,1);
return pView;
}
void CBottomDlg::OnButtonpause()
{
// TODO: Add your control notification handler code here
CWanGuanView * pView=(CWanGuanView*)GetWanGuanView();
pView->KillTimer(1);
}
void CBottomDlg::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
// TODO: Add your message handler code here and/or call default
int iRange;
float ftmp;
CWanGuanView * pView=(CWanGuanView*)GetWanGuanView();
ftmp=m_SliderSpeed.GetPos();
pView->fSimulationSpeed=ftmp/20;
CDialog::OnHScroll(nSBCode, nPos, pScrollBar);
}
void CBottomDlg::OnButtonguanxing()
{
static BOOL bShow;
bShow=!bShow;
if(bShow)
DlgGuanXingPar->ShowWindow(SW_SHOW);
else
DlgGuanXingPar->ShowWindow(SW_HIDE);
// TODO: Add your control notification handler code here
}
void CBottomDlg::OnButtonmachine()
{
static BOOL bShow;
bShow=!bShow;
if(bShow)
DlgMachengPar->ShowWindow(SW_SHOW);
else
DlgMachengPar->ShowWindow(SW_HIDE);
// TODO: Add your control notification handler code here
}
void CBottomDlg::OnButtonbigger()
{
// TODO: Add your control notification handler code here
CWanGuanView * pView=(CWanGuanView*)GetWanGuanView();
pView->m_xScaling=1.1*pView->m_xScaling;
pView->m_yScaling=pView->m_xScaling;
pView->m_zScaling=pView->m_xScaling;
pView->InvalidateRect(NULL,FALSE);
}
void CBottomDlg::OnButtonsmaller()
{
// TODO: Add your control notification handler code here
CWanGuanView * pView=(CWanGuanView*)GetWanGuanView();
pView->m_xScaling=pView->m_xScaling/1.1;
pView->m_yScaling=pView->m_xScaling;
pView->m_zScaling=pView->m_xScaling;
pView->InvalidateRect(NULL,FALSE);
}
void CBottomDlg::OnButtonrotate()
{
// TODO: Add your control notification handler code here
CWanGuanView * pView=(CWanGuanView*)GetWanGuanView();
pView->m_bRotateOperation=true;
pView->m_bMoveOperation=false;
}
void CBottomDlg::OnButtonmove()
{
// TODO: Add your control notification handler code here
CWanGuanView * pView=(CWanGuanView*)GetWanGuanView();
pView->m_bRotateOperation=false;
pView->m_bMoveOperation=true;
}
void CBottomDlg::OnButtonreset()
{
CWanGuanView * pView=(CWanGuanView*)GetWanGuanView();
pView->m_xScaling=1;
pView->m_yScaling=pView->m_xScaling;
pView->m_zScaling=pView->m_xScaling;
pView->m_xTranslation=0;
pView->m_yTranslation=pView->m_xTranslation;
pView->m_zTranslation=pView->m_xTranslation;
pView->m_xRotation=0;
pView->m_yRotation=pView->m_xRotation;
pView->InvalidateRect(NULL,FALSE);
// TODO: Add your control notification handler code here
}
void CBottomDlg::OnButtoncreateguanxing()
{
// TODO: Add your control notification handler code here
CWanGuanView * pView=(CWanGuanView*)GetWanGuanView();
pView->iViewMode=1;
pView->KillTimer(1);
ButtonPlay.EnableWindow(FALSE);
ButtonPause.EnableWindow(FALSE);
ButtonStop.EnableWindow(FALSE);
pView->InvalidateRect(NULL,FALSE);
}
void CBottomDlg::OnButtonfangzhen()
{
// TODO: Add your control notification handler code here
CWanGuanView * pView=(CWanGuanView*)GetWanGuanView();
pView->iViewMode=2;
pView->CalCreatedPipe();
ButtonPlay.EnableWindow(TRUE);
ButtonPause.EnableWindow(TRUE);
ButtonStop.EnableWindow(TRUE);
pView->InvalidateRect(NULL,FALSE);
}
void CBottomDlg::OnButtonstop()
{
// TODO: Add your control notification handler code here
CWanGuanView * pView=(CWanGuanView*)GetWanGuanView();
pView->KillTimer(1);
pView->fGuanCurrentPos=0;
pView->InvalidateRect(NULL,FALSE);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -