From f44c3579994e0259c2f5ce24cf41555b92a0d005 Mon Sep 17 00:00:00 2001 From: Don HO Date: Fri, 22 Nov 2019 14:28:13 +0100 Subject: [PATCH] Add tooltip for filter usage in Find in Files dialog --- PowerEditor/installer/nativeLang/chinese.xml | 5 ++++ PowerEditor/installer/nativeLang/english.xml | 5 ++++ PowerEditor/installer/nativeLang/french.xml | 5 ++++ PowerEditor/src/MISC/Common/Common.cpp | 5 ++++ .../src/ScitillaComponent/FindReplaceDlg.cpp | 23 +++++-------------- .../src/ScitillaComponent/FindReplaceDlg.h | 2 +- .../src/ScitillaComponent/FindReplaceDlg.rc | 2 +- 7 files changed, 28 insertions(+), 19 deletions(-) diff --git a/PowerEditor/installer/nativeLang/chinese.xml b/PowerEditor/installer/nativeLang/chinese.xml index 0e5a34f6..908a45d4 100644 --- a/PowerEditor/installer/nativeLang/chinese.xml +++ b/PowerEditor/installer/nativeLang/chinese.xml @@ -1164,6 +1164,11 @@ + diff --git a/PowerEditor/installer/nativeLang/english.xml b/PowerEditor/installer/nativeLang/english.xml index 1b71b88e..f2b21b3a 100644 --- a/PowerEditor/installer/nativeLang/english.xml +++ b/PowerEditor/installer/nativeLang/english.xml @@ -1195,6 +1195,11 @@ Continue?"/> + diff --git a/PowerEditor/installer/nativeLang/french.xml b/PowerEditor/installer/nativeLang/french.xml index c0b4909d..399e41e4 100644 --- a/PowerEditor/installer/nativeLang/french.xml +++ b/PowerEditor/installer/nativeLang/french.xml @@ -1170,6 +1170,11 @@ Voulez-vous les poursuivez ?"/> + diff --git a/PowerEditor/src/MISC/Common/Common.cpp b/PowerEditor/src/MISC/Common/Common.cpp index ebce1b30..322f1653 100644 --- a/PowerEditor/src/MISC/Common/Common.cpp +++ b/PowerEditor/src/MISC/Common/Common.cpp @@ -1052,6 +1052,11 @@ HWND CreateToolTip(int toolID, HWND hDlg, HINSTANCE hInst, const PTSTR pszText) return NULL; } + SendMessage(hwndTip, TTM_ACTIVATE, TRUE, 0); + SendMessage(hwndTip, TTM_SETMAXTIPWIDTH, 0, 200); + // Make tip stay 15 seconds + SendMessage(hwndTip, TTM_SETDELAYTIME, TTDT_AUTOPOP, MAKELPARAM((15000), (0))); + return hwndTip; } diff --git a/PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp b/PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp index fa2788f4..87a1fda3 100644 --- a/PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp +++ b/PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp @@ -245,6 +245,9 @@ FindReplaceDlg::~FindReplaceDlg() if (_2ButtonsTip) ::DestroyWindow(_2ButtonsTip); + if (_filterTip) + ::DestroyWindow(_filterTip); + if (_hMonospaceFont) ::DeleteObject(_hMonospaceFont); @@ -868,29 +871,15 @@ INT_PTR CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM _countInSelFramePos.top = countP.y - 9; NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker(); - generic_string searchButtonTip = pNativeSpeaker->getLocalizedStrFromID("shift-change-direction-tip", TEXT("Use Shift+Enter to search in the opposite direction.")); + generic_string searchButtonTip = pNativeSpeaker->getLocalizedStrFromID("shift-change-direction-tip", TEXT("Use Shift+Enter to search in the opposite direction.")); _shiftTrickUpTip = CreateToolTip(IDOK, _hSelf, _hInst, const_cast(searchButtonTip.c_str())); - if (_shiftTrickUpTip) - { - SendMessage(_shiftTrickUpTip, TTM_ACTIVATE, TRUE, 0); - SendMessage(_shiftTrickUpTip, TTM_SETMAXTIPWIDTH, 0, 200); - // Make tip stay 15 seconds - SendMessage(_shiftTrickUpTip, TTM_SETDELAYTIME, TTDT_AUTOPOP, MAKELPARAM((15000), (0))); - } - generic_string checkboxTip = pNativeSpeaker->getLocalizedStrFromID("two-find-buttons-tip", TEXT("2 find buttons mode")); - _2ButtonsTip = CreateToolTip(IDC_2_BUTTONS_MODE, _hSelf, _hInst, const_cast(checkboxTip.c_str())); - if (_2ButtonsTip) - { - SendMessage(_2ButtonsTip, TTM_ACTIVATE, TRUE, 0); - SendMessage(_2ButtonsTip, TTM_SETMAXTIPWIDTH, 0, 200); - // Make tip stay 15 seconds - SendMessage(_2ButtonsTip, TTM_SETDELAYTIME, TTDT_AUTOPOP, MAKELPARAM((15000), (0))); - } + generic_string findInFilesFilterTip = pNativeSpeaker->getLocalizedStrFromID("find-in-files-filter-tip", TEXT("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")); + _filterTip = CreateToolTip(IDD_FINDINFILES_FILTERS_STATIC, _hSelf, _hInst, const_cast(findInFilesFilterTip.c_str())); ::SetWindowTextW(::GetDlgItem(_hSelf, IDC_FINDPREV), TEXT("▲")); ::SetWindowTextW(::GetDlgItem(_hSelf, IDC_FINDNEXT), TEXT("▼ Find Next")); diff --git a/PowerEditor/src/ScitillaComponent/FindReplaceDlg.h b/PowerEditor/src/ScitillaComponent/FindReplaceDlg.h index 992d156b..1c7732ae 100644 --- a/PowerEditor/src/ScitillaComponent/FindReplaceDlg.h +++ b/PowerEditor/src/ScitillaComponent/FindReplaceDlg.h @@ -362,7 +362,7 @@ private : HWND _shiftTrickUpTip = nullptr; HWND _2ButtonsTip = nullptr; - + HWND _filterTip = nullptr; bool _isRTL = false; diff --git a/PowerEditor/src/ScitillaComponent/FindReplaceDlg.rc b/PowerEditor/src/ScitillaComponent/FindReplaceDlg.rc index 4c080e1f..74ea8422 100644 --- a/PowerEditor/src/ScitillaComponent/FindReplaceDlg.rc +++ b/PowerEditor/src/ScitillaComponent/FindReplaceDlg.rc @@ -41,7 +41,7 @@ BEGIN COMBOBOX IDFINDWHAT,83,20,178,150,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_TABSTOP RTEXT "Rep&lace with :",ID_STATICTEXT_REPLACE,6,40,75,8 COMBOBOX IDREPLACEWITH,83,38,178,50,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_TABSTOP - RTEXT "Filter&s :",IDD_FINDINFILES_FILTERS_STATIC,27,58,53,8 + RTEXT "Filter&s :",IDD_FINDINFILES_FILTERS_STATIC,27,58,53,8, SS_NOTIFY COMBOBOX IDD_FINDINFILES_FILTERS_COMBO,83,56,178,150,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_TABSTOP RTEXT "Dir&ectory :",IDD_FINDINFILES_DIR_STATIC,7,76,40,8 COMBOBOX IDD_FINDINFILES_DIR_COMBO,49,74,190,150,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_TABSTOP