[Ttssh2-commit] [3642] URL属性色が無効の場合は、URLに下線属性を付けないようにした。

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2009年 10月 10日 (土) 18:42:57 JST


Revision: 3642
          http://sourceforge.jp/projects/ttssh2/svn/view?view=rev&revision=3642
Author:   doda
Date:     2009-10-10 18:42:57 +0900 (Sat, 10 Oct 2009)

Log Message:
-----------
URL属性色が無効の場合は、URLに下線属性を付けないようにした。
# 下線の有無を選択する設定を別に作った方がいいのかも

Modified Paths:
--------------
    trunk/teraterm/teraterm/buffer.c
    trunk/teraterm/teraterm/vtdisp.c


-------------- next part --------------
Modified: trunk/teraterm/teraterm/buffer.c
===================================================================
--- trunk/teraterm/teraterm/buffer.c	2009-10-09 15:46:10 UTC (rev 3641)
+++ trunk/teraterm/teraterm/buffer.c	2009-10-10 09:42:57 UTC (rev 3642)
@@ -1380,7 +1380,7 @@
 	if (x == 0) {
 		if (AttrLine > AttrBuff && (AttrLine[x-1] & AttrURL)) {
 			if (!(ch & 0x80 || url_char[ch]==0)) { // ‚©‚ÂURL\¬•¶Žš‚È‚ç
-				AttrLine[x] |= (AttrURL | AttrUnder); 
+				AttrLine[x] |= AttrURL; 
 			}
 		}
 		return;
@@ -1389,7 +1389,7 @@
 	if ((x-1>=0) && (AttrLine[x-1] & AttrURL) &&
 		!(ch & 0x80 || url_char[ch]==0)) {
 //		!((CodeLine[x] <= ' ') && !(AttrLine[x] & AttrKanji))) {
-			AttrLine[x] |= (AttrURL | AttrUnder); 
+			AttrLine[x] |= AttrURL; 
 		return;
 	}
 
@@ -1403,7 +1403,7 @@
 			len = strlen(*p) - 1;
 			if ((x-len>=0) && !strncmp(&CodeLine[x-len], *p, len)) {
 				for (i = 0; i <= len; i++) {
-					AttrLine[x-i] |= (AttrURL | AttrUnder); 
+					AttrLine[x-i] |= AttrURL; 
 				}
 				break;
 			}

Modified: trunk/teraterm/teraterm/vtdisp.c
===================================================================
--- trunk/teraterm/teraterm/vtdisp.c	2009-10-09 15:46:10 UTC (rev 3641)
+++ trunk/teraterm/teraterm/vtdisp.c	2009-10-10 09:42:57 UTC (rev 3642)
@@ -2424,6 +2424,13 @@
   VTDC = NULL;
 }
 
+#define isURLColored(x) ((ts.ColorFlag & CF_URLCOLOR) && ((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))
+
 void DispSetupDC(TCharAttr Attr, BOOL Reverse)
 // Setup device context
 //   Attr: character attributes
@@ -2440,10 +2447,10 @@
   DCAttr = Attr;
   DCReverse = Reverse;
      
-  SelectObject(VTDC, VTFont[Attr.Attr & AttrFontMask]);
+  SelectObject(VTDC, VTFont[(Attr.Attr & AttrFontMask) | (isURLColored(Attr)?AttrUnder:0)]);
 
   if ((ts.ColorFlag & CF_FULLCOLOR) == 0) {
-	if ((ts.ColorFlag & CF_BLINKCOLOR) && (Attr.Attr & AttrBlink)) {
+	if (isBlinkColored(Attr)) {
 #ifdef ALPHABLEND_TYPE2 // AKASI
 	  TextColor = BGVTBlinkColor[0];
 	  BackColor = BGVTBlinkColor[1];
@@ -2452,7 +2459,7 @@
 	  BackColor = ts.VTBlinkColor[1];
 #endif
 	}
-	else if ((ts.ColorFlag & CF_BOLDCOLOR) && (Attr.Attr & AttrBold)) {
+	else if (isBoldColored(Attr)) {
 #ifdef ALPHABLEND_TYPE2 // AKASI
 	  TextColor = BGVTBoldColor[0];
 	  BackColor = BGVTBoldColor[1];
@@ -2462,7 +2469,7 @@
 #endif
 	}
     /* begin - ishizaki */
-	else if ((ts.ColorFlag & CF_URLCOLOR) && (Attr.Attr & AttrURL)) {
+	else if (isURLColored(Attr)) {
 #ifdef ALPHABLEND_TYPE2 // AKASI
 	  TextColor = BGURLColor[0];
 	  BackColor = BGURLColor[1];
@@ -2473,7 +2480,7 @@
 	}
     /* end - ishizaki */
 	else {
-	  if ((ts.ColorFlag & CF_ANSICOLOR) && (Attr.Attr2 & Attr2Fore)) {
+	  if (isForeColored(Attr)) {
 		TextColor = ANSIColor[Attr.Fore];
 	  }
 	  else {
@@ -2485,7 +2492,7 @@
 		NoReverseColor = 1;
 	  }
 
-	  if ((ts.ColorFlag & CF_ANSICOLOR) && (Attr.Attr2 & Attr2Back)) {
+	  if (isBackColored(Attr)) {
 		BackColor = ANSIColor[Attr.Back];
 	  }
 	  else {
@@ -2501,7 +2508,7 @@
 	}
   }
   else { // full color
-	if ((ts.ColorFlag & CF_ANSICOLOR) && (Attr.Attr2 & Attr2Fore)) {
+	if (isForeColored(Attr)) {
 	  if (Attr.Fore<8 && (ts.ColorFlag&CF_PCBOLD16)) {
 	    if (((Attr.Attr&AttrBold)!=0) == (Attr.Fore!=0)) {
 	      TextColor = ANSIColor[Attr.Fore];
@@ -2517,27 +2524,27 @@
 	    TextColor = ANSIColor[Attr.Fore];
 	  }
 	}
-	else if ((ts.ColorFlag & CF_BLINKCOLOR) && (Attr.Attr & AttrBlink))
+	else if (isBlinkColored(Attr))
 #ifdef ALPHABLEND_TYPE2 // AKASI
 	  TextColor = BGVTBlinkColor[0];
-	else if ((ts.ColorFlag & CF_BOLDCOLOR) && (Attr.Attr & AttrBold))
+	else if (isBoldColored(Attr))
 	  TextColor = BGVTBoldColor[0];
-	else if ((ts.ColorFlag & CF_URLCOLOR) && (Attr.Attr & AttrURL))
+	else if (isURLColored(Attr))
 	  TextColor = BGURLColor[0];
 	else {
 	  TextColor = BGVTColor[0];
 #else
 	  TextColor = ts.VTBlinkColor[0];
-	else if ((ts.ColorFlag & CF_BOLDCOLOR) && (Attr.Attr & AttrBold))
+	else if (isBoldColored(Attr))
 	  TextColor = ts.VTBoldColor[0];
-	else if ((ts.ColorFlag & CF_URLCOLOR) && (Attr.Attr & AttrURL))
+	else if (isURLColored(Attr))
 	  TextColor = ts.URLColor[0];
 	else {
 	  TextColor = ts.VTColor[0];
 #endif
 	  NoReverseColor = 1;
 	}
-	if ((ts.ColorFlag & CF_ANSICOLOR) && (Attr.Attr2 & Attr2Back)) {
+	if (isBackColored(Attr)) {
 	  if (Attr.Back<8 && (ts.ColorFlag&CF_PCBOLD16)) {
 	    if (((Attr.Attr&AttrBlink)!=0) == (Attr.Back!=0)) {
 	      BackColor = ANSIColor[Attr.Back];
@@ -2553,20 +2560,20 @@
 	    BackColor = ANSIColor[Attr.Back];
 	  }
 	}
-	else if ((ts.ColorFlag & CF_BLINKCOLOR) && (Attr.Attr & AttrBlink))
+	else if (isBlinkColored(Attr))
 #ifdef ALPHABLEND_TYPE2 // AKASI
 	  BackColor = BGVTBlinkColor[1];
-	else if ((ts.ColorFlag & CF_BOLDCOLOR) && (Attr.Attr & AttrBold))
+	else if (isBoldColored(Attr))
 	  BackColor = BGVTBoldColor[1];
-	else if ((ts.ColorFlag & CF_URLCOLOR) && (Attr.Attr & AttrURL))
+	else if (isURLColored(Attr))
 	  BackColor = BGURLColor[1];
 	else {
 	  BackColor = BGVTColor[1];
 #else
 	  BackColor = ts.VTBlinkColor[1];
-	else if ((ts.ColorFlag & CF_BOLDCOLOR) && (Attr.Attr & AttrBold))
+	else if (isBoldkColored(Attr))
 	  BackColor = ts.VTBoldColor[1];
-	else if ((ts.ColorFlag & CF_URLCOLOR) && (Attr.Attr & AttrURL))
+	else if (isURLColored(Attr))
 	  BackColor = ts.URLColor[1];
 	else {
 	  BackColor = ts.VTColor[1];



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