
// memwnd.cpp : implementation file
//

#include "stdafx.h"
#include "tutorial.h"
#include "TrcWnd.h"
#include "memwnd.h"
#include "mainfrm.h"
#include "memdlg.h"

#ifdef _DEBUG
#undef THIS_FILE
static char BASED_CODE THIS_FILE[] = __FILE__;
#endif

extern void Delay(int nDelay,BOOL bShow=0);
extern BOOL g_bAuto;
extern BOOL g_mbCanDoNext;
/*-------------------------------------------------------*/
/*                  Memory dialog action                 */
/*-------------------------------------------------------*/
void CMainFrame::AdvanceMemDlg()
{
  switch(m_uNextAction){
        case 1:         
             m_pDlg = new CMemDlg();
             break;
        case 2:     
             ((CMemDlg *)m_pDlg)->Checksum();
             break;
        case 3:                       
             Mem_Dlg_Change(1);
             break;
        case 4:                       
             Mem_Dlg_Change(2);
             break;  
        case 5:
             Mem_Dlg_Change(3);
             break;  
        case 6:
             Mem_Dlg_Change(4);
             break;  
        case 7:
             Mem_Dlg_Change(5);
             m_uNextAction=100;
             break;  
        default:
             if(m_pDlg){   
             m_pDlg->SendMessage(WM_COMMAND,IDCANCEL);   
             delete m_pDlg;
             m_pDlg=0;}
             g_mbCanDoNext=1;
             OnExitAdvance();
             break;
      }     
}

/*-------------------------------------------------------*/
/*             Memory checksum action                    */
/*-------------------------------------------------------*/
void CMainFrame::Mem_Dlg_Change(int n)
{
 POINT  point[]={160,70, 260,70, 330, 70, 100,50, 160,70 };
 CPoint pointDes;
 CPoint pointSrc;
 GetCursorPos(&pointSrc);
 
 if(!m_pDlg)
    m_pDlg->ClientToScreen(&point[n-1]);
    
 pointDes=point[n-1];   
 MoveCursor(pointDes,pointSrc,0,55,8,0);
 
 if(m_pDlg)
    ((CMemDlg*)m_pDlg)->SetTab(n);
 switch(n){
   case 1:
        ((CMemDlg *)m_pDlg)->Compare();
        break;
   case 2:
       ((CMemDlg *)m_pDlg)->Copy();
       break;                 
   case 3:
       ((CMemDlg *)m_pDlg)->Fill();
       break;                 
   case 4:
       ((CMemDlg *)m_pDlg)->Search();
       break;                 
   case 5:
       ((CMemDlg *)m_pDlg)->Test();
       break;                 
       
   default:
       break;
  }     
 GetCursorPos(&pointDes);
 MoveCursor(pointSrc,pointDes,0,55,8,0);                                        
 
 SetMouse(1);
 SetSysFilter(0);
 
}