// watcherDoc.cpp : implementation of the CWatcherDoc class // #include "stdafx.h" #include "watcher.h" #include "watcherDoc.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CWatcherDoc IMPLEMENT_DYNCREATE(CWatcherDoc, CDocument) BEGIN_MESSAGE_MAP(CWatcherDoc, CDocument) //{{AFX_MSG_MAP(CWatcherDoc) // NOTE - the ClassWizard will add and remove mapping macros here. // DO NOT EDIT what you see in these blocks of generated code! //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CWatcherDoc construction/destruction CWatcherDoc::CWatcherDoc() { // TODO: add one-time construction code here COLORREF white = WHITE; COLORREF black = BLACK; int i,j,size; size = MAX_TERMINAL_WIDTH*MAX_TERMINAL_HEIGHT; INT_PTR nRet; nRet = Params.DoModal(); if(nRet != IDOK){ // kill document Params.DeleteValue = TRUE; return; } // TODO: add one-time construction code here memset(Data,0,MAX_TERMINAL_WIDTH*MAX_TERMINAL_HEIGHT*sizeof(TCHAR)); for(i=0;i= MAX_TERMINAL_WIDTH){ return; } if (y>= MAX_TERMINAL_HEIGHT){ return; } Data[x+y*MAX_TERMINAL_WIDTH] = byte; Foreground[x+y*MAX_TERMINAL_WIDTH] = foreground; Background[x+y*MAX_TERMINAL_WIDTH] = background; return; } void CWatcherDoc::SetData(int x, int y, BYTE byte, int n, COLORREF foreground, COLORREF background) { int i,j; i=MAX_TERMINAL_WIDTH*y + x; if (i+n > MAX_TERMINAL_WIDTH*MAX_TERMINAL_HEIGHT) { return; } memset(&(Data[i]),byte, n*sizeof(TCHAR)); for(j=0;j MAX_TERMINAL_HEIGHT) || (ScrollTop > ScrollBottom)) { // error return; } int number = MAX_TERMINAL_WIDTH*(ScrollBottom - ScrollTop); int index1 = (ScrollTop-1)*MAX_TERMINAL_WIDTH; int index2 = index1 + MAX_TERMINAL_WIDTH; if (ScrollTop < ScrollBottom) { memmove(&(Data[index1]),&(Data[index2]), number*sizeof(TCHAR)); memmove(&(Foreground[index1]),&(Foreground[index2]), number*sizeof(TCHAR)); memmove(&(Background[index1]),&(Background[index2]), number*sizeof(TCHAR)); } // number -= MAX_TERMINAL_WIDTH; index1 = MAX_TERMINAL_WIDTH*(ScrollBottom - 1); memset(&(Data[index1]), byte, MAX_TERMINAL_WIDTH*sizeof(TCHAR)); for(int j=0;j