// DisperProg.cpp : implementation file // #include "stdafx.h" #include "mw4gameed2.h" #include "DisperProg.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CDisperProg dialog CDisperProg::CDisperProg(CWnd* pParent /*=NULL*/) : CDialog(CDisperProg::IDD, pParent) { //{{AFX_DATA_INIT(CDisperProg) m_MisPlaceText = _T(""); m_PlacedText = _T(""); m_ObjTotText = _T(""); //}}AFX_DATA_INIT MisPlace=ObjTot=ObjPlaced=0; Create(CDisperProg::IDD,pParent); ShowWindow(SW_SHOW); } void CDisperProg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CDisperProg) DDX_Control(pDX, IDC_TOTPROG, m_ProCtrl); DDX_Text(pDX, IDC_MISPLACE, m_MisPlaceText); DDX_Text(pDX, IDC_OBJPLACED, m_PlacedText); DDX_Text(pDX, IDC_OBJTOT, m_ObjTotText); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CDisperProg, CDialog) //{{AFX_MSG_MAP(CDisperProg) //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CDisperProg message handlers void CDisperProg::Misplace() { MisPlace++; UpdateCons(); } void CDisperProg::SetTot(int tot) { ObjTot=tot; m_ProCtrl.SetRange(0,ObjTot); UpdateCons(); } void CDisperProg::UpdateCons() { m_ProCtrl.SetPos(ObjPlaced); m_PlacedText.Format("%i",ObjPlaced); m_MisPlaceText.Format("%i",MisPlace); m_ObjTotText.Format("%i",ObjTot); UpdateData(FALSE); RedrawWindow(); } void CDisperProg::Place(int onum) { ObjPlaced+=onum; UpdateCons(); } void CDisperProg::OnCancel() { // TODO: Add extra cleanup here CDialog::OnCancel(); } void CDisperProg::OnOK() { // TODO: Add extra validation here CDialog::OnOK(); }