• R/O
  • SSH
  • HTTPS

ttssh2: Commit


Commit MetaInfo

Revision10303 (tree)
Time2022-10-10 13:48:24
Authorzmatsuo

Log Message

カラーテーマファイルのマニュアル追記、読み書きを修正

- カラーテーマ iniファイルフォーマットを変更

- 従来のフォーマットも読み込み可能だが近々未対応とする
- #RRGGBB 形式が使用できるようにした
- saveしたiniの R,G,B 形式の後ろに #RRGGBB が出力される

- マニュアル追記
- Unicode化(途中)

Change Summary

Incremental Difference

--- trunk/doc/en/html/menu/setup-additional-visual-theme.html (revision 10302)
+++ trunk/doc/en/html/menu/setup-additional-visual-theme.html (revision 10303)
@@ -29,6 +29,14 @@
2929
3030 <hr>
3131
32+ <h2>TODO</h2>
33+ <ul>
34+ <li>BGSPIPath(画像を読み込むのに用いる、Susie Plugin が格納されているフォルダを指定します。)の
35+ 設定GUIを作る
36+ </ul>
37+
38+ <hr>
39+
3240 <h2 id="preview">preview/file tab</h2>
3341
3442 preview<br>
@@ -63,7 +71,7 @@
6371 上から順に背景画像が合成されていく。
6472
6573 <dl>
66- <dt>base Color</dt>
74+ <dt>Base Color</dt>
6775 <dd>
6876 背景画像を使用しない場合はこの色で塗りつぶされる。背景画像が描画されない部分がある場合もこの色で塗りつぶされる。
6977 </dd>
--- trunk/doc/en/html/setup/theme.html (revision 10302)
+++ trunk/doc/en/html/setup/theme.html (revision 10303)
@@ -3,178 +3,233 @@
33 <html>
44 <head>
55 <meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS">
6-<title>Theme file</TITLE>
6+<title>Theme 設定ファイル</TITLE>
77 <meta http-equiv="Content-Style-Type" content="text/css">
88 <link rel="stylesheet" href="../style.css" type="text/css">
99 </head>
1010 <body>
1111
12+ <h1>Themeファイル</h1>
1213
13- <h1>Theme 設定ファイル</h1>
14+ <ul>
15+ <li><a href="#themefile">Themeファイルについて</a></li>
16+ <li><a href="#BGTheme">BG(背景) Theme</a></li>
17+ <li><a href="#ColorTheme">Color Theme</a></li>
18+ </ul>
1419
15- TODO
20+ <h2>TODO</h2>
1621 <ul>
17- <li>BGSPIPath(画像を読み込むのに用いる、Susie Plugin が格納されているフォルダを指定します。)の設定GUIを作る
1822 <li>仕様をちゃんと決める
1923 <li>仕様に合わせて<a href="https://ttssh2.osdn.jp/tmp/color/">color picker(仮)</a>を修正
2024 </ul>
2125
22- <h2>themeファイルの種類</h2>
26+ <h2 id="themefile">themeファイルについて</h2>
2327
2428 テーマファイルにはいくつかの種類がある。
2529
2630 <dl>
27- <dt>BG + カラー</dt>
31+ <dt>BG(背景)テーマ</dt>
2832 <dd>
29- [BG]と[Color Theme]の2セクション入ったファイル<br>
30- [BG]セクションには背景画像の設定だけ入っている
33+ [BG]セクションが入ったファイル<br>
34+ このセクションには背景画像の設定が入る
3135 </dd>
32- <dt>BG のみ</dt>
36+ <dt>カラーテーマ</dt>
3337 <dd>
34- [BG]セクションのみのファイル<br>
35- [BG]セクションには背景画像の設定だけ入っている
36- </dd>
37- <dt>カラーのみ</dt>
38+ [Color Theme]セクションが入ったファイル<br>
39+ このセクションには文字の色の設定が入る
40+ <dt>旧カラーテーマ (廃止予定)</dt>
3841 <dd>
39- [Color Theme]のみのファイル<br>
42+ [BG]セクションに文字の色の設定が入っている<br>
43+ Tera Term 4 でサポートしていたカラーテーマ<br>
44+ 読み込みはできるが廃止予定
4045 </dd>
41- <dt>BG + 旧カラー (廃止したい)</dt>
42- <dd>
43- [BG]セクションのみのファイル<br>
44- [BG]セクションには背景画像と文字の色情報が入っている<br>
45- [BG]セクションの色情報は廃止したい<br>
46- </dd>
4746 </dl>
4847
49- <h3>BG theme</h3>
48+ BG(背景)テーマとカラーテーマを別のファイルに保存しておくことも、
49+ 1つのファイルに両方を保存することもできる。
5050
51- iniファイルの[BG]セクション部分
51+ フォーマットはWindowsのiniファイル。
5252
53+ <h2 id="BGTheme">BG(背景)テーマ</h2>
54+
55+ セクション名は"[BG]"
56+
5357 <dl>
54- <dt>BGPictureTone</dt>
58+ <dt>BGDestColor</dt>
5559 <dd>
56- 背景画像(Dest)にデスクトップ画像(Src1)どれぐらいブレンドするか<br>
57- BGSrc1Alpha = 255 - BGPictureTone<br>
58- 0=デスクトップ画像(Src1)が100%<br>
59- 255=背景画像(Dest)が100%
60+ 背景画像を使用しない場合はこの色で塗りつぶされる。<br>
61+ 背景画像が描画されない部分がある場合もこの色で塗りつぶされる。
6062 </dd>
61- <dt>BGFadeColor</dt>
63+
64+ <dt>BGDestFile</dt>
6265 <dd>
63- Src2の色<br>
64- BGFadeColor = BGSrc2Color
66+ 背景画像
67+ ファイル名にワイルドカードが指定された場合、一致するファイルからランダムに一つ選びます。<br>
68+ 相対パスを利用する場合は、テーマファイルからの相対パスを指定してください。<br>
69+ 読み込めるファイルの種類は、BGSPIPath に格納されたプラグインによります。<br>
70+ ビットマップはプラグインが無くても読み込めます。
6571 </dd>
66- <dt>BGFadeTone</dt>
67- <dd>DestとSrc1の合成画像に単色(Src2)をどれぐらいブレンドするか<br>
68- BGSrc2Alpha = 255 - BGFadeTone<br>
69- 0=単色(Src2)が100%<br>
70- 255=DestとSrc1の合成画像が100%
72+
73+ <dt>BGDestPattern</dt>
74+ <dd>背景画像描画方法
75+ <dl>
76+ <dt>stretch</dt>
77+ <dt>tile</dt>
78+ <dt>center</dt>
79+ <dt>fit_width</dt>
80+ <dt>fit_height</dt>
81+ <dt>autofit</dt>
82+ <dt>autofill</dt>
83+ <dd>
84+ FitWidth、FitHeight は画像のアスペクト比を維持したまま、画像を拡大縮小します。<br>
85+ AutoFit は、ウィンドウと画像の間に隙間ができないように、FitWidth と FitHeight を切り替えます。
86+ </dd>
87+ </dl>
7188 </dd>
7289
73- <dt>BGReverseTextTone</t>
90+ <dt>BGSrc1Alpha</dt>
7491 <dd>
75- 0 - 255<br>
76- The transparency value of the reverse text.
92+ Windowsの壁紙画像をアルファブレンドする。<br>
93+ 背景画像(Dest)にデスクトップ画像(Src1)どれぐらいブレンドするを指定する。<br>
94+ 0のとき壁紙はブレンドされない。<br>
7795 </dd>
7896
79- <dt>BGPictureFile</dt>
80- <dd>file name<br>
81- You can specify the image file name merging with the wall paper.<br>
82- Tera Term will randomly select one of files when the wild card is specified.<br>
83- Please specify the relative path from the theme file when you want to use the relative path.<br>
84- The kind of file that Tera Term can load is depend the plugin stored in BGSPIPath.<br>
85- Tera Term can load the bitmap file when there is not plugin.<br>
97+
98+ <dt>BGSrc2Color</dt>
99+ <dd>
100+ 背景画像全体をアルファブレンドする色
86101 </dd>
87102
88- <dt>BGPicturePattern</dt>
89- <dd>Stretch<br>
90- Tile<br>
91- Center<br>
92- FitWidth<br>
93- FitHeight<br>
94- AutoFit<br>
95- You can specify the painting method of the image file.<br>
96- Both FitWidth and FitHeight can expand or reduce the image while the aspect ratio of the image preserves.<br>
97- AutoFit can exchange FitWidth for FitHeight not to generate the space between the window and the image.
103+ <dt>BGSrc2Alpha</dt>
104+ <dd>
105+ アルファブレンド値<br>
106+ DestとSrc1の合成画像に単色(Src2)をどれぐらいブレンドするか<br>
98107 </dd>
99108
100- <dt>BGPictureBaseColor</dt>
101- <dd>R, G, B<br>
102- This color can paint between the image file and the window.
109+ <dt>BGReverseTextTone</dt>
110+ <dd>
111+ 0 - 255<br>
112+ 反転テキストの透明度
103113 </dd>
114+ </dl>
104115
105- <dt>BGPictureTone</dt>
106- <dd>0 - 255<br>
107- The transparency value of the image file.</dd>
116+ <h3 id="ColorTheme">color theme</h3>
108117
109- <dt>BGFadeTone</dt>
110- <dd>0 - 255<br>
111- <td>This option can enable the whole background to fade.</dd>
118+ <h4>section</h4>
112119
113- <dt>BGFadeColor</dt>
114- <dd>R, G, B<br>
115- This option can configure the fade color.</dd>
120+ "Color Theme"
121+
122+ <h4>name</h4>
123+
124+ <dl>
125+ <dt>name</dt>
126+ <dd>テーマ名、値は文字列</dd>
116127 </dl>
117128
129+ <h4>attribute color</h4>
130+
118131 <dl>
119- <dt>VTFore, Red ...</dt>
120- <dd>R, G, B<br>
121- This option can configure the text color.</dd>
132+ <dt>VTColor</dt>
133+ <dd>通常文字色, SGR 0</dd>
134+
135+ <dt>BoldColor</dt>
136+ <dd>SGR 1</dd>
137+
138+ <dt>VTUnderlineColor</dt>
139+ <dd>SGR 4</dd>
140+
141+ <dt>BlinkColor</dt>
142+ <dd>SGR 5</dd>
143+
144+ <dt>ReverseColor</dt>
145+ <dd>SGR 7</dd>
146+
147+ <dt>URLColor</dt>
148+ <dd>
149+ URL文字列<br>
150+ Tera TermがURL文字列を検出したときに付加される文字アトリビュート
151+ </dd>
152+
153+ <dt>値 (0 or 1), (0 or 1), (fore red), (fore green), (fore blue), (back red), (back green), (back blue)</dt>
154+ <dt>値 (0 or 1), (0 or 1), (fore), (back)</dt>
155+ <dd>
156+ <dl>
157+ <dt>(0 or 1)</dt>
158+ <dd>
159+ 1=default色から変更する<br>
160+ 0=変更しない<br>
161+ (VTColorでは参照されない)
162+ </dd>
163+ <dt>(0 or 1)</dt>
164+ <dd>
165+ 1=文字属性(Bold attribute等)の独自色を有効<br>
166+ 0=無効にする<br>
167+ (VTColorでは参照されない)
168+ </dd>
169+
170+ <dt>(fore red), (fore green), (fore blue)</dt>
171+ <dd>文字の色、各値は0から255</dd>
172+
173+ <dt>(back red), (back green), (back blue)</dt>
174+ <dd>背景の色、各値は0から255</dd>
175+
176+ <dt>(fore), (back)</dt>
177+ <dd>
178+ #RRBBGG の形式で、各々00 から FF まで
179+ </dd>
180+ </dl>
181+ </dd>
122182 </dl>
123-</table>
124183
184+ <h4>ANSI color</h4>
125185
126-<h2>Extension of theme file</h2>
186+ 256色/16色 ANSI colorの最初の16色。<br>
187+ 8色時は、Dark colorを使用しない
127188
128-<p>
129-A user can configure the extension of the theme file based on the theme\Advanced.sample file.<br>
130-For example, an image file(sample.jpg) can be drawn in the Tera Term background.
131-Please specify the .ini file at the BGThemeFile entry of the teraterm.ini file.
132-</p>
189+ <dl>
190+ <dt>ANSIColor=(0 or 1)</dt>
191+ <dd>
192+ 1=default色から変更する<br>
193+ 0=変更しない
194+ </dd>
195+ </dl>
133196
134-<pre>
135-[BG]
136-; Advanced Setting
137-; Image source setting
138-; Type : Color / Picture / Wallpaper
139-: Pattern : Stretch / Tile / Center / FitWidth / FitHeight / AutoFit
140-; AntiAlias : On / Off
141-; Color : R,G,B (0-255)
142-; Alpha : 0-255
143-; File : wildcard =&gt; random select
144-; Dest = (Src1 * Src1Alpha + Dest * (255 - Src1Alpha)) / 255
145-; Dest = (Src2 * Src2Alpha + Dest * (255 - Src2Alpha)) / 255
146-BGReverseTextAlpha = 192
147-;
148-BGDestType = Picture
149-BGDestFile = sample.jpg
150-BGDestPattern = AutoFit
151-BGDestAntiAlias = On
152-BGDestColor = 0,0,0
153-;
154-BGSrc1Type = Color
155-BGSrc1File =
156-BGSrc1Pattern =
157-BGSrc1AntiAlias =
158-BGSrc1Color = 32,32,32
159-BGSrc1Alpha = 64
160-;
161-BGSrc2Type = Color
162-BGSrc2File =
163-BGSrc2Pattern =
164-BGSrc2AntiAlias =
165-BGSrc2Color = 32,32,32
166-BGSrc2Alpha = 64
167-</pre>
197+ <dl>
198+ <dt>Fore</dt>
199+ <dd>256 ANSI color 15番<br>
200+ 通常文字色(Tera TermではVTColorが使用される)
201+ </dd>
168202
169-<h2>color theme</h2>
203+ <dt>Back</dt>
204+ <dd>256 ANSI color 0番<br>
205+ 通常背景色(Tera TermではVTColorが使用される)
206+ </dd>
170207
171- TBD<br>
208+ <dt>Red</dt>
209+ <dt>Green</dt>
210+ <dt>Yellow</dt>
211+ <dt>Blue</dt>
212+ <dt>Magenta</dt>
213+ <dt>Cyan</dt>
214+ <dt>DarkFore</dt>
215+ <dt>DarkBack</dt>
216+ <dt>DarkRed</dt>
217+ <dt>DarkGreen</dt>
218+ <dt>DarkYellow</dt>
219+ <dt>DarkBlue</dt>
220+ <dt>DarkMagenta</dt>
221+ <dt>DarkCyan</dt>
222+ <dd>各文字色</dd>
172223
173- TODO
174- <ul>
175- <li>仕様書く
176- <li>release/theme/color/readme.md にリンク張る
177- </ul>
224+ <dt>値 (red), (green), (blue)</dt>
225+ <dd>各値は0から255</dd>
178226
227+ <dt>値 (color)</dt>
228+ <dd>
229+ #RRBBGG の形式で、各々00 から FF まで
230+ </dd>
231+
232+ </dl>
233+
179234 </body>
180235 </html>
--- trunk/doc/ja/html/menu/setup-additional-visual-theme.html (revision 10302)
+++ trunk/doc/ja/html/menu/setup-additional-visual-theme.html (revision 10303)
@@ -29,6 +29,14 @@
2929
3030 <hr>
3131
32+ <h2>TODO</h2>
33+ <ul>
34+ <li>BGSPIPath(画像を読み込むのに用いる、Susie Plugin が格納されているフォルダを指定します。)の
35+ 設定GUIを作る
36+ </ul>
37+
38+ <hr>
39+
3240 <h2 id="preview">preview/file tab</h2>
3341
3442 preview<br>
@@ -63,7 +71,7 @@
6371 上から順に背景画像が合成されていく。
6472
6573 <dl>
66- <dt>base Color</dt>
74+ <dt>Base Color</dt>
6775 <dd>
6876 背景画像を使用しない場合はこの色で塗りつぶされる。背景画像が描画されない部分がある場合もこの色で塗りつぶされる。
6977 </dd>
--- trunk/doc/ja/html/setup/theme.html (revision 10302)
+++ trunk/doc/ja/html/setup/theme.html (revision 10303)
@@ -9,172 +9,227 @@
99 </head>
1010 <body>
1111
12+ <h1>Themeファイル</h1>
1213
13- <h1>Theme 設定ファイル</h1>
14+ <ul>
15+ <li><a href="#themefile">Themeファイルについて</a></li>
16+ <li><a href="#BGTheme">BG(背景) Theme</a></li>
17+ <li><a href="#ColorTheme">Color Theme</a></li>
18+ </ul>
1419
15- TODO
20+ <h2>TODO</h2>
1621 <ul>
17- <li>BGSPIPath(画像を読み込むのに用いる、Susie Plugin が格納されているフォルダを指定します。)の設定GUIを作る
1822 <li>仕様をちゃんと決める
1923 <li>仕様に合わせて<a href="https://ttssh2.osdn.jp/tmp/color/">color picker(仮)</a>を修正
2024 </ul>
2125
22- <h2>themeファイルの種類</h2>
26+ <h2 id="themefile">themeファイルについて</h2>
2327
2428 テーマファイルにはいくつかの種類がある。
2529
2630 <dl>
27- <dt>BG + カラー</dt>
31+ <dt>BG(背景)テーマ</dt>
2832 <dd>
29- [BG]と[Color Theme]の2セクション入ったファイル<br>
30- [BG]セクションには背景画像の設定だけ入っている
33+ [BG]セクションが入ったファイル<br>
34+ このセクションには背景画像の設定が入る
3135 </dd>
32- <dt>BG のみ</dt>
36+ <dt>カラーテーマ</dt>
3337 <dd>
34- [BG]セクションのみのファイル<br>
35- [BG]セクションには背景画像の設定だけ入っている
36- </dd>
37- <dt>カラーのみ</dt>
38+ [Color Theme]セクションが入ったファイル<br>
39+ このセクションには文字の色の設定が入る
40+ <dt>旧カラーテーマ (廃止予定)</dt>
3841 <dd>
39- [Color Theme]のみのファイル<br>
42+ [BG]セクションに文字の色の設定が入っている<br>
43+ Tera Term 4 でサポートしていたカラーテーマ<br>
44+ 読み込みはできるが廃止予定
4045 </dd>
41- <dt>BG + 旧カラー (廃止したい)</dt>
42- <dd>
43- [BG]セクションのみのファイル<br>
44- [BG]セクションには背景画像と文字の色情報が入っている<br>
45- [BG]セクションの色情報は廃止したい<br>
46- </dd>
4746 </dl>
4847
49- <h3>BG theme</h3>
48+ BG(背景)テーマとカラーテーマを別のファイルに保存しておくことも、
49+ 1つのファイルに両方を保存することもできる。
5050
51- iniファイルの[BG]セクション部分
51+ フォーマットはWindowsのiniファイル。
5252
53+ <h2 id="BGTheme">BG(背景)テーマ</h2>
54+
55+ セクション名は"[BG]"
56+
5357 <dl>
54- <dt>BGPictureTone</dt>
58+ <dt>BGDestColor</dt>
5559 <dd>
56- 背景画像(Dest)にデスクトップ画像(Src1)どれぐらいブレンドするか<br>
57- BGSrc1Alpha = 255 - BGPictureTone<br>
58- 0=デスクトップ画像(Src1)が100%<br>
59- 255=背景画像(Dest)が100%
60+ 背景画像を使用しない場合はこの色で塗りつぶされる。<br>
61+ 背景画像が描画されない部分がある場合もこの色で塗りつぶされる。
6062 </dd>
61- <dt>BGFadeColor</dt>
63+
64+ <dt>BGDestFile</dt>
6265 <dd>
63- Src2の色<br>
64- BGFadeColor = BGSrc2Color
66+ 背景画像
67+ ファイル名にワイルドカードが指定された場合、一致するファイルからランダムに一つ選びます。<br>
68+ 相対パスを利用する場合は、テーマファイルからの相対パスを指定してください。<br>
69+ 読み込めるファイルの種類は、BGSPIPath に格納されたプラグインによります。<br>
70+ ビットマップはプラグインが無くても読み込めます。
6571 </dd>
66- <dt>BGFadeTone</dt>
67- <dd>DestとSrc1の合成画像に単色(Src2)をどれぐらいブレンドするか<br>
68- BGSrc2Alpha = 255 - BGFadeTone<br>
69- 0=単色(Src2)が100%<br>
70- 255=DestとSrc1の合成画像が100%
72+
73+ <dt>BGDestPattern</dt>
74+ <dd>背景画像描画方法
75+ <dl>
76+ <dt>stretch</dt>
77+ <dt>tile</dt>
78+ <dt>center</dt>
79+ <dt>fit_width</dt>
80+ <dt>fit_height</dt>
81+ <dt>autofit</dt>
82+ <dt>autofill</dt>
83+ <dd>
84+ FitWidth、FitHeight は画像のアスペクト比を維持したまま、画像を拡大縮小します。<br>
85+ AutoFit は、ウィンドウと画像の間に隙間ができないように、FitWidth と FitHeight を切り替えます。
86+ </dd>
87+ </dl>
7188 </dd>
7289
73- <dt>BGReverseTextTone</dt>
90+ <dt>BGSrc1Alpha</dt>
7491 <dd>
75- 0 - 255<br>
76- 反転テキストの透明度
92+ Windowsの壁紙画像をアルファブレンドする。<br>
93+ 背景画像(Dest)にデスクトップ画像(Src1)どれぐらいブレンドするを指定する。<br>
94+ 0のとき壁紙はブレンドされない。<br>
7795 </dd>
7896
79- <dt>BGPictureFile</dt>
97+
98+ <dt>BGSrc2Color</dt>
8099 <dd>
81- ファイル名<br>
82- 壁紙と合成する画像ファイル名を指定します。<br>
83- ファイル名にワイルドカードが指定された場合、一致するファイルからランダムに一つ選びます。<br>
84- 相対パスを利用する場合は、テーマファイルからの相対パスを指定してください。<br>
85- 読み込めるファイルの種類は、BGSPIPath に格納されたプラグインによります。<br>
86- ビットマップはプラグインが無くても読み込めます。
100+ 背景画像全体をアルファブレンドする色
87101 </dd>
88102
89- <dt>BGPicturePattern</dt>
90- <dd>Stretch<br>
91- Tile<br>
92- Center<br>
93- FitWidth<br>
94- FitHeight<br>
95- AutoFit<br>
96- 画像ファイルの描画方法を指定します。<br>
97- FitWidth、FitHeight は画像のアスペクト比を維持したまま、画像を拡大縮小します。<br>
98- AutoFit は、ウィンドウと画像の間に隙間ができないように、FitWidth と FitHeight を切り替えます。
103+ <dt>BGSrc2Alpha</dt>
104+ <dd>
105+ アルファブレンド値<br>
106+ DestとSrc1の合成画像に単色(Src2)をどれぐらいブレンドするか<br>
99107 </dd>
100108
101- <dt>BGPictureBaseColor</dt>
102- <dd>R, G, B<br>
103- 画像とウィンドウの間に隙間ができた場合、この色で塗られます。
109+ <dt>BGReverseTextTone</dt>
110+ <dd>
111+ 0 - 255<br>
112+ 反転テキストの透明度
104113 </dd>
114+ </dl>
105115
106- <dt>BGPictureTone</dt>
107- <dd>0 - 255<br>
108- 画像ファイルの透明度
116+ <h3 id="ColorTheme">color theme</h3>
117+
118+ <h4>section</h4>
119+
120+ "Color Theme"
121+
122+ <h4>name</h4>
123+
124+ <dl>
125+ <dt>name</dt>
126+ <dd>テーマ名、値は文字列</dd>
127+ </dl>
128+
129+ <h4>attribute color</h4>
130+
131+ <dl>
132+ <dt>VTColor</dt>
133+ <dd>通常文字色, SGR 0</dd>
134+
135+ <dt>BoldColor</dt>
136+ <dd>SGR 1</dd>
137+
138+ <dt>VTUnderlineColor</dt>
139+ <dd>SGR 4</dd>
140+
141+ <dt>BlinkColor</dt>
142+ <dd>SGR 5</dd>
143+
144+ <dt>ReverseColor</dt>
145+ <dd>SGR 7</dd>
146+
147+ <dt>URLColor</dt>
148+ <dd>
149+ URL文字列<br>
150+ Tera TermがURL文字列を検出したときに付加される文字アトリビュート
109151 </dd>
110152
111- <dt>BGFadeTone</dt>
112- <dd>0 - 255<br>
113- 背景全体をフェードします。</dd>
153+ <dt>値 (0 or 1), (0 or 1), (fore red), (fore green), (fore blue), (back red), (back green), (back blue)</dt>
154+ <dt>値 (0 or 1), (0 or 1), (fore), (back)</dt>
155+ <dd>
156+ <dl>
157+ <dt>(0 or 1)</dt>
158+ <dd>
159+ 1=default色から変更する<br>
160+ 0=変更しない<br>
161+ (VTColorでは参照されない)
162+ </dd>
163+ <dt>(0 or 1)</dt>
164+ <dd>
165+ 1=文字属性(Bold attribute等)の独自色を有効<br>
166+ 0=無効にする<br>
167+ (VTColorでは参照されない)
168+ </dd>
114169
115- <dt>BGFadeColor</dt>
116- <dd>R, G, B<br>
117- フェードしたときの色を指定します。</dd>
170+ <dt>(fore red), (fore green), (fore blue)</dt>
171+ <dd>文字の色、各値は0から255</dd>
172+
173+ <dt>(back red), (back green), (back blue)</dt>
174+ <dd>背景の色、各値は0から255</dd>
175+
176+ <dt>(fore), (back)</dt>
177+ <dd>
178+ #RRBBGG の形式で、各々00 から FF まで
179+ </dd>
180+ </dl>
181+ </dd>
118182 </dl>
119183
184+ <h4>ANSI color</h4>
185+
186+ 256色/16色 ANSI colorの最初の16色。<br>
187+ 8色時は、Dark colorを使用しない
188+
120189 <dl>
121- <dt>VTFore や Red など (廃止)</dt>
122- <dd>R, G, B<br>
123- テキストの色を設定します。</dd>
190+ <dt>ANSIColor=(0 or 1)</dt>
191+ <dd>
192+ 1=default色から変更する<br>
193+ 0=変更しない
194+ </dd>
124195 </dl>
125196
126-<h2>テーマファイルの拡張設定</h2>
197+ <dl>
198+ <dt>Fore</dt>
199+ <dd>256 ANSI color 15番<br>
200+ 通常文字色(Tera TermではVTColorが使用される)
201+ </dd>
127202
128-<p>
129-theme\Advanced.sample ファイルを利用して、拡張設定をすることができます。<br>
130-下記は、指定した画像ファイル(sample.jpg)を Tera Term の背景に描画する例で、
131-teraterm.ini の BGThemeFile エントリで指定してください。
132-</p>
203+ <dt>Back</dt>
204+ <dd>256 ANSI color 0番<br>
205+ 通常背景色(Tera TermではVTColorが使用される)
206+ </dd>
133207
134-<pre>
135-[BG]
136-; Advanced Setting
137-; Image source setting
138-; Type : Color / Picture / Wallpaper
139-: Pattern : Stretch / Tile / Center / FitWidth / FitHeight / AutoFit
140-; AntiAlias : On / Off
141-; Color : R,G,B (0-255)
142-; Alpha : 0-255
143-; File : wildcard =&gt; random select
144-; Dest = (Src1 * Src1Alpha + Dest * (255 - Src1Alpha)) / 255
145-; Dest = (Src2 * Src2Alpha + Dest * (255 - Src2Alpha)) / 255
146-BGReverseTextAlpha = 192
147-;
148-BGDestType = Picture
149-BGDestFile = sample.jpg
150-BGDestPattern = AutoFit
151-BGDestAntiAlias = On
152-BGDestColor = 0,0,0
153-;
154-BGSrc1Type = Color
155-BGSrc1File =
156-BGSrc1Pattern =
157-BGSrc1AntiAlias =
158-BGSrc1Color = 32,32,32
159-BGSrc1Alpha = 64
160-;
161-BGSrc2Type = Color
162-BGSrc2File =
163-BGSrc2Pattern =
164-BGSrc2AntiAlias =
165-BGSrc2Color = 32,32,32
166-BGSrc2Alpha = 64
167-</pre>
208+ <dt>Red</dt>
209+ <dt>Green</dt>
210+ <dt>Yellow</dt>
211+ <dt>Blue</dt>
212+ <dt>Magenta</dt>
213+ <dt>Cyan</dt>
214+ <dt>DarkFore</dt>
215+ <dt>DarkBack</dt>
216+ <dt>DarkRed</dt>
217+ <dt>DarkGreen</dt>
218+ <dt>DarkYellow</dt>
219+ <dt>DarkBlue</dt>
220+ <dt>DarkMagenta</dt>
221+ <dt>DarkCyan</dt>
222+ <dd>各文字色</dd>
168223
169-<h2>color theme</h2>
224+ <dt>値 (red), (green), (blue)</dt>
225+ <dd>各値は0から255</dd>
170226
171- TBD<br>
227+ <dt>値 (color)</dt>
228+ <dd>
229+ #RRBBGG の形式で、各々00 から FF まで
230+ </dd>
172231
173- TODO
174- <ul>
175- <li>仕様書く
176- <li>release/theme/color/readme.md にリンク張る
177- </ul>
232+ </dl>
178233
179234 </body>
180235 </html>
--- trunk/installer/release/theme/color/README.md (revision 10302)
+++ trunk/installer/release/theme/color/README.md (revision 10303)
@@ -1,5 +1,9 @@
11 # color theme folder
22
3+- see [Setup Files]/[theme file] in help
4+- Tera Term color theme plugin was referened.
5+ - https://osdn.net/users/doda/pf/TTXColorTheme/
6+
37 ## themes
48
59 - Solarized Dark
@@ -19,12 +23,3 @@
1923 - Color UniversalDesign 4
2024 - 色覚多様性に対応した設定例
2125 - カラーユニバーサルデザイン(CUD)推奨配色セット ver.4に準拠
22-
23-## format
24-
25-- 未決定
26- - まだ変更すると思う
27- - TBD
28-- Tera Term カラーテーマプラグイン を参考にしました。
29- - https://osdn.net/users/doda/pf/TTXColorTheme/
30-
--- trunk/teraterm/teraterm/theme.h (revision 10302)
+++ trunk/teraterm/teraterm/theme.h (revision 10303)
@@ -66,22 +66,26 @@
6666 // color theme
6767 ////////////////////
6868
69+// Character Attributes
70+// Normal(SGR 0), BOLD(SGR 1),...
6971 typedef struct {
70- BOOL change;
71- BOOL enable;
72- COLORREF fg;
73- COLORREF bg;
72+ BOOL change; // TRUE/FALSE = default色から変更する/変更しない
73+ BOOL enable; // TRUE/FALSE = この文字属性(Bold attribute等)の独自色を有効/無効にする
74+ COLORREF fg; // Fore color (文字属性の独自色が有効な場合)
75+ COLORREF bg; // Back color (文字属性の独自色が有効な場合)
7476 } TColorSetting;
7577
78+// ANSI Color
7679 typedef struct {
77- BOOL change;
78- BOOL enable;
79- COLORREF color[16];
80+ BOOL change; // TRUE/FALSE = default色から変更する/変更しない
81+ //BOOL enable; // 不要か?
82+ COLORREF color[16]; // ANSI color 256色 の最初の16色, (前半が暗い色,後半が原色の明るい色)
8083 } TAnsiColorSetting;
8184
85+// color theme
8286 typedef struct {
83- char name[50];
84- TColorSetting vt;
87+ wchar_t name[50];
88+ TColorSetting vt; // SGR 0
8589 TColorSetting bold; // SGR 1
8690 TColorSetting underline; // SGR 4
8791 TColorSetting blink; // SGR 5
@@ -100,8 +104,7 @@
100104
101105 // file / themefile.cpp
102106 void ThemeLoadBG(const wchar_t *file, BGTheme *bg_theme);
103-void ThemeLoadColor(const wchar_t *fn, TColorTheme *color_theme);
104-void ThemeLoadColorOld(const wchar_t *file, TColorTheme *theme);
107+void ThemeLoadColor(const wchar_t *fname, TColorTheme *color_theme);
105108 void ThemeLoad(const wchar_t *fname, BGTheme *bg_theme, TColorTheme *color_theme);
106109 void ThemeSaveBG(const BGTheme *bg_theme, const wchar_t *fname);
107110 void ThemeSaveColor(TColorTheme *color_theme, const wchar_t *fname);
--- trunk/teraterm/teraterm/themedlg.cpp (revision 10302)
+++ trunk/teraterm/teraterm/themedlg.cpp (revision 10303)
@@ -431,7 +431,7 @@
431431 const int b = GetBValue(c);
432432
433433 wchar_t color_str[64];
434- swprintf_s(color_str, L"0x%02x%02x%02x", r,g,b);
434+ swprintf_s(color_str, L"#%02x%02x%02x", r,g,b);
435435 item.mask = LVIF_TEXT;
436436 item.iItem = y;
437437 item.iSubItem = 2;
@@ -498,7 +498,7 @@
498498 //ListView_InsertColumn(hWndList, 1, &lvcol);
499499 SendMessage(hWndList, LVM_INSERTCOLUMNA, 1, (LPARAM)&lvcol);
500500
501- lvcol.pszText = (LPSTR)"value(RRGGBB)";
501+ lvcol.pszText = (LPSTR)"value(#RRGGBB)";
502502 lvcol.iSubItem = 2;
503503 //ListView_InsertColumn(hWndList, 1, &lvcol);
504504 SendMessage(hWndList, LVM_INSERTCOLUMNA, 2, (LPARAM)&lvcol);
@@ -748,7 +748,12 @@
748748 OPENFILENAMEW ofn = {};
749749 wchar_t theme_file[MAX_PATH];
750750
751- wcscpy_s(theme_file, _countof(theme_file), ts->EtermLookfeel.BGThemeFileW);
751+ if (ts->EtermLookfeel.BGThemeFileW != NULL) {
752+ wcscpy_s(theme_file, _countof(theme_file), ts->EtermLookfeel.BGThemeFileW);
753+ }
754+ else {
755+ theme_file[0] = 0;
756+ }
752757
753758 ofn.lStructSize = get_OPENFILENAME_SIZEW();
754759 ofn.hwndOwner = hWnd;
--- trunk/teraterm/teraterm/themefile.cpp (revision 10302)
+++ trunk/teraterm/teraterm/themefile.cpp (revision 10303)
@@ -35,6 +35,7 @@
3535 #include "asprintf.h"
3636 #include "inifile_com.h"
3737 #include "win32helper.h"
38+#include "codeconv.h"
3839
3940 #include "theme.h"
4041
@@ -42,18 +43,36 @@
4243 #define BG_SECTION "BG"
4344 #define BG_SECTIONW L"BG"
4445 #define BG_DESTFILE "BGDestFile"
45-#define BG_DESTFILEW L"BGDestFile"
46-//#define BG_THEME_IMAGEFILE "theme\\ImageFile.INI"
47-//#define BG_THEME_IMAGEFILE_DEFAULT "theme\\*.INI"
48-#define BG_THEME_IMAGE_BRIGHTNESS_DEFAULT 64
4946 #define BG_THEME_IMAGE_BRIGHTNESS1 "BGSrc1Alpha"
50-#define BG_THEME_IMAGE_BRIGHTNESS1W L"BGSrc1Alpha"
5147 #define BG_THEME_IMAGE_BRIGHTNESS2 "BGSrc2Alpha"
52-//#define BG_THEME_IMAGEFILE_NAME "ImageFile.INI"
53-//#define BG_THEME_IMAGEFILE_NAMEW L"ImageFile.INI"
54-//#define BG_THEME_THEMEFILE_SCALE "Scale.INI"
55-//#define BG_THEME_THEMEFILE_TILE "Tile.INI"
5648
49+/**
50+ * ANSI256色時の先頭16色
51+ * INIファイルから読み込むときのキーワードと色番号対応
52+ */
53+static const struct {
54+ int index;
55+ const wchar_t *key;
56+} ansi_list[] = {
57+ 7 + 8, L"Fore",
58+ 0, L"Back",
59+ 1 + 8, L"Red",
60+ 2 + 8, L"Green",
61+ 3 + 8, L"Yellow",
62+ 4 + 8, L"Blue",
63+ 5 + 8, L"Magenta",
64+ 6 + 8, L"Cyan",
65+
66+ 7, L"DarkFore",
67+ 0 + 8, L"DarkBack",
68+ 1, L"DarkRed",
69+ 2, L"DarkGreen",
70+ 3, L"DarkYellow",
71+ 4, L"DarkBlue",
72+ 5, L"DarkMagenta",
73+ 6, L"DarkCyan",
74+};
75+
5776 const BG_PATTERN_ST *ThemeBGPatternList(int index)
5877 {
5978 static const BG_PATTERN_ST bg_pattern_list[] = {
@@ -72,28 +91,50 @@
7291 return &bg_pattern_list[index];
7392 }
7493
94+static COLORREF LoadColorOneANSI(const wchar_t *section, const wchar_t *key, const wchar_t *file, COLORREF defcolor)
95+{
96+ int r;
97+ wchar_t *str;
98+ DWORD e = hGetPrivateProfileStringW(section, key, NULL, file, &str);
99+ if (e != 0 || *str == 0) {
100+ free(str);
101+ return defcolor;
102+ }
103+ if (*str == L'#') {
104+ // #RRGGBB 形式
105+ DWORD i32;
106+ r = swscanf_s(str, L"#%08x", &i32);
107+ if (r == 1) {
108+ free(str);
109+ return RGB((i32 & 0xff0000) >> 16, (i32 & 0x00ff00) >> 8, (i32 & 0x0000ff));
110+ }
111+ }
112+ // R, G, B 形式
113+ int red, green, blue;
114+ r = swscanf_s(str, L"%d , %d , %d", &red, &green, &blue);
115+ free(str);
116+ if (r == 3) {
117+ return RGB(red, green, blue);
118+ }
119+ return defcolor;
120+}
121+
75122 static COLORREF BGGetColor(const char *name, COLORREF defcolor, const wchar_t *file)
76123 {
77- unsigned int r, g, b;
78- char colorstr[256], defstr[256];
79-
80- _snprintf_s(defstr, sizeof(defstr), _TRUNCATE, "%d,%d,%d", GetRValue(defcolor), GetGValue(defcolor),
81- GetBValue(defcolor));
82-
83- GetPrivateProfileStringAFileW(BG_SECTION, name, defstr, colorstr, 255, file);
84-
85- r = g = b = 0;
86-
87- sscanf(colorstr, "%d , %d , %d", &r, &g, &b);
88-
89- return RGB(r, g, b);
124+ const wchar_t *section = BG_SECTIONW;
125+ wchar_t *keyW = ToWcharA(name);
126+ COLORREF color = LoadColorOneANSI(section, keyW, file, defcolor);
127+ free(keyW);
128+ return color;
90129 }
91130
92131 /*
93132 * color theme用ロード
94133 */
95-void ThemeLoadColorOld(const wchar_t *file, TColorTheme *theme)
134+static void ThemeLoadColorOld(const wchar_t *file, TColorTheme *theme)
96135 {
136+ theme->ansicolor.change = TRUE;
137+
97138 theme->ansicolor.color[IdFore] = BGGetColor("Fore", theme->ansicolor.color[IdFore], file);
98139 theme->ansicolor.color[IdBack] = BGGetColor("Back", theme->ansicolor.color[IdBack], file);
99140 theme->ansicolor.color[IdRed] = BGGetColor("Red", theme->ansicolor.color[IdRed], file);
@@ -114,39 +155,64 @@
114155
115156 theme->vt.fg = BGGetColor("VTFore", theme->vt.fg, file);
116157 theme->vt.bg = BGGetColor("VTBack", theme->vt.bg, file);
158+ theme->vt.change = TRUE;
159+ theme->vt.enable = TRUE;
117160
118161 theme->blink.fg = BGGetColor("VTBlinkFore", theme->blink.fg, file);
119162 theme->blink.bg = BGGetColor("VTBlinkBack", theme->blink.bg, file);
163+ theme->blink.change = TRUE;
164+ theme->blink.enable = TRUE;
120165
121166 theme->bold.fg = BGGetColor("VTBoldFore", theme->bold.fg, file);
122167 theme->bold.bg = BGGetColor("VTBoldBack", theme->bold.bg, file);
168+ theme->bold.change = TRUE;
169+ theme->bold.enable = TRUE;
123170
124171 theme->underline.fg = BGGetColor("VTUnderlineFore", theme->underline.fg, file);
125172 theme->underline.bg = BGGetColor("VTUnderlineBack", theme->underline.bg, file);
173+ theme->underline.change = TRUE;
174+ theme->underline.enable = TRUE;
126175
127176 theme->reverse.fg = BGGetColor("VTReverseFore", theme->reverse.fg, file);
128177 theme->reverse.bg = BGGetColor("VTReverseBack", theme->reverse.bg, file);
178+ theme->reverse.change = TRUE;
179+ theme->reverse.enable = TRUE;
129180
130181 theme->url.fg = BGGetColor("URLFore", theme->url.fg, file);
131182 theme->url.bg = BGGetColor("URLBack", theme->url.bg, file);
183+ theme->url.change = TRUE;
184+ theme->url.enable = TRUE;
132185 }
133186
134187 /**
135- * BGをロード
188+ * save color one attribute
136189 */
137-static void BGSaveColorOne(const TColorSetting *color, const char *key, const wchar_t *fn)
190+static void SaveColorAttr(const wchar_t *section, const wchar_t *key, const TColorSetting *color, const wchar_t *fn)
138191 {
139- char buf[512];
192+ wchar_t *buf;
140193 COLORREF fg = color->fg;
141194 COLORREF bg = color->bg;
195+ int sp_len = 20 - (int)wcslen(key);
196+ aswprintf(&buf, L"%*.*s %d,%d, %3hhu,%3hhu,%3hhu, %3hhu,%3hhu,%3hhu ; #%02x%02x%02x, #%02x%02x%02x",
197+ sp_len, sp_len, L" ",
198+ color->change, color->enable,
199+ GetRValue(fg), GetGValue(fg), GetBValue(fg),
200+ GetRValue(bg), GetGValue(bg), GetBValue(bg),
201+ GetRValue(fg), GetGValue(fg), GetBValue(fg),
202+ GetRValue(bg), GetGValue(bg), GetBValue(bg));
203+ WritePrivateProfileStringW(section, key, buf, fn);
204+ free(buf);
205+}
142206
143- sprintf(buf, "%d,%d, %d,%d,%d, %d,%d,%d", 1, 1,
144- GetRValue(fg), GetGValue(fg), GetBValue(fg),
145- GetRValue(bg), GetGValue(bg), GetBValue(bg));
146- WritePrivateProfileStringAFileW("Color Theme", key, buf, fn);
207+static void BGSaveColorOne(const TColorSetting *color, const char *key, const wchar_t *fn)
208+{
209+ const wchar_t *section = L"Color Theme";
210+ wchar_t *keyW = ToWcharA(key);
211+ SaveColorAttr(section, keyW, color, fn);
212+ free(keyW);
147213 }
148214
149-static void BGSaveColorANSI(TAnsiColorSetting *color, const wchar_t *fn)
215+static void BGSaveColorANSI(const TAnsiColorSetting *color, const wchar_t *fn)
150216 {
151217 int i;
152218 wchar_t *buff = NULL;
@@ -155,7 +221,7 @@
155221 for (i = 0; i < 16; i++) {
156222 wchar_t color_str[32];
157223 const COLORREF c = color->color[i];
158- swprintf(color_str, _countof(color_str), L"%d,%d,%d, ", GetRValue(c), GetGValue(c), GetBValue(c));
224+ swprintf(color_str, _countof(color_str), L"%hhu,%hhu,%hhu, ", GetRValue(c), GetGValue(c), GetBValue(c));
159225 awcscat(&buff, color_str);
160226 }
161227
@@ -163,8 +229,39 @@
163229 free(buff);
164230 }
165231
166-void ThemeSaveColor(TColorTheme *color_theme, const wchar_t *fn)
232+static void SaveColorOneANSI(const wchar_t *section, const wchar_t *key, const wchar_t *file, COLORREF color, int index)
167233 {
234+ const BYTE r = GetRValue(color);
235+ const BYTE g = GetGValue(color);
236+ const BYTE b = GetBValue(color);
237+ int sp_len = 20 - (int)wcslen(key);
238+ wchar_t *str;
239+ aswprintf(&str, L"%*.*s %3hhu, %3hhu, %3hhu ; #%02hhx%02hhx%02hhx ; ANSIColor[%2d]",
240+ sp_len, sp_len, L" ",
241+ r, g, b, r, g, b, index);
242+ WritePrivateProfileStringW(section, key, str, file);
243+ free(str);
244+}
245+
246+static void SaveColorANSINew(const wchar_t *section, const TAnsiColorSetting *color, const wchar_t *fname)
247+{
248+ wchar_t *str;
249+ aswprintf(&str, L"%d", color->change);
250+ WritePrivateProfileStringW(section, L"ANSIColor", str, fname);
251+ free(str);
252+
253+ for (int i = 0; i < _countof(ansi_list); i++) {
254+ const int index = ansi_list[i].index;
255+ const wchar_t *key = ansi_list[i].key;
256+ SaveColorOneANSI(section, key, fname, color->color[index], index);
257+ }
258+}
259+
260+/**
261+ * カラーテーマの保存
262+ */
263+void ThemeSaveColorOld(TColorTheme *color_theme, const wchar_t *fn)
264+{
168265 WritePrivateProfileStringAFileW("Color Theme", "Theme", "teraterm theme editor", fn);
169266
170267 BGSaveColorOne(&(color_theme->vt), "VTColor", fn);
@@ -172,10 +269,26 @@
172269 BGSaveColorOne(&(color_theme->blink), "BlinkColor", fn);
173270 BGSaveColorOne(&(color_theme->reverse), "ReverseColor", fn);
174271 BGSaveColorOne(&(color_theme->url), "URLColor", fn);
272+ BGSaveColorOne(&(color_theme->underline), "VTUnderlineColor", fn);
175273
176274 BGSaveColorANSI(&(color_theme->ansicolor), fn);
177275 }
178276
277+void ThemeSaveColor(TColorTheme *color_theme, const wchar_t *fn)
278+{
279+ const wchar_t *section = L"Color Theme";
280+ WritePrivateProfileStringW(section, L"Theme", color_theme->name, fn);
281+
282+ BGSaveColorOne(&(color_theme->vt), "VTColor", fn);
283+ BGSaveColorOne(&(color_theme->bold), "BoldColor", fn);
284+ BGSaveColorOne(&(color_theme->blink), "BlinkColor", fn);
285+ BGSaveColorOne(&(color_theme->reverse), "ReverseColor", fn);
286+ BGSaveColorOne(&(color_theme->url), "URLColor", fn);
287+ BGSaveColorOne(&(color_theme->underline), "VTUnderlineColor", fn);
288+
289+ SaveColorANSINew(section, &(color_theme->ansicolor), fn);
290+}
291+
179292 void WriteInt3(const char *Sect, const char *Key, const wchar_t *FName,
180293 int i1, int i2, int i3)
181294 {
@@ -350,9 +463,9 @@
350463 // ANSIColor16は、明るい/暗いグループが入れ替わっている
351464 const static int index256[] = {
352465 0,
466+ 1, 2, 3, 4, 5, 6, 7,
467+ 8,
353468 9, 10, 11, 12, 13, 14, 15,
354- 8,
355- 1, 2, 3, 4, 5, 6, 7
356469 };
357470
358471 GetPrivateProfileStringAFileW("Color Theme", "ANSIColor", "0", Buff, sizeof(Buff), fn);
@@ -361,7 +474,7 @@
361474 color->change = c;
362475
363476 GetNthNum(Buff, 2, &c);
364- color->enable = c;
477+ //color->enable = c;
365478
366479 for (c=0; c<16; c++) {
367480 int idx = index256[c];
@@ -396,16 +509,18 @@
396509 GetNthNum(Buff, 8, &b);
397510 color->bg = RGB(r, g, b);
398511 }
399-
400- return;
401512 }
402513
403-/*
404- * カラーテーマiniファイルをロードする
514+/**
515+ * カラーテーマプラグイン版 ini ファイル読み込み
405516 */
406-void ThemeLoadColor(const wchar_t *fn, TColorTheme *color_theme)
517+static void LoadColorPlugin(const wchar_t *fn, TColorTheme *color_theme)
407518 {
408- GetPrivateProfileStringAFileW("Color Theme", "Theme", "", color_theme->name, _countof(color_theme->name), fn);
519+ const wchar_t *section = L"Color Theme";
520+ wchar_t *name;
521+ hGetPrivateProfileStringW(section, L"Theme", NULL, fn, &name);
522+ wcscpy_s(color_theme->name, _countof(color_theme->name), name);
523+ free(name);
409524
410525 ReadColorSetting(&(color_theme->vt), "VTColor", fn);
411526 ReadColorSetting(&(color_theme->bold), "BoldColor", fn);
@@ -416,144 +531,108 @@
416531 ReadANSIColorSetting(&(color_theme->ansicolor), fn);
417532 }
418533
419-#if 0
420-#define SECTION "Color Theme"
421-
422-static void ReadANSIColorSetting(TAnsiColorSetting *color, const wchar_t *fn)
534+/**
535+ * カラーテーマファイル読み込み,1アトリビュート分
536+ */
537+static void LoadColorAttr(const wchar_t *section, const wchar_t *key, const wchar_t *file, TColorSetting *attr)
423538 {
424- char Buff[512];
425- int c, r, g, b;
539+ wchar_t *str;
540+ DWORD e = hGetPrivateProfileStringW(section, key, NULL, file, &str);
541+ if (e != 0 || *str == 0) {
542+ free(str);
543+ return;
544+ }
426545
427- GetPrivateProfileStringAFileW(SECTION, "ANSIColor", "0", Buff, sizeof(Buff), fn);
546+ BOOL change = FALSE;
547+ BOOL enable = FALSE;
548+ int fields;
428549
429- GetNthNum(Buff, 1, &c);
430- color->change = c;
550+ DWORD fore_rgb;
551+ DWORD back_rgb;
552+ fields = swscanf_s(str, L"%d, %d, #%06x, #%06x", &change, &enable, &fore_rgb, &back_rgb);
553+ if (fields == 4) {
554+ free(str);
555+ attr->change = change;
556+ attr->enable = enable;
557+ attr->fg = RGB((fore_rgb & 0xff0000) >> 16, (fore_rgb & 0x00ff00) >> 8, (fore_rgb & 0x0000ff));
558+ attr->bg = RGB((back_rgb & 0xff0000) >> 16, (back_rgb & 0x00ff00) >> 8, (back_rgb & 0x0000ff));
559+ return;
560+ }
431561
432- GetNthNum(Buff, 2, &c);
433- color->enable = c;
434-
435- for (c=0; c<16; c++) {
436- GetNthNum(Buff, c * 3 + 3, &r);
437- GetNthNum(Buff, c * 3 + 4, &g);
438- GetNthNum(Buff, c * 3 + 5, &b);
439- color->color[c] = RGB(r, g, b);
562+ BYTE fg_red, fg_green, fg_blue;
563+ BYTE bg_red, bg_green, bg_blue;
564+ fields = swscanf_s(str, L"%d, %d, %hhu, %hhu, %hhu, %hhu, %hhu, %hhu", &change, &enable, &fg_red, &fg_green,
565+ &fg_blue, &bg_red, &bg_green, &bg_blue);
566+ if (fields == 8) {
567+ free(str);
568+ attr->change = change;
569+ attr->enable = enable;
570+ attr->fg = RGB(fg_red, fg_green, fg_blue);
571+ attr->bg = RGB(bg_red, bg_green, bg_blue);
572+ return;
440573 }
441-
442- return;
574+ fields = swscanf_s(str, L"%d, %d", &change, &enable);
575+ if (fields == 2) {
576+ free(str);
577+ attr->change = change;
578+ attr->enable = FALSE; // 色指定が読めなかったので、文字属性の独自色は無効
579+ return;
580+ }
581+ fields = swscanf_s(str, L"%d", &change);
582+ free(str);
583+ if (fields == 1) {
584+ attr->change = FALSE; // 色変更はしない
585+ return;
586+ }
443587 }
444588
445-static void ReadColorSetting(TColorSetting *color, char *ent, const wchar_t *fn)
589+/*
590+ * color theme用ロード
591+ */
592+static void ThemeLoadColorDraft(const wchar_t *file, TColorTheme *theme)
446593 {
447- char Key[32], Buff[512];
448- int c, r, g, b;
594+ const wchar_t *section = L"Color Theme";
449595
450- _snprintf_s(Key, sizeof(Key), _TRUNCATE, "%s", ent);
451- GetPrivateProfileStringAFileW(SECTION, Key, "0", Buff, sizeof(Buff), fn);
596+ wchar_t *name;
597+ hGetPrivateProfileStringW(section, L"Theme", NULL, file, &name);
598+ wcscpy_s(theme->name, _countof(theme->name), name);
599+ free(name);
452600
453- GetNthNum(Buff, 1, &c);
454- color->change = c;
601+ struct {
602+ const wchar_t *key;
603+ TColorSetting *color;
604+ } attr_list[] = {
605+ L"VTColor", &(theme->vt),
606+ L"BoldColor", &(theme->bold),
607+ L"BlinkColor", &(theme->blink),
608+ L"ReverseColor", &(theme->reverse),
609+ L"URLColor", &(theme->url),
610+ L"VTUnderlineColor", &(theme->underline),
611+ };
612+ for (int i = 0; i < _countof(attr_list); i++) {
613+ LoadColorAttr(section, attr_list[i].key, file, attr_list[i].color);
614+ }
455615
456- GetNthNum(Buff, 2, &c);
457- color->enable = c;
458-
459- GetNthNum(Buff, 3, &r);
460- GetNthNum(Buff, 4, &g);
461- GetNthNum(Buff, 5, &b);
462- color->fg = RGB(r, g, b);
463-
464- GetNthNum(Buff, 6, &r);
465- GetNthNum(Buff, 7, &g);
466- GetNthNum(Buff, 8, &b);
467- color->bg = RGB(r, g, b);
616+ theme->ansicolor.change = (BOOL)GetPrivateProfileIntW(section, L"ANSIColor", 1, file);
617+ for (int i = 0; i < _countof(ansi_list); i++) {
618+ const int index = ansi_list[i].index;
619+ const wchar_t *key = ansi_list[i].key;
620+ theme->ansicolor.color[index] = LoadColorOneANSI(section, key, file, theme->ansicolor.color[index]);
621+ }
468622 }
469623
470-static void ReadColorSetting(TColorSetting *color, char *ent, const wchar_t *fn)
471-{
472- char Key[32], Buff[512];
473- int c, r, g, b;
474-
475- _snprintf_s(Key, sizeof(Key), _TRUNCATE, "%s", ent);
476- GetPrivateProfileStringAFileW(SECTION, Key, "0", Buff, sizeof(Buff), fn);
477-
478- GetNthNum(Buff, 1, &c);
479- color->change = c;
480-
481- GetNthNum(Buff, 2, &c);
482- color->enable = c;
483-
484- GetNthNum(Buff, 3, &r);
485- GetNthNum(Buff, 4, &g);
486- GetNthNum(Buff, 5, &b);
487- color->fg = RGB(r, g, b);
488-
489- GetNthNum(Buff, 6, &r);
490- GetNthNum(Buff, 7, &g);
491- GetNthNum(Buff, 8, &b);
492- color->bg = RGB(r, g, b);
493-}
494-
495-static void ReadColorTheme(const wchar_t *fn, TColorTheme *data)
496-{
497- memset(data, 0, sizeof(*data));
498-
499- GetPrivateProfileStringAFileW(SECTION, "Theme", "", data->name,
500- sizeof(data->name), fn);
501- if (data->name[0] == '\0')
502- return;
503-
504- ReadColorSetting(&data->vt, "VTColor", fn);
505- ReadColorSetting(&data->bold, "BoldColor", fn);
506- ReadColorSetting(&data->blink, "BlinkColor", fn);
507- ReadColorSetting(&data->reverse, "ReverseColor", fn);
508- ReadColorSetting(&data->url, "URLColor", fn);
509-
510- ReadANSIColorSetting(&data->ansicolor, fn);
511-}
512-
513-#endif
514-
515-#if 0
516-static void WriteInt(PCHAR Sect, PCHAR Key, const wchar_t *FName, int i)
517-{
518- char Temp[15];
519- _snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%d", i);
520- WritePrivateProfileStringAFileW(Sect, Key, Temp, FName);
521-}
522-#endif
523-
524-/**
525- * テーマファイルの書き込み
624+/*
625+ * カラーテーマiniファイルをロードする
526626 */
527-#if 0
528-void BGWriteThemeFile(const wchar_t *theme_file)
627+void ThemeLoadColor(const wchar_t *fn, TColorTheme *color_theme)
529628 {
530- WritePrivateProfileStringAFileW(BG_SECTION, BG_DESTFILE, BGDest.file, theme_file);
531- BGSrc1.alpha = GetPrivateProfileIntAFileW(BG_SECTION, "BGSrc1Alpha", BGSrc1.alpha, theme_file);
532- WriteInt(BG_SECTION, BG_THEME_IMAGE_BRIGHTNESS1, theme_file, BGSrc1.alpha);
533- WriteInt(BG_SECTION, BG_THEME_IMAGE_BRIGHTNESS2, theme_file, BGSrc2.alpha);
629+ ThemeGetColorDefault(color_theme);
630+ LoadColorPlugin(fn, color_theme);
631+ ThemeLoadColorOld(fn, color_theme);
632+ ThemeLoadColorDraft(fn, color_theme);
534633 }
535-#endif
536634
537635 /**
538- * テーマファイルの書き込み
539- */
540-#if 0
541-static void BGWriteIniFile(const wchar_t *file)
542-{
543- WritePrivateProfileStringAFileW(BG_SECTION, BG_DESTFILE, BGDest.file, file);
544- WritePrivateProfileStringAFileW(BG_SECTION, "BGDestType",
545- BGDest.type == BG_PICTURE ? "picture" : "color", file);
546- WriteCOLORREF(BG_SECTION, "BGDestColor", file, BGDest.color);
547- WritePrivateProfileStringAFileW(BG_SECTION, "BGDestPattern", GetBGPatternStr(BGDest.pattern), file);
548-
549- WritePrivateProfileIntAFileW(BG_SECTION, "BGSrc1Alpha", BGSrc1.alpha, file);
550-
551- WritePrivateProfileIntAFileW(BG_SECTION, "BGSrc2Alpha", BGSrc2.alpha, file);
552- WriteCOLORREF(BG_SECTION, "BGSrc2Color", file, BGSrc2.color);
553-}
554-#endif
555-
556-/**
557636 * テーマファイルを読み込む
558637 *
559638 * @param file ファイル名
--- trunk/teraterm/teraterm/vtdisp.c (revision 10302)
+++ trunk/teraterm/teraterm/vtdisp.c (revision 10303)
@@ -3583,18 +3583,34 @@
35833583 {
35843584 int i;
35853585
3586+ wcscpy_s(data->name, _countof(data->name), L"Tera Term color theme");
3587+ data->vt.change = TRUE;
3588+ data->vt.enable = TRUE;
35863589 data->vt.fg = BGVTColor[0];
35873590 data->vt.bg = BGVTColor[1];
3591+ data->bold.change = TRUE;
3592+ data->bold.enable = TRUE;
35883593 data->bold.fg = BGVTBoldColor[0];
35893594 data->bold.bg = BGVTBoldColor[1];
3595+ data->underline.change = TRUE;
3596+ data->underline.enable = TRUE;
35903597 data->underline.fg = BGVTUnderlineColor[0];
35913598 data->underline.bg = BGVTUnderlineColor[1];
3599+ data->blink.change = TRUE;
3600+ data->blink.enable = TRUE;
35923601 data->blink.fg = BGVTBlinkColor[0];
35933602 data->blink.bg = BGVTBlinkColor[1];
3603+ data->reverse.change = TRUE;
3604+ data->reverse.enable = TRUE;
35943605 data->reverse.fg = BGVTReverseColor[0];
35953606 data->reverse.bg = BGVTReverseColor[1];
3607+ data->url.change = TRUE;
3608+ data->url.enable = TRUE;
35963609 data->url.fg = BGURLColor[0];
35973610 data->url.bg = BGURLColor[1];
3611+
3612+ // ANSI color
3613+ data->ansicolor.change = TRUE;
35983614 for (i = 0; i < 16; i++) {
35993615 data->ansicolor.color[i] = ANSIColor[i];
36003616 }
--- trunk/teraterm/teraterm/vtdisp.h (revision 10302)
+++ trunk/teraterm/teraterm/vtdisp.h (revision 10303)
@@ -150,6 +150,7 @@
150150 extern BOOL IMEstat;
151151 extern BOOL IMECompositionState;
152152
153+// for DispHScroll(), DispVScroll()
153154 #define SCROLL_BOTTOM 1
154155 #define SCROLL_LINEDOWN 2
155156 #define SCROLL_LINEUP 3
@@ -158,6 +159,7 @@
158159 #define SCROLL_POS 6
159160 #define SCROLL_TOP 7
160161
162+// for DispShowWindow()
161163 #define WINDOW_MINIMIZE 1
162164 #define WINDOW_MAXIMIZE 2
163165 #define WINDOW_RESTORE 3
@@ -166,8 +168,6 @@
166168 #define WINDOW_REFRESH 6
167169 #define WINDOW_TOGGLE_MAXIMIZE 7
168170
169-#include "theme.h"
170-
171171 #ifdef __cplusplus
172172 }
173173 #endif
Show on old repository browser