[Ttssh2-commit] [4942] Eterm look-feel 機能の背景画像指定を Additional settings ダイアログから行えるようにした。

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2012年 5月 13日 (日) 21:59:08 JST


Revision: 4942
          http://sourceforge.jp/projects/ttssh2/scm/svn/commits/4942
Author:   yutakapon
Date:     2012-05-13 21:59:07 +0900 (Sun, 13 May 2012)
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

に戻す。

Modified Paths:
--------------
    trunk/doc/en/html/about/history.html
    trunk/doc/en/html/menu/setup-additional.html
    trunk/doc/ja/html/about/history.html
    trunk/doc/ja/html/menu/setup-additional.html
    trunk/teraterm/common/teraterm.h
    trunk/teraterm/common/tt_res.h
    trunk/teraterm/common/tttypes.h
    trunk/teraterm/teraterm/addsetting.cpp
    trunk/teraterm/teraterm/ttermpro.rc
    trunk/teraterm/teraterm/vtdisp.c
    trunk/teraterm/ttpset/ttset.c

-------------- next part --------------
Modified: trunk/doc/en/html/about/history.html
===================================================================
--- trunk/doc/en/html/about/history.html	2012-05-12 16:31:18 UTC (rev 4941)
+++ trunk/doc/en/html/about/history.html	2012-05-13 12:59:07 UTC (rev 4942)
@@ -59,7 +59,7 @@
       <li>Eterm look-feel
         <ul>
           <li>Environment variable strings(%variableName%) can be included in the ini file path.</li>
-          <li>added an image file specified configuration(theme\ImageFile.INI).</li>
+          <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>
           <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>
         </ul></li>
       <li>Macro

Modified: trunk/doc/en/html/menu/setup-additional.html
===================================================================
--- trunk/doc/en/html/menu/setup-additional.html	2012-05-12 16:31:18 UTC (rev 4941)
+++ trunk/doc/en/html/menu/setup-additional.html	2012-05-13 12:59:07 UTC (rev 4942)
@@ -229,11 +229,16 @@
       <dd>
 	Tera Term window looks like Eterm-lookfeel background transparency.
       </dd>
-    </dl>
-
+      
     <p>
       See also <a href="../usage/transparent.html">Background transparency</a>.
     </p>
+      
+      <dt>Background Image</dt>
+      <dd>
+	When the Eterm lookfeel feature is enabled, an image file can be specified as background.
+      </dd>
+    </dl>
 
     <dl>
       <dt>MouseCursor</dt>

Modified: trunk/doc/ja/html/about/history.html
===================================================================
--- trunk/doc/ja/html/about/history.html	2012-05-12 16:31:18 UTC (rev 4941)
+++ trunk/doc/ja/html/about/history.html	2012-05-13 12:59:07 UTC (rev 4942)
@@ -59,7 +59,7 @@
       <li>Eterm look-feel
         <ul>
           <li>ini\x83t\x83@\x83C\x83\x8B\x83p\x83X\x82Ɋ‹\xAB\x95ϐ\x94\x95\xB6\x8E\x9A\x97\xF1(%variableName%)\x82\xF0\x8A܂߂\xE7\x82\xEA\x82\xE9\x82悤\x82ɂ\xB5\x82\xBD\x81B</li>
-          <li>\x89摜\x83t\x83@\x83C\x83\x8B\x8Ew\x92\xE8\x90ݒ\xE8(theme\ImageFile.INI)\x82\xF0\x92lj\xC1\x82\xB5\x82\xBD\x81B</li>
+          <li>\x89摜\x83t\x83@\x83C\x83\x8B\x8Ew\x92\xE8\x90ݒ\xE8(theme\ImageFile.INI)\x82\xF0\x92lj\xC1\x82\xB5\x82\xBD\x81B<a href="../menu/setup-additional.html">Additional settings\x83_\x83C\x83A\x83\x8D\x83O</a>\x82\xCCVisual\x83^\x83u\x82ŁA\x94w\x8Ci\x89摜\x82\xF0\x8Ew\x92\xE8\x82ł\xAB\x82\xE9\x82悤\x82ɂ\xB5\x82\xBD\x81B</li>
           <li><a href="../menu/setup-additional.html">Additional settings\x83_\x83C\x83A\x83\x8D\x83O</a>\x82\xCCVisual\x83^\x83u\x82ŁA\x97L\x8C\xF8\x89\xBB\x82ł\xAB\x82\xE9\x82悤\x82ɂ\xB5\x82\xBD\x81B\x90ݒ\xE8\x95ύX\x8C\xE3\x81A\x8DċN\x93\xAE\x82\xB7\x82邩\x82\xF0\x96₢\x8D\x87\x82킹\x82\xE9\x82悤\x82ɂ\xB5\x82\xBD\x81B</li>
         </ul></li>
       <li>\x83}\x83N\x83\x8D

Modified: trunk/doc/ja/html/menu/setup-additional.html
===================================================================
--- trunk/doc/ja/html/menu/setup-additional.html	2012-05-12 16:31:18 UTC (rev 4941)
+++ trunk/doc/ja/html/menu/setup-additional.html	2012-05-13 12:59:07 UTC (rev 4942)
@@ -226,13 +226,18 @@
       <dd>
 	Eterm\x95\x97\x82̔\xBC\x93\xA7\x96\xBE\x83E\x83B\x83\x93\x83h\x83E\x82\xF0\x8Eg\x97p\x82\xB7\x82邱\x82Ƃ\xAA\x82ł\xAB\x82܂\xB7\x81B
       </dd>
-    </dl>
 
     <p>
       \x8Fڂ\xB5\x82\xAD\x82́u<a href="../usage/transparent.html">\x93\xA7\x89߃E\x83C\x83\x93\x83h\x83E</a>\x81v
       \x82\xF0\x8EQ\x8FƂ\xB5\x82Ă\xAD\x82\xBE\x82\xB3\x82\xA2\x81B
     </p>
 
+      <dt>Background Image</dt>
+      <dd>
+	Eterm lookfeel\x8B@\x94\\x82\xAA\x97L\x8C\xF8\x82̏ꍇ\x81A\x94w\x8Ci\x89摜\x82\xF0\x8Ew\x92肷\x82邱\x82Ƃ\xAA\x82ł\xAB\x82܂\xB7\x81B
+      </dd>
+    </dl>
+
     <dl>
       <dt>MouseCursor</dt>
       <dd>

Modified: trunk/teraterm/common/teraterm.h
===================================================================
--- trunk/teraterm/common/teraterm.h	2012-05-12 16:31:18 UTC (rev 4941)
+++ trunk/teraterm/common/teraterm.h	2012-05-13 12:59:07 UTC (rev 4942)
@@ -13,6 +13,12 @@
 // AKASI\x8E\x81\x82ɂ\xE6\x82\xE9Eterm\x95\x97\x93\xA7\x89߃E\x83B\x83\x93\x83h\x83E
 #define ALPHABLEND_TYPE2
 
+// Eterm look-feel
+#define BG_SECTION "BG"
+#define BG_DESTFILE "BGDestFile"
+#define BG_THEME_IMAGEFILE "theme\\ImageFile.INI"
+#define BG_THEME_IMAGEFILE_DEFAULT "theme\\*.INI"
+
 // Added by 337 2006/03/01
 #define USE_NORMAL_BGCOLOR
 

Modified: trunk/teraterm/common/tt_res.h
===================================================================
--- trunk/teraterm/common/tt_res.h	2012-05-12 16:31:18 UTC (rev 4941)
+++ trunk/teraterm/common/tt_res.h	2012-05-13 12:59:07 UTC (rev 4942)
@@ -130,6 +130,7 @@
 #define IDC_SCROLL_LINE                 2510
 #define IDC_PASTEDELAY_EDIT             2510
 #define IDC_SCP_PATH                    2510
+#define IDC_BGIMG_EDIT                  2510
 #define IDC_CHECK1                      2512
 #define IDC_CONFIRM_CHANGE_PASTE        2512
 #define IDC_CURSOR_CTRL_SEQ             2512
@@ -153,7 +154,10 @@
 #define IDC_PROTOELAPSEDTIME            2526
 #define IDC_DAD_SENDFILE                2526
 #define IDC_TRANS_ELAPSED               2527
+#define IDC_BGIMG_LABEL                 2527
 #define IDC_TRANS_ETIME                 2528
+#define IDC_BUTTON1                     2528
+#define IDC_BGIMG_BUTTON                2528
 #define IDC_CLIPBOARD_ACCESS_LABEL      2529
 #define IDC_CLIPBOARD_ACCESS            2530
 #define ID_ACC_SENDBREAK                50001
@@ -249,7 +253,7 @@
 #define _APS_NO_MFC                     1
 #define _APS_NEXT_RESOURCE_VALUE        123
 #define _APS_NEXT_COMMAND_VALUE         52031
-#define _APS_NEXT_CONTROL_VALUE         2527
+#define _APS_NEXT_CONTROL_VALUE         2529
 #define _APS_NEXT_SYMED_VALUE           101
 #endif
 #endif

Modified: trunk/teraterm/common/tttypes.h
===================================================================
--- trunk/teraterm/common/tttypes.h	2012-05-12 16:31:18 UTC (rev 4941)
+++ trunk/teraterm/common/tttypes.h	2012-05-13 12:59:07 UTC (rev 4942)
@@ -556,6 +556,7 @@
 	WORD KermitOpt;
 	WORD FontQuality;
 	char ScpSendDir[MAXPATHLEN];
+	char BGImageFilePath[MAX_PATH];
 };
 
 typedef struct tttset TTTSet, *PTTSet;
@@ -1014,6 +1015,7 @@
  * - At version 4.74, ttset_memfilemap was replaced with ttset_memfilemap_19.
  *   added tttset.FontQuality
  *   added tttset.ScpSenDir
+ *   added tttset.BGImageFilePath
  *
  * - At version 4.73, ttset_memfilemap was replaced with ttset_memfilemap_18.
  *   added tttset.LogLockExclusive

Modified: trunk/teraterm/teraterm/addsetting.cpp
===================================================================
--- trunk/teraterm/teraterm/addsetting.cpp	2012-05-12 16:31:18 UTC (rev 4941)
+++ trunk/teraterm/teraterm/addsetting.cpp	2012-05-13 12:59:07 UTC (rev 4942)
@@ -770,6 +770,9 @@
 		SendDlgItemMessage(IDC_ENABLE_URL_COLOR, WM_SETFONT, (WPARAM)DlgVisualFont, MAKELPARAM(TRUE,0));
 		SendDlgItemMessage(IDC_ENABLE_ANSI_COLOR, WM_SETFONT, (WPARAM)DlgVisualFont, MAKELPARAM(TRUE,0));
 		SendDlgItemMessage(IDC_URL_UNDERLINE, WM_SETFONT, (WPARAM)DlgVisualFont, MAKELPARAM(TRUE,0));
+		SendDlgItemMessage(IDC_BGIMG_LABEL, WM_SETFONT, (WPARAM)DlgVisualFont, MAKELPARAM(TRUE,0));
+		SendDlgItemMessage(IDC_BGIMG_EDIT, WM_SETFONT, (WPARAM)DlgVisualFont, MAKELPARAM(TRUE,0));
+		SendDlgItemMessage(IDC_BGIMG_BUTTON, WM_SETFONT, (WPARAM)DlgVisualFont, MAKELPARAM(TRUE,0));
 	}
 	else {
 		DlgVisualFont = NULL;
@@ -832,6 +835,18 @@
 	btn = (CButton *)GetDlgItem(IDC_ETERM_LOOKFEEL);
 	btn->SetCheck(ts.EtermLookfeel.BGEnable);
 
+	// Eterm look-feel\x82̔w\x8Ci\x89摜\x8Ew\x92\xE8\x81B
+	SetDlgItemText(IDC_BGIMG_EDIT, ts.BGImageFilePath);
+	if (ts.EtermLookfeel.BGEnable) {
+		GetDlgItem(IDC_BGIMG_LABEL)->EnableWindow(TRUE);
+		GetDlgItem(IDC_BGIMG_EDIT)->EnableWindow(TRUE);
+		GetDlgItem(IDC_BGIMG_BUTTON)->EnableWindow(TRUE);
+	} else {
+		GetDlgItem(IDC_BGIMG_LABEL)->EnableWindow(FALSE);
+		GetDlgItem(IDC_BGIMG_EDIT)->EnableWindow(FALSE);
+		GetDlgItem(IDC_BGIMG_BUTTON)->EnableWindow(FALSE);
+	}
+
 	// (3)Mouse cursor type
 	listbox = (CListBox *)GetDlgItem(IDC_MOUSE_CURSOR);
 	for (i = 0 ; MouseCursor[i].name ; i++) {
@@ -904,8 +919,38 @@
 	CListBox *listbox;
 	int sel;
 	char buf[MAXPATHLEN];
+	CButton *btn;
 
 	switch (wParam) {
+		case IDC_ETERM_LOOKFEEL:
+			// \x83`\x83F\x83b\x83N\x82\xB3\x82ꂽ\x82\xE7 Enable/Disable \x82\xF0\x83g\x83O\x83\x8B\x82\xB7\x82\xE9\x81B
+			btn = (CButton *)GetDlgItem(IDC_ETERM_LOOKFEEL);
+			if (btn->GetCheck()) {
+				GetDlgItem(IDC_BGIMG_LABEL)->EnableWindow(TRUE);
+				GetDlgItem(IDC_BGIMG_EDIT)->EnableWindow(TRUE);
+				GetDlgItem(IDC_BGIMG_BUTTON)->EnableWindow(TRUE);
+			} else {
+				GetDlgItem(IDC_BGIMG_LABEL)->EnableWindow(FALSE);
+				GetDlgItem(IDC_BGIMG_EDIT)->EnableWindow(FALSE);
+				GetDlgItem(IDC_BGIMG_BUTTON)->EnableWindow(FALSE);
+				// \x96\xB3\x8C\x{27B0B3}\x82ꂽ\x82\xE7\x81ABGThemeFile \x82\xF0\x8C\xB3\x82ɖ߂\xB7\x81B
+				strncpy_s(ts.EtermLookfeel.BGThemeFile, BG_THEME_IMAGEFILE_DEFAULT, sizeof(ts.EtermLookfeel.BGThemeFile));
+			}
+			return TRUE;
+
+		case IDC_BGIMG_BUTTON | (BN_CLICKED << 16):
+			// \x94w\x8Ci\x89摜\x82\xF0\x83_\x83C\x83A\x83\x8D\x83O\x82Ŏw\x92肷\x82\xE9\x81B
+			{
+				CString         filter("Image Files(*.jpg;*.jpeg;*.bmp)|*.jpg;*.jpeg;*.bmp|All Files(*.*)|*.*||");
+				CFileDialog     selDlg(TRUE, NULL, NULL, OFN_HIDEREADONLY, filter);
+				if (selDlg.DoModal() == IDOK) {
+					// \x94w\x8Ci\x89摜\x8Ew\x92肪\x88Ӑ}\x93I\x82ɍs\x82\xED\x82ꂽ\x82\xE7\x81ABGThemeFile \x82\xF0\x8CŒ艻\x82\xB7\x82\xE9\x81B
+					SetDlgItemText(IDC_BGIMG_EDIT, selDlg.GetPathName());
+					strncpy_s(ts.EtermLookfeel.BGThemeFile, BG_THEME_IMAGEFILE, sizeof(ts.EtermLookfeel.BGThemeFile));
+				}
+			}
+			return TRUE;
+
 		case IDC_ANSI_COLOR | (LBN_SELCHANGE << 16):
 			listbox = (CListBox *)GetDlgItem(IDC_ANSI_COLOR);
 			sel = listbox->GetCurSel();
@@ -1024,6 +1069,10 @@
 		ts.EtermLookfeel.BGEnable = btn->GetCheck();
 	}
 
+	if (ts.EtermLookfeel.BGEnable) {
+		GetDlgItemText(IDC_BGIMG_EDIT, ts.BGImageFilePath, sizeof(ts.BGImageFilePath));
+	}
+
 	// (3)
 	listbox = (CListBox *)GetDlgItem(IDC_MOUSE_CURSOR);
 	sel = listbox->GetCurSel();

Modified: trunk/teraterm/teraterm/ttermpro.rc
===================================================================
--- trunk/teraterm/teraterm/ttermpro.rc	2012-05-12 16:31:18 UTC (rev 4941)
+++ trunk/teraterm/teraterm/ttermpro.rc	2012-05-13 12:59:07 UTC (rev 4942)
@@ -117,8 +117,8 @@
     CONTROL         "&Eterm lookfeel",IDC_ETERM_LOOKFEEL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,116,8,72,12
     LTEXT           "&Mouse cursor",IDC_MOUSE,10,26,70,8
     LISTBOX         IDC_MOUSE_CURSOR,10,36,48,35,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
-    LTEXT           "&Font Quality",IDC_FONT_QUALITY_LABEL,100,26,70,8
-    COMBOBOX        IDC_FONT_QUALITY,100,36,80,52,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+    LTEXT           "&Font Quality",IDC_FONT_QUALITY_LABEL,100,51,70,8
+    COMBOBOX        IDC_FONT_QUALITY,100,61,80,52,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
     LTEXT           "ANSI color",IDC_ANSICOLOR,10,78,43,8
     LISTBOX         IDC_ANSI_COLOR,10,88,28,51,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
     LTEXT           "&Red",IDC_RED,45,91,22,8
@@ -138,6 +138,9 @@
                     "Button",BS_AUTOCHECKBOX | WS_TABSTOP,125,114,105,12
     CONTROL         "Enable A&NSI color",IDC_ENABLE_ANSI_COLOR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,125,126,105,12
     CONTROL         "Un&derline URL string",IDC_URL_UNDERLINE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,125,138,105,12
+    LTEXT           "Background Image",IDC_BGIMG_LABEL,100,22,60,8
+    EDITTEXT        IDC_BGIMG_EDIT,98,31,108,14,ES_AUTOHSCROLL
+    PUSHBUTTON      "...",IDC_BGIMG_BUTTON,213,30,14,14
 END
 
 IDD_TABSHEET_LOG DIALOGEX 0, 0, 242, 158

Modified: trunk/teraterm/teraterm/vtdisp.c
===================================================================
--- trunk/teraterm/teraterm/vtdisp.c	2012-05-12 16:31:18 UTC (rev 4941)
+++ trunk/teraterm/teraterm/vtdisp.c	2012-05-13 12:59:07 UTC (rev 4942)
@@ -112,8 +112,6 @@
 #include <stdio.h>
 #include <time.h>
 
-#define BG_SECTION "BG"
-
 typedef enum _BG_TYPE    {BG_COLOR = 0,BG_PICTURE,BG_WALLPAPER} BG_TYPE;
 typedef enum _BG_PATTERN {BG_STRETCH = 0,BG_TILE,BG_CENTER,BG_FIT_WIDTH,BG_FIT_HEIGHT,BG_AUTOFIT,BG_AUTOFILL} BG_PATTERN;
 
@@ -1388,7 +1386,7 @@
   BGDest.antiAlias = BGGetOnOff("BGDestAntiAlias",BGDest.antiAlias,file);
   BGDest.color     = BGGetColor("BGDestColor",BGDest.color,file);
 
-  GetPrivateProfileString(BG_SECTION,"BGDestFile",BGDest.file,path,MAX_PATH,file);
+  GetPrivateProfileString(BG_SECTION, BG_DESTFILE, BGDest.file,path,MAX_PATH,file);
   RandomFile(path,BGDest.file,sizeof(BGDest.file));
 
   //\x82\xBB\x82̑\xBC\x93ǂݏo\x82\xB5
@@ -1462,9 +1460,17 @@
   strncpy_s(ts.EtermLookfeel.BGSPIPath, sizeof(ts.EtermLookfeel.BGSPIPath), BGSPIPath, _TRUNCATE);
 
   //\x83R\x83\x93\x83t\x83B\x83O\x83t\x83@\x83C\x83\x8B\x82̌\x88\x92\xE8
-  GetPrivateProfileString(BG_SECTION,"BGThemeFile","",path,MAX_PATH,ts.SetupFName);
-  strncpy_s(ts.EtermLookfeel.BGThemeFile, sizeof(ts.EtermLookfeel.BGThemeFile), path, _TRUNCATE);
+  if (ts.EtermLookfeel.BGThemeFile[0] == '\0') {
+	  // \x8B\xF3\x82̏ꍇ\x82̂݁A\x83f\x83B\x83X\x83N\x82\xA9\x82\xE7\x93ǂށBBGInitialize()\x82\xAA Tera Term \x8BN\x93\xAE\x8E\x9E\x88ȊO\x82ɂ\xE0\x81A
+	  // Additional settings \x82\xA9\x82\xE7\x8CĂяo\x82\xB3\x82\xEA\x82邱\x82Ƃ\xAA\x82\xA0\x82邽\x82߁B
+	  GetPrivateProfileString(BG_SECTION,"BGThemeFile","",path,MAX_PATH,ts.SetupFName);
+	  strncpy_s(ts.EtermLookfeel.BGThemeFile, sizeof(ts.EtermLookfeel.BGThemeFile), path, _TRUNCATE);
+  }
 
+  // \x94w\x8Ci\x89摜\x82̓ǂݍ\x9E\x82\xDD
+  _snprintf_s(path, sizeof(path), _TRUNCATE, "%s\\%s", ts.HomeDir, BG_THEME_IMAGEFILE);
+  GetPrivateProfileString(BG_SECTION, BG_DESTFILE, "", ts.BGImageFilePath, sizeof(ts.BGImageFilePath), path);
+
   if(!BGEnable)
     return;
 

Modified: trunk/teraterm/ttpset/ttset.c
===================================================================
--- trunk/teraterm/ttpset/ttset.c	2012-05-12 16:31:18 UTC (rev 4941)
+++ trunk/teraterm/ttpset/ttset.c	2012-05-13 12:59:07 UTC (rev 4942)
@@ -2378,7 +2378,7 @@
 	WritePrivateProfileString(NULL, NULL, NULL, FName);
 
 	// Eterm lookfeel alphablend (2005.4.24 yutaka)
-#define ETERM_SECTION "BG"
+#define ETERM_SECTION BG_SECTION
 	WriteOnOff(ETERM_SECTION, "BGEnable", FName,
 	           ts->EtermLookfeel.BGEnable);
 	WriteOnOff(ETERM_SECTION, "BGUseAlphaBlendAPI", FName,
@@ -2393,6 +2393,8 @@
 	           ts->EtermLookfeel.BGNoFrame);
 	WritePrivateProfileString(ETERM_SECTION, "BGThemeFile",
 	                          ts->EtermLookfeel.BGThemeFile, FName);
+	_snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%s\\%s", ts->HomeDir, BG_THEME_IMAGEFILE);
+	WritePrivateProfileString(BG_SECTION, BG_DESTFILE, ts->BGImageFilePath, Temp);
 
 #ifdef USE_NORMAL_BGCOLOR
 	// UseNormalBGColor



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