#if !defined(AFX_OVERVIEWWINDOW_H__18B98A60_90F5_4B3E_8F53_03AD216845ED__INCLUDED_)
#define AFX_OVERVIEWWINDOW_H__18B98A60_90F5_4B3E_8F53_03AD216845ED__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// OverviewWindow.h : header file
//
#include"DrawInfo.h"

/////////////////////////////////////////////////////////////////////////////
// OverviewWindow frame
class ObjectManager;
class COverviewProperties;

class OverviewWindow : public CWnd
{
//	DECLARE_DYNCREATE(OverviewWindow)
protected:
// Attributes
public:
	OverviewWindow(ObjectManager *objman,CWnd *parent);           // protected constructor used by dynamic creation
	virtual ~OverviewWindow();

// Operations
public:
	COverviewProperties* m_COverviewProperties;
	enum ViewMode {VM_TEXTURE,VM_HFIELD,VM_SLOPEMAP};
	DrawInfo drawInfo;

	void SaveToReg();
	void LoadFromReg();

	bool SetCorrectSize(int cx,int cy);
	void DrawGrid(float xspace,float yspace,CDC *pDC);
	void DrawTileEntityCounts(CDC *pDC);
	void InitWindow();
	void SetObjectManager(ObjectManager *objman) {ObjMan=objman;}
	void SetViewMode(ViewMode vm);
	ViewMode GetViewMode() {return CurrentVMode;}

	// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(OverviewWindow)
	public:
	protected:
	virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
	//}}AFX_VIRTUAL

// Implementation

protected:
	void RefreshWindow(CDC *pDC=NULL);
//	void GetDrawRegion(CRect *rct);
	Point3D UserGridSize;
	enum TagFlagEnum {TF_NEVER,TF_ALWAYS,TF_ONSELECT}; 
	TagFlagEnum TagFlag;
	bool DisplayUserGrid;
	bool DisplayZoneGrid;
	bool DisplayTileGrid;
	DWORD ShowFlag;
	ViewMode CurrentVMode;
	ObjectManager *ObjMan;
	void DrawHelpers(CDC *pDC);
	CBitmap BackGround,BackBuffer;
	void BuildBackGround();
	void InitBackBuffer();
	void LoadTerraionTexture();
	CPoint BufferPoint;
	bool BreakBuffer;
	CPoint ZoomBufferPoint;
	bool ZoomBreakBuffer;
	bool AddedObject;
	CPoint OldPoint;
	CPen BoxPen,GridPen;
	CPen GreenPen,RedPen,YellowPen;
	CPen DarkGreenPen,DarkRedPen,DarkYellowPen;
	Point3D MoveCopyPoint;
	UnitQuaternion MoveCopyQuat;
	bool DidMoveCopy;
	int InitalSelectCount,InitalUnSelectCount;
	void DragCameraToPoint(const CPoint& point);
	HCURSOR OldCur,HandCur;

	Stuff::Point3D m_DistanceLineStartPos;
	Stuff::Point3D m_DistanceLineEndPos;
	CPoint m_LastMousePos;


	bool ShowTagsAlways;
	bool   GroupSelecting,ZoomBoxing;
	CPoint ZoomBoxAnchor,GroupSelAnchor,RotatePivot;
	CRect  GroupSelBox,ZoomBox;
	bool BackGroundReady;
//	CToolBar    m_wndToolBar;
//	CStatusBar  m_wndStatusBar;

	// Generated message map functions
	//{{AFX_MSG(OverviewWindow)
	afx_msg void OnPaint();
	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
	afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
	afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
	afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
	afx_msg void OnClose();
	afx_msg void OnSize(UINT nType, int cx, int cy);
	afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt);
	afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
	afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
	afx_msg void OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags);
	afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
	afx_msg void OnBackgroundHeightfield();
	afx_msg void OnBackgroundSlopemap();
	afx_msg void OnBackgroundTexture();
	afx_msg void OnEditCopy();
	afx_msg void OnEditCut();
	afx_msg void OnEditDelete();
	afx_msg void OnEditGroup();
	afx_msg void OnEditPaste();
	afx_msg void OnEditRedo();
	afx_msg void OnEditUndo();
	afx_msg void OnEditUngoup();
	afx_msg void OnUpdateBackgroundHeightfield(CCmdUI* pCmdUI);
	afx_msg void OnUpdateBackgroundSlopemap(CCmdUI* pCmdUI);
	afx_msg void OnUpdateBackgroundTexture(CCmdUI* pCmdUI);
	afx_msg void OnViewHelpersShowbounds();
	afx_msg void OnViewHelpersShowlattice();
	afx_msg void OnViewHelpersShowpaths();
	afx_msg void OnViewHelpersShowtilebounds();
	afx_msg void OnViewHelpersShowusergrid();
	afx_msg void OnViewHelpersShowzonebounds();
	afx_msg void OnUpdateViewHelpersShowbounds(CCmdUI* pCmdUI);
	afx_msg void OnUpdateViewHelpersShowlattice(CCmdUI* pCmdUI);
	afx_msg void OnUpdateViewHelpersShowpaths(CCmdUI* pCmdUI);
	afx_msg void OnUpdateViewHelpersShowtilebounds(CCmdUI* pCmdUI);
	afx_msg void OnUpdateViewHelpersShowusergrid(CCmdUI* pCmdUI);
	afx_msg void OnUpdateViewHelpersShowzonebounds(CCmdUI* pCmdUI);
	afx_msg void OnViewSetusergridproperties();
	afx_msg void OnViewSetpencolors();
	afx_msg void OnUpdateEditRedo(CCmdUI* pCmdUI);
	afx_msg void OnUpdateEditUndo(CCmdUI* pCmdUI);
	afx_msg void OnToolsCreatelattice();
	afx_msg void OnToolsRecalclatticelinks();
	afx_msg void OnToolsResetmissionbounds();
	afx_msg void OnOptionsSetdefaultalignment();
	afx_msg void OnViewTagsShowcustom();
	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
	afx_msg BOOL OnEraseBkgnd(CDC* pDC);
	afx_msg void OnToolsDispersewithbitmap();
	afx_msg void OnToolsSnapobjecttoterrain();
	afx_msg void OnRButtonDblClk(UINT nFlags, CPoint point);
	afx_msg void OnSysKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
	afx_msg void OnSysKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags);
	afx_msg void OnOptionsFilllattice();
	afx_msg void OnUpdateOptionsFilllattice(CCmdUI* pCmdUI);
	afx_msg void OnToolsDumpoverveiwcontentstofile();
	afx_msg void OnViewZoomin();
	afx_msg void OnViewZoomout();
	afx_msg void OnViewTagsShowtags();
	afx_msg void OnUpdateViewTagsShowtags(CCmdUI* pCmdUI);
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
	void OnMouseHover(UINT nFlags, CPoint point);

};

/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_OVERVIEWWINDOW_H__18B98A60_90F5_4B3E_8F53_03AD216845ED__INCLUDED_)
