/***************************************************************************
**
**    $Header:   D:/EP196/SRC/LOG/MAPDLG.H__   1.0   15 Aug 1997 14:01:06   ZJRD  $
**
**    $Log:   D:/EP196/SRC/LOG/MAPDLG.H__  $
** 
**    Rev 1.0   15 Aug 1997 14:01:06   ZJRD
** Initial revision.
** 
****************************************************************************/

#ifndef _MAPDLG_H_
#define _MAPDLG_H_

#include "mapbtn.h"
// mapdlg1.h : header file
//

/////////////////////////////////////////////////////////////////////////////
// CMapDlg dialog
class CMapColorBtn;

class CMapDlg : public CDialog
{
protected:
   CMapColorBtn btnIRW, btnIR, btnERW, btnER, btnGuard, btnCRW, btnCR;
   int   m_nArea;
   CRect m_ViewRect;
   BOOL  m_bCapture;
   //BOOL  m_bStart, m_bEnd;
   DWORD m_dwStartAddr, m_dwEndAddr, m_dwCurAddr;
   BOOL  m_bFirst;
   int   m_nSelectLast;
   int   m_nStartBlock, m_nEndBlock;
   int   m_nLastBlock, m_nCurBlock;
   int   m_nSplitBlock;
            
   struct tagBlock{
      CRect m_block;
      int   attribute;
   }m_block[512/*64*/];                 // 64K Byte
   DWORD m_dwxMin, m_dwxMax, m_dwpMin, m_dwpMax;
   int   m_nColorIndex;
      
// Construction
public:
   CMapDlg(CWnd* pParent = NULL);   // standard constructor

// Dialog Data
   //{{AFX_DATA(CMapDlg)
   enum { IDD = IDD_MAPDLG };
   CButton  m_ctrlUndo;
   CButton  m_ctrlMapEdit;
   CStatic  m_ctrlCurAddr;
   CStatic  m_ctrlMapView;
   CListBox m_ctrlListMap;
   CStatic  m_ctrlStartAddr;
   CStatic  m_ctrlEndAddr;
   int      m_nAreaSelect;
   //}}AFX_DATA

// Implementation
protected:
   void  InitBtn();
   void  BtnProcess(int nWhichBtn);
   void  DrawAreaMap(int nWhichArea);
   void  DrawInitMap(int nWhichArea);
   void  DrawMapView(CDC* pDC);
   void  InitMapView(DWORD startAddress, DWORD endAddrss, int attrib);
   void  DrawBlock(CDC *pDC, int nWhichBlock, CBrush* brush, CPen* pen);
   void  DrawBlockFrame(CDC *pDC, int nWhichBlock, CPen* pen);
   void  DrawBlockFrame(CDC *pDC, int nStartBlock, int nEndBlock, CPen* pen);
   void  DrawAllBlockFrame();
   BOOL  GetListSelect(int nSelectLast);
   void  DrawSelectMap(int nSelectLast, CDC* pDC);
   void  GetMap(int nWhichArea);
public:   
   BOOL CMapDlg::FindMapSave();
protected:
   virtual void DoDataExchange(CDataExchange* pDX);   // DDX/DDV support

   // Generated message map functions
   //{{AFX_MSG(CMapDlg)
   virtual BOOL OnInitDialog();
   afx_msg void OnMapRestore();
   afx_msg void OnMapSave();
   afx_msg void OnMapSet();
   afx_msg void OnBtnCr();
   afx_msg void OnBtnCrw();
   afx_msg void OnBtnEr();
   afx_msg void OnBtnErw();
   afx_msg void OnBtnG();
   afx_msg void OnBtnIr();
   afx_msg void OnBtnIrw();
   afx_msg void OnRdata();
   afx_msg void OnRprogram();
   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 OnMapEdit();
   afx_msg void OnSelchangeMapList();
   afx_msg void OnSetfocusMapList();
   afx_msg void OnKillfocusMapList();
   afx_msg void OnMapUndo();
	afx_msg void OnRbank1();
	afx_msg void OnRbank2();
	afx_msg void OnRbank3();
	afx_msg void OnRbank4();
	//}}AFX_MSG
   DECLARE_MESSAGE_MAP()
};

#endif
