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

#include "stdafx.h"
#include "NkILSampleImgInfoPage.h"

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

#define BITSPERBYTE	8
IMPLEMENT_DYNAMIC(CNkILSampleImgInfoPage, CPropertyPage)

CNkILSampleImgInfoPage::CNkILSampleImgInfoPage(CWnd* pParent /*=NULL*/)
	: CPropertyPage(CNkILSampleImgInfoPage::IDD)
{
	m_strFormat			= "";
	m_strSize			= "";
	m_strByte			= "";
	m_strColor			= "";
	m_strOrientation	= "";
	m_strOrgSize		= "";
	m_strOrgByte		= "";
	m_strOrgColor		= "";
	m_strOrgOrientation	= "";
}

CNkILSampleImgInfoPage::~CNkILSampleImgInfoPage()
{
}

void CNkILSampleImgInfoPage::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	DDX_Text( pDX, IDC_STATIC_FILEINFO_FORMAT, m_strFormat );
	DDX_Text( pDX, IDC_STATIC_IMGINFO_SIZE, m_strSize );
	DDX_Text( pDX, IDC_STATIC_IMGINFO_BYTE, m_strByte );
	DDX_Text( pDX, IDC_STATIC_IMGINFO_COLOR, m_strColor );
	DDX_Text( pDX, IDC_STATIC_IMGINFO_ANGLE, m_strOrientation );
	DDX_Text( pDX, IDC_STATIC_IMGINFO_ORGSIZE, m_strOrgSize );
	DDX_Text( pDX, IDC_STATIC_IMGINFO_ORGBYTE, m_strOrgByte );
	DDX_Text( pDX, IDC_STATIC_IMGINFO_ORGCOLOR, m_strOrgColor );
	DDX_Text( pDX, IDC_STATIC_IMGINFO_ORGANGLE, m_strOrgOrientation );
}


BEGIN_MESSAGE_MAP(CNkILSampleImgInfoPage, CPropertyPage)
END_MESSAGE_MAP()


//////////////////////////////////////////////////////////////////
// SetInfomation
void CNkILSampleImgInfoPage::SetInfomation(unsigned long ulFormat, NkIL_ImageInfo StrImageInfo, NkIL_ImageInfo StrOrgImageInfo)
{
	// set file format
	switch( ulFormat )
	{
	case kNkfl_Format_None:
		m_strFormat.LoadString(IDS_FORMAT_NONE);
		break;
	case kNkfl_Format_JPEG:
		m_strFormat.LoadString(IDS_FORMAT_JPEG);
		break;
	case kNkfl_Format_TIFF:
		m_strFormat.LoadString(IDS_FORMAT_TIFF);
		break;
	case kNkfl_Format_NEF:
		m_strFormat.LoadString(IDS_FORMAT_NEF);
		break;	
	}
	
	m_strSize.Format( "%d x %d", StrImageInfo.ulWidth, StrImageInfo.ulHeight ); // set image size
	m_strByte.Format( "%d bit", StrImageInfo.ulByteDepth * BITSPERBYTE );		// set bytedepth

	// set color info
	switch( StrImageInfo.ulColor )
	{
	case kNkfl_Color_Gray:
		m_strColor.LoadString( IDS_COLOR_GRAY );
		break;
	case kNkfl_Color_RGB_Gray:
		m_strColor.LoadString( IDS_COLOR_RGB_GRAY );
		break;
	case kNkfl_Color_CMYK_Gray:
		m_strColor.LoadString( IDS_COLOR_CMYK_GRAY );
		break;
	case kNkfl_Color_RGB:
		m_strColor.LoadString( IDS_COLOR_RGB );
		break;
	case kNkfl_Color_CMYK:
		m_strColor.LoadString( IDS_COLOR_CMYK );
		break;
	}
	
	// set orientation
	switch( StrImageInfo.ulOrientation )
	{
	case kNkfl_Orientation_CW0:
		m_strOrientation.LoadString( IDS_ORIENTATION_CW0 );
		break;
	case kNkfl_Orientation_FlippedCW0:
		m_strOrientation.LoadString( IDS_ORIENTATION_FLIPPEDCW0 );
		break;
	case kNkfl_Orientation_CW180:
		m_strOrientation.LoadString( IDS_ORIENTATION_CW180 );
		break;
	case kNkfl_Orientation_FlippedCW180:
		m_strOrientation.LoadString( IDS_ORIENTATION_FLIPPEDCW180 );
		break;
	case kNkfl_Orientation_CW270:
		m_strOrientation.LoadString( IDS_ORIENTATION_CW270 );
		break;
	case kNkfl_Orientation_FlippedCW270:
		m_strOrientation.LoadString( IDS_ORIENTATION_FLIPPEDCW270 );
		break;
	case kNkfl_Orientation_FlippedCW90:
		m_strOrientation.LoadString( IDS_ORIENTATION_FLIPPEDCW90 );
		break;
	case kNkfl_Orientation_CW90:
		m_strOrientation.LoadString( IDS_ORIENTATION_CW90 );
		break;
	}		
	
	m_strOrgSize.Format( "%d x %d", StrOrgImageInfo.ulWidth, StrOrgImageInfo.ulHeight );	// set original image size
	m_strOrgByte.Format( "%d bit", StrOrgImageInfo.ulByteDepth * BITSPERBYTE );				// set original bytedepth

	// set original color info
	switch( StrOrgImageInfo.ulColor )
	{
	case kNkfl_Color_Gray:
		m_strOrgColor.LoadString( IDS_COLOR_GRAY );
		break;
	case kNkfl_Color_RGB_Gray:
		m_strOrgColor.LoadString( IDS_COLOR_RGB_GRAY );
		break;
	case kNkfl_Color_CMYK_Gray:
		m_strOrgColor.LoadString( IDS_COLOR_CMYK_GRAY );
		break;
	case kNkfl_Color_RGB:
		m_strOrgColor.LoadString( IDS_COLOR_RGB );
		break;
	case kNkfl_Color_CMYK:
		m_strOrgColor.LoadString( IDS_COLOR_CMYK );
		break;
	}

	// set orientation
	switch( StrOrgImageInfo.ulOrientation )
	{
	case kNkfl_Orientation_CW0:
		m_strOrgOrientation.LoadString( IDS_ORIENTATION_CW0 );
		break;
	case kNkfl_Orientation_FlippedCW0:
		m_strOrgOrientation.LoadString( IDS_ORIENTATION_FLIPPEDCW0 );
		break;
	case kNkfl_Orientation_CW180:
		m_strOrgOrientation.LoadString( IDS_ORIENTATION_CW180 );
		break;
	case kNkfl_Orientation_FlippedCW180:
		m_strOrgOrientation.LoadString( IDS_ORIENTATION_FLIPPEDCW180 );
		break;
	case kNkfl_Orientation_CW270:
		m_strOrgOrientation.LoadString( IDS_ORIENTATION_CW270 );
		break;
	case kNkfl_Orientation_FlippedCW270:
		m_strOrgOrientation.LoadString( IDS_ORIENTATION_FLIPPEDCW270 );
		break;
	case kNkfl_Orientation_FlippedCW90:
		m_strOrgOrientation.LoadString( IDS_ORIENTATION_FLIPPEDCW90 );
		break;
	case kNkfl_Orientation_CW90:
		m_strOrgOrientation.LoadString( IDS_ORIENTATION_CW90 );
		break;
	}		
}
// SetInfomation
//////////////////////////////////////////////////////////////////
