/*********************************************************/
//	NkILSampleCameraInfoPage.cpp
//		Source file of PropertyPage class for Shooting Info.
//
//	Copyright(c) 2007, Nikon Corporation - All rights reserved.
/*********************************************************/
#include "stdafx.h"
#include "NkILSampleCameraInfoPage.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

IMPLEMENT_DYNAMIC(CNkILSampleCameraInfoPage, CPropertyPage)

const UINT g_TextIDTable[MAX_LINE_NUM] =
{
	IDC_STATIC_CAMERA_LINE1,
	IDC_STATIC_CAMERA_LINE2,
	IDC_STATIC_CAMERA_LINE3,
	IDC_STATIC_CAMERA_LINE4,
	IDC_STATIC_CAMERA_LINE5,
	IDC_STATIC_CAMERA_LINE6,
	IDC_STATIC_CAMERA_LINE7,
	IDC_STATIC_CAMERA_LINE8,
	IDC_STATIC_CAMERA_LINE9,
	IDC_STATIC_CAMERA_LINE10
};

CNkILSampleCameraInfoPage::CNkILSampleCameraInfoPage()
	: CPropertyPage(CNkILSampleCameraInfoPage::IDD)
{
	for( int i = 0; i < MAX_LINE_NUM; i++ )
	{
		m_strLine[i] = "";
	}	
	m_strNoData = "";
	m_bNoData	= false;
}

CNkILSampleCameraInfoPage::~CNkILSampleCameraInfoPage()
{
}

void CNkILSampleCameraInfoPage::DoDataExchange(CDataExchange* pDX)
{
	CPropertyPage::DoDataExchange(pDX);
	for( int i = 0; i < MAX_LINE_NUM; i++ )
	{
		DDX_Text( pDX, g_TextIDTable[i], m_strLine[i] );
	}
	DDX_Text( pDX, IDC_STATIC_NO_SHOOTINGDATA, m_strNoData );
}


BEGIN_MESSAGE_MAP(CNkILSampleCameraInfoPage, CPropertyPage)
END_MESSAGE_MAP()

BOOL CNkILSampleCameraInfoPage::OnInitDialog()
{
	CPropertyPage::OnInitDialog();

	// if no data, display message
	if( m_bNoData )
	{		
		m_strNoData.LoadString(IDS_ERROR_NOSHOOTINGDATA);		// if no info, show "not found"	
		// change Z-order to top
		GetDlgItem( IDC_STATIC_NO_SHOOTINGDATA )->SetWindowPos( &wndTopMost , 0, 0, 0, 0,  SWP_SHOWWINDOW | SWP_NOMOVE | SWP_NOSIZE );
	}
	else
	{
		// change Z-order to last
		GetDlgItem( IDC_STATIC_NO_SHOOTINGDATA )->SetWindowPos( &wndBottom, 0, 0, 0, 0, SWP_HIDEWINDOW | SWP_NOMOVE | SWP_NOSIZE );
	}
	UpdateData( false );

	return true;
}

//////////////////////////////////////////////////////////////////
// SetInfomation
void CNkILSampleCameraInfoPage::SetInfomation( VECTCAMERAINFO vecCameraInfo )
{
	// set camera info strings
	if( MAX_LINE_NUM < vecCameraInfo.size() )
	{
		return;
	}
	else if( 0 == vecCameraInfo.size() )
	{
		m_bNoData = true;
	}

	for( int i = 0; i < (int)vecCameraInfo.size(); i++ )
	{
		m_strLine[i] = vecCameraInfo[i];		
	}		
}
// SetInfomation
//////////////////////////////////////////////////////////////////
