small changes

svn path=/trunk/; revision=5799
This commit is contained in:
Thomas Bluemel 2003-08-23 17:06:07 +00:00
parent 274ac97525
commit 05831e8a00
3 changed files with 27 additions and 36 deletions

View file

@ -3380,13 +3380,16 @@ static void EDIT_WM_Command(EDITSTATE *es, INT code, INT id, HWND control)
*/
static void EDIT_WM_ContextMenu(EDITSTATE *es, INT x, INT y)
{
HMENU menu = LoadMenuA(GetModuleHandleA("USER32"), "EDITMENU");
HMENU popup = GetSubMenu(menu, 0);
UINT start = es->selection_start;
UINT end = es->selection_end;
UINT start, end;
HMENU popup;
start = es->selection_start;
end = es->selection_end;
ORDER_UINT(start, end);
popup = LoadMenuW(GetModuleHandleW(L"USER32"), L"EDITMENU");
/* undo */
EnableMenuItem(popup, 0, MF_BYPOSITION | (EDIT_EM_CanUndo(es) && !(es->style & ES_READONLY) ? MF_ENABLED : MF_GRAYED));
/* cut */
@ -3401,7 +3404,7 @@ static void EDIT_WM_ContextMenu(EDITSTATE *es, INT x, INT y)
EnableMenuItem(popup, 7, MF_BYPOSITION | (start || (end != strlenW(es->text)) ? MF_ENABLED : MF_GRAYED));
TrackPopupMenu(popup, TPM_LEFTALIGN | TPM_RIGHTBUTTON, x, y, 0, es->hwndSelf, NULL);
DestroyMenu(menu);
DestroyMenu(popup);
}

View file

@ -123,17 +123,14 @@ END
EDITMENU MENU LOADONCALL MOVEABLE DISCARDABLE
{
POPUP ""
BEGIN
MENUITEM "&Undo", EM_UNDO
MENUITEM SEPARATOR
MENUITEM "Cu&t", WM_CUT
MENUITEM "&Copy", WM_COPY
MENUITEM "&Paste", WM_PASTE
MENUITEM "&Delete", WM_CLEAR
MENUITEM SEPARATOR
MENUITEM "Select &All", EM_SETSEL
END
MENUITEM "&Undo", EM_UNDO
MENUITEM SEPARATOR
MENUITEM "Cu&t", WM_CUT
MENUITEM "&Copy", WM_COPY
MENUITEM "&Paste", WM_PASTE
MENUITEM "&Delete", WM_CLEAR
MENUITEM SEPARATOR
MENUITEM "Select &All", EM_SETSEL
}

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: menu.c,v 1.28 2003/08/22 16:01:01 weiden Exp $
/* $Id: menu.c,v 1.29 2003/08/23 17:06:07 weiden Exp $
*
* PROJECT: ReactOS user32.dll
* FILE: lib/user32/windows/menu.c
@ -192,7 +192,7 @@ static LPCSTR MENUEX_ParseResource( LPCSTR res, HMENU hMenu)
*
* NOTE: flags is equivalent to the mtOption field
*/
static LPCSTR MENU_ParseResource( LPCSTR res, HMENU hMenu, BOOL TopLevel, BOOL unicode )
static LPCSTR MENU_ParseResource( LPCSTR res, HMENU hMenu, BOOL unicode )
{
WORD flags, id = 0;
HMENU hSubMenu;
@ -201,7 +201,6 @@ static LPCSTR MENU_ParseResource( LPCSTR res, HMENU hMenu, BOOL TopLevel, BOOL u
do
{
hSubMenu = (HMENU)0;
flags = GET_WORD(res);
/* remove MF_END flag before passing it to AppendMenu()! */
@ -221,22 +220,14 @@ static LPCSTR MENU_ParseResource( LPCSTR res, HMENU hMenu, BOOL TopLevel, BOOL u
res += (strlenW((LPCWSTR)str) + 1) * sizeof(WCHAR);
if (flags & MF_POPUP)
{
if(!TopLevel)
{
hSubMenu = CreatePopupMenu();
if(!hSubMenu) return NULL;
}
else
hSubMenu = hMenu;
if(!(res = MENU_ParseResource(res, hSubMenu, FALSE, unicode)))
hSubMenu = CreatePopupMenu();
if(!hSubMenu) return NULL;
if(!(res = MENU_ParseResource(res, hSubMenu, unicode)))
return NULL;
if(!TopLevel)
{
if(!unicode)
AppendMenuA(hMenu, flags, (UINT)hSubMenu, str);
else
AppendMenuW(hMenu, flags, (UINT)hSubMenu, (LPCWSTR)str);
}
if(!unicode)
AppendMenuA(hMenu, flags, (UINT)hSubMenu, str);
else
AppendMenuW(hMenu, flags, (UINT)hSubMenu, (LPCWSTR)str);
}
else /* Not a popup */
{
@ -257,7 +248,7 @@ User32LoadSysMenuTemplateForKernel(PVOID Arguments, ULONG ArgumentLength)
{
LRESULT Result;
HMODULE hUser32;
hUser32 = GetModuleHandleW(L"user32.dll");
hUser32 = GetModuleHandleW(L"USER32");
Result = (LRESULT)LoadMenuW(hUser32, L"SYSMENU");
return(ZwCallbackReturn(&Result, sizeof(LRESULT), STATUS_SUCCESS));
}
@ -976,7 +967,7 @@ LoadMenuIndirectW(CONST MENUTEMPLATE *lpMenuTemplate)
offset = GET_WORD(p);
p += sizeof(WORD) + offset;
if (!(hMenu = CreateMenu())) return 0;
if (!MENU_ParseResource(p, hMenu, TRUE, TRUE))
if (!MENU_ParseResource(p, hMenu, TRUE))
{
DestroyMenu(hMenu);
return 0;