• R/O
  • SSH
  • HTTPS

ttssh2: Commit


Commit MetaInfo

Revision10373 (tree)
Time2022-11-20 23:18:21
Authorzmatsuo

Log Message

通知サウンド設定追加

- 通知サウンドenable/disable追加
- 通知テストボタン追加

Change Summary

Incremental Difference

--- trunk/doc/en/html/menu/setup-additional.html (revision 10372)
+++ trunk/doc/en/html/menu/setup-additional.html (revision 10373)
@@ -91,7 +91,20 @@
9191 </dd>
9292 </dl>
9393
94+ <h3>Notification</h3>
9495
96+ Notification area(it was called the Task Tray before Windows XP) settings.
97+
98+ Now (r10371), only ttxssh.dll uses notification.
99+
100+ <dl>
101+ <dt id="NotifySound">Notify sound</dt>
102+ <dd>Notification sound(sound can be muted in Windows XP and later)</dd>
103+
104+ <dt>Test button</dt>
105+ <dd>Test Notification</dd>
106+ </dl>
107+
95108 <h2 id="TabControlSequence">"Control Sequence" Tab</h2>
96109 <dl>
97110 <dt id="MouseEventTracking">Accept mouse event tracking</dt>
--- trunk/doc/en/html/setup/teraterm-ini.html (revision 10372)
+++ trunk/doc/en/html/setup/teraterm-ini.html (revision 10373)
@@ -944,6 +944,12 @@
944944 <td></td>
945945 </tr>
946946 <tr>
947+ <td id="NotifySound"><a href="../menu/setup-additional.html#NotifySound">NotifySound</a></td>
948+ <td style="width:250px;">on</td>
949+ <td style="width:250px;">&lt;-</td>
950+ <td></td>
951+ </tr>
952+ <tr>
947953 <td id="Parity"><a href="../menu/setup-serialport.html#Speed">Parity</a></td>
948954 <td style="width:250px;">none</td>
949955 <td style="width:250px;">&lt;-</td>
--- trunk/doc/ja/html/menu/setup-additional.html (revision 10372)
+++ trunk/doc/ja/html/menu/setup-additional.html (revision 10373)
@@ -90,7 +90,20 @@
9090 </dd>
9191 </dl>
9292
93+ <h3>Notification</h3>
9394
95+ 通知領域(Windows XP以前はタスクトレイと呼ばれていました)の設定。
96+
97+ 現時点で(r10371)で通知を利用しているのはttxssh.dllのみです。
98+
99+ <dl>
100+ <dt id="NotifySound">Notify sound</dt>
101+ <dd>通知音を許可する(Windows XP以降は音を消すことができます)</dd>
102+
103+ <dt>Test button</dt>
104+ <dd>通知のテストを行う</dd>
105+ </dl>
106+
94107 <h2 id="TabControlSequence">"Control Sequence" タブ</h2>
95108 <dl>
96109 <dt id="MouseEventTracking">Accept mouse event tracking</dt>
--- trunk/doc/ja/html/setup/teraterm-ini.html (revision 10372)
+++ trunk/doc/ja/html/setup/teraterm-ini.html (revision 10373)
@@ -950,6 +950,12 @@
950950 <td></td>
951951 </tr>
952952 <tr>
953+ <td id="NotifySound"><a href="../menu/setup-additional.html#NotifySound">NotifySound</a></td>
954+ <td style="width:250px;">on</td>
955+ <td style="width:250px;">&lt;-</td>
956+ <td></td>
957+ </tr>
958+ <tr>
953959 <td id="Parity"><a href="../menu/setup-serialport.html#Speed">Parity</a></td>
954960 <td style="width:250px;">none</td>
955961 <td style="width:250px;">&lt;-</td>
--- trunk/teraterm/common/tt_res.h (revision 10372)
+++ trunk/teraterm/common/tt_res.h (revision 10373)
@@ -233,6 +233,9 @@
233233 #define IDC_DISABLE_PRINT_START 2614
234234 #define IDC_BEEP_LABEL 2615
235235 #define IDC_BEEP_DROPDOWN 2616
236+#define IDC_NOTIFICATION_TITLE 2617
237+#define IDC_NOTIFY_SOUND 2618
238+#define IDC_NOTIFICATION_TEST 2619
236239 #define ID_ACC_SENDBREAK 50001
237240 #define ID_ACC_COPY 50002
238241 #define ID_ACC_NEWCONNECTION 50003
@@ -332,7 +335,7 @@
332335 #define _APS_NO_MFC 1
333336 #define _APS_NEXT_RESOURCE_VALUE 132
334337 #define _APS_NEXT_COMMAND_VALUE 52031
335-#define _APS_NEXT_CONTROL_VALUE 2614
338+#define _APS_NEXT_CONTROL_VALUE 2620
336339 #define _APS_NEXT_SYMED_VALUE 101
337340 #endif
338341 #endif
--- trunk/teraterm/common/tttypes.h (revision 10372)
+++ trunk/teraterm/common/tttypes.h (revision 10373)
@@ -614,6 +614,7 @@
614614 HINSTANCE TeraTermInstance;
615615 WORD WindowCornerDontround;
616616 wchar_t DialogFontNameW[LF_FACESIZE];
617+ BOOL NotifySound;
617618
618619 // Experimental
619620 BYTE ExperimentalTreeProprtySheetEnable;
--- trunk/teraterm/teraterm/addsetting.cpp (revision 10372)
+++ trunk/teraterm/teraterm/addsetting.cpp (revision 10373)
@@ -42,6 +42,7 @@
4242 #include "teraterm.h"
4343 #include "tttypes.h"
4444 #include "ttwinman.h" // for ts
45+#define TTCMN_NOTIFY_INTERNAL
4546 #include "ttcommon.h"
4647 #include "dlglib.h"
4748 #include "compat_win.h"
@@ -69,6 +70,20 @@
6970
7071 // CGeneralPropPageDlg ダイアログ
7172
73+// General Page
74+class CGeneralPropPageDlg : public TTCPropertyPage
75+{
76+public:
77+ CGeneralPropPageDlg(HINSTANCE inst);
78+ virtual ~CGeneralPropPageDlg();
79+private:
80+ void OnInitDialog();
81+ void OnOK();
82+ enum { IDD = IDD_TABSHEET_GENERAL };
83+ void OnHelp();
84+ BOOL OnCommand(WPARAM wParam, LPARAM lParam);
85+};
86+
7287 CGeneralPropPageDlg::CGeneralPropPageDlg(HINSTANCE inst)
7388 : TTCPropertyPage(inst, CGeneralPropPageDlg::IDD)
7489 {
@@ -105,7 +120,10 @@
105120 { IDC_TITLEFMT_DISPVTTEK, "DLG_TAB_GENERAL_TITLEFMT_DISPVTTEK" },
106121 { IDC_TITLEFMT_SWAPHOSTTITLE, "DLG_TAB_GENERAL_TITLEFMT_SWAPHOSTTITLE" },
107122 { IDC_TITLEFMT_DISPTCPPORT, "DLG_TAB_GENERAL_TITLEFMT_DISPTCPPORT" },
108- { IDC_TITLEFMT_DISPSERIALSPEED, "DLG_TAB_GENERAL_TITLEFMT_DISPSERIALSPEED" }
123+ { IDC_TITLEFMT_DISPSERIALSPEED, "DLG_TAB_GENERAL_TITLEFMT_DISPSERIALSPEED" },
124+ { IDC_NOTIFICATION_TITLE, "DLG_TAB_GENERAL_NOTIFICATION_TITLE" },
125+ { IDC_NOTIFY_SOUND, "DLG_TAB_GENERAL_NOTIFIY_SOUND" },
126+ { IDC_NOTIFICATION_TEST, "DLG_TAB_GENERAL_NOTIFICATION_TEST" },
109127 };
110128 SetDlgTextsW(m_hWnd, TextInfos, _countof(TextInfos), ts.UILanguageFileW);
111129
@@ -141,6 +159,9 @@
141159 SetCheck(IDC_TITLEFMT_DISPTCPPORT, (ts.TitleFormat & (1<<4)) != 0);
142160 SetCheck(IDC_TITLEFMT_DISPSERIALSPEED, (ts.TitleFormat & (1<<5)) != 0);
143161
162+ // Notify
163+ SetCheck(IDC_NOTIFY_SOUND, ts.NotifySound);
164+
144165 // ダイアログにフォーカスを当てる (2004.12.7 yutaka)
145166 ::SetFocus(::GetDlgItem(GetSafeHwnd(), IDC_CLICKABLE_URL));
146167 }
@@ -188,6 +209,16 @@
188209 ts.TitleFormat |= (GetCheck(IDC_TITLEFMT_SWAPHOSTTITLE) == BST_CHECKED) << 3;
189210 ts.TitleFormat |= (GetCheck(IDC_TITLEFMT_DISPTCPPORT) == BST_CHECKED) << 4;
190211 ts.TitleFormat |= (GetCheck(IDC_TITLEFMT_DISPSERIALSPEED) == BST_CHECKED) << 5;
212+
213+ // Notify
214+ {
215+ BOOL notify_sound = (BOOL)GetCheck(IDC_NOTIFY_SOUND);
216+ if (notify_sound != ts.NotifySound) {
217+ PComVar pcv = &cv;
218+ ts.NotifySound = notify_sound;
219+ NotifySetSound(pcv, notify_sound);
220+ }
221+ }
191222 }
192223
193224 void CGeneralPropPageDlg::OnHelp()
@@ -195,6 +226,25 @@
195226 PostMessage(HVTWin, WM_USER_DLGHELP2, HlpMenuSetupAdditional, 0);
196227 }
197228
229+BOOL CGeneralPropPageDlg::OnCommand(WPARAM wParam, LPARAM lParam)
230+{
231+ switch (wParam) {
232+ case IDC_NOTIFICATION_TEST | (BN_CLICKED << 16): {
233+ PComVar pcv = &cv;
234+ wchar_t *msg = L"Test button was pushed";
235+ BOOL prev_sound = NotifyGetSound(pcv);
236+ BOOL notify_sound = (BOOL)GetCheck(IDC_NOTIFY_SOUND);
237+ NotifySetSound(pcv, notify_sound);
238+ NotifyMessageW(pcv, msg, NULL, 1);
239+ NotifySetSound(pcv, prev_sound);
240+ break;
241+ }
242+ default:
243+ break;
244+ }
245+ return TTCPropertyPage::OnCommand(wParam, lParam);
246+}
247+
198248 // CSequencePropPageDlg ダイアログ
199249
200250 CSequencePropPageDlg::CSequencePropPageDlg(HINSTANCE inst)
@@ -847,7 +897,7 @@
847897 case SB_PAGEUP:
848898 case SB_THUMBPOSITION:
849899 case SB_THUMBTRACK:
850- pos = SendDlgItemMessage(IDC_ALPHA_BLEND_ACTIVE_TRACKBAR, TBM_GETPOS, NULL, NULL);
900+ pos = (int)SendDlgItemMessage(IDC_ALPHA_BLEND_ACTIVE_TRACKBAR, TBM_GETPOS, NULL, NULL);
851901 SetDlgItemNum(IDC_ALPHA_BLEND_ACTIVE, pos);
852902 break;
853903 case SB_ENDSCROLL:
@@ -865,7 +915,7 @@
865915 case SB_PAGEUP:
866916 case SB_THUMBPOSITION:
867917 case SB_THUMBTRACK:
868- pos = SendDlgItemMessage(IDC_ALPHA_BLEND_INACTIVE_TRACKBAR, TBM_GETPOS, NULL, NULL);
918+ pos = (int)SendDlgItemMessage(IDC_ALPHA_BLEND_INACTIVE_TRACKBAR, TBM_GETPOS, NULL, NULL);
869919 SetDlgItemNum(IDC_ALPHA_BLEND_INACTIVE, pos);
870920 break;
871921 case SB_ENDSCROLL:
@@ -895,8 +945,6 @@
895945
896946 BOOL CVisualPropPageDlg::OnCommand(WPARAM wParam, LPARAM lParam)
897947 {
898- int sel;
899-
900948 switch (wParam) {
901949 case IDC_THEME_EDITOR_BUTTON | (BN_CLICKED << 16): {
902950 ThemeDialog(m_hInst, m_hWnd, &cv);
@@ -944,13 +992,14 @@
944992 return TRUE;
945993 }
946994
947- case IDC_ANSI_COLOR | (LBN_SELCHANGE << 16):
948- sel = SendDlgItemMessage(IDC_ANSI_COLOR, LB_GETCURSEL, 0, 0);
995+ case IDC_ANSI_COLOR | (LBN_SELCHANGE << 16): {
996+ int sel = (int)SendDlgItemMessage(IDC_ANSI_COLOR, LB_GETCURSEL, 0, 0);
949997 if (sel != -1) {
950998 SetupRGBbox(sel);
951999 ::InvalidateRect(GetDlgItem(IDC_SAMPLE_COLOR), NULL, TRUE);
9521000 }
9531001 return TRUE;
1002+ }
9541003
9551004 case IDC_COLOR_RED | (EN_CHANGE << 16) :
9561005 case IDC_COLOR_GREEN | (EN_CHANGE << 16) :
@@ -957,6 +1006,7 @@
9571006 case IDC_COLOR_BLUE | (EN_CHANGE << 16) :
9581007 {
9591008 int r, g, b;
1009+ int sel;
9601010
9611011 sel = GetCurSel(IDC_ANSI_COLOR);
9621012 if (sel < 0 || sel > _countof(ANSIColor)-1) {
--- trunk/teraterm/teraterm/addsetting.h (revision 10372)
+++ trunk/teraterm/teraterm/addsetting.h (revision 10373)
@@ -41,19 +41,6 @@
4141
4242 extern const mouse_cursor_t MouseCursor[];
4343
44-// General Page
45-class CGeneralPropPageDlg : public TTCPropertyPage
46-{
47-public:
48- CGeneralPropPageDlg(HINSTANCE inst);
49- virtual ~CGeneralPropPageDlg();
50-private:
51- void OnInitDialog();
52- void OnOK();
53- enum { IDD = IDD_TABSHEET_GENERAL };
54- void OnHelp();
55-};
56-
5744 // Control Sequence Page
5845 class CSequencePropPageDlg : public TTCPropertyPage
5946 {
--- trunk/teraterm/teraterm/vtwin.cpp (revision 10372)
+++ trunk/teraterm/teraterm/vtwin.cpp (revision 10373)
@@ -438,6 +438,7 @@
438438 // 通知領域初期化
439439 NotifyInitialize(&cv);
440440 NotifySetWindow(&cv, m_hWnd, WM_USER_NOTIFYICON, m_hInst, (ts.VTIcon != IdIconDefault) ? ts.VTIcon: IDI_VT);
441+ NotifySetSound(&cv, ts.NotifySound);
441442
442443 // VT ウィンドウのアイコン
443444 SetVTIconID(&cv, NULL, 0);
--- trunk/teraterm/ttpcmn/ttcmn_notify.cpp (revision 10372)
+++ trunk/teraterm/ttpcmn/ttcmn_notify.cpp (revision 10373)
@@ -126,9 +126,10 @@
126126 /**
127127 *
128128 * @param flag NOTIFYICONDATA.dwInfoFlags
129- * 1 information icon
130- * 2 warning icon
131- * 3 error icon
129+ * 1 information icon (NIIF_INFO)
130+ * 2 warning icon (NIIF_WARNING)
131+ * 3 error icon (NIIF_ERROR)
132+ * 0x10 (NIIF_NOSOUND) XP+
132133 */
133134 static void NotifySetMessageW(NotifyIcon *ni, const wchar_t *msg, const wchar_t *title, DWORD flag)
134135 {
@@ -144,6 +145,7 @@
144145 }
145146
146147 if (ni->no_sound) {
148+ // shell32.dll 6.00(XP)+
147149 flag |= NIIF_NOSOUND;
148150 }
149151
@@ -236,6 +238,16 @@
236238 free(ni);
237239 }
238240
241+static void NotifySetSound(NotifyIcon *ni, BOOL sound)
242+{
243+ ni->no_sound = sound == FALSE ? TRUE : FALSE;
244+}
245+
246+static BOOL NotifyGetSound(NotifyIcon *ni)
247+{
248+ return ni->no_sound;
249+}
250+
239251 static NotifyIcon *GetNotifyData(PComVar cv)
240252 {
241253 assert(cv != NULL);
@@ -268,6 +280,18 @@
268280 free(msgW);
269281 }
270282
283+DllExport void NotifySetSound(PComVar cv, BOOL sound)
284+{
285+ NotifyIcon *ni = GetNotifyData(cv);
286+ NotifySetSound(ni, sound);
287+}
288+
289+DllExport BOOL NotifyGetSound(PComVar cv)
290+{
291+ NotifyIcon *ni = GetNotifyData(cv);
292+ return NotifyGetSound(ni);
293+}
294+
271295 /**
272296 * 通知領域初期化
273297 *
--- trunk/teraterm/ttpcmn/ttcmn_notify.h (revision 10372)
+++ trunk/teraterm/ttpcmn/ttcmn_notify.h (revision 10373)
@@ -45,6 +45,8 @@
4545 DllExport void WINAPI NotifySetWindow(PComVar cv, HWND hWnd, UINT msg, HINSTANCE hInstance, WORD IconID);
4646 DllExport void WINAPI NotifyUnsetWindow(PComVar cv);
4747 DllExport void WINAPI NotifyHideIcon(PComVar cv);
48+DllExport void NotifySetSound(PComVar cv, BOOL sound);
49+DllExport BOOL NotifyGetSound(PComVar cv);
4850 #endif
4951
5052 // plugin からも使用可能なIF
--- trunk/teraterm/ttpset/ttset.c (revision 10372)
+++ trunk/teraterm/ttpset/ttset.c (revision 10373)
@@ -2031,6 +2031,9 @@
20312031 // rounded corner preference for VT/TEK window
20322032 ts->WindowCornerDontround = GetOnOff(Section, "WindowCornerDontround", FName, FALSE);
20332033
2034+ // 通知音
2035+ ts->NotifySound = GetOnOff(Section, "NotifySound", FName, TRUE);
2036+
20342037 // Experimental
20352038 ts->ExperimentalTreeProprtySheetEnable = GetOnOff("Experimental", "TreeProprtySheet", FName, FALSE);
20362039 ts->ExperimentalDontUseFontDialog = GetOnOff("Experimental", "DontUseFontDialog", FName, FALSE);
@@ -3243,8 +3246,11 @@
32433246 WriteOnOff(Section, "UnicodeEmojiOverride", FName, ts->UnicodeEmojiOverride);
32443247 WriteInt(Section, "UnicodeEmojiWidth", FName, ts->UnicodeEmojiWidth);
32453248
3246- // // rounded corner preference for VT/TEK window
3249+ // rounded corner preference for VT/TEK window
32473250 WriteOnOff(Section, "WindowCornerDontround", FName, ts->WindowCornerDontround);
3251+
3252+ // 通知音
3253+ WriteOnOff(Section, "NotifySound", FName, ts->NotifySound);
32483254 }
32493255
32503256 void PASCAL _CopySerialList(const wchar_t *IniSrc, const wchar_t *IniDest, const wchar_t *section,
Show on old repository browser