warn about need to restart to pick up language change after last

opportunity to cancel is passed.  Change wording to make sense.
This commit is contained in:
ehouse 2009-10-02 05:48:48 +00:00
parent 05928b368d
commit 5ba99f45d7
6 changed files with 34 additions and 13 deletions

View file

@ -310,11 +310,12 @@ raiseForHiddenPlayers( GameInfoState* state, XP_U16 nPlayers )
static void static void
handlePrefsButton( HWND hDlg, CEAppGlobals* globals, GameInfoState* state ) handlePrefsButton( HWND hDlg, CEAppGlobals* globals, GameInfoState* state )
{ {
XP_Bool colorsChanged; XP_Bool colorsChanged, langChanged;
if ( WrapPrefsDialog( hDlg, globals, &state->prefsPrefs, if ( WrapPrefsDialog( hDlg, globals, &state->prefsPrefs,
state->isNewGame, &colorsChanged ) ) { state->isNewGame, &colorsChanged, &langChanged ) ) {
state->prefsChanged = XP_TRUE; state->prefsChanged = XP_TRUE;
state->colorsChanged = colorsChanged; state->colorsChanged = colorsChanged;
state->langChanged = langChanged;
/* nothing to do until user finally does confirm the parent dialog */ /* nothing to do until user finally does confirm the parent dialog */
} }
} /* handlePrefsButton */ } /* handlePrefsButton */

View file

@ -47,6 +47,7 @@ typedef struct GameInfoState {
XP_Bool prefsChanged; XP_Bool prefsChanged;
XP_Bool colorsChanged; XP_Bool colorsChanged;
XP_Bool langChanged;
XP_Bool addrChanged; XP_Bool addrChanged;
CePrefsPrefs prefsPrefs; CePrefsPrefs prefsPrefs;

View file

@ -1737,6 +1737,14 @@ ceDisplayFinalScores( CEAppGlobals* globals )
MB_OK | MB_ICONINFORMATION, XP_TRUE ); MB_OK | MB_ICONINFORMATION, XP_TRUE );
} /* ceDisplayFinalScores */ } /* ceDisplayFinalScores */
static void
ceWarnLangChange( CEAppGlobals* globals )
{
const wchar_t* msg = ceGetResStringL( globals,
IDS_LANG_CHANGE_RESTART );
MessageBox( globals->hWnd, msg, NULL, MB_OK | MB_ICONINFORMATION );
}
static XP_Bool static XP_Bool
ceDoNewGame( CEAppGlobals* globals ) ceDoNewGame( CEAppGlobals* globals )
{ {
@ -1770,6 +1778,11 @@ ceDoNewGame( CEAppGlobals* globals )
updateForColors( globals ); updateForColors( globals );
} }
} }
if ( giState.prefsChanged ) {
ceWarnLangChange( globals );
}
#if defined XWFEATURE_RELAY || defined XWFEATURE_BLUETOOTH #if defined XWFEATURE_RELAY || defined XWFEATURE_BLUETOOTH
if ( giState.addrChanged ) { if ( giState.addrChanged ) {
addr = &giState.prefsPrefs.addrRec; addr = &giState.prefsPrefs.addrRec;
@ -1871,14 +1884,14 @@ static void
ceDoPrefsDlg( CEAppGlobals* globals ) ceDoPrefsDlg( CEAppGlobals* globals )
{ {
CePrefsPrefs prefsPrefs; CePrefsPrefs prefsPrefs;
XP_Bool colorsChanged; XP_Bool colorsChanged, langChanged;
loadStateFromCurPrefs( globals, &globals->appPrefs, &globals->gameInfo, loadStateFromCurPrefs( globals, &globals->appPrefs, &globals->gameInfo,
&prefsPrefs ); &prefsPrefs );
assertOnTop( globals->hWnd ); assertOnTop( globals->hWnd );
if ( WrapPrefsDialog( globals->hWnd, globals, &prefsPrefs, if ( WrapPrefsDialog( globals->hWnd, globals, &prefsPrefs,
XP_FALSE, &colorsChanged ) ) { XP_FALSE, &colorsChanged, &langChanged ) ) {
loadCurPrefsFromState( globals, &globals->appPrefs, &globals->gameInfo, loadCurPrefsFromState( globals, &globals->appPrefs, &globals->gameInfo,
&prefsPrefs ); &prefsPrefs );
@ -1887,6 +1900,11 @@ ceDoPrefsDlg( CEAppGlobals* globals )
if ( colorsChanged ) { if ( colorsChanged ) {
updateForColors( globals ); updateForColors( globals );
} }
if ( langChanged ) {
ceWarnLangChange( globals );
}
/* need to reflect vars set in state into globals, and update/inval /* need to reflect vars set in state into globals, and update/inval
as appropriate. */ as appropriate. */
} }
@ -2442,6 +2460,9 @@ WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
if ( state.prefsChanged ) { if ( state.prefsChanged ) {
updateForColors( globals ); updateForColors( globals );
} }
if ( state.langChanged ) {
ceWarnLangChange( globals );
}
draw = server_do( globals->game.server ); draw = server_do( globals->game.server );
} }
} }

View file

@ -41,6 +41,7 @@ typedef struct _CePrefsDlgState {
//XP_Bool doGlobalPrefs; /* state of the radio */ //XP_Bool doGlobalPrefs; /* state of the radio */
XP_Bool isNewGame; XP_Bool isNewGame;
XP_Bool colorsChanged; XP_Bool colorsChanged;
XP_Bool langChanged;
} CePrefsDlgState; } CePrefsDlgState;
/* Stuff the strings for phonies. Why can't I put this in the resource? /* Stuff the strings for phonies. Why can't I put this in the resource?
@ -338,11 +339,7 @@ PrefsDlg(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
if ( ceChooseResFile( hDlg, globals, if ( ceChooseResFile( hDlg, globals,
pState->langFileName, pState->langFileName,
newFile, VSIZE(newFile)) ) { newFile, VSIZE(newFile)) ) {
const wchar_t* msg pState->langChanged = XP_TRUE;
= ceGetResStringL( globals,
IDS_LANG_CHANGE_RESTART );
MessageBox( hDlg, msg, NULL,
MB_OK | MB_ICONINFORMATION );
XP_STRNCPY( pState->langFileName, newFile, XP_STRNCPY( pState->langFileName, newFile,
VSIZE(pState->langFileName) ); VSIZE(pState->langFileName) );
} }
@ -394,7 +391,7 @@ PrefsDlg(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
*/ */
XP_Bool XP_Bool
WrapPrefsDialog( HWND hDlg, CEAppGlobals* globals, CePrefsPrefs* prefsPrefs, WrapPrefsDialog( HWND hDlg, CEAppGlobals* globals, CePrefsPrefs* prefsPrefs,
XP_Bool isNewGame, XP_Bool* colorsChanged ) XP_Bool isNewGame, XP_Bool* colorsChanged, XP_Bool* langChanged )
{ {
CePrefsDlgState state; CePrefsDlgState state;
XP_Bool result; XP_Bool result;
@ -417,6 +414,7 @@ WrapPrefsDialog( HWND hDlg, CEAppGlobals* globals, CePrefsPrefs* prefsPrefs,
if ( result ) { if ( result ) {
XP_MEMCPY( prefsPrefs, &state.prefsPrefs, sizeof( *prefsPrefs ) ); XP_MEMCPY( prefsPrefs, &state.prefsPrefs, sizeof( *prefsPrefs ) );
*colorsChanged = state.colorsChanged; *colorsChanged = state.colorsChanged;
*langChanged = state.langChanged;
replaceStringIfDifferent( globals->mpool, &globals->langFileName, replaceStringIfDifferent( globals->mpool, &globals->langFileName,
state.langFileName ); state.langFileName );

View file

@ -56,8 +56,8 @@ typedef struct CePrefsPrefs {
} CePrefsPrefs; } CePrefsPrefs;
XP_Bool WrapPrefsDialog( HWND hDlg, CEAppGlobals* globals, XP_Bool WrapPrefsDialog( HWND hDlg, CEAppGlobals* globals,
CePrefsPrefs* prefsPrefs, CePrefsPrefs* prefsPrefs, XP_Bool isNewGame,
XP_Bool isNewGame, XP_Bool* colorsChanged ); XP_Bool* colorsChanged, XP_Bool* langChanged );
void loadStateFromCurPrefs( CEAppGlobals* globals, const CEAppPrefs* appPrefs, void loadStateFromCurPrefs( CEAppGlobals* globals, const CEAppPrefs* appPrefs,
const CurGameInfo* gi, CePrefsPrefs* prefsPrefs ); const CurGameInfo* gi, CePrefsPrefs* prefsPrefs );
void loadCurPrefsFromState( CEAppGlobals* globals, CEAppPrefs* appPrefs, void loadCurPrefsFromState( CEAppGlobals* globals, CEAppPrefs* appPrefs,

View file

@ -955,7 +955,7 @@ BEGIN
IDS_NEED_TOUCH "This feature requires a touch screen." IDS_NEED_TOUCH "This feature requires a touch screen."
IDS_EDITCOLOR_FORMAT "Edit color for %s" IDS_EDITCOLOR_FORMAT "Edit color for %s"
IDS_LANG_CHANGE_RESTART "This change will take effect after you restart Crosswords." IDS_LANG_CHANGE_RESTART "You will see the new language after you restart Crosswords."
#ifndef XWFEATURE_STANDALONE_ONLY #ifndef XWFEATURE_STANDALONE_ONLY
IDS_RESEND_STANDALONE "This is a standalone game. There is nothing to resend." IDS_RESEND_STANDALONE "This is a standalone game. There is nothing to resend."