mirror of
https://github.com/reactos/reactos.git
synced 2025-07-23 04:33:38 +00:00
disable Search when there is no text
call SearchDialog when SearchNext is called without a string to search for svn path=/trunk/; revision=32057
This commit is contained in:
parent
8e346ad979
commit
d6dc1ebe36
3 changed files with 20 additions and 6 deletions
|
@ -320,16 +320,16 @@ void DoOpenFile(LPCTSTR szFileName)
|
|||
*/
|
||||
if (GetWindowText(Globals.hEdit, log, SIZEOF(log)) && !_tcscmp(log, dotlog))
|
||||
{
|
||||
static const TCHAR lf[] = _T("\r\n");
|
||||
SendMessage(Globals.hEdit, EM_SETSEL, GetWindowTextLength(Globals.hEdit), -1);
|
||||
SendMessage(Globals.hEdit, EM_REPLACESEL, TRUE, (LPARAM)lf);
|
||||
DIALOG_EditTimeDate();
|
||||
SendMessage(Globals.hEdit, EM_REPLACESEL, TRUE, (LPARAM)lf);
|
||||
static const TCHAR lf[] = _T("\r\n");
|
||||
SendMessage(Globals.hEdit, EM_SETSEL, GetWindowTextLength(Globals.hEdit), -1);
|
||||
SendMessage(Globals.hEdit, EM_REPLACESEL, TRUE, (LPARAM)lf);
|
||||
DIALOG_EditTimeDate();
|
||||
SendMessage(Globals.hEdit, EM_REPLACESEL, TRUE, (LPARAM)lf);
|
||||
}
|
||||
|
||||
SetFileName(szFileName);
|
||||
UpdateWindowCaption();
|
||||
|
||||
NOTEPAD_EnableSearchMenu();
|
||||
done:
|
||||
if (hFile != INVALID_HANDLE_VALUE)
|
||||
CloseHandle(hFile);
|
||||
|
@ -344,6 +344,7 @@ VOID DIALOG_FileNew(VOID)
|
|||
SetWindowText(Globals.hEdit, empty_str);
|
||||
SendMessage(Globals.hEdit, EM_EMPTYUNDOBUFFER, 0, 0);
|
||||
SetFocus(Globals.hEdit);
|
||||
NOTEPAD_EnableSearchMenu();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -783,6 +784,8 @@ VOID DIALOG_SearchNext(VOID)
|
|||
{
|
||||
if (Globals.find.lpstrFindWhat != NULL)
|
||||
NOTEPAD_FindNext(&Globals.find, FALSE, TRUE);
|
||||
else
|
||||
DIALOG_Search();
|
||||
}
|
||||
|
||||
VOID DIALOG_Replace(VOID)
|
||||
|
|
|
@ -27,6 +27,14 @@
|
|||
NOTEPAD_GLOBALS Globals;
|
||||
static ATOM aFINDMSGSTRING;
|
||||
|
||||
VOID NOTEPAD_EnableSearchMenu()
|
||||
{
|
||||
EnableMenuItem(GetMenu(Globals.hMainWnd), CMD_SEARCH,
|
||||
MF_BYCOMMAND | ((GetWindowTextLength(Globals.hEdit) == 0) ? MF_DISABLED | MF_GRAYED : MF_ENABLED));
|
||||
EnableMenuItem(GetMenu(Globals.hMainWnd), CMD_SEARCH_NEXT,
|
||||
MF_BYCOMMAND | ((GetWindowTextLength(Globals.hEdit) == 0) ? MF_DISABLED | MF_GRAYED : MF_ENABLED));
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* SetFileName
|
||||
|
@ -346,6 +354,8 @@ static LRESULT WINAPI NOTEPAD_WndProc(HWND hWnd, UINT msg, WPARAM wParam,
|
|||
case WM_COMMAND:
|
||||
if (HIWORD(wParam) == EN_CHANGE || HIWORD(wParam) == EN_HSCROLL || HIWORD(wParam) == EN_VSCROLL)
|
||||
DIALOG_StatusBarUpdateCaretPos();
|
||||
if ((HIWORD(wParam) == EN_CHANGE))
|
||||
NOTEPAD_EnableSearchMenu();
|
||||
NOTEPAD_MenuCommand(LOWORD(wParam));
|
||||
break;
|
||||
|
||||
|
|
|
@ -85,3 +85,4 @@ void SaveSettings(void);
|
|||
|
||||
/* from main.c */
|
||||
BOOL NOTEPAD_FindNext(FINDREPLACE *, BOOL , BOOL );
|
||||
VOID NOTEPAD_EnableSearchMenu(VOID);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue