mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-27 07:58:49 +01:00
Use nwgamest support for separate config button beside role combo, and
remove hack responding to tap (without change) on that combo.
This commit is contained in:
parent
cb72b3ffef
commit
f874183475
3 changed files with 33 additions and 41 deletions
|
@ -325,27 +325,34 @@ handlePrefsButton( HWND hDlg, CEAppGlobals* globals, GameInfoState* state )
|
|||
|
||||
#ifndef XWFEATURE_STANDALONE_ONLY
|
||||
static void
|
||||
handleConnOptionsButton( GameInfoState* state, DeviceRole role )
|
||||
callConnsDlg( GameInfoState* state )
|
||||
{
|
||||
if ( WrapConnsDlg( state->dlgHdr.hDlg, state->dlgHdr.globals,
|
||||
&state->prefsPrefs.addrRec,
|
||||
&state->prefsPrefs.addrRec, state->lastRole,
|
||||
state->isNewGame ) ) {
|
||||
state->addrChanged = XP_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
handleConnOptionsButton( GameInfoState* state )
|
||||
{
|
||||
HWND hDlg = state->dlgHdr.hDlg;
|
||||
CEAppGlobals* globals = state->dlgHdr.globals;
|
||||
DeviceRole role;
|
||||
NGValue value;
|
||||
|
||||
if ( role == SERVER_STANDALONE ) {
|
||||
NGValue value;
|
||||
role = (DeviceRole)SendDlgItemMessage( hDlg,
|
||||
state->roleComboId,
|
||||
GETCURSEL(globals), 0,
|
||||
0L);
|
||||
value.ng_role = role;
|
||||
newg_attrChanged( state->newGameCtx, NG_ATTR_ROLE, value );
|
||||
}
|
||||
role = (DeviceRole)SendDlgItemMessage( hDlg, state->roleComboId,
|
||||
GETCURSEL(globals), 0, 0L);
|
||||
value.ng_role = role;
|
||||
newg_attrChanged( state->newGameCtx, NG_ATTR_ROLE, value );
|
||||
|
||||
state->lastRole = role;
|
||||
if ( role != SERVER_STANDALONE) {
|
||||
if ( WrapConnsDlg( hDlg, globals, &state->prefsPrefs.addrRec,
|
||||
&state->prefsPrefs.addrRec, role,
|
||||
state->isNewGame ) ) {
|
||||
state->addrChanged = XP_TRUE;
|
||||
if ( state->lastRole != role ) {
|
||||
state->lastRole = role;
|
||||
if ( role != SERVER_STANDALONE ) {
|
||||
callConnsDlg( state );
|
||||
}
|
||||
}
|
||||
} /* handleConnOptionsButton */
|
||||
|
@ -387,6 +394,9 @@ resIDForAttr( GameInfoState* state, NewGameAttr attr )
|
|||
case NG_ATTR_ROLE:
|
||||
resID = state->roleComboId;
|
||||
break;
|
||||
case NG_ATTR_CANCONFIG:
|
||||
resID = GIROLECONF_BUTTON;
|
||||
break;
|
||||
case NG_ATTR_REMHEADER:
|
||||
resID = IDC_REMOTE_LABEL;
|
||||
break;
|
||||
|
@ -582,26 +592,10 @@ checkUpdateCombo( GameInfoState* state, XP_U16 id )
|
|||
}
|
||||
} else if ( id == state->roleComboId ) {
|
||||
XP_ASSERT( SERVER_STANDALONE == 0 );
|
||||
handleConnOptionsButton( state, SERVER_STANDALONE );
|
||||
handleConnOptionsButton( state );
|
||||
}
|
||||
} /* checkUpdateCombo */
|
||||
|
||||
/* If we're mid-game and can't change role, click on role dropdown should
|
||||
* still bring up conns dialog in read-only mode.
|
||||
*/
|
||||
static void
|
||||
checkRoleClick( GameInfoState* state, XP_U16 xx, XP_U16 yy )
|
||||
{
|
||||
RECT rect;
|
||||
ceGetItemRect( state->dlgHdr.hDlg, state->roleComboId, &rect );
|
||||
|
||||
/* Isn't there API for PtInRect? */
|
||||
if ( xx > rect.left && xx < rect.right
|
||||
&& yy > rect.top && yy < rect.bottom ) {
|
||||
handleConnOptionsButton( state, state->lastRole );
|
||||
}
|
||||
} /* checkRoleClick */
|
||||
|
||||
LRESULT CALLBACK
|
||||
GameInfo(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
|
@ -674,12 +668,6 @@ GameInfo(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
|
|||
}
|
||||
break;
|
||||
|
||||
case WM_LBUTTONUP:
|
||||
if ( !state->isNewGame ) {
|
||||
checkRoleClick( state, LOWORD(lParam), HIWORD(lParam) );
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_COMMAND:
|
||||
result = TRUE;
|
||||
id = LOWORD(wParam);
|
||||
|
@ -713,9 +701,12 @@ GameInfo(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
|
|||
if ( HIWORD(wParam) == CBN_SELCHANGE ) {
|
||||
/* If we've switched to a state where we'll be
|
||||
connecting */
|
||||
handleConnOptionsButton( state, SERVER_STANDALONE );
|
||||
handleConnOptionsButton( state );
|
||||
}
|
||||
break;
|
||||
case GIROLECONF_BUTTON:
|
||||
callConnsDlg( state );
|
||||
break;
|
||||
#endif
|
||||
case GIJUGGLE_BUTTON:
|
||||
XP_ASSERT( state->isNewGame );
|
||||
|
|
|
@ -74,7 +74,7 @@
|
|||
#define IDC_PREFCOLORS 1045
|
||||
#define IDC_PREFFONTS 1046
|
||||
#define PHONIES_LABEL 1048
|
||||
/* #define IDC_ROLECOMBO 1049 */
|
||||
#define GIROLECONF_BUTTON 1049
|
||||
#define GIJUGGLE_BUTTON 1050
|
||||
#define IDC_TOTAL_LABEL 1051
|
||||
#define IDC_REMOTE_LABEL 1052
|
||||
|
|
|
@ -271,6 +271,7 @@ BEGIN
|
|||
#endif
|
||||
COMBOBOX IDC_ROLECOMBO_PPC,25,SERVERROLE_ROW,50,58,CBS_DROPDOWNLIST |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
PUSHBUTTON "Conf.",GIROLECONF_BUTTON,75,SERVERROLE_ROW,20,ROW_HEIGHT
|
||||
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue