/*********************************************************/
//	NkILSampleThumbInfoPage.cpp
//		Source file of PropertyPage class for Thumbnail Info.
//
//	Copyright(c) 2007, Nikon Corporation - All rights reserved.
/*********************************************************/

#include "stdafx.h"
#include "NkILSampleThumbInfoPage.h"

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

IMPLEMENT_DYNAMIC(CNkILSampleThumbInfoPage, CPropertyPage)

CNkILSampleThumbInfoPage::CNkILSampleThumbInfoPage(CWnd* pParent /*=NULL*/)
	: CPropertyPage(CNkILSampleThumbInfoPage::IDD)
{
	m_ulThumbCnt		= 0;
	for( int i = 0; i < MAX_THUMB_NUM; i++ )
	{
		m_strThumbSizeBit[i]	= "";
		m_strThumbColor[i]		= "";
		m_strThumbAngle[i]		= "";
	}	
}

CNkILSampleThumbInfoPage::~CNkILSampleThumbInfoPage()
{
}

void CNkILSampleThumbInfoPage::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	DDX_Text( pDX, IDC_STATIC_THUMBINFO_COUNT, m_ulThumbCnt );
	DDX_Text( pDX, IDC_STATIC_THUMBINFO_THUMB1SIZE, m_strThumbSizeBit[0] );
	DDX_Text( pDX, IDC_STATIC_THUMBINFO_THUMB1COLOR, m_strThumbColor[0] );
	DDX_Text( pDX, IDC_STATIC_THUMBINFO_THUMB1ANGLE, m_strThumbAngle[0] );
	DDX_Text( pDX, IDC_STATIC_THUMBINFO_THUMB2SIZE, m_strThumbSizeBit[1] );
	DDX_Text( pDX, IDC_STATIC_THUMBINFO_THUMB2COLOR, m_strThumbColor[1] );
	DDX_Text( pDX, IDC_STATIC_THUMBINFO_THUMB2ANGLE, m_strThumbAngle[1] );
	DDX_Text( pDX, IDC_STATIC_THUMBINFO_THUMB3SIZE, m_strThumbSizeBit[2] );
	DDX_Text( pDX, IDC_STATIC_THUMBINFO_THUMB3COLOR, m_strThumbColor[2] );
	DDX_Text( pDX, IDC_STATIC_THUMBINFO_THUMB3ANGLE, m_strThumbAngle[2] );
	DDX_Text( pDX, IDC_STATIC_THUMBINFO_THUMB4SIZE, m_strThumbSizeBit[3] );
	DDX_Text( pDX, IDC_STATIC_THUMBINFO_THUMB4COLOR, m_strThumbColor[3] );
	DDX_Text( pDX, IDC_STATIC_THUMBINFO_THUMB4ANGLE, m_strThumbAngle[3] );
}


BEGIN_MESSAGE_MAP(CNkILSampleThumbInfoPage, CPropertyPage)
END_MESSAGE_MAP()


//////////////////////////////////////////////////////////////////
// SetInfomation
void CNkILSampleThumbInfoPage::SetInfomation( VECTTHUMBINFO vecThumbInfo )
{
	// set total thumbnail Number
	m_ulThumbCnt = (unsigned long)vecThumbInfo.size();
	if( MAX_THUMB_NUM < m_ulThumbCnt )
	{
		return;
	}
	// set thumbnail info
	for( int i = 0; i < (int)m_ulThumbCnt; i++ )
	{
		// set size and bytedepth as strings
		m_strThumbSizeBit[i].Format( "%d x %d, %dbit", vecThumbInfo[i].ulWidth, vecThumbInfo[i].ulHeight, 
																vecThumbInfo[i].ulByteDepth * BITSPERBYTE );
		// set color info as strings
		switch( vecThumbInfo[i].ulColor )
		{			
		// not suported other color 
		case kNkfl_Color_RGB:
			m_strThumbColor[i].LoadString( IDS_COLOR_RGB );
			break;		
		}

		// set orientation as strings
		switch( vecThumbInfo[i].ulOrientation )
		{
		case kNkfl_Orientation_CW0:
			m_strThumbAngle[i].LoadString( IDS_ORIENTATION_CW0 );
			break;
		case kNkfl_Orientation_FlippedCW0:
			m_strThumbAngle[i].LoadString( IDS_ORIENTATION_FLIPPEDCW0 );
			break;
		case kNkfl_Orientation_CW180:
			m_strThumbAngle[i].LoadString( IDS_ORIENTATION_CW180 );
			break;
		case kNkfl_Orientation_FlippedCW180:
			m_strThumbAngle[i].LoadString( IDS_ORIENTATION_FLIPPEDCW180 );
			break;
		case kNkfl_Orientation_CW270:
			m_strThumbAngle[i].LoadString( IDS_ORIENTATION_CW270 );
			break;
		case kNkfl_Orientation_FlippedCW270:
			m_strThumbAngle[i].LoadString( IDS_ORIENTATION_FLIPPEDCW270 );
			break;
		case kNkfl_Orientation_FlippedCW90:
			m_strThumbAngle[i].LoadString( IDS_ORIENTATION_FLIPPEDCW90 );
			break;
		case kNkfl_Orientation_CW90:
			m_strThumbAngle[i].LoadString( IDS_ORIENTATION_CW90 );
			break;
		}		
	}	
}