Develop and Download Open Source Software

Browse Subversion Repository

Annotation of /branches/ttcomtester/teraterm/teraterm/debug_pp.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 10521 - (hide annotations) (download) (as text)
Fri Jan 20 16:03:38 2023 UTC (14 months, 2 weeks ago) by zmatsuo
File MIME type: text/x-c++src
File size: 3935 byte(s)
add communication test tool
1 doda 8445 /*
2 nmaya 9048 * (C) 2019- TeraTerm Project
3 doda 8445 * All rights reserved.
4     *
5     * Redistribution and use in source and binary forms, with or without
6     * modification, are permitted provided that the following conditions
7     * are met:
8     *
9     * 1. Redistributions of source code must retain the above copyright
10     * notice, this list of conditions and the following disclaimer.
11     * 2. Redistributions in binary form must reproduce the above copyright
12     * notice, this list of conditions and the following disclaimer in the
13     * documentation and/or other materials provided with the distribution.
14     * 3. The name of the author may not be used to endorse or promote products
15     * derived from this software without specific prior written permission.
16     *
17     * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
18     * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19     * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20     * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
21     * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22     * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23     * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24     * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25     * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26     * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27     */
28    
29     /* debug property page */
30    
31     #include <stdio.h>
32    
33     #include "tmfc.h"
34     #include "tt_res.h"
35     #include "debug_pp.h"
36 zmatsuo 10223 #include "debug_pp_res.h"
37 zmatsuo 9124 #include "ttdebug.h"
38 doda 8445 #include "dlglib.h"
39     #include "compat_win.h"
40 zmatsuo 8749 #include "setting.h"
41 doda 8445
42 zmatsuo 8761 CDebugPropPage::CDebugPropPage(HINSTANCE inst)
43     : TTCPropertyPage(inst, IDD_TABSHEET_DEBUG)
44 doda 8445 {
45     }
46    
47     CDebugPropPage::~CDebugPropPage()
48     {
49     }
50    
51     static const struct {
52     WORD key_code;
53     const char *key_str;
54     } key_list[] = {
55 zmatsuo 9924 {VK_CONTROL, "VK_CONTROL"},
56 doda 8445 {VK_SHIFT, "VK_SHIFT"},
57     };
58    
59     void CDebugPropPage::OnInitDialog()
60     {
61     // popup
62     SetCheck(IDC_DEBUG_POPUP_ENABLE, UnicodeDebugParam.CodePopupEnable);
63 zmatsuo 8467 for (int i = 0; i < (int)_countof(key_list); i++) {
64 doda 8445 SendDlgItemMessage(IDC_DEBUG_POPUP_KEY1, CB_ADDSTRING, 0, (LPARAM)key_list[i].key_str);
65     SendDlgItemMessage(IDC_DEBUG_POPUP_KEY2, CB_ADDSTRING, 0, (LPARAM)key_list[i].key_str);
66     if (UnicodeDebugParam.CodePopupKey1 == key_list[i].key_code) {
67     SendDlgItemMessageA(IDC_DEBUG_POPUP_KEY1, CB_SETCURSEL, i, 0);
68     }
69     if (UnicodeDebugParam.CodePopupKey2 == key_list[i].key_code) {
70     SendDlgItemMessageA(IDC_DEBUG_POPUP_KEY2, CB_SETCURSEL, i, 0);
71     }
72     }
73    
74     // console button
75     const char *caption;
76     HWND hWnd = pGetConsoleWindow();
77     if (hWnd == NULL) {
78     caption = "Open console window";
79     } else {
80     if (::IsWindowVisible(hWnd)) {
81     caption = "Hide console window";
82     } else {
83     caption = "Show console window";
84     }
85     }
86     SetDlgItemTextA(IDC_DEBUG_CONSOLE_BUTTON, caption);
87     }
88    
89     BOOL CDebugPropPage::OnCommand(WPARAM wParam, LPARAM)
90     {
91     switch (wParam) {
92     case IDC_DEBUG_CONSOLE_BUTTON | (BN_CLICKED << 16): {
93     const char *caption;
94     HWND hWnd = pGetConsoleWindow();
95     if (hWnd == NULL) {
96 zmatsuo 9124 DebugConsoleOpen();
97 doda 8445 caption = "Hide console window";
98     }
99     else {
100     if (::IsWindowVisible(hWnd)) {
101     ::ShowWindow(hWnd, SW_HIDE);
102     caption = "Show console window";
103     }
104     else {
105     ::ShowWindow(hWnd, SW_SHOW);
106     caption = "Hide console window";
107     }
108     }
109     SetDlgItemTextA(IDC_DEBUG_CONSOLE_BUTTON, caption);
110     break;
111     }
112     default:
113     break;
114     }
115     return FALSE;
116     }
117    
118     void CDebugPropPage::OnOK()
119     {
120     UnicodeDebugParam.CodePopupEnable = GetCheck(IDC_DEBUG_POPUP_ENABLE);
121     int i = GetCurSel(IDC_DEBUG_POPUP_KEY1);
122     UnicodeDebugParam.CodePopupKey1 = key_list[i].key_code;
123     i = GetCurSel(IDC_DEBUG_POPUP_KEY2);
124     UnicodeDebugParam.CodePopupKey2 = key_list[i].key_code;
125     }

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26