Revision: 7516 http://sourceforge.jp/projects/ttssh2/scm/svn/commits/7516 Author: zmatsuo Date: 2019-03-27 00:42:57 +0900 (Wed, 27 Mar 2019) Log Message: ----------- 関数を移動 GetMessageboxFont() dlglib.cからttlib.cへ移動 SetDialogFont() dlglib.cからdlglib_cpp.cppへ移動 Modified Paths: -------------- trunk/teraterm/common/dlglib.c trunk/teraterm/common/dlglib_cpp.cpp trunk/teraterm/common/tipwin.cpp trunk/teraterm/common/ttlib.c trunk/teraterm/common/ttlib.h trunk/teraterm/ttpcmn/ttpcmn.def -------------- next part -------------- Modified: trunk/teraterm/common/dlglib.c =================================================================== --- trunk/teraterm/common/dlglib.c 2019-03-26 15:42:43 UTC (rev 7515) +++ trunk/teraterm/common/dlglib.c 2019-03-26 15:42:57 UTC (rev 7516) @@ -430,97 +430,6 @@ return info.found; } -/** - * \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, - const char *UILanguageFile, const char *Section) -{ - // teraterm.ini\x82̎w\x92\xE8 - if (SetupFName != NULL) { - LOGFONTA logfont; - BOOL result; - result = GetI18nLogfont("Tera Term", "DlgFont", &logfont, 0, SetupFName); - if (result == TRUE) { - result = IsExistFontA(logfont.lfFaceName, logfont.lfCharSet, TRUE); - if (result == TRUE) { - TTSetDlgFontA(logfont.lfFaceName, logfont.lfHeight, logfont.lfCharSet); - return; - } - } - } - - // .lng\x82̎w\x92\xE8 - if (UILanguageFile != NULL) { - static const char *dlg_font_keys[] = { - "DLG_FONT", - "DLG_TAHOMA_FONT", - "DLG_SYSTEM_FONT", - }; - BOOL result = FALSE; - LOGFONTA logfont; - size_t i; - if (Section != NULL) { - for (i = 0; i < _countof(dlg_font_keys); i++) { - result = GetI18nLogfont(Section, dlg_font_keys[i], &logfont, 0, UILanguageFile); - if (result == FALSE) { - continue; - } - if (logfont.lfFaceName[0] == '\0') { - break; - } - if (IsExistFontA(logfont.lfFaceName, logfont.lfCharSet, TRUE)) { - break; - } - } - } - if (result == FALSE) { - for (i = 0; i < _countof(dlg_font_keys); i++) { - result = GetI18nLogfont("Tera Term", dlg_font_keys[i], &logfont, 0, UILanguageFile); - if (result == FALSE) { - continue; - } - if (logfont.lfFaceName[0] == '\0') { - break; - } - if (IsExistFontA(logfont.lfFaceName, logfont.lfCharSet, TRUE)) { - break; - } - } - } - if (result == TRUE) { - TTSetDlgFontA(logfont.lfFaceName, logfont.lfHeight, logfont.lfCharSet); - return; - } - } - - // 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 - { - LOGFONT logfont; - GetMessageboxFont(&logfont); - TTSetDlgFont(logfont.lfFaceName, logfont.lfHeight, logfont.lfCharSet); - } -} - HFONT SetDlgFonts(HWND hDlg, const int nIDDlgItems[], int nIDDlgItemCount, const char *UILanguageFile, PCHAR key) { Modified: trunk/teraterm/common/dlglib_cpp.cpp =================================================================== --- trunk/teraterm/common/dlglib_cpp.cpp 2019-03-26 15:42:43 UTC (rev 7515) +++ trunk/teraterm/common/dlglib_cpp.cpp 2019-03-26 15:42:57 UTC (rev 7516) @@ -30,6 +30,7 @@ #include <windows.h> #include "dlglib.h" +#include "ttlib.h" // \x83_\x83C\x83A\x83\x8D\x83O\x83\x82\x81[\x83_\x83\x8B\x8F\xF3\x91Ԃ̎\x9E\x81AOnIdle()\x82\xF0\x8E\xC0\x8Ds\x82\xB7\x82\xE9 //#define ENABLE_CALL_IDLE_MODAL 1 @@ -240,3 +241,77 @@ hInstance, lpTemplateName, hWndParent, lpDialogFunc, (LPARAM)NULL); } + +/** + * \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, + const char *UILanguageFile, const char *Section) +{ + // teraterm.ini\x82̎w\x92\xE8 + if (SetupFName != NULL) { + LOGFONTA logfont; + BOOL result; + result = GetI18nLogfont("Tera Term", "DlgFont", &logfont, 0, SetupFName); + if (result == TRUE) { + result = IsExistFontA(logfont.lfFaceName, logfont.lfCharSet, TRUE); + if (result == TRUE) { + TTSetDlgFontA(logfont.lfFaceName, logfont.lfHeight, logfont.lfCharSet); + return; + } + } + } + + // .lng\x82̎w\x92\xE8 + if (UILanguageFile != NULL) { + static const char *dlg_font_keys[] = { + "DLG_FONT", + "DLG_TAHOMA_FONT", + "DLG_SYSTEM_FONT", + }; + BOOL result = FALSE; + LOGFONTA logfont; + size_t i; + if (Section != NULL) { + for (i = 0; i < _countof(dlg_font_keys); i++) { + result = GetI18nLogfont(Section, dlg_font_keys[i], &logfont, 0, UILanguageFile); + if (result == FALSE) { + continue; + } + if (logfont.lfFaceName[0] == '\0') { + break; + } + if (IsExistFontA(logfont.lfFaceName, logfont.lfCharSet, TRUE)) { + break; + } + } + } + if (result == FALSE) { + for (i = 0; i < _countof(dlg_font_keys); i++) { + result = GetI18nLogfont("Tera Term", dlg_font_keys[i], &logfont, 0, UILanguageFile); + if (result == FALSE) { + continue; + } + if (logfont.lfFaceName[0] == '\0') { + break; + } + if (IsExistFontA(logfont.lfFaceName, logfont.lfCharSet, TRUE)) { + break; + } + } + } + if (result == TRUE) { + TTSetDlgFontA(logfont.lfFaceName, logfont.lfHeight, logfont.lfCharSet); + return; + } + } + + // 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 + { + LOGFONT logfont; + GetMessageboxFont(&logfont); + TTSetDlgFont(logfont.lfFaceName, logfont.lfHeight, logfont.lfCharSet); + } +} Modified: trunk/teraterm/common/tipwin.cpp =================================================================== --- trunk/teraterm/common/tipwin.cpp 2019-03-26 15:42:43 UTC (rev 7515) +++ trunk/teraterm/common/tipwin.cpp 2019-03-26 15:42:57 UTC (rev 7516) @@ -58,9 +58,10 @@ #include <windows.h> #include <stdio.h> #include <tchar.h> -#include <commctrl.h> // for CCSIZEOF_STRUCT() #include <assert.h> +#include "ttlib.h" // for GetMessageboxFont() + #include "TipWin.h" #define FRAME_WIDTH 6 @@ -190,20 +191,6 @@ 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) { Modified: trunk/teraterm/common/ttlib.c =================================================================== --- trunk/teraterm/common/ttlib.c 2019-03-26 15:42:43 UTC (rev 7515) +++ trunk/teraterm/common/ttlib.c 2019-03-26 15:42:57 UTC (rev 7516) @@ -28,18 +28,19 @@ */ /* misc. routines */ -#include "teraterm.h" + #include <sys/stat.h> #include <sys/utime.h> #include <string.h> #include <time.h> #include <stdio.h> -#include "tttypes.h" #include <shlobj.h> #include <ctype.h> +#include <mbctype.h> // for _ismbblead +#include <assert.h> -// for _ismbblead -#include <mbctype.h> +#include "teraterm.h" +#include "tttypes.h" /* OS version with GetVersionEx(*1) @@ -1805,3 +1806,20 @@ { SetI18MenuStrs("Tera Term", hMenu, infos, infoCount, UILanguageFile); } + +/** + * \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; +} Modified: trunk/teraterm/common/ttlib.h =================================================================== --- trunk/teraterm/common/ttlib.h 2019-03-26 15:42:43 UTC (rev 7515) +++ trunk/teraterm/common/ttlib.h 2019-03-26 15:42:57 UTC (rev 7516) @@ -108,6 +108,7 @@ BOOL GetPositionOnWindow( HWND hWnd, const POINT *point, BOOL *InWindow, BOOL *InClient, BOOL *InTitleBar); +void GetMessageboxFont(LOGFONTA *logfont); #define CheckFlag(var, flag) (((var) & (flag)) != 0) Modified: trunk/teraterm/ttpcmn/ttpcmn.def =================================================================== --- trunk/teraterm/ttpcmn/ttpcmn.def 2019-03-26 15:42:43 UTC (rev 7515) +++ trunk/teraterm/ttpcmn/ttpcmn.def 2019-03-26 15:42:57 UTC (rev 7516) @@ -94,3 +94,4 @@ SetI18DlgStrs SetI18MenuStrs + GetMessageboxFont