• R/O
  • SSH
  • HTTPS

ttssh2: Commit


Commit MetaInfo

Revision4942 (tree)
Time2012-05-13 21:59:07
Author(del#24082)

Log Message

Eterm look-feel 機能の背景画像指定を Additional settings ダイアログから行えるようにした。
ダイアログ上から画像ファイルを指定すると、

BGThemeFile(teraterm.ini) = theme\ImageFile.INI
BGDestFile(theme\ImageFile.INI) = 画像ファイル

に更新する。
ダイアログ上から Eterm look-feel を off にすると、

BGThemeFile(teraterm.ini) = theme\*.INI

に戻す。

Change Summary

Incremental Difference

--- trunk/teraterm/teraterm/vtdisp.c (revision 4941)
+++ trunk/teraterm/teraterm/vtdisp.c (revision 4942)
@@ -112,8 +112,6 @@
112112 #include <stdio.h>
113113 #include <time.h>
114114
115-#define BG_SECTION "BG"
116-
117115 typedef enum _BG_TYPE {BG_COLOR = 0,BG_PICTURE,BG_WALLPAPER} BG_TYPE;
118116 typedef enum _BG_PATTERN {BG_STRETCH = 0,BG_TILE,BG_CENTER,BG_FIT_WIDTH,BG_FIT_HEIGHT,BG_AUTOFIT,BG_AUTOFILL} BG_PATTERN;
119117
@@ -1388,7 +1386,7 @@
13881386 BGDest.antiAlias = BGGetOnOff("BGDestAntiAlias",BGDest.antiAlias,file);
13891387 BGDest.color = BGGetColor("BGDestColor",BGDest.color,file);
13901388
1391- GetPrivateProfileString(BG_SECTION,"BGDestFile",BGDest.file,path,MAX_PATH,file);
1389+ GetPrivateProfileString(BG_SECTION, BG_DESTFILE, BGDest.file,path,MAX_PATH,file);
13921390 RandomFile(path,BGDest.file,sizeof(BGDest.file));
13931391
13941392 //その他読み出し
@@ -1462,9 +1460,17 @@
14621460 strncpy_s(ts.EtermLookfeel.BGSPIPath, sizeof(ts.EtermLookfeel.BGSPIPath), BGSPIPath, _TRUNCATE);
14631461
14641462 //コンフィグファイルの決定
1465- GetPrivateProfileString(BG_SECTION,"BGThemeFile","",path,MAX_PATH,ts.SetupFName);
1466- strncpy_s(ts.EtermLookfeel.BGThemeFile, sizeof(ts.EtermLookfeel.BGThemeFile), path, _TRUNCATE);
1463+ if (ts.EtermLookfeel.BGThemeFile[0] == '\0') {
1464+ // 空の場合のみ、ディスクから読む。BGInitialize()が Tera Term 起動時以外にも、
1465+ // Additional settings から呼び出されることがあるため。
1466+ GetPrivateProfileString(BG_SECTION,"BGThemeFile","",path,MAX_PATH,ts.SetupFName);
1467+ strncpy_s(ts.EtermLookfeel.BGThemeFile, sizeof(ts.EtermLookfeel.BGThemeFile), path, _TRUNCATE);
1468+ }
14671469
1470+ // 背景画像の読み込み
1471+ _snprintf_s(path, sizeof(path), _TRUNCATE, "%s\\%s", ts.HomeDir, BG_THEME_IMAGEFILE);
1472+ GetPrivateProfileString(BG_SECTION, BG_DESTFILE, "", ts.BGImageFilePath, sizeof(ts.BGImageFilePath), path);
1473+
14681474 if(!BGEnable)
14691475 return;
14701476
--- trunk/teraterm/teraterm/addsetting.cpp (revision 4941)
+++ trunk/teraterm/teraterm/addsetting.cpp (revision 4942)
@@ -770,6 +770,9 @@
770770 SendDlgItemMessage(IDC_ENABLE_URL_COLOR, WM_SETFONT, (WPARAM)DlgVisualFont, MAKELPARAM(TRUE,0));
771771 SendDlgItemMessage(IDC_ENABLE_ANSI_COLOR, WM_SETFONT, (WPARAM)DlgVisualFont, MAKELPARAM(TRUE,0));
772772 SendDlgItemMessage(IDC_URL_UNDERLINE, WM_SETFONT, (WPARAM)DlgVisualFont, MAKELPARAM(TRUE,0));
773+ SendDlgItemMessage(IDC_BGIMG_LABEL, WM_SETFONT, (WPARAM)DlgVisualFont, MAKELPARAM(TRUE,0));
774+ SendDlgItemMessage(IDC_BGIMG_EDIT, WM_SETFONT, (WPARAM)DlgVisualFont, MAKELPARAM(TRUE,0));
775+ SendDlgItemMessage(IDC_BGIMG_BUTTON, WM_SETFONT, (WPARAM)DlgVisualFont, MAKELPARAM(TRUE,0));
773776 }
774777 else {
775778 DlgVisualFont = NULL;
@@ -832,6 +835,18 @@
832835 btn = (CButton *)GetDlgItem(IDC_ETERM_LOOKFEEL);
833836 btn->SetCheck(ts.EtermLookfeel.BGEnable);
834837
838+ // Eterm look-feelの背景画像指定。
839+ SetDlgItemText(IDC_BGIMG_EDIT, ts.BGImageFilePath);
840+ if (ts.EtermLookfeel.BGEnable) {
841+ GetDlgItem(IDC_BGIMG_LABEL)->EnableWindow(TRUE);
842+ GetDlgItem(IDC_BGIMG_EDIT)->EnableWindow(TRUE);
843+ GetDlgItem(IDC_BGIMG_BUTTON)->EnableWindow(TRUE);
844+ } else {
845+ GetDlgItem(IDC_BGIMG_LABEL)->EnableWindow(FALSE);
846+ GetDlgItem(IDC_BGIMG_EDIT)->EnableWindow(FALSE);
847+ GetDlgItem(IDC_BGIMG_BUTTON)->EnableWindow(FALSE);
848+ }
849+
835850 // (3)Mouse cursor type
836851 listbox = (CListBox *)GetDlgItem(IDC_MOUSE_CURSOR);
837852 for (i = 0 ; MouseCursor[i].name ; i++) {
@@ -904,8 +919,38 @@
904919 CListBox *listbox;
905920 int sel;
906921 char buf[MAXPATHLEN];
922+ CButton *btn;
907923
908924 switch (wParam) {
925+ case IDC_ETERM_LOOKFEEL:
926+ // チェックされたら Enable/Disable をトグルする。
927+ btn = (CButton *)GetDlgItem(IDC_ETERM_LOOKFEEL);
928+ if (btn->GetCheck()) {
929+ GetDlgItem(IDC_BGIMG_LABEL)->EnableWindow(TRUE);
930+ GetDlgItem(IDC_BGIMG_EDIT)->EnableWindow(TRUE);
931+ GetDlgItem(IDC_BGIMG_BUTTON)->EnableWindow(TRUE);
932+ } else {
933+ GetDlgItem(IDC_BGIMG_LABEL)->EnableWindow(FALSE);
934+ GetDlgItem(IDC_BGIMG_EDIT)->EnableWindow(FALSE);
935+ GetDlgItem(IDC_BGIMG_BUTTON)->EnableWindow(FALSE);
936+ // 無効化されたら、BGThemeFile を元に戻す。
937+ strncpy_s(ts.EtermLookfeel.BGThemeFile, BG_THEME_IMAGEFILE_DEFAULT, sizeof(ts.EtermLookfeel.BGThemeFile));
938+ }
939+ return TRUE;
940+
941+ case IDC_BGIMG_BUTTON | (BN_CLICKED << 16):
942+ // 背景画像をダイアログで指定する。
943+ {
944+ CString filter("Image Files(*.jpg;*.jpeg;*.bmp)|*.jpg;*.jpeg;*.bmp|All Files(*.*)|*.*||");
945+ CFileDialog selDlg(TRUE, NULL, NULL, OFN_HIDEREADONLY, filter);
946+ if (selDlg.DoModal() == IDOK) {
947+ // 背景画像指定が意図的に行われたら、BGThemeFile を固定化する。
948+ SetDlgItemText(IDC_BGIMG_EDIT, selDlg.GetPathName());
949+ strncpy_s(ts.EtermLookfeel.BGThemeFile, BG_THEME_IMAGEFILE, sizeof(ts.EtermLookfeel.BGThemeFile));
950+ }
951+ }
952+ return TRUE;
953+
909954 case IDC_ANSI_COLOR | (LBN_SELCHANGE << 16):
910955 listbox = (CListBox *)GetDlgItem(IDC_ANSI_COLOR);
911956 sel = listbox->GetCurSel();
@@ -1024,6 +1069,10 @@
10241069 ts.EtermLookfeel.BGEnable = btn->GetCheck();
10251070 }
10261071
1072+ if (ts.EtermLookfeel.BGEnable) {
1073+ GetDlgItemText(IDC_BGIMG_EDIT, ts.BGImageFilePath, sizeof(ts.BGImageFilePath));
1074+ }
1075+
10271076 // (3)
10281077 listbox = (CListBox *)GetDlgItem(IDC_MOUSE_CURSOR);
10291078 sel = listbox->GetCurSel();
--- trunk/teraterm/ttpset/ttset.c (revision 4941)
+++ trunk/teraterm/ttpset/ttset.c (revision 4942)
@@ -2378,7 +2378,7 @@
23782378 WritePrivateProfileString(NULL, NULL, NULL, FName);
23792379
23802380 // Eterm lookfeel alphablend (2005.4.24 yutaka)
2381-#define ETERM_SECTION "BG"
2381+#define ETERM_SECTION BG_SECTION
23822382 WriteOnOff(ETERM_SECTION, "BGEnable", FName,
23832383 ts->EtermLookfeel.BGEnable);
23842384 WriteOnOff(ETERM_SECTION, "BGUseAlphaBlendAPI", FName,
@@ -2393,6 +2393,8 @@
23932393 ts->EtermLookfeel.BGNoFrame);
23942394 WritePrivateProfileString(ETERM_SECTION, "BGThemeFile",
23952395 ts->EtermLookfeel.BGThemeFile, FName);
2396+ _snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%s\\%s", ts->HomeDir, BG_THEME_IMAGEFILE);
2397+ WritePrivateProfileString(BG_SECTION, BG_DESTFILE, ts->BGImageFilePath, Temp);
23962398
23972399 #ifdef USE_NORMAL_BGCOLOR
23982400 // UseNormalBGColor
--- trunk/teraterm/common/tt_res.h (revision 4941)
+++ trunk/teraterm/common/tt_res.h (revision 4942)
@@ -130,6 +130,7 @@
130130 #define IDC_SCROLL_LINE 2510
131131 #define IDC_PASTEDELAY_EDIT 2510
132132 #define IDC_SCP_PATH 2510
133+#define IDC_BGIMG_EDIT 2510
133134 #define IDC_CHECK1 2512
134135 #define IDC_CONFIRM_CHANGE_PASTE 2512
135136 #define IDC_CURSOR_CTRL_SEQ 2512
@@ -153,7 +154,10 @@
153154 #define IDC_PROTOELAPSEDTIME 2526
154155 #define IDC_DAD_SENDFILE 2526
155156 #define IDC_TRANS_ELAPSED 2527
157+#define IDC_BGIMG_LABEL 2527
156158 #define IDC_TRANS_ETIME 2528
159+#define IDC_BUTTON1 2528
160+#define IDC_BGIMG_BUTTON 2528
157161 #define IDC_CLIPBOARD_ACCESS_LABEL 2529
158162 #define IDC_CLIPBOARD_ACCESS 2530
159163 #define ID_ACC_SENDBREAK 50001
@@ -249,7 +253,7 @@
249253 #define _APS_NO_MFC 1
250254 #define _APS_NEXT_RESOURCE_VALUE 123
251255 #define _APS_NEXT_COMMAND_VALUE 52031
252-#define _APS_NEXT_CONTROL_VALUE 2527
256+#define _APS_NEXT_CONTROL_VALUE 2529
253257 #define _APS_NEXT_SYMED_VALUE 101
254258 #endif
255259 #endif
--- trunk/teraterm/common/tttypes.h (revision 4941)
+++ trunk/teraterm/common/tttypes.h (revision 4942)
@@ -556,6 +556,7 @@
556556 WORD KermitOpt;
557557 WORD FontQuality;
558558 char ScpSendDir[MAXPATHLEN];
559+ char BGImageFilePath[MAX_PATH];
559560 };
560561
561562 typedef struct tttset TTTSet, *PTTSet;
@@ -1014,6 +1015,7 @@
10141015 * - At version 4.74, ttset_memfilemap was replaced with ttset_memfilemap_19.
10151016 * added tttset.FontQuality
10161017 * added tttset.ScpSenDir
1018+ * added tttset.BGImageFilePath
10171019 *
10181020 * - At version 4.73, ttset_memfilemap was replaced with ttset_memfilemap_18.
10191021 * added tttset.LogLockExclusive
--- trunk/teraterm/common/teraterm.h (revision 4941)
+++ trunk/teraterm/common/teraterm.h (revision 4942)
@@ -13,6 +13,12 @@
1313 // AKASI氏によるEterm風透過ウィンドウ
1414 #define ALPHABLEND_TYPE2
1515
16+// Eterm look-feel
17+#define BG_SECTION "BG"
18+#define BG_DESTFILE "BGDestFile"
19+#define BG_THEME_IMAGEFILE "theme\\ImageFile.INI"
20+#define BG_THEME_IMAGEFILE_DEFAULT "theme\\*.INI"
21+
1622 // Added by 337 2006/03/01
1723 #define USE_NORMAL_BGCOLOR
1824
--- trunk/doc/en/html/menu/setup-additional.html (revision 4941)
+++ trunk/doc/en/html/menu/setup-additional.html (revision 4942)
@@ -229,11 +229,16 @@
229229 <dd>
230230 Tera Term window looks like Eterm-lookfeel background transparency.
231231 </dd>
232- </dl>
233-
232+
234233 <p>
235234 See also <a href="../usage/transparent.html">Background transparency</a>.
236235 </p>
236+
237+ <dt>Background Image</dt>
238+ <dd>
239+ When the Eterm lookfeel feature is enabled, an image file can be specified as background.
240+ </dd>
241+ </dl>
237242
238243 <dl>
239244 <dt>MouseCursor</dt>
--- trunk/doc/en/html/about/history.html (revision 4941)
+++ trunk/doc/en/html/about/history.html (revision 4942)
@@ -59,7 +59,7 @@
5959 <li>Eterm look-feel
6060 <ul>
6161 <li>Environment variable strings(%variableName%) can be included in the ini file path.</li>
62- <li>added an image file specified configuration(theme\ImageFile.INI).</li>
62+ <li>added an image file specified configuration(theme\ImageFile.INI). Also, a background image file can be specified on the <a href="../menu/setup-additional.html">Additional settings dialog</a>.</li>
6363 <li>Enabled the "Eterm lookfeel" checkbox on the <a href="../menu/setup-additional.html">Additional settings dialog</a>. Also, a user will be confirmed whether Tera Term is be relaunched.</li>
6464 </ul></li>
6565 <li>Macro
--- trunk/doc/ja/html/menu/setup-additional.html (revision 4941)
+++ trunk/doc/ja/html/menu/setup-additional.html (revision 4942)
@@ -226,7 +226,6 @@
226226 <dd>
227227 Eterm風の半透明ウィンドウを使用することができます。
228228 </dd>
229- </dl>
230229
231230 <p>
232231 詳しくは「<a href="../usage/transparent.html">透過ウインドウ</a>」
@@ -233,6 +232,12 @@
233232 を参照してください。
234233 </p>
235234
235+ <dt>Background Image</dt>
236+ <dd>
237+ Eterm lookfeel機能が有効の場合、背景画像を指定することができます。
238+ </dd>
239+ </dl>
240+
236241 <dl>
237242 <dt>MouseCursor</dt>
238243 <dd>
--- trunk/doc/ja/html/about/history.html (revision 4941)
+++ trunk/doc/ja/html/about/history.html (revision 4942)
@@ -59,7 +59,7 @@
5959 <li>Eterm look-feel
6060 <ul>
6161 <li>iniファイルパスに環境変数文字列(%variableName%)を含められるようにした。</li>
62- <li>画像ファイル指定設定(theme\ImageFile.INI)を追加した。</li>
62+ <li>画像ファイル指定設定(theme\ImageFile.INI)を追加した。<a href="../menu/setup-additional.html">Additional settingsダイアログ</a>のVisualタブで、背景画像を指定できるようにした。</li>
6363 <li><a href="../menu/setup-additional.html">Additional settingsダイアログ</a>のVisualタブで、有効化できるようにした。設定変更後、再起動するかを問い合わせるようにした。</li>
6464 </ul></li>
6565 <li>マクロ
Show on old repository browser