[Ttssh2-commit] [8147] ANSI Color 設定のエディットコントロールの挙動を変更

Back to archive index
scmno****@osdn***** scmno****@osdn*****
2019年 9月 14日 (土) 20:11:21 JST


Revision: 8147
          https://osdn.net/projects/ttssh2/scm/svn/commits/8147
Author:   maya
Date:     2019-09-14 20:11:21 +0900 (Sat, 14 Sep 2019)
Log Message:
-----------
ANSI Color 設定のエディットコントロールの挙動を変更

- 値をチェック・反映するタイミングを EN_KILLFOCUS から EN_CHANGE に変更
- 入力値を BYTE で受け取って桁あふれしていたので int に変更し、上限値が 255 になるように変更

Modified Paths:
--------------
    trunk/teraterm/teraterm/addsetting.cpp

-------------- next part --------------
Modified: trunk/teraterm/teraterm/addsetting.cpp
===================================================================
--- trunk/teraterm/teraterm/addsetting.cpp	2019-09-14 11:08:05 UTC (rev 8146)
+++ trunk/teraterm/teraterm/addsetting.cpp	2019-09-14 11:11:21 UTC (rev 8147)
@@ -955,12 +955,11 @@
 			}
 			return TRUE;
 
-		case IDC_COLOR_RED | (EN_KILLFOCUS << 16):
-		case IDC_COLOR_GREEN | (EN_KILLFOCUS << 16):
-		case IDC_COLOR_BLUE | (EN_KILLFOCUS << 16):
+		case IDC_COLOR_RED | (EN_CHANGE << 16) :
+		case IDC_COLOR_GREEN | (EN_CHANGE << 16) :
+		case IDC_COLOR_BLUE | (EN_CHANGE << 16) :
 			{
-				BYTE r, g, b;
-				char buf[8];
+				int r, g, b;
 
 				sel = GetCurSel(IDC_ANSI_COLOR);
 				if (sel < 0 && sel > sizeof(ts.ANSIColor)-1) {
@@ -967,20 +966,36 @@
 					return TRUE;
 				}
 
-				GetDlgItemTextA(IDC_COLOR_RED, buf, sizeof(buf));
-				r = atoi(buf);
+				r = GetDlgItemInt(IDC_COLOR_RED);
+				if (r < 0) {
+					r = 0;
+				}
+				else if (r > 255) {
+					r = 255;
+				}
+				SetDlgItemNum(IDC_COLOR_RED, r);
 
-				GetDlgItemTextA(IDC_COLOR_GREEN, buf, sizeof(buf));
-				g = atoi(buf);
+				g = GetDlgItemInt(IDC_COLOR_GREEN);
+				if (g < 0) {
+					g = 0;
+				}
+				else if (g > 255) {
+					g = 255;
+				}
+				SetDlgItemNum(IDC_COLOR_GREEN, g);
 
-				GetDlgItemTextA(IDC_COLOR_BLUE, buf, sizeof(buf));
-				b = atoi(buf);
+				b = GetDlgItemInt(IDC_COLOR_BLUE);
+				if (b < 0) {
+					b = 0;
+				}
+				else if (b > 255) {
+					b = 255;
+				}
+				SetDlgItemNum(IDC_COLOR_BLUE, b);
 
+				// OK \x82\xF0\x89\x9F\x82\xB3\x82Ȃ\xAD\x82Ă\xE0\x90ݒ肪\x95ۑ\xB6\x82\xB3\x82\xEA\x82Ă\xA2\x82\xE9
 				ts.ANSIColor[sel] = RGB(r, g, b);
 
-				// 255\x82𒴂\xA6\x82\xBDRGB\x92l\x82͕␳\x82\xB3\x82\xEA\x82\xE9\x82̂ŁA\x82\xBB\x82\xEA\x82\xF0Edit\x82ɕ\\x8E\xA6\x82\xB7\x82\xE9 (2007.2.18 maya)
-				SetupRGBbox(sel);
-
 				::InvalidateRect(GetDlgItem(IDC_SAMPLE_COLOR), NULL, TRUE);
 			}
 			return TRUE;


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