| 1 |
/* |
| 2 |
* Copyright (C) 1994-1998 T. Teranishi |
| 3 |
* (C) 2005- TeraTerm Project |
| 4 |
* All rights reserved. |
| 5 |
* |
| 6 |
* Redistribution and use in source and binary forms, with or without |
| 7 |
* modification, are permitted provided that the following conditions |
| 8 |
* are met: |
| 9 |
* |
| 10 |
* 1. Redistributions of source code must retain the above copyright |
| 11 |
* notice, this list of conditions and the following disclaimer. |
| 12 |
* 2. Redistributions in binary form must reproduce the above copyright |
| 13 |
* notice, this list of conditions and the following disclaimer in the |
| 14 |
* documentation and/or other materials provided with the distribution. |
| 15 |
* 3. The name of the author may not be used to endorse or promote products |
| 16 |
* derived from this software without specific prior written permission. |
| 17 |
* |
| 18 |
* THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR |
| 19 |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
| 20 |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
| 21 |
* IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
| 22 |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
| 23 |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 24 |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 25 |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 26 |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| 27 |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 28 |
*/ |
| 29 |
|
| 30 |
/* TERATERM.EXE, scroll buffer routines */ |
| 31 |
|
| 32 |
#pragma once |
| 33 |
|
| 34 |
#include "teraprnfile.h" |
| 35 |
|
| 36 |
#ifdef __cplusplus |
| 37 |
extern "C" { |
| 38 |
#endif |
| 39 |
|
| 40 |
/* Character attribute bit masks */ |
| 41 |
#define AttrDefault 0x00 |
| 42 |
#define AttrDefaultFG 0x00 |
| 43 |
#define AttrDefaultBG 0x00 |
| 44 |
#define AttrBold 0x01 |
| 45 |
#define AttrUnder 0x02 |
| 46 |
#define AttrSpecial 0x04 |
| 47 |
#define AttrFontMask 0x07 |
| 48 |
#define AttrBlink 0x08 |
| 49 |
#define AttrReverse 0x10 |
| 50 |
#define AttrLineContinued 0x20 /* valid only at the beggining or end of a line */ |
| 51 |
#define AttrURL 0x40 |
| 52 |
#define AttrKanji 0x80 // 1=�S�p(2cell)/0=���p(1cell) (buffer.c,h ��������) |
| 53 |
#define AttrPadding 0x100 // 1=padding(2cell������1cell or �s��) (vtterm - buffer ������) |
| 54 |
|
| 55 |
/* Color attribute bit masks */ |
| 56 |
#define Attr2Fore 0x01 |
| 57 |
#define Attr2Back 0x02 |
| 58 |
#define AttrSgrMask (AttrBold | AttrUnder | AttrBlink | AttrReverse) |
| 59 |
#define AttrColorMask (AttrBold | AttrBlink | AttrReverse) |
| 60 |
#define Attr2ColorMask (Attr2Fore | Attr2Back) |
| 61 |
|
| 62 |
#define Attr2Protect 0x04 |
| 63 |
|
| 64 |
typedef struct { |
| 65 |
BYTE Attr; |
| 66 |
BYTE Attr2; |
| 67 |
WORD AttrEx; // �A�g���r���[�g���������e�X�g |
| 68 |
BYTE Fore; |
| 69 |
BYTE Back; |
| 70 |
} TCharAttr; |
| 71 |
|
| 72 |
typedef TCharAttr *PCharAttr; |
| 73 |
|
| 74 |
void InitBuffer(BOOL use_unicode_api); |
| 75 |
void LockBuffer(void); |
| 76 |
void UnlockBuffer(void); |
| 77 |
void FreeBuffer(void); |
| 78 |
void BuffReset(void); |
| 79 |
void BuffAllSelect(void); |
| 80 |
void BuffScreenSelect(void); |
| 81 |
void BuffCancelSelection(void); |
| 82 |
void ChangeSelectRegion(void); |
| 83 |
void BuffInsertSpace(int Count); |
| 84 |
void BuffEraseCurToEnd(void); |
| 85 |
void BuffEraseHomeToCur(void); |
| 86 |
void BuffInsertLines(int Count, int YEnd); |
| 87 |
void BuffEraseCharsInLine(int XStart, int Count); |
| 88 |
void BuffDeleteLines(int Count, int YEnd); |
| 89 |
void BuffDeleteChars(int Count); |
| 90 |
void BuffEraseChars(int Count); |
| 91 |
void BuffFillWithE(void); |
| 92 |
void BuffDrawLine(TCharAttr Attr, int Direction, int C); |
| 93 |
void BuffEraseBox(int XStart, int YStart, int XEnd, int YEnd); |
| 94 |
void BuffFillBox(char c, int XStart, int YStart, int XEnd, int YEnd); |
| 95 |
void BuffCopyBox(int SrcXStart, int SrcYStart, int SrcXEnd, int SrcYEnd, int SrcPage, int DstX, int DstY, int DstPage); |
| 96 |
void BuffChangeAttrBox(int XStart, int YStart, int XEnd, int YEnd, PCharAttr attr, PCharAttr mask); |
| 97 |
void BuffChangeAttrStream(int XStart, int YStart, int XEnd, int YEnd, PCharAttr attr, PCharAttr mask); |
| 98 |
wchar_t *BuffCBCopyUnicode(BOOL Table); |
| 99 |
void BuffPrint(BOOL ScrollRegion); |
| 100 |
void BuffDumpCurrentLine(PrintFile *handle, BYTE TERM); |
| 101 |
int BuffPutUnicode(unsigned int uc, TCharAttr Attr, BOOL Insert); |
| 102 |
void BuffUpdateRect(int XStart, int YStart, int XEnd, int YEnd); |
| 103 |
void UpdateStr(void); |
| 104 |
void UpdateStrUnicode(void); |
| 105 |
void MoveCursor(int Xnew, int Ynew); |
| 106 |
void MoveRight(void); |
| 107 |
void BuffSetCaretWidth(void); |
| 108 |
void BuffScrollNLines(int n); |
| 109 |
void BuffClearScreen(void); |
| 110 |
void BuffUpdateScroll(void); |
| 111 |
void CursorUpWithScroll(void); |
| 112 |
int BuffUrlDblClk(int Xw, int Yw); |
| 113 |
void BuffDblClk(int Xw, int Yw); |
| 114 |
void BuffTplClk(int Yw); |
| 115 |
void BuffSeveralPagesSelect(int Xw, int Yw); |
| 116 |
void BuffStartSelect(int Xw, int Yw, BOOL Box); |
| 117 |
void BuffChangeSelect(int Xw, int Yw, int NClick); |
| 118 |
wchar_t *BuffEndSelect(void); |
| 119 |
void BuffChangeWinSize(int Nx, int Ny); |
| 120 |
void BuffChangeTerminalSize(int Nx, int Ny); |
| 121 |
void ChangeWin(void); |
| 122 |
void ClearBuffer(void); |
| 123 |
void SetTabStop(void); |
| 124 |
void CursorForwardTab(int count, BOOL AutoWrapMode); |
| 125 |
void CursorBackwardTab(int count); |
| 126 |
void ClearTabStop(int Ps); |
| 127 |
void ShowStatusLine(int Show); |
| 128 |
void BuffLineContinued(BOOL mode); |
| 129 |
#define SetLineContinued() BuffLineContinued(TRUE) |
| 130 |
#define ClearLineContinued() BuffLineContinued(FALSE) |
| 131 |
void BuffRegionScrollUpNLines(int n); |
| 132 |
void BuffRegionScrollDownNLines(int n); |
| 133 |
void BuffSetCurCharAttr(TCharAttr Attr); |
| 134 |
void BuffSaveScreen(void); |
| 135 |
void BuffRestoreScreen(void); |
| 136 |
void BuffDiscardSavedScreen(void); |
| 137 |
void BuffSelectedEraseCharsInLine(int XStart, int Count); |
| 138 |
void BuffSelectedEraseCurToEnd(void); |
| 139 |
void BuffSelectedEraseHomeToCur(void); |
| 140 |
void BuffSelectedEraseScreen(void); |
| 141 |
void BuffSelectiveEraseBox(int XStart, int YStart, int XEnd, int YEnd); |
| 142 |
void BuffScrollLeft(int count); |
| 143 |
void BuffScrollRight(int count); |
| 144 |
int BuffGetCurrentLineData(char *buf, int bufsize); |
| 145 |
wchar_t *BuffGetLineStrW(int Sy, int *cx, size_t *length); |
| 146 |
int BuffGetAnyLineData(int offset_y, char *buf, int bufsize); |
| 147 |
int BuffGetAnyLineDataW(int offset_y, wchar_t *buf, size_t bufsize); |
| 148 |
BOOL BuffCheckMouseOnURL(int Xw, int Yw); |
| 149 |
wchar_t *BuffGetCharInfo(int Xw, int Yw); |
| 150 |
void BuffSetCursorCharAttr(int x, int y, TCharAttr Attr); |
| 151 |
TCharAttr BuffGetCursorCharAttr(int x, int y); |
| 152 |
BOOL BuffIsCombiningCharacter(int x, int y, unsigned int u32); |
| 153 |
void BuffSetDispAPI(BOOL unicode); |
| 154 |
void BuffSetDispCodePage(int CodePage); |
| 155 |
int BuffGetDispCodePage(void); |
| 156 |
BOOL BuffIsSelected(void); |
| 157 |
|
| 158 |
extern int StatusLine; |
| 159 |
extern int CursorTop, CursorBottom, CursorLeftM, CursorRightM; |
| 160 |
extern BOOL Wrap; |
| 161 |
|
| 162 |
#define isCursorOnStatusLine (StatusLine && CursorY == NumOfLines-1) |
| 163 |
|
| 164 |
#ifdef __cplusplus |
| 165 |
} |
| 166 |
#endif |