• R/O
  • SSH
  • HTTPS

ttssh2: Commit


Commit MetaInfo

Revision8367 (tree)
Time2019-11-09 00:39:57
Authorzmatsuo

Log Message

その他の設定に debug proparty page を追加

- コードポップアップのenable/keyの設定
- デバグ用コンソールウィンドウを表示するボタン

Change Summary

Incremental Difference

--- branches/unicode_buf/teraterm/common/tt_res.h (revision 8366)
+++ branches/unicode_buf/teraterm/common/tt_res.h (revision 8367)
@@ -1,6 +1,6 @@
11 //{{NO_DEPENDENCIES}}
2-// Microsoft Visual C++ generated include file.
3-// Used by ttermpro.rc
2+// Microsoft Visual C++ で生成されたインクルード ファイル。
3+// C:\work\teraterm\git\teraterm\teraterm\teraterm\debugpropartypage.rc で使用
44 //
55 #define IDI_TTERM 100
66 #define IDR_ACC 100
@@ -25,6 +25,7 @@
2525 #define IDD_SETUP_DIR_DIALOG 123
2626 #define IDI_TTERM_3D 124
2727 #define IDI_VT_3D 125
28+#define IDD_TABSHEET_DEBUG 126
2829 #define IDR_TEKMENU 1000
2930 #define IDC_EDIT_COMMENT 1000
3031 #define IDC_EDIT_FULLPATH 1001
@@ -240,6 +241,10 @@
240241 #define IDC_DAD_NOTE 2588
241242 #define IDC_SELECT_ON_ACTIVATE 2589
242243 #define IDC_MIXED_THEME_FILE 2590
244+#define IDC_DEBUG_POPUP_ENABLE 2591
245+#define IDC_DEBUG_POPUP_KEY1 2592
246+#define IDC_DEBUG_POPUP_KEY2 2593
247+#define IDC_DEBUG_CONSOLE_BUTTON 2594
243248 #define ID_ACC_SENDBREAK 50001
244249 #define ID_ACC_COPY 50002
245250 #define ID_ACC_NEWCONNECTION 50003
@@ -336,9 +341,9 @@
336341 #ifdef APSTUDIO_INVOKED
337342 #ifndef APSTUDIO_READONLY_SYMBOLS
338343 #define _APS_NO_MFC 1
339-#define _APS_NEXT_RESOURCE_VALUE 126
344+#define _APS_NEXT_RESOURCE_VALUE 127
340345 #define _APS_NEXT_COMMAND_VALUE 52031
341-#define _APS_NEXT_CONTROL_VALUE 2591
346+#define _APS_NEXT_CONTROL_VALUE 2594
342347 #define _APS_NEXT_SYMED_VALUE 101
343348 #endif
344349 #endif
--- branches/unicode_buf/teraterm/teraterm/CMakeLists.txt (revision 8366)
+++ branches/unicode_buf/teraterm/teraterm/CMakeLists.txt (revision 8367)
@@ -95,6 +95,9 @@
9595 ftdlg_lite.cpp
9696 clipboarddlg.h
9797 clipboarddlg.cpp
98+ debug_pp.cpp
99+ debug_pp.h
100+ debug_pp.rc
98101 )
99102
100103 target_sources(
--- branches/unicode_buf/teraterm/teraterm/addsetting.cpp (revision 8366)
+++ branches/unicode_buf/teraterm/teraterm/addsetting.cpp (revision 8367)
@@ -49,6 +49,7 @@
4949 #include "compat_win.h"
5050 #include "helpid.h"
5151 #include "addsetting.h"
52+#include "debug_pp.h"
5253
5354 #include "tipwin.h"
5455
@@ -1716,20 +1717,24 @@
17161717 HINSTANCE hInstance, HWND hParentWnd) :
17171718 TTCPropertySheet(hInstance, hParentWnd)
17181719 {
1719- m_GeneralPage = new CGeneralPropPageDlg(hInstance, this);
1720- m_SequencePage = new CSequencePropPageDlg(hInstance, this);
1721- m_CopypastePage = new CCopypastePropPageDlg(hInstance, this);
1722- m_VisualPage = new CVisualPropPageDlg(hInstance, this);
1723- m_LogPage = new CLogPropPageDlg(hInstance, this);
1724- m_CygwinPage = new CCygwinPropPageDlg(hInstance, this);
1720+ int i = 0;
1721+ m_Page[i++] = new CGeneralPropPageDlg(hInstance, this);
1722+ m_Page[i++] = new CSequencePropPageDlg(hInstance, this);
1723+ m_Page[i++] = new CCopypastePropPageDlg(hInstance, this);
1724+ m_Page[i++] = new CVisualPropPageDlg(hInstance, this);
1725+ m_Page[i++] = new CLogPropPageDlg(hInstance, this);
1726+ m_Page[i++] = new CCygwinPropPageDlg(hInstance, this);
1727+ if ((GetKeyState(VK_CONTROL) & 0x8000) != 0 ||
1728+ (GetKeyState(VK_SHIFT) & 0x8000) != 0 ) {
1729+ m_Page[i++] = new CDebugPropPage(hInstance, this);
1730+ }
1731+ m_PageCount = i;
17251732
1726- hPsp[0] = m_GeneralPage->CreatePropertySheetPage();
1727- hPsp[1] = m_SequencePage->CreatePropertySheetPage();
1728- hPsp[2] = m_CopypastePage->CreatePropertySheetPage();
1729- hPsp[3] = m_VisualPage->CreatePropertySheetPage();
1730- hPsp[4] = m_LogPage->CreatePropertySheetPage();
1731- hPsp[5] = m_CygwinPage->CreatePropertySheetPage();
1732- m_psh.nPages = 6;
1733+ for (i = 0; i < m_PageCount; i++) {
1734+ hPsp[i] = m_Page[i]->CreatePropertySheetPage();
1735+ }
1736+
1737+ m_psh.nPages = m_PageCount;
17331738 m_psh.phpage = hPsp;
17341739
17351740 wchar_t UIMsg[MAX_UIMSG];
@@ -1741,12 +1746,9 @@
17411746 CAddSettingPropSheetDlg::~CAddSettingPropSheetDlg()
17421747 {
17431748 free((void*)m_psh.pszCaption);
1744- delete m_GeneralPage;
1745- delete m_SequencePage;
1746- delete m_CopypastePage;
1747- delete m_VisualPage;
1748- delete m_LogPage;
1749- delete m_CygwinPage;
1749+ for (int i = 0; i < m_PageCount; i++) {
1750+ delete m_Page[i];
1751+ }
17501752 }
17511753
17521754 void CAddSettingPropSheetDlg::OnInitDialog()
--- branches/unicode_buf/teraterm/teraterm/addsetting.h (revision 8366)
+++ branches/unicode_buf/teraterm/teraterm/addsetting.h (revision 8367)
@@ -134,15 +134,11 @@
134134 public:
135135 CAddSettingPropSheetDlg(HINSTANCE hInstance, HWND hParentWnd);
136136 virtual ~CAddSettingPropSheetDlg();
137+
137138 private:
138139 void OnInitDialog();
139140
140- HPROPSHEETPAGE hPsp[6];
141-
142- CGeneralPropPageDlg *m_GeneralPage;
143- CSequencePropPageDlg *m_SequencePage;
144- CCopypastePropPageDlg *m_CopypastePage;
145- CVisualPropPageDlg *m_VisualPage;
146- CLogPropPageDlg *m_LogPage;
147- CCygwinPropPageDlg *m_CygwinPage;
141+ int m_PageCount;
142+ HPROPSHEETPAGE hPsp[7];
143+ TTCPropertyPage *m_Page[7];
148144 };
--- branches/unicode_buf/teraterm/teraterm/debug_pp.cpp (nonexistent)
+++ branches/unicode_buf/teraterm/teraterm/debug_pp.cpp (revision 8367)
@@ -0,0 +1,70 @@
1+
2+
3+/* debug property page */
4+
5+#include <stdio.h>
6+
7+#include "tmfc.h"
8+#include "tt_res.h"
9+#include "debug_pp.h"
10+#include "../common/tt_res.h"
11+#include "unicode_test.h"
12+#include "dlglib.h"
13+
14+CDebugPropPage::CDebugPropPage(HINSTANCE inst, TTCPropertySheet *sheet)
15+ : TTCPropertyPage(inst, IDD_TABSHEET_DEBUG, sheet)
16+{
17+}
18+
19+CDebugPropPage::~CDebugPropPage()
20+{
21+}
22+
23+static const struct {
24+ WORD key_code;
25+ const char *key_str;
26+} key_list[] = {
27+ {VK_CONTROL, "VT_CONTROL"},
28+ {VK_SHIFT, "VK_SHIFT"},
29+};
30+
31+void CDebugPropPage::OnInitDialog()
32+{
33+ SetCheck(IDC_DEBUG_POPUP_ENABLE, UnicodeDebugParam.CodePopupEnable);
34+ for (int i = 0; i < _countof(key_list); i++) {
35+ const char *key_str = key_list[i].key_str;
36+ SendDlgItemMessage(IDC_DEBUG_POPUP_KEY1, CB_ADDSTRING, 0, (LPARAM)key_list[i].key_str);
37+ SendDlgItemMessage(IDC_DEBUG_POPUP_KEY2, CB_ADDSTRING, 0, (LPARAM)key_list[i].key_str);
38+ if (UnicodeDebugParam.CodePopupKey1 == key_list[i].key_code) {
39+ SendDlgItemMessageA(IDC_DEBUG_POPUP_KEY1, CB_SETCURSEL, i, 0);
40+ }
41+ if (UnicodeDebugParam.CodePopupKey2 == key_list[i].key_code) {
42+ SendDlgItemMessageA(IDC_DEBUG_POPUP_KEY2, CB_SETCURSEL, i, 0);
43+ }
44+ }
45+}
46+
47+BOOL CDebugPropPage::OnCommand(WPARAM wParam, LPARAM lParam)
48+{
49+ switch (wParam) {
50+ case IDC_DEBUG_CONSOLE_BUTTON | (BN_CLICKED << 16): {
51+ FILE *fp;
52+ AllocConsole();
53+ freopen_s(&fp, "CONOUT$", "w", stdout);
54+ freopen_s(&fp, "CONOUT$", "w", stderr);
55+ break;
56+ }
57+ default:
58+ break;
59+ }
60+ return FALSE;
61+}
62+
63+void CDebugPropPage::OnOK()
64+{
65+ UnicodeDebugParam.CodePopupEnable = GetCheck(IDC_DEBUG_POPUP_ENABLE);
66+ int i = GetCurSel(IDC_DEBUG_POPUP_KEY1);
67+ UnicodeDebugParam.CodePopupKey1 = key_list[i].key_code;
68+ i = GetCurSel(IDC_DEBUG_POPUP_KEY2);
69+ UnicodeDebugParam.CodePopupKey2 = key_list[i].key_code;
70+}
--- branches/unicode_buf/teraterm/teraterm/debug_pp.h (nonexistent)
+++ branches/unicode_buf/teraterm/teraterm/debug_pp.h (revision 8367)
@@ -0,0 +1,14 @@
1+
2+
3+#include "tmfc.h"
4+
5+class CDebugPropPage : public TTCPropertyPage
6+{
7+public:
8+ CDebugPropPage(HINSTANCE inst, TTCPropertySheet *sheet);
9+ virtual ~CDebugPropPage();
10+private:
11+ void OnInitDialog();
12+ BOOL OnCommand(WPARAM wParam, LPARAM lParam);
13+ void OnOK();
14+};
--- branches/unicode_buf/teraterm/teraterm/teraterm.cpp (revision 8366)
+++ branches/unicode_buf/teraterm/teraterm/teraterm.cpp (revision 8367)
@@ -310,14 +310,6 @@
310310 #ifdef _DEBUG
311311 _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
312312 #endif
313-#if UNICODE_DEBUG
314- if (_access("teraterm_debug.txt", 0) == 0) {
315- FILE* fp;
316- AllocConsole();
317- freopen_s(&fp, "CONOUT$", "w", stdout);
318- freopen_s(&fp, "CONOUT$", "w", stderr);
319- }
320-#endif
321313
322314 init();
323315 hInst = hInstance;
--- branches/unicode_buf/teraterm/teraterm/unicode_test.h (revision 8366)
+++ branches/unicode_buf/teraterm/teraterm/unicode_test.h (revision 8367)
@@ -14,3 +14,23 @@
1414 #define UNICODE_API 1 // UNICODE APIを許可
1515 #define UNICODE_DEBUG 1 // デバグ用機能enable
1616 #define UNICODE_DEBUG_CARET_OFF 0 // カーソル点滅系を止めるデバグ用
17+
18+#ifdef __cplusplus
19+
20+class CUnicodeDebugParam
21+{
22+public:
23+ BOOL CodePopupEnable;
24+ WORD CodePopupKey1;
25+ WORD CodePopupKey2;
26+ CUnicodeDebugParam()
27+ {
28+ CodePopupEnable = FALSE;
29+ CodePopupKey1 = VK_CONTROL;
30+ CodePopupKey2 = VK_CONTROL;
31+ }
32+};
33+
34+extern CUnicodeDebugParam UnicodeDebugParam;
35+
36+#endif
--- branches/unicode_buf/teraterm/teraterm/vtwin.cpp (revision 8366)
+++ branches/unicode_buf/teraterm/teraterm/vtwin.cpp (revision 8367)
@@ -152,6 +152,10 @@
152152 #define WM_IME_COMPOSITION 0x010F
153153 #endif
154154
155+#if UNICODE_INTERNAL_BUFF
156+CUnicodeDebugParam UnicodeDebugParam;
157+#endif
158+
155159 /////////////////////////////////////////////////////////////////////////////
156160 // CVTWindow
157161
@@ -2139,20 +2143,27 @@
21392143 MSG M;
21402144
21412145 #if UNICODE_DEBUG
2142- if (nChar == VK_CONTROL) {
2146+ if (UnicodeDebugParam.CodePopupEnable)
2147+ {
21432148 const DWORD now = GetTickCount();
21442149 switch(CtrlKeyState) {
21452150 case 0:
2146- CtrlKeyDownTick = now;
2147- CtrlKeyState = 1;
2151+ if (nChar == UnicodeDebugParam.CodePopupKey1) {
2152+ CtrlKeyDownTick = now;
2153+ CtrlKeyState = 1;
2154+ }
21482155 break;
21492156 case 2:
2157+ if (nChar != UnicodeDebugParam.CodePopupKey2) {
2158+ CtrlKeyState = 0;
2159+ break;
2160+ }
21502161 if (now - CtrlKeyDownTick < 500 && TipWinCodeDebug == NULL) {
21512162 POINT pos;
21522163 GetCursorPos(&pos);
21532164 ScreenToClient(m_hWnd, &pos);
21542165 CodePopup(pos.x, pos.y);
2155- CtrlKeyState++;
2166+ CtrlKeyState = 3;
21562167 } else {
21572168 CtrlKeyDownTick = now;
21582169 CtrlKeyState = 1;
@@ -2164,8 +2175,6 @@
21642175 CtrlKeyState = 0;
21652176 break;
21662177 }
2167- } else {
2168- CtrlKeyState = 0;
21692178 }
21702179 if (TipWinCodeDebug != NULL && nChar == VK_SHIFT) {
21712180 POINT pos;
@@ -2209,12 +2218,12 @@
22092218 {
22102219 KeyUp(nChar);
22112220 #if UNICODE_DEBUG
2212- if (CtrlKeyState == 1 && nChar == VK_CONTROL) {
2221+ if (CtrlKeyState == 1 && nChar == UnicodeDebugParam.CodePopupKey1) {
22132222 CtrlKeyState++;
22142223 } else {
22152224 CtrlKeyState = 0;
22162225 }
2217- if (nChar == VK_CONTROL) {
2226+ if (nChar == UnicodeDebugParam.CodePopupKey2) {
22182227 if (TipWinCodeDebug != NULL) {
22192228 TipWinDestroy(TipWinCodeDebug);
22202229 TipWinCodeDebug = NULL;
Show on old repository browser