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 8467 - (hide annotations) (download) (as text)
Fri Jan 10 13:14:06 2020 UTC (4 years, 3 months ago) by zmatsuo
Original Path: trunk/teraterm/teraterm/debug_pp.cpp
File MIME type: text/x-c++src
File size: 4182 byte(s)
debug_pp警告対策
1 doda 8445 /*
2     * (C) 2019 TeraTerm Project
3     * 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     #include "../common/tt_res.h"
37     #include "unicode_test.h"
38     #include "dlglib.h"
39     #include "compat_win.h"
40    
41     CDebugPropPage::CDebugPropPage(HINSTANCE inst, TTCPropertySheet *sheet)
42     : TTCPropertyPage(inst, IDD_TABSHEET_DEBUG, sheet)
43     {
44     }
45    
46     CDebugPropPage::~CDebugPropPage()
47     {
48     }
49    
50     static const struct {
51     WORD key_code;
52     const char *key_str;
53     } key_list[] = {
54     {VK_CONTROL, "VT_CONTROL"},
55     {VK_SHIFT, "VK_SHIFT"},
56     };
57    
58     void CDebugPropPage::OnInitDialog()
59     {
60     // popup
61     SetCheck(IDC_DEBUG_POPUP_ENABLE, UnicodeDebugParam.CodePopupEnable);
62 zmatsuo 8467 for (int i = 0; i < (int)_countof(key_list); i++) {
63 doda 8445 SendDlgItemMessage(IDC_DEBUG_POPUP_KEY1, CB_ADDSTRING, 0, (LPARAM)key_list[i].key_str);
64     SendDlgItemMessage(IDC_DEBUG_POPUP_KEY2, CB_ADDSTRING, 0, (LPARAM)key_list[i].key_str);
65     if (UnicodeDebugParam.CodePopupKey1 == key_list[i].key_code) {
66     SendDlgItemMessageA(IDC_DEBUG_POPUP_KEY1, CB_SETCURSEL, i, 0);
67     }
68     if (UnicodeDebugParam.CodePopupKey2 == key_list[i].key_code) {
69     SendDlgItemMessageA(IDC_DEBUG_POPUP_KEY2, CB_SETCURSEL, i, 0);
70     }
71     }
72    
73     // console button
74     const char *caption;
75     HWND hWnd = pGetConsoleWindow();
76     if (hWnd == NULL) {
77     caption = "Open console window";
78     } else {
79     if (::IsWindowVisible(hWnd)) {
80     caption = "Hide console window";
81     } else {
82     caption = "Show console window";
83     }
84     }
85     SetDlgItemTextA(IDC_DEBUG_CONSOLE_BUTTON, caption);
86     }
87    
88     BOOL CDebugPropPage::OnCommand(WPARAM wParam, LPARAM)
89     {
90     switch (wParam) {
91     case IDC_DEBUG_CONSOLE_BUTTON | (BN_CLICKED << 16): {
92     const char *caption;
93     HWND hWnd = pGetConsoleWindow();
94     if (hWnd == NULL) {
95     FILE *fp;
96     AllocConsole();
97     freopen_s(&fp, "CONOUT$", "w", stdout);
98     freopen_s(&fp, "CONOUT$", "w", stderr);
99     caption = "Hide console window";
100     hWnd = pGetConsoleWindow();
101     HMENU hmenu = GetSystemMenu(hWnd, FALSE);
102     RemoveMenu(hmenu, SC_CLOSE, MF_BYCOMMAND);
103     }
104     else {
105     if (::IsWindowVisible(hWnd)) {
106     ::ShowWindow(hWnd, SW_HIDE);
107     caption = "Show console window";
108     }
109     else {
110     ::ShowWindow(hWnd, SW_SHOW);
111     caption = "Hide console window";
112     }
113     }
114     SetDlgItemTextA(IDC_DEBUG_CONSOLE_BUTTON, caption);
115     break;
116     }
117     default:
118     break;
119     }
120     return FALSE;
121     }
122    
123     void CDebugPropPage::OnOK()
124     {
125     UnicodeDebugParam.CodePopupEnable = GetCheck(IDC_DEBUG_POPUP_ENABLE);
126     int i = GetCurSel(IDC_DEBUG_POPUP_KEY1);
127     UnicodeDebugParam.CodePopupKey1 = key_list[i].key_code;
128     i = GetCurSel(IDC_DEBUG_POPUP_KEY2);
129     UnicodeDebugParam.CodePopupKey2 = key_list[i].key_code;
130     }

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