// MainFrm.cpp : implementation of the CPA_PartGen_MainFrame class
////////////////////////////////////////////////////////

#include "StdAfx.h"

#include "x:\cpa\main\inc\_EditID.h"
#include "TUT.h"

#include "PGen_Res.h"

#include "TPGMainF.hpp"
#include "_Minterf.hpp"
#include "TPG_View.hpp"


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

HCURSOR g_hcursor_CloseHand;
HCURSOR g_hcursor_UpDownHand;

/////////////////////////////////////////////////////////////////////////////
// CPA_PartGen_MainFrame
BEGIN_MESSAGE_MAP(CPA_PartGen_MainFrame, CSplitFrame)
	//{{AFX_MSG_MAP(CPA_PartGen_MainFrame)
	ON_WM_HELPINFO()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CPA_PartGen_MainFrame construction/destruction

//*******************************************************************************
CPA_PartGen_MainFrame::CPA_PartGen_MainFrame()
{
	//Loads a special cursor
	g_hcursor_UpDownHand = AfxGetApp()->LoadCursor(IDC_CURSOR_UPDOWN_HAND);
	g_hcursor_CloseHand = AfxGetApp()->LoadCursor(IDC_CURSOR_CLOSED_HAND);
}

//*******************************************************************************
CPA_PartGen_MainFrame::~CPA_PartGen_MainFrame()
{

}


//*******************************************************************************
BOOL CPA_PartGen_MainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext) 
{
	if ( !(CreateSplitter(C_cVerticalSplitter, 2)) )
		return FALSE;
	
	HINSTANCE hOldInstance = AfxGetResourceHandle();

	//Creates Dialog List View
	CPA_DialogList *pclDialogList = new CPA_DialogList;
	g_pclInterface->m_clDocument.m_pub_p_clDialogList = pclDialogList;
	pclDialogList->fn_vInitDialog(g_pclInterface, this);
	SetPaneView(0, pclDialogList, "Particles Generator", g_pclInterface->m_clDocument.m_ulListViewHeight);

	//*** register DialogList for Tut
	TUT_M_vGetTutDll();

	TUT_M_vRegisterDialogList( pclDialogList, "TPG_ListOfGeneratorsSystemsOrEnvironments",
																						"TPG_NoTree",
																						"TPG_SelectGeneratorsSystemsOrEnvironmentsList",
																						"TPG_NoTest" );


	AfxSetResourceHandle(g_stPartGenDLLIdentity.hModule);
	
	//Creates Control view
	if	( !CreateView(1,
										RUNTIME_CLASS(TPG_View),
										"View",
										450)
			)
		return FALSE;

	TPG_View *p_clView = (TPG_View *)m_fn_p_oGetPane(1);

	p_clView->OnInitialUpdate();
	g_pclInterface->m_clDocument.m_pub_fn_vFillControlLists();
	g_pclInterface->m_clDocument.m_pub_fn_vBuildAllEnumDescriptors();
	AfxSetResourceHandle(hOldInstance);

	return TRUE;
}

//*******************************************************************************
BOOL CPA_PartGen_MainFrame::OnHelpInfo(HELPINFO* pHelpInfo) 
{
	::WinHelp(m_hWnd,
						LPCTSTR(g_pclInterface->m_clDocument.m_csHelpFileNameAndPath),
						HELP_FINDER,
						0);
	
	return FALSE;
}


//*******************************************************************************
//*******************************************************************************
/////////////////////////////////////////////////////////////////////////////
// CPA_PartGen_MainFrame diagnostics

#ifdef _DEBUG
void CPA_PartGen_MainFrame::AssertValid() const
{
	CFrameWnd::AssertValid();
}

void CPA_PartGen_MainFrame::Dump(CDumpContext& dc) const
{
	CFrameWnd::Dump(dc);
}

#endif //_DEBUG


