Add tip in Find dialog for informing users the usage of Shift+Enter
This commit is contained in:
parent
a435e68164
commit
a482cbd215
|
@ -932,3 +932,46 @@ generic_string GetLastErrorAsString(DWORD errorCode)
|
||||||
|
|
||||||
return errorMsg;
|
return errorMsg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HWND CreateToolTip(int toolID, HWND hDlg, HINSTANCE hInst, const PTSTR pszText)
|
||||||
|
{
|
||||||
|
if (!toolID || !hDlg || !pszText)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get the window of the tool.
|
||||||
|
HWND hwndTool = GetDlgItem(hDlg, toolID);
|
||||||
|
if (!hwndTool)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create the tooltip. g_hInst is the global instance handle.
|
||||||
|
HWND hwndTip = CreateWindowEx(NULL, TOOLTIPS_CLASS, NULL,
|
||||||
|
WS_POPUP | TTS_ALWAYSTIP | TTS_BALLOON,
|
||||||
|
CW_USEDEFAULT, CW_USEDEFAULT,
|
||||||
|
CW_USEDEFAULT, CW_USEDEFAULT,
|
||||||
|
hDlg, NULL,
|
||||||
|
hInst, NULL);
|
||||||
|
|
||||||
|
if (!hwndTip)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Associate the tooltip with the tool.
|
||||||
|
TOOLINFO toolInfo = { 0 };
|
||||||
|
toolInfo.cbSize = sizeof(toolInfo);
|
||||||
|
toolInfo.hwnd = hDlg;
|
||||||
|
toolInfo.uFlags = TTF_IDISHWND | TTF_SUBCLASS;
|
||||||
|
toolInfo.uId = (UINT_PTR)hwndTool;
|
||||||
|
toolInfo.lpszText = pszText;
|
||||||
|
if (!SendMessage(hwndTip, TTM_ADDTOOL, 0, (LPARAM)&toolInfo))
|
||||||
|
{
|
||||||
|
DestroyWindow(hwndTip);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return hwndTip;
|
||||||
|
}
|
||||||
|
|
|
@ -186,4 +186,6 @@ bool str2Clipboard(const generic_string &str2cpy, HWND hwnd);
|
||||||
generic_string GetLastErrorAsString(DWORD errorCode = 0);
|
generic_string GetLastErrorAsString(DWORD errorCode = 0);
|
||||||
|
|
||||||
generic_string intToString(int val);
|
generic_string intToString(int val);
|
||||||
generic_string uintToString(unsigned int val);
|
generic_string uintToString(unsigned int val);
|
||||||
|
|
||||||
|
HWND CreateToolTip(int toolID, HWND hDlg, HINSTANCE hInst, const PTSTR pszText);
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
#include "Notepad_plus_msgs.h"
|
#include "Notepad_plus_msgs.h"
|
||||||
#include "UniConversion.h"
|
#include "UniConversion.h"
|
||||||
#include "LongRunningOperation.h"
|
#include "LongRunningOperation.h"
|
||||||
|
#include "localization.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
@ -235,6 +236,11 @@ FindReplaceDlg::~FindReplaceDlg()
|
||||||
_findersOfFinder.erase(_findersOfFinder.begin() + n);
|
_findersOfFinder.erase(_findersOfFinder.begin() + n);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_shiftTrickUpTip)
|
||||||
|
::DestroyWindow(_shiftTrickUpTip);
|
||||||
|
if (_shiftTrickDownTip)
|
||||||
|
::DestroyWindow(_shiftTrickDownTip);
|
||||||
|
|
||||||
delete[] _uniFileName;
|
delete[] _uniFileName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -697,6 +703,26 @@ INT_PTR CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
|
||||||
_findClosePos.left = p.x;
|
_findClosePos.left = p.x;
|
||||||
_findClosePos.top = p.y + 10;
|
_findClosePos.top = p.y + 10;
|
||||||
|
|
||||||
|
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker();
|
||||||
|
generic_string tip2show = pNativeSpeaker->getLocalizedStrFromID("shift-change-direction-tip");
|
||||||
|
if (tip2show.empty())
|
||||||
|
tip2show = TEXT("Use Shift+Enter to search in the reverse set direction.");
|
||||||
|
|
||||||
|
_shiftTrickUpTip = CreateToolTip(IDDIRECTIONUP, _hSelf, _hInst, const_cast<PTSTR>(tip2show.c_str()));
|
||||||
|
_shiftTrickDownTip = CreateToolTip(IDDIRECTIONDOWN, _hSelf, _hInst, const_cast<PTSTR>(tip2show.c_str()));
|
||||||
|
if (_shiftTrickUpTip && _shiftTrickDownTip)
|
||||||
|
{
|
||||||
|
SendMessage(_shiftTrickUpTip, TTM_ACTIVATE, TRUE, 0);
|
||||||
|
SendMessage(_shiftTrickUpTip, TTM_SETMAXTIPWIDTH, 0, 200);
|
||||||
|
// Make tip stay 30 seconds
|
||||||
|
SendMessage(_shiftTrickUpTip, TTM_SETDELAYTIME, TTDT_AUTOPOP, MAKELPARAM((30000), (0)));
|
||||||
|
|
||||||
|
SendMessage(_shiftTrickDownTip, TTM_ACTIVATE, TRUE, 0);
|
||||||
|
SendMessage(_shiftTrickDownTip, TTM_SETMAXTIPWIDTH, 0, 200);
|
||||||
|
// Make tip stay 30 seconds
|
||||||
|
SendMessage(_shiftTrickDownTip, TTM_SETDELAYTIME, TTDT_AUTOPOP, MAKELPARAM((30000), (0)));
|
||||||
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -353,6 +353,9 @@ private :
|
||||||
|
|
||||||
std::vector<Finder *> _findersOfFinder;
|
std::vector<Finder *> _findersOfFinder;
|
||||||
|
|
||||||
|
HWND _shiftTrickUpTip = nullptr;
|
||||||
|
HWND _shiftTrickDownTip = nullptr;
|
||||||
|
|
||||||
|
|
||||||
bool _isRTL;
|
bool _isRTL;
|
||||||
|
|
||||||
|
|
|
@ -2901,48 +2901,6 @@ void DelimiterSettingsDlg::detectSpace(const char *text2Check, int & nbSp, int &
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
HWND CreateToolTip(int toolID, HWND hDlg, HINSTANCE hInst, const PTSTR pszText)
|
|
||||||
{
|
|
||||||
if (!toolID || !hDlg || !pszText)
|
|
||||||
{
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get the window of the tool.
|
|
||||||
HWND hwndTool = GetDlgItem(hDlg, toolID);
|
|
||||||
if (!hwndTool)
|
|
||||||
{
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create the tooltip. g_hInst is the global instance handle.
|
|
||||||
HWND hwndTip = CreateWindowEx(NULL, TOOLTIPS_CLASS, NULL,
|
|
||||||
WS_POPUP | TTS_ALWAYSTIP | TTS_BALLOON,
|
|
||||||
CW_USEDEFAULT, CW_USEDEFAULT,
|
|
||||||
CW_USEDEFAULT, CW_USEDEFAULT,
|
|
||||||
hDlg, NULL,
|
|
||||||
hInst, NULL);
|
|
||||||
|
|
||||||
if (!hwndTip)
|
|
||||||
{
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Associate the tooltip with the tool.
|
|
||||||
TOOLINFO toolInfo = { 0 };
|
|
||||||
toolInfo.cbSize = sizeof(toolInfo);
|
|
||||||
toolInfo.hwnd = hDlg;
|
|
||||||
toolInfo.uFlags = TTF_IDISHWND | TTF_SUBCLASS;
|
|
||||||
toolInfo.uId = (UINT_PTR)hwndTool;
|
|
||||||
toolInfo.lpszText = pszText;
|
|
||||||
if (!SendMessage(hwndTip, TTM_ADDTOOL, 0, (LPARAM)&toolInfo))
|
|
||||||
{
|
|
||||||
DestroyWindow(hwndTip);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return hwndTip;
|
|
||||||
}
|
|
||||||
|
|
||||||
generic_string DelimiterSettingsDlg::getWarningText(size_t nbSp, size_t nbTab) const
|
generic_string DelimiterSettingsDlg::getWarningText(size_t nbSp, size_t nbTab) const
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue