Revision: 7691 https://osdn.net/projects/ttssh2/scm/svn/commits/7691 Author: zmatsuo Date: 2019-05-20 00:03:52 +0900 (Mon, 20 May 2019) Log Message: ----------- Merge r7512 into cmake Revision Links: -------------- https://osdn.net/projects/ttssh2/scm/svn/commits/7512 Modified Paths: -------------- branches/cmake/CMakeLists.txt branches/cmake/teraterm/common/dlglib.c branches/cmake/teraterm/common/dlglib.h branches/cmake/teraterm/common/i18n.h branches/cmake/teraterm/svnrev/svnrev.v15.vcxproj branches/cmake/teraterm/teraterm/CMakeLists.txt branches/cmake/teraterm/teraterm/dnddlg.cpp branches/cmake/teraterm/teraterm/sizetip.c branches/cmake/teraterm/teraterm/teraterm.cpp branches/cmake/teraterm/teraterm/ttermpro.v10.vcxproj branches/cmake/teraterm/teraterm/ttermpro.v11.vcxproj branches/cmake/teraterm/teraterm/ttermpro.v12.vcxproj branches/cmake/teraterm/teraterm/ttermpro.v14.vcxproj branches/cmake/teraterm/teraterm/ttermpro.v15.vcxproj branches/cmake/teraterm/teraterm/ttermpro.v9.vcproj branches/cmake/teraterm/teraterm/ttermpro.vcproj branches/cmake/teraterm/teraterm/ttime.c branches/cmake/teraterm/teraterm/vtwin.cpp branches/cmake/teraterm/ttpdlg/CMakeLists.txt branches/cmake/ttpmenu/CMakeLists.txt branches/cmake/ttssh2/ttxssh/CMakeLists.txt branches/cmake/ttssh2/ttxssh/auth.c branches/cmake/ttssh2/ttxssh/resource.h branches/cmake/ttssh2/ttxssh/ttxssh.rc branches/cmake/ttssh2/ttxssh/ttxssh.vcproj Added Paths: ----------- branches/cmake/teraterm/common/tipwin.cpp branches/cmake/teraterm/common/tipwin.h -------------- next part -------------- Modified: branches/cmake/CMakeLists.txt =================================================================== --- branches/cmake/CMakeLists.txt 2019-05-19 15:03:33 UTC (rev 7690) +++ branches/cmake/CMakeLists.txt 2019-05-19 15:03:52 UTC (rev 7691) @@ -3,6 +3,7 @@ project(teraterm_all) +option(ENABLE_DPIAWARENESS "Dpiawareness" ON) option(ENABLE_TTXSAMPLES "TTXSamples" ON) option(USE_UNICODE_API "unicode" ON) option(LINK_UNICOWS "unicode APIs for 9x" OFF) Modified: branches/cmake/teraterm/common/dlglib.c =================================================================== --- branches/cmake/teraterm/common/dlglib.c 2019-05-19 15:03:33 UTC (rev 7690) +++ branches/cmake/teraterm/common/dlglib.c 2019-05-19 15:03:52 UTC (rev 7691) @@ -36,6 +36,7 @@ #include <stdio.h> #include <commctrl.h> #include <tchar.h> +#include "ttlib.h" // for get_lang_font() void EnableDlgItem(HWND HDlg, int FirstId, int LastId) { @@ -422,7 +423,17 @@ } /** - * \x83t\x83H\x83\x93\x83g\x82\xAA\x83C\x83\x93\x83X\x83g\x81[\x83\x8B\x82\xB3\x82\xEA\x82Ă\xA2\x82邩\x92\xB2\x82ׂ\xE9 + * IsExistFont + * \x83t\x83H\x83\x93\x83g\x82\xAA\x91\xB6\x8D݂\xB5\x82Ă\xA2\x82邩\x83`\x83F\x83b\x83N\x82\xB7\x82\xE9 + * + * @param[in] face \x83t\x83H\x83\x93\x83g\x96\xBC(\x83t\x83@\x83C\x83\x8B\x96\xBC\x82ł͂Ȃ\xA2) + * @param[in] charset SHIFTJIS_CHARSET\x82Ȃ\xC7 + * @param[in] strict TRUE \x83t\x83H\x83\x93\x83g\x83\x8A\x83\x93\x83N\x82͌\x9F\x8D\xF5\x82Ɋ܂߂Ȃ\xA2 + * FALSE \x83t\x83H\x83\x93\x83g\x83\x8A\x83\x93\x83N\x82\xE0\x8C\x9F\x8D\xF5\x82Ɋ܂߂\xE9 + * @retval FALSE \x83t\x83H\x83\x93\x83g\x82͂\xB5\x82Ȃ\xA2 + * @retval TRUE \x83t\x83H\x83\x93\x83g\x82͑\xB6\x8D݂\xB7\x82\xE9 + * + * strict = FALSE\x8E\x9E\x81A\x91\xB6\x8D݂\xB5\x82Ȃ\xA2\x83t\x83H\x83\x93\x83g\x82ł\xE0\x95\\x8E\xA6\x82ł\xAB\x82\xE9\x82Ȃ\xE7TRUE\x82\xAA\x95Ԃ\xE9 */ BOOL IsExistFont(const wchar_t *face, BYTE charset, BOOL strict) { @@ -430,7 +441,7 @@ LOGFONTW lf; IsExistFontInfoW info; memset(&lf, 0, sizeof(lf)); - lf.lfCharSet = strict ? DEFAULT_CHARSET : charset; + lf.lfCharSet = !strict ? DEFAULT_CHARSET : charset; // \x81\xAADEFAULT_CHARSET\x82Ƃ\xB7\x82\xE9\x82ƃt\x83H\x83\x93\x83g\x83\x8A\x83\x93\x83N\x82\xE0\x97L\x8C\xF8\x82ɂȂ\xE9\x82悤\x82\xBE lf.lfPitchAndFamily = 0; info.found = FALSE; @@ -447,7 +458,7 @@ LOGFONTA lf; IsExistFontInfoA info; memset(&lf, 0, sizeof(lf)); - lf.lfCharSet = strict ? DEFAULT_CHARSET : charset; + lf.lfCharSet = !strict ? DEFAULT_CHARSET : charset; // \x81\xAADEFAULT_CHARSET\x82Ƃ\xB7\x82\xE9\x82ƃt\x83H\x83\x93\x83g\x83\x8A\x83\x93\x83N\x82\xE0\x97L\x8C\xF8\x82ɂȂ\xE9\x82悤\x82\xBE lf.lfPitchAndFamily = 0; info.found = FALSE; @@ -459,6 +470,23 @@ } /** + * \x83_\x83C\x83A\x83\x8D\x83O\x83t\x83H\x83\x93\x83g\x82\xF0\x8E擾\x82\xB7\x82\xE9 + * \x83G\x83\x89\x81[\x82͔\xAD\x90\xB6\x82\xB5\x82Ȃ\xA2 + */ +void GetMessageboxFont(LOGFONT *logfont) +{ + NONCLIENTMETRICS nci; + const int st_size = CCSIZEOF_STRUCT(NONCLIENTMETRICS, lfMessageFont); + BOOL r; + + memset(&nci, 0, sizeof(nci)); + nci.cbSize = st_size; + r = SystemParametersInfo(SPI_GETNONCLIENTMETRICS, st_size, &nci, 0); + assert(r == TRUE); + *logfont = nci.lfStatusFont; +} + +/** * \x8Eg\x97p\x82\xB7\x82\xE9\x83_\x83C\x83A\x83\x8D\x83O\x83t\x83H\x83\x93\x83g\x82\xF0\x8C\x88\x92肷\x82\xE9 */ void SetDialogFont(const char *SetupFName, @@ -470,7 +498,7 @@ BOOL result; result = GetI18nLogfont("Tera Term", "DlgFont", &logfont, 0, SetupFName); if (result == TRUE) { - result = IsExistFontA(logfont.lfFaceName, logfont.lfCharSet, FALSE); + result = IsExistFontA(logfont.lfFaceName, logfont.lfCharSet, TRUE); if (result == TRUE) { TTSetDlgFontA(logfont.lfFaceName, logfont.lfHeight, logfont.lfCharSet); return; @@ -497,7 +525,7 @@ if (logfont.lfFaceName[0] == '\0') { break; } - if (IsExistFontA(logfont.lfFaceName, logfont.lfCharSet, FALSE)) { + if (IsExistFontA(logfont.lfFaceName, logfont.lfCharSet, TRUE)) { break; } } @@ -511,7 +539,7 @@ if (logfont.lfFaceName[0] == '\0') { break; } - if (IsExistFontA(logfont.lfFaceName, logfont.lfCharSet, FALSE)) { + if (IsExistFontA(logfont.lfFaceName, logfont.lfCharSet, TRUE)) { break; } } @@ -520,24 +548,35 @@ TTSetDlgFontA(logfont.lfFaceName, logfont.lfHeight, logfont.lfCharSet); return; } - // \x83t\x83H\x83\x93\x83g\x82\xAA\x8C\xA9\x82\xA9\x82\xE7\x82Ȃ\xA9\x82\xC1\x82\xBD\x82Ƃ\xAB\x81A - // \x95\xB6\x8E\x9A\x89\xBB\x82\xAF\x82Ő\xB3\x82\xB5\x82\xAD\x95\\x8E\xA6\x82\xB3\x82\xEA\x82Ȃ\xA2\x8E\x96\x91ԂƂȂ\xE9 - // messagebox()\x82̃t\x83H\x83\x93\x83g\x82\xF0\x82Ƃ肠\x82\xA6\x82\xB8\x91I\x91\xF0\x82\xB5\x82Ă\xA8\x82\xAD } - // messagebox\x82̃t\x83H\x83\x93\x83g\x82\xF0\x91I\x91\xF0 + // ini,lng\x82Ŏw\x92肳\x82ꂽ\x83t\x83H\x83\x93\x83g\x82\xAA\x8C\xA9\x82\xA9\x82\xE7\x82Ȃ\xA9\x82\xC1\x82\xBD\x82Ƃ\xAB\x81A + // \x95\xB6\x8E\x9A\x89\xBB\x82\xAF\x82Ő\xB3\x82\xB5\x82\xAD\x95\\x8E\xA6\x82\xB3\x82\xEA\x82Ȃ\xA2\x8E\x96\x91ԂƂȂ\xE9 + // messagebox()\x82̃t\x83H\x83\x93\x83g\x82\xF0\x82Ƃ肠\x82\xA6\x82\xB8\x91I\x91\xF0\x82\xB5\x82Ă\xA8\x82\xAD { - NONCLIENTMETRICS nci; - int st_size = CCSIZEOF_STRUCT(NONCLIENTMETRICS, lfMessageFont); - BOOL r; - const LOGFONT *logfont; + LOGFONT logfont; + GetMessageboxFont(&logfont); + TTSetDlgFont(logfont.lfFaceName, logfont.lfHeight, logfont.lfCharSet); + } +} - memset(&nci, 0, sizeof(nci)); - nci.cbSize = st_size; - r = SystemParametersInfo(SPI_GETNONCLIENTMETRICS, st_size, &nci, 0); - assert(r == TRUE); - logfont = &nci.lfStatusFont; - - TTSetDlgFont(logfont->lfFaceName, logfont->lfHeight, logfont->lfCharSet); +#if 0 +HFONT SetDlgFonts(HWND hDlg, const int nIDDlgItems[], int nIDDlgItemCount, + const char *UILanguageFile, PCHAR key) +{ + HFONT hPrevFont = (HFONT)SendMessage(hDlg, WM_GETFONT, 0, 0); + LOGFONTA logfont; + HFONT hNewFont; + if (key == NULL) key = "DLG_TAHOMA_FONT"; + GetObject(hPrevFont, sizeof(LOGFONT), &logfont); + if (get_lang_font(key, hDlg, &logfont, &hNewFont, UILanguageFile)) { + int i; + for (i = 0 ; i < nIDDlgItemCount ; i++) { + const int nIDDlgItem = nIDDlgItems[i]; + SendDlgItemMessage(hDlg, nIDDlgItem, WM_SETFONT, (WPARAM)hNewFont, MAKELPARAM(TRUE,0)); + } } + return hNewFont; } +#endif + Modified: branches/cmake/teraterm/common/dlglib.h =================================================================== --- branches/cmake/teraterm/common/dlglib.h 2019-05-19 15:03:33 UTC (rev 7690) +++ branches/cmake/teraterm/common/dlglib.h 2019-05-19 15:03:52 UTC (rev 7691) @@ -57,7 +57,6 @@ #define SetDropDownListT(p1, p2, p3, p4) SetDropDownList(p1, p2, p3, p4) #endif -//////////////////////////////////////// void TTSetDlgFontA(const char *face, int height, int charset); void TTSetDlgFontW(const wchar_t *face, int height, int charset); const wchar_t *TTGetClassName(const DLGTEMPLATE *DlgTempl); @@ -89,6 +88,9 @@ HWND hWndParent, DLGPROC lpDialogFunc); void SetDialogFont(const char *SetupFName, const char *UILanguageFile, const char *Section); +HFONT SetDlgFonts(HWND hDlg, const int nIDDlgItems[], int nIDDlgItemCount, + const char *UILanguageFile, PCHAR key); +BOOL IsExistFontA(const char *face, BYTE charset, BOOL strict); #if defined(_UNICODE) #define TTSetDlgFont(p1,p2,p3) TTSetDlgFontW(p1,p2,p3) Modified: branches/cmake/teraterm/common/i18n.h =================================================================== --- branches/cmake/teraterm/common/i18n.h 2019-05-19 15:03:33 UTC (rev 7690) +++ branches/cmake/teraterm/common/i18n.h 2019-05-19 15:03:52 UTC (rev 7691) @@ -30,7 +30,6 @@ #define __I18N_H #include <windows.h> -//#include "ttlib.h" #define MAX_UIMSG 1024 Added: branches/cmake/teraterm/common/tipwin.cpp =================================================================== --- branches/cmake/teraterm/common/tipwin.cpp (rev 0) +++ branches/cmake/teraterm/common/tipwin.cpp 2019-05-19 15:03:52 UTC (rev 7691) @@ -0,0 +1,289 @@ +// Import from PuTTY 0.60 windows/sizetip.c +/* + * PuTTY is copyright 1997-2004 Simon Tatham. + * + * Portions copyright Robert de Bath, Joris van Rantwijk, Delian + * Delchev, Andreas Schultz, Jeroen Massar, Wez Furlong, Nicolas Barry, + * Justin Bradford, Ben Harris, Malcolm Smith, Ahmad Khalifa, Markus + * Kuhn, Colin Watson, Christopher Staite, and CORE SDI S.A. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation files + * (the "Software"), to deal in the Software without restriction, + * including without limitation the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE + * FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF + * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +/* + * Copyright (C) 2008-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. + */ +/* based on windows/sizetip.c from PuTTY 0.60 */ + +#include <windows.h> +#include <stdio.h> +#include <tchar.h> +#include <commctrl.h> // for CCSIZEOF_STRUCT() +#include <assert.h> + +#include "TipWin.h" + +#define FRAME_WIDTH 6 + +static ATOM tip_class = 0; + +typedef struct tagTipWinData { + HFONT tip_font; + COLORREF tip_bg; + COLORREF tip_text; + HWND tip_wnd; + HWND hParentWnd; + int tip_enabled; + const TCHAR *str; + size_t str_len; + RECT str_rect; + RECT rect; + int px; + int py; + BOOL auto_destroy; +} TipWin; + +static void CalcStrRect(TipWin *pTipWin) +{ + HDC hdc = CreateCompatibleDC(NULL); + SelectObject(hdc, pTipWin->tip_font); + pTipWin->str_rect.top = 0; + pTipWin->str_rect.left = 0; + DrawText(hdc, pTipWin->str, pTipWin->str_len, + &pTipWin->str_rect, DT_LEFT|DT_CALCRECT); + DeleteDC(hdc); +} + +static LRESULT CALLBACK SizeTipWndProc(HWND hWnd, UINT nMsg, + WPARAM wParam, LPARAM lParam) +{ + TipWin *pTipWin = (TipWin *)GetWindowLongPtr(hWnd, GWLP_USERDATA); + + switch (nMsg) { + case WM_CREATE: { + CREATESTRUCTA *create_st = (CREATESTRUCTA *)lParam; + pTipWin = (TipWin *)create_st->lpCreateParams; + SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR)pTipWin); + pTipWin->tip_wnd = hWnd; + break; + } + + case WM_ERASEBKGND: + return TRUE; + + case WM_PAINT: + { + HBRUSH hbr; + HGDIOBJ holdbr; + RECT cr; + HDC hdc; + + PAINTSTRUCT ps; + hdc = BeginPaint(hWnd, &ps); + + SelectObject(hdc, pTipWin->tip_font); + SelectObject(hdc, GetStockObject(BLACK_PEN)); + + hbr = CreateSolidBrush(pTipWin->tip_bg); + holdbr = SelectObject(hdc, hbr); + + GetClientRect(hWnd, &cr); + Rectangle(hdc, cr.left, cr.top, cr.right, cr.bottom); + + SetTextColor(hdc, pTipWin->tip_text); + SetBkColor(hdc, pTipWin->tip_bg); + + { + RECT rect = pTipWin->str_rect; + rect.left = rect.left + FRAME_WIDTH; + rect.right = rect.right + FRAME_WIDTH; + rect.top = rect.top + FRAME_WIDTH; + rect.bottom = rect.bottom + FRAME_WIDTH; + DrawText(hdc, pTipWin->str, pTipWin->str_len, &rect, DT_LEFT); + } + + SelectObject(hdc, holdbr); + DeleteObject(hbr); + + EndPaint(hWnd, &ps); + } + return 0; + + case WM_NCHITTEST: + return HTTRANSPARENT; + + case WM_DESTROY: + DeleteObject(pTipWin->tip_font); + pTipWin->tip_font = NULL; + break; + + case WM_SETTEXT: + { + LPCTSTR str = (LPCTSTR) lParam; + const int str_width = pTipWin->str_rect.right - pTipWin->str_rect.left; + const int str_height = pTipWin->str_rect.bottom - pTipWin->str_rect.top; + + free((void *)(pTipWin->str)); + pTipWin->str_len = _tcslen(str); + pTipWin->str = _tcsdup(str); + CalcStrRect(pTipWin); + + SetWindowPos(hWnd, NULL, + 0, 0, + str_width + FRAME_WIDTH * 2, str_height + FRAME_WIDTH * 2, + SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE); + InvalidateRect(hWnd, NULL, FALSE); + + } + break; + + case WM_NCDESTROY: + if (pTipWin->auto_destroy) { + free((void *)pTipWin->str); + free(pTipWin); + } + break; + default: + break; + } + + return DefWindowProc(hWnd, nMsg, wParam, lParam); +} + +// todo: dlglib.c\x82ɓ\xAF\x93\x99\x82ȃR\x81[\x83h\x82\xA0\x82\xE8 +void GetMessageboxFont(LOGFONT *logfont) +{ + NONCLIENTMETRICS nci; + const int st_size = CCSIZEOF_STRUCT(NONCLIENTMETRICS, lfMessageFont); + BOOL r; + + memset(&nci, 0, sizeof(nci)); + nci.cbSize = st_size; + r = SystemParametersInfo(SPI_GETNONCLIENTMETRICS, st_size, &nci, 0); + assert(r == TRUE); + *logfont = nci.lfStatusFont; +} + +static void register_class(HINSTANCE hInst) +{ + if (!tip_class) { + WNDCLASS wc; + wc.style = CS_HREDRAW | CS_VREDRAW; + wc.lpfnWndProc = SizeTipWndProc; + wc.cbClsExtra = 0; + wc.cbWndExtra = 0; + wc.hInstance = hInst; + wc.hIcon = NULL; + wc.hCursor = NULL; + wc.hbrBackground = NULL; + wc.lpszMenuName = NULL; + wc.lpszClassName = _T("SizeTipClass"); + + tip_class = RegisterClass(&wc); + } +} + +/* Create the tip window */ +static void create_tipwin(TipWin *pTipWin, HINSTANCE hInst, int cx, int cy) +{ + const TCHAR *str = pTipWin->str; + HWND hParnetWnd = pTipWin->hParentWnd; + const int str_width = pTipWin->str_rect.right - pTipWin->str_rect.left; + const int str_height = pTipWin->str_rect.bottom - pTipWin->str_rect.top; + pTipWin->tip_wnd = + CreateWindowEx(WS_EX_TOOLWINDOW | WS_EX_TOPMOST, + MAKEINTRESOURCE(tip_class), + str, WS_POPUP, + cx, cy, + str_width + FRAME_WIDTH * 2, str_height + FRAME_WIDTH * 2, + hParnetWnd, NULL, hInst, pTipWin); + assert(pTipWin->tip_wnd != NULL); +} + +TipWin *TipWinCreate(HWND src, int cx, int cy, const TCHAR *str) +{ + TipWin *pTipWin; + HINSTANCE hInst = (HINSTANCE)GetWindowLongPtr(src, GWLP_HINSTANCE); + LOGFONT logfont; + + register_class(hInst); + pTipWin = (TipWin *)malloc(sizeof(TipWin)); + if (pTipWin == NULL) return NULL; + pTipWin->str_len = _tcslen(str); + pTipWin->str = _tcsdup(str); + pTipWin->px = cx; + pTipWin->py = cy; + pTipWin->tip_bg = GetSysColor(COLOR_INFOBK); + pTipWin->tip_text = GetSysColor(COLOR_INFOTEXT); + GetMessageboxFont(&logfont); + pTipWin->tip_font = CreateFontIndirect(&logfont); + CalcStrRect(pTipWin); + pTipWin->hParentWnd = src; + create_tipwin(pTipWin, hInst, cx, cy); + + pTipWin->hParentWnd = src; + pTipWin->auto_destroy = TRUE; + ShowWindow(pTipWin->tip_wnd, SW_SHOWNOACTIVATE); + return pTipWin; +} + +void TipWinSetPos(int x, int y) +{ +} + +void TipWinSetText(TipWin *tWin, TCHAR *text) +{ + if (tWin != NULL) { + HWND tip_wnd = tWin->tip_wnd; + SetWindowText(tip_wnd, text); + } +} + +void TipWinDestroy(TipWin *tWin) +{ + if (tWin != NULL) { + HWND tip_wnd = tWin->tip_wnd; + DestroyWindow(tip_wnd); + } +} + Added: branches/cmake/teraterm/common/tipwin.h =================================================================== --- branches/cmake/teraterm/common/tipwin.h (rev 0) +++ branches/cmake/teraterm/common/tipwin.h 2019-05-19 15:03:52 UTC (rev 7691) @@ -0,0 +1,17 @@ + +#include <windows.h> +#include <tchar.h> + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct tagTipWinData TipWin; + +TipWin *TipWinCreate(HWND src, int cx, int cy, const TCHAR *str); +void TipWinSetText(TipWin *tWin, TCHAR *text); +void TipWinDestroy(TipWin *tWin); + +#ifdef __cplusplus +} +#endif Modified: branches/cmake/teraterm/svnrev/svnrev.v15.vcxproj =================================================================== --- branches/cmake/teraterm/svnrev/svnrev.v15.vcxproj 2019-05-19 15:03:33 UTC (rev 7690) +++ branches/cmake/teraterm/svnrev/svnrev.v15.vcxproj 2019-05-19 15:03:52 UTC (rev 7691) @@ -15,7 +15,6 @@ <RootNamespace>svnrev</RootNamespace> <Keyword>Win32Proj</Keyword> <ProjectName>svnrev</ProjectName> - <WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion> </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> Modified: branches/cmake/teraterm/teraterm/CMakeLists.txt =================================================================== --- branches/cmake/teraterm/teraterm/CMakeLists.txt 2019-05-19 15:03:33 UTC (rev 7690) +++ branches/cmake/teraterm/teraterm/CMakeLists.txt 2019-05-19 15:03:52 UTC (rev 7691) @@ -15,6 +15,10 @@ add_definitions(-DUNICODE_DISPLAY=1) endif() endif() +if(ENABLE_DPIAWARENESS) + add_definitions(-DDPIAWARENESS) +endif() + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/") set(COMMON_SRC @@ -29,9 +33,10 @@ ../common/teraterm.h ../common/ttlib.c ../common/ttlib.h + ../common/dlglib.h ../common/dlglib.c ../common/dlglib_cpp.cpp - ../common/dlglib.h + ../common/dlglib_tmpl.cpp ../common/win16api.h ../common/win16api.c ../common/dlglib_tmpl.cpp @@ -50,6 +55,8 @@ ../common/dllutil.h ../common/codeconv.h ../common/codeconv.cpp + ../common/tipwin.h + ../common/tipwin.cpp # ../teraterm/uni2sjis.map ../ttpcmn/sjis2uni.map @@ -205,9 +212,58 @@ ttptek ) -configure_file( - svnversion.h.in - svnversion.h @ONLY) -if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/../ttpdlg/svnversion.h") - file(REMOVE "${CMAKE_CURRENT_SOURCE_DIR}/../ttpdlg/svnversion.h") +# copy .lng files +if(${CMAKE_GENERATOR} MATCHES "Visual Studio 15 2017") + add_custom_target( + copy_lang ALL + DEPENDS + "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}$(Configuration)/lang/Default.lng" + "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}$(Configuration)/lang/English.lng" + "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}$(Configuration)/lang/French.lng" + "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}$(Configuration)/lang/German.lng" + "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}$(Configuration)/lang/Japanese.lng" + "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}$(Configuration)/lang/Korean.lng" + "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}$(Configuration)/lang/Russian.lng" + "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}$(Configuration)/lang/Simplified Chinese.lng" + "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}$(Configuration)/lang/Traditional Chinese.lng" + ) + add_custom_command( + OUTPUT + "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}$(Configuration)/lang/Default.lng" + "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}$(Configuration)/lang/English.lng" + "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}$(Configuration)/lang/French.lng" + "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}$(Configuration)/lang/German.lng" + "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}$(Configuration)/lang/Japanese.lng" + "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}$(Configuration)/lang/Korean.lng" + "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}$(Configuration)/lang/Russian.lng" + "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}$(Configuration)/lang/Simplified Chinese.lng" + "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}$(Configuration)/lang/Traditional Chinese.lng" + COMMAND ${CMAKE_COMMAND} -E copy + "${CMAKE_SOURCE_DIR}/installer/release/lang/Default.lng" + "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}$(Configuration)/lang/Default.lng" + COMMAND ${CMAKE_COMMAND} -E copy + "${CMAKE_SOURCE_DIR}/installer/release/lang/English.lng" + "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}$(Configuration)/lang/English.lng" + COMMAND ${CMAKE_COMMAND} -E copy + "${CMAKE_SOURCE_DIR}/installer/release/lang/French.lng" + "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}$(Configuration)/lang/French.lng" + COMMAND ${CMAKE_COMMAND} -E copy + "${CMAKE_SOURCE_DIR}/installer/release/lang/German.lng" + "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}$(Configuration)/lang/German.lng" + COMMAND ${CMAKE_COMMAND} -E copy + "${CMAKE_SOURCE_DIR}/installer/release/lang/Japanese.lng" + "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}$(Configuration)/lang/Japanese.lng" + COMMAND ${CMAKE_COMMAND} -E copy + "${CMAKE_SOURCE_DIR}/installer/release/lang/Korean.lng" + "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}$(Configuration)/lang/Korean.lng" + COMMAND ${CMAKE_COMMAND} -E copy + "${CMAKE_SOURCE_DIR}/installer/release/lang/Russian.lng" + "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}$(Configuration)/lang/Russian.lng" + COMMAND ${CMAKE_COMMAND} -E copy + "${CMAKE_SOURCE_DIR}/installer/release/lang/Simplified Chinese.lng" + "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}$(Configuration)/lang/Simplified Chinese.lng" + COMMAND ${CMAKE_COMMAND} -E copy + "${CMAKE_SOURCE_DIR}/installer/release/lang/Traditional Chinese.lng" + "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}$(Configuration)/lang/Traditional Chinese.lng" + ) endif() Modified: branches/cmake/teraterm/teraterm/dnddlg.cpp =================================================================== --- branches/cmake/teraterm/teraterm/dnddlg.cpp 2019-05-19 15:03:33 UTC (rev 7690) +++ branches/cmake/teraterm/teraterm/dnddlg.cpp 2019-05-19 15:03:52 UTC (rev 7691) @@ -1,296 +1,282 @@ -/* - * (C) 2005-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. - */ +/* + * (C) 2005-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.EXE, drag and drop dialog */ -#include "dnddlg.h" - -#include <windowsx.h> -#include <stdio.h> // for _snprintf_s - -#include "tt_res.h" - -#include "i18n.h" -#include "ttlib.h" -#include "dlglib.h" - -struct DrapDropDlgParam { - const TCHAR *TargetFilename; - enum drop_type DropType; - unsigned char DropTypePaste; - bool ScpEnable; - char *ScpSendDirPtr; - int ScpSendDirSize; - bool SendfileEnable; - bool PasteNewlineEnable; - int RemaingFileCount; - bool DoSameProcess; - bool DoSameProcessNextDrop; - bool DoNotShowDialogEnable; - bool DoNotShowDialog; - const char *UILanguageFile; -}; - -struct DrapDropDlgData { - DrapDropDlgParam *Param; -}; - -static LRESULT CALLBACK OnDragDropDlgProc(HWND hDlgWnd, UINT msg, WPARAM wp, LPARAM lp) -{ - static const DlgTextInfo TextInfos[] = { - { 0, "DLG_DANDD_TITLE" }, - { IDC_DAD_STATIC, "DLG_DANDD_TEXT" }, - { IDC_SCP_RADIO, "DLG_DANDD_SCP_RADIO" }, - { IDC_SENDFILE_RADIO, "DLG_DANDD_SENDFILE_RADIO" }, - { IDC_PASTE_RADIO, "DLG_DANDD_PASTE_RADIO" }, - { IDC_SCP_PATH_LABEL, "DLG_DANDD_SCP_DEST_LABEL" }, - { IDC_SCP_PATH_NOTE, "DLG_DANDD_SCP_DEST_NOTE" }, - { IDC_BINARY_CHECK, "DLG_DANDD_SEND_BINARY_CHECK" }, - { IDC_ESCAPE_CHECK, "DLG_DANDD_PASTE_ESCAPE_CHECK" }, - { IDC_SPACE_RADIO, "DLG_DANDD_PASTE_SPACE_RADIO" }, - { IDC_NEWLINE_RADIO, "DLG_DANDD_PASTE_NEWLINE_RADIO" }, - { IDC_SAME_PROCESS_CHECK, "DLG_DANDD_NEXTFILES" }, - { IDC_SAME_PROCESS_NEXTDROP_CHECK, "DLG_DANDD_SAME_NEEXTDROP" }, - { IDC_DONTSHOW_CHECK, "DLG_DANDD_DONTSHOW_NEEXTDROP" }, - { IDC_DAD_NOTE, "DLG_DANDD_NOTE" }, - { IDOK, "BTN_OK" }, - { IDCANCEL, "BTN_CANCEL" }, - }; - DrapDropDlgData *DlgData = (DrapDropDlgData *)GetWindowLongPtr(hDlgWnd, DWLP_USER); - - switch (msg) { - case WM_INITDIALOG: - { - DlgData = (DrapDropDlgData *)malloc(sizeof(DrapDropDlgData)); - SetWindowLongPtr(hDlgWnd, DWLP_USER, (LONG_PTR)DlgData); - DrapDropDlgParam *Param = (DrapDropDlgParam *)lp; - DlgData->Param = Param; - SetDlgTexts(hDlgWnd, TextInfos, _countof(TextInfos), Param->UILanguageFile); - - // target file - SetDlgItemText(hDlgWnd, IDC_FILENAME_EDIT, Param->TargetFilename); +/* TERATERM.EXE, drag and drop dialog */ +#include "dnddlg.h" - // checkbox - CheckRadioButton(hDlgWnd, IDC_SCP_RADIO, IDC_PASTE_RADIO, - (Param->DropType == DROP_TYPE_SEND_FILE || - Param->DropType == DROP_TYPE_SEND_FILE_BINARY) ? IDC_SENDFILE_RADIO : - Param->DropType == DROP_TYPE_PASTE_FILENAME ? IDC_PASTE_RADIO : - IDC_SCP_RADIO); - - // SCP - SetDlgItemTextA(hDlgWnd, IDC_SCP_PATH, Param->ScpSendDirPtr); - if (!Param->ScpEnable) { - // \x96\xB3\x8C\xF8\x89\xBB - EnableWindow(GetDlgItem(hDlgWnd, IDC_SCP_RADIO), FALSE); - EnableWindow(GetDlgItem(hDlgWnd, IDC_SCP_PATH_LABEL), FALSE); - EnableWindow(GetDlgItem(hDlgWnd, IDC_SCP_PATH), FALSE); - EnableWindow(GetDlgItem(hDlgWnd, IDC_SCP_PATH_NOTE), FALSE); - } - SetEditboxSubclass(hDlgWnd, IDC_SCP_PATH, FALSE); - - // Send File - if (Param->DropType == DROP_TYPE_SEND_FILE_BINARY) { - SendMessage(GetDlgItem(hDlgWnd, IDC_BINARY_CHECK), BM_SETCHECK, BST_CHECKED, 0); - } - if (!Param->SendfileEnable) { - // \x96\xB3\x8C\xF8\x89\xBB - EnableWindow(GetDlgItem(hDlgWnd, IDC_SENDFILE_RADIO), FALSE); - EnableWindow(GetDlgItem(hDlgWnd, IDC_BINARY_CHECK), FALSE); - } - - // Paste Filename - if (Param->DropTypePaste & DROP_TYPE_PASTE_ESCAPE) { - SendMessage(GetDlgItem(hDlgWnd, IDC_ESCAPE_CHECK), BM_SETCHECK, BST_CHECKED, 0); - } +#include <windowsx.h> +#include <stdio.h> // for _snprintf_s + +#include "tt_res.h" + +#include "i18n.h" +#include "ttlib.h" +#include "dlglib.h" + +struct DrapDropDlgParam { + const TCHAR *TargetFilename; + enum drop_type DropType; + unsigned char DropTypePaste; + bool ScpEnable; + char *ScpSendDirPtr; + int ScpSendDirSize; + bool SendfileEnable; + bool PasteNewlineEnable; + int RemaingFileCount; + bool DoSameProcess; + bool DoSameProcessNextDrop; + bool DoNotShowDialogEnable; + bool DoNotShowDialog; + const char *UILanguageFile; +}; + +struct DrapDropDlgData { + DrapDropDlgParam *Param; +}; + +static LRESULT CALLBACK OnDragDropDlgProc(HWND hDlgWnd, UINT msg, WPARAM wp, LPARAM lp) +{ + static const DlgTextInfo TextInfos[] = { + { 0, "DLG_DANDD_TITLE" }, + { IDC_DAD_STATIC, "DLG_DANDD_TEXT" }, + { IDC_SCP_RADIO, "DLG_DANDD_SCP_RADIO" }, + { IDC_SENDFILE_RADIO, "DLG_DANDD_SENDFILE_RADIO" }, + { IDC_PASTE_RADIO, "DLG_DANDD_PASTE_RADIO" }, + { IDC_SCP_PATH_LABEL, "DLG_DANDD_SCP_DEST_LABEL" }, + { IDC_SCP_PATH_NOTE, "DLG_DANDD_SCP_DEST_NOTE" }, + { IDC_BINARY_CHECK, "DLG_DANDD_SEND_BINARY_CHECK" }, + { IDC_ESCAPE_CHECK, "DLG_DANDD_PASTE_ESCAPE_CHECK" }, + { IDC_SPACE_RADIO, "DLG_DANDD_PASTE_SPACE_RADIO" }, + { IDC_NEWLINE_RADIO, "DLG_DANDD_PASTE_NEWLINE_RADIO" }, + { IDC_SAME_PROCESS_CHECK, "DLG_DANDD_NEXTFILES" }, + { IDC_SAME_PROCESS_NEXTDROP_CHECK, "DLG_DANDD_SAME_NEEXTDROP" }, + { IDC_DONTSHOW_CHECK, "DLG_DANDD_DONTSHOW_NEEXTDROP" }, + { IDC_DAD_NOTE, "DLG_DANDD_NOTE" }, + { IDOK, "BTN_OK" }, + { IDCANCEL, "BTN_CANCEL" }, + }; + DrapDropDlgData *DlgData = (DrapDropDlgData *)GetWindowLongPtr(hDlgWnd, DWLP_USER); + + switch (msg) { + case WM_INITDIALOG: + { + DlgData = (DrapDropDlgData *)malloc(sizeof(DrapDropDlgData)); + SetWindowLongPtr(hDlgWnd, DWLP_USER, (LONG_PTR)DlgData); + DrapDropDlgParam *Param = (DrapDropDlgParam *)lp; + DlgData->Param = Param; + SetDlgTexts(hDlgWnd, TextInfos, _countof(TextInfos), Param->UILanguageFile); + + // target file + SetDlgItemText(hDlgWnd, IDC_FILENAME_EDIT, Param->TargetFilename); + + // checkbox + CheckRadioButton(hDlgWnd, IDC_SCP_RADIO, IDC_PASTE_RADIO, + (Param->DropType == DROP_TYPE_SEND_FILE || + Param->DropType == DROP_TYPE_SEND_FILE_BINARY) ? IDC_SENDFILE_RADIO : + Param->DropType == DROP_TYPE_PASTE_FILENAME ? IDC_PASTE_RADIO : + IDC_SCP_RADIO); + + // SCP + SetDlgItemTextA(hDlgWnd, IDC_SCP_PATH, Param->ScpSendDirPtr); + if (!Param->ScpEnable) { + // \x96\xB3\x8C\xF8\x89\xBB + EnableWindow(GetDlgItem(hDlgWnd, IDC_SCP_RADIO), FALSE); + EnableWindow(GetDlgItem(hDlgWnd, IDC_SCP_PATH_LABEL), FALSE); + EnableWindow(GetDlgItem(hDlgWnd, IDC_SCP_PATH), FALSE); + EnableWindow(GetDlgItem(hDlgWnd, IDC_SCP_PATH_NOTE), FALSE); + } + SetEditboxSubclass(hDlgWnd, IDC_SCP_PATH, FALSE); + + // Send File + if (Param->DropType == DROP_TYPE_SEND_FILE_BINARY) { + SendMessage(GetDlgItem(hDlgWnd, IDC_BINARY_CHECK), BM_SETCHECK, BST_CHECKED, 0); + } + if (!Param->SendfileEnable) { + // \x96\xB3\x8C\xF8\x89\xBB + EnableWindow(GetDlgItem(hDlgWnd, IDC_SENDFILE_RADIO), FALSE); + EnableWindow(GetDlgItem(hDlgWnd, IDC_BINARY_CHECK), FALSE); + } + + // Paste Filename + if (Param->DropTypePaste & DROP_TYPE_PASTE_ESCAPE) { + SendMessage(GetDlgItem(hDlgWnd, IDC_ESCAPE_CHECK), BM_SETCHECK, BST_CHECKED, 0); + } CheckRadioButton(hDlgWnd, IDC_SPACE_RADIO, IDC_NEWLINE_RADIO, - Param->DropTypePaste & DROP_TYPE_PASTE_NEWLINE? - IDC_NEWLINE_RADIO : IDC_SPACE_RADIO); - if (Param->RemaingFileCount < 2) { - EnableWindow(GetDlgItem(hDlgWnd, IDC_SPACE_RADIO), FALSE); - EnableWindow(GetDlgItem(hDlgWnd, IDC_NEWLINE_RADIO), FALSE); - } - - // Do this for the next %d files - char orgmsg[MAX_UIMSG]; - GetDlgItemTextA(hDlgWnd, IDC_SAME_PROCESS_CHECK, orgmsg, sizeof(orgmsg)); - char uimsg[MAX_UIMSG]; - _snprintf_s(uimsg, sizeof(uimsg), _TRUNCATE, orgmsg, Param->RemaingFileCount - 1); - SetDlgItemTextA(hDlgWnd, IDC_SAME_PROCESS_CHECK, uimsg); - if (Param->RemaingFileCount < 2) { - EnableWindow(GetDlgItem(hDlgWnd, IDC_SAME_PROCESS_CHECK), FALSE); - } - - // Dont Show Dialog - if (Param->DoNotShowDialog) { - SendMessage(GetDlgItem(hDlgWnd, IDC_DONTSHOW_CHECK), BM_SETCHECK, BST_CHECKED, 0); - } - if (!Param->DoNotShowDialogEnable) { - EnableWindow(GetDlgItem(hDlgWnd, IDC_DONTSHOW_CHECK), FALSE); - EnableWindow(GetDlgItem(hDlgWnd, IDC_DAD_NOTE), FALSE); - } - - // focus to "SCP dest textbox" or "Cancel" - if (Param->ScpEnable) { - // "SCP" \x97L\x8C\xF8\x8E\x9E\x82\xCD Cancel \x82Ƀt\x83H\x81[\x83J\x83X\x82āA\x8DŏI\x93I\x82\xC9 SCP PATH \x82Ƀt\x83H\x81[\x83J\x83X\x82\xAA - // \x93\x96\x82\xBD\x82\xE9\x82悤\x82ɂ\xB7\x82\xE9\x81B - SetFocus(GetDlgItem(hDlgWnd, IDC_SCP_RADIO)); - } else { - // \x83t\x83H\x81[\x83J\x83X\x82̏\x89\x8A\xFA\x8F\xF3\x91Ԃ\xF0 Cancel \x82ɂ\xB7\x82\xE9\x88ׁA\x82\xB1\x82̎\x9E\x93_\x82ł\xCD IDOK \x82\xC9 - // \x83t\x83H\x81[\x83J\x83X\x82Ă\xE9\x81B\x8C\xE3\x82\xC5 WM_NEXTDLGCTL \x82Ńt\x83H\x81[\x83J\x83X\x82\xAA\x8E\x9F\x82̃{\x83^\x83\x93\x82ɂȂ\xE9\x81B - SetFocus(GetDlgItem(hDlgWnd, IDOK)); - } - // \x83t\x83H\x81[\x83J\x83X\x82\xF0\x8E\x9F\x82̃{\x83^\x83\x93\x82Ɉڂ\xB7 - // SetFocus() \x82Œ\xBC\x90ڃt\x83H\x81[\x83J\x83X\x82Ă\xE9\x82ƃ^\x83u\x83L\x81[\x82̓\xAE\x8D쓙\x82ɖ\xE2\x91肪\x8Fo\x82邽\x82߁A - // \x82\xB1\x82̃\x81\x83b\x83Z\x81[\x83W\x82p\x82\xB7\x82\xE9 - PostMessage(hDlgWnd, WM_NEXTDLGCTL, 0, 0L); - - // TRUE\x82ɂ\xB7\x82\xE9\x82ƃ{\x83^\x83\x93\x82Ƀt\x83H\x81[\x83J\x83X\x82\xAA\x93\x96\x82\xBD\x82\xE7\x82Ȃ\xA2\x81B - return FALSE; - } - - case WM_COMMAND: - { - WORD wID = GET_WM_COMMAND_ID(wp, lp); - const WORD wCMD = GET_WM_COMMAND_CMD(wp, lp); - if (wCMD == BN_DBLCLK && - (wID == IDC_SCP_RADIO || wID == IDC_SENDFILE_RADIO || wID == IDC_PASTE_RADIO)) - { // radio buttons double click - wID = IDOK; - } - if (wCMD == EN_SETFOCUS && wID == IDC_SCP_PATH) { - CheckRadioButton(hDlgWnd, IDC_SCP_RADIO, IDC_PASTE_RADIO, IDC_SCP_RADIO); - } - if (wID == IDC_BINARY_CHECK) { - CheckRadioButton(hDlgWnd, IDC_SCP_RADIO, IDC_PASTE_RADIO, IDC_SENDFILE_RADIO); - } - if (wID == IDC_ESCAPE_CHECK || - wID == IDC_SPACE_RADIO || wID == IDC_NEWLINE_RADIO) - { - CheckRadioButton(hDlgWnd, IDC_SCP_RADIO, IDC_PASTE_RADIO, IDC_PASTE_RADIO); - } - if (wID == IDOK) { - if (IsDlgButtonChecked(hDlgWnd, IDC_SCP_RADIO) == BST_CHECKED) { - // SCP - DlgData->Param->DropType = DROP_TYPE_SCP; - GetDlgItemTextA(hDlgWnd, IDC_SCP_PATH, - DlgData->Param->ScpSendDirPtr, DlgData->Param->ScpSendDirSize); - } else if (IsDlgButtonChecked(hDlgWnd, IDC_SENDFILE_RADIO) == BST_CHECKED) { - // Send File - DlgData->Param->DropType = - (IsDlgButtonChecked(hDlgWnd, IDC_BINARY_CHECK) == BST_CHECKED) ? - DROP_TYPE_SEND_FILE_BINARY : DROP_TYPE_SEND_FILE; - } else /* if (IsDlgButtonChecked(hDlgWnd, IDC_PASTE_RADIO) == BST_CHECKED) */ { - // Paste Filename - DlgData->Param->DropType = DROP_TYPE_PASTE_FILENAME; - DlgData->Param->DropTypePaste = 0; - DlgData->Param->DropTypePaste |= - (IsDlgButtonChecked(hDlgWnd, IDC_ESCAPE_CHECK) == BST_CHECKED) ? - DROP_TYPE_PASTE_ESCAPE : 0; - DlgData->Param->DropTypePaste |= - (IsDlgButtonChecked(hDlgWnd, IDC_NEWLINE_RADIO) == BST_CHECKED) ? - DROP_TYPE_PASTE_NEWLINE : 0; - } + Param->DropTypePaste & DROP_TYPE_PASTE_NEWLINE? + IDC_NEWLINE_RADIO : IDC_SPACE_RADIO); + if (Param->RemaingFileCount < 2) { + EnableWindow(GetDlgItem(hDlgWnd, IDC_SPACE_RADIO), FALSE); + EnableWindow(GetDlgItem(hDlgWnd, IDC_NEWLINE_RADIO), FALSE); + } + + // Do this for the next %d files + char orgmsg[MAX_UIMSG]; + GetDlgItemTextA(hDlgWnd, IDC_SAME_PROCESS_CHECK, orgmsg, sizeof(orgmsg)); + char uimsg[MAX_UIMSG]; + _snprintf_s(uimsg, sizeof(uimsg), _TRUNCATE, orgmsg, Param->RemaingFileCount - 1); + SetDlgItemTextA(hDlgWnd, IDC_SAME_PROCESS_CHECK, uimsg); + if (Param->RemaingFileCount < 2) { + EnableWindow(GetDlgItem(hDlgWnd, IDC_SAME_PROCESS_CHECK), FALSE); + } + + // Dont Show Dialog + if (Param->DoNotShowDialog) { + SendMessage(GetDlgItem(hDlgWnd, IDC_DONTSHOW_CHECK), BM_SETCHECK, BST_CHECKED, 0); + } + if (!Param->DoNotShowDialogEnable) { + EnableWindow(GetDlgItem(hDlgWnd, IDC_DONTSHOW_CHECK), FALSE); + EnableWindow(GetDlgItem(hDlgWnd, IDC_DAD_NOTE), FALSE); + } + + // focus to "SCP dest textbox" or "Cancel" + { + int focus_id; + if (Param->ScpEnable) { + focus_id = IDC_SCP_PATH; + } else { + focus_id = IDCANCEL; + } + PostMessage(hDlgWnd, WM_NEXTDLGCTL, + (WPARAM)GetDlgItem(hDlgWnd, focus_id), TRUE); + } + + // TRUE\x82ɂ\xB7\x82\xE9\x82ƃ{\x83^\x83\x93\x82Ƀt\x83H\x81[\x83J\x83X\x82\xAA\x93\x96\x82\xBD\x82\xE7\x82Ȃ\xA2\x81B + return FALSE; + } + + case WM_COMMAND: + { + WORD wID = GET_WM_COMMAND_ID(wp, lp); + const WORD wCMD = GET_WM_COMMAND_CMD(wp, lp); + if (wCMD == BN_DBLCLK && + (wID == IDC_SCP_RADIO || wID == IDC_SENDFILE_RADIO || wID == IDC_PASTE_RADIO)) + { // radio buttons double click + wID = IDOK; + } + if (wCMD == EN_SETFOCUS && wID == IDC_SCP_PATH) { + CheckRadioButton(hDlgWnd, IDC_SCP_RADIO, IDC_PASTE_RADIO, IDC_SCP_RADIO); + } + if (wID == IDC_BINARY_CHECK) { + CheckRadioButton(hDlgWnd, IDC_SCP_RADIO, IDC_PASTE_RADIO, IDC_SENDFILE_RADIO); + } + if (wID == IDC_ESCAPE_CHECK || + wID == IDC_SPACE_RADIO || wID == IDC_NEWLINE_RADIO) + { + CheckRadioButton(hDlgWnd, IDC_SCP_RADIO, IDC_PASTE_RADIO, IDC_PASTE_RADIO); + } + if (wID == IDOK) { + if (IsDlgButtonChecked(hDlgWnd, IDC_SCP_RADIO) == BST_CHECKED) { + // SCP + DlgData->Param->DropType = DROP_TYPE_SCP; + GetDlgItemTextA(hDlgWnd, IDC_SCP_PATH, + DlgData->Param->ScpSendDirPtr, DlgData->Param->ScpSendDirSize); + } else if (IsDlgButtonChecked(hDlgWnd, IDC_SENDFILE_RADIO) == BST_CHECKED) { + // Send File + DlgData->Param->DropType = + (IsDlgButtonChecked(hDlgWnd, IDC_BINARY_CHECK) == BST_CHECKED) ? + DROP_TYPE_SEND_FILE_BINARY : DROP_TYPE_SEND_FILE; + } else /* if (IsDlgButtonChecked(hDlgWnd, IDC_PASTE_RADIO) == BST_CHECKED) */ { + // Paste Filename + DlgData->Param->DropType = DROP_TYPE_PASTE_FILENAME; + DlgData->Param->DropTypePaste = 0; + DlgData->Param->DropTypePaste |= + (IsDlgButtonChecked(hDlgWnd, IDC_ESCAPE_CHECK) == BST_CHECKED) ? + DROP_TYPE_PASTE_ESCAPE : 0; + DlgData->Param->DropTypePaste |= + (IsDlgButtonChecked(hDlgWnd, IDC_NEWLINE_RADIO) == BST_CHECKED) ? + DROP_TYPE_PASTE_NEWLINE : 0; + } DlgData->Param->DoSameProcess = - (IsDlgButtonChecked(hDlgWnd, IDC_SAME_PROCESS_CHECK) == BST_CHECKED) ? - true : false; - DlgData->Param->DoSameProcessNextDrop = - (IsDlgButtonChecked(hDlgWnd, IDC_SAME_PROCESS_NEXTDROP_CHECK) == BST_CHECKED) ? - true : false; + (IsDlgButtonChecked(hDlgWnd, IDC_SAME_PROCESS_CHECK) == BST_CHECKED) ? + true : false; + DlgData->Param->DoSameProcessNextDrop = + (IsDlgButtonChecked(hDlgWnd, IDC_SAME_PROCESS_NEXTDROP_CHECK) == BST_CHECKED) ? + true : false; DlgData->Param->DoNotShowDialog = - (IsDlgButtonChecked(hDlgWnd, IDC_DONTSHOW_CHECK) == BST_CHECKED) ? - true : false; - } - if (wID == IDCANCEL) { - DlgData->Param->DropType = DROP_TYPE_CANCEL; - } - if (wID == IDOK || wID == IDCANCEL) { -#if 0 - EndDialog(hDlgWnd, wID); -#else - TTEndDialog(hDlgWnd, wID); -#endif - break; - } - return FALSE; - } - case WM_NCDESTROY: - free(DlgData); - break; - - default: - return FALSE; - } - return TRUE; -} - -enum drop_type ShowDropDialogBox( - HINSTANCE hInstance, HWND hWndParent, - const TCHAR *TargetFilename, - enum drop_type DefaultDropType, - int RemaingFileCount, - bool EnableSCP, - bool EnableSendFile, - TTTSet *pts, - unsigned char *DropTypePaste, - bool *DoSameProcess, - bool *DoSameProcessNextDrop, - bool *DoNotShowDialog) -{ - DrapDropDlgParam Param; - Param.TargetFilename = TargetFilename; - Param.DropType = DefaultDropType; - Param.DropTypePaste = *DropTypePaste; - Param.ScpEnable = EnableSCP; - Param.SendfileEnable = EnableSendFile; - Param.PasteNewlineEnable = true; - Param.RemaingFileCount = RemaingFileCount; - Param.DoNotShowDialog = *DoNotShowDialog; - Param.DoNotShowDialogEnable = pts->ConfirmFileDragAndDrop ? false : true, - Param.ScpSendDirPtr = pts->ScpSendDir; - Param.ScpSendDirSize = _countof(pts->ScpSendDir); - Param.UILanguageFile = pts->UILanguageFile; - -#if 0 - int ret = DialogBoxParam( - hInstance, MAKEINTRESOURCE(IDD_DAD_DIALOG), - hWndParent, (DLGPROC)OnDragDropDlgProc, - (LPARAM)&Param); -#else - int ret = TTDialogBoxParam( - hInstance, MAKEINTRESOURCE(IDD_DAD_DIALOG), - hWndParent, (DLGPROC)OnDragDropDlgProc, - (LPARAM)&Param); -#endif - if (ret != IDOK) { - return DROP_TYPE_CANCEL; - } - *DropTypePaste = Param.DropTypePaste; - *DoSameProcess = Param.DoSameProcess; - *DoSameProcessNextDrop = Param.DoSameProcessNextDrop; - *DoNotShowDialog = Param.DoNotShowDialog; - return Param.DropType; -} + (IsDlgButtonChecked(hDlgWnd, IDC_DONTSHOW_CHECK) == BST_CHECKED) ? + true : false; + } + if (wID == IDCANCEL) { + DlgData->Param->DropType = DROP_TYPE_CANCEL; + } + if (wID == IDOK || wID == IDCANCEL) { + TTEndDialog(hDlgWnd, wID); + break; + } + return FALSE; + } + case WM_NCDESTROY: + free(DlgData); + break; + + default: + return FALSE; + } + return TRUE; +} + +enum drop_type ShowDropDialogBox( + HINSTANCE hInstance, HWND hWndParent, + const TCHAR *TargetFilename, + enum drop_type DefaultDropType, + int RemaingFileCount, + bool EnableSCP, + bool EnableSendFile, + TTTSet *pts, + unsigned char *DropTypePaste, + bool *DoSameProcess, + bool *DoSameProcessNextDrop, + bool *DoNotShowDialog) +{ + DrapDropDlgParam Param; + Param.TargetFilename = TargetFilename; + Param.DropType = DefaultDropType; + Param.DropTypePaste = *DropTypePaste; + Param.ScpEnable = EnableSCP; + Param.SendfileEnable = EnableSendFile; + Param.PasteNewlineEnable = true; + Param.RemaingFileCount = RemaingFileCount; + Param.DoNotShowDialog = *DoNotShowDialog; + Param.DoNotShowDialogEnable = pts->ConfirmFileDragAndDrop ? false : true, + Param.ScpSendDirPtr = pts->ScpSendDir; + Param.ScpSendDirSize = _countof(pts->ScpSendDir); + Param.UILanguageFile = pts->UILanguageFile; + + int ret = TTDialogBoxParam( + hInstance, MAKEINTRESOURCE(IDD_DAD_DIALOG), + hWndParent, (DLGPROC)OnDragDropDlgProc, + (LPARAM)&Param); + if (ret != IDOK) { + return DROP_TYPE_CANCEL; + } + *DropTypePaste = Param.DropTypePaste; + *DoSameProcess = Param.DoSameProcess; + *DoSameProcessNextDrop = Param.DoSameProcessNextDrop; + *DoNotShowDialog = Param.DoNotShowDialog; + return Param.DropType; +} Modified: branches/cmake/teraterm/teraterm/sizetip.c =================================================================== --- branches/cmake/teraterm/teraterm/sizetip.c 2019-05-19 15:03:33 UTC (rev 7690) +++ branches/cmake/teraterm/teraterm/sizetip.c 2019-05-19 15:03:52 UTC (rev 7691) @@ -1,33 +1,5 @@ -// Import from PuTTY 0.60 windows/sizetip.c -/* - * PuTTY is copyright 1997-2004 Simon Tatham. - * - * Portions copyright Robert de Bath, Joris van Rantwijk, Delian - * Delchev, Andreas Schultz, Jeroen Massar, Wez Furlong, Nicolas Barry, - * Justin Bradford, Ben Harris, Malcolm Smith, Ahmad Khalifa, Markus - * Kuhn, Colin Watson, Christopher Staite, and CORE SDI S.A. - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation files - * (the "Software"), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, - * publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE - * FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF - * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ -/* - * Copyright (C) 2008-2018 TeraTerm Project +/* + * Copyright (C) 2008-2019 TeraTerm Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -53,6 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +/* original idea from PuTTY 0.60 windows/sizetip.c */ #include "teraterm.h" #include "tttypes.h" @@ -63,90 +36,56 @@ #include <stdio.h> #include <tchar.h> -// -// \x83\x8A\x83T\x83C\x83Y\x83c\x81[\x83\x8B\x83`\x83b\x83v (based on PuTTY sizetip.c) -// -static ATOM tip_class = 0; -static HFONT tip_font; -static COLORREF tip_bg; -static COLORREF tip_text; -static HWND tip_wnd = NULL; +#include "TipWin.h" + +static TipWin *SizeTip; static int tip_enabled = 0; -static LRESULT CALLBACK SizeTipWndProc(HWND hWnd, UINT nMsg, - WPARAM wParam, LPARAM lParam) +/** + * point を + * スクリーンからはみ出している場合、入るように補正する + * NearestMonitor が TRUE のとき、最も近いモニタ + * FALSEのとき、マウスのあるモニタに移動させる + * ディスプレイの端から FrameWidth(pixel) より離れるようにする + */ +static void FixPosFromFrame(POINT *point, int FrameWidth, BOOL NearestMonitor) { + if (HasMultiMonitorSupport()) { + // マルチモニタがサポートされている場合 + HMONITOR hm; + MONITORINFO mi; - switch (nMsg) { - case WM_ERASEBKGND: - return TRUE; - - case WM_PAINT: - { - HBRUSH hbr; - HGDIOBJ holdbr; - RECT cr; - int wtlen; - LPTSTR wt; - HDC hdc; - - PAINTSTRUCT ps; - hdc = BeginPaint(hWnd, &ps); - - SelectObject(hdc, tip_font); - SelectObject(hdc, GetStockObject(BLACK_PEN)); - - hbr = CreateSolidBrush(tip_bg); - holdbr = SelectObject(hdc, hbr); - - GetClientRect(hWnd, &cr); - Rectangle(hdc, cr.left, cr.top, cr.right, cr.bottom); - - wtlen = GetWindowTextLength(hWnd); - wt = (LPTSTR) malloc((wtlen + 1) * sizeof(TCHAR)); - GetWindowText(hWnd, wt, wtlen + 1); - - SetTextColor(hdc, tip_text); - SetBkColor(hdc, tip_bg); - - TextOut(hdc, cr.left + 3, cr.top + 3, wt, wtlen); - - free(wt); - - SelectObject(hdc, holdbr); - DeleteObject(hbr); - - EndPaint(hWnd, &ps); + hm = MonitorFromPoint(*point, MONITOR_DEFAULTTONULL); + if (hm == NULL) { + if (NearestMonitor) { + // 最も近いモニタに表示する + hm = MonitorFromPoint(*point, MONITOR_DEFAULTTONEAREST); + } else { + // スクリーンからはみ出している場合はマウスのあるモニタに表示する + GetCursorPos(point); + hm = MonitorFromPoint(*point, MONITOR_DEFAULTTONEAREST); } - return 0; + } - case WM_NCHITTEST: - return HTTRANSPARENT; - - case WM_DESTROY: - DeleteObject(tip_font); - tip_font = NULL; - break; - - case WM_SETTEXT: - { - LPCTSTR str = (LPCTSTR) lParam; - SIZE sz; - HDC hdc = CreateCompatibleDC(NULL); - - SelectObject(hdc, tip_font); - GetTextExtentPoint32(hdc, str, (int)_tcslen(str), &sz); - - SetWindowPos(hWnd, NULL, 0, 0, sz.cx + 6, sz.cy + 6, - SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE); - InvalidateRect(hWnd, NULL, FALSE); - - DeleteDC(hdc); - } - break; + mi.cbSize = sizeof(MONITORINFO); + GetMonitorInfo(hm, &mi); + if (point->x < mi.rcMonitor.left + FrameWidth) { + point->x = mi.rcMonitor.left + FrameWidth; + } + if (point->y < mi.rcMonitor.top + FrameWidth) { + point->y = mi.rcMonitor.top + FrameWidth; + } } - - return DefWindowProc(hWnd, nMsg, wParam, lParam); + else + { + // マルチモニタがサポートされていない場合 + if (point->x < FrameWidth) { + point->x = FrameWidth; + } + if (point->y < FrameWidth) { + point->y = FrameWidth; + } + } } void UpdateSizeTip(HWND src, int cx, int cy) @@ -156,130 +95,34 @@ if (!tip_enabled) return; - if (!tip_wnd) { - NONCLIENTMETRICS nci; - - /* First make sure the window class is registered */ - - if (!tip_class) { - WNDCLASS wc; - wc.style = CS_HREDRAW | CS_VREDRAW; - wc.lpfnWndProc = SizeTipWndProc; - wc.cbClsExtra = 0; - wc.cbWndExtra = 0; - wc.hInstance = hInst; - wc.hIcon = NULL; - wc.hCursor = NULL; - wc.hbrBackground = NULL; - wc.lpszMenuName = NULL; - wc.lpszClassName = _T("SizeTipClass"); - - tip_class = RegisterClass(&wc); - } -#if 0 - /* Default values based on Windows Standard color scheme */ - - tip_font = GetStockObject(SYSTEM_FONT); - tip_bg = RGB(255, 255, 225); - tip_text = RGB(0, 0, 0); -#endif - - /* Prepare other GDI objects and drawing info */ - - tip_bg = GetSysColor(COLOR_INFOBK); - tip_text = GetSysColor(COLOR_INFOTEXT); - - memset(&nci, 0, sizeof(NONCLIENTMETRICS)); - nci.cbSize = sizeof(NONCLIENTMETRICS); - SystemParametersInfo(SPI_GETNONCLIENTMETRICS, - sizeof(NONCLIENTMETRICS), &nci, 0); - tip_font = CreateFontIndirect(&nci.lfStatusFont); - } - /* Generate the tip text */ _stprintf_s(str, _countof(str), _T("%dx%d"), cx, cy); - if (!tip_wnd) { - HDC hdc; - SIZE sz; + if (SizeTip == NULL) { RECT wr; - int ix, iy; - HMONITOR hm; - - /* calculate the tip's size */ - - hdc = CreateCompatibleDC(NULL); - GetTextExtentPoint32(hdc, str, (int)_tcslen(str), &sz); - DeleteDC(hdc); - + POINT point; + // ウィンドウの位置を取得 GetWindowRect(src, &wr); - - ix = wr.left; - iy = wr.top - sz.cy; - - if (HasMultiMonitorSupport()) { - // \x83}\x83\x8B\x83`\x83\x82\x83j\x83^\x82\xAA\x83T\x83|\x81[\x83g\x82\xB3\x82\xEA\x82Ă\xA2\x82\xE9\x8Fꍇ - POINT p; - MONITORINFO mi; - - p.x = ix; - p.y = iy; - - hm = MonitorFromPoint(p, MONITOR_DEFAULTTONULL); - - if (hm == NULL) { -#if 1 - // \x83c\x81[\x83\x8B\x83`\x83b\x83v\x82\xAA\x83X\x83N\x83\x8A\x81[\x83\x93\x82\xA9\x82\xE7\x82͂ݏo\x82\xB5\x82Ă\xA2\x82\xE9\x8Fꍇ\x82̓}\x83E\x83X\x82̂\xA0\x82郂\x83j\x83^\x82ɕ\\x8E\xA6\x82\xB7\x82\xE9 - GetCursorPos(&p); - hm = MonitorFromPoint(p, MONITOR_DEFAULTTONEAREST); -#else - // \x83c\x81[\x83\x8B\x83`\x83b\x83v\x82\xAA\x83X\x83N\x83\x8A\x81[\x83\x93\x82\xA9\x82\xE7\x82͂ݏo\x82\xB5\x82Ă\xA2\x82\xE9\x8Fꍇ\x82͍ł\xE0\x8B߂\xA2\x83\x82\x83j\x83^\x82ɕ\\x8E\xA6\x82\xB7\x82\xE9 - hm = MonitorFromPoint(p, MONITOR_DEFAULTTONEAREST); -#endif - } - - mi.cbSize = sizeof(MONITORINFO); - GetMonitorInfo(hm, &mi); - if (ix < mi.rcMonitor.left + 16) { - ix = mi.rcMonitor.left + 16; - } - if (iy < mi.rcMonitor.top + 16) { - iy = mi.rcMonitor.top + 16; - } - } - else { - // \x83}\x83\x8B\x83`\x83\x82\x83j\x83^\x82\xAA\x83T\x83|\x81[\x83g\x82\xB3\x82\xEA\x82Ă\xA2\x82Ȃ\xA2\x8Fꍇ - if (ix < 16) { - ix = 16; - } - if (iy < 16) { - iy = 16; - } - } - - /* Create the tip window */ - - tip_wnd = - CreateWindowEx(WS_EX_TOOLWINDOW | WS_EX_TOPMOST, - MAKEINTRESOURCE(tip_class), str, WS_POPUP, ix, - iy, sz.cx, sz.cy, NULL, NULL, hInst, NULL); - - ShowWindow(tip_wnd, SW_SHOWNOACTIVATE); - + // sizetipを出す位置は、ウィンドウ左上-(8,16) + point.x = wr.left - 16; + point.y = wr.top - 8; + FixPosFromFrame(&point, 16, FALSE); + cx = point.x; + cy = point.y; + SizeTip = TipWinCreate(src, cx, cy, str); } else { - /* Tip already exists, just set the text */ - - SetWindowText(tip_wnd, str); + TipWinSetText(SizeTip, str); + //SetWindowText(tip_wnd, str); } } void EnableSizeTip(int bEnable) { - if (tip_wnd && !bEnable) { - DestroyWindow(tip_wnd); - tip_wnd = NULL; + if (SizeTip && !bEnable) { + TipWinDestroy(SizeTip); + SizeTip = NULL; } tip_enabled = bEnable; Modified: branches/cmake/teraterm/teraterm/teraterm.cpp =================================================================== --- branches/cmake/teraterm/teraterm/teraterm.cpp 2019-05-19 15:03:33 UTC (rev 7690) +++ branches/cmake/teraterm/teraterm/teraterm.cpp 2019-05-19 15:03:52 UTC (rev 7691) @@ -54,50 +54,12 @@ -typedef struct { - const TCHAR *FaceName; - bool found; -} EnumFontInfo; - -static int CALLBACK EnumFontExProc( - ENUMLOGFONT* lpelf, NEWTEXTMETRIC* lpntm, - int nFontType, LPARAM lParam) -{ - EnumFontInfo *info = (EnumFontInfo *)lParam; - if (nFontType == DEVICE_FONTTYPE) { - // \x90ڑ\xB1\x82\xB3\x82ꂽ\x83f\x83o\x83C\x83X(\x83v\x83\x8A\x83\x93\x83^\x82Ȃ\xC7)\x93\xE0\x82̃t\x83H\x83\x93\x83g - return 1; - } - const TCHAR *FaceName = lpelf->elfLogFont.lfFaceName; - if (_tcscmp(info->FaceName, FaceName) == 0) { - info->found = true; - return 0; - } - return 1; -} - -BOOL isExistFont(const TCHAR *FaceName) -{ - HDC hDC = GetDC(NULL); - LOGFONT lf; - memset(&lf, 0, sizeof(lf)); - lf.lfCharSet = DEFAULT_CHARSET;// SHIFTJIS_CHARSET; - lf.lfPitchAndFamily = 0; - - EnumFontInfo info; - info.FaceName = FaceName; - info.found = false; - EnumFontFamiliesEx(hDC, &lf, (FONTENUMPROC)EnumFontExProc, (LPARAM)&info, 0); - ReleaseDC(NULL, hDC); - return info.found; -} - static BOOL AddFontFlag; static TCHAR TSpecialFont[MAX_PATH]; static void LoadSpecialFont() { - if (!isExistFont(_T("Tera Special"))) { + if (!IsExistFontA("Tera Special", SYMBOL_CHARSET, TRUE)) { int r; if (GetModuleFileName(NULL, TSpecialFont,_countof(TSpecialFont)) == 0) { @@ -135,6 +97,9 @@ static void init() { +#ifdef _DEBUG + ::_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); +#endif DLLInit(); WinCompatInit(); if (pSetThreadDpiAwarenessContext) { Modified: branches/cmake/teraterm/teraterm/ttermpro.v10.vcxproj =================================================================== --- branches/cmake/teraterm/teraterm/ttermpro.v10.vcxproj 2019-05-19 15:03:33 UTC (rev 7690) +++ branches/cmake/teraterm/teraterm/ttermpro.v10.vcxproj 2019-05-19 15:03:52 UTC (rev 7691) @@ -79,7 +79,7 @@ <AdditionalIncludeDirectories>$(SolutionDir)common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> </ResourceCompile> <Link> - <AdditionalDependencies>ws2_32.lib;imm32.lib;imagehlp.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalDependencies>ws2_32.lib;imagehlp.lib;%(AdditionalDependencies)</AdditionalDependencies> <SuppressStartupBanner>true</SuppressStartupBanner> <AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <DelayLoadDLLs>imagehlp.dll;user32.dll;shell32.dll;%(DelayLoadDLLs)</DelayLoadDLLs> @@ -120,7 +120,7 @@ <AdditionalIncludeDirectories>$(SolutionDir)common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> </ResourceCompile> <Link> - <AdditionalDependencies>ws2_32.lib;imm32.lib;imagehlp.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalDependencies>ws2_32.lib;imagehlp.lib;%(AdditionalDependencies)</AdditionalDependencies> <SuppressStartupBanner>true</SuppressStartupBanner> <AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <DelayLoadDLLs>imagehlp.dll;user32.dll;shell32.dll;%(DelayLoadDLLs)</DelayLoadDLLs> @@ -133,31 +133,33 @@ </Manifest> </ItemDefinitionGroup> <ItemGroup> - <ClCompile Include="addsetting.cpp" /> - <ClCompile Include="..\common\win16api.c" /> <ClCompile Include="..\common\dlglib.c" /> - <ClCompile Include="filesys.cpp" /> - <ClCompile Include="ftdlg.cpp" /> - <ClCompile Include="prnabort.cpp" /> - <ClCompile Include="protodlg.cpp" /> <ClCompile Include="..\common\stdafx.cpp" /> - <ClCompile Include="tekwin.cpp" /> - <ClCompile Include="teraprn.cpp" /> - <ClCompile Include="teraterm.cpp" /> - <ClCompile Include="vtwin.cpp" /> + <ClCompile Include="..\common\ttlib.c" /> + <ClCompile Include="..\common\win16api.c" /> + <ClCompile Include="..\common\codeconv.cpp" /> + <ClCompile Include="..\common\dllutil.cpp" /> + <ClCompile Include="..\common\compat_win.cpp" /> + <ClCompile Include="addsetting.cpp" /> <ClCompile Include="buffer.c" /> <ClCompile Include="clipboar.c" /> <ClCompile Include="commlib.c" /> <ClCompile Include="dnddlg.cpp" /> + <ClCompile Include="filesys.cpp" /> + <ClCompile Include="ftdlg.cpp" /> <ClCompile Include="keyboard.c" /> <ClCompile Include="sizetip.c" /> + <ClCompile Include="prnabort.cpp" /> + <ClCompile Include="protodlg.cpp" /> <ClCompile Include="teklib.c" /> + <ClCompile Include="tekwin.cpp" /> <ClCompile Include="telnet.c" /> + <ClCompile Include="teraprn.cpp" /> + <ClCompile Include="teraterm.cpp" /> <ClCompile Include="ttdde.c" /> <ClCompile Include="ttdialog.c" /> <ClCompile Include="ttfileio.c" /> <ClCompile Include="ttime.c" /> - <ClCompile Include="..\common\ttlib.c" /> <ClCompile Include="ttplug.c" /> <ClCompile Include="ttsetup.c" /> <ClCompile Include="ttwinman.c" /> @@ -164,6 +166,7 @@ <ClCompile Include="ttwsk.c" /> <ClCompile Include="vtdisp.c" /> <ClCompile Include="vtterm.c" /> + <ClCompile Include="vtwin.cpp" /> <ClCompile Include="winjump.c" /> <ClCompile Include="WSAAsyncGetAddrInfo.c" /> </ItemGroup> Modified: branches/cmake/teraterm/teraterm/ttermpro.v11.vcxproj =================================================================== --- branches/cmake/teraterm/teraterm/ttermpro.v11.vcxproj 2019-05-19 15:03:33 UTC (rev 7690) +++ branches/cmake/teraterm/teraterm/ttermpro.v11.vcxproj 2019-05-19 15:03:52 UTC (rev 7691) @@ -77,7 +77,7 @@ <AdditionalIncludeDirectories>$(SolutionDir)common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> </ResourceCompile> <Link> - <AdditionalDependencies>ws2_32.lib;imm32.lib;imagehlp.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalDependencies>ws2_32.lib;imagehlp.lib;%(AdditionalDependencies)</AdditionalDependencies> <SuppressStartupBanner>true</SuppressStartupBanner> <AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <DelayLoadDLLs>imagehlp.dll;user32.dll;shell32.dll;%(DelayLoadDLLs)</DelayLoadDLLs> @@ -117,7 +117,7 @@ <AdditionalIncludeDirectories>$(SolutionDir)common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> </ResourceCompile> <Link> - <AdditionalDependencies>ws2_32.lib;imm32.lib;imagehlp.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalDependencies>ws2_32.lib;imagehlp.lib;%(AdditionalDependencies)</AdditionalDependencies> <SuppressStartupBanner>true</SuppressStartupBanner> <AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <DelayLoadDLLs>imagehlp.dll;user32.dll;shell32.dll;%(DelayLoadDLLs)</DelayLoadDLLs> @@ -130,31 +130,33 @@ </Manifest> </ItemDefinitionGroup> <ItemGroup> - <ClCompile Include="addsetting.cpp" /> - <ClCompile Include="..\common\win16api.c" /> <ClCompile Include="..\common\dlglib.c" /> - <ClCompile Include="filesys.cpp" /> - <ClCompile Include="ftdlg.cpp" /> - <ClCompile Include="prnabort.cpp" /> - <ClCompile Include="protodlg.cpp" /> <ClCompile Include="..\common\stdafx.cpp" /> - <ClCompile Include="tekwin.cpp" /> - <ClCompile Include="teraprn.cpp" /> - <ClCompile Include="teraterm.cpp" /> - <ClCompile Include="vtwin.cpp" /> + <ClCompile Include="..\common\ttlib.c" /> + <ClCompile Include="..\common\win16api.c" /> + <ClCompile Include="..\common\codeconv.cpp" /> + <ClCompile Include="..\common\dllutil.cpp" /> + <ClCompile Include="..\common\compat_win.cpp" /> + <ClCompile Include="addsetting.cpp" /> <ClCompile Include="buffer.c" /> <ClCompile Include="clipboar.c" /> <ClCompile Include="commlib.c" /> <ClCompile Include="dnddlg.cpp" /> + <ClCompile Include="filesys.cpp" /> + <ClCompile Include="ftdlg.cpp" /> <ClCompile Include="keyboard.c" /> <ClCompile Include="sizetip.c" /> + <ClCompile Include="prnabort.cpp" /> + <ClCompile Include="protodlg.cpp" /> <ClCompile Include="teklib.c" /> + <ClCompile Include="tekwin.cpp" /> <ClCompile Include="telnet.c" /> + <ClCompile Include="teraprn.cpp" /> + <ClCompile Include="teraterm.cpp" /> <ClCompile Include="ttdde.c" /> <ClCompile Include="ttdialog.c" /> <ClCompile Include="ttfileio.c" /> <ClCompile Include="ttime.c" /> - <ClCompile Include="..\common\ttlib.c" /> <ClCompile Include="ttplug.c" /> <ClCompile Include="ttsetup.c" /> <ClCompile Include="ttwinman.c" /> @@ -161,6 +163,7 @@ <ClCompile Include="ttwsk.c" /> <ClCompile Include="vtdisp.c" /> <ClCompile Include="vtterm.c" /> + <ClCompile Include="vtwin.cpp" /> <ClCompile Include="winjump.c" /> <ClCompile Include="WSAAsyncGetAddrInfo.c" /> </ItemGroup> Modified: branches/cmake/teraterm/teraterm/ttermpro.v12.vcxproj =================================================================== --- branches/cmake/teraterm/teraterm/ttermpro.v12.vcxproj 2019-05-19 15:03:33 UTC (rev 7690) +++ branches/cmake/teraterm/teraterm/ttermpro.v12.vcxproj 2019-05-19 15:03:52 UTC (rev 7691) @@ -77,7 +77,7 @@ <AdditionalIncludeDirectories>$(SolutionDir)common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> </ResourceCompile> <Link> - <AdditionalDependencies>nafxcwd.lib;LIBCMTD.lib;ws2_32.lib;imm32.lib;imagehlp.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalDependencies>nafxcwd.lib;LIBCMTD.lib;ws2_32.lib;imagehlp.lib;%(AdditionalDependencies)</AdditionalDependencies> <SuppressStartupBanner>true</SuppressStartupBanner> <AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <DelayLoadDLLs>imagehlp.dll;user32.dll;shell32.dll;%(DelayLoadDLLs)</DelayLoadDLLs> @@ -118,7 +118,7 @@ <AdditionalIncludeDirectories>$(SolutionDir)common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> </ResourceCompile> <Link> - <AdditionalDependencies>nafxcw.lib;LIBCMT.lib;ws2_32.lib;imm32.lib;imagehlp.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalDependencies>nafxcw.lib;LIBCMT.lib;ws2_32.lib;imagehlp.lib;%(AdditionalDependencies)</AdditionalDependencies> <SuppressStartupBanner>true</SuppressStartupBanner> <AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <DelayLoadDLLs>imagehlp.dll;user32.dll;shell32.dll;%(DelayLoadDLLs)</DelayLoadDLLs> @@ -136,6 +136,9 @@ <ClCompile Include="..\common\stdafx.cpp" /> <ClCompile Include="..\common\ttlib.c" /> <ClCompile Include="..\common\win16api.c" /> + <ClCompile Include="..\common\codeconv.cpp" /> + <ClCompile Include="..\common\dllutil.cpp" /> + <ClCompile Include="..\common\compat_win.cpp" /> <ClCompile Include="addsetting.cpp" /> <ClCompile Include="buffer.c" /> <ClCompile Include="clipboar.c" /> Modified: branches/cmake/teraterm/teraterm/ttermpro.v14.vcxproj =================================================================== --- branches/cmake/teraterm/teraterm/ttermpro.v14.vcxproj 2019-05-19 15:03:33 UTC (rev 7690) +++ branches/cmake/teraterm/teraterm/ttermpro.v14.vcxproj 2019-05-19 15:03:52 UTC (rev 7691) @@ -79,7 +79,7 @@ <AdditionalIncludeDirectories>$(SolutionDir)common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> </ResourceCompile> <Link> - <AdditionalDependencies>nafxcwd.lib;LIBCMTD.lib;ws2_32.lib;imm32.lib;imagehlp.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalDependencies>nafxcwd.lib;LIBCMTD.lib;ws2_32.lib;imagehlp.lib;%(AdditionalDependencies)</AdditionalDependencies> <SuppressStartupBanner>true</SuppressStartupBanner> <AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <DelayLoadDLLs>imagehlp.dll;user32.dll;shell32.dll;%(DelayLoadDLLs)</DelayLoadDLLs> @@ -120,7 +120,7 @@ <AdditionalIncludeDirectories>$(SolutionDir)common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> </ResourceCompile> <Link> - <AdditionalDependencies>nafxcw.lib;LIBCMT.lib;ws2_32.lib;imm32.lib;imagehlp.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalDependencies>nafxcw.lib;LIBCMT.lib;ws2_32.lib;imagehlp.lib;%(AdditionalDependencies)</AdditionalDependencies> <SuppressStartupBanner>true</SuppressStartupBanner> <AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <DelayLoadDLLs>imagehlp.dll;user32.dll;shell32.dll;%(DelayLoadDLLs)</DelayLoadDLLs> @@ -138,6 +138,9 @@ <ClCompile Include="..\common\stdafx.cpp" /> <ClCompile Include="..\common\ttlib.c" /> <ClCompile Include="..\common\win16api.c" /> + <ClCompile Include="..\common\codeconv.cpp" /> + <ClCompile Include="..\common\dllutil.cpp" /> + <ClCompile Include="..\common\compat_win.cpp" /> <ClCompile Include="addsetting.cpp" /> <ClCompile Include="buffer.c" /> <ClCompile Include="clipboar.c" /> Modified: branches/cmake/teraterm/teraterm/ttermpro.v15.vcxproj =================================================================== --- branches/cmake/teraterm/teraterm/ttermpro.v15.vcxproj 2019-05-19 15:03:33 UTC (rev 7690) +++ branches/cmake/teraterm/teraterm/ttermpro.v15.vcxproj 2019-05-19 15:03:52 UTC (rev 7691) @@ -15,7 +15,6 @@ <RootNamespace>ttermpro</RootNamespace> <Keyword>MFCProj</Keyword> <ProjectName>ttermpro</ProjectName> - <WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion> </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> @@ -81,7 +80,7 @@ <AdditionalIncludeDirectories>$(SolutionDir)common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> </ResourceCompile> <Link> - <AdditionalDependencies>nafxcwd.lib;LIBCMTD.lib;ws2_32.lib;imm32.lib;imagehlp.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalDependencies>nafxcwd.lib;LIBCMTD.lib;ws2_32.lib;imagehlp.lib;%(AdditionalDependencies)</AdditionalDependencies> <SuppressStartupBanner>true</SuppressStartupBanner> <AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <DelayLoadDLLs>imagehlp.dll;user32.dll;shell32.dll;%(DelayLoadDLLs)</DelayLoadDLLs> @@ -123,7 +122,7 @@ <AdditionalIncludeDirectories>$(SolutionDir)common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> </ResourceCompile> <Link> - <AdditionalDependencies>nafxcw.lib;LIBCMT.lib;ws2_32.lib;imm32.lib;imagehlp.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalDependencies>nafxcw.lib;LIBCMT.lib;ws2_32.lib;imagehlp.lib;%(AdditionalDependencies)</AdditionalDependencies> <SuppressStartupBanner>true</SuppressStartupBanner> <AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <DelayLoadDLLs>imagehlp.dll;user32.dll;shell32.dll;%(DelayLoadDLLs)</DelayLoadDLLs> @@ -142,6 +141,9 @@ <ClCompile Include="..\common\stdafx.cpp" /> <ClCompile Include="..\common\ttlib.c" /> <ClCompile Include="..\common\win16api.c" /> + <ClCompile Include="..\common\codeconv.cpp" /> + <ClCompile Include="..\common\dllutil.cpp" /> + <ClCompile Include="..\common\compat_win.cpp" /> <ClCompile Include="addsetting.cpp" /> <ClCompile Include="buffer.c" /> <ClCompile Include="clipboar.c" /> @@ -263,4 +265,4 @@ <UserProperties RESOURCE_FILE="ttermpro.rc" /> </VisualStudio> </ProjectExtensions> -</Project> \ No newline at end of file +</Project> Modified: branches/cmake/teraterm/teraterm/ttermpro.v9.vcproj =================================================================== --- branches/cmake/teraterm/teraterm/ttermpro.v9.vcproj 2019-05-19 15:03:33 UTC (rev 7690) +++ branches/cmake/teraterm/teraterm/ttermpro.v9.vcproj 2019-05-19 15:03:52 UTC (rev 7691) @@ -72,7 +72,7 @@ /> <Tool Name="VCLinkerTool" - AdditionalDependencies="ws2_32.lib imm32.lib imagehlp.lib" + AdditionalDependencies="ws2_32.lib imagehlp.lib" LinkIncremental="1" SuppressStartupBanner="true" AdditionalLibraryDirectories="$(OutDir)" @@ -164,7 +164,7 @@ /> <Tool Name="VCLinkerTool" - AdditionalDependencies="ws2_32.lib imm32.lib imagehlp.lib" + AdditionalDependencies="ws2_32.lib imagehlp.lib" LinkIncremental="1" SuppressStartupBanner="true" AdditionalLibraryDirectories="$(OutDir)" @@ -388,6 +388,18 @@ RelativePath="..\common\win16api.c" > </File> + <File + RelativePath="..\common\compat_win.cpp" + > + </File> + <File + RelativePath="..\common\dllutil.cpp" + > + </File> + <File + RelativePath="..\common\codeconv.cpp" + > + </File> </Filter> <Filter Name="Header Files" Modified: branches/cmake/teraterm/teraterm/ttermpro.vcproj =================================================================== --- branches/cmake/teraterm/teraterm/ttermpro.vcproj 2019-05-19 15:03:33 UTC (rev 7690) +++ branches/cmake/teraterm/teraterm/ttermpro.vcproj 2019-05-19 15:03:52 UTC (rev 7691) @@ -71,7 +71,7 @@ /> <Tool Name="VCLinkerTool" - AdditionalDependencies="ws2_32.lib imm32.lib imagehlp.lib" + AdditionalDependencies="ws2_32.lib imagehlp.lib" LinkIncremental="1" SuppressStartupBanner="true" AdditionalLibraryDirectories="$(OutDir)" @@ -164,7 +164,7 @@ /> <Tool Name="VCLinkerTool" - AdditionalDependencies="ws2_32.lib imm32.lib imagehlp.lib" + AdditionalDependencies="ws2_32.lib imagehlp.lib" LinkIncremental="1" SuppressStartupBanner="true" AdditionalLibraryDirectories="$(OutDir)" @@ -405,6 +405,10 @@ RelativePath="..\common\codeconv.cpp" > </File> + <File + RelativePath="..\common\tipwin.cpp" + > + </File> </Filter> <Filter Name="Header Files" Modified: branches/cmake/teraterm/teraterm/ttime.c =================================================================== --- branches/cmake/teraterm/teraterm/ttime.c 2019-05-19 15:03:33 UTC (rev 7690) +++ branches/cmake/teraterm/teraterm/ttime.c 2019-05-19 15:03:52 UTC (rev 7691) @@ -500,6 +500,7 @@ HWND hWnd, const char *str_ptr, size_t str_count, size_t cx, size_t *st_size_) { + if (HIMEDLL != NULL) return NULL; assert(IsWindowUnicode(hWnd) == FALSE); return CreateReconvStringSt(hWnd, FALSE, str_ptr, str_count, cx, st_size_); } @@ -519,6 +520,7 @@ HWND hWnd, const wchar_t *str_ptr, size_t str_count, size_t cx, size_t *st_size_) { + if (HIMEDLL == NULL) return NULL; assert(IsWindowUnicode(hWnd) == TRUE); return CreateReconvStringSt(hWnd, TRUE, str_ptr, str_count, cx, st_size_); } Modified: branches/cmake/teraterm/teraterm/vtwin.cpp =================================================================== --- branches/cmake/teraterm/teraterm/vtwin.cpp 2019-05-19 15:03:33 UTC (rev 7690) +++ branches/cmake/teraterm/teraterm/vtwin.cpp 2019-05-19 15:03:52 UTC (rev 7691) @@ -3214,7 +3214,6 @@ char buf[512]; // \x8EQ\x8Fƕ\xB6\x8E\x9A\x97\xF1\x82\xF0\x8E\xE6\x82\xE9\x83o\x83b\x83t\x83@ size_t str_len_count; int cx; - assert(IsWindowUnicode(hWnd) == FALSE); // \x8EQ\x8Fƕ\xB6\x8E\x9A\x97\xF1\x8E擾\x81A1\x8Ds\x8E\xE6\x82\xE8\x8Fo\x82\xB7 { // \x83J\x81[\x83\\x83\x8B\x82\xA9\x82\xE7\x8C\xE3\x82\xEB\x81A\x83X\x83y\x81[\x83X\x88ȊO\x82\xAA\x8C\xA9\x82\xA9\x82\xC1\x82\xBD\x82Ƃ\xB1\x82\xEB\x82\xF0\x8Ds\x96\x96\x82Ƃ\xB7\x82\xE9 @@ -3235,9 +3234,19 @@ if (pReconvPtrSave != NULL) { free(pReconvPtrSave); } +#if defined(UNICODE) +#if 0 + // TODO: buf\x82\xCDwchar_t + pReconvPtrSave = (RECONVERTSTRING *)CreateReconvStringStW( + hWnd, buf, str_len_count, cx, &ReconvSizeSave); +#else + pReconvPtrSave = NULL; + ReconvSizeSave = 0; +#endif +#else pReconvPtrSave = (RECONVERTSTRING *)CreateReconvStringStA( hWnd, buf, str_len_count, cx, &ReconvSizeSave); - +#endif // 1\x89\xF1\x96ڂ̓T\x83C\x83Y\x82\xBE\x82\xAF\x82\xF0\x95Ԃ\xB7 result = ReconvSizeSave; } Modified: branches/cmake/teraterm/ttpdlg/CMakeLists.txt =================================================================== --- branches/cmake/teraterm/ttpdlg/CMakeLists.txt 2019-05-19 15:03:33 UTC (rev 7690) +++ branches/cmake/teraterm/ttpdlg/CMakeLists.txt 2019-05-19 15:03:52 UTC (rev 7691) @@ -13,6 +13,7 @@ set(COMMON_SRC ../common/dlglib.c ../common/dlglib.h + ../common/dlglib_tmpl.cpp ../common/ttlib.c ../common/ttlib.h ../common/teraterm.ico Modified: branches/cmake/ttpmenu/CMakeLists.txt =================================================================== --- branches/cmake/ttpmenu/CMakeLists.txt 2019-05-19 15:03:33 UTC (rev 7690) +++ branches/cmake/ttpmenu/CMakeLists.txt 2019-05-19 15:03:52 UTC (rev 7691) @@ -25,6 +25,7 @@ ttpmenu.cpp # ttpmenu.rc + # left.ico right.ico teraterm.ico Modified: branches/cmake/ttssh2/ttxssh/CMakeLists.txt =================================================================== --- branches/cmake/ttssh2/ttxssh/CMakeLists.txt 2019-05-19 15:03:33 UTC (rev 7690) +++ branches/cmake/ttssh2/ttxssh/CMakeLists.txt 2019-05-19 15:03:52 UTC (rev 7691) @@ -21,6 +21,8 @@ ../../teraterm/common/servicenames.h ../../teraterm/common/codeconv.cpp ../../teraterm/common/codeconv.h + ../../teraterm/common/tipwin.cpp + ../../teraterm/common/tipwin.h ) source_group( Modified: branches/cmake/ttssh2/ttxssh/auth.c =================================================================== --- branches/cmake/ttssh2/ttxssh/auth.c 2019-05-19 15:03:33 UTC (rev 7690) +++ branches/cmake/ttssh2/ttxssh/auth.c 2019-05-19 15:03:52 UTC (rev 7691) @@ -44,6 +44,7 @@ #include "resource.h" #include "keyfiles.h" #include "libputty.h" +#include "tipwin.h" #define AUTH_START_USER_AUTH_ON_ERROR_END 1 @@ -90,6 +91,7 @@ IDC_SSHUSERHOSTS, IDC_SSHUSETIS, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, IDC_SSHUSEPAGEANT, -1 }; +static TipWin *tipwin; LRESULT CALLBACK password_wnd_proc(HWND control, UINT msg, WPARAM wParam, LPARAM lParam) @@ -97,12 +99,39 @@ switch (msg) { case WM_CHAR: if ((GetKeyState(VK_CONTROL) & 0x8000) != 0) { - char chars[] = { (char) wParam, 0 }; + TCHAR chars[] = { (TCHAR) wParam, 0 }; SendMessage(control, EM_REPLACESEL, (WPARAM) TRUE, - (LPARAM) (char *) chars); + (LPARAM) (TCHAR *) chars); + + if (tipwin == NULL) { + TCHAR *s; + RECT rect; + if (wParam == 'V' - 'A' + 1) { + s = _T("\x90\xA7\x8C䕶\x8E\x9A\x82\xF0\x93\xFC\x97͂\xB5\x82Ă\xA2\x82܂\xB7") + _T("\n") + _T("\x83N\x83\x8A\x83b\x83v\x83{\x81[\x83h\x82\xA9\x82\xE7\x82̓\\x82\xE8\x95t\x82\xAF\x82̃V\x83\x87\x81[\x83g\x83J\x83b\x83g\x82\xCDCTRL+Insert\x82ł\xB7"); + } else { + s = _T("\x90\xA7\x8C䕶\x8E\x9A\x82\xF0\x93\xFC\x97͂\xB5\x82Ă\xA2\x82܂\xB7"); + } + GetWindowRect(control, &rect); + tipwin = TipWinCreate(control, rect.left, rect.bottom, s); + } + return 0; + } else { + if (tipwin != NULL) { + TipWinDestroy(tipwin); + tipwin = NULL; + } } + break; + case WM_NCDESTROY: + if (tipwin != NULL) { + TipWinDestroy(tipwin); + tipwin = NULL; + } + break; } return CallWindowProc((WNDPROC) GetWindowLongPtr(control, GWLP_USERDATA), @@ -132,6 +161,7 @@ EnableWindow(GetDlgItem(dlg, IDC_SSHPASSWORDCAPTION), (!TIS_enabled && !PAGEANT_enabled)); EnableWindow(GetDlgItem(dlg, IDC_SSHPASSWORD), (!TIS_enabled && !PAGEANT_enabled)); + EnableWindow(GetDlgItem(dlg, IDC_FROM_CLIPBOARD), (!TIS_enabled && !PAGEANT_enabled)); for (i = IDC_CHOOSERSAFILE; i <= IDC_RSAFILENAME; i++) { EnableWindow(GetDlgItem(dlg, i), RSA_enabled); @@ -345,6 +375,7 @@ if (pvar->ssh2_autologin == 1) { EnableWindow(GetDlgItem(dlg, IDC_SSHPASSWORD), FALSE); EnableWindow(GetDlgItem(dlg, IDC_SSHPASSWORDCAPTION), FALSE); + EnableWindow(GetDlgItem(dlg, IDC_FROM_CLIPBOARD), FALSE); } } @@ -371,6 +402,7 @@ } else if (pvar->ssh2_authmethod == SSH_AUTH_TIS) { CheckRadioButton(dlg, IDC_SSHUSEPASSWORD, MAX_AUTH_CONTROL, IDC_SSHUSETIS); EnableWindow(GetDlgItem(dlg, IDC_SSHPASSWORD), FALSE); + EnableWindow(GetDlgItem(dlg, IDC_FROM_CLIPBOARD), FALSE); SetDlgItemText(dlg, IDC_SSHPASSWORD, ""); // /auth=pageant \x82\xF0\x92lj\xC1 @@ -377,6 +409,7 @@ } else if (pvar->ssh2_authmethod == SSH_AUTH_PAGEANT) { CheckRadioButton(dlg, IDC_SSHUSEPASSWORD, MAX_AUTH_CONTROL, IDC_SSHUSEPAGEANT); EnableWindow(GetDlgItem(dlg, IDC_SSHPASSWORD), FALSE); + EnableWindow(GetDlgItem(dlg, IDC_FROM_CLIPBOARD), FALSE); SetDlgItemText(dlg, IDC_SSHPASSWORD, ""); } else { @@ -746,6 +779,46 @@ return TRUE; } +/** + * \x83N\x83\x8A\x83b\x83v\x83{\x81[\x83h\x82\xA9\x82\xE7ANSI\x95\xB6\x8E\x9A\x97\xF1\x82\xF0\x8E擾\x82\xB7\x82\xE9 + * \x95\xB6\x8E\x9A\x97\xAA\x95K\x97v\x82ȂƂ\xAB\x82\xCDstrlen()\x82\xB7\x82邱\x82\xC6 + * @param hWnd + * @param emtpy TRUE\x82̂Ƃ\xAB\x83N\x83\x8A\x83b\x83v\x83{\x81[\x83h\x82\xF0\x8B\xF3\x82ɂ\xB7\x82\xE9 + * @retval \x95\xB6\x8E\x9A\x97\xF1\x82ւ̃|\x83C\x83\x93\x83^ \x8Eg\x97p\x8C\xE3free()\x82\xB7\x82邱\x82\xC6 + * \x95\xB6\x8E\x9A\x82\xAA\x82Ȃ\xA2(\x82܂\xBD\x82̓G\x83\x89\x81[\x8E\x9E)\x82\xCDNULL + */ +char *GetClipboardTextA(HWND hWnd, BOOL empty) +{ + HGLOBAL hGlobal; + const char *lpStr; + size_t length; + char *pool; + + OpenClipboard(hWnd); + hGlobal = (HGLOBAL)GetClipboardData(CF_TEXT); + if (hGlobal == NULL) { + CloseClipboard(); + return NULL; + } + lpStr = (const char *)GlobalLock(hGlobal); + length = GlobalSize(hGlobal); + if (length == 0) { + pool = NULL; + } else { + pool = (char *)malloc(length + 1); // +1 for terminator + memcpy(pool, lpStr, length); + pool[length] = '\0'; + } + GlobalUnlock(hGlobal); + if (empty) { + EmptyClipboard(); + } + CloseClipboard(); + + return pool; +} + + BOOL autologin_sent_none; static INT_PTR CALLBACK auth_dlg_proc(HWND dlg, UINT msg, WPARAM wParam, LPARAM lParam) @@ -999,6 +1072,17 @@ pvar->session_settings.ForwardAgent = IsDlgButtonChecked(dlg, IDC_FORWARD_AGENT); return TRUE; + case IDC_FROM_CLIPBOARD: { + char *clipboard = GetClipboardTextA(dlg, TRUE); + if (clipboard != NULL) { + SetDlgItemTextA(dlg, IDC_SSHPASSWORD, clipboard); + free(clipboard); + SendMessage(dlg, WM_NEXTDLGCTL, (WPARAM)GetDlgItem(dlg, IDOK), TRUE); + return FALSE; + } + return TRUE; + } + default: return FALSE; } Modified: branches/cmake/ttssh2/ttxssh/resource.h =================================================================== --- branches/cmake/ttssh2/ttxssh/resource.h 2019-05-19 15:03:33 UTC (rev 7690) +++ branches/cmake/ttssh2/ttxssh/resource.h 2019-05-19 15:03:52 UTC (rev 7691) @@ -227,14 +227,15 @@ #define IDC_SSHDYNFROMPORT 1228 #define IDC_SSHFWDLOCALDYNAMIC_LISTEN 1229 #define IDC_SSHDYNLISTENADDR 1230 +#define IDC_FROM_CLIPBOARD 1231 // Next default values for new objects // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 114 +#define _APS_NEXT_RESOURCE_VALUE 115 #define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1231 +#define _APS_NEXT_CONTROL_VALUE 1232 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif Modified: branches/cmake/ttssh2/ttxssh/ttxssh.rc =================================================================== --- branches/cmake/ttssh2/ttxssh/ttxssh.rc 2019-05-19 15:03:33 UTC (rev 7690) +++ branches/cmake/ttssh2/ttxssh/ttxssh.rc 2019-05-19 15:03:52 UTC (rev 7691) @@ -63,6 +63,7 @@ EDITTEXT IDC_SSHUSERNAME,75,29,145,12,ES_AUTOHSCROLL RTEXT "&Passphrase:",IDC_SSHPASSWORDCAPTION,14,48,56,8,0,WS_EX_RIGHT EDITTEXT IDC_SSHPASSWORD,75,46,145,12,ES_PASSWORD | ES_AUTOHSCROLL + PUSHBUTTON "&From Clipboard",IDC_FROM_CLIPBOARD,225,46,60,14 CONTROL "Remember password in &memory",IDC_REMEMBER_PASSWORD, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,75,61,132,10 CONTROL "F&orward agent",IDC_FORWARD_AGENT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,75,74,132,10 Modified: branches/cmake/ttssh2/ttxssh/ttxssh.vcproj =================================================================== --- branches/cmake/ttssh2/ttxssh/ttxssh.vcproj 2019-05-19 15:03:33 UTC (rev 7690) +++ branches/cmake/ttssh2/ttxssh/ttxssh.vcproj 2019-05-19 15:03:52 UTC (rev 7691) @@ -452,6 +452,10 @@ > </File> <File + RelativePath="..\..\teraterm\common\tipwin.cpp" + > + </File> + <File RelativePath="x11util.c" > </File>