
/***************************************************************************

                                 ChessV

                   COPYRIGHT (C) 2005 BY GREGORY STRONG

This file is part of ChessV.  ChessV is free software; you can redistribute
it and/or modify it under the terms of the GNU General Public License as 
published by the Free Software Foundation; either version 2 of the License, 
or (at your option) any later version.

ChessV is distributed in the hope that it will be useful, but WITHOUT ANY 
WARRANTY; without even the implied warranty of MERCHANTABILITY or 
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for 
more details; the file 'COPYING' contains the License text, but if for
some reason you need a copy, please write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

****************************************************************************/


#include "StdAfx.h"
#include "../../ChessV.h"
#include "../../Resource.h"


// *** DEBUG MEMORY ALLOCATION *** //
#ifdef _DEBUG
#define new SAFE_NEW
#endif


static HWND hSubDialog;


LRESULT CALLBACK Shatranj_SelectDlgProc
	( HWND hWndDlg, 
	  UINT Msg, 
	  WPARAM wParam, 
	  LPARAM lParam )
{
	switch( Msg )
	{
	  case WM_INITDIALOG:
		{
			if( !strcmp( gameSelection, "Shatranj" ) )
				::SendDlgItemMessage( hWndDlg, IDC_SHATRANJ_RADIO, BM_SETCHECK, (WPARAM) BST_CHECKED, (LPARAM) 0 );
			else if( !strcmp( gameSelection, "Shatranj Kamil" ) )
				::SendDlgItemMessage( hWndDlg, IDC_SHATRANJ_KAMIL_RADIO, BM_SETCHECK, (WPARAM) BST_CHECKED, (LPARAM) 0 );
			else if( !strcmp( gameSelection, "Archchess" ) )
				::SendDlgItemMessage( hWndDlg, IDC_ARCHCHESS_RADIO, BM_SETCHECK, (WPARAM) BST_CHECKED, (LPARAM) 0 );
			else if( !strcmp( gameSelection, "Shatranj Kamil (64)" ) )
				::SendDlgItemMessage( hWndDlg, IDC_SHATRANJ_KAMIL_64_RADIO, BM_SETCHECK, (WPARAM) BST_CHECKED, (LPARAM) 0 );
			else if( !strcmp( gameSelection, "Modern Shatranj" ) )
				::SendDlgItemMessage( hWndDlg, IDC_MODERN_SHATRANJ_RADIO, BM_SETCHECK, (WPARAM) BST_CHECKED, (LPARAM) 0 );
			else if( !strcmp( gameSelection, "Great Shatranj" ) )
				::SendDlgItemMessage( hWndDlg, IDC_GREAT_SHATRANJ_RADIO, BM_SETCHECK, (WPARAM) BST_CHECKED, (LPARAM) 0 );
			else
				::SendDlgItemMessage( hWndDlg, IDC_SHATRANJ_RADIO, BM_SETCHECK, (WPARAM) BST_CHECKED, (LPARAM) 0 );
			
			return TRUE;
		}

	  case WM_COMMAND:
		switch(wParam)
		{
		  case IDOK:
			if( ::SendDlgItemMessage( hWndDlg, IDC_SHATRANJ_RADIO, BM_GETCHECK, 0, (LPARAM) 0 ) == BST_CHECKED )
				strcpy( gameSelection, "Shatranj" );
			else if( ::SendDlgItemMessage( hWndDlg, IDC_SHATRANJ_KAMIL_RADIO, BM_GETCHECK, 0, (LPARAM) 0 ) == BST_CHECKED )
				strcpy( gameSelection, "Shatranj Kamil" );
			else if( ::SendDlgItemMessage( hWndDlg, IDC_ARCHCHESS_RADIO, BM_GETCHECK, 0, (LPARAM) 0 ) == BST_CHECKED )
				strcpy( gameSelection, "Archchess" );
			else if( ::SendDlgItemMessage( hWndDlg, IDC_SHATRANJ_KAMIL_64_RADIO, BM_GETCHECK, 0, (LPARAM) 0 ) == BST_CHECKED )
				strcpy( gameSelection, "Shatranj Kamil (64)" );
			else if( ::SendDlgItemMessage( hWndDlg, IDC_MODERN_SHATRANJ_RADIO, BM_GETCHECK, 0, (LPARAM) 0 ) == BST_CHECKED )
				strcpy( gameSelection, "Modern Shatranj" );
			else if( ::SendDlgItemMessage( hWndDlg, IDC_GREAT_SHATRANJ_RADIO, BM_GETCHECK, 0, (LPARAM) 0 ) == BST_CHECKED )
				strcpy( gameSelection, "Great Shatranj" );
			::EndDialog( hWndDlg, IDOK );
			return TRUE;
		}
		break;
	}

	return FALSE;
}
