mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-28 07:58:08 +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
|
#ifndef XWFEATURE_STANDALONE_ONLY
|
||||||
static void
|
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;
|
HWND hDlg = state->dlgHdr.hDlg;
|
||||||
CEAppGlobals* globals = state->dlgHdr.globals;
|
CEAppGlobals* globals = state->dlgHdr.globals;
|
||||||
|
DeviceRole role;
|
||||||
|
NGValue value;
|
||||||
|
|
||||||
if ( role == SERVER_STANDALONE ) {
|
role = (DeviceRole)SendDlgItemMessage( hDlg, state->roleComboId,
|
||||||
NGValue value;
|
GETCURSEL(globals), 0, 0L);
|
||||||
role = (DeviceRole)SendDlgItemMessage( hDlg,
|
value.ng_role = role;
|
||||||
state->roleComboId,
|
newg_attrChanged( state->newGameCtx, NG_ATTR_ROLE, value );
|
||||||
GETCURSEL(globals), 0,
|
|
||||||
0L);
|
|
||||||
value.ng_role = role;
|
|
||||||
newg_attrChanged( state->newGameCtx, NG_ATTR_ROLE, value );
|
|
||||||
}
|
|
||||||
|
|
||||||
state->lastRole = role;
|
if ( state->lastRole != role ) {
|
||||||
if ( role != SERVER_STANDALONE) {
|
state->lastRole = role;
|
||||||
if ( WrapConnsDlg( hDlg, globals, &state->prefsPrefs.addrRec,
|
if ( role != SERVER_STANDALONE ) {
|
||||||
&state->prefsPrefs.addrRec, role,
|
callConnsDlg( state );
|
||||||
state->isNewGame ) ) {
|
|
||||||
state->addrChanged = XP_TRUE;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} /* handleConnOptionsButton */
|
} /* handleConnOptionsButton */
|
||||||
|
@ -387,6 +394,9 @@ resIDForAttr( GameInfoState* state, NewGameAttr attr )
|
||||||
case NG_ATTR_ROLE:
|
case NG_ATTR_ROLE:
|
||||||
resID = state->roleComboId;
|
resID = state->roleComboId;
|
||||||
break;
|
break;
|
||||||
|
case NG_ATTR_CANCONFIG:
|
||||||
|
resID = GIROLECONF_BUTTON;
|
||||||
|
break;
|
||||||
case NG_ATTR_REMHEADER:
|
case NG_ATTR_REMHEADER:
|
||||||
resID = IDC_REMOTE_LABEL;
|
resID = IDC_REMOTE_LABEL;
|
||||||
break;
|
break;
|
||||||
|
@ -582,26 +592,10 @@ checkUpdateCombo( GameInfoState* state, XP_U16 id )
|
||||||
}
|
}
|
||||||
} else if ( id == state->roleComboId ) {
|
} else if ( id == state->roleComboId ) {
|
||||||
XP_ASSERT( SERVER_STANDALONE == 0 );
|
XP_ASSERT( SERVER_STANDALONE == 0 );
|
||||||
handleConnOptionsButton( state, SERVER_STANDALONE );
|
handleConnOptionsButton( state );
|
||||||
}
|
}
|
||||||
} /* checkUpdateCombo */
|
} /* 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
|
LRESULT CALLBACK
|
||||||
GameInfo(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
|
GameInfo(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
|
@ -674,12 +668,6 @@ GameInfo(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_LBUTTONUP:
|
|
||||||
if ( !state->isNewGame ) {
|
|
||||||
checkRoleClick( state, LOWORD(lParam), HIWORD(lParam) );
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WM_COMMAND:
|
case WM_COMMAND:
|
||||||
result = TRUE;
|
result = TRUE;
|
||||||
id = LOWORD(wParam);
|
id = LOWORD(wParam);
|
||||||
|
@ -713,9 +701,12 @@ GameInfo(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
if ( HIWORD(wParam) == CBN_SELCHANGE ) {
|
if ( HIWORD(wParam) == CBN_SELCHANGE ) {
|
||||||
/* If we've switched to a state where we'll be
|
/* If we've switched to a state where we'll be
|
||||||
connecting */
|
connecting */
|
||||||
handleConnOptionsButton( state, SERVER_STANDALONE );
|
handleConnOptionsButton( state );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case GIROLECONF_BUTTON:
|
||||||
|
callConnsDlg( state );
|
||||||
|
break;
|
||||||
#endif
|
#endif
|
||||||
case GIJUGGLE_BUTTON:
|
case GIJUGGLE_BUTTON:
|
||||||
XP_ASSERT( state->isNewGame );
|
XP_ASSERT( state->isNewGame );
|
||||||
|
|
|
@ -74,7 +74,7 @@
|
||||||
#define IDC_PREFCOLORS 1045
|
#define IDC_PREFCOLORS 1045
|
||||||
#define IDC_PREFFONTS 1046
|
#define IDC_PREFFONTS 1046
|
||||||
#define PHONIES_LABEL 1048
|
#define PHONIES_LABEL 1048
|
||||||
/* #define IDC_ROLECOMBO 1049 */
|
#define GIROLECONF_BUTTON 1049
|
||||||
#define GIJUGGLE_BUTTON 1050
|
#define GIJUGGLE_BUTTON 1050
|
||||||
#define IDC_TOTAL_LABEL 1051
|
#define IDC_TOTAL_LABEL 1051
|
||||||
#define IDC_REMOTE_LABEL 1052
|
#define IDC_REMOTE_LABEL 1052
|
||||||
|
|
|
@ -271,6 +271,7 @@ BEGIN
|
||||||
#endif
|
#endif
|
||||||
COMBOBOX IDC_ROLECOMBO_PPC,25,SERVERROLE_ROW,50,58,CBS_DROPDOWNLIST |
|
COMBOBOX IDC_ROLECOMBO_PPC,25,SERVERROLE_ROW,50,58,CBS_DROPDOWNLIST |
|
||||||
WS_VSCROLL | WS_TABSTOP
|
WS_VSCROLL | WS_TABSTOP
|
||||||
|
PUSHBUTTON "Conf.",GIROLECONF_BUTTON,75,SERVERROLE_ROW,20,ROW_HEIGHT
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue