Go back to using combobox on PPC but keep spinners on Smartphone.

Meaning: both exist in the resource, and at runtime we disable the
unwanted one and lookup IDs and sometimes window messages in order to
operate on 'em.  Also, spinners send WM_NOTIFY messages, so handle
that.  Current implementation is a bit of a hack but works.
This commit is contained in:
ehouse 2008-08-27 12:16:33 +00:00
parent 5e6ba430fe
commit bf505d1a62
14 changed files with 359 additions and 270 deletions

View file

@ -23,10 +23,12 @@
#include "debhacks.h" #include "debhacks.h"
static void static void
loadLettersList( HWND hDlg, BlankDialogState* bState ) loadLettersList( BlankDialogState* bState )
{ {
XP_U16 i; XP_U16 i;
XP_U16 nTiles = bState->nTiles; XP_U16 nTiles = bState->nTiles;
HWND hDlg = bState->dlgHdr.hDlg;
CEAppGlobals* globals = bState->dlgHdr.globals;
const XP_UCHAR4* texts = bState->texts; const XP_UCHAR4* texts = bState->texts;
for ( i = 0; i < nTiles; ++i ) { for ( i = 0; i < nTiles; ++i ) {
@ -38,10 +40,15 @@ loadLettersList( HWND hDlg, BlankDialogState* bState )
widebuf, VSIZE(widebuf) ); widebuf, VSIZE(widebuf) );
widebuf[len] = 0; widebuf[len] = 0;
SendDlgItemMessage( hDlg, BLANKFACE_LIST, ADDSTRING, SendDlgItemMessage( hDlg, LB_IF_PPC(globals,BLANKFACE_LIST),
0, (long)widebuf ); ADDSTRING(globals), 0, (long)widebuf );
} }
ce_selectAndShow( hDlg, BLANKFACE_LIST, 0 );
SendDlgItemMessage( hDlg, LB_IF_PPC(globals,BLANKFACE_LIST),
SETCURSEL(globals), 0, 0 );
#ifdef _WIN32_WCE
SendDlgItemMessage( hDlg, BLANKFACE_LIST_PPC, LB_SETANCHORINDEX, 0, 0 );
#endif
} /* loadLettersList */ } /* loadLettersList */
#ifdef FEATURE_TRAY_EDIT #ifdef FEATURE_TRAY_EDIT
@ -104,8 +111,9 @@ BlankDlg(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
#endif #endif
ceDlgSetup( &bState->dlgHdr, hDlg, DLG_STATE_TRAPBACK ); ceDlgSetup( &bState->dlgHdr, hDlg, DLG_STATE_TRAPBACK );
ceDlgComboShowHide( &bState->dlgHdr, BLANKFACE_LIST );
loadLettersList( hDlg, bState ); loadLettersList( bState );
} else { } else {
bState = (BlankDialogState*)GetWindowLong( hDlg, GWL_USERDATA ); bState = (BlankDialogState*)GetWindowLong( hDlg, GWL_USERDATA );
if ( !!bState ) { if ( !!bState ) {
@ -125,9 +133,11 @@ BlankDlg(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
bState->result = PICKER_BACKUP; bState->result = PICKER_BACKUP;
#endif #endif
} else if ( id == IDOK ) { } else if ( id == IDOK ) {
bState->result = CEAppGlobals* globals = bState->dlgHdr.globals;
(XP_S16)SendDlgItemMessage( hDlg, BLANKFACE_LIST, bState->result = (XP_S16)
GETCURSEL, 0, 0 ); SendDlgItemMessage( hDlg,
LB_IF_PPC(globals,BLANKFACE_LIST),
GETCURSEL(globals), 0, 0 );
} else { } else {
break; break;
} }

View file

@ -73,6 +73,10 @@ messageToStr( UINT message )
CASE_STR( WM_NCDESTROY ); CASE_STR( WM_NCDESTROY );
CASE_STR( WM_NOTIFY ); CASE_STR( WM_NOTIFY );
CASE_STR( WM_NCHITTEST ); CASE_STR( WM_NCHITTEST );
CASE_STR( WM_HSCROLL );
CASE_STR( WM_STYLECHANGED );
CASE_STR( WM_NOTIFYFORMAT );
CASE_STR( WM_KILLFOCUS );
default: default:
str = "<unknown>"; str = "<unknown>";
} }

View file

@ -26,7 +26,7 @@
#include "cecondlg.h" #include "cecondlg.h"
#include "strutils.h" #include "strutils.h"
#include "cedebug.h" #include "cedebug.h"
#include "debhacks.h" #include "strutils.h"
#define NUM_COLS 4 #define NUM_COLS 4
#define MENUDICTS_INCR 16 #define MENUDICTS_INCR 16
@ -117,13 +117,14 @@ addDictsToMenu( GameInfoState* giState )
wchar_t shortPath[CE_MAX_PATH_LEN+1]; wchar_t shortPath[CE_MAX_PATH_LEN+1];
XP_U16 i, nMenuDicts = giState->nMenuDicts; XP_U16 i, nMenuDicts = giState->nMenuDicts;
XP_S16 sel = 0; XP_S16 sel = 0;
CEAppGlobals* globals = giState->dlgHdr.globals;
/* insert the short names in the menu */ /* insert the short names in the menu */
for ( i = 0; i < nMenuDicts; ++i ) { for ( i = 0; i < nMenuDicts; ++i ) {
wchar_t* wPath = giState->menuDicts[i]; wchar_t* wPath = giState->menuDicts[i];
shortname = wbname( shortPath, sizeof(shortPath), wPath ); shortname = wbname( shortPath, sizeof(shortPath), wPath );
SendDlgItemMessage( giState->dlgHdr.hDlg, IDC_DICTLIST, ADDSTRING, 0, SendDlgItemMessage( giState->dlgHdr.hDlg, giState->dictListId,
(long)shortname ); ADDSTRING(globals), 0, (long)shortname );
if ( giState->newDictName[0] != 0 && sel == 0 ) { if ( giState->newDictName[0] != 0 && sel == 0 ) {
XP_UCHAR buf[CE_MAX_PATH_LEN+1]; XP_UCHAR buf[CE_MAX_PATH_LEN+1];
@ -135,7 +136,8 @@ addDictsToMenu( GameInfoState* giState )
} }
} }
SendDlgItemMessage( giState->dlgHdr.hDlg, IDC_DICTLIST, SETCURSEL, sel, 0L ); SendDlgItemMessage( giState->dlgHdr.hDlg, giState->dictListId,
SETCURSEL(globals), sel, 0L );
} /* addDictsToMenu */ } /* addDictsToMenu */
static void static void
@ -156,7 +158,8 @@ static void
loadFromGameInfo( GameInfoState* giState ) loadFromGameInfo( GameInfoState* giState )
{ {
XP_U16 i; XP_U16 i;
CurGameInfo* gi = &giState->dlgHdr.globals->gameInfo; CEAppGlobals* globals = giState->dlgHdr.globals;
CurGameInfo* gi = &globals->gameInfo;
#if defined XWFEATURE_RELAY || defined XWFEATURE_BLUETOOTH #if defined XWFEATURE_RELAY || defined XWFEATURE_BLUETOOTH
wchar_t* roles[] = { L"Standalone", L"Host", L"Guest" }; wchar_t* roles[] = { L"Standalone", L"Host", L"Guest" };
@ -170,7 +173,8 @@ loadFromGameInfo( GameInfoState* giState )
wchar_t widebuf[8]; wchar_t widebuf[8];
/* put a string in the moronic combobox */ /* put a string in the moronic combobox */
swprintf( widebuf, L"%d", i + 1 ); swprintf( widebuf, L"%d", i + 1 );
SendDlgItemMessage( giState->dlgHdr.hDlg, IDC_NPLAYERSCOMBO, ADDSTRING, 0, SendDlgItemMessage( giState->dlgHdr.hDlg, giState->comboId,
ADDSTRING(globals), 0,
(long)widebuf ); (long)widebuf );
} }
@ -195,7 +199,7 @@ loadFromGameInfo( GameInfoState* giState )
#endif #endif
if ( !giState->isNewGame ) { if ( !giState->isNewGame ) {
ceEnOrDisable( giState->dlgHdr.hDlg, IDC_DICTLIST, XP_FALSE ); ceEnOrDisable( giState->dlgHdr.hDlg, giState->dictListId, XP_FALSE );
} }
} /* loadFromGameInfo */ } /* loadFromGameInfo */
@ -212,7 +216,8 @@ stateToGameInfo( GameInfoState* giState )
/* dictionary */ { /* dictionary */ {
int sel; int sel;
sel = SendDlgItemMessage( hDlg, IDC_DICTLIST, GETCURSEL, 0, 0L ); sel = SendDlgItemMessage( hDlg, giState->dictListId,
GETCURSEL(globals), 0, 0L );
if ( sel >= 0 ) { if ( sel >= 0 ) {
WideCharToMultiByte( CP_ACP, 0, giState->menuDicts[sel], -1, WideCharToMultiByte( CP_ACP, 0, giState->menuDicts[sel], -1,
giState->newDictName, giState->newDictName,
@ -242,7 +247,6 @@ stateToGameInfo( GameInfoState* giState )
} }
} }
LOG_RETURNF( "%d", (int)success );
return success; return success;
} /* stateToGameInfo */ } /* stateToGameInfo */
@ -304,12 +308,12 @@ resIDForCol( XP_U16 player, NewGameColumn col )
} /* resIDForCol */ } /* resIDForCol */
static XP_U16 static XP_U16
resIDForAttr( NewGameAttr attr ) resIDForAttr( GameInfoState* state, NewGameAttr attr )
{ {
XP_U16 resID = 0; XP_U16 resID = 0;
switch( attr ) { switch( attr ) {
case NG_ATTR_NPLAYERS: case NG_ATTR_NPLAYERS:
resID = IDC_NPLAYERSCOMBO; resID = state->comboId;
break; break;
#if defined XWFEATURE_RELAY || defined XWFEATURE_BLUETOOTH #if defined XWFEATURE_RELAY || defined XWFEATURE_BLUETOOTH
case NG_ATTR_ROLE: case NG_ATTR_ROLE:
@ -355,7 +359,7 @@ static void
ceEnableAttrProc( void* closure, NewGameAttr attr, XP_TriEnable enable ) ceEnableAttrProc( void* closure, NewGameAttr attr, XP_TriEnable enable )
{ {
GameInfoState* giState = (GameInfoState*)closure; GameInfoState* giState = (GameInfoState*)closure;
XP_U16 resID = resIDForAttr( attr ); XP_U16 resID = resIDForAttr( giState, attr );
doForNWEnable( giState->dlgHdr.hDlg, resID, enable ); doForNWEnable( giState->dlgHdr.hDlg, resID, enable );
} /* ceEnableAttrProc */ } /* ceEnableAttrProc */
@ -416,22 +420,24 @@ ceSetColProc( void* closure, XP_U16 player, NewGameColumn col,
default: default:
XP_ASSERT(0); XP_ASSERT(0);
} }
} } /* ceSetColProc */
static void static void
ceSetAttrProc(void* closure, NewGameAttr attr, const NGValue value ) ceSetAttrProc(void* closure, NewGameAttr attr, const NGValue value )
{ {
GameInfoState* giState = (GameInfoState*)closure; GameInfoState* giState = (GameInfoState*)closure;
XP_U16 resID = resIDForAttr( attr ); XP_U16 resID = resIDForAttr( giState, attr );
CEAppGlobals* globals = giState->dlgHdr.globals;
switch ( attr ) { switch ( attr ) {
case NG_ATTR_NPLAYERS: case NG_ATTR_NPLAYERS:
SendDlgItemMessage( giState->dlgHdr.hDlg, resID, SETCURSEL, SendDlgItemMessage( giState->dlgHdr.hDlg, resID,
SETCURSEL(globals),
value.ng_u16 - 1, 0L ); value.ng_u16 - 1, 0L );
break; break;
#ifndef XWFEATURE_STANDALONE_ONLY #ifndef XWFEATURE_STANDALONE_ONLY
case NG_ATTR_ROLE: case NG_ATTR_ROLE:
SendDlgItemMessage( giState->dlgHdr.hDlg, resID, SETCURSEL, SendDlgItemMessage( giState->dlgHdr.hDlg, resID, SETCURSEL(globals),
value.ng_role, 0L ); value.ng_role, 0L );
break; break;
#endif #endif
@ -448,7 +454,6 @@ playerFromID( XP_U16 id, XP_U16 base )
{ {
XP_U16 player; XP_U16 player;
player = (id - base) / NUM_COLS; player = (id - base) / NUM_COLS;
/* XP_LOGF( "%s: looks like row %d", __func__, player ); */
return player; return player;
} }
@ -481,6 +486,20 @@ ceDrawIconButton( CEAppGlobals* globals, DRAWITEMSTRUCT* dis )
} /* ceDrawColorButton */ } /* ceDrawColorButton */
#endif #endif
static void
checkUpdateCombo( GameInfoState* giState, XP_U16 id )
{
if ( giState->isNewGame ) { /* ignore if in info mode */
NGValue value;
value.ng_u16 = 1 + (XP_U16)
SendDlgItemMessage( giState->dlgHdr.hDlg, id,
GETCURSEL(giState->dlgHdr.globals), 0, 0L);
XP_ASSERT( !!giState->newGameCtx );
newg_attrChanged( giState->newGameCtx,
NG_ATTR_NPLAYERS, value );
}
} /* checkUpdateCombo */
LRESULT CALLBACK LRESULT CALLBACK
GameInfo(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) GameInfo(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{ {
@ -496,7 +515,12 @@ GameInfo(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
giState = (GameInfoState*)lParam; giState = (GameInfoState*)lParam;
globals = giState->dlgHdr.globals; globals = giState->dlgHdr.globals;
giState->comboId = LB_IF_PPC(globals,IDC_NPLAYERSCOMBO);
giState->dictListId = LB_IF_PPC(globals,IDC_DICTLIST);
ceDlgSetup( &giState->dlgHdr, hDlg, DLG_STATE_TRAPBACK ); ceDlgSetup( &giState->dlgHdr, hDlg, DLG_STATE_TRAPBACK );
ceDlgComboShowHide( &giState->dlgHdr, IDC_NPLAYERSCOMBO );
ceDlgComboShowHide( &giState->dlgHdr, IDC_DICTLIST );
giState->newGameCtx = newg_make( MPPARM(globals->mpool) giState->newGameCtx = newg_make( MPPARM(globals->mpool)
giState->isNewGame, giState->isNewGame,
@ -535,104 +559,98 @@ GameInfo(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
break; break;
#endif #endif
case WM_NOTIFY:
if ( !!giState->newGameCtx ) {
checkUpdateCombo( giState, LOWORD(wParam)-1 );
}
break;
case WM_COMMAND: case WM_COMMAND:
result = TRUE; result = TRUE;
id = LOWORD(wParam); id = LOWORD(wParam);
switch( id ) { if ( id == giState->comboId ) {
if ( HIWORD(wParam) == CBN_SELCHANGE ) {
case ROBOT_CHECK1: checkUpdateCombo( giState, id );
case ROBOT_CHECK2: }
case ROBOT_CHECK3: } else {
case ROBOT_CHECK4: switch( id ) {
handleColChecked( giState, id, ROBOT_CHECK1 ); case ROBOT_CHECK1:
break; case ROBOT_CHECK2:
case ROBOT_CHECK3:
case ROBOT_CHECK4:
handleColChecked( giState, id, ROBOT_CHECK1 );
break;
#ifndef XWFEATURE_STANDALONE_ONLY #ifndef XWFEATURE_STANDALONE_ONLY
case REMOTE_CHECK1: case REMOTE_CHECK1:
case REMOTE_CHECK2: case REMOTE_CHECK2:
case REMOTE_CHECK3: case REMOTE_CHECK3:
case REMOTE_CHECK4: case REMOTE_CHECK4:
handleColChecked( giState, id, REMOTE_CHECK1 ); handleColChecked( giState, id, REMOTE_CHECK1 );
break; break;
#endif #endif
case IDC_NPLAYERSCOMBO:
if ( HIWORD(wParam) == CBN_SELCHANGE ) {
if ( giState->isNewGame ) { /* ignore if in info
mode */
NGValue value;
value.ng_u16 = 1 + (XP_U16)
SendDlgItemMessage( hDlg,
IDC_NPLAYERSCOMBO,
GETCURSEL, 0, 0L);
newg_attrChanged( giState->newGameCtx,
NG_ATTR_NPLAYERS, value );
}
}
break;
#if defined XWFEATURE_RELAY || defined XWFEATURE_BLUETOOTH #if defined XWFEATURE_RELAY || defined XWFEATURE_BLUETOOTH
case IDC_ROLECOMBO: case IDC_ROLECOMBO:
if ( HIWORD(wParam) == CBN_SELCHANGE ) { if ( HIWORD(wParam) == CBN_SELCHANGE ) {
if ( giState->isNewGame ) { /* ignore if in info if ( giState->isNewGame ) { /* ignore if in info
mode */ mode */
NGValue value; NGValue value;
value.ng_role = value.ng_role =
(DeviceRole)SendDlgItemMessage( hDlg, (DeviceRole)SendDlgItemMessage( hDlg,
IDC_ROLECOMBO, IDC_ROLECOMBO,
CB_GETCURSEL, 0, CB_GETCURSEL, 0,
0L); 0L);
newg_attrChanged( giState->newGameCtx, newg_attrChanged( giState->newGameCtx,
NG_ATTR_ROLE, value ); NG_ATTR_ROLE, value );
/* If we've switched to a state where we'll be /* If we've switched to a state where we'll be
connecting */ connecting */
if ( value.ng_role != SERVER_STANDALONE ) { if ( value.ng_role != SERVER_STANDALONE ) {
handleConnOptionsButton( hDlg, globals, handleConnOptionsButton( hDlg, globals,
value.ng_role, value.ng_role,
giState ); giState );
}
} }
} }
}
break;
#endif
case GIJUGGLE_BUTTON:
XP_ASSERT( giState->isNewGame );
/* Juggle vs switch. On Win32, updates are coalesced so
you don't see anything on screen if you change a field
then change it back. In terms of messages, all we see
here is a WM_CTLCOLOREDIT for each field being
changed. If I post a custom event here, it comes in
*before* the WM_CTLCOLOREDIT events. Short of a
timer, which starts a race with the user, I see no way
to get notified after the drawing's done. So for now,
we switch rather than juggle: call juggle until
something actually happens. */
while ( !newg_juggle( giState->newGameCtx ) ) {
}
break;
case OPTIONS_BUTTON:
handlePrefsButton( hDlg, globals, giState );
break;
case IDOK:
if ( !stateToGameInfo( giState ) ) {
break; break;
#endif
case GIJUGGLE_BUTTON:
XP_ASSERT( giState->isNewGame );
/* Juggle vs switch. On Win32, updates are
coalesced so you don't see anything on screen
if you change a field then change it back. In
terms of messages, all we see here is a
WM_CTLCOLOREDIT for each field being changed.
If I post a custom event here, it comes in
*before* the WM_CTLCOLOREDIT events. Short of
a timer, which starts a race with the user, I
see no way to get notified after the drawing's
done. So for now, we switch rather than
juggle: call juggle until something actually
happens. */
while ( !newg_juggle( giState->newGameCtx ) ) {
}
break;
case OPTIONS_BUTTON:
handlePrefsButton( hDlg, globals, giState );
break;
case IDOK:
if ( !stateToGameInfo( giState ) ) {
break;
}
case IDCANCEL:
EndDialog(hDlg, id);
giState->userCancelled = id == IDCANCEL;
cleanupGameInfoState( giState );
newg_destroy( giState->newGameCtx );
giState->newGameCtx = NULL;
} }
case IDCANCEL: break;
EndDialog(hDlg, id); default:
giState->userCancelled = id == IDCANCEL; result = FALSE;
cleanupGameInfoState( giState );
newg_destroy( giState->newGameCtx );
} }
break;
default:
result = FALSE;
/* case WM_CLOSE: */
/* EndDialog(hDlg, id); */
/* return TRUE; */
/* default: */
/* return DefWindowProc(hDlg, message, wParam, lParam); */
} }
} }
} }

View file

@ -35,6 +35,8 @@ typedef struct GameInfoState {
XP_U16 capMenuDicts; XP_U16 capMenuDicts;
XP_U16 nMenuDicts; XP_U16 nMenuDicts;
wchar_t** menuDicts; wchar_t** menuDicts;
XP_U16 comboId;
XP_U16 dictListId;
XP_Bool isNewGame; /* newGame or GameInfo */ XP_Bool isNewGame; /* newGame or GameInfo */
XP_Bool userCancelled; /* OUT param */ XP_Bool userCancelled; /* OUT param */

View file

@ -23,27 +23,29 @@
#include "cehntlim.h" #include "cehntlim.h"
static void static void
initComboBox( HWND hDlg, XP_U16 id, XP_U16 startVal ) initComboBox( HintLimitsState* state, XP_U16 id, XP_U16 startVal )
{ {
XP_U16 i; HWND hDlg = state->dlgHdr.hDlg;
for ( i = 1; i <= MAX_TRAY_TILES; ++i ) { XP_U16 ii;
for ( ii = 0; ii < MAX_TRAY_TILES; ++ii ) {
wchar_t str[4]; wchar_t str[4];
swprintf( str, L"%d", i ); swprintf( str, L"%d", ii+1 );
SendDlgItemMessage( hDlg, id, ADDSTRING, 0, (long)str ); SendDlgItemMessage( hDlg, id, INSERTSTRING(state->dlgHdr.globals), ii, (long)str );
if ( i == startVal ) { if ( (ii+1) == startVal ) {
SendDlgItemMessage( hDlg, id, SETCURSEL, i-1, 0L ); SendDlgItemMessage( hDlg, id, SETCURSEL(state->dlgHdr.globals), ii, 0L );
} }
} }
} /* initComboBox */ } /* initComboBox */
static XP_U16 static XP_U16
getComboValue( HWND hDlg, XP_U16 id ) getComboValue( HintLimitsState* state, XP_U16 id )
{ {
HWND hDlg = state->dlgHdr.hDlg;
LONG result; LONG result;
result = SendDlgItemMessage( hDlg, id, GETCURSEL, 0, 0L ); result = SendDlgItemMessage( hDlg, id, GETCURSEL(state->dlgHdr.globals), 0, 0L );
if ( result == CB_ERR ) { if ( result == CB_ERR ) {
result = 1; result = 1;
} }
@ -54,13 +56,14 @@ LRESULT CALLBACK
HintLimitsDlg( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam ) HintLimitsDlg( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam )
{ {
HintLimitsState* hState; HintLimitsState* hState;
XP_U16 id;
if ( message == WM_INITDIALOG ) { if ( message == WM_INITDIALOG ) {
SetWindowLong( hDlg, GWL_USERDATA, lParam ); SetWindowLong( hDlg, GWL_USERDATA, lParam );
hState = (HintLimitsState*)lParam; hState = (HintLimitsState*)lParam;
ceDlgSetup( &hState->dlgHdr, hDlg, DLG_STATE_NONE ); ceDlgSetup( &hState->dlgHdr, hDlg, DLG_STATE_NONE );
ceDlgComboShowHide( &hState->dlgHdr, HC_MIN_COMBO );
ceDlgComboShowHide( &hState->dlgHdr, HC_MAX_COMBO );
return TRUE; return TRUE;
} else { } else {
@ -68,8 +71,12 @@ HintLimitsDlg( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam )
if ( !!hState ) { if ( !!hState ) {
if ( !hState->inited ) { if ( !hState->inited ) {
initComboBox( hDlg, HC_MIN_COMBO, hState->min ); initComboBox( hState,
initComboBox( hDlg, HC_MAX_COMBO, hState->max ); LB_IF_PPC(hState->dlgHdr.globals, HC_MIN_COMBO),
hState->min );
initComboBox( hState,
LB_IF_PPC(hState->dlgHdr.globals,HC_MAX_COMBO),
hState->max );
hState->inited = XP_TRUE; hState->inited = XP_TRUE;
} }
@ -77,13 +84,14 @@ HintLimitsDlg( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam )
return TRUE; return TRUE;
} }
switch ( message ) { if ( (message == WM_COMMAND) && (BN_CLICKED == HIWORD(wParam) ) ) {
case WM_COMMAND: XP_U16 id = LOWORD(wParam);
id = LOWORD(wParam);
switch( id ) { switch( id ) {
case IDOK: case IDOK:
hState->min = getComboValue( hDlg, HC_MIN_COMBO ); hState->min = getComboValue( hState,
hState->max = getComboValue( hDlg, HC_MAX_COMBO ); LB_IF_PPC(hState->dlgHdr.globals,HC_MIN_COMBO) );
hState->max = getComboValue( hState,
LB_IF_PPC(hState->dlgHdr.globals,HC_MAX_COMBO) );
case IDCANCEL: case IDCANCEL:
hState->cancelled = id == IDCANCEL; hState->cancelled = id == IDCANCEL;

View file

@ -505,7 +505,7 @@ figureBoardParms( CEAppGlobals* globals, XP_U16 nRows, CEBoardParms* bparms )
width for a scrollbar. */ width for a scrollbar. */
boardHt = scrnHeight - scoreHeight - MIN_TRAY_HEIGHT; boardHt = scrnHeight - scoreHeight - MIN_TRAY_HEIGHT;
vScale = sizeBoard( &boardHt, &nVisibleRows ); vScale = sizeBoard( &boardHt, &nVisibleRows );
if ( nVisibleRows < nRows && !IS_SMARTPHONE(globals) ) { if ( (nVisibleRows < nRows) && !IS_SMARTPHONE(globals) ) {
scrollWidth = SCROLLBAR_WIDTH; scrollWidth = SCROLLBAR_WIDTH;
} }

View file

@ -43,7 +43,7 @@ typedef enum {
# define IS_SMARTPHONE(g) ((g)->winceVersion > _LAST_PPC) # define IS_SMARTPHONE(g) ((g)->winceVersion > _LAST_PPC)
#else #else
# define IS_SMARTPHONE(g) XP_FALSE # define IS_SMARTPHONE(g) ((g) != (g)) /* make compiler warnings go away */
#endif #endif
enum { CE_BONUS1_COLOR, enum { CE_BONUS1_COLOR,
@ -222,20 +222,14 @@ void messageToBuf( UINT message, char* buf, int bufSize );
#endif #endif
/* These allow LISTBOX and COMBOBOX to be used by the same code */ /* These allow LISTBOX and COMBOBOX to be used by the same code */
#ifdef _WIN32_WCE
# define SETCURSEL LB_SETCURSEL #define INSERTSTRING(g) (IS_SMARTPHONE(g)?LB_INSERTSTRING:CB_INSERTSTRING)
# define GETCURSEL LB_GETCURSEL #define SETCURSEL(g) (IS_SMARTPHONE(g)?LB_SETCURSEL:CB_SETCURSEL)
# define ADDSTRING LB_ADDSTRING #define GETCURSEL(g) (IS_SMARTPHONE(g)?LB_GETCURSEL:CB_GETCURSEL)
# define INSERTSTRING LB_INSERTSTRING #define ADDSTRING(g) (IS_SMARTPHONE(g)?LB_ADDSTRING:CB_ADDSTRING)
# define GETLBTEXTLEN LB_GETTEXTLEN #define GETLBTEXT(g) (IS_SMARTPHONE(g)?LB_GETTEXT:CB_GETLBTEXT)
# define GETLBTEXT LB_GETTEXT #define GETLBTEXTLEN(g) (IS_SMARTPHONE(g)?LB_GETTEXTLEN:CB_GETLBTEXTLEN)
#else
# define SETCURSEL CB_SETCURSEL #define LB_IF_PPC(g,id) (IS_SMARTPHONE(g)?id:(id+2))
# define GETCURSEL CB_GETCURSEL
# define ADDSTRING CB_ADDSTRING
# define INSERTSTRING CB_INSERTSTRING
# define GETLBTEXTLEN CB_GETLBTEXTLEN
# define GETLBTEXT CB_GETLBTEXT
#endif
#endif /* _CEMAIN_H_ */ #endif /* _CEMAIN_H_ */

View file

@ -29,8 +29,10 @@
/* Stuff the strings for phonies. Why can't I put this in the resource? /* Stuff the strings for phonies. Why can't I put this in the resource?
*/ */
static void static void
stuffPhoniesList( HWND hDlg ) stuffPhoniesList( CePrefsDlgState* state )
{ {
HWND hDlg = state->dlgHdr.hDlg;
CEAppGlobals* globals = state->dlgHdr.globals;
XP_U16 i; XP_U16 i;
wchar_t* strings[] = { wchar_t* strings[] = {
L"Ignore", L"Ignore",
@ -39,8 +41,8 @@ stuffPhoniesList( HWND hDlg )
}; };
for ( i = 0; i < 3; ++i ) { for ( i = 0; i < 3; ++i ) {
SendDlgItemMessage( hDlg, PHONIES_COMBO, ADDSTRING, SendDlgItemMessage( hDlg, state->phonComboId,
0, (long)strings[i] ); ADDSTRING(globals), 0, (long)strings[i] );
} }
} /* stuffPhoniesList */ } /* stuffPhoniesList */
@ -64,14 +66,16 @@ setTimerCtls( HWND hDlg, XP_Bool checked )
} /* setTimerCtls */ } /* setTimerCtls */
static void static void
adjustForChoice( HWND hDlg, CePrefsDlgState* state ) adjustForChoice( CePrefsDlgState* state )
{ {
HWND hDlg = state->dlgHdr.hDlg;
XP_U16 goesWithGlobal[] = {IDC_CHECKCOLORPLAYED, IDC_LEFTYCHECK, XP_U16 goesWithGlobal[] = {IDC_CHECKCOLORPLAYED, IDC_LEFTYCHECK,
IDC_CHECKSHOWCURSOR, IDC_CHECKROBOTSCORES, IDC_CHECKSHOWCURSOR, IDC_CHECKROBOTSCORES,
IDC_PREFCOLORS }; IDC_PREFCOLORS };
XP_U16 goesWithLocal[] = {IDC_CHECKSMARTROBOT, IDC_CHECKNOHINTS, XP_U16 goesWithLocal[] = {IDC_CHECKSMARTROBOT, IDC_CHECKNOHINTS,
TIMER_CHECK, TIMER_EDIT, PHONIES_LABEL, TIMER_CHECK, TIMER_EDIT, PHONIES_LABEL,
PHONIES_COMBO, IDC_PHONIESUPDOWN, IDC_PICKTILES PHONIES_COMBO, IDC_PHONIESUPDOWN, PHONIES_COMBO_PPC,
IDC_PHONIESUPDOWN, IDC_PICKTILES
#ifdef XWFEATURE_SEARCHLIMIT #ifdef XWFEATURE_SEARCHLIMIT
,IDC_CHECKHINTSLIMITS ,IDC_CHECKHINTSLIMITS
#endif #endif
@ -98,6 +102,7 @@ adjustForChoice( HWND hDlg, CePrefsDlgState* state )
ceShowOrHide( hDlg, IDC_CHECKHINTSLIMITS, ceShowOrHide( hDlg, IDC_CHECKHINTSLIMITS,
!ceGetChecked( hDlg, IDC_CHECKNOHINTS) ); !ceGetChecked( hDlg, IDC_CHECKNOHINTS) );
#endif #endif
ceDlgComboShowHide( &state->dlgHdr, PHONIES_COMBO );
} }
} /* adjustForChoice */ } /* adjustForChoice */
@ -170,8 +175,10 @@ loadCurPrefsFromState( CEAppGlobals* XP_UNUSED_STANDALONE(globals),
/* Reflect local state into the controls user will see. /* Reflect local state into the controls user will see.
*/ */
static void static void
loadControlsFromState( HWND hDlg, CePrefsDlgState* pState ) loadControlsFromState( CePrefsDlgState* pState )
{ {
HWND hDlg = pState->dlgHdr.hDlg;
CEAppGlobals* globals = pState->dlgHdr.globals;
CePrefsPrefs* prefsPrefs = &pState->prefsPrefs; CePrefsPrefs* prefsPrefs = &pState->prefsPrefs;
ceSetChecked( hDlg, IDC_CHECKCOLORPLAYED, prefsPrefs->showColors ); ceSetChecked( hDlg, IDC_CHECKCOLORPLAYED, prefsPrefs->showColors );
@ -191,7 +198,7 @@ loadControlsFromState( HWND hDlg, CePrefsDlgState* pState )
/* timer */ /* timer */
ceSetDlgItemNum( hDlg, TIMER_EDIT, prefsPrefs->gp.gameSeconds / 60 ); ceSetDlgItemNum( hDlg, TIMER_EDIT, prefsPrefs->gp.gameSeconds / 60 );
SendDlgItemMessage( hDlg, PHONIES_COMBO, SETCURSEL, SendDlgItemMessage( hDlg, pState->phonComboId, SETCURSEL(globals),
prefsPrefs->gp.phoniesAction, 0L ); prefsPrefs->gp.phoniesAction, 0L );
if ( !pState->isNewGame ) { if ( !pState->isNewGame ) {
@ -211,16 +218,19 @@ loadControlsFromState( HWND hDlg, CePrefsDlgState* pState )
* the values. * the values.
*/ */
static void static void
ceControlsToPrefs( HWND hDlg, CePrefsPrefs* prefsPrefs ) ceControlsToPrefs( CePrefsDlgState* state )
{ {
XP_S16 selIndex; XP_S16 selIndex;
CePrefsPrefs* prefsPrefs = &state->prefsPrefs;
HWND hDlg = state->dlgHdr.hDlg;
prefsPrefs->showColors = ceGetChecked( hDlg, IDC_CHECKCOLORPLAYED ); prefsPrefs->showColors = ceGetChecked( hDlg, IDC_CHECKCOLORPLAYED );
prefsPrefs->gp.robotSmartness prefsPrefs->gp.robotSmartness
= ceGetChecked( hDlg, IDC_CHECKSMARTROBOT ) ? 1 : 0; = ceGetChecked( hDlg, IDC_CHECKSMARTROBOT ) ? 1 : 0;
prefsPrefs->gp.hintsNotAllowed = ceGetChecked( hDlg, IDC_CHECKNOHINTS ); prefsPrefs->gp.hintsNotAllowed = ceGetChecked( hDlg, IDC_CHECKNOHINTS );
selIndex = (XP_U16)SendDlgItemMessage( hDlg, PHONIES_COMBO, GETCURSEL, selIndex = (XP_U16)SendDlgItemMessage( hDlg, state->phonComboId,
GETCURSEL(state->dlgHdr.globals),
0, 0 ); 0, 0 );
if ( selIndex != LB_ERR ) { if ( selIndex != LB_ERR ) {
prefsPrefs->gp.phoniesAction = (XWPhoniesChoice)selIndex; prefsPrefs->gp.phoniesAction = (XWPhoniesChoice)selIndex;
@ -255,12 +265,16 @@ PrefsDlg(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
SetWindowLong( hDlg, GWL_USERDATA, lParam ); SetWindowLong( hDlg, GWL_USERDATA, lParam );
pState = (CePrefsDlgState*)lParam; pState = (CePrefsDlgState*)lParam;
stuffPhoniesList( hDlg ); pState->phonComboId = LB_IF_PPC(pState->dlgHdr.globals,PHONIES_COMBO);
loadControlsFromState( hDlg, pState );
adjustForChoice( hDlg, pState );
ceDlgSetup( &pState->dlgHdr, hDlg, DLG_STATE_TRAPBACK ); ceDlgSetup( &pState->dlgHdr, hDlg, DLG_STATE_TRAPBACK );
ceDlgComboShowHide( &pState->dlgHdr, PHONIES_COMBO );
stuffPhoniesList( pState );
loadControlsFromState( pState );
adjustForChoice( pState );
return TRUE; return TRUE;
} else { } else {
@ -278,7 +292,7 @@ PrefsDlg(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
case IDC_RADIOGLOBAL: case IDC_RADIOGLOBAL:
case IDC_RADIOLOCAL: case IDC_RADIOLOCAL:
globals->doGlobalPrefs = id == IDC_RADIOGLOBAL; globals->doGlobalPrefs = id == IDC_RADIOGLOBAL;
adjustForChoice( hDlg, pState ); adjustForChoice( pState );
break; break;
case TIMER_CHECK: case TIMER_CHECK:
@ -300,7 +314,7 @@ PrefsDlg(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
#endif #endif
case IDOK: case IDOK:
ceControlsToPrefs( hDlg, &pState->prefsPrefs ); ceControlsToPrefs( pState );
case IDCANCEL: case IDCANCEL:
EndDialog(hDlg, id); EndDialog(hDlg, id);
pState->userCancelled = id == IDCANCEL; pState->userCancelled = id == IDCANCEL;

View file

@ -59,6 +59,8 @@ typedef struct CePrefsDlgState {
CeDlgHdr dlgHdr; CeDlgHdr dlgHdr;
CePrefsPrefs prefsPrefs; CePrefsPrefs prefsPrefs;
XP_U16 phonComboId;
XP_Bool userCancelled; XP_Bool userCancelled;
//XP_Bool doGlobalPrefs; /* state of the radio */ //XP_Bool doGlobalPrefs; /* state of the radio */
XP_Bool isNewGame; XP_Bool isNewGame;

View file

@ -1,6 +1,7 @@
/* -*- fill-column: 77; c-basic-offset: 4; compile-command: "make TARGET_OS=wince DEBUG=TRUE" -*- */ /* -*- fill-column: 77; compile-command: "make TARGET_OS=wince DEBUG=TRUE" -*- */
/* /*
* Copyright 2004-2008 by Eric House (xwords@eehouse.org). All rights reserved. * Copyright 2004-2008 by Eric House (xwords@eehouse.org). All rights
* reserved.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -108,11 +109,12 @@ SaveNameDlg( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam )
(void)GetDlgItemText( hDlg, IDC_SVGN_EDIT, buf, (void)GetDlgItemText( hDlg, IDC_SVGN_EDIT, buf,
VSIZE(buf) ); VSIZE(buf) );
if ( ceFileExists( buf ) ) { if ( ceFileExists( buf ) ) {
messageBoxChar( state->dlgHdr.globals, "File exists", messageBoxChar( state->dlgHdr.globals,
L"Oops!", MB_OK ); "File exists", L"Oops!", MB_OK );
break; break;
} }
swprintf( state->buf, DEFAULT_DIR_NAME L"\\%s.xwg", buf ); swprintf( state->buf, DEFAULT_DIR_NAME L"\\%s.xwg",
buf );
XP_LOGW( __func__, state->buf ); XP_LOGW( __func__, state->buf );
/* fallthru */ /* fallthru */
state->cancelled = XP_FALSE; state->cancelled = XP_FALSE;
@ -160,6 +162,7 @@ typedef struct CeSavedGamesState {
wchar_t curName[128]; wchar_t curName[128];
XP_U16 nItems; XP_U16 nItems;
XP_U16 gameListId;
XP_Bool opened; XP_Bool opened;
XP_Bool inited; XP_Bool inited;
XP_Bool relaunch; XP_Bool relaunch;
@ -167,11 +170,18 @@ typedef struct CeSavedGamesState {
/* Probably belongs as a utility */ /* Probably belongs as a utility */
static void static void
getCBText( HWND hDlg, XP_U16 id, XP_U16 sel, wchar_t* buf, XP_U16* lenp ) getCBText( CeSavedGamesState* state, XP_U16 id, XP_U16 sel, wchar_t* buf,
XP_U16* lenp )
{ {
XP_U16 len = SendDlgItemMessage( hDlg, id, GETLBTEXTLEN, sel, 0L ); HWND hDlg = state->dlgHdr.hDlg;
CEAppGlobals* globals = state->dlgHdr.globals;
XP_U16 len;
len = SendDlgItemMessage( hDlg, id, GETLBTEXTLEN(globals), sel, 0L );
if ( len < *lenp ) { if ( len < *lenp ) {
(void)SendDlgItemMessage( hDlg, id, GETLBTEXT, sel, (LPARAM)buf ); (void)SendDlgItemMessage( hDlg, id, GETLBTEXT(globals), sel,
(LPARAM)buf );
} else { } else {
XP_ASSERT( 0 ); XP_ASSERT( 0 );
} }
@ -185,8 +195,7 @@ getFullSelPath( CeSavedGamesState* state, wchar_t* buf, XP_U16 buflen )
lstrcpy( buf, DEFAULT_DIR_NAME L"\\" ); lstrcpy( buf, DEFAULT_DIR_NAME L"\\" );
len = lstrlen( buf ); len = lstrlen( buf );
buflen -= len; buflen -= len;
getCBText( state->dlgHdr.hDlg, IDC_SVGM_GAMELIST, state->sel, &buf[len], getCBText( state, state->gameListId, state->sel, &buf[len], &buflen );
&buflen );
lstrcat( buf, L".xwg" ); lstrcat( buf, L".xwg" );
} }
@ -208,6 +217,7 @@ initSavedGamesData( CeSavedGamesState* state )
{ {
HANDLE fileH; HANDLE fileH;
HWND hDlg = state->dlgHdr.hDlg; HWND hDlg = state->dlgHdr.hDlg;
CEAppGlobals* globals = state->dlgHdr.globals;
WIN32_FIND_DATA data; WIN32_FIND_DATA data;
wchar_t path[256]; wchar_t path[256];
XP_S16 curSel = -1; XP_S16 curSel = -1;
@ -231,14 +241,16 @@ initSavedGamesData( CeSavedGamesState* state )
numbers of saved games. */ numbers of saved games. */
for ( item = 0; item < nItems; ++item ) { for ( item = 0; item < nItems; ++item ) {
wchar_t buf[256]; wchar_t buf[256];
(void)SendDlgItemMessage( hDlg, IDC_SVGM_GAMELIST, GETLBTEXT, item, (void)SendDlgItemMessage( hDlg, state->gameListId,
GETLBTEXT(globals), item,
(LPARAM)buf ); (LPARAM)buf );
/* Does the current item belong above the one we're inserting? */ /* Does the current item belong above the one we're inserting? */
if ( 0 <= wcscmp( buf, data.cFileName ) ) { if ( 0 <= wcscmp( buf, data.cFileName ) ) {
break; break;
} }
} }
(void)SendDlgItemMessage( hDlg, IDC_SVGM_GAMELIST, INSERTSTRING, (void)SendDlgItemMessage( hDlg, state->gameListId,
INSERTSTRING(globals),
item, (LPARAM)data.cFileName ); item, (LPARAM)data.cFileName );
/* Remember which entry matches the currently opened game, and adjust /* Remember which entry matches the currently opened game, and adjust
@ -262,7 +274,8 @@ initSavedGamesData( CeSavedGamesState* state )
state->nItems = nItems; state->nItems = nItems;
state->openGameIndex = curSel; state->openGameIndex = curSel;
SendDlgItemMessage( hDlg, IDC_SVGM_GAMELIST, SETCURSEL, curSel, 0 ); SendDlgItemMessage( hDlg, state->gameListId,
SETCURSEL(globals), curSel, 0 );
state->sel = curSel; state->sel = curSel;
setButtons( state ); setButtons( state );
@ -313,7 +326,8 @@ deleteSelected( CeSavedGamesState* state )
"selected game? This action cannot be " "selected game? This action cannot be "
"undone."); "undone.");
if ( confirmed ) { if ( confirmed ) {
getCBText( state->dlgHdr.hDlg, IDC_SVGM_GAMELIST, state->sel, buf, &len ); getCBText( state, state->gameListId,
state->sel, buf, &len );
swprintf( path, DEFAULT_DIR_NAME L"\\%s.xwg", buf ); swprintf( path, DEFAULT_DIR_NAME L"\\%s.xwg", buf );
confirmed = DeleteFile( path ); confirmed = DeleteFile( path );
if ( confirmed ) { if ( confirmed ) {
@ -323,6 +337,19 @@ deleteSelected( CeSavedGamesState* state )
return confirmed; return confirmed;
} /* deleteSelected */ } /* deleteSelected */
static XP_Bool
tryGameChanged( CeSavedGamesState* state )
{
XP_S16 sel = SendDlgItemMessage( state->dlgHdr.hDlg, state->gameListId,
GETCURSEL(state->dlgHdr.globals), 0, 0L);
XP_Bool changing = sel >= 0 && state->sel != sel;
if ( changing ) {
state->sel = sel;
setButtons( state );
}
return changing;
} /* tryGameChanged */
static LRESULT CALLBACK static LRESULT CALLBACK
SavedGamesDlg( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam ) SavedGamesDlg( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam )
{ {
@ -334,8 +361,10 @@ SavedGamesDlg( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam )
state = (CeSavedGamesState*)lParam; state = (CeSavedGamesState*)lParam;
state->inited = XP_FALSE; state->inited = XP_FALSE;
state->gameListId = LB_IF_PPC(state->dlgHdr.globals,IDC_SVGM_GAMELIST);
ceDlgSetup( &state->dlgHdr, hDlg, DLG_STATE_NONE|DLG_STATE_DONEONLY ); ceDlgSetup( &state->dlgHdr, hDlg, DLG_STATE_NONE|DLG_STATE_DONEONLY );
ceDlgComboShowHide( &state->dlgHdr, IDC_SVGM_GAMELIST );
result = TRUE; result = TRUE;
} else { } else {
@ -349,17 +378,15 @@ SavedGamesDlg( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam )
if ( ceDoDlgHandle( &state->dlgHdr, message, wParam, lParam) ) { if ( ceDoDlgHandle( &state->dlgHdr, message, wParam, lParam) ) {
result = TRUE; result = TRUE;
} else if ( WM_NOTIFY == message ) {
result = tryGameChanged( state );
} else if ( message == WM_COMMAND ) { } else if ( message == WM_COMMAND ) {
XP_U16 wid = LOWORD(wParam); XP_U16 wid = LOWORD(wParam);
if ( (IDC_SVGM_GAMELIST == wid)
&& (CBN_SELCHANGE == HIWORD(wParam)) ) { if ( CBN_SELCHANGE == HIWORD(wParam) ) {
XP_S16 sel = SendDlgItemMessage( hDlg, IDC_SVGM_GAMELIST, if (state->gameListId == wid ) {
GETCURSEL, 0, 0L); result = tryGameChanged( state );
if ( sel >= 0 ) {
state->sel = sel;
setButtons( state );
} }
result = TRUE;
} else if ( BN_CLICKED == HIWORD(wParam) ) { } else if ( BN_CLICKED == HIWORD(wParam) ) {
switch( wid ) { switch( wid ) {
case IDC_SVGM_DUP: case IDC_SVGM_DUP:
@ -375,9 +402,10 @@ SavedGamesDlg( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam )
case IDC_SVGM_OPEN: { case IDC_SVGM_OPEN: {
wchar_t buf[128]; wchar_t buf[128];
XP_U16 len = VSIZE(buf); XP_U16 len = VSIZE(buf);
getCBText( hDlg, IDC_SVGM_GAMELIST, state->sel, getCBText( state, state->gameListId, state->sel,
buf, &len ); buf, &len );
swprintf( state->buf, DEFAULT_DIR_NAME L"\\%s.xwg", buf ); swprintf( state->buf, DEFAULT_DIR_NAME L"\\%s.xwg",
buf );
XP_LOGW( "returning", state->buf ); XP_LOGW( "returning", state->buf );
state->opened = XP_TRUE; state->opened = XP_TRUE;
} }

View file

@ -120,15 +120,6 @@ ceGetDlgItemNum( HWND hDlg, XP_U16 id )
return result; return result;
} /* ceGetDlgItemNum */ } /* ceGetDlgItemNum */
void
ce_selectAndShow( HWND hDlg, XP_U16 resID, XP_U16 index )
{
SendDlgItemMessage( hDlg, resID, SETCURSEL, index, 0 );
#ifdef _WIN32_WCE
SendDlgItemMessage( hDlg, resID, LB_SETANCHORINDEX, index, 0 );
#endif
} /* ce_selectAndShow */
void void
ceShowOrHide( HWND hDlg, XP_U16 resID, XP_Bool visible ) ceShowOrHide( HWND hDlg, XP_U16 resID, XP_Bool visible )
{ {
@ -398,6 +389,19 @@ ceDlgSetup( CeDlgHdr* dlgHdr, HWND hDlg, DlgStateTask doWhat )
dlgHdr->doWhat = doWhat; dlgHdr->doWhat = doWhat;
} /* ceDlgSetup */ } /* ceDlgSetup */
void
ceDlgComboShowHide( CeDlgHdr* dlgHdr, XP_U16 baseId )
{
HWND hDlg = dlgHdr->hDlg;
if ( IS_SMARTPHONE(dlgHdr->globals) ) {
ceShowOrHide( hDlg, baseId+2, XP_FALSE );
} else {
ceShowOrHide( hDlg, baseId, XP_FALSE );
ceShowOrHide( hDlg, baseId+1, XP_FALSE );
}
}
XP_Bool XP_Bool
ceDoDlgHandle( CeDlgHdr* dlgHdr, UINT message, WPARAM wParam, LPARAM lParam ) ceDoDlgHandle( CeDlgHdr* dlgHdr, UINT message, WPARAM wParam, LPARAM lParam )
{ {

View file

@ -57,6 +57,7 @@ typedef struct CeDlgHdr {
XP_U16 nPage; XP_U16 nPage;
} CeDlgHdr; } CeDlgHdr;
void ceDlgSetup( CeDlgHdr* dlgHdr, HWND hDlg, DlgStateTask doWhat ); void ceDlgSetup( CeDlgHdr* dlgHdr, HWND hDlg, DlgStateTask doWhat );
void ceDlgComboShowHide( CeDlgHdr* dlgHdr, XP_U16 baseId );
XP_Bool ceDoDlgHandle( CeDlgHdr* dlgHdr, UINT message, WPARAM wParam, LPARAM lParam); XP_Bool ceDoDlgHandle( CeDlgHdr* dlgHdr, UINT message, WPARAM wParam, LPARAM lParam);
/* Are we drawing things in landscape mode? */ /* Are we drawing things in landscape mode? */

View file

@ -50,17 +50,12 @@
#define IDC_COMBO1 1021 #define IDC_COMBO1 1021
#define PLAYERNUM_COMBO 1022 #define PLAYERNUM_COMBO 1022
#define IDC_NPLAYERSCOMBO 1023
#define TIMER_CHECK 1024 #define TIMER_CHECK 1024
#define NAME_EDIT5 1025 #define NAME_EDIT5 1025
#define TIMER_EDIT 1026 #define TIMER_EDIT 1026
#define IDC_DICTLIST 1027
#define IDC_DICTUPDOWN 1028
#define BLANKFACE_COMBO 1029 #define BLANKFACE_COMBO 1029
#define PHONIES_COMBO 1030
#define IDC_PWDLABEL 1031 #define IDC_PWDLABEL 1031
#define PASS_EDIT 1032 #define PASS_EDIT 1032
#define BLANKFACE_LIST 1033
#define IDC_NPLAYERSLIST 1034 #define IDC_NPLAYERSLIST 1034
#define OPTIONS_BUTTON 1035 #define OPTIONS_BUTTON 1035
#define IDC_RADIOGLOBAL 1036 #define IDC_RADIOGLOBAL 1036
@ -144,48 +139,38 @@
# define CLSAMPLE_BUTTON_ID 1123 # define CLSAMPLE_BUTTON_ID 1123
#endif // MY_COLOR_SEL #endif // MY_COLOR_SEL
#define HC_MIN_COMBO 1100 #define IDC_CCONVIA_LAB 1106
#define HC_MAX_COMBO 1101
#define IDC_CCONVIA_LAB 1102 #define IDC_COOKIE_LAB 1107
#define IDC_COOKIE_LAB 1103
#ifdef XWFEATURE_RELAY #ifdef XWFEATURE_RELAY
# define IDC_CRELAYNAME_LAB 1104 # define IDC_CRELAYNAME_LAB 1108
# define IDC_CRELAYPORT_LAB 1105 # define IDC_CRELAYPORT_LAB 1109
# define IDC_CRELAYHINT_LAB 1106 # define IDC_CRELAYHINT_LAB 1110
# define IDC_CONNECTCOMBO 1107 # define IDC_CONNECTCOMBO 1111
# define RELAYNAME_EDIT 1108 # define RELAYNAME_EDIT 1112
# define RELAYPORT_EDIT 1109 # define RELAYPORT_EDIT 1113
# define COOKIE_EDIT 1110 # define COOKIE_EDIT 1114
#endif #endif
#define IDC_BLUET_ADDR_LAB 1111 #define IDC_BLUET_ADDR_LAB 1115
#ifdef XWFEATURE_BLUETOOTH #ifdef XWFEATURE_BLUETOOTH
# define IDC_BLUET_ADDR_EDIT 1112 # define IDC_BLUET_ADDR_EDIT 1116
# define IDC_BLUET_ADDR_BROWSE 1113 # define IDC_BLUET_ADDR_BROWSE 1117
#endif #endif
#define IDS_UPDOWN 1114 /* #define IDS_UPDOWN 1118 */
#define IDC_NPLAYERSUPDOWN 1115
#define IDC_PHONIESUPDOWN 1116
#define IDC_SVGM_UPDOWN 1117
#define IDC_ASKBLANK_UPDOWN 1124
#define HC_MIN_UPDOWN 1125
#define HC_MAX_UPDOWN 1126
#define IDC_SVGM_SELLAB 1118 #define IDC_SVGM_SELLAB 1127
#define IDC_SVGM_GAMELIST 1119
/* Let's remove these until they're implemented */ /* Let's remove these until they're implemented */
#define IDC_SVGM_EDITLAB 1111 #define IDC_SVGM_EDITLAB 1131
#define IDC_SVGM_CHANGE 1112 #define IDC_SVGM_CHANGE 1130
#define IDC_SVGM_DUP 1114 #define IDC_SVGM_DUP 1129
#define IDC_SVGM_DEL 1115 #define IDC_SVGM_DEL 1128
#define IDC_SVGM_OPEN 1120 #define IDC_SVGM_OPEN 1120
#define IDC_SVGN_SELLAB 1121 #define IDC_SVGN_SELLAB 1125
#define IDC_SVGN_EDIT 1122 #define IDC_SVGN_EDIT 1122
@ -238,6 +223,34 @@
#define IDS_DUPENAME 40031 #define IDS_DUPENAME 40031
#define IDS_RENAME 40032 #define IDS_RENAME 40032
// These are in sets of three, and must be consecutive and in the right order within each set
#define PHONIES_COMBO 1200
#define IDC_PHONIESUPDOWN 1201
#define PHONIES_COMBO_PPC 1202
#define HC_MIN_COMBO 1203
#define HC_MIN_UPDOWN 1204
#define HC_MIN_COMBO_PPC 1205
#define HC_MAX_COMBO 1206
#define HC_MAX_UPDOWN 1207
#define HC_MAX_COMBO_PPC 1208
#define IDC_SVGM_GAMELIST 1209
#define IDC_SVGM_UPDOWN 1210
#define IDC_SVGM_GAMELIST_PPC 1211
#define BLANKFACE_LIST 1212
#define IDC_ASKBLANK_UPDOWN 1213
#define BLANKFACE_LIST_PPC 1214
#define IDC_DICTLIST 1215
#define IDC_DICTUPDOWN 1216
#define IDC_DICTLIST_PPC 1217
#define IDC_NPLAYERSCOMBO 1218
#define IDC_NPLAYERSUPDOWN 1219
#define IDC_NPLAYERSCOMBO_PPC 1220
// Next default values for new objects // Next default values for new objects
// //
@ -245,7 +258,7 @@
#ifndef APSTUDIO_READONLY_SYMBOLS #ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 125 #define _APS_NEXT_RESOURCE_VALUE 125
#define _APS_NEXT_COMMAND_VALUE 40033 #define _APS_NEXT_COMMAND_VALUE 40033
#define _APS_NEXT_CONTROL_VALUE 1127 #define _APS_NEXT_CONTROL_VALUE 1128
#define _APS_NEXT_SYMED_VALUE 101 #define _APS_NEXT_SYMED_VALUE 101
#endif #endif
#endif #endif

View file

@ -96,7 +96,7 @@ BEGIN
MENUITEM "Limited hint", ID_MOVE_LIMITEDHINT MENUITEM "Limited hint", ID_MOVE_LIMITEDHINT
#endif #endif
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "Tile values", ID_MOVE_VALUES MENUITEM "Toggle values", ID_MOVE_VALUES
END END
POPUP "Game" POPUP "Game"
@ -164,9 +164,13 @@ END
#endif #endif
#ifdef _WIN32_WCE #ifdef _WIN32_WCE
# define UDS_EXPANDABLE 0x0200
# define UDS_NOSCROLL 0x0400
# define LISTBOX_CONTROL_FLAGS \
NOT LBS_NOTIFY | LBS_SORT | LBS_NOINTEGRALHEIGHT | NOT WS_BORDER | WS_TABSTOP
# define SPINNER_CONTROL_FLAGS \ # define SPINNER_CONTROL_FLAGS \
UDS_AUTOBUDDY | UDS_HORZ | UDS_ALIGNRIGHT | UDS_WRAP | /*UDS_ARROWKEYS |*/\ UDS_AUTOBUDDY | UDS_HORZ | UDS_ALIGNRIGHT | UDS_ARROWKEYS |\
UDS_SETBUDDYINT | UDS_EXPANDABLE | UDS_NOSCROLL UDS_SETBUDDYINT | UDS_EXPANDABLE
#endif #endif
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
@ -231,9 +235,6 @@ END
#define CHECK_WIDTH 10 #define CHECK_WIDTH 10
/* Not in cegcc's mingw headers yet */
#define UDS_EXPANDABLE 0x0200
#define UDS_NOSCROLL 0x0400
/* in commctrl.h, but including isn't enough */ /* in commctrl.h, but including isn't enough */
#undef UPDOWN_CLASS #undef UPDOWN_CLASS
#define UPDOWN_CLASS "msctls_updown32" #define UPDOWN_CLASS "msctls_updown32"
@ -252,17 +253,13 @@ BEGIN
LTEXT "",IDC_TOTAL_LABEL,LEFT_COL,NPLAYERS_ROW,43,8 LTEXT "",IDC_TOTAL_LABEL,LEFT_COL,NPLAYERS_ROW,43,8
#ifdef _WIN32_WCE #ifdef _WIN32_WCE
LISTBOX IDC_NPLAYERSCOMBO, 46, NPLAYERS_ROW, 24, 12, WS_TABSTOP LISTBOX IDC_NPLAYERSCOMBO, 46, NPLAYERS_ROW, 24, 12,LISTBOX_CONTROL_FLAGS
CONTROL "", IDC_NPLAYERSUPDOWN, UPDOWN_CLASS, SPINNER_CONTROL_FLAGS, CONTROL "", IDC_NPLAYERSUPDOWN, UPDOWN_CLASS, SPINNER_CONTROL_FLAGS,
0, 0, 0, 0 0, 0, 0, 0
#else
COMBOBOX IDC_NPLAYERSCOMBO,46,NPLAYERS_ROW,24,58,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
#endif #endif
COMBOBOX IDC_NPLAYERSCOMBO_PPC,46,NPLAYERS_ROW,24,58,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
// "R" for rearrange. Go to J if no change becomes possible.
PUSHBUTTON "Jugl.",GIJUGGLE_BUTTON,75,NPLAYERS_ROW,20,12 PUSHBUTTON "Jugl.",GIJUGGLE_BUTTON,75,NPLAYERS_ROW,20,12
LTEXT "Name",IDC_STATIC,GAME_NAMELABEL_LEFT, LTEXT "Name",IDC_STATIC,GAME_NAMELABEL_LEFT,
@ -312,13 +309,12 @@ BEGIN
LTEXT "Dictionary:",IDC_STATIC,LEFT_COL,DICTPICK_LAB_ROW,36,8, LTEXT "Dictionary:",IDC_STATIC,LEFT_COL,DICTPICK_LAB_ROW,36,8,
SS_NOPREFIX SS_NOPREFIX
#ifdef _WIN32_WCE #ifdef _WIN32_WCE
LISTBOX IDC_DICTLIST, LEFT_COL+10,DICTPICK_ROW,70,12, WS_TABSTOP LISTBOX IDC_DICTLIST, LEFT_COL+10,DICTPICK_ROW,70,12,LISTBOX_CONTROL_FLAGS
CONTROL "", IDC_DICTUPDOWN, UPDOWN_CLASS, SPINNER_CONTROL_FLAGS, CONTROL "", IDC_DICTUPDOWN, UPDOWN_CLASS, SPINNER_CONTROL_FLAGS,
0, 0, 0, 0 0, 0, 0, 0
#else
COMBOBOX IDC_DICTLIST,LEFT_COL+10,DICTPICK_ROW,70,58,
CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
#endif #endif
COMBOBOX IDC_DICTLIST_PPC,LEFT_COL+10,DICTPICK_ROW,70,58,
CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "Preferences...",OPTIONS_BUTTON,LEFT_COL,PREFS_ROW,55,12 PUSHBUTTON "Preferences...",OPTIONS_BUTTON,LEFT_COL,PREFS_ROW,55,12
@ -367,17 +363,16 @@ BEGIN
#endif #endif
#ifdef _WIN32_WCE #ifdef _WIN32_WCE
LISTBOX BLANKFACE_LIST,65,8,25,12,WS_TABSTOP LISTBOX BLANKFACE_LIST,65,8,25,12,LISTBOX_CONTROL_FLAGS
CONTROL "", IDC_ASKBLANK_UPDOWN, UPDOWN_CLASS, SPINNER_CONTROL_FLAGS, CONTROL "", IDC_ASKBLANK_UPDOWN, UPDOWN_CLASS, SPINNER_CONTROL_FLAGS,
0, 0, 0, 0 0, 0, 0, 0
#else #endif
COMBOBOX BLANKFACE_LIST,60,5,25,12, COMBOBOX BLANKFACE_LIST_PPC,60,5,25,12,
CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
#ifndef _WIN32_WCE
DEFPUSHBUTTON "OK",IDOK,70,70,REPOS_BUTTON_WIDTH, BUTTON_HT DEFPUSHBUTTON "OK",IDOK,70,70,REPOS_BUTTON_WIDTH, BUTTON_HT
PUSHBUTTON "Cancel",IDCANCEL,20,70,REPOS_BUTTON_WIDTH, BUTTON_HT PUSHBUTTON "Cancel",IDCANCEL,20,70,REPOS_BUTTON_WIDTH, BUTTON_HT
#endif #endif
END END
#define SVGN_LEFT_COL 2 #define SVGN_LEFT_COL 2
@ -432,14 +427,12 @@ BEGIN
IDC_SVGM_SELLAB,SVGM_LEFT_COL, IDC_SVGM_SELLAB,SVGM_LEFT_COL,
SVGM_ROW_1,90,35 SVGM_ROW_1,90,35
#ifdef _WIN32_WCE #ifdef _WIN32_WCE
LISTBOX IDC_SVGM_GAMELIST, SVGM_LEFT_COL,SVGM_ROW_2,70,12, LISTBOX IDC_SVGM_GAMELIST, SVGM_LEFT_COL,SVGM_ROW_2,70,12,LISTBOX_CONTROL_FLAGS
WS_TABSTOP
CONTROL "", IDC_SVGM_UPDOWN, UPDOWN_CLASS, SPINNER_CONTROL_FLAGS, CONTROL "", IDC_SVGM_UPDOWN, UPDOWN_CLASS, SPINNER_CONTROL_FLAGS,
0, 0, 0, 0 0, 0, 0, 0
#else
COMBOBOX IDC_SVGM_GAMELIST,SVGM_LEFT_COL,SVGM_ROW_2,70,58,
CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
#endif #endif
COMBOBOX IDC_SVGM_GAMELIST_PPC,SVGM_LEFT_COL,SVGM_ROW_2,70,58,
CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "Open",IDC_SVGM_OPEN, PUSHBUTTON "Open",IDC_SVGM_OPEN,
SVGM_LEFT_COL,SVGM_ROW_3,40,14,WS_DISABLED SVGM_LEFT_COL,SVGM_ROW_3,40,14,WS_DISABLED
@ -502,24 +495,21 @@ FONT 8, "System"
BEGIN BEGIN
LTEXT "Use at least:",IDC_STATIC,HC_LABELS_COL,HC_MINROW,60,8 LTEXT "Use at least:",IDC_STATIC,HC_LABELS_COL,HC_MINROW,60,8
#ifdef _WIN32_WCE #ifdef _WIN32_WCE
LISTBOX HC_MIN_COMBO, HC_DROPDOWNS_COL,HC_MINROW, 24, 12, WS_TABSTOP LISTBOX HC_MIN_COMBO, HC_DROPDOWNS_COL,HC_MINROW, 24, 12, LISTBOX_CONTROL_FLAGS
CONTROL "", HC_MIN_UPDOWN, UPDOWN_CLASS, SPINNER_CONTROL_FLAGS, CONTROL "", HC_MIN_UPDOWN, UPDOWN_CLASS, SPINNER_CONTROL_FLAGS,
0, 0, 0, 0 0, 0, 0, 0
#else
COMBOBOX HC_MIN_COMBO,HC_DROPDOWNS_COL,HC_MINROW,17,58,
CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
#endif #endif
COMBOBOX HC_MIN_COMBO_PPC,HC_DROPDOWNS_COL,HC_MINROW,17,58,
CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "But no more than:",IDC_STATIC,HC_LABELS_COL,HC_MAXROW,60,8 LTEXT "But no more than:",IDC_STATIC,HC_LABELS_COL,HC_MAXROW,60,8
#ifdef _WIN32_WCE #ifdef _WIN32_WCE
LISTBOX HC_MAX_COMBO, HC_DROPDOWNS_COL,HC_MAXROW, 24, 12, WS_TABSTOP LISTBOX HC_MAX_COMBO, HC_DROPDOWNS_COL,HC_MAXROW, 24, 12, LISTBOX_CONTROL_FLAGS
CONTROL "", HC_MAX_UPDOWN, UPDOWN_CLASS, SPINNER_CONTROL_FLAGS, CONTROL "", HC_MAX_UPDOWN, UPDOWN_CLASS, SPINNER_CONTROL_FLAGS,
0, 0, 0, 0 0, 0, 0, 0
#else
COMBOBOX HC_MAX_COMBO,HC_DROPDOWNS_COL,HC_MAXROW,17,58,
CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
#endif #endif
COMBOBOX HC_MAX_COMBO_PPC,HC_DROPDOWNS_COL,HC_MAXROW,17,58,
CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
#ifndef _WIN32_WCE #ifndef _WIN32_WCE
DEFPUSHBUTTON "OK",IDOK,HC_OK_LEFT,31,REPOS_BUTTON_WIDTH,REPOS_BUTTON_HT DEFPUSHBUTTON "OK",IDOK,HC_OK_LEFT,31,REPOS_BUTTON_WIDTH,REPOS_BUTTON_HT
PUSHBUTTON "Cancel",IDCANCEL,HC_CANCEL_LEFT,31,REPOS_BUTTON_WIDTH, PUSHBUTTON "Cancel",IDCANCEL,HC_CANCEL_LEFT,31,REPOS_BUTTON_WIDTH,
@ -578,13 +568,13 @@ BEGIN
EDITTEXT TIMER_EDIT,80,PR_ROW5,16,12,ES_AUTOHSCROLL | ES_NUMBER EDITTEXT TIMER_EDIT,80,PR_ROW5,16,12,ES_AUTOHSCROLL | ES_NUMBER
LTEXT "Phonies:",PHONIES_LABEL,8,PR_ROW6,28,PREFS_ROW_HT LTEXT "Phonies:",PHONIES_LABEL,8,PR_ROW6,28,PREFS_ROW_HT
#ifdef _WIN32_WCE #ifdef _WIN32_WCE
LISTBOX PHONIES_COMBO, 38,PR_ROW6,50,12, WS_TABSTOP LISTBOX PHONIES_COMBO, 38,PR_ROW6,50,12, LISTBOX_CONTROL_FLAGS
CONTROL "", IDC_PHONIESUPDOWN, UPDOWN_CLASS, SPINNER_CONTROL_FLAGS, CONTROL "", IDC_PHONIESUPDOWN, UPDOWN_CLASS, SPINNER_CONTROL_FLAGS,
0, 0, 0, 0 0, 0, 0, 0
#else
COMBOBOX PHONIES_COMBO,38,PR_ROW6,40,58,CBS_DROPDOWNLIST | WS_VSCROLL |
WS_TABSTOP
#endif #endif
COMBOBOX PHONIES_COMBO_PPC,38,PR_ROW6,40,58,CBS_DROPDOWNLIST | WS_VSCROLL |
WS_TABSTOP
#ifdef FEATURE_TRAY_EDIT #ifdef FEATURE_TRAY_EDIT
CONTROL "Pick tiles face-up", IDC_PICKTILES, "Button", CONTROL "Pick tiles face-up", IDC_PICKTILES, "Button",
BS_AUTOCHECKBOX | WS_TABSTOP,8,PR_ROW7,90,PREFS_ROW_HT BS_AUTOCHECKBOX | WS_TABSTOP,8,PR_ROW7,90,PREFS_ROW_HT
@ -649,10 +639,11 @@ BEGIN
LTEXT "Bluetooth not supported.", LTEXT "Bluetooth not supported.",
IDC_BLUET_ADDR_LAB,LAB_COL,CONN_ROW_2,40,12 IDC_BLUET_ADDR_LAB,LAB_COL,CONN_ROW_2,40,12
#endif #endif
#ifndef _WIN32_WCE
PUSHBUTTON "OK",IDOK,9,BUTTON_ROW,REPOS_BUTTON_WIDTH,REPOS_BUTTON_HT PUSHBUTTON "OK",IDOK,9,BUTTON_ROW,REPOS_BUTTON_WIDTH,REPOS_BUTTON_HT
DEFPUSHBUTTON "Cancel",IDCANCEL,70,BUTTON_ROW, DEFPUSHBUTTON "Cancel",IDCANCEL,70,BUTTON_ROW,
REPOS_BUTTON_WIDTH,REPOS_BUTTON_HT REPOS_BUTTON_WIDTH,REPOS_BUTTON_HT
#endif
END END
#endif #endif