mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-28 07:58:08 +01:00
Get rid of cute-but-confusing feature whereby the menuitem to which
the left softkey is set is removed from the right key's menu. More important is that menu-9-6 always mean "exit".
This commit is contained in:
parent
bf505d1a62
commit
1384be6895
2 changed files with 25 additions and 32 deletions
|
@ -106,12 +106,7 @@ typedef struct CEAppGlobals {
|
||||||
XP_U16 dummyPos;
|
XP_U16 dummyPos;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct {
|
XP_U16 softKeyId; /* id of item now on left button */
|
||||||
HMENU oldMenu; /* menu whose item is now on left button */
|
|
||||||
XP_U16 oldId; /* id of item now on left button */
|
|
||||||
XP_U16 oldPos; /* position of prev item within oldMenu */
|
|
||||||
wchar_t oldName[32]; /* name of previous item */
|
|
||||||
} softkey;
|
|
||||||
|
|
||||||
DrawCtx* draw;
|
DrawCtx* draw;
|
||||||
XWGame game;
|
XWGame game;
|
||||||
|
|
|
@ -579,7 +579,10 @@ ceDoDlgFocusScroll( CeDlgHdr* dlgHdr, HWND nextCtrl )
|
||||||
} /* ceDoDlgFocusScroll */
|
} /* ceDoDlgFocusScroll */
|
||||||
|
|
||||||
static XP_Bool
|
static XP_Bool
|
||||||
ceFindMenu( HMENU menu, XP_U16 id, HMENU* foundMenu, XP_U16* foundPos,
|
ceFindMenu( HMENU menu, XP_U16 id,
|
||||||
|
#ifndef _WIN32_WCE
|
||||||
|
HMENU* foundMenu, XP_U16* foundPos,
|
||||||
|
#endif
|
||||||
wchar_t* foundBuf, XP_U16 bufLen )
|
wchar_t* foundBuf, XP_U16 bufLen )
|
||||||
{
|
{
|
||||||
XP_Bool found = XP_FALSE;
|
XP_Bool found = XP_FALSE;
|
||||||
|
@ -600,14 +603,19 @@ ceFindMenu( HMENU menu, XP_U16 id, HMENU* foundMenu, XP_U16* foundPos,
|
||||||
if ( !GetMenuItemInfo( menu, pos, TRUE, &minfo ) ) {
|
if ( !GetMenuItemInfo( menu, pos, TRUE, &minfo ) ) {
|
||||||
break; /* pos is too big */
|
break; /* pos is too big */
|
||||||
} else if ( NULL != minfo.hSubMenu ) {
|
} else if ( NULL != minfo.hSubMenu ) {
|
||||||
found = ceFindMenu( minfo.hSubMenu, id, foundMenu, foundPos,
|
found = ceFindMenu( minfo.hSubMenu, id,
|
||||||
|
#ifndef _WIN32_WCE
|
||||||
|
foundMenu, foundPos,
|
||||||
|
#endif
|
||||||
foundBuf, bufLen );
|
foundBuf, bufLen );
|
||||||
} else if ( MFT_SEPARATOR == minfo.fType ) {
|
} else if ( MFT_SEPARATOR == minfo.fType ) {
|
||||||
continue;
|
continue;
|
||||||
} else if ( minfo.wID == id ) {
|
} else if ( minfo.wID == id ) {
|
||||||
found = XP_TRUE;
|
found = XP_TRUE;
|
||||||
|
#ifndef _WIN32_WCE
|
||||||
*foundPos = pos;
|
*foundPos = pos;
|
||||||
*foundMenu = menu;
|
*foundMenu = menu;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return found;
|
return found;
|
||||||
|
@ -650,11 +658,14 @@ setW32DummyMenu( CEAppGlobals* globals, HMENU menu, XP_U16 id, wchar_t* oldNm )
|
||||||
void
|
void
|
||||||
ceSetLeftSoftkey( CEAppGlobals* globals, XP_U16 newId )
|
ceSetLeftSoftkey( CEAppGlobals* globals, XP_U16 newId )
|
||||||
{
|
{
|
||||||
if ( newId != globals->softkey.oldId ) {
|
if ( newId != globals->softKeyId ) {
|
||||||
|
wchar_t menuTxt[32]; /* text of newId menu */
|
||||||
HMENU menu;
|
HMENU menu;
|
||||||
|
#ifndef _WIN32_WCE
|
||||||
HMENU prevMenu;
|
HMENU prevMenu;
|
||||||
XP_U16 prevPos;
|
XP_U16 prevPos;
|
||||||
XP_U16 oldId = globals->softkey.oldId;
|
#endif
|
||||||
|
XP_U16 oldId = globals->softKeyId;
|
||||||
if ( 0 == oldId ) {
|
if ( 0 == oldId ) {
|
||||||
oldId = ID_INITIAL_SOFTID;
|
oldId = ID_INITIAL_SOFTID;
|
||||||
}
|
}
|
||||||
|
@ -675,26 +686,13 @@ ceSetLeftSoftkey( CEAppGlobals* globals, XP_U16 newId )
|
||||||
menu = GetMenu( globals->hWnd );
|
menu = GetMenu( globals->hWnd );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* First put any existing menu item back in the main menu! */
|
/* Look up the text... */
|
||||||
if ( globals->softkey.oldMenu != 0 ) {
|
if ( ceFindMenu( menu, newId,
|
||||||
if ( ! InsertMenu( globals->softkey.oldMenu,
|
#ifndef _WIN32_WCE
|
||||||
globals->softkey.oldPos, MF_BYPOSITION,
|
&prevMenu, &prevPos,
|
||||||
globals->softkey.oldId,
|
#endif
|
||||||
globals->softkey.oldName ) ) {
|
menuTxt, VSIZE(menuTxt) ) ) {
|
||||||
XP_LOGF( "%s: InsertMenu failed", __func__ );
|
globals->softKeyId = newId;
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Then find, remember and remove the new */
|
|
||||||
if ( ceFindMenu( menu, newId, &prevMenu, &prevPos,
|
|
||||||
globals->softkey.oldName,
|
|
||||||
VSIZE(globals->softkey.oldName) ) ) {
|
|
||||||
if ( !DeleteMenu( prevMenu, prevPos, MF_BYPOSITION ) ) {
|
|
||||||
XP_LOGF( "%s: DeleteMenu failed", __func__ );
|
|
||||||
}
|
|
||||||
globals->softkey.oldMenu = prevMenu;
|
|
||||||
globals->softkey.oldPos = prevPos;
|
|
||||||
globals->softkey.oldId = newId;
|
|
||||||
} else {
|
} else {
|
||||||
XP_LOGF( "%s: ceFindMenu failed", __func__ );
|
XP_LOGF( "%s: ceFindMenu failed", __func__ );
|
||||||
}
|
}
|
||||||
|
@ -703,10 +701,10 @@ ceSetLeftSoftkey( CEAppGlobals* globals, XP_U16 newId )
|
||||||
#ifdef _WIN32_WCE
|
#ifdef _WIN32_WCE
|
||||||
info.dwMask = TBIF_TEXT | TBIF_COMMAND;
|
info.dwMask = TBIF_TEXT | TBIF_COMMAND;
|
||||||
info.idCommand = newId;
|
info.idCommand = newId;
|
||||||
info.pszText = globals->softkey.oldName;
|
info.pszText = menuTxt;
|
||||||
SendMessage( globals->hwndCB, TB_SETBUTTONINFO, oldId, (LPARAM)&info );
|
SendMessage( globals->hwndCB, TB_SETBUTTONINFO, oldId, (LPARAM)&info );
|
||||||
#else
|
#else
|
||||||
setW32DummyMenu( globals, menu, newId, globals->softkey.oldName );
|
setW32DummyMenu( globals, menu, newId, menuTxt );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
} /* ceSetLeftSoftkey */
|
} /* ceSetLeftSoftkey */
|
||||||
|
|
Loading…
Add table
Reference in a new issue