[ttssh2-commit] [9942] ウィンドウの設定ダイアログにフレームを表示しない設定を追加

Back to archive index
scmno****@osdn***** scmno****@osdn*****
2022年 5月 21日 (土) 22:56:07 JST


Revision: 9942
          https://osdn.net/projects/ttssh2/scm/svn/commits/9942
Author:   zmatsuo
Date:     2022-05-21 22:56:07 +0900 (Sat, 21 May 2022)
Log Message:
-----------
ウィンドウの設定ダイアログにフレームを表示しない設定を追加

- [Setting]/[Windows...]
- フレームを表示しない設定をできるようにした
  - タイトルバーを隠したとき設定できる
  - IDC_NO_FRAME
- 色設定(カラー)のサンプル文字表示をコントロールで位置を指定するようにした
  - IDC_DRAW_SAMPLE_AREA

Modified Paths:
--------------
    trunk/teraterm/ttpdlg/dlg_res.h
    trunk/teraterm/ttpdlg/ttdlg.c
    trunk/teraterm/ttpdlg/ttpdlg.rc

-------------- next part --------------
Modified: trunk/teraterm/ttpdlg/dlg_res.h
===================================================================
--- trunk/teraterm/ttpdlg/dlg_res.h	2022-05-21 13:55:57 UTC (rev 9941)
+++ trunk/teraterm/ttpdlg/dlg_res.h	2022-05-21 13:56:07 UTC (rev 9942)
@@ -56,6 +56,8 @@
 #define IDC_WINATTR                     221
 #define IDC_WINAIXTERM16                222
 #define IDC_WINXTERM256                 223
+#define IDC_NO_FRAME                    224
+#define IDC_DRAW_SAMPLE_AREA            225
 #define IDC_WINUSENORMALBG              231
 #define IDC_WINHELP                     299
 #define IDD_KEYBDLG                     300

Modified: trunk/teraterm/ttpdlg/ttdlg.c
===================================================================
--- trunk/teraterm/ttpdlg/ttdlg.c	2022-05-21 13:55:57 UTC (rev 9941)
+++ trunk/teraterm/ttpdlg/ttdlg.c	2022-05-21 13:56:07 UTC (rev 9942)
@@ -443,11 +443,13 @@
 	COLORREF Text, Back;
 	int DX[3];
 	TEXTMETRIC Metrics;
-	RECT Rect, TestRect;
+	RECT TestRect;
 	int FW,FH;
 	HDC DC;
+	HWND HWndSample;
 
-	DC = GetDC(Dialog);
+	HWndSample = GetDlgItem(Dialog, IDC_DRAW_SAMPLE_AREA);
+	DC = GetDC(HWndSample);
 	Text = RGB(work->TmpColor[IAttr][0],
 	           work->TmpColor[IAttr][1],
 	           work->TmpColor[IAttr][2]);
@@ -464,20 +466,12 @@
 	FH = Metrics.tmHeight;
 	for (i = 0 ; i <= 2 ; i++)
 		DX[i] = FW;
-	GetClientRect(Dialog,&Rect);
-	TestRect.left = Rect.left + (int)((Rect.right-Rect.left)*0.70);
-	TestRect.right = Rect.left + (int)((Rect.right-Rect.left)*0.93);
-	TestRect.top = Rect.top + (int)((Rect.bottom-Rect.top)*0.54);
-#ifdef USE_NORMAL_BGCOLOR
-	TestRect.bottom = Rect.top + (int)((Rect.bottom-Rect.top)*0.90);
-#else
-	TestRect.bottom = Rect.top + (int)((Rect.bottom-Rect.top)*0.94);
-#endif
+	GetClientRect(HWndSample,&TestRect);
 	x = (int)((TestRect.left+TestRect.right) / 2 - FW * 1.5);
 	y = (TestRect.top+TestRect.bottom-FH) / 2;
 	ExtTextOut(DC, x,y, ETO_CLIPPED | ETO_OPAQUE,
 	           &TestRect, "ABC", 3, &(DX[0]));
-	ReleaseDC(Dialog,DC);
+	ReleaseDC(HWndSample,DC);
 }
 
 static void ChangeColor(HWND Dialog, WinDlgWork *work, int IAttr, int IOffset)
@@ -575,9 +569,13 @@
 			                   sizeof(ts->Title)-1, 0);
 
 			SetRB(Dialog,ts->HideTitle,IDC_WINHIDETITLE,IDC_WINHIDETITLE);
+			SetRB(Dialog,ts->EtermLookfeel.BGNoFrame,IDC_NO_FRAME,IDC_NO_FRAME);
 			SetRB(Dialog,ts->PopupMenu,IDC_WINHIDEMENU,IDC_WINHIDEMENU);
-			if ( ts->HideTitle>0 )
+			if ( ts->HideTitle>0 ) {
 				DisableDlgItem(Dialog,IDC_WINHIDEMENU,IDC_WINHIDEMENU);
+			} else {
+				DisableDlgItem(Dialog,IDC_NO_FRAME,IDC_NO_FRAME);
+			}
 
 			if (work->VTFlag>0) {
 				wchar_t *uimsg;
@@ -713,8 +711,11 @@
 			switch (LOWORD(wParam)) {
 				case IDOK:
 					if ( ts!=NULL ) {
+						WORD w;
 						GetDlgItemText(Dialog,IDC_WINTITLE,ts->Title,sizeof(ts->Title));
 						GetRB(Dialog,&ts->HideTitle,IDC_WINHIDETITLE,IDC_WINHIDETITLE);
+						GetRB(Dialog,&w,IDC_NO_FRAME,IDC_NO_FRAME);
+						ts->EtermLookfeel.BGNoFrame = w;
 						GetRB(Dialog,&ts->PopupMenu,IDC_WINHIDEMENU,IDC_WINHIDEMENU);
 						DC = GetDC(Dialog);
 						if (work->VTFlag>0) {
@@ -895,9 +896,11 @@
 					GetRB(Dialog,&i,IDC_WINHIDETITLE,IDC_WINHIDETITLE);
 					if (i>0) {
 						DisableDlgItem(Dialog,IDC_WINHIDEMENU,IDC_WINHIDEMENU);
+						EnableDlgItem(Dialog,IDC_NO_FRAME,IDC_NO_FRAME);
 					}
 					else {
 						EnableDlgItem(Dialog,IDC_WINHIDEMENU,IDC_WINHIDEMENU);
+						DisableDlgItem(Dialog,IDC_NO_FRAME,IDC_NO_FRAME);
 					}
 					break;
 

Modified: trunk/teraterm/ttpdlg/ttpdlg.rc
===================================================================
--- trunk/teraterm/ttpdlg/ttpdlg.rc	2022-05-21 13:55:57 UTC (rev 9941)
+++ trunk/teraterm/ttpdlg/ttpdlg.rc	2022-05-21 13:56:07 UTC (rev 9942)
@@ -301,7 +301,7 @@
     PUSHBUTTON      "&Help",IDC_KEYBHELP,107,55,40,14
 END
 
-IDD_WINDLG DIALOGEX 20, 20, 240, 210
+IDD_WINDLG DIALOGEX 20, 20, 240, 237
 STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
 CAPTION "Tera Term: Window setup"
 FONT 14, "System", 0, 0, 0x0
@@ -312,34 +312,36 @@
     CONTROL         "B&lock",IDC_WINBLOCK,"Button",BS_AUTORADIOBUTTON | WS_GROUP,16,40,42,9
     CONTROL         "&Vertical line",IDC_WINVERT,"Button",BS_AUTORADIOBUTTON,16,52,62,9
     CONTROL         "H&orizontal line",IDC_WINHORZ,"Button",BS_AUTORADIOBUTTON,16,64,68,10
-    CONTROL         "Enable bol&d font",IDC_FONTBOLD,"Button",BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_TABSTOP,11,93,82,10
+    CONTROL         "Enable bol&d font",IDC_FONTBOLD,"Button",BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_TABSTOP,11,109,82,10
     CONTROL         "H&ide title bar",IDC_WINHIDETITLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,98,30,90,10
-    CONTROL         "Hide &menu bar",IDC_WINHIDEMENU,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,98,42,90,10
-    CONTROL         "&Color emulation",IDC_WINCOLOREMU,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,98,54,90,10
-    CONTROL         "1&6 Colors (aixterm style)",IDC_WINAIXTERM16,"Button",BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_TABSTOP,98,66,100,10
-    CONTROL         "&256 Colors (xterm style)",IDC_WINXTERM256,"Button",BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_TABSTOP,98,78,100,10
-    CONTROL         "&Scroll buffer:",IDC_WINSCROLL1,"Button",BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_TABSTOP,98,92,83,12
-    LTEXT           "li&nes",IDC_WINSCROLL3,214,94,18,10,NOT WS_VISIBLE
-    EDITTEXT        IDC_WINSCROLL2,184,92,27,12,ES_AUTOHSCROLL | ES_NUMBER | NOT WS_VISIBLE
-    GROUPBOX        "Color",IDC_WINCOLOR,10,106,220,93
-    CONTROL         "Te&xt",IDC_WINTEXT,"Button",BS_AUTORADIOBUTTON | WS_GROUP,18,118,40,10
-    CONTROL         "Bac&kground",IDC_WINBACK,"Button",BS_AUTORADIOBUTTON,18,131,56,10
-    LTEXT           "&Attribute",IDC_WINATTRTEXT,76,116,36,10,NOT WS_VISIBLE
-    COMBOBOX        IDC_WINATTR,114,114,46,38,CBS_DROPDOWNLIST | NOT WS_VISIBLE | WS_VSCROLL | WS_GROUP | WS_TABSTOP
-    PUSHBUTTON      "R&everse",IDC_WINREV,98,130,36,14,WS_GROUP
-    LTEXT           "&R:",IDC_WINREDLABEL,18,147,20,8,NOT WS_GROUP
-    LTEXT           "255",IDC_WINRED,42,147,16,8
-    SCROLLBAR       IDC_WINREDBAR,59,147,100,8,WS_GROUP | WS_TABSTOP
-    LTEXT           "&G:",IDC_WINGREENLABEL,18,159,20,8,NOT WS_GROUP
-    LTEXT           "255",IDC_WINGREEN,42,159,16,8
-    SCROLLBAR       IDC_WINGREENBAR,59,159,100,8,WS_TABSTOP
-    LTEXT           "&B:",IDC_WINBLUELABEL,18,171,20,8,NOT WS_GROUP
-    LTEXT           "255",IDC_WINBLUE,42,171,16,8
-    SCROLLBAR       IDC_WINBLUEBAR,59,171,100,8,WS_TABSTOP
-    CONTROL         "Always &use Normal text's BG",IDC_WINUSENORMALBG,"Button",BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_TABSTOP,18,182,115,12
+    CONTROL         "No Frame",IDC_NO_FRAME,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,105,42,83,10
+    CONTROL         "Hide &menu bar",IDC_WINHIDEMENU,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,98,54,90,10
+    CONTROL         "&Color emulation",IDC_WINCOLOREMU,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,98,66,90,10
+    CONTROL         "1&6 Colors (aixterm style)",IDC_WINAIXTERM16,"Button",BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_TABSTOP,98,78,100,10
+    CONTROL         "&256 Colors (xterm style)",IDC_WINXTERM256,"Button",BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_TABSTOP,98,90,100,10
+    CONTROL         "&Scroll buffer:",IDC_WINSCROLL1,"Button",BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_TABSTOP,98,108,83,12
+    LTEXT           "li&nes",IDC_WINSCROLL3,214,110,18,10,NOT WS_VISIBLE
+    EDITTEXT        IDC_WINSCROLL2,184,108,27,12,ES_AUTOHSCROLL | ES_NUMBER | NOT WS_VISIBLE
+    GROUPBOX        "Color",IDC_WINCOLOR,10,121,220,112
+    CONTROL         "Te&xt",IDC_WINTEXT,"Button",BS_AUTORADIOBUTTON | WS_GROUP,18,145,55,10
+    CONTROL         "Bac&kground",IDC_WINBACK,"Button",BS_AUTORADIOBUTTON,18,157,56,10
+    LTEXT           "&Attribute",IDC_WINATTRTEXT,18,133,36,10,NOT WS_VISIBLE
+    COMBOBOX        IDC_WINATTR,56,132,46,38,CBS_DROPDOWNLIST | NOT WS_VISIBLE | WS_VSCROLL | WS_GROUP | WS_TABSTOP
+    PUSHBUTTON      "R&everse",IDC_WINREV,79,148,36,14,WS_GROUP
+    LTEXT           "&R:",IDC_WINREDLABEL,18,173,20,8,NOT WS_GROUP
+    LTEXT           "255",IDC_WINRED,42,173,16,8
+    SCROLLBAR       IDC_WINREDBAR,59,173,100,8,WS_GROUP | WS_TABSTOP
+    LTEXT           "&G:",IDC_WINGREENLABEL,18,185,20,8,NOT WS_GROUP
+    LTEXT           "255",IDC_WINGREEN,42,185,16,8
+    SCROLLBAR       IDC_WINGREENBAR,59,185,100,8,WS_TABSTOP
+    LTEXT           "&B:",IDC_WINBLUELABEL,18,197,20,8,NOT WS_GROUP
+    LTEXT           "255",IDC_WINBLUE,42,197,16,8
+    SCROLLBAR       IDC_WINBLUEBAR,59,197,100,8,WS_TABSTOP
+    CONTROL         "Always &use Normal text's BG",IDC_WINUSENORMALBG,"Button",BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_TABSTOP,17,209,115,12
     DEFPUSHBUTTON   "OK",1,194,4,40,16,WS_GROUP
     PUSHBUTTON      "Cancel",2,194,26,40,16
     PUSHBUTTON      "&Help",IDC_WINHELP,194,48,40,16
+    CONTROL         "",IDC_DRAW_SAMPLE_AREA,"Static",SS_BLACKFRAME,165,147,57,63
 END
 
 IDD_WINLISTDLG DIALOGEX 20, 20, 200, 100
@@ -402,7 +404,7 @@
 
     IDD_WINDLG, DIALOG
     BEGIN
-        BOTTOMMARGIN, 182
+        BOTTOMMARGIN, 233
     END
 
     IDD_WINLISTDLG, DIALOG


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