mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2024-12-28 09:58:30 +01:00
Merge branch 'android_branch' into send_in_background
This commit is contained in:
commit
471a9d988d
25 changed files with 113 additions and 80 deletions
|
@ -107,12 +107,11 @@ makeDSI( AndDraw* draw, int indx, const DrawScoreInfo* dsi )
|
|||
|
||||
static XP_Bool
|
||||
and_draw_scoreBegin( DrawCtx* dctx, const XP_Rect* rect,
|
||||
XP_U16 numPlayers,
|
||||
const XP_S16* const scores,
|
||||
XP_S16 remCount, DrawFocusState dfs )
|
||||
XP_U16 numPlayers, const XP_S16* const scores,
|
||||
XP_S16 remCount, DrawFocusState XP_UNUSED(dfs) )
|
||||
{
|
||||
jboolean result;
|
||||
DRAW_CBK_HEADER("scoreBegin", "(Landroid/graphics/Rect;I[III)Z" );
|
||||
DRAW_CBK_HEADER("scoreBegin", "(Landroid/graphics/Rect;I[II)Z" );
|
||||
|
||||
jint jarr[numPlayers];
|
||||
int ii;
|
||||
|
@ -123,8 +122,7 @@ and_draw_scoreBegin( DrawCtx* dctx, const XP_Rect* rect,
|
|||
jobject jrect = makeJRect( draw, JCACHE_RECT0, rect );
|
||||
|
||||
result = (*env)->CallBooleanMethod( env, draw->jdraw, mid,
|
||||
jrect, numPlayers, jscores, remCount,
|
||||
dfs );
|
||||
jrect, numPlayers, jscores, remCount );
|
||||
|
||||
(*env)->DeleteLocalRef( env, jscores );
|
||||
return result;
|
||||
|
@ -220,15 +218,15 @@ and_draw_drawTimer( DrawCtx* dctx, const XP_Rect* rect, XP_U16 player,
|
|||
|
||||
static XP_Bool
|
||||
and_draw_boardBegin( DrawCtx* dctx, const XP_Rect* rect,
|
||||
XP_U16 cellWidth, XP_U16 cellHeight, DrawFocusState dfs )
|
||||
XP_U16 cellWidth, XP_U16 cellHeight,
|
||||
DrawFocusState XP_UNUSED(dfs) )
|
||||
{
|
||||
DRAW_CBK_HEADER( "boardBegin", "(Landroid/graphics/Rect;III)Z" );
|
||||
DRAW_CBK_HEADER( "boardBegin", "(Landroid/graphics/Rect;II)Z" );
|
||||
|
||||
jobject jrect = makeJRect( draw, JCACHE_RECT0, rect );
|
||||
|
||||
jboolean result = (*env)->CallBooleanMethod( env, draw->jdraw, mid,
|
||||
jrect, cellWidth, cellHeight,
|
||||
(jint)dfs );
|
||||
jrect, cellWidth, cellHeight );
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -281,15 +279,14 @@ and_draw_vertScrollBoard( DrawCtx* XP_UNUSED(dctx), XP_Rect* XP_UNUSED(rect),
|
|||
|
||||
static XP_Bool
|
||||
and_draw_trayBegin( DrawCtx* dctx, const XP_Rect* rect, XP_U16 owner,
|
||||
DrawFocusState dfs )
|
||||
XP_S16 score, DrawFocusState XP_UNUSED(dfs) )
|
||||
{
|
||||
DRAW_CBK_HEADER( "trayBegin", "(Landroid/graphics/Rect;II)Z" );
|
||||
|
||||
jobject jrect = makeJRect( draw, JCACHE_RECT0, rect );
|
||||
|
||||
jboolean result = (*env)->CallBooleanMethod( env, draw->jdraw, mid,
|
||||
jrect, owner, (jint)dfs );
|
||||
|
||||
jrect, owner, score );
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -373,13 +370,13 @@ and_draw_score_pendingScore( DrawCtx* dctx, const XP_Rect* rect,
|
|||
static void
|
||||
and_draw_objFinished( DrawCtx* dctx, BoardObjectType typ,
|
||||
const XP_Rect* rect,
|
||||
DrawFocusState dfs )
|
||||
DrawFocusState XP_UNUSED(dfs) )
|
||||
{
|
||||
DRAW_CBK_HEADER( "objFinished", "(ILandroid/graphics/Rect;I)V" );
|
||||
DRAW_CBK_HEADER( "objFinished", "(ILandroid/graphics/Rect;)V" );
|
||||
|
||||
jobject jrect = makeJRect( draw, JCACHE_RECT0, rect );
|
||||
(*env)->CallVoidMethod( env, draw->jdraw, mid,
|
||||
(jint)typ, jrect, (jint)dfs );
|
||||
(jint)typ, jrect );
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -216,8 +216,7 @@ and_util_turnChanged(XW_UtilCtxt* uc)
|
|||
#endif
|
||||
|
||||
static void
|
||||
and_util_informMove( XW_UtilCtxt* uc, XWStreamCtxt* expl,
|
||||
XWStreamCtxt* words, XP_U16 wordCount )
|
||||
and_util_informMove( XW_UtilCtxt* uc, XWStreamCtxt* expl, XWStreamCtxt* words )
|
||||
{
|
||||
UTIL_CBK_HEADER( "informMove", "(Ljava/lang/String;Ljava/lang/String;)V" );
|
||||
jstring jexpl = streamToJString( MPPARM(util->util.mpool) env, expl );
|
||||
|
@ -227,8 +226,6 @@ and_util_informMove( XW_UtilCtxt* uc, XWStreamCtxt* expl,
|
|||
(*env)->DeleteLocalRef( env, jexpl );
|
||||
if ( !!jwords ) {
|
||||
(*env)->DeleteLocalRef( env, jwords );
|
||||
} else {
|
||||
XP_ASSERT( 0 == wordCount );
|
||||
}
|
||||
UTIL_CBK_TAIL();
|
||||
}
|
||||
|
|
|
@ -1199,6 +1199,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_game_1getState
|
|||
setBool( env, jgsi, "tradeTilesSelected", info.tradeTilesSelected );
|
||||
setBool( env, jgsi, "gameIsConnected", info.gameIsConnected );
|
||||
setBool( env, jgsi, "canShuffle", info.canShuffle );
|
||||
setBool( env, jgsi, "curTurnSelected", info.curTurnSelected );
|
||||
|
||||
XWJNI_END();
|
||||
}
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<group android:id="@+id/group_done">
|
||||
<!-- title set in BoardActivity -->
|
||||
<item android:id="@+id/board_menu_done"
|
||||
android:title="@string/board_menu_done"
|
||||
android:alphabeticShortcut="D"
|
||||
/>
|
||||
<item android:id="@+id/board_menu_trade"
|
||||
|
|
|
@ -197,13 +197,21 @@
|
|||
<string-array name="lookup_urls">
|
||||
<!-- -->
|
||||
<item>Dictionary.com</item>
|
||||
<item>:en:</item> <!-- means all supported -->
|
||||
<item>:en:</item>
|
||||
<item>http://dictionary.com/browse/%2$s</item> -->
|
||||
<!-- -->
|
||||
<item>TheFreeDictionary.com</item>
|
||||
<item>:en:es:</item> <!-- means all supported -->
|
||||
<item>:en:es:</item>
|
||||
<item>http://%1$s.thefreedictionary.com/_/dict.aspx?word=%2$s</item>
|
||||
<!-- -->
|
||||
<item>Larousse.com</item>
|
||||
<item>:fr:</item>
|
||||
<item>http://www.larousse.com/%1$s/dictionaries/french/%2$s</item>
|
||||
<!-- -->
|
||||
<item>Littre.reverso.net</item>
|
||||
<item>:fr:</item>
|
||||
<item>http://littre.reverso.net/dictionnaire-francais/definition/%2$s</item>
|
||||
<!-- -->
|
||||
<item>Google</item>
|
||||
<item></item> <!-- means all supported -->
|
||||
<item>http://www.google.com/search?nl=%1$s\u0026q=%2$s</item>
|
||||
|
|
|
@ -1774,5 +1774,7 @@
|
|||
<string name="site_spinner_prompt">Pick a site</string>
|
||||
<string name="word_list_label">Tap word to search</string>
|
||||
<string name="pick_url_titlef">Look up %s at</string>
|
||||
|
||||
<string name="board_menu_pass">Pass</string>
|
||||
</resources>
|
||||
|
||||
|
|
|
@ -597,12 +597,25 @@ public class BoardActivity extends XWActivity
|
|||
public boolean onPrepareOptionsMenu( Menu menu )
|
||||
{
|
||||
super.onPrepareOptionsMenu( menu );
|
||||
boolean inTrade = false;
|
||||
|
||||
if ( null != m_gsi ) {
|
||||
boolean inTrade = m_gsi.inTrade;
|
||||
inTrade = m_gsi.inTrade;
|
||||
menu.setGroupVisible( R.id.group_done, !inTrade );
|
||||
}
|
||||
|
||||
if ( !inTrade ) {
|
||||
MenuItem item = menu.findItem( R.id.board_menu_done );
|
||||
int strId;
|
||||
if ( 0 >= m_view.curPending() ) {
|
||||
strId = R.string.board_menu_pass;
|
||||
} else {
|
||||
strId = R.string.board_menu_done;
|
||||
}
|
||||
item.setTitle( strId );
|
||||
item.setEnabled( null == m_gsi || m_gsi.curTurnSelected );
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -80,6 +80,7 @@ public class BoardView extends View implements DrawCtx, BoardHandler,
|
|||
private int m_dictPtr = 0;
|
||||
private int m_lastSecsLeft;
|
||||
private int m_lastTimerPlayer;
|
||||
private int m_pendingScore;
|
||||
private Handler m_viewHandler;
|
||||
|
||||
// FontDims: exists to translate space available to the largest
|
||||
|
@ -169,6 +170,7 @@ public class BoardView extends View implements DrawCtx, BoardHandler,
|
|||
m_viewHandler = new Handler();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onTouchEvent( MotionEvent event )
|
||||
{
|
||||
int action = event.getAction();
|
||||
|
@ -336,9 +338,14 @@ public class BoardView extends View implements DrawCtx, BoardHandler,
|
|||
m_jniThread.handle( JNIThread.JNICmd.CMD_INVALALL );
|
||||
}
|
||||
|
||||
public int curPending()
|
||||
{
|
||||
return m_pendingScore;
|
||||
}
|
||||
|
||||
// DrawCtxt interface implementation
|
||||
public boolean scoreBegin( Rect rect, int numPlayers, int[] scores,
|
||||
int remCount, int dfs )
|
||||
int remCount )
|
||||
{
|
||||
fillRectOther( rect, CommonPrefs.COLOR_BACKGRND );
|
||||
m_canvas.save( Canvas.CLIP_SAVE_FLAG );
|
||||
|
@ -465,8 +472,7 @@ public class BoardView extends View implements DrawCtx, BoardHandler,
|
|||
}
|
||||
}
|
||||
|
||||
public boolean boardBegin( Rect rect, int cellWidth, int cellHeight,
|
||||
int dfs )
|
||||
public boolean boardBegin( Rect rect, int cellWidth, int cellHeight )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -582,9 +588,10 @@ public class BoardView extends View implements DrawCtx, BoardHandler,
|
|||
}
|
||||
}
|
||||
|
||||
public boolean trayBegin ( Rect rect, int owner, int dfs )
|
||||
public boolean trayBegin ( Rect rect, int owner, int score )
|
||||
{
|
||||
m_trayOwner = owner;
|
||||
m_pendingScore = score;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -638,7 +645,7 @@ public class BoardView extends View implements DrawCtx, BoardHandler,
|
|||
drawCentered( getResources().getString( R.string.pts ), rect, null );
|
||||
}
|
||||
|
||||
public void objFinished( /*BoardObjectType*/int typ, Rect rect, int dfs )
|
||||
public void objFinished( /*BoardObjectType*/int typ, Rect rect )
|
||||
{
|
||||
if ( DrawCtx.OBJ_SCORE == typ ) {
|
||||
m_canvas.restoreToCount(1); // in case new canvas...
|
||||
|
|
|
@ -43,21 +43,19 @@ public interface DrawCtx {
|
|||
static final int OBJ_TRAY = 3;
|
||||
|
||||
|
||||
boolean scoreBegin( Rect rect, int numPlayers, int[] scores, int remCount,
|
||||
int dfs );
|
||||
boolean scoreBegin( Rect rect, int numPlayers, int[] scores, int remCount );
|
||||
void measureRemText( Rect r, int nTilesLeft, int[] width, int[] height );
|
||||
void measureScoreText( Rect r, DrawScoreInfo dsi, int[] width, int[] height );
|
||||
void drawRemText( Rect rInner, Rect rOuter, int nTilesLeft, boolean focussed );
|
||||
void score_drawPlayer( Rect rInner, Rect rOuter, DrawScoreInfo dsi );
|
||||
void drawTimer( Rect rect, int player, int secondsLeft );
|
||||
boolean boardBegin( Rect rect, int cellWidth, int cellHeight,
|
||||
int dfs );
|
||||
boolean boardBegin( Rect rect, int cellWidth, int cellHeight );
|
||||
|
||||
boolean drawCell( Rect rect, String text, int tile,
|
||||
int owner, int bonus, int hintAtts, int flags );
|
||||
void drawBoardArrow ( Rect rect, int bonus, boolean vert, int hintAtts,
|
||||
int flags );
|
||||
boolean trayBegin ( Rect rect, int owner, int dfs );
|
||||
boolean trayBegin ( Rect rect, int owner, int score );
|
||||
void drawTile( Rect rect, String text, int val, int flags );
|
||||
void drawTileMidDrag ( Rect rect, String text, int val, int owner,
|
||||
int flags );
|
||||
|
@ -72,7 +70,7 @@ public interface DrawCtx {
|
|||
public static final int BONUS_TRIPLE_WORD = 4;
|
||||
public static final int INTRADE_MW_TEXT = 5;
|
||||
|
||||
void objFinished( /*BoardObjectType*/int typ, Rect rect, int dfs );
|
||||
void objFinished( /*BoardObjectType*/int typ, Rect rect );
|
||||
|
||||
void dictChanged( int dictPtr );
|
||||
|
||||
|
|
|
@ -99,6 +99,7 @@ public class JNIThread extends Thread {
|
|||
public boolean tradeTilesSelected;
|
||||
public boolean gameIsConnected;
|
||||
public boolean canShuffle;
|
||||
public boolean curTurnSelected;
|
||||
public GameStateInfo clone() {
|
||||
GameStateInfo obj = null;
|
||||
try {
|
||||
|
|
|
@ -541,6 +541,12 @@ board_getYOffset( const BoardCtxt* board )
|
|||
return vsd->offset;
|
||||
} /* board_getYOffset */
|
||||
|
||||
XP_Bool
|
||||
board_curTurnSelected( const BoardCtxt* board )
|
||||
{
|
||||
return MY_TURN( board );
|
||||
}
|
||||
|
||||
XP_U16
|
||||
board_visTileCount( const BoardCtxt* board )
|
||||
{
|
||||
|
|
|
@ -78,6 +78,7 @@ void board_reset( BoardCtxt* board );
|
|||
XP_Bool board_setYOffset( BoardCtxt* board, XP_U16 newOffset );
|
||||
XP_U16 board_getYOffset( const BoardCtxt* board );
|
||||
|
||||
XP_Bool board_curTurnSelected( const BoardCtxt* board );
|
||||
XP_U16 board_visTileCount( const BoardCtxt* board );
|
||||
XP_Bool board_canShuffle( const BoardCtxt* board );
|
||||
XP_Bool board_canTogglePending( const BoardCtxt* board );
|
||||
|
|
|
@ -129,7 +129,7 @@ typedef struct DrawCtxVTable {
|
|||
XP_S16 dist, DrawFocusState dfs );
|
||||
|
||||
XP_Bool DRAW_VTABLE_NAME(trayBegin) ( DrawCtx* dctx, const XP_Rect* rect,
|
||||
XP_U16 owner,
|
||||
XP_U16 owner, XP_S16 score,
|
||||
DrawFocusState dfs );
|
||||
void DRAW_VTABLE_NAME(measureRemText) ( DrawCtx* dctx, const XP_Rect* r,
|
||||
XP_S16 nTilesLeft,
|
||||
|
@ -257,8 +257,10 @@ struct DrawCtx {
|
|||
#define draw_dictChanged( dc, n, d ) CALL_DRAW_NAME2(dictChanged, (dc), (n), (d))
|
||||
#define draw_boardBegin( dc,r,h,v,f ) CALL_DRAW_NAME4(boardBegin, (dc),\
|
||||
(r),(h),(v),(f))
|
||||
#define draw_objFinished( dc, t, r, d ) CALL_DRAW_NAME3(objFinished, (dc), (t), (r), (d))
|
||||
#define draw_trayBegin( dc, r, o, f ) CALL_DRAW_NAME3(trayBegin,dc, r, o, f)
|
||||
#define draw_objFinished( dc, t, r, d ) \
|
||||
CALL_DRAW_NAME3(objFinished, (dc), (t), (r), (d))
|
||||
#define draw_trayBegin( dc, r, o, s, f ) \
|
||||
CALL_DRAW_NAME4(trayBegin, dc, r, o, s, f)
|
||||
#define draw_vertScrollBoard( dc, r, d, f ) \
|
||||
CALL_DRAW_NAME3(vertScrollBoard, (dc),(r),(d),(f))
|
||||
#define draw_scoreBegin( dc, r, t, s, c, f ) \
|
||||
|
|
|
@ -280,6 +280,7 @@ game_saveToStream( const XWGame* game, const CurGameInfo* gi,
|
|||
void
|
||||
game_getState( const XWGame* game, GameStateInfo* gsi )
|
||||
{
|
||||
gsi->curTurnSelected = board_curTurnSelected( game->board );
|
||||
gsi->visTileCount = board_visTileCount( game->board );
|
||||
gsi->canHint = board_canHint( game->board );
|
||||
gsi->canRedo = board_canTogglePending( game->board );
|
||||
|
|
|
@ -97,6 +97,7 @@ typedef struct _GameStateInfo {
|
|||
XP_Bool tradeTilesSelected;
|
||||
XP_Bool gameIsConnected;
|
||||
XP_Bool canShuffle;
|
||||
XP_Bool curTurnSelected;
|
||||
} GameStateInfo;
|
||||
|
||||
typedef struct XWGame {
|
||||
|
|
|
@ -2045,19 +2045,15 @@ recordWord( const XP_UCHAR* word, XP_Bool isLegal, void* closure )
|
|||
stream_putU8( stream, '\n' );
|
||||
}
|
||||
stream_catString( stream, word );
|
||||
if ( NULL != info->nWordsP ) {
|
||||
*info->nWordsP = info->nWords;
|
||||
}
|
||||
return XP_TRUE;
|
||||
}
|
||||
|
||||
WordNotifierInfo*
|
||||
model_initWordCounter( ModelCtxt* model, XWStreamCtxt* stream, XP_U16* nWords )
|
||||
model_initWordCounter( ModelCtxt* model, XWStreamCtxt* stream )
|
||||
{
|
||||
XP_ASSERT( model->vol.wni.proc == recordWord );
|
||||
XP_ASSERT( model->vol.wni.closure == &model->vol.rwi );
|
||||
model->vol.rwi.stream = stream;
|
||||
model->vol.rwi.nWordsP = nWords;
|
||||
model->vol.rwi.nWords = 0;
|
||||
return &model->vol.wni;
|
||||
}
|
||||
|
@ -2077,7 +2073,7 @@ model_getWordsPlayed( ModelCtxt* model, XP_U16 nTurns, XWStreamCtxt* stream )
|
|||
}
|
||||
|
||||
if ( model_undoLatestMoves( model, NULL, nTurns, NULL, NULL ) ) {
|
||||
WordNotifierInfo* ni = model_initWordCounter( model, stream, NULL );
|
||||
WordNotifierInfo* ni = model_initWordCounter( model, stream );
|
||||
/* Now push the undone moves back into the model one at a time.
|
||||
recordWord() will add each played word to the stream as it's
|
||||
scored */
|
||||
|
|
|
@ -272,8 +272,7 @@ XP_U16 figureMoveScore( const ModelCtxt* model, XP_U16 turn, MoveInfo* mvInfo,
|
|||
WordNotifierInfo* notifyInfo );
|
||||
|
||||
/* tap into internal WordNotifierInfo */
|
||||
WordNotifierInfo* model_initWordCounter( ModelCtxt* model, XWStreamCtxt* stream,
|
||||
XP_U16* nWords );
|
||||
WordNotifierInfo* model_initWordCounter( ModelCtxt* model, XWStreamCtxt* stream );
|
||||
|
||||
/********************* persistence ********************/
|
||||
#ifdef INCLUDE_IO_SUPPORT
|
||||
|
|
|
@ -45,7 +45,6 @@ typedef struct PlayerCtxt {
|
|||
|
||||
typedef struct _RecordWordsInfo {
|
||||
XWStreamCtxt* stream;
|
||||
XP_U16* nWordsP;
|
||||
XP_U16 nWords;
|
||||
} RecordWordsInfo;
|
||||
|
||||
|
|
|
@ -93,7 +93,6 @@ typedef struct ServerNonvolatiles {
|
|||
RemoteAddress addresses[MAX_NUM_PLAYERS];
|
||||
XWStreamCtxt* prevMoveStream; /* save it to print later */
|
||||
XWStreamCtxt* prevWordsStream;
|
||||
XP_U16 prevWordCount;
|
||||
} ServerNonvolatiles;
|
||||
|
||||
struct ServerCtxt {
|
||||
|
@ -758,8 +757,7 @@ makeRobotMove( ServerCtxt* server )
|
|||
if ( !!stream ) {
|
||||
XWStreamCtxt* wordsStream = mkServerStream( server );
|
||||
WordNotifierInfo* ni =
|
||||
model_initWordCounter( model, wordsStream,
|
||||
&server->nv.prevWordCount );
|
||||
model_initWordCounter( model, wordsStream );
|
||||
(void)model_checkMoveLegal( model, turn, stream, ni );
|
||||
XP_ASSERT( !server->nv.prevMoveStream );
|
||||
server->nv.prevMoveStream = stream;
|
||||
|
@ -870,8 +868,7 @@ showPrevScore( ServerCtxt* server )
|
|||
stream_destroy( prevStream );
|
||||
}
|
||||
|
||||
util_informMove( util, stream, server->nv.prevWordsStream,
|
||||
server->nv.prevWordCount );
|
||||
util_informMove( util, stream, server->nv.prevWordsStream );
|
||||
stream_destroy( stream );
|
||||
stream_destroy( server->nv.prevWordsStream );
|
||||
server->nv.prevWordsStream = NULL;
|
||||
|
@ -1885,9 +1882,7 @@ makeMoveReportIf( ServerCtxt* server, XWStreamCtxt** wordsStream )
|
|||
ModelCtxt* model = server->vol.model;
|
||||
stream = mkServerStream( server );
|
||||
*wordsStream = mkServerStream( server );
|
||||
WordNotifierInfo* ni =
|
||||
model_initWordCounter( model, *wordsStream,
|
||||
&server->nv.prevWordCount );
|
||||
WordNotifierInfo* ni = model_initWordCounter( model, *wordsStream );
|
||||
(void)model_checkMoveLegal( model, server->nv.currentTurn, stream, ni );
|
||||
}
|
||||
return stream;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* -*- compile-command: "cd ../linux && make MEMDEBUG=TRUE"; -*- */
|
||||
/* -*- compile-command: "cd ../linux && make MEMDEBUG=TRUE -j3"; -*- */
|
||||
/*
|
||||
* Copyright 1997 - 2009 by Eric House (xwords@eehouse.org). All rights
|
||||
* Copyright 1997 - 2011 by Eric House (xwords@eehouse.org). All rights
|
||||
* reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
|
@ -29,7 +29,9 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
/****************************** prototypes ******************************/
|
||||
static void drawPendingScore( BoardCtxt* board, XP_Bool hasCursor );
|
||||
static void drawPendingScore( BoardCtxt* board, XP_S16 turnScore,
|
||||
XP_Bool hasCursor );
|
||||
static XP_S16 figurePendingScore( const BoardCtxt* board );
|
||||
static XP_U16 countTilesToShow( BoardCtxt* board );
|
||||
static void figureDividerRect( BoardCtxt* board, XP_Rect* rect );
|
||||
|
||||
|
@ -130,8 +132,10 @@ drawTray( BoardCtxt* board )
|
|||
const XP_S16 turn = board->selPlayer;
|
||||
PerTurnInfo* pti = board->selInfo;
|
||||
|
||||
XP_S16 turnScore = figurePendingScore( board );
|
||||
|
||||
if ( draw_trayBegin( board->draw, &board->trayBounds, turn,
|
||||
dfsFor( board, OBJ_TRAY ) ) ) {
|
||||
turnScore, dfsFor( board, OBJ_TRAY ) ) ) {
|
||||
DictionaryCtxt* dictionary = model_getDictionary( board->model );
|
||||
XP_S16 cursorBits = 0;
|
||||
XP_Bool cursorOnDivider = XP_FALSE;
|
||||
|
@ -242,8 +246,7 @@ drawTray( BoardCtxt* board )
|
|||
draw_drawTrayDivider( board->draw, ÷r, flags );
|
||||
board->dividerInvalid = XP_FALSE;
|
||||
}
|
||||
|
||||
drawPendingScore( board,
|
||||
drawPendingScore( board, turnScore,
|
||||
(cursorBits & (1<<(MAX_TRAY_TILES-1))) != 0);
|
||||
}
|
||||
|
||||
|
@ -304,19 +307,25 @@ countTilesToShow( BoardCtxt* board )
|
|||
return numToShow;
|
||||
} /* countTilesToShow */
|
||||
|
||||
static XP_S16
|
||||
figurePendingScore( const BoardCtxt* board )
|
||||
{
|
||||
XP_S16 turnScore;
|
||||
(void)getCurrentMoveScoreIfLegal( board->model, board->selPlayer,
|
||||
(XWStreamCtxt*)NULL,
|
||||
(WordNotifierInfo*)NULL,
|
||||
&turnScore );
|
||||
return turnScore;
|
||||
}
|
||||
|
||||
static void
|
||||
drawPendingScore( BoardCtxt* board, XP_Bool hasCursor )
|
||||
drawPendingScore( BoardCtxt* board, XP_S16 turnScore, XP_Bool hasCursor )
|
||||
{
|
||||
/* Draw the pending score down in the last tray's rect */
|
||||
if ( countTilesToShow( board ) < MAX_TRAY_TILES ) {
|
||||
XP_U16 selPlayer = board->selPlayer;
|
||||
XP_S16 turnScore = 0;
|
||||
XP_Rect lastTileR;
|
||||
|
||||
(void)getCurrentMoveScoreIfLegal( board->model, selPlayer,
|
||||
(XWStreamCtxt*)NULL,
|
||||
(WordNotifierInfo*)NULL,
|
||||
&turnScore );
|
||||
figureTrayTileRect( board, MAX_TRAY_TILES-1, &lastTileR );
|
||||
draw_score_pendingScore( board->draw, &lastTileR, turnScore,
|
||||
selPlayer,
|
||||
|
|
|
@ -131,7 +131,7 @@ typedef struct UtilVtable {
|
|||
void (*m_util_turnChanged)(XW_UtilCtxt* uc);
|
||||
#endif
|
||||
void (*m_util_informMove)( XW_UtilCtxt* uc, XWStreamCtxt* expl,
|
||||
XWStreamCtxt* words, XP_U16 wordCount );
|
||||
XWStreamCtxt* words );
|
||||
void (*m_util_notifyGameOver)( XW_UtilCtxt* uc );
|
||||
|
||||
XP_Bool (*m_util_hiliteCell)( XW_UtilCtxt* uc, XP_U16 col, XP_U16 row );
|
||||
|
@ -228,8 +228,8 @@ struct XW_UtilCtxt {
|
|||
# define util_turnChanged( uc )
|
||||
#endif
|
||||
|
||||
#define util_informMove(uc,e,w,wc) \
|
||||
(uc)->vtable->m_util_informMove( (uc),(e),(w),(wc) )
|
||||
#define util_informMove(uc,e,w) \
|
||||
(uc)->vtable->m_util_informMove( (uc),(e),(w))
|
||||
#define util_notifyGameOver( uc ) \
|
||||
(uc)->vtable->m_util_notifyGameOver((uc))
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* -*-mode: C; fill-column: 78; c-basic-offset: 4; compile-command: "make MEMDEBUG=TRUE"; -*- */
|
||||
/* -*- compile-command: "make MEMDEBUG=TRUE -j3"; -*- */
|
||||
/*
|
||||
* Copyright 1997-2008 by Eric House (xwords@eehouse.org). All rights
|
||||
* Copyright 1997-2011 by Eric House (xwords@eehouse.org). All rights
|
||||
* reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
|
@ -91,6 +91,7 @@ static XP_Bool
|
|||
curses_draw_trayBegin( DrawCtx* XP_UNUSED(p_dctx),
|
||||
const XP_Rect* XP_UNUSED(rect),
|
||||
XP_U16 XP_UNUSED(owner),
|
||||
XP_S16 XP_UNUSED(score),
|
||||
DrawFocusState XP_UNUSED(dfs) )
|
||||
{
|
||||
return XP_TRUE;
|
||||
|
|
|
@ -334,8 +334,7 @@ cursesShowFinalScores( CursesAppGlobals* globals )
|
|||
|
||||
static void
|
||||
curses_util_informMove( XW_UtilCtxt* uc, XWStreamCtxt* expl,
|
||||
XWStreamCtxt* XP_UNUSED(words),
|
||||
XP_U16 XP_UNUSED(wordCount) )
|
||||
XWStreamCtxt* XP_UNUSED(words))
|
||||
{
|
||||
CursesAppGlobals* globals = (CursesAppGlobals*)uc->closure;
|
||||
char* question = strFromStream( expl );
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* -*- mode: C; fill-column: 78; c-basic-offset: 4; compile-command: "make MEMDEBUG=TRUE"; -*- */
|
||||
/* -*- compile-command: "make MEMDEBUG=TRUE -j3"; -*- */
|
||||
/*
|
||||
* Copyright 1997-2008 by Eric House (xwords@eehouse.org). All rights
|
||||
* Copyright 1997-2011 by Eric House (xwords@eehouse.org). All rights
|
||||
* reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
|
@ -634,7 +634,8 @@ gtk_draw_invertCell( DrawCtx* XP_UNUSED(p_dctx),
|
|||
|
||||
static XP_Bool
|
||||
gtk_draw_trayBegin( DrawCtx* p_dctx, const XP_Rect* XP_UNUSED(rect),
|
||||
XP_U16 owner, DrawFocusState XP_UNUSED(dfs) )
|
||||
XP_U16 owner, XP_S16 XP_UNUSED(owner),
|
||||
DrawFocusState XP_UNUSED(dfs) )
|
||||
{
|
||||
GtkDrawCtx* dctx = (GtkDrawCtx*)p_dctx;
|
||||
dctx->trayOwner = owner;
|
||||
|
@ -729,7 +730,7 @@ gtk_draw_drawTileMidDrag( DrawCtx* p_dctx, const XP_Rect* rect,
|
|||
const XP_UCHAR* textP, const XP_Bitmaps* bitmaps,
|
||||
XP_U16 val, XP_U16 owner, CellFlags flags )
|
||||
{
|
||||
gtk_draw_trayBegin( p_dctx, rect, owner, DFS_NONE );
|
||||
gtk_draw_trayBegin( p_dctx, rect, owner, 0, DFS_NONE );
|
||||
gtkDrawTileImpl( p_dctx, rect, textP, bitmaps, val,
|
||||
flags | CELL_HIGHLIGHT, XP_FALSE );
|
||||
}
|
||||
|
|
|
@ -1388,9 +1388,8 @@ gtkShowFinalScores( const CommonGlobals* cGlobals )
|
|||
|
||||
static void
|
||||
gtk_util_informMove( XW_UtilCtxt* XP_UNUSED(uc), XWStreamCtxt* XP_UNUSED(expl),
|
||||
XWStreamCtxt* words, XP_U16 wordCount )
|
||||
XWStreamCtxt* words )
|
||||
{
|
||||
XP_LOGF( "%s(wordCount=%d)", __func__, wordCount );
|
||||
char* question = strFromStream( words/*expl*/ );
|
||||
(void)gtkask( question, GTK_BUTTONS_OK );
|
||||
free( question );
|
||||
|
|
Loading…
Reference in a new issue