Revision: 8771 https://osdn.net/projects/ttssh2/scm/svn/commits/8771 Author: zmatsuo Date: 2020-05-12 23:32:44 +0900 (Tue, 12 May 2020) Log Message: ----------- fontプロパティーページ追加 - Unicode/ANSI API切り替え - ANSI API使用時、文字コード変換に使用するコードページを変更できる - debugプロパティーページのUnicode/ANSI API切り替えを削除 - VTfont切り替えはすぐに設定に反映する - 今の所、[設定]/[フォント] から切り替えたときと同じ動作 - ANSI API利用時 - 表示できない文字を表示 - 半角時 '?' - 全角時 '?_' - 未実装 - フォント間 - プロポーショナルフォント Modified Paths: -------------- trunk/teraterm/common/tt_res.h trunk/teraterm/teraterm/CMakeLists.txt trunk/teraterm/teraterm/addsetting.cpp trunk/teraterm/teraterm/addsetting.h trunk/teraterm/teraterm/buffer.c trunk/teraterm/teraterm/coding_pp.cpp trunk/teraterm/teraterm/debug_pp.cpp trunk/teraterm/teraterm/debug_pp.rc trunk/teraterm/teraterm/setting.h trunk/teraterm/teraterm/ttermpro.v16.vcxproj trunk/teraterm/teraterm/ttermpro.v16.vcxproj.filters trunk/teraterm/teraterm/ttermpro.vcproj trunk/teraterm/teraterm/vtdisp.c trunk/teraterm/teraterm/vtwin.cpp Added Paths: ----------- trunk/teraterm/teraterm/font_pp.cpp trunk/teraterm/teraterm/font_pp.h trunk/teraterm/teraterm/font_pp.rc trunk/teraterm/teraterm/font_pp_res.h -------------- next part -------------- Modified: trunk/teraterm/common/tt_res.h =================================================================== --- trunk/teraterm/common/tt_res.h 2020-05-12 14:32:31 UTC (rev 8770) +++ trunk/teraterm/common/tt_res.h 2020-05-12 14:32:44 UTC (rev 8771) @@ -28,6 +28,7 @@ #define IDD_TABSHEET_DEBUG 126 #define IDD_SENDFILEDLG 127 #define IDD_TABSHEET_CODING 128 +#define IDD_TABSHEET_FONT 129 #define IDR_TEKMENU 1000 #define IDC_EDIT_COMMENT 1000 #define IDC_EDIT_FULLPATH 1001 @@ -257,7 +258,6 @@ #define IDC_SENDFILE_SEND_SIZE_LABEL 2603 #define IDC_SENDFILE_DELAYTIME_LABEL 2604 #define IDC_SENDFILE_DELAYTIME_EDIT 2605 -#define IDC_DEBUG_USE_UNICODE_API 2606 #define ID_ACC_SENDBREAK 50001 #define ID_ACC_COPY 50002 #define ID_ACC_NEWCONNECTION 50003 @@ -358,7 +358,7 @@ #define _APS_NO_MFC 1 #define _APS_NEXT_RESOURCE_VALUE 129 #define _APS_NEXT_COMMAND_VALUE 52031 -#define _APS_NEXT_CONTROL_VALUE 2607 +#define _APS_NEXT_CONTROL_VALUE 2606 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif Modified: trunk/teraterm/teraterm/CMakeLists.txt =================================================================== --- trunk/teraterm/teraterm/CMakeLists.txt 2020-05-12 14:32:31 UTC (rev 8770) +++ trunk/teraterm/teraterm/CMakeLists.txt 2020-05-12 14:32:44 UTC (rev 8771) @@ -25,6 +25,10 @@ dnddlg.h filesys.cpp filesys.h + font_pp.cpp + font_pp.h + font_pp.rc + font_pp_res.h ftdlg.cpp ftdlg.h keyboard.c Modified: trunk/teraterm/teraterm/addsetting.cpp =================================================================== --- trunk/teraterm/teraterm/addsetting.cpp 2020-05-12 14:32:31 UTC (rev 8770) +++ trunk/teraterm/teraterm/addsetting.cpp 2020-05-12 14:32:44 UTC (rev 8771) @@ -57,6 +57,7 @@ #include "codeconv.h" #include "layer_for_unicode.h" #include "coding_pp.h" +#include "font_pp.h" const mouse_cursor_t MouseCursor[] = { {"ARROW", IDC_ARROW}, @@ -1776,7 +1777,8 @@ // TTCPropertyPage \x82\xF0\x8Eg\x97p\x82\xB5\x82Ȃ\xA2 PropertyPage hPsp[m_PageCountCPP+0] = CodingPageCreate(hInstance, &ts); - m_PageCount = m_PageCountCPP+ 1; + hPsp[m_PageCountCPP+1] = FontPageCreate(hInstance, &ts); + m_PageCount = m_PageCountCPP + 2; m_psh.nPages = m_PageCount; m_psh.phpage = hPsp; Modified: trunk/teraterm/teraterm/addsetting.h =================================================================== --- trunk/teraterm/teraterm/addsetting.h 2020-05-12 14:32:31 UTC (rev 8770) +++ trunk/teraterm/teraterm/addsetting.h 2020-05-12 14:32:44 UTC (rev 8771) @@ -147,7 +147,7 @@ HINSTANCE m_hInst; int m_PageCount; - HPROPSHEETPAGE hPsp[8]; + HPROPSHEETPAGE hPsp[9]; int m_PageCountCPP; TTCPropertyPage *m_Page[7]; Modified: trunk/teraterm/teraterm/buffer.c =================================================================== --- trunk/teraterm/teraterm/buffer.c 2020-05-12 14:32:31 UTC (rev 8770) +++ trunk/teraterm/teraterm/buffer.c 2020-05-12 14:32:44 UTC (rev 8771) @@ -178,6 +178,14 @@ switch (lenA) { case 0: default: +#if 1 + if (half_width) { + p->ansi_char = '?'; + } + else { + p->ansi_char = (('?' << 8) | '_'); + } +#else if (ts.UnknownUnicodeCharaAsWide) { p->ansi_char = (('?' << 8) | '?'); } @@ -184,6 +192,7 @@ else { p->ansi_char = '?'; } +#endif break; case 1: p->ansi_char = (unsigned char)strA[0]; @@ -5533,9 +5542,9 @@ UseUnicodeApi = unicode; } -void BuffSetDispCodePage(int CodePage) +void BuffSetDispCodePage(int code_page) { - CodePage = CodePage; + CodePage = code_page; } int BuffGetDispCodePage(void) Modified: trunk/teraterm/teraterm/coding_pp.cpp =================================================================== --- trunk/teraterm/teraterm/coding_pp.cpp 2020-05-12 14:32:31 UTC (rev 8770) +++ trunk/teraterm/teraterm/coding_pp.cpp 2020-05-12 14:32:44 UTC (rev 8771) @@ -219,6 +219,8 @@ break; } case PSN_HELP: + MessageBox(hWnd, "Tera Term", "not implimented", + MB_OK | MB_ICONEXCLAMATION); break; default: break; @@ -302,7 +304,7 @@ psp.pResource = Param->dlg_templ; #endif psp.pszTitle = L"coding"; // TODO lng \x83t\x83@\x83C\x83\x8B\x82ɓ\xFC\x82\xEA\x82\xE9 - psp.dwFlags |= (PSP_USETITLE | PSP_HASHELP); + psp.dwFlags |= (PSP_USETITLE /*| PSP_HASHELP */); psp.pfnDlgProc = Proc; psp.lParam = (LPARAM)Param; Modified: trunk/teraterm/teraterm/debug_pp.cpp =================================================================== --- trunk/teraterm/teraterm/debug_pp.cpp 2020-05-12 14:32:31 UTC (rev 8770) +++ trunk/teraterm/teraterm/debug_pp.cpp 2020-05-12 14:32:44 UTC (rev 8771) @@ -84,9 +84,6 @@ } } SetDlgItemTextA(IDC_DEBUG_CONSOLE_BUTTON, caption); - - // use unicode API - SetCheck(IDC_DEBUG_USE_UNICODE_API, UnicodeDebugParam.UseUnicodeApi); } BOOL CDebugPropPage::OnCommand(WPARAM wParam, LPARAM) @@ -131,6 +128,4 @@ UnicodeDebugParam.CodePopupKey1 = key_list[i].key_code; i = GetCurSel(IDC_DEBUG_POPUP_KEY2); UnicodeDebugParam.CodePopupKey2 = key_list[i].key_code; - - UnicodeDebugParam.UseUnicodeApi = GetCheck(IDC_DEBUG_USE_UNICODE_API); } Modified: trunk/teraterm/teraterm/debug_pp.rc =================================================================== --- trunk/teraterm/teraterm/debug_pp.rc 2020-05-12 14:32:31 UTC (rev 8770) +++ trunk/teraterm/teraterm/debug_pp.rc 2020-05-12 14:32:44 UTC (rev 8771) @@ -24,7 +24,7 @@ // Dialog // -IDD_TABSHEET_DEBUG DIALOGEX 0, 0, 175, 116 +IDD_TABSHEET_DEBUG DIALOGEX 0, 0, 175, 97 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Debug" FONT 8, "MS Shell Dlg", 400, 0, 0x1 @@ -36,7 +36,6 @@ LTEXT "1st Key",IDC_STATIC,23,33,25,8 LTEXT "2nd Key",IDC_STATIC,23,51,27,8 PUSHBUTTON "Display consol window",IDC_DEBUG_CONSOLE_BUTTON,10,71,93,14 - CONTROL "Use unicode API",IDC_DEBUG_USE_UNICODE_API,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,92,145,10 END @@ -81,7 +80,7 @@ VERTGUIDE, 23 VERTGUIDE, 61 VERTGUIDE, 155 - BOTTOMMARGIN, 109 + BOTTOMMARGIN, 90 HORZGUIDE, 37 HORZGUIDE, 55 END Added: trunk/teraterm/teraterm/font_pp.cpp =================================================================== --- trunk/teraterm/teraterm/font_pp.cpp (rev 0) +++ trunk/teraterm/teraterm/font_pp.cpp 2020-05-12 14:32:44 UTC (rev 8771) @@ -0,0 +1,283 @@ +/* + * (C) 2020 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. + */ + +/* font property page */ + +#include <stdio.h> +#define _CRTDBG_MAP_ALLOC +#include <stdlib.h> +#include <crtdbg.h> +#include <assert.h> + +#include "tttypes.h" +#include "font_pp_res.h" +#include "dlglib.h" +#include "setting.h" +#include "layer_for_unicode.h" +#include "vtdisp.h" // for DispSetupFontDlg() +#include "buffer.h" +#include "compat_win.h" // for CF_INACTIVEFONTS + +#include "font_pp.h" + +// \x83e\x83\x93\x83v\x83\x8C\x81[\x83g\x82̏\x91\x82\xAB\x8A\xB7\x82\xA6\x82\xF0\x8Ds\x82\xA4 +#define REWRITE_TEMPLATE + +struct FontPPData { + HINSTANCE hInst; + const char *UILanguageFile; + TTTSet *pts; + DLGTEMPLATE *dlg_templ; +// LOGFONTA VTFont; + LOGFONTA DlgFont; +}; + +static void GetDlgLogFont(HWND hWnd, const TTTSet *ts, LOGFONTA *logfont) +{ + memset(logfont, 0, sizeof(*logfont)); + logfont->lfHeight = -GetFontPixelFromPoint(hWnd, ts->DialogFontPoint); + strncpy_s(logfont->lfFaceName, sizeof(logfont->lfFaceName),ts->DialogFontName, _TRUNCATE); + logfont->lfCharSet = ts->DialogFontCharSet; +} + +static void SetDlgLogFont(HWND hWnd, const LOGFONTA *logfont, TTTSet *ts) +{ + strncpy_s(ts->DialogFontName, sizeof(ts->DialogFontName), logfont->lfFaceName, _TRUNCATE); + ts->DialogFontPoint = GetFontPointFromPixel(hWnd, -logfont->lfHeight); + ts->DialogFontCharSet = logfont->lfCharSet; +} + +static UINT_PTR CALLBACK TFontHook(HWND Dialog, UINT Message, WPARAM wParam, LPARAM lParam) +{ + if (Message == WM_INITDIALOG) { + FontPPData *dlg_data = (FontPPData *)(((CHOOSEFONTA *)lParam)->lCustData); + wchar_t uimsg[MAX_UIMSG]; + get_lang_msgW("DLG_CHOOSEFONT_STC6", uimsg, _countof(uimsg), + L"\"Font style\" selection here won't affect actual font appearance.", dlg_data->UILanguageFile); + _SetDlgItemTextW(Dialog, stc6, uimsg); + + SetFocus(GetDlgItem(Dialog,cmb1)); + + CenterWindow(Dialog, GetParent(Dialog)); + } + return FALSE; +} + +static void SetupDlgFont(HWND hWnd, FontPPData *dlg_data) +{ + const TTTSet *ts = dlg_data->pts; + + // \x83_\x83C\x83A\x83\x8D\x83O\x95\\x8E\xA6 + CHOOSEFONTA cf = {}; + cf.lStructSize = sizeof(cf); + cf.hwndOwner = hWnd; + cf.lpLogFont = &dlg_data->DlgFont; + cf.Flags = + CF_SCREENFONTS | CF_INITTOLOGFONTSTRUCT | + CF_SHOWHELP | CF_NOVERTFONTS | + CF_ENABLEHOOK; + if (IsWindows7OrLater() && ts->ListHiddenFonts) { + cf.Flags |= CF_INACTIVEFONTS; + } + cf.lpfnHook = &TFontHook; + cf.nFontType = REGULAR_FONTTYPE; + cf.hInstance = dlg_data->hInst; + cf.lCustData = (LPARAM)dlg_data; + BOOL result = ChooseFontA(&cf); +} + +static void EnableCodePage(HWND hWnd, BOOL enable) +{ + EnableWindow(GetDlgItem(hWnd, IDC_VTFONT_PAGECODE_LABEL), enable); + EnableWindow(GetDlgItem(hWnd, IDC_VTFONT_PAGECODE_EDIT), enable); +} + +static void SetFontString(HWND hWnd, int item, const LOGFONTA *logfont) +{ + // https://docs.microsoft.com/en-us/windows/win32/api/dimm/ns-dimm-logfonta + // http://www.coara.or.jp/~tkuri/D/015.htm#D2002-09-14 + char b[128]; + sprintf_s(b, "%s (%d,%d) %d", logfont->lfFaceName, logfont->lfWidth, logfont->lfHeight, logfont->lfCharSet); + SetDlgItemTextA(hWnd, item, b); +} + +static void SetVTFontString(HWND hWnd, int item, const TTTSet *ts) +{ + LOGFONTA logfont = {}; + logfont.lfWidth = ts->VTFontSize.x; + logfont.lfHeight = ts->VTFontSize.y; + strncpy_s(logfont.lfFaceName, sizeof(logfont.lfFaceName),ts->VTFont, _TRUNCATE); + logfont.lfCharSet = ts->VTFontCharSet; + SetFontString(hWnd, item, &logfont); +} + +static INT_PTR CALLBACK Proc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp) +{ + static const DlgTextInfo TextInfos[] = { + {0, "DLG_GEN_TITLE"}, + }; + FontPPData *dlg_data = (FontPPData *)GetWindowLongPtr(hWnd, DWLP_USER); + TTTSet *ts = dlg_data == NULL ? NULL : dlg_data->pts; + + switch (msg) { + case WM_INITDIALOG: { + dlg_data = (FontPPData *)(((PROPSHEETPAGEW_V1 *)lp)->lParam); + ts = dlg_data->pts; + SetWindowLongPtr(hWnd, DWLP_USER, (LONG_PTR)dlg_data); + SetDlgTexts(hWnd, TextInfos, _countof(TextInfos), dlg_data->pts->UILanguageFile); + + GetDlgLogFont(GetParent(hWnd), ts, &dlg_data->DlgFont); + + SetVTFontString(hWnd, IDC_VTFONT_EDIT, ts); + + CheckDlgButton(hWnd, + UnicodeDebugParam.UseUnicodeApi ? IDC_VTFONT_UNICODE : IDC_VTFONT_ANSI, + BST_CHECKED); + SetDlgItemInt(hWnd, IDC_VTFONT_PAGECODE_EDIT, UnicodeDebugParam.CodePageForANSIDraw, FALSE); + EnableCodePage(hWnd, UnicodeDebugParam.UseUnicodeApi ? FALSE : TRUE); + + CheckDlgButton(hWnd, IDC_LIST_HIDDEN_FONTS, ts->ListHiddenFonts); + EnableWindow(GetDlgItem(hWnd, IDC_LIST_HIDDEN_FONTS), IsWindows7OrLater() ? TRUE : FALSE); + + SetDlgItemInt(hWnd, IDC_SPACE_RIGHT, ts->FontDW, FALSE); + SetDlgItemInt(hWnd, IDC_SPACE_LEFT, ts->FontDH, FALSE); + SetDlgItemInt(hWnd, IDC_SPACE_TOP, ts->FontDX, FALSE); + SetDlgItemInt(hWnd, IDC_SPACE_BOTTOM, ts->FontDY, FALSE); + + const static I18nTextInfo visual_font_quality[] = { + { "DLG_TAB_VISUAL_FONT_QUALITY_DEFAULT", L"Default" }, + { "DLG_TAB_VISUAL_FONT_QUALITY_NONANTIALIASED", L"Non-Antialiased" }, + { "DLG_TAB_VISUAL_FONT_QUALITY_ANTIALIASED", L"Antialiased" }, + { "DLG_TAB_VISUAL_FONT_QUALITY_CLEARTYPE", L"ClearType" }, + }; + SetI18nList("Tera Term", hWnd, IDC_FONT_QUALITY, visual_font_quality, _countof(visual_font_quality), + ts->UILanguageFile, 0); + int cur = + ts->FontQuality == DEFAULT_QUALITY ? 0 : + ts->FontQuality == NONANTIALIASED_QUALITY ? 1 : + ts->FontQuality == ANTIALIASED_QUALITY ? 2 : + /*ts->FontQuality == CLEARTYPE_QUALITY ? */ 3; + SendDlgItemMessage(hWnd, IDC_FONT_QUALITY, CB_SETCURSEL, cur, 0); + + SetFontString(hWnd, IDC_DLGFONT_EDIT, &dlg_data->DlgFont); + } + case WM_NOTIFY: { + NMHDR *nmhdr = (NMHDR *)lp; + switch (nmhdr->code) { + case PSN_APPLY: { + UnicodeDebugParam.UseUnicodeApi = + IsDlgButtonChecked(hWnd, IDC_VTFONT_UNICODE) == BST_CHECKED; + UnicodeDebugParam.CodePageForANSIDraw = + GetDlgItemInt(hWnd, IDC_VTFONT_PAGECODE_EDIT, NULL, FALSE); + // ANSI\x95\\x8E\xA6\x97p\x82̃R\x81[\x83h\x83y\x81[\x83W\x82\xF0\x90ݒ肷\x82\xE9 + BuffSetDispCodePage(UnicodeDebugParam.CodePageForANSIDraw); + ts->ListHiddenFonts = IsDlgButtonChecked(hWnd, IDC_LIST_HIDDEN_FONTS) == BST_CHECKED; + + SetDlgLogFont(GetParent(hWnd), &dlg_data->DlgFont, ts); + + break; + } + case PSN_HELP: + MessageBox(hWnd, "Tera Term", "not implimented", + MB_OK | MB_ICONEXCLAMATION); + break; + default: + break; + } + break; + } + case WM_COMMAND: { + switch (wp) { + case IDC_VTFONT_ANSI | (BN_CLICKED << 16): + case IDC_VTFONT_UNICODE | (BN_CLICKED << 16): { + BOOL enable = (wp & 0xffff) == IDC_VTFONT_ANSI ? TRUE : FALSE; + EnableCodePage(hWnd, enable); + break; + } + case IDC_VTFONT_CHOOSE | (BN_CLICKED << 16): { + DispSetupFontDlg(); + SetDlgItemInt(hWnd, IDC_VTFONT_PAGECODE_EDIT, UnicodeDebugParam.CodePageForANSIDraw, FALSE); + SetVTFontString(hWnd, IDC_VTFONT_EDIT, ts); + break; + } + case IDC_DLGFONT_CHOOSE | (BN_CLICKED << 16): + SetupDlgFont(hWnd, dlg_data); + SetFontString(hWnd, IDC_DLGFONT_EDIT, &dlg_data->DlgFont); + break; + + case IDC_DLGFONT_DEFAULT | (BN_CLICKED << 16): { + GetMessageboxFont(&dlg_data->DlgFont); + SetFontString(hWnd, IDC_DLGFONT_EDIT, &dlg_data->DlgFont); + } + + default: + break; + } + break; + } + case WM_DESTROY: { + free(dlg_data->dlg_templ); + free(dlg_data); + SetWindowLongPtr(hWnd, DWLP_USER, NULL); + break; + } + default: + return FALSE; + } + return FALSE; +} + +HPROPSHEETPAGE FontPageCreate(HINSTANCE inst, TTTSet *pts) +{ + // \x92\x8D common/tt_res.h \x82\xC6 font_pp_res.h \x82Œl\x82\xF0\x88\xEA\x92v\x82\xB3\x82\xB9\x82邱\x82\xC6 + const int id = IDD_TABSHEET_FONT; + + FontPPData *Param = (FontPPData *)calloc(sizeof(FontPPData), 1); + Param->hInst = inst; + Param->UILanguageFile = pts->UILanguageFile; + Param->pts = pts; + + PROPSHEETPAGEW_V1 psp = {}; + psp.dwSize = sizeof(psp); + psp.dwFlags = PSP_DEFAULT; + psp.hInstance = inst; + psp.pszTemplate = MAKEINTRESOURCEW(id); +#if defined(REWRITE_TEMPLATE) + psp.dwFlags |= PSP_DLGINDIRECT; + Param->dlg_templ = TTGetDlgTemplate(inst, MAKEINTRESOURCEA(id)); + psp.pResource = Param->dlg_templ; +#endif + psp.pszTitle = L"font"; + psp.dwFlags |= (PSP_USETITLE /*| PSP_HASHELP */); + + psp.pfnDlgProc = Proc; + psp.lParam = (LPARAM)Param; + + HPROPSHEETPAGE hpsp = _CreatePropertySheetPageW(&psp); + return hpsp; +} Copied: trunk/teraterm/teraterm/font_pp.h (from rev 8770, trunk/teraterm/teraterm/setting.h) =================================================================== --- trunk/teraterm/teraterm/font_pp.h (rev 0) +++ trunk/teraterm/teraterm/font_pp.h 2020-05-12 14:32:44 UTC (rev 8771) @@ -0,0 +1,41 @@ +/* + * (C) 2020 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. + */ + +#include <windows.h> + +#ifdef __cplusplus +extern "C" { +#endif + +HPROPSHEETPAGE FontPageCreate(HINSTANCE inst, TTTSet *pts); + +#ifdef __cplusplus +} +#endif + + Added: trunk/teraterm/teraterm/font_pp.rc =================================================================== --- trunk/teraterm/teraterm/font_pp.rc (rev 0) +++ trunk/teraterm/teraterm/font_pp.rc 2020-05-12 14:32:44 UTC (rev 8771) @@ -0,0 +1,127 @@ +// Microsoft Visual C++ generated resource script. +// +#include "font_pp_res.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "winres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// \x93\xFA\x96{\x8C\xEA (\x93\xFA\x96{) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_JPN) +LANGUAGE LANG_JAPANESE, SUBLANG_DEFAULT +#pragma code_page(932) + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "font_pp_res.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#include ""winres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_TABSHEET_FONT DIALOGEX 0, 0, 309, 267 +STYLE DS_SETFONT | DS_CONTROL | WS_CHILD | WS_SYSMENU +CAPTION "\x95\\x8E\xA6/\x83t\x83H\x83\x93\x83g" +FONT 8, "MS Shell Dlg", 400, 0, 0x1 +BEGIN + EDITTEXT IDC_VTFONT_EDIT,19,27,148,12,ES_AUTOHSCROLL | ES_READONLY + PUSHBUTTON "\x95ύX",IDC_VTFONT_CHOOSE,177,27,50,14 + CONTROL "ANSI API",IDC_VTFONT_ANSI,"Button",BS_AUTORADIOBUTTON,31,66,45,10 + CONTROL "Unicode API",IDC_VTFONT_UNICODE,"Button",BS_AUTORADIOBUTTON,31,110,55,10 + EDITTEXT IDC_VTFONT_PAGECODE_EDIT,44,92,40,12,ES_AUTOHSCROLL + LTEXT "\x95\\x8E\xA6\x97p\x95\xB6\x8E\x9A\x95ϊ\xB7\x83R\x81[\x83h\x83y\x81[\x83W",IDC_VTFONT_PAGECODE_LABEL,43,81,95,8 + LTEXT "\x83t\x83H\x83\x93\x83g\x95i\x8E\xBF",IDC_STATIC,19,129,39,8 + CONTROL "OS\x82Ŕ\xF1\x95\\x8E\xA6\x82̃t\x83H\x83\x93\x83g\x82\xE0\x83t\x83H\x83\x93\x83g\x83_\x83C\x83A\x83\x8D\x83O\x82̈ꗗ\x82ɕ\\x8E\xA6\x82\xB7\x82\xE9",IDC_LIST_HIDDEN_FONTS, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,194,200,10 + COMBOBOX IDC_FONT_QUALITY,30,141,87,69,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP + LTEXT "\x95\xB6\x8E\x9A\x95`\x89\xE6\x82Ŏg\x97p\x82\xB7\x82\xE9API",IDC_STATIC,19,50,80,8 + CONTROL "\x83v\x83\x8D\x83|\x81[\x83V\x83\x87\x83i\x83\x8B\x83t\x83H\x83\x93\x83g\x82\xE0\x83t\x83H\x83\x93\x83g\x83_\x83C\x83A\x83\x8D\x83O\x82̈ꗗ\x82ɕ\\x8E\xA6\x82\xB7\x82\xE9",IDC_LIST_PRO_FONTS, + "Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,7,209,203,10 + LTEXT "\x83^\x81[\x83~\x83i\x83\x8B\x83t\x83H\x83\x93\x83g",IDC_STATIC,7,7,115,8 + LTEXT "\x83_\x83C\x83A\x83\x8D\x83O\x83t\x83H\x83\x93\x83g",IDC_STATIC,7,162,115,8 + EDITTEXT IDC_DLGFONT_EDIT,19,175,148,12,ES_AUTOHSCROLL | ES_READONLY + PUSHBUTTON "\x95ύX",IDC_DLGFONT_CHOOSE,177,175,50,14 + PUSHBUTTON "\x83f\x83t\x83H\x83\x8B\x83g",IDC_DLGFONT_DEFAULT,231,175,50,14 + LTEXT "\x95\xB6\x8E\x9A\x8AԃX\x83y\x81[\x83X",IDC_STATIC,187,51,115,8,WS_DISABLED + EDITTEXT IDC_SPACE_TOP,224,68,40,14,ES_AUTOHSCROLL | WS_DISABLED + EDITTEXT IDC_SPACE_BOTTOM,224,87,40,14,ES_AUTOHSCROLL | WS_DISABLED + EDITTEXT IDC_SPACE_LEFT,224,105,40,14,ES_AUTOHSCROLL | WS_DISABLED + EDITTEXT IDC_SPACE_RIGHT,224,123,40,14,ES_AUTOHSCROLL | WS_DISABLED +END + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO +BEGIN + IDD_TABSHEET_FONT, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 302 + TOPMARGIN, 7 + BOTTOMMARGIN, 260 + END +END +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// AFX_DIALOG_LAYOUT +// + +IDD_TABSHEET_FONT AFX_DIALOG_LAYOUT +BEGIN + 0 +END + +#endif // \x93\xFA\x96{\x8C\xEA (\x93\xFA\x96{) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + Added: trunk/teraterm/teraterm/font_pp_res.h =================================================================== --- trunk/teraterm/teraterm/font_pp_res.h (rev 0) +++ trunk/teraterm/teraterm/font_pp_res.h 2020-05-12 14:32:44 UTC (rev 8771) @@ -0,0 +1,37 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ \x82Ő\xB6\x90\xAC\x82\xB3\x82ꂽ\x83C\x83\x93\x83N\x83\x8B\x81[\x83h \x83t\x83@\x83C\x83\x8B\x81B +// font_pp.rc \x82Ŏg\x97p +// +#define IDD_TABSHEET_FONT 129 +#define IDC_SPACE_TOP 1001 +#define IDC_SPACE_BOTTOM 1002 +#define IDC_SPACE_LEFT 1003 +#define IDC_SPACE_RIGHT 1004 +#define IDC_VTFONT_PAGECODE_LABEL 1005 +#define IDC_VTFONT_EDIT 2607 +#define IDC_BUTTON1 2608 +#define IDC_VTFONT_CHOOSE 2608 +#define IDC_VTFONT_ANSI 2609 +#define IDC_VTFONT_UNICODE 2610 +#define IDC_VTFONT_PAGECODE_EDIT 2611 +#define IDC_LIST_HIDDEN_FONTS 2612 +#define IDC_FONT_QUALITY 2613 +#define IDC_CHECK2 2614 +#define IDC_LIST_PRO_FONTS 2614 +#define IDC_EDIT3 2615 +#define IDC_DLGFONT_EDIT 2615 +#define IDC_BUTTON2 2616 +#define IDC_DLGFONT_CHOOSE 2616 +#define IDC_BUTTON3 2617 +#define IDC_DLGFONT_DEFAULT 2617 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 102 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1006 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif Modified: trunk/teraterm/teraterm/setting.h =================================================================== --- trunk/teraterm/teraterm/setting.h 2020-05-12 14:32:31 UTC (rev 8770) +++ trunk/teraterm/teraterm/setting.h 2020-05-12 14:32:44 UTC (rev 8771) @@ -29,27 +29,20 @@ #pragma once #ifdef __cplusplus +extern "C" { +#endif -class CUnicodeDebugParam +typedef struct { -public: BOOL CodePopupEnable; WORD CodePopupKey1; WORD CodePopupKey2; BOOL UseUnicodeApi; - CUnicodeDebugParam() - { -#if _DEBUG - CodePopupEnable = TRUE; -#else - CodePopupEnable = FALSE; -#endif - CodePopupKey1 = VK_CONTROL; - CodePopupKey2 = VK_CONTROL; - UseUnicodeApi = FALSE; - } -}; + int CodePageForANSIDraw; +} UnicodeDebugParam_t; -extern CUnicodeDebugParam UnicodeDebugParam; +extern UnicodeDebugParam_t UnicodeDebugParam; +#ifdef __cplusplus +} #endif Modified: trunk/teraterm/teraterm/ttermpro.v16.vcxproj =================================================================== --- trunk/teraterm/teraterm/ttermpro.v16.vcxproj 2020-05-12 14:32:31 UTC (rev 8770) +++ trunk/teraterm/teraterm/ttermpro.v16.vcxproj 2020-05-12 14:32:44 UTC (rev 8771) @@ -143,6 +143,7 @@ <ClCompile Include="commlib.c" /> <ClCompile Include="dnddlg.cpp" /> <ClCompile Include="filesys.cpp" /> + <ClCompile Include="font_pp.cpp" /> <ClCompile Include="ftdlg.cpp" /> <ClCompile Include="keyboard.c" /> <ClCompile Include="sendfiledlg.cpp" /> @@ -173,6 +174,8 @@ <ClInclude Include="../ttpdlg/ttdlg.h" /> <ClInclude Include="coding_pp.h" /> <ClInclude Include="coding_pp_res.h" /> + <ClInclude Include="font_pp.h" /> + <ClInclude Include="font_pp_res.h" /> <ClInclude Include="sendfiledlg.h" /> <ClInclude Include="sendmem.h" /> <ClCompile Include="sendmem.cpp" /> @@ -197,6 +200,7 @@ <ResourceCompile Include="../ttpdlg/ttpdlg.rc" /> <ResourceCompile Include="coding_pp.rc" /> <ResourceCompile Include="debug_pp.rc" /> + <ResourceCompile Include="font_pp.rc" /> <ResourceCompile Include="teraterm_manifest.rc" /> <ResourceCompile Include="tt-version.rc" /> <ResourceCompile Include="ttermpro.rc" /> Modified: trunk/teraterm/teraterm/ttermpro.v16.vcxproj.filters =================================================================== --- trunk/teraterm/teraterm/ttermpro.v16.vcxproj.filters 2020-05-12 14:32:31 UTC (rev 8770) +++ trunk/teraterm/teraterm/ttermpro.v16.vcxproj.filters 2020-05-12 14:32:44 UTC (rev 8771) @@ -138,6 +138,9 @@ <ClCompile Include="coding_pp.cpp"> <Filter>dialog</Filter> </ClCompile> + <ClCompile Include="font_pp.cpp"> + <Filter>dialog</Filter> + </ClCompile> </ItemGroup> <ItemGroup> <Image Include="..\..\cygterm\cygterm.ico"> @@ -184,6 +187,9 @@ <ResourceCompile Include="coding_pp.rc"> <Filter>dialog</Filter> </ResourceCompile> + <ResourceCompile Include="font_pp.rc"> + <Filter>dialog</Filter> + </ResourceCompile> </ItemGroup> <ItemGroup> <ClInclude Include="sizetip.h"> @@ -348,5 +354,11 @@ <ClInclude Include="coding_pp.h"> <Filter>dialog</Filter> </ClInclude> + <ClInclude Include="font_pp.h"> + <Filter>dialog</Filter> + </ClInclude> + <ClInclude Include="font_pp_res.h"> + <Filter>dialog</Filter> + </ClInclude> </ItemGroup> </Project> \ No newline at end of file Modified: trunk/teraterm/teraterm/ttermpro.vcproj =================================================================== --- trunk/teraterm/teraterm/ttermpro.vcproj 2020-05-12 14:32:31 UTC (rev 8770) +++ trunk/teraterm/teraterm/ttermpro.vcproj 2020-05-12 14:32:44 UTC (rev 8771) @@ -583,6 +583,22 @@ > </File> <File + RelativePath=".\font_pp.cpp" + > + </File> + <File + RelativePath=".\font_pp.h" + > + </File> + <File + RelativePath=".\font_pp.rc" + > + </File> + <File + RelativePath=".\font_pp_res.h" + > + </File> + <File RelativePath="ftdlg.cpp" > </File> Modified: trunk/teraterm/teraterm/vtdisp.c =================================================================== --- trunk/teraterm/teraterm/vtdisp.c 2020-05-12 14:32:31 UTC (rev 8770) +++ trunk/teraterm/teraterm/vtdisp.c 2020-05-12 14:32:44 UTC (rev 8771) @@ -44,6 +44,7 @@ #include <olectl.h> #include "unicode_test.h" +#include "setting.h" #define CurWidth 2 @@ -3498,7 +3499,7 @@ ts.VTFontSize.y = VTlf.lfHeight; ts.VTFontCharSet = VTlf.lfCharSet; - ts.CodePage = GetCodePageFromFontCharSet(VTlf.lfCharSet); + UnicodeDebugParam.CodePageForANSIDraw = GetCodePageFromFontCharSet(VTlf.lfCharSet); ChangeFont(); Modified: trunk/teraterm/teraterm/vtwin.cpp =================================================================== --- trunk/teraterm/teraterm/vtwin.cpp 2020-05-12 14:32:31 UTC (rev 8770) +++ trunk/teraterm/teraterm/vtwin.cpp 2020-05-12 14:32:44 UTC (rev 8771) @@ -126,9 +126,7 @@ #define WM_IME_COMPOSITION 0x010F #endif -#if UNICODE_INTERNAL_BUFF -CUnicodeDebugParam UnicodeDebugParam; -#endif +UnicodeDebugParam_t UnicodeDebugParam; ///////////////////////////////////////////////////////////////////////////// // CVTWindow @@ -645,10 +643,23 @@ TipWinCodeDebug = NULL; #endif + // UnicodeDebugParam + { +#if _DEBUG + UnicodeDebugParam.CodePopupEnable = TRUE; +#else + UnicodeDebugParam.CodePopupEnable = FALSE; +#endif + UnicodeDebugParam.CodePopupKey1 = VK_CONTROL; + UnicodeDebugParam.CodePopupKey2 = VK_CONTROL; + UnicodeDebugParam.UseUnicodeApi = FALSE; + UnicodeDebugParam.CodePageForANSIDraw = 932; + } + /* Initialize scroll buffer */ UnicodeDebugParam.UseUnicodeApi = IsWindowsNTKernel() ? TRUE : FALSE; InitBuffer(UnicodeDebugParam.UseUnicodeApi); - BuffSetDispCodePage(932); + BuffSetDispCodePage(UnicodeDebugParam.CodePageForANSIDraw); InitDisp(); @@ -4635,7 +4646,8 @@ { HelpId = HlpSetupFont; DispSetupFontDlg(); - BuffSetDispCodePage(ts.CodePage); // ANSI\x95\\x8E\xA6\x97p\x82̃R\x81[\x83h\x83y\x81[\x83W\x82\xF0\x90ݒ肷\x82\xE9 + // ANSI\x95\\x8E\xA6\x97p\x82̃R\x81[\x83h\x83y\x81[\x83W\x82\xF0\x90ݒ肷\x82\xE9 + BuffSetDispCodePage(UnicodeDebugParam.CodePageForANSIDraw); } static BOOL CALLBACK TFontHook(HWND Dialog, UINT Message, WPARAM wParam, LPARAM lParam)