fix showing of timer field when timer disabled when switching from global

to local prefs; use num-getter utils rather than convert to/from text.
This commit is contained in:
ehouse 2006-07-02 00:39:31 +00:00
parent ef2101f4f8
commit 762070e6a9

View file

@ -97,12 +97,13 @@ adjustForChoice( HWND hDlg, CePrefsDlgState* state )
XP_TRUE); XP_TRUE);
} }
#ifdef XWFEATURE_SEARCHLIMIT
if ( !doGlobalPrefs ) { if ( !doGlobalPrefs ) {
setTimerCtls( hDlg, ceGetChecked( hDlg, TIMER_CHECK ) );
#ifdef XWFEATURE_SEARCHLIMIT
ceShowOrHide( hDlg, IDC_CHECKHINTSLIMITS, ceShowOrHide( hDlg, IDC_CHECKHINTSLIMITS,
!ceGetChecked( hDlg, IDC_CHECKNOHINTS) ); !ceGetChecked( hDlg, IDC_CHECKNOHINTS) );
}
#endif #endif
}
} /* adjustForChoice */ } /* adjustForChoice */
/* Copy global state into a local copy that can be changed without /* Copy global state into a local copy that can be changed without
@ -175,7 +176,6 @@ static void
loadControlsFromState( HWND hDlg, CePrefsDlgState* pState ) loadControlsFromState( HWND hDlg, CePrefsDlgState* pState )
{ {
CePrefsPrefs* prefsPrefs = &pState->prefsPrefs; CePrefsPrefs* prefsPrefs = &pState->prefsPrefs;
XP_UCHAR numBuf[10];
ceSetChecked( hDlg, IDC_CHECKCOLORPLAYED, prefsPrefs->showColors ); ceSetChecked( hDlg, IDC_CHECKCOLORPLAYED, prefsPrefs->showColors );
ceSetChecked( hDlg, IDC_CHECKSMARTROBOT, ceSetChecked( hDlg, IDC_CHECKSMARTROBOT,
@ -192,9 +192,7 @@ loadControlsFromState( HWND hDlg, CePrefsDlgState* pState )
ceSetChecked( hDlg, IDC_CHECKHINTSLIMITS, prefsPrefs->gp.allowHintRect ); ceSetChecked( hDlg, IDC_CHECKHINTSLIMITS, prefsPrefs->gp.allowHintRect );
#endif #endif
/* timer */ /* timer */
snprintf( numBuf, sizeof(numBuf), "%d", prefsPrefs->gp.gameSeconds / 60 ); ceSetDlgItemNum( hDlg, TIMER_EDIT, prefsPrefs->gp.gameSeconds / 60 );
ceSetDlgItemText( hDlg, TIMER_EDIT, numBuf );
setTimerCtls( hDlg, prefsPrefs->gp.timerEnabled );
SendDlgItemMessage( hDlg, PHONIES_COMBO, CB_SETCURSEL, SendDlgItemMessage( hDlg, PHONIES_COMBO, CB_SETCURSEL,
prefsPrefs->gp.phoniesAction, 0L ); prefsPrefs->gp.phoniesAction, 0L );
@ -236,12 +234,9 @@ ceControlsToPrefs( HWND hDlg, CePrefsPrefs* prefsPrefs )
prefsPrefs->gp.timerEnabled = ceGetChecked( hDlg, TIMER_CHECK ); prefsPrefs->gp.timerEnabled = ceGetChecked( hDlg, TIMER_CHECK );
if ( prefsPrefs->gp.timerEnabled ) { if ( prefsPrefs->gp.timerEnabled ) {
XP_UCHAR buf[10];
XP_U16 minutes; XP_U16 minutes;
XP_U16 bLen = sizeof(buf) / sizeof(buf[0]);
ceGetDlgItemText( hDlg, TIMER_EDIT, buf, &bLen ); minutes = ceGetDlgItemNum( hDlg, TIMER_EDIT );
minutes = atoi( buf );
prefsPrefs->gp.gameSeconds = minutes * 60; prefsPrefs->gp.gameSeconds = minutes * 60;
} }