mirror of
https://github.com/notepad-plus-plus/notepad-plus-plus.git
synced 2025-07-28 00:04:25 +02:00
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
This commit is contained in:
parent
8444f85c1c
commit
2bf50bc191
@ -5055,7 +5055,7 @@ void FindIncrementDlg::display(bool toShow) const
|
|||||||
_pRebar->setIDVisible(_rbBand.wID, toShow);
|
_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)
|
switch (message)
|
||||||
{
|
{
|
||||||
@ -5091,11 +5091,6 @@ intptr_t CALLBACK FindIncrementDlg::run_dlgProc(UINT message, WPARAM wParam, LPA
|
|||||||
case WM_CTLCOLORDLG:
|
case WM_CTLCOLORDLG:
|
||||||
case WM_CTLCOLORSTATIC:
|
case WM_CTLCOLORSTATIC:
|
||||||
{
|
{
|
||||||
if (!NppDarkMode::isEnabled())
|
|
||||||
{
|
|
||||||
return DefWindowProc(getHSelf(), message, wParam, lParam);
|
|
||||||
}
|
|
||||||
|
|
||||||
return NppDarkMode::onCtlColorDarker(reinterpret_cast<HDC>(wParam));
|
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:
|
case WM_INITDIALOG:
|
||||||
{
|
{
|
||||||
LRESULT lr = DefWindowProc(getHSelf(), message, wParam, lParam);
|
|
||||||
|
|
||||||
NppDarkMode::setBorder(::GetDlgItem(getHSelf(), IDC_INCFINDTEXT));
|
|
||||||
NppDarkMode::autoSubclassAndThemeChildControls(getHSelf());
|
NppDarkMode::autoSubclassAndThemeChildControls(getHSelf());
|
||||||
return lr;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
case WM_COMMAND :
|
case WM_COMMAND :
|
||||||
@ -5183,7 +5175,7 @@ intptr_t CALLBACK FindIncrementDlg::run_dlgProc(UINT message, WPARAM wParam, LPA
|
|||||||
// treat other edit notifications as unhandled
|
// treat other edit notifications as unhandled
|
||||||
[[fallthrough]];
|
[[fallthrough]];
|
||||||
default:
|
default:
|
||||||
return DefWindowProc(getHSelf(), message, wParam, lParam);
|
return FALSE;
|
||||||
}
|
}
|
||||||
FindOption fo;
|
FindOption fo;
|
||||||
fo._isWholeWord = false;
|
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)
|
void FindIncrementDlg::markSelectedTextInc(bool enable, FindOption *opt)
|
||||||
|
@ -14,6 +14,8 @@
|
|||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
#pragma code_page(65001)
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include "FindReplaceDlg_rc.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
|
STYLE DS_SYSMODAL | DS_CONTROL | DS_FIXEDSYS | WS_CHILD | WS_CLIPCHILDREN
|
||||||
FONT 8, TEXT("MS Shell Dlg")
|
FONT 8, TEXT("MS Shell Dlg")
|
||||||
BEGIN
|
BEGIN
|
||||||
PUSHBUTTON "X",IDCANCEL,2,3,16,14
|
PUSHBUTTON "✕",IDCANCEL,2,3,16,14
|
||||||
RTEXT "Find:",IDC_INCSTATIC,18,6,46,12
|
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_INCFINDPREVOK,243,3,16,14, WS_TABSTOP
|
||||||
PUSHBUTTON ">",IDC_INCFINDNXTOK,263,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
|
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);
|
_pTreeView->sort(_pTreeView->getRoot(), true);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
TCHAR text2search[MAX_PATH] ;
|
TCHAR text2search[MAX_PATH] = { '\0' };
|
||||||
::SendMessage(_hSearchEdit, WM_GETTEXT, MAX_PATH, reinterpret_cast<LPARAM>(text2search));
|
::SendMessage(_hSearchEdit, WM_GETTEXT, MAX_PATH, reinterpret_cast<LPARAM>(text2search));
|
||||||
|
|
||||||
if (text2search[0] == '\0') // main view
|
if (text2search[0] == '\0') // main view
|
||||||
@ -337,7 +337,7 @@ void FunctionListPanel::reload()
|
|||||||
bool isOK = _treeView.retrieveFoldingStateTo(currentTree, _treeView.getRoot());
|
bool isOK = _treeView.retrieveFoldingStateTo(currentTree, _treeView.getRoot());
|
||||||
if (isOK)
|
if (isOK)
|
||||||
{
|
{
|
||||||
TCHAR text2Search[MAX_PATH];
|
TCHAR text2Search[MAX_PATH] = { '\0' };
|
||||||
::SendMessage(_hSearchEdit, WM_GETTEXT, MAX_PATH, reinterpret_cast<LPARAM>(text2Search));
|
::SendMessage(_hSearchEdit, WM_GETTEXT, MAX_PATH, reinterpret_cast<LPARAM>(text2Search));
|
||||||
bool isSorted = shouldSort();
|
bool isSorted = shouldSort();
|
||||||
addInStateArray(currentTree, text2Search, isSorted);
|
addInStateArray(currentTree, text2Search, isSorted);
|
||||||
@ -434,8 +434,8 @@ void FunctionListPanel::initPreferencesMenu()
|
|||||||
|
|
||||||
void FunctionListPanel::showPreferencesMenu()
|
void FunctionListPanel::showPreferencesMenu()
|
||||||
{
|
{
|
||||||
RECT rectToolbar;
|
RECT rectToolbar{};
|
||||||
RECT rectPreferencesButton;
|
RECT rectPreferencesButton{};
|
||||||
::GetWindowRect(_hToolbarMenu, &rectToolbar);
|
::GetWindowRect(_hToolbarMenu, &rectToolbar);
|
||||||
::SendMessage(_hToolbarMenu, TB_GETRECT, IDC_PREFERENCEBUTTON_FUNCLIST, (LPARAM)&rectPreferencesButton);
|
::SendMessage(_hToolbarMenu, TB_GETRECT, IDC_PREFERENCEBUTTON_FUNCLIST, (LPARAM)&rectPreferencesButton);
|
||||||
|
|
||||||
@ -468,8 +468,8 @@ void FunctionListPanel::markEntry()
|
|||||||
|
|
||||||
void FunctionListPanel::findMarkEntry(HTREEITEM htItem, LONG line)
|
void FunctionListPanel::findMarkEntry(HTREEITEM htItem, LONG line)
|
||||||
{
|
{
|
||||||
HTREEITEM cItem;
|
HTREEITEM cItem{};
|
||||||
TVITEM tvItem;
|
TVITEM tvItem{};
|
||||||
for (; htItem != NULL; htItem = _treeView.getNextSibling(htItem))
|
for (; htItem != NULL; htItem = _treeView.getNextSibling(htItem))
|
||||||
{
|
{
|
||||||
cItem = _treeView.getChildFrom(htItem);
|
cItem = _treeView.getChildFrom(htItem);
|
||||||
@ -556,7 +556,7 @@ void FunctionListPanel::init(HINSTANCE hInst, HWND hPere, ScintillaEditView **pp
|
|||||||
|
|
||||||
bool FunctionListPanel::openSelection(const TreeView & treeView)
|
bool FunctionListPanel::openSelection(const TreeView & treeView)
|
||||||
{
|
{
|
||||||
TVITEM tvItem;
|
TVITEM tvItem{};
|
||||||
tvItem.mask = TVIF_IMAGE | TVIF_PARAM;
|
tvItem.mask = TVIF_IMAGE | TVIF_PARAM;
|
||||||
tvItem.hItem = treeView.getSelection();
|
tvItem.hItem = treeView.getSelection();
|
||||||
::SendMessage(treeView.getHSelf(), TVM_GETITEM, 0, reinterpret_cast<LPARAM>(&tvItem));
|
::SendMessage(treeView.getHSelf(), TVM_GETITEM, 0, reinterpret_cast<LPARAM>(&tvItem));
|
||||||
@ -658,7 +658,7 @@ void FunctionListPanel::notified(LPNMHDR notification)
|
|||||||
|
|
||||||
void FunctionListPanel::searchFuncAndSwitchView()
|
void FunctionListPanel::searchFuncAndSwitchView()
|
||||||
{
|
{
|
||||||
TCHAR text2search[MAX_PATH] ;
|
TCHAR text2search[MAX_PATH] = { '\0' };
|
||||||
::SendMessage(_hSearchEdit, WM_GETTEXT, MAX_PATH, reinterpret_cast<LPARAM>(text2search));
|
::SendMessage(_hSearchEdit, WM_GETTEXT, MAX_PATH, reinterpret_cast<LPARAM>(text2search));
|
||||||
|
|
||||||
if (text2search[0] == '\0')
|
if (text2search[0] == '\0')
|
||||||
@ -734,7 +734,7 @@ static LRESULT CALLBACK funclstSearchEditProc(HWND hwnd, UINT message, WPARAM wP
|
|||||||
|
|
||||||
bool FunctionListPanel::shouldSort()
|
bool FunctionListPanel::shouldSort()
|
||||||
{
|
{
|
||||||
TBBUTTONINFO tbbuttonInfo;
|
TBBUTTONINFO tbbuttonInfo{};
|
||||||
tbbuttonInfo.cbSize = sizeof(TBBUTTONINFO);
|
tbbuttonInfo.cbSize = sizeof(TBBUTTONINFO);
|
||||||
tbbuttonInfo.dwMask = TBIF_STATE;
|
tbbuttonInfo.dwMask = TBIF_STATE;
|
||||||
|
|
||||||
@ -745,7 +745,7 @@ bool FunctionListPanel::shouldSort()
|
|||||||
|
|
||||||
void FunctionListPanel::setSort(bool isEnabled)
|
void FunctionListPanel::setSort(bool isEnabled)
|
||||||
{
|
{
|
||||||
TBBUTTONINFO tbbuttonInfo;
|
TBBUTTONINFO tbbuttonInfo{};
|
||||||
tbbuttonInfo.cbSize = sizeof(TBBUTTONINFO);
|
tbbuttonInfo.cbSize = sizeof(TBBUTTONINFO);
|
||||||
tbbuttonInfo.dwMask = TBIF_STATE;
|
tbbuttonInfo.dwMask = TBIF_STATE;
|
||||||
tbbuttonInfo.fsState = isEnabled ? TBSTATE_ENABLED | TBSTATE_CHECKED : TBSTATE_ENABLED;
|
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
|
// Make edit field red if not found
|
||||||
case WM_CTLCOLOREDIT :
|
case WM_CTLCOLOREDIT :
|
||||||
{
|
{
|
||||||
TCHAR text2search[MAX_PATH] ;
|
TCHAR text2search[MAX_PATH] = { '\0' };
|
||||||
::SendMessage(_hSearchEdit, WM_GETTEXT, MAX_PATH, reinterpret_cast<LPARAM>(text2search));
|
::SendMessage(_hSearchEdit, WM_GETTEXT, MAX_PATH, reinterpret_cast<LPARAM>(text2search));
|
||||||
bool textFound = false;
|
bool textFound = false;
|
||||||
if (text2search[0] == '\0')
|
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
|
// Place holder of search text field
|
||||||
TBBUTTON tbButtons[1 + nbIcons];
|
TBBUTTON tbButtons[1 + nbIcons]{};
|
||||||
|
|
||||||
tbButtons[0].idCommand = 0;
|
tbButtons[0].idCommand = 0;
|
||||||
tbButtons[0].iBitmap = editWidthSep;
|
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);
|
_reloadTipStr = pNativeSpeaker->getAttrNameStr(_reloadTipStr.c_str(), FL_FUCTIONLISTROOTNODE, FL_RELOADLOCALNODENAME);
|
||||||
_preferenceTipStr = pNativeSpeaker->getAttrNameStr(_preferenceTipStr.c_str(), FL_FUCTIONLISTROOTNODE, FL_PREFERENCESLOCALNODENAME);
|
_preferenceTipStr = pNativeSpeaker->getAttrNameStr(_preferenceTipStr.c_str(), FL_FUCTIONLISTROOTNODE, FL_PREFERENCESLOCALNODENAME);
|
||||||
|
|
||||||
_hSearchEdit = CreateWindowEx(0, L"Edit", NULL,
|
_hSearchEdit = CreateWindowEx(WS_EX_CLIENTEDGE, L"Edit", NULL,
|
||||||
WS_CHILD | WS_BORDER | WS_VISIBLE | ES_AUTOVSCROLL,
|
WS_CHILD | WS_VISIBLE | ES_AUTOVSCROLL,
|
||||||
2, 2, editWidth, editHeight,
|
2, 2, editWidth, editHeight,
|
||||||
_hToolbarMenu, reinterpret_cast<HMENU>(IDC_SEARCHFIELD_FUNCLIST), _hInst, 0 );
|
_hToolbarMenu, reinterpret_cast<HMENU>(IDC_SEARCHFIELD_FUNCLIST), _hInst, 0 );
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user