Author: cwittich
Date: Wed Jan 30 20:20:47 2008
New Revision: 32057
URL:
http://svn.reactos.org/svn/reactos?rev=32057&view=rev
Log:
disable Search when there is no text
call SearchDialog when SearchNext is called without a string to search for
Modified:
trunk/reactos/base/applications/notepad/dialog.c
trunk/reactos/base/applications/notepad/main.c
trunk/reactos/base/applications/notepad/main.h
Modified: trunk/reactos/base/applications/notepad/dialog.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/notepad/…
==============================================================================
--- trunk/reactos/base/applications/notepad/dialog.c (original)
+++ trunk/reactos/base/applications/notepad/dialog.c Wed Jan 30 20:20:47 2008
@@ -320,16 +320,16 @@
*/
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 @@
SetWindowText(Globals.hEdit, empty_str);
SendMessage(Globals.hEdit, EM_EMPTYUNDOBUFFER, 0, 0);
SetFocus(Globals.hEdit);
+ NOTEPAD_EnableSearchMenu();
}
}
@@ -783,6 +784,8 @@
{
if (Globals.find.lpstrFindWhat != NULL)
NOTEPAD_FindNext(&Globals.find, FALSE, TRUE);
+ else
+ DIALOG_Search();
}
VOID DIALOG_Replace(VOID)
Modified: trunk/reactos/base/applications/notepad/main.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/notepad/…
==============================================================================
--- trunk/reactos/base/applications/notepad/main.c (original)
+++ trunk/reactos/base/applications/notepad/main.c Wed Jan 30 20:20:47 2008
@@ -26,6 +26,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));
+}
/***********************************************************************
*
@@ -346,6 +354,8 @@
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;
Modified: trunk/reactos/base/applications/notepad/main.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/notepad/…
==============================================================================
--- trunk/reactos/base/applications/notepad/main.h (original)
+++ trunk/reactos/base/applications/notepad/main.h Wed Jan 30 20:20:47 2008
@@ -85,3 +85,4 @@
/* from main.c */
BOOL NOTEPAD_FindNext(FINDREPLACE *, BOOL , BOOL );
+VOID NOTEPAD_EnableSearchMenu(VOID);