設定ダイアログのカラーパレット変更で正しくない色番号が変更されるので修正
ticket #45559
@@ -63,6 +63,7 @@ | ||
63 | 63 | <li>Fixed wrong value is written to VTReverseColor when saving TERATERM.INI during reverse video.</li> |
64 | 64 | <li>Fixed problem with color number 1-7 and 9-15 are replaced in sequence OCS 4. |
65 | 65 | <!--li>TERATERM.INI の MouseCursor の設定値が小文字だと Additional settings ダイアログに反映されない問題を修正</li--> |
66 | + <li>Fixed wrong color numbers were changed when the color palette change in Visual Tab in Additional settings dialog.</li> | |
66 | 67 | </ul> |
67 | 68 | </li> |
68 | 69 |
@@ -63,6 +63,7 @@ | ||
63 | 63 | <li>反転表示時にTERATERM.INIを保存すると、VTReverseColor に誤った値が書き込まれる問題を修正した。</li> |
64 | 64 | <li>シーケンス OSC 4 の色番号 1-7と9-15が入れ替わっていた問題を修正した。</li> |
65 | 65 | <li>TERATERM.INI の MouseCursor の設定値が小文字だと Additional settings ダイアログに反映されない問題を修正</li> |
66 | + <li>その他の設定ダイアログの表示タブのカラーパレット変更で正しくない色番号が変更される問題を修正した。</li> | |
66 | 67 | </ul> |
67 | 68 | </li> |
68 | 69 |
@@ -40,6 +40,7 @@ | ||
40 | 40 | #define _CRTDBG_MAP_ALLOC |
41 | 41 | #include <stdlib.h> |
42 | 42 | #include <crtdbg.h> |
43 | +#include <assert.h> | |
43 | 44 | |
44 | 45 | #include "teraterm.h" |
45 | 46 | #include "tttypes.h" |
@@ -62,9 +63,29 @@ | ||
62 | 63 | }; |
63 | 64 | #define MOUSE_CURSOR_MAX (sizeof(MouseCursor)/sizeof(MouseCursor[0]) - 1) |
64 | 65 | |
66 | +/** | |
67 | + * ANSI Color の index を変換する | |
68 | + * ts.ANSIColor と 256色カラー で異なっている | |
69 | + * 1-7 ⇒ 9-15 | |
70 | + * 9-15 ⇒ 1-7 | |
71 | + */ | |
72 | +static int ConvertColorIndex(int index) | |
73 | +{ | |
74 | + if (index > 15) { | |
75 | + assert(FALSE); | |
76 | + return index; | |
77 | + } | |
78 | + else if (index == 0 || index == 8) { | |
79 | + return index; | |
80 | + } | |
81 | + else { | |
82 | + return index ^ 8; | |
83 | + } | |
84 | +} | |
85 | + | |
65 | 86 | void CVisualPropPageDlg::SetupRGBbox(int index) |
66 | 87 | { |
67 | - COLORREF Color = ts.ANSIColor[index]; | |
88 | + COLORREF Color = ts.ANSIColor[ConvertColorIndex(index)]; | |
68 | 89 | BYTE c; |
69 | 90 | |
70 | 91 | c = GetRValue(Color); |
@@ -1021,7 +1042,7 @@ | ||
1021 | 1042 | } |
1022 | 1043 | |
1023 | 1044 | // OK を押さなくても設定が保存されている |
1024 | - ts.ANSIColor[sel] = RGB(r, g, b); | |
1045 | + ts.ANSIColor[ConvertColorIndex(sel)] = RGB(r, g, b); | |
1025 | 1046 | |
1026 | 1047 | ::InvalidateRect(GetDlgItem(IDC_SAMPLE_COLOR), NULL, TRUE); |
1027 | 1048 | } |