| 1 |
/* |
| 2 |
* Copyright (C) 1994-1998 T. Teranishi |
| 3 |
* (C) 2022- 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 |
#pragma once |
| 31 |
|
| 32 |
#include <windows.h> |
| 33 |
|
| 34 |
#ifdef __cplusplus |
| 35 |
extern "C" { |
| 36 |
#endif |
| 37 |
|
| 38 |
typedef enum _BG_TYPE { BG_COLOR = 0, BG_PICTURE, BG_WALLPAPER, BG_NONE } BG_TYPE; |
| 39 |
typedef enum _BG_PATTERN { |
| 40 |
BG_STRETCH = 0, |
| 41 |
BG_TILE, |
| 42 |
BG_CENTER, |
| 43 |
BG_FIT_WIDTH, |
| 44 |
BG_FIT_HEIGHT, |
| 45 |
BG_AUTOFIT, |
| 46 |
BG_AUTOFILL |
| 47 |
} BG_PATTERN; |
| 48 |
|
| 49 |
typedef struct { |
| 50 |
BG_TYPE type; |
| 51 |
BG_PATTERN pattern; |
| 52 |
BOOL enable; |
| 53 |
BOOL antiAlias; |
| 54 |
COLORREF color; // type=BG_PICTURE, BG_WALLPAPER���A���������������h���������F |
| 55 |
int alpha; |
| 56 |
wchar_t file[MAX_PATH]; |
| 57 |
} TBGSrc; |
| 58 |
|
| 59 |
typedef struct _BGTheme { |
| 60 |
TBGSrc BGDest; // �w�i���� |
| 61 |
TBGSrc BGSrc1; // ����(Windows���f�X�N�g�b�v�w�i) |
| 62 |
TBGSrc BGSrc2; // fill color |
| 63 |
BYTE TextBackAlpha; // ��������(SGR0),back������Alpha |
| 64 |
BYTE BGReverseTextAlpha; // ���]����(SGR7),back������Alpha |
| 65 |
BYTE BackAlpha; // ��������back������Alpha |
| 66 |
} BGTheme; |
| 67 |
|
| 68 |
//////////////////// |
| 69 |
// color theme |
| 70 |
//////////////////// |
| 71 |
|
| 72 |
// Character Attributes |
| 73 |
// Normal(SGR 0), BOLD(SGR 1),... |
| 74 |
typedef struct { |
| 75 |
BOOL change; // TRUE/FALSE = default�F�������X����/���X������ |
| 76 |
BOOL enable; // TRUE/FALSE = ������������(Bold attribute��)�������F���L��/���������� |
| 77 |
COLORREF fg; // Fore color (���������������F���L��������) |
| 78 |
COLORREF bg; // Back color (���������������F���L��������) |
| 79 |
} TColorSetting; |
| 80 |
|
| 81 |
// ANSI Color |
| 82 |
typedef struct { |
| 83 |
BOOL change; // TRUE/FALSE = default�F�������X����/���X������ |
| 84 |
//BOOL enable; // �s�v��? |
| 85 |
COLORREF color[16]; // ANSI color 256�F ��������16�F, (�O���������F,���������F���������F) |
| 86 |
} TAnsiColorSetting; |
| 87 |
|
| 88 |
// color theme |
| 89 |
typedef struct { |
| 90 |
wchar_t name[50]; |
| 91 |
TColorSetting vt; // SGR 0 |
| 92 |
TColorSetting bold; // SGR 1 |
| 93 |
TColorSetting underline; // SGR 4 |
| 94 |
TColorSetting blink; // SGR 5 |
| 95 |
TColorSetting reverse; // SGR 7 |
| 96 |
TColorSetting url; |
| 97 |
TAnsiColorSetting ansicolor; |
| 98 |
} TColorTheme; |
| 99 |
|
| 100 |
typedef struct { |
| 101 |
BG_PATTERN id; |
| 102 |
const wchar_t *str; |
| 103 |
} BG_PATTERN_ST; |
| 104 |
|
| 105 |
// setting / themefile.cpp |
| 106 |
void ThemeEnable(BOOL enable); |
| 107 |
BOOL ThemeIsEnabled(void); |
| 108 |
const BG_PATTERN_ST *ThemeBGPatternList(int index); |
| 109 |
|
| 110 |
// file / themefile.cpp |
| 111 |
void ThemeLoadBG(const wchar_t *file, BGTheme *bg_theme); |
| 112 |
void ThemeLoadColor(const wchar_t *fname, TColorTheme *color_theme); |
| 113 |
void ThemeLoad(const wchar_t *fname, BGTheme *bg_theme, TColorTheme *color_theme); |
| 114 |
void ThemeSaveBG(const BGTheme *bg_theme, const wchar_t *fname); |
| 115 |
void ThemeSaveColor(TColorTheme *color_theme, const wchar_t *fname); |
| 116 |
|
| 117 |
// setting / vtdisp.c |
| 118 |
void ThemeGetBG(BGTheme *bg_theme); |
| 119 |
void ThemeSetBG(const BGTheme *bg_theme); |
| 120 |
void ThemeGetColor(TColorTheme *data); |
| 121 |
void ThemeSetColor(const TColorTheme *data); |
| 122 |
void ThemeGetColorDefault(TColorTheme *data); |
| 123 |
void ThemeGetColorDefaultTS(const TTTSet *pts, TColorTheme *color_theme); |
| 124 |
void ThemeGetBGDefault(BGTheme *bg_theme); |
| 125 |
|
| 126 |
#ifdef __cplusplus |
| 127 |
} |
| 128 |
#endif |