// MainFrm.cpp : implementation of the CPA_Meca_MainFrame class
////////////////////////////////////////////////////////
#include "StdAfx.h"

#include "EMECFmMn.hpp"

#include "EMECVwMn.hpp"
#include "EMECVwMS.hpp"
#include "EMECCnst.hpp"
#include "_Minterf.hpp"

//External Modules
#include "IncTUT.h"
//End of External Modules

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

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

/////////////////////////////////////////////////////////////////////////////
// CPA_Meca_MainFrame construction/destruction

//*******************************************************************************
CPA_Meca_MainFrame::CPA_Meca_MainFrame()
{

}

//*******************************************************************************
CPA_Meca_MainFrame::~CPA_Meca_MainFrame()
{

}

//*******************************************************************************
/*UINT CPA_Meca_MainFrame::OnNcHitTest( CPoint point )
{
	UINT nResponse = CWnd::OnNcHitTest(point);
	
	if	(	( nResponse == HTBOTTOM )		//Re-size
		||	( nResponse == HTBOTTOMRIGHT )	//Re-size
		||	( nResponse == HTBOTTOMLEFT )	//Re-size
		||	( nResponse == HTTOP )			//Re-size
		||	( nResponse == HTTOPRIGHT )		//Re-size
		||	( nResponse == HTTOPLEFT )		//Re-size
		||	( nResponse == HTLEFT )			//Re-size
		||	( nResponse == HTRIGHT )		//Re-size
		||	( nResponse == HTCAPTION )		//Move
		||	( nResponse == HTZOOM )			//Max size
		||	( nResponse == HTSYSMENU )		//System Menu
		||	( nResponse == HTMENU )			//Menu
		)
	{
		return 0;
	}
	else
		return nResponse;
} */

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

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

	//////////////
	//////////////
	//Registers for TUT Module
	TUT_M_vGetTutDll();
	
	TUT_M_vRegisterDialogList(pclDialogList, "TMe_DialogList_List", 
													"TMe_DialogList_NoTree", "TMe_DialogList_ComboBox", "TMe_DialogList_TestButton");

	//End of Registers for TUT Module
	//////////////

	AfxSetResourceHandle(g_stMecaDLLIdentity.hModule);

	//Creates MS view
	if	(	!CreateView(2,
										RUNTIME_CLASS(CPA_Meca_MiniStrucView),
										"Edition",
										400) //The rest...
			)
		return FALSE;

	//Creates Control view
	if	( !CreateView(1,
										RUNTIME_CLASS(CPA_Meca_ControlView),
										"Types of Mechanics",
										g_pclInterface->m_clDocument.m_ulControlViewHeight)
			)
		return FALSE;

	//Manually calls OnInitialUpdate for all views !!!!!
	CPA_Meca_MiniStrucView *pclMSView = (CPA_Meca_MiniStrucView *)m_fn_p_oGetPane(2);
	pclMSView->OnInitialUpdate();
	
	CPA_Meca_ControlView *pclControlView = (CPA_Meca_ControlView *)m_fn_p_oGetPane(1);
	pclControlView->OnInitialUpdate();

	AfxSetResourceHandle(hOldInstance);

	return TRUE;
}

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


//*******************************************************************************
//*******************************************************************************
/////////////////////////////////////////////////////////////////////////////
// CPA_Meca_MainFrame diagnostics

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

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

#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CPA_Meca_MainFrame message handlers


