Skip to content

Commit be52eab

Browse files
committed
Find/Replace - add hints #274
1 parent 208f7ab commit be52eab

File tree

3 files changed

+37
-0
lines changed

3 files changed

+37
-0
lines changed

src/Edit.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5101,6 +5101,16 @@ INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd, UINT umsg, WPARAM wParam, LP
51015101
// [2e]: Ctrl+H: Replace input behaviour #121
51025102
n2e_SubclassFindEditInCombo(hwnd, IDC_FINDTEXT);
51035103
n2e_SubclassFindEditInCombo(hwnd, IDC_REPLACETEXT);
5104+
{
5105+
// [2e]: Find/Replace - add hints #274
5106+
const HWND hwndToolTip = n2e_ToolTipCreate(hwnd);
5107+
n2e_ToolTipAddControl(hwndToolTip, GetDlgItem(hwnd, IDOK), L"Select match (F3, Enter), Select from start (Ctrl+Enter), Select until (F2)");
5108+
n2e_ToolTipAddControl(hwndToolTip, GetDlgItem(hwnd, IDC_FINDPREV), L"Select match (Shift+F3), Select until (Shift+F2)");
5109+
if (GetDlgItem(hwnd, IDC_REPLACE) != NULL)
5110+
{
5111+
n2e_ToolTipAddControl(hwndToolTip, GetDlgItem(hwnd, IDC_REPLACE), L"Select match or replace and go to next (F4)");
5112+
}
5113+
}
51045114
// [/2e]
51055115
}
51065116
return TRUE;

src/Extension/Utils.c

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1307,3 +1307,27 @@ void n2e_EditJumpTo(const HWND hwnd, const int iNewLine, const int iNewCol, cons
13071307
SciCall_SetYCaretPolicy(CARET_EVEN, 0);
13081308
}
13091309
}
1310+
1311+
HWND n2e_ToolTipCreate(const HWND hwndParent)
1312+
{
1313+
return CreateWindowEx(0, TOOLTIPS_CLASS, NULL, WS_POPUP | TTS_ALWAYSTIP,
1314+
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, hwndParent, NULL, NULL, NULL);
1315+
}
1316+
1317+
BOOL n2e_ToolTipAddControl(const HWND hwndToolTip, const HWND hwndControl, LPSTR pszText)
1318+
{
1319+
const HWND hwndParent = GetParent(hwndToolTip);
1320+
if (!hwndToolTip || !IsWindow(hwndToolTip) || !hwndParent)
1321+
{
1322+
return FALSE;
1323+
}
1324+
1325+
TOOLINFO ti = { 0 };
1326+
ti.cbSize = sizeof(ti);
1327+
ti.hwnd = hwndParent;
1328+
ti.uFlags = TTF_IDISHWND | TTF_SUBCLASS;
1329+
ti.uId = (UINT_PTR)hwndControl;
1330+
ti.lpszText = pszText;
1331+
1332+
return SendMessage(hwndToolTip, TTM_ADDTOOL, 0, (LPARAM)&ti) == TRUE;
1333+
}

src/Extension/Utils.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,3 +163,6 @@ int n2e_GetCheckedRadioButton(const HWND hwnd, const int idFirst, const int idLa
163163

164164
void n2e_UpdateFavLnkParams(TADDFAVPARAMS* lpParams);
165165
void n2e_EditJumpTo(const HWND hwnd, const int iNewLine, const int iNewCol, const int iNewSelStart, const int iNewSelEnd);
166+
167+
HWND n2e_ToolTipCreate(const HWND hwndParent);
168+
BOOL n2e_ToolTipAddControl(const HWND hwndToolTip, const HWND hwndControl, LPSTR pszText);

0 commit comments

Comments
 (0)