// BCGPSkinsView.cpp : implementation of the CBCGPSkinsView class
//

#include "stdafx.h"
#include "BCGPSkins.h"

#include "BCGPSkinsDoc.h"
#include "BCGPSkinsView.h"

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

/////////////////////////////////////////////////////////////////////////////
// CBCGPSkinsView

IMPLEMENT_DYNCREATE(CBCGPSkinsView, CHtmlView)

BEGIN_MESSAGE_MAP(CBCGPSkinsView, CHtmlView)
	//{{AFX_MSG_MAP(CBCGPSkinsView)
		// NOTE - the ClassWizard will add and remove mapping macros here.
		//    DO NOT EDIT what you see in these blocks of generated code!
	//}}AFX_MSG_MAP
	// Standard printing commands
	ON_COMMAND(ID_FILE_PRINT, CHtmlView::OnFilePrint)
	ON_COMMAND(ID_FILE_PRINT_DIRECT, CHtmlView::OnFilePrint)
	ON_COMMAND(ID_FILE_PRINT_PREVIEW, OnFilePrintPreview)
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CBCGPSkinsView construction/destruction

CBCGPSkinsView::CBCGPSkinsView()
{
	// TODO: add construction code here

}

CBCGPSkinsView::~CBCGPSkinsView()
{
}

BOOL CBCGPSkinsView::PreCreateWindow(CREATESTRUCT& cs)
{
	// TODO: Modify the Window class or styles here by modifying
	//  the CREATESTRUCT cs

	return CHtmlView::PreCreateWindow(cs);
}

/////////////////////////////////////////////////////////////////////////////
// CBCGPSkinsView drawing

void CBCGPSkinsView::OnDraw(CDC* pDC)
{
	CBCGPSkinsDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	// TODO: add draw code for native data here
}

/////////////////////////////////////////////////////////////////////////////
// CBCGPSkinsView printing

void CBCGPSkinsView::OnFilePrintPreview() 
{
	BCGPPrintPreview (this);
}

BOOL CBCGPSkinsView::OnPreparePrinting(CPrintInfo* pInfo)
{
	// default preparation
	return DoPreparePrinting(pInfo);
}

void CBCGPSkinsView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
	// TODO: add extra initialization before printing
}

void CBCGPSkinsView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
	// TODO: add cleanup after printing
}

/////////////////////////////////////////////////////////////////////////////
// CBCGPSkinsView diagnostics

#ifdef _DEBUG
void CBCGPSkinsView::AssertValid() const
{
	CHtmlView::AssertValid();
}

void CBCGPSkinsView::Dump(CDumpContext& dc) const
{
	CHtmlView::Dump(dc);
}

CBCGPSkinsDoc* CBCGPSkinsView::GetDocument() // non-debug version is inline
{
	ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CBCGPSkinsDoc)));
	return (CBCGPSkinsDoc*)m_pDocument;
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CBCGPSkinsView message handlers


void CBCGPSkinsView::OnInitialUpdate() 
{
	CString strPath;

	TCHAR lpszFilePath [_MAX_PATH];
	if (::GetModuleFileName (NULL, lpszFilePath, _MAX_PATH) > 0)
	{
		TCHAR path_buffer[_MAX_PATH];
		TCHAR drive[_MAX_DRIVE];   
		TCHAR dir[_MAX_DIR];

		_tsplitpath (lpszFilePath, drive, dir, NULL, NULL);

		_tmakepath (path_buffer, drive, dir, _T("BCGPSkins"), _T("htm"));
		strPath = path_buffer;
	}

	Navigate2(strPath, NULL, NULL);
}
