// CurveEditorFrame.cpp : implementation file
//

#include "stdafx.h"
#include "pixelwhippro.h"
#include "CurveEditorFrame.h"


/////////////////////////////////////////////////////////////////////////////
// CCurveEditorFrame

//IMPLEMENT_DYNCREATE(CCurveEditorFrame, CFrameWnd)

CCurveEditorFrame::CCurveEditorFrame(CWnd *parent)
{
	LoadFrame(IDR_CURVEEDITMENU,WS_OVERLAPPED|WS_THICKFRAME|WS_CAPTION|WS_MAXIMIZEBOX|WS_MINIMIZEBOX|WS_SYSMENU,parent);

}

CCurveEditorFrame::~CCurveEditorFrame()
{
}


BEGIN_MESSAGE_MAP(CCurveEditorFrame, CFrameWnd)
	//{{AFX_MSG_MAP(CCurveEditorFrame)
	ON_WM_CREATE()
	ON_WM_SETFOCUS()
	ON_WM_CLOSE()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CCurveEditorFrame message handlers

int CCurveEditorFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) 
{
	if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
		return -1;
	
	// create a view to occupy the client area of the frame
	if (!m_wndView.Create(NULL, NULL, AFX_WS_DEFAULT_VIEW,
		CRect(0, 0, 0, 0), this, AFX_IDW_PANE_FIRST, NULL))
	{
		TRACE0("Failed to create view window\n");
		return -1;
	}
	
	if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
		| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
		!m_wndToolBar.LoadToolBar(IDR_CURVEEDITMENU))
	{
		TRACE0("Failed to create toolbar\n");
		return -1;      // fail to create
	}
/*
	if (!m_wndStatusBar.Create(this) ||
		!m_wndStatusBar.SetIndicators(indicators,
		  sizeof(indicators)/sizeof(UINT)))
	{
		TRACE0("Failed to create status bar\n");
		return -1;      // fail to create
	}
*/
	// TODO: Delete these three lines if you don't want the toolbar to
	//  be dockable
	m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
	EnableDocking(CBRS_ALIGN_ANY);
	DockControlBar(&m_wndToolBar);

//	m_wndView.InitWindow();
	
	return 0;
}

void CCurveEditorFrame::OnSetFocus(CWnd* pOldWnd) 
{
	CFrameWnd::OnSetFocus(pOldWnd);
	m_wndView.SetFocus();
	
}

BOOL CCurveEditorFrame::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo) 
{
	if (m_wndView.OnCmdMsg(nID, nCode, pExtra, pHandlerInfo))
		return TRUE;
	
	return CFrameWnd::OnCmdMsg(nID, nCode, pExtra, pHandlerInfo);
}

void CCurveEditorFrame::OnClose() 
{
	ShowWindow(SW_HIDE);
}
