www.pudn.com > goodchessGame.zip > MarriagePointsDialog.cpp


// MarriagePointsDialog.cpp : implementation file 
// 
 
#include "stdafx.h" 
#include "FiveInOne.h" 
#include "MarriagePointsDialog.h" 
 
 
// CMarriagePointsDialog dialog 
 
IMPLEMENT_DYNAMIC(CMarriagePointsDialog, CDialog) 
CMarriagePointsDialog::CMarriagePointsDialog(CWnd* pParent /*=NULL*/) 
	: CDialog(CMarriagePointsDialog::IDD, pParent) 
	, m_pointsJokerTunnela(10) 
	, m_pointsJhipluTunnela(20) 
	, m_pointsTipluTunnela(20) 
	, m_pointsPopluTunnela(20) 
	, m_pointsSimpleTunnela(5) 
	, m_pointsDueJokerSeen(3) 
	, m_pointsDueJokerNotSeen(10) 
	, m_pointsSingleMarriage(10) 
	, m_pointsDoubleMarriage(30) 
	, m_pointsTripleMarriage(50) 
	, m_pointsSingleJhiplu(2) 
	, m_pointsDoubleJhiplu(5) 
	, m_pointsTripleJhiplu(10) 
	, m_pointsSingleTiplu(2) 
	, m_pointsDoubleTiplu(5) 
	, m_pointsTripleTiplu(10) 
	, m_pointsSinglePoplu(2) 
	, m_pointsDoublePoplu(5) 
	, m_pointsTriplePoplu(10) 
{ 
} 
 
CMarriagePointsDialog::~CMarriagePointsDialog() 
{ 
} 
 
void CMarriagePointsDialog::DoDataExchange(CDataExchange* pDX) 
{ 
	CDialog::DoDataExchange(pDX); 
	DDX_Text(pDX, IDC_JOKER_TUNNELA, m_pointsJokerTunnela); 
	DDX_Text(pDX, IDC_JHIPLU_TUNNELA, m_pointsJhipluTunnela); 
	DDX_Text(pDX, IDC_TIPLU_TUNNELA, m_pointsTipluTunnela); 
	DDX_Text(pDX, IDC_POPLU_TUNNELA, m_pointsPopluTunnela); 
	DDX_Text(pDX, IDC_SIMPLE_TUNNELA, m_pointsSimpleTunnela); 
	DDX_Text(pDX, IDC_POINTSDUE_JOKERSEEN, m_pointsDueJokerSeen); 
	DDX_Text(pDX, IDC_POINTSDUE_JOKERNOTSEEN, m_pointsDueJokerNotSeen); 
	DDX_Text(pDX, IDC_SINGLE_MARRIAGE, m_pointsSingleMarriage); 
	DDX_Text(pDX, IDC_DOUBLE_MARRIAGE, m_pointsDoubleMarriage); 
	DDX_Text(pDX, IDC_TRIPLE_MARRIAGE, m_pointsTripleMarriage); 
	DDX_Text(pDX, IDC_SINGLE_JHIPLU, m_pointsSingleJhiplu); 
	DDX_Text(pDX, IDC_DOUBLE_JHIPLU, m_pointsDoubleJhiplu); 
	DDX_Text(pDX, IDC_TRIPLE_JHIPLU, m_pointsTripleJhiplu); 
	DDX_Text(pDX, IDC_SINGLE_TIPLU, m_pointsSingleTiplu); 
	DDX_Text(pDX, IDC_DOUBLE_TIPLU, m_pointsDoubleTiplu); 
	DDX_Text(pDX, IDC_TRIPLE_TIPLU, m_pointsTripleTiplu); 
	DDX_Text(pDX, IDC_SINGLE_POPLU, m_pointsSinglePoplu); 
	DDX_Text(pDX, IDC_DOUBLE_POPLU, m_pointsDoublePoplu); 
	DDX_Text(pDX, IDC_TRIPLE_POPLU, m_pointsTriplePoplu); 
} 
 
 
BEGIN_MESSAGE_MAP(CMarriagePointsDialog, CDialog) 
	ON_CONTROL_RANGE(EN_KILLFOCUS, IDC_JOKER_TUNNELA, IDC_TRIPLE_POPLU, OnEnKillfocus) 
	ON_CONTROL_RANGE(EN_CHANGE, IDC_JOKER_TUNNELA, IDC_TRIPLE_POPLU, OnEnChange) 
END_MESSAGE_MAP() 
 
 
// CMarriagePointsDialog message handlers 
 
void CMarriagePointsDialog::OnEnKillfocus(UINT nID) 
{ 
	// TODO: Add your control notification handler code here 
 
	switch(nID) 
	{ 
	case IDC_JOKER_TUNNELA: 
		{ 
			int val1 = GetDlgItemInt(IDC_SIMPLE_TUNNELA); 
			int val2 = GetDlgItemInt(IDC_JOKER_TUNNELA); 
			if(val2 <= val1) 
			{ 
				AfxMessageBox("Points for Joker Tunnela should be greater than points for Simple Tunnela"); 
				CWnd *pWnd = GetDlgItem(IDC_JOKER_TUNNELA); 
				pWnd->SetFocus(); 
			} 
		} 
		break; 
	case IDC_JHIPLU_TUNNELA: 
		{ 
			int val1 = GetDlgItemInt(IDC_JOKER_TUNNELA); 
			int val2 = GetDlgItemInt(IDC_JHIPLU_TUNNELA); 
			if(val2 <= val1) 
			{ 
				AfxMessageBox("Points for Jhiplu Tunnela should be greater than points for Joker Tunnela"); 
				CWnd *pWnd = GetDlgItem(IDC_JHIPLU_TUNNELA); 
				pWnd->SetFocus(); 
			} 
		} 
		break; 
	case IDC_TIPLU_TUNNELA: 
		{ 
			int val1 = GetDlgItemInt(IDC_JOKER_TUNNELA); 
			int val2 = GetDlgItemInt(IDC_TIPLU_TUNNELA); 
			if(val2 <= val1) 
			{ 
				AfxMessageBox("Points for Tiplu Tunnela should be greater than points for Joker Tunnela"); 
				CWnd *pWnd = GetDlgItem(IDC_TIPLU_TUNNELA); 
				pWnd->SetFocus(); 
			} 
		} 
		break; 
	case IDC_POPLU_TUNNELA: 
		{ 
			int val1 = GetDlgItemInt(IDC_JOKER_TUNNELA); 
			int val2 = GetDlgItemInt(IDC_POPLU_TUNNELA); 
			if(val2 <= val1) 
			{ 
				AfxMessageBox("Points for Poplu Tunnela should be greater than points for Joker Tunnela"); 
				CWnd *pWnd = GetDlgItem(IDC_POPLU_TUNNELA); 
				pWnd->SetFocus(); 
			} 
		} 
		break; 
	case IDC_SIMPLE_TUNNELA: 
		{ 
			int val1 = GetDlgItemInt(IDC_SIMPLE_TUNNELA); 
			if(val1 <= 0) 
			{ 
				AfxMessageBox("Points for Simple Tunnela should be greater than zero"); 
				CWnd *pWnd = GetDlgItem(IDC_SIMPLE_TUNNELA); 
				pWnd->SetFocus(); 
			} 
		} 
		break; 
	case IDC_POINTSDUE_JOKERSEEN: 
		{ 
			int val1 = GetDlgItemInt(IDC_POINTSDUE_JOKERSEEN); 
			if(val1 <= 0) 
			{ 
				AfxMessageBox("Due points for Joker seen should be greater than zero"); 
				CWnd *pWnd = GetDlgItem(IDC_POINTSDUE_JOKERSEEN); 
				pWnd->SetFocus(); 
			} 
		} 
		break; 
	case IDC_POINTSDUE_JOKERNOTSEEN: 
		{ 
			int val1 = GetDlgItemInt(IDC_POINTSDUE_JOKERSEEN); 
			int val2 = GetDlgItemInt(IDC_POINTSDUE_JOKERNOTSEEN); 
			if(val2 <= val1) 
			{ 
				AfxMessageBox("Due points for Joker not seen should be greater than due points for Joker seen"); 
				CWnd *pWnd = GetDlgItem(IDC_POINTSDUE_JOKERNOTSEEN); 
				pWnd->SetFocus(); 
			} 
		} 
		break; 
	case IDC_SINGLE_MARRIAGE: 
		{ 
			int val1 = GetDlgItemInt(IDC_SINGLE_MARRIAGE); 
			if(val1 <= 0) 
			{ 
				AfxMessageBox("Points for Single Marriage should be greater than zero"); 
				CWnd *pWnd = GetDlgItem(IDC_SINGLE_MARRIAGE); 
				pWnd->SetFocus(); 
			} 
		} 
		break; 
	case IDC_DOUBLE_MARRIAGE: 
		{ 
			int val1 = GetDlgItemInt(IDC_SINGLE_MARRIAGE); 
			int val2 = GetDlgItemInt(IDC_DOUBLE_MARRIAGE); 
			if(val2 <= val1) 
			{ 
				AfxMessageBox("Points for Double Marriage should be greater than points for Single Marriage"); 
				CWnd *pWnd = GetDlgItem(IDC_DOUBLE_MARRIAGE); 
				pWnd->SetFocus(); 
			} 
		} 
		break; 
	case IDC_TRIPLE_MARRIAGE: 
		{ 
			int val1 = GetDlgItemInt(IDC_DOUBLE_MARRIAGE); 
			int val2 = GetDlgItemInt(IDC_TRIPLE_MARRIAGE); 
			if(val2 <= val1) 
			{ 
				AfxMessageBox("Points for Triple Marriage should be greater than points for Double Marriage"); 
				CWnd *pWnd = GetDlgItem(IDC_TRIPLE_MARRIAGE); 
				pWnd->SetFocus(); 
			} 
		} 
		break; 
	case IDC_SINGLE_JHIPLU: 
		{ 
			int val1 = GetDlgItemInt(IDC_SINGLE_JHIPLU); 
			if(val1 <= 0) 
			{ 
				AfxMessageBox("Points for Single Jhiplu should be greater than zero"); 
				CWnd *pWnd = GetDlgItem(IDC_SINGLE_JHIPLU); 
				pWnd->SetFocus(); 
			} 
		} 
		break; 
	case IDC_DOUBLE_JHIPLU: 
		{ 
			int val1 = GetDlgItemInt(IDC_SINGLE_JHIPLU); 
			int val2 = GetDlgItemInt(IDC_DOUBLE_JHIPLU); 
			if(val2 <= val1) 
			{ 
				AfxMessageBox("Points for Double Jhiplu should be greater than points for Single Jhiplu"); 
				CWnd *pWnd = GetDlgItem(IDC_DOUBLE_JHIPLU); 
				pWnd->SetFocus(); 
			} 
		} 
		break; 
	case IDC_TRIPLE_JHIPLU: 
		{ 
			int val1 = GetDlgItemInt(IDC_DOUBLE_JHIPLU); 
			int val2 = GetDlgItemInt(IDC_TRIPLE_JHIPLU); 
			if(val2 <= val1) 
			{ 
				AfxMessageBox("Points for Triple Jhiplu should be greater than points for Double Jhiplu"); 
				CWnd *pWnd = GetDlgItem(IDC_TRIPLE_JHIPLU); 
				pWnd->SetFocus(); 
			} 
		} 
		break; 
	case IDC_SINGLE_TIPLU: 
		{ 
			int val1 = GetDlgItemInt(IDC_SINGLE_TIPLU); 
			if(val1 <= 0) 
			{ 
				AfxMessageBox("Points for Single Tiplu should be greater than zero"); 
				CWnd *pWnd = GetDlgItem(IDC_SINGLE_TIPLU); 
				pWnd->SetFocus(); 
			} 
		} 
		break; 
	case IDC_DOUBLE_TIPLU: 
		{ 
			int val1 = GetDlgItemInt(IDC_SINGLE_TIPLU); 
			int val2 = GetDlgItemInt(IDC_DOUBLE_TIPLU); 
			if(val2 <= val1) 
			{ 
				AfxMessageBox("Points for Double Tiplu should be greater than points for Single Tiplu"); 
				CWnd *pWnd = GetDlgItem(IDC_DOUBLE_TIPLU); 
				pWnd->SetFocus(); 
			} 
		} 
		break; 
	case IDC_TRIPLE_TIPLU: 
		{ 
			int val1 = GetDlgItemInt(IDC_DOUBLE_TIPLU); 
			int val2 = GetDlgItemInt(IDC_TRIPLE_TIPLU); 
			if(val2 <= val1) 
			{ 
				AfxMessageBox("Points for Triple Tiplu should be greater than points for Double Tiplu"); 
				CWnd *pWnd = GetDlgItem(IDC_TRIPLE_TIPLU); 
				pWnd->SetFocus(); 
			} 
		} 
		break; 
	case IDC_SINGLE_POPLU: 
		{ 
			int val1 = GetDlgItemInt(IDC_SINGLE_POPLU); 
			if(val1 <= 0) 
			{ 
				AfxMessageBox("Points for Single Poplu should be greater than zero"); 
				CWnd *pWnd = GetDlgItem(IDC_SINGLE_POPLU); 
				pWnd->SetFocus(); 
			} 
		} 
	case  IDC_DOUBLE_POPLU: 
		{ 
			int val1 = GetDlgItemInt(IDC_SINGLE_POPLU); 
			int val2 = GetDlgItemInt(IDC_DOUBLE_POPLU); 
			if(val2 <= val1) 
			{ 
				AfxMessageBox("Points for Double Poplu should be greater than points for Single Poplu"); 
				CWnd *pWnd = GetDlgItem(IDC_DOUBLE_POPLU); 
				pWnd->SetFocus(); 
			} 
		} 
		break; 
	case IDC_TRIPLE_POPLU: 
		{ 
			int val1 = GetDlgItemInt(IDC_DOUBLE_POPLU); 
			int val2 = GetDlgItemInt(IDC_TRIPLE_POPLU); 
			if(val2 <= val1) 
			{ 
				AfxMessageBox("Points for Triple Poplu should be greater than points for Double Poplu"); 
				CWnd *pWnd = GetDlgItem(IDC_TRIPLE_POPLU); 
				pWnd->SetFocus(); 
			} 
		} 
		break; 
	} 
} 
 
void CMarriagePointsDialog::OnEnChange(UINT nID) 
{ 
	// TODO: Add your control notification handler code here 
 
	switch(nID) 
	{ 
	case IDC_JOKER_TUNNELA: 
		{ 
			int val = GetDlgItemInt(IDC_JOKER_TUNNELA); 
			SetDlgItemInt(IDC_JHIPLU_TUNNELA, val+1); 
			SetDlgItemInt(IDC_TIPLU_TUNNELA, val+1); 
			SetDlgItemInt(IDC_POPLU_TUNNELA, val+1); 
		} 
		break; 
	case IDC_SIMPLE_TUNNELA: 
		{ 
			int val = GetDlgItemInt(IDC_SIMPLE_TUNNELA); 
			SetDlgItemInt(IDC_JOKER_TUNNELA, val+1); 
		} 
		break; 
	case IDC_POINTSDUE_JOKERSEEN: 
		{ 
			int val = GetDlgItemInt(IDC_POINTSDUE_JOKERSEEN); 
			SetDlgItemInt(IDC_POINTSDUE_JOKERNOTSEEN, val+1); 
		} 
		break; 
	case IDC_SINGLE_MARRIAGE: 
		{ 
			int val = GetDlgItemInt(IDC_SINGLE_MARRIAGE); 
			SetDlgItemInt(IDC_DOUBLE_MARRIAGE, val+1); 
		} 
		break; 
	case IDC_DOUBLE_MARRIAGE: 
		{ 
			int val = GetDlgItemInt(IDC_DOUBLE_MARRIAGE); 
			SetDlgItemInt(IDC_TRIPLE_MARRIAGE, val+1); 
		} 
		break; 
	case IDC_SINGLE_JHIPLU: 
		{ 
			int val = GetDlgItemInt(IDC_SINGLE_JHIPLU); 
			SetDlgItemInt(IDC_DOUBLE_JHIPLU, val+1); 
		} 
		break; 
	case IDC_DOUBLE_JHIPLU: 
		{ 
			int val = GetDlgItemInt(IDC_DOUBLE_JHIPLU); 
			SetDlgItemInt(IDC_TRIPLE_JHIPLU, val+1); 
		} 
		break; 
	case IDC_SINGLE_TIPLU: 
		{ 
			int val = GetDlgItemInt(IDC_SINGLE_TIPLU); 
			SetDlgItemInt(IDC_DOUBLE_TIPLU, val+1); 
		} 
		break; 
	case IDC_DOUBLE_TIPLU: 
		{ 
			int val = GetDlgItemInt(IDC_DOUBLE_TIPLU); 
			SetDlgItemInt(IDC_TRIPLE_TIPLU, val+1); 
		} 
		break; 
	case IDC_SINGLE_POPLU: 
		{ 
			int val = GetDlgItemInt(IDC_SINGLE_POPLU); 
			SetDlgItemInt(IDC_DOUBLE_POPLU, val+1); 
		} 
	case  IDC_DOUBLE_POPLU: 
		{ 
			int val = GetDlgItemInt(IDC_DOUBLE_POPLU); 
			SetDlgItemInt(IDC_TRIPLE_POPLU, val+1); 
		} 
		break; 
	} 
}