mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-28 07:58:08 +01:00
Put back "turn done" menu, and add call to change the left softkey.
Call it when turn changes, new game is begun, and hint feature has been used. Currently menuitem is duplicated. Goal is to remove the item being attached to the left button and to replace it when another is chosen.
This commit is contained in:
parent
da60e6211c
commit
885e7f0192
5 changed files with 83 additions and 3 deletions
|
@ -113,6 +113,7 @@ static void ce_util_trayHiddenChange( XW_UtilCtxt* uc,
|
|||
XP_U16 nVisibleRows );
|
||||
static void ce_util_yOffsetChange( XW_UtilCtxt* uc, XP_U16 oldOffset,
|
||||
XP_U16 newOffset );
|
||||
static void ce_util_turnChanged( XW_UtilCtxt* uc );
|
||||
static void ce_util_notifyGameOver( XW_UtilCtxt* uc );
|
||||
static XP_Bool ce_util_hiliteCell( XW_UtilCtxt* uc, XP_U16 col,
|
||||
XP_U16 row );
|
||||
|
@ -344,6 +345,7 @@ ceInitUtilFuncs( CEAppGlobals* globals )
|
|||
vtable->m_util_askPassword = ce_util_askPassword;
|
||||
vtable->m_util_trayHiddenChange = ce_util_trayHiddenChange;
|
||||
vtable->m_util_yOffsetChange = ce_util_yOffsetChange;
|
||||
vtable->m_util_turnChanged = ce_util_turnChanged;
|
||||
vtable->m_util_notifyGameOver = ce_util_notifyGameOver;
|
||||
vtable->m_util_hiliteCell = ce_util_hiliteCell;
|
||||
vtable->m_util_engineProgressCallback = ce_util_engineProgressCallback;
|
||||
|
@ -1328,6 +1330,9 @@ ceHandleHintRequest( CEAppGlobals* globals )
|
|||
#endif
|
||||
¬Done );
|
||||
globals->hintPending = notDone;
|
||||
if ( draw ) { /* don't turn on if disallowed */
|
||||
ceSetLeftSoftkey( globals, ID_MOVE_NEXTHINT );
|
||||
}
|
||||
return draw;
|
||||
} /* ceHandleHintRequest */
|
||||
|
||||
|
@ -1471,6 +1476,7 @@ ceDoNewGame( CEAppGlobals* globals )
|
|||
#endif
|
||||
|
||||
ceInitAndStartBoard( globals, XP_TRUE, addr );
|
||||
ceSetLeftSoftkey( globals, ID_MOVE_TURNDONE );
|
||||
changed = XP_TRUE;
|
||||
}
|
||||
|
||||
|
@ -2906,12 +2912,21 @@ ce_util_yOffsetChange( XW_UtilCtxt* uc, XP_U16 XP_UNUSED(oldOffset),
|
|||
#endif
|
||||
} /* ce_util_yOffsetChange */
|
||||
|
||||
static void
|
||||
ce_util_turnChanged( XW_UtilCtxt* uc )
|
||||
{
|
||||
CEAppGlobals* globals = (CEAppGlobals*)uc->closure;
|
||||
ceSetLeftSoftkey( globals, ID_MOVE_TURNDONE );
|
||||
}
|
||||
|
||||
static void
|
||||
ce_util_notifyGameOver( XW_UtilCtxt* uc )
|
||||
{
|
||||
CEAppGlobals* globals = (CEAppGlobals*)uc->closure;
|
||||
drawInsidePaint( globals );
|
||||
ceDisplayFinalScores( globals );
|
||||
|
||||
ceSetLeftSoftkey( globals, ID_FILE_NEWGAME );
|
||||
} /* ce_util_notifyGameOver */
|
||||
|
||||
static XP_Bool
|
||||
|
|
|
@ -92,6 +92,10 @@ typedef struct CEAppGlobals {
|
|||
#ifdef _WIN32_WCE
|
||||
SHACTIVATEINFO sai;
|
||||
XW_WinceVersion winceVersion;
|
||||
|
||||
struct {
|
||||
XP_U16 curItem;
|
||||
} softkey;
|
||||
#endif
|
||||
|
||||
DrawCtx* draw;
|
||||
|
|
|
@ -17,6 +17,9 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "stdafx.h"
|
||||
#include <commctrl.h>
|
||||
|
||||
#include "ceutil.h"
|
||||
#include "cedefines.h"
|
||||
|
||||
|
@ -75,7 +78,8 @@ ceGetDlgItemText( HWND hDlg, XP_U16 id, XP_UCHAR* buf, XP_U16* bLen )
|
|||
|
||||
XP_ASSERT( len <= BUF_SIZE );
|
||||
|
||||
gotLen = (XP_U16)SendDlgItemMessage( hDlg, id, WM_GETTEXT, len, (long)wbuf );
|
||||
gotLen = (XP_U16)SendDlgItemMessage( hDlg, id, WM_GETTEXT, len,
|
||||
(long)wbuf );
|
||||
if ( gotLen > 0 ) {
|
||||
XP_ASSERT( gotLen < len );
|
||||
if ( gotLen >= len ) {
|
||||
|
@ -360,3 +364,56 @@ ceStackButtonsRight( CEAppGlobals* globals, HWND hDlg )
|
|||
}
|
||||
}
|
||||
} /* ceStackButtonsRight */
|
||||
|
||||
#ifdef _WIN32_WCE
|
||||
void
|
||||
ceSetLeftSoftkey( CEAppGlobals* globals, XP_U16 id )
|
||||
{
|
||||
HMENU menu;
|
||||
XP_U16 curItem = globals->softkey.curItem;
|
||||
/* temporary!! */
|
||||
if ( curItem == 0 ) {
|
||||
curItem = ID_MOVE_TURNDONE;
|
||||
}
|
||||
|
||||
TBBUTTONINFO info;
|
||||
XP_MEMSET( &info, 0, sizeof(info) );
|
||||
info.cbSize = sizeof(info);
|
||||
|
||||
/* Also temporary!! */
|
||||
const wchar_t* txt = L"Mine";
|
||||
switch( id ) {
|
||||
case ID_MOVE_TURNDONE:
|
||||
txt = L"Turn done";
|
||||
break;
|
||||
case ID_FILE_NEWGAME:
|
||||
txt = L"New game";
|
||||
break;
|
||||
case ID_MOVE_NEXTHINT:
|
||||
txt = L"Next hint";
|
||||
break;
|
||||
default:
|
||||
XP_ASSERT(0);
|
||||
}
|
||||
|
||||
info.dwMask = TBIF_LPARAM;
|
||||
SendMessage( globals->hwndCB, TB_GETBUTTONINFO, IDM_MENU, (LPARAM)&info );
|
||||
menu = (HMENU)info.lParam; /* Use to remove item being installed in
|
||||
left button */
|
||||
|
||||
|
||||
/* First put any existing menu item back in the main menu! */
|
||||
|
||||
/* Then find, remember and remove the new */
|
||||
|
||||
/* Make it the button */
|
||||
|
||||
info.dwMask = TBIF_TEXT | TBIF_COMMAND;
|
||||
info.idCommand = id;
|
||||
info.pszText = txt;
|
||||
SendMessage( globals->hwndCB, TB_SETBUTTONINFO, curItem, (LPARAM)&info );
|
||||
|
||||
/* Save for next time */
|
||||
globals->softkey.curItem = id;
|
||||
} /* ceSetLeftSoftkey */
|
||||
#endif
|
||||
|
|
|
@ -50,4 +50,10 @@ void ceStackButtonsRight( CEAppGlobals* globals, HWND hDlg );
|
|||
/* Are we drawing things in landscape mode? */
|
||||
XP_Bool ceIsLandscape( CEAppGlobals* globals );
|
||||
|
||||
#ifdef _WIN32_WCE
|
||||
void ceSetLeftSoftkey( CEAppGlobals* globals, XP_U16 id );
|
||||
#else
|
||||
# define ceSetLeftSoftkey( globals, id )
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -70,9 +70,7 @@ IDM_MENU MENU DISCARDABLE
|
|||
BEGIN
|
||||
POPUP "Menu"
|
||||
BEGIN
|
||||
#ifndef _WIN32_WCE
|
||||
MENUITEM "Turn &done", ID_MOVE_TURNDONE
|
||||
#endif
|
||||
MENUITEM "&Juggle", ID_MOVE_JUGGLE
|
||||
MENUITEM "Fli&p", ID_MOVE_FLIP
|
||||
MENUITEM "&Trade", ID_MOVE_TRADE
|
||||
|
|
Loading…
Add table
Reference in a new issue