#if !defined(AFX_DLGCREATEMEGATEXTURE_H__FC8D944C_8B3C_494C_B30B_E850797FF251__INCLUDED_)
#define AFX_DLGCREATEMEGATEXTURE_H__FC8D944C_8B3C_494C_B30B_E850797FF251__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// DlgCreateMegatexture.h : header file
//

/////////////////////////////////////////////////////////////////////////////
// CDlgCreateMegatexture dialog
#include <imagelib\image.h>
#include <stuff\stuff.hpp>

class CCell
{
	int AddVert(int,int);
	int GetXDim();
	int GetYDim();

	int V1,V2;	// Upper left and lower right index in vertex array
	bool bSplit;
public:
	CCell();
	~CCell();

	Image *m_image;
	CCell *m_arrChildren[4];
	CString name;

	int state;	// 0 == empty, 1 == partial, 2==full
	int CreateCell(int,int);
	CCell *FillCell(Image *);
	int SplitCell(int,int);
	int SetVerts(int,int);
	int GetV1();
	int GetV2();
	CPoint GetPoint1();
};

class CDlgCreateMegatexture : public CDialog
{
// Construction
public:
	CDlgCreateMegatexture(CWnd* pParent = NULL);   // standard constructor
	virtual ~CDlgCreateMegatexture();
	CPtrList *m_pList;
	Image *m_pImage;
	CCell *m_pCell;
	Stuff::NotationFile *m_pNoteFile;

// Dialog Data
	//{{AFX_DATA(CDlgCreateMegatexture)
	enum { IDD = IDD_CREATE_MEGATEXTURE };
	CEdit	m_wndName;
	CButton	m_wndMegaPreview;
	CListBox	m_wndList;
	//}}AFX_DATA


// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CDlgCreateMegatexture)
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
	//}}AFX_VIRTUAL

// Implementation
protected:
	CBitmap m_BackBuffer;
	int pagesize;

	// Generated message map functions
	//{{AFX_MSG(CDlgCreateMegatexture)
	virtual BOOL OnInitDialog();
	afx_msg void OnSelchangeList();
	afx_msg void OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct);
	virtual void OnOK();
	afx_msg void OnRadio1();
	afx_msg void OnRadio2();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

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

#endif // !defined(AFX_DLGCREATEMEGATEXTURE_H__FC8D944C_8B3C_494C_B30B_E850797FF251__INCLUDED_)
