• R/O
  • SSH
  • HTTPS

ttssh2: Commit


Commit MetaInfo

Revision7176 (tree)
Time2018-08-11 00:12:13
Authorzmatsuo

Log Message

teraterm/ のダイアログ系でMFCを使用しないようにした

(フォントはテスト的にMeiryo UI 20pointにハードコード)

CMake MinGWを考慮

Change Summary

Incremental Difference

--- branches/cmake/teraterm/ttpcmn/CMakeLists.txt (revision 7175)
+++ branches/cmake/teraterm/ttpcmn/CMakeLists.txt (revision 7176)
@@ -34,6 +34,12 @@
3434 .
3535 )
3636
37+if(${MINGW})
38+ link_directories(
39+ ${CMAKE_CURRENT_SOURCE_DIR}/../htmlhelp
40+ )
41+endif()
42+
3743 add_library(
3844 ttpcmn SHARED
3945 ${SRC}
--- branches/cmake/teraterm/ttpfile/CMakeLists.txt (revision 7175)
+++ branches/cmake/teraterm/ttpfile/CMakeLists.txt (revision 7176)
@@ -43,6 +43,12 @@
4343 ../common
4444 )
4545
46+if(${MINGW})
47+ link_directories(
48+ ${CMAKE_CURRENT_SOURCE_DIR}/../htmlhelp
49+ )
50+endif()
51+
4652 add_library(
4753 ttpfile SHARED
4854 ${SRC}
--- branches/cmake/teraterm/ttpset/CMakeLists.txt (revision 7175)
+++ branches/cmake/teraterm/ttpset/CMakeLists.txt (revision 7176)
@@ -25,6 +25,12 @@
2525 ${CMAKE_CURRENT_SOURCE_DIR}/../common
2626 )
2727
28+if(${MINGW})
29+ link_directories(
30+ ${CMAKE_CURRENT_SOURCE_DIR}/../htmlhelp
31+ )
32+endif()
33+
2834 add_library(
2935 ttpset SHARED
3036 ${SRC}
--- branches/cmake/teraterm/teraterm/addsetting.h (revision 7175)
+++ branches/cmake/teraterm/teraterm/addsetting.h (revision 7176)
@@ -1,5 +1,5 @@
11 /*
2- * (C) 2008-2017 TeraTerm Project
2+ * (C) 2008-2018 TeraTerm Project
33 * All rights reserved.
44 *
55 * Redistribution and use in source and binary forms, with or without
@@ -28,191 +28,109 @@
2828
2929 #pragma once
3030
31+#include "tmfc.h"
3132 #include "tt_res.h"
3233 #include "teraterm.h"
3334
34-
3535 typedef struct {
3636 char *name;
3737 LPCTSTR id;
3838 } mouse_cursor_t;
3939
40-
41-
4240 // General Page
43-class CGeneralPropPageDlg : public CPropertyPage
41+class CGeneralPropPageDlg : public TTCPropertyPage
4442 {
45- DECLARE_DYNAMIC(CGeneralPropPageDlg)
46-
4743 public:
48- CGeneralPropPageDlg();
44+ CGeneralPropPageDlg(HINSTANCE inst, TTCPropertySheet *sheet);
4945 virtual ~CGeneralPropPageDlg();
50- BOOL OnInitDialog();
46+private:
47+ void OnInitDialog();
5148 void OnOK();
52-
5349 enum { IDD = IDD_TABSHEET_GENERAL };
54-
55-private:
56- HFONT DlgGeneralFont;
57- LOGFONT logfont;
58- HFONT font;
59-
60-protected:
61- DECLARE_MESSAGE_MAP()
6250 };
6351
64-
65-
6652 // Control Sequence Page
67-class CSequencePropPageDlg : public CPropertyPage
53+class CSequencePropPageDlg : public TTCPropertyPage
6854 {
69- DECLARE_DYNAMIC(CSequencePropPageDlg)
70-
7155 public:
72- CSequencePropPageDlg();
56+ CSequencePropPageDlg(HINSTANCE inst, TTCPropertySheet *sheet);
7357 virtual ~CSequencePropPageDlg();
74- BOOL OnInitDialog();
58+private:
59+ void OnInitDialog();
7560 void OnOK();
76-
7761 enum { IDD = IDD_TABSHEET_SEQUENCE };
78-
79-private:
80- HFONT DlgSequenceFont;
81- LOGFONT logfont;
82- HFONT font;
83-
84-protected:
85- DECLARE_MESSAGE_MAP()
86- virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam);
62+ BOOL OnCommand(WPARAM wParam, LPARAM lParam);
8763 };
8864
89-
90-
9165 // Copypaste Page
92-class CCopypastePropPageDlg : public CPropertyPage
66+class CCopypastePropPageDlg : public TTCPropertyPage
9367 {
94- DECLARE_DYNAMIC(CCopypastePropPageDlg)
95-
9668 public:
97- CCopypastePropPageDlg();
69+ CCopypastePropPageDlg(HINSTANCE inst, TTCPropertySheet *sheet);
9870 virtual ~CCopypastePropPageDlg();
99- BOOL OnInitDialog();
71+private:
72+ void OnInitDialog();
10073 void OnOK();
101-
10274 enum { IDD = IDD_TABSHEET_COPYPASTE };
103-
104-private:
105- HFONT DlgCopypasteFont;
106- LOGFONT logfont;
107- HFONT font;
108-
109-protected:
110- DECLARE_MESSAGE_MAP()
111- virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam);
75+ BOOL OnCommand(WPARAM wParam, LPARAM lParam);
11276 };
11377
114-
115-
11678 // Visual Page
117-class CVisualPropPageDlg : public CPropertyPage
79+class CVisualPropPageDlg : public TTCPropertyPage
11880 {
119- DECLARE_DYNAMIC(CVisualPropPageDlg)
120-
12181 public:
122- CVisualPropPageDlg();
82+ CVisualPropPageDlg(HINSTANCE inst, TTCPropertySheet *sheet);
12383 virtual ~CVisualPropPageDlg();
124- BOOL OnInitDialog();
84+private:
85+ void OnInitDialog();
12586 void OnOK();
126-
87+ HBRUSH OnCtlColor(HDC hDC, HWND hWnd);
12788 enum { IDD = IDD_TABSHEET_VISUAL };
128-
129-private:
130- HFONT DlgVisualFont;
131- LOGFONT logfont;
132- HFONT font;
133-
134-protected:
135- DECLARE_MESSAGE_MAP()
136- virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam);
89+ BOOL OnCommand(WPARAM wParam, LPARAM lParam);
13790 };
13891
139-
140-
14192 // Log Page
142-class CLogPropPageDlg : public CPropertyPage
93+class CLogPropPageDlg : public TTCPropertyPage
14394 {
144- DECLARE_DYNAMIC(CLogPropPageDlg)
145-
14695 public:
147- CLogPropPageDlg();
96+ CLogPropPageDlg(HINSTANCE inst, TTCPropertySheet *sheet);
14897 virtual ~CLogPropPageDlg();
149- BOOL OnInitDialog();
98+private:
99+ void OnInitDialog();
150100 void OnOK();
151-
152101 enum { IDD = IDD_TABSHEET_LOG };
153-
154-private:
155- HFONT DlgLogFont;
156- LOGFONT logfont;
157- HFONT font;
158-
159-protected:
160- DECLARE_MESSAGE_MAP()
161- virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam);
102+ BOOL OnCommand(WPARAM wParam, LPARAM lParam);
162103 };
163104
164-
165-
166105 // Cygwin Page
167-class CCygwinPropPageDlg : public CPropertyPage
106+class CCygwinPropPageDlg : public TTCPropertyPage
168107 {
169- DECLARE_DYNAMIC(CCygwinPropPageDlg)
170-
171108 public:
172- CCygwinPropPageDlg();
109+ CCygwinPropPageDlg(HINSTANCE inst, TTCPropertySheet *sheet);
173110 virtual ~CCygwinPropPageDlg();
174- BOOL OnInitDialog();
111+private:
112+ void OnInitDialog();
175113 void OnOK();
176-
177114 enum { IDD = IDD_TABSHEET_CYGWIN };
178-
179-private:
180- HFONT DlgCygwinFont;
181- LOGFONT logfont;
182- HFONT font;
183115 cygterm_t settings;
184-
185-protected:
186- DECLARE_MESSAGE_MAP()
187- virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam);
116+ BOOL OnCommand(WPARAM wParam, LPARAM lParam);
188117 };
189118
190-
191-
192119 // Property Sheet
193-class CAddSettingPropSheetDlg : public CPropertySheet
120+class CAddSettingPropSheetDlg : public TTCPropertySheet
194121 {
195- DECLARE_DYNAMIC(CAddSettingPropSheetDlg)
196-
197122 public:
198- CAddSettingPropSheetDlg(UINT nIDCaption, CWnd* pParentWnd = NULL, UINT iSelectPage = 0);
199- CAddSettingPropSheetDlg(LPCTSTR pszCaption, CWnd* pParentWnd = NULL, UINT iSelectPage = 0);
123+ CAddSettingPropSheetDlg(HINSTANCE hInstance, LPCTSTR pszCaption, HWND hParentWnd = NULL);
200124 virtual ~CAddSettingPropSheetDlg();
201- BOOL OnInitDialog();
202-
203125 private:
204- HFONT DlgAdditionalFont;
205- LOGFONT logfont;
206- HFONT font;
126+ void OnInitDialog();
207127
208-protected:
209- DECLARE_MESSAGE_MAP()
210-
211-public:
212- CGeneralPropPageDlg m_GeneralPage;
213- CSequencePropPageDlg m_SequencePage;
214- CCopypastePropPageDlg m_CopypastePage;
215- CVisualPropPageDlg m_VisualPage;
216- CLogPropPageDlg m_LogPage;
217- CCygwinPropPageDlg m_CygwinPage;
128+ HPROPSHEETPAGE hPsp[6];
129+
130+ CGeneralPropPageDlg *m_GeneralPage;
131+ CSequencePropPageDlg *m_SequencePage;
132+ CCopypastePropPageDlg *m_CopypastePage;
133+ CVisualPropPageDlg *m_VisualPage;
134+ CLogPropPageDlg *m_LogPage;
135+ CCygwinPropPageDlg *m_CygwinPage;
218136 };
--- branches/cmake/teraterm/teraterm/prnabort.h (revision 7175)
+++ branches/cmake/teraterm/teraterm/prnabort.h (revision 7176)
@@ -31,22 +31,21 @@
3131 #pragma once
3232
3333 #include "tttypes.h" // for TTSet
34+#include "tmfc.h"
3435
3536 // CPrnAbortDlg dialog
36-class CPrnAbortDlg
37+class CPrnAbortDlg : public TTCDialog
3738 {
3839 public:
39- HWND m_hWnd;
40- HWND GetSafeHwnd() const {return m_hWnd;}
40+ CPrnAbortDlg();
41+ ~CPrnAbortDlg();
4142 BOOL Create(HINSTANCE hInstance, HWND hParent, PBOOL AbortFlag, PTTSet pts);
42- BOOL DestroyWindow();
43- HFONT m_hNewFont;
43+ void OnCancel();
44+ void OnInitDialog();
45+ void PostNcDestroy();
4446
4547 private:
46- void OnCancel();
47- void PostNcDestroy();
48- HWND m_hParentWnd;
4948 BOOL *m_pAbort;
5049 TTTSet *m_ts;
51- static LRESULT CALLBACK OnDlgProc(HWND hDlgWnd, UINT msg, WPARAM wp, LPARAM lp);
50+ HFONT m_hNewFont;
5251 };
--- branches/cmake/teraterm/teraterm/ftdlg.cpp (revision 7175)
+++ branches/cmake/teraterm/teraterm/ftdlg.cpp (revision 7176)
@@ -1,6 +1,6 @@
11 /*
22 * Copyright (C) 1994-1998 T. Teranishi
3- * (C) 2007-2017 TeraTerm Project
3+ * (C) 2007-2018 TeraTerm Project
44 * All rights reserved.
55 *
66 * Redistribution and use in source and binary forms, with or without
@@ -28,32 +28,23 @@
2828 */
2929
3030 /* TERATERM.EXE, file transfer dialog box */
31-#include "stdafx.h"
31+#include <stdio.h>
32+#include <windows.h>
33+#include <Commctrl.h>
3234 #include "teraterm.h"
3335 #include "tttypes.h"
3436 #include "ttftypes.h"
3537 #include "ttlib.h"
38+#include "dlglib.h"
3639 #include "tt_res.h"
3740 #include "ftdlg.h"
3841
39-#ifdef _DEBUG
40-#define new DEBUG_NEW
41-#undef THIS_FILE
42-static char THIS_FILE[] = __FILE__;
43-#endif
44-
4542 /////////////////////////////////////////////////////////////////////////////
4643 // CFileTransDlg dialog
4744
48-BEGIN_MESSAGE_MAP(CFileTransDlg, CDialog)
49- //{{AFX_MSG_MAP(CFileTransDlg)
50- //}}AFX_MSG_MAP
51-END_MESSAGE_MAP()
52-
53-BOOL CFileTransDlg::Create(PFileVar pfv, PComVar pcv, PTTSet pts)
45+BOOL CFileTransDlg::Create(HINSTANCE hInstance, HWND hParent, PFileVar pfv, PComVar pcv, PTTSet pts)
5446 {
5547 BOOL Ok;
56- WNDCLASS wc;
5748 int fuLoad = LR_DEFAULTCOLOR;
5849 HWND hwnd;
5950
@@ -61,28 +52,14 @@
6152 cv = pcv;
6253 cv->FilePause &= ~fv->OpId;
6354 ts = pts;
64- LOGFONT logfont;
65- HFONT font;
55+ Pause = FALSE;
6656
67- wc.style = CS_PARENTDC;
68- wc.lpfnWndProc = AfxWndProc;
69- wc.cbClsExtra = 0;
70- wc.cbWndExtra = DLGWINDOWEXTRA;
71- wc.hInstance = AfxGetInstanceHandle();
72- wc.hIcon = NULL;
73- wc.hCursor = LoadCursor(NULL,IDC_ARROW);
74- wc.hbrBackground = (HBRUSH)(COLOR_BTNFACE+1);
75- wc.lpszMenuName = NULL;
76- wc.lpszClassName = "FTDlg32";
77- RegisterClass(&wc);
78-
79- Pause = FALSE;
80- hwnd = GetForegroundWindow()->GetSafeHwnd();
57+ hwnd = GetForegroundWindow();
8158 if (fv->OpId == OpLog) { // parent window is desktop
82- Ok = CDialog::Create(CFileTransDlg::IDD, GetDesktopWindow());
59+ Ok = TTCDialog::Create(hInstance, GetDesktopWindow(), CFileTransDlg::IDD);
8360 }
8461 else { // parent window is VT window
85- Ok = CDialog::Create(CFileTransDlg::IDD, NULL);
62+ Ok = TTCDialog::Create(hInstance, NULL, CFileTransDlg::IDD);
8663 }
8764
8865 if (!fv->HideDialog) {
@@ -100,22 +77,6 @@
10077
10178 fv->HWin = GetSafeHwnd();
10279
103- font = (HFONT)SendMessage(WM_GETFONT, 0, 0);
104- GetObject(font, sizeof(LOGFONT), &logfont);
105- if (get_lang_font("DLG_SYSTEM_FONT", fv->HWin, &logfont, &DlgFont, ts->UILanguageFile)) {
106- SendDlgItemMessage(IDC_TRANS_FILENAME, WM_SETFONT, (WPARAM)DlgFont, MAKELPARAM(TRUE,0));
107- SendDlgItemMessage(IDC_TRANSFNAME, WM_SETFONT, (WPARAM)DlgFont, MAKELPARAM(TRUE,0));
108- SendDlgItemMessage(IDC_FULLPATH_LABEL, WM_SETFONT, (WPARAM)DlgFont, MAKELPARAM(TRUE,0));
109- SendDlgItemMessage(IDC_EDIT_FULLPATH, WM_SETFONT, (WPARAM)DlgFont, MAKELPARAM(TRUE,0));
110- SendDlgItemMessage(IDC_TRANS_TRANS, WM_SETFONT, (WPARAM)DlgFont, MAKELPARAM(TRUE,0));
111- SendDlgItemMessage(IDC_TRANSBYTES, WM_SETFONT, (WPARAM)DlgFont, MAKELPARAM(TRUE,0));
112- SendDlgItemMessage(IDC_TRANS_ELAPSED, WM_SETFONT, (WPARAM)DlgFont, MAKELPARAM(TRUE,0));
113- SendDlgItemMessage(IDC_TRANS_ETIME, WM_SETFONT, (WPARAM)DlgFont, MAKELPARAM(TRUE,0));
114- SendDlgItemMessage(IDC_TRANSPAUSESTART, WM_SETFONT, (WPARAM)DlgFont, MAKELPARAM(TRUE,0));
115- SendDlgItemMessage(IDCANCEL, WM_SETFONT, (WPARAM)DlgFont, MAKELPARAM(TRUE,0));
116- SendDlgItemMessage(IDC_TRANSHELP, WM_SETFONT, (WPARAM)DlgFont, MAKELPARAM(TRUE,0));
117- }
118-
11980 return Ok;
12081 }
12182
@@ -183,7 +144,7 @@
183144 /////////////////////////////////////////////////////////////////////////////
184145 // CFileTransDlg message handler
185146
186-BOOL CFileTransDlg::OnInitDialog()
147+void CFileTransDlg::OnInitDialog()
187148 {
188149 int fuLoad = LR_DEFAULTCOLOR;
189150
@@ -205,19 +166,17 @@
205166 if (IsWindowsNT4()) {
206167 fuLoad = LR_VGACOLOR;
207168 }
208- SmallIcon = LoadImage(AfxGetInstanceHandle(),
169+ SmallIcon = LoadImage(m_hInst,
209170 MAKEINTRESOURCE(IDI_TTERM),
210171 IMAGE_ICON, 16, 16, fuLoad);
211172 ::PostMessage(GetSafeHwnd(), WM_SETICON, ICON_SMALL,
212173 (LPARAM)SmallIcon);
213174
214- BigIcon = LoadImage(AfxGetInstanceHandle(),
175+ BigIcon = LoadImage(m_hInst,
215176 MAKEINTRESOURCE(IDI_TTERM),
216177 IMAGE_ICON, 0, 0, fuLoad);
217178 ::PostMessage(GetSafeHwnd(), WM_SETICON, ICON_BIG,
218179 (LPARAM)BigIcon);
219-
220- return 1;
221180 }
222181
223182 void CFileTransDlg::OnCancel( )
@@ -238,7 +197,7 @@
238197 ::PostMessage(fv->HMainWin,WM_USER_DLGHELP2,0,0);
239198 return TRUE;
240199 default:
241- return (CDialog::OnCommand(wParam,lParam));
200+ return (TTCDialog::OnCommand(wParam,lParam));
242201 }
243202 }
244203
@@ -245,14 +204,8 @@
245204 void CFileTransDlg::PostNcDestroy()
246205 {
247206 // logopenとlogcloseを繰り返すと、GDIリソースリークとなる問題を修正した。
248- // - CreateFontIndirect()で作成した論理フォントを削除する。
249207 // - LoadImage()によるアイコンリソースを解放する。
250208 // (2016.10.5 yutaka)
251- if (DlgFont) {
252- DeleteObject(DlgFont);
253- DlgFont = NULL;
254- }
255-
256209 if (SmallIcon) {
257210 DestroyIcon((HICON)SmallIcon);
258211 SmallIcon = NULL;
@@ -265,8 +218,3 @@
265218
266219 delete this;
267220 }
268-
269-LRESULT CFileTransDlg::DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam)
270-{
271- return DefDlgProc(GetSafeHwnd(),message,wParam,lParam);
272-}
--- branches/cmake/teraterm/teraterm/vtwin.cpp (revision 7175)
+++ branches/cmake/teraterm/teraterm/vtwin.cpp (revision 7176)
@@ -4525,8 +4525,8 @@
45254525 {
45264526 DWORD ret;
45274527
4528- CAddSettingPropSheetDlg CAddSetting("", CWnd::FromHandle(HVTWin));
4529- CAddSetting.EnableStackedTabs(FALSE);
4528+ CAddSettingPropSheetDlg CAddSetting(hInst, "", HVTWin);
4529+// CAddSetting.EnableStackedTabs(FALSE);
45304530 ret = CAddSetting.DoModal();
45314531 switch (ret) {
45324532 case -1:
@@ -6215,3 +6215,10 @@
62156215 (*AboutDialog)(HVTWin);
62166216 FreeTTDLG();
62176217 }
6218+
6219+
6220+BOOL CallOnIdle(LONG lCount)
6221+{
6222+ CWinApp *app = AfxGetApp();
6223+ return app->OnIdle(lCount);
6224+}
--- branches/cmake/teraterm/teraterm/teraterm.cpp (revision 7175)
+++ branches/cmake/teraterm/teraterm/teraterm.cpp (revision 7176)
@@ -45,6 +45,7 @@
4545 #include "tekwin.h"
4646 #include "ttdde.h"
4747 #include "keyboard.h"
48+#include "compat_win.h"
4849
4950 #include "teraapp.h"
5051
@@ -81,6 +82,11 @@
8182 (*setDllDir)("");
8283 }
8384 }
85+
86+ WinCompatInit();
87+ if (PSetThreadDpiAwarenessContext) {
88+ PSetThreadDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2);
89+ }
8490 }
8591
8692 // CTeraApp instance
--- branches/cmake/teraterm/teraterm/prnabort.cpp (revision 7175)
+++ branches/cmake/teraterm/teraterm/prnabort.cpp (revision 7176)
@@ -28,59 +28,20 @@
2828 */
2929
3030 /* TERATERM.EXE, print-abort dialog box */
31-#include <windows.h>
32-#include <windowsx.h>
3331 #include "teraterm.h"
3432 #include "tttypes.h"
3533 #include "ttlib.h"
3634 #include "dlglib.h"
3735 #include "tt_res.h"
36+#include "tmfc.h"
3837 #include "prnabort.h"
3938
40-LRESULT CALLBACK CPrnAbortDlg::OnDlgProc(HWND hDlgWnd, UINT msg, WPARAM wp, LPARAM lp)
39+CPrnAbortDlg::CPrnAbortDlg()
4140 {
42- static const DlgTextInfo TextInfos[] = {
43- { IDC_PRNABORT_PRINTING, "DLG_PRNABORT_PRINTING" },
44- { IDCANCEL, "BTN_CANCEL" },
45- };
46- static const int FontIDs[] = {
47- IDC_PRNABORT_PRINTING, IDCANCEL
48- };
41+}
4942
50- CPrnAbortDlg *self = (CPrnAbortDlg *)GetWindowLongPtr(hDlgWnd, DWLP_USER);
51-
52- switch (msg) {
53- case WM_INITDIALOG:
54- {
55- CPrnAbortDlg *self = (CPrnAbortDlg *)lp;
56- SetWindowLongPtr(hDlgWnd, DWLP_USER, (LONG_PTR)self);
57- SetDlgTexts(hDlgWnd, TextInfos, _countof(TextInfos), self->m_ts->UILanguageFile);
58- self->m_hNewFont =
59- SetDlgFonts(hDlgWnd, FontIDs, _countof(FontIDs),
60- self->m_ts->UILanguageFile, "DLG_SYSTEM_FONT");
61- return TRUE;
62- }
63-
64- case WM_COMMAND:
65- {
66- WORD wID = GET_WM_COMMAND_ID(wp, lp);
67- const WORD wCMD = GET_WM_COMMAND_CMD(wp, lp);
68- if (wID == IDOK) {
69- self->DestroyWindow();
70- }
71- if (wID == IDCANCEL) {
72- self->OnCancel();
73- }
74- return FALSE;
75- }
76- case WM_NCDESTROY:
77- self->PostNcDestroy();
78- return TRUE;
79-
80- default:
81- return FALSE;
82- }
83- return TRUE;
43+CPrnAbortDlg::~CPrnAbortDlg()
44+{
8445 }
8546
8647 BOOL CPrnAbortDlg::Create(HINSTANCE hInstance, HWND hParent, PBOOL AbortFlag, PTTSet pts)
@@ -89,41 +50,36 @@
8950 m_hParentWnd = hParent;
9051 m_ts = pts;
9152
92- HRSRC hResource = ::FindResource(hInstance, MAKEINTRESOURCE(IDD_PRNABORTDLG), RT_DIALOG);
93- HANDLE hDlgTemplate = ::LoadResource(hInstance, hResource);
94- DLGTEMPLATE *lpTemplate = (DLGTEMPLATE *)::LockResource(hDlgTemplate);
95- HWND hWnd = ::CreateDialogIndirectParam(
96- hInstance, lpTemplate, hParent,
97- (DLGPROC)OnDlgProc, (LPARAM)this);
98- if (hWnd == NULL)
99- {
100- return FALSE;
101- }
53+ TTCDialog::Create(hInstance, hParent, IDD_PRNABORTDLG);
10254
103- m_hWnd = hWnd;
104- ::EnableWindow(hParent,FALSE);
105- ::ShowWindow(hWnd, SW_SHOW);
106- ::EnableWindow(m_hWnd,TRUE);
10755 return TRUE;
10856 }
10957
58+void CPrnAbortDlg::OnInitDialog()
59+{
60+ TTCDialog::OnInitDialog();
61+
62+ static const DlgTextInfo TextInfos[] = {
63+ { IDC_PRNABORT_PRINTING, "DLG_PRNABORT_PRINTING" },
64+ { IDCANCEL, "BTN_CANCEL" },
65+ };
66+ static const int FontIDs[] = {
67+ IDC_PRNABORT_PRINTING, IDCANCEL
68+ };
69+ SetDlgTexts(m_hWnd, TextInfos, _countof(TextInfos), m_ts->UILanguageFile);
70+ m_hNewFont =
71+ SetDlgFonts(m_hWnd, FontIDs, _countof(FontIDs),
72+ m_ts->UILanguageFile, "DLG_SYSTEM_FONT");
73+}
74+
11075 void CPrnAbortDlg::OnCancel()
11176 {
11277 *m_pAbort = TRUE;
113- DestroyWindow();
78+ TTCDialog::OnCancel();
11479 }
11580
11681 void CPrnAbortDlg::PostNcDestroy()
11782 {
11883 ::DeleteObject(m_hNewFont);
119- delete this;
84+ TTCDialog::DestroyWindow();
12085 }
121-
122-BOOL CPrnAbortDlg::DestroyWindow()
123-{
124- ::EnableWindow(m_hParentWnd,TRUE);
125- ::SetFocus(m_hParentWnd);
126- ::DestroyWindow(m_hWnd);
127- return TRUE;
128-}
129-
--- branches/cmake/teraterm/teraterm/protodlg.cpp (revision 7175)
+++ branches/cmake/teraterm/teraterm/protodlg.cpp (revision 7176)
@@ -1,6 +1,6 @@
11 /*
22 * Copyright (C) 1994-1998 T. Teranishi
3- * (C) 2007-2017 TeraTerm Project
3+ * (C) 2007-2018 TeraTerm Project
44 * All rights reserved.
55 *
66 * Redistribution and use in source and binary forms, with or without
@@ -28,12 +28,12 @@
2828 */
2929
3030 /* TERATERM.EXE, file-transfer-protocol dialog box */
31-#include "stdafx.h"
3231 #include "teraterm.h"
3332 #include "tt_res.h"
3433 #include "tttypes.h"
3534 #include "ttftypes.h"
3635 #include "ttlib.h"
36+#include "dlglib.h"
3737 #include "protodlg.h"
3838
3939 #ifdef _DEBUG
@@ -45,39 +45,14 @@
4545 /////////////////////////////////////////////////////////////////////////////
4646 // CProtoDlg dialog
4747
48-BEGIN_MESSAGE_MAP(CProtoDlg, CDialog)
49- //{{AFX_MSG_MAP(CProtoDlg)
50- //}}AFX_MSG_MAP
51-END_MESSAGE_MAP()
52-
53-BOOL CProtoDlg::Create(PFileVar pfv, PTTSet pts)
48+BOOL CProtoDlg::Create(HINSTANCE hInstance, HWND hParent, PFileVar pfv, PTTSet pts)
5449 {
55- BOOL Ok;
56- LOGFONT logfont;
57- HFONT font;
58-
50+ m_pts = pts;
5951 fv = pfv;
6052
61- Ok = CDialog::Create(CProtoDlg::IDD, NULL);
53+ BOOL Ok = TTCDialog::Create(hInstance, hParent, CProtoDlg::IDD);
6254 fv->HWin = GetSafeHwnd();
6355
64- font = (HFONT)SendMessage(WM_GETFONT, 0, 0);
65- GetObject(font, sizeof(LOGFONT), &logfont);
66- if (get_lang_font("DLG_SYSTEM_FONT", GetSafeHwnd(), &logfont, &DlgFont, pts->UILanguageFile)) {
67- SendDlgItemMessage(IDC_PROT_FILENAME, WM_SETFONT, (WPARAM)DlgFont, MAKELPARAM(TRUE,0));
68- SendDlgItemMessage(IDC_PROTOFNAME, WM_SETFONT, (WPARAM)DlgFont, MAKELPARAM(TRUE,0));
69- SendDlgItemMessage(IDC_PROT_PROT, WM_SETFONT, (WPARAM)DlgFont, MAKELPARAM(TRUE,0));
70- SendDlgItemMessage(IDC_PROTOPROT, WM_SETFONT, (WPARAM)DlgFont, MAKELPARAM(TRUE,0));
71- SendDlgItemMessage(IDC_PROT_PACKET, WM_SETFONT, (WPARAM)DlgFont, MAKELPARAM(TRUE,0));
72- SendDlgItemMessage(IDC_PROTOPKTNUM, WM_SETFONT, (WPARAM)DlgFont, MAKELPARAM(TRUE,0));
73- SendDlgItemMessage(IDC_PROT_TRANS, WM_SETFONT, (WPARAM)DlgFont, MAKELPARAM(TRUE,0));
74- SendDlgItemMessage(IDC_PROTOBYTECOUNT, WM_SETFONT, (WPARAM)DlgFont, MAKELPARAM(TRUE,0));
75- SendDlgItemMessage(IDC_PROT_ELAPSED, WM_SETFONT, (WPARAM)DlgFont, MAKELPARAM(TRUE,0));
76- SendDlgItemMessage(IDC_PROTOELAPSEDTIME, WM_SETFONT, (WPARAM)DlgFont, MAKELPARAM(TRUE,0));
77- SendDlgItemMessage(IDC_PROTOPERCENT, WM_SETFONT, (WPARAM)DlgFont, MAKELPARAM(TRUE,0));
78- SendDlgItemMessage(IDCANCEL, WM_SETFONT, (WPARAM)DlgFont, MAKELPARAM(TRUE,0));
79- }
80-
8156 return Ok;
8257 }
8358
@@ -84,8 +59,24 @@
8459 /////////////////////////////////////////////////////////////////////////////
8560 // CProtoDlg message handler
8661
87-void CProtoDlg::OnCancel( )
62+void CProtoDlg::OnInitDialog()
8863 {
64+ TTTSet *ts = m_pts;
65+
66+ static const DlgTextInfo TextInfos[] = {
67+ { IDC_PROT_FILENAME, "DLG_PROT_FILENAME" },
68+ { IDC_PROT_PROT, "DLG_PROT_PROTO" },
69+ { IDC_PROT_PACKET, "DLG_PROT_PACKET"},
70+ { IDC_PROT_TRANS, "DLG_PROT_TRANS" },
71+ { IDC_PROT_ELAPSED, "DLG_PROT_ELAPSED" },
72+ { IDCANCEL, "BTN_CANCEL" },
73+ };
74+ SetDlgTexts(m_hWnd, TextInfos, _countof(TextInfos), m_pts->UILanguageFile);
75+}
76+
77+
78+void CProtoDlg::OnCancel()
79+{
8980 ::PostMessage(fv->HMainWin,WM_USER_PROTOCANCEL,0,0);
9081 }
9182
@@ -96,7 +87,7 @@
9687 ::PostMessage(fv->HMainWin,WM_USER_PROTOCANCEL,0,0);
9788 return TRUE;
9889 default:
99- return (CDialog::OnCommand(wParam,lParam));
90+ return (TTCDialog::OnCommand(wParam,lParam));
10091 }
10192 }
10293
--- branches/cmake/teraterm/teraterm/dnddlg.cpp (revision 7175)
+++ branches/cmake/teraterm/teraterm/dnddlg.cpp (revision 7176)
@@ -56,12 +56,15 @@
5656 };
5757
5858 struct DrapDropDlgData {
59+#if 0
5960 HFONT hNewFont;
61+#endif
6062 DrapDropDlgParam *Param;
6163 };
6264
6365 static LRESULT CALLBACK OnDragDropDlgProc(HWND hDlgWnd, UINT msg, WPARAM wp, LPARAM lp)
6466 {
67+#if 0
6568 static const int FontIDs[] = {
6669 IDC_FILENAME_EDIT,
6770 IDC_DAD_STATIC,
@@ -73,6 +76,7 @@
7376 IDC_DAD_NOTE,
7477 IDOK, IDCANCEL,
7578 };
79+#endif
7680 static const DlgTextInfo TextInfos[] = {
7781 { 0, "DLG_DANDD_TITLE" },
7882 { IDC_DAD_STATIC, "DLG_DANDD_TEXT" },
@@ -101,7 +105,9 @@
101105 SetWindowLongPtr(hDlgWnd, DWLP_USER, (LONG_PTR)DlgData);
102106 DrapDropDlgParam *Param = (DrapDropDlgParam *)lp;
103107 DlgData->Param = Param;
108+#if 0
104109 DlgData->hNewFont = SetDlgFonts(hDlgWnd, FontIDs, _countof(FontIDs), Param->UILanguageFile, NULL);
110+#endif
105111 SetDlgTexts(hDlgWnd, TextInfos, _countof(TextInfos), Param->UILanguageFile);
106112
107113 // target file
@@ -242,16 +248,22 @@
242248 DlgData->Param->DropType = DROP_TYPE_CANCEL;
243249 }
244250 if (wID == IDOK || wID == IDCANCEL) {
251+#if 0
245252 EndDialog(hDlgWnd, wID);
253+#else
254+ TTEndDialog(hDlgWnd, wID);
255+#endif
246256 break;
247257 }
248258 return FALSE;
249259 }
250260 case WM_NCDESTROY:
261+#if 0
251262 if (DlgData->hNewFont != NULL) {
252263 DeleteObject(DlgData->hNewFont);
253264 DlgData->hNewFont = NULL;
254265 }
266+#endif
255267 free(DlgData);
256268 break;
257269
@@ -288,10 +300,17 @@
288300 Param.ScpSendDirSize = _countof(pts->ScpSendDir);
289301 Param.UILanguageFile = pts->UILanguageFile;
290302
303+#if 0
291304 int ret = DialogBoxParam(
292305 hInstance, MAKEINTRESOURCE(IDD_DAD_DIALOG),
293306 hWndParent, (DLGPROC)OnDragDropDlgProc,
294307 (LPARAM)&Param);
308+#else
309+ int ret = TTDialogBoxParam(
310+ hInstance, MAKEINTRESOURCE(IDD_DAD_DIALOG),
311+ hWndParent, (DLGPROC)OnDragDropDlgProc,
312+ (LPARAM)&Param);
313+#endif
295314 if (ret != IDOK) {
296315 return DROP_TYPE_CANCEL;
297316 }
--- branches/cmake/teraterm/teraterm/CMakeLists.txt (revision 7175)
+++ branches/cmake/teraterm/teraterm/CMakeLists.txt (revision 7176)
@@ -29,10 +29,16 @@
2929 ../common/ttlib.c
3030 ../common/ttlib.h
3131 ../common/dlglib.c
32+ ../common/dlglib_cpp.cpp
3233 ../common/dlglib.h
34+ ../common/dlglib_tmpl.cpp
35+ ../common/compat_win.cpp
36+ ../common/compat_win.h
3337 #
3438 addsetting.cpp
3539 addsetting.h
40+ tmfc.cpp
41+ tmfc.h
3642 buffer.c
3743 buffer.h
3844 clipboar.c
@@ -109,7 +115,9 @@
109115
110116 set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /NODEFAULTLIB:nafxcw.lib /NODEFAULTLIB:LIBCMT.lib")
111117 set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /NODEFAULTLIB:nafxcwd.lib /NODEFAULTLIB:LIBCMTD.lib")
112-set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /DELAYLOAD:imagehlp.dll /DELAYLOAD:user32.dll /DELAYLOAD:shell32.dll")
118+if (${MSVC})
119+ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /DELAYLOAD:imagehlp.dll /DELAYLOAD:user32.dll /DELAYLOAD:shell32.dll")
120+endif()
113121
114122 add_executable(
115123 teraterm WIN32
--- branches/cmake/teraterm/teraterm/ftdlg.h (revision 7175)
+++ branches/cmake/teraterm/teraterm/ftdlg.h (revision 7176)
@@ -1,6 +1,6 @@
11 /*
22 * Copyright (C) 1994-1998 T. Teranishi
3- * (C) 2007-2017 TeraTerm Project
3+ * (C) 2007-2018 TeraTerm Project
44 * All rights reserved.
55 *
66 * Redistribution and use in source and binary forms, with or without
@@ -29,55 +29,38 @@
2929
3030 /* TERATERM.EXE, file transfer dialog box */
3131
32+#include "tmfc.h"
33+
3234 /////////////////////////////////////////////////////////////////////////////
3335 // CFileTransDlg dialog
3436
35-class CFileTransDlg : public CDialog
37+class CFileTransDlg : public TTCDialog
3638 {
37-private:
38- PFileVar fv;
39- PComVar cv;
40- BOOL Pause;
41-#ifndef NO_I18N
42- PTTSet ts;
43- HFONT DlgFont;
44-#endif
45- HANDLE SmallIcon;
46- HANDLE BigIcon;
47-
4839 public:
4940 CFileTransDlg() {
50- DlgFont = NULL;
5141 SmallIcon = NULL;
5242 BigIcon = NULL;
5343 }
5444
55-#ifndef NO_I18N
56- BOOL Create(PFileVar pfv, PComVar pcv, PTTSet pts);
57-#else
58- BOOL Create(PFileVar pfv, PComVar pcv);
59-#endif
45+ BOOL Create(HINSTANCE hInstance, HWND hParent, PFileVar pfv, PComVar pcv, PTTSet pts);
6046 void ChangeButton(BOOL PauseFlag);
6147 void RefreshNum();
6248
63- //{{AFX_DATA(CFileTransDlg)
6449 enum { IDD = IDD_FILETRANSDLG };
65- //}}AFX_DATA
6650
67- //{{AFX_VIRTUAL(CFileTransDlg)
68- protected:
69- virtual void OnCancel( );
51+protected:
52+ virtual void OnCancel();
7053 virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam);
7154 virtual void PostNcDestroy();
72- virtual LRESULT DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam);
73- //}}AFX_VIRTUAL
55+ virtual void OnInitDialog();
7456
75-protected:
76-
77- //{{AFX_MSG(CFileTransDlg)
78- virtual BOOL OnInitDialog();
79- //}}AFX_MSG
80- DECLARE_MESSAGE_MAP()
57+private:
58+ PFileVar fv;
59+ PComVar cv;
60+ BOOL Pause;
61+ PTTSet ts;
62+ HANDLE SmallIcon;
63+ HANDLE BigIcon;
8164 };
8265
8366 typedef CFileTransDlg *PFileTransDlg;
--- branches/cmake/teraterm/teraterm/tmfc.h (revision 0)
+++ branches/cmake/teraterm/teraterm/tmfc.h (revision 7176)
@@ -0,0 +1,109 @@
1+/*
2+ * Copyright (C) 2018 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+/*
30+ * Tera term Micro Framework class
31+ */
32+#pragma once
33+#include <windows.h>
34+
35+class TTCWnd
36+{
37+public:
38+ HWND m_hWnd;
39+ HINSTANCE m_hInst;
40+
41+ HWND GetSafeHwnd() const {return m_hWnd;}
42+ HWND GetSafeHwnd() { return m_hWnd; }
43+ LRESULT SendMessage(UINT msg, WPARAM wp, LPARAM lp);
44+ LRESULT SendDlgItemMessage(int id, UINT msg, WPARAM wp, LPARAM lp);
45+ void GetDlgItemText(int id, TCHAR *buf, size_t size);
46+ void SetDlgItemText(int id, const TCHAR *str);
47+ void SetCheck(int id, int nCheck);
48+ UINT GetCheck(int id);
49+ void SetCurSel(int id, int no);
50+ int GetCurSel(int id);
51+ void EnableDlgItem(int id, BOOL enable);
52+ void SetDlgItemInt(int id, UINT val, BOOL bSigned = TRUE);
53+ UINT GetDlgItemInt(int id, BOOL* lpTrans = NULL, BOOL bSigned = TRUE) const;
54+ void ShowWindow(int nCmdShow);
55+ void SetWindowText(TCHAR *str);
56+ void ModifyStyle(DWORD dwRemove, DWORD dwAdd, UINT nFlags = 0);
57+ void ModifyStyleEx(DWORD dwRemove, DWORD dwAdd, UINT nFlags = 0);
58+ int MessageBox(LPCTSTR lpText, LPCTSTR lpCaption, UINT uType);
59+};
60+
61+class TTCDialog : public TTCWnd
62+{
63+public:
64+ TTCDialog();
65+ virtual ~TTCDialog();
66+ BOOL Create(HINSTANCE hInstance, HWND hParent, int idd);
67+ virtual void OnInitDialog();
68+ virtual void OnOK();
69+ virtual void OnCancel();
70+ virtual void DestroyWindow();
71+ virtual void PostNcDestroy();
72+ virtual BOOL OnCommand(WPARAM wp, LPARAM lp);
73+ HWND m_hParentWnd;
74+
75+private:
76+ int DoModal();
77+
78+ static LRESULT CALLBACK OnDlgProc(HWND hDlgWnd, UINT msg, WPARAM wp, LPARAM lp);
79+};
80+
81+class TTCPropertySheet
82+{
83+public:
84+ TTCPropertySheet(HINSTANCE hInstance, LPCTSTR pszCaption, HWND hParentWnd);
85+ virtual ~TTCPropertySheet();
86+ virtual void OnInitDialog();
87+ int DoModal();
88+ PROPSHEETHEADER m_psh;
89+ HWND m_hWnd;
90+ static int CALLBACK PropSheetProc(HWND hWnd, UINT msg, LPARAM lParam);
91+ HINSTANCE m_hInst;
92+};
93+
94+class TTCPropertyPage : public TTCWnd
95+{
96+public:
97+ TTCPropertyPage(HINSTANCE inst, int id, TTCPropertySheet *sheet);
98+ virtual ~TTCPropertyPage();
99+ virtual void OnInitDialog();
100+ virtual void OnOK();
101+ virtual BOOL OnCommand(WPARAM wp, LPARAM lp);
102+ virtual HBRUSH OnCtlColor(HDC hDC, HWND hWnd);
103+
104+ PROPSHEETPAGE m_psp;
105+ static BOOL CALLBACK Proc(HWND hDlgWnd, UINT msg, WPARAM wp, LPARAM lp);
106+ static UINT CALLBACK PropSheetPageProc(HWND hwnd, UINT uMsg, LPPROPSHEETPAGE ppsp);
107+ TTCPropertySheet *m_pSheet;
108+};
109+
--- branches/cmake/teraterm/teraterm/protodlg.h (revision 7175)
+++ branches/cmake/teraterm/teraterm/protodlg.h (revision 7176)
@@ -1,6 +1,6 @@
11 /*
22 * Copyright (C) 1994-1998 T. Teranishi
3- * (C) 2007-2017 TeraTerm Project
3+ * (C) 2007-2018 TeraTerm Project
44 * All rights reserved.
55 *
66 * Redistribution and use in source and binary forms, with or without
@@ -28,39 +28,25 @@
2828 */
2929
3030 /* TERATERM.EXE, file-transfer-protocol dialog box */
31+#include "tmfc.h"
32+#include "tttypes.h"
3133
3234 // CProtoDlg dialog
33-class CProtoDlg : public CDialog
35+class CProtoDlg : public TTCDialog
3436 {
35-private:
36- PFileVar fv;
37-#ifndef NO_I18N
38- HFONT DlgFont;
39-#endif
4037
4138 public:
42-#ifndef NO_I18N
43- BOOL Create(PFileVar pfv, PTTSet pts);
44-#else
45- BOOL Create(PFileVar pfv);
46-#endif
39+ BOOL Create(HINSTANCE hInstance, HWND hParent, PFileVar pfv, PTTSet pts);
4740
48- //{{AFX_DATA(CProtoDlg)
4941 enum { IDD = IDD_PROTDLG };
50- //}}AFX_DATA
51-
52- //{{AFX_VIRTUAL(CProtoDlg)
53- protected:
42+protected:
5443 virtual void OnCancel( );
5544 virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam);
45+ virtual void OnInitDialog();
5646 virtual void PostNcDestroy();
57- //}}AFX_VIRTUAL
58-
59-protected:
60-
61- //{{AFX_MSG(CProtoDlg)
62- //}}AFX_MSG
63- DECLARE_MESSAGE_MAP()
47+private:
48+ PFileVar fv;
49+ TTTSet *m_pts;
6450 };
6551
6652 typedef CProtoDlg *PProtoDlg;
--- branches/cmake/teraterm/teraterm/filesys.cpp (revision 7175)
+++ branches/cmake/teraterm/teraterm/filesys.cpp (revision 7176)
@@ -1,6 +1,6 @@
11 /*
22 * Copyright (C) 1994-1998 T. Teranishi
3- * (C) 2005-2017 TeraTerm Project
3+ * (C) 2005-2018 TeraTerm Project
44 * All rights reserved.
55 *
66 * Redistribution and use in source and binary forms, with or without
@@ -250,7 +250,7 @@
250250
251251 if (FTDlg!=NULL)
252252 {
253- FTDlg->Create(fv, &cv, &ts);
253+ FTDlg->Create(hInst, HVTWin, fv, &cv, &ts);
254254 FTDlg->RefreshNum();
255255 if (fv->OpId == OpLog) {
256256 HWndLog = FTDlg->m_hWnd; // steven add
@@ -1469,8 +1469,6 @@
14691469 {
14701470 int vsize;
14711471 PProtoDlg pd;
1472- HWND Hpd;
1473- char uimsg[MAX_UIMSG];
14741472
14751473 ProtoId = IdProto;
14761474
@@ -1530,29 +1528,8 @@
15301528 ProtoVar = NULL;
15311529 return FALSE;
15321530 }
1533- pd->Create(fv,&ts);
1531+ pd->Create(hInst, HVTWin, fv, &ts);
15341532
1535- Hpd=pd->GetSafeHwnd();
1536-
1537- GetDlgItemText(Hpd, IDC_PROT_FILENAME, uimsg, sizeof(uimsg));
1538- get_lang_msg("DLG_PROT_FILENAME", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
1539- SetDlgItemText(Hpd, IDC_PROT_FILENAME, ts.UIMsg);
1540- GetDlgItemText(Hpd, IDC_PROT_PROT, uimsg, sizeof(uimsg));
1541- get_lang_msg("DLG_PROT_PROTO", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
1542- SetDlgItemText(Hpd, IDC_PROT_PROT, ts.UIMsg);
1543- GetDlgItemText(Hpd, IDC_PROT_PACKET, uimsg, sizeof(uimsg));
1544- get_lang_msg("DLG_PROT_PACKET", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
1545- SetDlgItemText(Hpd, IDC_PROT_PACKET, ts.UIMsg);
1546- GetDlgItemText(Hpd, IDC_PROT_TRANS, uimsg, sizeof(uimsg));
1547- get_lang_msg("DLG_PROT_TRANS", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
1548- SetDlgItemText(Hpd, IDC_PROT_TRANS, ts.UIMsg);
1549- GetDlgItemText(Hpd, IDC_PROT_ELAPSED, uimsg, sizeof(uimsg));
1550- get_lang_msg("DLG_PROT_ELAPSED", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
1551- SetDlgItemText(Hpd, IDC_PROT_ELAPSED, ts.UIMsg);
1552- GetDlgItemText(Hpd, IDCANCEL, uimsg, sizeof(uimsg));
1553- get_lang_msg("BTN_CANCEL", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
1554- SetDlgItemText(Hpd, IDCANCEL, ts.UIMsg);
1555-
15561533 (*ProtoInit)(ProtoId,FileVar,ProtoVar,&cv,&ts);
15571534
15581535 PtDlg = pd;
--- branches/cmake/teraterm/teraterm/addsetting.cpp (revision 7175)
+++ branches/cmake/teraterm/teraterm/addsetting.cpp (revision 7176)
@@ -1,5 +1,5 @@
11 /*
2- * Copyright (C) 2008-2017 TeraTerm Project
2+ * Copyright (C) 2008-2018 TeraTerm Project
33 * All rights reserved.
44 *
55 * Redistribution and use in source and binary forms, with or without
@@ -30,10 +30,11 @@
3030 * Additional settings dialog
3131 */
3232
33-#include <afxwin.h>
34-#include <afxdlgs.h>
35-#include <afxcmn.h>
33+#include <stdio.h>
34+#include <tchar.h>
35+#include <Windows.h>
3636 #include <commctrl.h>
37+#include <time.h>
3738
3839 #include "addsetting.h"
3940 #include "teraterm.h"
@@ -41,7 +42,16 @@
4142 #include "ttwinman.h"
4243 #include "ttcommon.h"
4344 #include "ttftypes.h"
45+#include "dlglib.h"
46+#include "compat_win.h"
4447
48+#ifndef max
49+#define max(a,b) (((a) > (b)) ? (a) : (b))
50+#endif
51+#ifndef min
52+#define min(a,b) (((a) < (b)) ? (a) : (b))
53+#endif
54+
4555 mouse_cursor_t MouseCursor[] = {
4656 {"ARROW", IDC_ARROW},
4757 {"IBEAM", IDC_IBEAM},
@@ -77,182 +87,98 @@
7787 SendMessage(hWnd, WM_SETTEXT , 0, (LPARAM)buf);
7888 }
7989
80-
81-
8290 // CGeneralPropPageDlg ダイアログ
8391
84-IMPLEMENT_DYNAMIC(CGeneralPropPageDlg, CPropertyPage)
85-
86-CGeneralPropPageDlg::CGeneralPropPageDlg()
87- : CPropertyPage(CGeneralPropPageDlg::IDD)
92+CGeneralPropPageDlg::CGeneralPropPageDlg(HINSTANCE inst, TTCPropertySheet *sheet)
93+ : TTCPropertyPage(inst, CGeneralPropPageDlg::IDD, sheet)
8894 {
95+ get_lang_msg("DLG_TABSHEET_TITLE_GENERAL", ts.UIMsg, sizeof(ts.UIMsg),
96+ "General", ts.UILanguageFile);
97+ m_psp.pszTitle = _tcsdup(ts.UIMsg);
98+ m_psp.dwFlags |= PSP_USETITLE;
8999 }
90100
91101 CGeneralPropPageDlg::~CGeneralPropPageDlg()
92102 {
93- if (DlgGeneralFont != NULL) {
94- DeleteObject(DlgGeneralFont);
95- }
103+ free((void *)m_psp.pszTitle);
96104 }
97105
98-BEGIN_MESSAGE_MAP(CGeneralPropPageDlg, CPropertyPage)
99-END_MESSAGE_MAP()
100-
101106 // CGeneralPropPageDlg メッセージ ハンドラ
102107
103-BOOL CGeneralPropPageDlg::OnInitDialog()
108+void CGeneralPropPageDlg::OnInitDialog()
104109 {
105- char uimsg[MAX_UIMSG];
106- char buf[64];
107- CButton *btn;
110+ TTCPropertyPage::OnInitDialog();
108111
109- CPropertyPage::OnInitDialog();
112+ static const DlgTextInfo TextInfos[] = {
113+ { IDC_CLICKABLE_URL, "DLG_TAB_GENERAL_CLICKURL" },
114+ { IDC_DISABLE_SENDBREAK, "DLG_TAB_GENERAL_DISABLESENDBREAK" },
115+ { IDC_ACCEPT_BROADCAST, "DLG_TAB_GENERAL_ACCEPTBROADCAST" },
116+ { IDC_MOUSEWHEEL_SCROLL_LINE, "DLG_TAB_GENERAL_MOUSEWHEEL_SCROLL_LINE" },
117+ { IDC_AUTOSCROLL_ONLY_IN_BOTTOM_LINE, "DLG_TAB_GENERAL_AUTOSCROLL_ONLY_IN_BOTTOM_LINE" },
118+ { IDC_CLEAR_ON_RESIZE, "DLG_TAB_GENERAL_CLEAR_ON_RESIZE" },
119+ { IDC_CURSOR_CHANGE_IME, "DLG_TAB_GENERAL_CURSOR_CHANGE_IME" },
120+ { IDC_LIST_HIDDEN_FONTS, "DLG_TAB_GENERAL_LIST_HIDDEN_FONTS" },
121+ { IDC_TITLEFMT_GROUP, "DLG_TAB_GENERAL_TITLEFMT_GROUP" },
122+ { IDC_TITLEFMT_DISPHOSTNAME, "DLG_TAB_GENERAL_TITLEFMT_DISPHOSTNAME" },
123+ { IDC_TITLEFMT_DISPSESSION, "DLG_TAB_GENERAL_TITLEFMT_DISPSESSION" },
124+ { IDC_TITLEFMT_DISPVTTEK, "DLG_TAB_GENERAL_TITLEFMT_DISPVTTEK" },
125+ { IDC_TITLEFMT_SWAPHOSTTITLE, "DLG_TAB_GENERAL_TITLEFMT_SWAPHOSTTITLE" },
126+ { IDC_TITLEFMT_DISPTCPPORT, "DLG_TAB_GENERAL_TITLEFMT_DISPTCPPORT" },
127+ { IDC_TITLEFMT_DISPSERIALSPEED, "DLG_TAB_GENERAL_TITLEFMT_DISPSERIALSPEED" }
128+ };
129+ SetDlgTexts(m_hWnd, TextInfos, _countof(TextInfos), ts.UILanguageFile);
110130
111- font = (HFONT)SendMessage(WM_GETFONT, 0, 0);
112- GetObject(font, sizeof(LOGFONT), &logfont);
113- if (get_lang_font("DLG_TAHOMA_FONT", GetSafeHwnd(), &logfont, &DlgGeneralFont, ts.UILanguageFile)) {
114- SendDlgItemMessage(IDC_CLICKABLE_URL, WM_SETFONT, (WPARAM)DlgGeneralFont, MAKELPARAM(TRUE,0));
115- SendDlgItemMessage(IDC_DISABLE_SENDBREAK, WM_SETFONT, (WPARAM)DlgGeneralFont, MAKELPARAM(TRUE,0));
116- SendDlgItemMessage(IDC_ACCEPT_BROADCAST, WM_SETFONT, (WPARAM)DlgGeneralFont, MAKELPARAM(TRUE,0)); // 337: 2007/03/20
117- SendDlgItemMessage(IDC_MOUSEWHEEL_SCROLL_LINE, WM_SETFONT, (WPARAM)DlgGeneralFont, MAKELPARAM(TRUE,0));
118- SendDlgItemMessage(IDC_SCROLL_LINE, WM_SETFONT, (WPARAM)DlgGeneralFont, MAKELPARAM(TRUE,0));
119- SendDlgItemMessage(IDC_AUTOSCROLL_ONLY_IN_BOTTOM_LINE, WM_SETFONT, (WPARAM)DlgGeneralFont, MAKELPARAM(TRUE,0));
120- SendDlgItemMessage(IDC_CLEAR_ON_RESIZE, WM_SETFONT, (WPARAM)DlgGeneralFont, MAKELPARAM(TRUE,0));
121- SendDlgItemMessage(IDC_CURSOR_CHANGE_IME, WM_SETFONT, (WPARAM)DlgGeneralFont, MAKELPARAM(TRUE,0));
122- SendDlgItemMessage(IDC_LIST_HIDDEN_FONTS, WM_SETFONT, (WPARAM)DlgGeneralFont, MAKELPARAM(TRUE,0));
123- SendDlgItemMessage(IDC_TITLEFMT_GROUP, WM_SETFONT, (WPARAM)DlgGeneralFont, MAKELPARAM(TRUE,0));
124- SendDlgItemMessage(IDC_TITLEFMT_DISPHOSTNAME, WM_SETFONT, (WPARAM)DlgGeneralFont, MAKELPARAM(TRUE,0));
125- SendDlgItemMessage(IDC_TITLEFMT_DISPSESSION, WM_SETFONT, (WPARAM)DlgGeneralFont, MAKELPARAM(TRUE,0));
126- SendDlgItemMessage(IDC_TITLEFMT_DISPVTTEK, WM_SETFONT, (WPARAM)DlgGeneralFont, MAKELPARAM(TRUE,0));
127- SendDlgItemMessage(IDC_TITLEFMT_SWAPHOSTTITLE, WM_SETFONT, (WPARAM)DlgGeneralFont, MAKELPARAM(TRUE,0));
128- SendDlgItemMessage(IDC_TITLEFMT_DISPTCPPORT, WM_SETFONT, (WPARAM)DlgGeneralFont, MAKELPARAM(TRUE,0));
129- SendDlgItemMessage(IDC_TITLEFMT_DISPSERIALSPEED, WM_SETFONT, (WPARAM)DlgGeneralFont, MAKELPARAM(TRUE,0));
130- }
131- else {
132- DlgGeneralFont = NULL;
133- }
134-
135- GetDlgItemText(IDC_CLICKABLE_URL, uimsg, sizeof(uimsg));
136- get_lang_msg("DLG_TAB_GENERAL_CLICKURL", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
137- SetDlgItemText(IDC_CLICKABLE_URL, ts.UIMsg);
138- GetDlgItemText(IDC_DISABLE_SENDBREAK, uimsg, sizeof(uimsg));
139- get_lang_msg("DLG_TAB_GENERAL_DISABLESENDBREAK", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
140- SetDlgItemText(IDC_DISABLE_SENDBREAK, ts.UIMsg);
141- GetDlgItemText(IDC_ACCEPT_BROADCAST, uimsg, sizeof(uimsg));
142- get_lang_msg("DLG_TAB_GENERAL_ACCEPTBROADCAST", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
143- SetDlgItemText(IDC_ACCEPT_BROADCAST, ts.UIMsg);
144- GetDlgItemText(IDC_MOUSEWHEEL_SCROLL_LINE, uimsg, sizeof(uimsg));
145- get_lang_msg("DLG_TAB_GENERAL_MOUSEWHEEL_SCROLL_LINE", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
146- SetDlgItemText(IDC_MOUSEWHEEL_SCROLL_LINE, ts.UIMsg);
147- GetDlgItemText(IDC_AUTOSCROLL_ONLY_IN_BOTTOM_LINE, uimsg, sizeof(uimsg));
148- get_lang_msg("DLG_TAB_GENERAL_AUTOSCROLL_ONLY_IN_BOTTOM_LINE", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
149- SetDlgItemText(IDC_AUTOSCROLL_ONLY_IN_BOTTOM_LINE, ts.UIMsg);
150- GetDlgItemText(IDC_CLEAR_ON_RESIZE, uimsg, sizeof(uimsg));
151- get_lang_msg("DLG_TAB_GENERAL_CLEAR_ON_RESIZE", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
152- SetDlgItemText(IDC_CLEAR_ON_RESIZE, ts.UIMsg);
153- GetDlgItemText(IDC_CURSOR_CHANGE_IME, uimsg, sizeof(uimsg));
154- get_lang_msg("DLG_TAB_GENERAL_CURSOR_CHANGE_IME", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
155- SetDlgItemText(IDC_CURSOR_CHANGE_IME, ts.UIMsg);
156- GetDlgItemText(IDC_LIST_HIDDEN_FONTS, uimsg, sizeof(uimsg));
157- get_lang_msg("DLG_TAB_GENERAL_LIST_HIDDEN_FONTS", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
158- SetDlgItemText(IDC_LIST_HIDDEN_FONTS, ts.UIMsg);
159-
160- GetDlgItemText(IDC_TITLEFMT_GROUP, uimsg, sizeof(uimsg));
161- get_lang_msg("DLG_TAB_GENERAL_TITLEFMT_GROUP", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
162- SetDlgItemText(IDC_TITLEFMT_GROUP, ts.UIMsg);
163- GetDlgItemText(IDC_TITLEFMT_DISPHOSTNAME, uimsg, sizeof(uimsg));
164- get_lang_msg("DLG_TAB_GENERAL_TITLEFMT_DISPHOSTNAME", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
165- SetDlgItemText(IDC_TITLEFMT_DISPHOSTNAME, ts.UIMsg);
166- GetDlgItemText(IDC_TITLEFMT_DISPSESSION, uimsg, sizeof(uimsg));
167- get_lang_msg("DLG_TAB_GENERAL_TITLEFMT_DISPSESSION", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
168- SetDlgItemText(IDC_TITLEFMT_DISPSESSION, ts.UIMsg);
169- GetDlgItemText(IDC_TITLEFMT_DISPVTTEK, uimsg, sizeof(uimsg));
170- get_lang_msg("DLG_TAB_GENERAL_TITLEFMT_DISPVTTEK", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
171- SetDlgItemText(IDC_TITLEFMT_DISPVTTEK, ts.UIMsg);
172- GetDlgItemText(IDC_TITLEFMT_SWAPHOSTTITLE, uimsg, sizeof(uimsg));
173- get_lang_msg("DLG_TAB_GENERAL_TITLEFMT_SWAPHOSTTITLE", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
174- SetDlgItemText(IDC_TITLEFMT_SWAPHOSTTITLE, ts.UIMsg);
175- GetDlgItemText(IDC_TITLEFMT_DISPTCPPORT, uimsg, sizeof(uimsg));
176- get_lang_msg("DLG_TAB_GENERAL_TITLEFMT_DISPTCPPORT", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
177- SetDlgItemText(IDC_TITLEFMT_DISPTCPPORT, ts.UIMsg);
178- GetDlgItemText(IDC_TITLEFMT_DISPSERIALSPEED, uimsg, sizeof(uimsg));
179- get_lang_msg("DLG_TAB_GENERAL_TITLEFMT_DISPSERIALSPEED", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
180- SetDlgItemText(IDC_TITLEFMT_DISPSERIALSPEED, ts.UIMsg);
181-
182131 // (1)DisableAcceleratorSendBreak
183- btn = (CButton *)GetDlgItem(IDC_DISABLE_SENDBREAK);
184- btn->SetCheck(ts.DisableAcceleratorSendBreak);
132+ SetCheck(IDC_DISABLE_SENDBREAK, ts.DisableAcceleratorSendBreak);
185133
186134 // (2)EnableClickableUrl
187- btn = (CButton *)GetDlgItem(IDC_CLICKABLE_URL);
188- btn->SetCheck(ts.EnableClickableUrl);
135+ SetCheck(IDC_CLICKABLE_URL, ts.EnableClickableUrl);
189136
190137 // (3)AcceptBroadcast 337: 2007/03/20
191- btn = (CButton *)GetDlgItem(IDC_ACCEPT_BROADCAST);
192- btn->SetCheck(ts.AcceptBroadcast);
138+ SetCheck(IDC_ACCEPT_BROADCAST, ts.AcceptBroadcast);
193139
194140 // (4)IDC_MOUSEWHEEL_SCROLL_LINE
141+ char buf[64];
195142 _snprintf_s(buf, sizeof(buf), "%d", ts.MouseWheelScrollLine);
196143 SetDlgItemText(IDC_SCROLL_LINE, buf);
197144
198145 // (5)IDC_AUTOSCROLL_ONLY_IN_BOTTOM_LINE
199- btn = (CButton *)GetDlgItem(IDC_AUTOSCROLL_ONLY_IN_BOTTOM_LINE);
200- btn->SetCheck(ts.AutoScrollOnlyInBottomLine);
146+ SetCheck(IDC_AUTOSCROLL_ONLY_IN_BOTTOM_LINE, ts.AutoScrollOnlyInBottomLine);
201147
202148 // (6)IDC_CLEAR_ON_RESIZE
203- btn = (CButton *)GetDlgItem(IDC_CLEAR_ON_RESIZE);
204- btn->SetCheck((ts.TermFlag & TF_CLEARONRESIZE) != 0);
149+ SetCheck(IDC_CLEAR_ON_RESIZE, (ts.TermFlag & TF_CLEARONRESIZE) != 0);
205150
206151 // (7)IDC_CURSOR_CHANGE_IME
207- btn = (CButton *)GetDlgItem(IDC_CURSOR_CHANGE_IME);
208- btn->SetCheck((ts.WindowFlag & WF_IMECURSORCHANGE) != 0);
152+ SetCheck(IDC_CURSOR_CHANGE_IME, (ts.WindowFlag & WF_IMECURSORCHANGE) != 0);
209153
210154 // (8)IDC_LIST_HIDDEN_FONTS
211- btn = (CButton *)GetDlgItem(IDC_LIST_HIDDEN_FONTS);
212- btn->SetCheck(ts.ListHiddenFonts);
155+ SetCheck(IDC_LIST_HIDDEN_FONTS, ts.ListHiddenFonts);
213156
214157 // (9) Title Format
215- btn = (CButton *)GetDlgItem(IDC_TITLEFMT_DISPHOSTNAME);
216- btn->SetCheck((ts.TitleFormat & 1) != 0);
158+ SetCheck(IDC_TITLEFMT_DISPHOSTNAME, (ts.TitleFormat & 1) != 0);
159+ SetCheck(IDC_TITLEFMT_DISPSESSION, (ts.TitleFormat & (1<<1)) != 0);
160+ SetCheck(IDC_TITLEFMT_DISPVTTEK, (ts.TitleFormat & (1<<2)) != 0);
161+ SetCheck(IDC_TITLEFMT_SWAPHOSTTITLE, (ts.TitleFormat & (1<<3)) != 0);
162+ SetCheck(IDC_TITLEFMT_DISPTCPPORT, (ts.TitleFormat & (1<<4)) != 0);
163+ SetCheck(IDC_TITLEFMT_DISPSERIALSPEED, (ts.TitleFormat & (1<<5)) != 0);
217164
218- btn = (CButton *)GetDlgItem(IDC_TITLEFMT_DISPSESSION);
219- btn->SetCheck((ts.TitleFormat & (1<<1)) != 0);
220-
221- btn = (CButton *)GetDlgItem(IDC_TITLEFMT_DISPVTTEK);
222- btn->SetCheck((ts.TitleFormat & (1<<2)) != 0);
223-
224- btn = (CButton *)GetDlgItem(IDC_TITLEFMT_SWAPHOSTTITLE);
225- btn->SetCheck((ts.TitleFormat & (1<<3)) != 0);
226-
227- btn = (CButton *)GetDlgItem(IDC_TITLEFMT_DISPTCPPORT);
228- btn->SetCheck((ts.TitleFormat & (1<<4)) != 0);
229-
230- btn = (CButton *)GetDlgItem(IDC_TITLEFMT_DISPSERIALSPEED);
231- btn->SetCheck((ts.TitleFormat & (1<<5)) != 0);
232-
233165 // ダイアログにフォーカスを当てる (2004.12.7 yutaka)
234166 ::SetFocus(::GetDlgItem(GetSafeHwnd(), IDC_CLICKABLE_URL));
235-
236- return FALSE;
237167 }
238168
239169 void CGeneralPropPageDlg::OnOK()
240170 {
241- CButton *btn;
242171 char buf[64];
243172 int val;
244173
245174 // (1)
246- btn = (CButton *)GetDlgItem(IDC_DISABLE_SENDBREAK);
247- ts.DisableAcceleratorSendBreak = btn->GetCheck();
175+ ts.DisableAcceleratorSendBreak = GetCheck(IDC_DISABLE_SENDBREAK);
248176
249177 // (2)
250- btn = (CButton *)GetDlgItem(IDC_CLICKABLE_URL);
251- ts.EnableClickableUrl = btn->GetCheck();
178+ ts.EnableClickableUrl = GetCheck(IDC_CLICKABLE_URL);
252179
253180 // (3) 337: 2007/03/20
254- btn = (CButton *)GetDlgItem(IDC_ACCEPT_BROADCAST);
255- ts.AcceptBroadcast = btn->GetCheck();
181+ ts.AcceptBroadcast = GetCheck(IDC_ACCEPT_BROADCAST);
256182
257183 // (4)IDC_MOUSEWHEEL_SCROLL_LINE
258184 GetDlgItemText(IDC_SCROLL_LINE, buf, sizeof(buf));
@@ -261,101 +187,68 @@
261187 ts.MouseWheelScrollLine = val;
262188
263189 // (5)IDC_AUTOSCROLL_ONLY_IN_BOTTOM_LINE
264- btn = (CButton *)GetDlgItem(IDC_AUTOSCROLL_ONLY_IN_BOTTOM_LINE);
265- ts.AutoScrollOnlyInBottomLine = btn->GetCheck();
190+ ts.AutoScrollOnlyInBottomLine = GetCheck(IDC_AUTOSCROLL_ONLY_IN_BOTTOM_LINE);
266191
267192 // (6)IDC_CLEAR_ON_RESIZE
268- btn = (CButton *)GetDlgItem(IDC_CLEAR_ON_RESIZE);
269- if (((ts.TermFlag & TF_CLEARONRESIZE) != 0) != btn->GetCheck()) {
193+ if (((ts.TermFlag & TF_CLEARONRESIZE) != 0) != GetCheck(IDC_CLEAR_ON_RESIZE)) {
270194 ts.TermFlag ^= TF_CLEARONRESIZE;
271195 }
272196
273197 // (7)IDC_CURSOR_CHANGE_IME
274- btn = (CButton *)GetDlgItem(IDC_CURSOR_CHANGE_IME);
275- if (((ts.WindowFlag & WF_IMECURSORCHANGE) != 0) != btn->GetCheck()) {
198+ if (((ts.WindowFlag & WF_IMECURSORCHANGE) != 0) != GetCheck(IDC_CURSOR_CHANGE_IME)) {
276199 ts.WindowFlag ^= WF_IMECURSORCHANGE;
277200 }
278201
279202 // (8)IDC_LIST_HIDDEN_FONTS
280- btn = (CButton *)GetDlgItem(IDC_LIST_HIDDEN_FONTS);
281- ts.ListHiddenFonts = btn->GetCheck();
203+ ts.ListHiddenFonts = GetCheck(IDC_LIST_HIDDEN_FONTS);
282204
283205 // (9) Title Format
284- btn = (CButton *)GetDlgItem(IDC_TITLEFMT_DISPHOSTNAME);
285- ts.TitleFormat = (btn->GetCheck() == BST_CHECKED);
286- btn = (CButton *)GetDlgItem(IDC_TITLEFMT_DISPSESSION);
287- ts.TitleFormat |= ((btn->GetCheck() == BST_CHECKED) << 1);
288- btn = (CButton *)GetDlgItem(IDC_TITLEFMT_DISPVTTEK);
289- ts.TitleFormat |= ((btn->GetCheck() == BST_CHECKED) << 2);
290- btn = (CButton *)GetDlgItem(IDC_TITLEFMT_SWAPHOSTTITLE);
291- ts.TitleFormat |= ((btn->GetCheck() == BST_CHECKED) << 3);
292- btn = (CButton *)GetDlgItem(IDC_TITLEFMT_DISPTCPPORT);
293- ts.TitleFormat |= ((btn->GetCheck() == BST_CHECKED) << 4);
294- btn = (CButton *)GetDlgItem(IDC_TITLEFMT_DISPSERIALSPEED);
295- ts.TitleFormat |= ((btn->GetCheck() == BST_CHECKED) << 5);
206+ ts.TitleFormat = GetCheck(IDC_TITLEFMT_DISPHOSTNAME) == BST_CHECKED;
207+ ts.TitleFormat |= (GetCheck(IDC_TITLEFMT_DISPSESSION) == BST_CHECKED) << 1;
208+ ts.TitleFormat |= (GetCheck(IDC_TITLEFMT_DISPVTTEK) == BST_CHECKED) << 2;
209+ ts.TitleFormat |= (GetCheck(IDC_TITLEFMT_SWAPHOSTTITLE) == BST_CHECKED) << 3;
210+ ts.TitleFormat |= (GetCheck(IDC_TITLEFMT_DISPTCPPORT) == BST_CHECKED) << 4;
211+ ts.TitleFormat |= (GetCheck(IDC_TITLEFMT_DISPSERIALSPEED) == BST_CHECKED) << 5;
296212 }
297213
298-
299-
300214 // CSequencePropPageDlg ダイアログ
301215
302-IMPLEMENT_DYNAMIC(CSequencePropPageDlg, CPropertyPage)
303-
304-CSequencePropPageDlg::CSequencePropPageDlg()
305- : CPropertyPage(CSequencePropPageDlg::IDD)
216+CSequencePropPageDlg::CSequencePropPageDlg(HINSTANCE inst, TTCPropertySheet *sheet)
217+ : TTCPropertyPage(inst, CSequencePropPageDlg::IDD, sheet)
306218 {
219+ get_lang_msg("DLG_TABSHEET_TITLE_SEQUENCE", ts.UIMsg, sizeof(ts.UIMsg),
220+ "Control Sequence", ts.UILanguageFile);
221+ m_psp.pszTitle = _tcsdup(ts.UIMsg);
222+ m_psp.dwFlags |= PSP_USETITLE;
307223 }
308224
309225 CSequencePropPageDlg::~CSequencePropPageDlg()
310226 {
311- if (DlgSequenceFont != NULL) {
312- DeleteObject(DlgSequenceFont);
313- }
227+ free((void *)m_psp.pszTitle);
314228 }
315229
316-BEGIN_MESSAGE_MAP(CSequencePropPageDlg, CPropertyPage)
317-END_MESSAGE_MAP()
318-
319230 // CSequencePropPageDlg メッセージ ハンドラ
320231
321-BOOL CSequencePropPageDlg::OnInitDialog()
232+void CSequencePropPageDlg::OnInitDialog()
322233 {
323- char uimsg[MAX_UIMSG];
324- CButton *btn, *btn2;
325- CComboBox *cmb;
234+ TTCPropertyPage::OnInitDialog();
326235
327- CPropertyPage::OnInitDialog();
236+ static const DlgTextInfo TextInfos[] = {
237+ { IDC_ACCEPT_MOUSE_EVENT_TRACKING, "DLG_TAB_SEQUENCE_ACCEPT_MOUSE_EVENT_TRACKING" },
238+ { IDC_DISABLE_MOUSE_TRACKING_CTRL, "DLG_TAB_SEQUENCE_DISABLE_MOUSE_TRACKING_CTRL" },
239+ { IDC_ACCEPT_TITLE_CHANGING_LABEL, "DLG_TAB_SEQUENCE_ACCEPT_TITLE_CHANGING" },
328240
329- font = (HFONT)SendMessage(WM_GETFONT, 0, 0);
330- GetObject(font, sizeof(LOGFONT), &logfont);
331- if (get_lang_font("DLG_TAHOMA_FONT", GetSafeHwnd(), &logfont, &DlgSequenceFont, ts.UILanguageFile)) {
332- SendDlgItemMessage(IDC_ACCEPT_MOUSE_EVENT_TRACKING, WM_SETFONT, (WPARAM)DlgSequenceFont, MAKELPARAM(TRUE,0));
333- SendDlgItemMessage(IDC_DISABLE_MOUSE_TRACKING_CTRL, WM_SETFONT, (WPARAM)DlgSequenceFont, MAKELPARAM(TRUE,0));
334- SendDlgItemMessage(IDC_ACCEPT_TITLE_CHANGING_LABEL, WM_SETFONT, (WPARAM)DlgSequenceFont, MAKELPARAM(TRUE,0));
335- SendDlgItemMessage(IDC_ACCEPT_TITLE_CHANGING, WM_SETFONT, (WPARAM)DlgSequenceFont, MAKELPARAM(TRUE,0));
336- SendDlgItemMessage(IDC_TITLE_REPORT_LABEL, WM_SETFONT, (WPARAM)DlgSequenceFont, MAKELPARAM(TRUE,0));
337- SendDlgItemMessage(IDC_TITLE_REPORT, WM_SETFONT, (WPARAM)DlgSequenceFont, MAKELPARAM(TRUE,0));
338- SendDlgItemMessage(IDC_WINDOW_CTRL, WM_SETFONT, (WPARAM)DlgSequenceFont, MAKELPARAM(TRUE,0));
339- SendDlgItemMessage(IDC_WINDOW_REPORT, WM_SETFONT, (WPARAM)DlgSequenceFont, MAKELPARAM(TRUE,0));
340- SendDlgItemMessage(IDC_CURSOR_CTRL_SEQ, WM_SETFONT, (WPARAM)DlgSequenceFont, MAKELPARAM(TRUE,0));
341- SendDlgItemMessage(IDC_CLIPBOARD_ACCESS_LABEL, WM_SETFONT, (WPARAM)DlgSequenceFont, MAKELPARAM(TRUE,0));
342- SendDlgItemMessage(IDC_CLIPBOARD_ACCESS, WM_SETFONT, (WPARAM)DlgSequenceFont, MAKELPARAM(TRUE,0));
343- SendDlgItemMessage(IDC_CLIPBOARD_NOTIFY, WM_SETFONT, (WPARAM)DlgSequenceFont, MAKELPARAM(TRUE,0));
344- }
345- else {
346- DlgSequenceFont = NULL;
347- }
241+ { IDC_CURSOR_CTRL_SEQ, "DLG_TAB_SEQUENCE_CURSOR_CTRL" },
242+ { IDC_WINDOW_CTRL, "DLG_TAB_SEQUENCE_WINDOW_CTRL" },
243+ { IDC_WINDOW_REPORT, "DLG_TAB_SEQUENCE_WINDOW_REPORT" },
244+ { IDC_TITLE_REPORT_LABEL, "DLG_TAB_SEQUENCE_TITLE_REPORT" },
348245
349- GetDlgItemText(IDC_ACCEPT_MOUSE_EVENT_TRACKING, uimsg, sizeof(uimsg));
350- get_lang_msg("DLG_TAB_SEQUENCE_ACCEPT_MOUSE_EVENT_TRACKING", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
351- SetDlgItemText(IDC_ACCEPT_MOUSE_EVENT_TRACKING, ts.UIMsg);
352- GetDlgItemText(IDC_DISABLE_MOUSE_TRACKING_CTRL, uimsg, sizeof(uimsg));
353- get_lang_msg("DLG_TAB_SEQUENCE_DISABLE_MOUSE_TRACKING_CTRL", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
354- SetDlgItemText(IDC_DISABLE_MOUSE_TRACKING_CTRL, ts.UIMsg);
355- GetDlgItemText(IDC_ACCEPT_TITLE_CHANGING_LABEL, uimsg, sizeof(uimsg));
356- get_lang_msg("DLG_TAB_SEQUENCE_ACCEPT_TITLE_CHANGING", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
357- SetDlgItemText(IDC_ACCEPT_TITLE_CHANGING_LABEL, ts.UIMsg);
246+ { IDC_CLIPBOARD_ACCESS_LABEL, "DLG_TAB_SEQUENCE_CLIPBOARD_ACCESS" },
358247
248+ { IDC_CLIPBOARD_NOTIFY, "DLG_TAB_SEQUENCE_CLIPBOARD_NOTIFY" },
249+ };
250+ SetDlgTexts(m_hWnd, TextInfos, _countof(TextInfos), ts.UILanguageFile);
251+
359252 get_lang_msg("DLG_TAB_SEQUENCE_ACCEPT_TITLE_CHANGING_OFF", ts.UIMsg, sizeof(ts.UIMsg), "off", ts.UILanguageFile);
360253 SendDlgItemMessage(IDC_ACCEPT_TITLE_CHANGING, CB_ADDSTRING, 0, (LPARAM)ts.UIMsg);
361254 get_lang_msg("DLG_TAB_SEQUENCE_ACCEPT_TITLE_CHANGING_OVERWRITE", ts.UIMsg, sizeof(ts.UIMsg), "overwrite", ts.UILanguageFile);
@@ -365,19 +258,6 @@
365258 get_lang_msg("DLG_TAB_SEQUENCE_ACCEPT_TITLE_CHANGING_LAST", ts.UIMsg, sizeof(ts.UIMsg), "last", ts.UILanguageFile);
366259 SendDlgItemMessage(IDC_ACCEPT_TITLE_CHANGING, CB_ADDSTRING, 0, (LPARAM)ts.UIMsg);
367260
368- GetDlgItemText(IDC_CURSOR_CTRL_SEQ, uimsg, sizeof(uimsg));
369- get_lang_msg("DLG_TAB_SEQUENCE_CURSOR_CTRL", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
370- SetDlgItemText(IDC_CURSOR_CTRL_SEQ, ts.UIMsg);
371- GetDlgItemText(IDC_WINDOW_CTRL, uimsg, sizeof(uimsg));
372- get_lang_msg("DLG_TAB_SEQUENCE_WINDOW_CTRL", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
373- SetDlgItemText(IDC_WINDOW_CTRL, ts.UIMsg);
374- GetDlgItemText(IDC_WINDOW_REPORT, uimsg, sizeof(uimsg));
375- get_lang_msg("DLG_TAB_SEQUENCE_WINDOW_REPORT", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
376- SetDlgItemText(IDC_WINDOW_REPORT, ts.UIMsg);
377- GetDlgItemText(IDC_TITLE_REPORT_LABEL, uimsg, sizeof(uimsg));
378- get_lang_msg("DLG_TAB_SEQUENCE_TITLE_REPORT", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
379- SetDlgItemText(IDC_TITLE_REPORT_LABEL, ts.UIMsg);
380-
381261 get_lang_msg("DLG_TAB_SEQUENCE_TITLE_REPORT_IGNORE", ts.UIMsg, sizeof(ts.UIMsg), "ignore", ts.UILanguageFile);
382262 SendDlgItemMessage(IDC_TITLE_REPORT, CB_ADDSTRING, 0, (LPARAM)ts.UIMsg);
383263 get_lang_msg("DLG_TAB_SEQUENCE_TITLE_REPORT_ACCEPT", ts.UIMsg, sizeof(ts.UIMsg), "accept", ts.UILanguageFile);
@@ -385,10 +265,6 @@
385265 get_lang_msg("DLG_TAB_SEQUENCE_TITLE_REPORT_EMPTY", ts.UIMsg, sizeof(ts.UIMsg), "empty", ts.UILanguageFile);
386266 SendDlgItemMessage(IDC_TITLE_REPORT, CB_ADDSTRING, 0, (LPARAM)ts.UIMsg);
387267
388- GetDlgItemText(IDC_CLIPBOARD_ACCESS_LABEL, uimsg, sizeof(uimsg));
389- get_lang_msg("DLG_TAB_SEQUENCE_CLIPBOARD_ACCESS", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
390- SetDlgItemText(IDC_CLIPBOARD_ACCESS_LABEL, ts.UIMsg);
391-
392268 get_lang_msg("DLG_TAB_SEQUENCE_CLIPBOARD_ACCESS_OFF", ts.UIMsg, sizeof(ts.UIMsg), "off", ts.UILanguageFile);
393269 SendDlgItemMessage(IDC_CLIPBOARD_ACCESS, CB_ADDSTRING, 0, (LPARAM)ts.UIMsg);
394270 get_lang_msg("DLG_TAB_SEQUENCE_CLIPBOARD_ACCESS_WRITE", ts.UIMsg, sizeof(ts.UIMsg), "write only", ts.UILanguageFile);
@@ -398,128 +274,73 @@
398274 get_lang_msg("DLG_TAB_SEQUENCE_CLIPBOARD_ACCESS_ON", ts.UIMsg, sizeof(ts.UIMsg), "read/write", ts.UILanguageFile);
399275 SendDlgItemMessage(IDC_CLIPBOARD_ACCESS, CB_ADDSTRING, 0, (LPARAM)ts.UIMsg);
400276
401- GetDlgItemText(IDC_CLIPBOARD_NOTIFY, uimsg, sizeof(uimsg));
402- get_lang_msg("DLG_TAB_SEQUENCE_CLIPBOARD_NOTIFY", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
403- SetDlgItemText(IDC_CLIPBOARD_NOTIFY, ts.UIMsg);
404-
405277 // (1)IDC_ACCEPT_MOUSE_EVENT_TRACKING
406- btn = (CButton *)GetDlgItem(IDC_ACCEPT_MOUSE_EVENT_TRACKING);
407- btn2 = (CButton *)GetDlgItem(IDC_DISABLE_MOUSE_TRACKING_CTRL);
408- btn->SetCheck(ts.MouseEventTracking);
409- if (ts.MouseEventTracking) {
410- btn2->EnableWindow(TRUE);
411- } else {
412- btn2->EnableWindow(FALSE);
413- }
278+ SetCheck(IDC_ACCEPT_MOUSE_EVENT_TRACKING, ts.MouseEventTracking);
279+ EnableDlgItem(IDC_DISABLE_MOUSE_TRACKING_CTRL, ts.MouseEventTracking ? TRUE : FALSE);
414280
415281 // (2)IDC_DISABLE_MOUSE_TRACKING_CTRL
416- btn2->SetCheck(ts.DisableMouseTrackingByCtrl);
282+ SetCheck(IDC_DISABLE_MOUSE_TRACKING_CTRL, ts.DisableMouseTrackingByCtrl);
417283
418284 // (3)IDC_ACCEPT_TITLE_CHANGING
419- cmb = (CComboBox *)GetDlgItem(IDC_ACCEPT_TITLE_CHANGING);
420- cmb->SetCurSel(ts.AcceptTitleChangeRequest);
285+ SetCurSel(IDC_ACCEPT_TITLE_CHANGING, ts.AcceptTitleChangeRequest);
421286
422287 // (4)IDC_TITLE_REPORT
423- cmb = (CComboBox *)GetDlgItem(IDC_TITLE_REPORT);
424- switch (ts.WindowFlag & WF_TITLEREPORT) {
425- case IdTitleReportIgnore:
426- cmb->SetCurSel(0);
427- break;
428- case IdTitleReportAccept:
429- cmb->SetCurSel(1);
430- break;
431- default: // IdTitleReportEmpty
432- cmb->SetCurSel(2);
433- break;
434- }
288+ SetCurSel(IDC_TITLE_REPORT,
289+ (ts.WindowFlag & WF_TITLEREPORT) == IdTitleReportIgnore ? 0 :
290+ (ts.WindowFlag & WF_TITLEREPORT) == IdTitleReportAccept ? 1
291+ /*(ts.WindowFlag & WF_TITLEREPORT) == IdTitleReportEmptye ? */ : 2);
435292
436293 // (5)IDC_WINDOW_CTRL
437- btn = (CButton *)GetDlgItem(IDC_WINDOW_CTRL);
438- btn->SetCheck((ts.WindowFlag & WF_WINDOWCHANGE) != 0);
294+ SetCheck(IDC_WINDOW_CTRL, (ts.WindowFlag & WF_WINDOWCHANGE) != 0);
439295
440296 // (6)IDC_WINDOW_REPORT
441- btn = (CButton *)GetDlgItem(IDC_WINDOW_REPORT);
442- btn->SetCheck((ts.WindowFlag & WF_WINDOWREPORT) != 0);
297+ SetCheck(IDC_WINDOW_REPORT, (ts.WindowFlag & WF_WINDOWREPORT) != 0);
443298
444299 // (7)IDC_CURSOR_CTRL_SEQ
445- btn = (CButton *)GetDlgItem(IDC_CURSOR_CTRL_SEQ);
446- btn->SetCheck((ts.WindowFlag & WF_CURSORCHANGE) != 0);
300+ SetCheck(IDC_CURSOR_CTRL_SEQ, (ts.WindowFlag & WF_CURSORCHANGE) != 0);
447301
448302 // (8)IDC_CLIPBOARD_ACCESS
449- cmb = (CComboBox *)GetDlgItem(IDC_CLIPBOARD_ACCESS);
450- switch (ts.CtrlFlag & CSF_CBRW) {
451- case CSF_CBRW:
452- cmb->SetCurSel(3);
453- break;
454- case CSF_CBREAD:
455- cmb->SetCurSel(2);
456- break;
457- case CSF_CBWRITE:
458- cmb->SetCurSel(1);
459- break;
460- default: // off
461- cmb->SetCurSel(0);
462- break;
463- }
303+ SetCurSel(IDC_CLIPBOARD_ACCESS,
304+ (ts.CtrlFlag & CSF_CBRW) == CSF_CBRW ? 3 :
305+ (ts.CtrlFlag & CSF_CBRW) == CSF_CBREAD ? 2 :
306+ (ts.CtrlFlag & CSF_CBRW) == CSF_CBWRITE ? 1 :
307+ 0); // off
464308
465309 // (9)IDC_CLIPBOARD_NOTIFY
466- btn = (CButton *)GetDlgItem(IDC_CLIPBOARD_NOTIFY);
467- btn->SetCheck(ts.NotifyClipboardAccess);
468- if (HasBalloonTipSupport()) {
469- btn->EnableWindow(TRUE);
470- }
471- else {
472- btn->EnableWindow(FALSE);
473- }
310+ SetCheck(IDC_CLIPBOARD_NOTIFY, ts.NotifyClipboardAccess);
311+ EnableDlgItem(IDC_CLIPBOARD_NOTIFY, HasBalloonTipSupport() ? TRUE : FALSE);
474312
475313 // ダイアログにフォーカスを当てる (2004.12.7 yutaka)
476314 ::SetFocus(::GetDlgItem(GetSafeHwnd(), IDC_ACCEPT_MOUSE_EVENT_TRACKING));
477-
478- return FALSE;
479315 }
480316
481317 BOOL CSequencePropPageDlg::OnCommand(WPARAM wParam, LPARAM lParam)
482318 {
483- CButton *btn, *btn2;
484-
485319 switch (wParam) {
486320 case IDC_ACCEPT_MOUSE_EVENT_TRACKING | (BN_CLICKED << 16):
487- btn = (CButton *)GetDlgItem(IDC_ACCEPT_MOUSE_EVENT_TRACKING);
488- btn2 = (CButton *)GetDlgItem(IDC_DISABLE_MOUSE_TRACKING_CTRL);
489- if (btn->GetCheck()) {
490- btn2->EnableWindow(TRUE);
491- } else {
492- btn2->EnableWindow(FALSE);
493- }
321+ EnableDlgItem(IDC_DISABLE_MOUSE_TRACKING_CTRL,
322+ GetCheck(IDC_ACCEPT_MOUSE_EVENT_TRACKING) ? TRUE : FALSE);
494323 return TRUE;
495324 }
496- return CPropertyPage::OnCommand(wParam, lParam);
325+ return TTCPropertyPage::OnCommand(wParam, lParam);
497326 }
498327
499328 void CSequencePropPageDlg::OnOK()
500329 {
501- CButton *btn;
502- CComboBox *cmb;
503- int sel;
504-
505330 // (1)IDC_ACCEPT_MOUSE_EVENT_TRACKING
506- btn = (CButton *)GetDlgItem(IDC_ACCEPT_MOUSE_EVENT_TRACKING);
507- ts.MouseEventTracking = btn->GetCheck();
331+ ts.MouseEventTracking = GetCheck(IDC_ACCEPT_MOUSE_EVENT_TRACKING);
508332
509333 // (2)IDC_DISABLE_MOUSE_TRACKING_CTRL
510- btn = (CButton *)GetDlgItem(IDC_DISABLE_MOUSE_TRACKING_CTRL);
511- ts.DisableMouseTrackingByCtrl = btn->GetCheck();
334+ ts.DisableMouseTrackingByCtrl = GetCheck(IDC_DISABLE_MOUSE_TRACKING_CTRL);
512335
513336 // (3)IDC_ACCEPT_TITLE_CHANGING
514- cmb = (CComboBox *)GetDlgItem(IDC_ACCEPT_TITLE_CHANGING);
515- sel = cmb->GetCurSel();
337+ int sel = GetCurSel(IDC_ACCEPT_TITLE_CHANGING);
516338 if (0 <= sel && sel <= IdTitleChangeRequestMax) {
517339 ts.AcceptTitleChangeRequest = sel;
518340 }
519341
520342 // (4)IDC_TITLE_REPORT
521- cmb = (CComboBox *)GetDlgItem(IDC_TITLE_REPORT);
522- switch (cmb->GetCurSel()) {
343+ switch (GetCurSel(IDC_TITLE_REPORT)) {
523344 case 0:
524345 ts.WindowFlag &= ~WF_TITLEREPORT;
525346 break;
@@ -535,26 +356,22 @@
535356 }
536357
537358 // (5)IDC_WINDOW_CTRL
538- btn = (CButton *)GetDlgItem(IDC_WINDOW_CTRL);
539- if (((ts.WindowFlag & WF_WINDOWCHANGE) != 0) != btn->GetCheck()) {
359+ if (((ts.WindowFlag & WF_WINDOWCHANGE) != 0) != GetCheck(IDC_WINDOW_CTRL)) {
540360 ts.WindowFlag ^= WF_WINDOWCHANGE;
541361 }
542362
543363 // (6)IDC_WINDOW_REPORT
544- btn = (CButton *)GetDlgItem(IDC_WINDOW_REPORT);
545- if (((ts.WindowFlag & WF_WINDOWREPORT) != 0) != btn->GetCheck()) {
364+ if (((ts.WindowFlag & WF_WINDOWREPORT) != 0) != GetCheck(IDC_WINDOW_REPORT)) {
546365 ts.WindowFlag ^= WF_WINDOWREPORT;
547366 }
548367
549368 // (7)IDC_CURSOR_CTRL_SEQ
550- btn = (CButton *)GetDlgItem(IDC_CURSOR_CTRL_SEQ);
551- if (((ts.WindowFlag & WF_CURSORCHANGE) != 0) != btn->GetCheck()) {
369+ if (((ts.WindowFlag & WF_CURSORCHANGE) != 0) != GetCheck(IDC_CURSOR_CTRL_SEQ)) {
552370 ts.WindowFlag ^= WF_CURSORCHANGE;
553371 }
554372
555373 // (8)IDC_CLIPBOARD_ACCESS
556- cmb = (CComboBox *)GetDlgItem(IDC_CLIPBOARD_ACCESS);
557- switch (cmb->GetCurSel()) {
374+ switch (GetCurSel(IDC_CLIPBOARD_ACCESS)) {
558375 case 0: // off
559376 ts.CtrlFlag &= ~CSF_CBRW;
560377 break;
@@ -574,151 +391,86 @@
574391 }
575392
576393 // (9)IDC_CLIPBOARD_ACCESS
577- btn = (CButton *)GetDlgItem(IDC_CLIPBOARD_NOTIFY);
578- ts.NotifyClipboardAccess = btn->GetCheck();
394+ ts.NotifyClipboardAccess = GetCheck(IDC_CLIPBOARD_NOTIFY);
579395 }
580396
581397
582-
583398 // CCopypastePropPageDlg ダイアログ
584399
585-IMPLEMENT_DYNAMIC(CCopypastePropPageDlg, CPropertyPage)
586-
587-CCopypastePropPageDlg::CCopypastePropPageDlg()
588- : CPropertyPage(CCopypastePropPageDlg::IDD)
400+CCopypastePropPageDlg::CCopypastePropPageDlg(HINSTANCE inst, TTCPropertySheet *sheet)
401+ : TTCPropertyPage(inst, CCopypastePropPageDlg::IDD, sheet)
589402 {
403+ get_lang_msg("DLG_TABSHEET_TITLE_COPYPASTE", ts.UIMsg, sizeof(ts.UIMsg),
404+ "Copy and Paste", ts.UILanguageFile);
405+ m_psp.pszTitle = _tcsdup(ts.UIMsg);
406+ m_psp.dwFlags |= PSP_USETITLE;
590407 }
591408
592409 CCopypastePropPageDlg::~CCopypastePropPageDlg()
593410 {
594- if (DlgCopypasteFont != NULL) {
595- DeleteObject(DlgCopypasteFont);
596- }
411+ free((void *)m_psp.pszTitle);
597412 }
598413
599-BEGIN_MESSAGE_MAP(CCopypastePropPageDlg, CPropertyPage)
600-END_MESSAGE_MAP()
601-
602414 // CCopypastePropPageDlg メッセージ ハンドラ
603415
604-BOOL CCopypastePropPageDlg::OnInitDialog()
416+void CCopypastePropPageDlg::OnInitDialog()
605417 {
606- char uimsg[MAX_UIMSG];
607- CButton *btn, *btn2;
608- CEdit *edit;
609- char buf[64];
418+ TTCPropertyPage::OnInitDialog();
610419
611- CPropertyPage::OnInitDialog();
420+ static const DlgTextInfo TextInfos[] = {
421+ { IDC_LINECOPY, "DLG_TAB_COPYPASTE_CONTINUE" },
422+ { IDC_DISABLE_PASTE_RBUTTON, "DLG_TAB_COPYPASTE_MOUSEPASTE" },
423+ { IDC_CONFIRM_PASTE_RBUTTON, "DLG_TAB_COPYPASTE_CONFIRMPASTE" },
424+ { IDC_DISABLE_PASTE_MBUTTON, "DLG_TAB_COPYPASTE_MOUSEPASTEM" },
425+ { IDC_SELECT_LBUTTON, "DLG_TAB_COPYPASTE_SELECTLBUTTON" },
426+ { IDC_TRIMNLCHAR, "DLG_TAB_COPYPASTE_TRIM_TRAILING_NL" },
427+ { IDC_NORMALIZE_LINEBREAK, "DLG_TAB_COPYPASTE_NORMALIZE_LINEBREAK" },
428+ { IDC_CONFIRM_CHANGE_PASTE, "DLG_TAB_COPYPASTE_CONFIRM_CHANGE_PASTE" },
429+ { IDC_CONFIRM_STRING_FILE_LABEL, "DLG_TAB_COPYPASTE_STRINGFILE" },
430+ { IDC_DELIMITER, "DLG_TAB_COPYPASTE_DELIMITER" },
431+ { IDC_PASTEDELAY_LABEL, "DLG_TAB_COPYPASTE_PASTEDELAY" },
432+ { IDC_PASTEDELAY_LABEL2, "DLG_TAB_COPYPASTE_PASTEDELAY2" }
433+ };
434+ SetDlgTexts(m_hWnd, TextInfos, _countof(TextInfos), ts.UILanguageFile);
612435
613- font = (HFONT)SendMessage(WM_GETFONT, 0, 0);
614- GetObject(font, sizeof(LOGFONT), &logfont);
615- if (get_lang_font("DLG_TAHOMA_FONT", GetSafeHwnd(), &logfont, &DlgCopypasteFont, ts.UILanguageFile)) {
616- SendDlgItemMessage(IDC_LINECOPY, WM_SETFONT, (WPARAM)DlgCopypasteFont, MAKELPARAM(TRUE,0));
617- SendDlgItemMessage(IDC_DISABLE_PASTE_RBUTTON, WM_SETFONT, (WPARAM)DlgCopypasteFont, MAKELPARAM(TRUE,0));
618- SendDlgItemMessage(IDC_CONFIRM_PASTE_RBUTTON, WM_SETFONT, (WPARAM)DlgCopypasteFont, MAKELPARAM(TRUE,0));
619- SendDlgItemMessage(IDC_DISABLE_PASTE_MBUTTON, WM_SETFONT, (WPARAM)DlgCopypasteFont, MAKELPARAM(TRUE,0));
620- SendDlgItemMessage(IDC_SELECT_LBUTTON, WM_SETFONT, (WPARAM)DlgCopypasteFont, MAKELPARAM(TRUE,0));
621- SendDlgItemMessage(IDC_TRIMNLCHAR, WM_SETFONT, (WPARAM)DlgCopypasteFont, MAKELPARAM(TRUE,0));
622- SendDlgItemMessage(IDC_NORMALIZE_LINEBREAK, WM_SETFONT, (WPARAM)DlgCopypasteFont, MAKELPARAM(TRUE,0));
623- SendDlgItemMessage(IDC_CONFIRM_CHANGE_PASTE, WM_SETFONT, (WPARAM)DlgCopypasteFont, MAKELPARAM(TRUE,0));
624- SendDlgItemMessage(IDC_CONFIRM_STRING_FILE_LABEL, WM_SETFONT, (WPARAM)DlgCopypasteFont, MAKELPARAM(TRUE,0));
625- SendDlgItemMessage(IDC_CONFIRM_STRING_FILE, WM_SETFONT, (WPARAM)DlgCopypasteFont, MAKELPARAM(TRUE,0));
626- SendDlgItemMessage(IDC_CONFIRM_STRING_FILE_PATH, WM_SETFONT, (WPARAM)DlgCopypasteFont, MAKELPARAM(TRUE,0));
627- SendDlgItemMessage(IDC_DELIMITER, WM_SETFONT, (WPARAM)DlgCopypasteFont, MAKELPARAM(TRUE,0));
628- SendDlgItemMessage(IDC_DELIM_LIST, WM_SETFONT, (WPARAM)DlgCopypasteFont, MAKELPARAM(TRUE,0));
629- SendDlgItemMessage(IDC_PASTEDELAY_LABEL, WM_SETFONT, (WPARAM)DlgCopypasteFont, MAKELPARAM(TRUE,0));
630- SendDlgItemMessage(IDC_PASTEDELAY_EDIT, WM_SETFONT, (WPARAM)DlgCopypasteFont, MAKELPARAM(TRUE,0));
631- SendDlgItemMessage(IDC_PASTEDELAY_LABEL2, WM_SETFONT, (WPARAM)DlgCopypasteFont, MAKELPARAM(TRUE,0));
632- }
633- else {
634- DlgCopypasteFont = NULL;
635- }
636-
637- GetDlgItemText(IDC_LINECOPY, uimsg, sizeof(uimsg));
638- get_lang_msg("DLG_TAB_COPYPASTE_CONTINUE", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
639- SetDlgItemText(IDC_LINECOPY, ts.UIMsg);
640- GetDlgItemText(IDC_DISABLE_PASTE_RBUTTON, uimsg, sizeof(uimsg));
641- get_lang_msg("DLG_TAB_COPYPASTE_MOUSEPASTE", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
642- SetDlgItemText(IDC_DISABLE_PASTE_RBUTTON, ts.UIMsg);
643- GetDlgItemText(IDC_CONFIRM_PASTE_RBUTTON, uimsg, sizeof(uimsg));
644- get_lang_msg("DLG_TAB_COPYPASTE_CONFIRMPASTE", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
645- SetDlgItemText(IDC_CONFIRM_PASTE_RBUTTON, ts.UIMsg);
646- GetDlgItemText(IDC_DISABLE_PASTE_MBUTTON, uimsg, sizeof(uimsg));
647- get_lang_msg("DLG_TAB_COPYPASTE_MOUSEPASTEM", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
648- SetDlgItemText(IDC_DISABLE_PASTE_MBUTTON, ts.UIMsg);
649- GetDlgItemText(IDC_SELECT_LBUTTON, uimsg, sizeof(uimsg));
650- get_lang_msg("DLG_TAB_COPYPASTE_SELECTLBUTTON", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
651- SetDlgItemText(IDC_SELECT_LBUTTON, ts.UIMsg);
652- GetDlgItemText(IDC_TRIMNLCHAR, uimsg, sizeof(uimsg));
653- get_lang_msg("DLG_TAB_COPYPASTE_TRIM_TRAILING_NL", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
654- SetDlgItemText(IDC_TRIMNLCHAR, ts.UIMsg);
655- GetDlgItemText(IDC_NORMALIZE_LINEBREAK, uimsg, sizeof(uimsg));
656- get_lang_msg("DLG_TAB_COPYPASTE_NORMALIZE_LINEBREAK", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
657- SetDlgItemText(IDC_NORMALIZE_LINEBREAK, ts.UIMsg);
658- GetDlgItemText(IDC_CONFIRM_CHANGE_PASTE, uimsg, sizeof(uimsg));
659- get_lang_msg("DLG_TAB_COPYPASTE_CONFIRM_CHANGE_PASTE", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
660- SetDlgItemText(IDC_CONFIRM_CHANGE_PASTE, ts.UIMsg);
661- GetDlgItemText(IDC_CONFIRM_STRING_FILE_LABEL, uimsg, sizeof(uimsg));
662- get_lang_msg("DLG_TAB_COPYPASTE_STRINGFILE", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
663- SetDlgItemText(IDC_CONFIRM_STRING_FILE_LABEL, ts.UIMsg);
664- GetDlgItemText(IDC_DELIMITER, uimsg, sizeof(uimsg));
665- get_lang_msg("DLG_TAB_COPYPASTE_DELIMITER", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
666- SetDlgItemText(IDC_DELIMITER, ts.UIMsg);
667- GetDlgItemText(IDC_PASTEDELAY_LABEL, uimsg, sizeof(uimsg));
668- get_lang_msg("DLG_TAB_COPYPASTE_PASTEDELAY", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
669- SetDlgItemText(IDC_PASTEDELAY_LABEL, ts.UIMsg);
670- GetDlgItemText(IDC_PASTEDELAY_LABEL2, uimsg, sizeof(uimsg));
671- get_lang_msg("DLG_TAB_COPYPASTE_PASTEDELAY2", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
672- SetDlgItemText(IDC_PASTEDELAY_LABEL2, ts.UIMsg);
673-
674436 // (1)Enable continued-line copy
675- btn = (CButton *)GetDlgItem(IDC_LINECOPY);
676- btn->SetCheck(ts.EnableContinuedLineCopy);
437+ SetCheck(IDC_LINECOPY, ts.EnableContinuedLineCopy);
677438
678439 // (2)DisablePasteMouseRButton
679- btn = (CButton *)GetDlgItem(IDC_DISABLE_PASTE_RBUTTON);
680- btn2 = (CButton *)GetDlgItem(IDC_CONFIRM_PASTE_RBUTTON);
681440 if (ts.PasteFlag & CPF_DISABLE_RBUTTON) {
682- btn->SetCheck(BST_CHECKED);
683- btn2->EnableWindow(FALSE);
441+ SetCheck(IDC_DISABLE_PASTE_RBUTTON, BST_CHECKED);
442+ EnableDlgItem(IDC_CONFIRM_PASTE_RBUTTON, FALSE);
684443 } else {
685- btn->SetCheck(BST_UNCHECKED);
686- btn2->EnableWindow(TRUE);
444+ SetCheck(IDC_DISABLE_PASTE_RBUTTON, BST_UNCHECKED);
445+ EnableDlgItem(IDC_CONFIRM_PASTE_RBUTTON, TRUE);
687446 }
688447
689448 // (3)ConfirmPasteMouseRButton
690- btn2->SetCheck((ts.PasteFlag & CPF_CONFIRM_RBUTTON)?BST_CHECKED:BST_UNCHECKED);
449+ SetCheck(IDC_CONFIRM_PASTE_RBUTTON, (ts.PasteFlag & CPF_CONFIRM_RBUTTON)?BST_CHECKED:BST_UNCHECKED);
691450
692451 // (4)DisablePasteMouseMButton
693- btn = (CButton *)GetDlgItem(IDC_DISABLE_PASTE_MBUTTON);
694- btn->SetCheck((ts.PasteFlag & CPF_DISABLE_MBUTTON)?BST_CHECKED:BST_UNCHECKED);
452+ SetCheck(IDC_DISABLE_PASTE_MBUTTON, (ts.PasteFlag & CPF_DISABLE_MBUTTON)?BST_CHECKED:BST_UNCHECKED);
695453
696454 // (5)SelectOnlyByLButton
697- btn = (CButton *)GetDlgItem(IDC_SELECT_LBUTTON);
698- btn->SetCheck(ts.SelectOnlyByLButton);
455+ SetCheck(IDC_SELECT_LBUTTON, ts.SelectOnlyByLButton);
699456
700457 // (6)TrimTrailingNLonPaste
701- btn = (CButton *)GetDlgItem(IDC_TRIMNLCHAR);
702- btn->SetCheck((ts.PasteFlag & CPF_TRIM_TRAILING_NL)?BST_CHECKED:BST_UNCHECKED);
458+ SetCheck(IDC_TRIMNLCHAR, (ts.PasteFlag & CPF_TRIM_TRAILING_NL)?BST_CHECKED:BST_UNCHECKED);
703459
704460 // (7)NormalizeLineBreak
705- btn = (CButton *)GetDlgItem(IDC_NORMALIZE_LINEBREAK);
706- btn->SetCheck((ts.PasteFlag & CPF_NORMALIZE_LINEBREAK)?BST_CHECKED:BST_UNCHECKED);
461+ SetCheck(IDC_NORMALIZE_LINEBREAK, (ts.PasteFlag & CPF_NORMALIZE_LINEBREAK)?BST_CHECKED:BST_UNCHECKED);
707462
708463 // (8)ConfirmChangePaste
709- btn = (CButton *)GetDlgItem(IDC_CONFIRM_CHANGE_PASTE);
710- btn->SetCheck((ts.PasteFlag & CPF_CONFIRM_CHANGEPASTE)?BST_CHECKED:BST_UNCHECKED);
464+ SetCheck(IDC_CONFIRM_CHANGE_PASTE, (ts.PasteFlag & CPF_CONFIRM_CHANGEPASTE)?BST_CHECKED:BST_UNCHECKED);
711465
712466 // ファイルパス
713467 SetDlgItemText(IDC_CONFIRM_STRING_FILE, ts.ConfirmChangePasteStringFile);
714- edit = (CEdit *)GetDlgItem(IDC_CONFIRM_STRING_FILE);
715- btn = (CButton *)GetDlgItem(IDC_CONFIRM_STRING_FILE_PATH);
716468 if (ts.PasteFlag & CPF_CONFIRM_CHANGEPASTE) {
717- edit->EnableWindow(TRUE);
718- btn->EnableWindow(TRUE);
469+ EnableDlgItem(IDC_CONFIRM_STRING_FILE, TRUE);
470+ EnableDlgItem(IDC_CONFIRM_STRING_FILE_PATH, TRUE);
719471 } else {
720- edit->EnableWindow(FALSE);
721- btn->EnableWindow(FALSE);
472+ EnableDlgItem(IDC_CONFIRM_STRING_FILE, FALSE);
473+ EnableDlgItem(IDC_CONFIRM_STRING_FILE_PATH, FALSE);
722474 }
723475
724476 // (9)delimiter characters
@@ -725,42 +477,31 @@
725477 SetDlgItemText(IDC_DELIM_LIST, ts.DelimList);
726478
727479 // (10)PasteDelayPerLine
480+ char buf[64];
728481 _snprintf_s(buf, sizeof(buf), "%d", ts.PasteDelayPerLine);
729482 SetDlgItemText(IDC_PASTEDELAY_EDIT, buf);
730483
731484 // ダイアログにフォーカスを当てる
732485 ::SetFocus(::GetDlgItem(GetSafeHwnd(), IDC_LINECOPY));
733-
734- return FALSE;
735486 }
736487
737488 BOOL CCopypastePropPageDlg::OnCommand(WPARAM wParam, LPARAM lParam)
738489 {
739- CButton *btn, *btn2;
740- CEdit *edit;
741490 char uimsg[MAX_UIMSG];
742491
743492 switch (wParam) {
744493 case IDC_DISABLE_PASTE_RBUTTON | (BN_CLICKED << 16):
745- btn = (CButton *)GetDlgItem(IDC_DISABLE_PASTE_RBUTTON);
746- btn2 = (CButton *)GetDlgItem(IDC_CONFIRM_PASTE_RBUTTON);
747- if (btn->GetCheck()) {
748- btn2->EnableWindow(FALSE);
749- } else {
750- btn2->EnableWindow(TRUE);
751- }
494+ EnableDlgItem(IDC_CONFIRM_PASTE_RBUTTON,
495+ GetCheck(IDC_DISABLE_PASTE_RBUTTON) ? FALSE : TRUE);
752496 return TRUE;
753497
754498 case IDC_CONFIRM_CHANGE_PASTE | (BN_CLICKED << 16):
755- btn2 = (CButton *)GetDlgItem(IDC_CONFIRM_CHANGE_PASTE);
756- btn = (CButton *)GetDlgItem(IDC_CONFIRM_STRING_FILE_PATH);
757- edit = (CEdit *)GetDlgItem(IDC_CONFIRM_STRING_FILE);
758- if (btn2->GetCheck()) {
759- edit->EnableWindow(TRUE);
760- btn->EnableWindow(TRUE);
499+ if (GetCheck(IDC_CONFIRM_CHANGE_PASTE)) {
500+ EnableDlgItem(IDC_CONFIRM_STRING_FILE, TRUE);
501+ EnableDlgItem(IDC_CONFIRM_STRING_FILE_PATH, TRUE);
761502 } else {
762- edit->EnableWindow(FALSE);
763- btn->EnableWindow(FALSE);
503+ EnableDlgItem(IDC_CONFIRM_STRING_FILE, FALSE);
504+ EnableDlgItem(IDC_CONFIRM_STRING_FILE_PATH, FALSE);
764505 }
765506 return TRUE;
766507
@@ -768,7 +509,7 @@
768509 {
769510 OPENFILENAME ofn;
770511
771- ZeroMemory(&ofn, sizeof(ofn));
512+ memset(&ofn, 0, sizeof(ofn));
772513 ofn.lStructSize = get_OPENFILENAME_SIZE();
773514 ofn.hwndOwner = GetSafeHwnd();
774515 get_lang_msg("FILEDLG_SELECT_CONFIRM_STRING_APP_FILTER", ts.UIMsg, sizeof(ts.UIMsg),
@@ -787,22 +528,19 @@
787528 return TRUE;
788529 }
789530
790- return CPropertyPage::OnCommand(wParam, lParam);
531+ return TTCPropertyPage::OnCommand(wParam, lParam);
791532 }
792533
793534 void CCopypastePropPageDlg::OnOK()
794535 {
795- CButton *btn;
796536 char buf[64];
797537 int val;
798538
799539 // (1)
800- btn = (CButton *)GetDlgItem(IDC_LINECOPY);
801- ts.EnableContinuedLineCopy = btn->GetCheck();
540+ ts.EnableContinuedLineCopy = GetCheck(IDC_LINECOPY);
802541
803542 // (2)
804- btn = (CButton *)GetDlgItem(IDC_DISABLE_PASTE_RBUTTON);
805- if (btn->GetCheck()) {
543+ if (GetCheck(IDC_DISABLE_PASTE_RBUTTON)) {
806544 ts.PasteFlag |= CPF_DISABLE_RBUTTON;
807545 }
808546 else {
@@ -810,8 +548,7 @@
810548 }
811549
812550 // (3)
813- btn = (CButton *)GetDlgItem(IDC_CONFIRM_PASTE_RBUTTON);
814- if (btn->GetCheck()) {
551+ if (GetCheck(IDC_CONFIRM_PASTE_RBUTTON)) {
815552 ts.PasteFlag |= CPF_CONFIRM_RBUTTON;
816553 }
817554 else {
@@ -819,8 +556,7 @@
819556 }
820557
821558 // (4)
822- btn = (CButton *)GetDlgItem(IDC_DISABLE_PASTE_MBUTTON);
823- if (btn->GetCheck()) {
559+ if (GetCheck(IDC_DISABLE_PASTE_MBUTTON)) {
824560 ts.PasteFlag |= CPF_DISABLE_MBUTTON;
825561 }
826562 else {
@@ -828,12 +564,10 @@
828564 }
829565
830566 // (5)
831- btn = (CButton *)GetDlgItem(IDC_SELECT_LBUTTON);
832- ts.SelectOnlyByLButton = btn->GetCheck();
567+ ts.SelectOnlyByLButton = GetCheck(IDC_SELECT_LBUTTON);
833568
834569 // (6)
835- btn = (CButton *)GetDlgItem(IDC_TRIMNLCHAR);
836- if (btn->GetCheck()) {
570+ if (GetCheck(IDC_TRIMNLCHAR)) {
837571 ts.PasteFlag |= CPF_TRIM_TRAILING_NL;
838572 }
839573 else {
@@ -841,8 +575,7 @@
841575 }
842576
843577 // (7)
844- btn = (CButton *)GetDlgItem(IDC_NORMALIZE_LINEBREAK);
845- if (btn->GetCheck()) {
578+ if (GetCheck(IDC_NORMALIZE_LINEBREAK)) {
846579 ts.PasteFlag |= CPF_NORMALIZE_LINEBREAK;
847580 }
848581 else {
@@ -850,8 +583,7 @@
850583 }
851584
852585 // (8)IDC_CONFIRM_CHANGE_PASTE
853- btn = (CButton *)GetDlgItem(IDC_CONFIRM_CHANGE_PASTE);
854- if (btn->GetCheck()) {
586+ if (GetCheck(IDC_CONFIRM_CHANGE_PASTE)) {
855587 ts.PasteFlag |= CPF_CONFIRM_CHANGEPASTE;
856588 }
857589 else {
@@ -869,128 +601,51 @@
869601 }
870602
871603
872-
873604 // CVisualPropPageDlg ダイアログ
874605
875-IMPLEMENT_DYNAMIC(CVisualPropPageDlg, CPropertyPage)
876-
877-CVisualPropPageDlg::CVisualPropPageDlg()
878- : CPropertyPage(CVisualPropPageDlg::IDD)
606+CVisualPropPageDlg::CVisualPropPageDlg(HINSTANCE inst, TTCPropertySheet *sheet)
607+ : TTCPropertyPage(inst, CVisualPropPageDlg::IDD, sheet)
879608 {
880-
609+ get_lang_msg("DLG_TABSHEET_TITLE_VISUAL", ts.UIMsg, sizeof(ts.UIMsg),
610+ "Visual", ts.UILanguageFile);
611+ m_psp.pszTitle = _tcsdup(ts.UIMsg);
612+ m_psp.dwFlags |= PSP_USETITLE;
881613 }
882614
883615 CVisualPropPageDlg::~CVisualPropPageDlg()
884616 {
885- if (DlgVisualFont != NULL) {
886- DeleteObject(DlgVisualFont);
887- }
617+ free((void *)m_psp.pszTitle);
888618 }
889619
890-BEGIN_MESSAGE_MAP(CVisualPropPageDlg, CPropertyPage)
891-END_MESSAGE_MAP()
892-
893620 // CVisualPropPageDlg メッセージ ハンドラ
894621
895-BOOL CVisualPropPageDlg::OnInitDialog()
622+void CVisualPropPageDlg::OnInitDialog()
896623 {
897624 char buf[MAXPATHLEN];
898- char uimsg[MAX_UIMSG];
899- CListBox *listbox;
900- CButton *btn;
901- CComboBox *cmb;
902- int i;
903625
904- CPropertyPage::OnInitDialog();
626+ TTCPropertyPage::OnInitDialog();
905627
906- font = (HFONT)SendMessage(WM_GETFONT, 0, 0);
907- GetObject(font, sizeof(LOGFONT), &logfont);
908- if (get_lang_font("DLG_TAHOMA_FONT", GetSafeHwnd(), &logfont, &DlgVisualFont, ts.UILanguageFile)) {
909- SendDlgItemMessage(IDC_ALPHABLEND, WM_SETFONT, (WPARAM)DlgVisualFont, MAKELPARAM(TRUE,0));
910- SendDlgItemMessage(IDC_ALPHA_BLEND, WM_SETFONT, (WPARAM)DlgVisualFont, MAKELPARAM(TRUE,0));
911- SendDlgItemMessage(IDC_ETERM_LOOKFEEL, WM_SETFONT, (WPARAM)DlgVisualFont, MAKELPARAM(TRUE,0));
912- SendDlgItemMessage(IDC_MOUSE, WM_SETFONT, (WPARAM)DlgVisualFont, MAKELPARAM(TRUE,0));
913- SendDlgItemMessage(IDC_MOUSE_CURSOR, WM_SETFONT, (WPARAM)DlgVisualFont, MAKELPARAM(TRUE,0));
914- SendDlgItemMessage(IDC_FONT_QUALITY_LABEL, WM_SETFONT, (WPARAM)DlgVisualFont, MAKELPARAM(TRUE,0));
915- SendDlgItemMessage(IDC_FONT_QUALITY, WM_SETFONT, (WPARAM)DlgVisualFont, MAKELPARAM(TRUE,0));
916- SendDlgItemMessage(IDC_ANSICOLOR, WM_SETFONT, (WPARAM)DlgVisualFont, MAKELPARAM(TRUE,0));
917- SendDlgItemMessage(IDC_ANSI_COLOR, WM_SETFONT, (WPARAM)DlgVisualFont, MAKELPARAM(TRUE,0));
918- SendDlgItemMessage(IDC_RED, WM_SETFONT, (WPARAM)DlgVisualFont, MAKELPARAM(TRUE,0));
919- SendDlgItemMessage(IDC_COLOR_RED, WM_SETFONT, (WPARAM)DlgVisualFont, MAKELPARAM(TRUE,0));
920- SendDlgItemMessage(IDC_GREEN, WM_SETFONT, (WPARAM)DlgVisualFont, MAKELPARAM(TRUE,0));
921- SendDlgItemMessage(IDC_COLOR_GREEN, WM_SETFONT, (WPARAM)DlgVisualFont, MAKELPARAM(TRUE,0));
922- SendDlgItemMessage(IDC_BLUE, WM_SETFONT, (WPARAM)DlgVisualFont, MAKELPARAM(TRUE,0));
923- SendDlgItemMessage(IDC_COLOR_BLUE, WM_SETFONT, (WPARAM)DlgVisualFont, MAKELPARAM(TRUE,0));
924- SendDlgItemMessage(IDC_SAMPLE_COLOR, WM_SETFONT, (WPARAM)DlgVisualFont, MAKELPARAM(TRUE,0));
925- SendDlgItemMessage(IDC_ENABLE_ATTR_COLOR_BOLD, WM_SETFONT, (WPARAM)DlgVisualFont, MAKELPARAM(TRUE,0));
926- SendDlgItemMessage(IDC_ENABLE_ATTR_COLOR_BLINK, WM_SETFONT, (WPARAM)DlgVisualFont, MAKELPARAM(TRUE,0));
927- SendDlgItemMessage(IDC_ENABLE_ATTR_COLOR_REVERSE, WM_SETFONT, (WPARAM)DlgVisualFont, MAKELPARAM(TRUE,0));
928- SendDlgItemMessage(IDC_ENABLE_URL_COLOR, WM_SETFONT, (WPARAM)DlgVisualFont, MAKELPARAM(TRUE,0));
929- SendDlgItemMessage(IDC_ENABLE_ANSI_COLOR, WM_SETFONT, (WPARAM)DlgVisualFont, MAKELPARAM(TRUE,0));
930- SendDlgItemMessage(IDC_URL_UNDERLINE, WM_SETFONT, (WPARAM)DlgVisualFont, MAKELPARAM(TRUE,0));
931- SendDlgItemMessage(IDC_BGIMG_CHECK, WM_SETFONT, (WPARAM)DlgVisualFont, MAKELPARAM(TRUE,0));
932- SendDlgItemMessage(IDC_BGIMG_EDIT, WM_SETFONT, (WPARAM)DlgVisualFont, MAKELPARAM(TRUE,0));
933- SendDlgItemMessage(IDC_BGIMG_BUTTON, WM_SETFONT, (WPARAM)DlgVisualFont, MAKELPARAM(TRUE,0));
934- SendDlgItemMessage(IDC_RESTART, WM_SETFONT, (WPARAM)DlgVisualFont, MAKELPARAM(TRUE,0));
935- SendDlgItemMessage(IDC_BGIMG_BRIGHTNESS, WM_SETFONT, (WPARAM)DlgVisualFont, MAKELPARAM(TRUE, 0));
936- SendDlgItemMessage(IDC_EDIT_BGIMG_BRIGHTNESS, WM_SETFONT, (WPARAM)DlgVisualFont, MAKELPARAM(TRUE, 0));
937- }
938- else {
939- DlgVisualFont = NULL;
940- }
628+ static const DlgTextInfo TextInfos[] = {
629+ { IDC_ALPHABLEND, "DLG_TAB_VISUAL_ALPHA" },
630+ { IDC_ETERM_LOOKFEEL, "DLG_TAB_VISUAL_ETERM" },
631+ { IDC_BGIMG_CHECK, "DLG_TAB_VISUAL_BGIMG" },
632+ { IDC_BGIMG_BRIGHTNESS, "DLG_TAB_VISUAL_BGIMG_BRIGHTNESS" },
633+ { IDC_MOUSE, "DLG_TAB_VISUAL_MOUSE" },
634+ { IDC_FONT_QUALITY_LABEL, "DLG_TAB_VISUAL_FONT_QUALITY" },
635+ { IDC_ANSICOLOR, "DLG_TAB_VISUAL_ANSICOLOR" },
636+ { IDC_RED, "DLG_TAB_VISUAL_RED" },
637+ { IDC_GREEN, "DLG_TAB_VISUAL_GREEN" },
638+ { IDC_BLUE, "DLG_TAB_VISUAL_BLUE" },
639+ { IDC_ENABLE_ATTR_COLOR_BOLD, "DLG_TAB_VISUAL_BOLD" },
640+ { IDC_ENABLE_ATTR_COLOR_BLINK, "DLG_TAB_VISUAL_BLINK" },
641+ { IDC_ENABLE_ATTR_COLOR_REVERSE, "DLG_TAB_VISUAL_REVERSE" },
642+ { IDC_ENABLE_URL_COLOR, "DLG_TAB_VISUAL_URL" },
643+ { IDC_ENABLE_ANSI_COLOR, "DLG_TAB_VISUAL_ANSI" },
644+ { IDC_URL_UNDERLINE, "DLG_TAB_VISUAL_URLUL" },
645+ { IDC_RESTART, "DLG_TAB_VISUAL_RESTART" },
646+ };
647+ SetDlgTexts(m_hWnd, TextInfos, _countof(TextInfos), ts.UILanguageFile);
941648
942- GetDlgItemText(IDC_ALPHABLEND, uimsg, sizeof(uimsg));
943- get_lang_msg("DLG_TAB_VISUAL_ALPHA", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
944- SetDlgItemText(IDC_ALPHABLEND, ts.UIMsg);
945- GetDlgItemText(IDC_ETERM_LOOKFEEL, uimsg, sizeof(uimsg));
946- get_lang_msg("DLG_TAB_VISUAL_ETERM", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
947- SetDlgItemText(IDC_ETERM_LOOKFEEL, ts.UIMsg);
948- GetDlgItemText(IDC_BGIMG_CHECK, uimsg, sizeof(uimsg));
949- get_lang_msg("DLG_TAB_VISUAL_BGIMG", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
950- SetDlgItemText(IDC_BGIMG_CHECK, ts.UIMsg);
951- GetDlgItemText(IDC_BGIMG_BRIGHTNESS, uimsg, sizeof(uimsg));
952- get_lang_msg("DLG_TAB_VISUAL_BGIMG_BRIGHTNESS", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
953- SetDlgItemText(IDC_BGIMG_BRIGHTNESS, ts.UIMsg);
954- GetDlgItemText(IDC_MOUSE, uimsg, sizeof(uimsg));
955- get_lang_msg("DLG_TAB_VISUAL_MOUSE", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
956- SetDlgItemText(IDC_MOUSE, ts.UIMsg);
957- GetDlgItemText(IDC_FONT_QUALITY_LABEL, uimsg, sizeof(uimsg));
958- get_lang_msg("DLG_TAB_VISUAL_FONT_QUALITY", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
959- SetDlgItemText(IDC_FONT_QUALITY_LABEL, ts.UIMsg);
960- GetDlgItemText(IDC_ANSICOLOR, uimsg, sizeof(uimsg));
961- get_lang_msg("DLG_TAB_VISUAL_ANSICOLOR", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
962- SetDlgItemText(IDC_ANSICOLOR, ts.UIMsg);
963- GetDlgItemText(IDC_RED, uimsg, sizeof(uimsg));
964- get_lang_msg("DLG_TAB_VISUAL_RED", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
965- SetDlgItemText(IDC_RED, ts.UIMsg);
966- GetDlgItemText(IDC_GREEN, uimsg, sizeof(uimsg));
967- get_lang_msg("DLG_TAB_VISUAL_GREEN", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
968- SetDlgItemText(IDC_GREEN, ts.UIMsg);
969- GetDlgItemText(IDC_BLUE, uimsg, sizeof(uimsg));
970- get_lang_msg("DLG_TAB_VISUAL_BLUE", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
971- SetDlgItemText(IDC_BLUE, ts.UIMsg);
972- GetDlgItemText(IDC_ENABLE_ATTR_COLOR_BOLD, uimsg, sizeof(uimsg));
973- get_lang_msg("DLG_TAB_VISUAL_BOLD", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
974- SetDlgItemText(IDC_ENABLE_ATTR_COLOR_BOLD, ts.UIMsg);
975- GetDlgItemText(IDC_ENABLE_ATTR_COLOR_BLINK, uimsg, sizeof(uimsg));
976- get_lang_msg("DLG_TAB_VISUAL_BLINK", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
977- SetDlgItemText(IDC_ENABLE_ATTR_COLOR_BLINK, ts.UIMsg);
978- GetDlgItemText(IDC_ENABLE_ATTR_COLOR_REVERSE, uimsg, sizeof(uimsg));
979- get_lang_msg("DLG_TAB_VISUAL_REVERSE", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
980- SetDlgItemText(IDC_ENABLE_ATTR_COLOR_REVERSE, ts.UIMsg);
981- GetDlgItemText(IDC_ENABLE_URL_COLOR, uimsg, sizeof(uimsg));
982- get_lang_msg("DLG_TAB_VISUAL_URL", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
983- SetDlgItemText(IDC_ENABLE_URL_COLOR, ts.UIMsg);
984- GetDlgItemText(IDC_ENABLE_ANSI_COLOR, uimsg, sizeof(uimsg));
985- get_lang_msg("DLG_TAB_VISUAL_ANSI", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
986- SetDlgItemText(IDC_ENABLE_ANSI_COLOR, ts.UIMsg);
987- GetDlgItemText(IDC_URL_UNDERLINE, uimsg, sizeof(uimsg));
988- get_lang_msg("DLG_TAB_VISUAL_URLUL", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
989- SetDlgItemText(IDC_URL_UNDERLINE, ts.UIMsg);
990- GetDlgItemText(IDC_RESTART, uimsg, sizeof(uimsg));
991- get_lang_msg("DLG_TAB_VISUAL_RESTART", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
992- SetDlgItemText(IDC_RESTART, ts.UIMsg);
993-
994649 get_lang_msg("DLG_TAB_VISUAL_FONT_QUALITY_DEFAULT", ts.UIMsg, sizeof(ts.UIMsg), "Default", ts.UILanguageFile);
995650 SendDlgItemMessage(IDC_FONT_QUALITY, CB_ADDSTRING, 0, (LPARAM)ts.UIMsg);
996651 get_lang_msg("DLG_TAB_VISUAL_FONT_QUALITY_NONANTIALIASED", ts.UIMsg, sizeof(ts.UIMsg), "Non-Antialiased", ts.UILanguageFile);
@@ -1005,8 +660,7 @@
1005660 SetDlgItemText(IDC_ALPHA_BLEND, buf);
1006661
1007662 // (2)[BG] BGEnable
1008- btn = (CButton *)GetDlgItem(IDC_ETERM_LOOKFEEL);
1009- btn->SetCheck(ts.EtermLookfeel.BGEnable);
663+ SetCheck(IDC_ETERM_LOOKFEEL, ts.EtermLookfeel.BGEnable);
1010664
1011665 // Eterm look-feelの背景画像指定。
1012666 SetDlgItemText(IDC_BGIMG_EDIT, ts.BGImageFilePath);
@@ -1015,134 +669,119 @@
1015669 SetDlgItemText(IDC_EDIT_BGIMG_BRIGHTNESS, buf);
1016670
1017671 if (ts.EtermLookfeel.BGEnable) {
1018- GetDlgItem(IDC_BGIMG_CHECK)->EnableWindow(TRUE);
672+ EnableDlgItem(IDC_BGIMG_CHECK, TRUE);
1019673
1020- btn = (CButton *)GetDlgItem(IDC_BGIMG_CHECK);
1021674 if (strcmp(ts.EtermLookfeel.BGThemeFile, BG_THEME_IMAGEFILE) == 0) {
1022- btn->SetCheck(BST_CHECKED);
1023- GetDlgItem(IDC_BGIMG_EDIT)->EnableWindow(TRUE);
1024- GetDlgItem(IDC_BGIMG_BUTTON)->EnableWindow(TRUE);
675+ SetCheck(IDC_BGIMG_CHECK, BST_CHECKED);
676+ EnableDlgItem(IDC_BGIMG_EDIT, TRUE);
677+ EnableDlgItem(IDC_BGIMG_BUTTON, TRUE);
1025678
1026- GetDlgItem(IDC_BGIMG_BRIGHTNESS)->EnableWindow(TRUE);
1027- GetDlgItem(IDC_EDIT_BGIMG_BRIGHTNESS)->EnableWindow(TRUE);
679+ EnableDlgItem(IDC_BGIMG_BRIGHTNESS, TRUE);
680+ EnableDlgItem(IDC_EDIT_BGIMG_BRIGHTNESS, TRUE);
1028681 } else {
1029- btn->SetCheck(BST_UNCHECKED);
1030- GetDlgItem(IDC_BGIMG_EDIT)->EnableWindow(FALSE);
1031- GetDlgItem(IDC_BGIMG_BUTTON)->EnableWindow(FALSE);
682+ SetCheck(IDC_BGIMG_CHECK, BST_UNCHECKED);
683+ EnableDlgItem(IDC_BGIMG_EDIT, FALSE);
684+ EnableDlgItem(IDC_BGIMG_BUTTON, FALSE);
1032685
1033- GetDlgItem(IDC_BGIMG_BRIGHTNESS)->EnableWindow(FALSE);
1034- GetDlgItem(IDC_EDIT_BGIMG_BRIGHTNESS)->EnableWindow(FALSE);
686+ EnableDlgItem(IDC_BGIMG_BRIGHTNESS, FALSE);
687+ EnableDlgItem(IDC_EDIT_BGIMG_BRIGHTNESS, FALSE);
1035688 }
1036689 } else {
1037- GetDlgItem(IDC_BGIMG_CHECK)->EnableWindow(FALSE);
1038- GetDlgItem(IDC_BGIMG_EDIT)->EnableWindow(FALSE);
1039- GetDlgItem(IDC_BGIMG_BUTTON)->EnableWindow(FALSE);
690+ EnableDlgItem(IDC_BGIMG_CHECK, FALSE);
691+ EnableDlgItem(IDC_BGIMG_EDIT, FALSE);
692+ EnableDlgItem(IDC_BGIMG_BUTTON, FALSE);
1040693
1041- GetDlgItem(IDC_BGIMG_BRIGHTNESS)->EnableWindow(FALSE);
1042- GetDlgItem(IDC_EDIT_BGIMG_BRIGHTNESS)->EnableWindow(FALSE);
694+ EnableDlgItem(IDC_BGIMG_BRIGHTNESS, FALSE);
695+ EnableDlgItem(IDC_EDIT_BGIMG_BRIGHTNESS, FALSE);
1043696 }
1044697
1045698 // (3)Mouse cursor type
1046- listbox = (CListBox *)GetDlgItem(IDC_MOUSE_CURSOR);
1047- for (i = 0 ; MouseCursor[i].name ; i++) {
1048- listbox->InsertString(i, MouseCursor[i].name);
699+ int sel = 0;
700+ for (int i = 0 ; MouseCursor[i].name ; i++) {
701+ const TCHAR *name = MouseCursor[i].name;
702+ SendDlgItemMessage(IDC_MOUSE_CURSOR, LB_INSERTSTRING, i, (LPARAM)name);
703+ if (_tcscmp(name, ts.MouseCursorName) == 0) {
704+ sel = i;
705+ }
1049706 }
1050- listbox->SelectString(0, ts.MouseCursorName);
707+ SendDlgItemMessage(IDC_MOUSE_CURSOR, LB_SETCURSEL, sel, 0);
1051708
1052709 // (4)Font quality
1053- cmb = (CComboBox *)GetDlgItem(IDC_FONT_QUALITY);
1054710 switch (ts.FontQuality) {
1055711 case DEFAULT_QUALITY:
1056- cmb->SetCurSel(0);
712+ SetCurSel(IDC_FONT_QUALITY, 0);
1057713 break;
1058714 case NONANTIALIASED_QUALITY:
1059- cmb->SetCurSel(1);
715+ SetCurSel(IDC_FONT_QUALITY, 1);
1060716 break;
1061717 case ANTIALIASED_QUALITY:
1062- cmb->SetCurSel(2);
718+ SetCurSel(IDC_FONT_QUALITY, 2);
1063719 break;
1064720 default: // CLEARTYPE_QUALITY
1065- cmb->SetCurSel(3);
721+ SetCurSel(IDC_FONT_QUALITY, 3);
1066722 break;
1067723 }
1068724
1069725 // (5)ANSI color
1070- listbox = (CListBox *)GetDlgItem(IDC_ANSI_COLOR);
1071- for (i = 0 ; i < 16 ; i++) {
726+ for (int i = 0 ; i < 16 ; i++) {
1072727 _snprintf_s(buf, sizeof(buf), _TRUNCATE, "%d", i);
1073- listbox->InsertString(i, buf);
728+ SendDlgItemMessage(IDC_ANSI_COLOR, LB_INSERTSTRING, i, (LPARAM)buf);
1074729 }
1075730 SetupRGBbox(GetSafeHwnd(), 0);
1076-#if 0
1077- SendMessage(WM_CTLCOLORSTATIC,
1078- (WPARAM)label_hdc,
1079- (LPARAM)GetDlgItem(IDC_SAMPLE_COLOR));
1080-#endif
731+ SendDlgItemMessage(IDC_ANSI_COLOR, LB_SETCURSEL, 0, 0);
732+ InvalidateRect(GetDlgItem(m_hWnd, IDC_SAMPLE_COLOR), NULL, TRUE);
1081733
1082734 // (6)Bold Attr Color
1083- btn = (CButton *)GetDlgItem(IDC_ENABLE_ATTR_COLOR_BOLD);
1084- btn->SetCheck((ts.ColorFlag&CF_BOLDCOLOR) != 0);
735+ SetCheck(IDC_ENABLE_ATTR_COLOR_BOLD, (ts.ColorFlag&CF_BOLDCOLOR) != 0);
1085736
1086737 // (7)Blink Attr Color
1087- btn = (CButton *)GetDlgItem(IDC_ENABLE_ATTR_COLOR_BLINK);
1088- btn->SetCheck((ts.ColorFlag&CF_BLINKCOLOR) != 0);
738+ SetCheck(IDC_ENABLE_ATTR_COLOR_BLINK, (ts.ColorFlag&CF_BLINKCOLOR) != 0);
1089739
1090740 // (8)Reverse Attr Color
1091- btn = (CButton *)GetDlgItem(IDC_ENABLE_ATTR_COLOR_REVERSE);
1092- btn->SetCheck((ts.ColorFlag&CF_REVERSECOLOR) != 0);
741+ SetCheck(IDC_ENABLE_ATTR_COLOR_REVERSE, (ts.ColorFlag&CF_REVERSECOLOR) != 0);
1093742
1094743 // (9)URL Color
1095- btn = (CButton *)GetDlgItem(IDC_ENABLE_URL_COLOR);
1096- btn->SetCheck((ts.ColorFlag&CF_URLCOLOR) != 0);
744+ SetCheck(IDC_ENABLE_URL_COLOR, (ts.ColorFlag&CF_URLCOLOR) != 0);
1097745
1098746 // (10)Color
1099- btn = (CButton *)GetDlgItem(IDC_ENABLE_ANSI_COLOR);
1100- btn->SetCheck((ts.ColorFlag&CF_ANSICOLOR) != 0);
747+ SetCheck(IDC_ENABLE_ANSI_COLOR, (ts.ColorFlag&CF_ANSICOLOR) != 0);
1101748
1102749 // (11)URL Underline
1103- btn = (CButton *)GetDlgItem(IDC_URL_UNDERLINE);
1104- btn->SetCheck((ts.FontFlag&FF_URLUNDERLINE) != 0);
750+ SetCheck(IDC_URL_UNDERLINE, (ts.FontFlag&FF_URLUNDERLINE) != 0);
1105751
1106752 // ダイアログにフォーカスを当てる
1107753 ::SetFocus(::GetDlgItem(GetSafeHwnd(), IDC_ALPHA_BLEND));
1108-
1109- return FALSE;
1110754 }
1111755
1112756 BOOL CVisualPropPageDlg::OnCommand(WPARAM wParam, LPARAM lParam)
1113757 {
1114- CListBox *listbox;
1115758 int sel;
1116- char buf[MAXPATHLEN];
1117- CButton *btn;
1118759
1119760 switch (wParam) {
1120- case IDC_ETERM_LOOKFEEL:
761+ case IDC_ETERM_LOOKFEEL:
1121762 // チェックされたら Enable/Disable をトグルする。
1122- btn = (CButton *)GetDlgItem(IDC_ETERM_LOOKFEEL);
1123- if (btn->GetCheck()) {
1124- GetDlgItem(IDC_BGIMG_CHECK)->EnableWindow(TRUE);
1125- btn = (CButton *)GetDlgItem(IDC_BGIMG_CHECK);
1126- if (btn->GetCheck()) {
1127- GetDlgItem(IDC_BGIMG_EDIT)->EnableWindow(TRUE);
1128- GetDlgItem(IDC_BGIMG_BUTTON)->EnableWindow(TRUE);
763+ if (GetCheck(IDC_ETERM_LOOKFEEL)) {
764+ EnableDlgItem(IDC_BGIMG_CHECK, TRUE);
765+ if (GetCheck(IDC_BGIMG_CHECK)) {
766+ EnableDlgItem(IDC_BGIMG_EDIT, TRUE);
767+ EnableDlgItem(IDC_BGIMG_BUTTON, TRUE);
1129768
1130- GetDlgItem(IDC_BGIMG_BRIGHTNESS)->EnableWindow(TRUE);
1131- GetDlgItem(IDC_EDIT_BGIMG_BRIGHTNESS)->EnableWindow(TRUE);
769+ EnableDlgItem(IDC_BGIMG_BRIGHTNESS, TRUE);
770+ EnableDlgItem(IDC_EDIT_BGIMG_BRIGHTNESS, TRUE);
1132771 } else {
1133- GetDlgItem(IDC_BGIMG_EDIT)->EnableWindow(FALSE);
1134- GetDlgItem(IDC_BGIMG_BUTTON)->EnableWindow(FALSE);
772+ EnableDlgItem(IDC_BGIMG_EDIT, FALSE);
773+ EnableDlgItem(IDC_BGIMG_BUTTON, FALSE);
1135774
1136- GetDlgItem(IDC_BGIMG_BRIGHTNESS)->EnableWindow(FALSE);
1137- GetDlgItem(IDC_EDIT_BGIMG_BRIGHTNESS)->EnableWindow(FALSE);
775+ EnableDlgItem(IDC_BGIMG_BRIGHTNESS, FALSE);
776+ EnableDlgItem(IDC_EDIT_BGIMG_BRIGHTNESS, FALSE);
1138777 }
1139778 } else {
1140- GetDlgItem(IDC_BGIMG_CHECK)->EnableWindow(FALSE);
1141- GetDlgItem(IDC_BGIMG_EDIT)->EnableWindow(FALSE);
1142- GetDlgItem(IDC_BGIMG_BUTTON)->EnableWindow(FALSE);
779+ EnableDlgItem(IDC_BGIMG_CHECK, FALSE);
780+ EnableDlgItem(IDC_BGIMG_EDIT, FALSE);
781+ EnableDlgItem(IDC_BGIMG_BUTTON, FALSE);
1143782
1144- GetDlgItem(IDC_BGIMG_BRIGHTNESS)->EnableWindow(FALSE);
1145- GetDlgItem(IDC_EDIT_BGIMG_BRIGHTNESS)->EnableWindow(FALSE);
783+ EnableDlgItem(IDC_BGIMG_BRIGHTNESS, FALSE);
784+ EnableDlgItem(IDC_EDIT_BGIMG_BRIGHTNESS, FALSE);
1146785
1147786 // 無効化されたら、BGThemeFile を元に戻す。
1148787 strncpy_s(ts.EtermLookfeel.BGThemeFile, BG_THEME_IMAGEFILE_DEFAULT, sizeof(ts.EtermLookfeel.BGThemeFile));
@@ -1153,21 +792,20 @@
1153792 return TRUE;
1154793
1155794 case IDC_BGIMG_CHECK:
1156- btn = (CButton *)GetDlgItem(IDC_BGIMG_CHECK);
1157- if (btn->GetCheck()) {
1158- GetDlgItem(IDC_BGIMG_EDIT)->EnableWindow(TRUE);
1159- GetDlgItem(IDC_BGIMG_BUTTON)->EnableWindow(TRUE);
795+ if (GetCheck(IDC_BGIMG_CHECK)) {
796+ EnableDlgItem(IDC_BGIMG_EDIT, TRUE);
797+ EnableDlgItem(IDC_BGIMG_BUTTON, TRUE);
1160798
1161- GetDlgItem(IDC_BGIMG_BRIGHTNESS)->EnableWindow(TRUE);
1162- GetDlgItem(IDC_EDIT_BGIMG_BRIGHTNESS)->EnableWindow(TRUE);
799+ EnableDlgItem(IDC_BGIMG_BRIGHTNESS, TRUE);
800+ EnableDlgItem(IDC_EDIT_BGIMG_BRIGHTNESS, TRUE);
1163801
1164802 strncpy_s(ts.EtermLookfeel.BGThemeFile, BG_THEME_IMAGEFILE, sizeof(ts.EtermLookfeel.BGThemeFile));
1165803 } else {
1166- GetDlgItem(IDC_BGIMG_EDIT)->EnableWindow(FALSE);
1167- GetDlgItem(IDC_BGIMG_BUTTON)->EnableWindow(FALSE);
804+ EnableDlgItem(IDC_BGIMG_EDIT, FALSE);
805+ EnableDlgItem(IDC_BGIMG_BUTTON, FALSE);
1168806
1169- GetDlgItem(IDC_BGIMG_BRIGHTNESS)->EnableWindow(FALSE);
1170- GetDlgItem(IDC_EDIT_BGIMG_BRIGHTNESS)->EnableWindow(FALSE);
807+ EnableDlgItem(IDC_BGIMG_BRIGHTNESS, FALSE);
808+ EnableDlgItem(IDC_EDIT_BGIMG_BRIGHTNESS, FALSE);
1171809
1172810 // 無効化されたら、BGThemeFile を元に戻す。
1173811 strncpy_s(ts.EtermLookfeel.BGThemeFile, BG_THEME_IMAGEFILE_DEFAULT, sizeof(ts.EtermLookfeel.BGThemeFile));
@@ -1180,25 +818,29 @@
1180818 case IDC_BGIMG_BUTTON | (BN_CLICKED << 16):
1181819 // 背景画像をダイアログで指定する。
1182820 {
1183- CString filter("Image Files(*.jpg;*.jpeg;*.bmp)|*.jpg;*.jpeg;*.bmp|All Files(*.*)|*.*||");
1184- CFileDialog selDlg(TRUE, NULL, NULL, OFN_HIDEREADONLY, filter);
1185- if (selDlg.DoModal() == IDOK) {
1186- // 背景画像指定が意図的に行われたら、BGThemeFile を固定化する。
1187- SetDlgItemText(IDC_BGIMG_EDIT, selDlg.GetPathName());
821+ OPENFILENAME ofn;
822+ char szFile[MAX_PATH];
823+
824+ memset(&ofn, 0, sizeof(ofn));
825+ memset(szFile, 0, sizeof(szFile));
826+ ofn.lStructSize = get_OPENFILENAME_SIZE();
827+ ofn.hwndOwner = m_pSheet->m_hWnd;
828+ ofn.lpstrFilter = "Image Files(*.jpg;*.jpeg;*.bmp)\0*.jpg;*.jpeg;*.bmp\0All Files(*.*)\0*.*\0";
829+ ofn.lpstrFile = szFile;
830+ ofn.nMaxFile = _countof(szFile);
831+ ofn.lpstrTitle = "select image file";
832+ ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
833+ if (GetOpenFileName(&ofn) != 0) {
834+ SetDlgItemText(IDC_BGIMG_EDIT, szFile);
1188835 }
1189836 }
1190837 return TRUE;
1191838
1192839 case IDC_ANSI_COLOR | (LBN_SELCHANGE << 16):
1193- listbox = (CListBox *)GetDlgItem(IDC_ANSI_COLOR);
1194- sel = listbox->GetCurSel();
840+ sel = SendDlgItemMessage(IDC_ANSI_COLOR, LB_GETCURSEL, 0, 0);
1195841 if (sel != -1) {
1196842 SetupRGBbox(GetSafeHwnd(), sel);
1197-#if 0
1198- SendMessage(WM_CTLCOLORSTATIC,
1199- (WPARAM)label_hdc,
1200- (LPARAM)GetDlgItem(IDC_SAMPLE_COLOR));
1201-#endif
843+ InvalidateRect(GetDlgItem(m_hWnd, IDC_SAMPLE_COLOR), NULL, TRUE);
1202844 }
1203845 return TRUE;
1204846
@@ -1207,9 +849,9 @@
1207849 case IDC_COLOR_BLUE | (EN_KILLFOCUS << 16):
1208850 {
1209851 BYTE r, g, b;
852+ char buf[8];
1210853
1211- listbox = (CListBox *)GetDlgItem(IDC_ANSI_COLOR);
1212- sel = listbox->GetCurSel();
854+ sel = GetCurSel(IDC_ANSI_COLOR);
1213855 if (sel < 0 && sel > sizeof(ts.ANSIColor)-1) {
1214856 return TRUE;
1215857 }
@@ -1227,62 +869,41 @@
1227869
1228870 // 255を超えたRGB値は補正されるので、それをEditに表示する (2007.2.18 maya)
1229871 SetupRGBbox(GetSafeHwnd(), sel);
1230-#if 0
1231- SendMessage(WM_CTLCOLORSTATIC,
1232- (WPARAM)label_hdc,
1233- (LPARAM)GetDlgItem(IDC_SAMPLE_COLOR));
1234-#endif
872+
873+ InvalidateRect(GetDlgItem(m_hWnd, IDC_SAMPLE_COLOR), NULL, TRUE);
1235874 }
1236875
1237876 return TRUE;
1238-#if 0
1239- case WM_CTLCOLORSTATIC:
1240- {
1241- HDC hDC = (HDC)wp;
1242- HWND hWnd = (HWND)lp;
877+ }
1243878
1244- //if (label_hdc == NULL) {
1245- hDC = GetWindowDC(GetDlgItem(hDlgWnd, IDC_SAMPLE_COLOR));
1246- // label_hdc = hDC;
1247- //}
879+ return TTCPropertyPage::OnCommand(wParam, lParam);
880+}
1248881
1249- if ( hWnd == GetDlgItem(hDlgWnd, IDC_SAMPLE_COLOR) ) {
1250- BYTE r, g, b;
882+HBRUSH CVisualPropPageDlg::OnCtlColor(HDC hDC, HWND hWnd)
883+{
884+ if ( hWnd == GetDlgItem(m_hWnd, IDC_SAMPLE_COLOR) ) {
885+ BYTE r, g, b;
886+ char buf[8];
1251887
1252- hWnd = GetDlgItem(hDlgWnd, IDC_COLOR_RED);
1253- SendMessage(hWnd, WM_GETTEXT , sizeof(buf), (LPARAM)buf);
1254- r = atoi(buf);
888+ GetDlgItemText(IDC_COLOR_RED, buf, sizeof(buf));
889+ r = atoi(buf);
1255890
1256- hWnd = GetDlgItem(hDlgWnd, IDC_COLOR_GREEN);
1257- SendMessage(hWnd, WM_GETTEXT , sizeof(buf), (LPARAM)buf);
1258- g = atoi(buf);
891+ GetDlgItemText(IDC_COLOR_GREEN, buf, sizeof(buf));
892+ g = atoi(buf);
1259893
1260- hWnd = GetDlgItem(hDlgWnd, IDC_COLOR_BLUE);
1261- SendMessage(hWnd, WM_GETTEXT , sizeof(buf), (LPARAM)buf);
1262- b = atoi(buf);
894+ GetDlgItemText(IDC_COLOR_BLUE, buf, sizeof(buf));
895+ b = atoi(buf);
1263896
1264- OutputDebugPrintf("%06x\n", RGB(r, g, b));
897+ SetBkMode(hDC, TRANSPARENT);
898+ SetTextColor(hDC, RGB(r, g, b) );
1265899
1266- SetBkMode(hDC, TRANSPARENT);
1267- SetTextColor(hDC, RGB(r, g, b) );
1268- ReleaseDC(hDlgWnd, hDC);
1269-
1270- return (BOOL)(HBRUSH)GetStockObject(NULL_BRUSH);
1271- }
1272- return FALSE;
1273- }
1274- break ;
1275-#endif
900+ return (HBRUSH)GetStockObject(NULL_BRUSH);
1276901 }
1277-
1278- return CPropertyPage::OnCommand(wParam, lParam);
902+ return TTCPropertyPage::OnCtlColor(hDC, hWnd);
1279903 }
1280904
1281905 void CVisualPropPageDlg::OnOK()
1282906 {
1283- CListBox *listbox;
1284- CButton *btn;
1285- CComboBox *cmb;
1286907 int sel;
1287908 int beforeAlphaBlend;
1288909 char buf[MAXPATHLEN];
@@ -1301,12 +922,10 @@
1301922 // (2)
1302923 // グローバル変数 BGEnable を直接書き換えると、プログラムが落ちることが
1303924 // あるのでコピーを修正するのみとする。(2005.4.24 yutaka)
1304- btn = (CButton *)GetDlgItem(IDC_ETERM_LOOKFEEL);
1305- if (ts.EtermLookfeel.BGEnable != btn->GetCheck()) {
925+ if (ts.EtermLookfeel.BGEnable != GetCheck(IDC_ETERM_LOOKFEEL)) {
1306926 flag_changed = 1;
1307- ts.EtermLookfeel.BGEnable = btn->GetCheck();
927+ ts.EtermLookfeel.BGEnable = GetCheck(IDC_ETERM_LOOKFEEL);
1308928 }
1309-
1310929 if (ts.EtermLookfeel.BGEnable) {
1311930 GetDlgItemText(IDC_BGIMG_EDIT, ts.BGImageFilePath, sizeof(ts.BGImageFilePath));
1312931 } else {
@@ -1321,15 +940,13 @@
1321940 }
1322941
1323942 // (3)
1324- listbox = (CListBox *)GetDlgItem(IDC_MOUSE_CURSOR);
1325- sel = listbox->GetCurSel();
943+ sel = SendDlgItemMessage(IDC_MOUSE_CURSOR, LB_GETCURSEL, 0, 0);
1326944 if (sel >= 0 && sel < MOUSE_CURSOR_MAX) {
1327945 strncpy_s(ts.MouseCursorName, sizeof(ts.MouseCursorName), MouseCursor[sel].name, _TRUNCATE);
1328946 }
1329947
1330948 // (4)Font quality
1331- cmb = (CComboBox *)GetDlgItem(IDC_FONT_QUALITY);
1332- switch (cmb->GetCurSel()) {
949+ switch (GetCurSel(IDC_FONT_QUALITY)) {
1333950 case 0:
1334951 ts.FontQuality = DEFAULT_QUALITY;
1335952 break;
@@ -1347,22 +964,19 @@
1347964 }
1348965
1349966 // (6) Attr Bold Color
1350- btn = (CButton *)GetDlgItem(IDC_ENABLE_ATTR_COLOR_BOLD);
1351- if (((ts.ColorFlag & CF_BOLDCOLOR) != 0) != btn->GetCheck()) {
967+ if (((ts.ColorFlag & CF_BOLDCOLOR) != 0) != GetCheck(IDC_ENABLE_ATTR_COLOR_BOLD)) {
1352968 ts.ColorFlag ^= CF_BOLDCOLOR;
1353969 }
1354970
1355971 // (7) Attr Blink Color
1356- btn = (CButton *)GetDlgItem(IDC_ENABLE_ATTR_COLOR_BLINK);
1357- if (((ts.ColorFlag & CF_BLINKCOLOR) != 0) != btn->GetCheck()) {
972+ if (((ts.ColorFlag & CF_BLINKCOLOR) != 0) != GetCheck(IDC_ENABLE_ATTR_COLOR_BLINK)) {
1358973 ts.ColorFlag ^= CF_BLINKCOLOR;
1359974 }
1360975
1361976 // (8) Attr Reverse Color
1362- btn = (CButton *)GetDlgItem(IDC_ENABLE_ATTR_COLOR_REVERSE);
1363977 if (ts.ColorFlag & CF_REVERSEVIDEO) { // Reverse Videoモード(DECSCNM)時は処理を変える
1364978 if (ts.ColorFlag & CF_REVERSECOLOR) {
1365- if (!btn->GetCheck()) {
979+ if (!GetCheck(IDC_ENABLE_ATTR_COLOR_REVERSE)) {
1366980 TmpColor = ts.VTColor[0];
1367981 ts.VTColor[0] = ts.VTReverseColor[1];
1368982 ts.VTReverseColor[1] = ts.VTColor[1];
@@ -1371,7 +985,7 @@
1371985 ts.ColorFlag ^= CF_REVERSECOLOR;
1372986 }
1373987 }
1374- else if (btn->GetCheck()) {
988+ else if (GetCheck(IDC_ENABLE_ATTR_COLOR_REVERSE)) {
1375989 TmpColor = ts.VTColor[0];
1376990 ts.VTColor[0] = ts.VTReverseColor[0];
1377991 ts.VTReverseColor[0] = ts.VTColor[1];
@@ -1380,25 +994,22 @@
1380994 ts.ColorFlag ^= CF_REVERSECOLOR;
1381995 }
1382996 }
1383- else if (((ts.ColorFlag & CF_REVERSECOLOR) != 0) != btn->GetCheck()) {
997+ else if (((ts.ColorFlag & CF_REVERSECOLOR) != 0) != GetCheck(IDC_ENABLE_ATTR_COLOR_REVERSE)) {
1384998 ts.ColorFlag ^= CF_REVERSECOLOR;
1385999 }
13861000
13871001 // (9) URL Color
1388- btn = (CButton *)GetDlgItem(IDC_ENABLE_URL_COLOR);
1389- if (((ts.ColorFlag & CF_URLCOLOR) != 0) != btn->GetCheck()) {
1002+ if (((ts.ColorFlag & CF_URLCOLOR) != 0) != GetCheck(IDC_ENABLE_URL_COLOR)) {
13901003 ts.ColorFlag ^= CF_URLCOLOR;
13911004 }
13921005
13931006 // (10) Color
1394- btn = (CButton *)GetDlgItem(IDC_ENABLE_ANSI_COLOR);
1395- if (((ts.ColorFlag & CF_ANSICOLOR) != 0) != btn->GetCheck()) {
1007+ if (((ts.ColorFlag & CF_ANSICOLOR) != 0) != GetCheck(IDC_ENABLE_ANSI_COLOR)) {
13961008 ts.ColorFlag ^= CF_ANSICOLOR;
13971009 }
13981010
13991011 // (11) URL Underline
1400- btn = (CButton *)GetDlgItem(IDC_URL_UNDERLINE);
1401- if (((ts.FontFlag & FF_URLUNDERLINE) != 0) != btn->GetCheck()) {
1012+ if (((ts.FontFlag & FF_URLUNDERLINE) != 0) != GetCheck(IDC_URL_UNDERLINE)) {
14021013 ts.FontFlag ^= FF_URLUNDERLINE;
14031014 }
14041015
@@ -1423,32 +1034,28 @@
14231034
14241035 // CLogPropPageDlg ダイアログ
14251036
1426-IMPLEMENT_DYNAMIC(CLogPropPageDlg, CPropertyPage)
1427-
1428-CLogPropPageDlg::CLogPropPageDlg()
1429- : CPropertyPage(CLogPropPageDlg::IDD)
1037+CLogPropPageDlg::CLogPropPageDlg(HINSTANCE inst, TTCPropertySheet *sheet)
1038+ : TTCPropertyPage(inst, CLogPropPageDlg::IDD, sheet)
14301039 {
1431-
1040+ get_lang_msg("DLG_TABSHEET_TITLE_Log", ts.UIMsg, sizeof(ts.UIMsg),
1041+ "Log", ts.UILanguageFile);
1042+ m_psp.pszTitle = _tcsdup(ts.UIMsg);
1043+ m_psp.dwFlags |= PSP_USETITLE;
14321044 }
14331045
14341046 CLogPropPageDlg::~CLogPropPageDlg()
14351047 {
1436- if (DlgLogFont != NULL) {
1437- DeleteObject(DlgLogFont);
1438- }
1048+ free((void *)m_psp.pszTitle);
14391049 }
14401050
1441-BEGIN_MESSAGE_MAP(CLogPropPageDlg, CPropertyPage)
1442-END_MESSAGE_MAP()
1443-
14441051 // CLogPropPageDlg メッセージ ハンドラ
14451052
14461053 #define LOG_ROTATE_SIZETYPE_NUM 3
1447-static char *LogRotateSizeType[] = {
1054+static const char *LogRotateSizeType[] = {
14481055 "Byte", "KB", "MB"
14491056 };
14501057
1451-static char *GetLogRotateSizeType(int val)
1058+static const char *GetLogRotateSizeType(int val)
14521059 {
14531060 if (val >= LOG_ROTATE_SIZETYPE_NUM)
14541061 val = 0;
@@ -1456,95 +1063,31 @@
14561063 return LogRotateSizeType[val];
14571064 }
14581065
1459-BOOL CLogPropPageDlg::OnInitDialog()
1066+void CLogPropPageDlg::OnInitDialog()
14601067 {
1461- char uimsg[MAX_UIMSG];
1462- CButton *btn;
1463- CComboBox *combo;
1464- int i, TmpLogRotateSize;
1068+ TTCPropertyPage::OnInitDialog();
14651069
1466- CPropertyPage::OnInitDialog();
1467-
1468- font = (HFONT)SendMessage(WM_GETFONT, 0, 0);
1469- GetObject(font, sizeof(LOGFONT), &logfont);
1470- if (get_lang_font("DLG_TAHOMA_FONT", GetSafeHwnd(), &logfont, &DlgLogFont, ts.UILanguageFile)) {
1471- SendDlgItemMessage(IDC_VIEWLOG_LABEL, WM_SETFONT, (WPARAM)DlgLogFont, MAKELPARAM(TRUE,0));
1472- SendDlgItemMessage(IDC_VIEWLOG_EDITOR, WM_SETFONT, (WPARAM)DlgLogFont, MAKELPARAM(TRUE,0));
1473- SendDlgItemMessage(IDC_VIEWLOG_PATH, WM_SETFONT, (WPARAM)DlgLogFont, MAKELPARAM(TRUE,0));
1474- SendDlgItemMessage(IDC_DEFAULTNAME_LABEL, WM_SETFONT, (WPARAM)DlgLogFont, MAKELPARAM(TRUE,0));
1475- SendDlgItemMessage(IDC_DEFAULTNAME_EDITOR, WM_SETFONT, (WPARAM)DlgLogFont, MAKELPARAM(TRUE,0));
1476- SendDlgItemMessage(IDC_DEFAULTPATH_LABEL, WM_SETFONT, (WPARAM)DlgLogFont, MAKELPARAM(TRUE,0));
1477- SendDlgItemMessage(IDC_DEFAULTPATH_EDITOR, WM_SETFONT, (WPARAM)DlgLogFont, MAKELPARAM(TRUE,0));
1478- SendDlgItemMessage(IDC_DEFAULTPATH_PUSH, WM_SETFONT, (WPARAM)DlgLogFont, MAKELPARAM(TRUE,0));
1479- SendDlgItemMessage(IDC_AUTOSTART, WM_SETFONT, (WPARAM)DlgLogFont, MAKELPARAM(TRUE,0));
1480-
1070+ static const DlgTextInfo TextInfos[] = {
1071+ { IDC_VIEWLOG_LABEL, "DLG_TAB_LOG_EDITOR" },
1072+ { IDC_DEFAULTNAME_LABEL, "DLG_TAB_LOG_FILENAME" },
1073+ { IDC_DEFAULTPATH_LABEL, "DLG_TAB_LOG_FILEPATH" },
1074+ { IDC_AUTOSTART, "DLG_TAB_LOG_AUTOSTART" },
14811075 // Log rotate
1482- SendDlgItemMessage(IDC_LOG_ROTATE, WM_SETFONT, (WPARAM)DlgLogFont, MAKELPARAM(TRUE,0));
1483- SendDlgItemMessage(IDC_ROTATE_SIZE_TEXT, WM_SETFONT, (WPARAM)DlgLogFont, MAKELPARAM(TRUE,0));
1484- SendDlgItemMessage(IDC_ROTATE_SIZE, WM_SETFONT, (WPARAM)DlgLogFont, MAKELPARAM(TRUE,0));
1485- SendDlgItemMessage(IDC_ROTATE_SIZE_TYPE, WM_SETFONT, (WPARAM)DlgLogFont, MAKELPARAM(TRUE,0));
1486- SendDlgItemMessage(IDC_ROTATE_STEP_TEXT, WM_SETFONT, (WPARAM)DlgLogFont, MAKELPARAM(TRUE,0));
1487- SendDlgItemMessage(IDC_ROTATE_STEP, WM_SETFONT, (WPARAM)DlgLogFont, MAKELPARAM(TRUE,0));
1488-
1076+ { IDC_LOG_ROTATE, "DLG_TAB_LOG_ROTATE" },
1077+ { IDC_ROTATE_SIZE_TEXT, "DLG_TAB_LOG_ROTATE_SIZE_TEXT" },
1078+ { IDC_ROTATE_STEP_TEXT, "DLG_TAB_LOG_ROTATESTEP" },
14891079 // Log options
1490- SendDlgItemMessage(IDC_LOG_OPTION_GROUP, WM_SETFONT, (WPARAM)DlgLogFont, MAKELPARAM(TRUE,0));
1491- SendDlgItemMessage(IDC_OPT_BINARY, WM_SETFONT, (WPARAM)DlgLogFont, MAKELPARAM(TRUE,0));
1492- SendDlgItemMessage(IDC_OPT_APPEND, WM_SETFONT, (WPARAM)DlgLogFont, MAKELPARAM(TRUE,0));
1493- SendDlgItemMessage(IDC_OPT_PLAINTEXT, WM_SETFONT, (WPARAM)DlgLogFont, MAKELPARAM(TRUE,0));
1494- SendDlgItemMessage(IDC_OPT_TIMESTAMP, WM_SETFONT, (WPARAM)DlgLogFont, MAKELPARAM(TRUE,0));
1495- SendDlgItemMessage(IDC_OPT_HIDEDLG, WM_SETFONT, (WPARAM)DlgLogFont, MAKELPARAM(TRUE,0));
1496- SendDlgItemMessage(IDC_OPT_INCBUF, WM_SETFONT, (WPARAM)DlgLogFont, MAKELPARAM(TRUE,0));
1497- }
1498- else {
1499- DlgLogFont = NULL;
1500- }
1080+ // FIXME: メッセージカタログは既存のログオプションのものを流用したが、アクセラレータキーが重複するかもしれない。
1081+ { IDC_LOG_OPTION_GROUP, "DLG_FOPT" },
1082+ { IDC_OPT_BINARY, "DLG_FOPT_BINARY" },
1083+ { IDC_OPT_APPEND, "DLG_FOPT_APPEND" },
1084+ { IDC_OPT_PLAINTEXT, "DLG_FOPT_PLAIN" },
1085+ { IDC_OPT_HIDEDLG, "DLG_FOPT_HIDEDIALOG" },
1086+ { IDC_OPT_INCBUF, "DLG_FOPT_ALLBUFFINFIRST" },
1087+ { IDC_OPT_TIMESTAMP, "DLG_FOPT_TIMESTAMP" },
1088+ };
1089+ SetDlgTexts(m_hWnd, TextInfos, _countof(TextInfos), ts.UILanguageFile);
15011090
1502- GetDlgItemText(IDC_VIEWLOG_LABEL, uimsg, sizeof(uimsg));
1503- get_lang_msg("DLG_TAB_LOG_EDITOR", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
1504- SetDlgItemText(IDC_VIEWLOG_LABEL, ts.UIMsg);
1505- GetDlgItemText(IDC_DEFAULTNAME_LABEL, uimsg, sizeof(uimsg));
1506- get_lang_msg("DLG_TAB_LOG_FILENAME", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
1507- SetDlgItemText(IDC_DEFAULTNAME_LABEL, ts.UIMsg);
1508- GetDlgItemText(IDC_DEFAULTPATH_LABEL, uimsg, sizeof(uimsg));
1509- get_lang_msg("DLG_TAB_LOG_FILEPATH", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
1510- SetDlgItemText(IDC_DEFAULTPATH_LABEL, ts.UIMsg);
1511- GetDlgItemText(IDC_AUTOSTART, uimsg, sizeof(uimsg));
1512- get_lang_msg("DLG_TAB_LOG_AUTOSTART", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
1513- SetDlgItemText(IDC_AUTOSTART, ts.UIMsg);
1514- // Log rotate
1515- GetDlgItemText(IDC_LOG_ROTATE, uimsg, sizeof(uimsg));
1516- get_lang_msg("DLG_TAB_LOG_ROTATE", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
1517- SetDlgItemText(IDC_LOG_ROTATE, ts.UIMsg);
1518- GetDlgItemText(IDC_ROTATE_SIZE_TEXT, uimsg, sizeof(uimsg));
1519- get_lang_msg("DLG_TAB_LOG_ROTATE_SIZE_TEXT", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
1520- SetDlgItemText(IDC_ROTATE_SIZE_TEXT, ts.UIMsg);
1521- GetDlgItemText(IDC_ROTATE_STEP_TEXT, uimsg, sizeof(uimsg));
1522- get_lang_msg("DLG_TAB_LOG_ROTATESTEP", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
1523- SetDlgItemText(IDC_ROTATE_STEP_TEXT, ts.UIMsg);
1524- // Log options
1525- // FIXME: メッセージカタログは既存のログオプションのものを流用したが、アクセラレータキーが重複するかもしれない。
1526- GetDlgItemText(IDC_LOG_OPTION_GROUP, uimsg, sizeof(uimsg));
1527- get_lang_msg("DLG_FOPT", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
1528- SetDlgItemText(IDC_LOG_OPTION_GROUP, ts.UIMsg);
1529- GetDlgItemText(IDC_OPT_BINARY, uimsg, sizeof(uimsg));
1530- get_lang_msg("DLG_FOPT_BINARY", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
1531- SetDlgItemText(IDC_OPT_BINARY, ts.UIMsg);
1532- GetDlgItemText(IDC_OPT_APPEND, uimsg, sizeof(uimsg));
1533- get_lang_msg("DLG_FOPT_APPEND", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
1534- SetDlgItemText(IDC_OPT_APPEND, ts.UIMsg);
1535- GetDlgItemText(IDC_OPT_PLAINTEXT, uimsg, sizeof(uimsg));
1536- get_lang_msg("DLG_FOPT_PLAIN", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
1537- SetDlgItemText(IDC_OPT_PLAINTEXT, ts.UIMsg);
1538- GetDlgItemText(IDC_OPT_HIDEDLG, uimsg, sizeof(uimsg));
1539- get_lang_msg("DLG_FOPT_HIDEDIALOG", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
1540- SetDlgItemText(IDC_OPT_HIDEDLG, ts.UIMsg);
1541- GetDlgItemText(IDC_OPT_INCBUF, uimsg, sizeof(uimsg));
1542- get_lang_msg("DLG_FOPT_ALLBUFFINFIRST", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
1543- SetDlgItemText(IDC_OPT_INCBUF, ts.UIMsg);
1544- GetDlgItemText(IDC_OPT_TIMESTAMP, uimsg, sizeof(uimsg));
1545- get_lang_msg("DLG_FOPT_TIMESTAMP", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
1546- SetDlgItemText(IDC_OPT_TIMESTAMP, ts.UIMsg);
1547-
15481091 get_lang_msg("DLG_FOPT_TIMESTAMP_LOCAL", ts.UIMsg, sizeof(ts.UIMsg), "Local Time", ts.UILanguageFile);
15491092 SendDlgItemMessage(IDC_OPT_TIMESTAMP_TYPE, CB_ADDSTRING, 0, (LPARAM)ts.UIMsg);
15501093 get_lang_msg("DLG_FOPT_TIMESTAMP_UTC", ts.UIMsg, sizeof(ts.UIMsg), "UTC", ts.UILanguageFile);
@@ -1565,66 +1108,55 @@
15651108 SetDlgItemText(IDC_DEFAULTPATH_EDITOR, ts.LogDefaultPath);
15661109
15671110 /* Auto start logging (2007.5.31 maya) */
1568- btn = (CButton *)GetDlgItem(IDC_AUTOSTART);
1569- btn->SetCheck(ts.LogAutoStart);
1111+ SetCheck(IDC_AUTOSTART, ts.LogAutoStart);
15701112
15711113 // Log rotate
1572- btn = (CButton *)GetDlgItem(IDC_LOG_ROTATE);
1573- btn->SetCheck(ts.LogRotate != ROTATE_NONE);
1114+ SetCheck(IDC_LOG_ROTATE, ts.LogRotate != ROTATE_NONE);
15741115
1575- combo = (CComboBox *)GetDlgItem(IDC_ROTATE_SIZE_TYPE);
1576- for (i = 0 ; i < LOG_ROTATE_SIZETYPE_NUM ; i++) {
1577- combo->AddString(LogRotateSizeType[i]);
1116+ for (int i = 0 ; i < LOG_ROTATE_SIZETYPE_NUM ; i++) {
1117+ SendDlgItemMessage(IDC_ROTATE_SIZE_TYPE, CB_ADDSTRING, 0, (LPARAM)LogRotateSizeType[i]);
15781118 }
1579-
1580- TmpLogRotateSize = ts.LogRotateSize;
1581- for (i = 0 ; i < ts.LogRotateSizeType ; i++)
1119+ int TmpLogRotateSize = ts.LogRotateSize;
1120+ for (int i = 0 ; i < ts.LogRotateSizeType ; i++)
15821121 TmpLogRotateSize /= 1024;
15831122 SetDlgItemInt(IDC_ROTATE_SIZE, TmpLogRotateSize, FALSE);
1584- combo->SelectString(-1, GetLogRotateSizeType(ts.LogRotateSizeType));
1123+ SendDlgItemMessage(IDC_ROTATE_SIZE_TYPE, CB_SELECTSTRING, -1, (LPARAM)GetLogRotateSizeType(ts.LogRotateSizeType));
15851124 SetDlgItemInt(IDC_ROTATE_STEP, ts.LogRotateStep, FALSE);
15861125 if (ts.LogRotate == ROTATE_NONE) {
1587- GetDlgItem(IDC_ROTATE_SIZE_TEXT)->EnableWindow(FALSE);
1588- GetDlgItem(IDC_ROTATE_SIZE)->EnableWindow(FALSE);
1589- GetDlgItem(IDC_ROTATE_SIZE_TYPE)->EnableWindow(FALSE);
1590- GetDlgItem(IDC_ROTATE_STEP_TEXT)->EnableWindow(FALSE);
1591- GetDlgItem(IDC_ROTATE_STEP)->EnableWindow(FALSE);
1126+ EnableDlgItem(IDC_ROTATE_SIZE_TEXT, FALSE);
1127+ EnableDlgItem(IDC_ROTATE_SIZE, FALSE);
1128+ EnableDlgItem(IDC_ROTATE_SIZE_TYPE, FALSE);
1129+ EnableDlgItem(IDC_ROTATE_STEP_TEXT, FALSE);
1130+ EnableDlgItem(IDC_ROTATE_STEP, FALSE);
15921131 } else {
1593- GetDlgItem(IDC_ROTATE_SIZE_TEXT)->EnableWindow(TRUE);
1594- GetDlgItem(IDC_ROTATE_SIZE)->EnableWindow(TRUE);
1595- GetDlgItem(IDC_ROTATE_SIZE_TYPE)->EnableWindow(TRUE);
1596- GetDlgItem(IDC_ROTATE_STEP_TEXT)->EnableWindow(TRUE);
1597- GetDlgItem(IDC_ROTATE_STEP)->EnableWindow(TRUE);
1132+ EnableDlgItem(IDC_ROTATE_SIZE_TEXT, TRUE);
1133+ EnableDlgItem(IDC_ROTATE_SIZE, TRUE);
1134+ EnableDlgItem(IDC_ROTATE_SIZE_TYPE, TRUE);
1135+ EnableDlgItem(IDC_ROTATE_STEP_TEXT, TRUE);
1136+ EnableDlgItem(IDC_ROTATE_STEP, TRUE);
15981137 }
15991138
16001139 // Log options
1601- btn = (CButton *)GetDlgItem(IDC_OPT_BINARY);
1602- btn->SetCheck(ts.LogBinary != 0);
1140+ SetCheck(IDC_OPT_BINARY, ts.LogBinary != 0);
16031141 if (ts.LogBinary) {
1604- GetDlgItem(IDC_OPT_PLAINTEXT)->EnableWindow(FALSE);
1605- GetDlgItem(IDC_OPT_TIMESTAMP)->EnableWindow(FALSE);
1142+ EnableDlgItem(IDC_OPT_PLAINTEXT, FALSE);
1143+ EnableDlgItem(IDC_OPT_TIMESTAMP, FALSE);
16061144 } else {
1607- GetDlgItem(IDC_OPT_PLAINTEXT)->EnableWindow(TRUE);
1608- GetDlgItem(IDC_OPT_TIMESTAMP)->EnableWindow(TRUE);
1145+ EnableDlgItem(IDC_OPT_PLAINTEXT, TRUE);
1146+ EnableDlgItem(IDC_OPT_TIMESTAMP, TRUE);
16091147 }
1610- btn = (CButton *)GetDlgItem(IDC_OPT_APPEND);
1611- btn->SetCheck(ts.Append != 0);
1612- btn = (CButton *)GetDlgItem(IDC_OPT_PLAINTEXT);
1613- btn->SetCheck(ts.LogTypePlainText != 0);
1614- btn = (CButton *)GetDlgItem(IDC_OPT_HIDEDLG);
1615- btn->SetCheck(ts.LogHideDialog != 0);
1616- btn = (CButton *)GetDlgItem(IDC_OPT_INCBUF);
1617- btn->SetCheck(ts.LogAllBuffIncludedInFirst != 0);
1618- btn = (CButton *)GetDlgItem(IDC_OPT_TIMESTAMP);
1619- btn->SetCheck(ts.LogTimestamp != 0);
1148+ SetCheck(IDC_OPT_APPEND, ts.Append != 0);
1149+ SetCheck(IDC_OPT_PLAINTEXT, ts.LogTypePlainText != 0);
1150+ SetCheck(IDC_OPT_HIDEDLG, ts.LogHideDialog != 0);
1151+ SetCheck(IDC_OPT_INCBUF, ts.LogAllBuffIncludedInFirst != 0);
1152+ SetCheck(IDC_OPT_TIMESTAMP, ts.LogTimestamp != 0);
16201153
1621- combo = (CComboBox *)GetDlgItem(IDC_OPT_TIMESTAMP_TYPE);
1622- combo->SetCurSel(ts.LogTimestampType);
1154+ SetCurSel(IDC_OPT_TIMESTAMP_TYPE, ts.LogTimestampType);
16231155 if (ts.LogBinary || !ts.LogTimestamp) {
1624- GetDlgItem(IDC_OPT_TIMESTAMP_TYPE)->EnableWindow(FALSE);
1156+ EnableDlgItem(IDC_OPT_TIMESTAMP_TYPE, FALSE);
16251157 }
16261158 else {
1627- GetDlgItem(IDC_OPT_TIMESTAMP_TYPE)->EnableWindow(TRUE);
1159+ EnableDlgItem(IDC_OPT_TIMESTAMP_TYPE, TRUE);
16281160 }
16291161 /*
16301162 switch (ts.LogTimestampType) {
@@ -1645,8 +1177,6 @@
16451177
16461178 // ダイアログにフォーカスを当てる
16471179 ::SetFocus(::GetDlgItem(GetSafeHwnd(), IDC_VIEWLOG_EDITOR));
1648-
1649- return FALSE;
16501180 }
16511181
16521182 BOOL CLogPropPageDlg::OnCommand(WPARAM wParam, LPARAM lParam)
@@ -1690,20 +1220,18 @@
16901220
16911221 case IDC_LOG_ROTATE | (BN_CLICKED << 16):
16921222 {
1693- CButton *btn;
1694- btn = (CButton *)GetDlgItem(IDC_LOG_ROTATE);
1695- if (btn->GetCheck()) {
1696- GetDlgItem(IDC_ROTATE_SIZE_TEXT)->EnableWindow(TRUE);
1697- GetDlgItem(IDC_ROTATE_SIZE)->EnableWindow(TRUE);
1698- GetDlgItem(IDC_ROTATE_SIZE_TYPE)->EnableWindow(TRUE);
1699- GetDlgItem(IDC_ROTATE_STEP_TEXT)->EnableWindow(TRUE);
1700- GetDlgItem(IDC_ROTATE_STEP)->EnableWindow(TRUE);
1223+ if (GetCheck(IDC_LOG_ROTATE)) {
1224+ EnableDlgItem(IDC_ROTATE_SIZE_TEXT, TRUE);
1225+ EnableDlgItem(IDC_ROTATE_SIZE, TRUE);
1226+ EnableDlgItem(IDC_ROTATE_SIZE_TYPE, TRUE);
1227+ EnableDlgItem(IDC_ROTATE_STEP_TEXT, TRUE);
1228+ EnableDlgItem(IDC_ROTATE_STEP, TRUE);
17011229 } else {
1702- GetDlgItem(IDC_ROTATE_SIZE_TEXT)->EnableWindow(FALSE);
1703- GetDlgItem(IDC_ROTATE_SIZE)->EnableWindow(FALSE);
1704- GetDlgItem(IDC_ROTATE_SIZE_TYPE)->EnableWindow(FALSE);
1705- GetDlgItem(IDC_ROTATE_STEP_TEXT)->EnableWindow(FALSE);
1706- GetDlgItem(IDC_ROTATE_STEP)->EnableWindow(FALSE);
1230+ EnableDlgItem(IDC_ROTATE_SIZE_TEXT, FALSE);
1231+ EnableDlgItem(IDC_ROTATE_SIZE, FALSE);
1232+ EnableDlgItem(IDC_ROTATE_SIZE_TYPE, FALSE);
1233+ EnableDlgItem(IDC_ROTATE_STEP_TEXT, FALSE);
1234+ EnableDlgItem(IDC_ROTATE_STEP, FALSE);
17071235 }
17081236
17091237 }
@@ -1711,19 +1239,16 @@
17111239
17121240 case IDC_OPT_BINARY | (BN_CLICKED << 16):
17131241 {
1714- CButton *btn;
1715- btn = (CButton *)GetDlgItem(IDC_OPT_BINARY);
1716- if (btn->GetCheck()) {
1717- GetDlgItem(IDC_OPT_PLAINTEXT)->EnableWindow(FALSE);
1718- GetDlgItem(IDC_OPT_TIMESTAMP)->EnableWindow(FALSE);
1719- GetDlgItem(IDC_OPT_TIMESTAMP_TYPE)->EnableWindow(FALSE);
1242+ if (GetCheck(IDC_OPT_BINARY)) {
1243+ EnableDlgItem(IDC_OPT_PLAINTEXT, FALSE);
1244+ EnableDlgItem(IDC_OPT_TIMESTAMP, FALSE);
1245+ EnableDlgItem(IDC_OPT_TIMESTAMP_TYPE, FALSE);
17201246 } else {
1721- GetDlgItem(IDC_OPT_PLAINTEXT)->EnableWindow(TRUE);
1722- GetDlgItem(IDC_OPT_TIMESTAMP)->EnableWindow(TRUE);
1247+ EnableDlgItem(IDC_OPT_PLAINTEXT, TRUE);
1248+ EnableDlgItem(IDC_OPT_TIMESTAMP, TRUE);
17231249
1724- btn = (CButton *)GetDlgItem(IDC_OPT_TIMESTAMP);
1725- if (btn->GetCheck()) {
1726- GetDlgItem(IDC_OPT_TIMESTAMP_TYPE)->EnableWindow(TRUE);
1250+ if (GetCheck(IDC_OPT_TIMESTAMP)) {
1251+ EnableDlgItem(IDC_OPT_TIMESTAMP_TYPE, TRUE);
17271252 }
17281253 }
17291254 }
@@ -1731,18 +1256,16 @@
17311256
17321257 case IDC_OPT_TIMESTAMP | (BN_CLICKED << 16):
17331258 {
1734- CButton *btn;
1735- btn = (CButton *)GetDlgItem(IDC_OPT_TIMESTAMP);
1736- if (btn->GetCheck()) {
1737- GetDlgItem(IDC_OPT_TIMESTAMP_TYPE)->EnableWindow(TRUE);
1259+ if (GetCheck(IDC_OPT_TIMESTAMP)) {
1260+ EnableDlgItem(IDC_OPT_TIMESTAMP_TYPE, TRUE);
17381261 } else {
1739- GetDlgItem(IDC_OPT_TIMESTAMP_TYPE)->EnableWindow(FALSE);
1262+ EnableDlgItem(IDC_OPT_TIMESTAMP_TYPE, FALSE);
17401263 }
17411264 }
17421265 return TRUE;
17431266 }
17441267
1745- return CPropertyPage::OnCommand(wParam, lParam);
1268+ return TTCPropertyPage::OnCommand(wParam, lParam);
17461269 }
17471270
17481271 void CLogPropPageDlg::OnOK()
@@ -1751,10 +1274,6 @@
17511274 time_t time_local;
17521275 struct tm *tm_local;
17531276 char uimsg[MAX_UIMSG];
1754- CButton *btn;
1755- CString str;
1756- CComboBox *cmb;
1757- int i;
17581277
17591278 // Viewlog Editor path (2005.1.29 yutaka)
17601279 GetDlgItemText(IDC_VIEWLOG_EDITOR, ts.ViewlogEditor, sizeof(ts.ViewlogEditor));
@@ -1768,6 +1287,7 @@
17681287 MessageBox(ts.UIMsg, uimsg, MB_ICONEXCLAMATION);
17691288 return;
17701289 }
1290+
17711291 // 現在時刻を取得
17721292 time(&time_local);
17731293 tm_local = localtime(&time_local);
@@ -1792,25 +1312,21 @@
17921312 GetDlgItemText(IDC_DEFAULTPATH_EDITOR, ts.LogDefaultPath, sizeof(ts.LogDefaultPath));
17931313
17941314 /* Auto start logging (2007.5.31 maya) */
1795- btn = (CButton *)GetDlgItem(IDC_AUTOSTART);
1796- ts.LogAutoStart = btn->GetCheck();
1315+ ts.LogAutoStart = GetCheck(IDC_AUTOSTART);
17971316
17981317 /* Log Rotate */
1799- btn = (CButton *)GetDlgItem(IDC_LOG_ROTATE);
1800- if (btn->GetCheck()) { /* on */
1318+ if (GetCheck(IDC_LOG_ROTATE)) { /* on */
18011319 ts.LogRotate = ROTATE_SIZE;
1802-
1803- ((CComboBox*)GetDlgItem(IDC_ROTATE_SIZE_TYPE))->GetWindowText(str);
1804- for (i = 0 ; i < LOG_ROTATE_SIZETYPE_NUM ; i++) {
1805- if (strcmp(str, LogRotateSizeType[i]) == 0)
1320+ GetDlgItemText(IDC_ROTATE_SIZE_TYPE, buf, _countof(buf));
1321+ ts.LogRotateSizeType = 0;
1322+ for (int i = 0 ; i < LOG_ROTATE_SIZETYPE_NUM ; i++) {
1323+ if (strcmp(buf, LogRotateSizeType[i]) == 0) {
1324+ ts.LogRotateSizeType = i;
18061325 break;
1326+ }
18071327 }
1808- if (i >= LOG_ROTATE_SIZETYPE_NUM)
1809- i = 0;
1810- ts.LogRotateSizeType = i;
1811-
18121328 ts.LogRotateSize = GetDlgItemInt(IDC_ROTATE_SIZE);
1813- for (i = 0 ; i < ts.LogRotateSizeType ; i++)
1329+ for (int i = 0 ; i < ts.LogRotateSizeType ; i++)
18141330 ts.LogRotateSize *= 1024;
18151331
18161332 ts.LogRotateStep = GetDlgItemInt(IDC_ROTATE_STEP);
@@ -1821,8 +1337,7 @@
18211337 }
18221338
18231339 // Log Options
1824- btn = (CButton *)GetDlgItem(IDC_OPT_BINARY);
1825- if (btn->GetCheck()) {
1340+ if (GetCheck(IDC_OPT_BINARY)) {
18261341 ts.LogBinary = 1;
18271342 }
18281343 else {
@@ -1829,8 +1344,7 @@
18291344 ts.LogBinary = 0;
18301345 }
18311346
1832- btn = (CButton *)GetDlgItem(IDC_OPT_APPEND);
1833- if (btn->GetCheck()) {
1347+ if (GetCheck(IDC_OPT_APPEND)) {
18341348 ts.Append = 1;
18351349 }
18361350 else {
@@ -1837,8 +1351,7 @@
18371351 ts.Append = 0;
18381352 }
18391353
1840- btn = (CButton *)GetDlgItem(IDC_OPT_PLAINTEXT);
1841- if (btn->GetCheck()) {
1354+ if (GetCheck(IDC_OPT_PLAINTEXT)) {
18421355 ts.LogTypePlainText = 1;
18431356 }
18441357 else {
@@ -1845,8 +1358,7 @@
18451358 ts.LogTypePlainText = 0;
18461359 }
18471360
1848- btn = (CButton *)GetDlgItem(IDC_OPT_HIDEDLG);
1849- if (btn->GetCheck()) {
1361+ if (GetCheck(IDC_OPT_HIDEDLG)) {
18501362 ts.LogHideDialog = 1;
18511363 }
18521364 else {
@@ -1853,8 +1365,7 @@
18531365 ts.LogHideDialog = 0;
18541366 }
18551367
1856- btn = (CButton *)GetDlgItem(IDC_OPT_INCBUF);
1857- if (btn->GetCheck()) {
1368+ if (GetCheck(IDC_OPT_INCBUF)) {
18581369 ts.LogAllBuffIncludedInFirst = 1;
18591370 }
18601371 else {
@@ -1861,8 +1372,7 @@
18611372 ts.LogAllBuffIncludedInFirst = 0;
18621373 }
18631374
1864- btn = (CButton *)GetDlgItem(IDC_OPT_TIMESTAMP);
1865- if (btn->GetCheck()) {
1375+ if (GetCheck(IDC_OPT_TIMESTAMP)) {
18661376 ts.LogTimestamp = 1;
18671377 }
18681378 else {
@@ -1869,72 +1379,38 @@
18691379 ts.LogTimestamp = 0;
18701380 }
18711381
1872- cmb = (CComboBox *)GetDlgItem(IDC_OPT_TIMESTAMP_TYPE);
1873- ts.LogTimestampType = cmb->GetCurSel();
1382+ ts.LogTimestampType = GetCurSel(IDC_OPT_TIMESTAMP_TYPE);
18741383 }
18751384
1385+/////////////////////////////
18761386
18771387 // CCygwinPropPageDlg ダイアログ
18781388
1879-IMPLEMENT_DYNAMIC(CCygwinPropPageDlg, CPropertyPage)
1880-
1881-CCygwinPropPageDlg::CCygwinPropPageDlg()
1882- : CPropertyPage(CCygwinPropPageDlg::IDD)
1389+CCygwinPropPageDlg::CCygwinPropPageDlg(HINSTANCE inst, TTCPropertySheet *sheet)
1390+ : TTCPropertyPage(inst, CCygwinPropPageDlg::IDD, sheet)
18831391 {
1392+ get_lang_msg("DLG_TABSHEET_TITLE_CYGWIN", ts.UIMsg, sizeof(ts.UIMsg),
1393+ "Cygwin", ts.UILanguageFile);
1394+ m_psp.pszTitle = _tcsdup(ts.UIMsg);
1395+ m_psp.dwFlags |= PSP_USETITLE;
18841396 }
18851397
18861398 CCygwinPropPageDlg::~CCygwinPropPageDlg()
18871399 {
1888- if (DlgCygwinFont != NULL) {
1889- DeleteObject(DlgCygwinFont);
1890- }
1400+ free((void *)m_psp.pszTitle);
18911401 }
18921402
1893-BEGIN_MESSAGE_MAP(CCygwinPropPageDlg, CPropertyPage)
1894-END_MESSAGE_MAP()
1895-
18961403 // CCygwinPropPageDlg メッセージ ハンドラ
18971404
1898-BOOL CCygwinPropPageDlg::OnInitDialog()
1405+void CCygwinPropPageDlg::OnInitDialog()
18991406 {
1900- char uimsg[MAX_UIMSG];
1901- CButton *btn;
1407+ TTCPropertyPage::OnInitDialog();
19021408
1903- CPropertyPage::OnInitDialog();
1409+ static const DlgTextInfo TextInfos[] = {
1410+ { IDC_CYGWIN_PATH_LABEL, "DLG_TAB_CYGWIN_PATH" }
1411+ };
1412+ SetDlgTexts(m_hWnd, TextInfos, _countof(TextInfos), ts.UILanguageFile);
19041413
1905- font = (HFONT)SendMessage(WM_GETFONT, 0, 0);
1906- GetObject(font, sizeof(LOGFONT), &logfont);
1907- if (get_lang_font("DLG_TAHOMA_FONT", GetSafeHwnd(), &logfont, &DlgCygwinFont, ts.UILanguageFile)) {
1908- SendDlgItemMessage(IDC_CYGWIN_PATH_LABEL, WM_SETFONT, (WPARAM)DlgCygwinFont, MAKELPARAM(TRUE,0));
1909- SendDlgItemMessage(IDC_CYGWIN_PATH, WM_SETFONT, (WPARAM)DlgCygwinFont, MAKELPARAM(TRUE,0));
1910- SendDlgItemMessage(IDC_SELECT_FILE, WM_SETFONT, (WPARAM)DlgCygwinFont, MAKELPARAM(TRUE,0));
1911- SendDlgItemMessage(IDC_CYGWIN, WM_SETFONT, (WPARAM)DlgCygwinFont, MAKELPARAM(TRUE,0));
1912- SendDlgItemMessage(IDC_TERM_LABEL, WM_SETFONT, (WPARAM)DlgCygwinFont, MAKELPARAM(TRUE,0));
1913- SendDlgItemMessage(IDC_TERM_EDIT, WM_SETFONT, (WPARAM)DlgCygwinFont, MAKELPARAM(TRUE,0));
1914- SendDlgItemMessage(IDC_TERMTYPE_LABEL, WM_SETFONT, (WPARAM)DlgCygwinFont, MAKELPARAM(TRUE,0));
1915- SendDlgItemMessage(IDC_TERM_TYPE, WM_SETFONT, (WPARAM)DlgCygwinFont, MAKELPARAM(TRUE,0));
1916- SendDlgItemMessage(IDC_PORTSTART_LABEL, WM_SETFONT, (WPARAM)DlgCygwinFont, MAKELPARAM(TRUE,0));
1917- SendDlgItemMessage(IDC_PORT_START, WM_SETFONT, (WPARAM)DlgCygwinFont, MAKELPARAM(TRUE,0));
1918- SendDlgItemMessage(IDC_PORTRANGE_LABEL, WM_SETFONT, (WPARAM)DlgCygwinFont, MAKELPARAM(TRUE,0));
1919- SendDlgItemMessage(IDC_PORT_RANGE, WM_SETFONT, (WPARAM)DlgCygwinFont, MAKELPARAM(TRUE,0));
1920- SendDlgItemMessage(IDC_SHELL_LABEL, WM_SETFONT, (WPARAM)DlgCygwinFont, MAKELPARAM(TRUE,0));
1921- SendDlgItemMessage(IDC_SHELL, WM_SETFONT, (WPARAM)DlgCygwinFont, MAKELPARAM(TRUE,0));
1922- SendDlgItemMessage(IDC_ENV1_LABEL, WM_SETFONT, (WPARAM)DlgCygwinFont, MAKELPARAM(TRUE,0));
1923- SendDlgItemMessage(IDC_ENV1, WM_SETFONT, (WPARAM)DlgCygwinFont, MAKELPARAM(TRUE,0));
1924- SendDlgItemMessage(IDC_ENV2_LABEL, WM_SETFONT, (WPARAM)DlgCygwinFont, MAKELPARAM(TRUE,0));
1925- SendDlgItemMessage(IDC_ENV2, WM_SETFONT, (WPARAM)DlgCygwinFont, MAKELPARAM(TRUE,0));
1926- SendDlgItemMessage(IDC_LOGIN_SHELL, WM_SETFONT, (WPARAM)DlgCygwinFont, MAKELPARAM(TRUE,0));
1927- SendDlgItemMessage(IDC_HOME_CHDIR, WM_SETFONT, (WPARAM)DlgCygwinFont, MAKELPARAM(TRUE,0));
1928- SendDlgItemMessage(IDC_AGENT_PROXY, WM_SETFONT, (WPARAM)DlgCygwinFont, MAKELPARAM(TRUE,0));
1929- }
1930- else {
1931- DlgCygwinFont = NULL;
1932- }
1933-
1934- GetDlgItemText(IDC_CYGWIN_PATH_LABEL, uimsg, sizeof(uimsg));
1935- get_lang_msg("DLG_TAB_CYGWIN_PATH", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
1936- SetDlgItemText(IDC_CYGWIN_PATH_LABEL, ts.UIMsg);
1937-
19381414 memcpy(&settings, &ts.CygtermSettings, sizeof(cygterm_t));
19391415
19401416 SetDlgItemText(IDC_TERM_EDIT, settings.term);
@@ -1944,20 +1420,16 @@
19441420 SetDlgItemText(IDC_SHELL, settings.shell);
19451421 SetDlgItemText(IDC_ENV1, settings.env1);
19461422 SetDlgItemText(IDC_ENV2, settings.env2);
1947- btn = (CButton *)GetDlgItem(IDC_LOGIN_SHELL);
1948- btn->SetCheck(settings.login_shell);
1949- btn = (CButton *)GetDlgItem(IDC_HOME_CHDIR);
1950- btn->SetCheck(settings.home_chdir);
1951- btn = (CButton *)GetDlgItem(IDC_AGENT_PROXY);
1952- btn->SetCheck(settings.agent_proxy);
19531423
1424+ SetCheck(IDC_LOGIN_SHELL, settings.login_shell);
1425+ SetCheck(IDC_HOME_CHDIR, settings.home_chdir);
1426+ SetCheck(IDC_AGENT_PROXY, settings.agent_proxy);
1427+
19541428 // Cygwin install path
19551429 SetDlgItemText(IDC_CYGWIN_PATH, ts.CygwinDirectory);
19561430
19571431 // ダイアログにフォーカスを当てる
19581432 ::SetFocus(::GetDlgItem(GetSafeHwnd(), IDC_CYGWIN_PATH));
1959-
1960- return FALSE;
19611433 }
19621434
19631435 BOOL CCygwinPropPageDlg::OnCommand(WPARAM wParam, LPARAM lParam)
@@ -1976,13 +1448,11 @@
19761448 return TRUE;
19771449 }
19781450
1979- return CPropertyPage::OnCommand(wParam, lParam);
1451+ return TTCPropertyPage::OnCommand(wParam, lParam);
19801452 }
19811453
19821454 void CCygwinPropPageDlg::OnOK()
19831455 {
1984- CButton *btn;
1985-
19861456 // writing to CygTerm config file
19871457 GetDlgItemText(IDC_TERM_EDIT, settings.term, sizeof(settings.term));
19881458 GetDlgItemText(IDC_TERM_TYPE, settings.term_type, sizeof(settings.term_type));
@@ -1991,13 +1461,11 @@
19911461 GetDlgItemText(IDC_SHELL, settings.shell, sizeof(settings.shell));
19921462 GetDlgItemText(IDC_ENV1, settings.env1, sizeof(settings.env1));
19931463 GetDlgItemText(IDC_ENV2, settings.env2, sizeof(settings.env2));
1994- btn = (CButton *)GetDlgItem(IDC_LOGIN_SHELL);
1995- settings.login_shell = btn->GetCheck();
1996- btn = (CButton *)GetDlgItem(IDC_HOME_CHDIR);
1997- settings.home_chdir = btn->GetCheck();
1998- btn = (CButton *)GetDlgItem(IDC_AGENT_PROXY);
1999- settings.agent_proxy = btn->GetCheck();
20001464
1465+ settings.login_shell = GetCheck(IDC_LOGIN_SHELL);
1466+ settings.home_chdir = GetCheck(IDC_HOME_CHDIR);
1467+ settings.agent_proxy = GetCheck(IDC_AGENT_PROXY);
1468+
20011469 memcpy(&ts.CygtermSettings, &settings, sizeof(cygterm_t));
20021470
20031471 // 設定を書き込むためフラグを立てておく。
@@ -2007,90 +1475,42 @@
20071475 GetDlgItemText(IDC_CYGWIN_PATH, ts.CygwinDirectory, sizeof(ts.CygwinDirectory));
20081476 }
20091477
2010-
2011-
20121478 // CAddSettingPropSheetDlg
2013-
2014-IMPLEMENT_DYNAMIC(CAddSettingPropSheetDlg, CPropertySheet)
2015-
2016-CAddSettingPropSheetDlg::CAddSettingPropSheetDlg(UINT nIDCaption, CWnd* pParentWnd, UINT iSelectPage)
2017- :CPropertySheet(nIDCaption, pParentWnd, iSelectPage)
1479+CAddSettingPropSheetDlg::CAddSettingPropSheetDlg(HINSTANCE hInstance, LPCTSTR pszCaption, HWND hParentWnd) :
1480+ TTCPropertySheet(hInstance, pszCaption, hParentWnd)
20181481 {
2019- AddPage(&m_GeneralPage);
2020- AddPage(&m_SequencePage);
2021- AddPage(&m_CopypastePage);
2022- AddPage(&m_VisualPage);
2023- AddPage(&m_LogPage);
2024- AddPage(&m_CygwinPage);
1482+ m_GeneralPage = new CGeneralPropPageDlg(hInstance, this);
1483+ m_SequencePage = new CSequencePropPageDlg(hInstance, this);
1484+ m_CopypastePage = new CCopypastePropPageDlg(hInstance, this);
1485+ m_VisualPage = new CVisualPropPageDlg(hInstance, this);
1486+ m_LogPage = new CLogPropPageDlg(hInstance, this);
1487+ m_CygwinPage = new CCygwinPropPageDlg(hInstance, this);
1488+
1489+ hPsp[0] = CreatePropertySheetPage(&m_GeneralPage->m_psp);
1490+ hPsp[1] = CreatePropertySheetPage(&m_SequencePage->m_psp);
1491+ hPsp[2] = CreatePropertySheetPage(&m_CopypastePage->m_psp);
1492+ hPsp[3] = CreatePropertySheetPage(&m_VisualPage->m_psp);
1493+ hPsp[4] = CreatePropertySheetPage(&m_LogPage->m_psp);
1494+ hPsp[5] = CreatePropertySheetPage(&m_CygwinPage->m_psp);
1495+ m_psh.nPages = 6;
1496+ m_psh.phpage = hPsp;
20251497
2026- m_psh.dwFlags |= PSH_NOAPPLYNOW;
1498+ get_lang_msg("DLG_TABSHEET_TITLE", ts.UIMsg, sizeof(ts.UIMsg),
1499+ "Tera Term: Additional settings", ts.UILanguageFile);
1500+ m_psh.pszCaption = _tcsdup(ts.UIMsg);
20271501 }
20281502
2029-CAddSettingPropSheetDlg::CAddSettingPropSheetDlg(LPCTSTR pszCaption, CWnd* pParentWnd, UINT iSelectPage)
2030- :CPropertySheet(pszCaption, pParentWnd, iSelectPage)
2031-{
2032- AddPage(&m_GeneralPage);
2033- AddPage(&m_SequencePage);
2034- AddPage(&m_CopypastePage);
2035- AddPage(&m_VisualPage);
2036- AddPage(&m_LogPage);
2037- AddPage(&m_CygwinPage);
2038-
2039- m_psh.dwFlags |= PSH_NOAPPLYNOW;
2040-}
2041-
20421503 CAddSettingPropSheetDlg::~CAddSettingPropSheetDlg()
20431504 {
1505+ free((void*)m_psh.pszCaption);
1506+ delete m_GeneralPage;
1507+ delete m_SequencePage;
1508+ delete m_CopypastePage;
1509+ delete m_VisualPage;
1510+ delete m_LogPage;
1511+ delete m_CygwinPage;
20441512 }
20451513
2046-
2047-BEGIN_MESSAGE_MAP(CAddSettingPropSheetDlg, CPropertySheet)
2048-END_MESSAGE_MAP()
2049-
2050-
2051-// CAddSettingPropSheetDlg メッセージ ハンドラ
2052-
2053-BOOL CAddSettingPropSheetDlg::OnInitDialog()
1514+void CAddSettingPropSheetDlg::OnInitDialog()
20541515 {
2055- CPropertySheet::OnInitDialog();
2056-
2057- get_lang_msg("DLG_TABSHEET_TITLE", ts.UIMsg, sizeof(ts.UIMsg),
2058- "Tera Term: Additional settings", ts.UILanguageFile);
2059- SetWindowText(ts.UIMsg);
2060-
2061- CTabCtrl *tab = GetTabControl();
2062- TCITEM tc;
2063- tc.mask = TCIF_TEXT;
2064-
2065- get_lang_msg("DLG_TABSHEET_TITLE_GENERAL", ts.UIMsg, sizeof(ts.UIMsg),
2066- "General", ts.UILanguageFile);
2067- tc.pszText = ts.UIMsg;
2068- tab->SetItem(0, &tc);
2069-
2070- get_lang_msg("DLG_TABSHEET_TITLE_SEQUENCE", ts.UIMsg, sizeof(ts.UIMsg),
2071- "Control Sequence", ts.UILanguageFile);
2072- tc.pszText = ts.UIMsg;
2073- tab->SetItem(1, &tc);
2074-
2075- get_lang_msg("DLG_TABSHEET_TITLE_COPYPASTE", ts.UIMsg, sizeof(ts.UIMsg),
2076- "Copy and Paste", ts.UILanguageFile);
2077- tc.pszText = ts.UIMsg;
2078- tab->SetItem(2, &tc);
2079-
2080- get_lang_msg("DLG_TABSHEET_TITLE_VISUAL", ts.UIMsg, sizeof(ts.UIMsg),
2081- "Visual", ts.UILanguageFile);
2082- tc.pszText = ts.UIMsg;
2083- tab->SetItem(3, &tc);
2084-
2085- get_lang_msg("DLG_TABSHEET_TITLE_Log", ts.UIMsg, sizeof(ts.UIMsg),
2086- "Log", ts.UILanguageFile);
2087- tc.pszText = ts.UIMsg;
2088- tab->SetItem(4, &tc);
2089-
2090- get_lang_msg("DLG_TABSHEET_TITLE_CYGWIN", ts.UIMsg, sizeof(ts.UIMsg),
2091- "Cygwin", ts.UILanguageFile);
2092- tc.pszText = ts.UIMsg;
2093- tab->SetItem(5, &tc);
2094-
2095- return FALSE;
20961516 }
--- branches/cmake/teraterm/teraterm/tmfc.cpp (revision 0)
+++ branches/cmake/teraterm/teraterm/tmfc.cpp (revision 7176)
@@ -0,0 +1,411 @@
1+/*
2+ * Copyright (C) 2018 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+/*
30+ * Tera term Micro Framework class
31+ */
32+#include "tmfc.h"
33+
34+#include <windowsx.h>
35+#include "dlglib.h"
36+
37+LRESULT TTCWnd::SendMessage(UINT msg, WPARAM wp, LPARAM lp)
38+{
39+ return ::SendMessage(m_hWnd, msg, wp, lp);
40+}
41+
42+LRESULT TTCWnd::SendDlgItemMessage(int id, UINT msg, WPARAM wp, LPARAM lp)
43+{
44+ return ::SendDlgItemMessage(m_hWnd, id, msg, wp, lp);
45+}
46+
47+void TTCWnd::GetDlgItemText(int id, TCHAR *buf, size_t size)
48+{
49+ ::GetDlgItemText(m_hWnd, id, buf, size);
50+}
51+
52+void TTCWnd::SetDlgItemText(int id, const TCHAR *str)
53+{
54+ ::SetDlgItemText(m_hWnd, id, str);
55+}
56+
57+// nCheck BST_UNCHECKED / BST_CHECKED / BST_INDETERMINATE
58+void TTCWnd::SetCheck(int id, int nCheck)
59+{
60+ ::SendMessage(::GetDlgItem(m_hWnd, id), BM_SETCHECK, nCheck, 0);
61+}
62+
63+UINT TTCWnd::GetCheck(int id)
64+{
65+ return ::IsDlgButtonChecked(m_hWnd, id);
66+}
67+
68+void TTCWnd::SetCurSel(int id, int no)
69+{
70+ ::SendMessage(::GetDlgItem(m_hWnd, id), CB_SETCURSEL, no, 0);
71+}
72+
73+int TTCWnd::GetCurSel(int id)
74+{
75+ LRESULT lResult = ::SendMessage(::GetDlgItem(m_hWnd, id), CB_GETCURSEL, 0, 0);
76+ return (int)lResult;
77+}
78+
79+void TTCWnd::EnableDlgItem(int id, BOOL enable)
80+{
81+ ::EnableWindow(::GetDlgItem(m_hWnd, id), enable);
82+}
83+
84+void TTCWnd::SetDlgItemInt(int id, UINT val, BOOL bSigned)
85+{
86+ ::SetDlgItemInt(m_hWnd, id, val, bSigned);
87+}
88+
89+UINT TTCWnd::GetDlgItemInt(int id, BOOL* lpTrans, BOOL bSigned) const
90+{
91+ return ::GetDlgItemInt(m_hWnd, id, lpTrans, bSigned);
92+}
93+
94+void TTCWnd::ShowWindow(int nCmdShow)
95+{
96+ ::ShowWindow(m_hWnd, nCmdShow);
97+}
98+
99+void TTCWnd::SetWindowText(TCHAR *str)
100+{
101+ ::SetWindowText(m_hWnd, str);
102+}
103+
104+static void ModifyStyleCom(
105+ HWND hWnd, int nStyleOffset,
106+ DWORD dwRemove, DWORD dwAdd, UINT nFlags = 0)
107+{
108+ const DWORD dwStyle = ::GetWindowLong(hWnd, nStyleOffset);
109+ const DWORD dwNewStyle = (dwStyle & ~dwRemove) | dwAdd;
110+ if (dwStyle != dwNewStyle) {
111+ ::SetWindowLong(hWnd, nStyleOffset, dwNewStyle);
112+ }
113+ if (nFlags != 0)
114+ {
115+ ::SetWindowPos(hWnd, NULL, 0, 0, 0, 0,
116+ SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE | nFlags);
117+ }
118+}
119+
120+void TTCWnd::ModifyStyle(DWORD dwRemove, DWORD dwAdd, UINT nFlags)
121+{
122+ ModifyStyleCom(m_hWnd, GWL_STYLE, dwRemove, dwAdd, nFlags);
123+}
124+
125+void TTCWnd::ModifyStyleEx(DWORD dwRemove, DWORD dwAdd, UINT nFlags)
126+{
127+ ModifyStyleCom(m_hWnd, GWL_EXSTYLE, dwRemove, dwAdd, nFlags);
128+}
129+
130+int TTCWnd::MessageBox(LPCTSTR lpText, LPCTSTR lpCaption, UINT uType)
131+{
132+ return ::MessageBox(m_hWnd, lpText, lpCaption, uType);
133+}
134+
135+////////////////////////////////////////
136+
137+TTCDialog::TTCDialog()
138+{
139+}
140+
141+TTCDialog::~TTCDialog()
142+{
143+}
144+
145+void TTCDialog::OnInitDialog()
146+{
147+}
148+
149+BOOL TTCDialog::Create(HINSTANCE hInstance, HWND hParent, int idd)
150+{
151+#if 0
152+ HRSRC hResource = ::FindResource(hInstance, MAKEINTRESOURCE(idd), RT_DIALOG);
153+ HANDLE hDlgTemplate = ::LoadResource(hInstance, hResource);
154+ DLGTEMPLATE *lpTemplate = (DLGTEMPLATE *)::LockResource(hDlgTemplate);
155+#else
156+ DLGTEMPLATE *lpTemplate = TTGetDlgTemplate(hInstance, MAKEINTRESOURCE(idd));
157+#endif
158+ HWND hWnd = ::CreateDialogIndirectParam(
159+ hInstance, lpTemplate, hParent,
160+ (DLGPROC)OnDlgProc, (LPARAM)this);
161+ if (hWnd == NULL)
162+ {
163+ return FALSE;
164+ }
165+
166+ m_hWnd = hWnd;
167+// ::EnableWindow(hParent,FALSE);
168+ ::ShowWindow(hWnd, SW_SHOW);
169+// ::EnableWindow(m_hWnd,TRUE);
170+
171+ return TRUE;
172+}
173+
174+BOOL TTCDialog::OnCommand(WPARAM wp, LPARAM lp)
175+{
176+ return TRUE;
177+}
178+
179+void TTCDialog::OnOK()
180+{
181+ DestroyWindow();
182+}
183+
184+void TTCDialog::OnCancel()
185+{
186+ DestroyWindow();
187+}
188+
189+void TTCDialog::PostNcDestroy()
190+{
191+ delete this;
192+}
193+
194+void TTCDialog::DestroyWindow()
195+{
196+ ::EnableWindow(m_hParentWnd,TRUE);
197+ ::SetFocus(m_hParentWnd);
198+ ::DestroyWindow(m_hWnd);
199+}
200+
201+LRESULT CALLBACK TTCDialog::OnDlgProc(HWND hDlgWnd, UINT msg, WPARAM wp, LPARAM lp)
202+{
203+ TTCDialog *self = (TTCDialog *)GetWindowLongPtr(hDlgWnd, DWLP_USER);
204+
205+ switch (msg) {
206+ case WM_INITDIALOG:
207+ {
208+ self = (TTCDialog *)lp;
209+ SetWindowLongPtr(hDlgWnd, DWLP_USER, (LONG_PTR)self);
210+ self->OnInitDialog();
211+ return TRUE;
212+ }
213+
214+ case WM_COMMAND:
215+ {
216+ WORD wID = GET_WM_COMMAND_ID(wp, lp);
217+ const WORD wCMD = GET_WM_COMMAND_CMD(wp, lp);
218+ if (wID == IDOK) {
219+ self->OnOK();
220+ self->DestroyWindow();
221+ }
222+ if (wID == IDCANCEL) {
223+ self->OnCancel();
224+ }
225+ return FALSE;
226+ }
227+ case WM_NCDESTROY:
228+ self->PostNcDestroy();
229+ return TRUE;
230+
231+ default:
232+ return FALSE;
233+ }
234+ return TRUE;
235+}
236+
237+////////////////////////////////////////
238+
239+// quick hack :-(
240+static HINSTANCE ghInstance;
241+static class TTCPropertySheet *gTTCPS;
242+
243+TTCPropertyPage::TTCPropertyPage(HINSTANCE inst, int id, TTCPropertySheet *sheet)
244+{
245+ memset(&m_psp, 0, sizeof(m_psp));
246+ m_psp.dwSize = sizeof(m_psp);
247+ m_psp.dwFlags = PSP_DEFAULT;
248+ m_psp.hInstance = inst;
249+ m_psp.pszTemplate = MAKEINTRESOURCE(id);
250+#if 1
251+ m_psp.dwFlags |= PSP_DLGINDIRECT;
252+ m_psp.pResource = TTGetDlgTemplate(inst, m_psp.pszTemplate);
253+#endif
254+ m_psp.pfnDlgProc = (DLGPROC)Proc;
255+ m_psp.lParam = (LPARAM)this;
256+
257+ m_pSheet = sheet;
258+}
259+
260+TTCPropertyPage::~TTCPropertyPage()
261+{
262+ free((void *)m_psp.pResource);
263+}
264+
265+void TTCPropertyPage::OnInitDialog()
266+{
267+}
268+
269+void TTCPropertyPage::OnOK()
270+{
271+}
272+
273+BOOL TTCPropertyPage::OnCommand(WPARAM wp, LPARAM lp)
274+{
275+ return TRUE;
276+}
277+
278+HBRUSH TTCPropertyPage::OnCtlColor(HDC hDC, HWND hWnd)
279+{
280+ return (HBRUSH)::DefWindowProc(m_hWnd, WM_CTLCOLORSTATIC, (WPARAM)hDC, (LPARAM)hWnd);
281+}
282+
283+UINT CALLBACK TTCPropertyPage::PropSheetPageProc(HWND hwnd, UINT uMsg, LPPROPSHEETPAGE ppsp)
284+{
285+ return 0;
286+}
287+
288+BOOL CALLBACK TTCPropertyPage::Proc(HWND hDlgWnd, UINT msg, WPARAM wp, LPARAM lp)
289+{
290+ TTCPropertyPage *self = (TTCPropertyPage *)GetWindowLongPtr(hDlgWnd, DWLP_USER);
291+ switch (msg)
292+ {
293+ case WM_INITDIALOG:
294+ self = (TTCPropertyPage *)(((PROPSHEETPAGE *)lp)->lParam);
295+ SetWindowLongPtr(hDlgWnd, DWLP_USER, (LONG_PTR)self);
296+ self->m_hWnd = hDlgWnd;
297+ self->OnInitDialog();
298+ break;
299+ case WM_NOTIFY:
300+ {
301+ NMHDR * nmhdr = (NMHDR *)lp;
302+ switch (nmhdr->code)
303+ {
304+ case PSN_APPLY:
305+ self->OnOK();
306+ break;
307+ default:
308+ break;
309+ }
310+ break;
311+ }
312+ case WM_COMMAND:
313+ self->OnCommand(wp, lp);
314+ break;
315+ case WM_CTLCOLORSTATIC:
316+ return (BOOL)self->OnCtlColor((HDC)wp, (HWND)lp);
317+ }
318+ return FALSE;
319+}
320+
321+////////////////////////////////////////
322+
323+TTCPropertySheet::TTCPropertySheet(HINSTANCE hInstance, LPCTSTR pszCaption, HWND hParentWnd)
324+{
325+ m_hInst = hInstance;
326+ memset(&m_psh, 0, sizeof(m_psh));
327+ m_psh.dwSize = sizeof(m_psh);
328+ m_psh.dwFlags = PSH_DEFAULT | PSH_NOAPPLYNOW | PSH_USECALLBACK; // | PSH_MODELESS
329+ m_psh.hwndParent = hParentWnd;
330+ m_psh.pfnCallback = PropSheetProc;
331+}
332+
333+TTCPropertySheet::~TTCPropertySheet()
334+{
335+}
336+
337+int TTCPropertySheet::DoModal()
338+{
339+ ghInstance = m_hInst;
340+ gTTCPS = this;
341+ return PropertySheet(&m_psh);
342+
343+ // モーダレスにするとタブの動きがおかしい
344+#if 0
345+ // モードレスダイアログボックスの場合はウィンドウのハンドル
346+ m_hWnd = (HWND)::PropertySheet(&m_psh);
347+// ShowWindow(m_hWnd, SW_SHOW);
348+
349+// ::ModifyStyle(m_hWnd, TCS_MULTILINE, TCS_SINGLELINE, 0);
350+
351+ ModalResult = 0;
352+ HWND hDlgWnd = m_hWnd;
353+ for(;;) {
354+ if (ModalResult != 0) {
355+ break;
356+ }
357+ MSG Msg;
358+ BOOL quit = !::GetMessage(&Msg, NULL, NULL, NULL);
359+ if (quit) {
360+ // QM_QUIT
361+ PostQuitMessage(0);
362+ return IDCANCEL;
363+ }
364+ if ((hDlgWnd == Msg.hwnd) ||
365+ ::SendMessage(hDlgWnd, PSM_ISDIALOGMESSAGE, NULL, (LPARAM)&Msg))
366+ {
367+ // ダイアログ以外の処理
368+ ::TranslateMessage(&Msg);
369+ ::DispatchMessage(&Msg);
370+ }
371+ if (!SendMessage(hDlgWnd, PSM_GETCURRENTPAGEHWND, 0, 0)) {
372+ // プロパティーシート終了
373+ break;
374+ }
375+ }
376+ return ModalResult;
377+#endif
378+}
379+
380+int CALLBACK TTCPropertySheet::PropSheetProc(HWND hWnd, UINT msg, LPARAM lp)
381+{
382+ switch (msg) {
383+ case PSCB_PRECREATE:
384+ {
385+ // テンプレートの内容を書き換える 危険
386+ // http://home.att.ne.jp/banana/akatsuki/doc/atlwtl/atlwtl15-01/index.html
387+ size_t PrevTemplSize;
388+ size_t NewTemplSize;
389+ DLGTEMPLATE *NewTempl =
390+ TTGetNewDlgTemplate(ghInstance, (DLGTEMPLATE *)lp,
391+ &PrevTemplSize, &NewTemplSize);
392+ NewTempl->style &= ~DS_CONTEXTHELP; // check DLGTEMPLATEEX
393+ memcpy((void *)lp, NewTempl, NewTemplSize);
394+ free(NewTempl);
395+ break;
396+ }
397+ case PSCB_INITIALIZED:
398+ {
399+ //TTCPropertySheet *self = (TTCPropertySheet *)lp;
400+ TTCPropertySheet *self = gTTCPS;
401+ self->m_hWnd = hWnd;
402+ self->OnInitDialog();
403+ break;
404+ }
405+ }
406+ return 0;
407+}
408+
409+void TTCPropertySheet::OnInitDialog()
410+{
411+}
--- branches/cmake/teraterm/common/ttlib.c (revision 7175)
+++ branches/cmake/teraterm/common/ttlib.c (revision 7176)
@@ -970,7 +970,7 @@
970970 strncpy_s(buf, buflen, Temp, _TRUNCATE);
971971 }
972972
973-void get_lang_msg(PCHAR key, PCHAR buf, int buf_len, PCHAR def, const char *iniFile)
973+void get_lang_msg(const char *key, PCHAR buf, int buf_len, const char *def, const char *iniFile)
974974 {
975975 GetI18nStr("Tera Term", key, buf, buf_len, def, iniFile);
976976 }
--- branches/cmake/teraterm/common/ttlib.h (revision 7175)
+++ branches/cmake/teraterm/common/ttlib.h (revision 7176)
@@ -67,7 +67,7 @@
6767 void GetDefaultSetupFName(char *home, char *dest, int destlen);
6868 void GetUILanguageFile(char *buf, int buflen);
6969 void GetOnOffEntryInifile(char *entry, char *buf, int buflen);
70-void get_lang_msg(PCHAR key, PCHAR buf, int buf_len, PCHAR def, const char *iniFile);
70+void get_lang_msg(const char *key, PCHAR buf, int buf_len, const char *def, const char *iniFile);
7171 int get_lang_font(PCHAR key, HWND dlg, PLOGFONT logfont, HFONT *font, const char *iniFile);
7272 BOOL doSelectFolder(HWND hWnd, char *path, int pathlen, char *def, char *msg);
7373 void OutputDebugPrintf(char *fmt, ...);
--- branches/cmake/teraterm/common/compat_win.cpp (revision 0)
+++ branches/cmake/teraterm/common/compat_win.cpp (revision 7176)
@@ -0,0 +1,20 @@
1+
2+#include "compat_win.h"
3+
4+TSetThreadDpiAwarenessContext PSetThreadDpiAwarenessContext;
5+
6+void WinCompatInit()
7+{
8+ static bool done = false;
9+ if (done) return;
10+ done = true;
11+
12+ char user32_dll[MAX_PATH];
13+ GetSystemDirectory(user32_dll, sizeof(user32_dll));
14+ strncat_s(user32_dll, sizeof(user32_dll), "\\user32.dll", _TRUNCATE);
15+
16+ HMODULE dll_handle = LoadLibrary(user32_dll);
17+ PSetThreadDpiAwarenessContext =
18+ (TSetThreadDpiAwarenessContext)
19+ GetProcAddress(dll_handle, "SetThreadDpiAwarenessContext");
20+}
--- branches/cmake/teraterm/common/dlglib.h (revision 7175)
+++ branches/cmake/teraterm/common/dlglib.h (revision 7176)
@@ -1,4 +1,4 @@
1-/*
1+/*
22 * Copyright (C) 1994-1998 T. Teranishi
33 * (C) 2005-2018 TeraTerm Project
44 * All rights reserved.
@@ -27,7 +27,11 @@
2727 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2828 */
2929
30-/* Routines for dialog boxes */
30+#pragma once
31+
32+#include <windows.h>
33+
34+ /* Routines for dialog boxes */
3135 #ifdef __cplusplus
3236 extern "C" {
3337 #endif
@@ -52,6 +56,25 @@
5256 HFONT SetDlgFonts(HWND hDlg, const int nIDDlgItems[], int nIDDlgItemCount,
5357 const char *UILanguageFile, PCHAR key);
5458
59+////////////////////////////////////////
60+DLGTEMPLATE *TTGetDlgTemplate(HINSTANCE hInst, LPCSTR lpTemplateName);
61+DLGTEMPLATE *TTGetNewDlgTemplate(
62+ HINSTANCE hInst, const DLGTEMPLATE *src,
63+ size_t *PrevTemplSize, size_t *NewTemplSize);
64+BOOL TTEndDialog(HWND hDlgWnd, INT_PTR nResult);
65+HWND TTCreateDialogIndirectParam(
66+ HINSTANCE hInstance,
67+ LPCTSTR lpTemplateName,
68+ HWND hWndParent,
69+ DLGPROC lpDialogFunc,
70+ LPARAM lParamInit);
71+int TTDialogBoxParam(
72+ HINSTANCE hInstance,
73+ LPCTSTR lpTemplateName,
74+ HWND hWndParent,
75+ DLGPROC lpDialogFunc,
76+ LPARAM lParamInit);
77+
5578 #ifdef __cplusplus
5679 }
5780 #endif
--- branches/cmake/teraterm/common/tttypes.h (revision 7175)
+++ branches/cmake/teraterm/common/tttypes.h (revision 7176)
@@ -643,7 +643,8 @@
643643 WORD FontQuality;
644644 char ScpSendDir[MAXPATHLEN];
645645 char BGImageFilePath[MAX_PATH];
646- enum rotate_mode LogRotate;
646+// enum rotate_mode LogRotate;
647+ int LogRotate;
647648 DWORD LogRotateSize;
648649 WORD LogRotateSizeType;
649650 WORD LogRotateStep;
--- branches/cmake/teraterm/common/ttftypes.h (revision 7175)
+++ branches/cmake/teraterm/common/ttftypes.h (revision 7176)
@@ -133,7 +133,8 @@
133133 DWORD StartTime;
134134
135135 // log rotate
136- enum rotate_mode RotateMode;
136+// enum rotate_mode RotateMode;
137+ int RotateMode;
137138 LONG RotateSize;
138139 int RotateStep;
139140
--- branches/cmake/teraterm/common/dlglib_tmpl.cpp (revision 0)
+++ branches/cmake/teraterm/common/dlglib_tmpl.cpp (revision 7176)
@@ -0,0 +1,422 @@
1+
2+#include "dlglib.h"
3+
4+#include <wchar.h>
5+
6+//#define _countof(ary) (sizeof(ary)/sizeof(ary[0]))
7+
8+// https://docs.microsoft.com/ja-jp/windows/desktop/dlgbox/dlgtemplateex
9+// https://www.pg-fl.jp/program/tips/dlgmem.htm
10+#pragma pack(push, 1)
11+typedef struct
12+{
13+ WORD dlgVer;
14+ WORD signature;
15+ DWORD helpID;
16+ DWORD exStyle;
17+ DWORD style;
18+ WORD cDlgItems;
19+ short x;
20+ short y;
21+ short cx;
22+ short cy;
23+
24+ // sz_Or_Ord menu; // name or ordinal of a menu resource
25+ // sz_Or_Ord windowClass; // name or ordinal of a window class
26+ // WCHAR title[N];
27+ // WORD pointsize; // only if DS_SETFONT is set
28+ // WORD weight; // only if DS_SETFONT is set
29+ // BYTE italic; // only if DS_SETFONT is set
30+ // BYTE charset; // only if DS_SETFONT is set
31+ // WCHAR typeface[stringLen]; // only if DS_SETFONT is set
32+
33+ // PAD
34+
35+ // DLGITEMTEMPLATEEX controls[cDlgItems];
36+} DLGTEMPLATEEX;
37+
38+typedef struct
39+{
40+ DWORD helpID;
41+ DWORD exStyle;
42+ DWORD style;
43+ short x;
44+ short y;
45+ short cx;
46+ short cy;
47+ DWORD id;
48+
49+ // sz_Or_Ord windowClass; // name or ordinal of a window class
50+ // sz_Or_Ord title; // title string or ordinal of a resource
51+ // WORD extraCount; // bytes following creation data
52+} DLGITEMTEMPLATEEX;
53+#pragma pack(pop)
54+
55+#if 0 // !defined(_MSC_VER)
56+static inline errno_t wcscpy_s(
57+ wchar_t *dest,
58+ size_t dest_size,
59+ const wchar_t *src)
60+{
61+ wcscpy(dest, src);
62+ return 0;
63+}
64+#endif
65+
66+static size_t CopySz(const WORD *src, WORD *dest)
67+{
68+ size_t size = 0;
69+ do {
70+ if (dest != NULL) {
71+ *dest++ = *src;
72+ }
73+ size++;
74+ } while (*src++ != 0);
75+ return size;
76+}
77+
78+static size_t CopySzOrOrd(const WORD *src, WORD *dest)
79+{
80+ size_t size;
81+ if (*src == 0x0000) {
82+ if (dest != NULL) {
83+ *dest = *src;
84+ }
85+ size = 1;
86+ } else if (*src == 0xffff) {
87+ if (dest != NULL) {
88+ *dest++ = *src++;
89+ *dest++ = *src++;
90+ }
91+ size = 2;
92+ } else {
93+ return CopySz(src, dest);
94+ }
95+ return size;
96+}
97+
98+static size_t CopyDlgItem(const WORD *src, WORD *dest)
99+{
100+ size_t size = sizeof(DLGITEMTEMPLATE) / sizeof(WORD);
101+ if (dest != NULL) {
102+ *(DLGITEMTEMPLATE *)dest = *(DLGITEMTEMPLATE *)src;
103+ dest += size;
104+ }
105+ src += size;
106+
107+ size_t t;
108+ t = CopySzOrOrd(src, dest); // windowClass
109+ size += t;
110+ src += t; if (dest != NULL) dest += t;
111+ t = CopySzOrOrd(src, dest); // title
112+ size += t;
113+ src += t; if (dest != NULL) dest += t;
114+ const WORD extraCount = *src++;
115+ size++;
116+ if (dest != NULL) {
117+ *dest++ = extraCount;
118+ }
119+ if (extraCount != 0) {
120+ size += extraCount;
121+ if (dest != NULL) {
122+ memcpy(dest, src, extraCount * sizeof(WORD));
123+ dest += extraCount;
124+ }
125+ src += extraCount;
126+ }
127+
128+ size = (size + 1) & ~1;
129+ return size;
130+}
131+
132+/**
133+ * drc ダイアログリソースへのポインタ
134+ * dest コピー先(NULLのときコピーしない)
135+ * logfont 設定するフォント情報(ただし、dest_vがNULLの時は取得)
136+ * NULLのとき設定,取得しない
137+ */
138+static size_t CopyDlgTemplate(
139+ const WORD *src_v,
140+ WORD *dest_v,
141+ LOGFONTW *logfont)
142+{
143+ const WORD *src = (const WORD *)src_v;
144+ WORD *dest = (WORD *)dest_v;
145+ size_t size = sizeof(DLGTEMPLATE) / sizeof(WORD);
146+ const DLGTEMPLATE *dlg = (DLGTEMPLATE *)src;
147+ if (dest != NULL) {
148+ *(DLGTEMPLATE *)dest = *dlg;
149+ dest += size;
150+ }
151+ src += size;
152+
153+ size_t t;
154+ t = CopySzOrOrd(src, dest); // menu
155+ size += t;
156+ src += t; if (dest != NULL) dest += t;
157+ t = CopySzOrOrd(src, dest); // windowClass
158+ size += t;
159+ src += t; if (dest != NULL) dest += t;
160+ t = CopySz(src, dest); // title
161+ size += t;
162+ src += t; if (dest != NULL) dest += t;
163+ size_t dsize = 0;
164+ if (dlg->style & DS_SETFONT) {
165+ if (dest == NULL) {
166+ // 取得
167+ if (logfont != NULL) {
168+ memset(logfont, 0, sizeof(*logfont));
169+ logfont->lfHeight = -(*src++);
170+ t = CopySz(src, (WORD *)(&logfont->lfFaceName[0]));
171+ } else {
172+ src++;
173+ t = CopySz(src, NULL);
174+ }
175+ size += t + 1;
176+ } else {
177+ // セット
178+ if (logfont != NULL) {
179+ *dest++ = (WORD)(-logfont->lfHeight);
180+ src += 1;
181+ t = CopySz((WORD *)(&logfont->lfFaceName[0]), dest);
182+ dest += t;
183+ dsize = size + t + 1;
184+ t = CopySz(src, NULL);
185+ size += t + 1;
186+ } else {
187+ *dest++ = *src++;
188+ t = CopySz(src, dest);
189+ size += t + 1;
190+ dsize = size;
191+ }
192+ }
193+ }
194+
195+ size = (size + 1) & ~1;
196+ src = ((const WORD *)src_v) + size;
197+ if (dest != NULL) {
198+ dsize = (dsize + 1) & ~1;
199+ dest = ((WORD *)dest_v) + dsize;
200+ size = dsize;
201+ }
202+ for (int i = 0; i < dlg->cdit; i++) {
203+ t = CopyDlgItem(src, dest);
204+ src += t; if (dest != NULL) dest += t;
205+ size += t;
206+ }
207+
208+ return size * sizeof(WORD);
209+}
210+
211+static size_t CopyDlgItemEx(const WORD *src, WORD *dest)
212+{
213+ size_t size = sizeof(DLGITEMTEMPLATEEX) / sizeof(WORD);
214+ if (dest != NULL) {
215+ *(DLGITEMTEMPLATEEX *)dest = *(DLGITEMTEMPLATEEX *)src;
216+ dest += size;
217+ }
218+ src += size;
219+
220+ size_t t;
221+ t = CopySzOrOrd(src, dest); // windowClass
222+ size += t;
223+ src += t; if (dest != NULL) dest += t;
224+ t = CopySzOrOrd(src, dest); // title
225+ size += t;
226+ src += t; if (dest != NULL) dest += t;
227+ const WORD extraCount = *src++;
228+ size++;
229+ if (dest != NULL) {
230+ *dest++ = extraCount;
231+ }
232+ if (extraCount != 0) {
233+ size += extraCount;
234+ if (dest != NULL) {
235+ memcpy(dest, src, extraCount * sizeof(WORD));
236+ dest += extraCount;
237+ }
238+ src += extraCount;
239+ }
240+
241+ size = (size + 1) & ~1;
242+ return size;
243+}
244+
245+/**
246+ * drc_v ダイアログリソースへのポインタ
247+ * dest_v コピー先(NULLのときコピーしない)
248+ * logfont 設定するフォント情報(ただし、dest_vがNULLの時は取得)
249+ * NULLのとき設定,取得しない
250+ */
251+static size_t CopyDlgTemplateEx(
252+ const DLGTEMPLATE *src_v,
253+ DLGTEMPLATE *dest_v,
254+ LOGFONTW *logfont)
255+{
256+ const WORD *src = (const WORD *)src_v;
257+ WORD *dest = (WORD *)dest_v;
258+ if (*src != 1) {
259+ return CopyDlgTemplate(src, dest, logfont);
260+ }
261+ // version 1
262+ size_t size = sizeof(DLGTEMPLATEEX) / sizeof(WORD);
263+ const DLGTEMPLATEEX *dlg = (DLGTEMPLATEEX *)src;
264+ if (dest != NULL) {
265+ *(DLGTEMPLATEEX *)dest = *dlg;
266+ dest += size;
267+ }
268+ src += size;
269+
270+ size_t t;
271+ t = CopySzOrOrd(src, dest); // menu
272+ size += t;
273+ src += t; if (dest != NULL) dest += t;
274+ t = CopySzOrOrd(src, dest); // windowClass
275+ size += t;
276+ src += t; if (dest != NULL) dest += t;
277+ t = CopySz(src, dest); // title
278+ size += t;
279+ src += t; if (dest != NULL) dest += t;
280+ size_t dsize = 0;
281+ if (dlg->style & DS_SETFONT) {
282+ if (dest == NULL) {
283+ // 取得
284+ if (logfont != NULL) {
285+ memset(logfont, 0, sizeof(*logfont));
286+ logfont->lfHeight = -(*src++);
287+ logfont->lfWeight = *src++;
288+ logfont->lfItalic = *((BYTE *)src);
289+ logfont->lfCharSet = *(((BYTE *)src)+1);
290+ src++;
291+ t = CopySz(src, (WORD *)(&logfont->lfFaceName[0]));
292+ } else {
293+ src++;
294+ src++;
295+ src++;
296+ t = CopySz(src, NULL);
297+ }
298+ size += t + 3;
299+ } else {
300+ // セット
301+ if (logfont != NULL) {
302+ *dest++ = (WORD)(-logfont->lfHeight);
303+ *dest++ = (WORD)logfont->lfWeight;
304+ *((BYTE *)dest) = logfont->lfItalic;
305+ *(((BYTE *)dest)+1) = logfont->lfCharSet;
306+ dest++;
307+ src += 3;
308+ t = CopySz((WORD *)(&logfont->lfFaceName[0]), dest);
309+ dest += t;
310+ dsize = size + t + 3;
311+ t = CopySz(src, NULL);
312+ size += t + 3;
313+ } else {
314+ *dest++ = *src++;
315+ *dest++ = *src++;
316+ *dest++ = *src++;
317+ t = CopySz(src, dest);
318+ size += t + 3;
319+ dsize = size;
320+ }
321+ }
322+ }
323+
324+ size = (size + 1) & ~1;
325+ src = ((const WORD *)src_v) + size;
326+ if (dest != NULL) {
327+ dsize = (dsize + 1) & ~1;
328+ dest = ((WORD *)dest_v) + dsize;
329+ size = dsize;
330+ }
331+ for (int i = 0; i < dlg->cDlgItems; i++) {
332+ t = CopyDlgItemEx(src, dest);
333+ src += t; if (dest != NULL) dest += t;
334+ size += t;
335+ }
336+
337+ return size * sizeof(WORD);
338+}
339+
340+DLGTEMPLATE *GetNewDlgTemplate(
341+ HINSTANCE hInst, const DLGTEMPLATE *src,
342+ const WCHAR *FontFaceName, LONG FontHeight, BYTE FontCharSet,
343+ size_t *PrevTemplSize, size_t *NewTemplSize)
344+{
345+ LOGFONTW logfont;
346+ const size_t prev_size = CopyDlgTemplateEx(src, NULL, &logfont);
347+ DLGTEMPLATE *dest;
348+ size_t new_size = 0;
349+ if (FontFaceName == NULL) {
350+ // simple copy
351+ dest = (DLGTEMPLATE *)malloc(prev_size);
352+ CopyDlgTemplateEx(src, dest, NULL);
353+ new_size = prev_size;
354+ } else {
355+ // copy with replacing font
356+ const size_t new_size_forcast = prev_size +
357+ ((wcslen(FontFaceName) - wcslen(logfont.lfFaceName)) *
358+ sizeof(WCHAR)) + 4;
359+ dest = (DLGTEMPLATE *)malloc(new_size_forcast);
360+ logfont.lfCharSet = FontCharSet;
361+ logfont.lfHeight = FontHeight;
362+ wcscpy_s(logfont.lfFaceName, _countof(logfont.lfFaceName),
363+ FontFaceName);
364+ new_size = CopyDlgTemplateEx(src, dest, &logfont);
365+ }
366+
367+ if (PrevTemplSize != NULL) {
368+ *PrevTemplSize = prev_size;
369+ }
370+ if (NewTemplSize != NULL) {
371+ *NewTemplSize = new_size;
372+ }
373+ return dest;
374+}
375+
376+DLGTEMPLATE *GetDlgTemplate(
377+ HINSTANCE hInst, LPCSTR lpTemplateName,
378+ const WCHAR *FontFaceName, LONG FontHeight, BYTE FontCharSet)
379+{
380+ HRSRC hResource = ::FindResource(hInst, lpTemplateName, RT_DIALOG);
381+ HANDLE hDlgTemplate = ::LoadResource(hInst, hResource);
382+ const DLGTEMPLATE *src = (DLGTEMPLATE *)::LockResource(hDlgTemplate);
383+
384+ DLGTEMPLATE *dest = GetNewDlgTemplate(
385+ hInst, src,
386+ FontFaceName, FontHeight, FontCharSet,
387+ NULL, NULL);
388+
389+ ::FreeResource(hDlgTemplate);
390+
391+ return dest;
392+}
393+
394+DLGTEMPLATE *TTGetNewDlgTemplate(
395+ HINSTANCE hInst, const DLGTEMPLATE *src,
396+ size_t *PrevTemplSize, size_t *NewTemplSize)
397+{
398+ const WCHAR *FontFaceName = L"Meiryo UI";
399+// const WCHAR *FontFaceName = L"Tahoma";
400+ LONG FontHeight = 20;
401+ BYTE FontCharSet = 128;
402+
403+ DLGTEMPLATE *DlgTemplate =
404+ GetNewDlgTemplate(hInst, src,
405+ FontFaceName, FontHeight, FontCharSet,
406+ PrevTemplSize, NewTemplSize);
407+
408+ return DlgTemplate;
409+}
410+
411+DLGTEMPLATE *TTGetDlgTemplate(HINSTANCE hInst, LPCSTR lpTemplateName)
412+{
413+ const WCHAR *FontFaceName = L"Meiryo UI";
414+ LONG FontHeight = 20;
415+ BYTE FontCharSet = 128;
416+
417+ DLGTEMPLATE *DlgTemplate =
418+ GetDlgTemplate(hInst, lpTemplateName,
419+ FontFaceName, FontHeight, FontCharSet);
420+
421+ return DlgTemplate;
422+}
--- branches/cmake/teraterm/common/dlglib_cpp.cpp (revision 0)
+++ branches/cmake/teraterm/common/dlglib_cpp.cpp (revision 7176)
@@ -0,0 +1,177 @@
1+
2+#include <windows.h>
3+#include "dlglib.h"
4+
5+extern BOOL CallOnIdle(LONG lCount);
6+
7+typedef struct {
8+ DLGPROC OrigProc; // Dialog proc
9+ LONG_PTR OrigUser; // DWLP_USER
10+ LPARAM ParamInit;
11+ int DlgResult;
12+} TTDialogData;
13+
14+static TTDialogData *TTDialogTmpData;
15+
16+static int TTDoModal(HWND hDlgWnd)
17+{
18+ LONG lIdleCount = 0;
19+ MSG Msg;
20+ TTDialogData *data = (TTDialogData *)GetWindowLongPtr(hDlgWnd, DWLP_USER);
21+
22+ for (;;)
23+ {
24+ if (!IsWindow(hDlgWnd)) {
25+ // ウインドウが閉じられた
26+ return IDCANCEL;
27+ }
28+#if defined(_DEBUG)
29+ if (!IsWindowVisible(hDlgWnd)) {
30+ // 誤ってEndDialog()が使われた? -> TTEndDialog()を使うこと
31+ ::ShowWindow(hDlgWnd, SW_SHOWNORMAL);
32+ }
33+#endif
34+ int DlgRet = data->DlgResult;
35+ if (DlgRet != 0) {
36+ // TTEndDialog()が呼ばれた
37+ return DlgRet;
38+ }
39+
40+ if(!::PeekMessage(&Msg, NULL, NULL, NULL, PM_NOREMOVE))
41+ {
42+ // メッセージがない
43+ // OnIdel() を処理する
44+ if (!CallOnIdle(lIdleCount++)) {
45+ // Idle処理がなくなった
46+ lIdleCount = 0;
47+ Sleep(10);
48+ }
49+ continue;
50+ }
51+ else
52+ {
53+ // メッセージがある
54+
55+ // pump message
56+ BOOL quit = !::GetMessage(&Msg, NULL, NULL, NULL);
57+ if (quit) {
58+ // QM_QUIT
59+ PostQuitMessage(0);
60+ return IDCANCEL;
61+ }
62+
63+ if (!::IsDialogMessage(hDlgWnd, &Msg)) {
64+ // ダイアログ以外の処理
65+ ::TranslateMessage(&Msg);
66+ ::DispatchMessage(&Msg);
67+ }
68+ }
69+ }
70+
71+ // ここには来ない
72+ return IDOK;
73+}
74+
75+static INT_PTR CALLBACK TTDialogProc(
76+ HWND hDlgWnd, UINT msg,
77+ WPARAM wParam, LPARAM lParam)
78+{
79+ TTDialogData *data = (TTDialogData *)GetWindowLongPtr(hDlgWnd, DWLP_USER);
80+ if (msg == WM_INITDIALOG) {
81+ TTDialogData *data = (TTDialogData *)lParam;
82+ LONG_PTR r = SetWindowLongPtr(hDlgWnd, DWLP_USER, 0);
83+ DWORD d = GetLastError();
84+ SetWindowLongPtr(hDlgWnd, DWLP_USER, (LONG_PTR)lParam);
85+ SetWindowLongPtr(hDlgWnd, DWLP_USER, (LONG_PTR)lParam);
86+ lParam = data->ParamInit;
87+ }
88+
89+ if (data == NULL) {
90+ // WM_INITDIALOGよりも前は設定されていない
91+ data = TTDialogTmpData;
92+ } else {
93+ // TTEndDialog()が呼ばれたとき、DWLP_USER が参照できない
94+ TTDialogTmpData = data;
95+ }
96+
97+ SetWindowLongPtr(hDlgWnd, DWLP_DLGPROC, (LONG_PTR)data->OrigProc);
98+ SetWindowLongPtr(hDlgWnd, DWLP_USER, (LONG_PTR)data->OrigUser);
99+ LRESULT Result = data->OrigProc(hDlgWnd, msg, wParam, lParam);
100+ data->OrigProc = (DLGPROC)GetWindowLongPtr(hDlgWnd, DWLP_DLGPROC);
101+ data->OrigUser = GetWindowLongPtr(hDlgWnd, DWLP_USER);
102+ SetWindowLongPtr(hDlgWnd, DWLP_DLGPROC, (LONG_PTR)TTDialogProc);
103+ SetWindowLongPtr(hDlgWnd, DWLP_USER, (LONG_PTR)data);
104+
105+ if (msg == WM_NCDESTROY) {
106+ SetWindowLongPtr(hDlgWnd, DWLP_USER, 0);
107+ free(data);
108+ }
109+
110+ return Result;
111+}
112+
113+/**
114+ * EndDialog() 互換関数
115+ */
116+BOOL TTEndDialog(HWND hDlgWnd, INT_PTR nResult)
117+{
118+ TTDialogData *data = TTDialogTmpData;
119+ data->DlgResult = nResult;
120+ return TRUE;
121+}
122+
123+/**
124+ * CreateDialogIndirectParam() 互換関数
125+ */
126+HWND TTCreateDialogIndirectParam(
127+ HINSTANCE hInstance,
128+ LPCTSTR lpTemplateName,
129+ HWND hWndParent, // オーナーウィンドウのハンドル
130+ DLGPROC lpDialogFunc, // ダイアログボックスプロシージャへのポインタ
131+ LPARAM lParamInit) // 初期化値
132+{
133+ TTDialogData *data = (TTDialogData *)malloc(sizeof(TTDialogData));
134+ data->OrigProc = lpDialogFunc;
135+ data->OrigUser = 0;
136+ data->ParamInit = lParamInit;
137+ data->DlgResult = 0;
138+#if 0
139+ HRSRC hResource = ::FindResource(hInstance, lpTemplateName, RT_DIALOG);
140+ HANDLE hDlgTemplate = ::LoadResource(hInstance, hResource);
141+ DLGTEMPLATE *lpTemplate = (DLGTEMPLATE *)::LockResource(hDlgTemplate);
142+#else
143+ DLGTEMPLATE *lpTemplate = TTGetDlgTemplate(hInstance, lpTemplateName);
144+#endif
145+ TTDialogTmpData = data;
146+ HWND hDlgWnd = CreateDialogIndirectParam(
147+ hInstance, lpTemplate, hWndParent, TTDialogProc, (LPARAM)data);
148+ TTDialogTmpData = NULL;
149+ ShowWindow(hDlgWnd, SW_SHOW);
150+ UpdateWindow(hDlgWnd);
151+#if 1
152+ free(lpTemplate);
153+#endif
154+ return hDlgWnd;
155+}
156+
157+/**
158+ * DialogBoxParam() 互換関数
159+ * EndDialog()ではなく、TTEndDialog()を使用すること
160+ */
161+int TTDialogBoxParam(
162+ HINSTANCE hInstance,
163+ LPCTSTR lpTemplateName,
164+ HWND hWndParent, // オーナーウィンドウのハンドル
165+ DLGPROC lpDialogFunc, // ダイアログボックスプロシージャへのポインタ
166+ LPARAM lParamInit) // 初期化値
167+{
168+ HWND hDlgWnd = TTCreateDialogIndirectParam(
169+ hInstance, lpTemplateName,
170+ hWndParent, lpDialogFunc, lParamInit);
171+ EnableWindow(hWndParent, FALSE);
172+ int DlgResult = TTDoModal(hDlgWnd);
173+ ::DestroyWindow(hDlgWnd);
174+ EnableWindow(hWndParent, TRUE);
175+ return DlgResult;
176+}
177+
--- branches/cmake/teraterm/common/compat_win.h (revision 0)
+++ branches/cmake/teraterm/common/compat_win.h (revision 7176)
@@ -0,0 +1,24 @@
1+
2+#include <windows.h>
3+
4+extern "C" {
5+
6+#if !defined(DPI_AWARENESS_CONTEXT_SYSTEM_AWARE)
7+#define DPI_AWARENESS_CONTEXT_SYSTEM_AWARE ((DPI_AWARENESS_CONTEXT)-2)
8+#define DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE ((DPI_AWARENESS_CONTEXT)-3)
9+#define DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2 ((DPI_AWARENESS_CONTEXT)-4)
10+DECLARE_HANDLE(DPI_AWARENESS_CONTEXT);
11+#endif
12+
13+#if !defined(WM_DPICHANGED)
14+#define WM_DPICHANGED 0x02E0
15+#endif
16+
17+typedef DPI_AWARENESS_CONTEXT (WINAPI *TSetThreadDpiAwarenessContext)
18+ (DPI_AWARENESS_CONTEXT dpiContext);
19+extern TSetThreadDpiAwarenessContext PSetThreadDpiAwarenessContext;
20+
21+void WinCompatInit();
22+
23+
24+}
--- branches/cmake/teraterm/ttpmacro/CMakeLists.txt (revision 7175)
+++ branches/cmake/teraterm/ttpmacro/CMakeLists.txt (revision 7176)
@@ -77,7 +77,9 @@
7777
7878 set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /NODEFAULTLIB:nafxcw.lib /NODEFAULTLIB:LIBCMT.lib")
7979 set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /NODEFAULTLIB:nafxcwd.lib /NODEFAULTLIB:LIBCMTD.lib")
80-set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /DELAYLOAD:iphlpapi.dll /DELAYLOAD:user32.dll")
80+if (${MSVC})
81+ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /DELAYLOAD:iphlpapi.dll /DELAYLOAD:user32.dll")
82+endif()
8183
8284 add_executable(
8385 ttpmacro WIN32
--- branches/cmake/teraterm/ttpdlg/CMakeLists.txt (revision 7175)
+++ branches/cmake/teraterm/ttpdlg/CMakeLists.txt (revision 7176)
@@ -15,7 +15,11 @@
1515
1616 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/")
1717
18-set(CMAKE_RC_FLAGS "${CMAKE_RC_FLAGS} /i ${CMAKE_CURRENT_SOURCE_DIR}/../common")
18+if(${MINGW})
19+ set(CMAKE_RC_FLAGS "${CMAKE_RC_FLAGS} -I ${CMAKE_CURRENT_SOURCE_DIR}/../common")
20+else()
21+ set(CMAKE_RC_FLAGS "${CMAKE_RC_FLAGS} /i ${CMAKE_CURRENT_SOURCE_DIR}/../common")
22+endif()
1923
2024 set(SRC
2125 ../common/dlglib.c
@@ -38,9 +42,16 @@
3842 ${ONIGURUMA_INCLUDE_DIRS}
3943 )
4044
41-link_directories(
42- ${ONIGURUMA_LIBRARY_DIRS}
43- )
45+if(${MINGW})
46+ link_directories(
47+ ${CMAKE_CURRENT_SOURCE_DIR}/../htmlhelp
48+ ${ONIGURUMA_LIBRARY_DIRS}
49+ )
50+else()
51+ link_directories(
52+ ${ONIGURUMA_LIBRARY_DIRS}
53+ )
54+endif()
4455
4556 add_library(
4657 ttpdlg SHARED
Show on old repository browser