[ttssh2-commit] [10389] Underline属性(SGR 4)の色を設定できるようにした

Back to archive index
scmno****@osdn***** scmno****@osdn*****
2022年 11月 28日 (月) 22:56:21 JST


Revision: 10389
          https://osdn.net/projects/ttssh2/scm/svn/commits/10389
Author:   zmatsuo
Date:     2022-11-28 22:56:20 +0900 (Mon, 28 Nov 2022)
Log Message:
-----------
Underline属性(SGR 4)の色を設定できるようにした

- [Setup]-[Windows...] dialog
- DispResetColor(CS_ALL)でUnderline属性(SGR 4)色を初期化するようにした

Modified Paths:
--------------
    trunk/doc/en/html/menu/setup-window.html
    trunk/doc/ja/html/menu/setup-window.html
    trunk/teraterm/teraterm/vtdisp.c
    trunk/teraterm/ttpdlg/ttdlg.c

-------------- next part --------------
Modified: trunk/doc/en/html/menu/setup-window.html
===================================================================
--- trunk/doc/en/html/menu/setup-window.html	2022-11-28 13:56:09 UTC (rev 10388)
+++ trunk/doc/en/html/menu/setup-window.html	2022-11-28 13:56:20 UTC (rev 10389)
@@ -93,9 +93,15 @@
 
 	  <dt id="Attribute">Attribute</dt>
 	  <dd>
-	    Attribute of characters (Normal, Bold, Blink, Reverse or URL) whose colors
-	    are being changed.<br>
-        Note: Currently, the function URL attribute is disabled.
+	    Attribute of characters whose colors are being changed.
+      <ul>
+        <li>Normal</li>
+        <li>Bold</li>
+        <li>Blink</li>
+        <li>Reverse</li>
+        <li>URL</li>
+        <li>Underline</li>
+      </ul>
 	  </dd>
 
 	  <dt>Reverse</dt>

Modified: trunk/doc/ja/html/menu/setup-window.html
===================================================================
--- trunk/doc/ja/html/menu/setup-window.html	2022-11-28 13:56:09 UTC (rev 10388)
+++ trunk/doc/ja/html/menu/setup-window.html	2022-11-28 13:56:20 UTC (rev 10389)
@@ -93,8 +93,15 @@
 
 	  <dt id="Attribute">Attribute</dt>
 	  <dd>
-	    \x90F\x82\xF0\x90ݒ肵\x82\xBD\x82\xA2\x95\xB6\x8E\x9A\x82̑\xAE\x90\xAB (Normal, Bold, Blink, Reverse, URL)<br>
-        \x92\x8D\x81F\x8C\xBB\x8D\xDD URL \x91\xAE\x90\xAB\x82\xF0\x95\\x8E\xA6\x82\xB7\x82\xE9\x8B@\x94\\x82͖\xB3\x8C\xF8\x82ɂȂ\xC1\x82Ă\xA2\x82܂\xB7\x81B
+	    \x90F\x82\xF0\x90ݒ肵\x82\xBD\x82\xA2\x95\xB6\x8E\x9A\x82̑\xAE\x90\xAB
+      <ul>
+        <li>Normal</li>
+        <li>Bold</li>
+        <li>Blink</li>
+        <li>Reverse</li>
+        <li>URL</li>
+        <li>Underline</li>
+      </ul>
 	  </dd>
 
 	  <dt>Reverse</dt>

Modified: trunk/teraterm/teraterm/vtdisp.c
===================================================================
--- trunk/teraterm/teraterm/vtdisp.c	2022-11-28 13:56:09 UTC (rev 10388)
+++ trunk/teraterm/teraterm/vtdisp.c	2022-11-28 13:56:20 UTC (rev 10389)
@@ -3475,6 +3475,7 @@
 		BGVTBlinkColor[0] = ts.VTBlinkColor[0];
 		BGVTReverseColor[0] = ts.VTReverseColor[0];
 		BGURLColor[0] = ts.URLColor[0];
+		BGVTUnderlineColor[0] = ts.VTUnderlineColor[0];
 
 		// VT color Background
 		BGVTColor[1] = ts.VTColor[1];
@@ -3482,6 +3483,7 @@
 		BGVTBoldColor[1] = ts.VTBoldColor[1];
 		BGVTBlinkColor[1] = ts.VTBlinkColor[1];
 		BGURLColor[1] = ts.URLColor[1];
+		BGVTUnderlineColor[1] = ts.VTUnderlineColor[1];
 
 		// ANSI Color / xterm 256 color
 		InitColorTable(ts.ANSIColor);

Modified: trunk/teraterm/ttpdlg/ttdlg.c
===================================================================
--- trunk/teraterm/ttpdlg/ttdlg.c	2022-11-28 13:56:09 UTC (rev 10388)
+++ trunk/teraterm/ttpdlg/ttdlg.c	2022-11-28 13:56:20 UTC (rev 10389)
@@ -40,6 +40,7 @@
 #define _CRTDBG_MAP_ALLOC
 #include <stdlib.h>
 #include <crtdbg.h>
+#include <assert.h>
 
 #include "tttypes.h"
 #include "ttlib.h"
@@ -117,10 +118,10 @@
 static void SetKanjiCodeDropDownList(HWND HDlg, int id, int language, int sel_code)
 {
 	int i;
-	int sel_index = 0;
+	LRESULT sel_index = 0;
 
 	for(i = 0;; i++) {
-		int index;
+		LRESULT index;
 		const TKanjiList *p = GetKanjiList(i);
 		if (p == NULL) {
 			break;
@@ -135,7 +136,7 @@
 			sel_index = index;
 		}
 	}
-	SendDlgItemMessage(HDlg, id, CB_SETCURSEL, sel_index, 0);
+	SendDlgItemMessageA(HDlg, id, CB_SETCURSEL, sel_index, 0);
 }
 
 /*
@@ -549,7 +550,6 @@
 	HWND Wnd, HRed, HGreen, HBlue;
 	int IAttr, IOffset;
 	WORD i, pos, ScrollCode, NewPos;
-	HDC DC;
 	WinDlgWork *work = (WinDlgWork *)GetWindowLongPtr(Dialog,DWLP_USER);
 
 	switch (Message) {
@@ -615,6 +615,9 @@
 					work->TmpColor[4][i*3]   = GetRValue(ts->URLColor[i]);
 					work->TmpColor[4][i*3+1] = GetGValue(ts->URLColor[i]);
 					work->TmpColor[4][i*3+2] = GetBValue(ts->URLColor[i]);
+					work->TmpColor[5][i*3]   = GetRValue(ts->VTUnderlineColor[i]);
+					work->TmpColor[5][i*3+1] = GetGValue(ts->VTUnderlineColor[i]);
+					work->TmpColor[5][i*3+2] = GetBValue(ts->VTUnderlineColor[i]);
 				}
 				ShowDlgItem(Dialog,IDC_WINATTRTEXT,IDC_WINATTR);
 				{
@@ -624,6 +627,7 @@
 						{ "DLG_WIN_BLINK", L"Blink" },
 						{ "DLG_WIN_REVERSEATTR", L"Reverse" },
 						{ NULL, L"URL" },
+						{ NULL, L"Underline" },
 					};
 					SetI18nListW("Tera Term", Dialog, IDC_WINATTR, infos, _countof(infos), ts->UILanguageFileW, 0);
 				}
@@ -666,96 +670,105 @@
 		case WM_COMMAND:
 			ts = work->ts;
 			RestoreVar(Dialog,work,&IAttr,&IOffset);
+			assert(IAttr < _countof(work->TmpColor));
 			switch (LOWORD(wParam)) {
-				case IDOK:
-					if ( ts!=NULL ) {
-						WORD w;
-						GetDlgItemText(Dialog,IDC_WINTITLE,ts->Title,sizeof(ts->Title));
-						GetRB(Dialog,&ts->HideTitle,IDC_WINHIDETITLE,IDC_WINHIDETITLE);
-						GetRB(Dialog,&w,IDC_NO_FRAME,IDC_NO_FRAME);
-						ts->EtermLookfeel.BGNoFrame = w;
-						GetRB(Dialog,&ts->PopupMenu,IDC_WINHIDEMENU,IDC_WINHIDEMENU);
-						DC = GetDC(Dialog);
-						if (work->VTFlag>0) {
-							GetRB(Dialog,&i,IDC_WINCOLOREMU,IDC_WINCOLOREMU);
-							if (i!=0) {
-								ts->ColorFlag |= CF_PCBOLD16;
-							}
-							else {
-								ts->ColorFlag &= ~(WORD)CF_PCBOLD16;
-							}
-							GetRB(Dialog,&i,IDC_WINAIXTERM16,IDC_WINAIXTERM16);
-							if (i!=0) {
-								ts->ColorFlag |= CF_AIXTERM16;
-							}
-							else {
-								ts->ColorFlag &= ~(WORD)CF_AIXTERM16;
-							}
-							GetRB(Dialog,&i,IDC_WINXTERM256,IDC_WINXTERM256);
-							if (i!=0) {
-								ts->ColorFlag |= CF_XTERM256;
-							}
-							else {
-								ts->ColorFlag &= ~(WORD)CF_XTERM256;
-							}
-							GetRB(Dialog,&ts->EnableScrollBuff,IDC_WINSCROLL1,IDC_WINSCROLL1);
-							if ( ts->EnableScrollBuff>0 ) {
+				case IDOK: {
+					WORD w;
+					//HDC DC;
+					GetDlgItemText(Dialog, IDC_WINTITLE, ts->Title, sizeof(ts->Title));
+					GetRB(Dialog, &ts->HideTitle, IDC_WINHIDETITLE, IDC_WINHIDETITLE);
+					GetRB(Dialog, &w, IDC_NO_FRAME, IDC_NO_FRAME);
+					ts->EtermLookfeel.BGNoFrame = w;
+					GetRB(Dialog, &ts->PopupMenu, IDC_WINHIDEMENU, IDC_WINHIDEMENU);
+					// DC = GetDC(Dialog);
+					if (work->VTFlag > 0) {
+						GetRB(Dialog, &i, IDC_WINCOLOREMU, IDC_WINCOLOREMU);
+						if (i != 0) {
+							ts->ColorFlag |= CF_PCBOLD16;
+						}
+						else {
+							ts->ColorFlag &= ~(WORD)CF_PCBOLD16;
+						}
+						GetRB(Dialog, &i, IDC_WINAIXTERM16, IDC_WINAIXTERM16);
+						if (i != 0) {
+							ts->ColorFlag |= CF_AIXTERM16;
+						}
+						else {
+							ts->ColorFlag &= ~(WORD)CF_AIXTERM16;
+						}
+						GetRB(Dialog, &i, IDC_WINXTERM256, IDC_WINXTERM256);
+						if (i != 0) {
+							ts->ColorFlag |= CF_XTERM256;
+						}
+						else {
+							ts->ColorFlag &= ~(WORD)CF_XTERM256;
+						}
+						GetRB(Dialog, &ts->EnableScrollBuff, IDC_WINSCROLL1, IDC_WINSCROLL1);
+						if (ts->EnableScrollBuff > 0) {
 								ts->ScrollBuffSize =
 									GetDlgItemInt(Dialog,IDC_WINSCROLL2,NULL,FALSE);
-							}
-							for (i = 0 ; i <= 1 ; i++) {
-								ts->VTColor[i] =
-									RGB(work->TmpColor[0][i*3],
-										work->TmpColor[0][i*3+1],
-										work->TmpColor[0][i*3+2]);
-								ts->VTBoldColor[i] =
-									RGB(work->TmpColor[1][i*3],
-										work->TmpColor[1][i*3+1],
-										work->TmpColor[1][i*3+2]);
-								ts->VTBlinkColor[i] =
-									RGB(work->TmpColor[2][i*3],
-										work->TmpColor[2][i*3+1],
-										work->TmpColor[2][i*3+2]);
-								ts->VTReverseColor[i] =
-									RGB(work->TmpColor[3][i*3],
-										work->TmpColor[3][i*3+1],
-										work->TmpColor[3][i*3+2]);
-								ts->URLColor[i] =
-									RGB(work->TmpColor[4][i*3],
-										work->TmpColor[4][i*3+1],
-										work->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]);
-								ts->URLColor[i] = GetNearestColor(DC,ts->URLColor[i]);
-							}
-							GetRB(Dialog,&ts->UseNormalBGColor,
-							      IDC_WINUSENORMALBG,IDC_WINUSENORMALBG);
-							GetRB(Dialog, &i, IDC_FONTBOLD, IDC_FONTBOLD);
-							if (i > 0) {
-								ts->FontFlag |= FF_BOLD;
-							}
-							else {
-								ts->FontFlag &= ~(WORD)FF_BOLD;
-							}
 						}
+						for (i = 0; i <= 1; i++) {
+							ts->VTColor[i] =
+								RGB(work->TmpColor[0][i*3],
+									work->TmpColor[0][i*3+1],
+									work->TmpColor[0][i*3+2]);
+							ts->VTBoldColor[i] =
+								RGB(work->TmpColor[1][i*3],
+									work->TmpColor[1][i*3+1],
+									work->TmpColor[1][i*3+2]);
+							ts->VTBlinkColor[i] =
+								RGB(work->TmpColor[2][i*3],
+									work->TmpColor[2][i*3+1],
+									work->TmpColor[2][i*3+2]);
+							ts->VTReverseColor[i] =
+								RGB(work->TmpColor[3][i*3],
+									work->TmpColor[3][i*3+1],
+									work->TmpColor[3][i*3+2]);
+							ts->URLColor[i] =
+								RGB(work->TmpColor[4][i*3],
+									work->TmpColor[4][i*3+1],
+									work->TmpColor[4][i*3+2]);
+							ts->VTUnderlineColor[i] =
+								RGB(work->TmpColor[5][i * 3],
+									work->TmpColor[5][i * 3 + 1],
+									work->TmpColor[5][i * 3 + 2]);
+#if 0
+							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]);
+							ts->URLColor[i] = GetNearestColor(DC, ts->URLColor[i]);
+#endif
+						}
+						GetRB(Dialog, &ts->UseNormalBGColor,
+							  IDC_WINUSENORMALBG, IDC_WINUSENORMALBG);
+						GetRB(Dialog, &i, IDC_FONTBOLD, IDC_FONTBOLD);
+						if (i > 0) {
+							ts->FontFlag |= FF_BOLD;
+						}
 						else {
-							for (i = 0 ; i <= 1 ; i++) {
-								ts->TEKColor[i] =
-									RGB(work->TmpColor[0][i*3],
-									    work->TmpColor[0][i*3+1],
-									    work->TmpColor[0][i*3+2]);
-								ts->TEKColor[i] = GetNearestColor(DC,ts->TEKColor[i]);
-							}
-							GetRB(Dialog,&ts->TEKColorEmu,IDC_WINCOLOREMU,IDC_WINCOLOREMU);
+							ts->FontFlag &= ~(WORD)FF_BOLD;
 						}
-						ReleaseDC(Dialog,DC);
+					}
+					else {
+						for (i = 0; i <= 1; i++) {
+							ts->TEKColor[i] =
+								RGB(work->TmpColor[0][i*3],
+									work->TmpColor[0][i*3+1],
+									work->TmpColor[0][i*3+2]);
+#if 0
+							ts->TEKColor[i] = GetNearestColor(DC, ts->TEKColor[i]);
+#endif
+						}
+						GetRB(Dialog, &ts->TEKColorEmu, IDC_WINCOLOREMU, IDC_WINCOLOREMU);
+					}
+					// ReleaseDC(Dialog,DC);
 
-						GetRB(Dialog,&ts->CursorShape,IDC_WINBLOCK,IDC_WINHORZ);
-					}
+					GetRB(Dialog, &ts->CursorShape, IDC_WINBLOCK, IDC_WINHORZ);
 					EndDialog(Dialog, 1);
 					return TRUE;
+				}
 
 				case IDCANCEL:
 					EndDialog(Dialog, 0);


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