mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-02-06 20:45:54 +01:00
cleanup closing in on building correctly -- which now works, though it
takes a hex editor. May have fixed a bug with a missing CloseHandle call.
This commit is contained in:
parent
2e901dde4e
commit
bc6cfacedb
1 changed files with 37 additions and 29 deletions
|
@ -1,4 +1,4 @@
|
||||||
/* -*-mode: C; fill-column: 77; c-basic-offset: 4; -*- */
|
/* -*- fill-column: 77; c-basic-offset: 4; compile-command: "make TARGET_OS=wince"-*- */
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2004 by Eric House (xwords@eehouse.org). All rights reserved.
|
* Copyright 2002-2004 by Eric House (xwords@eehouse.org). All rights reserved.
|
||||||
*
|
*
|
||||||
|
@ -241,10 +241,10 @@ addButtonsToCmdBar( CEAppGlobals* globals )
|
||||||
XP_Bool success;
|
XP_Bool success;
|
||||||
XP_U16 i;
|
XP_U16 i;
|
||||||
int index;
|
int index;
|
||||||
int cmds[N_TOOLBAR_BUTTONS] = { FLIP_BUTTON_ID, VALUE_BUTTON_ID,
|
int cmds[] = { FLIP_BUTTON_ID, VALUE_BUTTON_ID,
|
||||||
HINT_BUTTON_ID, JUGGLE_BUTTON_ID };
|
HINT_BUTTON_ID, JUGGLE_BUTTON_ID };
|
||||||
int resIDs[N_TOOLBAR_BUTTONS] = { IDB_FLIPBUTTON, IDB_VALUESBUTTON,
|
int resIDs[] = { IDB_FLIPBUTTON, IDB_VALUESBUTTON,
|
||||||
IDB_HINTBUTTON, IDB_JUGGLEBUTTON };
|
IDB_HINTBUTTON, IDB_JUGGLEBUTTON };
|
||||||
|
|
||||||
TBBUTTON buttData = {
|
TBBUTTON buttData = {
|
||||||
0, /*iBitmap; */
|
0, /*iBitmap; */
|
||||||
|
@ -257,12 +257,13 @@ addButtonsToCmdBar( CEAppGlobals* globals )
|
||||||
|
|
||||||
#ifndef CANT_DO_CMDBAR
|
#ifndef CANT_DO_CMDBAR
|
||||||
#ifdef TARGET_OS_WINCE
|
#ifdef TARGET_OS_WINCE
|
||||||
for ( i = 0; i < N_TOOLBAR_BUTTONS; ++i ) {
|
for ( i = 0; i < sizeof(cmds)/sizeof(cmds[0]); ++i ) {
|
||||||
index = CommandBar_AddBitmap(globals->hwndCB, globals->hInst,
|
index = CommandBar_AddBitmap(globals->hwndCB, globals->hInst,
|
||||||
resIDs[i], 1, 16, 16 );
|
resIDs[i], 1, 16, 16 );
|
||||||
buttData.iBitmap = index;
|
buttData.iBitmap = index;
|
||||||
buttData.idCommand = cmds[i];
|
buttData.idCommand = cmds[i];
|
||||||
success = CommandBar_InsertButton( globals->hwndCB, -1, &buttData );
|
success = CommandBar_InsertButton( globals->hwndCB, -1,
|
||||||
|
(LPARAM)&buttData );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
@ -680,6 +681,7 @@ ceSavePrefs( CEAppGlobals* globals )
|
||||||
|
|
||||||
SetEndOfFile( fileH ); /* truncate anything previously there */
|
SetEndOfFile( fileH ); /* truncate anything previously there */
|
||||||
|
|
||||||
|
CloseHandle( fileH ); /* am I not supposed to do this? PENDING */
|
||||||
XP_DEBUGF( "ceSavePrefs: prefs file written" );
|
XP_DEBUGF( "ceSavePrefs: prefs file written" );
|
||||||
} else {
|
} else {
|
||||||
logLastError( "failed to create prefs file" );
|
logLastError( "failed to create prefs file" );
|
||||||
|
@ -790,7 +792,7 @@ ceLoadSavedGame( CEAppGlobals* globals )
|
||||||
XP_Bool success = XP_FALSE;
|
XP_Bool success = XP_FALSE;
|
||||||
XWStreamCtxt* stream;
|
XWStreamCtxt* stream;
|
||||||
|
|
||||||
XP_DEBUGF( "ceLoadSavedGame" );
|
LOG_FUNC();
|
||||||
|
|
||||||
stream = fileToStream( globals, globals->curGameName );
|
stream = fileToStream( globals, globals->curGameName );
|
||||||
success = stream != NULL;
|
success = stream != NULL;
|
||||||
|
@ -888,6 +890,7 @@ InitInstance(HINSTANCE hInstance, int nCmdShow)
|
||||||
XP_U16 len;
|
XP_U16 len;
|
||||||
MPSLOT;
|
MPSLOT;
|
||||||
|
|
||||||
|
#ifdef BEYOND_IR
|
||||||
{
|
{
|
||||||
WORD wVersionRequested;
|
WORD wVersionRequested;
|
||||||
WSADATA wsaData;
|
WSADATA wsaData;
|
||||||
|
@ -897,9 +900,10 @@ InitInstance(HINSTANCE hInstance, int nCmdShow)
|
||||||
if ( err != 0 ) {
|
if ( err != 0 ) {
|
||||||
/* Tell the user that we could not find a usable */
|
/* Tell the user that we could not find a usable */
|
||||||
/* WinSock DLL. */
|
/* WinSock DLL. */
|
||||||
XP_LOGF( "unable to laod winsock" );
|
XP_LOGF( "unable to load winsock" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
|
LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
|
||||||
LoadString(hInstance, IDC_XWORDS4, szWindowClass, MAX_LOADSTRING);
|
LoadString(hInstance, IDC_XWORDS4, szWindowClass, MAX_LOADSTRING);
|
||||||
|
@ -943,7 +947,7 @@ InitInstance(HINSTANCE hInstance, int nCmdShow)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef TARGET_OS_WINCE
|
#ifdef _WIN32_WCE
|
||||||
if ( globals->hwndCB ) {
|
if ( globals->hwndCB ) {
|
||||||
RECT rc, rcmb;
|
RECT rc, rcmb;
|
||||||
|
|
||||||
|
@ -1149,8 +1153,8 @@ ceDoNewGame( CEAppGlobals* globals, XP_Bool silent )
|
||||||
giState.globals = globals;
|
giState.globals = globals;
|
||||||
giState.isNewGame = XP_TRUE;
|
giState.isNewGame = XP_TRUE;
|
||||||
|
|
||||||
DH(DialogBoxParam)( globals->hInst, (LPCTSTR)IDD_GAMEINFO, globals->hWnd,
|
DialogBoxParam( globals->hInst, (LPCTSTR)IDD_GAMEINFO, globals->hWnd,
|
||||||
(DLGPROC)GameInfo, (long)&giState );
|
(DLGPROC)GameInfo, (long)&giState );
|
||||||
|
|
||||||
if ( !giState.userCancelled
|
if ( !giState.userCancelled
|
||||||
#ifndef STUBBED_DICT
|
#ifndef STUBBED_DICT
|
||||||
|
@ -1457,8 +1461,8 @@ makeCommandBar( HWND hwnd, HINSTANCE hInst )
|
||||||
#ifndef CANT_DO_SHELL_THING
|
#ifndef CANT_DO_SHELL_THING
|
||||||
SHMENUBARINFO mbi;
|
SHMENUBARINFO mbi;
|
||||||
|
|
||||||
XP_MEMSET( &mbi, 0, sizeof(SHMENUBARINFO) );
|
XP_MEMSET( &mbi, 0, sizeof(mbi) );
|
||||||
mbi.cbSize = sizeof(SHMENUBARINFO);
|
mbi.cbSize = sizeof(mbi);
|
||||||
mbi.hwndParent = hwnd;
|
mbi.hwndParent = hwnd;
|
||||||
mbi.nToolBarId = IDM_MENU;
|
mbi.nToolBarId = IDM_MENU;
|
||||||
mbi.hInstRes = hInst;
|
mbi.hInstRes = hInst;
|
||||||
|
@ -1577,7 +1581,7 @@ WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
if ( message == WM_CREATE ) {
|
if ( message == WM_CREATE ) {
|
||||||
globals = ((CREATESTRUCT*)lParam)->lpCreateParams;
|
globals = ((CREATESTRUCT*)lParam)->lpCreateParams;
|
||||||
SetWindowLong( hWnd, GWL_USERDATA, (long)globals );
|
SetWindowLong( hWnd, GWL_USERDATA, (long)globals );
|
||||||
#ifdef TARGET_OS_WINCE
|
#ifdef _WIN32_WCE
|
||||||
globals->hwndCB = makeCommandBar( hWnd, globals->hInst );
|
globals->hwndCB = makeCommandBar( hWnd, globals->hInst );
|
||||||
addButtonsToCmdBar( globals );
|
addButtonsToCmdBar( globals );
|
||||||
#endif
|
#endif
|
||||||
|
@ -1595,14 +1599,16 @@ WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
// Notify shell of our activate message
|
// Notify shell of our activate message
|
||||||
SHHandleWMActivate( hWnd, wParam, lParam, &globals->sai, FALSE );
|
SHHandleWMActivate( hWnd, wParam, lParam, &globals->sai, FALSE );
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
case WM_SETTINGCHANGE:
|
case WM_SETTINGCHANGE:
|
||||||
|
#ifndef CANT_DO_SHELL_THING
|
||||||
SHHandleWMSettingChange( hWnd, wParam, lParam, &globals->sai );
|
SHHandleWMSettingChange( hWnd, wParam, lParam, &globals->sai );
|
||||||
|
#endif
|
||||||
cePositionBoard( globals );
|
cePositionBoard( globals );
|
||||||
board_invalAll( globals->game.board );
|
board_invalAll( globals->game.board );
|
||||||
draw = XP_TRUE;
|
draw = XP_TRUE;
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef CEFEATURE_CANSCROLL
|
#ifdef CEFEATURE_CANSCROLL
|
||||||
case WM_VSCROLL:
|
case WM_VSCROLL:
|
||||||
|
@ -1618,8 +1624,8 @@ WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
// Parse the menu selections:
|
// Parse the menu selections:
|
||||||
switch (wmId) {
|
switch (wmId) {
|
||||||
case ID_FILE_ABOUT:
|
case ID_FILE_ABOUT:
|
||||||
DH(DialogBoxParam)(globals->hInst, (LPCTSTR)IDD_ABOUTBOX, hWnd,
|
DialogBoxParam(globals->hInst, (LPCTSTR)IDD_ABOUTBOX, hWnd,
|
||||||
(DLGPROC)About, 0L );
|
(DLGPROC)About, 0L );
|
||||||
break;
|
break;
|
||||||
case ID_GAME_GAMEINFO: {
|
case ID_GAME_GAMEINFO: {
|
||||||
GameInfoState state;
|
GameInfoState state;
|
||||||
|
@ -1628,8 +1634,8 @@ WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
state.globals = globals;
|
state.globals = globals;
|
||||||
state.isNewGame = XP_FALSE;
|
state.isNewGame = XP_FALSE;
|
||||||
|
|
||||||
DH(DialogBoxParam)(globals->hInst, (LPCTSTR)IDD_GAMEINFO, hWnd,
|
DialogBoxParam(globals->hInst, (LPCTSTR)IDD_GAMEINFO, hWnd,
|
||||||
(DLGPROC)GameInfo, (long)&state );
|
(DLGPROC)GameInfo, (long)&state );
|
||||||
|
|
||||||
if ( !state.userCancelled && state.prefsChanged ) {
|
if ( !state.userCancelled && state.prefsChanged ) {
|
||||||
/* need to update some prefs? */
|
/* need to update some prefs? */
|
||||||
|
@ -1880,8 +1886,8 @@ ceMsgFromStream( CEAppGlobals* globals, XWStreamCtxt* stream,
|
||||||
init.isQuery = isQuery;
|
init.isQuery = isQuery;
|
||||||
init.globals = globals;
|
init.globals = globals;
|
||||||
|
|
||||||
DH(DialogBoxParam)( globals->hInst, (LPCTSTR)IDD_STRBOX, globals->hWnd,
|
DialogBoxParam( globals->hInst, (LPCTSTR)IDD_STRBOX, globals->hWnd,
|
||||||
(DLGPROC)StrBox, (long)&init );
|
(DLGPROC)StrBox, (long)&init );
|
||||||
|
|
||||||
if ( destroy ) {
|
if ( destroy ) {
|
||||||
stream_destroy( stream );
|
stream_destroy( stream );
|
||||||
|
@ -1986,7 +1992,7 @@ makeTimeStamp( XP_UCHAR* timeStamp, XP_U16 size )
|
||||||
SYSTEMTIME st;
|
SYSTEMTIME st;
|
||||||
DWORD tid;
|
DWORD tid;
|
||||||
|
|
||||||
tid = DH(GetCurrentThreadId)();
|
tid = GetCurrentThreadId();
|
||||||
|
|
||||||
GetLocalTime( &st );
|
GetLocalTime( &st );
|
||||||
sprintf( timeStamp, "<%lx>%d:%.2d:%.2d ", tid, st.wHour, st.wMinute,
|
sprintf( timeStamp, "<%lx>%d:%.2d:%.2d ", tid, st.wHour, st.wMinute,
|
||||||
|
@ -2165,6 +2171,7 @@ ce_util_userError( XW_UtilCtxt* uc, UtilErrID id )
|
||||||
message = "Tile assignment can't be undone.";
|
message = "Tile assignment can't be undone.";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
#ifdef BEYOND_IR
|
||||||
case ERR_RELAY_BASE + XWRELAY_ERROR_TIMEOUT:
|
case ERR_RELAY_BASE + XWRELAY_ERROR_TIMEOUT:
|
||||||
message = "The relay timed you out; usually that means "
|
message = "The relay timed you out; usually that means "
|
||||||
"the other players didn't show.";
|
"the other players didn't show.";
|
||||||
|
@ -2177,6 +2184,7 @@ ce_util_userError( XW_UtilCtxt* uc, UtilErrID id )
|
||||||
case ERR_RELAY_BASE + XWRELAY_ERROR_LOST_OTHER:
|
case ERR_RELAY_BASE + XWRELAY_ERROR_LOST_OTHER:
|
||||||
message = "The relay has lost contact with a device in this game.";
|
message = "The relay has lost contact with a device in this game.";
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
default:
|
default:
|
||||||
message = "unknown errorcode ID!!!";
|
message = "unknown errorcode ID!!!";
|
||||||
|
@ -2277,8 +2285,8 @@ ce_util_userPickTile( XW_UtilCtxt* uc, const PickInfo* pi,
|
||||||
state.playerNum = playerNum;
|
state.playerNum = playerNum;
|
||||||
state.pi = pi;
|
state.pi = pi;
|
||||||
|
|
||||||
DH(DialogBoxParam)( globals->hInst, (LPCTSTR)IDD_ASKBLANK, globals->hWnd,
|
DialogBoxParam( globals->hInst, (LPCTSTR)IDD_ASKBLANK, globals->hWnd,
|
||||||
(DLGPROC)BlankDlg, (long)&state );
|
(DLGPROC)BlankDlg, (long)&state );
|
||||||
return state.result;
|
return state.result;
|
||||||
} /* ce_util_userPickTile */
|
} /* ce_util_userPickTile */
|
||||||
|
|
||||||
|
@ -2294,8 +2302,8 @@ ce_util_askPassword( XW_UtilCtxt* uc, const XP_UCHAR* name,
|
||||||
state.buf = buf;
|
state.buf = buf;
|
||||||
state.lenp = len;
|
state.lenp = len;
|
||||||
|
|
||||||
DH(DialogBoxParam)( globals->hInst, (LPCTSTR)IDD_ASKPASS, globals->hWnd,
|
DialogBoxParam( globals->hInst, (LPCTSTR)IDD_ASKPASS, globals->hWnd,
|
||||||
(DLGPROC)PasswdDlg, (long)&state );
|
(DLGPROC)PasswdDlg, (long)&state );
|
||||||
|
|
||||||
return !state.userCancelled;
|
return !state.userCancelled;
|
||||||
} /* ce_util_askPassword */
|
} /* ce_util_askPassword */
|
||||||
|
@ -2547,8 +2555,8 @@ ce_util_getTraySearchLimits( XW_UtilCtxt* uc, XP_U16* min, XP_U16* max )
|
||||||
hls.min = *min;
|
hls.min = *min;
|
||||||
hls.max = *max;
|
hls.max = *max;
|
||||||
|
|
||||||
DH(DialogBoxParam)( globals->hInst, (LPCTSTR)IDD_ASKHINTLIMTS, globals->hWnd,
|
DialogBoxParam( globals->hInst, (LPCTSTR)IDD_ASKHINTLIMTS, globals->hWnd,
|
||||||
(DLGPROC)HintLimitsDlg, (long)&hls );
|
(DLGPROC)HintLimitsDlg, (long)&hls );
|
||||||
|
|
||||||
if ( !hls.cancelled ) {
|
if ( !hls.cancelled ) {
|
||||||
*min = hls.min;
|
*min = hls.min;
|
||||||
|
|
Loading…
Add table
Reference in a new issue