mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2024-12-30 10:26:58 +01:00
catch up with API changes
This commit is contained in:
parent
8f7047a3f8
commit
6b0f82c8f8
2 changed files with 42 additions and 20 deletions
|
@ -45,7 +45,7 @@ eraseRect(FrankDrawCtx* dctx, RECT* rect )
|
||||||
} /* eraseRect */
|
} /* eraseRect */
|
||||||
|
|
||||||
static XP_Bool
|
static XP_Bool
|
||||||
frank_draw_boardBegin( DrawCtx* p_dctx, XP_Rect* rect, XP_Bool hasfocus )
|
frank_draw_boardBegin( DrawCtx* p_dctx, DictionaryCtxt* dict, XP_Rect* rect, XP_Bool hasfocus )
|
||||||
{
|
{
|
||||||
/* FrankDrawCtx* dctx = (FrankDrawCtx*)p_dctx; */
|
/* FrankDrawCtx* dctx = (FrankDrawCtx*)p_dctx; */
|
||||||
return XP_TRUE;
|
return XP_TRUE;
|
||||||
|
|
|
@ -102,7 +102,9 @@ static void frank_util_notifyGameOver( XW_UtilCtxt* uc );
|
||||||
static XP_Bool frank_util_hiliteCell( XW_UtilCtxt* uc,
|
static XP_Bool frank_util_hiliteCell( XW_UtilCtxt* uc,
|
||||||
XP_U16 col, XP_U16 row );
|
XP_U16 col, XP_U16 row );
|
||||||
static XP_Bool frank_util_engineProgressCallback( XW_UtilCtxt* uc );
|
static XP_Bool frank_util_engineProgressCallback( XW_UtilCtxt* uc );
|
||||||
static void frank_util_setTimer( XW_UtilCtxt* uc, XWTimerReason why );
|
static void frank_util_setTimer( XW_UtilCtxt* uc, XWTimerReason why,
|
||||||
|
XP_U16 when,
|
||||||
|
TimerProc proc, void* closure );
|
||||||
static void frank_util_requestTime( XW_UtilCtxt* uc );
|
static void frank_util_requestTime( XW_UtilCtxt* uc );
|
||||||
static XP_U32 frank_util_getCurSeconds( XW_UtilCtxt* uc );
|
static XP_U32 frank_util_getCurSeconds( XW_UtilCtxt* uc );
|
||||||
static XWBonusType frank_util_getSquareBonus( XW_UtilCtxt* uc,
|
static XWBonusType frank_util_getSquareBonus( XW_UtilCtxt* uc,
|
||||||
|
@ -127,7 +129,6 @@ class CXWordsWindow : public CWindow {
|
||||||
public: /* so util functions can access */
|
public: /* so util functions can access */
|
||||||
XWGame fGame;
|
XWGame fGame;
|
||||||
CurGameInfo fGameInfo;
|
CurGameInfo fGameInfo;
|
||||||
XP_Bool fTimers[2];
|
|
||||||
VTableMgr* fVTableMgr;
|
VTableMgr* fVTableMgr;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -145,6 +146,10 @@ class CXWordsWindow : public CWindow {
|
||||||
RECT fProgressRect;
|
RECT fProgressRect;
|
||||||
U16 fProgressCurLine;
|
U16 fProgressCurLine;
|
||||||
|
|
||||||
|
/* There's a wasted slot here, but it simplifies indexing */
|
||||||
|
TimerProc fTimerProcs[TIMER_NUM_PLUS_ONE];
|
||||||
|
void* fTimerClosures[TIMER_NUM_PLUS_ONE];
|
||||||
|
|
||||||
XP_U8 phoniesAction;
|
XP_U8 phoniesAction;
|
||||||
BOOL penDown;
|
BOOL penDown;
|
||||||
BOOL drawInProgress;
|
BOOL drawInProgress;
|
||||||
|
@ -162,7 +167,10 @@ public:
|
||||||
void setUserEventPending() { this->userEventPending = TRUE; }
|
void setUserEventPending() { this->userEventPending = TRUE; }
|
||||||
void clearUserEventPending() { this->userEventPending = FALSE; }
|
void clearUserEventPending() { this->userEventPending = FALSE; }
|
||||||
BOOL getUserEventPending() { return this->userEventPending; }
|
BOOL getUserEventPending() { return this->userEventPending; }
|
||||||
|
void setTimerImpl( XWTimerReason why,
|
||||||
|
TimerProc proc, void* closure );
|
||||||
void setTimerIfNeeded();
|
void setTimerIfNeeded();
|
||||||
|
void fireTimer( XWTimerReason why );
|
||||||
XP_Bool robotIsHalted() { return fRobotHalted; }
|
XP_Bool robotIsHalted() { return fRobotHalted; }
|
||||||
void updateCtrlsForTray( XW_TrayVisState newState );
|
void updateCtrlsForTray( XW_TrayVisState newState );
|
||||||
void startProgressBar();
|
void startProgressBar();
|
||||||
|
@ -463,7 +471,6 @@ CXWordsWindow::MsgHandler( MSG_TYPE type, CViewable *from, S32 data )
|
||||||
XP_Key xpkey;
|
XP_Key xpkey;
|
||||||
S16 drag_x;
|
S16 drag_x;
|
||||||
S16 drag_y;
|
S16 drag_y;
|
||||||
XWTimerReason reason;
|
|
||||||
XP_Bool handled;
|
XP_Bool handled;
|
||||||
|
|
||||||
drag_x = (S16) (data >> 16);
|
drag_x = (S16) (data >> 16);
|
||||||
|
@ -522,10 +529,7 @@ CXWordsWindow::MsgHandler( MSG_TYPE type, CViewable *from, S32 data )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MSG_TIMER:
|
case MSG_TIMER:
|
||||||
reason = this->fTimers[TIMER_PENDOWN]?
|
fireTimer( (XWTimerReason)data );
|
||||||
TIMER_PENDOWN:TIMER_TIMERTICK;
|
|
||||||
fTimers[reason] = XP_FALSE; /* clear now; board may set it again */
|
|
||||||
board_timerFired( fGame.board, reason );
|
|
||||||
setTimerIfNeeded();
|
setTimerIfNeeded();
|
||||||
GUI_NeedUpdate(); /* Needed off-emulator? PENDING */
|
GUI_NeedUpdate(); /* Needed off-emulator? PENDING */
|
||||||
break;
|
break;
|
||||||
|
@ -629,19 +633,41 @@ void
|
||||||
CXWordsWindow::setTimerIfNeeded()
|
CXWordsWindow::setTimerIfNeeded()
|
||||||
{
|
{
|
||||||
U32 mSeconds;
|
U32 mSeconds;
|
||||||
if ( fTimers[TIMER_PENDOWN] ) { /* faster, so higher priority */
|
XWTimerReason why;
|
||||||
|
|
||||||
|
if ( fTimerProcs[TIMER_PENDOWN] != NULL ) { /* faster, so higher priority */
|
||||||
mSeconds = (U32)450;
|
mSeconds = (U32)450;
|
||||||
XP_DEBUGF( "setting timer %d", TIMER_PENDOWN );
|
why = TIMER_PENDOWN;
|
||||||
} else if ( fTimers[TIMER_TIMERTICK] ) {
|
} else if ( fTimerProcs[TIMER_TIMERTICK] != NULL ) {
|
||||||
mSeconds = (U32)1000;
|
mSeconds = (U32)1000;
|
||||||
XP_DEBUGF( "setting timer %d", TIMER_TIMERTICK );
|
why = TIMER_TIMERTICK;
|
||||||
} else {
|
} else {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
SetTimer( mSeconds, XP_FALSE, 0L );
|
SetTimer( mSeconds, XP_FALSE, why );
|
||||||
} /* setTimerIfNeeded */
|
} /* setTimerIfNeeded */
|
||||||
|
|
||||||
|
void
|
||||||
|
CXWordsWindow::fireTimer( XWTimerReason why )
|
||||||
|
{
|
||||||
|
TimerProc proc = fTimerProcs[why];
|
||||||
|
fTimerProcs[why] = (TimerProc)NULL; /* clear now; board may set it again */
|
||||||
|
|
||||||
|
(*proc)( fTimerClosures[why], why );
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CXWordsWindow::setTimerImpl( XWTimerReason why, TimerProc proc, void* closure )
|
||||||
|
{
|
||||||
|
XP_ASSERT( why == TIMER_PENDOWN ||
|
||||||
|
why == TIMER_TIMERTICK );
|
||||||
|
|
||||||
|
fTimerProcs[why] = proc;
|
||||||
|
fTimerClosures[why] = closure;
|
||||||
|
setTimerIfNeeded();
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CXWordsWindow::disOrEnableFrank( U16 id, XP_Bool enable )
|
CXWordsWindow::disOrEnableFrank( U16 id, XP_Bool enable )
|
||||||
{
|
{
|
||||||
|
@ -1466,15 +1492,11 @@ frank_util_engineProgressCallback( XW_UtilCtxt* uc )
|
||||||
} /* frank_util_engineProgressCallback */
|
} /* frank_util_engineProgressCallback */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
frank_util_setTimer( XW_UtilCtxt* uc, XWTimerReason why )
|
frank_util_setTimer( XW_UtilCtxt* uc, XWTimerReason why, XP_U16 when,
|
||||||
|
TimerProc proc, void* closure )
|
||||||
{
|
{
|
||||||
CXWordsWindow* self = (CXWordsWindow*)uc->closure;
|
CXWordsWindow* self = (CXWordsWindow*)uc->closure;
|
||||||
|
self->setTimerImpl( why, proc, closure );
|
||||||
XP_ASSERT( why == TIMER_PENDOWN ||
|
|
||||||
why == TIMER_TIMERTICK );
|
|
||||||
|
|
||||||
self->fTimers[why] = XP_TRUE;
|
|
||||||
self->setTimerIfNeeded();
|
|
||||||
} /* frank_util_setTimer */
|
} /* frank_util_setTimer */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
Loading…
Reference in a new issue