#if !defined(AFX_HEXEDIT_H__03D3D420_82D4_11D6_9D64_E13C41E7571A__INCLUDED_)
#define AFX_HEXEDIT_H__03D3D420_82D4_11D6_9D64_E13C41E7571A__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// hexedit.h : header file
//

/////////////////////////////////////////////////////////////////////////////
// hexedit dialog

struct Cell : public CEdit {
   int row;
   int col;
   int ofs;
   Cell(int r, int c, int o) : CEdit(), row(r), col(c), ofs(o) { }
};

class hexedit : public CDialog
{
   enum {
      H     = 20,
      W     = 35,
      nCol  = 16,
      nRow  = 16,
      nCell = nCol*nRow
   };

   BYTE     inputBuffer  [nCell];
   BYTE     displayBuffer[nCell];

   Cell    *hx[nCell];
   CStatic *rl[nRow];
   CStatic *cl[nCol];

   enum { on = 1, off = 0 };
   void timer(int);

   int  _tableSize;
   void fetch();
   void updateDisplay(bool force=false);

   WORD  _baseAddr;

   int   _base;
   char *Fmt(int);

   bool _ramEdit; // Ram or table editor?

public:
	hexedit(CWnd* pParent = NULL, bool ramEdit=true);   // standard constructor

// Dialog Data
	//{{AFX_DATA(hexedit)
      enum { IDD = IDD_HEXEDIT_DIALOG };
      CStatic	m_baseAddrLabel;
      CButton	m_units;
      CStatic	m_counter;
      CButton	m_realtime;
      CEdit    m_baseAddr;
	//}}AFX_DATA


// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(hexedit)
	public:
	virtual BOOL DestroyWindow();
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
	//}}AFX_VIRTUAL

// Implementation
protected:

	// Generated message map functions
	//{{AFX_MSG(hexedit)
	afx_msg void OnFetch();
	virtual BOOL OnInitDialog();
	afx_msg void OnDestroy();
	afx_msg void OnRealtime();
	afx_msg void OnTimer(UINT nIDEvent);
	afx_msg void OnBinary();
	afx_msg void OnDecimal();
	afx_msg void OnHexadecimal();
	afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
	afx_msg void OnBaseAddr();
   afx_msg void OnCell(UINT nId);
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_HEXEDIT_H__03D3D420_82D4_11D6_9D64_E13C41E7571A__INCLUDED_)

