From ad2ba1c249e91a168c51aa4dc8f71e7bc63ff423 Mon Sep 17 00:00:00 2001 From: ehouse Date: Sat, 17 Oct 2009 04:10:28 +0000 Subject: [PATCH] Don't assume resources aren't utf-8 because current dict isn't. Always assuming they're utf-8 seems to work, so do that for now. Fixes problems with Catalan messages when using English dict. --- xwords4/wince/cemain.c | 9 +++------ xwords4/wince/ceprefs.c | 1 - xwords4/wince/ceutil.c | 7 +++---- xwords4/wince/ceutil.h | 2 +- 4 files changed, 7 insertions(+), 12 deletions(-) diff --git a/xwords4/wince/cemain.c b/xwords4/wince/cemain.c index 361be272c..19083381f 100755 --- a/xwords4/wince/cemain.c +++ b/xwords4/wince/cemain.c @@ -2835,8 +2835,7 @@ ceStreamToStrBuf( MPFORMAL XWStreamCtxt* stream ) static int ceOops( CEAppGlobals* globals, const XP_UCHAR* str ) { - XP_Bool isUTF8 = ceCurDictIsUTF8( globals ); - return ceMessageBoxChar( globals, str, isUTF8, + return ceMessageBoxChar( globals, str, ceGetResStringL( globals, IDS_FYI_L ), MB_OK | MB_ICONHAND ); } @@ -2854,8 +2853,7 @@ messageBoxStream( CEAppGlobals* globals, XWStreamCtxt* stream, XP_UCHAR* buf = ceStreamToStrBuf( MPPARM(globals->mpool) stream ); int result; - result = ceMessageBoxChar( globals, buf, ceCurDictIsUTF8(globals), - title, buttons ); + result = ceMessageBoxChar( globals, buf, title, buttons ); XP_FREE( globals->mpool, buf ); return result; @@ -3636,8 +3634,7 @@ ce_util_warnIllegalWord( XW_UtilCtxt* uc, BadWordInfo* bwi, snprintf( msgBuf, VSIZE(msgBuf), fmt, wordsBuf ); if ( turnLost ) { - XP_Bool isUTF8 = ceCurDictIsUTF8( globals ); - ceMessageBoxChar( globals, msgBuf, isUTF8, + ceMessageBoxChar( globals, msgBuf, ceGetResStringL( globals, IDS_ILLEGALWRD_L ), MB_OK | MB_ICONHAND ); isOk = XP_TRUE; diff --git a/xwords4/wince/ceprefs.c b/xwords4/wince/ceprefs.c index 6c9a7b3eb..e95716f38 100755 --- a/xwords4/wince/ceprefs.c +++ b/xwords4/wince/ceprefs.c @@ -362,7 +362,6 @@ PrefsDlg(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) ceMessageBoxChar( globals, ceGetResString( globals, IDS_NEED_TOUCH ), - XP_FALSE, ceGetResStringL( globals, IDS_FYI_L ), MB_OK | MB_ICONHAND ); diff --git a/xwords4/wince/ceutil.c b/xwords4/wince/ceutil.c index c06ea48f7..1a931c6b1 100755 --- a/xwords4/wince/ceutil.c +++ b/xwords4/wince/ceutil.c @@ -1063,17 +1063,16 @@ ceGetPath( CEAppGlobals* globals, CePathType typ, int ceMessageBoxChar( CEAppGlobals* XP_UNUSED(globals), const XP_UCHAR* str, - XP_Bool isUTF8, const wchar_t* title, XP_U16 buttons ) + const wchar_t* title, XP_U16 buttons ) { HWND parent; /* Get the length required, then alloc and go. This is technically correct, but everywhere else I assume a 2:1 ratio for wchar_t:char. */ XP_U16 clen = 1 + strlen(str); - UINT codePage = isUTF8? CP_UTF8:CP_ACP; - XP_U32 wlen = 1 + MultiByteToWideChar( codePage, 0, str, clen, NULL, 0 ); + XP_U32 wlen = 1 + MultiByteToWideChar( CP_UTF8, 0, str, clen, NULL, 0 ); wchar_t widebuf[wlen]; - MultiByteToWideChar( codePage, 0, str, clen, widebuf, wlen ); + MultiByteToWideChar( CP_UTF8, 0, str, clen, widebuf, wlen ); parent = GetForegroundWindow(); return MessageBox( parent, widebuf, title, buttons ); diff --git a/xwords4/wince/ceutil.h b/xwords4/wince/ceutil.h index cf5409b1b..5113a4bf1 100755 --- a/xwords4/wince/ceutil.h +++ b/xwords4/wince/ceutil.h @@ -48,7 +48,7 @@ void ceGetItemRect( HWND hDlg, XP_U16 resID, RECT* rect ); void ceMoveItem( HWND hDlg, XP_U16 resID, XP_S16 byX, XP_S16 byY ); int ceMessageBoxChar( CEAppGlobals* globals, const XP_UCHAR* str, - XP_Bool isUTF8, const wchar_t* title, XP_U16 buttons ); + const wchar_t* title, XP_U16 buttons ); XP_Bool ceCurDictIsUTF8( CEAppGlobals* globals ); XP_U16 ceDistanceBetween( HWND hDlg, XP_U16 resID1, XP_U16 resID2 );