| 1 |
/* |
| 2 |
* Copyright (C) 1994-1998 T. Teranishi |
| 3 |
* (C) 2008- 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, VT terminal display routines */ |
| 31 |
|
| 32 |
#pragma once |
| 33 |
|
| 34 |
#include "buffer.h" // for TCharAttr |
| 35 |
|
| 36 |
#ifdef __cplusplus |
| 37 |
extern "C" { |
| 38 |
#endif |
| 39 |
|
| 40 |
/* Constants */ |
| 41 |
/* for DispSetColor() / DispGetColor() */ |
| 42 |
// ANSIColor -- 0-255 |
| 43 |
#define CS_VT_NORMALFG 256 |
| 44 |
#define CS_VT_NORMALBG 257 |
| 45 |
#define CS_VT_BOLDFG 258 |
| 46 |
#define CS_VT_BOLDBG 259 |
| 47 |
#define CS_VT_BLINKFG 260 |
| 48 |
#define CS_VT_BLINKBG 261 |
| 49 |
#define CS_VT_REVERSEFG 262 |
| 50 |
#define CS_VT_REVERSEBG 263 |
| 51 |
#define CS_VT_URLFG 264 |
| 52 |
#define CS_VT_URLBG 265 |
| 53 |
#define CS_VT_UNDERFG 266 |
| 54 |
#define CS_VT_UNDERBG 267 |
| 55 |
#define CS_TEK_FG 268 |
| 56 |
#define CS_TEK_BG 269 |
| 57 |
#define CS_ANSICOLOR_ALL 270 |
| 58 |
#define CS_SP_ALL 271 |
| 59 |
#define CS_UNSPEC 0xffffffff |
| 60 |
#define CS_ALL 0xfffffffe // DispResetColor() �������g�p |
| 61 |
|
| 62 |
/* prototypes */ |
| 63 |
void BGInitialize(BOOL initialize_once); |
| 64 |
void BGLoadThemeFile(const TTTSet *pts); |
| 65 |
void BGSetupPrimary(BOOL forceSetup); |
| 66 |
|
| 67 |
void BGOnSettingChange(void); |
| 68 |
void BGOnEnterSizeMove(void); |
| 69 |
void BGOnExitSizeMove(void); |
| 70 |
|
| 71 |
void InitDisp(void); |
| 72 |
void EndDisp(void); |
| 73 |
void DispReset(void); |
| 74 |
void DispConvWinToScreen |
| 75 |
(int Xw, int Yw, int *Xs, int *Ys, PBOOL Right); |
| 76 |
void DispConvScreenToWin |
| 77 |
(int Xs, int Ys, int *Xw, int *Yw); |
| 78 |
void ChangeFont(void); |
| 79 |
void ResetIME(void); |
| 80 |
void ChangeCaret(void); |
| 81 |
void CaretKillFocus(BOOL show); |
| 82 |
void UpdateCaretPosition(BOOL enforce); |
| 83 |
void CaretOn(void); |
| 84 |
void CaretOff(void); |
| 85 |
void DispDestroyCaret(void); |
| 86 |
BOOL IsCaretOn(void); |
| 87 |
void DispEnableCaret(BOOL On); |
| 88 |
BOOL IsCaretEnabled(void); |
| 89 |
void DispSetCaretWidth(BOOL DW); |
| 90 |
void DispChangeWinSize(int Nx, int Ny); |
| 91 |
void ResizeWindow(int x, int y, int w, int h, int cw, int ch); |
| 92 |
void PaintWindow(HDC PaintDC, RECT PaintRect, BOOL fBkGnd, |
| 93 |
int* Xs, int* Ys, int* Xe, int* Ye); |
| 94 |
void DispEndPaint(void); |
| 95 |
void DispClearWin(void); |
| 96 |
void DispChangeBackground(void); |
| 97 |
void DispChangeWin(void); |
| 98 |
void DispInitDC(void); |
| 99 |
void DispReleaseDC(void); |
| 100 |
void DispSetupDC(TCharAttr Attr, BOOL Reverse); |
| 101 |
void DispStrA(const char *Buff, const char *WidthInfo, int Count, int Y, int* X); |
| 102 |
void DispStrW(const wchar_t *StrW, const char *WidthInfo, int Count, int Y, int* X); |
| 103 |
BOOL DispDeleteLines(int Count, int YEnd); |
| 104 |
BOOL DispInsertLines(int Count, int YEnd); |
| 105 |
BOOL IsLineVisible(int* X, int* Y); |
| 106 |
void AdjustScrollBar(void); |
| 107 |
void DispScrollToCursor(int CurX, int CurY); |
| 108 |
void DispScrollNLines(int Top, int Bottom, int Direction); |
| 109 |
void DispCountScroll(int n); |
| 110 |
void DispUpdateScroll(void); |
| 111 |
void DispScrollHomePos(void); |
| 112 |
void DispAutoScroll(POINT p); |
| 113 |
void DispHScroll(int Func, int Pos); |
| 114 |
void DispVScroll(int Func, int Pos); |
| 115 |
void DispSetupFontDlg(HWND hwndOwner); |
| 116 |
void DispRestoreWinSize(void); |
| 117 |
void DispSetWinPos(void); |
| 118 |
void DispSetActive(BOOL ActiveFlag); |
| 119 |
int TCharAttrCmp(TCharAttr a, TCharAttr b); |
| 120 |
void DispSetColor(unsigned int num, COLORREF color); |
| 121 |
void DispResetColor(unsigned int num); |
| 122 |
COLORREF DispGetColor(unsigned int num); |
| 123 |
void DispSetCurCharAttr(TCharAttr Attr); |
| 124 |
void DispMoveWindow(int x, int y); |
| 125 |
void DispShowWindow(int mode); |
| 126 |
void DispResizeWin(int w, int h); |
| 127 |
BOOL DispWindowIconified(void); |
| 128 |
void DispGetWindowPos(int *x, int *y, BOOL client); |
| 129 |
void DispGetWindowSize(int *width, int *height, BOOL client); |
| 130 |
void DispGetRootWinSize(int *x, int *y, BOOL inPixels); |
| 131 |
int DispFindClosestColor(int red, int green, int blue); |
| 132 |
void DrawStrW(HDC DC, HDC BGDC, const wchar_t *StrW, const char *WidthInfo, int Count, int font_width, int font_height, |
| 133 |
int Y, int *X); |
| 134 |
void DrawStrA(HDC DC, HDC BGDC, const char *StrA, const char *WidthInfo, int Count, int font_width, int font_height, |
| 135 |
int Y, int *X); |
| 136 |
void DispEnableResizedFont(BOOL enable); |
| 137 |
BOOL DispIsResizedFont(); |
| 138 |
|
| 139 |
extern int WinWidth, WinHeight; |
| 140 |
extern HFONT VTFont[AttrFontMask+1]; |
| 141 |
extern int FontHeight, FontWidth, ScreenWidth, ScreenHeight; |
| 142 |
extern BOOL AdjustSize, DontChangeSize; |
| 143 |
extern int CursorX, CursorY; |
| 144 |
extern int WinOrgX, WinOrgY, NewOrgX, NewOrgY; |
| 145 |
extern int NumOfLines, NumOfColumns; |
| 146 |
extern int PageStart, BuffEnd; |
| 147 |
extern TCharAttr DefCharAttr; |
| 148 |
|
| 149 |
extern BOOL IMEstat; |
| 150 |
extern BOOL IMECompositionState; |
| 151 |
|
| 152 |
// for DispHScroll(), DispVScroll() |
| 153 |
#define SCROLL_BOTTOM 1 |
| 154 |
#define SCROLL_LINEDOWN 2 |
| 155 |
#define SCROLL_LINEUP 3 |
| 156 |
#define SCROLL_PAGEDOWN 4 |
| 157 |
#define SCROLL_PAGEUP 5 |
| 158 |
#define SCROLL_POS 6 |
| 159 |
#define SCROLL_TOP 7 |
| 160 |
|
| 161 |
// for DispShowWindow() |
| 162 |
#define WINDOW_MINIMIZE 1 |
| 163 |
#define WINDOW_MAXIMIZE 2 |
| 164 |
#define WINDOW_RESTORE 3 |
| 165 |
#define WINDOW_RAISE 4 |
| 166 |
#define WINDOW_LOWER 5 |
| 167 |
#define WINDOW_REFRESH 6 |
| 168 |
#define WINDOW_TOGGLE_MAXIMIZE 7 |
| 169 |
|
| 170 |
#ifdef __cplusplus |
| 171 |
} |
| 172 |
#endif |