clean up dialog init

This commit is contained in:
ehouse 2004-05-26 04:39:29 +00:00
parent 566d21fc7b
commit def1f19e02
3 changed files with 106 additions and 101 deletions

View file

@ -54,22 +54,24 @@ PasswdDlg(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
return TRUE;
} else {
pState = (PasswdDialogState*)GetWindowLong( hDlg, GWL_USERDATA );
globals = pState->globals;
if ( !!pState ) {
globals = pState->globals;
switch ( message ) {
case WM_COMMAND:
id = LOWORD(wParam);
switch( id ) {
case IDOK:
ceGetDlgItemText( hDlg, PASS_EDIT, pState->buf, pState->lenp );
case IDCANCEL:
pState->userCancelled = id == IDCANCEL;
EndDialog( hDlg, id );
switch ( message ) {
case WM_COMMAND:
id = LOWORD(wParam);
switch( id ) {
case IDOK:
ceGetDlgItemText( hDlg, PASS_EDIT, pState->buf,
pState->lenp );
case IDCANCEL:
pState->userCancelled = id == IDCANCEL;
EndDialog( hDlg, id );
return TRUE;
return TRUE;
}
}
}
}
return FALSE;
} /* PasswdDlg */

View file

@ -108,31 +108,32 @@ BlankDlg(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
loadLettersList( hDlg, bState );
} else {
bState = (BlankDialogState*)GetWindowLong( hDlg, GWL_USERDATA );
if ( !!bState ) {
switch (message) {
case WM_KEYDOWN: /* key down. Select a list item? */
XP_LOGF( "got WM_KEYDOWN" );
break;
case WM_COMMAND:
id = LOWORD(wParam);
if ( 0 ) {
#ifdef FEATURE_TRAY_EDIT
} else if ( id == IDC_PICKALL ) {
bState->result = PICKER_PICKALL;
} else if ( id == IDC_BACKUP ) {
bState->result = PICKER_BACKUP;
#endif
} else if ( id == IDOK ) {
bState->result =
(XP_S16)SendDlgItemMessage( hDlg, BLANKFACE_LIST,
LB_GETCURSEL, 0, 0 );
} else {
switch ( message ) {
case WM_KEYDOWN: /* key down. Select a list item? */
XP_LOGF( "got WM_KEYDOWN" );
break;
case WM_COMMAND:
id = LOWORD(wParam);
if ( 0 ) {
#ifdef FEATURE_TRAY_EDIT
} else if ( id == IDC_PICKALL ) {
bState->result = PICKER_PICKALL;
} else if ( id == IDC_BACKUP ) {
bState->result = PICKER_BACKUP;
#endif
} else if ( id == IDOK ) {
bState->result =
(XP_S16)SendDlgItemMessage( hDlg, BLANKFACE_LIST,
LB_GETCURSEL, 0, 0 );
} else {
break;
}
EndDialog( hDlg, id );
return TRUE;
}
EndDialog( hDlg, id );
return TRUE;
}
}
return FALSE;

View file

@ -359,6 +359,7 @@ handleOptionsButton( HWND hDlg, CEAppGlobals* globals, GameInfoState* giState )
if ( WrapPrefsDialog( hDlg, globals, &state, &giState->prefsPrefs,
giState->isNewGame ) ) {
giState->prefsChanged = XP_TRUE;
giState->colorsChanged = state.colorsChanged;
/* nothing to do until user finally does confirm the parent dialog */
}
} /* handleOptionsButton */
@ -424,92 +425,93 @@ GameInfo(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
} else {
giState = (GameInfoState*)GetWindowLong( hDlg, GWL_USERDATA );
globals = giState->globals;
if ( !!giState ) {
globals = giState->globals;
switch (message) {
case WM_COMMAND:
id = LOWORD(wParam);
switch( id ) {
switch (message) {
case WM_COMMAND:
id = LOWORD(wParam);
switch( id ) {
case ROBOT_CHECK1:
case ROBOT_CHECK2:
case ROBOT_CHECK3:
case ROBOT_CHECK4:
ceAdjustVisibility( hDlg, giState, XP_TRUE );
break;
case ROBOT_CHECK1:
case ROBOT_CHECK2:
case ROBOT_CHECK3:
case ROBOT_CHECK4:
ceAdjustVisibility( hDlg, giState, XP_TRUE );
break;
#ifndef XWFEATURE_STANDALONE_ONLY
case REMOTE_CHECK1:
case REMOTE_CHECK2:
case REMOTE_CHECK3:
case REMOTE_CHECK4:
XP_ASSERT( giState->curServerHilite == SERVER_ISSERVER );
on = ceGetChecked( hDlg, id );
ceAdjustVisibility( hDlg, giState, XP_FALSE );
break;
case REMOTE_CHECK1:
case REMOTE_CHECK2:
case REMOTE_CHECK3:
case REMOTE_CHECK4:
XP_ASSERT( giState->curServerHilite == SERVER_ISSERVER );
on = ceGetChecked( hDlg, id );
ceAdjustVisibility( hDlg, giState, XP_FALSE );
break;
#endif
case IDC_NPLAYERSCOMBO:
if ( HIWORD(wParam) == CBN_SELCHANGE ) {
if ( giState->isNewGame ) { /* ignore if in info mode */
XP_U16 role;
XP_U16 sel;
sel = (XP_U16)SendDlgItemMessage( hDlg,
IDC_NPLAYERSCOMBO,
CB_GETCURSEL, 0, 0L);
++sel;
role = (XP_U16)SendDlgItemMessage( hDlg, IDC_ROLECOMBO,
CB_GETCURSEL, 0, 0L);
ceAdjustVisibility( hDlg, giState, XP_TRUE );
case IDC_NPLAYERSCOMBO:
if ( HIWORD(wParam) == CBN_SELCHANGE ) {
if ( giState->isNewGame ) { /* ignore if in info mode */
XP_U16 role;
XP_U16 sel;
sel = (XP_U16)SendDlgItemMessage( hDlg,
IDC_NPLAYERSCOMBO,
CB_GETCURSEL, 0, 0L);
++sel;
role = (XP_U16)SendDlgItemMessage( hDlg, IDC_ROLECOMBO,
CB_GETCURSEL, 0, 0L);
ceAdjustVisibility( hDlg, giState, XP_TRUE );
}
}
}
break;
break;
case IDC_ROLECOMBO:
if ( HIWORD(wParam) == CBN_SELCHANGE ) {
if ( giState->isNewGame ) { /* ignore if in info mode */
XP_U16 sel;
sel = (XP_U16)SendDlgItemMessage( hDlg, IDC_ROLECOMBO,
CB_GETCURSEL, 0, 0L);
giState->curServerHilite = (Connectedness)sel;
ceAdjustVisibility( hDlg, giState, XP_FALSE );
case IDC_ROLECOMBO:
if ( HIWORD(wParam) == CBN_SELCHANGE ) {
if ( giState->isNewGame ) { /* ignore if in info mode */
XP_U16 sel;
sel = (XP_U16)SendDlgItemMessage( hDlg, IDC_ROLECOMBO,
CB_GETCURSEL, 0, 0L);
giState->curServerHilite = (Connectedness)sel;
ceAdjustVisibility( hDlg, giState, XP_FALSE );
}
}
}
break;
break;
#ifndef STUBBED_DICT
case IDC_DICTBUTTON:
if ( giState->isNewGame ) { /* ignore if in info mode */
giState->newDictName[0] = 0;
if ( ce_pickDictFile( globals, giState->newDictName,
sizeof(giState->newDictName) ) ) {
XP_UCHAR* basename = bname(giState->newDictName);
ceSetDlgItemFileName( hDlg, id, basename );
case IDC_DICTBUTTON:
if ( giState->isNewGame ) { /* ignore if in info mode */
giState->newDictName[0] = 0;
if ( ce_pickDictFile( globals, giState->newDictName,
sizeof(giState->newDictName) ) ) {
XP_UCHAR* basename = bname(giState->newDictName);
ceSetDlgItemFileName( hDlg, id, basename );
}
}
}
break;
break;
#endif
case OPTIONS_BUTTON:
handleOptionsButton( hDlg, globals, giState );
break;
case OPTIONS_BUTTON:
handleOptionsButton( hDlg, globals, giState );
break;
case IDOK:
stateToGameInfo( hDlg, globals, giState );
case IDCANCEL:
EndDialog(hDlg, id);
giState->userCancelled = id == IDCANCEL;
return TRUE;
case IDOK:
stateToGameInfo( hDlg, globals, giState );
case IDCANCEL:
EndDialog(hDlg, id);
giState->userCancelled = id == IDCANCEL;
return TRUE;
}
break;
/* case WM_CLOSE: */
/* EndDialog(hDlg, id); */
/* return TRUE; */
/* default: */
/* return DefWindowProc(hDlg, message, wParam, lParam); */
}
break;
/* case WM_CLOSE: */
/* EndDialog(hDlg, id); */
/* return TRUE; */
/* default: */
/* return DefWindowProc(hDlg, message, wParam, lParam); */
}
}
return FALSE;
} /* GameInfo */