// ImageGrinderView.h : interface of the CImageGrinderView class
//
/////////////////////////////////////////////////////////////////////////////

#if !defined(AFX_IMAGEGRINDERVIEW_H__1B275CED_0C5E_11D3_A5F1_00902712C9AE__INCLUDED_)
#define AFX_IMAGEGRINDERVIEW_H__1B275CED_0C5E_11D3_A5F1_00902712C9AE__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "..\..\Libraries\ImageLib\Image.h"
#include "ImageGrinderDoc.h"
#include "ComposeInfo.h"
#include <afxmt.h>


class CImageGrinderView : public CView
{
protected: // create from serialization only
	CImageGrinderView();
	DECLARE_DYNCREATE(CImageGrinderView)
	CBrush GreenBrush;
	int ViewMode, ProcRunning;
//	CHFPreview *PreviewWin;
	CCriticalSection ProcLock;
	SYSTEM_INFO sysinfo;
	CComposeInfo *ProcInfo;
	bool FirstMove;
	Init();
	// Attributes
public:
	CImageGrinderDoc* GetDocument();

	CPoint OldPointView,OldPointSel,ViewOrg,OrgPoint;
	CPen PenSelected,SolidSel,GridPen,BoxPen,WirePen,WireHLPen;
	Compost::FeatureInstance *HanFet;
	int	ViewScale;
	DWORD HanFlag;
	bool Grid,Helpers,WireMode,DragFlag,CanCopy;
	int DragIn;
	int PixelSpace;
	CRect DragRect;
	Image CompleteImage;
	bool RenderLowRes;
	//	CBitMap ScreenBuf;
//	CBitmap *ImageBuf;
	// Operations
public:

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CImageGrinderView)
	public:
	virtual void OnDraw(CDC* pDC);  // overridden to draw this view
	virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
	virtual BOOL OnDrop(COleDataObject* pDataObject, DROPEFFECT dropEffect, CPoint point);
	virtual DROPEFFECT OnDragOver(COleDataObject* pDataObject, DWORD dwKeyState, CPoint point);
	virtual DROPEFFECT OnDragEnter(COleDataObject* pDataObject, DWORD dwKeyState, CPoint point);
	virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext = NULL);
	virtual void OnInitialUpdate();
	protected:
	virtual void OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint);
	virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
	//}}AFX_VIRTUAL

// Implementation
public:
	void DeletePens();
	void CreatePens();
	void ComposeList(CComposeInfo &);
	void UpdatePPoint();
	void DataToScreen(CPoint *pt);
	void DataToScreen(CRect *rct);
	void ScreenToData(CPoint *pt);
	void ScreenToData(CRect *rct);
	void ClearWindow();
	void CenterBitmap();
	void ComposeBackBuffer();
	void ForceSingleProc();
	void DetectProcs();
	int	ProcCount();
	void UpdateWindow();
	virtual ~CImageGrinderView();
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

protected:

// Generated message map functions
protected:
	//{{AFX_MSG(CImageGrinderView)
	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 BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt);
	afx_msg void OnSize(UINT nType, int cx, int cy);
	afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
	afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
	afx_msg void OnEditAddfeature();
	afx_msg void OnEditDeletefeature();
	afx_msg void OnViewDepthview();
	afx_msg void OnUpdateViewDepthview(CCmdUI* pCmdUI);
	afx_msg void OnTestTest1();
	afx_msg void OnTestXsnap1();
	afx_msg void OnTestXsnap2();
	afx_msg void OnTestXsnap8();
	afx_msg void OnTestXsnap16();
	afx_msg void OnTestXsnap4();
	afx_msg void OnUpdateTestXsnap1(CCmdUI* pCmdUI);
	afx_msg void OnUpdateTestXsnap16(CCmdUI* pCmdUI);
	afx_msg void OnUpdateTestXsnap2(CCmdUI* pCmdUI);
	afx_msg void OnUpdateTestXsnap4(CCmdUI* pCmdUI);
	afx_msg void OnUpdateTestXsnap8(CCmdUI* pCmdUI);
	afx_msg void OnViewGridoptions();
	afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
	afx_msg void OnEditMakeunique();
	afx_msg void OnViewGrid();
	afx_msg void OnUpdateViewGrid(CCmdUI* pCmdUI);
	afx_msg void OnViewHelpers();
	afx_msg void OnUpdateViewHelpers(CCmdUI* pCmdUI);
	afx_msg void OnViewWiremode();
	afx_msg void OnUpdateViewWiremode(CCmdUI* pCmdUI);
	afx_msg void OnViewColorproperties();
	afx_msg void OnEditLockselection();
	afx_msg void OnEditUnlockall();
	afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
	afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
	afx_msg void OnEditUngroupselection();
	afx_msg void OnEditGroupselection();
	afx_msg void OnViewZoomin();
	afx_msg void OnViewZoomout();
	afx_msg void OnEditGlobaltextures();
	afx_msg void OnEditLocaltextures();
	afx_msg void OnFileExportPartialoutput();
	afx_msg void OnFileExportMaptextureindex();
	afx_msg void OnFileExportAll();
	afx_msg void OnViewManualupdate();
	afx_msg void OnUpdateViewManualupdate(CCmdUI* pCmdUI);
	afx_msg void OnViewUpdate();
	afx_msg void OnTestRenderlowres();
	afx_msg void OnUpdateTestRenderlowres(CCmdUI* pCmdUI);
	afx_msg void OnOptionsForcesingleproc();
	afx_msg void OnUpdateOptionsForcesingleproc(CCmdUI* pCmdUI);
	afx_msg void OnEditUndo();
	afx_msg void OnUpdateEditUndo(CCmdUI* pCmdUI);
	afx_msg void OnEditRedo();
	afx_msg void OnUpdateEditRedo(CCmdUI* pCmdUI);
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

#ifndef _DEBUG  // debug version in ImageGrinderView.cpp
inline CImageGrinderDoc* CImageGrinderView::GetDocument()
   { return (CImageGrinderDoc*)m_pDocument; }
#endif

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

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

#endif // !defined(AFX_IMAGEGRINDERVIEW_H__1B275CED_0C5E_11D3_A5F1_00902712C9AE__INCLUDED_)
