#include "stdafx.h"
#include "Analyzer.h"
#include "MainPS.h"
#include "analyze3.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CAnalyzeApp

BEGIN_MESSAGE_MAP(CAnalyzeApp, CWinApp)
	//{{AFX_MSG_MAP(CAnalyzeApp)
		// NOTE - the ClassWizard will add and remove mapping macros here.
		//    DO NOT EDIT what you see in these blocks of generated code!
	//}}AFX_MSG
	ON_COMMAND(ID_HELP, CWinApp::OnHelp)
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CAnalyzeApp construction

CAnalyzeApp::CAnalyzeApp()
{
}

/////////////////////////////////////////////////////////////////////////////
// The one and only CAnalyzeApp object

CAnalyzeApp theApp;

/////////////////////////////////////////////////////////////////////////////
// CAnalyzeApp initialization

BOOL CAnalyzeApp::InitInstance()
{
   dbgEnable(TRUE);
   dbgClear();
	//Enable3dControls();   
   
   CPlayVideoDlg dlg;
   RECT r, rscr;

   // get the workspace area
   SystemParametersInfo(SPI_GETWORKAREA, 0, &rscr, 0);

   Analyzer *analyzer = new Analyzer();
   CMainPS *ps = new CMainPS("Analyzer Options");
   ps->Build(analyzer, &dlg);
   dlg.SetCameraIndex(CAMERA);
   dlg.SetFileName("c:\\cube.avi");
   dlg.SetLiveInput(FALSE);
   dlg.SetLiveVideoParams(160, 120, 15);
   dlg.Play();

   m_pMainWnd = &dlg;

   ps->Create(NULL, WS_SYSMENU | WS_POPUP | WS_CAPTION
         | DS_MODALFRAME | WS_VISIBLE | WS_MINIMIZEBOX,
         WS_EX_DLGMODALFRAME);
      
   ps->GetWindowRect(&r);
   OffsetRect(&r, rscr.right-r.right, rscr.bottom-r.bottom);
   ps->MoveWindow(&r);

   dlg.SetHandler(analyzer);
   dlg.Play();

   UseGuivlForResources();
   dlg.DoModal();

   DeleteClean(ps);
   DeleteClean(analyzer);

	return FALSE;
}
