cleanup: remove dead function; move variables closer to where used

This commit is contained in:
ehouse 2008-05-25 15:08:03 +00:00
parent 8fa530303a
commit ec8786b2a7
2 changed files with 18 additions and 64 deletions

View file

@ -62,6 +62,7 @@ messageToStr( UINT message )
CASE_STR( WM_WINDOWPOSCHANGING ); CASE_STR( WM_WINDOWPOSCHANGING );
CASE_STR( WM_SETFOCUS ); CASE_STR( WM_SETFOCUS );
CASE_STR( WM_NCPAINT ); CASE_STR( WM_NCPAINT );
CASE_STR( WM_ERASEBKGND );
CASE_STR( WM_NCCALCSIZE ); CASE_STR( WM_NCCALCSIZE );
CASE_STR( WM_SETTEXT ); CASE_STR( WM_SETTEXT );
CASE_STR( WM_CTLCOLORDLG ); CASE_STR( WM_CTLCOLORDLG );

View file

@ -143,7 +143,7 @@ static XP_Bool queryBoxChar( CEAppGlobals* globals, XP_UCHAR* msg );
static XP_Bool ceMsgFromStream( CEAppGlobals* globals, XWStreamCtxt* stream, static XP_Bool ceMsgFromStream( CEAppGlobals* globals, XWStreamCtxt* stream,
wchar_t* title, XP_U16 buttons, wchar_t* title, XP_U16 buttons,
XP_Bool destroy ); XP_Bool destroy );
static void RECTtoXPR( XP_Rect* dest, RECT* src ); static void RECTtoXPR( XP_Rect* dest, const RECT* src );
static XP_Bool ceDoNewGame( CEAppGlobals* globals ); static XP_Bool ceDoNewGame( CEAppGlobals* globals );
static XP_Bool ceSaveCurGame( CEAppGlobals* globals, XP_Bool autoSave ); static XP_Bool ceSaveCurGame( CEAppGlobals* globals, XP_Bool autoSave );
static void ceInitPrefs( CEAppGlobals* globals, CEAppPrefs* prefs ); static void ceInitPrefs( CEAppGlobals* globals, CEAppPrefs* prefs );
@ -1992,7 +1992,6 @@ WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{ {
LRESULT result = 0; LRESULT result = 0;
int wmId; int wmId;
RECT rt;
XP_Bool draw = XP_FALSE; XP_Bool draw = XP_FALSE;
XWTimerReason why; XWTimerReason why;
CEAppGlobals* globals; CEAppGlobals* globals;
@ -2162,20 +2161,23 @@ WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
} }
break; break;
case WM_PAINT: case WM_PAINT:
if ( !!globals && GetUpdateRect( hWnd, &rt, FALSE ) ) { if ( !!globals ) {
XP_Rect rect; RECT winrect;
if ( GetUpdateRect( hWnd, &winrect, FALSE ) ) {
if ( !!globals->game.board ) {
XP_Rect rect;
/* When an obscuring window goes away, the update region
needs to be redrawn. This allows invalidating it. */
if ( !!globals->game.board ) { RECTtoXPR( &rect, &winrect );
/* When an obscuring window goes away, the update region board_invalRect( globals->game.board, &rect );
needs to be redrawn. This allows invalidating it. */
RECTtoXPR( &rect, &rt );
board_invalRect( globals->game.board, &rect );
XP_ASSERT( globals->hWnd == hWnd ); XP_ASSERT( globals->hWnd == hWnd );
drawInsidePaint( globals ); drawInsidePaint( globals );
} }
if ( !ValidateRect( hWnd, &rt ) ) { if ( !ValidateRect( hWnd, &winrect ) ) {
logLastError( "WM_PAINT:ValidateRect" ); logLastError( "WM_PAINT:ValidateRect" );
}
} }
} }
break; break;
@ -2447,7 +2449,7 @@ ceQueryFromStream( CEAppGlobals* globals, XWStreamCtxt* stream )
} /* ceQueryFromStream */ } /* ceQueryFromStream */
static void static void
RECTtoXPR( XP_Rect* dest, RECT* src ) RECTtoXPR( XP_Rect* dest, const RECT* src )
{ {
dest->top = (short)src->top; dest->top = (short)src->top;
dest->left = (short)src->left; dest->left = (short)src->left;
@ -2533,55 +2535,6 @@ wince_debugf(const XP_UCHAR* format, ...)
} }
#endif #endif
} /* wince_debugf */ } /* wince_debugf */
void
messageToBuf( UINT message, char* buf, int bufSize )
{
char* str = NULL;
#define STRCASE(s) case s : str = #s; break
switch( message ) {
STRCASE(WM_TIMER);
STRCASE(WM_SETCURSOR);
STRCASE(WM_NCHITTEST);
STRCASE(WM_MOUSEMOVE);
STRCASE(WM_SYSKEYDOWN);
STRCASE(WM_SYSKEYUP);
STRCASE(WM_SYSCHAR);
STRCASE(WM_SYSCOMMAND);
STRCASE(WM_ENTERMENULOOP);
STRCASE(WM_INITMENU);
STRCASE(WM_MENUSELECT);
STRCASE(WM_COMMAND);
STRCASE(WM_SETTEXT);
STRCASE(WM_QUERYNEWPALETTE);
STRCASE(WM_NCACTIVATE);
STRCASE(WM_ACTIVATE);
STRCASE(WM_SHOWWINDOW);
STRCASE(WM_CTLCOLOREDIT);
STRCASE(WM_MOUSEACTIVATE);
STRCASE(WM_CTLCOLORBTN);
STRCASE(WM_PASTE);
STRCASE(WM_WINDOWPOSCHANGING);
STRCASE(WM_SETFOCUS);
STRCASE(WM_WINDOWPOSCHANGED);
STRCASE(WM_PAINT);
STRCASE(WM_VSCROLL);
STRCASE(WM_LBUTTONDOWN);
STRCASE(WM_LBUTTONUP);
STRCASE(WM_INITMENUPOPUP);
STRCASE(WM_CANCELMODE);
STRCASE(WM_EXITMENULOOP);
STRCASE(WM_KILLFOCUS);
STRCASE(WM_ERASEBKGND);
default:
snprintf( buf, bufSize, "%d", message );
return;
}
#undef STRCASE
if ( !!str ) {
snprintf( buf, bufSize, "%s", str );
}
} /* messageToBuf */
#endif /* ENABLE_LOGGING */ #endif /* ENABLE_LOGGING */
XP_U16 XP_U16