diff --git a/wince/cedebug.c b/wince/cedebug.c index a512163e8..b62211f4c 100644 --- a/wince/cedebug.c +++ b/wince/cedebug.c @@ -19,6 +19,8 @@ #include "cedebug.h" +#ifdef DEBUG + #define CASE_STR(c) case c: str = #c; break const char* @@ -56,4 +58,15 @@ messageToStr( UINT message ) return str; } /* messageToStr */ +void +XP_LOGW( const XP_UCHAR* prefix, const wchar_t* arg ) +{ + XP_UCHAR buf[512]; + (void)WideCharToMultiByte( CP_ACP, 0, arg, -1, + buf, sizeof(buf), NULL, NULL ); + XP_LOGF( "%s: %s", prefix, buf ); +} + #undef CASE_STR + +#endif /* DEBUG */ diff --git a/wince/cedebug.h b/wince/cedebug.h index adf0057e4..d7dfabe75 100644 --- a/wince/cedebug.h +++ b/wince/cedebug.h @@ -24,4 +24,10 @@ const char* messageToStr( UINT message ); +#ifdef DEBUG +void XP_LOGW( const XP_UCHAR* prefix, const wchar_t* arg ); +#else +# define XP_LOGW( prefix, arg ) +#endif + #endif /* _CEDEBUG_H_ */ diff --git a/wince/ceutil.c b/wince/ceutil.c index 67cb59ef6..834ee44af 100755 --- a/wince/ceutil.c +++ b/wince/ceutil.c @@ -226,7 +226,7 @@ ceIsLandscape( CEAppGlobals* globals ) /* Can't figure out how to do this on CE. IsWindowVisible doesn't work, and GetWindowInfo isn't even there. */ static XP_Bool -ceIsVisible( HWND hwnd ) +ceIsVisible( HWND XP_UNUSED_CE(hwnd) ) { #ifdef _WIN32_WCE /* GetWindowInfo isn't on CE */ return XP_TRUE; @@ -243,12 +243,54 @@ ceIsVisible( HWND hwnd ) #endif } /* ceIsVisible */ +#ifdef _WIN32_WCE +static XP_Bool +mkFullscreenWithSoftkeys( CEAppGlobals* globals, HWND hDlg ) +{ +/* XP_Bool fullScreen = XP_FALSE; /\* probably want this TRUE for */ +/* small-screened smartphones only. *\/ */ +/* if ( fullScreen ) { */ +/* SHINITDLGINFO info; */ + +/* info.dwMask = SHIDIM_FLAGS; */ +/* info.dwFlags = SHIDIF_SIZEDLG */ +/* /\* | SHIDIF_DONEBUTTON *\/ */ +/* | SHIDIF_WANTSCROLLBAR; */ +/* info.hDlg = hDlg; */ + +/* BOOL b = SHInitDialog( &info ); */ +/* XP_LOGF( "SHInitDialog=>%d", (int)b ); */ +/* } */ + + XP_Bool success = XP_FALSE; + SHMENUBARINFO mbi; + + XP_MEMSET( &mbi, 0, sizeof(mbi) ); + mbi.cbSize = sizeof(mbi); + mbi.hwndParent = hDlg; + mbi.nToolBarId = IDM_OKCANCEL_MENUBAR; + mbi.hInstRes = globals->hInst; + success = SHCreateMenuBar( &mbi ); + if ( !success ) { + XP_LOGF( "SHCreateMenuBar failed" ); + } + return success; +} /* mkFullscreenWithSoftkeys */ +#endif + void ceStackButtonsRight( CEAppGlobals* globals, HWND hDlg ) { + XP_Bool justRemove = XP_FALSE; XP_ASSERT( !!globals ); - if ( ceIsLandscape( globals ) ) { +#ifdef _WIN32_WCE + if ( mkFullscreenWithSoftkeys( globals, hDlg ) ) { + justRemove = XP_TRUE; + } +#endif + + if ( justRemove || ceIsLandscape( globals ) ) { XP_U16 resIDs[] = { IDOK, IDCANCEL }; RECT wrect, crect; XP_U16 left, top; @@ -282,10 +324,10 @@ ceStackButtonsRight( CEAppGlobals* globals, HWND hDlg ) /* Make sure we're not proposing to make the dialog wider than the screen */ GetWindowRect( hDlg, &wrect ); - newWidth = wrect.right - wrect.left + butWidth - + HPADDING_L + HPADDING_R; + newWidth = wrect.right - wrect.left + + butWidth + HPADDING_L + HPADDING_R; - if ( newWidth <= mainWidth ) { + if ( justRemove || (newWidth <= mainWidth) ) { GetClientRect( hDlg, &crect ); barHt = wrect.bottom - wrect.top - crect.bottom; @@ -305,21 +347,16 @@ ceStackButtonsRight( CEAppGlobals* globals, HWND hDlg ) } } - butWidth += HPADDING_L + HPADDING_R; - MoveWindow( hDlg, wrect.left - (butWidth/2), wrect.top, - newWidth, wrect.bottom - wrect.top - butHeight - 2, - FALSE ); + if ( justRemove ) { + MoveWindow( hDlg, wrect.left, wrect.top, + wrect.right - wrect.left, wrect.bottom - wrect.top - butHeight - 2, + FALSE ); + } else { + butWidth += HPADDING_L + HPADDING_R; + MoveWindow( hDlg, wrect.left - (butWidth/2), wrect.top, + newWidth, wrect.bottom - wrect.top - butHeight - 2, + FALSE ); + } } } } /* ceStackButtonsRight */ - -#ifdef DEBUG -void -XP_LOGW( const XP_UCHAR* prefix, const wchar_t* arg ) -{ - XP_UCHAR buf[512]; - (void)WideCharToMultiByte( CP_ACP, 0, arg, -1, - buf, sizeof(buf), NULL, NULL ); - XP_LOGF( "%s: %s", prefix, buf ); -} -#endif diff --git a/wince/ceutil.h b/wince/ceutil.h index 152357d7f..b059b45c3 100755 --- a/wince/ceutil.h +++ b/wince/ceutil.h @@ -50,10 +50,4 @@ void ceStackButtonsRight( CEAppGlobals* globals, HWND hDlg ); /* Are we drawing things in landscape mode? */ XP_Bool ceIsLandscape( CEAppGlobals* globals ); -#ifdef DEBUG -void XP_LOGW( const XP_UCHAR* prefix, const wchar_t* arg ); -#else -# define XP_LOGW( prefix, arg ) -#endif - #endif diff --git a/wince/resource.h b/wince/resource.h index 328ce6db7..f1e3e98e9 100755 --- a/wince/resource.h +++ b/wince/resource.h @@ -18,6 +18,7 @@ #define IDD_COLORSDLG 118 #define IDD_COLOREDITDLG 119 #define IDM_MAIN_MENUBAR 120 +#define IDM_OKCANCEL_MENUBAR 121 #define IDB_ORIGIN 124 #ifdef XWFEATURE_SEARCHLIMIT # define IDD_ASKHINTLIMTS 125 @@ -183,14 +184,14 @@ #define ID_BONUS_RES 9998 #define IDM_MAIN_COMMAND1 40001 -#define IDS_FILE 40002 -#define IDS_GAME 40003 -#define IDS_MOVE 40004 -#define IDS_MENU 40005 -#define IDS_DONE 40006 -// Don't use the numbers after 4005: one string needs not to be there +#define IDS_MENU 40002 +#define IDS_DONE 40003 +#define IDS_CANCEL 40004 +#define IDS_OK 40005 + +// Don't use the numbers after 4009: one string needs not to be there // to stop the progression in cedict.c -#define IDS_DICTDIRS 40007 +#define IDS_DICTDIRS 40009 // Next default values for new objects // diff --git a/wince/xwords4.rc b/wince/xwords4.rc index 47c693f8e..026c8d0e9 100755 --- a/wince/xwords4.rc +++ b/wince/xwords4.rc @@ -122,6 +122,7 @@ BEGIN END END +#ifdef _WIN32_WCE // soft key bar described at // http://msdn2.microsoft.com/en-us/library/aa457781.aspx IDM_MAIN_MENUBAR RCDATA @@ -135,6 +136,18 @@ BEGIN 0 // Use the 0th popup above -- the only one END +IDM_OKCANCEL_MENUBAR RCDATA +BEGIN + 0, 2, + I_IMAGENONE, IDCANCEL, TBSTATE_ENABLED, + TBSTYLE_BUTTON | TBSTYLE_AUTOSIZE, IDS_CANCEL, 0, + NOMENU, + I_IMAGENONE, IDOK, TBSTATE_ENABLED, + TBSTYLE_BUTTON | TBSTYLE_AUTOSIZE, IDS_OK, 0, + NOMENU +END +#endif + ///////////////////////////////////////////////////////////////////////////// // // Dialog @@ -735,9 +748,6 @@ BEGIN IDS_APP_TITLE "Crosswords" IDC_XWORDS4 "XWORDS4" #endif - IDS_FILE "File" - IDS_GAME "Game" - IDS_MOVE "Move" IDS_MENU "Menu" IDS_DONE "Done" #ifdef _WIN32_WCE