• R/O
  • SSH
  • HTTPS

ttssh2: Commit


Commit MetaInfo

Revision7238 (tree)
Time2018-09-13 23:47:43
Authorzmatsuo

Log Message

ログダイアログが表示できていなかったので対応

Change Summary

Incremental Difference

--- branches/cmake/teraterm/ttpfile/ttfile.c (revision 7237)
+++ branches/cmake/teraterm/ttpfile/ttfile.c (revision 7238)
@@ -46,6 +46,7 @@
4646 #include "quickvan.h"
4747 // resource IDs
4848 #include "file_res.h"
49+#include "dlglib.h"
4950
5051 #include <stdlib.h>
5152 #include <stdio.h>
@@ -53,6 +54,16 @@
5354
5455 #include "compat_w95.h"
5556
57+#undef DialogBoxParam
58+#define DialogBoxParam(p1,p2,p3,p4,p5) \
59+ TTDialogBoxParam(p1,p2,p3,p4,p5)
60+#undef DialogBox
61+#define DialogBox(p1,p2,p3,p4) \
62+ TTDialogBox(p1,p2,p3,p4)
63+#undef EndDialog
64+#define EndDialog(p1,p2) \
65+ TTEndDialog(p1, p2)
66+
5667 #undef DllExport
5768 #define DllExport __declspec(dllexport)
5869
@@ -170,13 +181,13 @@
170181 return Ok;
171182 }
172183
173-void SetLogFlags(HWND Dialog)
184+static void SetLogFlags(HWND Dialog)
174185 {
175186 LPLONG pl;
176187 WORD BinFlag, val;
177188 long opt = 0;
178189
179- pl = (LPLONG)GetWindowLong(Dialog, DWL_USER);
190+ pl = (LPLONG)GetWindowLongPtr(Dialog, DWLP_USER);
180191 if (pl) {
181192 GetRB(Dialog, &BinFlag, IDC_FOPTBIN, IDC_FOPTBIN);
182193 if (BinFlag) {
@@ -233,7 +244,7 @@
233244 }
234245
235246 /* Hook function for file name dialog box */
236-BOOL CALLBACK LogFnHook(HWND Dialog, UINT Message, WPARAM wParam, LPARAM lParam)
247+static BOOL CALLBACK LogFnHook(HWND Dialog, UINT Message, WPARAM wParam, LPARAM lParam)
237248 {
238249 LPOPENFILENAME ofn;
239250 WORD BinFlag, TsFlag;
@@ -250,7 +261,7 @@
250261 ofn = (LPOPENFILENAME)lParam;
251262 pl = (LPLONG)(ofn->lCustData);
252263 opt = *pl;
253- SetWindowLong(Dialog, DWL_USER, (LONG)pl);
264+ SetWindowLongPtr(Dialog, DWLP_USER, (LONG)pl);
254265
255266 font = (HFONT)SendMessage(Dialog, WM_GETFONT, 0, 0);
256267 GetObject(font, sizeof(LOGFONT), &logfont);
@@ -422,7 +433,7 @@
422433 return FALSE;
423434 }
424435
425-BOOL CALLBACK TransFnHook(HWND Dialog, UINT Message, WPARAM wParam, LPARAM lParam);
436+static BOOL CALLBACK TransFnHook(HWND Dialog, UINT Message, WPARAM wParam, LPARAM lParam);
426437
427438 DllExport BOOL WINAPI GetTransFname(PFileVar fv, PCHAR CurDir, WORD FuncId, LPLONG Option)
428439 {
@@ -569,7 +580,7 @@
569580 return Ok;
570581 }
571582
572-BOOL CALLBACK TransFnHook(HWND Dialog, UINT Message, WPARAM wParam, LPARAM lParam)
583+static BOOL CALLBACK TransFnHook(HWND Dialog, UINT Message, WPARAM wParam, LPARAM lParam)
573584 {
574585 LPOPENFILENAME ofn;
575586 LPWORD pw;
@@ -790,8 +801,7 @@
790801 return Ok;
791802 }
792803
793-BOOL CALLBACK GetFnDlg
794- (HWND Dialog, UINT Message, WPARAM wParam, LPARAM lParam)
804+static BOOL CALLBACK GetFnDlg(HWND Dialog, UINT Message, WPARAM wParam, LPARAM lParam)
795805 {
796806 PFileVar fv;
797807 char TempFull[MAX_PATH];
@@ -952,7 +962,7 @@
952962 }
953963
954964 /* Hook function for XMODEM file name dialog box */
955-BOOL CALLBACK XFnHook(HWND Dialog, UINT Message, WPARAM wParam, LPARAM lParam)
965+static BOOL CALLBACK XFnHook(HWND Dialog, UINT Message, WPARAM wParam, LPARAM lParam)
956966 {
957967 LPOPENFILENAME ofn;
958968 WORD Hi, Lo;
--- branches/cmake/teraterm/ttpfile/CMakeLists.txt (revision 7237)
+++ branches/cmake/teraterm/ttpfile/CMakeLists.txt (revision 7238)
@@ -16,6 +16,8 @@
1616 set(COMMON_SRC
1717 ../common/dlglib.c
1818 ../common/dlglib.h
19+ ../common/dlglib_cpp.cpp
20+ ../common/dlglib_tmpl.cpp
1921 ../common/ttlib.c
2022 ../common/ttlib.h
2123 )
--- branches/cmake/teraterm/teraterm/ftdlg.cpp (revision 7237)
+++ branches/cmake/teraterm/teraterm/ftdlg.cpp (revision 7238)
@@ -45,6 +45,7 @@
4545 BOOL CFileTransDlg::Create(HINSTANCE hInstance, HWND hParent, PFileVar pfv, PComVar pcv, PTTSet pts)
4646 {
4747 BOOL Ok;
48+ WNDCLASS wc;
4849 int fuLoad = LR_DEFAULTCOLOR;
4950 HWND hwnd;
5051
@@ -52,6 +53,19 @@
5253 cv = pcv;
5354 cv->FilePause &= ~fv->OpId;
5455 ts = pts;
56+
57+ wc.style = CS_PARENTDC;
58+ wc.lpfnWndProc = TTCDialog::ProcStub;
59+ wc.cbClsExtra = 0;
60+ wc.cbWndExtra = DLGWINDOWEXTRA;
61+ wc.hInstance = hInstance;
62+ wc.hIcon = NULL;
63+ wc.hCursor = LoadCursor(NULL,IDC_ARROW);
64+ wc.hbrBackground = (HBRUSH)(COLOR_BTNFACE+1);
65+ wc.lpszMenuName = NULL;
66+ wc.lpszClassName = "FTDlg32";
67+ RegisterClass(&wc);
68+
5569 Pause = FALSE;
5670
5771 hwnd = GetForegroundWindow();
@@ -146,6 +160,16 @@
146160
147161 void CFileTransDlg::OnInitDialog()
148162 {
163+ static const DlgTextInfo TextInfos[] = {
164+ { IDC_TRANS_FILENAME, "DLG_FILETRANS_FILENAME" },
165+ { IDC_FULLPATH_LABEL, "DLG_FILETRANS_FULLPATH" },
166+ { IDC_TRANS_TRANS, "DLG_FILETRANS_TRNAS" },
167+ { IDC_TRANS_ELAPSED, "DLG_FILETRANS_ELAPSED" },
168+ { IDCANCEL, "DLG_FILETRANS_CLOSE" },
169+ { IDC_TRANSPAUSESTART, "DLG_FILETRANS_PAUSE" },
170+ { IDC_TRANSHELP, "BTN_HELP" },
171+ };
172+
149173 int fuLoad = LR_DEFAULTCOLOR;
150174
151175 if (fv->HideDialog) {
@@ -163,20 +187,22 @@
163187 // ログファイルはフルパス表示にする(2004.8.6 yutaka)
164188 SetDlgItemText(IDC_EDIT_FULLPATH, &(fv->FullName[0]));
165189
190+ SetDlgTexts(m_hWnd, TextInfos, _countof(TextInfos), ts->UILanguageFile);
191+
166192 if (IsWindowsNT4()) {
167193 fuLoad = LR_VGACOLOR;
168194 }
169195 SmallIcon = LoadImage(m_hInst,
170- MAKEINTRESOURCE(IDI_TTERM),
171- IMAGE_ICON, 16, 16, fuLoad);
196+ MAKEINTRESOURCE(IDI_TTERM),
197+ IMAGE_ICON, 16, 16, fuLoad);
172198 ::PostMessage(GetSafeHwnd(), WM_SETICON, ICON_SMALL,
173- (LPARAM)SmallIcon);
199+ (LPARAM)SmallIcon);
174200
175201 BigIcon = LoadImage(m_hInst,
176- MAKEINTRESOURCE(IDI_TTERM),
177- IMAGE_ICON, 0, 0, fuLoad);
202+ MAKEINTRESOURCE(IDI_TTERM),
203+ IMAGE_ICON, 0, 0, fuLoad);
178204 ::PostMessage(GetSafeHwnd(), WM_SETICON, ICON_BIG,
179- (LPARAM)BigIcon);
205+ (LPARAM)BigIcon);
180206 }
181207
182208 void CFileTransDlg::OnCancel( )
--- branches/cmake/teraterm/teraterm/ttdialog.c (revision 7237)
+++ branches/cmake/teraterm/teraterm/ttdialog.c (revision 7238)
@@ -50,7 +50,11 @@
5050
5151 BOOL LoadTTDLG()
5252 {
53- TTXGetUIHooks(); /* TTPLUG */
53+ static BOOL initialized;
54+ if (!initialized) {
55+ TTXGetUIHooks(); /* TTPLUG */
56+ initialized = TRUE;
57+ }
5458 return TRUE;
5559 }
5660
--- branches/cmake/teraterm/teraterm/tmfc.h (revision 7237)
+++ branches/cmake/teraterm/teraterm/tmfc.h (revision 7238)
@@ -32,18 +32,6 @@
3232 #pragma once
3333 #include <windows.h>
3434
35-class TTCMenu
36-{
37-public:
38- HMENU m_hMenu;
39-};
40-
41-class TTCPoint {
42-public:
43- int x;
44- int y;
45-};
46-
4735 class TTCWnd
4836 {
4937 public:
@@ -70,7 +58,7 @@
7058 void SetDlgItemInt(int id, UINT val, BOOL bSigned = TRUE);
7159 UINT GetDlgItemInt(int id, BOOL* lpTrans = NULL, BOOL bSigned = TRUE) const;
7260 void ShowWindow(int nCmdShow);
73- void SetWindowText(TCHAR *str);
61+ void SetWindowText(const TCHAR *str);
7462 void ModifyStyle(DWORD dwRemove, DWORD dwAdd, UINT nFlags = 0);
7563 void ModifyStyleEx(DWORD dwRemove, DWORD dwAdd, UINT nFlags = 0);
7664 int MessageBox(LPCTSTR lpText, LPCTSTR lpCaption, UINT uType);
@@ -82,7 +70,7 @@
8270 TTCFrameWnd();
8371 virtual ~TTCFrameWnd();
8472 static TTCFrameWnd *pseudoPtr;
85- static LRESULT ProcStub(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp);
73+ static LRESULT CALLBACK ProcStub(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp);
8674 virtual BOOL Create(HINSTANCE hInstance,
8775 LPCTSTR lpszClassName,
8876 LPCTSTR lpszWindowName,
@@ -98,7 +86,6 @@
9886 virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam);
9987 ///
10088 #if 1
101- void OnInitMenuPopup(TTCMenu* pPopupMenu, UINT nIndex, BOOL bSysMenu);
10289 void OnKillFocus(HWND hNewWnd);
10390 void OnDestroy();
10491 void OnSetFocus(HWND hOldWnd);
@@ -114,6 +101,8 @@
114101 public:
115102 TTCDialog();
116103 virtual ~TTCDialog();
104+ static TTCDialog *pseudoPtr;
105+ static LRESULT CALLBACK ProcStub(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp);
117106 BOOL Create(HINSTANCE hInstance, HWND hParent, int idd);
118107 void DestroyWindow();
119108 virtual void OnInitDialog();
--- branches/cmake/teraterm/teraterm/tmfc_frame.cpp (revision 7237)
+++ branches/cmake/teraterm/teraterm/tmfc_frame.cpp (revision 7238)
@@ -74,9 +74,6 @@
7474 return FALSE;
7575 }
7676
77-void TTCFrameWnd::OnInitMenuPopup(TTCMenu* pPopupMenu, UINT nIndex, BOOL bSysMenu)
78-{}
79-
8077 void TTCFrameWnd::OnKillFocus(HWND hNewWnd)
8178 {}
8279
--- branches/cmake/teraterm/teraterm/filesys.cpp (revision 7237)
+++ branches/cmake/teraterm/teraterm/filesys.cpp (revision 7238)
@@ -188,11 +188,9 @@
188188 static PFileTransDlg SendDlg = NULL;
189189 static PProtoDlg PtDlg = NULL;
190190
191-BOOL OpenFTDlg(PFileVar fv)
191+static BOOL OpenFTDlg(PFileVar fv)
192192 {
193193 PFileTransDlg FTDlg;
194- HWND HFTDlg;
195- char uimsg[MAX_UIMSG];
196194
197195 FTDlg = new CFileTransDlg();
198196
@@ -217,32 +215,9 @@
217215 else
218216 SendDlg = FTDlg; /* File send */
219217
220- HFTDlg=FTDlg->GetSafeHwnd();
221-
222- GetDlgItemText(HFTDlg, IDC_TRANS_FILENAME, uimsg, sizeof(uimsg));
223- get_lang_msg("DLG_FILETRANS_FILENAME", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
224- SetDlgItemText(HFTDlg, IDC_TRANS_FILENAME, ts.UIMsg);
225- GetDlgItemText(HFTDlg, IDC_FULLPATH_LABEL, uimsg, sizeof(uimsg));
226- get_lang_msg("DLG_FILETRANS_FULLPATH", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
227- SetDlgItemText(HFTDlg, IDC_FULLPATH_LABEL, ts.UIMsg);
228- GetDlgItemText(HFTDlg, IDC_TRANS_TRANS, uimsg, sizeof(uimsg));
229- get_lang_msg("DLG_FILETRANS_TRNAS", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
230- SetDlgItemText(HFTDlg, IDC_TRANS_TRANS, ts.UIMsg);
231- GetDlgItemText(HFTDlg, IDC_TRANS_ELAPSED, uimsg, sizeof(uimsg));
232- get_lang_msg("DLG_FILETRANS_ELAPSED", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
233- SetDlgItemText(HFTDlg, IDC_TRANS_ELAPSED, ts.UIMsg);
234- GetDlgItemText(HFTDlg, IDCANCEL, uimsg, sizeof(uimsg));
235- get_lang_msg("DLG_FILETRANS_CLOSE", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
236- SetDlgItemText(HFTDlg, IDCANCEL, ts.UIMsg);
237- GetDlgItemText(HFTDlg, IDC_TRANSPAUSESTART, uimsg, sizeof(uimsg));
238- get_lang_msg("DLG_FILETRANS_PAUSE", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
239- SetDlgItemText(HFTDlg, IDC_TRANSPAUSESTART, ts.UIMsg);
240- GetDlgItemText(HFTDlg, IDC_TRANSHELP, uimsg, sizeof(uimsg));
241- get_lang_msg("BTN_HELP", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
242- SetDlgItemText(HFTDlg, IDC_TRANSHELP, ts.UIMsg);
243-
244218 fv->StartTime = GetTickCount();
245219 if (fv->OpId == OpSendFile) {
220+ HWND HFTDlg = FTDlg->GetSafeHwnd();
246221 InitDlgProgress(HFTDlg, IDC_TRANSPROGRESS, &fv->ProgStat);
247222 ShowWindow(GetDlgItem(HFTDlg, IDC_TRANS_ELAPSED), SW_SHOW);
248223 }
--- branches/cmake/teraterm/teraterm/tmfc.cpp (revision 7237)
+++ branches/cmake/teraterm/teraterm/tmfc.cpp (revision 7238)
@@ -32,6 +32,7 @@
3232 #include "tmfc.h"
3333
3434 #include <windowsx.h>
35+#include <assert.h>
3536 #include "dlglib.h"
3637
3738 TTCWnd::TTCWnd()
@@ -103,7 +104,7 @@
103104 ::ShowWindow(m_hWnd, nCmdShow);
104105 }
105106
106-void TTCWnd::SetWindowText(TCHAR *str)
107+void TTCWnd::SetWindowText(const TCHAR *str)
107108 {
108109 ::SetWindowText(m_hWnd, str);
109110 }
@@ -162,11 +163,17 @@
162163 #else
163164 DLGTEMPLATE *lpTemplate = TTGetDlgTemplate(hInstance, MAKEINTRESOURCE(idd));
164165 #endif
166+ pseudoPtr = this;
165167 HWND hWnd = ::CreateDialogIndirectParam(
166168 hInstance, lpTemplate, hParent,
167169 (DLGPROC)OnDlgProc, (LPARAM)this);
170+ pseudoPtr = NULL;
168171 if (hWnd == NULL)
169172 {
173+#if defined(_DEBUG)
174+ DWORD e = GetLastError();
175+#endif
176+ assert(false);
170177 return FALSE;
171178 }
172179
@@ -241,6 +248,25 @@
241248 return TRUE;
242249 }
243250
251+TTCDialog *TTCDialog::pseudoPtr;
252+
253+LRESULT CALLBACK TTCDialog::ProcStub(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp)
254+{
255+ TTCDialog *self;
256+ if (pseudoPtr != NULL) {
257+ self = pseudoPtr;
258+ self->m_hWnd = hWnd;
259+ } else {
260+ self = (TTCDialog *)GetWindowLongPtr(hWnd, DWLP_USER);
261+ }
262+
263+ LRESULT result = self->OnDlgProc(hWnd, msg, wp, lp);
264+ if (result == FALSE) {
265+ result = ::DefWindowProc(hWnd, msg, wp, lp);
266+ }
267+ return result;
268+}
269+
244270 ////////////////////////////////////////
245271
246272 // quick hack :-(
--- branches/cmake/.gitignore (revision 7237)
+++ branches/cmake/.gitignore (revision 7238)
@@ -10,6 +10,7 @@
1010 *.exp
1111 *.log
1212 *.tlog
13+*.aps
1314 .vs/
1415 **/Debug/*
1516 **/Release/*
Show on old repository browser