From 299beddc77762aac89125c8c6f56dd8c0174cd69 Mon Sep 17 00:00:00 2001 From: ehouse Date: Wed, 17 Sep 2008 04:19:20 +0000 Subject: [PATCH] cleanup; to get better idea of what fonts are available on smartphone add rough font chooser dialog. Is commented out and not meant to ship. --- wince/Makefile | 7 +++++-- wince/cedraw.c | 4 +--- wince/cemain.h | 3 ++- wince/ceprefs.c | 18 +++++++++++++++--- wince/resource.h | 15 +++++++++++++++ wince/xwords4.rc | 47 +++++++++++++++++++++++++++++++++++++++++++++-- 6 files changed, 83 insertions(+), 11 deletions(-) diff --git a/wince/Makefile b/wince/Makefile index 2c643a117..bcbfc8e3b 100644 --- a/wince/Makefile +++ b/wince/Makefile @@ -43,6 +43,8 @@ CEOPT_ROOT ?= /opt # This requires custom Debian pocketpc-sdk package at the moment HAVE_COMMCTRL = 1 +# Dialog to browse fonts on device. I doubt I want to ship with this. +# CHOOSE_FONTS = -DALLOW_CHOOSE_FONTS ifeq ($(TARGET_OS),wince) # BLUETOOTH = -DXWFEATURE_BLUETOOTH @@ -89,7 +91,7 @@ CFLAGS += -DARM -I./ -I../common -I../relay CFLAGS += -Wall -Wunused-parameter -CFLAGS += $(BLUETOOTH) $(RELAY) $(STANDALONE) $(COLOR_SEL) +CFLAGS += $(BLUETOOTH) $(RELAY) $(STANDALONE) $(COLOR_SEL) $(CHOOSE_FONTS) SVNDEF = -DSVN_REV='\"$(SVNREV)\"' CFLAGS += $(SVNDEF) @@ -138,6 +140,7 @@ WINCESRC = \ ceprefs.c \ cestrbx.c \ cedraw.c \ + cefonts.c \ debhacks.c \ cedebug.c \ @@ -165,7 +168,7 @@ XW_BOTH_DEFINES = \ CFLAGS += $(XW_BOTH_DEFINES) -DARM RESFLAGS += $(XW_BOTH_DEFINES) $(STANDALONE) $(BLUETOOTH) $(RELAY) \ - -D_WIN32 -D_WIN32_IE=0x0400 $(COLOR_SEL) + -D_WIN32 -D_WIN32_IE=0x0400 $(COLOR_SEL) $(CHOOSE_FONTS) #################################################################### # Rules start here diff --git a/wince/cedraw.c b/wince/cedraw.c index 76d761613..6fd585b68 100755 --- a/wince/cedraw.c +++ b/wince/cedraw.c @@ -32,6 +32,7 @@ #include "cemain.h" #include "cedict.h" #include "cedefines.h" +#include "cedebug.h" #include "debhacks.h" #ifndef DRAW_FUNC_NAME @@ -102,7 +103,6 @@ struct CEDrawCtx { XP_U16 miniLineHt; XP_Bool scoreIsVertical; XP_Bool topFocus; - XP_Bool beenCleared; MPSLOT }; @@ -1115,10 +1115,8 @@ DRAW_FUNC_NAME(measureRemText)( DrawCtx* p_dctx, const XP_Rect* xprect, fce = ceGetSizedFont( dctx, height, RFONTS_REM ); oldFont = SelectObject( hdc, fce->setFont ); ceMeasureText( dctx, fce, buf, 0/*CE_REM_PADDING*/, widthP, heightP ); - (void)SelectObject( hdc, oldFont ); (void)SelectObject( hdc, oldFont ); - } else { *widthP = *heightP = 0; } diff --git a/wince/cemain.h b/wince/cemain.h index 4dab185cf..1104a987d 100755 --- a/wince/cemain.h +++ b/wince/cemain.h @@ -178,7 +178,8 @@ XP_Bool queryBoxChar( CEAppGlobals* globals, const XP_UCHAR* msg ); #define ADDSTRING(g) (IS_SMARTPHONE(g)?LB_ADDSTRING:CB_ADDSTRING) #define GETLBTEXT(g) (IS_SMARTPHONE(g)?LB_GETTEXT:CB_GETLBTEXT) #define GETLBTEXTLEN(g) (IS_SMARTPHONE(g)?LB_GETTEXTLEN:CB_GETLBTEXTLEN) - +#define FINDSTRINGEXACT(g) \ + (IS_SMARTPHONE(g)?LB_FINDSTRINGEXACT:CB_FINDSTRINGEXACT) #define LB_IF_PPC(g,id) (IS_SMARTPHONE(g)?id:(id+2)) #endif /* _CEMAIN_H_ */ diff --git a/wince/ceprefs.c b/wince/ceprefs.c index 17a12be02..c4ce3fc9f 100755 --- a/wince/ceprefs.c +++ b/wince/ceprefs.c @@ -71,11 +71,17 @@ adjustForChoice( CePrefsDlgState* state ) HWND hDlg = state->dlgHdr.hDlg; XP_U16 goesWithGlobal[] = {IDC_CHECKCOLORPLAYED, IDC_LEFTYCHECK, IDC_CHECKSHOWCURSOR, IDC_CHECKROBOTSCORES, - IDC_PREFCOLORS }; + IDC_PREFCOLORS +#ifdef ALLOW_CHOOSE_FONTS + ,IDC_PREFFONTS +#endif + + }; XP_U16 goesWithLocal[] = {IDC_CHECKSMARTROBOT, IDC_CHECKNOHINTS, TIMER_CHECK, TIMER_EDIT, PHONIES_LABEL, - PHONIES_COMBO, IDC_PHONIESUPDOWN, PHONIES_COMBO_PPC, - IDC_PHONIESUPDOWN, IDC_PICKTILES + PHONIES_COMBO, IDC_PHONIESUPDOWN, + PHONIES_COMBO_PPC, + IDC_PICKTILES #ifdef XWFEATURE_SEARCHLIMIT ,IDC_CHECKHINTSLIMITS #endif @@ -305,6 +311,12 @@ PrefsDlg(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) ceDoColorsEdit( hDlg, globals, pState->prefsPrefs.colors ); break; +#ifdef ALLOW_CHOOSE_FONTS + case IDC_PREFFONTS: + ceShowFonts( hDlg, globals ); + break; +#endif + #ifdef XWFEATURE_SEARCHLIMIT case IDC_CHECKNOHINTS: timerOn = SendDlgItemMessage( hDlg, IDC_CHECKNOHINTS, diff --git a/wince/resource.h b/wince/resource.h index 198368e81..e1bd143b0 100755 --- a/wince/resource.h +++ b/wince/resource.h @@ -27,6 +27,9 @@ #ifndef XWFEATURE_STANDALONE_ONLY # define IDD_CONNSSDLG 126 #endif +#ifdef ALLOW_CHOOSE_FONTS +# define IDD_FONTSSDLG 127 +#endif #define REMOTE_CHECK1 1005 #define NAME_EDIT1 1006 @@ -67,6 +70,7 @@ #define IDC_CHECKSHOWCURSOR 1042 #define IDC_CHECKROBOTSCORES 1043 #define IDC_PREFCOLORS 1044 +#define IDC_PREFFONTS 1100 #define PHONIES_LABEL 1045 #define IDC_ROLECOMBO 1046 #define GIJUGGLE_BUTTON 1048 @@ -139,6 +143,17 @@ # define CLSAMPLE_BUTTON_ID 1123 #endif // MY_COLOR_SEL +#ifdef ALLOW_CHOOSE_FONTS +# define FONTS_LABEL 1123 +# define FONTS_COMBO 1124 +# define IDC_FONTSUPDOWN 1125 +# define FONTS_COMBO_PPC 1126 +# define FONTSIZE_LABEL 1127 +# define FONTSIZE_COMBO 1128 +# define IDC_FONTSIZEUPDOWN 1129 +# define FONTSIZE_COMBO_PPC 1130 +#endif + #define IDC_CCONVIA_LAB 1106 #define IDC_COOKIE_LAB 1107 diff --git a/wince/xwords4.rc b/wince/xwords4.rc index b1bbf8681..7432a51fc 100755 --- a/wince/xwords4.rc +++ b/wince/xwords4.rc @@ -549,15 +549,24 @@ BEGIN BS_AUTORADIOBUTTON | WS_GROUP,4,PR_ROW1,47,10 CONTROL "All games",IDC_RADIOGLOBAL,"Button", BS_AUTORADIOBUTTON,52,PR_ROW1,53,10 + + /* Global */ CONTROL "Color played tiles",IDC_CHECKCOLORPLAYED,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP | WS_GROUP,8,PR_ROW2,90,PREFS_ROW_HT + BS_AUTOCHECKBOX | WS_TABSTOP | WS_GROUP,8,PR_ROW2,90, + PREFS_ROW_HT CONTROL "Enable cursor",IDC_CHECKSHOWCURSOR,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,8,PR_ROW3,90,PREFS_ROW_HT CONTROL "Explain robot scores",IDC_CHECKROBOTSCORES,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,8,PR_ROW4,90,PREFS_ROW_HT PUSHBUTTON "Edit colors...",IDC_PREFCOLORS,8,PR_ROW5,60,12 +#ifdef ALLOW_CHOOSE_FONTS + PUSHBUTTON "Choose font...",IDC_PREFFONTS,8,PR_ROW6,60,12 +#endif + + /* Per game */ CONTROL "Smart robot",IDC_CHECKSMARTROBOT,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP | WS_GROUP,8,PR_ROW2,90,PREFS_ROW_HT + BS_AUTOCHECKBOX | WS_TABSTOP | WS_GROUP,8,PR_ROW2,90, + PREFS_ROW_HT CONTROL "Disallow hints",IDC_CHECKNOHINTS,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,8,PR_ROW3,60,PREFS_ROW_HT #ifdef XWFEATURE_SEARCHLIMIT @@ -795,6 +804,40 @@ END #endif +#ifdef ALLOW_CHOOSE_FONTS +IDD_FONTSSDLG DIALOG DISCARDABLE 0, 0, 120, 115 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | DS_CENTER +CAPTION "" /* set by code */ +FONT 8, "System" +BEGIN + + LTEXT "Fonts:",FONTS_LABEL,5,2,25,12 +#ifdef _WIN32_WCE + LISTBOX FONTS_COMBO, 30,2,70,12, LISTBOX_CONTROL_FLAGS + CONTROL "", IDC_FONTSUPDOWN, UPDOWN_CLASS, SPINNER_CONTROL_FLAGS, + 0, 0, 0, 0 +#endif + COMBOBOX FONTS_COMBO_PPC,30,2,70,58, + CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + + LTEXT "Size:",FONTSIZE_LABEL,5,16,25,12 +#ifdef _WIN32_WCE + LISTBOX FONTSIZE_COMBO, 30,16,25,12, LISTBOX_CONTROL_FLAGS + CONTROL "", IDC_FONTSIZEUPDOWN, UPDOWN_CLASS, SPINNER_CONTROL_FLAGS, + 0, 0, 0, 0 +#endif + COMBOBOX FONTSIZE_COMBO_PPC,30,16,25,58, + CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + +# ifndef _WIN32_WCE + DEFPUSHBUTTON "OK",IDOK,20,100,REPOS_BUTTON_WIDTH, + REPOS_BUTTON_HT + PUSHBUTTON "Cancel",IDCANCEL,100,100,REPOS_BUTTON_WIDTH, + REPOS_BUTTON_HT +# endif +END +#endif + ///////////////////////////////////////////////////////////////////////////// // // Bitmap