mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2024-12-27 09:58:45 +01:00
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.
This commit is contained in:
parent
0d326c0252
commit
ad2ba1c249
4 changed files with 7 additions and 12 deletions
|
@ -2835,8 +2835,7 @@ ceStreamToStrBuf( MPFORMAL XWStreamCtxt* stream )
|
||||||
static int
|
static int
|
||||||
ceOops( CEAppGlobals* globals, const XP_UCHAR* str )
|
ceOops( CEAppGlobals* globals, const XP_UCHAR* str )
|
||||||
{
|
{
|
||||||
XP_Bool isUTF8 = ceCurDictIsUTF8( globals );
|
return ceMessageBoxChar( globals, str,
|
||||||
return ceMessageBoxChar( globals, str, isUTF8,
|
|
||||||
ceGetResStringL( globals, IDS_FYI_L ),
|
ceGetResStringL( globals, IDS_FYI_L ),
|
||||||
MB_OK | MB_ICONHAND );
|
MB_OK | MB_ICONHAND );
|
||||||
}
|
}
|
||||||
|
@ -2854,8 +2853,7 @@ messageBoxStream( CEAppGlobals* globals, XWStreamCtxt* stream,
|
||||||
XP_UCHAR* buf = ceStreamToStrBuf( MPPARM(globals->mpool) stream );
|
XP_UCHAR* buf = ceStreamToStrBuf( MPPARM(globals->mpool) stream );
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
result = ceMessageBoxChar( globals, buf, ceCurDictIsUTF8(globals),
|
result = ceMessageBoxChar( globals, buf, title, buttons );
|
||||||
title, buttons );
|
|
||||||
|
|
||||||
XP_FREE( globals->mpool, buf );
|
XP_FREE( globals->mpool, buf );
|
||||||
return result;
|
return result;
|
||||||
|
@ -3636,8 +3634,7 @@ ce_util_warnIllegalWord( XW_UtilCtxt* uc, BadWordInfo* bwi,
|
||||||
snprintf( msgBuf, VSIZE(msgBuf), fmt, wordsBuf );
|
snprintf( msgBuf, VSIZE(msgBuf), fmt, wordsBuf );
|
||||||
|
|
||||||
if ( turnLost ) {
|
if ( turnLost ) {
|
||||||
XP_Bool isUTF8 = ceCurDictIsUTF8( globals );
|
ceMessageBoxChar( globals, msgBuf,
|
||||||
ceMessageBoxChar( globals, msgBuf, isUTF8,
|
|
||||||
ceGetResStringL( globals, IDS_ILLEGALWRD_L ),
|
ceGetResStringL( globals, IDS_ILLEGALWRD_L ),
|
||||||
MB_OK | MB_ICONHAND );
|
MB_OK | MB_ICONHAND );
|
||||||
isOk = XP_TRUE;
|
isOk = XP_TRUE;
|
||||||
|
|
|
@ -362,7 +362,6 @@ PrefsDlg(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
ceMessageBoxChar( globals,
|
ceMessageBoxChar( globals,
|
||||||
ceGetResString( globals,
|
ceGetResString( globals,
|
||||||
IDS_NEED_TOUCH ),
|
IDS_NEED_TOUCH ),
|
||||||
XP_FALSE,
|
|
||||||
ceGetResStringL( globals,
|
ceGetResStringL( globals,
|
||||||
IDS_FYI_L ),
|
IDS_FYI_L ),
|
||||||
MB_OK | MB_ICONHAND );
|
MB_OK | MB_ICONHAND );
|
||||||
|
|
|
@ -1063,17 +1063,16 @@ ceGetPath( CEAppGlobals* globals, CePathType typ,
|
||||||
|
|
||||||
int
|
int
|
||||||
ceMessageBoxChar( CEAppGlobals* XP_UNUSED(globals), const XP_UCHAR* str,
|
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;
|
HWND parent;
|
||||||
/* Get the length required, then alloc and go. This is technically
|
/* 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. */
|
correct, but everywhere else I assume a 2:1 ratio for wchar_t:char. */
|
||||||
XP_U16 clen = 1 + strlen(str);
|
XP_U16 clen = 1 + strlen(str);
|
||||||
UINT codePage = isUTF8? CP_UTF8:CP_ACP;
|
XP_U32 wlen = 1 + MultiByteToWideChar( CP_UTF8, 0, str, clen, NULL, 0 );
|
||||||
XP_U32 wlen = 1 + MultiByteToWideChar( codePage, 0, str, clen, NULL, 0 );
|
|
||||||
wchar_t widebuf[wlen];
|
wchar_t widebuf[wlen];
|
||||||
|
|
||||||
MultiByteToWideChar( codePage, 0, str, clen, widebuf, wlen );
|
MultiByteToWideChar( CP_UTF8, 0, str, clen, widebuf, wlen );
|
||||||
|
|
||||||
parent = GetForegroundWindow();
|
parent = GetForegroundWindow();
|
||||||
return MessageBox( parent, widebuf, title, buttons );
|
return MessageBox( parent, widebuf, title, buttons );
|
||||||
|
|
|
@ -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 );
|
void ceMoveItem( HWND hDlg, XP_U16 resID, XP_S16 byX, XP_S16 byY );
|
||||||
|
|
||||||
int ceMessageBoxChar( CEAppGlobals* globals, const XP_UCHAR* str,
|
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_Bool ceCurDictIsUTF8( CEAppGlobals* globals );
|
||||||
|
|
||||||
XP_U16 ceDistanceBetween( HWND hDlg, XP_U16 resID1, XP_U16 resID2 );
|
XP_U16 ceDistanceBetween( HWND hDlg, XP_U16 resID1, XP_U16 resID2 );
|
||||||
|
|
Loading…
Reference in a new issue