From 08084d2b14cccfc345fd7c6d856939653674408a Mon Sep 17 00:00:00 2001 From: Don Ho Date: Sun, 27 Apr 2025 18:55:05 +0200 Subject: [PATCH] Use "(?)" static text instead of "?" button for the tip/info/message Close #16478 --- .../src/ScintillaComponent/FindReplaceDlg.cpp | 21 +++++- .../src/ScintillaComponent/FindReplaceDlg.rc | 3 +- .../ScintillaComponent/FindReplaceDlg_rc.h | 2 +- .../src/WinControls/Preference/preference.rc | 8 +-- .../WinControls/Preference/preferenceDlg.cpp | 71 ++++++++++++++----- 5 files changed, 79 insertions(+), 26 deletions(-) diff --git a/PowerEditor/src/ScintillaComponent/FindReplaceDlg.cpp b/PowerEditor/src/ScintillaComponent/FindReplaceDlg.cpp index 8a4e37b6b..693bed10e 100644 --- a/PowerEditor/src/ScintillaComponent/FindReplaceDlg.cpp +++ b/PowerEditor/src/ScintillaComponent/FindReplaceDlg.cpp @@ -1228,7 +1228,7 @@ void FindReplaceDlg::resizeDialogElements() const auto moveBtnIDs = { IDCMARKALL, IDC_CLEAR_ALL, IDCCOUNTALL, IDC_FINDALL_OPENEDFILES, IDC_FINDALL_CURRENTFILE, IDREPLACE, IDREPLACEALL, IDC_REPLACE_OPENEDFILES, IDD_FINDINFILES_FIND_BUTTON, IDD_FINDINFILES_REPLACEINFILES, IDCANCEL, - IDC_FINDPREV, IDC_COPY_MARKED_TEXT, IDD_FINDINFILES_REPLACEINPROJECTS, IDD_FINDINFILES_SETDIRFROMDOC_BUTTON, + IDC_FINDPREV, IDC_COPY_MARKED_TEXT, IDD_FINDINFILES_REPLACEINPROJECTS, IDD_FINDINFILES_SETDIRFROMDOC_BUTTON }; const auto moveOtherCtrlsIDs = { @@ -1332,6 +1332,11 @@ void FindReplaceDlg::resizeDialogElements() getMappedChildRect(hFPrevBtn, rcFPrevBtn); hdwp = setOrDeferWindowPos(hdwp, ::GetDlgItem(_hSelf, IDC_FINDNEXT), nullptr, rcFPrevBtn.right + gap, rcOkBtn.top, 0, 0, SWP_NOSIZE | flags); + RECT rcFilterTipStatic{}; + HWND FilterTipStatic = ::GetDlgItem(_hSelf, IDC_FIF_FILTER_TIP_STATIC); + getMappedChildRect(FilterTipStatic, rcFilterTipStatic); + hdwp = setOrDeferWindowPos(hdwp, FilterTipStatic, nullptr, rcSwapBtn.left + 4, rcFilterTipStatic.top, 0, 0, SWP_NOSIZE | flags); + RECT rcBrowseBtn{}; HWND hBrowseBtn = ::GetDlgItem(_hSelf, IDD_FINDINFILES_BROWSE_BUTTON); getMappedChildRect(hBrowseBtn, rcBrowseBtn); @@ -1476,8 +1481,19 @@ intptr_t CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARA } case WM_CTLCOLORDLG: + { + return NppDarkMode::onCtlColorDlg(reinterpret_cast(wParam)); + } + case WM_CTLCOLORSTATIC: { + auto hdc = reinterpret_cast(wParam); + const int dlgCtrlID = ::GetDlgCtrlID(reinterpret_cast(lParam)); + if (dlgCtrlID == IDC_FIF_FILTER_TIP_STATIC) + { + return NppDarkMode::onCtlColorDlgLinkText(hdc, true); + } + return NppDarkMode::onCtlColorDlg(reinterpret_cast(wParam)); } @@ -1592,7 +1608,7 @@ intptr_t CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARA _2ButtonsTip = CreateToolTip(IDC_2_BUTTONS_MODE, _hSelf, _hInst, const_cast(checkboxTip.c_str()), _isRTL); wstring findInFilesFilterTip = pNativeSpeaker->getLocalizedStrFromID("find-in-files-filter-tip", L"Find in cpp, cxx, h, hxx && hpp:\r*.cpp *.cxx *.h *.hxx *.hpp\r\rFind in all files except exe, obj && log:\r*.* !*.exe !*.obj !*.log\r\rFind in all files but exclude folders tests, bin && bin64:\r*.* !\\tests !\\bin*\r\rFind in all files but exclude all folders log or logs recursively:\r*.* !+\\log*"); - _filterTip = CreateToolTip(IDD_FINDINFILES_FILTERS_STATIC, _hSelf, _hInst, const_cast(findInFilesFilterTip.c_str()), _isRTL); + _filterTip = CreateToolTip(IDC_FIF_FILTER_TIP_STATIC, _hSelf, _hInst, const_cast(findInFilesFilterTip.c_str()), _isRTL); wstring dirFromActiveDocTip = pNativeSpeaker->getLocalizedStrFromID("find-in-files-dir-from-active-doc-tip", L"Fill directory field based on active document"); _dirFromActiveDocTip = CreateToolTip(IDD_FINDINFILES_SETDIRFROMDOC_BUTTON, _hSelf, _hInst, const_cast(dirFromActiveDocTip.c_str()), _isRTL); @@ -4070,6 +4086,7 @@ void FindReplaceDlg::enableFindInFilesControls(bool isEnable, bool projectPanels showFindDlgItem(IDD_FINDINFILES_REPLACEINPROJECTS, isEnable && projectPanels); showFindDlgItem(IDD_FINDINFILES_FILTERS_STATIC, isEnable); showFindDlgItem(IDD_FINDINFILES_FILTERS_COMBO, isEnable); + showFindDlgItem(IDC_FIF_FILTER_TIP_STATIC, isEnable); showFindDlgItem(IDD_FINDINFILES_DIR_STATIC, isEnable && (!projectPanels)); showFindDlgItem(IDD_FINDINFILES_DIR_COMBO, isEnable && (!projectPanels)); showFindDlgItem(IDD_FINDINFILES_BROWSE_BUTTON, isEnable && (!projectPanels)); diff --git a/PowerEditor/src/ScintillaComponent/FindReplaceDlg.rc b/PowerEditor/src/ScintillaComponent/FindReplaceDlg.rc index 431575c53..48e6d7e72 100644 --- a/PowerEditor/src/ScintillaComponent/FindReplaceDlg.rc +++ b/PowerEditor/src/ScintillaComponent/FindReplaceDlg.rc @@ -32,8 +32,9 @@ BEGIN RTEXT "Rep&lace with:",ID_STATICTEXT_REPLACE,1,40,73,8 COMBOBOX IDREPLACEWITH,76,38,170,50,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP CONTROL "",IDD_FINDREPLACE_SWAP_BUTTON,"Button",BS_SPLITBUTTON | WS_TABSTOP,250,27,24,17 - RTEXT "Filter&s:",IDD_FINDINFILES_FILTERS_STATIC,1,58,73,8, SS_NOTIFY + RTEXT "Filter&s:",IDD_FINDINFILES_FILTERS_STATIC,1,58,73,8 COMBOBOX IDD_FINDINFILES_FILTERS_COMBO,76,56,170,150,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP + LTEXT "(?)",IDC_FIF_FILTER_TIP_STATIC,252,58,10,8, SS_NOTIFY RTEXT "Dir&ectory:",IDD_FINDINFILES_DIR_STATIC,7,76,41,8 COMBOBOX IDD_FINDINFILES_DIR_COMBO,50,74,196,150,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP PUSHBUTTON "...",IDD_FINDINFILES_BROWSE_BUTTON,250,73,16,14 diff --git a/PowerEditor/src/ScintillaComponent/FindReplaceDlg_rc.h b/PowerEditor/src/ScintillaComponent/FindReplaceDlg_rc.h index 5706a7f2e..87a929bbf 100644 --- a/PowerEditor/src/ScintillaComponent/FindReplaceDlg_rc.h +++ b/PowerEditor/src/ScintillaComponent/FindReplaceDlg_rc.h @@ -48,7 +48,7 @@ #define IDF_PURGE_CHECK 4 #define IDC_FINDALL_STATIC 1619 #define IDFINDWHAT_STATIC 1620 -//#define IDC_DIR_STATIC 1621 +#define IDC_FIF_FILTER_TIP_STATIC 1621 #define IDC_PERCENTAGE_SLIDER 1622 #define IDC_TRANSPARENT_GRPBOX 1623 diff --git a/PowerEditor/src/WinControls/Preference/preference.rc b/PowerEditor/src/WinControls/Preference/preference.rc index 7fd6b50f2..e0af64bfa 100644 --- a/PowerEditor/src/WinControls/Preference/preference.rc +++ b/PowerEditor/src/WinControls/Preference/preference.rc @@ -215,7 +215,7 @@ BEGIN CONTROL "No edge",IDC_CHECK_NOEDGE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,28,146,60,10 GROUPBOX "Vertical Edge Settings",IDC_VES_GB_STATIC,116,21,148,89,BS_CENTER - PUSHBUTTON "?",IDC_BUTTON_VES_TIP,182,33,16,14,NOT WS_TABSTOP + LTEXT "(?)",IDC_BUTTON_VES_TIP,184,33,10,8,SS_NOTIFY EDITTEXT IDC_COLUMNPOS_EDIT,126,51,128,36,ES_MULTILINE CONTROL "Background mode",IDC_CHECK_EDGEBGMODE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,127,94,122,10 @@ -423,7 +423,7 @@ IDD_PREFERENCE_SUB_SEARCHING DIALOGEX 115, 10, 460, 205 BEGIN GROUPBOX "When Find Dialog is Invoked", IDD_FILL_FIND_FIELD_GRP_STATIC, 31, 4, 323, 85, BS_CENTER RTEXT "Minimum Size for Auto-Checking ""In selection"":", IDC_INSELECTION_THRESHOLD_STATIC, 37, 16, 210, 8 - PUSHBUTTON "?", IDC_INSELECTION_THRESH_QUESTION_BUTTON, 283, 14, 16, 14, NOT WS_TABSTOP + LTEXT "(?)",IDC_INSELECTION_THRESH_QUESTION_BUTTON,283, 16,10,8,SS_NOTIFY EDITTEXT IDC_INSELECTION_THRESHOLD_EDIT, 250, 15, 27, 12, ES_CENTER | ES_NUMBER CONTROL "Fill Find Field with Selected Text", IDC_CHECK_FILL_FIND_FIELD_WITH_SELECTED, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 37, 59, 300, 10 CONTROL "Select Word Under Caret when Nothing Selected", IDC_CHECK_FILL_FIND_FIELD_SELECT_CARET, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 52, 73, 275, 10 @@ -545,7 +545,7 @@ BEGIN CONTROL "Use default Word character list as it is",IDC_RADIO_WORDCHAR_DEFAULT,"Button",BS_AUTORADIOBUTTON | WS_GROUP,100,18,250,10 CONTROL "Add your character as part of word\r(don't choose it unless you know what you're doing)",IDC_RADIO_WORDCHAR_CUSTOM,"Button",BS_AUTORADIOBUTTON | BS_MULTILINE | BS_TOP | WS_GROUP,100,32,250,20 EDITTEXT IDC_WORDCHAR_CUSTOM_EDIT,111,54,180,12,ES_AUTOHSCROLL - PUSHBUTTON "?",IDD_WORDCHAR_QUESTION_BUTTON,303,53,16,14 + LTEXT "(?)",IDD_WORDCHAR_QUESTION_BUTTON,303, 55,10,8,SS_NOTIFY LTEXT "",IDD_STATIC_WORDCHAR_WARNING,111,70,210,8 GROUPBOX "Delimiter selection settings (Ctrl + Mouse double click)",IDC_DELIMITERSETTINGS_GB_STATIC,89,113,268,70,BS_CENTER @@ -598,7 +598,7 @@ STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD FONT 8, "MS Shell Dlg", 0, 0, 0x1 BEGIN GROUPBOX "Large File Restriction",IDC_GROUPSTATIC_PERFORMANCE_RESTRICTION,73,7,301,189,BS_CENTER - PUSHBUTTON "?",IDD_PERFORMANCE_TIP_QUESTION_BUTTON,215,21,16,14 + LTEXT "(?)",IDD_PERFORMANCE_TIP_QUESTION_BUTTON,217, 23,10,8,SS_NOTIFY CONTROL "Enable Large File Restriction (no syntax highlighting)",IDC_CHECK_PERFORMANCE_ENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,79,41,290,10 RTEXT "Define Large File Size:",IDC_STATIC_PERFORMANCE_FILESIZE,75,59,125,8 EDITTEXT IDC_EDIT_PERFORMANCE_FILESIZE,201,57,24,12,ES_RIGHT | ES_NUMBER diff --git a/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp b/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp index 05a2bddf1..cdf442685 100644 --- a/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp +++ b/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp @@ -923,6 +923,7 @@ intptr_t CALLBACK ToolbarSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM { return NppDarkMode::onCtlColorDlgLinkText(hdc, !isCheckedOrNot(IDC_RADIO_STANDARD)); } + return NppDarkMode::onCtlColorDlg(hdc); } @@ -2792,8 +2793,19 @@ intptr_t CALLBACK MarginsBorderEdgeSubDlg::run_dlgProc(UINT message, WPARAM wPar } case WM_CTLCOLORDLG: + { + return NppDarkMode::onCtlColorDlg(reinterpret_cast(wParam)); + } + case WM_CTLCOLORSTATIC: { + auto hdc = reinterpret_cast(wParam); + const int dlgCtrlID = ::GetDlgCtrlID(reinterpret_cast(lParam)); + if (dlgCtrlID == IDC_BUTTON_VES_TIP) + { + return NppDarkMode::onCtlColorDlgLinkText(hdc, true); + } + return NppDarkMode::onCtlColorDlg(reinterpret_cast(wParam)); } @@ -6146,24 +6158,33 @@ intptr_t CALLBACK DelimiterSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPAR auto hdcStatic = reinterpret_cast(wParam); auto dlgCtrlID = ::GetDlgCtrlID(reinterpret_cast(lParam)); bool isBlabla = (dlgCtrlID == IDD_STATIC_BLABLA) || (dlgCtrlID == IDD_STATIC_BLABLA2NDLINE); - if (NppDarkMode::isEnabled()) + + if (dlgCtrlID == IDD_WORDCHAR_QUESTION_BUTTON) { - if (isBlabla) + return NppDarkMode::onCtlColorDlgLinkText(hdcStatic, true); + } + else + { + if (NppDarkMode::isEnabled()) { - return NppDarkMode::onCtlColor(hdcStatic); + if (isBlabla) + { + return NppDarkMode::onCtlColor(hdcStatic); + } + return NppDarkMode::onCtlColorDlg(hdcStatic); + } + else if (isBlabla) + { + COLORREF bgColor = getCtrlBgColor(_hSelf); + SetTextColor(hdcStatic, RGB(0, 0, 0)); + BYTE r = GetRValue(bgColor) - 30; + BYTE g = MyGetGValue(bgColor) - 30; + BYTE b = GetBValue(bgColor) - 30; + SetBkColor(hdcStatic, RGB(r, g, b)); + return TRUE; } - return NppDarkMode::onCtlColorDlg(hdcStatic); - } - else if (isBlabla) - { - COLORREF bgColor = getCtrlBgColor(_hSelf); - SetTextColor(hdcStatic, RGB(0, 0, 0)); - BYTE r = GetRValue(bgColor) - 30; - BYTE g = MyGetGValue(bgColor) - 30; - BYTE b = GetBValue(bgColor) - 30; - SetBkColor(hdcStatic, RGB(r, g, b)); - return TRUE; } + break; } @@ -6523,10 +6544,13 @@ intptr_t CALLBACK PerformanceSubDlg::run_dlgProc(UINT message , WPARAM wParam, L auto hdcStatic = reinterpret_cast(wParam); auto dlgCtrlID = ::GetDlgCtrlID(reinterpret_cast(lParam)); - bool isStaticText = (dlgCtrlID == IDC_STATIC_PERFORMANCE_FILESIZE || dlgCtrlID == IDC_STATIC_PERFORMANCE_MB); - //set the static text colors to show enable/disable instead of ::EnableWindow which causes blurry text - if (isStaticText) + if (dlgCtrlID == IDD_PERFORMANCE_TIP_QUESTION_BUTTON) { + return NppDarkMode::onCtlColorDlgLinkText(hdcStatic, true); + } + else if (dlgCtrlID == IDC_STATIC_PERFORMANCE_FILESIZE || dlgCtrlID == IDC_STATIC_PERFORMANCE_MB) + { + //set the static text colors to show enable/disable instead of ::EnableWindow which causes blurry text bool isTextEnabled = isCheckedOrNot(IDC_CHECK_PERFORMANCE_ENABLE); return NppDarkMode::onCtlColorDlgStaticText(hdcStatic, isTextEnabled); } @@ -6783,7 +6807,7 @@ intptr_t CALLBACK SearchEngineSubDlg::run_dlgProc(UINT message, WPARAM wParam, L return FALSE; } -intptr_t CALLBACK SearchingSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM) +intptr_t CALLBACK SearchingSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam) { NppParameters& nppParams = NppParameters::getInstance(); NppGUI& nppGUI = nppParams.getNppGUI(); @@ -6825,8 +6849,19 @@ intptr_t CALLBACK SearchingSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPAR } case WM_CTLCOLORDLG: + { + return NppDarkMode::onCtlColorDlg(reinterpret_cast(wParam)); + } + case WM_CTLCOLORSTATIC: { + auto hdc = reinterpret_cast(wParam); + const int dlgCtrlID = ::GetDlgCtrlID(reinterpret_cast(lParam)); + if (dlgCtrlID == IDC_INSELECTION_THRESH_QUESTION_BUTTON) + { + return NppDarkMode::onCtlColorDlgLinkText(hdc, true); + } + return NppDarkMode::onCtlColorDlg(reinterpret_cast(wParam)); }