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
handlePrefsButton( HWND hDlg, CEAppGlobals* globals, GameInfoState* state )
{
XP_Bool colorsChanged;
XP_Bool colorsChanged, langChanged;
if ( WrapPrefsDialog( hDlg, globals, &state->prefsPrefs,
state->isNewGame, &colorsChanged ) ) {
state->isNewGame, &colorsChanged, &langChanged ) ) {
state->prefsChanged = XP_TRUE;
state->colorsChanged = colorsChanged;
state->langChanged = langChanged;
/* nothing to do until user finally does confirm the parent dialog */
}
} /* handlePrefsButton */

View file

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

View file

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

View file

@ -41,6 +41,7 @@ typedef struct _CePrefsDlgState {
//XP_Bool doGlobalPrefs; /* state of the radio */
XP_Bool isNewGame;
XP_Bool colorsChanged;
XP_Bool langChanged;
} CePrefsDlgState;
/* 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,
pState->langFileName,
newFile, VSIZE(newFile)) ) {
const wchar_t* msg
= ceGetResStringL( globals,
IDS_LANG_CHANGE_RESTART );
MessageBox( hDlg, msg, NULL,
MB_OK | MB_ICONINFORMATION );
pState->langChanged = XP_TRUE;
XP_STRNCPY( pState->langFileName, newFile,
VSIZE(pState->langFileName) );
}
@ -394,7 +391,7 @@ PrefsDlg(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
*/
XP_Bool
WrapPrefsDialog( HWND hDlg, CEAppGlobals* globals, CePrefsPrefs* prefsPrefs,
XP_Bool isNewGame, XP_Bool* colorsChanged )
XP_Bool isNewGame, XP_Bool* colorsChanged, XP_Bool* langChanged )
{
CePrefsDlgState state;
XP_Bool result;
@ -417,6 +414,7 @@ WrapPrefsDialog( HWND hDlg, CEAppGlobals* globals, CePrefsPrefs* prefsPrefs,
if ( result ) {
XP_MEMCPY( prefsPrefs, &state.prefsPrefs, sizeof( *prefsPrefs ) );
*colorsChanged = state.colorsChanged;
*langChanged = state.langChanged;
replaceStringIfDifferent( globals->mpool, &globals->langFileName,
state.langFileName );

View file

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

View file

@ -955,7 +955,7 @@ BEGIN
IDS_NEED_TOUCH "This feature requires a touch screen."
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
IDS_RESEND_STANDALONE "This is a standalone game. There is nothing to resend."