When creating dicts dropdown, set 0th as default if there's been no match.

This commit is contained in:
ehouse 2006-04-20 03:56:38 +00:00
parent b5843a5486
commit fc0c7c3f80

View file

@ -56,9 +56,11 @@ addDictToMenu( const wchar_t* wPath, XP_U16 index, void* ctxt )
XP_UCHAR buf[CE_MAX_PATH_LEN+1]; XP_UCHAR buf[CE_MAX_PATH_LEN+1];
WideCharToMultiByte( CP_ACP, 0, wPath, -1, buf, sizeof(buf), WideCharToMultiByte( CP_ACP, 0, wPath, -1, buf, sizeof(buf),
NULL, NULL ); NULL, NULL );
XP_LOGF( "%s: comparing %s, %s", __FUNCTION__, buf, giState->newDictName ); XP_LOGF( "%s: comparing %s, %s", __FUNCTION__, buf,
giState->newDictName );
if ( 0 == XP_STRCMP( buf, giState->newDictName ) ) { if ( 0 == XP_STRCMP( buf, giState->newDictName ) ) {
XP_LOGF( "%s: they're the same; setting to %d", __FUNCTION__, index ); XP_LOGF( "%s: they're the same; setting to %d", __FUNCTION__,
index );
giState->curSelSet = XP_TRUE; giState->curSelSet = XP_TRUE;
SendDlgItemMessage( giState->hDlg, IDC_DICTCOMBO, CB_SETCURSEL, SendDlgItemMessage( giState->hDlg, IDC_DICTCOMBO, CB_SETCURSEL,
index, 0L ); index, 0L );
@ -66,7 +68,7 @@ addDictToMenu( const wchar_t* wPath, XP_U16 index, void* ctxt )
} }
return XP_TRUE; return XP_TRUE;
} } /* addDictToMenu */
static void static void
loadFromGameInfo( HWND hDlg, CEAppGlobals* globals, GameInfoState* giState ) loadFromGameInfo( HWND hDlg, CEAppGlobals* globals, GameInfoState* giState )
@ -136,6 +138,10 @@ loadFromGameInfo( HWND hDlg, CEAppGlobals* globals, GameInfoState* giState )
if ( giState->isNewGame ) { if ( giState->isNewGame ) {
(void)ceLocateNDicts( MPPARM(globals->mpool) 32, addDictToMenu, (void)ceLocateNDicts( MPPARM(globals->mpool) 32, addDictToMenu,
giState ); giState );
if ( !giState->curSelSet ) {
SendDlgItemMessage( giState->hDlg, IDC_DICTCOMBO, CB_SETCURSEL,
0, 0L );
}
} }
#endif #endif