// SettingsDlg.cpp : implementation file
//

#include "stdafx.h"
#include "dslavsplit.h"
#include "SettingsDlg.h"

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

/////////////////////////////////////////////////////////////////////////////
// CSettingsDlg
// 11/23-2 New class

IMPLEMENT_DYNAMIC(CSettingsDlg, CPropertySheet)

CSettingsDlg::CSettingsDlg(UINT nIDCaption, CWnd* pParentWnd, UINT iSelectPage)
	:CPropertySheet(nIDCaption, pParentWnd, iSelectPage)
{
	DoConstruct();
}

CSettingsDlg::CSettingsDlg(LPCTSTR pszCaption, CWnd* pParentWnd, UINT iSelectPage)
	:CPropertySheet(pszCaption, pParentWnd, iSelectPage)
{
	DoConstruct();
}

CSettingsDlg::~CSettingsDlg()
{
}


BEGIN_MESSAGE_MAP(CSettingsDlg, CPropertySheet)
	//{{AFX_MSG_MAP(CSettingsDlg)
		// NOTE - the ClassWizard will add and remove mapping macros here.
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

// Construct Prop Pages.
void CSettingsDlg::DoConstruct()
{
	TRACE(_T("In CSettingsDlg::DoConstruct\n"));

	// Add pages.
	AddPage(&m_ppGeneral);
	AddPage(&m_ppFolders);
	AddPage(&m_ppLav);

	// Set dlg title
	SetTitle(_T("Settings"), 0);
}

// Set prop page data.
void CSettingsDlg::SetSettingsData(SETTINGS settings)
{
	// Lav
	m_ppLav.m_bStereo = settings.m_bStereo;
	m_ppLav.m_bWMA2   = settings.m_bWMA2;
	m_ppLav.m_bWMAAll = settings.m_bWMAAll;
	m_ppLav.m_bWMAPro = settings.m_bWMAPro;
	// General.
	m_ppGeneral.m_listLf		= settings.m_listLf;
	m_ppGeneral.m_treeLf		= settings.m_treeLf;
	m_ppGeneral.m_iVolPercent	= settings.m_startVolPercent;
	m_ppGeneral.m_bStartVol		= settings.m_bUseLastVol;
	// Folders.
	m_ppFolders.m_strVideos		= settings.m_pathVideos;
	m_ppFolders.m_strContents	= settings.m_pathContents;
}
// Get prop page data.
BOOL CSettingsDlg::GetSettingsData(SETTINGS & settings)
{
	// Lav
	settings.m_bStereo = m_ppLav.m_bStereo;
	settings.m_bWMA2   = m_ppLav.m_bWMA2;
	settings.m_bWMAAll = m_ppLav.m_bWMAAll;
	settings.m_bWMAPro = m_ppLav.m_bWMAPro;
	// General.
	settings.m_listLf			= m_ppGeneral.m_listLf;
	settings.m_treeLf			= m_ppGeneral.m_treeLf;
	settings.m_startVolPercent	= m_ppGeneral.m_iVolPercent;
	settings.m_bUseLastVol		= m_ppGeneral.m_bStartVol;
	// Folders.
	settings.m_pathVideos		= m_ppFolders.m_strVideos;
	settings.m_pathContents		= m_ppFolders.m_strContents;

	return TRUE;
}

/////////////////////////////////////////////////////////////////////////////
// CSettingsDlg message handlers

BOOL CSettingsDlg::OnInitDialog() 
{
	TRACE(_T("In CSettingsDlg::OnInitDialog\n"));

	BOOL bResult = CPropertySheet::OnInitDialog();

	// This hides the Apply button - see Q141039
	CWnd * pApplyButton = GetDlgItem(ID_APPLY_NOW);
	if(pApplyButton)
		pApplyButton->ShowWindow(SW_HIDE);
	
	return bResult;
}
