亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
日产国产高清一区二区三区 | 中文子幕无线码一区tr| 成人一二三区视频| 日韩午夜激情免费电影| 91福利国产精品| 欧美成va人片在线观看| 亚洲人成亚洲人成在线观看图片| 免费看欧美美女黄的网站| 91亚洲国产成人精品一区二三| 日韩午夜小视频| 亚洲丰满少妇videoshd| av一区二区三区四区| 日韩欧美国产麻豆| 五月激情综合婷婷| 色屁屁一区二区| 国产精品成人免费精品自在线观看| 美国三级日本三级久久99| 欧美三级一区二区| 国产精品久99| 国产91露脸合集magnet| 欧美大片一区二区| 蜜桃视频第一区免费观看| 精品视频一区二区三区免费| 国产精品久久看| 成人99免费视频| 国产精品区一区二区三| 国产激情一区二区三区四区| 久久综合久久综合久久| 奇米色一区二区| 欧美电视剧在线观看完整版| 美女在线视频一区| 中文一区二区完整视频在线观看| 久久成人久久爱| 欧美一区二区三级| 美女看a上一区| 26uuu亚洲| 国产丶欧美丶日本不卡视频| 国产欧美视频在线观看| 国产成人午夜精品影院观看视频 | 亚洲精品欧美激情| 91丨九色丨黑人外教| 国产精品成人在线观看| 色诱亚洲精品久久久久久| 亚洲靠逼com| 欧美日韩一区高清| 老司机精品视频线观看86| 精品日韩一区二区三区免费视频| 狠狠色丁香婷综合久久| 久久精品一区蜜桃臀影院| 懂色av中文一区二区三区| 中日韩av电影| 色综合亚洲欧洲| 婷婷中文字幕综合| 精品美女被调教视频大全网站| 狠狠色狠狠色合久久伊人| 日本一二三四高清不卡| 色噜噜偷拍精品综合在线| 肉色丝袜一区二区| 精品国产一区二区在线观看| 成人黄色在线看| 亚洲国产wwwccc36天堂| 亚洲精品在线一区二区| 99久久精品国产导航| 午夜视频在线观看一区| 欧美mv日韩mv国产网站app| 成人黄色777网| 亚洲成人动漫在线观看| 国产亚洲人成网站| 色狠狠av一区二区三区| 蜜臀va亚洲va欧美va天堂| 中文字幕在线不卡一区二区三区| 欧美视频一区二区三区| 精久久久久久久久久久| 亚洲人成精品久久久久| 日韩欧美www| 在线亚洲免费视频| 国产东北露脸精品视频| 亚洲一区视频在线| 国产日韩精品久久久| 欧美日韩一区二区在线视频| 国产精品一区二区在线播放 | 欧美日韩aaa| 国产黄色成人av| 亚洲综合色视频| 国产亚洲精品中文字幕| 91精品在线免费| 99免费精品视频| 国产一区二区91| 亚洲h精品动漫在线观看| 狠狠狠色丁香婷婷综合久久五月| 中文字幕欧美一区| 欧美精品一区二区三区在线| 欧美日韩一区三区| 91欧美激情一区二区三区成人| 久久国产精品区| 亚洲色图自拍偷拍美腿丝袜制服诱惑麻豆| 欧美日韩高清在线播放| 91网址在线看| 国产盗摄精品一区二区三区在线 | 欧美日韩一级片网站| 高清国产一区二区三区| 久88久久88久久久| 亚洲mv大片欧洲mv大片精品| 亚洲色图第一区| 国产精品丝袜一区| 久久久亚洲国产美女国产盗摄 | av亚洲产国偷v产偷v自拍| 老司机精品视频线观看86| 日韩国产在线观看| 亚洲第一搞黄网站| 一区二区三区高清不卡| 日韩一区欧美小说| 中文字幕欧美日本乱码一线二线 | 亚洲人成网站影音先锋播放| 国产精品卡一卡二| 欧美激情一区二区在线| 久久精品在线免费观看| 久久久久久久久久电影| 精品久久久久久久久久久久久久久 | 欧美日韩一区在线观看| 欧美在线观看你懂的| 91国模大尺度私拍在线视频| 色综合久久久久久久久久久| 99久久精品一区| 色一区在线观看| 欧美日韩电影一区| 日韩视频永久免费| 精品国产第一区二区三区观看体验| 日韩久久精品一区| 久久嫩草精品久久久久| 欧美韩国一区二区| 亚洲少妇最新在线视频| 亚洲图片自拍偷拍| 日韩成人午夜精品| 国产自产2019最新不卡| 国产精品夜夜爽| 色综合久久综合| 欧美精品日韩一本| 久久女同互慰一区二区三区| 国产欧美精品区一区二区三区| 国产精品婷婷午夜在线观看| 日韩美女啊v在线免费观看| 一区二区日韩av| 麻豆精品精品国产自在97香蕉| 国产盗摄视频一区二区三区| 色婷婷亚洲一区二区三区| 欧美久久久一区| 国产三级欧美三级| 亚洲一区二三区| 国产一区二区三区黄视频| 99亚偷拍自图区亚洲| 欧美日本一道本在线视频| 精品国产制服丝袜高跟| 亚洲精品视频在线观看网站| 日本不卡高清视频| 从欧美一区二区三区| 在线播放国产精品二区一二区四区 | 成人一级视频在线观看| 欧美日本韩国一区二区三区视频| 日韩亚洲欧美综合| 国产精品激情偷乱一区二区∴| 日韩中文字幕91| jvid福利写真一区二区三区| 在线播放中文一区| 中文字幕一区二区三区不卡| 日韩成人免费在线| 99视频一区二区三区| 欧美一区二区在线免费观看| 亚洲欧洲日韩一区二区三区| 免费观看在线综合色| 日本黄色一区二区| 久久一二三国产| 婷婷丁香久久五月婷婷| 91久久精品网| 中文字幕在线观看一区| 国产资源在线一区| 欧美久久久久久蜜桃| 伊人开心综合网| 成人高清免费在线播放| 久久久另类综合| 麻豆一区二区三| 777奇米成人网| 亚洲一二三区在线观看| av一区二区三区黑人| 欧美国产一区二区在线观看| 麻豆精品国产传媒mv男同| 欧美美女视频在线观看| 亚洲综合自拍偷拍| 99免费精品视频| 成人免费在线视频| 懂色av中文字幕一区二区三区| 欧美tickling挠脚心丨vk| 婷婷综合久久一区二区三区| 欧美日韩亚洲国产综合| 亚洲成人福利片| 欧美日韩极品在线观看一区| 亚洲综合区在线| 在线看日韩精品电影| 亚洲综合久久久久| 欧美亚男人的天堂|