Only set StrBox font on Win32. WinMo devices seem to have Unicode

font even if not localized.
This commit is contained in:
ehouse 2009-10-25 15:00:06 +00:00
parent 34032a9d0a
commit b957e9c195

View file

@ -1,6 +1,6 @@
/* -*- fill-column: 77; c-basic-offset: 4; compile-command: "make TARGET_OS=wince DEBUG=TRUE" -*- */ /* -*- fill-column: 77; c-basic-offset: 4; compile-command: "make TARGET_OS=wince DEBUG=TRUE" -*- */
/* /*
* Copyright 2002-2006 by Eric House (xwords@eehouse.org). All rights reserved. * Copyright 2002-2009 by Eric House (xwords@eehouse.org). All rights reserved.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -27,7 +27,9 @@
typedef struct StrBoxState { typedef struct StrBoxState {
CeDlgHdr dlgHdr; CeDlgHdr dlgHdr;
const wchar_t* title; const wchar_t* title;
#ifndef _WIN32_WCE
HFONT font; HFONT font;
#endif
XWStreamCtxt* stream; XWStreamCtxt* stream;
XP_U16 result; XP_U16 result;
XP_Bool isQuery; XP_Bool isQuery;
@ -76,10 +78,10 @@ StrBox(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
if ( !!state->title ) { if ( !!state->title ) {
SendMessage( hDlg, WM_SETTEXT, 0, (long)state->title ); SendMessage( hDlg, WM_SETTEXT, 0, (long)state->title );
} }
#ifndef _WIN32_WCE
SendDlgItemMessage( hDlg, ID_EDITTEXT, WM_SETFONT, SendDlgItemMessage( hDlg, ID_EDITTEXT, WM_SETFONT,
(WPARAM)state->font, 0L ); (WPARAM)state->font, 0L );
#endif
if ( !state->isQuery ) { if ( !state->isQuery ) {
ceShowOrHide( hDlg, IDCANCEL, XP_FALSE ); ceShowOrHide( hDlg, IDCANCEL, XP_FALSE );
} }
@ -136,20 +138,23 @@ WrapStrBox( CEAppGlobals* globals, const wchar_t* title,
state.isQuery = (buttons & ~MB_ICONMASK) != MB_OK; state.isQuery = (buttons & ~MB_ICONMASK) != MB_OK;
state.dlgHdr.globals = globals; state.dlgHdr.globals = globals;
#ifndef _WIN32_WCE
LOGFONT fontInfo; LOGFONT fontInfo;
XP_MEMSET( &fontInfo, 0, sizeof(fontInfo) ); XP_MEMSET( &fontInfo, 0, sizeof(fontInfo) );
fontInfo.lfHeight = 14; fontInfo.lfHeight = 14;
fontInfo.lfQuality = PROOF_QUALITY; fontInfo.lfQuality = PROOF_QUALITY;
wcscpy( fontInfo.lfFaceName, IS_SMARTPHONE(globals)? wcscpy( fontInfo.lfFaceName, IS_SMARTPHONE(globals)?
L"Segoe Condensed" : L"Tahoma" ); L"Segoe Condensed" : L"Tahoma" );
state.font = CreateFontIndirect( &fontInfo ); state.font = CreateFontIndirect( &fontInfo );
#endif
assertOnTop( globals->hWnd ); assertOnTop( globals->hWnd );
DialogBoxParam( globals->locInst, (LPCTSTR)IDD_STRBOX, globals->hWnd, DialogBoxParam( globals->locInst, (LPCTSTR)IDD_STRBOX, globals->hWnd,
(DLGPROC)StrBox, (long)&state ); (DLGPROC)StrBox, (long)&state );
#ifndef _WIN32_WCE
DeleteObject( state.font ); DeleteObject( state.font );
#endif
return state.result == IDOK; return state.result == IDOK;
} }