Revision: 10059 https://osdn.net/projects/ttssh2/scm/svn/commits/10059 Author: zmatsuo Date: 2022-07-15 21:59:29 +0900 (Fri, 15 Jul 2022) Log Message: ----------- 従来のフォント選択メニューを選ぶとその他の設定のフォントタブが出るようにした - INIファイルに次の設定をしたときののみ - TERATERM.INI の [Experimental] セクション DontUseFontDialog=ON - 設定しないと従来と同じ動作 Modified Paths: -------------- trunk/teraterm/common/tttypes.h trunk/teraterm/teraterm/addsetting.cpp trunk/teraterm/teraterm/addsetting.h trunk/teraterm/teraterm/vtwin.cpp trunk/teraterm/teraterm/vtwin.h trunk/teraterm/ttpset/ttset.c -------------- next part -------------- Modified: trunk/teraterm/common/tttypes.h =================================================================== --- trunk/teraterm/common/tttypes.h 2022-07-15 12:59:20 UTC (rev 10058) +++ trunk/teraterm/common/tttypes.h 2022-07-15 12:59:29 UTC (rev 10059) @@ -659,6 +659,7 @@ // Experimental BYTE ExperimentalTreeProprtySheetEnable; + BYTE ExperimentalDontUseFontDialog; }; typedef struct tttset TTTSet, *PTTSet; Modified: trunk/teraterm/teraterm/addsetting.cpp =================================================================== --- trunk/teraterm/teraterm/addsetting.cpp 2022-07-15 12:59:20 UTC (rev 10058) +++ trunk/teraterm/teraterm/addsetting.cpp 2022-07-15 12:59:29 UTC (rev 10059) @@ -1765,3 +1765,9 @@ delete m_Page[i]; } } + +void CAddSettingPropSheetDlg::SetStartPage(Page page) +{ + int start_page = page == DefaultPage ? 0: 7; + TTCPropSheetDlg::SetStartPage(start_page); +} Modified: trunk/teraterm/teraterm/addsetting.h =================================================================== --- trunk/teraterm/teraterm/addsetting.h 2022-07-15 12:59:20 UTC (rev 10058) +++ trunk/teraterm/teraterm/addsetting.h 2022-07-15 12:59:29 UTC (rev 10059) @@ -135,8 +135,14 @@ public: CAddSettingPropSheetDlg(HINSTANCE hInstance, HWND hParentWnd); ~CAddSettingPropSheetDlg(); + enum Page { + DefaultPage, + FontPage, + }; + void SetStartPage(Page page); private: int m_PageCountCPP; TTCPropertyPage *m_Page[7]; + Page m_StartPage; }; Modified: trunk/teraterm/teraterm/vtwin.cpp =================================================================== --- trunk/teraterm/teraterm/vtwin.cpp 2022-07-15 12:59:20 UTC (rev 10058) +++ trunk/teraterm/teraterm/vtwin.cpp 2022-07-15 12:59:29 UTC (rev 10059) @@ -4207,18 +4207,16 @@ ChangeSelectRegion(); } -// Additional settings dialog -// -// (2004.9.5 yutaka) new added -// (2005.2.22 yutaka) changed to Tab Control -// (2008.5.12 maya) changed to PropertySheet -void CVTWindow::OnExternalSetup() +void CVTWindow::OpenExternalSetup(int page) { + CAddSettingPropSheetDlg::Page additional_page = + page == 0 ? CAddSettingPropSheetDlg::DefaultPage : CAddSettingPropSheetDlg::FontPage; BOOL old_use_unicode_api = UnicodeDebugParam.UseUnicodeApi; SetDialogFont(ts.DialogFontName, ts.DialogFontPoint, ts.DialogFontCharSet, ts.UILanguageFile, "Tera Term", "DLG_TAHOMA_FONT"); CAddSettingPropSheetDlg::SetTreeViewMode(ts.ExperimentalTreeProprtySheetEnable); CAddSettingPropSheetDlg CAddSetting(m_hInst, HVTWin); + CAddSetting.SetStartPage(additional_page); INT_PTR ret = CAddSetting.DoModal(); if (ret == IDOK) { #ifdef ALPHABLEND_TYPE2 @@ -4239,6 +4237,16 @@ } } +// Additional settings dialog +// +// (2004.9.5 yutaka) new added +// (2005.2.22 yutaka) changed to Tab Control +// (2008.5.12 maya) changed to PropertySheet +void CVTWindow::OnExternalSetup() +{ + OpenExternalSetup(0); +} + void CVTWindow::OnSetupTerminal() { BOOL Ok; @@ -4314,10 +4322,15 @@ void CVTWindow::OnSetupFont() { - HelpId = HlpSetupFont; - DispSetupFontDlg(); - // ANSI\x95\\x8E\xA6\x97p\x82̃R\x81[\x83h\x83y\x81[\x83W\x82\xF0\x90ݒ肷\x82\xE9 - BuffSetDispCodePage(UnicodeDebugParam.CodePageForANSIDraw); + if (ts.ExperimentalDontUseFontDialog) { + OpenExternalSetup(CAddSettingPropSheetDlg::FontPage); + } + else { + HelpId = HlpSetupFont; + DispSetupFontDlg(); + // ANSI\x95\\x8E\xA6\x97p\x82̃R\x81[\x83h\x83y\x81[\x83W\x82\xF0\x90ݒ肷\x82\xE9 + BuffSetDispCodePage(UnicodeDebugParam.CodePageForANSIDraw); + } } static UINT_PTR CALLBACK TFontHook(HWND Dialog, UINT Message, WPARAM wParam, LPARAM lParam) @@ -4337,42 +4350,47 @@ void CVTWindow::OnSetupDlgFont() { - LOGFONTA LogFont; - CHOOSEFONTA cf; - BOOL result; - - // LOGFONT\x8F\x80\x94\xF5 - memset(&LogFont, 0, sizeof(LogFont)); - strncpy_s(LogFont.lfFaceName, sizeof(LogFont.lfFaceName), ts.DialogFontName, _TRUNCATE); - LogFont.lfHeight = -GetFontPixelFromPoint(m_hWnd, ts.DialogFontPoint); - LogFont.lfCharSet = ts.DialogFontCharSet; - if (LogFont.lfFaceName[0] == 0) { - GetMessageboxFont(&LogFont); + if (ts.ExperimentalDontUseFontDialog) { + OpenExternalSetup(CAddSettingPropSheetDlg::FontPage); } + else { + LOGFONTA LogFont; + CHOOSEFONTA cf; + BOOL result; - // \x83_\x83C\x83A\x83\x8D\x83O\x95\\x8E\xA6 - memset(&cf, 0, sizeof(cf)); - cf.lStructSize = sizeof(cf); - cf.hwndOwner = HVTWin; - cf.lpLogFont = &LogFont; - 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 = m_hInst; - HelpId = HlpSetupFont; - result = ChooseFontA(&cf); + // LOGFONT\x8F\x80\x94\xF5 + memset(&LogFont, 0, sizeof(LogFont)); + strncpy_s(LogFont.lfFaceName, sizeof(LogFont.lfFaceName), ts.DialogFontName, _TRUNCATE); + LogFont.lfHeight = -GetFontPixelFromPoint(m_hWnd, ts.DialogFontPoint); + LogFont.lfCharSet = ts.DialogFontCharSet; + if (LogFont.lfFaceName[0] == 0) { + GetMessageboxFont(&LogFont); + } - if (result) { - // \x90ݒ\xE8 - strncpy_s(ts.DialogFontName, sizeof(ts.DialogFontName), LogFont.lfFaceName, _TRUNCATE); - ts.DialogFontPoint = cf.iPointSize / 10; - ts.DialogFontCharSet = LogFont.lfCharSet; + // \x83_\x83C\x83A\x83\x8D\x83O\x95\\x8E\xA6 + memset(&cf, 0, sizeof(cf)); + cf.lStructSize = sizeof(cf); + cf.hwndOwner = HVTWin; + cf.lpLogFont = &LogFont; + 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 = m_hInst; + HelpId = HlpSetupFont; + result = ChooseFontA(&cf); + + if (result) { + // \x90ݒ\xE8 + strncpy_s(ts.DialogFontName, sizeof(ts.DialogFontName), LogFont.lfFaceName, _TRUNCATE); + ts.DialogFontPoint = cf.iPointSize / 10; + ts.DialogFontCharSet = LogFont.lfCharSet; + } } } Modified: trunk/teraterm/teraterm/vtwin.h =================================================================== --- trunk/teraterm/teraterm/vtwin.h 2022-07-15 12:59:20 UTC (rev 10058) +++ trunk/teraterm/teraterm/vtwin.h 2022-07-15 12:59:29 UTC (rev 10059) @@ -239,5 +239,6 @@ private: void CodePopup(int client_x, int client_y); + void OpenExternalSetup(int page); }; #endif Modified: trunk/teraterm/ttpset/ttset.c =================================================================== --- trunk/teraterm/ttpset/ttset.c 2022-07-15 12:59:20 UTC (rev 10058) +++ trunk/teraterm/ttpset/ttset.c 2022-07-15 12:59:29 UTC (rev 10059) @@ -2286,6 +2286,7 @@ // Experimental ts->ExperimentalTreeProprtySheetEnable = GetOnOff("Experimental", "TreeProprtySheet", FName, FALSE); + ts->ExperimentalDontUseFontDialog = GetOnOff("Experimental", "DontUseFontDialog", FName, FALSE); } void PASCAL WriteIniFile(const wchar_t *FName, PTTSet ts)