FlightDLG.cpp
上传用户:lbr_007
上传日期:2019-05-31
资源大小:282k
文件大小:2k
- // FlightDLG.cpp : implementation file
- //
- #include "stdafx.h"
- #include "tiffsample.h"
- #include "FlightDLG.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- namespace F3DSettings {
- bool firstPerson = false;
- int duration = 30;
- };
- /////////////////////////////////////////////////////////////////////////////
- // FlightDLG dialog
- FlightDLG::FlightDLG(CWnd* pParent /*=NULL*/)
- : CDialog(FlightDLG::IDD, pParent)
- {
- //{{AFX_DATA_INIT(FlightDLG)
- // NOTE: the ClassWizard will add member initialization here
- //}}AFX_DATA_INIT
- m_firstPerson = false;
- m_secs = 10;
- }
- void FlightDLG::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(FlightDLG)
- DDX_Control(pDX, IDC_DURATION_EDIT, m_durationEdit);
- DDX_Control(pDX, IDC_FIRSTPERSON_CHECK, m_fpCheck);
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(FlightDLG, CDialog)
- //{{AFX_MSG_MAP(FlightDLG)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // FlightDLG message handlers
- BOOL FlightDLG::OnInitDialog()
- {
- CDialog::OnInitDialog();
-
- char txt[24];
- sprintf(txt,"%d",F3DSettings::duration);
- m_durationEdit.SetWindowText(txt);
- m_fpCheck.SetCheck(F3DSettings::firstPerson);
-
- return TRUE; // return TRUE unless you set the focus to a control
- // EXCEPTION: OCX Property Pages should return FALSE
- }
- void FlightDLG::OnOK()
- {
- CString txt;
- m_durationEdit.GetWindowText(txt);
- m_secs = atoi((LPCTSTR)txt);
- m_firstPerson = (bool)m_fpCheck.GetCheck();
- if (m_secs < 2)
- {
- AfxMessageBox("Duration must be greater than 2 seconds",MB_ICONERROR);
- return;
- }
- F3DSettings::duration = m_secs;
- F3DSettings::firstPerson = m_firstPerson;
-
- CDialog::OnOK();
- }