Revision: 8250 https://osdn.net/projects/ttssh2/scm/svn/commits/8250 Author: zmatsuo Date: 2019-10-03 00:07:55 +0900 (Thu, 03 Oct 2019) Log Message: ----------- _CreatePropertySheetPageW(), _PropertySheetW()を追加 - CreatePropertySheetPageW(), PropertySheetW() の layer for uncode版 - Additional settings ダイアログをUniocde版APIを使用するようにした - 多言語化対応した Modified Paths: -------------- branches/unicode_buf/teraterm/common/compat_win.cpp branches/unicode_buf/teraterm/common/compat_win.h branches/unicode_buf/teraterm/common/layer_for_unicode.cpp branches/unicode_buf/teraterm/common/layer_for_unicode.h branches/unicode_buf/teraterm/common/tmfc.cpp branches/unicode_buf/teraterm/common/tmfc.h branches/unicode_buf/teraterm/teraterm/addsetting.cpp branches/unicode_buf/teraterm/teraterm/addsetting.h branches/unicode_buf/teraterm/teraterm/vtwin.cpp -------------- next part -------------- Modified: branches/unicode_buf/teraterm/common/compat_win.cpp =================================================================== --- branches/unicode_buf/teraterm/common/compat_win.cpp 2019-10-02 15:07:44 UTC (rev 8249) +++ branches/unicode_buf/teraterm/common/compat_win.cpp 2019-10-02 15:07:55 UTC (rev 8250) @@ -35,6 +35,8 @@ #include "dllutil.h" #include "ttlib.h" +HPROPSHEETPAGE (WINAPI * pCreatePropertySheetPageW)(LPCPROPSHEETPAGEW constPropSheetPagePointer); +INT_PTR (WINAPI *pPropertySheetW)(LPCPROPSHEETHEADERW constPropSheetHeaderPointer); LRESULT (WINAPI *pSendDlgItemMessageW)(HWND hDlg, int nIDDlgItem, UINT Msg, WPARAM wParam, LPARAM lParam); BOOL (WINAPI *pModifyMenuW)(HMENU hMnu, UINT uPosition, UINT uFlags, UINT_PTR uIDNewItem, LPCWSTR lpNewItem); BOOL (WINAPI *pSetWindowTextW)(HWND hWnd, LPCWSTR lpString); @@ -99,6 +101,12 @@ { NULL, NULL }, }; +static const APIInfo Lists_comctl32[] = { + { "CreatePropertySheetPageW", (void **)&pCreatePropertySheetPageW }, + { "PropertySheetW", (void **)&pPropertySheetW }, + { NULL, NULL }, +}; + static const DllInfo DllInfos[] = { { _T("user32.dll"), DLL_LOAD_LIBRARY_SYSTEM, DLL_ACCEPT_NOT_EXIST, Lists_user32 }, { _T("msimg32.dll"), DLL_LOAD_LIBRARY_SYSTEM, DLL_ACCEPT_NOT_EXIST, Lists_msimg32 }, @@ -106,6 +114,7 @@ { _T("Shcore.dll"), DLL_LOAD_LIBRARY_SYSTEM, DLL_ACCEPT_NOT_EXIST, Lists_Shcore }, { _T("kernel32.dll"), DLL_LOAD_LIBRARY_SYSTEM, DLL_ACCEPT_NOT_EXIST, Lists_kernel32 }, { _T("shell32.dll"), DLL_LOAD_LIBRARY_SYSTEM, DLL_ACCEPT_NOT_EXIST, Lists_shell32 }, + { _T("Comctl32.dll"), DLL_LOAD_LIBRARY_SYSTEM, DLL_ACCEPT_NOT_EXIST, Lists_comctl32 }, { NULL, DLL_GET_MODULE_HANDLE, DLL_ACCEPT_NOT_EXIST, NULL }, }; Modified: branches/unicode_buf/teraterm/common/compat_win.h =================================================================== --- branches/unicode_buf/teraterm/common/compat_win.h 2019-10-02 15:07:44 UTC (rev 8249) +++ branches/unicode_buf/teraterm/common/compat_win.h 2019-10-02 15:07:55 UTC (rev 8250) @@ -67,6 +67,8 @@ #define OPENFILENAME_SIZE_VERSION_400A 76 #endif +extern HPROPSHEETPAGE (WINAPI * pCreatePropertySheetPageW)(LPCPROPSHEETPAGEW constPropSheetPagePointer); +extern INT_PTR (WINAPI *pPropertySheetW)(LPCPROPSHEETHEADERW constPropSheetHeaderPointer); extern LRESULT (WINAPI *pSendDlgItemMessageW)(HWND hDlg, int nIDDlgItem, UINT Msg, WPARAM wParam, LPARAM lParam); extern BOOL(WINAPI *pModifyMenuW)(HMENU hMnu, UINT uPosition, UINT uFlags, UINT_PTR uIDNewItem, LPCWSTR lpNewItem); extern BOOL(WINAPI *pSetWindowTextW)(HWND hWnd, LPCWSTR lpString); Modified: branches/unicode_buf/teraterm/common/layer_for_unicode.cpp =================================================================== --- branches/unicode_buf/teraterm/common/layer_for_unicode.cpp 2019-10-02 15:07:44 UTC (rev 8249) +++ branches/unicode_buf/teraterm/common/layer_for_unicode.cpp 2019-10-02 15:07:55 UTC (rev 8250) @@ -118,3 +118,59 @@ } return retval; } + +HPROPSHEETPAGE _CreatePropertySheetPageW(LPCPROPSHEETPAGEW_V1 psp) +{ + if (pCreatePropertySheetPageW != NULL) { + return pCreatePropertySheetPageW((LPCPROPSHEETPAGEW)psp); + } + + char *titleA = ToCharW(psp->pszTitle); + + PROPSHEETPAGEA_V1 pspA; + memset(&pspA, 0, sizeof(pspA)); + pspA.dwSize = sizeof(pspA); + pspA.dwFlags = psp->dwFlags; + pspA.hInstance = psp->hInstance; + pspA.pResource = psp->pResource; + pspA.pszTitle = titleA; + pspA.pfnDlgProc = psp->pfnDlgProc; + pspA.lParam = psp->lParam; + + HPROPSHEETPAGE retval = CreatePropertySheetPageA((LPCPROPSHEETPAGEA)&pspA); + + free(titleA); + return retval; +} + +// \x83\x8A\x83\x8A\x81[\x83X\x97pSDK\x82̃w\x83b\x83_\x82\xC9 +// PROPSHEETHEADERW_V1 \x82\xAA\x82Ȃ\xA2\x82\xBD\x82\xDF +// PROPSHEETHEADERW \x82\xF0\x8Eg\x97p +// SDK: Windows Server 2003 R2 Platform SDK +// (Microsoft Windows SDK for Windows 7 and .NET Framework 3.5 SP1) +//INT_PTR _PropertySheetW(PROPSHEETHEADERW_V1 *psh) +INT_PTR _PropertySheetW(PROPSHEETHEADERW *psh) +{ + if (pPropertySheetW != NULL) { + return pPropertySheetW((PROPSHEETHEADERW *)psh); + } + + char *captionA = ToCharW(psh->pszCaption); + +// PROPSHEETHEADERA_V1 pshA; + PROPSHEETHEADERA pshA; + memset(&pshA, 0, sizeof(pshA)); + pshA.dwSize = sizeof(pshA); + pshA.dwFlags = psh->dwFlags; + pshA.hwndParent = psh->hwndParent; + pshA.hInstance = psh->hInstance; + pshA.pszCaption = captionA; + pshA.nPages = psh->nPages; + pshA.phpage = psh->phpage; + pshA.pfnCallback = psh->pfnCallback; + + INT_PTR retval = PropertySheetA(&pshA); + + free(captionA); + return retval; +} Modified: branches/unicode_buf/teraterm/common/layer_for_unicode.h =================================================================== --- branches/unicode_buf/teraterm/common/layer_for_unicode.h 2019-10-02 15:07:44 UTC (rev 8249) +++ branches/unicode_buf/teraterm/common/layer_for_unicode.h 2019-10-02 15:07:55 UTC (rev 8250) @@ -44,6 +44,9 @@ DWORD _GetFileAttributesW(LPCWSTR lpFileName); UINT _DragQueryFileW(HDROP hDrop, UINT iFile, LPWSTR lpszFile, UINT cch); LRESULT _SendDlgItemMessageW(HWND hDlg, int nIDDlgItem, UINT Msg, WPARAM wParam, LPARAM lParam); +HPROPSHEETPAGE _CreatePropertySheetPageW(LPCPROPSHEETPAGEW_V1 constPropSheetPagePointer); +INT_PTR _PropertySheetW(PROPSHEETHEADERW *constPropSheetHeaderPointer); +//INT_PTR _PropertySheetW(PROPSHEETHEADERW_V1 *constPropSheetHeaderPointer); #ifdef __cplusplus } Modified: branches/unicode_buf/teraterm/common/tmfc.cpp =================================================================== --- branches/unicode_buf/teraterm/common/tmfc.cpp 2019-10-02 15:07:44 UTC (rev 8249) +++ branches/unicode_buf/teraterm/common/tmfc.cpp 2019-10-02 15:07:55 UTC (rev 8250) @@ -634,10 +634,10 @@ m_psp.dwSize = sizeof(m_psp); m_psp.dwFlags = PSP_DEFAULT; m_psp.hInstance = inst; - m_psp.pszTemplate = MAKEINTRESOURCE(id); + m_psp.pszTemplate = MAKEINTRESOURCEW(id); #if defined(REWRITE_TEMPLATE) m_psp.dwFlags |= PSP_DLGINDIRECT; - m_psp.pResource = TTGetDlgTemplate(inst, m_psp.pszTemplate); + m_psp.pResource = TTGetDlgTemplate(inst, MAKEINTRESOURCEA(id)); #endif m_psp.pfnDlgProc = Proc; m_psp.lParam = (LPARAM)this; @@ -652,7 +652,7 @@ HPROPSHEETPAGE TTCPropertyPage::CreatePropertySheetPage() { - return ::CreatePropertySheetPage((PROPSHEETPAGE *)&m_psp); + return ::_CreatePropertySheetPageW(&m_psp); } void TTCPropertyPage::OnInitDialog() @@ -734,7 +734,7 @@ //////////////////////////////////////// -TTCPropertySheet::TTCPropertySheet(HINSTANCE hInstance, LPCTSTR pszCaption, HWND hParentWnd) +TTCPropertySheet::TTCPropertySheet(HINSTANCE hInstance, HWND hParentWnd) { m_hInst = hInstance; m_hWnd = 0; @@ -742,11 +742,9 @@ memset(&m_psh, 0, sizeof(m_psh)); m_psh.dwSize = sizeof(m_psh); m_psh.dwFlags = PSH_DEFAULT | PSH_NOAPPLYNOW | PSH_USECALLBACK; // | PSH_MODELESS - if (pszCaption != nullptr) { - m_psh.pszCaption = pszCaption; - //m_psh.dwFlags |= PSH_PROPTITLE; // \x81u\x82̃v\x83\x8D\x83p\x83e\x83B\x81[\x81v\x82\xAA\x92lj\xC1\x82\xB3\x82\xEA\x82\xE9? - } + //m_psh.dwFlags |= PSH_PROPTITLE; // \x81u\x82̃v\x83\x8D\x83p\x83e\x83B\x81[\x81v\x82\xAA\x92lj\xC1\x82\xB3\x82\xEA\x82\xE9? m_psh.hwndParent = hParentWnd; + m_psh.hInstance = hInstance; m_psh.pfnCallback = PropSheetProc; } @@ -758,7 +756,7 @@ { ghInstance = m_hInst; gTTCPS = this; - return PropertySheet(&m_psh); + return _PropertySheetW(&m_psh); // \x83\x82\x81[\x83_\x83\x8C\x83X\x82ɂ\xB7\x82\xE9\x82ƃ^\x83u\x82̓\xAE\x82\xAB\x82\xAA\x82\xA8\x82\xA9\x82\xB5\x82\xA2 #if 0 Modified: branches/unicode_buf/teraterm/common/tmfc.h =================================================================== --- branches/unicode_buf/teraterm/common/tmfc.h 2019-10-02 15:07:44 UTC (rev 8249) +++ branches/unicode_buf/teraterm/common/tmfc.h 2019-10-02 15:07:55 UTC (rev 8250) @@ -152,11 +152,11 @@ class TTCPropertySheet { public: - TTCPropertySheet(HINSTANCE hInstance, LPCTSTR pszCaption, HWND hParentWnd); + TTCPropertySheet(HINSTANCE hInstance, HWND hParentWnd); virtual ~TTCPropertySheet(); virtual void OnInitDialog(); INT_PTR DoModal(); - PROPSHEETHEADER m_psh; + PROPSHEETHEADERW m_psh; HWND m_hWnd; HWND m_hParentWnd; static int CALLBACK PropSheetProc(HWND hWnd, UINT msg, LPARAM lParam); @@ -177,7 +177,7 @@ virtual void OnHelp(); HPROPSHEETPAGE CreatePropertySheetPage(); protected: - PROPSHEETPAGE_V1 m_psp; + PROPSHEETPAGEW_V1 m_psp; private: static INT_PTR CALLBACK Proc(HWND hDlgWnd, UINT msg, WPARAM wp, LPARAM lp); static UINT CALLBACK PropSheetPageProc(HWND hwnd, UINT uMsg, LPPROPSHEETPAGE ppsp); Modified: branches/unicode_buf/teraterm/teraterm/addsetting.cpp =================================================================== --- branches/unicode_buf/teraterm/teraterm/addsetting.cpp 2019-10-02 15:07:44 UTC (rev 8249) +++ branches/unicode_buf/teraterm/teraterm/addsetting.cpp 2019-10-02 15:07:55 UTC (rev 8250) @@ -95,10 +95,10 @@ CGeneralPropPageDlg::CGeneralPropPageDlg(HINSTANCE inst, TTCPropertySheet *sheet) : TTCPropertyPage(inst, CGeneralPropPageDlg::IDD, sheet) { - TCHAR UIMsg[MAX_UIMSG]; - get_lang_msgT("DLG_TABSHEET_TITLE_GENERAL", UIMsg, _countof(UIMsg), - _T("General"), ts.UILanguageFile); - m_psp.pszTitle = _tcsdup(UIMsg); + wchar_t UIMsg[MAX_UIMSG]; + get_lang_msgW("DLG_TABSHEET_TITLE_GENERAL", UIMsg, _countof(UIMsg), + L"General", ts.UILanguageFile); + m_psp.pszTitle = _wcsdup(UIMsg); m_psp.dwFlags |= (PSP_USETITLE | PSP_HASHELP); } @@ -223,10 +223,10 @@ CSequencePropPageDlg::CSequencePropPageDlg(HINSTANCE inst, TTCPropertySheet *sheet) : TTCPropertyPage(inst, CSequencePropPageDlg::IDD, sheet) { - TCHAR UIMsg[MAX_UIMSG]; - get_lang_msgT("DLG_TABSHEET_TITLE_SEQUENCE", UIMsg, _countof(UIMsg), - _T("Control Sequence"), ts.UILanguageFile); - m_psp.pszTitle = _tcsdup(UIMsg); + wchar_t UIMsg[MAX_UIMSG]; + get_lang_msgW("DLG_TABSHEET_TITLE_SEQUENCE", UIMsg, _countof(UIMsg), + L"Control Sequence", ts.UILanguageFile); + m_psp.pszTitle = _wcsdup(UIMsg); m_psp.dwFlags |= (PSP_USETITLE | PSP_HASHELP); } @@ -413,10 +413,10 @@ CCopypastePropPageDlg::CCopypastePropPageDlg(HINSTANCE inst, TTCPropertySheet *sheet) : TTCPropertyPage(inst, CCopypastePropPageDlg::IDD, sheet) { - TCHAR UIMsg[MAX_UIMSG]; - get_lang_msgT("DLG_TABSHEET_TITLE_COPYPASTE", UIMsg, _countof(UIMsg), - _T("Copy and Paste"), ts.UILanguageFile); - m_psp.pszTitle = _tcsdup(UIMsg); + wchar_t UIMsg[MAX_UIMSG]; + get_lang_msgW("DLG_TABSHEET_TITLE_COPYPASTE", UIMsg, _countof(UIMsg), + L"Copy and Paste", ts.UILanguageFile); + m_psp.pszTitle = _wcsdup(UIMsg); m_psp.dwFlags |= (PSP_USETITLE | PSP_HASHELP); } @@ -633,10 +633,10 @@ CVisualPropPageDlg::CVisualPropPageDlg(HINSTANCE inst, TTCPropertySheet *sheet) : TTCPropertyPage(inst, CVisualPropPageDlg::IDD, sheet) { - TCHAR UIMsg[MAX_UIMSG]; - get_lang_msgT("DLG_TABSHEET_TITLE_VISUAL", UIMsg, _countof(UIMsg), - _T("Visual"), ts.UILanguageFile); - m_psp.pszTitle = _tcsdup(UIMsg); + wchar_t UIMsg[MAX_UIMSG]; + get_lang_msgW("DLG_TABSHEET_TITLE_VISUAL", UIMsg, _countof(UIMsg), + L"Visual", ts.UILanguageFile); + m_psp.pszTitle = _wcsdup(UIMsg); m_psp.dwFlags |= (PSP_USETITLE | PSP_HASHELP); } @@ -1236,10 +1236,10 @@ CLogPropPageDlg::CLogPropPageDlg(HINSTANCE inst, TTCPropertySheet *sheet) : TTCPropertyPage(inst, CLogPropPageDlg::IDD, sheet) { - TCHAR UIMsg[MAX_UIMSG]; - get_lang_msgT("DLG_TABSHEET_TITLE_Log", UIMsg, _countof(UIMsg), - _T("Log"), ts.UILanguageFile); - m_psp.pszTitle = _tcsdup(UIMsg); + wchar_t UIMsg[MAX_UIMSG]; + get_lang_msgW("DLG_TABSHEET_TITLE_Log", UIMsg, _countof(UIMsg), + L"Log", ts.UILanguageFile); + m_psp.pszTitle = _wcsdup(UIMsg); m_psp.dwFlags |= (PSP_USETITLE | PSP_HASHELP); } @@ -1599,10 +1599,10 @@ CCygwinPropPageDlg::CCygwinPropPageDlg(HINSTANCE inst, TTCPropertySheet *sheet) : TTCPropertyPage(inst, CCygwinPropPageDlg::IDD, sheet) { - TCHAR UIMsg[MAX_UIMSG]; - get_lang_msgT("DLG_TABSHEET_TITLE_CYGWIN", UIMsg, _countof(UIMsg), - _T("Cygwin"), ts.UILanguageFile); - m_psp.pszTitle = _tcsdup(UIMsg); + wchar_t UIMsg[MAX_UIMSG]; + get_lang_msgW("DLG_TABSHEET_TITLE_CYGWIN", UIMsg, _countof(UIMsg), + L"Cygwin", ts.UILanguageFile); + m_psp.pszTitle = _wcsdup(UIMsg); m_psp.dwFlags |= (PSP_USETITLE | PSP_HASHELP); } @@ -1693,8 +1693,8 @@ // CAddSettingPropSheetDlg CAddSettingPropSheetDlg::CAddSettingPropSheetDlg( - HINSTANCE hInstance, LPCTSTR pszCaption, HWND hParentWnd) : - TTCPropertySheet(hInstance, pszCaption, hParentWnd) + HINSTANCE hInstance, HWND hParentWnd) : + TTCPropertySheet(hInstance, hParentWnd) { m_GeneralPage = new CGeneralPropPageDlg(hInstance, this); m_SequencePage = new CSequencePropPageDlg(hInstance, this); @@ -1712,10 +1712,10 @@ m_psh.nPages = 6; m_psh.phpage = hPsp; - TCHAR UIMsg[MAX_UIMSG]; - get_lang_msgT("DLG_TABSHEET_TITLE", UIMsg, _countof(UIMsg), - pszCaption, ts.UILanguageFile); - m_psh.pszCaption = _tcsdup(UIMsg); + wchar_t UIMsg[MAX_UIMSG]; + get_lang_msgW("DLG_TABSHEET_TITLE", UIMsg, _countof(UIMsg), + L"Tera Term: Additional settings", ts.UILanguageFile); + m_psh.pszCaption = _wcsdup(UIMsg); } CAddSettingPropSheetDlg::~CAddSettingPropSheetDlg() Modified: branches/unicode_buf/teraterm/teraterm/addsetting.h =================================================================== --- branches/unicode_buf/teraterm/teraterm/addsetting.h 2019-10-02 15:07:44 UTC (rev 8249) +++ branches/unicode_buf/teraterm/teraterm/addsetting.h 2019-10-02 15:07:55 UTC (rev 8250) @@ -131,7 +131,7 @@ class CAddSettingPropSheetDlg : public TTCPropertySheet { public: - CAddSettingPropSheetDlg(HINSTANCE hInstance, LPCTSTR pszCaption, HWND hParentWnd); + CAddSettingPropSheetDlg(HINSTANCE hInstance, HWND hParentWnd); virtual ~CAddSettingPropSheetDlg(); private: void OnInitDialog(); Modified: branches/unicode_buf/teraterm/teraterm/vtwin.cpp =================================================================== --- branches/unicode_buf/teraterm/teraterm/vtwin.cpp 2019-10-02 15:07:44 UTC (rev 8249) +++ branches/unicode_buf/teraterm/teraterm/vtwin.cpp 2019-10-02 15:07:55 UTC (rev 8250) @@ -4466,7 +4466,7 @@ SetDialogFont(ts.DialogFontName, ts.DialogFontPoint, ts.DialogFontCharSet, ts.UILanguageFile, "Tera Term", "DLG_TAHOMA_FONT"); - CAddSettingPropSheetDlg CAddSetting(m_hInst, _T("Tera Term: Additional settings"), HVTWin); + CAddSettingPropSheetDlg CAddSetting(m_hInst, HVTWin); ret = CAddSetting.DoModal(); switch (ret) { case (DWORD)-1: