Revision: 7301 http://sourceforge.jp/projects/ttssh2/scm/svn/commits/7301 Author: zmatsuo Date: 2018-12-01 01:51:06 +0900 (Sat, 01 Dec 2018) Log Message: ----------- ・ログダイアログでファイル名/パスが表示されない ・モーダレスダイアログのメッセージハンドリングを正しくした ・ログダイアログでウィンドウアイコンが表示されるようにした ・ログダイアログのウィンドウクラスを使用しなくした Modified Paths: -------------- branches/cmake/teraterm/common/tmfc.cpp branches/cmake/teraterm/common/tmfc.h branches/cmake/teraterm/common/tmfc_frame.cpp branches/cmake/teraterm/teraterm/ftdlg.cpp branches/cmake/teraterm/teraterm/teraterm.cpp branches/cmake/teraterm/teraterm/ttermpro.rc Added Paths: ----------- branches/cmake/teraterm/teraterm/teraterml.h -------------- next part -------------- Modified: branches/cmake/teraterm/common/tmfc.cpp =================================================================== --- branches/cmake/teraterm/common/tmfc.cpp 2018-11-30 16:50:55 UTC (rev 7300) +++ branches/cmake/teraterm/common/tmfc.cpp 2018-11-30 16:51:06 UTC (rev 7301) @@ -50,6 +50,7 @@ m_hWnd = nullptr; m_hInst = nullptr; m_hAccel = nullptr; + m_hParentWnd = nullptr; } LRESULT TTCWnd::SendMessage(UINT msg, WPARAM wp, LPARAM lp) @@ -112,7 +113,7 @@ SetDlgNum(m_hWnd, id, Num); } -// nCheck BST_UNCHECKED / BST_CHECKED / BST_INDETERMINATE +// nCheck BST_UNCHECKED / BST_CHECKED / BST_INDETERMINATE void TTCWnd::SetCheck(int id, int nCheck) { ::SendMessage(GetDlgItem(id), BM_SETCHECK, nCheck, 0); @@ -130,7 +131,7 @@ TCHAR ClassName[32]; int r = GetClassName(hWnd, ClassName, _countof(ClassName)); assert(r != 0); (void)r; - UINT msg = + UINT msg = (_tcscmp(ClassName, _T("ListBox")) == 0) ? LB_SETCURSEL : (_tcscmp(ClassName, _T("ComboBox")) == 0) ? CB_SETCURSEL : 0; assert(msg != 0); @@ -144,7 +145,7 @@ TCHAR ClassName[32]; int r = GetClassName(hWnd, ClassName, _countof(ClassName)); assert(r != 0); (void)r; - UINT msg = + UINT msg = (_tcscmp(ClassName, _T("ListBox")) == 0) ? LB_GETCURSEL : (_tcscmp(ClassName, _T("ComboBox")) == 0) ? CB_GETCURSEL : 0; assert(msg != 0); @@ -489,18 +490,18 @@ { pseudoPtr = this; #if defined(REWRITE_TEMPLATE) - INT_PTR result = + INT_PTR result = TTDialogBoxParam(hInstance, MAKEINTRESOURCE(idd), hParent, (DLGPROC)&DlgProcStub, (LPARAM)this); #else - INT_PTR result = + INT_PTR result = DialogBoxParam(hInstance, MAKEINTRESOURCE(idd), hParent, (DLGPROC)&DlgProcStub, (LPARAM)this); -#endif +#endif pseudoPtr = nullptr; return result; } @@ -510,6 +511,8 @@ */ BOOL TTCDialog::Create(HINSTANCE hInstance, HWND hParent, int idd) { + m_hInst = hInstance; + m_hParentWnd = hParent; #if defined(REWRITE_TEMPLATE) DLGTEMPLATE *lpTemplate = TTGetDlgTemplate(hInstance, MAKEINTRESOURCE(idd)); #else @@ -700,7 +703,7 @@ m_psh.hwndParent = hParentWnd; m_psh.pfnCallback = PropSheetProc; } - + TTCPropertySheet::~TTCPropertySheet() { } @@ -716,7 +719,7 @@ // モードレスダイアログボックスの場合はウィンドウのハンドル m_hWnd = (HWND)::PropertySheet(&m_psh); // ShowWindow(m_hWnd, SW_SHOW); - + // ::ModifyStyle(m_hWnd, TCS_MULTILINE, TCS_SINGLELINE, 0); ModalResult = 0; Modified: branches/cmake/teraterm/common/tmfc.h =================================================================== --- branches/cmake/teraterm/common/tmfc.h 2018-11-30 16:50:55 UTC (rev 7300) +++ branches/cmake/teraterm/common/tmfc.h 2018-11-30 16:51:06 UTC (rev 7301) @@ -38,6 +38,7 @@ HWND m_hWnd; HINSTANCE m_hInst; HACCEL m_hAccel; + HWND m_hParentWnd; TTCWnd(); void DestroyWindow(); @@ -132,7 +133,6 @@ virtual BOOL OnClose(); virtual BOOL PostNcDestroy(); virtual LRESULT DlgProc(UINT msg, WPARAM wp, LPARAM lp); - HWND m_hParentWnd; static LRESULT CALLBACK DlgProcStub(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp); static LRESULT CALLBACK WndProcStub(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp); Modified: branches/cmake/teraterm/common/tmfc_frame.cpp =================================================================== --- branches/cmake/teraterm/common/tmfc_frame.cpp 2018-11-30 16:50:55 UTC (rev 7300) +++ branches/cmake/teraterm/common/tmfc_frame.cpp 2018-11-30 16:51:06 UTC (rev 7301) @@ -62,6 +62,8 @@ LPCTSTR lpszMenuName, DWORD dwExStyle) { + m_hInst = hInstance; + m_hParentWnd = hParentWnd; pseudoPtr = this; HWND hWnd = ::CreateWindowEx( 0, Modified: branches/cmake/teraterm/teraterm/ftdlg.cpp =================================================================== --- branches/cmake/teraterm/teraterm/ftdlg.cpp 2018-11-30 16:50:55 UTC (rev 7300) +++ branches/cmake/teraterm/teraterm/ftdlg.cpp 2018-11-30 16:51:06 UTC (rev 7301) @@ -39,6 +39,7 @@ #include "dlglib.h" #include "tt_res.h" #include "ftdlg.h" +#include "teraterml.h" #undef SetDlgItemText #define SetDlgItemText SetDlgItemTextA @@ -51,7 +52,6 @@ BOOL CFileTransDlg::Create(HINSTANCE hInstance, HWND hParent, PFileVar pfv, PComVar pcv, PTTSet pts) { BOOL Ok; - WNDCLASS wc; int fuLoad = LR_DEFAULTCOLOR; HWND hwnd; @@ -60,6 +60,8 @@ cv->FilePause &= ~fv->OpId; ts = pts; +#if 0 + WNDCLASS wc; wc.style = CS_PARENTDC; wc.lpfnWndProc = TTCDialog::WndProcStub; wc.cbClsExtra = 0; @@ -71,6 +73,7 @@ wc.lpszMenuName = NULL; wc.lpszClassName = _T("FTDlg32"); RegisterClass(&wc); +#endif Pause = FALSE; @@ -209,6 +212,9 @@ IMAGE_ICON, 0, 0, fuLoad); ::PostMessage(GetSafeHwnd(), WM_SETICON, ICON_BIG, (LPARAM)BigIcon); + + AddModalHandle(m_hWnd); + return TRUE; } @@ -250,6 +256,8 @@ BigIcon = NULL; } + RemoveModalHandle(m_hWnd); + delete this; return TRUE; } Modified: branches/cmake/teraterm/teraterm/teraterm.cpp =================================================================== --- branches/cmake/teraterm/teraterm/teraterm.cpp 2018-11-30 16:50:55 UTC (rev 7300) +++ branches/cmake/teraterm/teraterm/teraterm.cpp 2018-11-30 16:51:06 UTC (rev 7301) @@ -48,6 +48,7 @@ #include "compat_win.h" #include "compat_w95.h" #include "dlglib.h" +#include "teraterml.h" static void init() { @@ -264,6 +265,18 @@ } } +static HWND hModalWnd; + +void AddModalHandle(HWND hWnd) +{ + hModalWnd = hWnd; +} + +void RemoveModalHandle(HWND hWnd) +{ + hModalWnd = 0; +} + int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPreInst, LPSTR lpszCmdLine, int nCmdShow) { @@ -283,6 +296,12 @@ MSG msg; while (GetMessage(&msg, NULL, 0, 0)) { + if (hModalWnd != 0) { + if (IsDialogMessage(hModalWnd, &msg)) { + continue; + } + } + bool message_processed = false; if (m_pMainWnd->m_hAccel != NULL) { Added: branches/cmake/teraterm/teraterm/teraterml.h =================================================================== --- branches/cmake/teraterm/teraterm/teraterml.h (rev 0) +++ branches/cmake/teraterm/teraterm/teraterml.h 2018-11-30 16:51:06 UTC (rev 7301) @@ -0,0 +1,33 @@ +/* + * (C) 2018 TeraTerm Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* teraterm local header */ +/* teraterm/ folder only */ + +void AddModalHandle(HWND hWnd); +void RemoveModalHandle(HWND hWnd); Modified: branches/cmake/teraterm/teraterm/ttermpro.rc =================================================================== --- branches/cmake/teraterm/teraterm/ttermpro.rc 2018-11-30 16:50:55 UTC (rev 7300) +++ branches/cmake/teraterm/teraterm/ttermpro.rc 2018-11-30 16:51:06 UTC (rev 7301) @@ -271,7 +271,6 @@ IDD_FILETRANSDLG DIALOGEX 20, 20, 176, 96 STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU -CLASS "FTDlg32" FONT 14, "System", 0, 0, 0x0 BEGIN CONTROL "Filename:",IDC_TRANS_FILENAME,"Static",SS_LEFTNOWORDWRAP | WS_GROUP,15,12,38,10