From c02c23b7d431fe27ebad41619df4c2b4f1ea3a9a Mon Sep 17 00:00:00 2001 From: Don Ho Date: Mon, 17 Oct 2022 17:09:02 +0200 Subject: [PATCH] Add tooltips in performance section to make features more explicit Ref: https://github.com/notepad-plus-plus/notepad-plus-plus/pull/12310#issuecomment-1279826809 --- PowerEditor/installer/nativeLang/english.xml | 3 ++- PowerEditor/installer/nativeLang/french.xml | 2 ++ .../nativeLang/taiwaneseMandarin.xml | 5 ++++- PowerEditor/src/NppDarkMode.cpp | 20 ++++++++++++++++++- .../WinControls/Preference/preferenceDlg.cpp | 11 ++++++++++ .../WinControls/Preference/preferenceDlg.h | 10 ++++++++++ 6 files changed, 48 insertions(+), 3 deletions(-) diff --git a/PowerEditor/installer/nativeLang/english.xml b/PowerEditor/installer/nativeLang/english.xml index b5206e995..4a47c1559 100644 --- a/PowerEditor/installer/nativeLang/english.xml +++ b/PowerEditor/installer/nativeLang/english.xml @@ -1605,7 +1605,8 @@ Find in all files but exclude all folders log or logs recursively: - + + diff --git a/PowerEditor/installer/nativeLang/french.xml b/PowerEditor/installer/nativeLang/french.xml index 31fd0899e..7d062ed18 100644 --- a/PowerEditor/installer/nativeLang/french.xml +++ b/PowerEditor/installer/nativeLang/french.xml @@ -1606,6 +1606,8 @@ Rechercher dans tous les fichiers mais pas dans les dossiers log ou logs récurs + + diff --git a/PowerEditor/installer/nativeLang/taiwaneseMandarin.xml b/PowerEditor/installer/nativeLang/taiwaneseMandarin.xml index ac8ddffe5..1e2f3a17b 100644 --- a/PowerEditor/installer/nativeLang/taiwaneseMandarin.xml +++ b/PowerEditor/installer/nativeLang/taiwaneseMandarin.xml @@ -1011,6 +1011,7 @@ + @@ -1142,7 +1143,7 @@ - + @@ -1546,6 +1547,8 @@ + + diff --git a/PowerEditor/src/NppDarkMode.cpp b/PowerEditor/src/NppDarkMode.cpp index 98db368e7..439b0d310 100644 --- a/PowerEditor/src/NppDarkMode.cpp +++ b/PowerEditor/src/NppDarkMode.cpp @@ -1795,7 +1795,7 @@ namespace NppDarkMode EnumChildWindows(hwndParent, [](HWND hwnd, LPARAM lParam) WINAPI_LAMBDA { auto& p = *reinterpret_cast(lParam); - constexpr size_t classNameLen = 16; + constexpr size_t classNameLen = 32; TCHAR className[classNameLen]{}; GetClassName(hwnd, className, classNameLen); @@ -1854,6 +1854,24 @@ namespace NppDarkMode return TRUE; } + /* + // for debugging + if (wcscmp(className, L"#32770") == 0) + { + return TRUE; + } + + if (wcscmp(className, L"Static") == 0) + { + return TRUE; + } + + if (wcscmp(className, L"msctls_trackbar32") == 0) + { + return TRUE; + } + */ + return TRUE; }, reinterpret_cast(&p)); } diff --git a/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp b/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp index 379bfa057..69679987a 100644 --- a/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp +++ b/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp @@ -263,6 +263,12 @@ intptr_t CALLBACK PreferenceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM case NPPM_INTERNAL_REFRESHDARKMODE: { NppDarkMode::autoThemeChildControls(_hSelf); + + if (_performanceSubDlg._enableLargeFileRestrictionTip) + NppDarkMode::setDarkTooltips(_performanceSubDlg._enableLargeFileRestrictionTip, NppDarkMode::ToolTipsType::tooltip); + if (_performanceSubDlg._changeLargeFileLengthTip) + NppDarkMode::setDarkTooltips(_performanceSubDlg._changeLargeFileLengthTip, NppDarkMode::ToolTipsType::tooltip); + return TRUE; } @@ -4931,6 +4937,11 @@ intptr_t CALLBACK PerformanceSubDlg::run_dlgProc(UINT message , WPARAM wParam, L ::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_PERFORMANCE_ALLOWSMARTHILITE), largeFileRestrictionEnabled); ::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_PERFORMANCE_ALLOWWORDWRAP), largeFileRestrictionEnabled); + NativeLangSpeaker* pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker(); + generic_string checkboxTip = pNativeSpeaker->getLocalizedStrFromID("enable-disable-largeFileRestriction-tip", TEXT("Toggling \"Enable Large File Restriction\" takes effect only after closing and re-opening the large file")); + generic_string editTip = pNativeSpeaker->getLocalizedStrFromID("change-largeFileRestriction_fileLength-tip", TEXT("Modifying file size value takes effect only after closing and re-opening the large file")); + _enableLargeFileRestrictionTip = CreateToolTip(IDC_CHECK_PERFORMANCE_ENABLE, _hSelf, _hInst, const_cast(checkboxTip.c_str()), false); + _changeLargeFileLengthTip = CreateToolTip(IDC_EDIT_PERFORMANCE_FILESIZE, _hSelf, _hInst, const_cast(editTip.c_str()), false); } break; diff --git a/PowerEditor/src/WinControls/Preference/preferenceDlg.h b/PowerEditor/src/WinControls/Preference/preferenceDlg.h index d17b8440e..0f635006a 100644 --- a/PowerEditor/src/WinControls/Preference/preferenceDlg.h +++ b/PowerEditor/src/WinControls/Preference/preferenceDlg.h @@ -254,11 +254,21 @@ private : class PerformanceSubDlg : public StaticDialog { +friend class PreferenceDlg; public : PerformanceSubDlg() = default; + ~PerformanceSubDlg() { + if (_enableLargeFileRestrictionTip) + ::DestroyWindow(_enableLargeFileRestrictionTip); + if (_changeLargeFileLengthTip) + ::DestroyWindow(_changeLargeFileLengthTip); + }; private : intptr_t CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam); + + HWND _enableLargeFileRestrictionTip = nullptr; + HWND _changeLargeFileLengthTip = nullptr; }; class PreferenceDlg : public StaticDialog