[ttssh2-commit] [10269] ANSIColorを設定した文字の前景色と背景色を入れ替えるようにした

Back to archive index
scmno****@osdn***** scmno****@osdn*****
2022年 9月 17日 (土) 15:21:41 JST


Revision: 10269
          https://osdn.net/projects/ttssh2/scm/svn/commits/10269
Author:   zmatsuo
Date:     2022-09-17 15:21:40 +0900 (Sat, 17 Sep 2022)
Log Message:
-----------
ANSIColorを設定した文字の前景色と背景色を入れ替えるようにした

- 文字アトリビュート設定をTera Term5からバックポート
- DECSCNM setで色反転時に、属性にANSIColorを設定した文字の前景色と背景色を入れ替えるようにした

MFT r10192, r10198, r10201, r10203, r10208, r10214, r10216, r10217, r10219, r10222, r10229, r10230, r10231

Revision Links:
--------------
    https://osdn.net/projects/ttssh2/scm/svn/commits/10192
    https://osdn.net/projects/ttssh2/scm/svn/commits/10198
    https://osdn.net/projects/ttssh2/scm/svn/commits/10201
    https://osdn.net/projects/ttssh2/scm/svn/commits/10203
    https://osdn.net/projects/ttssh2/scm/svn/commits/10208
    https://osdn.net/projects/ttssh2/scm/svn/commits/10214
    https://osdn.net/projects/ttssh2/scm/svn/commits/10216
    https://osdn.net/projects/ttssh2/scm/svn/commits/10217
    https://osdn.net/projects/ttssh2/scm/svn/commits/10219
    https://osdn.net/projects/ttssh2/scm/svn/commits/10222
    https://osdn.net/projects/ttssh2/scm/svn/commits/10229
    https://osdn.net/projects/ttssh2/scm/svn/commits/10230
    https://osdn.net/projects/ttssh2/scm/svn/commits/10231

Modified Paths:
--------------
    branches/4-stable/doc/en/html/about/history.html
    branches/4-stable/doc/ja/html/about/history.html
    branches/4-stable/teraterm/teraterm/addsetting.cpp
    branches/4-stable/teraterm/teraterm/vtdisp.c
    branches/4-stable/teraterm/teraterm/vtdisp.h
    branches/4-stable/teraterm/teraterm/vtterm.c
    branches/4-stable/teraterm/ttpdlg/ttdlg.c
    branches/4-stable/teraterm/ttpset/ttset.c

-------------- next part --------------
Modified: branches/4-stable/doc/en/html/about/history.html
===================================================================
--- branches/4-stable/doc/en/html/about/history.html	2022-09-14 14:16:07 UTC (rev 10268)
+++ branches/4-stable/doc/en/html/about/history.html	2022-09-17 06:21:40 UTC (rev 10269)
@@ -47,6 +47,7 @@
           <li>\x83f\x83t\x83H\x83\x8B\x83g\x82ɁAini \x83t\x83@\x83C\x83\x8B\x82\xCC TransBin\x90ݒ\xE8\x82𔽉f\x82\xB7\x82\xE9\x82悤\x82ɂ\xB5\x82\xBD\x81B</li>
           <li>"\x8E\x9F\x82̃h\x83\x8D\x83b\x83v\x8E\x9E\x81A\x93\xAF\x82\xB6\x8F\x88\x97\x9D\x82\xF0\x8Ds\x82\xA4"\x83`\x83F\x83b\x83N\x8E\x9E\x82ɁA\x8BL\x89\xAF\x82\xB7\x82\xE9\x82悤\x82ɂ\xB5\x82\xBD\x81B</li>
       </ul></li-->
+      <li>Exchanged fore and back colors of characters that attributes is setted ANSIColor when colors are reversed with DECSCNM set.</li>
     </ul>
   </li>
 

Modified: branches/4-stable/doc/ja/html/about/history.html
===================================================================
--- branches/4-stable/doc/ja/html/about/history.html	2022-09-14 14:16:07 UTC (rev 10268)
+++ branches/4-stable/doc/ja/html/about/history.html	2022-09-17 06:21:40 UTC (rev 10269)
@@ -47,6 +47,7 @@
           <li>\x83f\x83t\x83H\x83\x8B\x83g\x82ɁAini \x83t\x83@\x83C\x83\x8B\x82\xCC TransBin\x90ݒ\xE8\x82𔽉f\x82\xB7\x82\xE9\x82悤\x82ɂ\xB5\x82\xBD\x81B</li>
           <li>"\x8E\x9F\x82̃h\x83\x8D\x83b\x83v\x8E\x9E\x81A\x93\xAF\x82\xB6\x8F\x88\x97\x9D\x82\xF0\x8Ds\x82\xA4"\x83`\x83F\x83b\x83N\x8E\x9E\x82ɁA\x8BL\x89\xAF\x82\xB7\x82\xE9\x82悤\x82ɂ\xB5\x82\xBD\x81B</li>
       </ul></li>
+      <li>DECSCNM set\x82ŐF\x94\xBD\x93]\x8E\x9E\x82ɁA\x91\xAE\x90\xAB\x82\xC9ANSIColor\x82\xF0\x90ݒ肵\x82\xBD\x95\xB6\x8E\x9A\x82̑O\x8Ci\x90F\x82Ɣw\x8Ci\x90F\x82\xF0\x93\xFC\x82\xEA\x91ւ\xA6\x82\xE9\x82悤\x82ɂ\xB5\x82\xBD\x81B</li>
     </ul>
   </li>
 

Modified: branches/4-stable/teraterm/teraterm/addsetting.cpp
===================================================================
--- branches/4-stable/teraterm/teraterm/addsetting.cpp	2022-09-14 14:16:07 UTC (rev 10268)
+++ branches/4-stable/teraterm/teraterm/addsetting.cpp	2022-09-17 06:21:40 UTC (rev 10269)
@@ -1115,7 +1115,6 @@
 {
 	int sel;
 	char buf[MAXPATHLEN];
-	COLORREF TmpColor;
 	int flag_changed = 0;
 
 	// (1)
@@ -1211,27 +1210,7 @@
 	}
 
 	// (8) Attr Reverse Color
-	if (ts.ColorFlag & CF_REVERSEVIDEO) { // Reverse Video\x83\x82\x81[\x83h(DECSCNM)\x8E\x9E\x82͏\x88\x97\x9D\x82\xF0\x95ς\xA6\x82\xE9
-		if (ts.ColorFlag & CF_REVERSECOLOR) {
-			if (!GetCheck(IDC_ENABLE_ATTR_COLOR_REVERSE)) {
-				TmpColor = ts.VTColor[0];
-				ts.VTColor[0] = ts.VTReverseColor[1];
-				ts.VTReverseColor[1] = ts.VTColor[1];
-				ts.VTColor[1] = ts.VTReverseColor[0];
-				ts.VTReverseColor[0] = TmpColor;
-				ts.ColorFlag ^= CF_REVERSECOLOR;
-			}
-		}
-		else if (GetCheck(IDC_ENABLE_ATTR_COLOR_REVERSE)) {
-			TmpColor = ts.VTColor[0];
-			ts.VTColor[0] = ts.VTReverseColor[0];
-			ts.VTReverseColor[0] = ts.VTColor[1];
-			ts.VTColor[1] = ts.VTReverseColor[1];
-			ts.VTReverseColor[1] = TmpColor;
-			ts.ColorFlag ^= CF_REVERSECOLOR;
-		}
-	}
-	else if (((ts.ColorFlag & CF_REVERSECOLOR) != 0) != GetCheck(IDC_ENABLE_ATTR_COLOR_REVERSE)) {
+	if (((ts.ColorFlag & CF_REVERSECOLOR) != 0) != GetCheck(IDC_ENABLE_ATTR_COLOR_REVERSE)) {
 		ts.ColorFlag ^= CF_REVERSECOLOR;
 	}
 

Modified: branches/4-stable/teraterm/teraterm/vtdisp.c
===================================================================
--- branches/4-stable/teraterm/teraterm/vtdisp.c	2022-09-14 14:16:07 UTC (rev 10268)
+++ branches/4-stable/teraterm/teraterm/vtdisp.c	2022-09-17 06:21:40 UTC (rev 10269)
@@ -1658,37 +1658,6 @@
 
 }
 
-void BGExchangeColor() {
-	COLORREF ColorRef;
-      if (ts.ColorFlag & CF_REVERSECOLOR) {
-        ColorRef = BGVTColor[0];
-        BGVTColor[0] = BGVTReverseColor[0];
-        BGVTReverseColor[0] = ColorRef;
-        ColorRef = BGVTColor[1];
-        BGVTColor[1] = BGVTReverseColor[1];
-        BGVTReverseColor[1] = ColorRef;
-      }
-      else {
-        ColorRef = BGVTColor[0];
-        BGVTColor[0] = BGVTColor[1];
-        BGVTColor[1] = ColorRef;
-      }
-
-      ColorRef = BGVTBoldColor[0];
-      BGVTBoldColor[0] = BGVTBoldColor[1];
-      BGVTBoldColor[1] = ColorRef;
-
-      ColorRef = BGVTBlinkColor[0];
-      BGVTBlinkColor[0] = BGVTBlinkColor[1];
-      BGVTBlinkColor[1] = ColorRef;
-
-      ColorRef = BGURLColor[0];
-      BGURLColor[0] = BGURLColor[1];
-      BGURLColor[1] = ColorRef;
-
-//    BGReverseText = !BGReverseText;
-}
-
 void BGFillRect(HDC hdc,RECT *R,HBRUSH brush)
 {
   if(!BGEnable)
@@ -1790,21 +1759,11 @@
 //-->
 #endif  // ALPHABLEND_TYPE2
 
-void DispApplyANSIColor() {
+static void DispApplyANSIColor(void) {
   int i;
 
   for (i = IdBack ; i <= IdFore+8 ; i++)
     ANSIColor[i] = ts.ANSIColor[i];
-
-  if ((ts.ColorFlag & CF_USETEXTCOLOR)!=0) {
-#ifdef ALPHABLEND_TYPE2
-    ANSIColor[IdBack ] = BGVTColor[1]; // use background color for "Black"
-    ANSIColor[IdFore ] = BGVTColor[0]; // use text color for "white"
-#else
-    ANSIColor[IdBack ] = ts.VTColor[1]; // use background color for "Black"
-    ANSIColor[IdFore ] = ts.VTColor[0]; // use text color for "white"
-#endif
-  }
 }
 
 void InitColorTable()
@@ -2544,22 +2503,6 @@
   /* Change caret shape */
   ChangeCaret();
 
-  if ((ts.ColorFlag & CF_USETEXTCOLOR)==0)
-  {
-    ANSIColor[IdFore ]   = ts.ANSIColor[IdFore ];
-    ANSIColor[IdBack ]   = ts.ANSIColor[IdBack ];
-  }
-  else { // use text (background) color for "white (black)"
-    ANSIColor[IdFore ]   = ts.VTColor[0];
-    ANSIColor[IdBack ]   = ts.VTColor[1];
-
-#ifdef ALPHABLEND_TYPE2
-	ANSIColor[IdFore ]   = BGVTColor[0];
-	ANSIColor[IdBack ]   = BGVTColor[1];
-#endif  // ALPHABLEND_TYPE2
-
-  }
-
   /* change background color */
   DispChangeBackground();
 }
@@ -2602,17 +2545,8 @@
   VTDC = NULL;
 }
 
-#define isURLColored(x) ((ts.ColorFlag & CF_URLCOLOR) && ((x).Attr & AttrURL))
-#define isURLUnderlined(x) ((ts.FontFlag & FF_URLUNDERLINE) && ((x).Attr & AttrURL))
-#define isBoldColored(x) ((ts.ColorFlag & CF_BOLDCOLOR) && ((x).Attr & AttrBold))
-#define isBlinkColored(x) ((ts.ColorFlag & CF_BLINKCOLOR) && ((x).Attr & AttrBlink))
-#define isReverseColored(x) ((ts.ColorFlag & CF_REVERSECOLOR) && ((x).Attr & AttrReverse))
-#define isForeColored(x) ((ts.ColorFlag & CF_ANSICOLOR) && ((x).Attr2 & Attr2Fore))
-#define isBackColored(x) ((ts.ColorFlag & CF_ANSICOLOR) && ((x).Attr2 & Attr2Back))
-
 /**
- * \x95\xB6\x8E\x9A\x90F\x81E\x94w\x8Ci\x90F\x82\xF0\x90ݒ肷\x82\xE9
- *   \x83V\x81[\x83P\x83\x93\x83X\x82̐F\x94ԍ\x86\x82\xA9\x82\xE7 ANSIColor[] \x82̐F\x82𓾂鏈\x97\x9D\x82\xAA\x8A܂܂\xEA\x82\xE9
+ * \x83V\x81[\x83P\x83\x93\x83X\x82\xCCcolor_index\x82\xF0ANSIColor[]\x82\xCCindex\x82֕ϊ\xB7\x82\xB7\x82\xE9
  *
  * ANSIColor[] \x82\xCC 0-7 \x82ɂ͌\xB4\x90F(\x96\xBE\x82邢\x90F)\x81A8-15 \x82ɂ͏\xAD\x82\xB5\x88Â\xA2\x90F\x82\xAA\x93\xFC\x82\xC1\x82Ă\xA2\x82\xE9
  *   0: Black   8: Gray (Bright Black)
@@ -2624,202 +2558,250 @@
  * PC-style 16 colors
  *   Bold \x91\xAE\x90\xAB\x82ƕ\xB6\x8E\x9A\x90F\x91\xAE\x90\xAB(0-7)\x82̑g\x82ݍ\x87\x82킹\x82Ŗ\xBE\x82邢\x95\xB6\x8E\x9A\x90F\x82\xF0\x95\\x82\xB7
  *   Blink \x91\xAE\x90\xAB\x82Ɣw\x8Ci\x90F\x91\xAE\x90\xAB(0-7)\x82̑g\x82ݍ\x87\x82킹\x82Ŗ\xBE\x82邢\x94w\x8Ci\x90F\x82\xF0\x95\\x82\xB7
- * - \x82\xBB\x82̂\xBD\x82\xDF CF_PCBOLD16 \x82\xAA\x97L\x8C\xF8\x82ŁA\x95\xB6\x8E\x9A\x90F\x82\xAA Bold \x82̂Ƃ\xAB\x81E\x94w\x8Ci\x90F\x82\xAA Blink \x82̂Ƃ\xAB\x82\xCD
+ * - \x82\xBB\x82̂\xBD\x82\xDF CF_PCBOLD16 \x82\xAA\x97L\x8C\xF8\x82\xC5 pcbold16_bright \x82\xAA true \x82̂Ƃ\xAB\x82\xCD
  * \x8C\xB4\x90F(\x96\xBE\x82邢\x90F)\x82ɂȂ\xE9\x82悤 1-7 \x82͓\xFC\x82\xEA\x91ւ\xA6\x82Ȃ\xA2\x81B
  * - CF_PCBOLD16 \x82\xAA\x96\xB3\x8C\xF8\x82ȂƂ\xAB\x82ɂ\xCD 1-7 \x82\xF0\x93\xFC\x82\xEA\x91ւ\xA6\x82\xE9\x81B
  *   \x82\xB1\x82̑g\x82ݍ\x87\x82킹\x82Ŗ\xBE\x82邢\x90F\x82\xF0\x95\\x82\xB7\x82̂\xCD PC-style \x82\xBE\x82\xAF\x82Ȃ̂œ\xFC\x82\xEA\x91ւ\xA6\x82\xE9\x81B
  * - 9-15 \x82͏\xED\x82ɓ\xFC\x82\xEA\x91ւ\xA6\x82\xE9\x81B
- *   CF_PCBOLD16 \x82\xAA\x97L\x8C\xF8\x82ŁA\x95\xB6\x8E\x9A\x90F\x82\xAA Bold \x82̂Ƃ\xAB\x81E\x94w\x8Ci\x90F\x82\xAA Blink \x82̂Ƃ\xAB\x82\xCD 1-7 \x82\xE0 9-15 \x82\xE0
+ *   CF_PCBOLD16 \x82\xAA\x97L\x8C\xF8\x82\xC5 pcbold16_bright \x82\xAA true \x82̂Ƃ\xAB\x82\xCD 1-7 \x82\xE0 9-15 \x82\xE0
  * \x96\xBE\x82邢\x90F\x82ɂȂ邪\x81A9-15 \x82͑\xBC\x82̊g\x92\xA3\x83\x82\x81[\x83h\x82Ŏg\x82\xED\x82\xEA\x82\xE9\x81B
- */
+ *
+ * @param color_index
+ * @param pcbold16				0/0\x88ȊO = 16 color mode PC Style\x82ł͂Ȃ\xA2/\x82ł\xA0\x82\xE9
+ * @param pcbold16_bright		0/0\x88ȊO = \x90F\x82𖾂邭\x82\xB5\x82Ȃ\xA2/\x82\xB7\x82\xE9
+ * @return ANSIColor[]\x82\xCCindex
+*/
+static int Get256ColorIndex(int color_index, int pcbold16, int pcbold16_bright)
+{
+	int table_index;
+	if ((ts.ColorFlag & CF_FULLCOLOR) == 0) {
+		// 8\x90F\x83\x82\x81[\x83h
+		//		table index		default color
+		//		0    			\x8D\x95,Black
+		//		1-7  			\x96\xBE\x82邢\x90F,\x8C\xB4\x90F (Bright color)
+		table_index = color_index;
+	}
+	else {
+		// 16/256\x90F
+		if (color_index < 8 && (pcbold16 != 0)) {
+			//		index-> table index		default color
+			//	not bright\x8E\x9E
+			//		0    -> 0   (\x95ω\xBB\x82Ȃ\xB5)	\x8D\x95,Black
+			//		1-7  -> 9-15			\x8F\xAD\x82\xB5\x88Â\xA2\x90F
+			//	bright\x8E\x9E
+			//		0    -> 0   (\x95ω\xBB\x82Ȃ\xB5)	\x8D\x95,Black
+			//		1-7  -> 1-7 (\x95ω\xBB\x82Ȃ\xB5)	\x96\xBE\x82邢\x90F,\x8C\xB4\x90F (Bright color)
+			if ((pcbold16_bright != 0) == (color_index != 0)) {
+				table_index = color_index;
+			}
+			else {
+				table_index = color_index ^ 8;
+			}
+		}
+		else {
+			//		index-> table index		default color
+			//		0    -> 0   (\x95ω\xBB\x82Ȃ\xB5)	\x8D\x95,Black
+			//		1-7  -> 9-15			\x8F\xAD\x82\xB5\x88Â\xA2\x90F
+			//		8    -> 8   (\x95ω\xBB\x82Ȃ\xB5)	\x8AD\x90F, Bright Black (Gray)
+			//		9-15 -> 1-7				\x96\xBE\x82邢\x90F,\x8C\xB4\x90F (Bright color)
+			//		16-  -> 16- (\x95ω\xBB\x82Ȃ\xB5)
+			if (color_index < 16 && (color_index & 7) != 0) {
+				// color_index \x82\xAA 1-7,9-15 \x82̂Ƃ\xAB
+				table_index = color_index ^ 8;
+			}
+			else {
+				table_index = color_index;
+			}
+		}
+	}
+	return table_index;
+}
+
 void DispSetupDC(TCharAttr Attr, BOOL Reverse)
 // Setup device context
 //   Attr: character attributes
 //   Reverse: true if text is selected (reversed) by mouse
 {
-  COLORREF TextColor, BackColor;
-  int NoReverseColor = 2;
+	COLORREF TextColor, BackColor;
+	WORD AttrFlag;	// Attr + Flag
+	WORD Attr2Flag;	// Attr2 + Flag
+	BOOL reverse;
+	const BOOL use_normal_bg_color = ts.UseNormalBGColor;
 
-  if (VTDC==NULL)  DispInitDC();
+	// ts.ColorFlag \x82\xC6 Attr \x82\xF0\x8D\x87\x90\xAC\x82\xB5\x82\xBD Attr \x82\xF0\x8D\xEC\x82\xE9
+	AttrFlag = 0;
+	AttrFlag |= ((ts.ColorFlag & CF_URLCOLOR) && (Attr.Attr & AttrURL)) ? AttrURL : 0;
+	//AttrFlag |= ((ts.ColorFlag & CF_UNDERLINE) && (Attr.Attr & AttrUnder)) ? AttrUnder : 0;
+	AttrFlag |= ((ts.ColorFlag & CF_URLCOLOR) && (Attr.Attr & AttrUnder)) ? AttrUnder : 0;
+	AttrFlag |= ((ts.ColorFlag & CF_BOLDCOLOR) && (Attr.Attr & AttrBold)) ? AttrBold : 0;
+	AttrFlag |= ((ts.ColorFlag & CF_BLINKCOLOR) && (Attr.Attr & AttrBlink)) ? AttrBlink : 0;
+	AttrFlag |= ((ts.ColorFlag & CF_REVERSECOLOR) && (Attr.Attr & AttrReverse)) ? AttrReverse : 0;
+	Attr2Flag = 0;
+	Attr2Flag |= ((ts.ColorFlag & CF_ANSICOLOR) && (Attr.Attr2 & Attr2Fore)) ? Attr2Fore : 0;
+	Attr2Flag |= ((ts.ColorFlag & CF_ANSICOLOR) && (Attr.Attr2 & Attr2Back)) ? Attr2Back : 0;
 
-  if (TCharAttrCmp(DCAttr, Attr) == 0 && DCReverse == Reverse) {
-    return;
-  }
-  DCAttr = Attr;
-  DCReverse = Reverse;
+	if (VTDC == NULL)
+		DispInitDC();
 
-  SelectObject(VTDC, VTFont[(Attr.Attr & AttrFontMask) | (isURLUnderlined(Attr)?AttrUnder:0)]);
+	// \x94\xBD\x93]
+	reverse = FALSE;
+	if (Reverse) {
+		reverse = TRUE;
+	}
+	if ((AttrFlag & AttrReverse) != 0) {
+		reverse = reverse ? FALSE : TRUE;
+	}
+	if ((ts.ColorFlag & CF_REVERSEVIDEO) != 0) {
+		reverse = reverse ? FALSE : TRUE;
+	}
 
-  if ((ts.ColorFlag & CF_FULLCOLOR) == 0) {
-	if (isBlinkColored(Attr)) {
-#ifdef ALPHABLEND_TYPE2 // AKASI
-	  TextColor = BGVTBlinkColor[0];
-	  BackColor = BGVTBlinkColor[1];
-#else
-	  TextColor = ts.VTBlinkColor[0];
-	  BackColor = ts.VTBlinkColor[1];
-#endif
+	if (TCharAttrCmp(DCAttr, Attr) == 0 && DCReverse == reverse) {
+		return;
 	}
-	else if (isBoldColored(Attr)) {
-#ifdef ALPHABLEND_TYPE2 // AKASI
-	  TextColor = BGVTBoldColor[0];
-	  BackColor = BGVTBoldColor[1];
-#else
-	  TextColor = ts.VTBoldColor[0];
-	  BackColor = ts.VTBoldColor[1];
-#endif
+	DCAttr = Attr;
+	DCReverse = reverse;
+
+	// \x83t\x83H\x83\x93\x83g\x90ݒ\xE8
+	if (((ts.FontFlag & FF_URLUNDERLINE) && (Attr.Attr & AttrURL)) ||
+		//((ts.FontFlag & FF_UNDERLINE) && (Attr.Attr & AttrUnder))) {
+		((ts.FontFlag & FF_URLUNDERLINE) && (Attr.Attr & AttrUnder))) {
+		SelectObject(VTDC, VTFont[(Attr.Attr & AttrFontMask) | AttrUnder]);
 	}
-    /* begin - ishizaki */
-	else if (isURLColored(Attr)) {
-#ifdef ALPHABLEND_TYPE2 // AKASI
-	  TextColor = BGURLColor[0];
-	  BackColor = BGURLColor[1];
-#else
-	  TextColor = ts.URLColor[0];
-	  BackColor = ts.URLColor[1];
-#endif
+	else {
+		SelectObject(VTDC, VTFont[Attr.Attr & (AttrBold|AttrSpecial)]);
 	}
-    /* end - ishizaki */
-	else {
-	  if (isForeColored(Attr)) {
-		TextColor = ANSIColor[Attr.Fore];
-	  }
-	  else {
-#ifdef ALPHABLEND_TYPE2 // AKASI
-		TextColor = BGVTColor[0];
-#else
-		TextColor = ts.VTColor[0];
-#endif
-		NoReverseColor = 1;
-	  }
 
-	  if (isBackColored(Attr)) {
-		BackColor = ANSIColor[Attr.Back];
-	  }
-	  else {
-#ifdef ALPHABLEND_TYPE2 // AKASI
-		BackColor = BGVTColor[1];
-#else
-		BackColor = ts.VTColor[1];
-#endif
-		if (NoReverseColor == 1) {
-		  NoReverseColor = !(ts.ColorFlag & CF_REVERSECOLOR);
+	// \x90F\x82\xF0\x8C\x88\x92肷\x82\xE9
+	TextColor = BGVTColor[0];
+	BackColor = BGVTColor[1];
+	if ((AttrFlag & (AttrURL | AttrUnder | AttrBold | AttrBlink)) == 0) {
+		if (!reverse) {
+			TextColor = BGVTColor[0];
+			BackColor = BGVTColor[1];
 		}
-	  }
+		else {
+			TextColor = BGVTReverseColor[0];
+			BackColor = BGVTReverseColor[1];
+		}
+	} else if (AttrFlag & AttrBlink) {
+		if (!reverse) {
+			TextColor = BGVTBlinkColor[0];
+			if (!use_normal_bg_color) {
+				BackColor = BGVTBlinkColor[1];
+			} else {
+				BackColor = BGVTColor[1];
+			}
+		} else {
+			if (!use_normal_bg_color) {
+				TextColor = BGVTBlinkColor[1];
+			} else {
+				TextColor = BGVTColor[1];
+			}
+			BackColor = BGVTBlinkColor[0];
+		}
+	} else if (AttrFlag & AttrBold) {
+		if (!reverse) {
+			TextColor = BGVTBoldColor[0];
+			if (!use_normal_bg_color) {
+				BackColor = BGVTBoldColor[1];
+			} else {
+				BackColor = BGVTColor[1];
+			}
+		} else {
+			if (!use_normal_bg_color) {
+				TextColor = BGVTBoldColor[1];
+			} else {
+				TextColor = BGVTColor[1];
+			}
+			BackColor = BGVTBoldColor[0];
+		}
+	} else if (AttrFlag & AttrUnder) {
+#define BGVTUnderlineColor BGURLColor
+		if (!reverse) {
+			TextColor = BGVTUnderlineColor[0];
+			if (!use_normal_bg_color) {
+				BackColor = BGVTUnderlineColor[1];
+			} else {
+				BackColor = BGVTColor[1];
+			}
+		} else {
+			if (!use_normal_bg_color) {
+				TextColor = BGVTUnderlineColor[1];
+			} else {
+				TextColor = BGVTColor[1];
+			}
+			BackColor = BGVTUnderlineColor[0];
+		}
+	} else if (AttrFlag & AttrURL) {
+		if (!reverse) {
+			TextColor = BGURLColor[0];
+			if (!use_normal_bg_color) {
+				BackColor = BGURLColor[1];
+			} else {
+				BackColor = BGVTColor[1];
+			}
+		} else {
+			if (!use_normal_bg_color) {
+				TextColor = BGURLColor[1];
+			} else {
+				TextColor = BGVTColor[1];
+			}
+			BackColor = BGURLColor[0];
+		}
 	}
-  }
-  else { // full color
-	if (isForeColored(Attr)) {
-	  if (Attr.Fore<8 && (ts.ColorFlag&CF_PCBOLD16)) {
-	    if (((Attr.Attr&AttrBold)!=0) == (Attr.Fore!=0)) {
-	      TextColor = ANSIColor[Attr.Fore];
-	    }
-	    else {
-	      TextColor = ANSIColor[Attr.Fore ^ 8];
-	    }
-	  }
-	  else if (Attr.Fore < 16 && (Attr.Fore&7) != 0) {
-	    TextColor = ANSIColor[Attr.Fore ^ 8];
-	  }
-	  else {
-	    TextColor = ANSIColor[Attr.Fore];
-	  }
+
+	//	ANSIColor/Fore
+	if (Attr2Flag & Attr2Fore) {
+		const int index = Get256ColorIndex(Attr.Fore, ts.ColorFlag & CF_PCBOLD16, AttrFlag & AttrBold);
+		if (!reverse) {
+			TextColor = ANSIColor[index];
+		}
+		else {
+			BackColor = ANSIColor[index];
+		}
 	}
-	else if (isBlinkColored(Attr))
-#ifdef ALPHABLEND_TYPE2 // AKASI
-	  TextColor = BGVTBlinkColor[0];
-	else if (isBoldColored(Attr))
-	  TextColor = BGVTBoldColor[0];
-	else if (isURLColored(Attr))
-	  TextColor = BGURLColor[0];
-	else {
-	  TextColor = BGVTColor[0];
-#else
-	  TextColor = ts.VTBlinkColor[0];
-	else if (isBoldColored(Attr))
-	  TextColor = ts.VTBoldColor[0];
-	else if (isURLColored(Attr))
-	  TextColor = ts.URLColor[0];
-	else {
-	  TextColor = ts.VTColor[0];
-#endif
-	  NoReverseColor = 1;
+
+	//	ANSIColor/Back
+	if (Attr2Flag & Attr2Back) {
+		const int index = Get256ColorIndex(Attr.Back, ts.ColorFlag & CF_PCBOLD16, AttrFlag & AttrBlink);
+		if (!reverse) {
+			BackColor = ANSIColor[index];
+		}
+		else {
+			TextColor = ANSIColor[index];
+		}
 	}
-	if (isBackColored(Attr)) {
-	  if (Attr.Back<8 && (ts.ColorFlag&CF_PCBOLD16)) {
-	    if (((Attr.Attr&AttrBlink)!=0) == (Attr.Back!=0)) {
-	      BackColor = ANSIColor[Attr.Back];
-	    }
-	    else {
-	      BackColor = ANSIColor[Attr.Back ^ 8];
-	    }
-	  }
-	  else if (Attr.Back < 16 && (Attr.Back&7) != 0) {
-	    BackColor = ANSIColor[Attr.Back ^ 8];
-	  }
-	  else {
-	    BackColor = ANSIColor[Attr.Back];
-	  }
+
+	// UseTextColor=on \x82̂Ƃ\xAB\x82̏\x88\x97\x9D
+	//	\x94w\x8Ci\x90F(Back)\x82\xF0\x8Dl\x97\xB6\x82\xB9\x82\xB8\x82ɕ\xB6\x8E\x9A\x90F(Fore)\x82\xBE\x82\xAF\x82\xF0\x95ύX\x82\xB7\x82\xE9\x83A\x83v\x83\x8A\x82\xF0\x8Eg\x82\xC1\x82Ă\xA2\x82\xC4
+	//	\x95\xB6\x8E\x9A\x82\xAA\x8C\xA9\x82\xA6\x82Ȃ\xA2\x8F\xF3\x91ԂɂȂ\xC1\x82\xBD\x82\xE7\x92ʏ핶\x8E\x9A\x90F\x82\xA9\x94\xBD\x93]\x91\xAE\x90\xAB\x95\xB6\x8E\x9A\x90F\x82\xF0\x8Eg\x97p\x82\xB7\x82\xE9
+	if ((ts.ColorFlag & CF_USETEXTCOLOR) !=0) {
+		if ((Attr2Flag & Attr2Fore) && (Attr2Flag & Attr2Back)) {
+			const int is_target_color = (Attr.Fore == IdFore || Attr.Fore == IdBack || Attr.Fore == 15);
+//			const int is_target_color = 1;
+			if (Attr.Fore == Attr.Back && is_target_color) {
+				if (!reverse) {
+					TextColor = BGVTColor[0];
+					BackColor = BGVTColor[1];
+				}
+				else {
+					TextColor = BGVTReverseColor[0];
+					BackColor = BGVTReverseColor[1];
+				}
+			}
+		}
 	}
-	else if (isBlinkColored(Attr))
-#ifdef ALPHABLEND_TYPE2 // AKASI
-	  BackColor = BGVTBlinkColor[1];
-	else if (isBoldColored(Attr))
-	  BackColor = BGVTBoldColor[1];
-	else if (isURLColored(Attr))
-	  BackColor = BGURLColor[1];
+
+	// \x95`\x89掞(DrawStrW())\x82ɎQ\x8FƂ\xB7\x82\xE9
+	if (reverse) {
+		BGReverseText = TRUE;
+	}
 	else {
-	  BackColor = BGVTColor[1];
-#else
-	  BackColor = ts.VTBlinkColor[1];
-	else if (isBoldColored(Attr))
-	  BackColor = ts.VTBoldColor[1];
-	else if (isURLColored(Attr))
-	  BackColor = ts.URLColor[1];
-	else {
-	  BackColor = ts.VTColor[1];
-#endif
-	  if (NoReverseColor == 1) {
-	    NoReverseColor = !(ts.ColorFlag & CF_REVERSECOLOR);
-	  }
+		BGReverseText = FALSE;
 	}
-  }
-#ifdef USE_NORMAL_BGCOLOR_REJECT
-  if (ts.UseNormalBGColor) {
- #ifdef ALPHABLEND_TYPE2
-    BackColor = BGVTColor[1];
- #else
-    BackColor = ts.VTColor[1];
- #endif
-  }
-#endif
 
-  if (Reverse != ((Attr.Attr & AttrReverse) != 0))
-  {
-#ifdef ALPHABLEND_TYPE2
-    BGReverseText = TRUE;
-#endif
-    if ((Attr.Attr & AttrReverse) && !NoReverseColor) {
-#ifdef ALPHABLEND_TYPE2
-      SetTextColor(VTDC, BGVTReverseColor[0]);
-      SetBkColor(  VTDC, BGVTReverseColor[1]);
-#else
-      SetTextColor(VTDC, ts.VTReverseColor[0]);
-      SetBkColor(  VTDC, ts.VTReverseColor[1]);
-#endif
-    }
-    else {
-      SetTextColor(VTDC, BackColor);
-      SetBkColor(  VTDC, TextColor);
-    }
-  }
-  else {
-#ifdef ALPHABLEND_TYPE2 // by AKASI
-    BGReverseText = FALSE;
-#endif
-    SetTextColor(VTDC,TextColor);
-    SetBkColor(  VTDC,BackColor);
-  }
+	SetTextColor(VTDC, TextColor);
+	SetBkColor(VTDC, BackColor);
 }
 
 #if 1
@@ -3547,20 +3529,9 @@
 #ifdef ALPHABLEND_TYPE2
 	case CS_VT_NORMALFG:
 		BGVTColor[0] = color;
-		if ((ts.ColorFlag & CF_USETEXTCOLOR)!=0) {
-			ANSIColor[IdFore ] = BGVTColor[0]; // use text color for "white"
-		}
 		break;
 	case CS_VT_NORMALBG:
 		BGVTColor[1] = color;
-		if ((ts.ColorFlag & CF_USETEXTCOLOR)!=0) {
-			ANSIColor[IdBack ] = BGVTColor[1]; // use background color for "Black"
-		}
-		if (ts.UseNormalBGColor) {
-			BGVTBoldColor[1] = BGVTColor[1];
-			BGVTBlinkColor[1] = BGVTColor[1];
-			BGURLColor[1] = BGVTColor[1];
-		}
 		break;
 	case CS_VT_BOLDFG:    BGVTBoldColor[0] = color; break;
 	case CS_VT_BOLDBG:    BGVTBoldColor[1] = color; break;
@@ -3573,20 +3544,9 @@
 #else
 	case CS_VT_NORMALFG:
 		ts.VTColor[0] = color;
-		if ((ts.ColorFlag & CF_USETEXTCOLOR)!=0) {
-			ANSIColor[IdFore ] = ts.VTColor[0]; // use text color for "white"
-		}
 		break;
 	case CS_VT_NORMALBG:
 		ts.VTColor[1] = color;
-		if ((ts.ColorFlag & CF_USETEXTCOLOR)!=0) {
-			ANSIColor[IdBack ] = ts.VTColor[1]; // use background color for "Black"
-		}
-		if (ts.UseNormalBGColor) {
-			ts.VTBoldColor[1] = ts.VTColor[1];
-			ts.VTBlinkColor[1] = ts.VTColor[1];
-			ts.URLColor[1] = ts.VTColor[1];
-		}
 		break;
 	case CS_VT_BOLDFG:    ts.VTBoldColor[0] = color; break;
 	case CS_VT_BOLDBG:    ts.VTBoldColor[1] = color; break;
@@ -3638,20 +3598,9 @@
 #ifdef ALPHABLEND_TYPE2
 	case CS_VT_NORMALFG:
 		BGVTColor[0] = ts.VTColor[0];
-		if ((ts.ColorFlag & CF_USETEXTCOLOR)!=0) {
-			ANSIColor[IdFore ] = ts.VTColor[0]; // use text color for "white"
-		}
 		break;
 	case CS_VT_NORMALBG:
 		BGVTColor[1] = ts.VTColor[1];
-		if ((ts.ColorFlag & CF_USETEXTCOLOR)!=0) {
-			ANSIColor[IdBack ] = ts.VTColor[1]; // use background color for "Black"
-		}
-		if (ts.UseNormalBGColor) {
-			BGVTBoldColor[1] = ts.VTColor[1];
-			BGVTBlinkColor[1] = ts.VTColor[1];
-			BGURLColor[1] = ts.VTColor[1];
-		}
 		break;
 	case CS_VT_BOLDFG:    BGVTBoldColor[0] = ts.VTBoldColor[0]; break;
 	case CS_VT_BOLDBG:    BGVTBoldColor[1] = ts.VTBoldColor[1]; break;
@@ -3686,16 +3635,9 @@
 		// VT color Background
 		BGVTColor[1] = ts.VTColor[1];
 		BGVTReverseColor[1] = ts.VTReverseColor[1];
-		if (ts.UseNormalBGColor) {
-			BGVTBoldColor[1] = ts.VTColor[1];
-			BGVTBlinkColor[1] = ts.VTColor[1];
-			BGURLColor[1] = ts.VTColor[1];
-		}
-		else {
-			BGVTBoldColor[1] = ts.VTBoldColor[1];
-			BGVTBlinkColor[1] = ts.VTBlinkColor[1];
-			BGURLColor[1] = ts.URLColor[1];
-		}
+		BGVTBoldColor[1] = ts.VTBoldColor[1];
+		BGVTBlinkColor[1] = ts.VTBlinkColor[1];
+		BGURLColor[1] = ts.URLColor[1];
 
 		// ANSI Color / xterm 256 color
 		InitColorTable();
@@ -3702,33 +3644,7 @@
 		DispSetNearestColors(0, 255, NULL);
 		break;
 	default:
-		if (num == IdBack) {
-			if (ts.ColorFlag & CF_USETEXTCOLOR) {
-#ifdef ALPHABLEND_TYPE2
-				ANSIColor[IdBack] = BGVTColor[1]; // use background color for "Black"
-#else
-				ANSIColor[IdBack] = ts.VTColor[1]; // use background color for "Black"
-#endif
-			}
-			else {
-				ANSIColor[IdBack] = ts.ANSIColor[IdBack];
-			}
-			DispSetNearestColors(num, num, NULL);
-		}
-		else if (num == IdFore) {
-			if (ts.ColorFlag & CF_USETEXTCOLOR) {
-#ifdef ALPHABLEND_TYPE2
-				ANSIColor[IdFore] = BGVTColor[0]; // use text color for "white"
-#else
-				ANSIColor[IdFore] = ts.VTColor[0]; // use text color for "white"
-#endif
-			}
-			else {
-				ANSIColor[IdFore] = ts.ANSIColor[IdFore];
-			}
-			DispSetNearestColors(num, num, NULL);
-		}
-		else if (num <= 15) {
+		if (num <= 15) {
 			ANSIColor[num] = ts.ANSIColor[num];
 			DispSetNearestColors(num, num, NULL);
 		}

Modified: branches/4-stable/teraterm/teraterm/vtdisp.h
===================================================================
--- branches/4-stable/teraterm/teraterm/vtdisp.h	2022-09-14 14:16:07 UTC (rev 10268)
+++ branches/4-stable/teraterm/teraterm/vtdisp.h	2022-09-17 06:21:40 UTC (rev 10269)
@@ -37,8 +37,6 @@
 void BGInitialize(BOOL initialize_once);
 void BGSetupPrimary(BOOL);
 
-void BGExchangeColor(void);
-
 void BGOnSettingChange(void);
 void BGOnEnterSizeMove(void);
 void BGOnExitSizeMove(void);

Modified: branches/4-stable/teraterm/teraterm/vtterm.c
===================================================================
--- branches/4-stable/teraterm/teraterm/vtterm.c	2022-09-14 14:16:07 UTC (rev 10268)
+++ branches/4-stable/teraterm/teraterm/vtterm.c	2022-09-17 06:21:40 UTC (rev 10269)
@@ -2841,43 +2841,13 @@
 	}
 }
 
-void CSQExchangeColor()		// DECSCNM / Visual Bell
+// DECSCNM / Visual Bell
+static void CSQExchangeColor(void)
 {
-	COLORREF ColorRef;
-
 	BuffUpdateScroll();
 
-	if (ts.ColorFlag & CF_REVERSECOLOR) {
-		ColorRef = ts.VTColor[0];
-		ts.VTColor[0] = ts.VTReverseColor[0];
-		ts.VTReverseColor[0] = ColorRef;
-		ColorRef = ts.VTColor[1];
-		ts.VTColor[1] = ts.VTReverseColor[1];
-		ts.VTReverseColor[1] = ColorRef;
-	}
-	else {
-		ColorRef = ts.VTColor[0];
-		ts.VTColor[0] = ts.VTColor[1];
-		ts.VTColor[1] = ColorRef;
-	}
-
-	ColorRef = ts.VTBoldColor[0];
-	ts.VTBoldColor[0] = ts.VTBoldColor[1];
-	ts.VTBoldColor[1] = ColorRef;
-
-	ColorRef = ts.VTBlinkColor[0];
-	ts.VTBlinkColor[0] = ts.VTBlinkColor[1];
-	ts.VTBlinkColor[1] = ColorRef;
-
-	ColorRef = ts.URLColor[0];
-	ts.URLColor[0] = ts.URLColor[1];
-	ts.URLColor[1] = ColorRef;
-
 	ts.ColorFlag ^= CF_REVERSEVIDEO;
 
-#ifdef ALPHABLEND_TYPE2
-	BGExchangeColor();
-#endif
 	DispChangeBackground();
 	UpdateWindow(HVTWin);
 }

Modified: branches/4-stable/teraterm/ttpdlg/ttdlg.c
===================================================================
--- branches/4-stable/teraterm/ttpdlg/ttdlg.c	2022-09-14 14:16:07 UTC (rev 10268)
+++ branches/4-stable/teraterm/ttpdlg/ttdlg.c	2022-09-17 06:21:40 UTC (rev 10269)
@@ -608,64 +608,21 @@
 				}
 
 				for (i = 0 ; i <= 1 ; i++) {
-					if (ts->ColorFlag & CF_REVERSEVIDEO) {
-						//
-						// Reverse Video\x83\x82\x81[\x83h(DECSCNM\x82\xAAon)\x82̎\x9E
-						//
-						if (ts->ColorFlag & CF_REVERSECOLOR) {
-							//
-							// VTReverseColor\x82\xAA\x97L\x8C\xF8\x82̎\x9E\x82\xCD
-							// VTColor\x82\xC6VTReverseColor\x82\xF0\x93\xFC\x82\xEA\x91ւ\xA6\x82\xE9
-							//
-							ts->TmpColor[0][i*3]   = GetRValue(ts->VTReverseColor[i]);
-							ts->TmpColor[0][i*3+1] = GetGValue(ts->VTReverseColor[i]);
-							ts->TmpColor[0][i*3+2] = GetBValue(ts->VTReverseColor[i]);
-							ts->TmpColor[3][i*3]   = GetRValue(ts->VTColor[i]);
-							ts->TmpColor[3][i*3+1] = GetGValue(ts->VTColor[i]);
-							ts->TmpColor[3][i*3+2] = GetBValue(ts->VTColor[i]);
-						}
-						else {
-							//
-							// VTReverseColor\x82\xAA\x96\xB3\x8C\xF8\x82̎\x9E\x82\xCD
-							// \x81EVTColor\x82̕\xB6\x8E\x9A\x90F\x82Ɣw\x8Ci\x90F\x82\xF0\x93\xFC\x82\xEA\x91ւ\xA6\x82\xE9
-							// \x81EVTReverseColor\x82͂\xA2\x82\xB6\x82\xE7\x82Ȃ\xA2
-							//
-							ts->TmpColor[0][i*3]   = GetRValue(ts->VTColor[!i]);
-							ts->TmpColor[0][i*3+1] = GetGValue(ts->VTColor[!i]);
-							ts->TmpColor[0][i*3+2] = GetBValue(ts->VTColor[!i]);
-						}
-						//
-						// \x91\xBC\x82̑\xAE\x90\xAB\x90F\x82͕\xB6\x8E\x9A\x90F\x82Ɣw\x8Ci\x90F\x82\xF0\x93\xFC\x82\xEA\x91ւ\xA6\x82\xE9
-						//
-						ts->TmpColor[1][i*3]   = GetRValue(ts->VTBoldColor[!i]);
-						ts->TmpColor[1][i*3+1] = GetGValue(ts->VTBoldColor[!i]);
-						ts->TmpColor[1][i*3+2] = GetBValue(ts->VTBoldColor[!i]);
-						ts->TmpColor[2][i*3]   = GetRValue(ts->VTBlinkColor[!i]);
-						ts->TmpColor[2][i*3+1] = GetGValue(ts->VTBlinkColor[!i]);
-						ts->TmpColor[2][i*3+2] = GetBValue(ts->VTBlinkColor[!i]);
-						ts->TmpColor[4][i*3]   = GetRValue(ts->URLColor[!i]);
-						ts->TmpColor[4][i*3+1] = GetGValue(ts->URLColor[!i]);
-						ts->TmpColor[4][i*3+2] = GetBValue(ts->URLColor[!i]);
-					}
-					else {
-						ts->TmpColor[0][i*3]   = GetRValue(ts->VTColor[i]);
-						ts->TmpColor[0][i*3+1] = GetGValue(ts->VTColor[i]);
-						ts->TmpColor[0][i*3+2] = GetBValue(ts->VTColor[i]);
-						ts->TmpColor[1][i*3]   = GetRValue(ts->VTBoldColor[i]);
-						ts->TmpColor[1][i*3+1] = GetGValue(ts->VTBoldColor[i]);
-						ts->TmpColor[1][i*3+2] = GetBValue(ts->VTBoldColor[i]);
-						ts->TmpColor[2][i*3]   = GetRValue(ts->VTBlinkColor[i]);
-						ts->TmpColor[2][i*3+1] = GetGValue(ts->VTBlinkColor[i]);
-						ts->TmpColor[2][i*3+2] = GetBValue(ts->VTBlinkColor[i]);
-						ts->TmpColor[3][i*3]   = GetRValue(ts->VTReverseColor[i]);
-						ts->TmpColor[3][i*3+1] = GetGValue(ts->VTReverseColor[i]);
-						ts->TmpColor[3][i*3+2] = GetBValue(ts->VTReverseColor[i]);
-						/* begin - ishizaki */
-						ts->TmpColor[4][i*3]   = GetRValue(ts->URLColor[i]);
-						ts->TmpColor[4][i*3+1] = GetGValue(ts->URLColor[i]);
-						ts->TmpColor[4][i*3+2] = GetBValue(ts->URLColor[i]);
-						/* end - ishizaki */
-					}
+					ts->TmpColor[0][i*3]   = GetRValue(ts->VTColor[i]);
+					ts->TmpColor[0][i*3+1] = GetGValue(ts->VTColor[i]);
+					ts->TmpColor[0][i*3+2] = GetBValue(ts->VTColor[i]);
+					ts->TmpColor[1][i*3]   = GetRValue(ts->VTBoldColor[i]);
+					ts->TmpColor[1][i*3+1] = GetGValue(ts->VTBoldColor[i]);
+					ts->TmpColor[1][i*3+2] = GetBValue(ts->VTBoldColor[i]);
+					ts->TmpColor[2][i*3]   = GetRValue(ts->VTBlinkColor[i]);
+					ts->TmpColor[2][i*3+1] = GetGValue(ts->VTBlinkColor[i]);
+					ts->TmpColor[2][i*3+2] = GetBValue(ts->VTBlinkColor[i]);
+					ts->TmpColor[3][i*3]   = GetRValue(ts->VTReverseColor[i]);
+					ts->TmpColor[3][i*3+1] = GetGValue(ts->VTReverseColor[i]);
+					ts->TmpColor[3][i*3+2] = GetBValue(ts->VTReverseColor[i]);
+					ts->TmpColor[4][i*3]   = GetRValue(ts->URLColor[i]);
+					ts->TmpColor[4][i*3+1] = GetGValue(ts->URLColor[i]);
+					ts->TmpColor[4][i*3+2] = GetBValue(ts->URLColor[i]);
 				}
 				ShowDlgItem(Dialog,IDC_WINATTRTEXT,IDC_WINATTR);
 				get_lang_msg("DLG_WIN_NORMAL", uimsg, sizeof(uimsg), "Normal", UILanguageFile);
@@ -680,10 +637,8 @@
 				SendDlgItemMessage(Dialog, IDC_WINATTR, CB_ADDSTRING, 0, (LPARAM)"URL");
 				/* end - ishizaki */
 				SendDlgItemMessage(Dialog, IDC_WINATTR, CB_SETCURSEL, 0,0);
-#ifdef USE_NORMAL_BGCOLOR
 				ShowDlgItem(Dialog,IDC_WINUSENORMALBG,IDC_WINUSENORMALBG);
 				SetRB(Dialog,ts->UseNormalBGColor,IDC_WINUSENORMALBG,IDC_WINUSENORMALBG);
-#endif
 				ShowDlgItem(Dialog, IDC_FONTBOLD, IDC_FONTBOLD);
 				SetRB(Dialog, (ts->FontFlag & FF_BOLD) > 0, IDC_FONTBOLD,IDC_FONTBOLD);
 			}
@@ -755,123 +710,34 @@
 									GetDlgItemInt(Dialog,IDC_WINSCROLL2,NULL,FALSE);
 							}
 							for (i = 0 ; i <= 1 ; i++) {
-								if (ts->ColorFlag & CF_REVERSEVIDEO) {
-									//
-									// Reverse Video\x83\x82\x81[\x83h(DECSCNM\x82\xAAon)\x82̎\x9E
-									//
-									if (ts->ColorFlag & CF_REVERSECOLOR) {
-										//
-										// VTReverseColor\x82\xAA\x97L\x8C\xF8\x82̎\x9E\x82\xCD
-										// VTColor\x82\xC6VTReverseColor\x82\xF0\x93\xFC\x82\xEA\x91ւ\xA6\x82\xE9
-										//
-										ts->VTReverseColor[i] =
-											RGB(ts->TmpColor[0][i*3],
-											    ts->TmpColor[0][i*3+1],
-											    ts->TmpColor[0][i*3+2]);
-										ts->VTColor[i] =
-											RGB(ts->TmpColor[3][i*3],
-											    ts->TmpColor[3][i*3+1],
-											    ts->TmpColor[3][i*3+2]);
-									}
-									else {
-										//
-										// VTReverseColor\x82\xAA\x96\xB3\x8C\xF8\x82̎\x9E\x82\xCD
-										// \x81EVTColor\x82̕\xB6\x8E\x9A\x90F\x82Ɣw\x8Ci\x90F\x82\xF0\x93\xFC\x82\xEA\x91ւ\xA6\x82\xE9
-										// \x81EVTReverseColor\x82͂\xA2\x82\xB6\x82\xE7\x82Ȃ\xA2
-										//
-										ts->VTColor[i] =
-											RGB(ts->TmpColor[0][(!i)*3],
-											    ts->TmpColor[0][(!i)*3+1],
-											    ts->TmpColor[0][(!i)*3+2]);
-									}
-									//
-									// \x81E\x91\xBC\x82̑\xAE\x90\xAB\x90F\x82͕\xB6\x8E\x9A\x90F\x82Ɣw\x8Ci\x90F\x82\xF0\x93\xFC\x82\xEA\x91ւ\xA6\x82\xE9
-									//
-									ts->VTBoldColor[i] =
-										RGB(ts->TmpColor[1][(!i)*3],
-										    ts->TmpColor[1][(!i)*3+1],
-										    ts->TmpColor[1][(!i)*3+2]);
-									ts->VTBlinkColor[i] =
-										RGB(ts->TmpColor[2][(!i)*3],
-										    ts->TmpColor[2][(!i)*3+1],
-										    ts->TmpColor[2][(!i)*3+2]);
-									ts->URLColor[i] =
-										RGB(ts->TmpColor[4][(!i)*3],
-										    ts->TmpColor[4][(!i)*3+1],
-										    ts->TmpColor[4][(!i)*3+2]);
-								}
-								else {
-									ts->VTColor[i] =
-										RGB(ts->TmpColor[0][i*3],
-										    ts->TmpColor[0][i*3+1],
-										    ts->TmpColor[0][i*3+2]);
-									ts->VTBoldColor[i] =
-										RGB(ts->TmpColor[1][i*3],
-										    ts->TmpColor[1][i*3+1],
-										    ts->TmpColor[1][i*3+2]);
-									ts->VTBlinkColor[i] =
-										RGB(ts->TmpColor[2][i*3],
-										    ts->TmpColor[2][i*3+1],
-										    ts->TmpColor[2][i*3+2]);
-									ts->VTReverseColor[i] =
-										RGB(ts->TmpColor[3][i*3],
-										    ts->TmpColor[3][i*3+1],
-										    ts->TmpColor[3][i*3+2]);
-									/* begin - ishizaki */
-									ts->URLColor[i] =
-										RGB(ts->TmpColor[4][i*3],
-										    ts->TmpColor[4][i*3+1],
-										    ts->TmpColor[4][i*3+2]);
-									/* end - ishizaki */
-								}
+								ts->VTColor[i] =
+									RGB(ts->TmpColor[0][i*3],
+										ts->TmpColor[0][i*3+1],
+										ts->TmpColor[0][i*3+2]);
+								ts->VTBoldColor[i] =
+									RGB(ts->TmpColor[1][i*3],
+										ts->TmpColor[1][i*3+1],
+										ts->TmpColor[1][i*3+2]);
+								ts->VTBlinkColor[i] =
+									RGB(ts->TmpColor[2][i*3],
+										ts->TmpColor[2][i*3+1],
+										ts->TmpColor[2][i*3+2]);
+								ts->VTReverseColor[i] =
+									RGB(ts->TmpColor[3][i*3],
+										ts->TmpColor[3][i*3+1],
+										ts->TmpColor[3][i*3+2]);
+								ts->URLColor[i] =
+									RGB(ts->TmpColor[4][i*3],
+										ts->TmpColor[4][i*3+1],
+										ts->TmpColor[4][i*3+2]);
 								ts->VTColor[i] = GetNearestColor(DC,ts->VTColor[i]);
 								ts->VTBoldColor[i] = GetNearestColor(DC,ts->VTBoldColor[i]);
 								ts->VTBlinkColor[i] = GetNearestColor(DC,ts->VTBlinkColor[i]);
 								ts->VTReverseColor[i] = GetNearestColor(DC,ts->VTReverseColor[i]);
-								/* begin - ishizaki */
 								ts->URLColor[i] = GetNearestColor(DC,ts->URLColor[i]);
-								/* end - ishizaki */
 							}
-#ifdef USE_NORMAL_BGCOLOR
 							GetRB(Dialog,&ts->UseNormalBGColor,
 							      IDC_WINUSENORMALBG,IDC_WINUSENORMALBG);
-							// 2006/03/11 by 337
-							if (ts->ColorFlag & CF_REVERSEVIDEO) {
-								if (ts->UseNormalBGColor) {
-									//
-									// Reverse Video\x83\x82\x81[\x83h(DECSCNM\x82\xAAon)\x82̎\x9E
-									//
-									if (ts->ColorFlag & CF_REVERSECOLOR) {
-										//
-										// VTReverseColor\x82\xAA\x97L\x8C\xF8\x82̎\x9E\x82\xCD
-										// \x95\xB6\x8E\x9A\x90F\x82𔽓]\x94w\x8Ci\x90F\x82ɍ\x87\x82킹\x82\xE9
-										//
-										ts->VTBoldColor[0] =
-										ts->VTBlinkColor[0] =
-										ts->URLColor[0] =
-											ts->VTReverseColor[1];
-									}
-									else {
-										//
-										// VTReverseColor\x82\xAA\x96\xB3\x8C\xF8\x82̎\x9E\x82\xCD
-										// \x95\xB6\x8E\x9A\x90F\x82\xF0\x92ʏ핶\x8E\x9A\x90F\x82ɍ\x87\x82킹\x82\xE9
-										//
-										ts->VTBoldColor[0] =
-										ts->VTBlinkColor[0] =
-										ts->URLColor[0] =
-											ts->VTColor[0];
-									}
-								}
-							}
-							else {
-								if (ts->UseNormalBGColor) {
-									ts->VTBoldColor[1] =
-									ts->VTBlinkColor[1] =
-									ts->URLColor[1] =
-										ts->VTColor[1];
-								}
-							}
-#endif
 							GetRB(Dialog, &i, IDC_FONTBOLD, IDC_FONTBOLD);
 							if (i > 0) {
 								ts->FontFlag |= FF_BOLD;

Modified: branches/4-stable/teraterm/ttpset/ttset.c
===================================================================
--- branches/4-stable/teraterm/ttpset/ttset.c	2022-09-14 14:16:07 UTC (rev 10268)
+++ branches/4-stable/teraterm/ttpset/ttset.c	2022-09-17 06:21:40 UTC (rev 10269)
@@ -2560,23 +2560,9 @@
 
 	/* VT Color */
 	for (i = 0; i <= 1; i++) {
-		if (ts->ColorFlag & CF_REVERSEVIDEO) {
-			if (ts->ColorFlag & CF_REVERSECOLOR) {
-				ts->TmpColor[0][i * 3] = GetRValue(ts->VTReverseColor[i]);
-				ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTReverseColor[i]);
-				ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTReverseColor[i]);
-			}
-			else {
-				ts->TmpColor[0][i * 3] = GetRValue(ts->VTColor[!i]);
-				ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTColor[!i]);
-				ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTColor[!i]);
-			}
-		}
-		else {
-			ts->TmpColor[0][i * 3] = GetRValue(ts->VTColor[i]);
-			ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTColor[i]);
-			ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTColor[i]);
-		}
+		ts->TmpColor[0][i * 3] = GetRValue(ts->VTColor[i]);
+		ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTColor[i]);
+		ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTColor[i]);
 	}
 	WriteInt6(Section, "VTColor", FName,
 	          ts->TmpColor[0][0], ts->TmpColor[0][1], ts->TmpColor[0][2],
@@ -2584,16 +2570,9 @@
 
 	/* VT Bold Color */
 	for (i = 0; i <= 1; i++) {
-		if (ts->ColorFlag & CF_REVERSEVIDEO) {
-			ts->TmpColor[0][i * 3] = GetRValue(ts->VTBoldColor[!i]);
-			ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTBoldColor[!i]);
-			ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTBoldColor[!i]);
-		}
-		else {
-			ts->TmpColor[0][i * 3] = GetRValue(ts->VTBoldColor[i]);
-			ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTBoldColor[i]);
-			ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTBoldColor[i]);
-		}
+		ts->TmpColor[0][i * 3] = GetRValue(ts->VTBoldColor[i]);
+		ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTBoldColor[i]);
+		ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTBoldColor[i]);
 	}
 	WriteInt6(Section, "VTBoldColor", FName,
 	          ts->TmpColor[0][0], ts->TmpColor[0][1], ts->TmpColor[0][2],
@@ -2601,16 +2580,9 @@
 
 	/* VT Blink Color */
 	for (i = 0; i <= 1; i++) {
-		if (ts->ColorFlag & CF_REVERSEVIDEO) {
-			ts->TmpColor[0][i * 3] = GetRValue(ts->VTBlinkColor[!i]);
-			ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTBlinkColor[!i]);
-			ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTBlinkColor[!i]);
-		}
-		else {
-			ts->TmpColor[0][i * 3] = GetRValue(ts->VTBlinkColor[i]);
-			ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTBlinkColor[i]);
-			ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTBlinkColor[i]);
-		}
+		ts->TmpColor[0][i * 3] = GetRValue(ts->VTBlinkColor[i]);
+		ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTBlinkColor[i]);
+		ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTBlinkColor[i]);
 	}
 	WriteInt6(Section, "VTBlinkColor", FName,
 	          ts->TmpColor[0][0], ts->TmpColor[0][1], ts->TmpColor[0][2],
@@ -2618,16 +2590,9 @@
 
 	/* VT Reverse Color */
 	for (i = 0; i <= 1; i++) {
-		if (ts->ColorFlag & CF_REVERSEVIDEO && ts->ColorFlag & CF_REVERSECOLOR) {
-			ts->TmpColor[0][i * 3] = GetRValue(ts->VTReverseColor[i]);
-			ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTReverseColor[i]);
-			ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTReverseColor[i]);
-		}
-		else {
-			ts->TmpColor[0][i * 3] = GetRValue(ts->VTReverseColor[i]);
-			ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTReverseColor[i]);
-			ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTReverseColor[i]);
-		}
+		ts->TmpColor[0][i * 3] = GetRValue(ts->VTReverseColor[i]);
+		ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTReverseColor[i]);
+		ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTReverseColor[i]);
 	}
 	WriteInt6(Section, "VTReverseColor", FName,
 	          ts->TmpColor[0][0], ts->TmpColor[0][1], ts->TmpColor[0][2],
@@ -2638,16 +2603,9 @@
 
 	/* URL color */
 	for (i = 0; i <= 1; i++) {
-		if (ts->ColorFlag & CF_REVERSEVIDEO) {
-			ts->TmpColor[0][i * 3] = GetRValue(ts->URLColor[!i]);
-			ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->URLColor[!i]);
-			ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->URLColor[!i]);
-		}
-		else {
-			ts->TmpColor[0][i * 3] = GetRValue(ts->URLColor[i]);
-			ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->URLColor[i]);
-			ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->URLColor[i]);
-		}
+		ts->TmpColor[0][i * 3] = GetRValue(ts->URLColor[i]);
+		ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->URLColor[i]);
+		ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->URLColor[i]);
 	}
 	WriteInt6(Section, "URLColor", FName,
 	          ts->TmpColor[0][0], ts->TmpColor[0][1], ts->TmpColor[0][2],


ttssh2-commit メーリングリストの案内
Back to archive index