| 1 |
doda |
6806 |
/* |
| 2 |
|
|
* Copyright (C) 1994-1998 T. Teranishi |
| 3 |
zmatsuo |
8675 |
* (C) 2005-2020 TeraTerm Project |
| 4 |
doda |
6806 |
* All rights reserved. |
| 5 |
|
|
* |
| 6 |
doda |
6841 |
* Redistribution and use in source and binary forms, with or without |
| 7 |
|
|
* modification, are permitted provided that the following conditions |
| 8 |
|
|
* are met: |
| 9 |
doda |
6806 |
* |
| 10 |
doda |
6841 |
* 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 |
doda |
6806 |
* |
| 18 |
doda |
6841 |
* 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 |
doda |
6806 |
*/ |
| 29 |
maya |
3227 |
|
| 30 |
|
|
/* TERATERM.EXE, scroll buffer routines */ |
| 31 |
|
|
|
| 32 |
zmatsuo |
8675 |
#pragma once |
| 33 |
|
|
|
| 34 |
maya |
3227 |
#ifdef __cplusplus |
| 35 |
|
|
extern "C" { |
| 36 |
|
|
#endif |
| 37 |
|
|
|
| 38 |
zmatsuo |
8675 |
/* Character attribute bit masks */ |
| 39 |
|
|
#define AttrDefault 0x00 |
| 40 |
|
|
#define AttrDefaultFG 0x00 |
| 41 |
|
|
#define AttrDefaultBG 0x00 |
| 42 |
|
|
#define AttrBold 0x01 |
| 43 |
|
|
#define AttrUnder 0x02 |
| 44 |
|
|
#define AttrSpecial 0x04 |
| 45 |
|
|
#define AttrFontMask 0x07 |
| 46 |
|
|
#define AttrBlink 0x08 |
| 47 |
|
|
#define AttrReverse 0x10 |
| 48 |
|
|
#define AttrLineContinued 0x20 /* valid only at the beggining or end of a line */ |
| 49 |
|
|
/* begin - ishizaki */ |
| 50 |
|
|
#define AttrURL 0x40 |
| 51 |
|
|
/* end - ishizaki */ |
| 52 |
|
|
#define AttrKanji 0x80 // 1=�S�p(2cell)/0=���p(1cell) |
| 53 |
|
|
#define AttrPadding 0x100 // 1=padding(2cell������1cell or �s��) |
| 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 |
|
|
#if 1 //UNICODE_INTERNAL_BUFF |
| 68 |
|
|
WORD AttrEx; // �A�g���r���[�g���������e�X�g |
| 69 |
|
|
#endif |
| 70 |
|
|
BYTE Fore; |
| 71 |
|
|
BYTE Back; |
| 72 |
|
|
} TCharAttr; |
| 73 |
|
|
|
| 74 |
|
|
typedef TCharAttr *PCharAttr; |
| 75 |
|
|
|
| 76 |
zmatsuo |
8748 |
void InitBuffer(BOOL use_unicode_api); |
| 77 |
maya |
3227 |
void LockBuffer(); |
| 78 |
|
|
void UnlockBuffer(); |
| 79 |
|
|
void FreeBuffer(); |
| 80 |
|
|
void BuffReset(); |
| 81 |
|
|
void BuffAllSelect(); |
| 82 |
|
|
void BuffScreenSelect(); |
| 83 |
|
|
void BuffCancelSelection(); |
| 84 |
|
|
void ChangeSelectRegion(); |
| 85 |
|
|
void BuffScroll(int Count, int Bottom); |
| 86 |
|
|
void BuffInsertSpace(int Count); |
| 87 |
|
|
void BuffEraseCurToEnd(); |
| 88 |
|
|
void BuffEraseHomeToCur(); |
| 89 |
|
|
void BuffInsertLines(int Count, int YEnd); |
| 90 |
|
|
void BuffEraseCharsInLine(int XStart, int Count); |
| 91 |
|
|
void BuffDeleteLines(int Count, int YEnd); |
| 92 |
|
|
void BuffDeleteChars(int Count); |
| 93 |
|
|
void BuffEraseChars(int Count); |
| 94 |
|
|
void BuffFillWithE(); |
| 95 |
|
|
void BuffDrawLine(TCharAttr Attr, int Direction, int C); |
| 96 |
|
|
void BuffEraseBox(int XStart, int YStart, int XEnd, int YEnd); |
| 97 |
doda |
5090 |
void BuffFillBox(char c, int XStart, int YStart, int XEnd, int YEnd); |
| 98 |
doda |
5089 |
void BuffCopyBox(int SrcXStart, int SrcYStart, int SrcXEnd, int SrcYEnd, int SrcPage, int DstX, int DstY, int DstPage); |
| 99 |
doda |
5095 |
void BuffChangeAttrBox(int XStart, int YStart, int XEnd, int YEnd, PCharAttr attr, PCharAttr mask); |
| 100 |
doda |
7086 |
void BuffChangeAttrStream(int XStart, int YStart, int XEnd, int YEnd, PCharAttr attr, PCharAttr mask); |
| 101 |
zmatsuo |
8676 |
wchar_t *BuffCBCopyUnicode(BOOL Table); |
| 102 |
maya |
3227 |
void BuffPrint(BOOL ScrollRegion); |
| 103 |
|
|
void BuffDumpCurrentLine(BYTE TERM); |
| 104 |
|
|
void BuffPutChar(BYTE b, TCharAttr Attr, BOOL Insert); |
| 105 |
|
|
void BuffPutKanji(WORD w, TCharAttr Attr, BOOL Insert); |
| 106 |
doda |
8445 |
int BuffPutUnicode(unsigned int uc, TCharAttr Attr, BOOL Insert); |
| 107 |
maya |
3227 |
void BuffUpdateRect(int XStart, int YStart, int XEnd, int YEnd); |
| 108 |
|
|
void UpdateStr(); |
| 109 |
|
|
void UpdateStrUnicode(void); |
| 110 |
|
|
void MoveCursor(int Xnew, int Ynew); |
| 111 |
|
|
void MoveRight(); |
| 112 |
|
|
void BuffSetCaretWidth(); |
| 113 |
|
|
void BuffScrollNLines(int n); |
| 114 |
|
|
void BuffClearScreen(); |
| 115 |
|
|
void BuffUpdateScroll(); |
| 116 |
|
|
void CursorUpWithScroll(); |
| 117 |
|
|
int BuffUrlDblClk(int Xw, int Yw); |
| 118 |
|
|
void BuffDblClk(int Xw, int Yw); |
| 119 |
|
|
void BuffTplClk(int Yw); |
| 120 |
|
|
void BuffSeveralPagesSelect(int Xw, int Yw); |
| 121 |
|
|
void BuffStartSelect(int Xw, int Yw, BOOL Box); |
| 122 |
|
|
void BuffChangeSelect(int Xw, int Yw, int NClick); |
| 123 |
zmatsuo |
8676 |
wchar_t *BuffEndSelect(); |
| 124 |
maya |
3227 |
void BuffChangeWinSize(int Nx, int Ny); |
| 125 |
|
|
void BuffChangeTerminalSize(int Nx, int Ny); |
| 126 |
|
|
void ChangeWin(); |
| 127 |
|
|
void ClearBuffer(); |
| 128 |
|
|
void SetTabStop(); |
| 129 |
|
|
void CursorForwardTab(int count, BOOL AutoWrapMode); |
| 130 |
|
|
void CursorBackwardTab(int count); |
| 131 |
|
|
void ClearTabStop(int Ps); |
| 132 |
|
|
void ShowStatusLine(int Show); |
| 133 |
doda |
3312 |
void BuffLineContinued(BOOL mode); |
| 134 |
|
|
#define SetLineContinued() BuffLineContinued(TRUE) |
| 135 |
|
|
#define ClearLineContinued() BuffLineContinued(FALSE) |
| 136 |
maya |
3227 |
void BuffRegionScrollUpNLines(int n); |
| 137 |
|
|
void BuffRegionScrollDownNLines(int n); |
| 138 |
|
|
void BuffSetCurCharAttr(TCharAttr Attr); |
| 139 |
doda |
3743 |
void BuffSaveScreen(); |
| 140 |
|
|
void BuffRestoreScreen(); |
| 141 |
doda |
3745 |
void BuffDiscardSavedScreen(); |
| 142 |
doda |
4070 |
void BuffSelectedEraseCharsInLine(int XStart, int Count); |
| 143 |
|
|
void BuffSelectedEraseCurToEnd(); |
| 144 |
|
|
void BuffSelectedEraseHomeToCur(); |
| 145 |
|
|
void BuffSelectedEraseScreen(); |
| 146 |
doda |
5091 |
void BuffSelectiveEraseBox(int XStart, int YStart, int XEnd, int YEnd); |
| 147 |
doda |
4243 |
void BuffScrollLeft(int count); |
| 148 |
|
|
void BuffScrollRight(int count); |
| 149 |
yutakapon |
4932 |
int BuffGetCurrentLineData(char *buf, int bufsize); |
| 150 |
zmatsuo |
8678 |
wchar_t *BuffGetLineStrW(int Sy, int *cx, size_t *length); |
| 151 |
zmatsuo |
8908 |
int BuffGetAnyLineData(int offset_y, char *buf, int bufsize); |
| 152 |
|
|
int BuffGetAnyLineDataW(int offset_y, wchar_t *buf, size_t bufsize); |
| 153 |
doda |
5279 |
BOOL BuffCheckMouseOnURL(int Xw, int Yw); |
| 154 |
doda |
8445 |
wchar_t *BuffGetCharInfo(int Xw, int Yw); |
| 155 |
|
|
void BuffSetCursorCharAttr(int x, int y, TCharAttr Attr); |
| 156 |
|
|
TCharAttr BuffGetCursorCharAttr(int x, int y); |
| 157 |
zmatsuo |
8605 |
BOOL BuffIsCombiningCharacter(int x, int y, unsigned int u32); |
| 158 |
zmatsuo |
8750 |
void BuffSetDispAPI(BOOL unicode); |
| 159 |
zmatsuo |
8770 |
void BuffSetDispCodePage(int CodePage); |
| 160 |
|
|
int BuffGetDispCodePage(void); |
| 161 |
maya |
3227 |
|
| 162 |
|
|
extern int StatusLine; |
| 163 |
doda |
5324 |
extern int CursorTop, CursorBottom, CursorLeftM, CursorRightM; |
| 164 |
maya |
3227 |
extern BOOL Selected; |
| 165 |
|
|
extern BOOL Wrap; |
| 166 |
|
|
|
| 167 |
doda |
6175 |
#define isCursorOnStatusLine (StatusLine && CursorY == NumOfLines-1) |
| 168 |
doda |
5324 |
|
| 169 |
maya |
3227 |
#ifdef __cplusplus |
| 170 |
|
|
} |
| 171 |
|
|
#endif |