From 619a97e89f418cd10ca620ea327886224053ff6a Mon Sep 17 00:00:00 2001 From: Tatsuhiko Shoji Date: Mon, 24 Feb 2025 16:39:05 +0900 Subject: [PATCH] =?UTF-8?q?=E3=82=BF=E3=82=A4=E3=83=88=E3=83=AB=E3=83=90?= =?UTF-8?q?=E3=83=BC=E3=81=AE=E5=BC=B7=E5=88=B6=E3=83=95=E3=82=A9=E3=83=B3?= =?UTF-8?q?=E3=83=88=E8=A8=AD=E5=AE=9A=E3=82=92=E6=93=8D=E4=BD=9C=E3=81=A7?= =?UTF-8?q?=E3=81=8D=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB=E3=81=97=E3=81=9F?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit タイトルバーの強制フォント設定表示リソースを追加した。 タイトルバーの強制フォント設定メニューを追加した。 タイトルバーの強制フォント設定が設定されているときにタイトルバーのフォント選択を可能にした。 --- program/TWR/BaseDialog.cpp | 8 ++++---- program/langresource.cpp | 8 +++++++- program/langresource.h | 4 +++- program/noMeiryoUI.cpp | 39 +++++++++++++++++++++++++++++++++++--- program/noMeiryoUI.h | 3 +++ program/noMeiryoUI.rc | 1 + program/resource.h | 4 +++- 7 files changed, 57 insertions(+), 10 deletions(-) diff --git a/program/TWR/BaseDialog.cpp b/program/TWR/BaseDialog.cpp index 9194703..d614188 100644 --- a/program/TWR/BaseDialog.cpp +++ b/program/TWR/BaseDialog.cpp @@ -184,22 +184,22 @@ INT_PTR CALLBACK BaseDialog::dialogProc(HWND hDlg, UINT message, WPARAM wParam, case WM_INITDIALOG: this->hWnd = hDlg; result = OnInitDialog(); - return TRUE; + return (INT_PTR)TRUE; case WM_SHOWWINDOW: if (wParam == TRUE) { PostMessage(this->hWnd, WM_DIALOG_SHOWN, 0, 0); } - return TRUE; + return (INT_PTR)TRUE; case WM_DIALOG_SHOWN: result = OnWindowShown(wParam, lParam); PostMessage(this->hWnd, WM_DIALOG_CREATED, 0, 0); - return TRUE; + return (INT_PTR)TRUE; case WM_DIALOG_CREATED: result = OnWindowCreated(wParam, lParam); - return TRUE; + return (INT_PTR)TRUE; case WM_COMMAND: result = OnCommand(wParam); diff --git a/program/langresource.cpp b/program/langresource.cpp index 13a4f23..0d2c8f7 100644 --- a/program/langresource.cpp +++ b/program/langresource.cpp @@ -1,5 +1,5 @@ /* -noMeiryoUI (C) 2005,2012-2024 Tatsuhiko Shoji +noMeiryoUI (C) 2005,2012-2025 Tatsuhiko Shoji The sources for noMeiryoUI are distributed under the MIT open source license */ @@ -283,5 +283,11 @@ void readResourceFile(TCHAR *file) readResourceItem(file, _T("MENU_TOOLS_NO_MULTI_RUN"), _T("&Don't run multiply") ); + readResourceItem(file, _T("MENU_FORCE_TITLE_SET"), + _T("F&orce title bar font change enabled") + ); + readResourceItem(file, _T("MSG_FORCE_TITLE_SET"), + _T("Changeing titlebar font may cause some troubles.") + ); } diff --git a/program/langresource.h b/program/langresource.h index bca6467..d610666 100644 --- a/program/langresource.h +++ b/program/langresource.h @@ -1,5 +1,5 @@ /* -noMeiryoUI (C) 2005,2012-2024 Tatsuhiko Shoji +noMeiryoUI (C) 2005,2012-2025 Tatsuhiko Shoji The sources for noMeiryoUI are distributed under the MIT open source license */ @@ -96,6 +96,8 @@ The sources for noMeiryoUI are distributed under the MIT open source license #define MSG_WIN11_22H2RESTRICTION 85 #define MENU_CHOICE_APP_FONT 86 #define MENU_DONT_RUN_MULTIPLY 87 +#define MENU_FORCE_TITLE_SET 88 +#define MSG_FORCE_TITLE_SET 89 extern void readResourceFile(TCHAR *file); diff --git a/program/noMeiryoUI.cpp b/program/noMeiryoUI.cpp index fc93034..f34b96c 100644 --- a/program/noMeiryoUI.cpp +++ b/program/noMeiryoUI.cpp @@ -272,6 +272,7 @@ int NoMeiryoUI::OnAppliStart(TCHAR *lpCmdLine) usePreset = false; autosetDelay = 0; + forceTitleFontSet = false; loadConfig(); handleMultipleRun(); @@ -455,6 +456,8 @@ INT_PTR NoMeiryoUI::OnWindowShown(WPARAM wParam, LPARAM lParam) appMenu->setEnabled(IDM_SET_8, has8Preset); appMenu->setEnabled(IDM_SET_10, has10Preset); appMenu->setEnabled(IDM_SET_11, has11Preset); + + // Nݒ if (!multiRun) { appMenu->CheckMenuItem(IDM_NO_MULTI_RUN, true); } @@ -516,7 +519,7 @@ INT_PTR NoMeiryoUI::OnWindowShown(WPARAM wParam, LPARAM lParam) } /** - * WM_SHOWWINDOWbZ[Wɂ\ԕύX̏ + * _CAO\ꂽɍs * * @param wParam WPARAM * @param lParam lParam @@ -528,13 +531,15 @@ INT_PTR NoMeiryoUI::OnWindowCreated(WPARAM wParam, LPARAM lParam) if (compatLevel > 0) { titleFontButton->EnableWindow(FALSE); + appMenu->setEnabled(IDM_FORCE_TITLE_SET, true); // [jObZ[W in Win11 22H2 MessageBox(this->getHwnd(), langResource[MSG_WIN11_22H2RESTRICTION].c_str(), langResource[MSG_WARNING].c_str(), MB_OK | MB_ICONWARNING); //MessageBox(this->getHwnd(), _T("Windows 11̃oJ["), // _T("႟႟"), MB_OK | MB_ICONWARNING); - + } else { + appMenu->setEnabled(IDM_FORCE_TITLE_SET, false); } return (INT_PTR)0; @@ -877,6 +882,7 @@ void NoMeiryoUI::applyDisplayText() appMenu->setText(2, langResource[10].c_str(), TRUE); appMenu->setText(IDM_CHOICE_APP_FONT, langResource[MENU_CHOICE_APP_FONT].c_str(), FALSE); appMenu->setText(IDM_NO_MULTI_RUN, langResource[MENU_DONT_RUN_MULTIPLY].c_str(), FALSE); + appMenu->setText(IDM_FORCE_TITLE_SET, langResource[MENU_FORCE_TITLE_SET].c_str(), FALSE); appMenu->setText(IDM_ANOTHER, langResource[MENU_TOOLS_THREAD].c_str(), FALSE); appMenu->setText(IDM_COMPAT7, langResource[MENU_TOOLS_SEVEN].c_str(), FALSE); appMenu->setText(3, langResource[13].c_str(), TRUE); @@ -1202,6 +1208,9 @@ INT_PTR NoMeiryoUI::OnCommand(WPARAM wParam) case IDM_NO_MULTI_RUN: toggleMultiRun(); + return (INT_PTR)0; + case IDM_FORCE_TITLE_SET: + toggleForceTitleSet(); return (INT_PTR)0; case IDM_HELPTOPIC: showHelp(); @@ -1247,6 +1256,30 @@ void NoMeiryoUI::toggleMultiRun() saveConfig(); } +/** + * @brief Windows 11 22H2ȍ~ł̋tHgݒ؂ւ + */ +void NoMeiryoUI::toggleForceTitleSet() +{ + if (appMenu->isChecked(IDM_FORCE_TITLE_SET)) { + appMenu->CheckMenuItem(IDM_FORCE_TITLE_SET, false); + forceTitleFontSet = false; + if (compatLevel > 0) { + titleFontButton->EnableWindow(FALSE); + } + } else { + appMenu->CheckMenuItem(IDM_FORCE_TITLE_SET, true); + forceTitleFontSet = true; + if (compatLevel > 0) { + titleFontButton->EnableWindow(TRUE); + MessageBox(this->getHwnd(), langResource[MSG_FORCE_TITLE_SET].c_str(), + langResource[MSG_WARNING].c_str(), MB_OK | MB_ICONWARNING); + } + } +} + + + /** * tHgIB * @@ -1361,7 +1394,7 @@ void NoMeiryoUI::selectFont(enum fontType type) case title: // Silently ignore on Win11 22H2 - if (compatLevel < 1) { + if ((compatLevel < 1) || (forceTitleFontSet)) { metrics.lfCaptionFont = logfont; titleFontName = logfont.lfFaceName; diff --git a/program/noMeiryoUI.h b/program/noMeiryoUI.h index 2402f2e..402f2c3 100644 --- a/program/noMeiryoUI.h +++ b/program/noMeiryoUI.h @@ -116,6 +116,7 @@ private: bool firstShow; int autosetDelay; + bool forceTitleFontSet; void OnLoad(); BOOL loadFontInfo(TCHAR *filename); @@ -162,6 +163,8 @@ private: protected: INT_PTR OnCommand(WPARAM wParam); + void toggleForceTitleSet(); + public: BaseDialog *createBaseDialog(); diff --git a/program/noMeiryoUI.rc b/program/noMeiryoUI.rc index 62ee16c..856d953 100644 --- a/program/noMeiryoUI.rc +++ b/program/noMeiryoUI.rc @@ -247,6 +247,7 @@ BEGIN MENUITEM "ʃXbhŃtHgύX(&A)", IDM_ANOTHER MENUITEM "tHgTCYWindows 7ƓlɈ(&7)", IDM_COMPAT7 MENUITEM "dNȂ(&D)", IDM_NO_MULTI_RUN + MENUITEM "^Cgo[̃tHgύX”\ɂ(&O)", IDM_FORCE_TITLE_SET END POPUP "wv(&H)" BEGIN diff --git a/program/resource.h b/program/resource.h index bd685b0..034789f 100644 --- a/program/resource.h +++ b/program/resource.h @@ -81,6 +81,8 @@ #define IDM_SET_11 32792 #define IDM_NO_MULTI_RUN 32793 #define IDM_CHOICE_APP_FONT 32794 +#define ID_32795 32795 +#define IDM_FORCE_TITLE_SET 32796 #define IDC_STATIC -1 #define IDC_STATIC_CHARSET -1 #define IDC_GROUP_INDIVIDUAL -1 @@ -91,7 +93,7 @@ #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NO_MFC 1 #define _APS_NEXT_RESOURCE_VALUE 134 -#define _APS_NEXT_COMMAND_VALUE 32795 +#define _APS_NEXT_COMMAND_VALUE 32797 #define _APS_NEXT_CONTROL_VALUE 1024 #define _APS_NEXT_SYMED_VALUE 110 #endif