Add edit ctrl highlight on focus for incremental search & function panel

- Enable edit control highlight for incremental search and function panel
- add initializers

Fix #13187, close #13187
pull/13227/head
ozone10 2 years ago committed by Don Ho
parent 8444f85c1c
commit 2bf50bc191

@ -5055,7 +5055,7 @@ void FindIncrementDlg::display(bool toShow) const
_pRebar->setIDVisible(_rbBand.wID, toShow);
}
intptr_t CALLBACK FindIncrementDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam)
intptr_t CALLBACK FindIncrementDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM /*lParam*/)
{
switch (message)
{
@ -5091,11 +5091,6 @@ intptr_t CALLBACK FindIncrementDlg::run_dlgProc(UINT message, WPARAM wParam, LPA
case WM_CTLCOLORDLG:
case WM_CTLCOLORSTATIC:
{
if (!NppDarkMode::isEnabled())
{
return DefWindowProc(getHSelf(), message, wParam, lParam);
}
return NppDarkMode::onCtlColorDarker(reinterpret_cast<HDC>(wParam));
}
@ -5116,11 +5111,8 @@ intptr_t CALLBACK FindIncrementDlg::run_dlgProc(UINT message, WPARAM wParam, LPA
case WM_INITDIALOG:
{
LRESULT lr = DefWindowProc(getHSelf(), message, wParam, lParam);
NppDarkMode::setBorder(::GetDlgItem(getHSelf(), IDC_INCFINDTEXT));
NppDarkMode::autoSubclassAndThemeChildControls(getHSelf());
return lr;
return TRUE;
}
case WM_COMMAND :
@ -5183,7 +5175,7 @@ intptr_t CALLBACK FindIncrementDlg::run_dlgProc(UINT message, WPARAM wParam, LPA
// treat other edit notifications as unhandled
[[fallthrough]];
default:
return DefWindowProc(getHSelf(), message, wParam, lParam);
return FALSE;
}
FindOption fo;
fo._isWholeWord = false;
@ -5243,7 +5235,7 @@ intptr_t CALLBACK FindIncrementDlg::run_dlgProc(UINT message, WPARAM wParam, LPA
}
}
}
return DefWindowProc(getHSelf(), message, wParam, lParam);
return FALSE;
}
void FindIncrementDlg::markSelectedTextInc(bool enable, FindOption *opt)

@ -14,6 +14,8 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
#pragma code_page(65001)
#include <windows.h>
#include "FindReplaceDlg_rc.h"
@ -83,9 +85,9 @@ IDD_INCREMENT_FIND DIALOGEX 0, 0, 680, 20
STYLE DS_SYSMODAL | DS_CONTROL | DS_FIXEDSYS | WS_CHILD | WS_CLIPCHILDREN
FONT 8, TEXT("MS Shell Dlg")
BEGIN
PUSHBUTTON "X",IDCANCEL,2,3,16,14
PUSHBUTTON "✕",IDCANCEL,2,3,16,14
RTEXT "Find:",IDC_INCSTATIC,18,6,46,12
EDITTEXT IDC_INCFINDTEXT,65,6,175,10,ES_AUTOHSCROLL | ES_WANTRETURN | NOT WS_BORDER | WS_TABSTOP
EDITTEXT IDC_INCFINDTEXT,65,4,175,12,ES_AUTOHSCROLL | ES_WANTRETURN | WS_TABSTOP
PUSHBUTTON "<",IDC_INCFINDPREVOK,243,3,16,14, WS_TABSTOP
PUSHBUTTON ">",IDC_INCFINDNXTOK,263,3,16,14, WS_TABSTOP
CONTROL "Match &case", IDC_INCFINDMATCHCASE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,290,5,100,12

@ -204,7 +204,7 @@ void FunctionListPanel::sortOrUnsort()
_pTreeView->sort(_pTreeView->getRoot(), true);
else
{
TCHAR text2search[MAX_PATH] ;
TCHAR text2search[MAX_PATH] = { '\0' };
::SendMessage(_hSearchEdit, WM_GETTEXT, MAX_PATH, reinterpret_cast<LPARAM>(text2search));
if (text2search[0] == '\0') // main view
@ -337,7 +337,7 @@ void FunctionListPanel::reload()
bool isOK = _treeView.retrieveFoldingStateTo(currentTree, _treeView.getRoot());
if (isOK)
{
TCHAR text2Search[MAX_PATH];
TCHAR text2Search[MAX_PATH] = { '\0' };
::SendMessage(_hSearchEdit, WM_GETTEXT, MAX_PATH, reinterpret_cast<LPARAM>(text2Search));
bool isSorted = shouldSort();
addInStateArray(currentTree, text2Search, isSorted);
@ -434,8 +434,8 @@ void FunctionListPanel::initPreferencesMenu()
void FunctionListPanel::showPreferencesMenu()
{
RECT rectToolbar;
RECT rectPreferencesButton;
RECT rectToolbar{};
RECT rectPreferencesButton{};
::GetWindowRect(_hToolbarMenu, &rectToolbar);
::SendMessage(_hToolbarMenu, TB_GETRECT, IDC_PREFERENCEBUTTON_FUNCLIST, (LPARAM)&rectPreferencesButton);
@ -468,8 +468,8 @@ void FunctionListPanel::markEntry()
void FunctionListPanel::findMarkEntry(HTREEITEM htItem, LONG line)
{
HTREEITEM cItem;
TVITEM tvItem;
HTREEITEM cItem{};
TVITEM tvItem{};
for (; htItem != NULL; htItem = _treeView.getNextSibling(htItem))
{
cItem = _treeView.getChildFrom(htItem);
@ -556,7 +556,7 @@ void FunctionListPanel::init(HINSTANCE hInst, HWND hPere, ScintillaEditView **pp
bool FunctionListPanel::openSelection(const TreeView & treeView)
{
TVITEM tvItem;
TVITEM tvItem{};
tvItem.mask = TVIF_IMAGE | TVIF_PARAM;
tvItem.hItem = treeView.getSelection();
::SendMessage(treeView.getHSelf(), TVM_GETITEM, 0, reinterpret_cast<LPARAM>(&tvItem));
@ -658,7 +658,7 @@ void FunctionListPanel::notified(LPNMHDR notification)
void FunctionListPanel::searchFuncAndSwitchView()
{
TCHAR text2search[MAX_PATH] ;
TCHAR text2search[MAX_PATH] = { '\0' };
::SendMessage(_hSearchEdit, WM_GETTEXT, MAX_PATH, reinterpret_cast<LPARAM>(text2search));
if (text2search[0] == '\0')
@ -734,7 +734,7 @@ static LRESULT CALLBACK funclstSearchEditProc(HWND hwnd, UINT message, WPARAM wP
bool FunctionListPanel::shouldSort()
{
TBBUTTONINFO tbbuttonInfo;
TBBUTTONINFO tbbuttonInfo{};
tbbuttonInfo.cbSize = sizeof(TBBUTTONINFO);
tbbuttonInfo.dwMask = TBIF_STATE;
@ -745,7 +745,7 @@ bool FunctionListPanel::shouldSort()
void FunctionListPanel::setSort(bool isEnabled)
{
TBBUTTONINFO tbbuttonInfo;
TBBUTTONINFO tbbuttonInfo{};
tbbuttonInfo.cbSize = sizeof(TBBUTTONINFO);
tbbuttonInfo.dwMask = TBIF_STATE;
tbbuttonInfo.fsState = isEnabled ? TBSTATE_ENABLED | TBSTATE_CHECKED : TBSTATE_ENABLED;
@ -759,7 +759,7 @@ intptr_t CALLBACK FunctionListPanel::run_dlgProc(UINT message, WPARAM wParam, LP
// Make edit field red if not found
case WM_CTLCOLOREDIT :
{
TCHAR text2search[MAX_PATH] ;
TCHAR text2search[MAX_PATH] = { '\0' };
::SendMessage(_hSearchEdit, WM_GETTEXT, MAX_PATH, reinterpret_cast<LPARAM>(text2search));
bool textFound = false;
if (text2search[0] == '\0')
@ -844,7 +844,7 @@ intptr_t CALLBACK FunctionListPanel::run_dlgProc(UINT message, WPARAM wParam, LP
}
// Place holder of search text field
TBBUTTON tbButtons[1 + nbIcons];
TBBUTTON tbButtons[1 + nbIcons]{};
tbButtons[0].idCommand = 0;
tbButtons[0].iBitmap = editWidthSep;
@ -883,8 +883,8 @@ intptr_t CALLBACK FunctionListPanel::run_dlgProc(UINT message, WPARAM wParam, LP
_reloadTipStr = pNativeSpeaker->getAttrNameStr(_reloadTipStr.c_str(), FL_FUCTIONLISTROOTNODE, FL_RELOADLOCALNODENAME);
_preferenceTipStr = pNativeSpeaker->getAttrNameStr(_preferenceTipStr.c_str(), FL_FUCTIONLISTROOTNODE, FL_PREFERENCESLOCALNODENAME);
_hSearchEdit = CreateWindowEx(0, L"Edit", NULL,
WS_CHILD | WS_BORDER | WS_VISIBLE | ES_AUTOVSCROLL,
_hSearchEdit = CreateWindowEx(WS_EX_CLIENTEDGE, L"Edit", NULL,
WS_CHILD | WS_VISIBLE | ES_AUTOVSCROLL,
2, 2, editWidth, editHeight,
_hToolbarMenu, reinterpret_cast<HMENU>(IDC_SEARCHFIELD_FUNCLIST), _hInst, 0 );

Loading…
Cancel
Save