亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? vt102em.cpp

?? 使用BorlandC++4.5編譯的一個MUD客戶端程序
?? CPP
?? 第 1 頁 / 共 3 頁
字號:
head	2.3;access;symbols;locks; strict;comment	@// @;2.3date	95.10.31.02.26.20;	author tsurace;	state Release;branches;next	2.2;2.2date	95.10.30.18.28.46;	author tsurace;	state Exp;branches;next	2.1;2.1date	95.10.24.15.52.51;	author tsurace;	state Exp;branches;next	1.8;1.8date	95.10.19.00.58.27;	author tsurace;	state Beta;branches;next	1.7;1.7date	95.10.18.22.58.01;	author tsurace;	state Beta;branches;next	1.6;1.6date	95.10.15.23.33.25;	author tsurace;	state Exp;branches;next	1.5;1.5date	95.10.15.23.23.39;	author tsurace;	state Exp;branches;next	1.4;1.4date	95.10.11.21.40.43;	author tsurace;	state Exp;branches;next	1.3;1.3date	95.10.08.23.29.29;	author tsurace;	state Exp;branches;next	1.2;1.2date	95.10.07.00.33.48;	author tsurace;	state Exp;branches;next	1.1;1.1date	95.10.05.18.34.13;	author tsurace;	state Exp;branches;next	;desc@VT102Emulator methods.@2.3log@Fixed ret_val uninitialized in _SysMenuCommand.@text@// vt102em.cpp - vt102 emulator methods

// $Id: vt102em.cpp 2.2 1995/10/30 18:28:46 tsurace Exp tsurace $
// $Log: vt102em.cpp $
// Revision 2.2  1995/10/30  18:28:46  tsurace
// Added debug toggle and console mode switch to system menu.
//
// Revision 2.1  1995/10/24  15:52:51  tsurace
// Roll.
//
// Revision 1.8  1995/10/19  00:58:27  tsurace
// Changed title.
//
// Revision 1.7  1995/10/18  22:58:01  tsurace
// Made MY_SOCKET_LONG message globally accessible.
//
// Revision 1.6  1995/10/15  23:33:25  tsurace
// Added one line comment.
//
// Revision 1.5  1995/10/15  23:23:39  tsurace
// Fixed bug that caused all windows to resize on SIZE_MINIMIZE.
//
// Revision 1.4  1995/10/11  21:40:43  tsurace
// Modified the "select event" handling code.
// Modified resize functionality.
// Reflects changes to the scream_and_die function.
//
// Revision 1.3  1995/10/08  23:29:29  tsurace
// Modified code to update more quickly when scrolling.  It kind
// of sucks if you have a slow display card right now.
//
// Revision 1.2  1995/10/07  00:33:48  tsurace
// Added some cursor colors and the _Size function.  Scrolling
// optimization.
//
// (End of log)

// This is a simple VT102 emulator library for 32-bit
// programs only, but supportive of win32s.  This is intended to
// support the subset of vt102 required by VaporTalk, the best MUD
// client in the world.  It may also support ANSI color, someday.

#define  STRICT
#include <windows.h>
#pragma hdrstop

#include <stdlib.h>
#include <string.h>

#include "debug.hpp"
#include "esc_seq.hpp"
#include "global.hpp"
#include "keyev.hpp"
#include "vt102em.hpp"

extern "C" {
    // Functions from VT -- these define entry points into the
    // vt code to send keyboard events, check for remote input, and
    // so on.
    //
    // Be sure to check the type of these when updating
    // to a new version of VT!  I wanted to put these in a shared header
    // file, but it was getting to be a lot of trouble.  <frown>
    
    extern int io_check(long sec, long usec);  /* remote.c */
    extern int io_cycle();                     /* main.c */
    extern void process_incoming (char * str); /* keyboard input routine */
    extern void resize_screen(int new_rows, int new_cols);
    extern void curs_input();                  /* window.c */

    extern void console();                     /* console.c */
    extern int console_mode;                   /* console.c */
    extern int debug;                          /* vtc.c */
};

#define TEXT_FORE RGB(160,160,160)
#define TEXT_BACK RGB(0,0,0)
#define TEXT_BOLD RGB(40,255,100)
#define CURSOR_FORE RGB(255,255,255)
#define CURSOR_BACK RGB(128,0,128)
//
// >>>>> VT102Emulator class <<<<< //
//

char VT102Emulator::_szClassName[] = "VT102 Emulator Window";
static const char _TITLE[] = "VT-Win 1.1 $State: Exp $";

// ------------------------------------------------------------------------
// VT102Emulator constructor
// Do not create unless previously registered.
//
VT102Emulator::VT102Emulator(int nCmdShow)
: _screen(80,35,
          TEXT_FORE, // Normal foreground
          TEXT_BOLD,  // Bold foreground
          &VT102Emulator::InvalidateStaticCB,
          this,
          &VT102Emulator::ScrollAreaStaticCB,
          this),
  _font(0),
  _cursorColor(CURSOR_FORE),
  _cursorBackground(CURSOR_BACK),
  _cursorPen(0),
  _backgroundColor(TEXT_BACK),
  _fontSize(8,16),
  _lastPaintTickCount(0),
  _forceUpdateSoon(0),
  _initialized(0)
{
    // A Windows class should be registered with Windows before any windows
    // of that type are created.
    if (! Global::PrevInstance())      // Not already registered?
        _Register();              // Register!

    // Create a window, and Pass 'this' pointer in lpParam of CreateWindow()
    _hWnd = CreateWindow(_szClassName,
                         _TITLE,
                         WS_OVERLAPPEDWINDOW,
                         CW_USEDEFAULT,
                         0,
                         CW_USEDEFAULT,
                         0,
                         NULL,
                         NULL,
                         Global::Instance(),
                         (LPSTR) this );

    // Could not create window, might as well exit
    if (!_hWnd)
        scream_and_die(EC_FatalError, ERR_CreateWindow);

    // Load the monospace font, and initialize the "screen"
    _InitScreen();
    Show(nCmdShow);    // Show the window the correct/official way
    Update();
    _initialized = 1;  // Call after construction
};

VT102Emulator::~VT102Emulator()
{
    // _cursorPen is a stock object
    // _font is a stock object, maybe
}

// ------------------------------------------------------------------------
// ScrollAreaStaticCB - callback function, calls ScrollArea
//
int VT102Emulator::ScrollAreaStaticCB(int target,
                                      int source,
                                      int size,
                                      void * this_ptr)
{
    return ((VT102Emulator *)this_ptr)->ScrollArea(target, source, size);
}

// ------------------------------------------------------------------------
// ScrollArea - Scrolls the specified area of the screen
//
// Parameters:
//   top - first line to scroll (zero-indexed)
//   bottom - last line to scroll (also zero-indexed)
//   amount - amount to scroll, may be negative
//
// Returns:
//   nonzero if the row was successfully copied
//
int VT102Emulator::ScrollArea(int top, int bottom, int amount)
{
    ASSERT(bottom >= top, "No area to scroll");
    ASSERT(top >= 0, "Top is off screen");
    ASSERT(bottom < _screen.Height(), "Bottom is off screen");

    if (amount != 0)
    {
        RECT area;   
        area.top = top * _fontSize.Height();
        area.bottom = ((bottom + 1) * _fontSize.Height()) - 1;
        area.left = 0;
        area.right = (_screen.Width() * _fontSize.Width());

        ScrollWindow(Handle(),
                     0,         // No scroll of x
                     - (amount * _fontSize.Height()),  
                     NULL,      // Must be null so that exposed regions scroll
                     &area);     // Clip area

        _forceUpdateSoon = 1;
    };
    
    return 1;  // Successful scroll
}

// ------------------------------------------------------------------------
// _InvalidateStaticCB - invalidate rect - static callback calls builtin
void VT102Emulator::InvalidateStaticCB(const Pos & pos,
                                       const Size & size,
                                       void * this_ptr)
{
    ((VT102Emulator *)this_ptr)->Invalidate(pos, size);
}

void VT102Emulator::Invalidate(const Pos & pos, const Size & size)
{
    RECT area;
    area.left = pos.X() * _fontSize.Width();
    area.top = pos.Y() * _fontSize.Height();
    area.right = (pos.X() + size.Width()) * _fontSize.Width();
    area.bottom = (pos.Y() + size.Height()) * _fontSize.Height();
    
    // Don't clear, because it causes an annoying flicker, and the
    // textbackmode is opaque anyway
    InvalidateRect(Handle(), &area, TRUE);
}

// ------------------------------------------------------------------------
// NewSocket - tell windows about this new socket.
//
// Returns:
//   NULL on success or an error string on failure.
const char * VT102Emulator::NewSocket (SOCKET s, long events)
{
    // Select soctet messages
    if (SOCKET_ERROR == WSAAsyncSelect (s, Handle(), VT_SOCKET_MSG, events))
    {
        switch (WSAGetLastError())
        {
          case WSAENETDOWN: // Net is dead!
            return "The network is dead";

          case WSAEINPROGRESS:
            return "Blocking WinSock operation in progress";
            
          default:
            return "A horrible unknown WinSock error occurred";
        };
    };
    return NULL; // No problem
};


// ------------------------------------------------------------------------
void VT102Emulator::Output(char * str, int len)
{
    for (int i=0; i < len; i++)
    {
        _screen.Put(str[i]);   // Output the next character
        
        // Update screen at LEAST every quarter of a second, which is
        // generally accepted as the minimum acceptable delay.
        if (_forceUpdateSoon
            || ((GetTickCount() - _lastPaintTickCount) > 200))
        {
            Update();
        };
    };
}

// >>>>> PRIVATE and PROTECTED functions <<<<< //

// ------------------------------------------------------------------------
// This is the expose function, the critical heart of any graphic
// program!  :>
//
// Only call this in response to a WM_PAINT event!
//
void VT102Emulator::_Paint()
{
    _lastPaintTickCount = GetTickCount(); // Now
    _forceUpdateSoon = 0;                 // We are updating now.
    
    PAINTSTRUCT ps; // Begin paint, get info
    BeginPaint(Handle(), &ps);
    
    RECT clip_rect;
    GetClipBox(ps.hdc, &clip_rect);
    HRGN clip_reg = CreateRectRgnIndirect(&clip_rect);
    SelectClipRgn(ps.hdc, clip_reg);
    
    _PutText(ps.hdc, clip_reg);
    _PutCursor(ps.hdc);
    
    DeleteObject(clip_reg); // Don't need this region any more
    
    EndPaint(Handle(), &ps ); // Done, yay!
}

// ------------------------------------------------------------------------
// _PutTextOneLine - puts just this line of text on the screen
//
void VT102Emulator::_PutTextOneLine(HDC hdc, int row)
{
    ASSERT(_screen.Width() > 0, "Assuming the screen has width");
    
    // TextOut is very slow...count characters that are all the
    // same color and put them all at once.
    
    int y_pixel_location = row * _fontSize.Height();
    int x_text_location = 0;
    int start = _screen.IndexOf(0,row); // Start of string to put
    int row_end_marker = start + _screen.Width();
    int width = 0; // Width of current segment
    COLORREF thisColor = _screen.ForegroundElement(start);
    while(1)   // Loop forever
    {
        ++width;
        int end = start + width; // End of string
        if ((end >= row_end_marker)
            || (_screen.ForegroundElement(end) != thisColor))
        {
            // New color, flush text.
            SetTextColor(hdc, thisColor);
            TextOut(hdc,
                    x_text_location * _fontSize.Width(),
                    y_pixel_location,
                    &_screen.TextElement(start),
                    width);
            
            if (end >= row_end_marker) // Done with this line
                break;
            
            start += width; // Increment array offset
            x_text_location += width; // Increment column offset
            width = 0;        
            thisColor = _screen.ForegroundElement(end); // Save new color
        };
    };
}

// ------------------------------------------------------------------------
// _PutText - _Paint helper function that updates all modified text areas
//
// Parameters:
//   hdc - dc to paint to
//   clip_reg - current exposed region
//
void VT102Emulator::_PutText(HDC hdc, HRGN clip_reg)
{
    RECT exposeRect;
    GetRgnBox(clip_reg, &exposeRect); // What area of the screen to paint?
    
    int firstRow = (exposeRect.top+1) / _fontSize.Height();
    if (firstRow < 0) // Off top of screen?
        firstRow = 0;              
    else if (firstRow >= _screen.Height()) // Or bottom?
        firstRow = _screen.Height();
    
    int lastRow = (exposeRect.bottom) / _fontSize.Height();
    if (lastRow < 0) // Off top of screen
        lastRow = 0;
    else if (lastRow >= _screen.Height()) // Off bottom of screen?
        lastRow = _screen.Height() - 1; 
    
    HFONT oldFont = (HFONT)SelectObject(hdc, _font);
    COLORREF oldColor = SetBkColor(hdc, _backgroundColor);
    int oldBkMode = (int)SetBkMode(hdc, TRANSPARENT); // Don't do background
    
    // Draw all text that is exposed.  Start at the bottom of the screen,
    // because this is the lastest text
    

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
樱桃国产成人精品视频| 91激情在线视频| 欧美一区二区二区| 日韩av一区二| 精品久久一二三区| 国产在线精品一区二区不卡了| 欧美成人欧美edvon| 国产一区二区三区黄视频| 欧美经典三级视频一区二区三区| 国产麻豆一精品一av一免费| 国产性天天综合网| 91免费视频观看| 午夜影视日本亚洲欧洲精品| 欧美一级日韩不卡播放免费| 精品亚洲aⅴ乱码一区二区三区| 欧美精品一区二区高清在线观看| 国产一区二区不卡| 国产精品国产三级国产aⅴ原创| 在线观看成人小视频| 香蕉久久夜色精品国产使用方法| 日韩精品一区二区三区视频在线观看 | 26uuu另类欧美亚洲曰本| 国产成人免费av在线| 亚洲免费电影在线| 欧美一区二区三区人| 国产精品一区二区在线观看不卡 | 亚洲精品视频一区二区| 日韩午夜精品电影| 99精品国产热久久91蜜凸| 日本不卡视频一二三区| 亚洲欧洲美洲综合色网| 91精品久久久久久久99蜜桃 | 日韩区在线观看| 成人综合在线视频| 亚洲成人精品影院| 国产精品美女久久久久高潮| 7799精品视频| 91玉足脚交白嫩脚丫在线播放| 免费成人在线影院| 一区二区三区电影在线播| 久久综合精品国产一区二区三区| 欧美中文字幕不卡| 国产成人免费在线视频| 天堂蜜桃91精品| 亚洲欧美二区三区| 国产欧美日韩不卡| 精品国产乱码久久久久久牛牛| 在线观看一区二区精品视频| 风间由美性色一区二区三区| 日本网站在线观看一区二区三区 | 成人综合婷婷国产精品久久免费| 国产在线精品一区二区夜色 | 精品视频一区二区不卡| 精品一区二区三区欧美| 亚洲在线观看免费| 国产精品久线在线观看| 日韩免费一区二区三区在线播放| 91亚洲精华国产精华精华液| 国产精品99久久久久久有的能看| 视频一区二区不卡| 亚洲综合激情小说| 亚洲色图自拍偷拍美腿丝袜制服诱惑麻豆| 日韩免费福利电影在线观看| 91麻豆精品国产91久久久资源速度 | 日韩精品视频网站| 亚洲地区一二三色| 久久久精品影视| 成人教育av在线| 国产伦精品一区二区三区免费| 久久久久久久综合| 日韩西西人体444www| 欧美日韩免费观看一区三区| 色久优优欧美色久优优| 91一区二区三区在线播放| 国产69精品久久99不卡| 国产精品123| 国产**成人网毛片九色 | 久久人人爽人人爽| 精品国内片67194| 日韩欧美一级在线播放| 日韩一二三区不卡| 日韩欧美一区二区久久婷婷| 欧美哺乳videos| 精品日韩av一区二区| 精品国产乱码久久久久久夜甘婷婷| 日韩一区二区在线观看视频播放| 欧美一区二区三区爱爱| 26uuu欧美| 国产精品麻豆一区二区| 18成人在线观看| 亚洲在线中文字幕| 日本中文一区二区三区| 极品美女销魂一区二区三区免费| 国产一区二区伦理片| 成人综合在线观看| 欧美在线一二三| 91精品免费观看| 国产亚洲精品中文字幕| 亚洲手机成人高清视频| 亚洲国产精品一区二区尤物区| 亚洲成人av福利| 精品一区二区三区日韩| 成人av网站大全| 欧美日本精品一区二区三区| 欧美成人乱码一区二区三区| 久久精品免视看| 亚洲综合色视频| 韩国av一区二区三区在线观看 | 99久久精品免费看| 欧美午夜一区二区| 久久综合九色综合97_久久久| 国产精品卡一卡二| 日韩激情视频在线观看| 国产成人在线看| 在线观看av一区二区| 理论片日本一区| 成人夜色视频网站在线观看| 欧美视频一区二区三区四区| 5月丁香婷婷综合| 精品理论电影在线观看 | 精油按摩中文字幕久久| 亚洲精品你懂的| 99re热这里只有精品免费视频| 99re免费视频精品全部| 欧美唯美清纯偷拍| 日韩亚洲欧美高清| 日韩美女视频19| 五月激情六月综合| 欧美一区二区高清| 色婷婷久久久久swag精品| 成人免费在线视频| 国产精品久久久一区麻豆最新章节| 最新中文字幕一区二区三区 | 蜜桃精品视频在线| av午夜一区麻豆| 久久色中文字幕| 亚洲444eee在线观看| gogo大胆日本视频一区| 日韩一区二区电影在线| 日韩欧美aaaaaa| 久久99久久99| 日韩女同互慰一区二区| 激情综合五月天| 国产美女精品人人做人人爽| 欧美无砖专区一中文字| 亚洲欧美在线视频观看| 国内精品视频666| 欧美一级免费大片| 亚洲高清一区二区三区| 91网站最新网址| 国产精品久久一卡二卡| 国产乱人伦精品一区二区在线观看| 日韩一区二区视频| 亚洲第一久久影院| 欧美日韩精品一区二区在线播放| 亚洲女同女同女同女同女同69| 国产91高潮流白浆在线麻豆| 日韩欧美中文字幕制服| 麻豆国产精品官网| 日韩欧美亚洲一区二区| 美女视频黄久久| 欧美成人综合网站| av一本久道久久综合久久鬼色| 久久久久国产精品人| 国产精品系列在线播放| 国产三区在线成人av| 国产精品一二三区| 国产精品乱码妇女bbbb| 成人av网站在线| 亚洲美女淫视频| 欧美吻胸吃奶大尺度电影| 午夜免费久久看| 日韩午夜在线观看视频| 狠狠色伊人亚洲综合成人| 337p日本欧洲亚洲大胆精品| 国产九色sp调教91| 国产精品国产自产拍在线| 91在线无精精品入口| 一区二区三区中文字幕精品精品| 欧美在线999| 日本不卡一二三| 久久午夜色播影院免费高清| 国产成人亚洲综合色影视| 国产精品理伦片| 欧美三级视频在线观看| 日本系列欧美系列| 国产网站一区二区三区| 91在线观看免费视频| 午夜精品久久久久影视| 精品动漫一区二区三区在线观看| 国产夫妻精品视频| 亚洲乱码国产乱码精品精小说| 欧美日韩一二三| 久久精品999| 中文字幕佐山爱一区二区免费| 在线视频欧美区| 国产一区在线看| 一区二区国产盗摄色噜噜| 日韩三级视频在线观看| 岛国精品在线播放|