adtrmemu.pas

来自「测试用例」· PAS 代码 · 共 1,284 行 · 第 1/5 页

PAS
1,284
字号
(***** BEGIN LICENSE BLOCK *****
 * Version: MPL 1.1
 *
 * The contents of this file are subject to the Mozilla Public License Version
 * 1.1 (the "License"); you may not use this file except in compliance with
 * the License. You may obtain a copy of the License at
 * http://www.mozilla.org/MPL/
 *
 * Software distributed under the License is distributed on an "AS IS" basis,
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
 * for the specific language governing rights and limitations under the
 * License.
 *
 * The Original Code is TurboPower Async Professional
 *
 * The Initial Developer of the Original Code is
 * TurboPower Software
 *
 * Portions created by the Initial Developer are Copyright (C) 1991-2002
 * the Initial Developer. All Rights Reserved.
 *
 * Contributor(s):
 *
 * ***** END LICENSE BLOCK ***** *)

{*********************************************************}
{*                   ADTRMEMU.PAS 4.06                   *}
{*********************************************************}
{*   Terminal: Terminal, Emulator ancestor, and TTY &    *}
{*                    VT100 Emulators                    *}
{*********************************************************}

unit ADTrmEmu;                 

{Notes:
        To speed up the display of lots of data, the terminal provides
        a lazy display option. If data is arriving at full speed, the
        terminal 'saves up' the data it needs to display until either
        (a) it receives a certain number of bytes (defaulting to 200
        bytes), or (b) until no data has arrived or the keyboard was
        not used for a certain amount of time (default 100
        milliseconds). This improves the perceived speed of the
        terminal display.

        The BlinkTime property can be set to 0, meaning no blinking.
        This in turn means that text on the display marked as blinking
        will not, it'll be 'on' all the time. For efficiency reasons,
        the blink rate cannot be set to anything less than 250 milli-
        seconds.

        The Capture property has only two values on reading: whether
        data capture is 'on' or 'off'. It has three possible values on
        writing: 'on', 'off', or 'append'. If the value written is
        'append' and the current value is 'off', the capture file is
        opened in non-sharing mode for appending data and the value of
        the Capture property is then set to 'on' (note that if the
        file doesn't exist, it will be created). If the value written
        is 'append' and the current value is 'on', nothing happens.

        A valid value for the CaptureFile property is required to set
        Capture to 'on' or 'append'. If Capture is 'on' and the value
        of CaptureFile is changed, Capture is set 'off', the internal
        file name changed and then Capture is set back 'on'. If you
        want to append to the new file in this situation, the user is
        responsible for manually setting Capture 'off' before and then
        'append' afterwards.
        }

{ several preliminary code changes are left in the code, marked by !!.!! }
{ comments.  They should be invisible to current applications }

{$I AWDEFINE.INC}

{$Z-}

interface

uses
  {$IFDEF Win32} Windows, {$ELSE} WinTypes, WinProcs, {$ENDIF}
  Messages, SysUtils, Classes, Graphics, Controls, ExtCtrls,
  Forms, Dialogs, ClipBrd, Menus,
  OOMisc,
  ADPort, ADExcept,
  ADTrmPsr, ADTrmMap, ADTrmBuf;

type
  TAdCharSource = (csUnknown, csKeyboard, csPort, csWriteChar);        {!!.04}

  TAdEmuCommand = (ecNone,                                             {!!.04}
                   ecBell,                                             {!!.04}
                   ecBackspace,                                        {!!.04}
                   ecTabHorz,                                          {!!.04}
                   ecLF,                                               {!!.04}
                   ecCR,                                               {!!.04}
                   ecBackTabHorz,                                      {!!.04}
                   ecCursorDown,                                       {!!.04}
                   ecCursorLeft,                                       {!!.04}
                   ecCursorRight,                                      {!!.04}
                   ecCursorUp,                                         {!!.04}
                   ecCursorPos,                                        {!!.04}
                   ecDeleteChars,                                      {!!.04}
                   ecDeleteLines,                                      {!!.04}
                   ecInsertChars,                                      {!!.04}
                   ecInsertLines,                                      {!!.04}
                   ecEraseAll,                                         {!!.04}
                   ecEraseChars,                                       {!!.04}
                   ecEraseFromBOW,                                     {!!.04}
                   ecEraseFromBOL,                                     {!!.04}
                   ecEraseLine,                                        {!!.04}
                   ecEraseScreen,                                      {!!.04}
                   ecEraseToEOL,                                       {!!.04}
                   ecEraseToEOW,                                       {!!.04}
                   ecSetHorzTabStop,                                   {!!.04}
                   ecClearHorzTabStop,                                 {!!.04}
                   ecClearVertTabStop,                                 {!!.04}
                   ecClearAllHorzTabStops,                             {!!.04}
                   ecSetVertTabStop,                                   {!!.04}
                   ecClearAllVertTabStops,                             {!!.04}
                   ecSetScrollRegion,                                  {!!.04}
                   ecTabVert,                                          {!!.04}
                   ecBackTabVert,                                      {!!.04}
                   ecBackColor,                                        {!!.04}
                   ecForeColor,                                        {!!.04}
                   ecAbsAddress,                                       {!!.04}
                   ecNoAbsAddress,                                     {!!.04}
                   ecAutoWrap,                                         {!!.04}
                   ecNoAutoWrap,                                       {!!.04}
                   ecAutoWrapDelay,                                    {!!.04}
                   ecNoAutoWrapDelay,                                  {!!.04}
                   ecInsertMode,                                       {!!.04}
                   ecNoInsertMode,                                     {!!.04}
                   ecNewLineMode,                                      {!!.04}
                   ecNoNewLineMode,                                    {!!.04}
                   ecScrollRegion,                                     {!!.04}
                   ecNoScrollRegion,                                   {!!.04}
                   ecSetCharAttr,                                      {!!.04}
                   ecAddBold,                                          {!!.04}
                   ecBoldOnly,                                         {!!.04}
                   ecRemoveBold,                                       {!!.04}
                   ecInvertBold,                                       {!!.04}
                   ecAddUnderLine,                                     {!!.04}
                   ecUnderlineOnly,                                    {!!.04}
                   ecRemoveUnderline,                                  {!!.04}
                   ecInvertUnderline,                                  {!!.04}
                   ecAddStrikethrough,                                 {!!.04}
                   ecStrikethroughOnly,                                {!!.04}
                   ecRemoveStrikethrough,                              {!!.04}
                   ecInvertStrikethrough,                              {!!.04}
                   ecAddBlink,                                         {!!.04}
                   ecBlinkOnly,                                        {!!.04}
                   ecRemoveBlink,                                      {!!.04}
                   ecInvertBlink,                                      {!!.04}
                   ecAddReverse,                                       {!!.04}
                   ecReverseOnly,                                      {!!.04}
                   ecRemoveReverse,                                    {!!.04}
                   ecInvertReverse,                                    {!!.04}
                   ecAddInvisible,                                     {!!.04}
                   ecInvisibleOnly,                                    {!!.04}
                   ecRemoveInvisible,                                  {!!.04}
                   ecInvertInvisible,                                  {!!.04}
                   ecAddSelected,                                      {!!.04}
                   ecRemoveSelected,                                   {!!.04}
                   ecSelectedOnly,                                     {!!.04}
                   ecInvertSelected,                                   {!!.04}
                   ecRemoveAllAttr,                                    {!!.04}
                   ecRemoveAllAttrIgnoreSelect,                        {!!.04}
                   ecClearAndHome,                                     {!!.04}
                   ecHome,                                             {!!.04}
                   ecCursorEOL,                                        {!!.04}
                   ecCursorBOL,                                        {!!.04}
                   ecCursorTop,                                        {!!.04}
                   ecCursorBottom,                                     {!!.04}
                   ecWriteString,                                      {!!.04}
                   ecColor,                                            {!!.04}
                   ecSaveCursorPos,                                    {!!.04}
                   ecRestoreCursorPos,                                 {!!.04}
                   ecDeviceAttributesReport,                           {!!.04}
                   ecNEL,                                              {!!.04}
                   ecReset,                                            {!!.04}
                   ecAnswerback,                                       {!!.04}
                   ecDECALN,                                           {!!.04}
                   ecDeviceStatusReport,                               {!!.06}
                   ecCursorOff,                                        {!!.06}
                   ecCursorUnderline,                                  {!!.06}
                   ecCursorBlock                                       {!!.06}
                  );                                                   {!!.04}

type
  TAdCaptureMode = ( {terminal data capture modes..}
          cmOff,     {..no capturing of data}
          cmOn,      {..capture new data to new file}
          cmAppend); {..capture data, appending to old file}

  TAdTerminalCursorMovedEvent =
     procedure (aSender : TObject; aRow, aCol : integer) of object;

  TAdCursorType = (  {cursor types}
    ctNone,          {..no cursor is visible}
    ctUnderline,     {..underline cursor}
    ctBlock);        {..block cursor}

  TAdVT100LineAttr = ( {special VT100 line attributes}
    ltNormal,          {..normal, no special attrs}
    ltDblHeightTop,    {..line is top half of double-height line}
    ltDblHeightBottom, {..line is bottom half of double-height line}
    ltDblWidth);       {..line is double-width}

const
  {default property values for the terminal}
  adc_TermActive = true;
  adc_TermBackColor = adc_TermBufBackColor;
  adc_TermBlinkTime = 500;
  adc_TermBorderStyle = bsSingle;
  adc_TermCapture = cmOff;
  adc_TermCaptureFile = 'APROTERM.CAP';
  adc_TermColumnCount = adc_TermBufColCount;
  adc_TermCursorType = ctBlock;
  adc_TermFontName = 'Terminal';
  adc_TermForeColor = adc_TermBufForeColor;
  adc_TermHalfDuplex = false;
  adc_TermHeight = 200;
  adc_TermLazyByteDelay = 200;
  adc_TermLazyTimeDelay = 100;
  adc_TermRowCount = adc_TermBufRowCount;
  adc_TermScrollback = false;
  adc_TermScrollRowCount = adc_TermBufScrollRowCount;
  adc_TermUseLazyDisplay = true;
  adc_TermWantAllKeys = true;
  adc_TermWidth = 300;
  adc_FreezeScrollback = true;
  adc_TermMouseSelect = True;                                            {!!.03}
  adc_TermAutoCopy = True;                                               {!!.03}
  adc_TermAutoScrollback = True;                                         {!!.03}
  adc_TermHideScrollbars = False;                                        {!!.03}
  adc_TermFollowsCursor = True;                                          {!!.03}
  adc_TermPasteToPort = False;                                           {!!.04}
  adc_TermPasteToScreen = False;                                         {!!.04}

  {default property values for the VT100 emulator--'power-up' values}
  adc_VT100ANSIMode = true;
  adc_VT100Answerback = 'APROterm';
  adc_VT100AppKeyMode = false;
  adc_VT100AppKeypadMode = false;
  adc_VT100AutoRepeat = true;
  adc_VT100Col132Mode = false;
  adc_VT100G0CharSet = 0;
  adc_VT100G1CharSet = 0;
  adc_VT100GPOMode = false;
  adc_VT100InsertMode = adc_TermBufUseInsertMode;
  adc_VT100Interlace = false;
  adc_VT100NewLineMode = adc_TermBufUseNewLineMode;
  adc_VT100RelOriginMode = not adc_TermBufUseAbsAddress;
  adc_VT100RevScreenMode = false;
  adc_VT100SmoothScrollMode = false;
  adc_VT100WrapAround = adc_TermBufUseAutoWrap;

type                          

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?