[Ttssh2-commit] [3392] インデントを調整。コード的な変更はないはず。

svnno****@sourc***** svnno****@sourc*****
2009年 5月 12日 (火) 20:55:28 JST


Revision: 3392
          http://svn.sourceforge.jp/view?root=ttssh2&view=rev&rev=3392
Author:   maya
Date:     2009-05-12 20:55:27 +0900 (Tue, 12 May 2009)

Log Message:
-----------
インデントを調整。コード的な変更はないはず。

Modified Paths:
--------------
    trunk/teraterm/common/dlglib.c
    trunk/teraterm/common/ttlib.c
    trunk/teraterm/keycode/keycode.c
    trunk/teraterm/teraterm/ftdlg.cpp
    trunk/teraterm/teraterm/prnabort.cpp
    trunk/teraterm/teraterm/protodlg.cpp
    trunk/teraterm/teraterm/tekwin.cpp
    trunk/teraterm/teraterm/teraprn.cpp
    trunk/teraterm/teraterm/teraterm.cpp
    trunk/teraterm/teraterm/vtwin.cpp
    trunk/teraterm/ttpcmn/language.c
    trunk/teraterm/ttpcmn/ttcmn.c
    trunk/teraterm/ttpdlg/ttdlg.c


-------------- next part --------------
Modified: trunk/teraterm/common/dlglib.c
===================================================================
--- trunk/teraterm/common/dlglib.c	2009-05-11 14:10:03 UTC (rev 3391)
+++ trunk/teraterm/common/dlglib.c	2009-05-12 11:55:27 UTC (rev 3392)
@@ -45,10 +45,12 @@
 	HWND HControl;
 	DWORD Style;
 
-	if ( R<1 )
+	if ( R<1 ) {
 		return;
-	if ( FirstId+R-1 > LastId )
+	}
+	if ( FirstId+R-1 > LastId ) {
 		return;
+	}
 	HControl = GetDlgItem(HDlg, FirstId + R - 1);
 	SendMessage(HControl, BM_SETCHECK, 1, 0);
 	Style = GetClassLong(HControl, GCL_STYLE);
@@ -60,12 +62,12 @@
 	int i;
 
 	*R = 0;
-	for (i = FirstId ; i <= LastId ; i++)
-		if (SendDlgItemMessage(HDlg, i, BM_GETCHECK, 0, 0) != 0)
-		{
+	for (i = FirstId ; i <= LastId ; i++) {
+		if (SendDlgItemMessage(HDlg, i, BM_GETCHECK, 0, 0) != 0) {
 			*R = i - FirstId + 1;
 			return;
 		}
+	}
 }
 
 void SetDlgNum(HWND HDlg, int id_Item, LONG Num)
@@ -99,10 +101,12 @@
 	double Num; 
 	char NumStr[10]; 
 
-	if (b==0) 
+	if (b==0) {
 		Num = 100.0; 
-	else 
+	}
+	else {
 		Num = 100.0 * (double)a / (double)b; 
+	}
 	_snprintf_s(NumStr,sizeof(NumStr),_TRUNCATE,"%3.1f%%",Num); 
 	SetDlgItemText(HDlg, id_Item, NumStr); 
 
@@ -130,10 +134,12 @@
 	LONG n;
 
 	n = SendDlgItemMessage(HDlg, Id_Item, CB_GETCURSEL, 0, 0);
-	if (n==CB_ERR)
+	if (n==CB_ERR) {
 		n = 0;
-	else
+	}
+	else {
 		n++;
+	}
 
 	return n;
 }

Modified: trunk/teraterm/common/ttlib.c
===================================================================
--- trunk/teraterm/common/ttlib.c	2009-05-11 14:10:03 UTC (rev 3391)
+++ trunk/teraterm/common/ttlib.c	2009-05-12 11:55:27 UTC (rev 3392)
@@ -107,9 +107,10 @@
 	Temp[j] = 0;
 
 	if ((NumOfDots==0) &&
-	    (DefExt!=NULL))
+	    (DefExt!=NULL)) {
 		/* add the default extension */
 		strncat_s(Temp,sizeof(Temp),DefExt,_TRUNCATE);
+	}
 
 	strncpy_s(FileName,destlen,Temp,_TRUNCATE);
 }
@@ -119,8 +120,9 @@
 {
 	if (strcmp(CharPrev((LPCTSTR)Path,
 	           (LPCTSTR)(&Path[strlen(Path)])),
-	           "\\") != 0)
+	           "\\") != 0) {
 		strncat_s(Path,destlen,"\\",_TRUNCATE);
+	}
 }
 
 void Str2Hex(PCHAR Str, PCHAR Hex, int Len, int MaxHexLen, BOOL ConvSP)
@@ -146,15 +148,19 @@
 			if (j < MaxHexLen-2) {
 				Hex[j] = '$';
 				j++;
-				if (b<=0x9f)
+				if (b<=0x9f) {
 					Hex[j] = (char)((b >> 4) + 0x30);
-				else
+				}
+				else {
 					Hex[j] = (char)((b >> 4) + 0x37);
+				}
 				j++;
-				if ((b & 0x0f) <= 0x9)
+				if ((b & 0x0f) <= 0x9) {
 					Hex[j] = (char)((b & 0x0f) + 0x30);
-				else
+				}
+				else {
 					Hex[j] = (char)((b & 0x0f) + 0x37);
+				}
 				j++;
 			}
 		}
@@ -164,14 +170,18 @@
 
 BYTE ConvHexChar(BYTE b)
 {
-	if ((b>='0') && (b<='9'))
+	if ((b>='0') && (b<='9')) {
 		return (b - 0x30);
-	else if ((b>='A') && (b<='F'))
+	}
+	else if ((b>='A') && (b<='F')) {
 		return (b - 0x37);
-	else if ((b>='a') && (b<='f'))
+	}
+	else if ((b>='a') && (b<='f')) {
 		return (b - 0x57);
-	else
+	}
+	else {
 		return 0;
+	}
 }
 
 int Hex2Str(PCHAR Hex, PCHAR Str, int MaxLen)
@@ -186,16 +196,20 @@
 		b = Hex[i];
 		if (b=='$') {
 			i++;
-			if (i < imax)
+			if (i < imax) {
 				c = Hex[i];
-			else
+			}
+			else {
 				c = 0x30;
+			}
 			b = ConvHexChar(c) << 4;
 			i++;
-			if (i < imax)
+			if (i < imax) {
 				c = Hex[i];
-			else
+			}
+			else {
 				c = 0x30;
+			}
 			b = b + ConvHexChar(c);
 		};
 
@@ -203,8 +217,9 @@
 		j++;
 		i++;
 	}
-	if (j<MaxLen)
+	if (j<MaxLen) {
 		Str[j] = 0;
+	}
 
 	return j;
 }
@@ -221,8 +236,9 @@
 {
 	struct _stat st;
 
-	if (_stat(FName,&st)==-1)
+	if (_stat(FName,&st)==-1) {
 		return 0;
+	}
 	return (long)st.st_size;
 }
 
@@ -240,10 +256,12 @@
 {
 	int i;
 
-	if (FName[0]==0)
+	if (FName[0]==0) {
 		return;
-	if (strchr(FName,' ')==NULL)
+	}
+	if (strchr(FName,' ')==NULL) {
 		return;
+	}
 	i = strlen(FName);
 	memmove(&(FName[1]),FName,i);
 	FName[0] = '\"';
@@ -474,8 +492,9 @@
 	int DirLen, FNPos;
 
 	FName[0] = 0;
-	if ( ! GetFileNamePos(Temp,&DirLen,&FNPos) )
+	if ( ! GetFileNamePos(Temp,&DirLen,&FNPos) ) {
 		return;
+	}
 	FitFileName(&Temp[FNPos],templen - FNPos,DefExt);
 	if ( DirLen==0 ) {
 		strncpy_s(FName,destlen,HomeDir,_TRUNCATE);
@@ -535,8 +554,9 @@
 	k = 0;
 	do {
 		c = Source[j];
-		if ( c==',' )
+		if ( c==',' ) {
 			i++;
+		}
 		j++;
 		if ( (i==Nth) && (c!=',') && (k<Size-1) ) {
 			Dest[k] = c;
@@ -552,8 +572,9 @@
 	char T[15];
 
 	GetNthString(Source,Nth,sizeof(T),T);
-	if (sscanf(T, "%d", Num) != 1)
+	if (sscanf(T, "%d", Num) != 1) {
 		*Num = 0;
+	}
 }
 
 void WINAPI GetDefaultFName(char *home, char *file, char *dest, int destlen)

Modified: trunk/teraterm/keycode/keycode.c
===================================================================
--- trunk/teraterm/keycode/keycode.c	2009-05-11 14:10:03 UTC (rev 3391)
+++ trunk/teraterm/keycode/keycode.c	2009-05-12 11:55:27 UTC (rev 3392)
@@ -23,168 +23,178 @@
 static WORD Scan;
 
 int PASCAL WinMain(HINSTANCE hInstance,
-  HINSTANCE hPrevInstance,
-  LPSTR lpszCmdLine,
-  int nCmdShow)
+                   HINSTANCE hPrevInstance,
+                   LPSTR lpszCmdLine,
+                   int nCmdShow)
 {
-  WNDCLASS wc;
-  MSG msg;
-  HWND hWnd;
+	WNDCLASS wc;
+	MSG msg;
+	HWND hWnd;
 
-  // ƒCƒ“ƒXƒg[ƒ‰‚ÅŽÀs‚ðŒŸo‚·‚邽‚ß‚É mutex ‚ðì¬‚·‚é (2006.8.12 maya)
-  // 2d‹N“®–hŽ~‚Ì‚½‚ß‚Å‚Í‚È‚¢‚̂ŁA“Á‚É•Ô‚è’l‚ÍŒ©‚È‚¢
-  HANDLE hMutex;
-  hMutex = CreateMutex(NULL, TRUE, "TeraTermProKeycodeAppMutex");
+	// ƒCƒ“ƒXƒg[ƒ‰‚ÅŽÀs‚ðŒŸo‚·‚邽‚ß‚É mutex ‚ðì¬‚·‚é (2006.8.12 maya)
+	// 2d‹N“®–hŽ~‚Ì‚½‚ß‚Å‚Í‚È‚¢‚̂ŁA“Á‚É•Ô‚è’l‚ÍŒ©‚È‚¢
+	HANDLE hMutex;
+	hMutex = CreateMutex(NULL, TRUE, "TeraTermProKeycodeAppMutex");
 
-  DoCover_IsDebuggerPresent();
+	DoCover_IsDebuggerPresent();
 
-  if(!hPrevInstance)
-  {
-    wc.style = CS_OWNDC | CS_VREDRAW | CS_HREDRAW;
-    wc.lpfnWndProc = MainWndProc;
-    wc.cbClsExtra = 0;
-    wc.cbWndExtra = 0;
-    wc.hInstance = hInstance;
-    wc.hIcon = NULL;
-    wc.hCursor = LoadCursor(NULL, IDC_ARROW);
-    wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
-    wc.lpszMenuName = NULL;
-    wc.lpszClassName = ClassName;
-    RegisterClass(&wc);
-  }
+	if(!hPrevInstance) {
+		wc.style = CS_OWNDC | CS_VREDRAW | CS_HREDRAW;
+		wc.lpfnWndProc = MainWndProc;
+		wc.cbClsExtra = 0;
+		wc.cbWndExtra = 0;
+		wc.hInstance = hInstance;
+		wc.hIcon = NULL;
+		wc.hCursor = LoadCursor(NULL, IDC_ARROW);
+		wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
+		wc.lpszMenuName = NULL;
+		wc.lpszClassName = ClassName;
+		RegisterClass(&wc);
+	}
 
-  ghInstance = hInstance;
+	ghInstance = hInstance;
 
-  hWnd = CreateWindow(ClassName,
-    "Key code for Tera Term",
-    WS_OVERLAPPEDWINDOW,
-    CW_USEDEFAULT,
-    CW_USEDEFAULT,
-    200,
-    100,
-    NULL,
-    NULL,
-    hInstance,
-    NULL);
+	hWnd = CreateWindow(ClassName,
+	                    "Key code for Tera Term",
+	                    WS_OVERLAPPEDWINDOW,
+	                    CW_USEDEFAULT,
+	                    CW_USEDEFAULT,
+	                    200,
+	                    100,
+	                    NULL,
+	                    NULL,
+	                    hInstance,
+	                    NULL);
 
-  ShowWindow(hWnd, nCmdShow);
+	ShowWindow(hWnd, nCmdShow);
 
-  PostMessage(hWnd,WM_SETICON,ICON_SMALL,
-              (LPARAM)LoadImage(hInstance,
-                                MAKEINTRESOURCE(IDI_KEYCODE),
-                                IMAGE_ICON,16,16,0));
-  PostMessage(hWnd,WM_SETICON,ICON_BIG,
-              (LPARAM)LoadImage(hInstance,
-                                MAKEINTRESOURCE(IDI_KEYCODE),
-                                IMAGE_ICON,0,0,0));
+	PostMessage(hWnd,WM_SETICON,ICON_SMALL,
+	            (LPARAM)LoadImage(hInstance,
+	                              MAKEINTRESOURCE(IDI_KEYCODE),
+	                              IMAGE_ICON,16,16,0));
+	PostMessage(hWnd,WM_SETICON,ICON_BIG,
+	            (LPARAM)LoadImage(hInstance,
+	                              MAKEINTRESOURCE(IDI_KEYCODE),
+	                              IMAGE_ICON,0,0,0));
 
-  while(GetMessage(&msg, NULL, 0, 0)) {
-    TranslateMessage(&msg);
-    DispatchMessage(&msg);
-  }
+	while(GetMessage(&msg, NULL, 0, 0)) {
+		TranslateMessage(&msg);
+		DispatchMessage(&msg);
+	}
 
-  return msg.wParam;
+	return msg.wParam;
 }
 
 void KeyDownProc(HWND hWnd, WPARAM wParam, LPARAM lParam)
 {
-  if ((wParam==VK_SHIFT) ||
-      (wParam==VK_CONTROL) ||
-      (wParam==VK_MENU)) return;
+	if ((wParam==VK_SHIFT) ||
+	    (wParam==VK_CONTROL) ||
+	    (wParam==VK_MENU)) {
+		return;
+	}
 
-  Scan = HIWORD(lParam) & 0x1ff;
-  if ((GetKeyState(VK_SHIFT) & 0x80) != 0)
-    Scan = Scan | 0x200;
-  if ((GetKeyState(VK_CONTROL) & 0x80) != 0)
-    Scan = Scan | 0x400;
-  if ((GetKeyState(VK_MENU) & 0x80) != 0)
-    Scan = Scan | 0x800;
+	Scan = HIWORD(lParam) & 0x1ff;
+	if ((GetKeyState(VK_SHIFT) & 0x80) != 0) {
+		Scan = Scan | 0x200;
+	}
+	if ((GetKeyState(VK_CONTROL) & 0x80) != 0) {
+		Scan = Scan | 0x400;
+	}
+	if ((GetKeyState(VK_MENU) & 0x80) != 0) {
+		Scan = Scan | 0x800;
+	}
 
-  if (! KeyDown)
-  {
-    KeyDown = TRUE;
-    Short = TRUE;
-    SetTimer(hWnd,1,10,NULL);
-    InvalidateRect(hWnd,NULL,TRUE);
-  }
+	if (! KeyDown) {
+		KeyDown = TRUE;
+		Short = TRUE;
+		SetTimer(hWnd,1,10,NULL);
+		InvalidateRect(hWnd,NULL,TRUE);
+	}
 }
 
 void KeyUpProc(HWND hWnd, WPARAM wParam, LPARAM lParam)
 {
-  if (! KeyDown) return;
-  if (Short)
-    SetTimer(hWnd,2,500,NULL);
-  else {
-    KeyDown = FALSE;
-    InvalidateRect(hWnd,NULL,TRUE);
-  }
+	if (! KeyDown) {
+		return;
+	}
+	if (Short) {
+		SetTimer(hWnd,2,500,NULL);
+	}
+	else {
+		KeyDown = FALSE;
+		InvalidateRect(hWnd,NULL,TRUE);
+	}
 }
 
 void PaintProc(HWND hWnd)
 {
-  PAINTSTRUCT ps;
-  HDC hDC;
-  char OutStr[30];
+	PAINTSTRUCT ps;
+	HDC hDC;
+	char OutStr[30];
 
-  hDC = BeginPaint(hWnd, &ps);
+	hDC = BeginPaint(hWnd, &ps);
 
-  if (KeyDown)
-  {
-    _snprintf_s(OutStr,sizeof(OutStr),_TRUNCATE,"Key code is %u.",Scan);
-    TextOut(hDC,10,10,OutStr,strlen(OutStr));
-  }
-  else
-    TextOut(hDC,10,10,"Push any key.",13);
+	if (KeyDown) {
+		_snprintf_s(OutStr,sizeof(OutStr),_TRUNCATE,"Key code is %u.",Scan);
+		TextOut(hDC,10,10,OutStr,strlen(OutStr));
+	}
+	else {
+		TextOut(hDC,10,10,"Push any key.",13);
+	}
 
-  EndPaint(hWnd, &ps);
+	EndPaint(hWnd, &ps);
 }
 
 void TimerProc(HWND hWnd, WPARAM wParam)
 {
-  KillTimer(hWnd,wParam);
-  if (wParam==1)
-    Short = FALSE;
-  else if (wParam==2)
-  {
-    KeyDown = FALSE;
-    InvalidateRect(hWnd,NULL,TRUE);
-  }
+	KillTimer(hWnd,wParam);
+	if (wParam==1) {
+		Short = FALSE;
+	}
+	else if (wParam==2) {
+		KeyDown = FALSE;
+		InvalidateRect(hWnd,NULL,TRUE);
+	}
 }
 
 LRESULT CALLBACK MainWndProc(HWND hWnd, UINT msg, WPARAM wParam,
   LPARAM lParam)
 {
-  switch( msg ) {
-    case WM_KEYDOWN:
-      KeyDownProc(hWnd, wParam, lParam);
-      break;
-    case WM_KEYUP:
-      KeyUpProc(hWnd, wParam, lParam);
-      break;
-    case WM_SYSKEYDOWN:
-      if (wParam==VK_F10)
-	KeyDownProc(hWnd, wParam, lParam);
-      else
-	return (DefWindowProc(hWnd, msg, wParam, lParam));
-      break;
-    case WM_SYSKEYUP:
-      if (wParam==VK_F10)
-	KeyUpProc(hWnd, wParam, lParam);
-      else
-	return (DefWindowProc(hWnd, msg, wParam, lParam));
-      break;
-    case WM_PAINT:
-      PaintProc(hWnd);
-      break;
-    case WM_TIMER:
-      TimerProc(hWnd, wParam);
-      break;
-    case WM_DESTROY:
-      PostQuitMessage(0);
-      break;
-    default:
-      return (DefWindowProc(hWnd, msg, wParam, lParam));
-  }
+	switch( msg ) {
+		case WM_KEYDOWN:
+			KeyDownProc(hWnd, wParam, lParam);
+			break;
+		case WM_KEYUP:
+			KeyUpProc(hWnd, wParam, lParam);
+			break;
+		case WM_SYSKEYDOWN:
+			if (wParam==VK_F10) {
+				KeyDownProc(hWnd, wParam, lParam);
+			}
+			else {
+				return (DefWindowProc(hWnd, msg, wParam, lParam));
+			}
+			break;
+		case WM_SYSKEYUP:
+			if (wParam==VK_F10) {
+				KeyUpProc(hWnd, wParam, lParam);
+			}
+			else {
+				return (DefWindowProc(hWnd, msg, wParam, lParam));
+			}
+			break;
+		case WM_PAINT:
+			PaintProc(hWnd);
+			break;
+		case WM_TIMER:
+			TimerProc(hWnd, wParam);
+			break;
+		case WM_DESTROY:
+			PostQuitMessage(0);
+			break;
+		default:
+			return (DefWindowProc(hWnd, msg, wParam, lParam));
+	}
 
-  return 0;
+	return 0;
 }

Modified: trunk/teraterm/teraterm/ftdlg.cpp
===================================================================
--- trunk/teraterm/teraterm/ftdlg.cpp	2009-05-11 14:10:03 UTC (rev 3391)
+++ trunk/teraterm/teraterm/ftdlg.cpp	2009-05-12 11:55:27 UTC (rev 3392)
@@ -27,95 +27,96 @@
 
 BOOL CFileTransDlg::Create(PFileVar pfv, PComVar pcv, PTTSet pts)
 {
-  BOOL Ok;
-  WNDCLASS wc;
-  int fuLoad = LR_DEFAULTCOLOR;
+	BOOL Ok;
+	WNDCLASS wc;
+	int fuLoad = LR_DEFAULTCOLOR;
 
-  fv = pfv;
-  cv = pcv;
-  cv->FilePause &= ~fv->OpId;
-  ts = pts;
-  LOGFONT logfont;
-  HFONT font;
+	fv = pfv;
+	cv = pcv;
+	cv->FilePause &= ~fv->OpId;
+	ts = pts;
+	LOGFONT logfont;
+	HFONT font;
 
-  wc.style = CS_PARENTDC;
-  wc.lpfnWndProc = AfxWndProc;
-  wc.cbClsExtra = 0;
-  wc.cbWndExtra = DLGWINDOWEXTRA;
-  wc.hInstance = AfxGetInstanceHandle();
-  wc.hIcon = NULL;
-  wc.hCursor = LoadCursor(NULL,IDC_ARROW);
-  wc.hbrBackground = (HBRUSH)(COLOR_BTNFACE+1);
-  wc.lpszMenuName = NULL;
-  wc.lpszClassName = "FTDlg32";
-  RegisterClass(&wc);
+	wc.style = CS_PARENTDC;
+	wc.lpfnWndProc = AfxWndProc;
+	wc.cbClsExtra = 0;
+	wc.cbWndExtra = DLGWINDOWEXTRA;
+	wc.hInstance = AfxGetInstanceHandle();
+	wc.hIcon = NULL;
+	wc.hCursor = LoadCursor(NULL,IDC_ARROW);
+	wc.hbrBackground = (HBRUSH)(COLOR_BTNFACE+1);
+	wc.lpszMenuName = NULL;
+	wc.lpszClassName = "FTDlg32";
+	RegisterClass(&wc);
 
-  Pause = FALSE;
-  if (fv->OpId == OpLog) // parent window is desktop
-    Ok = CDialog::Create(CFileTransDlg::IDD, GetDesktopWindow());
-  else // parent window is VT window
-    Ok = CDialog::Create(CFileTransDlg::IDD, NULL);
+	Pause = FALSE;
+	if (fv->OpId == OpLog) { // parent window is desktop
+		Ok = CDialog::Create(CFileTransDlg::IDD, GetDesktopWindow());
+	}
+	else { // parent window is VT window
+	Ok = CDialog::Create(CFileTransDlg::IDD, NULL);
+	}
 
-  // ŒÄ‚яo‚µŒ³‚©‚çˆÚ“® (2009.2.7 maya)
-  if (!fv->HideDialog) {
-    ShowWindow(SW_SHOW);
-    if (fv->OpId == OpLog) {
-      ShowWindow(SW_MINIMIZE);
-    }
-  }
+	// ŒÄ‚яo‚µŒ³‚©‚çˆÚ“® (2009.2.7 maya)
+	if (!fv->HideDialog) {
+		ShowWindow(SW_SHOW);
+		if (fv->OpId == OpLog) {
+			ShowWindow(SW_MINIMIZE);
+		}
+	}
 
-  fv->HWin = GetSafeHwnd();
+	fv->HWin = GetSafeHwnd();
 
-  font = (HFONT)SendMessage(WM_GETFONT, 0, 0);
-  GetObject(font, sizeof(LOGFONT), &logfont);
-  if (get_lang_font("DLG_SYSTEM_FONT", fv->HWin, &logfont, &DlgFont, ts->UILanguageFile)) {
-	SendDlgItemMessage(IDC_TRANS_FILENAME, WM_SETFONT, (WPARAM)DlgFont, MAKELPARAM(TRUE,0));
-	SendDlgItemMessage(IDC_TRANSFNAME, WM_SETFONT, (WPARAM)DlgFont, MAKELPARAM(TRUE,0));
-	SendDlgItemMessage(IDC_FULLPATH_LABEL, WM_SETFONT, (WPARAM)DlgFont, MAKELPARAM(TRUE,0));
-	SendDlgItemMessage(IDC_EDIT_FULLPATH, WM_SETFONT, (WPARAM)DlgFont, MAKELPARAM(TRUE,0));
-	SendDlgItemMessage(IDC_TRANS_TRANS, WM_SETFONT, (WPARAM)DlgFont, MAKELPARAM(TRUE,0));
-	SendDlgItemMessage(IDC_TRANSBYTES, WM_SETFONT, (WPARAM)DlgFont, MAKELPARAM(TRUE,0));
-	SendDlgItemMessage(IDC_TRANSPAUSESTART, WM_SETFONT, (WPARAM)DlgFont, MAKELPARAM(TRUE,0));
-	SendDlgItemMessage(IDCANCEL, WM_SETFONT, (WPARAM)DlgFont, MAKELPARAM(TRUE,0));
-	SendDlgItemMessage(IDC_TRANSHELP, WM_SETFONT, (WPARAM)DlgFont, MAKELPARAM(TRUE,0));
-  }
+	font = (HFONT)SendMessage(WM_GETFONT, 0, 0);
+	GetObject(font, sizeof(LOGFONT), &logfont);
+	if (get_lang_font("DLG_SYSTEM_FONT", fv->HWin, &logfont, &DlgFont, ts->UILanguageFile)) {
+		SendDlgItemMessage(IDC_TRANS_FILENAME, WM_SETFONT, (WPARAM)DlgFont, MAKELPARAM(TRUE,0));
+		SendDlgItemMessage(IDC_TRANSFNAME, WM_SETFONT, (WPARAM)DlgFont, MAKELPARAM(TRUE,0));
+		SendDlgItemMessage(IDC_FULLPATH_LABEL, WM_SETFONT, (WPARAM)DlgFont, MAKELPARAM(TRUE,0));
+		SendDlgItemMessage(IDC_EDIT_FULLPATH, WM_SETFONT, (WPARAM)DlgFont, MAKELPARAM(TRUE,0));
+		SendDlgItemMessage(IDC_TRANS_TRANS, WM_SETFONT, (WPARAM)DlgFont, MAKELPARAM(TRUE,0));
+		SendDlgItemMessage(IDC_TRANSBYTES, WM_SETFONT, (WPARAM)DlgFont, MAKELPARAM(TRUE,0));
+		SendDlgItemMessage(IDC_TRANSPAUSESTART, WM_SETFONT, (WPARAM)DlgFont, MAKELPARAM(TRUE,0));
+		SendDlgItemMessage(IDCANCEL, WM_SETFONT, (WPARAM)DlgFont, MAKELPARAM(TRUE,0));
+		SendDlgItemMessage(IDC_TRANSHELP, WM_SETFONT, (WPARAM)DlgFont, MAKELPARAM(TRUE,0));
+	}
 
-  return Ok;
+	return Ok;
 }
 
 void CFileTransDlg::ChangeButton(BOOL PauseFlag)
 {
-  Pause = PauseFlag;
-  if (Pause)
-  {
-    get_lang_msg("DLG_FILETRANS_START", ts->UIMsg, sizeof(ts->UIMsg), "&Start", ts->UILanguageFile);
-    SetDlgItemText(IDC_TRANSPAUSESTART, ts->UIMsg);
-    cv->FilePause |= fv->OpId;
-  }
-  else {
-    get_lang_msg("DLG_FILETRANS_PAUSE", ts->UIMsg, sizeof(ts->UIMsg), "Pau&se", ts->UILanguageFile);
-    SetDlgItemText(IDC_TRANSPAUSESTART, ts->UIMsg);
-    cv->FilePause &= ~fv->OpId;
-  }
+	Pause = PauseFlag;
+	if (Pause) {
+		get_lang_msg("DLG_FILETRANS_START", ts->UIMsg, sizeof(ts->UIMsg), "&Start", ts->UILanguageFile);
+		SetDlgItemText(IDC_TRANSPAUSESTART, ts->UIMsg);
+		cv->FilePause |= fv->OpId;
+	}
+	else {
+		get_lang_msg("DLG_FILETRANS_PAUSE", ts->UIMsg, sizeof(ts->UIMsg), "Pau&se", ts->UILanguageFile);
+		SetDlgItemText(IDC_TRANSPAUSESTART, ts->UIMsg);
+		cv->FilePause &= ~fv->OpId;
+	}
 }
 
 void CFileTransDlg::RefreshNum()
 {
-  char NumStr[24];
-  double rate;
+	char NumStr[24];
+	double rate;
 
-  if (fv->OpId == OpSendFile && fv->FileSize > 0) {
-    rate = 100.0 * (double)fv->ByteCount / (double)fv->FileSize;
-    if (fv->ProgStat < (int)rate) {
-      fv->ProgStat = (int)rate;
-      SendDlgItemMessage(IDC_TRANSPROGRESS, PBM_SETPOS, (WPARAM)fv->ProgStat, 0);
-    }
-    _snprintf_s(NumStr,sizeof(NumStr),_TRUNCATE,"%u (%3.1f%%)",fv->ByteCount, rate);
-  }
-  else {
-    _snprintf_s(NumStr,sizeof(NumStr),_TRUNCATE,"%u",fv->ByteCount);
-  }
-  SetDlgItemText(IDC_TRANSBYTES, NumStr);
+	if (fv->OpId == OpSendFile && fv->FileSize > 0) {
+		rate = 100.0 * (double)fv->ByteCount / (double)fv->FileSize;
+		if (fv->ProgStat < (int)rate) {
+			fv->ProgStat = (int)rate;
+			SendDlgItemMessage(IDC_TRANSPROGRESS, PBM_SETPOS, (WPARAM)fv->ProgStat, 0);
+		}
+		_snprintf_s(NumStr,sizeof(NumStr),_TRUNCATE,"%u (%3.1f%%)",fv->ByteCount, rate);
+	}
+	else {
+		_snprintf_s(NumStr,sizeof(NumStr),_TRUNCATE,"%u",fv->ByteCount);
+	}
+	SetDlgItemText(IDC_TRANSBYTES, NumStr);
 }
 
 /////////////////////////////////////////////////////////////////////////////
@@ -123,57 +124,57 @@
 
 BOOL CFileTransDlg::OnInitDialog()
 {
-  int fuLoad = LR_DEFAULTCOLOR;
+	int fuLoad = LR_DEFAULTCOLOR;
 
-  SetWindowText(fv->DlgCaption);
-  SetDlgItemText(IDC_TRANSFNAME, &(fv->FullName[fv->DirLen]));
+	SetWindowText(fv->DlgCaption);
+	SetDlgItemText(IDC_TRANSFNAME, &(fv->FullName[fv->DirLen]));
 
-  // ƒƒOƒtƒ@ƒCƒ‹‚̓tƒ‹ƒpƒX•\Ž¦‚É‚·‚é(2004.8.6 yutaka)
-  SetDlgItemText(IDC_EDIT_FULLPATH, &(fv->FullName[0]));
+	// ƒƒOƒtƒ@ƒCƒ‹‚̓tƒ‹ƒpƒX•\Ž¦‚É‚·‚é(2004.8.6 yutaka)
+	SetDlgItemText(IDC_EDIT_FULLPATH, &(fv->FullName[0]));
 
-  if (is_NT4()) {
-    fuLoad = LR_VGACOLOR;
-  }
-  ::PostMessage(GetSafeHwnd(),WM_SETICON,ICON_SMALL,
-                (LPARAM)LoadImage(AfxGetInstanceHandle(),
-                                  MAKEINTRESOURCE(IDI_TTERM),
-                                  IMAGE_ICON,16,16,fuLoad));
-  ::PostMessage(GetSafeHwnd(),WM_SETICON,ICON_BIG,
-                (LPARAM)LoadImage(AfxGetInstanceHandle(),
-                                  MAKEINTRESOURCE(IDI_TTERM),
-                                  IMAGE_ICON, 0, 0, fuLoad));
+	if (is_NT4()) {
+		fuLoad = LR_VGACOLOR;
+	}
+	::PostMessage(GetSafeHwnd(),WM_SETICON,ICON_SMALL,
+	              (LPARAM)LoadImage(AfxGetInstanceHandle(),
+	                                MAKEINTRESOURCE(IDI_TTERM),
+	                                IMAGE_ICON,16,16,fuLoad));
+	::PostMessage(GetSafeHwnd(),WM_SETICON,ICON_BIG,
+	              (LPARAM)LoadImage(AfxGetInstanceHandle(),
+	                                MAKEINTRESOURCE(IDI_TTERM),
+	                                IMAGE_ICON, 0, 0, fuLoad));
 
-  return 1;
+	return 1;
 }
 
 void CFileTransDlg::OnCancel( )
 {
-  ::PostMessage(fv->HMainWin,WM_USER_FTCANCEL,fv->OpId,0);
+	::PostMessage(fv->HMainWin,WM_USER_FTCANCEL,fv->OpId,0);
 }
 
 BOOL CFileTransDlg::OnCommand(WPARAM wParam, LPARAM lParam) 
 {
-  switch (LOWORD(wParam)) {
-    case IDCANCEL:
-      ::PostMessage(fv->HMainWin,WM_USER_FTCANCEL,fv->OpId,0);
-      return TRUE;
-    case IDC_TRANSPAUSESTART:
-      ChangeButton(! Pause);
-      return TRUE;
-    case IDC_TRANSHELP:
-      ::PostMessage(fv->HMainWin,WM_USER_DLGHELP2,0,0);
-      return TRUE;
-    default:
-      return (CDialog::OnCommand(wParam,lParam));
-  }
+	switch (LOWORD(wParam)) {
+		case IDCANCEL:
+			::PostMessage(fv->HMainWin,WM_USER_FTCANCEL,fv->OpId,0);
+			return TRUE;
+		case IDC_TRANSPAUSESTART:
+			ChangeButton(! Pause);
+			return TRUE;
+		case IDC_TRANSHELP:
+			::PostMessage(fv->HMainWin,WM_USER_DLGHELP2,0,0);
+			return TRUE;
+		default:
+			return (CDialog::OnCommand(wParam,lParam));
+	}
 }
 
 void CFileTransDlg::PostNcDestroy()
 {
-  delete this;
+	delete this;
 }
 
 LRESULT CFileTransDlg::DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam)
 {
-  return DefDlgProc(GetSafeHwnd(),message,wParam,lParam);
+	return DefDlgProc(GetSafeHwnd(),message,wParam,lParam);
 }

Modified: trunk/teraterm/teraterm/prnabort.cpp
===================================================================
--- trunk/teraterm/teraterm/prnabort.cpp	2009-05-11 14:10:03 UTC (rev 3391)
+++ trunk/teraterm/teraterm/prnabort.cpp	2009-05-12 11:55:27 UTC (rev 3392)
@@ -25,59 +25,60 @@
 // CPrnAbortDlg message handler
 BOOL CPrnAbortDlg::Create(CWnd* p_Parent, PBOOL AbortFlag, PTTSet pts)
 {
-  BOOL Ok;
-  HWND HParent;
-  LOGFONT logfont;
-  HFONT font;
+	BOOL Ok;
+	HWND HParent;
+	LOGFONT logfont;
+	HFONT font;
 
-  m_pParent = p_Parent;
-  if (p_Parent!=NULL)
-    HParent = p_Parent->GetSafeHwnd();
-  else
-    HParent = NULL;
-  Abort = AbortFlag;
-  Ok = (CDialog::Create(CPrnAbortDlg::IDD, m_pParent));
-  if (Ok)
-  {
-    ::EnableWindow(HParent,FALSE);
-    ::EnableWindow(GetSafeHwnd(),TRUE);
-  }
+	m_pParent = p_Parent;
+	if (p_Parent!=NULL) {
+		HParent = p_Parent->GetSafeHwnd();
+	}
+	else {
+		HParent = NULL;
+	}
+	Abort = AbortFlag;
+	Ok = (CDialog::Create(CPrnAbortDlg::IDD, m_pParent));
+	if (Ok) {
+		::EnableWindow(HParent,FALSE);
+		::EnableWindow(GetSafeHwnd(),TRUE);
+	}
 
-  font = (HFONT)SendMessage(WM_GETFONT, 0, 0);
-  GetObject(font, sizeof(LOGFONT), &logfont);
-  if (get_lang_font("DLG_SYSTEM_FONT", GetSafeHwnd(), &logfont, &DlgFont, pts->UILanguageFile)) {
-	SendDlgItemMessage(IDC_PRNABORT_PRINTING, WM_SETFONT, (WPARAM)DlgFont, MAKELPARAM(TRUE,0));
-	SendDlgItemMessage(IDCANCEL, WM_SETFONT, (WPARAM)DlgFont, MAKELPARAM(TRUE,0));
-  }
+	font = (HFONT)SendMessage(WM_GETFONT, 0, 0);
+	GetObject(font, sizeof(LOGFONT), &logfont);
+	if (get_lang_font("DLG_SYSTEM_FONT", GetSafeHwnd(), &logfont, &DlgFont, pts->UILanguageFile)) {
+		SendDlgItemMessage(IDC_PRNABORT_PRINTING, WM_SETFONT, (WPARAM)DlgFont, MAKELPARAM(TRUE,0));
+		SendDlgItemMessage(IDCANCEL, WM_SETFONT, (WPARAM)DlgFont, MAKELPARAM(TRUE,0));
+	}
 
-  return Ok;
+	return Ok;
 }
 
 void CPrnAbortDlg::OnCancel()
 {
-  *Abort = TRUE;
-  DestroyWindow();
+	*Abort = TRUE;
+	DestroyWindow();
 }
 
 BOOL CPrnAbortDlg::OnCommand(WPARAM wParam, LPARAM lParam) 
 {
-  *Abort = TRUE;
-  DestroyWindow();
-	
-  return CDialog::OnCommand(wParam, lParam);
+	*Abort = TRUE;
+	DestroyWindow();
+
+	return CDialog::OnCommand(wParam, lParam);
 }
 
 void CPrnAbortDlg::PostNcDestroy() 
 {
-  delete this;
+	delete this;
 }
 
 BOOL CPrnAbortDlg::DestroyWindow() 
 {
-  HWND HParent;
+	HWND HParent;
 
-  HParent = m_pParent->GetSafeHwnd();
-  ::EnableWindow(HParent,TRUE);
-  ::SetFocus(HParent);
-  return CDialog::DestroyWindow();
+	HParent = m_pParent->GetSafeHwnd();
+	::EnableWindow(HParent,TRUE);
+	::SetFocus(HParent);
+	return CDialog::DestroyWindow();
 }

Modified: trunk/teraterm/teraterm/protodlg.cpp
===================================================================
--- trunk/teraterm/teraterm/protodlg.cpp	2009-05-11 14:10:03 UTC (rev 3391)
+++ trunk/teraterm/teraterm/protodlg.cpp	2009-05-12 11:55:27 UTC (rev 3392)
@@ -27,31 +27,31 @@
 
 BOOL CProtoDlg::Create(PFileVar pfv, PTTSet pts)
 {
-  BOOL Ok;
-  LOGFONT logfont;
-  HFONT font;
+	BOOL Ok;
+	LOGFONT logfont;
+	HFONT font;
 
-  fv = pfv;
+	fv = pfv;
 
-  Ok = CDialog::Create(CProtoDlg::IDD, NULL);
-  fv->HWin = GetSafeHwnd();
+	Ok = CDialog::Create(CProtoDlg::IDD, NULL);
+	fv->HWin = GetSafeHwnd();
 
-  font = (HFONT)SendMessage(WM_GETFONT, 0, 0);
-  GetObject(font, sizeof(LOGFONT), &logfont);
-  if (get_lang_font("DLG_SYSTEM_FONT", GetSafeHwnd(), &logfont, &DlgFont, pts->UILanguageFile)) {
-	SendDlgItemMessage(IDC_PROT_FILENAME, WM_SETFONT, (WPARAM)DlgFont, MAKELPARAM(TRUE,0));
-	SendDlgItemMessage(IDC_PROTOFNAME, WM_SETFONT, (WPARAM)DlgFont, MAKELPARAM(TRUE,0));
-	SendDlgItemMessage(IDC_PROT_PROT, WM_SETFONT, (WPARAM)DlgFont, MAKELPARAM(TRUE,0));
-	SendDlgItemMessage(IDC_PROTOPROT, WM_SETFONT, (WPARAM)DlgFont, MAKELPARAM(TRUE,0));
-	SendDlgItemMessage(IDC_PROT_PACKET, WM_SETFONT, (WPARAM)DlgFont, MAKELPARAM(TRUE,0));
-	SendDlgItemMessage(IDC_PROTOPKTNUM, WM_SETFONT, (WPARAM)DlgFont, MAKELPARAM(TRUE,0));
-	SendDlgItemMessage(IDC_PROT_TRANS, WM_SETFONT, (WPARAM)DlgFont, MAKELPARAM(TRUE,0));
-	SendDlgItemMessage(IDC_PROTOBYTECOUNT, WM_SETFONT, (WPARAM)DlgFont, MAKELPARAM(TRUE,0));
-	SendDlgItemMessage(IDC_PROTOPERCENT, WM_SETFONT, (WPARAM)DlgFont, MAKELPARAM(TRUE,0));
-	SendDlgItemMessage(IDCANCEL, WM_SETFONT, (WPARAM)DlgFont, MAKELPARAM(TRUE,0));
-  }
+	font = (HFONT)SendMessage(WM_GETFONT, 0, 0);
+	GetObject(font, sizeof(LOGFONT), &logfont);
+	if (get_lang_font("DLG_SYSTEM_FONT", GetSafeHwnd(), &logfont, &DlgFont, pts->UILanguageFile)) {
+		SendDlgItemMessage(IDC_PROT_FILENAME, WM_SETFONT, (WPARAM)DlgFont, MAKELPARAM(TRUE,0));
+		SendDlgItemMessage(IDC_PROTOFNAME, WM_SETFONT, (WPARAM)DlgFont, MAKELPARAM(TRUE,0));
+		SendDlgItemMessage(IDC_PROT_PROT, WM_SETFONT, (WPARAM)DlgFont, MAKELPARAM(TRUE,0));
+		SendDlgItemMessage(IDC_PROTOPROT, WM_SETFONT, (WPARAM)DlgFont, MAKELPARAM(TRUE,0));
+		SendDlgItemMessage(IDC_PROT_PACKET, WM_SETFONT, (WPARAM)DlgFont, MAKELPARAM(TRUE,0));
+		SendDlgItemMessage(IDC_PROTOPKTNUM, WM_SETFONT, (WPARAM)DlgFont, MAKELPARAM(TRUE,0));
+		SendDlgItemMessage(IDC_PROT_TRANS, WM_SETFONT, (WPARAM)DlgFont, MAKELPARAM(TRUE,0));
+		SendDlgItemMessage(IDC_PROTOBYTECOUNT, WM_SETFONT, (WPARAM)DlgFont, MAKELPARAM(TRUE,0));
+		SendDlgItemMessage(IDC_PROTOPERCENT, WM_SETFONT, (WPARAM)DlgFont, MAKELPARAM(TRUE,0));
+		SendDlgItemMessage(IDCANCEL, WM_SETFONT, (WPARAM)DlgFont, MAKELPARAM(TRUE,0));
+	}
 
-  return Ok;
+	return Ok;
 }
 
 /////////////////////////////////////////////////////////////////////////////
@@ -59,21 +59,21 @@
 
 void CProtoDlg::OnCancel( )
 {
-  ::PostMessage(fv->HMainWin,WM_USER_PROTOCANCEL,0,0);
+	::PostMessage(fv->HMainWin,WM_USER_PROTOCANCEL,0,0);
 }
 
 BOOL CProtoDlg::OnCommand(WPARAM wParam, LPARAM lParam) 
 {
-  switch (LOWORD(wParam)) {
-    case IDCANCEL:
-      ::PostMessage(fv->HMainWin,WM_USER_PROTOCANCEL,0,0);
-      return TRUE;
-    default:
-      return (CDialog::OnCommand(wParam,lParam));
-  }
+	switch (LOWORD(wParam)) {
+		case IDCANCEL:
+			::PostMessage(fv->HMainWin,WM_USER_PROTOCANCEL,0,0);
+			return TRUE;
+		default:
+			return (CDialog::OnCommand(wParam,lParam));
+	}
 }
 
 void CProtoDlg::PostNcDestroy()
 {
-  delete this;
+	delete this;
 }

Modified: trunk/teraterm/teraterm/tekwin.cpp
===================================================================
--- trunk/teraterm/teraterm/tekwin.cpp	2009-05-11 14:10:03 UTC (rev 3391)
+++ trunk/teraterm/teraterm/tekwin.cpp	2009-05-12 11:55:27 UTC (rev 3392)
@@ -32,191 +32,193 @@
 
 CTEKWindow::CTEKWindow()
 {
-  WNDCLASS wc;
-  RECT rect;
-  DWORD Style;
-  int fuLoad = LR_DEFAULTCOLOR;
+	WNDCLASS wc;
+	RECT rect;
+	DWORD Style;
+	int fuLoad = LR_DEFAULTCOLOR;
 
-  if (! LoadTTTEK()) return;
-  TEKInit(&tk, &ts);
+	if (! LoadTTTEK()) {
+		return;
+	}
+	TEKInit(&tk, &ts);
 
-  if (ts.HideTitle>0)
-    Style = WS_POPUP | WS_THICKFRAME | WS_BORDER;
-  else
-    Style = WS_CAPTION | WS_SYSMENU |
-	    WS_MINIMIZEBOX | WS_BORDER | WS_THICKFRAME;
+	if (ts.HideTitle>0) {
+		Style = WS_POPUP | WS_THICKFRAME | WS_BORDER;
+	}
+	else {
+		Style = WS_CAPTION | WS_SYSMENU |
+		        WS_MINIMIZEBOX | WS_BORDER | WS_THICKFRAME;
+	}
 
-  wc.style = CS_HREDRAW | CS_VREDRAW;
-  wc.lpfnWndProc = AfxWndProc;
-  wc.cbClsExtra = 0;
-  wc.cbWndExtra = 0;
-  wc.hInstance = AfxGetInstanceHandle();
-  wc.hIcon = NULL;
-  wc.hCursor = LoadCursor(NULL,IDC_ARROW);
-  wc.hbrBackground = NULL;
-  wc.lpszMenuName = NULL;
-  wc.lpszClassName = TEKClassName;
+	wc.style = CS_HREDRAW | CS_VREDRAW;
+	wc.lpfnWndProc = AfxWndProc;
+	wc.cbClsExtra = 0;
+	wc.cbWndExtra = 0;
+	wc.hInstance = AfxGetInstanceHandle();
+	wc.hIcon = NULL;
+	wc.hCursor = LoadCursor(NULL,IDC_ARROW);
+	wc.hbrBackground = NULL;
+	wc.lpszMenuName = NULL;
+	wc.lpszClassName = TEKClassName;
 
-  RegisterClass(&wc);
+	RegisterClass(&wc);
 
-  if (ts.TEKPos.x==CW_USEDEFAULT)
-    rect = rectDefault;
-  else {
-    rect.left = ts.TEKPos.x;
-    rect.top = ts.TEKPos.y;
-    rect.right = rect.left + 640; //temporary width
-    rect.bottom = rect.top + 400; //temporary height
-  }
-  Create(TEKClassName, "Tera Term", Style, rect, GetDesktopWindow(), NULL);
+	if (ts.TEKPos.x==CW_USEDEFAULT) {
+		rect = rectDefault;
+	}
+	else {
+		rect.left = ts.TEKPos.x;
+		rect.top = ts.TEKPos.y;
+		rect.right = rect.left + 640; //temporary width
+		rect.bottom = rect.top + 400; //temporary height
+	}
+	Create(TEKClassName, "Tera Term", Style, rect, GetDesktopWindow(), NULL);
 //--------------------------------------------------------
-  HTEKWin = GetSafeHwnd();
-  if (HTEKWin == NULL) return;
-  tk.HWin = HTEKWin;
-  // register this window to the window list
-  RegWin(HVTWin,HTEKWin);
+	HTEKWin = GetSafeHwnd();
+	if (HTEKWin == NULL) {
+		return;
+	}
+	tk.HWin = HTEKWin;
+	// register this window to the window list
+	RegWin(HVTWin,HTEKWin);
 
-    if (is_NT4()) {
-    fuLoad = LR_VGACOLOR;
-  }
-  ::PostMessage(HTEKWin,WM_SETICON,ICON_SMALL,
-                (LPARAM)LoadImage(AfxGetInstanceHandle(),
-                                  MAKEINTRESOURCE((ts.TEKIcon!=IdIconDefault)?ts.TEKIcon:IDI_TEK),
-                                  IMAGE_ICON,16,16,fuLoad));
-  ::PostMessage(HTEKWin,WM_SETICON,ICON_BIG,
-                (LPARAM)LoadImage(AfxGetInstanceHandle(),
-                                  MAKEINTRESOURCE((ts.TEKIcon!=IdIconDefault)?ts.TEKIcon:IDI_TEK),
-                                  IMAGE_ICON, 0, 0, fuLoad));
+	if (is_NT4()) {
+		fuLoad = LR_VGACOLOR;
+	}
+	::PostMessage(HTEKWin,WM_SETICON,ICON_SMALL,
+	              (LPARAM)LoadImage(AfxGetInstanceHandle(),
+	                                MAKEINTRESOURCE((ts.TEKIcon!=IdIconDefault)?ts.TEKIcon:IDI_TEK),
+	                                IMAGE_ICON,16,16,fuLoad));
+	::PostMessage(HTEKWin,WM_SETICON,ICON_BIG,
+	              (LPARAM)LoadImage(AfxGetInstanceHandle(),
+	                                MAKEINTRESOURCE((ts.TEKIcon!=IdIconDefault)?ts.TEKIcon:IDI_TEK),
+	                                IMAGE_ICON, 0, 0, fuLoad));
 
-  MainMenu = NULL;
-  WinMenu = NULL;
-  if ((ts.HideTitle==0) && (ts.PopupMenu==0))
-  {
-    InitMenu(&MainMenu);
-    ::SetMenu(HTEKWin,MainMenu);
-  }
+	MainMenu = NULL;
+	WinMenu = NULL;
+	if ((ts.HideTitle==0) && (ts.PopupMenu==0)) {
+		InitMenu(&MainMenu);
+		::SetMenu(HTEKWin,MainMenu);
+	}
 
-  ChangeTitle();
+	ChangeTitle();
 
-  ::GetWindowRect(tk.HWin,&rect);
-  TEKResizeWindow(&tk,&ts,
-     rect.right-rect.left, rect.bottom-rect.top);
+	::GetWindowRect(tk.HWin,&rect);
+	TEKResizeWindow(&tk,&ts, rect.right-rect.left, rect.bottom-rect.top);
 
-  if ((ts.PopupMenu>0) || (ts.HideTitle>0))
-    ::PostMessage(HTEKWin,WM_USER_CHANGEMENU,0,0);
+	if ((ts.PopupMenu>0) || (ts.HideTitle>0)) {
+		::PostMessage(HTEKWin,WM_USER_CHANGEMENU,0,0);
+	}
 
-  ::ShowWindow(tk.HWin, SW_SHOWNORMAL);
+	::ShowWindow(tk.HWin, SW_SHOWNORMAL);
 }
 
 int CTEKWindow::Parse()
 {
-  return (TEKParse(&tk,&ts,&cv));
+	return (TEKParse(&tk,&ts,&cv));
 }
 
 void CTEKWindow::RestoreSetup()
 {
-  TEKRestoreSetup(&tk,&ts);
-  ChangeTitle();
+	TEKRestoreSetup(&tk,&ts);
+	ChangeTitle();
 }
 
 void CTEKWindow::InitMenu(HMENU *Menu)
 {
-  *Menu = ::LoadMenu(AfxGetInstanceHandle(),
-					 MAKEINTRESOURCE(IDR_TEKMENU));
-  EditMenu = GetSubMenu(MainMenu,1);
-  FileMenu = GetSubMenu(MainMenu,0);
-  SetupMenu = GetSubMenu(MainMenu,2);
-  HelpMenu = GetSubMenu(MainMenu,4);
-  char uimsg[MAX_UIMSG];
+	*Menu = ::LoadMenu(AfxGetInstanceHandle(),
+	                   MAKEINTRESOURCE(IDR_TEKMENU));
+	EditMenu = GetSubMenu(MainMenu,1);
+	FileMenu = GetSubMenu(MainMenu,0);
+	SetupMenu = GetSubMenu(MainMenu,2);
+	HelpMenu = GetSubMenu(MainMenu,4);
+	char uimsg[MAX_UIMSG];
 
-  GetMenuString(*Menu, 0, uimsg, sizeof(uimsg), MF_BYPOSITION);
-  get_lang_msg("TEKMENU_FILE", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-  ModifyMenu(*Menu, 0, MF_BYPOSITION, 0, ts.UIMsg);
-  GetMenuString(FileMenu, ID_TEKFILE_PRINT, uimsg, sizeof(uimsg), MF_BYCOMMAND);
-  get_lang_msg("TEKMENU_FILE_PRINT", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-  ModifyMenu(FileMenu, ID_TEKFILE_PRINT, MF_BYCOMMAND, ID_TEKFILE_PRINT, ts.UIMsg);
-  GetMenuString(FileMenu, ID_TEKFILE_EXIT, uimsg, sizeof(uimsg), MF_BYCOMMAND);
-  get_lang_msg("TEKMENU_FILE_EXIT", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-  ModifyMenu(FileMenu, ID_TEKFILE_EXIT, MF_BYCOMMAND, ID_TEKFILE_EXIT, ts.UIMsg);
+	GetMenuString(*Menu, 0, uimsg, sizeof(uimsg), MF_BYPOSITION);
+	get_lang_msg("TEKMENU_FILE", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
+	ModifyMenu(*Menu, 0, MF_BYPOSITION, 0, ts.UIMsg);
+	GetMenuString(FileMenu, ID_TEKFILE_PRINT, uimsg, sizeof(uimsg), MF_BYCOMMAND);
+	get_lang_msg("TEKMENU_FILE_PRINT", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
+	ModifyMenu(FileMenu, ID_TEKFILE_PRINT, MF_BYCOMMAND, ID_TEKFILE_PRINT, ts.UIMsg);
+	GetMenuString(FileMenu, ID_TEKFILE_EXIT, uimsg, sizeof(uimsg), MF_BYCOMMAND);
+	get_lang_msg("TEKMENU_FILE_EXIT", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
+	ModifyMenu(FileMenu, ID_TEKFILE_EXIT, MF_BYCOMMAND, ID_TEKFILE_EXIT, ts.UIMsg);
 
-  GetMenuString(*Menu, 1, uimsg, sizeof(uimsg), MF_BYPOSITION);
-  get_lang_msg("TEKMENU_EDIT", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-  ModifyMenu(*Menu, 1, MF_BYPOSITION, 1, ts.UIMsg);
-  GetMenuString(EditMenu, ID_TEKEDIT_COPY, uimsg, sizeof(uimsg), MF_BYCOMMAND);
-  get_lang_msg("TEKMENU_EDIT_COPY", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-  ModifyMenu(EditMenu, ID_TEKEDIT_COPY, MF_BYCOMMAND, ID_TEKEDIT_COPY, ts.UIMsg);
-  GetMenuString(EditMenu, ID_TEKEDIT_COPYSCREEN, uimsg, sizeof(uimsg), MF_BYCOMMAND);
-  get_lang_msg("TEKMENU_EDIT_COPYSCREEN", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-  ModifyMenu(EditMenu, ID_TEKEDIT_COPYSCREEN, MF_BYCOMMAND, ID_TEKEDIT_COPYSCREEN, ts.UIMsg);
-  GetMenuString(EditMenu, ID_TEKEDIT_PASTE, uimsg, sizeof(uimsg), MF_BYCOMMAND);
-  get_lang_msg("TEKMENU_EDIT_PASTE", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-  ModifyMenu(EditMenu, ID_TEKEDIT_PASTE, MF_BYCOMMAND, ID_TEKEDIT_PASTE, ts.UIMsg);
-  GetMenuString(EditMenu, ID_TEKEDIT_PASTECR, uimsg, sizeof(uimsg), MF_BYCOMMAND);
-  get_lang_msg("TEKMENU_EDIT_PASTECR", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-  ModifyMenu(EditMenu, ID_TEKEDIT_PASTECR, MF_BYCOMMAND, ID_TEKEDIT_PASTECR, ts.UIMsg);
-  GetMenuString(EditMenu, ID_TEKEDIT_CLEARSCREEN, uimsg, sizeof(uimsg), MF_BYCOMMAND);
-  get_lang_msg("TEKMENU_EDIT_CLSCREEN", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-  ModifyMenu(EditMenu, ID_TEKEDIT_CLEARSCREEN, MF_BYCOMMAND, ID_TEKEDIT_CLEARSCREEN, ts.UIMsg);
+	GetMenuString(*Menu, 1, uimsg, sizeof(uimsg), MF_BYPOSITION);
+	get_lang_msg("TEKMENU_EDIT", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
+	ModifyMenu(*Menu, 1, MF_BYPOSITION, 1, ts.UIMsg);
+	GetMenuString(EditMenu, ID_TEKEDIT_COPY, uimsg, sizeof(uimsg), MF_BYCOMMAND);
+	get_lang_msg("TEKMENU_EDIT_COPY", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
+	ModifyMenu(EditMenu, ID_TEKEDIT_COPY, MF_BYCOMMAND, ID_TEKEDIT_COPY, ts.UIMsg);
+	GetMenuString(EditMenu, ID_TEKEDIT_COPYSCREEN, uimsg, sizeof(uimsg), MF_BYCOMMAND);
+	get_lang_msg("TEKMENU_EDIT_COPYSCREEN", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
+	ModifyMenu(EditMenu, ID_TEKEDIT_COPYSCREEN, MF_BYCOMMAND, ID_TEKEDIT_COPYSCREEN, ts.UIMsg);
+	GetMenuString(EditMenu, ID_TEKEDIT_PASTE, uimsg, sizeof(uimsg), MF_BYCOMMAND);
+	get_lang_msg("TEKMENU_EDIT_PASTE", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
+	ModifyMenu(EditMenu, ID_TEKEDIT_PASTE, MF_BYCOMMAND, ID_TEKEDIT_PASTE, ts.UIMsg);
+	GetMenuString(EditMenu, ID_TEKEDIT_PASTECR, uimsg, sizeof(uimsg), MF_BYCOMMAND);
+	get_lang_msg("TEKMENU_EDIT_PASTECR", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
+	ModifyMenu(EditMenu, ID_TEKEDIT_PASTECR, MF_BYCOMMAND, ID_TEKEDIT_PASTECR, ts.UIMsg);
+	GetMenuString(EditMenu, ID_TEKEDIT_CLEARSCREEN, uimsg, sizeof(uimsg), MF_BYCOMMAND);
+	get_lang_msg("TEKMENU_EDIT_CLSCREEN", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
+	ModifyMenu(EditMenu, ID_TEKEDIT_CLEARSCREEN, MF_BYCOMMAND, ID_TEKEDIT_CLEARSCREEN, ts.UIMsg);
 
-  GetMenuString(*Menu, 2, uimsg, sizeof(uimsg), MF_BYPOSITION);
-  get_lang_msg("TEKMENU_SETUP", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-  ModifyMenu(*Menu, 2, MF_BYPOSITION, 2, ts.UIMsg);
-  GetMenuString(SetupMenu, ID_TEKSETUP_WINDOW, uimsg, sizeof(uimsg), MF_BYCOMMAND);
-  get_lang_msg("TEKMENU_SETUP_WINDOW", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-  ModifyMenu(SetupMenu, ID_TEKSETUP_WINDOW, MF_BYCOMMAND, ID_TEKSETUP_WINDOW, ts.UIMsg);
-  GetMenuString(SetupMenu, ID_TEKSETUP_FONT, uimsg, sizeof(uimsg), MF_BYCOMMAND);
-  get_lang_msg("TEKMENU_SETUP_FONT", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-  ModifyMenu(SetupMenu, ID_TEKSETUP_FONT, MF_BYCOMMAND, ID_TEKSETUP_FONT, ts.UIMsg);
+	GetMenuString(*Menu, 2, uimsg, sizeof(uimsg), MF_BYPOSITION);
+	get_lang_msg("TEKMENU_SETUP", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
+	ModifyMenu(*Menu, 2, MF_BYPOSITION, 2, ts.UIMsg);
+	GetMenuString(SetupMenu, ID_TEKSETUP_WINDOW, uimsg, sizeof(uimsg), MF_BYCOMMAND);
+	get_lang_msg("TEKMENU_SETUP_WINDOW", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
+	ModifyMenu(SetupMenu, ID_TEKSETUP_WINDOW, MF_BYCOMMAND, ID_TEKSETUP_WINDOW, ts.UIMsg);
+	GetMenuString(SetupMenu, ID_TEKSETUP_FONT, uimsg, sizeof(uimsg), MF_BYCOMMAND);
+	get_lang_msg("TEKMENU_SETUP_FONT", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
+	ModifyMenu(SetupMenu, ID_TEKSETUP_FONT, MF_BYCOMMAND, ID_TEKSETUP_FONT, ts.UIMsg);
 
-  GetMenuString(*Menu, ID_TEKVTWIN, uimsg, sizeof(uimsg), MF_BYCOMMAND);
-  get_lang_msg("TEKMENU_VTWIN", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-  ModifyMenu(*Menu, ID_TEKVTWIN, MF_BYCOMMAND, ID_TEKVTWIN, ts.UIMsg);
+	GetMenuString(*Menu, ID_TEKVTWIN, uimsg, sizeof(uimsg), MF_BYCOMMAND);
+	get_lang_msg("TEKMENU_VTWIN", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
+	ModifyMenu(*Menu, ID_TEKVTWIN, MF_BYCOMMAND, ID_TEKVTWIN, ts.UIMsg);
 
-  GetMenuString(*Menu, 4, uimsg, sizeof(uimsg), MF_BYPOSITION);
-  get_lang_msg("TEKMENU_HELP", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-  ModifyMenu(*Menu, 4, MF_BYPOSITION, 4, ts.UIMsg);
-  GetMenuString(HelpMenu, ID_TEKHELP_INDEX, uimsg, sizeof(uimsg), MF_BYCOMMAND);
-  get_lang_msg("TEKMENU_HELP_INDEX", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-  ModifyMenu(HelpMenu, ID_TEKHELP_INDEX, MF_BYCOMMAND, ID_TEKHELP_INDEX, ts.UIMsg);
-  GetMenuString(HelpMenu, ID_TEKHELP_ABOUT, uimsg, sizeof(uimsg), MF_BYCOMMAND);
-  get_lang_msg("TEKMENU_HELP_ABOUT", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-  ModifyMenu(HelpMenu, ID_TEKHELP_ABOUT, MF_BYCOMMAND, ID_TEKHELP_ABOUT, ts.UIMsg);
+	GetMenuString(*Menu, 4, uimsg, sizeof(uimsg), MF_BYPOSITION);
+	get_lang_msg("TEKMENU_HELP", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
+	ModifyMenu(*Menu, 4, MF_BYPOSITION, 4, ts.UIMsg);
+	GetMenuString(HelpMenu, ID_TEKHELP_INDEX, uimsg, sizeof(uimsg), MF_BYCOMMAND);
+	get_lang_msg("TEKMENU_HELP_INDEX", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
+	ModifyMenu(HelpMenu, ID_TEKHELP_INDEX, MF_BYCOMMAND, ID_TEKHELP_INDEX, ts.UIMsg);
+	GetMenuString(HelpMenu, ID_TEKHELP_ABOUT, uimsg, sizeof(uimsg), MF_BYCOMMAND);
+	get_lang_msg("TEKMENU_HELP_ABOUT", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
+	ModifyMenu(HelpMenu, ID_TEKHELP_ABOUT, MF_BYCOMMAND, ID_TEKHELP_ABOUT, ts.UIMsg);
 
-  if ((ts.MenuFlag & MF_SHOWWINMENU) !=0)
-  {
-    WinMenu = CreatePopupMenu();
-    get_lang_msg("TEKMENU_WINDOW", ts.UIMsg, sizeof(ts.UIMsg), "&Window", ts.UILanguageFile);
-    ::InsertMenu(*Menu,4,
-		 MF_STRING | MF_ENABLED |
-		 MF_POPUP | MF_BYPOSITION,
-		 (int)WinMenu, ts.UIMsg);
-  }
+	if ((ts.MenuFlag & MF_SHOWWINMENU) !=0) {
+		WinMenu = CreatePopupMenu();
+		get_lang_msg("TEKMENU_WINDOW", ts.UIMsg, sizeof(ts.UIMsg), "&Window", ts.UILanguageFile);
+		::InsertMenu(*Menu,4,MF_STRING | MF_ENABLED | MF_POPUP | MF_BYPOSITION,
+		             (int)WinMenu, ts.UIMsg);
+	}
 }
 
 void CTEKWindow::InitMenuPopup(HMENU SubMenu)
 {
-  if (SubMenu==EditMenu)
-  {
-    if (tk.Select)
-      EnableMenuItem(EditMenu,ID_TEKEDIT_COPY,MF_BYCOMMAND | MF_ENABLED);
-    else
-      EnableMenuItem(EditMenu,ID_TEKEDIT_COPY,MF_BYCOMMAND | MF_GRAYED);
+	if (SubMenu==EditMenu) {
+		if (tk.Select) {
+			EnableMenuItem(EditMenu,ID_TEKEDIT_COPY,MF_BYCOMMAND | MF_ENABLED);
+		}
+		else {
+			EnableMenuItem(EditMenu,ID_TEKEDIT_COPY,MF_BYCOMMAND | MF_GRAYED);
+		}
 
-    if (cv.Ready &&
-	(IsClipboardFormatAvailable(CF_TEXT) ||
-	 IsClipboardFormatAvailable(CF_OEMTEXT)))
-    {
-      EnableMenuItem(EditMenu,ID_TEKEDIT_PASTE,MF_BYCOMMAND | MF_ENABLED);
-      EnableMenuItem(EditMenu,ID_TEKEDIT_PASTECR,MF_BYCOMMAND | MF_ENABLED);
-    }
-    else {
-      EnableMenuItem(EditMenu,ID_TEKEDIT_PASTE,MF_BYCOMMAND | MF_GRAYED);
-      EnableMenuItem(EditMenu,ID_TEKEDIT_PASTECR,MF_BYCOMMAND | MF_GRAYED);
-    }
-  }
-  else if ( SubMenu == WinMenu )
-  {
-    SetWinMenu(WinMenu, ts.UIMsg, sizeof(ts.UIMsg), ts.UILanguageFile, 0);
-  }
+		if (cv.Ready &&
+		    (IsClipboardFormatAvailable(CF_TEXT) ||
+		     IsClipboardFormatAvailable(CF_OEMTEXT))) {
+			EnableMenuItem(EditMenu,ID_TEKEDIT_PASTE,MF_BYCOMMAND | MF_ENABLED);
+			EnableMenuItem(EditMenu,ID_TEKEDIT_PASTECR,MF_BYCOMMAND | MF_ENABLED);
+		}
+		else {
+			EnableMenuItem(EditMenu,ID_TEKEDIT_PASTE,MF_BYCOMMAND | MF_GRAYED);
+			EnableMenuItem(EditMenu,ID_TEKEDIT_PASTECR,MF_BYCOMMAND | MF_GRAYED);
+		}
+	}
+	else if ( SubMenu == WinMenu ) {
+		SetWinMenu(WinMenu, ts.UIMsg, sizeof(ts.UIMsg), ts.UILanguageFile, 0);
+	}
 }
 
 BEGIN_MESSAGE_MAP(CTEKWindow, CFrameWnd)
@@ -270,531 +272,555 @@
 
 LRESULT CTEKWindow::DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam)
 {
-  LRESULT Result;
+	LRESULT Result;
 
-  if (message == MsgDlgHelp)
-  {
-    OnDlgHelp(wParam,lParam);
-    return 0;
-  }
-  else if ((ts.HideTitle>0) &&
-	   (message == WM_NCHITTEST))
-  {
-    Result = CFrameWnd::DefWindowProc(message,wParam,lParam);
-    if ((Result==HTCLIENT) && AltKey())
-      Result = HTCAPTION;
-    return Result;
-  }
+	if (message == MsgDlgHelp) {
+		OnDlgHelp(wParam,lParam);
+		return 0;
+	}
+	else if ((ts.HideTitle>0) &&
+	         (message == WM_NCHITTEST)) {
+		Result = CFrameWnd::DefWindowProc(message,wParam,lParam);
+		if ((Result==HTCLIENT) && AltKey()) {
+			Result = HTCAPTION;
+		}
+		return Result;
+	}
 
-  return (CFrameWnd::DefWindowProc(message,wParam,lParam));
+	return (CFrameWnd::DefWindowProc(message,wParam,lParam));
 }
 
 BOOL CTEKWindow::OnCommand(WPARAM wParam, LPARAM lParam)
 {
-  if ((LOWORD(wParam)>=ID_WINDOW_1) && (LOWORD(wParam)<ID_WINDOW_1+9))
-  {
-    SelectWin(LOWORD(wParam)-ID_WINDOW_1);
-    return TRUE;
-  }
-  else
-    return CFrameWnd::OnCommand(wParam, lParam);
+	if ((LOWORD(wParam)>=ID_WINDOW_1) && (LOWORD(wParam)<ID_WINDOW_1+9)) {
+		SelectWin(LOWORD(wParam)-ID_WINDOW_1);
+		return TRUE;
+	}
+	else {
+		return CFrameWnd::OnCommand(wParam, lParam);
+	}
 }
 
 void CTEKWindow::OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimized)
 {
-  if (nState!=WA_INACTIVE)
-  {
-    tk.Active = TRUE;
-    ActiveWin = IdTEK;
-  }
-  else {
-    tk.Active = FALSE;
-  }
+	if (nState!=WA_INACTIVE) {
+		tk.Active = TRUE;
+		ActiveWin = IdTEK;
+	}
+	else {
+		tk.Active = FALSE;
+	}
 }
 
 void CTEKWindow::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
 {
-  unsigned int i;
-  char Code;
+	unsigned int i;
+	char Code;
 
-  if (!KeybEnabled || (TalkStatus!=IdTalkKeyb)) return;
-  Code = nChar;
+	if (!KeybEnabled || (TalkStatus!=IdTalkKeyb)) {
+		return;
+	}
+	Code = nChar;
 
-  if (tk.GIN) TEKReportGIN(&tk,&ts,&cv,Code);
-  else
-    for (i=1 ; i<=nRepCnt ; i++)
-    {
-      CommTextOut(&cv,&Code,1);
-      if (ts.LocalEcho>0)
-	CommTextEcho(&cv,&Code,1);
-    }
+	if (tk.GIN) {
+		TEKReportGIN(&tk,&ts,&cv,Code);
+	}
+	else {
+		for (i=1 ; i<=nRepCnt ; i++) {
+			CommTextOut(&cv,&Code,1);
+			if (ts.LocalEcho>0) {
+				CommTextEcho(&cv,&Code,1);
+			}
+		}
+	}
 }
 
 void CTEKWindow::OnDestroy()
 {
-  // remove this window from the window list
-  UnregWin(HTEKWin);
+	// remove this window from the window list
+	UnregWin(HTEKWin);
 
-  CFrameWnd::OnDestroy();
+	CFrameWnd::OnDestroy();
 
-  TEKEnd(&tk);
-  FreeTTTEK();
-  HTEKWin = NULL;
-  pTEKWin = NULL;
-  ActiveWin = IdVT;
+	TEKEnd(&tk);
+	FreeTTTEK();
+	HTEKWin = NULL;
+	pTEKWin = NULL;
+	ActiveWin = IdVT;
 }
 
 void CTEKWindow::OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI)
 {
-  lpMMI->ptMaxSize.x = 10000;
-  lpMMI->ptMaxSize.y = 10000;
-  lpMMI->ptMaxTrackSize.x = 10000;
-  lpMMI->ptMaxTrackSize.y = 10000;
+	lpMMI->ptMaxSize.x = 10000;
+	lpMMI->ptMaxSize.y = 10000;
+	lpMMI->ptMaxTrackSize.x = 10000;
+	lpMMI->ptMaxTrackSize.y = 10000;
 }
 
 void CTEKWindow::OnInitMenuPopup(CMenu* pPopupMenu, UINT nIndex, BOOL bSysMenu)
 {
-  InitMenuPopup(pPopupMenu->m_hMenu);
+	InitMenuPopup(pPopupMenu->m_hMenu);
 }
 
 void CTEKWindow::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
 {
-  KeyDown(HTEKWin,nChar,nRepCnt,nFlags & 0x1ff);
+	KeyDown(HTEKWin,nChar,nRepCnt,nFlags & 0x1ff);
 }
 
 void CTEKWindow::OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags)
 {
-  KeyUp(nChar);
+	KeyUp(nChar);
 }
 
 void CTEKWindow::OnKillFocus(CWnd* pNewWnd)
 {
-  TEKDestroyCaret(&tk,&ts);
-  CFrameWnd::OnKillFocus(pNewWnd);
+	TEKDestroyCaret(&tk,&ts);
+	CFrameWnd::OnKillFocus(pNewWnd);
 }
 
 void CTEKWindow::OnLButtonDown(UINT nFlags, CPoint point)
 {
-  POINT p;
-  HMENU PopupMenu, PopupBase;
+	POINT p;
+	HMENU PopupMenu, PopupBase;
 
-  p.x = point.x;
-  p.y = point.y;
+	p.x = point.x;
+	p.y = point.y;
 
-  // popup menu
-  if (ControlKey() && (MainMenu==NULL))
-  {
-    InitMenu(&PopupMenu);
-    InitMenuPopup(EditMenu);
-    if (WinMenu!=NULL)
-      InitMenuPopup(WinMenu);
-    PopupBase = CreatePopupMenu();
-    get_lang_msg("MENU_CONTROL", ts.UIMsg, sizeof(ts.UIMsg), "&File", ts.UILanguageFile);
-    AppendMenu(PopupBase, MF_STRING | MF_ENABLED | MF_POPUP,
-               (UINT)GetSubMenu(PopupMenu,0), ts.UIMsg);
-    get_lang_msg("TEKMENU_EDIT", ts.UIMsg, sizeof(ts.UIMsg), "&Edit", ts.UILanguageFile);
-    AppendMenu(PopupBase, MF_STRING | MF_ENABLED | MF_POPUP,
-               (UINT)EditMenu, ts.UIMsg);
-    get_lang_msg("TEKMENU_SETUP", ts.UIMsg, sizeof(ts.UIMsg), "&Setup", ts.UILanguageFile);
-    AppendMenu(PopupBase, MF_STRING | MF_ENABLED | MF_POPUP,
-               (UINT)GetSubMenu(PopupMenu,2), ts.UIMsg);
-    get_lang_msg("TEKMENU_VTWIN", ts.UIMsg, sizeof(ts.UIMsg), "VT-Wind&ow", ts.UILanguageFile);
-    AppendMenu(PopupBase, MF_STRING | MF_ENABLED,
-               ID_TEKVTWIN, ts.UIMsg);
-    if (WinMenu!=NULL) {
-      get_lang_msg("TEKMENU_WINDOW", ts.UIMsg, sizeof(ts.UIMsg), "&Window", ts.UILanguageFile);
-      AppendMenu(PopupBase, MF_STRING | MF_ENABLED | MF_POPUP,
-                 (UINT)WinMenu, ts.UIMsg);
-    }
-    get_lang_msg("TEKMENU_HELP", ts.UIMsg, sizeof(ts.UIMsg), "&Help", ts.UILanguageFile);
-    AppendMenu(PopupBase, MF_STRING | MF_ENABLED | MF_POPUP,
-               (UINT)GetSubMenu(PopupMenu,4), ts.UIMsg);
-    ::ClientToScreen(tk.HWin, &p);
-    TrackPopupMenu(PopupBase,TPM_LEFTALIGN | TPM_LEFTBUTTON,
-                   p.x,p.y,0,tk.HWin,NULL);
-    if (WinMenu!=NULL)
-    {
-      DestroyMenu(WinMenu);
-      WinMenu = NULL;
-    }
-    DestroyMenu(PopupBase);
-    DestroyMenu(PopupMenu);
-    return;
-  }
+	// popup menu
+	if (ControlKey() && (MainMenu==NULL))
+	{
+		InitMenu(&PopupMenu);
+		InitMenuPopup(EditMenu);
+		if (WinMenu!=NULL) {
+			InitMenuPopup(WinMenu);
+		}
+		PopupBase = CreatePopupMenu();
+		get_lang_msg("MENU_CONTROL", ts.UIMsg, sizeof(ts.UIMsg), "&File", ts.UILanguageFile);
+		AppendMenu(PopupBase, MF_STRING | MF_ENABLED | MF_POPUP,
+		           (UINT)GetSubMenu(PopupMenu,0), ts.UIMsg);
+		get_lang_msg("TEKMENU_EDIT", ts.UIMsg, sizeof(ts.UIMsg), "&Edit", ts.UILanguageFile);
+		AppendMenu(PopupBase, MF_STRING | MF_ENABLED | MF_POPUP,
+		           (UINT)EditMenu, ts.UIMsg);
+		get_lang_msg("TEKMENU_SETUP", ts.UIMsg, sizeof(ts.UIMsg), "&Setup", ts.UILanguageFile);
+		AppendMenu(PopupBase, MF_STRING | MF_ENABLED | MF_POPUP,
+		           (UINT)GetSubMenu(PopupMenu,2), ts.UIMsg);
+		get_lang_msg("TEKMENU_VTWIN", ts.UIMsg, sizeof(ts.UIMsg), "VT-Wind&ow", ts.UILanguageFile);
+		AppendMenu(PopupBase, MF_STRING | MF_ENABLED,
+		           ID_TEKVTWIN, ts.UIMsg);
+		if (WinMenu!=NULL) {
+			get_lang_msg("TEKMENU_WINDOW", ts.UIMsg, sizeof(ts.UIMsg), "&Window", ts.UILanguageFile);
+			AppendMenu(PopupBase, MF_STRING | MF_ENABLED | MF_POPUP,
+			           (UINT)WinMenu, ts.UIMsg);
+		}
+		get_lang_msg("TEKMENU_HELP", ts.UIMsg, sizeof(ts.UIMsg), "&Help", ts.UILanguageFile);
+		AppendMenu(PopupBase, MF_STRING | MF_ENABLED | MF_POPUP,
+		           (UINT)GetSubMenu(PopupMenu,4), ts.UIMsg);
+		::ClientToScreen(tk.HWin, &p);
+		TrackPopupMenu(PopupBase,TPM_LEFTALIGN | TPM_LEFTBUTTON,
+		               p.x,p.y,0,tk.HWin,NULL);
+		if (WinMenu!=NULL) {
+			DestroyMenu(WinMenu);
+			WinMenu = NULL;
+		}
+		DestroyMenu(PopupBase);
+		DestroyMenu(PopupMenu);
+		return;
+	}
 
-  TEKWMLButtonDown(&tk,&ts,&cv,p);
+	TEKWMLButtonDown(&tk,&ts,&cv,p);
 }
 
 void CTEKWindow::OnLButtonUp(UINT nFlags, CPoint point)
 {
-  TEKWMLButtonUp(&tk,&ts);
+	TEKWMLButtonUp(&tk,&ts);
 }
 
 void CTEKWindow::OnMButtonUp(UINT nFlags, CPoint point)
 {
-  //OnRButtonUp(nFlags,point);
+	//OnRButtonUp(nFlags,point);
 }
 
 int CTEKWindow::OnMouseActivate(CWnd* pDesktopWnd, UINT nHitTest, UINT message)
 {
-  if ((ts.SelOnActive==0) &&
-      (nHitTest==HTCLIENT))   //disable mouse event for text selection
-    return MA_ACTIVATEANDEAT; //     when window is activated
-  else
-    return MA_ACTIVATE;
+	if ((ts.SelOnActive==0) &&
+	    (nHitTest==HTCLIENT)) { //disable mouse event for text selection
+		return MA_ACTIVATEANDEAT; //     when window is activated
+	}
+	else {
+		return MA_ACTIVATE;
+	}
 }
 
 void CTEKWindow::OnMouseMove(UINT nFlags, CPoint point)
 {
-  POINT p;
+	POINT p;
 
-  p.x = point.x;
-  p.y = point.y;
-  TEKWMMouseMove(&tk,&ts,p);
+	p.x = point.x;
+	p.y = point.y;
+	TEKWMMouseMove(&tk,&ts,p);
 }
 
 void CTEKWindow::OnMove(int x, int y)
 {
-  RECT R;
+	RECT R;
 
-  ::GetWindowRect(HTEKWin,&R);
-  ts.TEKPos.x = R.left;
-  ts.TEKPos.y = R.top;
+	::GetWindowRect(HTEKWin,&R);
+	ts.TEKPos.x = R.left;
+	ts.TEKPos.y = R.top;
 }
 
 void CTEKWindow::OnPaint()
 {
-  PAINTSTRUCT ps;
-  CDC *cdc;
-  HDC PaintDC;
+	PAINTSTRUCT ps;
+	CDC *cdc;
+	HDC PaintDC;
 
-  cdc = BeginPaint(&ps);
-  PaintDC = cdc->GetSafeHdc();
+	cdc = BeginPaint(&ps);
+	PaintDC = cdc->GetSafeHdc();
 
-  TEKPaint(&tk,&ts,PaintDC,&ps);
+	TEKPaint(&tk,&ts,PaintDC,&ps);
 
-  EndPaint(&ps);
+	EndPaint(&ps);
 }
 
 void CTEKWindow::OnRButtonUp(UINT nFlags, CPoint point)
 {
-  CBStartPaste(tk.HWin,FALSE,0,NULL,0);
+	CBStartPaste(tk.HWin,FALSE,0,NULL,0);
 }
 
 void CTEKWindow::OnSetFocus(CWnd* pOldWnd)
 {
-  TEKChangeCaret(&tk,&ts);
-  CFrameWnd::OnSetFocus(pOldWnd);	
+	TEKChangeCaret(&tk,&ts);
+	CFrameWnd::OnSetFocus(pOldWnd);	
 }
 
 void CTEKWindow::OnSize(UINT nType, int cx, int cy)
 {
-  int w, h;
-  RECT R;
+	int w, h;
+	RECT R;
 
-  if (tk.Minimized && (nType==SIZE_RESTORED))
-  {
-    tk.Minimized = FALSE;
-    return;
-  }
-  tk.Minimized = (nType==SIZE_MINIMIZED);
-  if (tk.Minimized) return;
+	if (tk.Minimized && (nType==SIZE_RESTORED)) {
+		tk.Minimized = FALSE;
+		return;
+	}
+	tk.Minimized = (nType==SIZE_MINIMIZED);
+	if (tk.Minimized) {
+		return;
+	}
 
-  ::GetWindowRect(tk.HWin,&R);
-  w = R.right - R.left;
-  h = R.bottom - R.top;
+	::GetWindowRect(tk.HWin,&R);
+	w = R.right - R.left;
+	h = R.bottom - R.top;
 
-  TEKWMSize(&tk,&ts,w,h,cx,cy);
+	TEKWMSize(&tk,&ts,w,h,cx,cy);
 }
 
 void CTEKWindow::OnSysCommand(UINT nID, LPARAM lParam)
 {
-  if (nID==ID_SHOWMENUBAR)
-  {
-    ts.PopupMenu = 0;
-    SwitchMenu();
-  }
-  else CFrameWnd::OnSysCommand(nID,lParam);
+	if (nID==ID_SHOWMENUBAR) {
+		ts.PopupMenu = 0;
+		SwitchMenu();
+	}
+	else {
+		CFrameWnd::OnSysCommand(nID,lParam);
+	}
 }
 
 void CTEKWindow::OnSysKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
 {
-  if (nChar==VK_F10)
-    OnKeyDown(nChar,nRepCnt,nFlags);
-  else
-    CFrameWnd::OnSysKeyDown(nChar,nRepCnt,nFlags);
+	if (nChar==VK_F10) {
+		OnKeyDown(nChar,nRepCnt,nFlags);
+	}
+	else {
+		CFrameWnd::OnSysKeyDown(nChar,nRepCnt,nFlags);
+	}
 }
 
 void CTEKWindow::OnSysKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags)
 {
-  if (nChar==VK_F10)
-    OnKeyUp(nChar,nRepCnt,nFlags);
-  else
-    CFrameWnd::OnSysKeyUp(nChar,nRepCnt,nFlags);
+	if (nChar==VK_F10) {
+		OnKeyUp(nChar,nRepCnt,nFlags);
+	}
+	else {
+		CFrameWnd::OnSysKeyUp(nChar,nRepCnt,nFlags);
+	}
 }
 
 void CTEKWindow::OnTimer(UINT nIDEvent)
 {
-  UINT T;
+	UINT T;
 
-  if (nIDEvent==IdCaretTimer)
-  {
-    if (ts.NonblinkingCursor!=0)
-    {
-      T = GetCaretBlinkTime();
-      SetCaretBlinkTime(T);
-    }
-    else
-      ::KillTimer(HTEKWin,IdCaretTimer);
-    return;
-  }
-  else
-    ::KillTimer(HTEKWin,nIDEvent);
+	if (nIDEvent==IdCaretTimer) {
+		if (ts.NonblinkingCursor!=0) {
+			T = GetCaretBlinkTime();
+			SetCaretBlinkTime(T);
+		}
+		else {
+			::KillTimer(HTEKWin,IdCaretTimer);
+		}
+		return;
+	}
+	else {
+		::KillTimer(HTEKWin,nIDEvent);
+	}
 }
 
 LONG CTEKWindow::OnAccelCommand(UINT wParam, LONG lParam)
 {
-  switch (wParam) {
-    case IdPrint:
-      OnFilePrint();
-      break;
-    case IdCmdEditCopy:
-      OnEditCopy();
-      break;
-    case IdCmdEditPaste:
-      OnEditPaste();
-      break;
-    case IdCmdEditPasteCR:
-      OnEditPasteCR();
-      break;
-    case IdCmdEditCLS:
-      OnEditClearScreen();
-      break;
-    case IdCmdCtrlCloseTEK:
-      OnFileExit();
-      break;
-    case IdCmdNextWin:
-      SelectNextWin(HTEKWin,1);
-      break;
-    case IdCmdPrevWin:
-      SelectNextWin(HTEKWin,-1);
-      break;
-    case IdBreak:
-    case IdCmdRestoreSetup:
-    case IdCmdLoadKeyMap:
-      ::PostMessage(HVTWin,WM_USER_ACCELCOMMAND,wParam,0);
-      break;
-  }
-  return 0;
+	switch (wParam) {
+		case IdPrint:
+			OnFilePrint();
+			break;
+		case IdCmdEditCopy:
+			OnEditCopy();
+			break;
+		case IdCmdEditPaste:
+			OnEditPaste();
+			break;
+		case IdCmdEditPasteCR:
+			OnEditPasteCR();
+			break;
+		case IdCmdEditCLS:
+			OnEditClearScreen();
+			break;
+		case IdCmdCtrlCloseTEK:
+			OnFileExit();
+			break;
+		case IdCmdNextWin:
+			SelectNextWin(HTEKWin,1);
+			break;
+		case IdCmdPrevWin:
+			SelectNextWin(HTEKWin,-1);
+			break;
+		case IdBreak:
+		case IdCmdRestoreSetup:
+		case IdCmdLoadKeyMap:
+			::PostMessage(HVTWin,WM_USER_ACCELCOMMAND,wParam,0);
+		break;
+	}
+	return 0;
 }
 
 LONG CTEKWindow::OnChangeMenu(UINT wParam, LONG lParam)
 {
-  HMENU SysMenu;
-  BOOL Show, B1, B2;
+	HMENU SysMenu;
+	BOOL Show, B1, B2;
 
-  Show = (ts.PopupMenu==0) && (ts.HideTitle==0);
-  if (Show != (MainMenu!=NULL))
-  {
-    if (! Show)
-    {
-      if (WinMenu!=NULL)
-	DestroyMenu(WinMenu);
-      WinMenu = NULL;
-      DestroyMenu(MainMenu);
-      MainMenu = NULL;
-    }
-    else
-      InitMenu(&MainMenu);
+	Show = (ts.PopupMenu==0) && (ts.HideTitle==0);
+	if (Show != (MainMenu!=NULL)) {
+		if (! Show) {
+			if (WinMenu!=NULL) {
+				DestroyMenu(WinMenu);
+			}
+			WinMenu = NULL;
+			DestroyMenu(MainMenu);
+			MainMenu = NULL;
+		}
+		else {
+			InitMenu(&MainMenu);
+		}
 
-    tk.AdjustSize = TRUE;
-    ::SetMenu(tk.HWin, MainMenu);
-    ::DrawMenuBar(HTEKWin);
-  }
+		tk.AdjustSize = TRUE;
+		::SetMenu(tk.HWin, MainMenu);
+		::DrawMenuBar(HTEKWin);
+	}
 
-  B1 = ((ts.MenuFlag & MF_SHOWWINMENU)!=0);
-  B2 = (WinMenu!=NULL);
-  if ((MainMenu!=NULL) &&
-      (B1 != B2))
-  {
-    if (WinMenu==NULL)
-    {
-      WinMenu = CreatePopupMenu();
-      get_lang_msg("TEKMENU_WINDOW", ts.UIMsg, sizeof(ts.UIMsg), "&Window", ts.UILanguageFile);
-      ::InsertMenu(MainMenu,4,
-                   MF_STRING | MF_ENABLED |
-                   MF_POPUP | MF_BYPOSITION,
-                   (int)WinMenu, ts.UIMsg);
-    }
-    else {
-      RemoveMenu(MainMenu,4,MF_BYPOSITION);
-      DestroyMenu(WinMenu);
-      WinMenu = NULL;
-    }
-    ::DrawMenuBar(HTEKWin);
-  }
+	B1 = ((ts.MenuFlag & MF_SHOWWINMENU)!=0);
+	B2 = (WinMenu!=NULL);
+	if ((MainMenu!=NULL) &&
+	    (B1 != B2)) {
+		if (WinMenu==NULL) {
+			WinMenu = CreatePopupMenu();
+			get_lang_msg("TEKMENU_WINDOW", ts.UIMsg, sizeof(ts.UIMsg), "&Window", ts.UILanguageFile);
+			::InsertMenu(MainMenu,4,
+			             MF_STRING | MF_ENABLED | MF_POPUP | MF_BYPOSITION,
+			             (int)WinMenu, ts.UIMsg);
+		}
+		else {
+			RemoveMenu(MainMenu,4,MF_BYPOSITION);
+			DestroyMenu(WinMenu);
+			WinMenu = NULL;
+		}
+		::DrawMenuBar(HTEKWin);
+	}
 
-  ::GetSystemMenu(tk.HWin,TRUE);
-  if ((! Show) && ((ts.MenuFlag & MF_NOSHOWMENU)==0))
-  {
-    SysMenu = ::GetSystemMenu(tk.HWin,FALSE);
-    AppendMenu(SysMenu, MF_SEPARATOR, 0, NULL);
-    get_lang_msg("TEKMENU_SHOW_MENUBAR", ts.UIMsg, sizeof(ts.UIMsg), "Show menu &bar", ts.UILanguageFile);
-    AppendMenu(SysMenu, MF_STRING, ID_SHOWMENUBAR, ts.UIMsg);
-  }
-  return 0;
+	::GetSystemMenu(tk.HWin,TRUE);
+	if ((! Show) && ((ts.MenuFlag & MF_NOSHOWMENU)==0)) {
+		SysMenu = ::GetSystemMenu(tk.HWin,FALSE);
+		AppendMenu(SysMenu, MF_SEPARATOR, 0, NULL);
+		get_lang_msg("TEKMENU_SHOW_MENUBAR", ts.UIMsg, sizeof(ts.UIMsg), "Show menu &bar", ts.UILanguageFile);
+		AppendMenu(SysMenu, MF_STRING, ID_SHOWMENUBAR, ts.UIMsg);
+	}
+	return 0;
 }
 
 LONG CTEKWindow::OnChangeTBar(UINT wParam, LONG lParam)
 {
-  BOOL TBar;
-  DWORD Style;
-  HMENU SysMenu;
+	BOOL TBar;
+	DWORD Style;
+	HMENU SysMenu;
 
-  Style = GetWindowLong (HTEKWin, GWL_STYLE);
-  TBar = ((Style & WS_SYSMENU)!=0);
-  if (TBar == (ts.HideTitle==0)) return 0;
-  if (ts.HideTitle>0)
-    Style = Style & ~(WS_SYSMENU | WS_CAPTION |
-		      WS_MINIMIZEBOX) | WS_BORDER | WS_POPUP;
-  else
-    Style = Style & ~WS_POPUP | WS_SYSMENU | WS_CAPTION |
-		     WS_MINIMIZEBOX;
-  tk.AdjustSize = TRUE;
-  SetWindowLong (HTEKWin, GWL_STYLE, Style);
-  ::SetWindowPos (HTEKWin, NULL, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE |
-		  SWP_NOZORDER | SWP_FRAMECHANGED);
-  ::ShowWindow (HTEKWin, SW_SHOW);
+	Style = GetWindowLong (HTEKWin, GWL_STYLE);
+	TBar = ((Style & WS_SYSMENU)!=0);
+	if (TBar == (ts.HideTitle==0)) {
+		return 0;
+	}
+	if (ts.HideTitle>0) {
+		Style = Style & ~(WS_SYSMENU | WS_CAPTION |
+		                  WS_MINIMIZEBOX) | WS_BORDER | WS_POPUP;
+	}
+	else {
+		Style = Style & ~WS_POPUP | WS_SYSMENU | WS_CAPTION | WS_MINIMIZEBOX;
+	}
+	tk.AdjustSize = TRUE;
+	SetWindowLong (HTEKWin, GWL_STYLE, Style);
+	::SetWindowPos (HTEKWin, NULL, 0, 0, 0, 0,
+	                SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED);
+	::ShowWindow (HTEKWin, SW_SHOW);
 
-  if ((ts.HideTitle==0) && (MainMenu==NULL) &&
-      ((ts.MenuFlag & MF_NOSHOWMENU) == 0))
-  {
-    SysMenu = ::GetSystemMenu(HTEKWin,FALSE);
-    AppendMenu(SysMenu, MF_SEPARATOR, 0, NULL);
-    get_lang_msg("TEKMENU_SHOW_MENUBAR", ts.UIMsg, sizeof(ts.UIMsg), "Show menu &bar", ts.UILanguageFile);
-    AppendMenu(SysMenu, MF_STRING, ID_SHOWMENUBAR, ts.UIMsg);
-  }
-  return 0;
+	if ((ts.HideTitle==0) && (MainMenu==NULL) &&
+	    ((ts.MenuFlag & MF_NOSHOWMENU) == 0)) {
+		SysMenu = ::GetSystemMenu(HTEKWin,FALSE);
+		AppendMenu(SysMenu, MF_SEPARATOR, 0, NULL);
+		get_lang_msg("TEKMENU_SHOW_MENUBAR", ts.UIMsg, sizeof(ts.UIMsg), "Show menu &bar", ts.UILanguageFile);
+		AppendMenu(SysMenu, MF_STRING, ID_SHOWMENUBAR, ts.UIMsg);
+	}
+	return 0;
 }
 
 LONG CTEKWindow::OnDlgHelp(UINT wParam, LONG lParam)
 {
-  OpenHelp(tk.HWin,HH_HELP_CONTEXT,HelpId);
-  return 0;
+	OpenHelp(tk.HWin,HH_HELP_CONTEXT,HelpId);
+	return 0;
 }
 
 LONG CTEKWindow::OnGetSerialNo(UINT wParam, LONG lParam)
 {
-  return (LONG)SerialNo;
+	return (LONG)SerialNo;
 }
 
 void CTEKWindow::OnFilePrint()
 {
-  BOOL Sel;
-  HDC PrintDC;
+	BOOL Sel;
+	HDC PrintDC;
 
-  HelpId = HlpTEKFilePrint;
+	HelpId = HlpTEKFilePrint;
 
-  Sel = tk.Select;
-  PrintDC = PrnBox(tk.HWin,&Sel);
-  if (PrintDC==NULL) return;
-  if (! PrnStart(ts.Title)) return;
+	Sel = tk.Select;
+	PrintDC = PrnBox(tk.HWin,&Sel);
+	if (PrintDC==NULL) {
+		return;
+	}
+	if (! PrnStart(ts.Title)) {
+		return;
+	}
 
-  (*TEKPrint)(&tk,&ts,PrintDC,Sel);
+	(*TEKPrint)(&tk,&ts,PrintDC,Sel);
 
-  PrnStop();
+	PrnStop();
 }
 
 void CTEKWindow::OnFileExit()
 {
-  DestroyWindow();
+	DestroyWindow();
 }
 
 void CTEKWindow::OnEditCopy()
 {
-  (*TEKCMCopy)(&tk,&ts);
+	(*TEKCMCopy)(&tk,&ts);
 }
 
 void CTEKWindow::OnEditCopyScreen()
 {
-  (*TEKCMCopyScreen)(&tk,&ts);
+	(*TEKCMCopyScreen)(&tk,&ts);
 }
 
 void CTEKWindow::OnEditPaste()
 {
-  CBStartPaste(tk.HWin,FALSE,0,NULL,0);
+	CBStartPaste(tk.HWin,FALSE,0,NULL,0);
 }
 
 void CTEKWindow::OnEditPasteCR()
 {
-  CBStartPaste(tk.HWin,TRUE,0,NULL,0);
+	CBStartPaste(tk.HWin,TRUE,0,NULL,0);
 }
 
 void CTEKWindow::OnEditClearScreen()
 {
-  (*TEKClearScreen)(&tk,&ts);
+	(*TEKClearScreen)(&tk,&ts);
 }
 
 void CTEKWindow::OnSetupWindow()
 {
-  BOOL Ok;
-  WORD OldEmu;
+	BOOL Ok;
+	WORD OldEmu;
 
-  HelpId = HlpTEKSetupWindow;
-  ts.VTFlag = 0;
-  ts.SampleFont = tk.TEKFont[0];
+	HelpId = HlpTEKSetupWindow;
+	ts.VTFlag = 0;
+	ts.SampleFont = tk.TEKFont[0];
 
-  if (! LoadTTDLG()) return;
-  OldEmu = ts.TEKColorEmu;
-  Ok = (*SetupWin)(HTEKWin, &ts);
-  FreeTTDLG();
-  if (Ok)
-  {
-    (*TEKResetWin)(&tk,&ts,OldEmu);
-    ChangeTitle();
-    SwitchMenu();
-    SwitchTitleBar();
-  }
+	if (! LoadTTDLG()) {
+		return;
+	}
+	OldEmu = ts.TEKColorEmu;
+	Ok = (*SetupWin)(HTEKWin, &ts);
+	FreeTTDLG();
+	if (Ok) {
+		(*TEKResetWin)(&tk,&ts,OldEmu);
+		ChangeTitle();
+		SwitchMenu();
+		SwitchTitleBar();
+	}
 }
 
 void CTEKWindow::OnSetupFont()
 {
-  BOOL Ok;
+	BOOL Ok;
 
-  HelpId = HlpTEKSetupFont;
-  ts.VTFlag = 0;
-  if (! LoadTTDLG()) return;
-  Ok = (*ChooseFontDlg)(HTEKWin,&tk.TEKlf,&ts);
-  FreeTTDLG();
-  if (! Ok) return;
+	HelpId = HlpTEKSetupFont;
+	ts.VTFlag = 0;
+	if (! LoadTTDLG()) {
+		return;
+	}
+	Ok = (*ChooseFontDlg)(HTEKWin,&tk.TEKlf,&ts);
+	FreeTTDLG();
+	if (! Ok) {
+		return;
+	}
 
-  (*TEKSetupFont)(&tk,&ts);
+	(*TEKSetupFont)(&tk,&ts);
 }
 
 void CTEKWindow::OnVTWin()
 {
-  VTActivate();
+	VTActivate();
 }
 
 void CTEKWindow::OnWindowWindow()
 {
-  BOOL Close;
+	BOOL Close;
 
-  HelpId = HlpWindowWindow;
-  if (! LoadTTDLG()) return;
-  (*WindowWindow)(HTEKWin,&Close);
-  FreeTTDLG();
-  if (Close) OnClose();
+	HelpId = HlpWindowWindow;
+	if (! LoadTTDLG()) {
+		return;
+	}
+	(*WindowWindow)(HTEKWin,&Close);
+	FreeTTDLG();
+	if (Close) {
+		OnClose();
+	}
 }
 
 void CTEKWindow::OnHelpIndex()
 {
-  OpenHelp(tk.HWin,HH_DISPLAY_TOPIC,0);
+	OpenHelp(tk.HWin,HH_DISPLAY_TOPIC,0);
 }
 
 void CTEKWindow::OnHelpAbout()
 {
-  if (! LoadTTDLG()) return;
-  (*AboutDialog)(tk.HWin);
-  FreeTTDLG();
+	if (! LoadTTDLG()) {
+		return;
+	}
+	(*AboutDialog)(tk.HWin);
+	FreeTTDLG();
 }

Modified: trunk/teraterm/teraterm/teraprn.cpp
===================================================================
--- trunk/teraterm/teraterm/teraprn.cpp	2009-05-11 14:10:03 UTC (rev 3391)
+++ trunk/teraterm/teraterm/teraprn.cpp	2009-05-12 11:55:27 UTC (rev 3392)
@@ -52,109 +52,116 @@
 /* Print Abortion Call Back Function */
 BOOL CALLBACK PrnAbortProc(HDC PDC, int Code)
 {
-  MSG m;
+	MSG m;
 
-  while ((! PrintAbortFlag) && PeekMessage(&m, 0,0,0, PM_REMOVE))
-    if ((HPrnAbortDlg==NULL) || (! IsDialogMessage(HPrnAbortDlg, &m)))
-    {
-      TranslateMessage(&m);
-      DispatchMessage(&m);
-    }
+	while ((! PrintAbortFlag) && PeekMessage(&m, 0,0,0, PM_REMOVE))
+		if ((HPrnAbortDlg==NULL) || (! IsDialogMessage(HPrnAbortDlg, &m))) {
+			TranslateMessage(&m);
+			DispatchMessage(&m);
+		}
 
-  if (PrintAbortFlag)
-  {
-    HPrnAbortDlg = NULL;
-    PrnAbortDlg = NULL;
-    return FALSE;
-  }
-  else
-    return TRUE;
+	if (PrintAbortFlag) {
+		HPrnAbortDlg = NULL;
+		PrnAbortDlg = NULL;
+		return FALSE;
+	}
+	else {
+		return TRUE;
+	}
 }
 
 extern "C" {
 HDC PrnBox(HWND HWin, PBOOL Sel)
 {
-  /* initialize PrnDlg record */
-  memset(&PrnDlg, 0, sizeof(PRINTDLG));
-  PrnDlg.lStructSize = sizeof(PRINTDLG);
-  PrnDlg.hwndOwner = HWin;
-  PrnDlg.Flags = PD_RETURNDC | PD_NOPAGENUMS | PD_SHOWHELP;
-  if (! *Sel)
-    PrnDlg.Flags = PrnDlg.Flags | PD_NOSELECTION;
-  PrnDlg.nCopies = 1;
+	/* initialize PrnDlg record */
+	memset(&PrnDlg, 0, sizeof(PRINTDLG));
+	PrnDlg.lStructSize = sizeof(PRINTDLG);
+	PrnDlg.hwndOwner = HWin;
+	PrnDlg.Flags = PD_RETURNDC | PD_NOPAGENUMS | PD_SHOWHELP;
+	if (! *Sel) {
+		PrnDlg.Flags = PrnDlg.Flags | PD_NOSELECTION;
+	}
+	PrnDlg.nCopies = 1;
 
-  /* 'Print' dialog box */
-  if (! PrintDlg(&PrnDlg)) return NULL; /* if 'Cancel' button clicked, exit */
-  if (PrnDlg.hDC == NULL) return NULL;
-  PrintDC = PrnDlg.hDC;
-  *Sel = (PrnDlg.Flags & PD_SELECTION) != 0;
-  return PrintDC;
+	/* 'Print' dialog box */
+	if (! PrintDlg(&PrnDlg)) {
+		return NULL; /* if 'Cancel' button clicked, exit */
+	}
+	if (PrnDlg.hDC == NULL) {
+		return NULL;
+	}
+	PrintDC = PrnDlg.hDC;
+	*Sel = (PrnDlg.Flags & PD_SELECTION) != 0;
+	return PrintDC;
 }
 }
 
 extern "C" {
 BOOL PrnStart(LPSTR DocumentName)
 {
-  DOCINFO Doc;
-  char DocName[50];
-  CWnd* pParent;
-  char uimsg[MAX_UIMSG];
+	DOCINFO Doc;
+	char DocName[50];
+	CWnd* pParent;
+	char uimsg[MAX_UIMSG];
 
-  Printing = FALSE;
-  PrintAbortFlag = FALSE;
+	Printing = FALSE;
+	PrintAbortFlag = FALSE;
 
-  PrnAbortDlg = new CPrnAbortDlg();
-  if (PrnAbortDlg==NULL) return FALSE;
-  if (ActiveWin==IdVT)
-    pParent = (CWnd*)pVTWin;
-  else
-    pParent = (CWnd*)pTEKWin;
-  PrnAbortDlg->Create(pParent,&PrintAbortFlag,&ts);
-  HPrnAbortDlg = PrnAbortDlg->GetSafeHwnd();
+	PrnAbortDlg = new CPrnAbortDlg();
+	if (PrnAbortDlg==NULL) {
+		return FALSE;
+	}
+	if (ActiveWin==IdVT) {
+		pParent = (CWnd*)pVTWin;
+	}
+	else {
+		pParent = (CWnd*)pTEKWin;
+	}
+	PrnAbortDlg->Create(pParent,&PrintAbortFlag,&ts);
+	HPrnAbortDlg = PrnAbortDlg->GetSafeHwnd();
 
-  GetDlgItemText(HPrnAbortDlg, IDC_PRNABORT_PRINTING, uimsg, sizeof(uimsg));
-  get_lang_msg("DLG_PRNABORT_PRINTING", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-  SetDlgItemText(HPrnAbortDlg, IDC_PRNABORT_PRINTING, ts.UIMsg);
-  GetDlgItemText(HPrnAbortDlg, IDCANCEL, uimsg, sizeof(uimsg));
-  get_lang_msg("BTN_CANCEL", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-  SetDlgItemText(HPrnAbortDlg, IDCANCEL, ts.UIMsg);
+	GetDlgItemText(HPrnAbortDlg, IDC_PRNABORT_PRINTING, uimsg, sizeof(uimsg));
+	get_lang_msg("DLG_PRNABORT_PRINTING", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
+	SetDlgItemText(HPrnAbortDlg, IDC_PRNABORT_PRINTING, ts.UIMsg);
+	GetDlgItemText(HPrnAbortDlg, IDCANCEL, uimsg, sizeof(uimsg));
+	get_lang_msg("BTN_CANCEL", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
+	SetDlgItemText(HPrnAbortDlg, IDCANCEL, ts.UIMsg);
 
-  SetAbortProc(PrintDC,PrnAbortProc);
+	SetAbortProc(PrintDC,PrnAbortProc);
 
-  Doc.cbSize = sizeof(DOCINFO);
-  strncpy_s(DocName,sizeof(DocName),DocumentName,_TRUNCATE);
-  Doc.lpszDocName = DocName;
-  Doc.lpszOutput = NULL;
-  Doc.lpszDatatype = NULL;
-  Doc.fwType = 0;
-  if (StartDoc(PrintDC, &Doc) > 0)
-    Printing = TRUE;
-  else
-    if (PrnAbortDlg != NULL)
-    {
-      PrnAbortDlg->DestroyWindow();
-      PrnAbortDlg = NULL;
-      HPrnAbortDlg = NULL;
-    }
-  return Printing;
+	Doc.cbSize = sizeof(DOCINFO);
+	strncpy_s(DocName,sizeof(DocName),DocumentName,_TRUNCATE);
+	Doc.lpszDocName = DocName;
+	Doc.lpszOutput = NULL;
+	Doc.lpszDatatype = NULL;
+	Doc.fwType = 0;
+	if (StartDoc(PrintDC, &Doc) > 0) {
+		Printing = TRUE;
+	}
+	else {
+		if (PrnAbortDlg != NULL) {
+			PrnAbortDlg->DestroyWindow();
+			PrnAbortDlg = NULL;
+			HPrnAbortDlg = NULL;
+		}
+	}
+	return Printing;
 }
 }
 
 extern "C" {
 void PrnStop()
 {
-  if (Printing)
-  {
-    EndDoc(PrintDC);
-    DeleteDC(PrintDC);
-    Printing = FALSE;
-  }
-  if (PrnAbortDlg != NULL)
-  {
-    PrnAbortDlg->DestroyWindow();
-    PrnAbortDlg = NULL;
-    HPrnAbortDlg = NULL;
-  }
+	if (Printing) {
+		EndDoc(PrintDC);
+		DeleteDC(PrintDC);
+		Printing = FALSE;
+	}
+	if (PrnAbortDlg != NULL) {
+		PrnAbortDlg->DestroyWindow();
+		PrnAbortDlg = NULL;
+		HPrnAbortDlg = NULL;
+	}
 }
 }
 
@@ -173,146 +180,155 @@
 //	= IdPrnScrollRegion	(always when PrnFlag=IdPrnScrollRegion)
 //	= IdPrnFile		(always when PrnFlag=IdPrnFile)
 {	
-  BOOL Sel;
-  TEXTMETRIC Metrics;
-  POINT PPI, PPI2;
-  HDC DC;
-  int i;
-  TCharAttr TempAttr = {
-    AttrDefault,
-    AttrDefault,
-    AttrDefaultFG,
-    AttrDefaultBG
-  };
+	BOOL Sel;
+	TEXTMETRIC Metrics;
+	POINT PPI, PPI2;
+	HDC DC;
+	int i;
+	TCharAttr TempAttr = {
+		AttrDefault,
+		AttrDefault,
+		AttrDefaultFG,
+		AttrDefaultBG
+	};
 
-  Sel = (PrnFlag & IdPrnSelectedText)!=0;
-  if (PrnBox(HVTWin,&Sel)==NULL) return (IdPrnCancel);
+	Sel = (PrnFlag & IdPrnSelectedText)!=0;
+	if (PrnBox(HVTWin,&Sel)==NULL) {
+		return (IdPrnCancel);
+	}
 
-  if (PrintDC==0) return (IdPrnCancel);
+	if (PrintDC==0) {
+		return (IdPrnCancel);
+	}
 
-  /* start printing */
-  if (! PrnStart(ts.Title)) return (IdPrnCancel);
+	/* start printing */
+	if (! PrnStart(ts.Title)) {
+		return (IdPrnCancel);
+	}
 
-  /* initialization */
-  StartPage(PrintDC);
+	/* initialization */
+	StartPage(PrintDC);
 
-  /* pixels per inch */
-  if ((ts.VTPPI.x>0) && (ts.VTPPI.y>0))
-    PPI = ts.VTPPI;
-  else {
-    PPI.x = GetDeviceCaps(PrintDC,LOGPIXELSX);
-    PPI.y = GetDeviceCaps(PrintDC,LOGPIXELSY);
-  }
+	/* pixels per inch */
+	if ((ts.VTPPI.x>0) && (ts.VTPPI.y>0)) {
+		PPI = ts.VTPPI;
+	}
+	else {
+		PPI.x = GetDeviceCaps(PrintDC,LOGPIXELSX);
+		PPI.y = GetDeviceCaps(PrintDC,LOGPIXELSY);
+	}
 
-  Margin.left = /* left margin */
-    (int)((float)ts.PrnMargin[0] / 100.0 * (float)PPI.x);
-  Margin.right = /* right margin */
-    GetDeviceCaps(PrintDC,HORZRES) -
-    (int)((float)ts.PrnMargin[1] / 100.0 * (float)PPI.x);
-  Margin.top = /* top margin */
-    (int)((float)ts.PrnMargin[2] / 100.0 * (float)PPI.y);
-  Margin.bottom = /* bottom margin */
-    GetDeviceCaps(PrintDC,VERTRES) -
-    (int)((float)ts.PrnMargin[3] / 100.0 * (float)PPI.y);
+	/* left margin */
+	Margin.left = (int)((float)ts.PrnMargin[0] / 100.0 * (float)PPI.x);
+	/* right margin */
+	Margin.right = GetDeviceCaps(PrintDC,HORZRES) -
+	               (int)((float)ts.PrnMargin[1] / 100.0 * (float)PPI.x);
+	/* top margin */
+	Margin.top = (int)((float)ts.PrnMargin[2] / 100.0 * (float)PPI.y);
+	/* bottom margin */
+	Margin.bottom =  GetDeviceCaps(PrintDC,VERTRES) -
+	                 (int)((float)ts.PrnMargin[3] / 100.0 * (float)PPI.y);
 
-  /* create test font */
-  memset(&Prnlf, 0, sizeof(LOGFONT));
+	/* create test font */
+	memset(&Prnlf, 0, sizeof(LOGFONT));
 
-  if (ts.PrnFont[0]==0)
-  {
-    Prnlf.lfHeight = ts.VTFontSize.y;
-    Prnlf.lfWidth = ts.VTFontSize.x;
-    Prnlf.lfCharSet = ts.VTFontCharSet;
-    strncpy_s(Prnlf.lfFaceName, sizeof(Prnlf.lfFaceName), ts.VTFont, _TRUNCATE);
-  }
-  else {
-    Prnlf.lfHeight = ts.PrnFontSize.y;
-    Prnlf.lfWidth = ts.PrnFontSize.x;
-    Prnlf.lfCharSet = ts.PrnFontCharSet;
-    strncpy_s(Prnlf.lfFaceName, sizeof(Prnlf.lfFaceName), ts.PrnFont, _TRUNCATE);
-  }
-  Prnlf.lfWeight = FW_NORMAL;
-  Prnlf.lfItalic = 0;
-  Prnlf.lfUnderline = 0;
-  Prnlf.lfStrikeOut = 0;
-  Prnlf.lfOutPrecision	= OUT_CHARACTER_PRECIS;
-  Prnlf.lfClipPrecision = CLIP_CHARACTER_PRECIS;
-  Prnlf.lfQuality	= DEFAULT_QUALITY;
-  Prnlf.lfPitchAndFamily = FIXED_PITCH | FF_DONTCARE;
+	if (ts.PrnFont[0]==0) {
+		Prnlf.lfHeight = ts.VTFontSize.y;
+		Prnlf.lfWidth = ts.VTFontSize.x;
+		Prnlf.lfCharSet = ts.VTFontCharSet;
+		strncpy_s(Prnlf.lfFaceName, sizeof(Prnlf.lfFaceName), ts.VTFont, _TRUNCATE);
+	}
+	else {
+		Prnlf.lfHeight = ts.PrnFontSize.y;
+		Prnlf.lfWidth = ts.PrnFontSize.x;
+		Prnlf.lfCharSet = ts.PrnFontCharSet;
+		strncpy_s(Prnlf.lfFaceName, sizeof(Prnlf.lfFaceName), ts.PrnFont, _TRUNCATE);
+	}
+	Prnlf.lfWeight = FW_NORMAL;
+	Prnlf.lfItalic = 0;
+	Prnlf.lfUnderline = 0;
+	Prnlf.lfStrikeOut = 0;
+	Prnlf.lfOutPrecision = OUT_CHARACTER_PRECIS;
+	Prnlf.lfClipPrecision = CLIP_CHARACTER_PRECIS;
+	Prnlf.lfQuality = DEFAULT_QUALITY;
+	Prnlf.lfPitchAndFamily = FIXED_PITCH | FF_DONTCARE;
 
-  PrnFont[0] = CreateFontIndirect(&Prnlf);
+	PrnFont[0] = CreateFontIndirect(&Prnlf);
 
-  DC = GetDC(HVTWin);
-  SelectObject(DC, PrnFont[0]);
-  GetTextMetrics(DC, &Metrics);
-  PPI2.x = GetDeviceCaps(DC,LOGPIXELSX);
-  PPI2.y = GetDeviceCaps(DC,LOGPIXELSY);
-  ReleaseDC(HVTWin,DC);
-  DeleteObject(PrnFont[0]); /* Delete test font */
+	DC = GetDC(HVTWin);
+	SelectObject(DC, PrnFont[0]);
+	GetTextMetrics(DC, &Metrics);
+	PPI2.x = GetDeviceCaps(DC,LOGPIXELSX);
+	PPI2.y = GetDeviceCaps(DC,LOGPIXELSY);
+	ReleaseDC(HVTWin,DC);
+	DeleteObject(PrnFont[0]); /* Delete test font */
 
-  /* Adjust font size */
-  Prnlf.lfHeight =
-    (int)((float)Metrics.tmHeight * (float)PPI.y / (float)PPI2.y);
-  Prnlf.lfWidth =
-    (int)((float)Metrics.tmAveCharWidth * (float)PPI.x / (float)PPI2.x);
+	/* Adjust font size */
+	Prnlf.lfHeight = (int)((float)Metrics.tmHeight * (float)PPI.y / (float)PPI2.y);
+	Prnlf.lfWidth = (int)((float)Metrics.tmAveCharWidth * (float)PPI.x / (float)PPI2.x);
 
-  /* Create New Fonts */
+	/* Create New Fonts */
 
-  /* Normal Font */
-  Prnlf.lfWeight = FW_NORMAL;
-  Prnlf.lfUnderline = 0;
-  PrnFont[0] = CreateFontIndirect(&Prnlf);
-  SelectObject(PrintDC,PrnFont[0]);
-  GetTextMetrics(PrintDC, &Metrics);
-  PrnFW = Metrics.tmAveCharWidth;
-  PrnFH = Metrics.tmHeight;
-  /* Under line */
-  Prnlf.lfUnderline = 1;
-  PrnFont[AttrUnder] = CreateFontIndirect(&Prnlf);
+	/* Normal Font */
+	Prnlf.lfWeight = FW_NORMAL;
+	Prnlf.lfUnderline = 0;
+	PrnFont[0] = CreateFontIndirect(&Prnlf);
+	SelectObject(PrintDC,PrnFont[0]);
+	GetTextMetrics(PrintDC, &Metrics);
+	PrnFW = Metrics.tmAveCharWidth;
+	PrnFH = Metrics.tmHeight;
+	/* Under line */
+	Prnlf.lfUnderline = 1;
+	PrnFont[AttrUnder] = CreateFontIndirect(&Prnlf);
 
-  if (ts.EnableBold > 0)
-  {
-    /* Bold */
-    Prnlf.lfUnderline = 0;
-    Prnlf.lfWeight = FW_BOLD;
-    PrnFont[AttrBold] = CreateFontIndirect(&Prnlf);
-    /* Bold + Underline */
-    Prnlf.lfUnderline = 1;
-    PrnFont[AttrBold | AttrUnder] = CreateFontIndirect(&Prnlf);
-  }
-  else {
-    PrnFont[AttrBold] = PrnFont[AttrDefault];
-    PrnFont[AttrBold | AttrUnder] = PrnFont[AttrUnder];
-  }
-  /* Special font */
-  Prnlf.lfWeight = FW_NORMAL;
-  Prnlf.lfUnderline = 0;
-  Prnlf.lfWidth = PrnFW; /* adjust width */
-  Prnlf.lfHeight = PrnFH;
-  Prnlf.lfCharSet = SYMBOL_CHARSET;
+	if (ts.EnableBold > 0) {
+		/* Bold */
+		Prnlf.lfUnderline = 0;
+		Prnlf.lfWeight = FW_BOLD;
+		PrnFont[AttrBold] = CreateFontIndirect(&Prnlf);
+		/* Bold + Underline */
+		Prnlf.lfUnderline = 1;
+		PrnFont[AttrBold | AttrUnder] = CreateFontIndirect(&Prnlf);
+	}
+	else {
+		PrnFont[AttrBold] = PrnFont[AttrDefault];
+		PrnFont[AttrBold | AttrUnder] = PrnFont[AttrUnder];
+	}
+	/* Special font */
+	Prnlf.lfWeight = FW_NORMAL;
+	Prnlf.lfUnderline = 0;
+	Prnlf.lfWidth = PrnFW; /* adjust width */
+	Prnlf.lfHeight = PrnFH;
+	Prnlf.lfCharSet = SYMBOL_CHARSET;
 
-  strncpy_s(Prnlf.lfFaceName, sizeof(Prnlf.lfFaceName),"Tera Special", _TRUNCATE);
-  PrnFont[AttrSpecial] = CreateFontIndirect(&Prnlf);
-  PrnFont[AttrSpecial | AttrBold] = PrnFont[AttrSpecial];
-  PrnFont[AttrSpecial | AttrUnder] = PrnFont[AttrSpecial];
-  PrnFont[AttrSpecial | AttrBold | AttrUnder] = PrnFont[AttrSpecial];
+	strncpy_s(Prnlf.lfFaceName, sizeof(Prnlf.lfFaceName),"Tera Special", _TRUNCATE);
+	PrnFont[AttrSpecial] = CreateFontIndirect(&Prnlf);
+	PrnFont[AttrSpecial | AttrBold] = PrnFont[AttrSpecial];
+	PrnFont[AttrSpecial | AttrUnder] = PrnFont[AttrSpecial];
+	PrnFont[AttrSpecial | AttrBold | AttrUnder] = PrnFont[AttrSpecial];
 
-  Black = RGB(0,0,0);
-  White = RGB(255,255,255);
-  for (i = 0 ; i <= 255 ; i++)
-    PrnDx[i] = PrnFW;
-  PrnSetAttr(TempAttr);
+	Black = RGB(0,0,0);
+	White = RGB(255,255,255);
+	for (i = 0 ; i <= 255 ; i++) {
+		PrnDx[i] = PrnFW;
+	}
+	PrnSetAttr(TempAttr);
 
-  PrnY = Margin.top;
-  PrnX = Margin.left;
+	PrnY = Margin.top;
+	PrnX = Margin.left;
 
-  if (PrnFlag == IdPrnScrollRegion)
-    return (IdPrnScrollRegion);
-  if (PrnFlag == IdPrnFile)
-    return (IdPrnFile);
-  if (Sel) return (IdPrnSelectedText);
-      else return (IdPrnScreen);
-
+	if (PrnFlag == IdPrnScrollRegion) {
+		return (IdPrnScrollRegion);
+	}
+	if (PrnFlag == IdPrnFile) {
+		return (IdPrnFile);
+	}
+	if (Sel) {
+		return (IdPrnSelectedText);
+	}
+	else {
+		return (IdPrnScreen);
+	}
 }
 }
 extern "C" {
@@ -320,18 +336,17 @@
 //  Set text attribute of printing
 //
 {
-  PrnAttr = Attr;
-  SelectObject(PrintDC, PrnFont[Attr.Attr & AttrFontMask]);
+	PrnAttr = Attr;
+	SelectObject(PrintDC, PrnFont[Attr.Attr & AttrFontMask]);
 
-  if ((Attr.Attr & AttrReverse) != 0)
-  {
-    SetTextColor(PrintDC,White);
-    SetBkColor(  PrintDC,Black);
-  }
-  else {
-    SetTextColor(PrintDC,Black);
-    SetBkColor(  PrintDC,White);
-  }
+	if ((Attr.Attr & AttrReverse) != 0) {
+		SetTextColor(PrintDC,White);
+		SetBkColor(  PrintDC,Black);
+	}
+	else {
+		SetTextColor(PrintDC,Black);
+		SetBkColor(  PrintDC,White);
+	}
 }
 }
 
@@ -341,66 +356,73 @@
 //    Buff: points text buffer
 //    Count: number of characters to be printed
 {
-  int i;
-  RECT RText;
-  PCHAR Ptr, Ptr1, Ptr2;
-  char Buff2[256];
+	int i;
+	RECT RText;
+	PCHAR Ptr, Ptr1, Ptr2;
+	char Buff2[256];
 
-  if (Count<=0) return;
-  if (Count>(sizeof(Buff2)-1)) Count=sizeof(Buff2)-1;
-  memcpy(Buff2,Buff,Count);
-  Buff2[Count] = 0;
-  Ptr = Buff2;
+	if (Count<=0) {
+		return;
+	}
+	if (Count>(sizeof(Buff2)-1)) {
+		Count=sizeof(Buff2)-1;
+	}
+	memcpy(Buff2,Buff,Count);
+	Buff2[Count] = 0;
+	Ptr = Buff2;
 
-  if (ts.Language==IdRussian)
-  {
-    if (ts.PrnFont[0]==0)
-      RussConvStr(ts.RussClient,ts.RussFont,Buff2,Count);
-    else
-      RussConvStr(ts.RussClient,ts.RussPrint,Buff2,Count);
-  }
+	if (ts.Language==IdRussian) {
+		if (ts.PrnFont[0]==0) {
+			RussConvStr(ts.RussClient,ts.RussFont,Buff2,Count);
+		}
+		else {
+			RussConvStr(ts.RussClient,ts.RussPrint,Buff2,Count);
+		}
+	}
 
-  do {
-    if (PrnX+PrnFW > Margin.right)
-    {
-      /* new line */
-      PrnX = Margin.left;
-      PrnY = PrnY + PrnFH;
-    }
-    if (PrnY+PrnFH > Margin.bottom)
-    {
-      /* next page */
-      EndPage(PrintDC);
-      StartPage(PrintDC);
-      PrnSetAttr(PrnAttr);
-      PrnY = Margin.top;
-    }
+	do {
+		if (PrnX+PrnFW > Margin.right) {
+			/* new line */
+			PrnX = Margin.left;
+			PrnY = PrnY + PrnFH;
+		}
+		if (PrnY+PrnFH > Margin.bottom) {
+			/* next page */
+			EndPage(PrintDC);
+			StartPage(PrintDC);
+			PrnSetAttr(PrnAttr);
+			PrnY = Margin.top;
+		}
 
-    i = (Margin.right-PrnX) / PrnFW;
-    if (i==0) i=1;
-    if (i>Count) i=Count;
+		i = (Margin.right-PrnX) / PrnFW;
+		if (i==0) {
+			i=1;
+		}
+		if (i>Count) {
+			i=Count;
+		}
 
-    if (i<Count)
-    {
-      Ptr2 = Ptr;
-      do {
-	Ptr1 = Ptr2;
-	Ptr2 = CharNext(Ptr1);
-      } while ((Ptr2!=NULL) && ((Ptr2-Ptr)<=i));
-      i = Ptr1-Ptr;
-      if (i<=0) i=1;
-    }
+		if (i<Count) {
+			Ptr2 = Ptr;
+			do {
+				Ptr1 = Ptr2;
+				Ptr2 = CharNext(Ptr1);
+			} while ((Ptr2!=NULL) && ((Ptr2-Ptr)<=i));
+			i = Ptr1-Ptr;
+			if (i<=0) {
+				i=1;
+			}
+		}
 
-    RText.left = PrnX;
-    RText.right = PrnX + i*PrnFW;
-    RText.top = PrnY;
-    RText.bottom = PrnY+PrnFH;
-    ExtTextOut(PrintDC,PrnX,PrnY,6,&RText,Ptr,
-	       i,&PrnDx[0]);
-    PrnX = RText.right;
-    Count=Count-i;
-    Ptr = Ptr + i;
-  } while (Count>0);
+		RText.left = PrnX;
+		RText.right = PrnX + i*PrnFW;
+		RText.top = PrnY;
+		RText.bottom = PrnY+PrnFH;
+		ExtTextOut(PrintDC,PrnX,PrnY,6,&RText,Ptr,i,&PrnDx[0]);
+		PrnX = RText.right;
+		Count=Count-i;
+		Ptr = Ptr + i;
+	} while (Count>0);
 
 }
 }
@@ -409,28 +431,31 @@
 void PrnNewLine()
 //  Moves to the next line in printing
 {
-  PrnX = Margin.left;
-  PrnY = PrnY + PrnFH;
+	PrnX = Margin.left;
+	PrnY = PrnY + PrnFH;
 }
 }
 
 extern "C" {
 void VTPrintEnd()
 {
-  int i, j;
+	int i, j;
 
-  EndPage(PrintDC);
+	EndPage(PrintDC);
 
-  for (i = 0 ; i <= AttrFontMask ; i++)
-  {
-    for (j = i+1 ; j <= AttrFontMask ; j++)
-      if (PrnFont[j]==PrnFont[i])
-	PrnFont[j] = NULL;
-    if (PrnFont[i] != NULL) DeleteObject(PrnFont[i]);
-  }
+	for (i = 0 ; i <= AttrFontMask ; i++) {
+		for (j = i+1 ; j <= AttrFontMask ; j++) {
+			if (PrnFont[j]==PrnFont[i]) {
+				PrnFont[j] = NULL;
+			}
+		}
+		if (PrnFont[i] != NULL) {
+			DeleteObject(PrnFont[i]);
+		}
+	}
 
-  PrnStop();
-  return;
+	PrnStop();
+	return;
 }
 }
 
@@ -438,180 +463,193 @@
 extern "C" {
 void OpenPrnFile()
 {
-  char Temp[MAXPATHLEN];
+	char Temp[MAXPATHLEN];
 
-  KillTimer(HVTWin,IdPrnStartTimer);
-  if (HPrnFile > 0) return;
-  if (PrnFName[0] == 0)
-  {
-    GetTempPath(sizeof(Temp),Temp);
-    if (GetTempFileName(Temp,"tmp",0,PrnFName)==0) return;
-    HPrnFile = _lcreat(PrnFName,0);
-  }
-  else {
-    HPrnFile = _lopen(PrnFName,OF_WRITE);
-    if (HPrnFile <= 0)
-      HPrnFile = _lcreat(PrnFName,0);      
-  }
-  if (HPrnFile > 0)
-    _llseek(HPrnFile,0,2);
+	KillTimer(HVTWin,IdPrnStartTimer);
+	if (HPrnFile > 0) {
+		return;
+	}
+	if (PrnFName[0] == 0) {
+		GetTempPath(sizeof(Temp),Temp);
+		if (GetTempFileName(Temp,"tmp",0,PrnFName)==0) {
+			return;
+		}
+		HPrnFile = _lcreat(PrnFName,0);
+	}
+	else {
+		HPrnFile = _lopen(PrnFName,OF_WRITE);
+		if (HPrnFile <= 0) {
+			HPrnFile = _lcreat(PrnFName,0);
+		}
+	}
+	if (HPrnFile > 0) {
+		_llseek(HPrnFile,0,2);
+	}
 }
 }
 
 void PrintFile()
 {
-  char Buff[256];
-  BOOL CRFlag = FALSE;
-  int c, i;
-  BYTE b;
+	char Buff[256];
+	BOOL CRFlag = FALSE;
+	int c, i;
+	BYTE b;
 
-  if (VTPrintInit(IdPrnFile)==IdPrnFile)
-  {
-    HPrnFile = _lopen(PrnFName,OF_READ);
-    if (HPrnFile>0)
-    {
-      do {
-	i = 0;
-	do {
-	  c = _lread(HPrnFile,&b,1);
-	  if (c==1)
-	  {
-	    switch (b) {
-	      case HT:
-		memset(&(Buff[i]),0x20,8);
-		i = i + 8;
-		CRFlag = FALSE;
-		break;
-	      case LF:
-		CRFlag = ! CRFlag;
-		break;
-	      case FF:
-	      case CR:
-		CRFlag = TRUE;
-		break;
-	      default:
-		if (b >= 0x20)
-		{
-		  Buff[i] = b;
-		  i++;
+	if (VTPrintInit(IdPrnFile)==IdPrnFile) {
+		HPrnFile = _lopen(PrnFName,OF_READ);
+		if (HPrnFile>0) {
+			do {
+				i = 0;
+				do {
+					c = _lread(HPrnFile,&b,1);
+					if (c==1) {
+						switch (b) {
+							case HT:
+								memset(&(Buff[i]),0x20,8);
+								i = i + 8;
+								CRFlag = FALSE;
+								break;
+							case LF:
+								CRFlag = ! CRFlag;
+								break;
+							case FF:
+							case CR:
+								CRFlag = TRUE;
+								break;
+							default:
+								if (b >= 0x20) {
+									Buff[i] = b;
+									i++;
+								}
+								CRFlag = FALSE;
+								break;
+						}
+					}
+					if (i>=(sizeof(Buff)-7)) {
+						CRFlag=TRUE;
+					}
+				} while ((c>0) && (! CRFlag));
+				if (i>0) {
+					PrnOutText(Buff, i);
+				}
+				if (CRFlag) {
+					PrnX = Margin.left;
+					if ((b==FF) && (ts.PrnConvFF==0)) { // new page
+						PrnY = Margin.bottom;
+					}
+					else { // new line
+						PrnY = PrnY + PrnFH;
+					}
+				}
+				CRFlag = (b==CR);
+			} while (c>0);
+			_lclose(HPrnFile);
 		}
-		CRFlag = FALSE;
-		break;
-	    }
-	  }
-	  if (i>=(sizeof(Buff)-7)) CRFlag=TRUE;
-	} while ((c>0) && (! CRFlag));
-	if (i>0) PrnOutText(Buff, i);
-	if (CRFlag)
-	{
-	  PrnX = Margin.left;
-	  if ((b==FF) && (ts.PrnConvFF==0)) // new page
-	    PrnY = Margin.bottom;
-	  else // new line
-	    PrnY = PrnY + PrnFH;
+		HPrnFile = 0;
+		VTPrintEnd();
 	}
-	CRFlag = (b==CR);
-      }  while (c>0);
-      _lclose(HPrnFile);
-    }
-    HPrnFile = 0;
-    VTPrintEnd();
-  }
-  remove(PrnFName);
-  PrnFName[0] = 0;
+	remove(PrnFName);
+	PrnFName[0] = 0;
 }
 
 void PrintFileDirect()
 {
-  CWnd* pParent;
+	CWnd* pParent;
 
-  PrnAbortDlg = new CPrnAbortDlg();
-  if (PrnAbortDlg==NULL)
-  {
-    remove(PrnFName);
-    PrnFName[0] = 0;
-    return;
-  }
-  if (ActiveWin==IdVT)
-    pParent = (CWnd*)pVTWin;
-  else
-    pParent = (CWnd*)pTEKWin;
-  PrnAbortDlg->Create(pParent,&PrintAbortFlag,&ts);
-  HPrnAbortDlg = PrnAbortDlg->GetSafeHwnd();
+	PrnAbortDlg = new CPrnAbortDlg();
+	if (PrnAbortDlg==NULL) {
+		remove(PrnFName);
+		PrnFName[0] = 0;
+		return;
+	}
+	if (ActiveWin==IdVT) {
+		pParent = (CWnd*)pVTWin;
+	}
+	else {
+		pParent = (CWnd*)pTEKWin;
+	}
+	PrnAbortDlg->Create(pParent,&PrintAbortFlag,&ts);
+	HPrnAbortDlg = PrnAbortDlg->GetSafeHwnd();
 
-  HPrnFile = _lopen(PrnFName,OF_READ);
-  PrintAbortFlag = (HPrnFile<=HFILE_ERROR) || ! PrnOpen(ts.PrnDev);
-  PrnBuffCount = 0;
-  SetTimer(HVTWin,IdPrnProcTimer,0,NULL);
+	HPrnFile = _lopen(PrnFName,OF_READ);
+	PrintAbortFlag = (HPrnFile<=HFILE_ERROR) || ! PrnOpen(ts.PrnDev);
+	PrnBuffCount = 0;
+	SetTimer(HVTWin,IdPrnProcTimer,0,NULL);
 }
 
 void PrnFileDirectProc()
 {
-  int c;
+	int c;
 
-  if (HPrnFile==0) return;
-  if (PrintAbortFlag)
-  {
-    HPrnAbortDlg = NULL;
-    PrnAbortDlg = NULL;
-    PrnCancel();
-  }
-  if (!PrintAbortFlag && (HPrnFile>0))
-  {
-    do {
-      if (PrnBuffCount==0)
-      {
-        PrnBuffCount = _lread(HPrnFile,PrnBuff,1);
-	if (ts.Language==IdRussian)
-	  RussConvStr(ts.RussClient,ts.RussPrint,PrnBuff,PrnBuffCount);
-      }
+	if (HPrnFile==0) {
+		return;
+	}
+	if (PrintAbortFlag) {
+		HPrnAbortDlg = NULL;
+		PrnAbortDlg = NULL;
+		PrnCancel();
+	}
+	if (!PrintAbortFlag && (HPrnFile>0)) {
+		do {
+			if (PrnBuffCount==0) {
+				PrnBuffCount = _lread(HPrnFile,PrnBuff,1);
+				if (ts.Language==IdRussian) {
+					RussConvStr(ts.RussClient,ts.RussPrint,PrnBuff,PrnBuffCount);
+				}
+			}
 
-      if (PrnBuffCount==1)
-      {
-	c = PrnWrite(PrnBuff,1);
-	if (c==0)
-	{
-	  SetTimer(HVTWin,IdPrnProcTimer,10,NULL);
-	  return;
+			if (PrnBuffCount==1) {
+				c = PrnWrite(PrnBuff,1);
+				if (c==0) {
+					SetTimer(HVTWin,IdPrnProcTimer,10,NULL);
+					return;
+				}
+				PrnBuffCount = 0;
+			}
+			else {
+				c = 0;
+			}
+		} while (c>0);
 	}
-	PrnBuffCount = 0;
-      }
-      else
-	c = 0;
-    } while (c>0);
-  }
-  if (HPrnFile > 0)
-    _lclose(HPrnFile);
-  HPrnFile = 0;
-  PrnClose();
-  remove(PrnFName);
-  PrnFName[0] = 0;
-  if (PrnAbortDlg!=NULL)
-  {
-    PrnAbortDlg->DestroyWindow();
-    PrnAbortDlg = NULL;
-    HPrnAbortDlg = NULL;
-  }
+	if (HPrnFile > 0) {
+		_lclose(HPrnFile);
+	}
+	HPrnFile = 0;
+	PrnClose();
+	remove(PrnFName);
+	PrnFName[0] = 0;
+	if (PrnAbortDlg!=NULL) {
+		PrnAbortDlg->DestroyWindow();
+		PrnAbortDlg = NULL;
+		HPrnAbortDlg = NULL;
+	}
 }
 
 void PrnFileStart()
 {
-  if (HPrnFile>0) return;
-  if (PrnFName[0]==0) return;
-  if (ts.PrnDev[0]!=0)
-    PrintFileDirect(); // send file directry to printer port
-  else  // print file by using Windows API
-    PrintFile();
+	if (HPrnFile>0) {
+		return;
+	}
+	if (PrnFName[0]==0) {
+		return;
+	}
+	if (ts.PrnDev[0]!=0) {
+		PrintFileDirect(); // send file directry to printer port
+	}
+	else { // print file by using Windows API
+		PrintFile();
+	}
 }
 
 extern "C" {
 void ClosePrnFile()
 {
-  PrnBuffCount = 0;
-  if (HPrnFile > 0)
-    _lclose(HPrnFile);
-  HPrnFile = 0;
-  SetTimer(HVTWin,IdPrnStartTimer,ts.PassThruDelay*1000,NULL);
+	PrnBuffCount = 0;
+	if (HPrnFile > 0) {
+		_lclose(HPrnFile);
+	}
+	HPrnFile = 0;
+	SetTimer(HVTWin,IdPrnStartTimer,ts.PassThruDelay*1000,NULL);
 }
 }
 
@@ -624,14 +662,16 @@
 //    (b,TRUE):  put b in buff and
 //		 write buffer to file
 {
-  if ((b>0) && (PrnBuffCount<sizeof(PrnBuff)))
-    PrnBuff[PrnBuffCount++] = b;
+	if ((b>0) && (PrnBuffCount<sizeof(PrnBuff))) {
+		PrnBuff[PrnBuffCount++] = b;
+	}
 
-  if (Write)
-  {
-    _lwrite(HPrnFile,PrnBuff,PrnBuffCount);
-    PrnBuffCount = 0;
-  }
-  if ((b==0) && ! Write) PrnBuffCount = 0;
+	if (Write) {
+		_lwrite(HPrnFile,PrnBuff,PrnBuffCount);
+		PrnBuffCount = 0;
+	}
+	if ((b==0) && ! Write) {
+		PrnBuffCount = 0;
+	}
 }
 }

Modified: trunk/teraterm/teraterm/teraterm.cpp
===================================================================
--- trunk/teraterm/teraterm/teraterm.cpp	2009-05-11 14:10:03 UTC (rev 3391)
+++ trunk/teraterm/teraterm/teraterm.cpp	2009-05-12 11:55:27 UTC (rev 3392)
@@ -49,20 +49,20 @@
 // CTeraApp initialization
 BOOL CTeraApp::InitInstance()
 {
-  // ƒCƒ“ƒXƒg[ƒ‰‚ÅŽÀs‚ðŒŸo‚·‚邽‚ß‚É mutex ‚ðì¬‚·‚é (2006.8.12 maya)
-  // 2d‹N“®–hŽ~‚Ì‚½‚ß‚Å‚Í‚È‚¢‚̂ŁA“Á‚É•Ô‚è’l‚ÍŒ©‚È‚¢
-  HANDLE hMutex;
-  hMutex = CreateMutex(NULL, TRUE, "TeraTermProAppMutex");
+	// ƒCƒ“ƒXƒg[ƒ‰‚ÅŽÀs‚ðŒŸo‚·‚邽‚ß‚É mutex ‚ðì¬‚·‚é (2006.8.12 maya)
+	// 2d‹N“®–hŽ~‚Ì‚½‚ß‚Å‚Í‚È‚¢‚̂ŁA“Á‚É•Ô‚è’l‚ÍŒ©‚È‚¢
+	HANDLE hMutex;
+	hMutex = CreateMutex(NULL, TRUE, "TeraTermProAppMutex");
 
-  hInst = m_hInstance;
-  m_pMainWnd = new CVTWindow();
-  pVTWin = m_pMainWnd;
-  return TRUE;
+	hInst = m_hInstance;
+	m_pMainWnd = new CVTWindow();
+	pVTWin = m_pMainWnd;
+	return TRUE;
 }
 
 int CTeraApp::ExitInstance()
 {
-  return CWinApp::ExitInstance();
+	return CWinApp::ExitInstance();
 }
 
 // Tera Term main engine
@@ -117,8 +117,9 @@
 						// Œ»Û‚Ö‚ÌŽb’è‘ΏˆB(2006.2.6 yutaka)
 						Sleep(1);
 					}
-					else
+					else {
 						Change = IdVT;
+					}
 					break;
 
 				default:
@@ -126,31 +127,45 @@
 				}
 
 				switch (Change) {
-				case IdVT: VTActivate(); break;
-				case IdTEK: ((CVTWindow*)pVTWin)->OpenTEK(); break;
+					case IdVT:
+						VTActivate();
+						break;
+					case IdTEK:
+						((CVTWindow*)pVTWin)->OpenTEK();
+						break;
 				}
 			}
 		}
 
 		if (cv.LogBuf!=NULL)
 		{
-			if (FileLog) LogToFile();
-			if (DDELog && AdvFlag) DDEAdv();
+			if (FileLog) {
+				LogToFile();
+			}
+			if (DDELog && AdvFlag) {
+				DDEAdv();
+			}
 			GlobalUnlock(cv.HLogBuf);
 			cv.LogBuf = NULL;
 		}
 
 		if (cv.BinBuf!=NULL)
 		{
-			if (BinLog) LogToFile();
+			if (BinLog) {
+				LogToFile();
+			}
 			GlobalUnlock(cv.HBinBuf);
 			cv.BinBuf = NULL;
 		}
 
 		/* Talker */
 		switch (TalkStatus) {
-		case IdTalkCB: CBSend(); break; /* clip board */
-		case IdTalkFile: FileSend(); break; /* file */
+		case IdTalkCB:
+			CBSend();
+			break; /* clip board */
+		case IdTalkFile:
+			FileSend();
+			break; /* file */
 		}
 
 		/* Receiver */
@@ -167,19 +182,22 @@
 	}
 
 	if (cv.Ready &&
-		(cv.RRQ || (cv.OutBuffCount>0) || (cv.InBuffCount>0) ||
-		(cv.LCount>0) || (cv.BCount>0) || (cv.DCount>0)) )
+	    (cv.RRQ || (cv.OutBuffCount>0) || (cv.InBuffCount>0) || (cv.LCount>0) || (cv.BCount>0) || (cv.DCount>0)) ) {
 		Busy = 2;
-	else
+	}
+	else {
 		Busy--;
+	}
 
 	return (Busy>0);
 }
 
 BOOL CTeraApp::PreTranslateMessage(MSG* pMsg)
 {
-  if (ts.MetaKey>0)
-    return FALSE; /* ignore accelerator keys */
-  else
-    return CWinApp::PreTranslateMessage(pMsg);
+	if (ts.MetaKey>0) {
+		return FALSE; /* ignore accelerator keys */
+	}
+	else {
+		return CWinApp::PreTranslateMessage(pMsg);
+	}
 }

Modified: trunk/teraterm/teraterm/vtwin.cpp
===================================================================
--- trunk/teraterm/teraterm/vtwin.cpp	2009-05-11 14:10:03 UTC (rev 3391)
+++ trunk/teraterm/teraterm/vtwin.cpp	2009-05-12 11:55:27 UTC (rev 3392)
@@ -218,15 +218,17 @@
 
 	if (g_hmodUser32 == NULL) {
 		g_hmodUser32 = LoadLibrary("user32.dll");
-		if (g_hmodUser32 == NULL)
+		if (g_hmodUser32 == NULL) {
 			return FALSE;
+		}
 
 		g_pSetLayeredWindowAttributes =
 			(func)GetProcAddress(g_hmodUser32, "SetLayeredWindowAttributes");
 	}
 
-	if (g_pSetLayeredWindowAttributes == NULL)
+	if (g_pSetLayeredWindowAttributes == NULL) {
 		return FALSE;
+	}
 
 	return g_pSetLayeredWindowAttributes(hwnd, crKey, 
 	                                     bAlpha, dwFlags);
@@ -246,10 +248,10 @@
 			break;
 		}
 	}
-	if (name == NULL)
+	if (name == NULL) {
 		return;
+	}
 
-
 	hc = (HCURSOR)LoadImage(NULL, MAKEINTRESOURCE(name), IMAGE_CURSOR,
 	                        0, 0, LR_DEFAULTSIZE | LR_SHARED);
 
@@ -359,8 +361,9 @@
 
 	/* ƒVƒ“ƒ{ƒ‹î•ñŠi”[—pƒoƒbƒtƒ@‚̏‰Šú‰» */
 	gptr = GlobalAlloc(GMEM_FIXED, 10000);
-	if (gptr == NULL)
+	if (gptr == NULL) {
 		goto error;
+	}
 	pSym = (PIMAGEHLP_SYMBOL)GlobalLock(gptr);
 	ZeroMemory(pSym, sizeof(IMAGEHLP_SYMBOL));
 	pSym->SizeOfStruct = 10000;
@@ -499,7 +502,7 @@
   ::_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
 #endif
 
-  	// —áŠOƒnƒ“ƒhƒ‰‚̃tƒbƒN (2007.9.30 yutaka)
+	// —áŠOƒnƒ“ƒhƒ‰‚̃tƒbƒN (2007.9.30 yutaka)
 	SetUnhandledExceptionFilter(ApplicationFaultHandler);
 
 	TTXInit(&ts, &cv); /* TTPLUG */
@@ -546,7 +549,9 @@
 			}
 			FreeTTSET();
 			/* store default sets in TTCMN */
-			if (tempkm!=NULL) free(tempkm);
+			if (tempkm!=NULL) {
+				free(tempkm);
+			}
 		}
 
 	}
@@ -555,8 +560,9 @@
 	// 256ƒoƒCƒgˆÈã‚̃Rƒ}ƒ“ƒhƒ‰ƒCƒ“ƒpƒ‰ƒ[ƒ^Žw’肪‚ ‚é‚ƁABOF(Buffer Over Flow)‚Å
 	// —Ž‚¿‚éƒoƒO‚ðC³B(2007.6.12 maya)
 	Param = GetCommandLine();
-	if (LoadTTSET())
+	if (LoadTTSET()) {
 		(*ParseParam)(Param, &ts, &(TopicName[0]));
+	}
 	FreeTTSET();
 
 	// duplicate session‚ÌŽw’肪‚ ‚é‚È‚çA‹¤—Lƒƒ‚ƒŠ‚©‚çƒRƒs[‚·‚é (2004.12.7 yutaka)
@@ -627,8 +633,9 @@
 	RegisterClass(&wc);
 	LoadAccelTable(MAKEINTRESOURCE(IDR_ACC));
 
-	if (ts.VTPos.x==CW_USEDEFAULT)
+	if (ts.VTPos.x==CW_USEDEFAULT) {
 		rect = rectDefault;
+	}
 	else {
 		rect.left = ts.VTPos.x;
 		rect.top = ts.VTPos.y;
@@ -684,8 +691,9 @@
 	/* Reset Terminal */
 	ResetTerminal();
 
-	if ((ts.PopupMenu>0) || (ts.HideTitle>0))
+	if ((ts.PopupMenu>0) || (ts.HideTitle>0)) {
 		::PostMessage(HVTWin,WM_USER_CHANGEMENU,0,0);
+	}
 
 	ChangeFont();
 
@@ -706,9 +714,10 @@
 		Startup();
 		return;
 	}
-	 CmdShow = SW_SHOWDEFAULT;
-	if (ts.Minimize>0)
+	CmdShow = SW_SHOWDEFAULT;
+	if (ts.Minimize>0) {
 		CmdShow = SW_SHOWMINIMIZED;
+	}
 	ShowWindow(CmdShow);
 	ChangeCaret();
 }
@@ -1293,10 +1302,12 @@
 	else if (SubMenu == SetupMenu)
 		if (cv.Ready &&
 		    ((cv.PortType==IdTCPIP) || (cv.PortType==IdFile)) ||
-		    (SendVar!=NULL) || (FileVar!=NULL) || Connecting)
+			(SendVar!=NULL) || (FileVar!=NULL) || Connecting) {
 			EnableMenuItem(SetupMenu,ID_SETUP_SERIALPORT,MF_BYCOMMAND | MF_GRAYED);
-		else
+		}
+		else {
 			EnableMenuItem(SetupMenu,ID_SETUP_SERIALPORT,MF_BYCOMMAND | MF_ENABLED);
+		}
 
 	else if (SubMenu == ControlMenu)
 	{
@@ -1308,30 +1319,38 @@
 			else {
 				EnableMenuItem(ControlMenu,ID_CONTROL_SENDBREAK,MF_BYCOMMAND | MF_ENABLED);
 			}
-			if (cv.PortType==IdSerial)
+			if (cv.PortType==IdSerial) {
 				EnableMenuItem(ControlMenu,ID_CONTROL_RESETPORT,MF_BYCOMMAND | MF_ENABLED);
-			else
+			}
+			else {
 				EnableMenuItem(ControlMenu,ID_CONTROL_RESETPORT,MF_BYCOMMAND | MF_GRAYED);
+			}
 		}
 		else {
 			EnableMenuItem(ControlMenu,ID_CONTROL_SENDBREAK,MF_BYCOMMAND | MF_GRAYED);
 			EnableMenuItem(ControlMenu,ID_CONTROL_RESETPORT,MF_BYCOMMAND | MF_GRAYED);
 		}
 
-		if (cv.Ready && cv.TelFlag && (FileVar==NULL))
+		if (cv.Ready && cv.TelFlag && (FileVar==NULL)) {
 			EnableMenuItem(ControlMenu,ID_CONTROL_AREYOUTHERE,MF_BYCOMMAND | MF_ENABLED);
-		else
+		}
+		else {
 			EnableMenuItem(ControlMenu,ID_CONTROL_AREYOUTHERE,MF_BYCOMMAND | MF_GRAYED);
+		}
 
-		if (HTEKWin==0)
+		if (HTEKWin==0) {
 			EnableMenuItem(ControlMenu,ID_CONTROL_CLOSETEK,MF_BYCOMMAND | MF_GRAYED);
-		else
+		}
+		else {
 			EnableMenuItem(ControlMenu,ID_CONTROL_CLOSETEK,MF_BYCOMMAND | MF_ENABLED);
+		}
 
-		if ((ConvH!=0) || (FileVar!=NULL))
+		if ((ConvH!=0) || (FileVar!=NULL)) {
 			EnableMenuItem(ControlMenu,ID_CONTROL_MACRO,MF_BYCOMMAND | MF_GRAYED);
-		else
+		}
+		else {
 			EnableMenuItem(ControlMenu,ID_CONTROL_MACRO,MF_BYCOMMAND | MF_ENABLED);
+		}
 
 	}
 	else if (SubMenu == WinMenu)
@@ -1406,8 +1425,9 @@
 	char TempDir[MAXPATHLEN];
 	char TempName[MAXPATHLEN];
 
-	if ( strlen(ts.SetupFName)==0 )
+	if ( strlen(ts.SetupFName)==0 ) {
 		return;
+	}
 
 	ExtractFileName(ts.SetupFName,TempName,sizeof(TempName));
 	ExtractDirName(ts.SetupFName,TempDir);
@@ -1417,10 +1437,11 @@
 
 	strncpy_s(ts.SetupFName, sizeof(ts.SetupFName),TempDir, _TRUNCATE);
 	AppendSlash(ts.SetupFName,sizeof(ts.SetupFName));
-  strncat_s(ts.SetupFName,sizeof(ts.SetupFName),TempName,_TRUNCATE);
+	strncat_s(ts.SetupFName,sizeof(ts.SetupFName),TempName,_TRUNCATE);
 
-	if (LoadTTSET())
+	if (LoadTTSET()) {
 		(*ReadIniFile)(ts.SetupFName,&ts);
+	}
 	FreeTTSET();
 
 #if 0
@@ -1441,8 +1462,9 @@
 	cv.RussHost = ts.RussHost;
 	cv.RussClient = ts.RussClient;
 
-	if (cv.Ready && cv.TelFlag && (ts.TelEcho>0))
+	if (cv.Ready && cv.TelFlag && (ts.TelEcho>0)) {
 		TelChangeEcho();
+	}
 
 	if ((ts.TerminalWidth!=NumOfColumns) ||
 	    (ts.TerminalHeight!=NumOfLines-StatusLine)) {
@@ -1454,8 +1476,9 @@
 	}
 	else if ((ts.TermIsWin>0) &&
 	         ((ts.TerminalWidth!=WinWidth) ||
-	          (ts.TerminalHeight!=WinHeight-StatusLine)))
+	          (ts.TerminalHeight!=WinHeight-StatusLine))) {
 		BuffChangeWinSize(ts.TerminalWidth,ts.TerminalHeight+StatusLine);
+	}
 }
 
 void CVTWindow::Startup()
@@ -1469,8 +1492,9 @@
 		ts.MacroFN[0] = 0;
 	}
 	else {// start connection
-		if (TopicName[0]!=0)
+		if (TopicName[0]!=0) {
 			cv.NoMsg=1; /* suppress error messages */
+		}
 		::PostMessage(HVTWin,WM_USER_COMMSTART,0,0);
 	}
 }
@@ -1582,10 +1606,12 @@
 		return TRUE;
 	}
 	else {
-		if (TTXProcessCommand(HVTWin, wID))
+		if (TTXProcessCommand(HVTWin, wID)) {
 			return TRUE;
-		else /* TTPLUG */
+		}
+		else { /* TTPLUG */
 			return CFrameWnd::OnCommand(wParam, lParam);
+		}
 	}
 }
 
@@ -1599,8 +1625,9 @@
 	unsigned int i;
 	char Code;
 
-	if (!KeybEnabled || (TalkStatus!=IdTalkKeyb))
+	if (!KeybEnabled || (TalkStatus!=IdTalkKeyb)) {
 		return;
+	}
 
 	if ((ts.MetaKey>0) && AltKey()) {
 		::PostMessage(HVTWin,WM_SYSCHAR,nChar,MAKELONG(nRepCnt,nFlags));
@@ -1609,13 +1636,15 @@
 	Code = nChar;
 
 	if ((ts.Language==IdRussian) &&
-	    ((BYTE)Code>=128))
+		((BYTE)Code>=128)) {
 		Code = (char)RussConv(ts.RussKeyb,ts.RussClient,(BYTE)Code);
+	}
 
 	for (i=1 ; i<=nRepCnt ; i++) {
 		CommTextOut(&cv,&Code,1);
-		if (ts.LocalEcho>0)
+		if (ts.LocalEcho>0) {
 			CommTextEcho(&cv,&Code,1);
+		}
 	}
 
 	/* Å‰ºs‚Å‚¾‚¯Ž©“®ƒXƒNƒ[ƒ‹‚·‚éÝ’è‚̏ꍇ
@@ -1658,8 +1687,9 @@
 	    ((ts.PortFlag & PF_CONFIRMDISCONN) != 0) &&
 	    ! CloseTT &&
 	    (::MessageBox(HVTWin, ts.UIMsg, "Tera Term",
-	     MB_OKCANCEL | MB_ICONEXCLAMATION | MB_DEFBUTTON2)==IDCANCEL))
+	     MB_OKCANCEL | MB_ICONEXCLAMATION | MB_DEFBUTTON2)==IDCANCEL)) {
 		return;
+	}
 
 	FileTransEnd(0);
 	ProtoEnd();
@@ -1680,8 +1710,9 @@
 
 	EndDDE();
 
-	if (cv.TelFlag)
+	if (cv.TelFlag) {
 		EndTelnet();
+	}
 	CommClose(&cv);
 
 	OpenHelp(HVTWin,HH_CLOSE_ALL,0);
@@ -1689,13 +1720,14 @@
 	FreeIME();
 	FreeTTSET();
 	do { }
-		while (FreeTTDLG());
+	while (FreeTTDLG());
 
 	do { }
-		while (FreeTTFILE());
+	while (FreeTTFILE());
 
-	if (HTEKWin != NULL)
+	if (HTEKWin != NULL) {
 		::DestroyWindow(HTEKWin);
+	}
 
 	EndDisp();
 
@@ -1962,22 +1994,24 @@
 	FocusReport(FALSE);
 	CFrameWnd::OnKillFocus(pNewWnd);
 
-	if (IsCaretOn()) 
+	if (IsCaretOn()) {
 		CaretKillFocus(TRUE);
+	}
 }
 
 void CVTWindow::OnLButtonDblClk(UINT nFlags, CPoint point)
 {
-	if (LButton || MButton || RButton)
+	if (LButton || MButton || RButton) {
 		return;
+	}
 
 	DblClkX = point.x;
 	DblClkY = point.y;
 
-
 	if (! MouseReport(IdMouseEventBtnDown, IdLeftButton, DblClkX, DblClkY) &&
-	    BuffUrlDblClk(DblClkX, DblClkY)) // ƒuƒ‰ƒEƒUŒÄ‚яo‚µ‚̏ꍇ‚͉½‚à‚µ‚È‚¢B (2005.4.3 yutaka)
+		BuffUrlDblClk(DblClkX, DblClkY)) { // ƒuƒ‰ƒEƒUŒÄ‚яo‚µ‚̏ꍇ‚͉½‚à‚µ‚È‚¢B (2005.4.3 yutaka)
 		return;
+	}
 
 	BuffDblClk(DblClkX, DblClkY);
 
@@ -2004,8 +2038,9 @@
 {
 	MouseReport(IdMouseEventBtnUp, IdLeftButton, point.x, point.y);
 
-	if (! LButton)
+	if (! LButton) {
 		return;
+	}
 
 	ButtonUp(FALSE);
 }
@@ -2025,14 +2060,17 @@
 
 	mousereport = MouseReport(IdMouseEventBtnUp, IdMiddleButton, point.x, point.y);
 
-	if (! MButton)
+	if (! MButton) {
 		return;
+	}
 
 	// added DisablePasteMouseMButton (2008.3.2 maya)
-	if (ts.DisablePasteMouseMButton)
+	if (ts.DisablePasteMouseMButton) {
 		ButtonUp(FALSE);
-	else
+	}
+	else {
 		ButtonUp(TRUE);
+	}
 }
 
 int CVTWindow::OnMouseActivate(CWnd* pDesktopWnd, UINT nHitTest, UINT message)
@@ -2054,15 +2092,18 @@
 		return;
 	}
 
-	if (DblClk)
+	if (DblClk) {
 		i = 2;
-	else if (TplClk)
+	}
+	else if (TplClk) {
 		i = 3;
-	else
+	}
+	else {
 		i = 1;
+	}
 
 	if (!ts.SelectOnlyByLButton ||
-		(ts.SelectOnlyByLButton && LButton) ) {
+	    (ts.SelectOnlyByLButton && LButton) ) {
 		// SelectOnlyByLButton == TRUE ‚Ì‚Æ‚«‚́A¶ƒ{ƒ^ƒ“ƒ_ƒEƒ“Žž‚Ì‚Ý‘I‘ð‚·‚é (2007.11.21 maya)
 		BuffChangeSelect(point.x, point.y,i);
 	}
@@ -2095,7 +2136,7 @@
 		return TRUE;
 
 	if (ts.TranslateWheelToCursor && AppliCursorMode && !ts.DisableAppCursor &&
-            !(ControlKey() && ts.DisableWheelToCursorByCtrl)) {
+	    !(ControlKey() && ts.DisableWheelToCursorByCtrl)) {
 		if (zDelta < 0) {
 			KeyDown(HVTWin, VK_DOWN, line, MapVirtualKey(VK_DOWN, 0) | 0x100);
 			KeyUp(VK_DOWN);
@@ -2119,18 +2160,21 @@
 
 void CVTWindow::OnNcLButtonDblClk(UINT nHitTest, CPoint point)
 {
-	if (! Minimized && (nHitTest == HTCAPTION))
+	if (! Minimized && (nHitTest == HTCAPTION)) {
 		DispRestoreWinSize();
-	else
+	}
+	else {
 		CFrameWnd::OnNcLButtonDblClk(nHitTest,point);
+	}
 }
 
 void CVTWindow::OnNcRButtonDown(UINT nHitTest, CPoint point)
 {
 	if ((nHitTest==HTCAPTION) &&
 	    (ts.HideTitle>0) &&
-	    AltKey())
+		AltKey()) {
 		::CloseWindow(HVTWin); /* iconize */
+	}
 }
 
 void CVTWindow::OnPaint()
@@ -2182,7 +2226,9 @@
 
 	mousereport = MouseReport(IdMouseEventBtnUp, IdRightButton, point.x, point.y);
 
-	if (! RButton) return;
+	if (! RButton) {
+		return;
+	}
 
 	// ‰Eƒ{ƒ^ƒ“‰Ÿ‰º‚ł̃y[ƒXƒg‚ð‹ÖŽ~‚·‚é (2005.3.16 yutaka)
 	if (ts.DisablePasteMouseRButton || mousereport) {
@@ -2211,76 +2257,76 @@
 static int tip_enabled = 0;
 
 static LRESULT CALLBACK SizeTipWndProc(HWND hWnd, UINT nMsg,
-				       WPARAM wParam, LPARAM lParam)
+                                       WPARAM wParam, LPARAM lParam)
 {
 
 	switch (nMsg) {
-	  case WM_ERASEBKGND:
-		  return TRUE;
+		case WM_ERASEBKGND:
+			return TRUE;
 
-	  case WM_PAINT:
-		  {
-			  HBRUSH hbr;
-			  HGDIOBJ holdbr;
-			  RECT cr;
-			  int wtlen;
-			  LPTSTR wt;
-			  HDC hdc;
+		case WM_PAINT:
+			{
+				HBRUSH hbr;
+				HGDIOBJ holdbr;
+				RECT cr;
+				int wtlen;
+				LPTSTR wt;
+				HDC hdc;
 
-			  PAINTSTRUCT ps;
-			  hdc = BeginPaint(hWnd, &ps);
+				PAINTSTRUCT ps;
+				hdc = BeginPaint(hWnd, &ps);
 
-			  SelectObject(hdc, tip_font);
-			  SelectObject(hdc, GetStockObject(BLACK_PEN));
+				SelectObject(hdc, tip_font);
+				SelectObject(hdc, GetStockObject(BLACK_PEN));
 
-			  hbr = CreateSolidBrush(tip_bg);
-			  holdbr = SelectObject(hdc, hbr);
+				hbr = CreateSolidBrush(tip_bg);
+				holdbr = SelectObject(hdc, hbr);
 
-			  GetClientRect(hWnd, &cr);
-			  Rectangle(hdc, cr.left, cr.top, cr.right, cr.bottom);
+				GetClientRect(hWnd, &cr);
+				Rectangle(hdc, cr.left, cr.top, cr.right, cr.bottom);
 
-			  wtlen = GetWindowTextLength(hWnd);
-			  wt = (LPTSTR) malloc((wtlen + 1) * sizeof(TCHAR));
-			  GetWindowText(hWnd, wt, wtlen + 1);
+				wtlen = GetWindowTextLength(hWnd);
+				wt = (LPTSTR) malloc((wtlen + 1) * sizeof(TCHAR));
+				GetWindowText(hWnd, wt, wtlen + 1);
 
-			  SetTextColor(hdc, tip_text);
-			  SetBkColor(hdc, tip_bg);
+				SetTextColor(hdc, tip_text);
+				SetBkColor(hdc, tip_bg);
 
-			  TextOut(hdc, cr.left + 3, cr.top + 3, wt, wtlen);
+				TextOut(hdc, cr.left + 3, cr.top + 3, wt, wtlen);
 
-			  free(wt);
+				free(wt);
 
-			  SelectObject(hdc, holdbr);
-			  DeleteObject(hbr);
+				SelectObject(hdc, holdbr);
+				DeleteObject(hbr);
 
-			  EndPaint(hWnd, &ps);
-		  }
-		  return 0;
+				EndPaint(hWnd, &ps);
+			}
+			return 0;
 
-	  case WM_NCHITTEST:
-		  return HTTRANSPARENT;
+		case WM_NCHITTEST:
+			return HTTRANSPARENT;
 
-	  case WM_DESTROY:
-		  DeleteObject(tip_font);
-		  tip_font = NULL;
-		  break;
+		case WM_DESTROY:
+			DeleteObject(tip_font);
+			tip_font = NULL;
+			break;
 
-	  case WM_SETTEXT:
-		  {
-			  LPCTSTR str = (LPCTSTR) lParam;
-			  SIZE sz;
-			  HDC hdc = CreateCompatibleDC(NULL);
+		case WM_SETTEXT:
+			{
+				LPCTSTR str = (LPCTSTR) lParam;
+				SIZE sz;
+				HDC hdc = CreateCompatibleDC(NULL);
 
-			  SelectObject(hdc, tip_font);
-			  GetTextExtentPoint32(hdc, str, _tcslen(str), &sz);
+				SelectObject(hdc, tip_font);
+				GetTextExtentPoint32(hdc, str, _tcslen(str), &sz);
 
-			  SetWindowPos(hWnd, NULL, 0, 0, sz.cx + 6, sz.cy + 6,
-				  SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE);
-			  InvalidateRect(hWnd, NULL, FALSE);
+				SetWindowPos(hWnd, NULL, 0, 0, sz.cx + 6, sz.cy + 6,
+				             SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE);
+				InvalidateRect(hWnd, NULL, FALSE);
 
-			  DeleteDC(hdc);
-		  }
-		  break;
+				DeleteDC(hdc);
+			}
+			break;
 	}
 
 	return DefWindowProc(hWnd, nMsg, wParam, lParam);
@@ -2352,12 +2398,14 @@
 		GetWindowRect(src, &wr);
 
 		ix = wr.left;
-		if (ix < 16)
+		if (ix < 16) {
 			ix = 16;
+		}
 
 		iy = wr.top - sz.cy;
-		if (iy < 16)
+		if (iy < 16) {
 			iy = 16;
+		}
 
 		/* Create the tip window */
 
@@ -2404,7 +2452,9 @@
 		Startup();
 		return;
 	}
-	if (Minimized || DontChangeSize) return;
+	if (Minimized || DontChangeSize) {
+		return;
+	}
 
 	if (nType == SIZE_MAXIMIZED) {
 		ts.TerminalOldWidth = ts.TerminalWidth;
@@ -2414,8 +2464,9 @@
 	::GetWindowRect(HVTWin,&R);
 	w = R.right - R.left;
 	h = R.bottom - R.top;
-	if (AdjustSize)
+	if (AdjustSize) {
 		ResizeWindow(R.left,R.top,w,h,cx,cy);
+	}
 	else {
 		w = cx / FontWidth;
 		h = cy / FontHeight;
@@ -2438,7 +2489,7 @@
 {
 	int nWidth;
 	int nHeight;
-    RECT cr, wr;
+	RECT cr, wr;
 	int extra_width, extra_height;
 	int w, h;
 
@@ -2504,11 +2555,13 @@
 		SwitchMenu();
 	}
 	else if (((nID & 0xfff0)==SC_CLOSE) && (cv.PortType==IdTCPIP) &&
-	         cv.Open && ! cv.Ready && (cv.ComPort>0))
+	         cv.Open && ! cv.Ready && (cv.ComPort>0)) {
 		// now getting host address (see CommOpen() in commlib.c)
 		::PostMessage(HVTWin,WM_SYSCOMMAND,nID,lParam);
-	else
+	}
+	else {
 		CFrameWnd::OnSysCommand(nID,lParam);
+	}
 }
 
 void CVTWindow::OnSysKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
@@ -2516,19 +2569,23 @@
 	if ((nChar==VK_F10) ||
 	    (ts.MetaKey>0) &&
 	    ((MainMenu==NULL) || (nChar!=VK_MENU)) &&
-	    ((nFlags & 0x2000) != 0))
+		((nFlags & 0x2000) != 0)) {
 		KeyDown(HVTWin,nChar,nRepCnt,nFlags & 0x1ff);
 		// OnKeyDown(nChar,nRepCnt,nFlags);
-	else
+	}
+	else {
 		CFrameWnd::OnSysKeyDown(nChar,nRepCnt,nFlags);
+	}
 }
 
 void CVTWindow::OnSysKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags)
 {
-	if (nChar==VK_F10)
+	if (nChar==VK_F10) {
 		OnKeyUp(nChar,nRepCnt,nFlags);
-	else
+	}
+	else {
 		CFrameWnd::OnSysKeyUp(nChar,nRepCnt,nFlags);
+	}
 }
 
 void CVTWindow::OnTimer(UINT nIDEvent)
@@ -2542,8 +2599,9 @@
 			T = GetCaretBlinkTime();
 			SetCaretBlinkTime(T);
 		}
-		else
+		else {
 			::KillTimer(HVTWin,IdCaretTimer);
+		}
 		return;
 	}
 	else if (nIDEvent==IdScrollTimer) {
@@ -2551,8 +2609,9 @@
 		::ScreenToClient(HVTWin,&Point);
 		DispAutoScroll(Point);
 		if ((Point.x < 0) || (Point.x >= ScreenWidth) ||
-		    (Point.y < 0) || (Point.y >= ScreenHeight))
+			(Point.y < 0) || (Point.y >= ScreenHeight)) {
 			::PostMessage(HVTWin,WM_MOUSEMOVE,MK_LBUTTON,MAKELONG(Point.x,Point.y));
+		}
 		return;
 	}
 	else if (nIDEvent == IdCancelConnectTimer) {
@@ -2582,19 +2641,22 @@
 				break;
 			}
 			cv.Ready = FALSE;
-			if (cv.TelFlag)
+			if (cv.TelFlag) {
 				EndTelnet();
+			}
 			PortType = cv.PortType;
 			CommClose(&cv);
 			SetDdeComReady(0);
 			if ((PortType==IdTCPIP) &&
-				((ts.PortFlag & PF_BEEPONCONNECT) != 0))
+				((ts.PortFlag & PF_BEEPONCONNECT) != 0)) {
 				MessageBeep(0);
+			}
 			if ((PortType==IdTCPIP) &&
 				(ts.AutoWinClose>0) &&
 				::IsWindowEnabled(HVTWin) &&
-				((HTEKWin==NULL) || ::IsWindowEnabled(HTEKWin)) )
+				((HTEKWin==NULL) || ::IsWindowEnabled(HTEKWin)) ) {
 				OnClose();
+			}
 			else {
 				ChangeTitle();
 				if (ts.ClearScreenOnCloseConnection) {
@@ -2617,15 +2679,30 @@
 	SCROLLINFO si;
 
 	switch (nSBCode) {
-	case SB_BOTTOM: Func = SCROLL_BOTTOM; break;
-	case SB_ENDSCROLL: return;
-	case SB_LINEDOWN: Func = SCROLL_LINEDOWN; break;
-	case SB_LINEUP: Func = SCROLL_LINEUP; break;
-	case SB_PAGEDOWN: Func = SCROLL_PAGEDOWN; break;
-	case SB_PAGEUP: Func = SCROLL_PAGEUP; break;
+	case SB_BOTTOM:
+		Func = SCROLL_BOTTOM;
+		break;
+	case SB_ENDSCROLL:
+		return;
+	case SB_LINEDOWN:
+		Func = SCROLL_LINEDOWN;
+		break;
+	case SB_LINEUP:
+		Func = SCROLL_LINEUP;
+		break;
+	case SB_PAGEDOWN:
+		Func = SCROLL_PAGEDOWN;
+		break;
+	case SB_PAGEUP:
+		Func = SCROLL_PAGEUP;
+		break;
 	case SB_THUMBPOSITION:
-	case SB_THUMBTRACK: Func = SCROLL_POS; break;
-	case SB_TOP: Func = SCROLL_TOP; break;
+	case SB_THUMBTRACK:
+		Func = SCROLL_POS;
+		break;
+	case SB_TOP:
+		Func = SCROLL_TOP;
+		break;
 	default:
 		return;
 	}
@@ -2645,8 +2722,9 @@
 LONG CVTWindow::OnWindowPosChanging(UINT wParam, LONG lParam)
 {
 #ifdef ALPHABLEND_TYPE2
-	if(BGEnable && BGNoCopyBits)
+	if(BGEnable && BGNoCopyBits) {
 		((WINDOWPOS*)lParam)->flags |= SWP_NOCOPYBITS;
+	}
 #endif
 
 	return CFrameWnd::DefWindowProc(WM_WINDOWPOSCHANGING,wParam,lParam);
@@ -2691,10 +2769,12 @@
 	char *mbstr;
 	int mlen;
 
-	if (CanUseIME())
+	if (CanUseIME()) {
 		hstr = GetConvString(wParam, lParam);
-	else
+	}
+	else {
 		hstr = NULL;
+	}
 
 	if (hstr!=NULL) {
 		//lpstr = (LPSTR)GlobalLock(hstr);
@@ -2702,8 +2782,9 @@
 		if (lpstr!=NULL) {
 			mlen = wcstombs(NULL, lpstr, 0);
 			mbstr = (char *)malloc(sizeof(char) * (mlen + 1));
-			if (mbstr == NULL)
+			if (mbstr == NULL) {
 				goto skip;
+			}
 			Len = wcstombs(mbstr, lpstr, mlen + 1);
 
 			// add this string into text buffer of application
@@ -2711,15 +2792,20 @@
 			if (Len==1) {
 				switch (mbstr[0]) {
 				case 0x20:
-					if (ControlKey()) mbstr[0] = 0; /* Ctrl-Space */
+					if (ControlKey()) {
+						mbstr[0] = 0; /* Ctrl-Space */
+					}
 					break;
 				case 0x5c: // Ctrl-\ support for NEC-PC98
-					if (ControlKey()) mbstr[0] = 0x1c;
+					if (ControlKey()) {
+						mbstr[0] = 0x1c;
+					}
 					break;
 				}
 			}
-			if (ts.LocalEcho>0)
+			if (ts.LocalEcho>0) {
 				CommTextEcho(&cv,mbstr,Len);
+			}
 			CommTextOut(&cv,mbstr,Len);
 
 			free(mbstr);
@@ -2729,8 +2815,7 @@
 		GlobalFree(hstr);
 		return 0;
 	}
-	return CFrameWnd::DefWindowProc
-		(WM_IME_COMPOSITION,wParam,lParam);
+	return CFrameWnd::DefWindowProc(WM_IME_COMPOSITION,wParam,lParam);
 }
 
 LONG CVTWindow::OnAccelCommand(UINT wParam, LONG lParam)
@@ -2798,12 +2883,15 @@
 			SelectNextWin(HVTWin,-1);
 			break;
 		case IdCmdLocalEcho:
-			if (ts.LocalEcho==0)
+			if (ts.LocalEcho==0) {
 				ts.LocalEcho = 1;
-			else
+			}
+			else {
 				ts.LocalEcho = 0;
-			if (cv.Ready && cv.TelFlag && (ts.TelEcho>0))
+			}
+			if (cv.Ready && cv.TelFlag && (ts.TelEcho>0)) {
 				TelChangeEcho();
+			}
 			break;
 		case IdCmdDisconnect: // called by TTMACRO
 			OnFileDisconnect();
@@ -2827,8 +2915,9 @@
 
 // TTXKanjiMenu ‚Ì‚½‚߂ɁAƒƒjƒ…[‚ª•\Ž¦‚³‚ê‚Ä‚¢‚Ä‚à
 // Ä•`‰æ‚·‚é‚悤‚É‚µ‚½B (2007.7.14 maya)
-	if (Show != (MainMenu!=NULL))
+	if (Show != (MainMenu!=NULL)) {
 		AdjustSize = TRUE;
+	}
 
 	if (MainMenu!=NULL) {
 		DestroyMenu(MainMenu);
@@ -2836,12 +2925,14 @@
 	}
 
 	if (! Show) {
-		if (WinMenu!=NULL)
+		if (WinMenu!=NULL) {
 			DestroyMenu(WinMenu);
+		}
 		WinMenu = NULL;
 	}
-	else
+	else {
 		InitMenu(&MainMenu);
+	}
 
 	::SetMenu(HVTWin, MainMenu);
 	::DrawMenuBar(HVTWin);
@@ -2886,8 +2977,9 @@
 	Style = GetWindowLong (HVTWin, GWL_STYLE);
 	ExStyle = GetWindowLong (HVTWin, GWL_EXSTYLE);
 	TBar = ((Style & WS_SYSMENU)!=0);
-	if (TBar == (ts.HideTitle==0))
+	if (TBar == (ts.HideTitle==0)) {
 		return 0;
+	}
 
 #ifndef WINDOW_MAXMIMUM_ENABLED
 	if (ts.HideTitle>0)
@@ -2902,8 +2994,8 @@
 	                      WS_MINIMIZEBOX | WS_MAXIMIZEBOX) | WS_BORDER | WS_POPUP;
 
 #ifdef ALPHABLEND_TYPE2
-	if(BGNoFrame) {
-		Style   &= ~(WS_THICKFRAME | WS_BORDER);
+		if(BGNoFrame) {
+			Style   &= ~(WS_THICKFRAME | WS_BORDER);
 			ExStyle &= ~WS_EX_CLIENTEDGE;
 		}else{
 			ExStyle |=  WS_EX_CLIENTEDGE;
@@ -2959,16 +3051,19 @@
 {
 	CommStart(&cv,lParam,&ts);
 #ifndef NO_INET6
-	if (ts.PortType == IdTCPIP && cv.RetryWithOtherProtocol == TRUE)
+	if (ts.PortType == IdTCPIP && cv.RetryWithOtherProtocol == TRUE) {
 		Connecting = TRUE;
-	else
+	}
+	else {
 		Connecting = FALSE;
+	}
 #else
 	Connecting = FALSE;
 #endif /* NO_INET6 */
 	ChangeTitle();
-	if (! cv.Ready)
+	if (! cv.Ready) {
 		return 0;
+	}
 
 	/* Auto start logging (2007.5.31 maya) */
 	if (ts.LogAutoStart && ts.LogFN[0]==0) {
@@ -2982,8 +3077,9 @@
 	}
 
 	if ((ts.PortType==IdTCPIP) &&
-	    ((ts.PortFlag & PF_BEEPONCONNECT) != 0))
+	    ((ts.PortFlag & PF_BEEPONCONNECT) != 0)) {
 		MessageBeep(0);
+	}
 
 	if (cv.PortType==IdTCPIP) {
 		InitTelnet();
@@ -3030,23 +3126,27 @@
 				ts.CRSend = ts.TCPCRSend;
 				cv.CRSend = ts.TCPCRSend;
 			}
-			if (ts.TCPLocalEcho>0)
+			if (ts.TCPLocalEcho>0) {
 				ts.LocalEcho = ts.TCPLocalEcho;
+			}
 		}
 	}
 
 	if (DDELog || FileLog) {
 		if (! CreateLogBuf()) {
-			if (DDELog)
+			if (DDELog) {
 				EndDDE();
-			if (FileLog)
+			}
+			if (FileLog) {
 				FileTransEnd(OpLog);
+			}
 		}
 	}
 
 	if (BinLog) {
-		if (! CreateBinBuf())
+		if (! CreateBinBuf()) {
 			FileTransEnd(OpLog);
+		}
 	}
 
 	SetDdeComReady(1);
@@ -3077,8 +3177,9 @@
 LONG CVTWindow::OnDdeEnd(UINT wParam, LONG lParam)
 {
 	EndDDE();
-	if (CloseTT)
+	if (CloseTT) {
 		OnClose();
+	}
 	return 0;
 }
 
@@ -3140,8 +3241,10 @@
 	strncpy_s(Command, sizeof(Command),"ttermpro ", _TRUNCATE);
 	GetHNRec.HostName = &Command[9];
 
-	if (! LoadTTDLG())
+	if (! LoadTTDLG()) {
 		return;
+	}
+
 	if ((*GetHostName)(HVTWin,&GetHNRec)) {
 		if ((GetHNRec.PortType==IdTCPIP) &&
 		    (ts.HistoryList>0) &&
@@ -3215,8 +3318,9 @@
 		}
 	}
 	else {/* canceled */
-		if (! cv.Ready)
-		SetDdeComReady(0);
+		if (! cv.Ready) {
+			SetDdeComReady(0);
+		}
 	}
 
 	FreeTTDLG();
@@ -3418,8 +3522,8 @@
 
 void CVTWindow::OnFileLog()
 {
-  HelpId = HlpFileLog;
-  LogStart();
+	HelpId = HlpFileLog;
+	LogStart();
 }
 
 
@@ -3675,8 +3779,9 @@
 void CVTWindow::OnFileChangeDir()
 {
 	HelpId = HlpFileChangeDir;
-	if (! LoadTTDLG())
+	if (! LoadTTDLG()) {
 		return;
+	}
 	(*ChangeDirectory)(HVTWin,ts.FileDir);
 	FreeTTDLG();
 }
@@ -3689,15 +3794,19 @@
 
 void CVTWindow::OnFileDisconnect()
 {
-	if (! cv.Ready)
+	if (! cv.Ready) {
 		return;
+	}
+
 	get_lang_msg("MSG_DISCONNECT_CONF", ts.UIMsg, sizeof(ts.UIMsg),
 	             "Disconnect?", ts.UILanguageFile);
 	if ((cv.PortType==IdTCPIP) &&
 	    ((ts.PortFlag & PF_CONFIRMDISCONN) != 0) &&
 	    (::MessageBox(HVTWin, ts.UIMsg, "Tera Term",
-	                  MB_OKCANCEL | MB_ICONEXCLAMATION | MB_DEFBUTTON2)==IDCANCEL))
+	                  MB_OKCANCEL | MB_ICONEXCLAMATION | MB_DEFBUTTON2)==IDCANCEL)) {
 		return;
+	}
+
 	::PostMessage(HVTWin, WM_USER_COMMNOTIFY, 0, FD_CLOSE);
 }
 
@@ -3748,10 +3857,12 @@
 {
 	LockBuffer();
 	BuffClearScreen();
-	if ((StatusLine>0) && (CursorY==NumOfLines-1))
+	if ((StatusLine>0) && (CursorY==NumOfLines-1)) {
 		MoveCursor(0,CursorY);
-	else
+	}
+	else {
 		MoveCursor(0,0);
+	}
 	BuffUpdateScroll();
 	BuffSetCaretWidth();
 	UnlockBuffer();
@@ -3833,16 +3944,20 @@
 {
 	BOOL Ok;
 
-	if (ts.Language==IdRussian)
+	if (ts.Language==IdRussian) {
 		HelpId = HlpSetupTerminalRuss;
-	else
+	}
+	else {
 		HelpId = HlpSetupTerminal;
-	if (! LoadTTDLG())
+	}
+	if (! LoadTTDLG()) {
 		return;
+	}
 	Ok = (*SetupTerminal)(HVTWin, &ts);
 	FreeTTDLG();
-	if (Ok)
+	if (Ok) {
 		SetupTerm();
+	}
 }
 
 void CVTWindow::OnSetupWindow()
@@ -3854,8 +3969,9 @@
 	ts.VTFlag = 1;
 	ts.SampleFont = VTFont[0];
 
-	if (! LoadTTDLG())
+	if (! LoadTTDLG()) {
 		return;
+	}
 
 	strncpy_s(orgTitle, sizeof(orgTitle), ts.Title, _TRUNCATE);
 	Ok = (*SetupWin)(HVTWin, &ts);
@@ -3882,10 +3998,12 @@
 
 void CVTWindow::OnSetupFont()
 {
-	if (ts.Language==IdRussian)
+	if (ts.Language==IdRussian) {
 		HelpId = HlpSetupFontRuss;
-	else
+	}
+	else {
 		HelpId = HlpSetupFont;
+	}
 	DispSetupFontDlg();
 }
 
@@ -3893,17 +4011,21 @@
 {
 	BOOL Ok;
 
-	if (ts.Language==IdRussian)
+	if (ts.Language==IdRussian) {
 		HelpId = HlpSetupKeyboardRuss;
-	else
+	}
+	else {
 		HelpId = HlpSetupKeyboard;
-	if (! LoadTTDLG()) return;
+	}
+	if (! LoadTTDLG()) {
+		return;
+	}
 	Ok = (*SetupKeyboard)(HVTWin, &ts);
 	FreeTTDLG();
 
 	if (Ok) {
-//	    ResetKeypadMode(TRUE);
-	    if ((ts.Language==IdJapanese) || (ts.Language==IdKorean)) //HKS
+//		ResetKeypadMode(TRUE);
+		if ((ts.Language==IdJapanese) || (ts.Language==IdKorean)) //HKS
 		ResetIME();
 	}
 }
@@ -3912,8 +4034,9 @@
 {
 	BOOL Ok;
 	HelpId = HlpSetupSerialPort;
-	if (! LoadTTDLG())
+	if (! LoadTTDLG()) {
 		return;
+	}
 	Ok = (*SetupSerialPort)(HVTWin, &ts);
 	FreeTTDLG();
 
@@ -3923,19 +4046,22 @@
 				CommClose(&cv);
 				CommOpen(HVTWin,&ts,&cv);
 			}
-			else
+			else {
 				CommResetSerial(&ts, &cv, ts.ClearComBuffOnOpen);
+			}
 		}
-		else
+		else {
 			CommOpen(HVTWin,&ts,&cv);
+		}
 	}
 }
 
 void CVTWindow::OnSetupTCPIP()
 {
 	HelpId = HlpSetupTCPIP;
-	if (! LoadTTDLG())
+	if (! LoadTTDLG()) {
 		return;
+	}
 	if ((*SetupTCPIP)(HVTWin, &ts)) {
 		TelUpdateKeepAliveInterval();
 	}
@@ -3945,10 +4071,10 @@
 void CVTWindow::OnSetupGeneral()
 {
 	HelpId = HlpSetupGeneral;
-	if (! LoadTTDLG())
+	if (! LoadTTDLG()) {
 		return;
-	if ((*SetupGeneral)(HVTWin,&ts))
-	{
+	}
+	if ((*SetupGeneral)(HVTWin,&ts)) {
 		ResetCharSet();
 		ResetIME();
 	}
@@ -3962,11 +4088,15 @@
 	int ret;
 
 	strncpy_s(TmpSetupFN, sizeof(TmpSetupFN),ts.SetupFName, _TRUNCATE);
-	if (! LoadTTFILE()) return;
+	if (! LoadTTFILE()) {
+		return;
+	}
 	HelpId = HlpSetupSave;
 	Ok = (*GetSetupFname)(HVTWin,GSF_SAVE,&ts);
 	FreeTTFILE();
-	if (! Ok) return;
+	if (! Ok) {
+		return;
+	}
 
 	// ‘‚«ž‚Ý‚Å‚«‚é‚©‚Ì”»•Ê‚ð’ljÁ (2005.11.3 yutaka)
 	if ((ret = _access(ts.SetupFName, 0x02)) != 0) {
@@ -4018,12 +4148,14 @@
 	BOOL Ok;
 
 	HelpId = HlpSetupRestore;
-	if (! LoadTTFILE())
+	if (! LoadTTFILE()) {
 		return;
+	}
 	Ok = (*GetSetupFname)(HVTWin,GSF_RESTORE,&ts);
 	FreeTTFILE();
-	if (Ok)
+	if (Ok) {
 		RestoreSetup();
+	}
 }
 
 void CVTWindow::OnSetupLoadKeyMap()
@@ -4031,12 +4163,14 @@
 	BOOL Ok;
 
 	HelpId = HlpSetupLoadKeyMap;
-	if (! LoadTTFILE())
+	if (! LoadTTFILE()) {
 		return;
+	}
 	Ok = (*GetSetupFname)(HVTWin,GSF_LOADKEY,&ts);
 	FreeTTFILE();
-	if (! Ok)
+	if (! Ok) {
 		return;
+	}
 
 	// load key map
 	SetKeyMap();
@@ -4068,8 +4202,9 @@
 
 void CVTWindow::OnControlAreYouThere()
 {
-	if (cv.Ready && (cv.PortType==IdTCPIP))
+	if (cv.Ready && (cv.PortType==IdTCPIP)) {
 		TelSendAYT();
+	}
 }
 
 void CVTWindow::OnControlSendBreak()
@@ -4101,9 +4236,10 @@
 		_snprintf_s(EntName, sizeof(EntName), _TRUNCATE, "Command%d", i);
 		GetPrivateProfileString("BroadcastCommands",EntName,"",
 		                        Command,sizeof(Command), historyfile);
-		if (strlen(Command) > 0)
+		if (strlen(Command) > 0) {
 			SendDlgItemMessage(Dialog, IDC_COMMAND_EDIT, CB_ADDSTRING,
 			                   0, (LPARAM)Command);
+		}
 		i++;
 	} while ((i <= ts.MaxBroadcatHistory) && (strlen(Command)>0));
 
@@ -4191,10 +4327,11 @@
 
 	for (i = 0 ; i < MAXNWIN ; i++) { // 50 = MAXNWIN(@ ttcmn.c)
 		hd = GetNthWin(i);
-		if (hd == NULL)
+		if (hd == NULL) {
 			break;
+		}
 
-        GetWindowText(hd, szWindowText, 256);
+		GetWindowText(hd, szWindowText, 256);
 		SendMessage(hWnd, LB_INSERTSTRING, -1, (LPARAM)szWindowText);
 	}
 
@@ -4229,8 +4366,9 @@
 				hd = GetNthWin(i);
 			}
 		}
-		if (hd == NULL)
+		if (hd == NULL) {
 			break;
+		}
 
 		ZeroMemory(&cds, sizeof(cds));
 		cds.dwData = IPC_BROADCAST_COMMAND;
@@ -4276,16 +4414,18 @@
 	nlen = strlen(name) + 1;
 	msglen = nlen + buflen;
 	msg = (char *)malloc(msglen);
-	if (msg == NULL)
+	if (msg == NULL) {
 		goto error;
+	}
 	strcpy_s(msg, msglen, name);
 	memcpy(msg + nlen, buf, buflen);
 
 	// ‚·‚ׂĂÌTera Term‚ɃƒbƒZ[ƒW‚ƃf[ƒ^‚ð‘—‚é
 	for (i = 0 ; i < MAXNWIN ; i++) { // 50 = MAXNWIN(@ ttcmn.c)
 		hd = GetNthWin(i);
-		if (hd == NULL)
+		if (hd == NULL) {
 			break;
+		}
 
 		ZeroMemory(&cds, sizeof(cds));
 		cds.dwData = IPC_MULTICAST_COMMAND;
@@ -4474,44 +4614,44 @@
 						ret = GetDlgItemText(hWnd, IDC_COMMAND_EDIT, buf, 256 - 1);
 						if (ret == 0) { // error
 							memset(buf, 0, sizeof(buf));
-					}
+						}
 
-					// ƒuƒ[ƒhƒLƒƒƒXƒgƒRƒ}ƒ“ƒh‚Ì—š—ð‚ð•Û‘¶ (2007.3.3 maya)
-					history = SendMessage(GetDlgItem(hWnd, IDC_HISTORY_CHECK), BM_GETCHECK, 0, 0);
-					if (history) {
-						GetDefaultFName(ts.HomeDir, BROADCAST_LOGFILE, historyfile, sizeof(historyfile));
-						if (LoadTTSET()) {
-							(*AddValueToList)(historyfile, buf, "BroadcastCommands", "Command",
-							                  ts.MaxBroadcatHistory);
-							FreeTTSET();
+						// ƒuƒ[ƒhƒLƒƒƒXƒgƒRƒ}ƒ“ƒh‚Ì—š—ð‚ð•Û‘¶ (2007.3.3 maya)
+						history = SendMessage(GetDlgItem(hWnd, IDC_HISTORY_CHECK), BM_GETCHECK, 0, 0);
+						if (history) {
+							GetDefaultFName(ts.HomeDir, BROADCAST_LOGFILE, historyfile, sizeof(historyfile));
+							if (LoadTTSET()) {
+								(*AddValueToList)(historyfile, buf, "BroadcastCommands", "Command",
+												  ts.MaxBroadcatHistory);
+								FreeTTSET();
+							}
+							ApplyBoradCastCommandHisotry(hWnd, historyfile);
+							ts.BroadcastCommandHistory = TRUE;
 						}
-						ApplyBoradCastCommandHisotry(hWnd, historyfile);
-						ts.BroadcastCommandHistory = TRUE;
-					}
-					else {
-						ts.BroadcastCommandHistory = FALSE;
-					}
-					checked = SendMessage(GetDlgItem(hWnd, IDC_ENTERKEY_CHECK), BM_GETCHECK, 0, 0);
-					if (checked & BST_CHECKED) { // ‰üsƒR[ƒh‚ ‚è
-						if (SendMessage(GetDlgItem(hWnd, IDC_RADIO_CRLF), BM_GETCHECK, 0, 0) & BST_CHECKED) {
-							strncat_s(buf, sizeof(buf), "\r\n", _TRUNCATE);
+						else {
+							ts.BroadcastCommandHistory = FALSE;
+						}
+						checked = SendMessage(GetDlgItem(hWnd, IDC_ENTERKEY_CHECK), BM_GETCHECK, 0, 0);
+						if (checked & BST_CHECKED) { // ‰üsƒR[ƒh‚ ‚è
+							if (SendMessage(GetDlgItem(hWnd, IDC_RADIO_CRLF), BM_GETCHECK, 0, 0) & BST_CHECKED) {
+								strncat_s(buf, sizeof(buf), "\r\n", _TRUNCATE);
 
-						} else if (SendMessage(GetDlgItem(hWnd, IDC_RADIO_CR), BM_GETCHECK, 0, 0) & BST_CHECKED) {
-							strncat_s(buf, sizeof(buf), "\r", _TRUNCATE);
+							} else if (SendMessage(GetDlgItem(hWnd, IDC_RADIO_CR), BM_GETCHECK, 0, 0) & BST_CHECKED) {
+								strncat_s(buf, sizeof(buf), "\r", _TRUNCATE);
 
-						} else if (SendMessage(GetDlgItem(hWnd, IDC_RADIO_LF), BM_GETCHECK, 0, 0) & BST_CHECKED) {
-							strncat_s(buf, sizeof(buf), "\n", _TRUNCATE);
+							} else if (SendMessage(GetDlgItem(hWnd, IDC_RADIO_LF), BM_GETCHECK, 0, 0) & BST_CHECKED) {
+								strncat_s(buf, sizeof(buf), "\n", _TRUNCATE);
 
-						} else {
-							strncat_s(buf, sizeof(buf), "\r", _TRUNCATE);
+							} else {
+								strncat_s(buf, sizeof(buf), "\r", _TRUNCATE);
 
+							}
 						}
-					}
 
-					// 337: 2007/03/20 ƒ`ƒFƒbƒN‚³‚ê‚Ä‚¢‚½‚çeƒEƒBƒ“ƒhƒE‚É‚Ì‚Ý‘—M
-					checked = SendMessage(GetDlgItem(hWnd, IDC_PARENT_ONLY), BM_GETCHECK, 0, 0);
+						// 337: 2007/03/20 ƒ`ƒFƒbƒN‚³‚ê‚Ä‚¢‚½‚çeƒEƒBƒ“ƒhƒE‚É‚Ì‚Ý‘—M
+						checked = SendMessage(GetDlgItem(hWnd, IDC_PARENT_ONLY), BM_GETCHECK, 0, 0);
 
-					SendAllBroadcastMessage(HVTWin, hWnd, checked, buf, strlen(buf));
+						SendAllBroadcastMessage(HVTWin, hWnd, checked, buf, strlen(buf));
 					}
 
 					// ƒ‚[ƒhƒŒƒXƒ_ƒCƒAƒƒO‚͈ê“x¶¬‚³‚ê‚é‚ƁAƒAƒvƒŠƒP[ƒVƒ‡ƒ“‚ªI—¹‚·‚é‚Ü‚Å
@@ -4545,18 +4685,21 @@
 						max = ListBox_GetCount(BroadcastWindowList);
 						n = 0;
 						for (i = 0 ; i < max ; i++) {
-							if (ListBox_GetSel(BroadcastWindowList, i))
+							if (ListBox_GetSel(BroadcastWindowList, i)) {
 								n++;
+							}
 						}
 						
 						if (max == 2) {  // ƒGƒ“ƒgƒŠ‚ª2ŒÂ‚̏ꍇ‚͏í‚É‘S‘I‘ð‚Æ‚·‚éB
 							flag = TRUE;
 
 						} else {
-							if (n >= max - 1) // all select
+							if (n >= max - 1) { // all select
 								flag = FALSE;
-							else
+							}
+							else {
 								flag = TRUE;
+							}
 
 						}
 
@@ -4593,22 +4736,25 @@
 	RECT prc, rc;
 	LONG x, y;
 
-	if (hDlgWnd != NULL)
+	if (hDlgWnd != NULL) {
 		goto activate;
+	}
 
 	hDlgWnd = CreateDialog(hInst, MAKEINTRESOURCE(IDD_BROADCAST_DIALOG),
 	                       HVTWin, (DLGPROC)BroadcastCommandDlgProc);
 
-	if (hDlgWnd == NULL)
+	if (hDlgWnd == NULL) {
 		return;
+	}
 
 	// ƒ_ƒCƒAƒƒO‚ðƒEƒBƒ“ƒhƒE‚̐^ã‚É”z’u‚·‚é (2008.1.25 yutaka)
 	GetWindowRect(&prc);
 	::GetWindowRect(hDlgWnd, &rc);
 	x = prc.left;
 	y = prc.top - (rc.bottom - rc.top);
-	if (y < 0)
+	if (y < 0) {
 		y = 0;
+	}
 	::SetWindowPos(hDlgWnd, NULL, x, y,  0, 0, SWP_NOSIZE | SWP_NOZORDER);
 
 activate:;
@@ -4623,11 +4769,13 @@
 	int buflen, msglen, nlen;
 	int sending = 0;
 
-	if (!cv.Ready)
+	if (!cv.Ready) {
 		return 0;
+	}
 
-	if (!ts.AcceptBroadcast)	// 337: 2007/03/20
+	if (!ts.AcceptBroadcast) { // 337: 2007/03/20
 		return 0;
+	}
 
 	// –¢‘—Mƒf[ƒ^‚ª‚ ‚éê‡‚͐æ‚É‘—M‚·‚é
 	// ƒf[ƒ^—Ê‚ª‘½‚¢ê‡‚Í‘—M‚µ‚«‚ê‚È‚¢‰Â”\«‚ª‚ ‚é
@@ -4676,16 +4824,18 @@
 
 void CVTWindow::OnControlOpenTEK()
 {
-  OpenTEK();
+	OpenTEK();
 }
 
 void CVTWindow::OnControlCloseTEK()
 {
 	if ((HTEKWin==NULL) ||
-	    ! ::IsWindowEnabled(HTEKWin))
+		! ::IsWindowEnabled(HTEKWin)) {
 		MessageBeep(0);
-	else
+	}
+	else {
 		::DestroyWindow(HTEKWin);
+	}
 }
 
 void CVTWindow::OnControlMacro()
@@ -4698,12 +4848,14 @@
 	BOOL Close;
 
 	HelpId = HlpWindowWindow;
-	if (! LoadTTDLG())
+	if (! LoadTTDLG()) {
 		return;
+	}
 	(*WindowWindow)(HVTWin,&Close);
 	FreeTTDLG();
-	if (Close)
+	if (Close) {
 		OnClose();
+	}
 }
 
 void CVTWindow::OnHelpIndex()
@@ -4713,8 +4865,9 @@
 
 void CVTWindow::OnHelpAbout()
 {
-	if (! LoadTTDLG())
+	if (! LoadTTDLG()) {
 		return;
+	}
 	(*AboutDialog)(HVTWin);
 	FreeTTDLG();
 }

Modified: trunk/teraterm/ttpcmn/language.c
===================================================================
--- trunk/teraterm/ttpcmn/language.c	2009-05-11 14:10:03 UTC (rev 3391)
+++ trunk/teraterm/ttpcmn/language.c	2009-05-12 11:55:27 UTC (rev 3392)
@@ -140,17 +140,22 @@
 	n1 = (KCode-0x2121) / 0x200;
 	n2 = (KCode-0x2121) % 0x200;
 
-	if (n1<=0x1e)
+	if (n1<=0x1e) {
 		SJIS = 0x8100 + n1*256;
-	else
+	}
+	else {
 		SJIS = 0xC100 + n1*256;
+	}
 
-	if (n2<=0x3e)
+	if (n2<=0x3e) {
 		return (SJIS + n2 + 0x40);
-	else if ((n2>=0x3f) && (n2<=0x5d))
+	}
+	else if ((n2>=0x3f) && (n2<=0x5d)) {
 		return (SJIS + n2 + 0x41);
-	else
+	}
+	else {
 		return (SJIS + n2 - 0x61);
+	}
 }
 
 /* Russian charset conversion table by Andrey Nikiforov 19971114 */
@@ -307,8 +312,9 @@
 // cin: input character set (IdWindows/IdKOI8/Id866/IdISO)
 // cin: output character set (IdWindows/IdKOI8/Id866/IdISO)
 {
-	if (b<128)
+	if (b<128) {
 		return b;
+	}
 	return cpconv[cin-1][cout-1][b-128];
 }
 
@@ -319,10 +325,13 @@
 {
 	int i;
 
-	if (count<=0)
+	if (count<=0) {
 		return;
+	}
 
-	for (i=0; i<=count-1; i++)
-		if ((BYTE)Str[i]>=128)
+	for (i=0; i<=count-1; i++) {
+		if ((BYTE)Str[i]>=128) {
 			Str[i] = (char)cpconv[cin-1][cout-1][(BYTE)Str[i]-128];
+		}
+	}
 }

Modified: trunk/teraterm/ttpcmn/ttcmn.c
===================================================================
--- trunk/teraterm/ttpcmn/ttcmn.c	2009-05-11 14:10:03 UTC (rev 3391)
+++ trunk/teraterm/ttpcmn/ttcmn.c	2009-05-12 11:55:27 UTC (rev 3392)
@@ -72,17 +72,20 @@
 		FirstInstance = FALSE;
 		return TRUE;
 	}
-	else
+	else {
 		return FALSE;
+	}
 }
 
 void PASCAL FAR ChangeDefaultSet(PTTSet ts, PKeyMap km)
 {
 	if ((ts!=NULL) &&
-	    (_stricmp(ts->SetupFName, pm->ts.SetupFName) == 0))
+		(_stricmp(ts->SetupFName, pm->ts.SetupFName) == 0)) {
 		memcpy(&(pm->ts),ts,sizeof(TTTSet));
-	if (km!=NULL)
+	}
+	if (km!=NULL) {
 		memcpy(&(pm->km),km,sizeof(TKeyMap));
+	}
 }
 
 void PASCAL FAR GetDefaultSet(PTTSet ts)
@@ -96,11 +99,13 @@
 {
 	WORD Key;
 
-	if (KeyMap==NULL)
+	if (KeyMap==NULL) {
 		KeyMap = &(pm->km);
+	}
 	Key = IdKeyMax;
-	while ((Key>0) && (KeyMap->Map[Key-1] != Scan))
+	while ((Key>0) && (KeyMap->Map[Key-1] != Scan)) {
 		Key--;
+	}
 	return Key;
 }
 
@@ -112,8 +117,9 @@
 	MSG Msg;
 	char Temp[201];
 
-	if (KeyMap==NULL)
+	if (KeyMap==NULL) {
 		KeyMap = &(pm->km);
+	}
 
 	*Type = IdBinary;  // key type
 	*Len = 0;
@@ -781,11 +787,13 @@
 		return 0;
 	}
 	pm->WinList[pm->NWin++] = HWinVT;
-	if (pm->NWin==1)
+	if (pm->NWin==1) {
 		return 1;
-	else
+	}
+	else {
 		return (int)(SendMessage(pm->WinList[pm->NWin-2],
-		             WM_USER_GETSERIALNO,0,0)+1);
+		                         WM_USER_GETSERIALNO,0,0)+1);
+	}
 }
 
 void FAR PASCAL UnregWin(HWND HWin)
@@ -793,14 +801,18 @@
 	int i, j;
 
 	i = 0;
-	while ((i<pm->NWin) && (pm->WinList[i]!=HWin))
+	while ((i<pm->NWin) && (pm->WinList[i]!=HWin)) {
 		i++;
-	if (pm->WinList[i]!=HWin)
+	}
+	if (pm->WinList[i]!=HWin) {
 		return;
-	for (j=i ; j<pm->NWin-1 ; j++)
+	}
+	for (j=i ; j<pm->NWin-1 ; j++) {
 		pm->WinList[j] = pm->WinList[j+1];
-	if (pm->NWin>0)
+	}
+	if (pm->NWin>0) {
 		pm->NWin--;
+	}
 }
 
 void FAR PASCAL SetWinMenu(HMENU menu, PCHAR buf, int buflen, PCHAR langFile, int VTFlag)
@@ -829,11 +841,13 @@
 			GetWindowText(Hw,&Temp[3],sizeof(Temp)-4);
 			AppendMenu(menu,MF_ENABLED | MF_STRING,ID_WINDOW_1+i,Temp);
 			i++;
-			if (i>8)
+			if (i>8) {
 				i = pm->NWin;
+			}
 		}
-		else
+		else {
 			UnregWin(Hw);
+		}
 	}
 	get_lang_msg("MENU_WINDOW_WINDOW", buf, buflen, "&Window", langFile);
 	if (VTFlag == 1) {
@@ -858,12 +872,13 @@
 			GetWindowText(Hw,Temp,sizeof(Temp)-1);
 			SendDlgItemMessage(HDlg, IList, LB_ADDSTRING,
 			                   0, (LONG)Temp);
-			if (Hw==HWin) 
-				SendDlgItemMessage(HDlg, IList, LB_SETCURSEL,
-				                  i,0);
+			if (Hw==HWin) {
+				SendDlgItemMessage(HDlg, IList, LB_SETCURSEL, i,0);
+			}
 		}
-		else
+		else {
 			UnregWin(Hw);
+		}
 	}
 }
 
@@ -880,37 +895,45 @@
 	int i;
 
 	i = 0;
-	while ((i<pm->NWin) && (pm->WinList[i]!=HWin))
+	while ((i<pm->NWin) && (pm->WinList[i]!=HWin)) {
 		i++;
-	if (pm->WinList[i]!=HWin)
+	}
+	if (pm->WinList[i]!=HWin) {
 		return;
+	}
 	i = i + Next;
-	if (i >= pm->NWin)
+	if (i >= pm->NWin) {
 		i = 0;
-	else if (i<0)
+	}
+	else if (i<0) {
 		i = pm->NWin-1;
+	}
 	SelectWin(i);
 }
 
 HWND FAR PASCAL GetNthWin(int n)
 {
-	if (n<pm->NWin)
+	if (n<pm->NWin) {
 		return pm->WinList[n];
-	else
+	}
+	else {
 		return NULL;
+	}
 }
 
 int FAR PASCAL CommReadRawByte(PComVar cv, LPBYTE b)
 {
-	if ( ! cv->Ready )
+	if ( ! cv->Ready ) {
 		return 0;
+	}
 
 	if ( cv->InBuffCount>0 ) {
 		*b = cv->InBuff[cv->InPtr];
 		cv->InPtr++;
 		cv->InBuffCount--;
-		if ( cv->InBuffCount==0 )
+		if ( cv->InBuffCount==0 ) {
 			cv->InPtr = 0;
+		}
 		return 1;
 	}
 	else {
@@ -921,46 +944,54 @@
 
 void PASCAL FAR CommInsert1Byte(PComVar cv, BYTE b)
 {
-	if ( ! cv->Ready )
+	if ( ! cv->Ready ) {
 		return;
+	}
 
-	if (cv->InPtr == 0)
+	if (cv->InPtr == 0) {
 		memmove(&(cv->InBuff[1]),&(cv->InBuff[0]),cv->InBuffCount);
-	else
+	}
+	else {
 		cv->InPtr--;
+	}
 	cv->InBuff[cv->InPtr] = b;
 	cv->InBuffCount++;
 
-	if (cv->HBinBuf!=0 )
+	if (cv->HBinBuf!=0 ) {
 		cv->BinSkip++;
+	}
 }
 
 void Log1Bin(PComVar cv, BYTE b)
 {
-	if (((cv->FilePause & OpLog)!=0) || cv->ProtoFlag)
+	if (((cv->FilePause & OpLog)!=0) || cv->ProtoFlag) {
 		return;
+	}
 	if (cv->BinSkip > 0) {
 		cv->BinSkip--;
 		return;
 	}
 	cv->BinBuf[cv->BinPtr] = b;
 	cv->BinPtr++;
-	if (cv->BinPtr>=InBuffSize)
+	if (cv->BinPtr>=InBuffSize) {
 		cv->BinPtr = cv->BinPtr-InBuffSize;
+	}
 	if (cv->BCount>=InBuffSize) {
 		cv->BCount = InBuffSize;
 		cv->BStart = cv->BinPtr;
 	}
-	else
+	else {
 		cv->BCount++;
+	}
 }
 
 int FAR PASCAL CommRead1Byte(PComVar cv, LPBYTE b)
 {
 	int c;
 
-	if ( ! cv->Ready )
+	if ( ! cv->Ready ) {
 		return 0;
+	}
 
 	if ((cv->HLogBuf!=NULL) &&
 	    ((cv->LCount>=InBuffSize-10) ||
@@ -973,17 +1004,22 @@
 	}
 
 	if ((cv->HBinBuf!=NULL) &&
-	    (cv->BCount>=InBuffSize-10))
+	    (cv->BCount>=InBuffSize-10)) {
 		return 0;
+	}
 
-	if ( cv->TelMode )
+	if ( cv->TelMode ) {
 		c = 0;
-	else
+	}
+	else {
 		c = CommReadRawByte(cv,b);
+	}
 
 	if ((c==1) && cv->TelCRFlag) {
 		cv->TelCRFlag = FALSE;
-		if (*b==0) c = 0;
+		if (*b==0) {
+			c = 0;
+		}
 	}
 
 	if ( c==1 ) {
@@ -992,25 +1028,29 @@
 			if ( *b != 0xFF ) {
 				cv->TelMode = TRUE;
 				CommInsert1Byte(cv,*b);
-				if ( cv->HBinBuf!=0 )
+				if ( cv->HBinBuf!=0 ) {
 					cv->BinSkip--;
+				}
 				c = 0;
 			}
 		}
 		else if ((cv->PortType==IdTCPIP) && (*b==0xFF)) {
-			if (!cv->TelFlag && cv->TelAutoDetect)  /* TTPLUG */
+			if (!cv->TelFlag && cv->TelAutoDetect) { /* TTPLUG */
 				cv->TelFlag = TRUE;
+			}
 			if (cv->TelFlag) {
 				cv->IACFlag = TRUE;
 				c = 0;
 			}
 		}
-		else if (cv->TelFlag && ! cv->TelBinRecv && (*b==0x0D))
+		else if (cv->TelFlag && ! cv->TelBinRecv && (*b==0x0D)) {
 			cv->TelCRFlag = TRUE;
+		}
 	}
 
-	if ( (c==1) && (cv->HBinBuf!=0) )
+	if ( (c==1) && (cv->HBinBuf!=0) ) {
 		Log1Bin(cv, *b);
+	}
 
 	return c;
 }
@@ -1019,13 +1059,16 @@
 {
 	int a;
 
-	if ( ! cv->Ready )
+	if ( ! cv->Ready ) {
 		return C;
+	}
 
-	if (C > OutBuffSize - cv->OutBuffCount)
+	if (C > OutBuffSize - cv->OutBuffCount) {
 		a = OutBuffSize - cv->OutBuffCount;
-	else
+	}
+	else {
 		a = C;
+	}
 	if ( cv->OutPtr > 0 ) {
 		memmove(&(cv->OutBuff[0]),&(cv->OutBuff[cv->OutPtr]),cv->OutBuffCount);
 		cv->OutPtr = 0;
@@ -1040,8 +1083,9 @@
 	int a, i, Len;
 	char d[3];
 
-	if ( ! cv->Ready )
+	if ( ! cv->Ready ) {
 		return C;
+	}
 
 	i = 0;
 	a = 1;
@@ -1066,8 +1110,9 @@
 			CommRawOut(cv,d,Len);
 			a = 1;
 		}
-		else
+		else {
 			a = 0;
+		}
 
 		i = i + a;
 	}
@@ -1131,10 +1176,12 @@
 
 			} else {
 
-				if (cv->KanjiCodeSend == IdEUC)
+				if (cv->KanjiCodeSend == IdEUC) {
 					K = SJIS2EUC(K);
-				else if (cv->KanjiCodeSend != IdSJIS)
+				}
+				else if (cv->KanjiCodeSend != IdSJIS) {
 					K = SJIS2JIS(K);
+				}
 
 				if ((cv->SendCode==IdKatakana) &&
 				    (cv->KanjiCodeSend==IdJIS) &&
@@ -1158,20 +1205,23 @@
 			    (cv->KanjiCodeSend==IdJIS)) {
 				TempStr[0] = 0x1B;
 				TempStr[1] = '$';
-				if (cv->KanjiIn == IdKanjiInB)
+				if (cv->KanjiIn == IdKanjiInB) {
 					TempStr[2] = 'B';
-				else
+				}
+				else {
 					TempStr[2] = '@';
+				}
 				TempLen = 3;
 			}
-			else TempLen = 0;
+			else {
+				TempLen = 0;
+			}
 		}
 		else {
 			KanjiFlagNew = FALSE;
 
 			if ((cv->SendCode==IdKanji) &&
-				(cv->KanjiCodeSend==IdJIS))
-			{
+			    (cv->KanjiCodeSend==IdJIS)) {
 				TempStr[0] = 0x1B;
 				TempStr[1] = '(';
 				switch (cv->KanjiOut) {
@@ -1186,7 +1236,9 @@
 				}
 				TempLen = 3;
 			}
-			else TempLen = 0;
+			else {
+				TempLen = 0;
+			}
 
 			if ((0xa0<d) && (d<0xe0)) {
 				SendCodeNew = IdKatakana;
@@ -1227,10 +1279,12 @@
 					TempLen++;
 				}
 				if ((cv->KanjiCodeSend==IdJIS) &&
-				    (cv->JIS7KatakanaSend==1))
+					(cv->JIS7KatakanaSend==1)) {
 					TempStr[TempLen] = d & 0x7f;
-				else
+				}
+				else {
 					TempStr[TempLen] = d;
+				}
 				TempLen++;
 
 				// ”¼ŠpƒJƒi‚ÍUnicode‚Å‚Í2ƒoƒCƒg‚É‚È‚é (2004.10.4 yutaka)
@@ -1300,13 +1354,16 @@
 
 			} else {
 
-				if (cv->KanjiCodeSend == IdEUC) K = K;
-				else if (cv->KanjiCodeSend != IdSJIS) K = K;
+				if (cv->KanjiCodeSend == IdEUC) {
+					K = K;
+				}
+				else if (cv->KanjiCodeSend != IdSJIS) {
+					K = K;
+				}
 
 				if ((cv->SendCode==IdKatakana) &&
-					(cv->KanjiCodeSend==IdJIS) &&
-					(cv->JIS7KatakanaSend==1))
-				{
+				    (cv->KanjiCodeSend==IdJIS) &&
+				    (cv->JIS7KatakanaSend==1)) {
 					TempStr[TempLen] = SI;
 					TempLen++;
 				}
@@ -1323,43 +1380,49 @@
 			SendCodeNew = IdKanji;
 
 			if ((cv->SendCode!=IdKanji) &&
-				(cv->KanjiCodeSend==IdJIS))
-			{
+			    (cv->KanjiCodeSend==IdJIS)) {
 				TempStr[0] = 0x1B;
 				TempStr[1] = '$';
-				if (cv->KanjiIn == IdKanjiInB)
+				if (cv->KanjiIn == IdKanjiInB) {
 					TempStr[2] = 'B';
-				else
+				}
+				else {
 					TempStr[2] = '@';
+				}
 				TempLen = 3;
 			}
-			else TempLen = 0;
+			else {
+				TempLen = 0;
+			}
 		}
 		else {
 			KanjiFlagNew = FALSE;
 
 			if ((cv->SendCode==IdKanji) &&
-				(cv->KanjiCodeSend==IdJIS))
-			{
+			    (cv->KanjiCodeSend==IdJIS)) {
 				TempStr[0] = 0x1B;
 				TempStr[1] = '(';
 				switch (cv->KanjiOut) {
-				case IdKanjiOutJ: TempStr[2] = 'J'; break;
-				case IdKanjiOutH: TempStr[2] = 'H'; break;
-				default:
-					TempStr[2] = 'B';
+					case IdKanjiOutJ:
+						TempStr[2] = 'J';
+						break;
+					case IdKanjiOutH:
+						TempStr[2] = 'H';
+						break;
+					default:
+						TempStr[2] = 'B';
 				}
 				TempLen = 3;
 			}
-			else TempLen = 0;
+			else {
+				TempLen = 0;
+			}
 
-			if ((0xa0<d) && (d<0xe0))
-			{
+			if ((0xa0<d) && (d<0xe0)) {
 				SendCodeNew = IdKatakana;
 				if ((cv->SendCode!=IdKatakana) &&
-					(cv->KanjiCodeSend==IdJIS) &&
-					(cv->JIS7KatakanaSend==1))
-				{
+				    (cv->KanjiCodeSend==IdJIS) &&
+				    (cv->JIS7KatakanaSend==1)) {
 					TempStr[TempLen] = SO;
 					TempLen++;
 				}
@@ -1367,43 +1430,39 @@
 			else {
 				SendCodeNew = IdASCII;
 				if ((cv->SendCode==IdKatakana) &&
-					(cv->KanjiCodeSend==IdJIS) &&
-					(cv->JIS7KatakanaSend==1))
-				{
+				    (cv->KanjiCodeSend==IdJIS) &&
+				    (cv->JIS7KatakanaSend==1)) {
 					TempStr[TempLen] = SI;
 					TempLen++;
 				}
 			}
 
-			if (d==0x0d)
-			{
+			if (d==0x0d) {
 				TempStr[TempLen] = 0x0d;
 				TempLen++;
-				if (cv->CRSend==IdCRLF)
-				{
+				if (cv->CRSend==IdCRLF) {
 					TempStr[TempLen] = 0x0a;
 					TempLen++;
 				}
 				else if ((cv->CRSend==IdCR) &&
-					cv->TelFlag && ! cv->TelBinSend)
-				{
+				    cv->TelFlag && ! cv->TelBinSend) {
 					TempStr[TempLen] = 0;
 					TempLen++;
 				}
 			}
-			else if ((d>=0xa1) && (d<=0xe0))
-			{
+			else if ((d>=0xa1) && (d<=0xe0)) {
 				/* Katakana */
-				if (cv->KanjiCodeSend==IdEUC)
-				{
+				if (cv->KanjiCodeSend==IdEUC) {
 					TempStr[TempLen] = (char)0x8E;
 					TempLen++;
 				}
 				if ((cv->KanjiCodeSend==IdJIS) &&
-					(cv->JIS7KatakanaSend==1))
+					(cv->JIS7KatakanaSend==1)) {
 					TempStr[TempLen] = d & 0x7f;
-				else
+				}
+				else {
 					TempStr[TempLen] = d;
+				}
 				TempLen++;
 
 				// ”¼ŠpƒJƒi‚ÍUnicode‚Å‚Í2ƒoƒCƒg‚É‚È‚é (2004.10.4 yutaka)
@@ -1416,24 +1475,21 @@
 			else {
 				TempStr[TempLen] = d;
 				TempLen++;
-				if (cv->TelFlag && (d==0xff))
-				{
+				if (cv->TelFlag && (d==0xff)) {
 					TempStr[TempLen] = (char)0xff;
 					TempLen++;
 				}
 			}
 		} // if (cv->SendKanjiFlag) else if ... else ... end
 
-		if (TempLen == 0)
-		{
+		if (TempLen == 0) {
 			i++;
 			cv->SendCode = SendCodeNew;
 			cv->SendKanjiFlag = KanjiFlagNew;
 		}
 		else {
 			Full = OutBuffSize-cv->OutBuffCount-TempLen < 0;
-			if (! Full)
-			{
+			if (! Full) {
 				i++;
 				cv->SendCode = SendCodeNew;
 				cv->SendKanjiFlag = KanjiFlagNew;
@@ -1453,13 +1509,16 @@
 	BYTE d;
 	BOOL Full;
 
-	if (! cv->Ready )
+	if (! cv->Ready ) {
 		return C;
+	}
 
-	if (cv->Language==IdJapanese)
+	if (cv->Language==IdJapanese) {
 		return TextOutJP(cv,B,C);
-	if (cv->Language==IdKorean)		// HKS
+	}
+	if (cv->Language==IdKorean) { // HKS
 		return TextOutKR(cv,B,C);
+	}
 
 	Full = FALSE;
 	i = 0;
@@ -1572,10 +1631,12 @@
 				OutputTextUTF8(K, TempStr, &TempLen, cv);
 			}
 			else {
-				if (cv->KanjiCodeEcho == IdEUC)
+				if (cv->KanjiCodeEcho == IdEUC) {
 					K = SJIS2EUC(K);
-				else if (cv->KanjiCodeEcho != IdSJIS)
+				}
+				else if (cv->KanjiCodeEcho != IdSJIS) {
 					K = SJIS2JIS(K);
+				}
 
 				if ((cv->EchoCode==IdKatakana) &&
 				    (cv->KanjiCodeEcho==IdJIS) &&
@@ -1598,14 +1659,17 @@
 			    (cv->KanjiCodeEcho==IdJIS)) {
 				TempStr[0] = 0x1B;
 				TempStr[1] = '$';
-				if (cv->KanjiIn == IdKanjiInB)
+				if (cv->KanjiIn == IdKanjiInB) {
 					TempStr[2] = 'B';
-				else
+				}
+				else {
 					TempStr[2] = '@';
+				}
 				TempLen = 3;
 			}
-			else
+			else {
 				TempLen = 0;
+			}
 		}
 		else {
 			KanjiFlagNew = FALSE;
@@ -1656,7 +1720,7 @@
 					TempLen++;
 				}
 				else if ((cv->CRSend==IdCR) &&
-						 cv->TelFlag && ! cv->TelBinSend) {
+				          cv->TelFlag && ! cv->TelBinSend) {
 					TempStr[TempLen] = 0;
 					TempLen++;
 				}
@@ -1668,10 +1732,12 @@
 					TempLen++;
 				}
 				if ((cv->KanjiCodeEcho==IdJIS) &&
-				    (cv->JIS7KatakanaEcho==1))
+					(cv->JIS7KatakanaEcho==1)) {
 					TempStr[TempLen] = d & 0x7f;
-				else
+				}
+				else {
 					TempStr[TempLen] = d;
+				}
 				TempLen++;
 			}
 			else {
@@ -1712,16 +1778,18 @@
 	BYTE d;
 	BOOL Full;
 
-	if ( ! cv->Ready )
+	if ( ! cv->Ready ) {
 		return C;
+	}
 
 	if ( (cv->InPtr>0) && (cv->InBuffCount>0) ) {
 		memmove(cv->InBuff,&(cv->InBuff[cv->InPtr]),cv->InBuffCount);
 		cv->InPtr = 0;
 	}
 
-	if (cv->Language==IdJapanese)
+	if (cv->Language==IdJapanese) {
 		return TextEchoJP(cv,B,C);
+	}
 
 	Full = FALSE;
 	i = 0;
@@ -1744,8 +1812,9 @@
 		}
 		else {
 			if ((cv->Language==IdRussian) &&
-			    (d>=128))
+				(d>=128)) {
 				d = RussConv(cv->RussClient,cv->RussHost,d);
+			}
 			TempStr[TempLen] = d;
 			TempLen++;
 			if (cv->TelFlag && (d==0xff)) {
@@ -1790,8 +1859,9 @@
 	bRet =
 		SetupDiClassGuidsFromName(_T("PORTS"), (LPGUID) & ClassGuid, 1,
 		                          &dwRequiredSize);
-	if (!bRet)
+	if (!bRet) {
 		goto cleanup;
+	}
 
 // Get class devices
 	// COMƒ|[ƒg”ԍ†‚ð‹­§•t‚¯‘Ö‚¦‚µ‚½ê‡‚ɁAŒ»Ý‚Ì‚à‚Ì‚Å‚Í‚È‚­AƒŒƒWƒXƒgƒŠ‚ÉŽc‚Á‚Ä‚¢‚é
@@ -1803,7 +1873,7 @@
 // Enumerate devices
 		dwMemberIndex = 0;
 		while (SetupDiEnumDeviceInfo
-			   (DeviceInfoSet, dwMemberIndex++, &DeviceInfoData)) {
+		       (DeviceInfoSet, dwMemberIndex++, &DeviceInfoData)) {
 			TCHAR szFriendlyName[MAX_PATH];
 			TCHAR szPortName[MAX_PATH];
 			//TCHAR szMessage[MAX_PATH];
@@ -1863,7 +1933,7 @@
 		}
 	}
 
-  cleanup:
+cleanup:
 // Destroy device info list
 	SetupDiDestroyDeviceInfoList(DeviceInfoSet);
 }
@@ -1893,9 +1963,11 @@
 
 		for (i=0; i<comports-1; i++) {
 			min = i;
-			for (j=i+1; j<comports; j++)
-				if (ComPortTable[min] > ComPortTable[j])
+			for (j=i+1; j<comports; j++) {
+				if (ComPortTable[min] > ComPortTable[j]) {
 					min = j;
+				}
+			}
 			if (min != i) {
 				s = ComPortTable[i];
 				ComPortTable[i] = ComPortTable[min];
@@ -1939,16 +2011,17 @@
 			/* do process initialization */
 			DoCover_IsDebuggerPresent();
 			hInst = hInstance;
-			HMap = CreateFileMapping(
-				(HANDLE) 0xFFFFFFFF, NULL, PAGE_READWRITE,
-				0, sizeof(TMap), TT_FILEMAPNAME);
-			if (HMap == NULL)
+			HMap = CreateFileMapping((HANDLE) 0xFFFFFFFF, NULL, PAGE_READWRITE,
+			                         0, sizeof(TMap), TT_FILEMAPNAME);
+			if (HMap == NULL) {
 				return FALSE;
+			}
 			FirstInstance = (GetLastError() != ERROR_ALREADY_EXISTS);
 
 			pm = (PMap)MapViewOfFile(HMap,FILE_MAP_WRITE,0,0,0);
-			if (pm == NULL)
+			if (pm == NULL) {
 				return FALSE;
+			}
 			break;
 		case DLL_PROCESS_DETACH:
 			/* do process cleanup */

Modified: trunk/teraterm/ttpdlg/ttdlg.c
===================================================================
--- trunk/teraterm/ttpdlg/ttdlg.c	2009-05-11 14:10:03 UTC (rev 3391)
+++ trunk/teraterm/ttpdlg/ttdlg.c	2009-05-12 11:55:27 UTC (rev 3392)
@@ -78,354 +78,368 @@
 	HFONT font;
 
 	switch (Message) {
-	case WM_INITDIALOG:
-		ts = (PTTSet)lParam;
-		SetWindowLong(Dialog, DWL_USER, lParam);
+		case WM_INITDIALOG:
+			ts = (PTTSet)lParam;
+			SetWindowLong(Dialog, DWL_USER, lParam);
 
-		font = (HFONT)SendMessage(Dialog, WM_GETFONT, 0, 0);
-		GetObject(font, sizeof(LOGFONT), &logfont);
-		if (get_lang_font("DLG_SYSTEM_FONT", Dialog, &logfont, &DlgTermFont, UILanguageFile)) {
-			SendDlgItemMessage(Dialog, IDC_TERMWIDTHLABEL, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
-			SendDlgItemMessage(Dialog, IDC_TERMWIDTH, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
-			SendDlgItemMessage(Dialog, IDC_TERMX, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
-			SendDlgItemMessage(Dialog, IDC_TERMHEIGHT, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
-			SendDlgItemMessage(Dialog, IDC_TERMISWIN, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
-			SendDlgItemMessage(Dialog, IDC_TERMRESIZE, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
-			SendDlgItemMessage(Dialog, IDC_TERMNEWLINE, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
-			SendDlgItemMessage(Dialog, IDC_TERMCRRCVLABEL, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
-			SendDlgItemMessage(Dialog, IDC_TERMCRRCV, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
-			SendDlgItemMessage(Dialog, IDC_TERMCRSENDLABEL, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
-			SendDlgItemMessage(Dialog, IDC_TERMCRSEND, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
-			SendDlgItemMessage(Dialog, IDC_TERMIDLABEL, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
-			SendDlgItemMessage(Dialog, IDC_TERMID, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
-			SendDlgItemMessage(Dialog, IDC_TERMLOCALECHO, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
-			SendDlgItemMessage(Dialog, IDC_TERMANSBACKTEXT, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
-			SendDlgItemMessage(Dialog, IDC_TERMANSBACK, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
-			SendDlgItemMessage(Dialog, IDC_TERMAUTOSWITCH, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
-			SendDlgItemMessage(Dialog, IDOK, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
-			SendDlgItemMessage(Dialog, IDCANCEL, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
-			SendDlgItemMessage(Dialog, IDC_TERMHELP, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
-			if (ts->Language==IdJapanese) {
-				SendDlgItemMessage(Dialog, IDC_TERMKANJILABEL, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_TERMKANJI, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_TERMKANA, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_TERMKANJISENDLABEL, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_TERMKANJISEND, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_TERMKANASEND, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_TERMKINTEXT, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_TERMKIN, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_TERMKOUTTEXT, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_TERMKOUT, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_LOCALE_LABEL, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_LOCALE_EDIT, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_CODEPAGE_LABEL, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_CODEPAGE_EDIT, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
+			font = (HFONT)SendMessage(Dialog, WM_GETFONT, 0, 0);
+			GetObject(font, sizeof(LOGFONT), &logfont);
+			if (get_lang_font("DLG_SYSTEM_FONT", Dialog, &logfont, &DlgTermFont, UILanguageFile)) {
+				SendDlgItemMessage(Dialog, IDC_TERMWIDTHLABEL, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
+				SendDlgItemMessage(Dialog, IDC_TERMWIDTH, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
+				SendDlgItemMessage(Dialog, IDC_TERMX, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
+				SendDlgItemMessage(Dialog, IDC_TERMHEIGHT, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
+				SendDlgItemMessage(Dialog, IDC_TERMISWIN, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
+				SendDlgItemMessage(Dialog, IDC_TERMRESIZE, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
+				SendDlgItemMessage(Dialog, IDC_TERMNEWLINE, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
+				SendDlgItemMessage(Dialog, IDC_TERMCRRCVLABEL, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
+				SendDlgItemMessage(Dialog, IDC_TERMCRRCV, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
+				SendDlgItemMessage(Dialog, IDC_TERMCRSENDLABEL, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
+				SendDlgItemMessage(Dialog, IDC_TERMCRSEND, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
+				SendDlgItemMessage(Dialog, IDC_TERMIDLABEL, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
+				SendDlgItemMessage(Dialog, IDC_TERMID, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
+				SendDlgItemMessage(Dialog, IDC_TERMLOCALECHO, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
+				SendDlgItemMessage(Dialog, IDC_TERMANSBACKTEXT, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
+				SendDlgItemMessage(Dialog, IDC_TERMANSBACK, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
+				SendDlgItemMessage(Dialog, IDC_TERMAUTOSWITCH, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
+				SendDlgItemMessage(Dialog, IDOK, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
+				SendDlgItemMessage(Dialog, IDCANCEL, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
+				SendDlgItemMessage(Dialog, IDC_TERMHELP, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
+				if (ts->Language==IdJapanese) {
+					SendDlgItemMessage(Dialog, IDC_TERMKANJILABEL, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
+					SendDlgItemMessage(Dialog, IDC_TERMKANJI, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
+					SendDlgItemMessage(Dialog, IDC_TERMKANA, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
+					SendDlgItemMessage(Dialog, IDC_TERMKANJISENDLABEL, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
+					SendDlgItemMessage(Dialog, IDC_TERMKANJISEND, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
+					SendDlgItemMessage(Dialog, IDC_TERMKANASEND, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
+					SendDlgItemMessage(Dialog, IDC_TERMKINTEXT, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
+					SendDlgItemMessage(Dialog, IDC_TERMKIN, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
+					SendDlgItemMessage(Dialog, IDC_TERMKOUTTEXT, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
+					SendDlgItemMessage(Dialog, IDC_TERMKOUT, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
+					SendDlgItemMessage(Dialog, IDC_LOCALE_LABEL, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
+					SendDlgItemMessage(Dialog, IDC_LOCALE_EDIT, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
+					SendDlgItemMessage(Dialog, IDC_CODEPAGE_LABEL, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
+					SendDlgItemMessage(Dialog, IDC_CODEPAGE_EDIT, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
+				}
+				if (ts->Language==IdRussian) {
+					SendDlgItemMessage(Dialog, IDC_TERMRUSSCHARSET, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
+					SendDlgItemMessage(Dialog, IDC_TERMRUSSHOSTLABEL, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
+					SendDlgItemMessage(Dialog, IDC_TERMRUSSHOST, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
+					SendDlgItemMessage(Dialog, IDC_TERMRUSSCLIENTLABEL, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
+					SendDlgItemMessage(Dialog, IDC_TERMRUSSCLIENT, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
+					SendDlgItemMessage(Dialog, IDC_TERMRUSSFONTLABEL, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
+					SendDlgItemMessage(Dialog, IDC_TERMRUSSFONT, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
+				}
 			}
-			if (ts->Language==IdRussian) {
-				SendDlgItemMessage(Dialog, IDC_TERMRUSSCHARSET, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_TERMRUSSHOSTLABEL, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_TERMRUSSHOST, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_TERMRUSSCLIENTLABEL, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_TERMRUSSCLIENT, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_TERMRUSSFONTLABEL, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_TERMRUSSFONT, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
+			else {
+				DlgTermFont = NULL;
 			}
-		}
-		else {
-			DlgTermFont = NULL;
-		}
 
-		GetWindowText(Dialog, uimsg2, sizeof(uimsg2));
-		get_lang_msg("DLG_TERM_TITLE", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-		SetWindowText(Dialog, uimsg);
-		GetDlgItemText(Dialog, IDC_TERMWIDTHLABEL, uimsg2, sizeof(uimsg2));
-		get_lang_msg("DLG_TERM_WIDTHLABEL", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-		SetDlgItemText(Dialog, IDC_TERMWIDTHLABEL, uimsg);
-		GetDlgItemText(Dialog, IDC_TERMISWIN, uimsg2, sizeof(uimsg2));
-		get_lang_msg("DLG_TERM_ISWIN", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-		SetDlgItemText(Dialog, IDC_TERMISWIN, uimsg);
-		GetDlgItemText(Dialog, IDC_TERMRESIZE, uimsg2, sizeof(uimsg2));
-		get_lang_msg("DLG_TERM_RESIZE", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-		SetDlgItemText(Dialog, IDC_TERMRESIZE, uimsg);
-		GetDlgItemText(Dialog, IDC_TERMNEWLINE, uimsg2, sizeof(uimsg2));
-		get_lang_msg("DLG_TERM_NEWLINE", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-		SetDlgItemText(Dialog, IDC_TERMNEWLINE, uimsg);
-		GetDlgItemText(Dialog, IDC_TERMCRRCVLABEL, uimsg2, sizeof(uimsg2));
-		get_lang_msg("DLG_TERM_CRRCV", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-		SetDlgItemText(Dialog, IDC_TERMCRRCVLABEL, uimsg);
-		GetDlgItemText(Dialog, IDC_TERMCRSENDLABEL, uimsg2, sizeof(uimsg2));
-		get_lang_msg("DLG_TERM_CRSEND", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-		SetDlgItemText(Dialog, IDC_TERMCRSENDLABEL, uimsg);
-		GetDlgItemText(Dialog, IDC_TERMIDLABEL, uimsg2, sizeof(uimsg2));
-		get_lang_msg("DLG_TERM_ID", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-		SetDlgItemText(Dialog, IDC_TERMIDLABEL, uimsg);
-		GetDlgItemText(Dialog, IDC_TERMLOCALECHO, uimsg2, sizeof(uimsg2));
-		get_lang_msg("DLG_TERM_LOCALECHO", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-		SetDlgItemText(Dialog, IDC_TERMLOCALECHO, uimsg);
-		GetDlgItemText(Dialog, IDC_TERMANSBACKTEXT, uimsg2, sizeof(uimsg2));
-		get_lang_msg("DLG_TERM_ANSBACK", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-		SetDlgItemText(Dialog, IDC_TERMANSBACKTEXT, uimsg);
-		GetDlgItemText(Dialog, IDC_TERMAUTOSWITCH, uimsg2, sizeof(uimsg2));
-		get_lang_msg("DLG_TERM_AUTOSWITCH", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-		SetDlgItemText(Dialog, IDC_TERMAUTOSWITCH, uimsg);
-		GetDlgItemText(Dialog, IDOK, uimsg2, sizeof(uimsg2));
-		get_lang_msg("BTN_OK", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-		SetDlgItemText(Dialog, IDOK, uimsg);
-		GetDlgItemText(Dialog, IDCANCEL, uimsg2, sizeof(uimsg2));
-		get_lang_msg("BTN_CANCEL", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-		SetDlgItemText(Dialog, IDCANCEL, uimsg);
-		GetDlgItemText(Dialog, IDC_TERMHELP, uimsg2, sizeof(uimsg2));
-		get_lang_msg("BTN_HELP", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-		SetDlgItemText(Dialog, IDC_TERMHELP, uimsg);
-		if ( ts->Language==IdJapanese ) {
-			GetDlgItemText(Dialog, IDC_TERMKANJILABEL, uimsg2, sizeof(uimsg2));
-			get_lang_msg("DLG_TERM_KANJI", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDC_TERMKANJILABEL, uimsg);
-			GetDlgItemText(Dialog, IDC_TERMKANA, uimsg2, sizeof(uimsg2));
-			get_lang_msg("DLG_TERM_KANA", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDC_TERMKANA, uimsg);
-			GetDlgItemText(Dialog, IDC_TERMKANJISENDLABEL, uimsg2, sizeof(uimsg2));
-			get_lang_msg("DLG_TERM_KANJISEND", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDC_TERMKANJISENDLABEL, uimsg);
-			GetDlgItemText(Dialog, IDC_TERMKANASEND, uimsg2, sizeof(uimsg2));
-			get_lang_msg("DLG_TERM_KANASEND", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDC_TERMKANASEND, uimsg);
-			GetDlgItemText(Dialog, IDC_TERMKINTEXT, uimsg2, sizeof(uimsg2));
-			get_lang_msg("DLG_TERM_KIN", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDC_TERMKINTEXT, uimsg);
-			GetDlgItemText(Dialog, IDC_TERMKOUTTEXT, uimsg2, sizeof(uimsg2));
-			get_lang_msg("DLG_TERM_KOUT", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDC_TERMKOUTTEXT, uimsg);
-			GetDlgItemText(Dialog, IDC_LOCALE_LABEL, uimsg2, sizeof(uimsg2));
-			get_lang_msg("DLG_TERM_LOCALE", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDC_LOCALE_LABEL, uimsg);
-			GetDlgItemText(Dialog, IDC_CODEPAGE_LABEL, uimsg2, sizeof(uimsg2));
-			get_lang_msg("DLG_TERM_CODEPAGE", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDC_CODEPAGE_LABEL, uimsg);
-		}
-		else if ( ts->Language==IdRussian ) {
-			GetDlgItemText(Dialog, IDC_TERMRUSSCHARSET, uimsg2, sizeof(uimsg2));
-			get_lang_msg("DLG_TERM_RUSSCHARSET", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDC_TERMRUSSCHARSET, uimsg);
-			GetDlgItemText(Dialog, IDC_TERMRUSSHOSTLABEL, uimsg2, sizeof(uimsg2));
-			get_lang_msg("DLG_TERM_RUSSHOST", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDC_TERMRUSSHOSTLABEL, uimsg);
-			GetDlgItemText(Dialog, IDC_TERMRUSSCLIENTLABEL, uimsg2, sizeof(uimsg2));
-			get_lang_msg("DLG_TERM_RUSSCLIENT", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDC_TERMRUSSCLIENTLABEL, uimsg);
-			GetDlgItemText(Dialog, IDC_TERMRUSSFONTLABEL, uimsg2, sizeof(uimsg2));
-			get_lang_msg("DLG_TERM_RUSSFONT", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDC_TERMRUSSFONTLABEL, uimsg);
-		}
+			GetWindowText(Dialog, uimsg2, sizeof(uimsg2));
+			get_lang_msg("DLG_TERM_TITLE", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
+			SetWindowText(Dialog, uimsg);
+			GetDlgItemText(Dialog, IDC_TERMWIDTHLABEL, uimsg2, sizeof(uimsg2));
+			get_lang_msg("DLG_TERM_WIDTHLABEL", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
+			SetDlgItemText(Dialog, IDC_TERMWIDTHLABEL, uimsg);
+			GetDlgItemText(Dialog, IDC_TERMISWIN, uimsg2, sizeof(uimsg2));
+			get_lang_msg("DLG_TERM_ISWIN", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
+			SetDlgItemText(Dialog, IDC_TERMISWIN, uimsg);
+			GetDlgItemText(Dialog, IDC_TERMRESIZE, uimsg2, sizeof(uimsg2));
+			get_lang_msg("DLG_TERM_RESIZE", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
+			SetDlgItemText(Dialog, IDC_TERMRESIZE, uimsg);
+			GetDlgItemText(Dialog, IDC_TERMNEWLINE, uimsg2, sizeof(uimsg2));
+			get_lang_msg("DLG_TERM_NEWLINE", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
+			SetDlgItemText(Dialog, IDC_TERMNEWLINE, uimsg);
+			GetDlgItemText(Dialog, IDC_TERMCRRCVLABEL, uimsg2, sizeof(uimsg2));
+			get_lang_msg("DLG_TERM_CRRCV", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
+			SetDlgItemText(Dialog, IDC_TERMCRRCVLABEL, uimsg);
+			GetDlgItemText(Dialog, IDC_TERMCRSENDLABEL, uimsg2, sizeof(uimsg2));
+			get_lang_msg("DLG_TERM_CRSEND", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
+			SetDlgItemText(Dialog, IDC_TERMCRSENDLABEL, uimsg);
+			GetDlgItemText(Dialog, IDC_TERMIDLABEL, uimsg2, sizeof(uimsg2));
+			get_lang_msg("DLG_TERM_ID", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
+			SetDlgItemText(Dialog, IDC_TERMIDLABEL, uimsg);
+			GetDlgItemText(Dialog, IDC_TERMLOCALECHO, uimsg2, sizeof(uimsg2));
+			get_lang_msg("DLG_TERM_LOCALECHO", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
+			SetDlgItemText(Dialog, IDC_TERMLOCALECHO, uimsg);
+			GetDlgItemText(Dialog, IDC_TERMANSBACKTEXT, uimsg2, sizeof(uimsg2));
+			get_lang_msg("DLG_TERM_ANSBACK", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
+			SetDlgItemText(Dialog, IDC_TERMANSBACKTEXT, uimsg);
+			GetDlgItemText(Dialog, IDC_TERMAUTOSWITCH, uimsg2, sizeof(uimsg2));
+			get_lang_msg("DLG_TERM_AUTOSWITCH", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
+			SetDlgItemText(Dialog, IDC_TERMAUTOSWITCH, uimsg);
+			GetDlgItemText(Dialog, IDOK, uimsg2, sizeof(uimsg2));
+			get_lang_msg("BTN_OK", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
+			SetDlgItemText(Dialog, IDOK, uimsg);
+			GetDlgItemText(Dialog, IDCANCEL, uimsg2, sizeof(uimsg2));
+			get_lang_msg("BTN_CANCEL", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
+			SetDlgItemText(Dialog, IDCANCEL, uimsg);
+			GetDlgItemText(Dialog, IDC_TERMHELP, uimsg2, sizeof(uimsg2));
+			get_lang_msg("BTN_HELP", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
+			SetDlgItemText(Dialog, IDC_TERMHELP, uimsg);
+			if ( ts->Language==IdJapanese ) {
+				GetDlgItemText(Dialog, IDC_TERMKANJILABEL, uimsg2, sizeof(uimsg2));
+				get_lang_msg("DLG_TERM_KANJI", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
+				SetDlgItemText(Dialog, IDC_TERMKANJILABEL, uimsg);
+				GetDlgItemText(Dialog, IDC_TERMKANA, uimsg2, sizeof(uimsg2));
+				get_lang_msg("DLG_TERM_KANA", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
+				SetDlgItemText(Dialog, IDC_TERMKANA, uimsg);
+				GetDlgItemText(Dialog, IDC_TERMKANJISENDLABEL, uimsg2, sizeof(uimsg2));
+				get_lang_msg("DLG_TERM_KANJISEND", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
+				SetDlgItemText(Dialog, IDC_TERMKANJISENDLABEL, uimsg);
+				GetDlgItemText(Dialog, IDC_TERMKANASEND, uimsg2, sizeof(uimsg2));
+				get_lang_msg("DLG_TERM_KANASEND", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
+				SetDlgItemText(Dialog, IDC_TERMKANASEND, uimsg);
+				GetDlgItemText(Dialog, IDC_TERMKINTEXT, uimsg2, sizeof(uimsg2));
+				get_lang_msg("DLG_TERM_KIN", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
+				SetDlgItemText(Dialog, IDC_TERMKINTEXT, uimsg);
+				GetDlgItemText(Dialog, IDC_TERMKOUTTEXT, uimsg2, sizeof(uimsg2));
+				get_lang_msg("DLG_TERM_KOUT", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
+				SetDlgItemText(Dialog, IDC_TERMKOUTTEXT, uimsg);
+				GetDlgItemText(Dialog, IDC_LOCALE_LABEL, uimsg2, sizeof(uimsg2));
+				get_lang_msg("DLG_TERM_LOCALE", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
+				SetDlgItemText(Dialog, IDC_LOCALE_LABEL, uimsg);
+				GetDlgItemText(Dialog, IDC_CODEPAGE_LABEL, uimsg2, sizeof(uimsg2));
+				get_lang_msg("DLG_TERM_CODEPAGE", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
+				SetDlgItemText(Dialog, IDC_CODEPAGE_LABEL, uimsg);
+			}
+			else if ( ts->Language==IdRussian ) {
+				GetDlgItemText(Dialog, IDC_TERMRUSSCHARSET, uimsg2, sizeof(uimsg2));
+				get_lang_msg("DLG_TERM_RUSSCHARSET", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
+				SetDlgItemText(Dialog, IDC_TERMRUSSCHARSET, uimsg);
+				GetDlgItemText(Dialog, IDC_TERMRUSSHOSTLABEL, uimsg2, sizeof(uimsg2));
+				get_lang_msg("DLG_TERM_RUSSHOST", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
+				SetDlgItemText(Dialog, IDC_TERMRUSSHOSTLABEL, uimsg);
+				GetDlgItemText(Dialog, IDC_TERMRUSSCLIENTLABEL, uimsg2, sizeof(uimsg2));
+				get_lang_msg("DLG_TERM_RUSSCLIENT", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
+				SetDlgItemText(Dialog, IDC_TERMRUSSCLIENTLABEL, uimsg);
+				GetDlgItemText(Dialog, IDC_TERMRUSSFONTLABEL, uimsg2, sizeof(uimsg2));
+				get_lang_msg("DLG_TERM_RUSSFONT", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
+				SetDlgItemText(Dialog, IDC_TERMRUSSFONTLABEL, uimsg);
+			}
 
-		SetDlgItemInt(Dialog,IDC_TERMWIDTH,ts->TerminalWidth,FALSE);
-		SendDlgItemMessage(Dialog, IDC_TERMWIDTH, EM_LIMITTEXT,3, 0);
+			SetDlgItemInt(Dialog,IDC_TERMWIDTH,ts->TerminalWidth,FALSE);
+			SendDlgItemMessage(Dialog, IDC_TERMWIDTH, EM_LIMITTEXT,3, 0);
 
-		SetDlgItemInt(Dialog,IDC_TERMHEIGHT,ts->TerminalHeight,FALSE);
-		SendDlgItemMessage(Dialog, IDC_TERMHEIGHT, EM_LIMITTEXT,3, 0);
+			SetDlgItemInt(Dialog,IDC_TERMHEIGHT,ts->TerminalHeight,FALSE);
+			SendDlgItemMessage(Dialog, IDC_TERMHEIGHT, EM_LIMITTEXT,3, 0);
 
-		SetRB(Dialog,ts->TermIsWin,IDC_TERMISWIN,IDC_TERMISWIN);
-		SetRB(Dialog,ts->AutoWinResize,IDC_TERMRESIZE,IDC_TERMRESIZE);
-		if ( ts->TermIsWin>0 )
-			DisableDlgItem(Dialog,IDC_TERMRESIZE,IDC_TERMRESIZE);
+			SetRB(Dialog,ts->TermIsWin,IDC_TERMISWIN,IDC_TERMISWIN);
+			SetRB(Dialog,ts->AutoWinResize,IDC_TERMRESIZE,IDC_TERMRESIZE);
+			if ( ts->TermIsWin>0 )
+				DisableDlgItem(Dialog,IDC_TERMRESIZE,IDC_TERMRESIZE);
 
-		SetDropDownList(Dialog, IDC_TERMCRRCV, NLListRcv, ts->CRReceive); // add 'LF' (2007.1.21 yutaka)
-		SetDropDownList(Dialog, IDC_TERMCRSEND, NLList, ts->CRSend);
+			SetDropDownList(Dialog, IDC_TERMCRRCV, NLListRcv, ts->CRReceive); // add 'LF' (2007.1.21 yutaka)
+			SetDropDownList(Dialog, IDC_TERMCRSEND, NLList, ts->CRSend);
 
-		if ( ts->Language!=IdJapanese ) /* non-Japanese mode */
-		{
-			if ((ts->TerminalID>=1) &&
-				(ts->TerminalID<=9))
-				w = TermJ_Term[ts->TerminalID-1];
-			else
-				w = 1;
-			SetDropDownList(Dialog, IDC_TERMID, TermList, w);
-		}
-		else
-			SetDropDownList(Dialog, IDC_TERMID, TermListJ, ts->TerminalID);
+			if ( ts->Language!=IdJapanese ) { /* non-Japanese mode */
+				if ((ts->TerminalID>=1) &&
+					(ts->TerminalID<=9)) {
+					w = TermJ_Term[ts->TerminalID-1];
+				}
+				else {
+					w = 1;
+				}
+				SetDropDownList(Dialog, IDC_TERMID, TermList, w);
+			}
+			else {
+				SetDropDownList(Dialog, IDC_TERMID, TermListJ, ts->TerminalID);
+			}
 
-		SetRB(Dialog,ts->LocalEcho,IDC_TERMLOCALECHO,IDC_TERMLOCALECHO);
+			SetRB(Dialog,ts->LocalEcho,IDC_TERMLOCALECHO,IDC_TERMLOCALECHO);
 
-		if ((ts->FTFlag & FT_BPAUTO)!=0)
-			DisableDlgItem(Dialog,IDC_TERMANSBACKTEXT,IDC_TERMANSBACK);
-		else {
-			Str2Hex(ts->Answerback,Temp,ts->AnswerbackLen,
-				sizeof(Temp)-1,FALSE);
-			SetDlgItemText(Dialog, IDC_TERMANSBACK, Temp);
-			SendDlgItemMessage(Dialog, IDC_TERMANSBACK, EM_LIMITTEXT,
-				sizeof(Temp) - 1, 0);
-		}
+			if ((ts->FTFlag & FT_BPAUTO)!=0) {
+				DisableDlgItem(Dialog,IDC_TERMANSBACKTEXT,IDC_TERMANSBACK);
+			}
+			else {
+				Str2Hex(ts->Answerback,Temp,ts->AnswerbackLen,
+					sizeof(Temp)-1,FALSE);
+				SetDlgItemText(Dialog, IDC_TERMANSBACK, Temp);
+				SendDlgItemMessage(Dialog, IDC_TERMANSBACK, EM_LIMITTEXT,
+					sizeof(Temp) - 1, 0);
+			}
 
-		SetRB(Dialog,ts->AutoWinSwitch,IDC_TERMAUTOSWITCH,IDC_TERMAUTOSWITCH);
+			SetRB(Dialog,ts->AutoWinSwitch,IDC_TERMAUTOSWITCH,IDC_TERMAUTOSWITCH);
 
-		if (ts->Language==IdJapanese)
-		{
-			SetDropDownList(Dialog, IDC_TERMKANJI, KanjiList, ts->KanjiCode);
-			if ( ts->KanjiCode!=IdJIS )
-				DisableDlgItem(Dialog,IDC_TERMKANA,IDC_TERMKANA);
-			SetRB(Dialog,ts->JIS7Katakana,IDC_TERMKANA,IDC_TERMKANA);
-			SetDropDownList(Dialog, IDC_TERMKANJISEND, KanjiListSend, ts->KanjiCodeSend);
-			if ( ts->KanjiCodeSend!=IdJIS )
-				DisableDlgItem(Dialog,IDC_TERMKANASEND,IDC_TERMKOUT);
-			SetRB(Dialog,ts->JIS7KatakanaSend,IDC_TERMKANASEND,IDC_TERMKANASEND);
-			SetDropDownList(Dialog,IDC_TERMKIN,KanjiInList,ts->KanjiIn);
-			if ((ts->TermFlag & TF_ALLOWWRONGSEQUENCE)!=0)
-				SetDropDownList(Dialog,IDC_TERMKOUT,KanjiOutList2,ts->KanjiOut);
-			else
-				SetDropDownList(Dialog,IDC_TERMKOUT,KanjiOutList,ts->KanjiOut);
+			if (ts->Language==IdJapanese) {
+				SetDropDownList(Dialog, IDC_TERMKANJI, KanjiList, ts->KanjiCode);
+				if ( ts->KanjiCode!=IdJIS ) {
+					DisableDlgItem(Dialog,IDC_TERMKANA,IDC_TERMKANA);
+				}
+				SetRB(Dialog,ts->JIS7Katakana,IDC_TERMKANA,IDC_TERMKANA);
+				SetDropDownList(Dialog, IDC_TERMKANJISEND, KanjiListSend, ts->KanjiCodeSend);
+				if ( ts->KanjiCodeSend!=IdJIS ) {
+					DisableDlgItem(Dialog,IDC_TERMKANASEND,IDC_TERMKOUT);
+				}
+				SetRB(Dialog,ts->JIS7KatakanaSend,IDC_TERMKANASEND,IDC_TERMKANASEND);
+				SetDropDownList(Dialog,IDC_TERMKIN,KanjiInList,ts->KanjiIn);
+				if ((ts->TermFlag & TF_ALLOWWRONGSEQUENCE)!=0) {
+					SetDropDownList(Dialog,IDC_TERMKOUT,KanjiOutList2,ts->KanjiOut);
+				}
+				else {
+					SetDropDownList(Dialog,IDC_TERMKOUT,KanjiOutList,ts->KanjiOut);
+				}
 
-			// ƒƒP[ƒ‹—pƒeƒLƒXƒgƒ{ƒbƒNƒX
-			SetDlgItemText(Dialog, IDC_LOCALE_EDIT, ts->Locale);
-			SendDlgItemMessage(Dialog, IDC_LOCALE_EDIT, EM_LIMITTEXT, sizeof(ts->Locale), 0);
+				// ƒƒP[ƒ‹—pƒeƒLƒXƒgƒ{ƒbƒNƒX
+				SetDlgItemText(Dialog, IDC_LOCALE_EDIT, ts->Locale);
+				SendDlgItemMessage(Dialog, IDC_LOCALE_EDIT, EM_LIMITTEXT, sizeof(ts->Locale), 0);
 
-			SetDlgItemInt(Dialog, IDC_CODEPAGE_EDIT, ts->CodePage, FALSE);
-			//SendDlgItemMessage(Dialog, IDC_CODEPAGE_EDIT, EM_LIMITTEXT, 16, 0);
+				SetDlgItemInt(Dialog, IDC_CODEPAGE_EDIT, ts->CodePage, FALSE);
+				//SendDlgItemMessage(Dialog, IDC_CODEPAGE_EDIT, EM_LIMITTEXT, 16, 0);
 
-		}
-		else if (ts->Language==IdRussian)
-		{
-			SetDropDownList(Dialog,IDC_TERMRUSSHOST,RussList,ts->RussHost);
-			SetDropDownList(Dialog,IDC_TERMRUSSCLIENT,RussList,ts->RussClient);
-			SetDropDownList(Dialog,IDC_TERMRUSSFONT,RussList,ts->RussFont);
-		}
-		else if (ts->Language==IdKorean) // HKS
-		{
-			SetDropDownList(Dialog, IDC_TERMKANJI, KoreanList, (ts->KanjiCode==IdUTF8)? 2:1);
-			SetDropDownList(Dialog, IDC_TERMKANJISEND, KoreanListSend, (ts->KanjiCodeSend==IdUTF8)? 2:1);
+			}
+			else if (ts->Language==IdRussian) {
+				SetDropDownList(Dialog,IDC_TERMRUSSHOST,RussList,ts->RussHost);
+				SetDropDownList(Dialog,IDC_TERMRUSSCLIENT,RussList,ts->RussClient);
+				SetDropDownList(Dialog,IDC_TERMRUSSFONT,RussList,ts->RussFont);
+			}
+			else if (ts->Language==IdKorean) { // HKS
+				SetDropDownList(Dialog, IDC_TERMKANJI, KoreanList, (ts->KanjiCode==IdUTF8)? 2:1);
+				SetDropDownList(Dialog, IDC_TERMKANJISEND, KoreanListSend, (ts->KanjiCodeSend==IdUTF8)? 2:1);
 
-			// ƒƒP[ƒ‹—pƒeƒLƒXƒgƒ{ƒbƒNƒX
-			SetDlgItemText(Dialog, IDC_LOCALE_EDIT, ts->Locale);
-			SendDlgItemMessage(Dialog, IDC_LOCALE_EDIT, EM_LIMITTEXT, sizeof(ts->Locale), 0);
+				// ƒƒP[ƒ‹—pƒeƒLƒXƒgƒ{ƒbƒNƒX
+				SetDlgItemText(Dialog, IDC_LOCALE_EDIT, ts->Locale);
+				SendDlgItemMessage(Dialog, IDC_LOCALE_EDIT, EM_LIMITTEXT, sizeof(ts->Locale), 0);
 
-			SetDlgItemInt(Dialog, IDC_CODEPAGE_EDIT, ts->CodePage, FALSE);
-			//SendDlgItemMessage(Dialog, IDC_CODEPAGE_EDIT, EM_LIMITTEXT, 16, 0);
+				SetDlgItemInt(Dialog, IDC_CODEPAGE_EDIT, ts->CodePage, FALSE);
+				//SendDlgItemMessage(Dialog, IDC_CODEPAGE_EDIT, EM_LIMITTEXT, 16, 0);
 
-		}
-		return TRUE;
+			}
+			return TRUE;
 
-	case WM_COMMAND:
-		switch (LOWORD(wParam)) {
-	case IDOK:
-		ts = (PTTSet)GetWindowLong(Dialog,DWL_USER);
+		case WM_COMMAND:
+			switch (LOWORD(wParam)) {
+				case IDOK:
+					ts = (PTTSet)GetWindowLong(Dialog,DWL_USER);
 
-		if ( ts!=NULL )
-		{
-			ts->TerminalWidth = GetDlgItemInt(Dialog,IDC_TERMWIDTH,NULL,FALSE);
-			if ( ts->TerminalWidth<1 ) ts->TerminalWidth = 1;
-			if ( ts->TerminalWidth>500 ) ts->TerminalWidth = 500;
+					if ( ts!=NULL ) {
+						ts->TerminalWidth = GetDlgItemInt(Dialog,IDC_TERMWIDTH,NULL,FALSE);
+						if ( ts->TerminalWidth<1 ) {
+							ts->TerminalWidth = 1;
+						}
+						if ( ts->TerminalWidth>500 ) {
+							ts->TerminalWidth = 500;
+						}
 
-			ts->TerminalHeight = GetDlgItemInt(Dialog,IDC_TERMHEIGHT,NULL,FALSE);
-			if ( ts->TerminalHeight<1 ) ts->TerminalHeight = 1;
-			if ( ts->TerminalHeight>500 ) ts->TerminalHeight = 500;
+						ts->TerminalHeight = GetDlgItemInt(Dialog,IDC_TERMHEIGHT,NULL,FALSE);
+						if ( ts->TerminalHeight<1 ) {
+							ts->TerminalHeight = 1;
+						}
+						if ( ts->TerminalHeight>500 ) {
+							ts->TerminalHeight = 500;
+						}
 
-			GetRB(Dialog,&ts->TermIsWin,IDC_TERMISWIN,IDC_TERMISWIN);
-			GetRB(Dialog,&ts->AutoWinResize,IDC_TERMRESIZE,IDC_TERMRESIZE);
+						GetRB(Dialog,&ts->TermIsWin,IDC_TERMISWIN,IDC_TERMISWIN);
+						GetRB(Dialog,&ts->AutoWinResize,IDC_TERMRESIZE,IDC_TERMRESIZE);
 
-			ts->CRReceive = (WORD)GetCurSel(Dialog, IDC_TERMCRRCV);
-			ts->CRSend = (WORD)GetCurSel(Dialog, IDC_TERMCRSEND);
+						ts->CRReceive = (WORD)GetCurSel(Dialog, IDC_TERMCRRCV);
+						ts->CRSend = (WORD)GetCurSel(Dialog, IDC_TERMCRSEND);
 
-			w = (WORD)GetCurSel(Dialog, IDC_TERMID);
-			if ( ts->Language!=IdJapanese ) /* non-Japanese mode */
-			{
-				if ((w==0) || (w>6)) w = 1;
-				w = Term_TermJ[w-1];
-			}
-			ts->TerminalID = w;
+						w = (WORD)GetCurSel(Dialog, IDC_TERMID);
+						if ( ts->Language!=IdJapanese ) { /* non-Japanese mode */
+							if ((w==0) || (w>6)) w = 1;
+							w = Term_TermJ[w-1];
+						}
+						ts->TerminalID = w;
 
-			GetRB(Dialog,&ts->LocalEcho,IDC_TERMLOCALECHO,IDC_TERMLOCALECHO);
+						GetRB(Dialog,&ts->LocalEcho,IDC_TERMLOCALECHO,IDC_TERMLOCALECHO);
 
-			if ((ts->FTFlag & FT_BPAUTO)==0)
-			{
-				GetDlgItemText(Dialog, IDC_TERMANSBACK,Temp,sizeof(Temp));
-				ts->AnswerbackLen =
-					Hex2Str(Temp,ts->Answerback,sizeof(ts->Answerback));
-			}
+						if ((ts->FTFlag & FT_BPAUTO)==0) {
+							GetDlgItemText(Dialog, IDC_TERMANSBACK,Temp,sizeof(Temp));
+							ts->AnswerbackLen = Hex2Str(Temp,ts->Answerback,sizeof(ts->Answerback));
+						}
 
-			GetRB(Dialog,&ts->AutoWinSwitch,IDC_TERMAUTOSWITCH,IDC_TERMAUTOSWITCH);
+						GetRB(Dialog,&ts->AutoWinSwitch,IDC_TERMAUTOSWITCH,IDC_TERMAUTOSWITCH);
 
-			if (ts->Language==IdJapanese)
-			{
-				BOOL ret;
+						if (ts->Language==IdJapanese) {
+							BOOL ret;
 
-				ts->KanjiCode = (WORD)GetCurSel(Dialog, IDC_TERMKANJI);
-				GetRB(Dialog,&ts->JIS7Katakana,IDC_TERMKANA,IDC_TERMKANA);
-				ts->KanjiCodeSend = (WORD)GetCurSel(Dialog, IDC_TERMKANJISEND);
-				GetRB(Dialog,&ts->JIS7KatakanaSend,IDC_TERMKANASEND,IDC_TERMKANASEND);
-				ts->KanjiIn = (WORD)GetCurSel(Dialog, IDC_TERMKIN);
-				ts->KanjiOut = (WORD)GetCurSel(Dialog, IDC_TERMKOUT);
+							ts->KanjiCode = (WORD)GetCurSel(Dialog, IDC_TERMKANJI);
+							GetRB(Dialog,&ts->JIS7Katakana,IDC_TERMKANA,IDC_TERMKANA);
+							ts->KanjiCodeSend = (WORD)GetCurSel(Dialog, IDC_TERMKANJISEND);
+							GetRB(Dialog,&ts->JIS7KatakanaSend,IDC_TERMKANASEND,IDC_TERMKANASEND);
+							ts->KanjiIn = (WORD)GetCurSel(Dialog, IDC_TERMKIN);
+							ts->KanjiOut = (WORD)GetCurSel(Dialog, IDC_TERMKOUT);
 
-				GetDlgItemText(Dialog, IDC_LOCALE_EDIT, ts->Locale, sizeof(ts->Locale));
-				ts->CodePage = GetDlgItemInt(Dialog, IDC_CODEPAGE_EDIT, &ret, FALSE);
-			}
-			else if (ts->Language==IdRussian)
-			{
-				ts->RussHost = (WORD)GetCurSel(Dialog, IDC_TERMRUSSHOST);
-				ts->RussClient = (WORD)GetCurSel(Dialog, IDC_TERMRUSSCLIENT);
-				ts->RussFont = (WORD)GetCurSel(Dialog, IDC_TERMRUSSFONT);
-			}
-			else if (ts->Language==IdKorean) // HKS
-			{
-				BOOL ret;
+							GetDlgItemText(Dialog, IDC_LOCALE_EDIT, ts->Locale, sizeof(ts->Locale));
+							ts->CodePage = GetDlgItemInt(Dialog, IDC_CODEPAGE_EDIT, &ret, FALSE);
+						}
+						else if (ts->Language==IdRussian) {
+							ts->RussHost = (WORD)GetCurSel(Dialog, IDC_TERMRUSSHOST);
+							ts->RussClient = (WORD)GetCurSel(Dialog, IDC_TERMRUSSCLIENT);
+							ts->RussFont = (WORD)GetCurSel(Dialog, IDC_TERMRUSSFONT);
+						}
+						else if (ts->Language==IdKorean) { // HKS
+							BOOL ret;
 
-				ts->KanjiCode = (WORD)GetCurSel(Dialog, IDC_TERMKANJI);
-				if(ts->KanjiCode==2)
-				   ts->KanjiCode=IdUTF8;
-				ts->KanjiCodeSend = (WORD)GetCurSel(Dialog, IDC_TERMKANJISEND);
-				if(ts->KanjiCodeSend==2)
-				   ts->KanjiCodeSend=IdUTF8;
-				ts->JIS7KatakanaSend=0;
-				ts->JIS7Katakana=0;
-				ts->KanjiIn = 0;
-				ts->KanjiOut = 0;
+							ts->KanjiCode = (WORD)GetCurSel(Dialog, IDC_TERMKANJI);
+							if(ts->KanjiCode==2) {
+								ts->KanjiCode=IdUTF8;
+							}
+							ts->KanjiCodeSend = (WORD)GetCurSel(Dialog, IDC_TERMKANJISEND);
+							if(ts->KanjiCodeSend==2) {
+								ts->KanjiCodeSend=IdUTF8;
+							}
+							ts->JIS7KatakanaSend=0;
+							ts->JIS7Katakana=0;
+							ts->KanjiIn = 0;
+							ts->KanjiOut = 0;
 
-				GetDlgItemText(Dialog, IDC_LOCALE_EDIT, ts->Locale, sizeof(ts->Locale));
-				ts->CodePage = GetDlgItemInt(Dialog, IDC_CODEPAGE_EDIT, &ret, FALSE);
-				if(ts->CodePage==932)
-				  ts->Language = IdJapanese;
-			}
+							GetDlgItemText(Dialog, IDC_LOCALE_EDIT, ts->Locale, sizeof(ts->Locale));
+							ts->CodePage = GetDlgItemInt(Dialog, IDC_CODEPAGE_EDIT, &ret, FALSE);
+							if(ts->CodePage==932) {
+								ts->Language = IdJapanese;
+							}
+						}
 
-		}
-		EndDialog(Dialog, 1);
-		if (DlgTermFont != NULL) {
-			DeleteObject(DlgTermFont);
-		}
-		return TRUE;
+					}
+					EndDialog(Dialog, 1);
+					if (DlgTermFont != NULL) {
+						DeleteObject(DlgTermFont);
+					}
+					return TRUE;
 
-	case IDCANCEL:
-		EndDialog(Dialog, 0);
-		if (DlgTermFont != NULL) {
-			DeleteObject(DlgTermFont);
-		}
-		return TRUE;
+				case IDCANCEL:
+					EndDialog(Dialog, 0);
+					if (DlgTermFont != NULL) {
+						DeleteObject(DlgTermFont);
+					}
+					return TRUE;
 
-	case IDC_TERMISWIN:
-		GetRB(Dialog,&w,IDC_TERMISWIN,IDC_TERMISWIN);
-		if ( w==0 )
-			EnableDlgItem(Dialog,IDC_TERMRESIZE,IDC_TERMRESIZE);
-		else
-			DisableDlgItem(Dialog,IDC_TERMRESIZE,IDC_TERMRESIZE);
-		break;
+				case IDC_TERMISWIN:
+					GetRB(Dialog,&w,IDC_TERMISWIN,IDC_TERMISWIN);
+					if ( w==0 ) {
+						EnableDlgItem(Dialog,IDC_TERMRESIZE,IDC_TERMRESIZE);
+					}
+					else {
+						DisableDlgItem(Dialog,IDC_TERMRESIZE,IDC_TERMRESIZE);
+					}
+					break;
 
-	case IDC_TERMKANJI:
-		w = (WORD)GetCurSel(Dialog, IDC_TERMKANJI);
-		if (w==IdJIS)
-			EnableDlgItem(Dialog,IDC_TERMKANA,IDC_TERMKANA);
-		else
-			DisableDlgItem(Dialog,IDC_TERMKANA,IDC_TERMKANA);
-		break;
+				case IDC_TERMKANJI:
+					w = (WORD)GetCurSel(Dialog, IDC_TERMKANJI);
+					if (w==IdJIS) {
+						EnableDlgItem(Dialog,IDC_TERMKANA,IDC_TERMKANA);
+					}
+					else {
+						DisableDlgItem(Dialog,IDC_TERMKANA,IDC_TERMKANA);
+						}
+					break;
 
-	case IDC_TERMKANJISEND:
-		w = (WORD)GetCurSel(Dialog, IDC_TERMKANJISEND);
-		if (w==IdJIS)
-			EnableDlgItem(Dialog,IDC_TERMKANASEND,IDC_TERMKOUT);
-		else
-			DisableDlgItem(Dialog,IDC_TERMKANASEND,IDC_TERMKOUT);
-		break;
+				case IDC_TERMKANJISEND:
+					w = (WORD)GetCurSel(Dialog, IDC_TERMKANJISEND);
+					if (w==IdJIS) {
+						EnableDlgItem(Dialog,IDC_TERMKANASEND,IDC_TERMKOUT);
+					}
+					else {
+						DisableDlgItem(Dialog,IDC_TERMKANASEND,IDC_TERMKOUT);
+					}
+					break;
 
-	case IDC_TERMHELP:
-		PostMessage(GetParent(Dialog),WM_USER_DLGHELP2,0,0);
-		break;
-		}
+				case IDC_TERMHELP:
+					PostMessage(GetParent(Dialog),WM_USER_DLGHELP2,0,0);
+					break;
+			}
 	}
 	return FALSE;
 }
@@ -501,17 +515,19 @@
 	WORD w;
 
 	GetRB(Dialog,&w,IDC_WINTEXT,IDC_WINBACK);
-	if (w==2)
+	if (w==2) {
 		*IOffset = 3;
-	else
+	}
+	else {
 		*IOffset = 0;
-	if ((ts!=NULL) && (ts->VTFlag>0))
-	{
+	}
+	if ((ts!=NULL) && (ts->VTFlag>0)) {
 		*IAttr = GetCurSel(Dialog,IDC_WINATTR);
 		if (*IAttr>0) (*IAttr)--;
 	}
-	else
+	else {
 		*IAttr = 0;
+	}
 }
 
 BOOL CALLBACK WinDlg(HWND Dialog, UINT Message, WPARAM wParam, LPARAM lParam)
@@ -670,8 +686,10 @@
 
 				SendDlgItemMessage(Dialog, IDC_WINSCROLL2, EM_LIMITTEXT, 6, 0);
 
-				if ( ts->EnableScrollBuff==0 )
+				if ( ts->EnableScrollBuff==0 ) {
 					DisableDlgItem(Dialog,IDC_WINSCROLL2,IDC_WINSCROLL3);
+				}
+
 				for (i = 0 ; i <= 1 ; i++) {
 					if (ts->ColorFlag & CF_REVERSEVIDEO) {
 						//
@@ -792,20 +810,26 @@
 						DC = GetDC(Dialog);
 						if (ts->VTFlag>0) {
 							GetRB(Dialog,&i,IDC_WINCOLOREMU,IDC_WINCOLOREMU);
-							if (i!=0)
+							if (i!=0) {
 								ts->ColorFlag |= CF_PCBOLD16;
-							else
+							}
+							else {
 								ts->ColorFlag &= ~(WORD)CF_PCBOLD16;
+							}
 							GetRB(Dialog,&i,IDC_WINAIXTERM16,IDC_WINAIXTERM16);
-							if (i!=0)
+							if (i!=0) {
 								ts->ColorFlag |= CF_AIXTERM16;
-							else
+							}
+							else {
 								ts->ColorFlag &= ~(WORD)CF_AIXTERM16;
+							}
 							GetRB(Dialog,&i,IDC_WINXTERM256,IDC_WINXTERM256);
-							if (i!=0)
+							if (i!=0) {
 								ts->ColorFlag |= CF_XTERM256;
-							else
+							}
+							else {
 								ts->ColorFlag &= ~(WORD)CF_XTERM256;
+							}
 							GetRB(Dialog,&ts->EnableScrollBuff,IDC_WINSCROLL1,IDC_WINSCROLL1);
 							if ( ts->EnableScrollBuff>0 ) {
 								ts->ScrollBuffSize =
@@ -960,75 +984,86 @@
 
 				case IDC_WINHIDETITLE:
 					GetRB(Dialog,&i,IDC_WINHIDETITLE,IDC_WINHIDETITLE);
-					if (i>0)
+					if (i>0) {
 						DisableDlgItem(Dialog,IDC_WINHIDEMENU,IDC_WINHIDEMENU);
-					else
+					}
+					else {
 						EnableDlgItem(Dialog,IDC_WINHIDEMENU,IDC_WINHIDEMENU);
+					}
 					break;
 
 				case IDC_WINSCROLL1:
-					if ( ts==NULL )
+					if ( ts==NULL ) {
 						return TRUE;
+					}
 					GetRB(Dialog,&i,IDC_WINSCROLL1,IDC_WINSCROLL1);
-					if ( i>0 )
+					if ( i>0 ) {
 						EnableDlgItem(Dialog,IDC_WINSCROLL2,IDC_WINSCROLL3);
-					else
+					}
+					else {
 						DisableDlgItem(Dialog,IDC_WINSCROLL2,IDC_WINSCROLL3);
+					}
 					break;
 
 				case IDC_WINTEXT:
-					if ( ts==NULL )
+					if ( ts==NULL ) {
 						return TRUE;
+					}
 					IOffset = 0;
 					ChangeSB(Dialog,ts,IAttr,IOffset);
 					break;
 
 				case IDC_WINBACK:
-					if ( ts==NULL )
+					if ( ts==NULL ) {
 						return TRUE;
+					}
 					IOffset = 3;
 					ChangeSB(Dialog,ts,IAttr,IOffset);
 					break;
 
 				case IDC_WINREV:
-				if ( ts==NULL )
-					return TRUE;
-				i = ts->TmpColor[IAttr][0];
-				ts->TmpColor[IAttr][0] = ts->TmpColor[IAttr][3];
-				ts->TmpColor[IAttr][3] = i;
-				i = ts->TmpColor[IAttr][1];
-				ts->TmpColor[IAttr][1] = ts->TmpColor[IAttr][4];
-				ts->TmpColor[IAttr][4] = i;
-				i = ts->TmpColor[IAttr][2];
-				ts->TmpColor[IAttr][2] = ts->TmpColor[IAttr][5];
-				ts->TmpColor[IAttr][5] = i;
+					if ( ts==NULL ) {
+						return TRUE;
+					}
+					i = ts->TmpColor[IAttr][0];
+					ts->TmpColor[IAttr][0] = ts->TmpColor[IAttr][3];
+					ts->TmpColor[IAttr][3] = i;
+					i = ts->TmpColor[IAttr][1];
+					ts->TmpColor[IAttr][1] = ts->TmpColor[IAttr][4];
+					ts->TmpColor[IAttr][4] = i;
+					i = ts->TmpColor[IAttr][2];
+					ts->TmpColor[IAttr][2] = ts->TmpColor[IAttr][5];
+					ts->TmpColor[IAttr][5] = i;
 
-				ChangeSB(Dialog,ts,IAttr,IOffset);
-				break;
+					ChangeSB(Dialog,ts,IAttr,IOffset);
+					break;
 
 				case IDC_WINATTR:
-				if ( ts!=NULL )
-					ChangeSB(Dialog,ts,IAttr,IOffset);
-				break;
+					if ( ts!=NULL ) {
+						ChangeSB(Dialog,ts,IAttr,IOffset);
+					}
+					break;
 
 				case IDC_WINHELP:
-				PostMessage(GetParent(Dialog),WM_USER_DLGHELP2,0,0);
-				break;
+					PostMessage(GetParent(Dialog),WM_USER_DLGHELP2,0,0);
+					break;
 			}
 			break;
 
 		case WM_PAINT:
 			ts = (PTTSet)GetWindowLong(Dialog,DWL_USER);
-			if ( ts==NULL )
+			if ( ts==NULL ) {
 				return TRUE;
+			}
 			RestoreVar(Dialog,ts,&IAttr,&IOffset);
 			DispSample(Dialog,ts,IAttr);
 			break;
 
 		case WM_HSCROLL:
 			ts = (PTTSet)GetWindowLong(Dialog,DWL_USER);
-			if (ts==NULL)
+			if (ts==NULL) {
 				return TRUE;
+			}
 			RestoreVar(Dialog,ts,&IAttr,&IOffset);
 			HRed = GetDlgItem(Dialog, IDC_WINREDBAR);
 			HGreen = GetDlgItem(Dialog, IDC_WINGREENBAR);
@@ -1036,33 +1071,43 @@
 			Wnd = (HWND)lParam;
 			ScrollCode = LOWORD(wParam);
 			NewPos = HIWORD(wParam);
-			if ( Wnd == HRed )
+			if ( Wnd == HRed ) {
 				i = IOffset;
-			else if ( Wnd == HGreen )
+			}
+			else if ( Wnd == HGreen ) {
 				i = IOffset + 1;
-			else if ( Wnd == HBlue )
+			}
+			else if ( Wnd == HBlue ) {
 				i = IOffset + 2;
-			else
+			}
+			else {
 				return TRUE;
+			}
 			pos = ts->TmpColor[IAttr][i];
 			switch (ScrollCode) {
 				case SB_BOTTOM:
 					pos = 255;
 					break;
 				case SB_LINEDOWN:
-					if (pos<255) pos++;
+					if (pos<255) {
+						pos++;
+					}
 					break;
 				case SB_LINEUP:
-					if (pos>0) pos--;
+					if (pos>0) {
+						pos--;
+					}
 					break;
 				case SB_PAGEDOWN:
 					pos += 16;
 					break;
 				case SB_PAGEUP:
-					if (pos < 16)
+					if (pos < 16) {
 						pos = 0;
-					else
+					}
+					else {
 						pos -= 16;
+					}
 					break;
 				case SB_THUMBPOSITION:
 					pos = NewPos;
@@ -1076,8 +1121,9 @@
 				default:
 					return TRUE;
 			}
-			if (pos > 255)
+			if (pos > 255) {
 				pos = 255;
+			}
 			ts->TmpColor[IAttr][i] = pos;
 			SetScrollPos(Wnd,SB_CTL,pos,TRUE);
 			ChangeColor(Dialog,ts,IAttr,IOffset);
@@ -1160,8 +1206,7 @@
 			SetRB(Dialog,ts->MetaKey,IDC_KEYBMETA,IDC_KEYBMETA);
 			SetRB(Dialog,ts->DisableAppKeypad,IDC_KEYBAPPKEY,IDC_KEYBAPPKEY);
 			SetRB(Dialog,ts->DisableAppCursor,IDC_KEYBAPPCUR,IDC_KEYBAPPCUR);
-			if (ts->Language==IdRussian)
-			{
+			if (ts->Language==IdRussian) {
 				ShowDlgItem(Dialog,IDC_KEYBKEYBTEXT,IDC_KEYBKEYB);
 				SetDropDownList(Dialog, IDC_KEYBKEYB, RussList2, ts->RussKeyb);
 			}
@@ -1171,8 +1216,7 @@
 			switch (LOWORD(wParam)) {
 				case IDOK:
 					ts = (PTTSet)GetWindowLong(Dialog,DWL_USER);
-					if ( ts!=NULL )
-					{
+					if ( ts!=NULL ) {
 						GetRB(Dialog,&ts->BSKey,IDC_KEYBBS,IDC_KEYBBS);
 						ts->BSKey++;
 						GetRB(Dialog,&ts->DelKey,IDC_KEYBDEL,IDC_KEYBDEL);
@@ -1322,8 +1366,9 @@
 					SendDlgItemMessage(Dialog, IDC_SERIALPORT, CB_ADDSTRING,
 					                   0, (LPARAM)Temp);
 				}
-				if (ts->ComPort<=ts->MaxComPort)
+				if (ts->ComPort<=ts->MaxComPort) {
 					w = ts->ComPort-1;
+				}
 
 			}
 			SendDlgItemMessage(Dialog, IDC_SERIALPORT, CB_SETCURSEL, w, 0);
@@ -1494,32 +1539,24 @@
 				_snprintf_s(EntName, sizeof(EntName), _TRUNCATE, "Host%d", i);
 				GetPrivateProfileString("Hosts",EntName,"",
 				                        TempHost,sizeof(TempHost),ts->SetupFName);
-				if (strlen(TempHost) > 0)
+				if (strlen(TempHost) > 0) {
 					SendDlgItemMessage(Dialog, IDC_TCPIPLIST, LB_ADDSTRING,
 					                   0, (LPARAM)TempHost);
+				}
 				i++;
 			} while ((i <= MAXHOSTLIST) && (strlen(TempHost)>0));
 
 			/* append a blank item to the bottom */
 			TempHost[0] = 0;
-			SendDlgItemMessage(Dialog, IDC_TCPIPLIST, LB_ADDSTRING,
-			                   0, (LPARAM)TempHost);
-
+			SendDlgItemMessage(Dialog, IDC_TCPIPLIST, LB_ADDSTRING, 0, (LPARAM)TempHost);
 			SetRB(Dialog,ts->HistoryList,IDC_TCPIPHISTORY,IDC_TCPIPHISTORY);
-
 			SetRB(Dialog,ts->AutoWinClose,IDC_TCPIPAUTOCLOSE,IDC_TCPIPAUTOCLOSE);
-
 			SetDlgItemInt(Dialog,IDC_TCPIPPORT,ts->TCPPort,FALSE);
-
 			SetDlgItemInt(Dialog,IDC_TCPIPTELNETKEEPALIVE,ts->TelKeepAliveInterval,FALSE);
-
 			SetRB(Dialog,ts->Telnet,IDC_TCPIPTELNET,IDC_TCPIPTELNET);
-
 			SetDlgItemText(Dialog, IDC_TCPIPTERMTYPE, ts->TermType);
+			SendDlgItemMessage(Dialog, IDC_TCPIPTERMTYPE, EM_LIMITTEXT, sizeof(ts->TermType)-1, 0);
 
-			SendDlgItemMessage(Dialog, IDC_TCPIPTERMTYPE, EM_LIMITTEXT,
-				 sizeof(ts->TermType)-1, 0);
-
 			// SSHÚ‘±‚Ì‚Æ‚«‚É‚à TERM ‚ð‘—‚é‚̂ŁAtelnet‚ª–³Œø‚Å‚à disabled ‚É‚µ‚È‚¢B(2005.11.3 yutaka)
 			EnableDlgItem(Dialog,IDC_TCPIPTERMTYPELABEL,IDC_TCPIPTERMTYPE);
 
@@ -1533,32 +1570,29 @@
 						WritePrivateProfileString("Hosts",NULL,NULL,ts->SetupFName);
 
 						Index = SendDlgItemMessage(Dialog,IDC_TCPIPLIST,LB_GETCOUNT,0,0);
-						if (Index==(UINT)LB_ERR)
+						if (Index==(UINT)LB_ERR) {
 							Index = 0;
-						else
+						}
+						else {
 							Index--;
-						if (Index>MAXHOSTLIST)
+						}
+						if (Index>MAXHOSTLIST) {
 							Index = MAXHOSTLIST;
-
+						}
 						for (i = 1 ; i <= Index ; i++) {
 							SendDlgItemMessage(Dialog, IDC_TCPIPLIST, LB_GETTEXT,
 							                   i-1, (LPARAM)TempHost);
 							_snprintf_s(EntName, sizeof(EntName), _TRUNCATE, "Host%i", i);
 							WritePrivateProfileString("Hosts",EntName,TempHost,ts->SetupFName);
 						}
-
 						GetRB(Dialog,&ts->HistoryList,IDC_TCPIPHISTORY,IDC_TCPIPHISTORY);
-
 						GetRB(Dialog,&ts->AutoWinClose,IDC_TCPIPAUTOCLOSE,IDC_TCPIPAUTOCLOSE);
-
 						ts->TCPPort = GetDlgItemInt(Dialog,IDC_TCPIPPORT,&Ok,FALSE);
-						if (! Ok)
+						if (! Ok) {
 							ts->TCPPort = ts->TelPort;
-
+						}
 						ts->TelKeepAliveInterval = GetDlgItemInt(Dialog,IDC_TCPIPTELNETKEEPALIVE,&Ok,FALSE);
-
 						GetRB(Dialog,&ts->Telnet,IDC_TCPIPTELNET,IDC_TCPIPTELNET);
-
 						GetDlgItemText(Dialog, IDC_TCPIPTERMTYPE, ts->TermType,
 						               sizeof(ts->TermType));
 					}
@@ -1578,10 +1612,12 @@
 				case IDC_TCPIPHOST:
 					if (HIWORD(wParam)==EN_CHANGE) {
 						GetDlgItemText(Dialog, IDC_TCPIPHOST, TempHost, sizeof(TempHost));
-						if (strlen(TempHost)==0)
+						if (strlen(TempHost)==0) {
 							DisableDlgItem(Dialog,IDC_TCPIPADD,IDC_TCPIPADD);
-						else
-						EnableDlgItem(Dialog,IDC_TCPIPADD,IDC_TCPIPADD);
+						}
+						else {
+							EnableDlgItem(Dialog,IDC_TCPIPADD,IDC_TCPIPADD);
+						}
 					}
 					break;
 
@@ -1589,8 +1625,9 @@
 					GetDlgItemText(Dialog, IDC_TCPIPHOST, TempHost, sizeof(TempHost));
 					if (strlen(TempHost)>0) {
 						Index = SendDlgItemMessage(Dialog,IDC_TCPIPLIST,LB_GETCURSEL,0,0);
-						if (Index==(UINT)LB_ERR)
+						if (Index==(UINT)LB_ERR) {
 							Index = 0;
+						}
 
 						SendDlgItemMessage(Dialog, IDC_TCPIPLIST, LB_INSERTSTRING,
 						                   Index, (LPARAM)TempHost);
@@ -1604,18 +1641,23 @@
 					if (HIWORD(wParam)==LBN_SELCHANGE) {
 						i = SendDlgItemMessage(Dialog,IDC_TCPIPLIST,LB_GETCOUNT,0,0);
 						Index = SendDlgItemMessage(Dialog, IDC_TCPIPLIST, LB_GETCURSEL, 0, 0);
-						if ((i<=1) || (Index==(UINT)LB_ERR) || (Index==i-1))
+						if ((i<=1) || (Index==(UINT)LB_ERR) || (Index==i-1)) {
 							DisableDlgItem(Dialog,IDC_TCPIPUP,IDC_TCPIPDOWN);
+						}
 						else {
 							EnableDlgItem(Dialog,IDC_TCPIPREMOVE,IDC_TCPIPREMOVE);
-							if (Index==0)
+							if (Index==0) {
 								DisableDlgItem(Dialog,IDC_TCPIPUP,IDC_TCPIPUP);
-						else
-							EnableDlgItem(Dialog,IDC_TCPIPUP,IDC_TCPIPUP);
-						if (Index>=i-2)
-							DisableDlgItem(Dialog,IDC_TCPIPDOWN,IDC_TCPIPDOWN);
-						else
-							EnableDlgItem(Dialog,IDC_TCPIPDOWN,IDC_TCPIPDOWN);
+							}
+							else {
+								EnableDlgItem(Dialog,IDC_TCPIPUP,IDC_TCPIPUP);
+							}
+							if (Index>=i-2) {
+								DisableDlgItem(Dialog,IDC_TCPIPDOWN,IDC_TCPIPDOWN);
+							}
+							else {
+								EnableDlgItem(Dialog,IDC_TCPIPDOWN,IDC_TCPIPDOWN);
+							}
 						}
 					}
 					break;
@@ -1624,29 +1666,37 @@
 				case IDC_TCPIPDOWN:
 					i = SendDlgItemMessage(Dialog,IDC_TCPIPLIST,LB_GETCOUNT,0,0);
 					Index = SendDlgItemMessage(Dialog, IDC_TCPIPLIST, LB_GETCURSEL, 0, 0);
-					if (Index==(UINT)LB_ERR)
+					if (Index==(UINT)LB_ERR) {
 						return TRUE;
-					if (LOWORD(wParam)==IDC_TCPIPDOWN)
+					}
+					if (LOWORD(wParam)==IDC_TCPIPDOWN) {
 						Index++;
-					if ((Index==0) || (Index>=i-1))
+					}
+					if ((Index==0) || (Index>=i-1)) {
 						return TRUE;
+					}
 					SendDlgItemMessage(Dialog, IDC_TCPIPLIST, LB_GETTEXT,
 					                   Index, (LPARAM)TempHost);
 					SendDlgItemMessage(Dialog, IDC_TCPIPLIST, LB_DELETESTRING,
 					                   Index, 0);
 					SendDlgItemMessage(Dialog, IDC_TCPIPLIST, LB_INSERTSTRING,
 					                   Index-1, (LPARAM)TempHost);
-					if (LOWORD(wParam)==IDC_TCPIPUP)
+					if (LOWORD(wParam)==IDC_TCPIPUP) {
 						Index--;
+					}
 					SendDlgItemMessage(Dialog, IDC_TCPIPLIST, LB_SETCURSEL,Index,0);
-					if (Index==0)
+					if (Index==0) {
 						DisableDlgItem(Dialog,IDC_TCPIPUP,IDC_TCPIPUP);
-					else
+					}
+					else {
 						EnableDlgItem(Dialog,IDC_TCPIPUP,IDC_TCPIPUP);
-					if (Index>=i-2)
+					}
+					if (Index>=i-2) {
 						DisableDlgItem(Dialog,IDC_TCPIPDOWN,IDC_TCPIPDOWN);
-					else
+					}
+					else {
 						EnableDlgItem(Dialog,IDC_TCPIPDOWN,IDC_TCPIPDOWN);
+					}
 					SetFocus(GetDlgItem(Dialog, IDC_TCPIPLIST));
 					break;
 
@@ -1654,8 +1704,9 @@
 					i = SendDlgItemMessage(Dialog,IDC_TCPIPLIST,LB_GETCOUNT,0,0);
 					Index = SendDlgItemMessage(Dialog,IDC_TCPIPLIST,LB_GETCURSEL, 0, 0);
 					if ((Index==(UINT)LB_ERR) ||
-					    (Index==i-1))
+						(Index==i-1)) {
 						return TRUE;
+					}
 					SendDlgItemMessage(Dialog, IDC_TCPIPLIST, LB_GETTEXT,
 					                   Index, (LPARAM)TempHost);
 					SendDlgItemMessage(Dialog, IDC_TCPIPLIST, LB_DELETESTRING,
@@ -1670,11 +1721,11 @@
 					if (w==1) {
 						EnableDlgItem(Dialog,IDC_TCPIPTERMTYPELABEL,IDC_TCPIPTERMTYPE);
 						ts = (PTTSet)GetWindowLong(Dialog,DWL_USER);
-						if (ts!=NULL)
+						if (ts!=NULL) {
 							SetDlgItemInt(Dialog,IDC_TCPIPPORT,ts->TelPort,FALSE);
+						}
 					}
-					else 
-					{
+					else {
 						// SSHÚ‘±‚Ì‚Æ‚«‚É‚à TERM ‚ð‘—‚é‚̂ŁAtelnet‚ª–³Œø‚Å‚à disabled ‚É‚µ‚È‚¢B(2005.11.3 yutaka)
 						EnableDlgItem(Dialog,IDC_TCPIPTERMTYPELABEL,IDC_TCPIPTERMTYPE);
 					}
@@ -1866,18 +1917,19 @@
 			get_lang_msg("BTN_HELP", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
 			SetDlgItemText(Dialog, IDC_HOSTHELP, uimsg);
 
-			if ( GetHNRec->PortType==IdFile )
+			if ( GetHNRec->PortType==IdFile ) {
 				GetHNRec->PortType = IdTCPIP;
+			}
 
-
 			i = 1;
 			do {
 				_snprintf_s(EntName, sizeof(EntName), _TRUNCATE, "Host%d", i);
 				GetPrivateProfileString("Hosts",EntName,"",
 				                        TempHost,sizeof(TempHost),GetHNRec->SetupFN);
-				if ( strlen(TempHost) > 0 )
+				if ( strlen(TempHost) > 0 ) {
 					SendDlgItemMessage(Dialog, IDC_HOSTNAME, CB_ADDSTRING,
 					                   0, (LPARAM)TempHost);
+				}
 				i++;
 			} while ((i <= MAXHOSTLIST) && (strlen(TempHost)>0));
 
@@ -1928,12 +1980,12 @@
 					SendDlgItemMessage(Dialog, IDC_HOSTCOM, CB_ADDSTRING,
 					                   0, (LPARAM)EntName);
 					j++;
-					if (GetHNRec->ComPort==ComPortTable[i])
+					if (GetHNRec->ComPort==ComPortTable[i]) {
 						w = j;
+					}
 				}
 			} else {
-				for (i=1; i<=GetHNRec->MaxComPort ;i++)
-				{
+				for (i=1; i<=GetHNRec->MaxComPort ;i++) {
 					// Žg—p’†‚̃|[ƒg‚Í•\Ž¦‚µ‚È‚¢
 					if (CheckCOMFlag(i) == 1) {
 						continue;
@@ -1942,12 +1994,14 @@
 					SendDlgItemMessage(Dialog, IDC_HOSTCOM, CB_ADDSTRING,
 					                   0, (LPARAM)EntName);
 					j++;
-					if (GetHNRec->ComPort==i)
+					if (GetHNRec->ComPort==i) {
 						w = j;
+					}
 				}
 			}
-			if (j>0)
+			if (j>0) {
 				SendDlgItemMessage(Dialog, IDC_HOSTCOM, CB_SETCURSEL,w-1,0);
+			}
 			else { /* All com ports are already used */
 				GetHNRec->PortType = IdTCPIP;
 				DisableDlgItem(Dialog,IDC_HOSTSERIAL,IDC_HOSTSERIAL);
@@ -1955,11 +2009,13 @@
 
 			SetRB(Dialog,GetHNRec->PortType,IDC_HOSTTCPIP,IDC_HOSTSERIAL);
 
-			if ( GetHNRec->PortType==IdTCPIP )
+			if ( GetHNRec->PortType==IdTCPIP ) {
 				DisableDlgItem(Dialog,IDC_HOSTCOMLABEL,IDC_HOSTCOM);
+			}
 #ifndef INET6
-			else
+			else {
 				DisableDlgItem(Dialog,IDC_HOSTNAMELABEL,IDC_HOSTTCPPORT);
+			}
 #else
 			else {
 				DisableDlgItem(Dialog,IDC_HOSTNAMELABEL,IDC_HOSTTCPPORT);
@@ -1978,13 +2034,17 @@
 						char afstr[BUFSIZ];
 #endif /* NO_INET6 */
 						GetRB(Dialog,&GetHNRec->PortType,IDC_HOSTTCPIP,IDC_HOSTSERIAL);
-						if ( GetHNRec->PortType==IdTCPIP )
+						if ( GetHNRec->PortType==IdTCPIP ) {
 							GetDlgItemText(Dialog, IDC_HOSTNAME, GetHNRec->HostName, HostNameMaxLength);
-						else
+						}
+						else {
 							GetHNRec->HostName[0] = 0;
+						}
 						GetRB(Dialog,&GetHNRec->Telnet,IDC_HOSTTELNET,IDC_HOSTTELNET);
 						i = GetDlgItemInt(Dialog,IDC_HOSTTCPPORT,&Ok,FALSE);
-						if (Ok) GetHNRec->TCPPort = i;
+						if (Ok) {
+							GetHNRec->TCPPort = i;
+						}
 #ifndef NO_INET6
 #define getaf(str) \
 	((strcmp((str), "IPv6") == 0) ? AF_INET6 : \
@@ -2003,8 +2063,9 @@
 #else
 							GetHNRec->ComPort = atoi(&EntName[3]);
 #endif
-							if (GetHNRec->ComPort > GetHNRec->MaxComPort)
+							if (GetHNRec->ComPort > GetHNRec->MaxComPort) {
 								GetHNRec->ComPort = 1;
+							}
 						}
 						else {
 							GetHNRec->ComPort = 1;
@@ -2043,11 +2104,11 @@
 
 				case IDC_HOSTTELNET:
 					GetRB(Dialog,&i,IDC_HOSTTELNET,IDC_HOSTTELNET);
-					if ( i==1 )
-					{
+					if ( i==1 ) {
 						GetHNRec = (PGetHNRec)GetWindowLong(Dialog,DWL_USER);
-						if ( GetHNRec!=NULL )
+						if ( GetHNRec!=NULL ) {
 							SetDlgItemInt(Dialog,IDC_HOSTTCPPORT,GetHNRec->TelPort,FALSE);
+						}
 					}
 					break;
 
@@ -2064,8 +2125,9 @@
 							lbl = (char *)calloc(len+1, sizeof(char));
 							SendMessage(hostcom, CB_GETLBTEXT, i, (LPARAM)lbl);
 							GetTextExtentPoint32(TmpDC, lbl, len, &s);
-							if (s.cx > max_len)
+							if (s.cx > max_len) {
 								max_len = s.cx;
+							}
 							free(lbl);
 						}
 						SendMessage(hostcom, CB_SETDROPPEDWIDTH,
@@ -2170,7 +2232,9 @@
 			WH = R.bottom-R.top;
 			GetClientRect(Dialog,&R);
 			CW = R.right-R.left;
-			if (D.x+DW < CW) DW = CW-D.x;
+			if (D.x+DW < CW) {
+				DW = CW-D.x;
+			}
 			WW = WW + D.x+DW - CW;
 
 			// resize current dir text
@@ -2186,7 +2250,9 @@
 			D.y = R.top;
 			ScreenToClient(Dialog,&D);
 			DW = R.right-R.left;
-			if (DW<s.cx) DW = s.cx;
+			if (DW<s.cx) {
+				DW = s.cx;
+			}
 			MoveWindow(HDir,D.x,D.y,DW,R.bottom-R.top,TRUE);
 			// select dir button
 			HSel = GetDlgItem(Dialog, IDC_SELECT_DIR);
@@ -2279,15 +2345,15 @@
 		goto error;
 	}
 
-	ret = VerQueryValue(buf,
-			"\\VarFileInfo\\Translation", 
-			(LPVOID *)&lplgcode, &unLen);
-	if (ret == FALSE)
+	ret = VerQueryValue(buf, "\\VarFileInfo\\Translation", 
+	                    (LPVOID *)&lplgcode, &unLen);
+	if (ret == FALSE) {
 		goto error;
+	}
 
 	for (i = 0 ; i < (int)(unLen / sizeof(LANGANDCODEPAGE)) ; i++) {
-		_snprintf_s(fmt, sizeof(fmt), _TRUNCATE, "\\StringFileInfo\\%04x%04x\\FileVersion", 
-			lplgcode[i].wLanguage, lplgcode[i].wCodePage);
+		_snprintf_s(fmt, sizeof(fmt), _TRUNCATE, "\\StringFileInfo\\%04x%04x\\FileVersion",
+		            lplgcode[i].wLanguage, lplgcode[i].wCodePage);
 		VerQueryValue(buf, fmt, &pbuf, &unLen);
 		if (unLen > 0) { // get success
 			int n, a, b, c, d;
@@ -2340,49 +2406,49 @@
 #if 0
 	case WM_SETCURSOR:
 		{
-		// ƒJ[ƒ\ƒ‹Œ`ó•ÏX
-		HCURSOR hc;
+			// ƒJ[ƒ\ƒ‹Œ`ó•ÏX
+			HCURSOR hc;
 
-		hc = (HCURSOR)LoadImage(NULL,
-				MAKEINTRESOURCE(IDC_HAND),
-				IMAGE_CURSOR,
-				0,
-				0,
-				LR_DEFAULTSIZE | LR_SHARED);
-		if (hc != NULL) {
-			SetClassLongPtr(hWnd, GCLP_HCURSOR, (LONG_PTR)hc);
+			hc = (HCURSOR)LoadImage(NULL,
+					MAKEINTRESOURCE(IDC_HAND),
+					IMAGE_CURSOR,
+					0,
+					0,
+					LR_DEFAULTSIZE | LR_SHARED);
+			if (hc != NULL) {
+				SetClassLongPtr(hWnd, GCLP_HCURSOR, (LONG_PTR)hc);
+			}
+			return (LRESULT)0;
 		}
-		return (LRESULT)0;
-		}
 #endif
 
 	case WM_LBUTTONDBLCLK:
 		{
-		char url[128];
+			char url[128];
 
-		// get URL
-		SendMessage(hWnd, WM_GETTEXT , sizeof(url), (LPARAM)url);
-		// kick WWW browser
-	    ShellExecute(NULL, NULL, url, NULL, NULL,SW_SHOWNORMAL);
+			// get URL
+			SendMessage(hWnd, WM_GETTEXT , sizeof(url), (LPARAM)url);
+			// kick WWW browser
+			ShellExecute(NULL, NULL, url, NULL, NULL,SW_SHOWNORMAL);
 		}
 		break;
 
 	case WM_MOUSEMOVE:
 		{
-		BOOL bHilighted;
-		pt.x = LOWORD( lParam );
-		pt.y = HIWORD( lParam );
-		GetClientRect( hWnd, &rc );
-		bHilighted = PtInRect( &rc, pt );
+			BOOL bHilighted;
+			pt.x = LOWORD( lParam );
+			pt.y = HIWORD( lParam );
+			GetClientRect( hWnd, &rc );
+			bHilighted = PtInRect( &rc, pt );
 
-		if (parent->mouseover != bHilighted) {
-			parent->mouseover = bHilighted;
-			InvalidateRect( hWnd, NULL, TRUE );
-			if (parent->timer_done == 0) {
-				parent->timer_done = 1;
-				SetTimer( hWnd, 1, 200, NULL );
+			if (parent->mouseover != bHilighted) {
+				parent->mouseover = bHilighted;
+				InvalidateRect( hWnd, NULL, TRUE );
+				if (parent->timer_done == 0) {
+					parent->timer_done = 1;
+					SetTimer( hWnd, 1, 200, NULL );
+				}
 			}
-		}
 
 		}
 		break;
@@ -2393,12 +2459,9 @@
 			HCURSOR hc;
 			//SetCapture(hWnd);
 
-			hc = (HCURSOR)LoadImage(NULL,
-					MAKEINTRESOURCE(IDC_HAND),
-					IMAGE_CURSOR,
-					0,
-					0,
-					LR_DEFAULTSIZE | LR_SHARED);
+			hc = (HCURSOR)LoadImage(NULL, MAKEINTRESOURCE(IDC_HAND),
+			                        IMAGE_CURSOR, 0, 0,
+			                        LR_DEFAULTSIZE | LR_SHARED);
 
 			SetSystemCursor(CopyCursor(hc), 32512 /* OCR_NORMAL */);    // –îˆó
 			SetSystemCursor(CopyCursor(hc), 32513 /* OCR_IBEAM */);     // Iƒr[ƒ€
@@ -2414,8 +2477,9 @@
 		GetCursorPos( &pt );
 		ScreenToClient( hWnd, &pt );
 		GetClientRect( hWnd, &rc );
-		if( !PtInRect( &rc, pt ) )
+		if( !PtInRect( &rc, pt ) ) {
 			SendMessage( hWnd, WM_MOUSEMOVE, 0, MAKELONG( pt.x, pt.y ) );
+		}
 		break;
 
 	case WM_PAINT: 
@@ -2471,8 +2535,9 @@
 	case WM_DESTROY:
 		// ŒãŽn––
 		SetWindowLongPtr( hWnd, GWLP_WNDPROC, (LONG_PTR)parent->proc );
-		if( parent->font != NULL )
+		if( parent->font != NULL ) {
 			DeleteObject( parent->font );
+		}
 
 		// ƒ}ƒEƒXƒJ[ƒ\ƒ‹‚ðŒ³‚É–ß‚·B
 		SystemParametersInfo(SPI_SETCURSORS, 0, NULL, 0);
@@ -2491,8 +2556,9 @@
 
 	//SetCapture(hWnd);
 
-	if (!IsWindow(hWnd))
+	if (!IsWindow(hWnd)) {
 		return;
+	}
 
 	// e‚̃vƒƒV[ƒWƒƒ‚ðƒTƒuƒNƒ‰ƒX‚©‚çŽQÆ‚Å‚«‚é‚悤‚ɁAƒ|ƒCƒ“ƒ^‚ð“o˜^‚µ‚Ä‚¨‚­B
 	lptr = SetWindowLongPtr( hWnd, GWLP_USERDATA, (LONG_PTR)parent );
@@ -2504,8 +2570,9 @@
 	GetObject( hFont, sizeof(lf), &lf );
 	lf.lfUnderline = TRUE;
 	parent->font = hFont = CreateFontIndirect( &lf ); // •s—v‚É‚È‚Á‚½‚çíœ‚·‚邱‚Æ
-	if (hFont != NULL)
+	if (hFont != NULL) {
 		SendMessage( hWnd, WM_SETFONT, (WPARAM)hFont, (LPARAM)FALSE );
+	}
 
 	parent->hWnd = hWnd;
 	parent->timer_done = 0;
@@ -2527,141 +2594,141 @@
 	HFONT font;
 
 	switch (Message) {
-	case WM_INITDIALOG:
+		case WM_INITDIALOG:
 
-		font = (HFONT)SendMessage(Dialog, WM_GETFONT, 0, 0);
-		GetObject(font, sizeof(LOGFONT), &logfont);
-		if (get_lang_font("DLG_SYSTEM_FONT", Dialog, &logfont, &DlgAboutFont, UILanguageFile)) {
-			SendDlgItemMessage(Dialog, IDC_TT_PRO, WM_SETFONT, (WPARAM)DlgAboutFont, MAKELPARAM(TRUE,0));
-			SendDlgItemMessage(Dialog, IDC_TT_VERSION, WM_SETFONT, (WPARAM)DlgAboutFont, MAKELPARAM(TRUE,0));
-			SendDlgItemMessage(Dialog, IDC_INLUCDE_LABEL, WM_SETFONT, (WPARAM)DlgAboutFont, MAKELPARAM(TRUE,0));
-			SendDlgItemMessage(Dialog, IDC_ONIGURUMA_LABEL, WM_SETFONT, (WPARAM)DlgAboutFont, MAKELPARAM(TRUE,0));
-			SendDlgItemMessage(Dialog, IDC_TT23_LABEL, WM_SETFONT, (WPARAM)DlgAboutFont, MAKELPARAM(TRUE,0));
-			SendDlgItemMessage(Dialog, IDC_TT23DATE_LABEL, WM_SETFONT, (WPARAM)DlgAboutFont, MAKELPARAM(TRUE,0));
-			SendDlgItemMessage(Dialog, IDC_TERANISHI_LABEL, WM_SETFONT, (WPARAM)DlgAboutFont, MAKELPARAM(TRUE,0));
-			SendDlgItemMessage(Dialog, IDC_PROJECT_LABEL, WM_SETFONT, (WPARAM)DlgAboutFont, MAKELPARAM(TRUE,0));
-			SendDlgItemMessage(Dialog, IDC_RIGHTS_LABEL, WM_SETFONT, (WPARAM)DlgAboutFont, MAKELPARAM(TRUE,0));
-			SendDlgItemMessage(Dialog, IDC_AUTHOR_LABEL, WM_SETFONT, (WPARAM)DlgAboutFont, MAKELPARAM(TRUE,0));
-			SendDlgItemMessage(Dialog, IDC_AUTHOR_URL, WM_SETFONT, (WPARAM)DlgAboutFont, MAKELPARAM(TRUE,0));
-			SendDlgItemMessage(Dialog, IDC_FORUM_LABEL, WM_SETFONT, (WPARAM)DlgAboutFont, MAKELPARAM(TRUE,0));
-			SendDlgItemMessage(Dialog, IDC_FORUM_URL, WM_SETFONT, (WPARAM)DlgAboutFont, MAKELPARAM(TRUE,0));
-			SendDlgItemMessage(Dialog, IDC_BUILDTIME, WM_SETFONT, (WPARAM)DlgAboutFont, MAKELPARAM(TRUE,0));
-			SendDlgItemMessage(Dialog, IDC_BUILDTOOL, WM_SETFONT, (WPARAM)DlgAboutFont, MAKELPARAM(TRUE,0));
-			SendDlgItemMessage(Dialog, IDOK, WM_SETFONT, (WPARAM)DlgAboutFont, MAKELPARAM(TRUE,0));
-		}
-		else {
-			DlgAboutFont = NULL;
-		}
+			font = (HFONT)SendMessage(Dialog, WM_GETFONT, 0, 0);
+			GetObject(font, sizeof(LOGFONT), &logfont);
+			if (get_lang_font("DLG_SYSTEM_FONT", Dialog, &logfont, &DlgAboutFont, UILanguageFile)) {
+				SendDlgItemMessage(Dialog, IDC_TT_PRO, WM_SETFONT, (WPARAM)DlgAboutFont, MAKELPARAM(TRUE,0));
+				SendDlgItemMessage(Dialog, IDC_TT_VERSION, WM_SETFONT, (WPARAM)DlgAboutFont, MAKELPARAM(TRUE,0));
+				SendDlgItemMessage(Dialog, IDC_INLUCDE_LABEL, WM_SETFONT, (WPARAM)DlgAboutFont, MAKELPARAM(TRUE,0));
+				SendDlgItemMessage(Dialog, IDC_ONIGURUMA_LABEL, WM_SETFONT, (WPARAM)DlgAboutFont, MAKELPARAM(TRUE,0));
+				SendDlgItemMessage(Dialog, IDC_TT23_LABEL, WM_SETFONT, (WPARAM)DlgAboutFont, MAKELPARAM(TRUE,0));
+				SendDlgItemMessage(Dialog, IDC_TT23DATE_LABEL, WM_SETFONT, (WPARAM)DlgAboutFont, MAKELPARAM(TRUE,0));
+				SendDlgItemMessage(Dialog, IDC_TERANISHI_LABEL, WM_SETFONT, (WPARAM)DlgAboutFont, MAKELPARAM(TRUE,0));
+				SendDlgItemMessage(Dialog, IDC_PROJECT_LABEL, WM_SETFONT, (WPARAM)DlgAboutFont, MAKELPARAM(TRUE,0));
+				SendDlgItemMessage(Dialog, IDC_RIGHTS_LABEL, WM_SETFONT, (WPARAM)DlgAboutFont, MAKELPARAM(TRUE,0));
+				SendDlgItemMessage(Dialog, IDC_AUTHOR_LABEL, WM_SETFONT, (WPARAM)DlgAboutFont, MAKELPARAM(TRUE,0));
+				SendDlgItemMessage(Dialog, IDC_AUTHOR_URL, WM_SETFONT, (WPARAM)DlgAboutFont, MAKELPARAM(TRUE,0));
+				SendDlgItemMessage(Dialog, IDC_FORUM_LABEL, WM_SETFONT, (WPARAM)DlgAboutFont, MAKELPARAM(TRUE,0));
+				SendDlgItemMessage(Dialog, IDC_FORUM_URL, WM_SETFONT, (WPARAM)DlgAboutFont, MAKELPARAM(TRUE,0));
+				SendDlgItemMessage(Dialog, IDC_BUILDTIME, WM_SETFONT, (WPARAM)DlgAboutFont, MAKELPARAM(TRUE,0));
+				SendDlgItemMessage(Dialog, IDC_BUILDTOOL, WM_SETFONT, (WPARAM)DlgAboutFont, MAKELPARAM(TRUE,0));
+				SendDlgItemMessage(Dialog, IDOK, WM_SETFONT, (WPARAM)DlgAboutFont, MAKELPARAM(TRUE,0));
+			}
+			else {
+				DlgAboutFont = NULL;
+			}
 
-		// ƒAƒCƒRƒ“‚ð“®“I‚ɃZƒbƒg
-		{
-			int fuLoad = LR_DEFAULTCOLOR;
-			HICON hicon;
+			// ƒAƒCƒRƒ“‚ð“®“I‚ɃZƒbƒg
+			{
+				int fuLoad = LR_DEFAULTCOLOR;
+				HICON hicon;
 
-			if (is_NT4()) {
-				fuLoad = LR_VGACOLOR;
+				if (is_NT4()) {
+					fuLoad = LR_VGACOLOR;
+				}
+
+				hicon = LoadImage(hInst, MAKEINTRESOURCE(IDI_TTERM),
+								  IMAGE_ICON, 32, 32, fuLoad);
+				SendDlgItemMessage(Dialog, IDC_TT_ICON, STM_SETICON, (WPARAM)hicon, 0);
 			}
 
-			hicon = LoadImage(hInst, MAKEINTRESOURCE(IDI_TTERM),
-			                  IMAGE_ICON, 32, 32, fuLoad);
-			SendDlgItemMessage(Dialog, IDC_TT_ICON, STM_SETICON, (WPARAM)hicon, 0);
-		}
+			GetWindowText(Dialog, uimsg2, sizeof(uimsg2));
+			get_lang_msg("DLG_ABOUT_TITLE", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
+			SetWindowText(Dialog, uimsg);
 
-		GetWindowText(Dialog, uimsg2, sizeof(uimsg2));
-		get_lang_msg("DLG_ABOUT_TITLE", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-		SetWindowText(Dialog, uimsg);
-
-		// Tera Term‚̃o[ƒWƒ‡ƒ“‚ðÝ’è‚·‚é (2005.2.28 yutaka)
-		// __argv[0]‚Å‚Í WinExec() ‚µ‚½ƒvƒƒZƒX‚©‚çŽQÆ‚Å‚«‚È‚¢‚悤‚Ȃ̂ō폜B(2005.3.14 yutaka)
-		get_file_version("ttermpro.exe", &a, &b, &c, &d);
-		_snprintf_s(buf, sizeof(buf), _TRUNCATE, "Version %d.%d", a, b);
+			// Tera Term‚̃o[ƒWƒ‡ƒ“‚ðÝ’è‚·‚é (2005.2.28 yutaka)
+			// __argv[0]‚Å‚Í WinExec() ‚µ‚½ƒvƒƒZƒX‚©‚çŽQÆ‚Å‚«‚È‚¢‚悤‚Ȃ̂ō폜B(2005.3.14 yutaka)
+			get_file_version("ttermpro.exe", &a, &b, &c, &d);
+			_snprintf_s(buf, sizeof(buf), _TRUNCATE, "Version %d.%d", a, b);
 #ifdef SVNVERSION
-		_snprintf_s(tmpbuf, sizeof(tmpbuf), _TRUNCATE, " (SVN# %d)", SVNVERSION);
-		strncat_s(buf, sizeof(buf), tmpbuf, _TRUNCATE);
+			_snprintf_s(tmpbuf, sizeof(tmpbuf), _TRUNCATE, " (SVN# %d)", SVNVERSION);
+			strncat_s(buf, sizeof(buf), tmpbuf, _TRUNCATE);
 #endif
-		SendMessage(GetDlgItem(Dialog, IDC_TT_VERSION), WM_SETTEXT, 0, (LPARAM)buf);
+			SendMessage(GetDlgItem(Dialog, IDC_TT_VERSION), WM_SETTEXT, 0, (LPARAM)buf);
 
-		// Oniguruma‚̃o[ƒWƒ‡ƒ“‚ðÝ’è‚·‚é 
-		// ƒo[ƒWƒ‡ƒ“‚̎擾‚Í onig_version() ‚ðŒÄ‚яo‚·‚Ì‚ª“KØ‚¾‚ªA‚»‚Ì‚½‚ß‚¾‚¯‚Ƀ‰ƒCƒuƒ‰ƒŠ‚ð
-		// ƒŠƒ“ƒN‚µ‚½‚­‚È‚©‚Á‚½‚̂ŁAˆÈ‰º‚̂悤‚É‚µ‚½BOniguruma‚̃o[ƒWƒ‡ƒ“‚ªã‚ª‚Á‚½ê‡A
-		// ƒrƒ‹ƒhƒGƒ‰[‚Æ‚È‚é‚©‚à‚µ‚ê‚È‚¢B
-		// (2005.10.8 yutaka)
-		// ƒ‰ƒCƒuƒ‰ƒŠ‚ðƒŠƒ“ƒN‚µA³‹K‚̎菇‚Ńo[ƒWƒ‡ƒ“‚𓾂邱‚Æ‚É‚µ‚½B
-		// (2006.7.24 yutaka)
-		_snprintf_s(buf, sizeof(buf), _TRUNCATE, "Oniguruma %s", onig_version());
-		SendMessage(GetDlgItem(Dialog, IDC_ONIGURUMA_LABEL), WM_SETTEXT, 0, (LPARAM)buf);
+			// Oniguruma‚̃o[ƒWƒ‡ƒ“‚ðÝ’è‚·‚é 
+			// ƒo[ƒWƒ‡ƒ“‚̎擾‚Í onig_version() ‚ðŒÄ‚яo‚·‚Ì‚ª“KØ‚¾‚ªA‚»‚Ì‚½‚ß‚¾‚¯‚Ƀ‰ƒCƒuƒ‰ƒŠ‚ð
+			// ƒŠƒ“ƒN‚µ‚½‚­‚È‚©‚Á‚½‚̂ŁAˆÈ‰º‚̂悤‚É‚µ‚½BOniguruma‚̃o[ƒWƒ‡ƒ“‚ªã‚ª‚Á‚½ê‡A
+			// ƒrƒ‹ƒhƒGƒ‰[‚Æ‚È‚é‚©‚à‚µ‚ê‚È‚¢B
+			// (2005.10.8 yutaka)
+			// ƒ‰ƒCƒuƒ‰ƒŠ‚ðƒŠƒ“ƒN‚µA³‹K‚̎菇‚Ńo[ƒWƒ‡ƒ“‚𓾂邱‚Æ‚É‚µ‚½B
+			// (2006.7.24 yutaka)
+			_snprintf_s(buf, sizeof(buf), _TRUNCATE, "Oniguruma %s", onig_version());
+			SendMessage(GetDlgItem(Dialog, IDC_ONIGURUMA_LABEL), WM_SETTEXT, 0, (LPARAM)buf);
 
-		// ƒrƒ‹ƒh‚µ‚½‚Æ‚«‚ÉŽg‚í‚ꂽVisual C++‚̃o[ƒWƒ‡ƒ“‚ðÝ’è‚·‚éB(2009.3.3 yutaka)
-		_snprintf_s(buf, sizeof(buf), _TRUNCATE, "Built using Microsoft Visual C++");
+			// ƒrƒ‹ƒh‚µ‚½‚Æ‚«‚ÉŽg‚í‚ꂽVisual C++‚̃o[ƒWƒ‡ƒ“‚ðÝ’è‚·‚éB(2009.3.3 yutaka)
+			_snprintf_s(buf, sizeof(buf), _TRUNCATE, "Built using Microsoft Visual C++");
 #ifdef _MSC_FULL_VER
-		_snprintf_s(tmpbuf, sizeof(tmpbuf), _TRUNCATE, " %d.%d",
-			(_MSC_FULL_VER / 10000000) - 6,
-			(_MSC_FULL_VER / 100000) % 100);
-		strncat_s(buf, sizeof(buf), tmpbuf, _TRUNCATE);
-		if (_MSC_FULL_VER % 100000) {
-			_snprintf_s(tmpbuf, sizeof(tmpbuf), _TRUNCATE, " build %d",
-				_MSC_FULL_VER % 100000);
+			_snprintf_s(tmpbuf, sizeof(tmpbuf), _TRUNCATE, " %d.%d",
+				(_MSC_FULL_VER / 10000000) - 6,
+				(_MSC_FULL_VER / 100000) % 100);
 			strncat_s(buf, sizeof(buf), tmpbuf, _TRUNCATE);
-		}
+			if (_MSC_FULL_VER % 100000) {
+				_snprintf_s(tmpbuf, sizeof(tmpbuf), _TRUNCATE, " build %d",
+					_MSC_FULL_VER % 100000);
+				strncat_s(buf, sizeof(buf), tmpbuf, _TRUNCATE);
+			}
 #elif defined(_MSC_VER)
-		_snprintf_s(tmpbuf, sizeof(tmpbuf), _TRUNCATE, " %d.%d",
-			(_MSC_VER / 100) - 6,
-			_MSC_VER % 100);
-		strncat_s(buf, sizeof(buf), tmpbuf, _TRUNCATE);
+			_snprintf_s(tmpbuf, sizeof(tmpbuf), _TRUNCATE, " %d.%d",
+				(_MSC_VER / 100) - 6,
+				_MSC_VER % 100);
+			strncat_s(buf, sizeof(buf), tmpbuf, _TRUNCATE);
 #endif
-		SendMessage(GetDlgItem(Dialog, IDC_BUILDTOOL), WM_SETTEXT, 0, (LPARAM)buf);
+			SendMessage(GetDlgItem(Dialog, IDC_BUILDTOOL), WM_SETTEXT, 0, (LPARAM)buf);
 
-		// ƒrƒ‹ƒhƒ^ƒCƒ€‚ðÝ’è‚·‚éB(2009.3.4 yutaka)
-		_snprintf_s(buf, sizeof(buf), _TRUNCATE, "Build time: %s %s", __DATE__, __TIME__);
-		SendMessage(GetDlgItem(Dialog, IDC_BUILDTIME), WM_SETTEXT, 0, (LPARAM)buf);
+			// ƒrƒ‹ƒhƒ^ƒCƒ€‚ðÝ’è‚·‚éB(2009.3.4 yutaka)
+			_snprintf_s(buf, sizeof(buf), _TRUNCATE, "Build time: %s %s", __DATE__, __TIME__);
+			SendMessage(GetDlgItem(Dialog, IDC_BUILDTIME), WM_SETTEXT, 0, (LPARAM)buf);
 
-		// static text ‚̃TƒCƒY‚ð•ÏX (2007.4.16 maya)
-		hwnd = GetDlgItem(Dialog, IDC_AUTHOR_URL);
-		hdc = GetDC(hwnd);
-		SelectObject(hdc, DlgAboutFont);
-		GetDlgItemText(Dialog, IDC_AUTHOR_URL, uimsg, sizeof(uimsg));
-		dwExt = GetTabbedTextExtent(hdc,uimsg,strlen(uimsg),0,NULL);
-		w = LOWORD(dwExt) + 5; // •‚ªŽáŠ±‘«‚è‚È‚¢‚̂ŕ␳
-		h = HIWORD(dwExt);
-		GetWindowRect(hwnd, &r);
-		point.x = r.left;
-		point.y = r.top;
-		ScreenToClient(Dialog, &point);
-		MoveWindow(hwnd, point.x, point.y, w, h, TRUE);
+			// static text ‚̃TƒCƒY‚ð•ÏX (2007.4.16 maya)
+			hwnd = GetDlgItem(Dialog, IDC_AUTHOR_URL);
+			hdc = GetDC(hwnd);
+			SelectObject(hdc, DlgAboutFont);
+			GetDlgItemText(Dialog, IDC_AUTHOR_URL, uimsg, sizeof(uimsg));
+			dwExt = GetTabbedTextExtent(hdc,uimsg,strlen(uimsg),0,NULL);
+			w = LOWORD(dwExt) + 5; // •‚ªŽáŠ±‘«‚è‚È‚¢‚̂ŕ␳
+			h = HIWORD(dwExt);
+			GetWindowRect(hwnd, &r);
+			point.x = r.left;
+			point.y = r.top;
+			ScreenToClient(Dialog, &point);
+			MoveWindow(hwnd, point.x, point.y, w, h, TRUE);
 
-		hwnd = GetDlgItem(Dialog, IDC_FORUM_URL);
-		hdc = GetDC(hwnd);
-		SelectObject(hdc, DlgAboutFont);
-		GetDlgItemText(Dialog, IDC_FORUM_URL, uimsg, sizeof(uimsg));
-		dwExt = GetTabbedTextExtent(hdc,uimsg,strlen(uimsg),0,NULL);
-		w = LOWORD(dwExt) + 5; // •‚ªŽáŠ±‘«‚è‚È‚¢‚̂ŕ␳
-		h = HIWORD(dwExt);
-		GetWindowRect(hwnd, &r);
-		point.x = r.left;
-		point.y = r.top;
-		ScreenToClient(Dialog, &point);
-		MoveWindow(hwnd, point.x, point.y, w, h, TRUE);
+			hwnd = GetDlgItem(Dialog, IDC_FORUM_URL);
+			hdc = GetDC(hwnd);
+			SelectObject(hdc, DlgAboutFont);
+			GetDlgItemText(Dialog, IDC_FORUM_URL, uimsg, sizeof(uimsg));
+			dwExt = GetTabbedTextExtent(hdc,uimsg,strlen(uimsg),0,NULL);
+			w = LOWORD(dwExt) + 5; // •‚ªŽáŠ±‘«‚è‚È‚¢‚̂ŕ␳
+			h = HIWORD(dwExt);
+			GetWindowRect(hwnd, &r);
+			point.x = r.left;
+			point.y = r.top;
+			ScreenToClient(Dialog, &point);
+			MoveWindow(hwnd, point.x, point.y, w, h, TRUE);
 
-		// static text‚ðƒTƒuƒNƒ‰ƒX‰»‚·‚éB‚½‚¾‚µAtabstop, notifyƒvƒƒpƒeƒB‚ð—LŒø‚É‚µ‚Ä‚¨‚©‚È‚¢‚Æ
-		// ƒƒbƒZ[ƒW‚ªE‚¦‚È‚¢B(2005.4.5 yutaka)
-		do_subclass_window(GetDlgItem(Dialog, IDC_AUTHOR_URL), &author_url_class);
-		do_subclass_window(GetDlgItem(Dialog, IDC_FORUM_URL), &forum_url_class);
-		return TRUE;
-
-	case WM_COMMAND:
-		switch (LOWORD(wParam)) {
-		case IDOK:
-			EndDialog(Dialog, 1);
+			// static text‚ðƒTƒuƒNƒ‰ƒX‰»‚·‚éB‚½‚¾‚µAtabstop, notifyƒvƒƒpƒeƒB‚ð—LŒø‚É‚µ‚Ä‚¨‚©‚È‚¢‚Æ
+			// ƒƒbƒZ[ƒW‚ªE‚¦‚È‚¢B(2005.4.5 yutaka)
+			do_subclass_window(GetDlgItem(Dialog, IDC_AUTHOR_URL), &author_url_class);
+			do_subclass_window(GetDlgItem(Dialog, IDC_FORUM_URL), &forum_url_class);
 			return TRUE;
 
-		case IDCANCEL:
-			EndDialog(Dialog, 0);
-			return TRUE;
-		}
-		if (DlgAboutFont != NULL) {
-			DeleteObject(DlgAboutFont);
-		}
-		break;
+		case WM_COMMAND:
+			switch (LOWORD(wParam)) {
+				case IDOK:
+					EndDialog(Dialog, 1);
+					return TRUE;
+
+				case IDCANCEL:
+					EndDialog(Dialog, 0);
+					return TRUE;
+			}
+			if (DlgAboutFont != NULL) {
+				DeleteObject(DlgAboutFont);
+			}
+			break;
 	}
 	return FALSE;
 }
@@ -2717,20 +2784,23 @@
 			SetDlgItemText(Dialog, IDC_GENHELP, uimsg);
 
 			SendDlgItemMessage(Dialog, IDC_GENPORT, CB_ADDSTRING,
-							   0, (LPARAM)"TCP/IP");
+			                   0, (LPARAM)"TCP/IP");
 			for (w=1;w<=ts->MaxComPort;w++) {
 				_snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "COM%d", w);
 				SendDlgItemMessage(Dialog, IDC_GENPORT, CB_ADDSTRING,
-								   0, (LPARAM)Temp);
+				                   0, (LPARAM)Temp);
 			}
 			if (ts->PortType==IdSerial) {
-				if (ts->ComPort <= ts->MaxComPort)
+				if (ts->ComPort <= ts->MaxComPort) {
 					w = ts->ComPort;
-				else
+				}
+				else {
 					w = 1; // COM1
+				}
 			}
-			else
+			else {
 				w = 0; // TCP/IP
+			}
 			SendDlgItemMessage(Dialog, IDC_GENPORT, CB_SETCURSEL,w,0);
 
 			if ((ts->MenuFlag & MF_NOLANGUAGE)==0) {
@@ -2749,10 +2819,12 @@
 							ts->PortType = IdSerial;
 							ts->ComPort = w-1;
 						}
-						else
+						else {
 							ts->PortType = IdTCPIP;
-						if ((ts->MenuFlag & MF_NOLANGUAGE)==0)
+						}
+						if ((ts->MenuFlag & MF_NOLANGUAGE)==0) {
 							ts->Language = (WORD)GetCurSel(Dialog, IDC_GENLANG);
+						}
 					}
 
 					// TTXKanjiMenu ‚Ì‚½‚߂ɁAOK ‰Ÿ‰ºŽž‚Ƀƒjƒ…[Ä•`‰æ‚Ì
@@ -2834,8 +2906,9 @@
 				case IDOK:
 					n = SendDlgItemMessage(Dialog,IDC_WINLISTLIST,
 					LB_GETCURSEL, 0, 0);
-					if (n!=CB_ERR)
+					if (n!=CB_ERR) {
 						SelectWin(n);
+					}
 					EndDialog(Dialog, 1);
 					if (DlgWinlistFont != NULL) {
 						DeleteObject(DlgWinlistFont);
@@ -2850,15 +2923,17 @@
 					return TRUE;
 
 				case IDC_WINLISTLIST:
-					if (HIWORD(wParam)==LBN_DBLCLK)
+					if (HIWORD(wParam)==LBN_DBLCLK) {
 						PostMessage(Dialog,WM_COMMAND,IDOK,0);
+					}
 					break;
 
 				case IDC_WINLISTCLOSE:
 					n = SendDlgItemMessage(Dialog,IDC_WINLISTLIST,
 					LB_GETCURSEL, 0, 0);
-					if (n==CB_ERR)
+					if (n==CB_ERR) {
 						break;
+					}
 					Hw = GetNthWin(n);
 					if (Hw!=GetParent(Dialog)) {
 						if (! IsWindowEnabled(Hw)) {
@@ -2874,8 +2949,9 @@
 					}
 					else {
 						Close = (PBOOL)GetWindowLong(Dialog,DWL_USER);
-						if (Close!=NULL)
+						if (Close!=NULL) {
 							*Close = TRUE;
+						}
 						EndDialog(Dialog, 1);
 						if (DlgWinlistFont != NULL) {
 							DeleteObject(DlgWinlistFont);



Ttssh2-commit メーリングリストの案内