From 19d8f307b154a4a7565e410457178dcef9cb1447 Mon Sep 17 00:00:00 2001 From: ehouse Date: Sun, 7 Dec 2008 16:24:26 +0000 Subject: [PATCH] Add appropriate icon flags to all uses of MessageBox; remove a couple of unnecessary Cancel buttons. --- xwords4/wince/cemain.c | 39 ++++++++++++++++++++++----------------- xwords4/wince/ceprefs.c | 5 +++-- xwords4/wince/cestrbx.c | 3 ++- xwords4/wince/cesvdgms.c | 5 +++-- xwords4/wince/ceutil.c | 6 +++--- xwords4/wince/ceutil.h | 2 +- xwords4/wince/resource.h | 3 +-- xwords4/wince/xwords4.rc | 5 ++--- 8 files changed, 37 insertions(+), 31 deletions(-) diff --git a/xwords4/wince/cemain.c b/xwords4/wince/cemain.c index 8e1aeed66..406873404 100755 --- a/xwords4/wince/cemain.c +++ b/xwords4/wince/cemain.c @@ -1115,7 +1115,8 @@ ceLoadSavedGame( CEAppGlobals* globals ) snprintf( buf, VSIZE(buf), "Unable to open dictionary: %s", dictName ); buf[VSIZE(buf)-1] = '\0'; - ceMessageBoxChar( globals, NULL, buf, L"Oops!", MB_OK ); + ceMessageBoxChar( globals, NULL, buf, L"Oops!", + MB_OK | MB_ICONHAND ); } XP_FREE( globals->mpool, dictName ); #endif @@ -1355,7 +1356,8 @@ InitInstance(HINSTANCE hInstance, int nCmdShow wchar_t buf[512]; (void)LoadString( globals->hInst, (UINT)IDS_DICTLOC, buf, VSIZE(buf) ); assertOnTop( globals->hWnd ); - MessageBox( globals->hWnd, buf, L"Dictionary Not Found", MB_OK ); + MessageBox( globals->hWnd, buf, L"Dictionary Not Found", + MB_OK | MB_ICONHAND ); result = FALSE; goto exit; } @@ -1490,7 +1492,7 @@ ceCountsAndValues( CEAppGlobals* globals ) server_formatDictCounts( globals->game.server, stream, 3 ); (void)ceMsgFromStream( globals, stream, L"Tile Counts and Values", - MB_OK, XP_TRUE ); + MB_OK | MB_ICONINFORMATION, XP_TRUE ); } } /* ceCountsAndValues */ @@ -1502,7 +1504,7 @@ ceTilesLeft( CEAppGlobals* globals ) board_formatRemainingTiles( globals->game.board, stream ); (void)ceMsgFromStream( globals, stream, L"Remaining tiles", - MB_OK, XP_TRUE ); + MB_OK | MB_ICONINFORMATION, XP_TRUE ); } } /* ceTilesLeft */ @@ -1517,7 +1519,7 @@ ceDoHistory( CEAppGlobals* globals ) model_writeGameHistory( globals->game.model, stream, globals->game.server, gameOver ); (void)ceMsgFromStream( globals, stream, L"Game history", - MB_OK, XP_TRUE ); + MB_OK | MB_ICONINFORMATION, XP_TRUE ); } /* ceDoHistory */ static void @@ -1573,7 +1575,7 @@ ceDisplayFinalScores( CEAppGlobals* globals ) stream_putU8( stream, '\0' ); (void)ceMsgFromStream( globals, stream, L"Final scores", - MB_OK, XP_TRUE ); + MB_OK | MB_ICONINFORMATION, XP_TRUE ); } /* ceDisplayFinalScores */ static XP_Bool @@ -2203,7 +2205,8 @@ doAbout( CEAppGlobals* globals ) wchar_t buf[1024]; (void)LoadString( globals->hInst, (UINT)IDS_ABOUT, buf, VSIZE(buf) ); assertOnTop( globals->hWnd ); - MessageBox( globals->hWnd, buf, L"About", MB_OK ); + MessageBox( globals->hWnd, buf, L"About " LCROSSWORDS_DIR, + MB_OK | MB_ICONINFORMATION ); } LRESULT CALLBACK @@ -2633,7 +2636,7 @@ ceMsgFromStream( CEAppGlobals* globals, XWStreamCtxt* stream, state.title = title; state.stream = stream; - state.isQuery = buttons != MB_OK; + state.isQuery = (buttons & ~MB_ICONMASK) != MB_OK; state.dlgHdr.globals = globals; assertOnTop( globals->hWnd ); @@ -2684,15 +2687,16 @@ queryBoxChar( HWND hWnd, const XP_UCHAR* msg ) widebuf, VSIZE(widebuf) ); widebuf[len] = 0; - answer = MessageBox( hWnd, widebuf, L"Question", MB_YESNO ); + answer = MessageBox( hWnd, widebuf, L"Question", + MB_YESNO | MB_ICONQUESTION ); return answer == IDOK || answer == IDYES; } /* queryBoxChar */ static XP_Bool ceQueryFromStream( CEAppGlobals* globals, XWStreamCtxt* stream ) { - return ceMsgFromStream( globals, stream, L"Question", XP_TRUE, - XP_FALSE ); + return ceMsgFromStream( globals, stream, L"Question", + MB_OKCANCEL | MB_ICONQUESTION, XP_FALSE ); } /* ceQueryFromStream */ static void @@ -2743,7 +2747,7 @@ wince_warnf(const XP_UCHAR* format, ...) MultiByteToWideChar( CP_ACP, MB_PRECOMPOSED, buf, slen, widebuf, slen ); - MessageBox( NULL, widebuf, L"WARNF", MB_OK ); + MessageBox( NULL, widebuf, L"WARNF", MB_OK | MB_ICONHAND ); } /* wince_warnf */ void @@ -2968,7 +2972,7 @@ ce_util_userError( XW_UtilCtxt* uc, UtilErrID id ) break; } - ceMessageBoxChar( globals, NULL, message, L"Oops!", MB_OK ); + ceMessageBoxChar( globals, NULL, message, L"Oops!", MB_OK | MB_ICONHAND ); } /* ce_util_userError */ static XP_Bool @@ -2987,11 +2991,11 @@ ce_util_userQuery( XW_UtilCtxt* uc, UtilQueryID id, XWStreamCtxt* stream ) return queryBoxChar( globals->hWnd, query ); case QUERY_ROBOT_MOVE: - return ceMsgFromStream( globals, stream, L"FYI", XP_FALSE, - XP_FALSE ); + return ceMsgFromStream( globals, stream, L"FYI", + MB_OK | MB_ICONINFORMATION, XP_FALSE ); case QUERY_ROBOT_TRADE: - messageBoxStream( globals, stream, L"FYI", MB_OK ); + messageBoxStream( globals, stream, L"FYI", MB_OK | MB_ICONINFORMATION); break; default: @@ -3339,7 +3343,8 @@ ce_util_warnIllegalWord( XW_UtilCtxt* uc, BadWordInfo* bwi, sprintf( msgBuf, "Word[s] %s not found in dictionary.", wordsBuf ); if ( turnLost ) { - ceMessageBoxChar( globals, NULL, msgBuf, L"Illegal word", MB_OK ); + ceMessageBoxChar( globals, NULL, msgBuf, L"Illegal word", + MB_OK | MB_ICONHAND ); isOk = XP_TRUE; } else { strcat( msgBuf, " Use it anyway?" ); diff --git a/xwords4/wince/ceprefs.c b/xwords4/wince/ceprefs.c index 14a67570a..e6b2ac8d4 100755 --- a/xwords4/wince/ceprefs.c +++ b/xwords4/wince/ceprefs.c @@ -333,8 +333,9 @@ PrefsDlg(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) break; case IDC_CHECKHINTSLIMITS: if ( IS_SMARTPHONE(globals) ) { - ceMessageBoxChar( globals, hDlg, "This feature requires a " - "touch screen.", L"Sorry", MB_OK ); + ceMessageBoxChar( globals, hDlg, "This feature " + "requires a touch screen.", + L"Sorry", MB_OK | MB_ICONHAND ); ceSetChecked( hDlg, IDC_CHECKHINTSLIMITS, XP_FALSE ); } break; diff --git a/xwords4/wince/cestrbx.c b/xwords4/wince/cestrbx.c index 7aa860b3b..d53853a70 100755 --- a/xwords4/wince/cestrbx.c +++ b/xwords4/wince/cestrbx.c @@ -77,7 +77,8 @@ StrBox(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) /* } */ } - ceDlgSetup( &state->dlgHdr, hDlg, DLG_STATE_NONE ); + ceDlgSetup( &state->dlgHdr, hDlg, + state->isQuery? DLG_STATE_NONE : DLG_STATE_OKONLY ); handled = TRUE; } else { diff --git a/xwords4/wince/cesvdgms.c b/xwords4/wince/cesvdgms.c index 4d6c55cb5..c9f07da13 100644 --- a/xwords4/wince/cesvdgms.c +++ b/xwords4/wince/cesvdgms.c @@ -122,7 +122,8 @@ SaveNameDlg( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam ) wchar_t widebuf[128]; snwprintf( widebuf, VSIZE(widebuf), L"File \"%s\" already exists.", buf ); - result = MessageBox( hDlg, widebuf, L"Oops!", MB_OK ); + result = MessageBox( hDlg, widebuf, L"Oops!", + MB_OK | MB_ICONHAND ); (void)SetDlgItemText( hDlg, IDC_SVGN_EDIT, state->buf ); break; } @@ -401,7 +402,7 @@ SavedGamesDlg( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam ) state->inited = XP_FALSE; state->gameListId = LB_IF_PPC(state->dlgHdr.globals,IDC_SVGM_GAMELIST); - ceDlgSetup( &state->dlgHdr, hDlg, DLG_STATE_DONEONLY ); + ceDlgSetup( &state->dlgHdr, hDlg, DLG_STATE_OKONLY ); ceDlgComboShowHide( &state->dlgHdr, IDC_SVGM_GAMELIST ); result = TRUE; diff --git a/xwords4/wince/ceutil.c b/xwords4/wince/ceutil.c index 3d0363e43..de37d6a46 100755 --- a/xwords4/wince/ceutil.c +++ b/xwords4/wince/ceutil.c @@ -307,7 +307,7 @@ mkFullscreenWithSoftkeys( CEAppGlobals* globals, HWND hDlg, XP_U16 curHt, XP_MEMSET( &mbi, 0, sizeof(mbi) ); mbi.cbSize = sizeof(mbi); mbi.hwndParent = hDlg; - mbi.nToolBarId = doneOnly? IDM_DONE_MENUBAR:IDM_OKCANCEL_MENUBAR; + mbi.nToolBarId = doneOnly? IDM_OK_MENUBAR:IDM_OKCANCEL_MENUBAR; mbi.hInstRes = globals->hInst; success = SHCreateMenuBar( &mbi ); if ( !success ) { @@ -358,7 +358,7 @@ ceDlgSetup( CeDlgHdr* dlgHdr, HWND hDlg, DlgStateTask doWhat ) #ifdef _WIN32_WCE (void)mkFullscreenWithSoftkeys( globals, hDlg, fullHeight, - (doWhat & DLG_STATE_DONEONLY) != 0); + (doWhat & DLG_STATE_OKONLY) != 0); #elif defined DEBUG /* Force it to be small so we can test scrolling etc. */ if ( globals->dbWidth > 0 && globals->dbHeight > 0) { @@ -435,7 +435,7 @@ ceDoDlgHandle( CeDlgHdr* dlgHdr, UINT message, WPARAM wParam, LPARAM lParam ) if ( editHasFocus() ) { SHSendBackToFocusWindow( message, wParam, lParam ); } else if ( 0 != (BACK_KEY_UP_MAYBE & LOWORD(lParam) ) ) { - WPARAM cmd = (0 != (dlgHdr->doWhat & DLG_STATE_DONEONLY)) ? + WPARAM cmd = (0 != (dlgHdr->doWhat & DLG_STATE_OKONLY)) ? IDOK : IDCANCEL; SendMessage( dlgHdr->hDlg, WM_COMMAND, cmd, 0L ); } diff --git a/xwords4/wince/ceutil.h b/xwords4/wince/ceutil.h index c53855c4c..aea4ea6c1 100755 --- a/xwords4/wince/ceutil.h +++ b/xwords4/wince/ceutil.h @@ -62,7 +62,7 @@ XP_U16 ceGetPath( CEAppGlobals* globals, CePathType typ, /* set vHeight to 0 to turn off scrolling */ typedef enum { DLG_STATE_NONE = 0 , DLG_STATE_TRAPBACK = 1 - , DLG_STATE_DONEONLY = 2 + , DLG_STATE_OKONLY = 2 } DlgStateTask; typedef struct CeDlgHdr { CEAppGlobals* globals; diff --git a/xwords4/wince/resource.h b/xwords4/wince/resource.h index 945068d79..e8f0ff89b 100755 --- a/xwords4/wince/resource.h +++ b/xwords4/wince/resource.h @@ -19,7 +19,7 @@ #define IDD_COLOREDITDLG 119 #define IDM_MAIN_MENUBAR 120 #define IDM_OKCANCEL_MENUBAR 121 -#define IDM_DONE_MENUBAR 122 +#define IDM_OK_MENUBAR 122 #define IDB_ORIGIN 124 #ifdef XWFEATURE_SEARCHLIMIT # define IDD_ASKHINTLIMTS 125 @@ -233,7 +233,6 @@ #define IDS_CANCEL 40004 #define IDS_OK 40005 #define IDS_ABOUT 40006 -#define IDS_DONE 40007 #define IDS_DICTLOC 40029 #define IDS_SAVENAME 40030 #define IDS_DUPENAME 40031 diff --git a/xwords4/wince/xwords4.rc b/xwords4/wince/xwords4.rc index dba82ee27..79baf707a 100755 --- a/xwords4/wince/xwords4.rc +++ b/xwords4/wince/xwords4.rc @@ -152,11 +152,11 @@ BEGIN NOMENU END -IDM_DONE_MENUBAR RCDATA +IDM_OK_MENUBAR RCDATA BEGIN 0, 1, I_IMAGENONE, IDOK, TBSTATE_ENABLED, - TBSTYLE_BUTTON | TBSTYLE_AUTOSIZE, IDS_DONE, 0, + TBSTYLE_BUTTON | TBSTYLE_AUTOSIZE, IDS_OK, 0, NOMENU END #endif @@ -913,7 +913,6 @@ BEGIN IDS_DUMMY "--" IDS_CANCEL "Cancel" IDS_OK "Ok" - IDS_DONE "Done" IDS_ABOUT "Crosswords 4.2b7 (rev " SVN_REV ") "\ "for Windows Mobile. Copyright 1998-2008 by "\ "Eric House. This software is released under the GNU "\