[ttssh2-commit] [10029] テーマファイルから読み込んですぐに反映できるようにした

Back to archive index
scmno****@osdn***** scmno****@osdn*****
2022年 6月 27日 (月) 01:14:39 JST


Revision: 10029
          https://osdn.net/projects/ttssh2/scm/svn/commits/10029
Author:   zmatsuo
Date:     2022-06-27 01:14:39 +0900 (Mon, 27 Jun 2022)
Log Message:
-----------
テーマファイルから読み込んですぐに反映できるようにした

Modified Paths:
--------------
    branches/theme/teraterm/teraterm/ttermpro.rc
    branches/theme/teraterm/teraterm/vtdisp.c

-------------- next part --------------
Modified: branches/theme/teraterm/teraterm/ttermpro.rc
===================================================================
--- branches/theme/teraterm/teraterm/ttermpro.rc	2022-06-26 16:14:29 UTC (rev 10028)
+++ branches/theme/teraterm/teraterm/ttermpro.rc	2022-06-26 16:14:39 UTC (rev 10029)
@@ -351,33 +351,33 @@
     PUSHBUTTON      "Cancel",IDCANCEL,215,166,50,14
 END
 
-IDD_TABSHEET_THEME_EDITOR DIALOGEX 0, 0, 326, 309
+IDD_TABSHEET_THEME_EDITOR DIALOGEX 0, 0, 326, 322
 STYLE DS_SETFONT | DS_CONTROL | WS_CHILD | WS_SYSMENU
 FONT 8, "Tahoma", 0, 0, 0x0
 BEGIN
-    CONTROL         "&Eterm lookfeel(*)",IDC_ETERM_LOOKFEEL,"Button",BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_DISABLED | WS_TABSTOP,228,270,74,12
+    CONTROL         "&Eterm lookfeel(*)",IDC_ETERM_LOOKFEEL,"Button",BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_DISABLED | WS_TABSTOP,228,291,74,12
     CONTROL         "Mixed &ThemeFile to Background (alpha blend desktop wallpaper image)",IDC_MIXED_THEME_FILE,
-                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,22,167,269,10
-    LTEXT           "Image Brightness (Alpha) 0...255",IDC_BGIMG_BRIGHTNESS,37,182,143,8
-    EDITTEXT        IDC_EDIT_BGIMG_BRIGHTNESS,37,247,34,14,ES_AUTOHSCROLL | ES_NUMBER
-    CONTROL         "Background &Image",IDC_BGIMG_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,22,107,73,10
-    EDITTEXT        IDC_BGIMG_EDIT,37,123,255,14,ES_AUTOHSCROLL
-    PUSHBUTTON      "...",IDC_BGIMG_BUTTON,302,123,14,14
+                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,22,188,269,10
+    LTEXT           "Image Brightness (Alpha) 0...255",IDC_BGIMG_BRIGHTNESS,37,203,143,8
+    EDITTEXT        IDC_EDIT_BGIMG_BRIGHTNESS,37,268,34,14,ES_AUTOHSCROLL | ES_NUMBER
+    CONTROL         "Background &Image",IDC_BGIMG_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,22,128,73,10
+    EDITTEXT        IDC_BGIMG_EDIT,37,144,255,14,ES_AUTOHSCROLL
+    PUSHBUTTON      "...",IDC_BGIMG_BUTTON,302,144,14,14
     LTEXT           "targte file",IDC_BGIMG_BRIGHTNESS2,5,5,126,8
-    CONTROL         "Mixed simple color plane",IDC_MIXED_THEME_FILE2,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,22,217,221,10
-    EDITTEXT        IDC_EDIT_BGIMG_BRIGHTNESS2,37,277,22,14,ES_AUTOHSCROLL | ES_NUMBER
+    CONTROL         "Mixed simple color plane",IDC_MIXED_THEME_FILE2,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,22,238,221,10
+    EDITTEXT        IDC_EDIT_BGIMG_BRIGHTNESS2,37,298,22,14,ES_AUTOHSCROLL | ES_NUMBER
     EDITTEXT        IDC_BGIMG_EDIT2,22,17,270,14,ES_AUTOHSCROLL | ES_READONLY
     PUSHBUTTON      "Read",IDC_BUTTON1,22,35,50,14
     PUSHBUTTON      "Write",IDC_BUTTON3,77,35,50,14
-    LTEXT           "Alpha 0...255",IDC_BGIMG_BRIGHTNESS3,37,265,143,8
-    LTEXT           "Color (RRGGBB)",IDC_BGIMG_BRIGHTNESS4,37,232,143,8
-    EDITTEXT        IDC_EDIT_BGIMG_BRIGHTNESS3,37,195,22,14,ES_AUTOHSCROLL | ES_NUMBER
-    EDITTEXT        IDC_EDIT_BGIMG_BRIGHTNESS4,37,87,34,14,ES_AUTOHSCROLL | ES_NUMBER
-    LTEXT           "Color (RRGGBB)",IDC_BGIMG_BRIGHTNESS5,37,73,143,8
-    LTEXT           "base",IDC_STATIC,22,58,16,8
-    COMBOBOX        IDC_COMBO1,37,146,107,45,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
-    LTEXT           "static text",IDC_STATIC_HELP,135,34,176,82
-    PUSHBUTTON      "Set",IDC_BUTTON4,78,53,50,14
+    LTEXT           "Alpha 0...255",IDC_BGIMG_BRIGHTNESS3,37,286,143,8
+    LTEXT           "Color (RRGGBB)",IDC_BGIMG_BRIGHTNESS4,37,253,143,8
+    EDITTEXT        IDC_EDIT_BGIMG_BRIGHTNESS3,37,216,22,14,ES_AUTOHSCROLL | ES_NUMBER
+    EDITTEXT        IDC_EDIT_BGIMG_BRIGHTNESS4,37,108,34,14,ES_AUTOHSCROLL | ES_NUMBER
+    LTEXT           "Color (RRGGBB)",IDC_BGIMG_BRIGHTNESS5,37,94,143,8
+    LTEXT           "base",IDC_STATIC,22,79,16,8
+    COMBOBOX        IDC_COMBO1,37,167,107,45,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+    LTEXT           "static text",IDC_STATIC_HELP,135,35,176,102
+    PUSHBUTTON      "Set",IDC_BUTTON4,22,53,50,14
 END
 
 
@@ -494,7 +494,7 @@
         VERTGUIDE, 292
         VERTGUIDE, 302
         TOPMARGIN, 5
-        BOTTOMMARGIN, 305
+        BOTTOMMARGIN, 318
         HORZGUIDE, 24
         HORZGUIDE, 42
         HORZGUIDE, 130

Modified: branches/theme/teraterm/teraterm/vtdisp.c
===================================================================
--- branches/theme/teraterm/teraterm/vtdisp.c	2022-06-26 16:14:29 UTC (rev 10028)
+++ branches/theme/teraterm/teraterm/vtdisp.c	2022-06-26 16:14:39 UTC (rev 10029)
@@ -4113,7 +4113,7 @@
 
 	checked = SendDlgItemMessageA(hWnd, IDC_MIXED_THEME_FILE2, BM_GETCHECK, 0, 0);
 	if (checked & BST_CHECKED) {
-		BGSrc2.alpha = GetDlgItemInt(hWnd, IDC_EDIT_BGIMG_BRIGHTNESS, NULL, FALSE);
+		BGSrc2.alpha = GetDlgItemInt(hWnd, IDC_EDIT_BGIMG_BRIGHTNESS2, NULL, FALSE);
 	} else {
 		BGSrc2.alpha = 0;
 	}
@@ -4140,15 +4140,15 @@
 							L"\x82\xA2\x82ܕ\\x8E\xA6\x82\xB3\x82\xEA\x82Ă\xA2\x82\xE9\x83e\x81[\x83}\x83t\x83@\x83C\x83\x8B\x96\xBC"
 				);
 			TipWin2SetTextW(dlg_data->tipwin, IDC_BUTTON1,
-							L"target file \x82\xF0\x8Dēǂݍ\x9E\x82݂\xB7\x82\xE9\n"
-							L"\x8F\xAB\x97\x88\x82́A\x94C\x88ӂ̃e\x81[\x83}\x83t\x83@\x83C\x83\x8B\x82\xF0\x93ǂݍ\x9E\x82߂\xE9\x82悤\x82ɂ\xB7\x82\xE9"
+							L"\x83e\x81[\x83}\x83t\x83B\x83A\x83\x8B\x82\xF0\x93ǂݍ\x9E\x82\xDE\n"
 				);
 			TipWin2SetTextW(dlg_data->tipwin, IDC_BUTTON3,
-							L"\x8C\xBB\x8D݂̃_\x83C\x83A\x83\x8D\x83O\x82̏\xF3\x91Ԃ\xF0\x83e\x81[\x83}\x83t\x83@\x83C\x83\x8B\x82ɏ\x91\x82\xAB\x8D\x9E\x82\xDE\n"
-							L"\x8F\x91\x82\xAB\x8D\x9E\x82񂾃C\x83t\x83@\x83C\x83\x8B(\x83e\x81[\x83}\x83t\x83@\x83C\x83\x8B)\x82\xF0\n"
-							L"\x81u\x95\\x8E\xA6\x83^\x83u\x81v\x82œǂݍ\x9E\x82ݎw\x92肵\x82āA\x81uok\x81v\x89\x9F\x82\xB7\x82Ɣ\xBD\x89f\x82\xB3\x82\xEA\x82\xE9\n"
-							L"\x82\xB1\x82̃y\x81[\x83W\x82̐ݒ\xE8\x82͂\xB1\x82\xEA\x82ŏ\x91\x82\xAB\x8Fo\x82\xB3\x82Ȃ\xA2\x82Ǝ\xB8\x82\xED\x82\xEA\x82\xE9\n"
+							L"\x8C\xBB\x8D݂̃_\x83C\x83A\x83\x8D\x83O\x82̏\xF3\x91Ԃ\xF0\x90ݒ肵\x82ăe\x81[\x83}\x83t\x83@\x83C\x83\x8B\x82ɏ\x91\x82\xAB\x8D\x9E\x82\xDE\n"
 				);
+			TipWin2SetTextW(dlg_data->tipwin, IDC_BUTTON4,
+							L"\x8C\xBB\x8D݂̃_\x83C\x83A\x83\x8D\x83O\x82̏\xF3\x91Ԃ\xF0\x90ݒ肷\x82\xE9\n"
+							L"\x82\xB1\x82̃y\x81[\x83W\x82̐ݒ\xE8\x82͏\x91\x82\xAB\x8Fo\x82\xB3\x82Ȃ\xA2\x82Ǝ\xB8\x82\xED\x82\xEA\x82\xE9\n"
+				);
 			SetDlgItemTextW(hWnd, IDC_STATIC_HELP,
 							L"\x8E\x9F\x82̏\x87\x82ō\x87\x90\xAC\x82\xB3\x82\xEA\x82āA\x94w\x8Ci\x82ɕ\\x8E\xA6\x82\xB3\x82\xEA\x82\xE9\n"
 							L"base\n"
@@ -4194,14 +4194,37 @@
 			switch (wp) {
 			case IDC_BUTTON1 | (BN_CLICKED << 16): {
 				// \x83e\x81[\x83}\x83t\x83@\x83C\x83\x8B\x93ǂݍ\x9E\x82\xDD
-				wchar_t *theme_file;
-				hGetDlgItemTextW(hWnd, IDC_BGIMG_EDIT2, &theme_file);
-				free(ts->EtermLookfeel.BGThemeFileW);
-				ts->EtermLookfeel.BGThemeFileW = theme_file;
+				OPENFILENAMEW ofn = {0};
+				wchar_t theme_file[MAX_PATH];
+				wchar_t *theme_file_in;
 
-				BGReadIniFile(ts->EtermLookfeel.BGThemeFileW);
-				ResetControls(hWnd, dlg_data);
-				BGSetupPrimary(TRUE);
+				hGetDlgItemTextW(hWnd, IDC_BGIMG_EDIT2, &theme_file_in);
+				wcscpy_s(theme_file, _countof(theme_file), theme_file_in);
+				free(theme_file_in);
+				theme_file_in = NULL;
+
+				ofn.lStructSize = get_OPENFILENAME_SIZEW();
+				ofn.hwndOwner   = hWnd;
+				ofn.lpstrFile   = theme_file;
+				ofn.nMaxFile    = _countof(theme_file);
+				ofn.nFilterIndex = 1;
+				ofn.hInstance = hInst;
+				ofn.lpstrDefExt = L"ini";
+				ofn.Flags = OFN_PATHMUSTEXIST | OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY;
+				ofn.lpstrTitle = L"select theme file";
+
+				if (GetOpenFileNameW(&ofn)) {
+					free(ts->EtermLookfeel.BGThemeFileW);
+					ts->EtermLookfeel.BGThemeFileW = _wcsdup(theme_file);
+					SetDlgItemTextW(hWnd, IDC_BGIMG_EDIT2, theme_file);
+
+					BGReadIniFile(ts->EtermLookfeel.BGThemeFileW);
+					BGSetupPrimary(TRUE);
+					InvalidateRect(HVTWin, NULL, FALSE);
+
+					ResetControls(hWnd, dlg_data);
+				}
+
 				break;
 			}
 			case IDC_BGIMG_BUTTON | (BN_CLICKED << 16): {


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