mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-28 07:58:08 +01:00
rename and reorganize/simplify dialog-handling code common to all
dialogs, handling scrolling and backspace key (smartphone only) and scroll-by-focus in a single place.
This commit is contained in:
parent
3555414ffc
commit
a29ab639fc
19 changed files with 421 additions and 440 deletions
|
@ -49,8 +49,7 @@ PasswdDlg(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
SetWindowLong( hDlg, GWL_USERDATA, lParam );
|
SetWindowLong( hDlg, GWL_USERDATA, lParam );
|
||||||
pState = (PasswdDialogState*)lParam;
|
pState = (PasswdDialogState*)lParam;
|
||||||
|
|
||||||
ceDlgSetup( pState->globals, hDlg );
|
ceDlgSetup( &pState->dlgHdr, hDlg, DLG_STATE_TRAPBACK );
|
||||||
trapBackspaceKey( hDlg );
|
|
||||||
|
|
||||||
nameToLabel( hDlg, pState->name, IDC_PWDLABEL );
|
nameToLabel( hDlg, pState->name, IDC_PWDLABEL );
|
||||||
|
|
||||||
|
@ -59,15 +58,11 @@ PasswdDlg(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
pState = (PasswdDialogState*)GetWindowLong( hDlg, GWL_USERDATA );
|
pState = (PasswdDialogState*)GetWindowLong( hDlg, GWL_USERDATA );
|
||||||
if ( !!pState ) {
|
if ( !!pState ) {
|
||||||
|
|
||||||
|
if ( ceDoDlgHandle( &pState->dlgHdr, message, wParam, lParam ) ) {
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
switch ( message ) {
|
switch ( message ) {
|
||||||
#ifdef _WIN32_WCE
|
|
||||||
case WM_HOTKEY:
|
|
||||||
if ( VK_TBACK == HIWORD(lParam) ) {
|
|
||||||
SHSendBackToFocusWindow( message, wParam, lParam );
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
case WM_COMMAND:
|
case WM_COMMAND:
|
||||||
id = LOWORD(wParam);
|
id = LOWORD(wParam);
|
||||||
switch( id ) {
|
switch( id ) {
|
||||||
|
|
|
@ -22,9 +22,10 @@
|
||||||
|
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "cemain.h"
|
#include "cemain.h"
|
||||||
|
#include "ceutil.h"
|
||||||
|
|
||||||
typedef struct PasswdDialogState {
|
typedef struct PasswdDialogState {
|
||||||
CEAppGlobals* globals;
|
CeDlgHdr dlgHdr;
|
||||||
const XP_UCHAR* name;
|
const XP_UCHAR* name;
|
||||||
XP_UCHAR* buf;
|
XP_UCHAR* buf;
|
||||||
XP_U16* lenp;
|
XP_U16* lenp;
|
||||||
|
|
|
@ -56,7 +56,7 @@ showCurTray( HWND hDlg, BlankDialogState* bState )
|
||||||
wchar_t widebuf[48];
|
wchar_t widebuf[48];
|
||||||
XP_UCHAR* name;
|
XP_UCHAR* name;
|
||||||
|
|
||||||
name = bState->globals->gameInfo.players[bState->playerNum].name;
|
name = bState->dlgHdr.globals->gameInfo.players[bState->playerNum].name;
|
||||||
|
|
||||||
lenSoFar += XP_SNPRINTF( labelBuf + lenSoFar,
|
lenSoFar += XP_SNPRINTF( labelBuf + lenSoFar,
|
||||||
sizeof(labelBuf) - lenSoFar,
|
sizeof(labelBuf) - lenSoFar,
|
||||||
|
@ -103,29 +103,18 @@ BlankDlg(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
ceShowOrHide( hDlg, IDC_BACKUP, bState->canBackup );
|
ceShowOrHide( hDlg, IDC_BACKUP, bState->canBackup );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ceDlgSetup( bState->globals, hDlg );
|
ceDlgSetup( &bState->dlgHdr, hDlg, DLG_STATE_TRAPBACK );
|
||||||
trapBackspaceKey( hDlg );
|
|
||||||
|
|
||||||
loadLettersList( hDlg, bState );
|
loadLettersList( hDlg, bState );
|
||||||
} else {
|
} else {
|
||||||
bState = (BlankDialogState*)GetWindowLong( hDlg, GWL_USERDATA );
|
bState = (BlankDialogState*)GetWindowLong( hDlg, GWL_USERDATA );
|
||||||
if ( !!bState ) {
|
if ( !!bState ) {
|
||||||
|
|
||||||
|
if ( ceDoDlgHandle( &bState->dlgHdr, message, wParam, lParam) ) {
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
switch ( message ) {
|
switch ( message ) {
|
||||||
/* case WM_KEYDOWN: /\* key down. Select a list item? *\/ */
|
|
||||||
/* XP_LOGF( "got WM_KEYDOWN" ); */
|
|
||||||
/* break; */
|
|
||||||
#ifdef _WIN32_WCE
|
|
||||||
case WM_HOTKEY:
|
|
||||||
if ( VK_TBACK == HIWORD(lParam) ) {
|
|
||||||
if ( bState->canBackup ) {
|
|
||||||
bState->result = PICKER_BACKUP;
|
|
||||||
EndDialog( hDlg, IDC_BACKUP );
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
case WM_COMMAND:
|
case WM_COMMAND:
|
||||||
id = LOWORD(wParam);
|
id = LOWORD(wParam);
|
||||||
if ( 0 ) {
|
if ( 0 ) {
|
||||||
|
|
|
@ -22,9 +22,10 @@
|
||||||
|
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "cemain.h"
|
#include "cemain.h"
|
||||||
|
#include "ceutil.h"
|
||||||
|
|
||||||
typedef struct BlankDialogState {
|
typedef struct BlankDialogState {
|
||||||
CEAppGlobals* globals;
|
CeDlgHdr dlgHdr;
|
||||||
const PickInfo* pi;
|
const PickInfo* pi;
|
||||||
XP_U16 playerNum;
|
XP_U16 playerNum;
|
||||||
const XP_UCHAR4* texts;
|
const XP_UCHAR4* texts;
|
||||||
|
|
|
@ -31,8 +31,7 @@ static void colorButton( DRAWITEMSTRUCT* dis, HBRUSH brush );
|
||||||
#ifdef MY_COLOR_SEL
|
#ifdef MY_COLOR_SEL
|
||||||
|
|
||||||
typedef struct ClrEditDlgState {
|
typedef struct ClrEditDlgState {
|
||||||
CEAppGlobals* globals;
|
CeDlgHdr dlgHdr;
|
||||||
|
|
||||||
HWND parent;
|
HWND parent;
|
||||||
HWND sampleButton;
|
HWND sampleButton;
|
||||||
XP_U16 labelID;
|
XP_U16 labelID;
|
||||||
|
@ -145,8 +144,7 @@ EditColorsDlg( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam )
|
||||||
eState->cancelled = XP_TRUE;
|
eState->cancelled = XP_TRUE;
|
||||||
eState->inited = XP_FALSE;
|
eState->inited = XP_FALSE;
|
||||||
|
|
||||||
ceDlgSetup( eState->globals, hDlg );
|
ceDlgSetup( &eState->dlgHdr, hDlg, DLG_STATE_TRAPBACK );
|
||||||
trapBackspaceKey( hDlg );
|
|
||||||
|
|
||||||
wchar_t label[32];
|
wchar_t label[32];
|
||||||
XP_U16 len = SendDlgItemMessage( eState->parent, eState->labelID,
|
XP_U16 len = SendDlgItemMessage( eState->parent, eState->labelID,
|
||||||
|
@ -176,11 +174,11 @@ EditColorsDlg( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam )
|
||||||
initChooseColor( eState, hDlg );
|
initChooseColor( eState, hDlg );
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (message) {
|
if ( ceDoDlgHandle( &eState->dlgHdr, message, wParam, lParam) ) {
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
case WM_VSCROLL:
|
switch (message) {
|
||||||
ceDoDlgScroll( eState->globals, hDlg, wParam );
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WM_DRAWITEM:
|
case WM_DRAWITEM:
|
||||||
colorButtonFromState( eState, (DRAWITEMSTRUCT*)lParam );
|
colorButtonFromState( eState, (DRAWITEMSTRUCT*)lParam );
|
||||||
|
@ -198,14 +196,6 @@ EditColorsDlg( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#ifdef _WIN32_WCE
|
|
||||||
case WM_HOTKEY:
|
|
||||||
if ( VK_TBACK == HIWORD(lParam) ) {
|
|
||||||
SHSendBackToFocusWindow( message, wParam, lParam );
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
case WM_COMMAND:
|
case WM_COMMAND:
|
||||||
wid = LOWORD(wParam);
|
wid = LOWORD(wParam);
|
||||||
switch( wid ) {
|
switch( wid ) {
|
||||||
|
@ -234,24 +224,23 @@ EditColorsDlg( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam )
|
||||||
} /* EditColorsDlg */
|
} /* EditColorsDlg */
|
||||||
|
|
||||||
static XP_Bool
|
static XP_Bool
|
||||||
myChooseColor( CEAppGlobals* globals, HWND parent, XP_U16 labelID,
|
myChooseColor( CeDlgHdr* dlgHdr, XP_U16 labelID, COLORREF* cref )
|
||||||
COLORREF* cref )
|
|
||||||
{
|
{
|
||||||
ClrEditDlgState state;
|
ClrEditDlgState state;
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
XP_MEMSET( &state, 0, sizeof(state) );
|
XP_MEMSET( &state, 0, sizeof(state) );
|
||||||
state.globals = globals;
|
state.dlgHdr.globals = dlgHdr->globals;
|
||||||
state.red = GetRValue(*cref);
|
state.red = GetRValue(*cref);
|
||||||
state.green = GetGValue(*cref);
|
state.green = GetGValue(*cref);
|
||||||
state.blue = GetBValue(*cref);
|
state.blue = GetBValue(*cref);
|
||||||
state.labelID = labelID;
|
state.labelID = labelID;
|
||||||
state.parent = parent;
|
state.parent = dlgHdr->hDlg;
|
||||||
|
|
||||||
XP_LOGF( "setting up IDD_COLOREDITDLG" );
|
XP_LOGF( "setting up IDD_COLOREDITDLG" );
|
||||||
|
|
||||||
result = DialogBoxParam( globals->hInst, (LPCTSTR)IDD_COLOREDITDLG,
|
result = DialogBoxParam( dlgHdr->globals->hInst, (LPCTSTR)IDD_COLOREDITDLG,
|
||||||
parent, (DLGPROC)EditColorsDlg, (long)&state );
|
dlgHdr->hDlg, (DLGPROC)EditColorsDlg, (long)&state );
|
||||||
|
|
||||||
XP_LOGF( "DialogBoxParam=>%d", result );
|
XP_LOGF( "DialogBoxParam=>%d", result );
|
||||||
|
|
||||||
|
@ -275,8 +264,7 @@ colorButton( DRAWITEMSTRUCT* dis, HBRUSH brush )
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct ColorsDlgState {
|
typedef struct ColorsDlgState {
|
||||||
HWND hDlg;
|
CeDlgHdr dlgHdr;
|
||||||
CEAppGlobals* globals;
|
|
||||||
COLORREF* inColors;
|
COLORREF* inColors;
|
||||||
|
|
||||||
COLORREF colors[CE_NUM_EDITABLE_COLORS];
|
COLORREF colors[CE_NUM_EDITABLE_COLORS];
|
||||||
|
@ -299,7 +287,7 @@ initColorData( ColorsDlgState* cState )
|
||||||
|
|
||||||
for ( i = 0; i < CE_NUM_EDITABLE_COLORS; ++i ) {
|
for ( i = 0; i < CE_NUM_EDITABLE_COLORS; ++i ) {
|
||||||
COLORREF ref = cState->inColors[i];
|
COLORREF ref = cState->inColors[i];
|
||||||
HWND button = GetDlgItem( cState->hDlg, FIRST_BUTTON + i );
|
HWND button = GetDlgItem( cState->dlgHdr.hDlg, FIRST_BUTTON + i );
|
||||||
cState->colors[i] = ref;
|
cState->colors[i] = ref;
|
||||||
cState->brushes[i] = CreateSolidBrush( ref );
|
cState->brushes[i] = CreateSolidBrush( ref );
|
||||||
cState->buttons[i] = button;
|
cState->buttons[i] = button;
|
||||||
|
@ -338,7 +326,7 @@ wrapChooseColor( ColorsDlgState* cState, XP_U16 button )
|
||||||
XP_U16 labelID = button + CLRSEL_LABEL_OFFSET;
|
XP_U16 labelID = button + CLRSEL_LABEL_OFFSET;
|
||||||
COLORREF clrref = cState->colors[index];
|
COLORREF clrref = cState->colors[index];
|
||||||
|
|
||||||
if ( myChooseColor( cState->globals, cState->hDlg, labelID, &clrref ) ) {
|
if ( myChooseColor( &cState->dlgHdr, labelID, &clrref ) ) {
|
||||||
cState->colors[index] = clrref;
|
cState->colors[index] = clrref;
|
||||||
DeleteObject( cState->brushes[index] );
|
DeleteObject( cState->brushes[index] );
|
||||||
cState->brushes[index] = CreateSolidBrush( clrref );
|
cState->brushes[index] = CreateSolidBrush( clrref );
|
||||||
|
@ -359,7 +347,7 @@ wrapChooseColor( ColorsDlgState* cState, XP_U16 button )
|
||||||
}
|
}
|
||||||
|
|
||||||
ccs.lStructSize = sizeof(ccs);
|
ccs.lStructSize = sizeof(ccs);
|
||||||
ccs.hwndOwner = cState->hDlg;
|
ccs.hwndOwner = cState->dlgHdr.hDlg;
|
||||||
ccs.rgbResult = cState->colors[index];
|
ccs.rgbResult = cState->colors[index];
|
||||||
ccs.lpCustColors = arr;
|
ccs.lpCustColors = arr;
|
||||||
|
|
||||||
|
@ -397,9 +385,8 @@ ColorsDlg( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam )
|
||||||
state = (ColorsDlgState*)lParam;
|
state = (ColorsDlgState*)lParam;
|
||||||
state->cancelled = XP_TRUE;
|
state->cancelled = XP_TRUE;
|
||||||
state->inited = XP_FALSE;
|
state->inited = XP_FALSE;
|
||||||
state->hDlg = hDlg;
|
|
||||||
|
|
||||||
ceDlgSetup( state->globals, hDlg );
|
ceDlgSetup( &state->dlgHdr, hDlg, DLG_STATE_NONE );
|
||||||
|
|
||||||
result = TRUE;
|
result = TRUE;
|
||||||
} else {
|
} else {
|
||||||
|
@ -416,37 +403,37 @@ ColorsDlg( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam )
|
||||||
/* __func__, messageToStr(message), message, */
|
/* __func__, messageToStr(message), message, */
|
||||||
/* wParam, lParam ); */
|
/* wParam, lParam ); */
|
||||||
|
|
||||||
switch (message) {
|
if ( ceDoDlgHandle( &state->dlgHdr, message, wParam, lParam) ) {
|
||||||
|
|
||||||
case WM_VSCROLL:
|
|
||||||
ceDoDlgScroll( state->globals, hDlg, wParam );
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WM_DRAWITEM:
|
|
||||||
ceDrawColorButton( state, (DRAWITEMSTRUCT*)lParam );
|
|
||||||
result = TRUE;
|
result = TRUE;
|
||||||
break;
|
} else {
|
||||||
|
switch (message) {
|
||||||
|
|
||||||
case WM_COMMAND:
|
case WM_DRAWITEM:
|
||||||
wid = LOWORD(wParam);
|
ceDrawColorButton( state, (DRAWITEMSTRUCT*)lParam );
|
||||||
switch( wid ) {
|
|
||||||
|
|
||||||
case IDOK:
|
|
||||||
state->cancelled = XP_FALSE;
|
|
||||||
/* fallthrough */
|
|
||||||
|
|
||||||
case IDCANCEL:
|
|
||||||
deleteButtonBrushes( state );
|
|
||||||
EndDialog(hDlg, wid);
|
|
||||||
result = TRUE;
|
result = TRUE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
case WM_COMMAND:
|
||||||
/* it's one of the color buttons. Set up with the
|
wid = LOWORD(wParam);
|
||||||
appropriate color and launch ChooseColor */
|
switch( wid ) {
|
||||||
wrapChooseColor( state, wid );
|
|
||||||
result = TRUE;
|
case IDOK:
|
||||||
break;
|
state->cancelled = XP_FALSE;
|
||||||
|
/* fallthrough */
|
||||||
|
|
||||||
|
case IDCANCEL:
|
||||||
|
deleteButtonBrushes( state );
|
||||||
|
EndDialog(hDlg, wid);
|
||||||
|
result = TRUE;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
/* it's one of the color buttons. Set up with the
|
||||||
|
appropriate color and launch ChooseColor */
|
||||||
|
wrapChooseColor( state, wid );
|
||||||
|
result = TRUE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -461,7 +448,7 @@ ceDoColorsEdit( HWND hwnd, CEAppGlobals* globals, COLORREF* colors )
|
||||||
ColorsDlgState state;
|
ColorsDlgState state;
|
||||||
|
|
||||||
XP_MEMSET( &state, 0, sizeof(state) );
|
XP_MEMSET( &state, 0, sizeof(state) );
|
||||||
state.globals = globals;
|
state.dlgHdr.globals = globals;
|
||||||
state.inColors = colors;
|
state.inColors = colors;
|
||||||
|
|
||||||
(void)DialogBoxParam( globals->hInst, (LPCTSTR)IDD_COLORSDLG, hwnd,
|
(void)DialogBoxParam( globals->hInst, (LPCTSTR)IDD_COLORSDLG, hwnd,
|
||||||
|
|
|
@ -167,24 +167,22 @@ ConnsDlg( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam )
|
||||||
LRESULT result = FALSE;
|
LRESULT result = FALSE;
|
||||||
|
|
||||||
CeConnDlgState* cState;
|
CeConnDlgState* cState;
|
||||||
CEAppGlobals* globals;
|
|
||||||
|
|
||||||
if ( message == WM_INITDIALOG ) {
|
if ( message == WM_INITDIALOG ) {
|
||||||
SetWindowLong( hDlg, GWL_USERDATA, lParam );
|
SetWindowLong( hDlg, GWL_USERDATA, lParam );
|
||||||
cState = (CeConnDlgState*)lParam;
|
cState = (CeConnDlgState*)lParam;
|
||||||
globals = cState->globals;
|
|
||||||
|
|
||||||
adjustForConnType( hDlg, cState );
|
adjustForConnType( hDlg, cState );
|
||||||
|
|
||||||
ceControlsFromAddrRec( hDlg, cState );
|
ceControlsFromAddrRec( hDlg, cState );
|
||||||
|
|
||||||
ceDlgSetup( globals, hDlg );
|
ceDlgSetup( &cState->dlgState, hDlg, DLG_STATE_NONE );
|
||||||
|
|
||||||
result = TRUE;
|
result = TRUE;
|
||||||
} else {
|
} else {
|
||||||
cState = (CeConnDlgState*)GetWindowLong( hDlg, GWL_USERDATA );
|
cState = (CeConnDlgState*)GetWindowLong( hDlg, GWL_USERDATA );
|
||||||
if ( !!cState ) {
|
if ( !!cState ) {
|
||||||
globals = cState->globals;
|
CEAppGlobals* globals = cState->dlgHdr.globals;
|
||||||
|
|
||||||
if ( message == WM_COMMAND ) {
|
if ( message == WM_COMMAND ) {
|
||||||
XP_U16 id = LOWORD(wParam);
|
XP_U16 id = LOWORD(wParam);
|
||||||
|
|
|
@ -24,9 +24,9 @@
|
||||||
#include "cemain.h"
|
#include "cemain.h"
|
||||||
|
|
||||||
typedef struct CeConnDlgState {
|
typedef struct CeConnDlgState {
|
||||||
|
CeDlgHdr dlgHdr;
|
||||||
CommsAddrRec addrRec;
|
CommsAddrRec addrRec;
|
||||||
DeviceRole role;
|
DeviceRole role;
|
||||||
CEAppGlobals* globals;
|
|
||||||
XP_Bool userCancelled;
|
XP_Bool userCancelled;
|
||||||
} CeConnDlgState;
|
} CeConnDlgState;
|
||||||
|
|
||||||
|
|
|
@ -77,7 +77,7 @@ addDictToState( const wchar_t* wPath, XP_U16 XP_UNUSED(index), void* ctxt )
|
||||||
if ( loc >= 0 ) {
|
if ( loc >= 0 ) {
|
||||||
/* make a copy of the long name */
|
/* make a copy of the long name */
|
||||||
len = wcslen( wPath ) + 1;
|
len = wcslen( wPath ) + 1;
|
||||||
wstr = (wchar_t*)XP_MALLOC( giState->globals->mpool,
|
wstr = (wchar_t*)XP_MALLOC( giState->dlgHdr.globals->mpool,
|
||||||
len * sizeof(wstr[0]) );
|
len * sizeof(wstr[0]) );
|
||||||
|
|
||||||
XP_MEMCPY( wstr, wPath, len*sizeof(wstr[0]) );
|
XP_MEMCPY( wstr, wPath, len*sizeof(wstr[0]) );
|
||||||
|
@ -86,13 +86,13 @@ addDictToState( const wchar_t* wPath, XP_U16 XP_UNUSED(index), void* ctxt )
|
||||||
XP_ASSERT( giState->capMenuDicts == 0 );
|
XP_ASSERT( giState->capMenuDicts == 0 );
|
||||||
giState->capMenuDicts = MENUDICTS_INCR;
|
giState->capMenuDicts = MENUDICTS_INCR;
|
||||||
giState->menuDicts
|
giState->menuDicts
|
||||||
= (wchar_t**)XP_MALLOC( giState->globals->mpool,
|
= (wchar_t**)XP_MALLOC( giState->dlgHdr.globals->mpool,
|
||||||
giState->capMenuDicts
|
giState->capMenuDicts
|
||||||
* sizeof(giState->menuDicts[0]) );
|
* sizeof(giState->menuDicts[0]) );
|
||||||
} else if ( giState->nMenuDicts == giState->capMenuDicts ) {
|
} else if ( giState->nMenuDicts == giState->capMenuDicts ) {
|
||||||
giState->capMenuDicts += MENUDICTS_INCR;
|
giState->capMenuDicts += MENUDICTS_INCR;
|
||||||
giState->menuDicts
|
giState->menuDicts
|
||||||
= (wchar_t**)XP_REALLOC( giState->globals->mpool,
|
= (wchar_t**)XP_REALLOC( giState->dlgHdr.globals->mpool,
|
||||||
giState->menuDicts,
|
giState->menuDicts,
|
||||||
giState->capMenuDicts
|
giState->capMenuDicts
|
||||||
* sizeof(giState->menuDicts[0]) );
|
* sizeof(giState->menuDicts[0]) );
|
||||||
|
@ -122,7 +122,7 @@ addDictsToMenu( GameInfoState* giState )
|
||||||
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->hDlg, IDC_DICTLIST, ADDSTRING, 0,
|
SendDlgItemMessage( giState->dlgHdr.hDlg, IDC_DICTLIST, ADDSTRING, 0,
|
||||||
(long)shortname );
|
(long)shortname );
|
||||||
|
|
||||||
if ( giState->newDictName[0] != 0 && sel == 0 ) {
|
if ( giState->newDictName[0] != 0 && sel == 0 ) {
|
||||||
|
@ -135,7 +135,7 @@ addDictsToMenu( GameInfoState* giState )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SendDlgItemMessage( giState->hDlg, IDC_DICTLIST, SETCURSEL, sel, 0L );
|
SendDlgItemMessage( giState->dlgHdr.hDlg, IDC_DICTLIST, SETCURSEL, sel, 0L );
|
||||||
} /* addDictsToMenu */
|
} /* addDictsToMenu */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -145,18 +145,18 @@ cleanupGameInfoState( GameInfoState* giState )
|
||||||
XP_U16 nMenuDicts = giState->nMenuDicts;
|
XP_U16 nMenuDicts = giState->nMenuDicts;
|
||||||
XP_U16 i;
|
XP_U16 i;
|
||||||
for ( i = 0; i < nMenuDicts; ++i ) {
|
for ( i = 0; i < nMenuDicts; ++i ) {
|
||||||
XP_FREE( giState->globals->mpool, giState->menuDicts[i] );
|
XP_FREE( giState->dlgHdr.globals->mpool, giState->menuDicts[i] );
|
||||||
}
|
}
|
||||||
XP_FREE( giState->globals->mpool, giState->menuDicts );
|
XP_FREE( giState->dlgHdr.globals->mpool, giState->menuDicts );
|
||||||
giState->menuDicts = NULL;
|
giState->menuDicts = NULL;
|
||||||
}
|
}
|
||||||
} /* cleanupGameInfoState */
|
} /* cleanupGameInfoState */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
loadFromGameInfo( HWND hDlg, CEAppGlobals* globals, GameInfoState* giState )
|
loadFromGameInfo( GameInfoState* giState )
|
||||||
{
|
{
|
||||||
XP_U16 i;
|
XP_U16 i;
|
||||||
CurGameInfo* gi = &globals->gameInfo;
|
CurGameInfo* gi = &giState->dlgHdr.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 +170,7 @@ loadFromGameInfo( HWND hDlg, CEAppGlobals* globals, 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( hDlg, IDC_NPLAYERSCOMBO, ADDSTRING, 0,
|
SendDlgItemMessage( giState->dlgHdr.hDlg, IDC_NPLAYERSCOMBO, ADDSTRING, 0,
|
||||||
(long)widebuf );
|
(long)widebuf );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -182,7 +182,7 @@ loadFromGameInfo( HWND hDlg, CEAppGlobals* globals, GameInfoState* giState )
|
||||||
(XP_U16)XP_STRLEN(gi->dictName)+1 );
|
(XP_U16)XP_STRLEN(gi->dictName)+1 );
|
||||||
}
|
}
|
||||||
if ( giState->isNewGame ) {
|
if ( giState->isNewGame ) {
|
||||||
(void)ceLocateNDicts( MPPARM(globals->mpool)
|
(void)ceLocateNDicts( MPPARM(giState->dlgHdr.globals->mpool)
|
||||||
CE_MAXDICTS, addDictToState, giState );
|
CE_MAXDICTS, addDictToState, giState );
|
||||||
} else {
|
} else {
|
||||||
wchar_t wPath[CE_MAX_PATH_LEN+1];
|
wchar_t wPath[CE_MAX_PATH_LEN+1];
|
||||||
|
@ -195,14 +195,16 @@ loadFromGameInfo( HWND hDlg, CEAppGlobals* globals, GameInfoState* giState )
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if ( !giState->isNewGame ) {
|
if ( !giState->isNewGame ) {
|
||||||
ceEnOrDisable( hDlg, IDC_DICTLIST, XP_FALSE );
|
ceEnOrDisable( giState->dlgHdr.hDlg, IDC_DICTLIST, XP_FALSE );
|
||||||
}
|
}
|
||||||
} /* loadFromGameInfo */
|
} /* loadFromGameInfo */
|
||||||
|
|
||||||
static XP_Bool
|
static XP_Bool
|
||||||
stateToGameInfo( HWND hDlg, CEAppGlobals* globals, GameInfoState* giState )
|
stateToGameInfo( GameInfoState* giState )
|
||||||
{
|
{
|
||||||
|
CEAppGlobals* globals = giState->dlgHdr.globals;
|
||||||
CurGameInfo* gi = &globals->gameInfo;
|
CurGameInfo* gi = &globals->gameInfo;
|
||||||
|
HWND hDlg = giState->dlgHdr.hDlg;
|
||||||
XP_Bool timerOn;
|
XP_Bool timerOn;
|
||||||
XP_Bool success = newg_store( giState->newGameCtx, gi, XP_TRUE );
|
XP_Bool success = newg_store( giState->newGameCtx, gi, XP_TRUE );
|
||||||
|
|
||||||
|
@ -346,7 +348,7 @@ ceEnableColProc( void* closure, XP_U16 player, NewGameColumn col,
|
||||||
{
|
{
|
||||||
GameInfoState* giState = (GameInfoState*)closure;
|
GameInfoState* giState = (GameInfoState*)closure;
|
||||||
XP_U16 resID = resIDForCol( player, col );
|
XP_U16 resID = resIDForCol( player, col );
|
||||||
doForNWEnable( giState->hDlg, resID, enable );
|
doForNWEnable( giState->dlgHdr.hDlg, resID, enable );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -354,7 +356,7 @@ 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( attr );
|
||||||
doForNWEnable( giState->hDlg, resID, enable );
|
doForNWEnable( giState->dlgHdr.hDlg, resID, enable );
|
||||||
} /* ceEnableAttrProc */
|
} /* ceEnableAttrProc */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -372,12 +374,12 @@ ceGetColProc( void* closure, XP_U16 player, NewGameColumn col,
|
||||||
case NG_COL_REMOTE:
|
case NG_COL_REMOTE:
|
||||||
#endif
|
#endif
|
||||||
case NG_COL_ROBOT:
|
case NG_COL_ROBOT:
|
||||||
value.ng_bool = ceGetChecked( giState->hDlg, resID );
|
value.ng_bool = ceGetChecked( giState->dlgHdr.hDlg, resID );
|
||||||
break;
|
break;
|
||||||
case NG_COL_NAME:
|
case NG_COL_NAME:
|
||||||
case NG_COL_PASSWD:
|
case NG_COL_PASSWD:
|
||||||
len = sizeof(txt);
|
len = sizeof(txt);
|
||||||
ceGetDlgItemText( giState->hDlg, resID, txt, &len );
|
ceGetDlgItemText( giState->dlgHdr.hDlg, resID, txt, &len );
|
||||||
value.ng_cp = &txt[0];
|
value.ng_cp = &txt[0];
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -403,13 +405,13 @@ ceSetColProc( void* closure, XP_U16 player, NewGameColumn col,
|
||||||
} else {
|
} else {
|
||||||
cp = value.ng_cp;
|
cp = value.ng_cp;
|
||||||
}
|
}
|
||||||
ceSetDlgItemText( giState->hDlg, resID, cp );
|
ceSetDlgItemText( giState->dlgHdr.hDlg, resID, cp );
|
||||||
break;
|
break;
|
||||||
#ifndef XWFEATURE_STANDALONE_ONLY
|
#ifndef XWFEATURE_STANDALONE_ONLY
|
||||||
case NG_COL_REMOTE:
|
case NG_COL_REMOTE:
|
||||||
#endif
|
#endif
|
||||||
case NG_COL_ROBOT:
|
case NG_COL_ROBOT:
|
||||||
ceSetChecked( giState->hDlg, resID, value.ng_bool );
|
ceSetChecked( giState->dlgHdr.hDlg, resID, value.ng_bool );
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
XP_ASSERT(0);
|
XP_ASSERT(0);
|
||||||
|
@ -424,17 +426,17 @@ ceSetAttrProc(void* closure, NewGameAttr attr, const NGValue value )
|
||||||
|
|
||||||
switch ( attr ) {
|
switch ( attr ) {
|
||||||
case NG_ATTR_NPLAYERS:
|
case NG_ATTR_NPLAYERS:
|
||||||
SendDlgItemMessage( giState->hDlg, resID, SETCURSEL,
|
SendDlgItemMessage( giState->dlgHdr.hDlg, resID, SETCURSEL,
|
||||||
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->hDlg, resID, SETCURSEL,
|
SendDlgItemMessage( giState->dlgHdr.hDlg, resID, SETCURSEL,
|
||||||
value.ng_role, 0L );
|
value.ng_role, 0L );
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
case NG_ATTR_NPLAYHEADER:
|
case NG_ATTR_NPLAYHEADER:
|
||||||
ceSetDlgItemText( giState->hDlg, resID, value.ng_cp );
|
ceSetDlgItemText( giState->dlgHdr.hDlg, resID, value.ng_cp );
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -456,7 +458,7 @@ handleColChecked( GameInfoState* giState, XP_U16 id, XP_U16 base )
|
||||||
NGValue value;
|
NGValue value;
|
||||||
XP_U16 player = playerFromID( id, base );
|
XP_U16 player = playerFromID( id, base );
|
||||||
|
|
||||||
value.ng_bool = ceGetChecked( giState->hDlg, id );
|
value.ng_bool = ceGetChecked( giState->dlgHdr.hDlg, id );
|
||||||
|
|
||||||
newg_colChanged( giState->newGameCtx, player );
|
newg_colChanged( giState->newGameCtx, player );
|
||||||
}
|
}
|
||||||
|
@ -492,11 +494,9 @@ GameInfo(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
if ( message == WM_INITDIALOG ) {
|
if ( message == WM_INITDIALOG ) {
|
||||||
SetWindowLong( hDlg, GWL_USERDATA, lParam );
|
SetWindowLong( hDlg, GWL_USERDATA, lParam );
|
||||||
giState = (GameInfoState*)lParam;
|
giState = (GameInfoState*)lParam;
|
||||||
giState->hDlg = hDlg;
|
globals = giState->dlgHdr.globals;
|
||||||
globals = giState->globals;
|
|
||||||
|
|
||||||
ceDlgSetup( globals, hDlg );
|
ceDlgSetup( &giState->dlgHdr, hDlg, DLG_STATE_TRAPBACK );
|
||||||
trapBackspaceKey( hDlg );
|
|
||||||
|
|
||||||
giState->newGameCtx = newg_make( MPPARM(globals->mpool)
|
giState->newGameCtx = newg_make( MPPARM(globals->mpool)
|
||||||
giState->isNewGame,
|
giState->isNewGame,
|
||||||
|
@ -508,7 +508,7 @@ GameInfo(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
ceSetAttrProc,
|
ceSetAttrProc,
|
||||||
giState );
|
giState );
|
||||||
|
|
||||||
loadFromGameInfo( hDlg, globals, giState );
|
loadFromGameInfo( giState );
|
||||||
loadStateFromCurPrefs( globals, &globals->appPrefs, &globals->gameInfo,
|
loadStateFromCurPrefs( globals, &globals->appPrefs, &globals->gameInfo,
|
||||||
&giState->prefsPrefs );
|
&giState->prefsPrefs );
|
||||||
|
|
||||||
|
@ -521,131 +521,119 @@ GameInfo(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
} else {
|
} else {
|
||||||
giState = (GameInfoState*)GetWindowLong( hDlg, GWL_USERDATA );
|
giState = (GameInfoState*)GetWindowLong( hDlg, GWL_USERDATA );
|
||||||
if ( !!giState ) {
|
if ( !!giState ) {
|
||||||
globals = giState->globals;
|
globals = giState->dlgHdr.globals;
|
||||||
|
|
||||||
switch (message) {
|
XP_ASSERT( hDlg == giState->dlgHdr.hDlg );
|
||||||
#ifdef _WIN32_WCE
|
result = ceDoDlgHandle( &giState->dlgHdr, message, wParam, lParam );
|
||||||
case WM_HOTKEY:
|
if ( !result ) {
|
||||||
if ( VK_TBACK == HIWORD(lParam) ) {
|
switch (message) {
|
||||||
SHSendBackToFocusWindow( message, wParam, lParam );
|
|
||||||
result = TRUE;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
case WM_VSCROLL:
|
|
||||||
result = ceDoDlgScroll( globals, hDlg, wParam );
|
|
||||||
break;
|
|
||||||
|
|
||||||
/* WM_NEXTDLGCTL is worthless; prev obj still has focus */
|
|
||||||
case WM_NEXTDLGCTL:
|
|
||||||
ceDoDlgFocusScroll( globals, hDlg, wParam, lParam );
|
|
||||||
break;
|
|
||||||
|
|
||||||
#ifdef OWNERDRAW_JUGGLE
|
#ifdef OWNERDRAW_JUGGLE
|
||||||
case WM_DRAWITEM: /* for BS_OWNERDRAW style */
|
case WM_DRAWITEM: /* for BS_OWNERDRAW style */
|
||||||
ceDrawIconButton( globals, (DRAWITEMSTRUCT*)lParam );
|
ceDrawIconButton( globals, (DRAWITEMSTRUCT*)lParam );
|
||||||
result = TRUE;
|
result = TRUE;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
case WM_COMMAND:
|
case WM_COMMAND:
|
||||||
result = TRUE;
|
result = TRUE;
|
||||||
id = LOWORD(wParam);
|
id = LOWORD(wParam);
|
||||||
switch( id ) {
|
switch( id ) {
|
||||||
|
|
||||||
case ROBOT_CHECK1:
|
case ROBOT_CHECK1:
|
||||||
case ROBOT_CHECK2:
|
case ROBOT_CHECK2:
|
||||||
case ROBOT_CHECK3:
|
case ROBOT_CHECK3:
|
||||||
case ROBOT_CHECK4:
|
case ROBOT_CHECK4:
|
||||||
handleColChecked( giState, id, ROBOT_CHECK1 );
|
handleColChecked( giState, id, ROBOT_CHECK1 );
|
||||||
break;
|
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:
|
case IDC_NPLAYERSCOMBO:
|
||||||
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_u16 = 1 + (XP_U16)
|
value.ng_u16 = 1 + (XP_U16)
|
||||||
SendDlgItemMessage( hDlg,
|
SendDlgItemMessage( hDlg,
|
||||||
IDC_NPLAYERSCOMBO,
|
IDC_NPLAYERSCOMBO,
|
||||||
GETCURSEL, 0, 0L);
|
GETCURSEL, 0, 0L);
|
||||||
newg_attrChanged( giState->newGameCtx,
|
newg_attrChanged( giState->newGameCtx,
|
||||||
NG_ATTR_NPLAYERS, value );
|
NG_ATTR_NPLAYERS, value );
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
#if defined XWFEATURE_RELAY || defined XWFEATURE_BLUETOOTH
|
|
||||||
case IDC_ROLECOMBO:
|
|
||||||
if ( HIWORD(wParam) == CBN_SELCHANGE ) {
|
|
||||||
if ( giState->isNewGame ) { /* ignore if in info
|
|
||||||
mode */
|
|
||||||
NGValue value;
|
|
||||||
value.ng_role =
|
|
||||||
(DeviceRole)SendDlgItemMessage( hDlg,
|
|
||||||
IDC_ROLECOMBO,
|
|
||||||
CB_GETCURSEL, 0,
|
|
||||||
0L);
|
|
||||||
newg_attrChanged( giState->newGameCtx,
|
|
||||||
NG_ATTR_ROLE, value );
|
|
||||||
/* If we've switched to a state where we'll be
|
|
||||||
connecting */
|
|
||||||
if ( value.ng_role != SERVER_STANDALONE ) {
|
|
||||||
handleConnOptionsButton( hDlg, globals,
|
|
||||||
value.ng_role,
|
|
||||||
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( hDlg, globals, giState ) ) {
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
#if defined XWFEATURE_RELAY || defined XWFEATURE_BLUETOOTH
|
||||||
|
case IDC_ROLECOMBO:
|
||||||
|
if ( HIWORD(wParam) == CBN_SELCHANGE ) {
|
||||||
|
if ( giState->isNewGame ) { /* ignore if in info
|
||||||
|
mode */
|
||||||
|
NGValue value;
|
||||||
|
value.ng_role =
|
||||||
|
(DeviceRole)SendDlgItemMessage( hDlg,
|
||||||
|
IDC_ROLECOMBO,
|
||||||
|
CB_GETCURSEL, 0,
|
||||||
|
0L);
|
||||||
|
newg_attrChanged( giState->newGameCtx,
|
||||||
|
NG_ATTR_ROLE, value );
|
||||||
|
/* If we've switched to a state where we'll be
|
||||||
|
connecting */
|
||||||
|
if ( value.ng_role != SERVER_STANDALONE ) {
|
||||||
|
handleConnOptionsButton( hDlg, globals,
|
||||||
|
value.ng_role,
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
case IDCANCEL:
|
||||||
|
EndDialog(hDlg, id);
|
||||||
|
giState->userCancelled = id == IDCANCEL;
|
||||||
|
cleanupGameInfoState( giState );
|
||||||
|
newg_destroy( giState->newGameCtx );
|
||||||
}
|
}
|
||||||
case IDCANCEL:
|
break;
|
||||||
EndDialog(hDlg, id);
|
default:
|
||||||
giState->userCancelled = id == IDCANCEL;
|
result = FALSE;
|
||||||
cleanupGameInfoState( giState );
|
/* case WM_CLOSE: */
|
||||||
newg_destroy( giState->newGameCtx );
|
/* EndDialog(hDlg, id); */
|
||||||
|
/* return TRUE; */
|
||||||
|
/* default: */
|
||||||
|
/* return DefWindowProc(hDlg, message, wParam, lParam); */
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
default:
|
|
||||||
result = FALSE;
|
|
||||||
/* case WM_CLOSE: */
|
|
||||||
/* EndDialog(hDlg, id); */
|
|
||||||
/* return TRUE; */
|
|
||||||
/* default: */
|
|
||||||
/* return DefWindowProc(hDlg, message, wParam, lParam); */
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,11 +24,11 @@
|
||||||
#include "cemain.h"
|
#include "cemain.h"
|
||||||
#include "ceprefs.h"
|
#include "ceprefs.h"
|
||||||
#include "cedict.h"
|
#include "cedict.h"
|
||||||
|
#include "ceutil.h"
|
||||||
#include "nwgamest.h"
|
#include "nwgamest.h"
|
||||||
|
|
||||||
typedef struct GameInfoState {
|
typedef struct GameInfoState {
|
||||||
CEAppGlobals* globals;
|
CeDlgHdr dlgHdr;
|
||||||
HWND hDlg;
|
|
||||||
NewGameCtx* newGameCtx;
|
NewGameCtx* newGameCtx;
|
||||||
XP_UCHAR newDictName[CE_MAX_PATH_LEN+1];
|
XP_UCHAR newDictName[CE_MAX_PATH_LEN+1];
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,6 @@
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "cehntlim.h"
|
#include "cehntlim.h"
|
||||||
#include "ceutil.h"
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
initComboBox( HWND hDlg, XP_U16 id, XP_U16 startVal )
|
initComboBox( HWND hDlg, XP_U16 id, XP_U16 startVal )
|
||||||
|
@ -55,15 +54,13 @@ LRESULT CALLBACK
|
||||||
HintLimitsDlg( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam )
|
HintLimitsDlg( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam )
|
||||||
{
|
{
|
||||||
HintLimitsState* hState;
|
HintLimitsState* hState;
|
||||||
CEAppGlobals* globals;
|
|
||||||
XP_U16 id;
|
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;
|
||||||
globals = hState->globals;
|
|
||||||
|
|
||||||
ceDlgSetup( globals, hDlg );
|
ceDlgSetup( &hState->dlgHdr, hDlg, DLG_STATE_NONE );
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
} else {
|
} else {
|
||||||
|
@ -76,6 +73,10 @@ HintLimitsDlg( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam )
|
||||||
hState->inited = XP_TRUE;
|
hState->inited = XP_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( ceDoDlgHandle( &hState->dlgHdr, message, wParam, lParam) ) {
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
switch ( message ) {
|
switch ( message ) {
|
||||||
case WM_COMMAND:
|
case WM_COMMAND:
|
||||||
id = LOWORD(wParam);
|
id = LOWORD(wParam);
|
||||||
|
|
|
@ -23,9 +23,10 @@
|
||||||
#ifdef XWFEATURE_SEARCHLIMIT
|
#ifdef XWFEATURE_SEARCHLIMIT
|
||||||
|
|
||||||
#include "cemain.h"
|
#include "cemain.h"
|
||||||
|
#include "ceutil.h"
|
||||||
|
|
||||||
typedef struct HintLimitsState {
|
typedef struct HintLimitsState {
|
||||||
CEAppGlobals* globals;
|
CeDlgHdr dlgHdr;
|
||||||
XP_U16 min, max;
|
XP_U16 min, max;
|
||||||
XP_Bool inited;
|
XP_Bool inited;
|
||||||
XP_Bool cancelled;
|
XP_Bool cancelled;
|
||||||
|
|
|
@ -1464,7 +1464,7 @@ ceDoNewGame( CEAppGlobals* globals )
|
||||||
}
|
}
|
||||||
|
|
||||||
XP_MEMSET( &giState, 0, sizeof(giState) );
|
XP_MEMSET( &giState, 0, sizeof(giState) );
|
||||||
giState.globals = globals;
|
giState.dlgHdr.globals = globals;
|
||||||
giState.isNewGame = XP_TRUE;
|
giState.isNewGame = XP_TRUE;
|
||||||
|
|
||||||
DialogBoxParam( globals->hInst, (LPCTSTR)IDD_GAMEINFO, globals->hWnd,
|
DialogBoxParam( globals->hInst, (LPCTSTR)IDD_GAMEINFO, globals->hWnd,
|
||||||
|
@ -2054,7 +2054,7 @@ WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
GameInfoState state;
|
GameInfoState state;
|
||||||
|
|
||||||
XP_MEMSET( &state, 0, sizeof(state) );
|
XP_MEMSET( &state, 0, sizeof(state) );
|
||||||
state.globals = globals;
|
state.dlgHdr.globals = globals;
|
||||||
|
|
||||||
DialogBoxParam(globals->hInst, (LPCTSTR)IDD_GAMEINFO, hWnd,
|
DialogBoxParam(globals->hInst, (LPCTSTR)IDD_GAMEINFO, hWnd,
|
||||||
(DLGPROC)GameInfo, (long)&state );
|
(DLGPROC)GameInfo, (long)&state );
|
||||||
|
@ -2376,18 +2376,18 @@ ceMsgFromStream( CEAppGlobals* globals, XWStreamCtxt* stream,
|
||||||
int result = messageBoxStream( globals, stream, title, buttons );
|
int result = messageBoxStream( globals, stream, title, buttons );
|
||||||
saidYes = (IDOK == result) | (IDRETRY == result) | (IDYES == result);
|
saidYes = (IDOK == result) | (IDRETRY == result) | (IDYES == result);
|
||||||
} else {
|
} else {
|
||||||
StrBoxInit init;
|
StrBoxState state;
|
||||||
|
|
||||||
XP_MEMSET( &init, 0, sizeof(init) );
|
XP_MEMSET( &state, 0, sizeof(state) );
|
||||||
|
|
||||||
init.title = title;
|
state.title = title;
|
||||||
init.stream = stream;
|
state.stream = stream;
|
||||||
init.isQuery = buttons != MB_OK;
|
state.isQuery = buttons != MB_OK;
|
||||||
init.globals = globals;
|
state.dlgHdr.globals = globals;
|
||||||
|
|
||||||
DialogBoxParam( globals->hInst, (LPCTSTR)IDD_STRBOX, globals->hWnd,
|
DialogBoxParam( globals->hInst, (LPCTSTR)IDD_STRBOX, globals->hWnd,
|
||||||
(DLGPROC)StrBox, (long)&init );
|
(DLGPROC)StrBox, (long)&state );
|
||||||
saidYes = init.result == IDOK;
|
saidYes = state.result == IDOK;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( destroy ) {
|
if ( destroy ) {
|
||||||
|
@ -2798,7 +2798,7 @@ ce_util_userPickTile( XW_UtilCtxt* uc, const PickInfo* pi,
|
||||||
CEAppGlobals* globals = (CEAppGlobals*)uc->closure;
|
CEAppGlobals* globals = (CEAppGlobals*)uc->closure;
|
||||||
XP_MEMSET( &state, 0, sizeof(state) );
|
XP_MEMSET( &state, 0, sizeof(state) );
|
||||||
|
|
||||||
state.globals = globals;
|
state.dlgHdr.globals = globals;
|
||||||
state.texts = texts;
|
state.texts = texts;
|
||||||
state.nTiles = nTiles;
|
state.nTiles = nTiles;
|
||||||
state.playerNum = playerNum;
|
state.playerNum = playerNum;
|
||||||
|
@ -2817,7 +2817,7 @@ ce_util_askPassword( XW_UtilCtxt* uc, const XP_UCHAR* name,
|
||||||
CEAppGlobals* globals = (CEAppGlobals*)uc->closure;
|
CEAppGlobals* globals = (CEAppGlobals*)uc->closure;
|
||||||
XP_MEMSET( &state, 0, sizeof(state) );
|
XP_MEMSET( &state, 0, sizeof(state) );
|
||||||
|
|
||||||
state.globals = globals;
|
state.dlgHdr.globals = globals;
|
||||||
state.name = name;
|
state.name = name;
|
||||||
state.buf = buf;
|
state.buf = buf;
|
||||||
state.lenp = len;
|
state.lenp = len;
|
||||||
|
@ -3111,7 +3111,7 @@ ce_util_getTraySearchLimits( XW_UtilCtxt* uc, XP_U16* min, XP_U16* max )
|
||||||
|
|
||||||
XP_MEMSET( &hls, 0, sizeof(hls) );
|
XP_MEMSET( &hls, 0, sizeof(hls) );
|
||||||
|
|
||||||
hls.globals = globals;
|
hls.dlgHdr.globals = globals;
|
||||||
hls.min = *min;
|
hls.min = *min;
|
||||||
hls.max = *max;
|
hls.max = *max;
|
||||||
|
|
||||||
|
|
|
@ -77,7 +77,7 @@ adjustForChoice( HWND hDlg, CePrefsDlgState* state )
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
XP_U16 resID;
|
XP_U16 resID;
|
||||||
XP_Bool doGlobalPrefs = state->globals->doGlobalPrefs;
|
XP_Bool doGlobalPrefs = state->dlgHdr.globals->doGlobalPrefs;
|
||||||
|
|
||||||
resID = doGlobalPrefs? IDC_RADIOGLOBAL:IDC_RADIOLOCAL;
|
resID = doGlobalPrefs? IDC_RADIOGLOBAL:IDC_RADIOLOCAL;
|
||||||
SendDlgItemMessage( hDlg, resID, BM_SETCHECK, BST_CHECKED, 0L );
|
SendDlgItemMessage( hDlg, resID, BM_SETCHECK, BST_CHECKED, 0L );
|
||||||
|
@ -248,81 +248,64 @@ ceControlsToPrefs( HWND hDlg, CePrefsPrefs* prefsPrefs )
|
||||||
LRESULT CALLBACK
|
LRESULT CALLBACK
|
||||||
PrefsDlg(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
|
PrefsDlg(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
CEAppGlobals* globals;
|
|
||||||
XP_U16 id;
|
XP_U16 id;
|
||||||
CePrefsDlgState* pState;
|
CePrefsDlgState* pState;
|
||||||
|
|
||||||
if ( message == WM_INITDIALOG ) {
|
if ( message == WM_INITDIALOG ) {
|
||||||
SetWindowLong( hDlg, GWL_USERDATA, lParam );
|
SetWindowLong( hDlg, GWL_USERDATA, lParam );
|
||||||
pState = (CePrefsDlgState*)lParam;
|
pState = (CePrefsDlgState*)lParam;
|
||||||
globals = pState->globals;
|
|
||||||
|
|
||||||
stuffPhoniesList( hDlg );
|
stuffPhoniesList( hDlg );
|
||||||
|
|
||||||
loadControlsFromState( hDlg, pState );
|
loadControlsFromState( hDlg, pState );
|
||||||
adjustForChoice( hDlg, pState );
|
adjustForChoice( hDlg, pState );
|
||||||
|
|
||||||
ceDlgSetup( globals, hDlg );
|
ceDlgSetup( &pState->dlgHdr, hDlg, DLG_STATE_TRAPBACK );
|
||||||
trapBackspaceKey( hDlg );
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
XP_Bool timerOn;
|
|
||||||
pState = (CePrefsDlgState*)GetWindowLong( hDlg, GWL_USERDATA );
|
pState = (CePrefsDlgState*)GetWindowLong( hDlg, GWL_USERDATA );
|
||||||
if ( !!pState ) {
|
if ( !!pState ) {
|
||||||
globals = pState->globals;
|
if ( !ceDoDlgHandle( &pState->dlgHdr, message, wParam, lParam ) ) {
|
||||||
|
CEAppGlobals* globals = pState->dlgHdr.globals;
|
||||||
|
XP_Bool timerOn;
|
||||||
|
|
||||||
switch (message) {
|
switch (message) {
|
||||||
case WM_VSCROLL:
|
case WM_COMMAND:
|
||||||
ceDoDlgScroll( globals, hDlg, wParam );
|
id = LOWORD(wParam);
|
||||||
break;
|
switch( id ) {
|
||||||
#ifdef _WIN32_WCE
|
|
||||||
case WM_HOTKEY:
|
|
||||||
if ( VK_TBACK == HIWORD(lParam) ) {
|
|
||||||
SHSendBackToFocusWindow( message, wParam, lParam );
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
case WM_NEXTDLGCTL:
|
|
||||||
ceDoDlgFocusScroll( globals, hDlg, wParam, lParam );
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WM_COMMAND:
|
case IDC_RADIOGLOBAL:
|
||||||
id = LOWORD(wParam);
|
case IDC_RADIOLOCAL:
|
||||||
switch( id ) {
|
globals->doGlobalPrefs = id == IDC_RADIOGLOBAL;
|
||||||
|
adjustForChoice( hDlg, pState );
|
||||||
|
break;
|
||||||
|
|
||||||
case IDC_RADIOGLOBAL:
|
case TIMER_CHECK:
|
||||||
case IDC_RADIOLOCAL:
|
timerOn = SendDlgItemMessage( hDlg, TIMER_CHECK,
|
||||||
pState->globals->doGlobalPrefs = id == IDC_RADIOGLOBAL;
|
BM_GETCHECK, 0, 0 );
|
||||||
adjustForChoice( hDlg, pState );
|
setTimerCtls( hDlg, timerOn );
|
||||||
break;
|
break;
|
||||||
|
case IDC_PREFCOLORS:
|
||||||
case TIMER_CHECK:
|
pState->colorsChanged =
|
||||||
timerOn = SendDlgItemMessage( hDlg, TIMER_CHECK, BM_GETCHECK,
|
ceDoColorsEdit( hDlg, globals,
|
||||||
0, 0 );
|
pState->prefsPrefs.colors );
|
||||||
setTimerCtls( hDlg, timerOn );
|
break;
|
||||||
break;
|
|
||||||
case IDC_PREFCOLORS:
|
|
||||||
pState->colorsChanged =
|
|
||||||
ceDoColorsEdit( hDlg, pState->globals,
|
|
||||||
pState->prefsPrefs.colors );
|
|
||||||
break;
|
|
||||||
#ifdef XWFEATURE_SEARCHLIMIT
|
#ifdef XWFEATURE_SEARCHLIMIT
|
||||||
case IDC_CHECKNOHINTS:
|
case IDC_CHECKNOHINTS:
|
||||||
timerOn = SendDlgItemMessage( hDlg, IDC_CHECKNOHINTS,
|
timerOn = SendDlgItemMessage( hDlg, IDC_CHECKNOHINTS,
|
||||||
BM_GETCHECK, 0, 0 );
|
BM_GETCHECK, 0, 0 );
|
||||||
ceShowOrHide( hDlg, IDC_CHECKHINTSLIMITS, !timerOn );
|
ceShowOrHide( hDlg, IDC_CHECKHINTSLIMITS, !timerOn );
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
case IDOK:
|
case IDOK:
|
||||||
ceControlsToPrefs( hDlg, &pState->prefsPrefs );
|
ceControlsToPrefs( hDlg, &pState->prefsPrefs );
|
||||||
case IDCANCEL:
|
case IDCANCEL:
|
||||||
EndDialog(hDlg, id);
|
EndDialog(hDlg, id);
|
||||||
pState->userCancelled = id == IDCANCEL;
|
pState->userCancelled = id == IDCANCEL;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -341,7 +324,7 @@ WrapPrefsDialog( HWND hDlg, CEAppGlobals* globals, CePrefsDlgState* state,
|
||||||
XP_Bool result;
|
XP_Bool result;
|
||||||
XP_MEMSET( state, 0, sizeof(*state) );
|
XP_MEMSET( state, 0, sizeof(*state) );
|
||||||
|
|
||||||
state->globals = globals;
|
state->dlgHdr.globals = globals;
|
||||||
state->isNewGame = isNewGame;
|
state->isNewGame = isNewGame;
|
||||||
XP_MEMCPY( &state->prefsPrefs, prefsPrefs, sizeof( state->prefsPrefs ) );
|
XP_MEMCPY( &state->prefsPrefs, prefsPrefs, sizeof( state->prefsPrefs ) );
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
|
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "cemain.h"
|
#include "cemain.h"
|
||||||
|
#include "ceutil.h"
|
||||||
|
|
||||||
typedef struct CeGamePrefs {
|
typedef struct CeGamePrefs {
|
||||||
XP_U16 gameSeconds;
|
XP_U16 gameSeconds;
|
||||||
|
@ -55,7 +56,7 @@ typedef struct CePrefsPrefs {
|
||||||
} CePrefsPrefs;
|
} CePrefsPrefs;
|
||||||
|
|
||||||
typedef struct CePrefsDlgState {
|
typedef struct CePrefsDlgState {
|
||||||
CEAppGlobals* globals;
|
CeDlgHdr dlgHdr;
|
||||||
CePrefsPrefs prefsPrefs;
|
CePrefsPrefs prefsPrefs;
|
||||||
|
|
||||||
XP_Bool userCancelled;
|
XP_Bool userCancelled;
|
||||||
|
|
|
@ -22,18 +22,18 @@
|
||||||
#include "ceutil.h"
|
#include "ceutil.h"
|
||||||
|
|
||||||
static void
|
static void
|
||||||
stuffTextInField( HWND hDlg, StrBoxInit* init )
|
stuffTextInField( HWND hDlg, StrBoxState* state )
|
||||||
{
|
{
|
||||||
XP_U16 nBytes = stream_getSize(init->stream);
|
XP_U16 nBytes = stream_getSize(state->stream);
|
||||||
XP_U16 len, crlen;
|
XP_U16 len, crlen;
|
||||||
XP_UCHAR* sbuf;
|
XP_UCHAR* sbuf;
|
||||||
wchar_t* wbuf;
|
wchar_t* wbuf;
|
||||||
#ifdef MEM_DEBUG
|
#ifdef MEM_DEBUG
|
||||||
CEAppGlobals* globals = init->globals;
|
CEAppGlobals* globals = state->dlgHdr.globals;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
sbuf = XP_MALLOC( globals->mpool, nBytes + 1 );
|
sbuf = XP_MALLOC( globals->mpool, nBytes + 1 );
|
||||||
stream_getBytes( init->stream, sbuf, nBytes );
|
stream_getBytes( state->stream, sbuf, nBytes );
|
||||||
|
|
||||||
crlen = strlen(XP_CR);
|
crlen = strlen(XP_CR);
|
||||||
if ( 0 == strncmp( XP_CR, &sbuf[nBytes-crlen], crlen ) ) {
|
if ( 0 == strncmp( XP_CR, &sbuf[nBytes-crlen], crlen ) ) {
|
||||||
|
@ -58,60 +58,57 @@ StrBox(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
LRESULT handled = FALSE;
|
LRESULT handled = FALSE;
|
||||||
CEAppGlobals* globals = NULL;
|
CEAppGlobals* globals = NULL;
|
||||||
StrBoxInit* init;
|
StrBoxState* state;
|
||||||
XP_U16 id;
|
XP_U16 id;
|
||||||
|
|
||||||
if ( message == WM_INITDIALOG ) {
|
if ( message == WM_INITDIALOG ) {
|
||||||
SetWindowLong( hDlg, GWL_USERDATA, (long)lParam );
|
SetWindowLong( hDlg, GWL_USERDATA, (long)lParam );
|
||||||
init = (StrBoxInit*)lParam;
|
state = (StrBoxState*)lParam;
|
||||||
|
|
||||||
globals = init->globals;
|
if ( !!state->title ) {
|
||||||
|
SendMessage( hDlg, WM_SETTEXT, 0, (long)state->title );
|
||||||
if ( !!init->title ) {
|
|
||||||
SendMessage( hDlg, WM_SETTEXT, 0, (long)init->title );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !init->isQuery ) {
|
if ( !state->isQuery ) {
|
||||||
ceShowOrHide( hDlg, IDCANCEL, XP_FALSE );
|
ceShowOrHide( hDlg, IDCANCEL, XP_FALSE );
|
||||||
/* also want to expand the text box to the bottom */
|
/* also want to expand the text box to the bottom */
|
||||||
if ( !ceIsLandscape( globals ) ) {
|
if ( !ceIsLandscape( state->dlgHdr.globals ) ) {
|
||||||
ceCenterCtl( hDlg, IDOK );
|
ceCenterCtl( hDlg, IDOK );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ceDlgSetup( globals, hDlg );
|
ceDlgSetup( &state->dlgHdr, hDlg, DLG_STATE_NONE );
|
||||||
|
|
||||||
handled = TRUE;
|
handled = TRUE;
|
||||||
} else {
|
} else {
|
||||||
init = (StrBoxInit*)GetWindowLong( hDlg, GWL_USERDATA );
|
state = (StrBoxState*)GetWindowLong( hDlg, GWL_USERDATA );
|
||||||
|
|
||||||
if ( !!init ) {
|
if ( !!state ) {
|
||||||
|
if ( ceDoDlgHandle( &state->dlgHdr, message, wParam, lParam) ) {
|
||||||
|
handled = TRUE;
|
||||||
|
} else {
|
||||||
|
switch (message) {
|
||||||
|
|
||||||
switch (message) {
|
case WM_COMMAND:
|
||||||
|
|
||||||
case WM_VSCROLL:
|
/* If I add the text above in the WM_INITDIALOG section it
|
||||||
ceDoDlgScroll( globals, hDlg, wParam );
|
shows up selected though selStart and selEnd are 0. */
|
||||||
break;
|
if ( !state->textIsSet ) {
|
||||||
|
state->textIsSet = XP_TRUE;
|
||||||
|
stuffTextInField( hDlg, state );
|
||||||
|
}
|
||||||
|
|
||||||
case WM_COMMAND:
|
id = LOWORD(wParam);
|
||||||
|
switch( id ) {
|
||||||
|
|
||||||
/* If I add the text above in the WM_INITDIALOG section it
|
case IDOK:
|
||||||
shows up selected though selStart and selEnd are 0. */
|
case IDCANCEL:
|
||||||
if ( !init->textIsSet ) {
|
state->result = id;
|
||||||
init->textIsSet = XP_TRUE;
|
EndDialog(hDlg, id);
|
||||||
stuffTextInField( hDlg, init );
|
handled = TRUE;
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
id = LOWORD(wParam);
|
|
||||||
switch( id ) {
|
|
||||||
|
|
||||||
case IDOK:
|
|
||||||
case IDCANCEL:
|
|
||||||
init->result = id;
|
|
||||||
EndDialog(hDlg, id);
|
|
||||||
handled = TRUE;
|
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,16 +21,17 @@
|
||||||
|
|
||||||
#include "xwstream.h"
|
#include "xwstream.h"
|
||||||
#include "cemain.h"
|
#include "cemain.h"
|
||||||
|
#include "ceutil.h"
|
||||||
|
|
||||||
LRESULT CALLBACK StrBox(HWND hDlg, UINT message, WPARAM wParam,
|
LRESULT CALLBACK StrBox(HWND hDlg, UINT message, WPARAM wParam,
|
||||||
LPARAM lParam);
|
LPARAM lParam);
|
||||||
|
|
||||||
|
|
||||||
typedef struct StrBoxInit {
|
typedef struct StrBoxState {
|
||||||
CEAppGlobals* globals;
|
CeDlgHdr dlgHdr;
|
||||||
wchar_t* title;
|
wchar_t* title;
|
||||||
XWStreamCtxt* stream;
|
XWStreamCtxt* stream;
|
||||||
XP_U16 result;
|
XP_U16 result;
|
||||||
XP_Bool isQuery;
|
XP_Bool isQuery;
|
||||||
XP_Bool textIsSet;
|
XP_Bool textIsSet;
|
||||||
} StrBoxInit;
|
} StrBoxState;
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
#include "debhacks.h"
|
#include "debhacks.h"
|
||||||
|
|
||||||
typedef struct CeSaveGameNameState {
|
typedef struct CeSaveGameNameState {
|
||||||
CEAppGlobals* globals;
|
CeDlgHdr dlgHdr;
|
||||||
wchar_t* buf;
|
wchar_t* buf;
|
||||||
XP_U16 buflen;
|
XP_U16 buflen;
|
||||||
XP_Bool cancelled;
|
XP_Bool cancelled;
|
||||||
|
@ -83,8 +83,7 @@ SaveNameDlg( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam )
|
||||||
state->cancelled = XP_TRUE;
|
state->cancelled = XP_TRUE;
|
||||||
state->inited = XP_FALSE;
|
state->inited = XP_FALSE;
|
||||||
|
|
||||||
ceDlgSetup( state->globals, hDlg );
|
ceDlgSetup( &state->dlgHdr, hDlg, DLG_STATE_TRAPBACK );
|
||||||
trapBackspaceKey( hDlg );
|
|
||||||
|
|
||||||
result = TRUE;
|
result = TRUE;
|
||||||
} else {
|
} else {
|
||||||
|
@ -95,36 +94,33 @@ SaveNameDlg( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam )
|
||||||
(void)SetDlgItemText( hDlg, IDC_SVGN_EDIT, state->buf );
|
(void)SetDlgItemText( hDlg, IDC_SVGN_EDIT, state->buf );
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (message) {
|
if ( ceDoDlgHandle( &state->dlgHdr, message, wParam, lParam) ) {
|
||||||
#ifdef _WIN32_WCE
|
result = TRUE;
|
||||||
case WM_HOTKEY:
|
} else {
|
||||||
if ( VK_TBACK == HIWORD(lParam) ) {
|
|
||||||
SHSendBackToFocusWindow( message, wParam, lParam );
|
switch (message) {
|
||||||
result = TRUE;
|
case WM_COMMAND:
|
||||||
}
|
wid = LOWORD(wParam);
|
||||||
break;
|
switch( wid ) {
|
||||||
#endif
|
case IDOK: {
|
||||||
case WM_COMMAND:
|
wchar_t buf[128];
|
||||||
wid = LOWORD(wParam);
|
(void)GetDlgItemText( hDlg, IDC_SVGN_EDIT, buf,
|
||||||
switch( wid ) {
|
VSIZE(buf) );
|
||||||
case IDOK: {
|
if ( ceFileExists( buf ) ) {
|
||||||
wchar_t buf[128];
|
messageBoxChar( state->dlgHdr.globals, "File exists",
|
||||||
(void)GetDlgItemText( hDlg, IDC_SVGN_EDIT, buf,
|
L"Oops!", MB_OK );
|
||||||
VSIZE(buf) );
|
break;
|
||||||
if ( ceFileExists( buf ) ) {
|
}
|
||||||
messageBoxChar( state->globals, "File exists",
|
swprintf( state->buf, DEFAULT_DIR_NAME L"\\%s.xwg", buf );
|
||||||
L"Oops!", MB_OK );
|
XP_LOGW( __func__, state->buf );
|
||||||
|
/* fallthru */
|
||||||
|
state->cancelled = XP_FALSE;
|
||||||
|
}
|
||||||
|
case IDCANCEL:
|
||||||
|
EndDialog(hDlg, wid);
|
||||||
|
result = TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
swprintf( state->buf, DEFAULT_DIR_NAME L"\\%s.xwg", buf );
|
|
||||||
XP_LOGW( __func__, state->buf );
|
|
||||||
/* fallthru */
|
|
||||||
state->cancelled = XP_FALSE;
|
|
||||||
}
|
|
||||||
case IDCANCEL:
|
|
||||||
EndDialog(hDlg, wid);
|
|
||||||
result = TRUE;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -142,7 +138,7 @@ ceConfirmUniqueName( CEAppGlobals* globals, wchar_t* buf, XP_U16 buflen )
|
||||||
makeUniqueName( buf, buflen );
|
makeUniqueName( buf, buflen );
|
||||||
|
|
||||||
XP_MEMSET( &state, 0, sizeof(state) );
|
XP_MEMSET( &state, 0, sizeof(state) );
|
||||||
state.globals = globals;
|
state.dlgHdr.globals = globals;
|
||||||
state.buf = buf;
|
state.buf = buf;
|
||||||
state.buflen = buflen;
|
state.buflen = buflen;
|
||||||
(void)DialogBoxParam( globals->hInst, (LPCTSTR)IDD_SAVENAMEDLG,
|
(void)DialogBoxParam( globals->hInst, (LPCTSTR)IDD_SAVENAMEDLG,
|
||||||
|
@ -153,8 +149,7 @@ ceConfirmUniqueName( CEAppGlobals* globals, wchar_t* buf, XP_U16 buflen )
|
||||||
} /* ceConfirmUniqueName */
|
} /* ceConfirmUniqueName */
|
||||||
|
|
||||||
typedef struct CeSavedGamesState {
|
typedef struct CeSavedGamesState {
|
||||||
CEAppGlobals* globals;
|
CeDlgHdr dlgHdr;
|
||||||
HWND hDlg;
|
|
||||||
wchar_t* buf;
|
wchar_t* buf;
|
||||||
XP_U16 buflen;
|
XP_U16 buflen;
|
||||||
XP_S16 sel;
|
XP_S16 sel;
|
||||||
|
@ -197,7 +192,7 @@ static void
|
||||||
setButtons( CeSavedGamesState* state )
|
setButtons( CeSavedGamesState* state )
|
||||||
{
|
{
|
||||||
/* Open button disabled by default in case no games */
|
/* Open button disabled by default in case no games */
|
||||||
ceEnOrDisable( state->hDlg, IDC_SVGM_OPEN, state->nItems > 0 );
|
ceEnOrDisable( state->dlgHdr.hDlg, IDC_SVGM_OPEN, state->nItems > 0 );
|
||||||
/* ceEnOrDisable( state->hDlg, IDC_SVGM_DEL, state->nItems > 0 ); */
|
/* ceEnOrDisable( state->hDlg, IDC_SVGM_DEL, state->nItems > 0 ); */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -225,7 +220,7 @@ initSavedGamesData( CeSavedGamesState* state )
|
||||||
|
|
||||||
XP_ASSERT( data.cFileName[len-4] == '.');
|
XP_ASSERT( data.cFileName[len-4] == '.');
|
||||||
data.cFileName[len-4] = 0;
|
data.cFileName[len-4] = 0;
|
||||||
SendDlgItemMessage( state->hDlg, IDC_SVGM_GAMELIST, ADDSTRING,
|
SendDlgItemMessage( state->dlgHdr.hDlg, IDC_SVGM_GAMELIST, ADDSTRING,
|
||||||
0, (LPARAM)data.cFileName );
|
0, (LPARAM)data.cFileName );
|
||||||
|
|
||||||
++state->nItems;
|
++state->nItems;
|
||||||
|
@ -236,7 +231,7 @@ initSavedGamesData( CeSavedGamesState* state )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SendDlgItemMessage( state->hDlg, IDC_SVGM_GAMELIST, SETCURSEL, curSel, 0 );
|
SendDlgItemMessage( state->dlgHdr.hDlg, IDC_SVGM_GAMELIST, SETCURSEL, curSel, 0 );
|
||||||
state->sel = curSel;
|
state->sel = curSel;
|
||||||
setEditFromSel( state );
|
setEditFromSel( state );
|
||||||
|
|
||||||
|
@ -277,10 +272,9 @@ SavedGamesDlg( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam )
|
||||||
SetWindowLong( hDlg, GWL_USERDATA, lParam );
|
SetWindowLong( hDlg, GWL_USERDATA, lParam );
|
||||||
|
|
||||||
state = (CeSavedGamesState*)lParam;
|
state = (CeSavedGamesState*)lParam;
|
||||||
state->hDlg = hDlg;
|
|
||||||
state->inited = XP_FALSE;
|
state->inited = XP_FALSE;
|
||||||
|
|
||||||
ceDlgSetup( state->globals, hDlg );
|
ceDlgSetup( &state->dlgHdr, hDlg, DLG_STATE_NONE );
|
||||||
|
|
||||||
result = TRUE;
|
result = TRUE;
|
||||||
} else {
|
} else {
|
||||||
|
@ -292,56 +286,52 @@ SavedGamesDlg( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam )
|
||||||
initSavedGamesData( state );
|
initSavedGamesData( state );
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (message) {
|
if ( ceDoDlgHandle( &state->dlgHdr, message, wParam, lParam) ) {
|
||||||
|
result = TRUE;
|
||||||
|
} else {
|
||||||
|
switch (message) {
|
||||||
|
|
||||||
case WM_VSCROLL:
|
case WM_COMMAND:
|
||||||
ceDoDlgScroll( state->globals, hDlg, wParam );
|
wid = LOWORD(wParam);
|
||||||
break;
|
switch( wid ) {
|
||||||
|
|
||||||
case WM_NEXTDLGCTL:
|
case IDC_SVGM_GAMELIST:
|
||||||
ceDoDlgFocusScroll( state->globals, hDlg, wParam, lParam );
|
if ( HIWORD(wParam) == CBN_SELCHANGE ) {
|
||||||
break;
|
XP_S16 sel = SendDlgItemMessage( hDlg,
|
||||||
|
IDC_SVGM_GAMELIST,
|
||||||
case WM_COMMAND:
|
GETCURSEL, 0, 0L);
|
||||||
wid = LOWORD(wParam);
|
if ( sel >= 0 ) {
|
||||||
switch( wid ) {
|
state->sel = sel;
|
||||||
|
setEditFromSel( state );
|
||||||
case IDC_SVGM_GAMELIST:
|
}
|
||||||
if ( HIWORD(wParam) == CBN_SELCHANGE ) {
|
|
||||||
XP_S16 sel = SendDlgItemMessage( state->hDlg,
|
|
||||||
IDC_SVGM_GAMELIST,
|
|
||||||
GETCURSEL, 0, 0L);
|
|
||||||
if ( sel >= 0 ) {
|
|
||||||
state->sel = sel;
|
|
||||||
setEditFromSel( state );
|
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* case IDC_SVGM_DUP: */
|
||||||
|
/* case IDC_SVGM_CHANGE: */
|
||||||
|
/* notImpl( state->globals ); */
|
||||||
|
/* break; */
|
||||||
|
/* case IDC_SVGM_DEL: */
|
||||||
|
/* deleteSelected( state ); */
|
||||||
|
/* break; */
|
||||||
|
|
||||||
|
case IDC_SVGM_OPEN: {
|
||||||
|
wchar_t buf[128];
|
||||||
|
XP_U16 len = VSIZE(buf);
|
||||||
|
getCBText( hDlg, IDC_SVGM_GAMELIST, state->sel,
|
||||||
|
buf, &len );
|
||||||
|
swprintf( state->buf, DEFAULT_DIR_NAME L"\\%s.xwg", buf );
|
||||||
|
XP_LOGW( "returning", state->buf );
|
||||||
|
state->opened = XP_TRUE;
|
||||||
|
}
|
||||||
|
/* fallthrough */
|
||||||
|
case IDOK:
|
||||||
|
/* fallthrough */
|
||||||
|
case IDCANCEL:
|
||||||
|
EndDialog(hDlg, wid);
|
||||||
|
result = TRUE;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
|
|
||||||
/* case IDC_SVGM_DUP: */
|
|
||||||
/* case IDC_SVGM_CHANGE: */
|
|
||||||
/* notImpl( state->globals ); */
|
|
||||||
/* break; */
|
|
||||||
/* case IDC_SVGM_DEL: */
|
|
||||||
/* deleteSelected( state ); */
|
|
||||||
/* break; */
|
|
||||||
|
|
||||||
case IDC_SVGM_OPEN: {
|
|
||||||
wchar_t buf[128];
|
|
||||||
XP_U16 len = VSIZE(buf);
|
|
||||||
getCBText( state->hDlg, IDC_SVGM_GAMELIST, state->sel,
|
|
||||||
buf, &len );
|
|
||||||
swprintf( state->buf, DEFAULT_DIR_NAME L"\\%s.xwg", buf );
|
|
||||||
XP_LOGW( "returning", state->buf );
|
|
||||||
state->opened = XP_TRUE;
|
|
||||||
}
|
|
||||||
/* fallthrough */
|
|
||||||
case IDOK:
|
|
||||||
/* fallthrough */
|
|
||||||
case IDCANCEL:
|
|
||||||
EndDialog(hDlg, wid);
|
|
||||||
result = TRUE;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -359,7 +349,7 @@ ceSavedGamesDlg( CEAppGlobals* globals, const XP_UCHAR* curPath,
|
||||||
LOG_FUNC();
|
LOG_FUNC();
|
||||||
|
|
||||||
XP_MEMSET( &state, 0, sizeof(state) ); /* sets cancelled */
|
XP_MEMSET( &state, 0, sizeof(state) ); /* sets cancelled */
|
||||||
state.globals = globals;
|
state.dlgHdr.globals = globals;
|
||||||
state.buf = buf;
|
state.buf = buf;
|
||||||
state.buflen = buflen;
|
state.buflen = buflen;
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,11 @@
|
||||||
#define HPADDING_L 2
|
#define HPADDING_L 2
|
||||||
#define HPADDING_R 3
|
#define HPADDING_R 3
|
||||||
|
|
||||||
|
static XP_Bool ceDoDlgScroll( CeDlgHdr* dlgHdr, WPARAM wParam );
|
||||||
|
static void ceDoDlgFocusScroll( CEAppGlobals* globals, HWND hDlg,
|
||||||
|
WPARAM wParam, LPARAM lParam );
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ceSetDlgItemText( HWND hDlg, XP_U16 id, const XP_UCHAR* buf )
|
ceSetDlgItemText( HWND hDlg, XP_U16 id, const XP_UCHAR* buf )
|
||||||
{
|
{
|
||||||
|
@ -334,11 +339,16 @@ mkFullscreenWithSoftkeys( CEAppGlobals* globals, HWND hDlg )
|
||||||
|
|
||||||
#define TITLE_HT 20 /* Need to get this from the OS */
|
#define TITLE_HT 20 /* Need to get this from the OS */
|
||||||
void
|
void
|
||||||
ceDlgSetup( CEAppGlobals* globals, HWND hDlg )
|
ceDlgSetup( CeDlgHdr* dlgHdr, HWND hDlg, DlgStateTask doWhat )
|
||||||
{
|
{
|
||||||
XP_ASSERT( !!globals );
|
|
||||||
RECT rect;
|
RECT rect;
|
||||||
XP_U16 vHeight;
|
XP_U16 vHeight;
|
||||||
|
CEAppGlobals* globals = dlgHdr->globals;
|
||||||
|
|
||||||
|
dlgHdr->hDlg = hDlg;
|
||||||
|
|
||||||
|
XP_ASSERT( !!globals );
|
||||||
|
XP_ASSERT( !!hDlg );
|
||||||
|
|
||||||
GetClientRect( hDlg, &rect );
|
GetClientRect( hDlg, &rect );
|
||||||
XP_ASSERT( rect.top == 0 );
|
XP_ASSERT( rect.top == 0 );
|
||||||
|
@ -380,8 +390,39 @@ ceDlgSetup( CEAppGlobals* globals, HWND hDlg )
|
||||||
(void)SetScrollInfo( hDlg, SB_VERT, &sinfo, FALSE );
|
(void)SetScrollInfo( hDlg, SB_VERT, &sinfo, FALSE );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( IS_SMARTPHONE(globals) && ((doWhat & DLG_STATE_TRAPBACK) != 0) ) {
|
||||||
|
trapBackspaceKey( hDlg );
|
||||||
|
}
|
||||||
|
|
||||||
|
dlgHdr->doWhat = doWhat;
|
||||||
} /* ceDlgSetup */
|
} /* ceDlgSetup */
|
||||||
|
|
||||||
|
XP_Bool
|
||||||
|
ceDoDlgHandle( CeDlgHdr* dlgHdr, UINT message, WPARAM wParam, LPARAM lParam )
|
||||||
|
{
|
||||||
|
XP_Bool handled = XP_FALSE;
|
||||||
|
switch( message ) {
|
||||||
|
#ifdef _WIN32_WCE
|
||||||
|
case WM_HOTKEY:
|
||||||
|
XP_ASSERT( (dlgHdr->doWhat && DLG_STATE_TRAPBACK) != 0 );
|
||||||
|
if ( VK_TBACK == HIWORD(lParam) ) {
|
||||||
|
SHSendBackToFocusWindow( message, wParam, lParam );
|
||||||
|
handled = TRUE;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
case WM_VSCROLL:
|
||||||
|
handled = ceDoDlgScroll( dlgHdr, wParam );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WM_NEXTDLGCTL:
|
||||||
|
ceDoDlgFocusScroll( dlgHdr->globals, dlgHdr->hDlg, wParam, lParam );
|
||||||
|
handled = TRUE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return handled;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
setScrollPos( HWND hDlg, XP_S16 newPos )
|
setScrollPos( HWND hDlg, XP_S16 newPos )
|
||||||
{
|
{
|
||||||
|
@ -432,10 +473,10 @@ adjustScrollPos( HWND hDlg, XP_S16 vertChange )
|
||||||
LOG_RETURN_VOID();
|
LOG_RETURN_VOID();
|
||||||
} /* adjustScrollPos */
|
} /* adjustScrollPos */
|
||||||
|
|
||||||
XP_Bool
|
static XP_Bool
|
||||||
ceDoDlgScroll( CEAppGlobals* globals, HWND hDlg, WPARAM wParam )
|
ceDoDlgScroll( CeDlgHdr* dlgHdr, WPARAM wParam )
|
||||||
{
|
{
|
||||||
XP_Bool handled = !IS_SMARTPHONE(globals);
|
XP_Bool handled = !IS_SMARTPHONE(dlgHdr->globals);
|
||||||
if ( handled ) {
|
if ( handled ) {
|
||||||
XP_S16 vertChange = 0;
|
XP_S16 vertChange = 0;
|
||||||
|
|
||||||
|
@ -457,12 +498,12 @@ ceDoDlgScroll( CEAppGlobals* globals, HWND hDlg, WPARAM wParam )
|
||||||
|
|
||||||
case SB_THUMBTRACK: /* still dragging; don't redraw */
|
case SB_THUMBTRACK: /* still dragging; don't redraw */
|
||||||
case SB_THUMBPOSITION:
|
case SB_THUMBPOSITION:
|
||||||
setScrollPos( hDlg, HIWORD(wParam) );
|
setScrollPos( dlgHdr->hDlg, HIWORD(wParam) );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( 0 != vertChange ) {
|
if ( 0 != vertChange ) {
|
||||||
adjustScrollPos( hDlg, vertChange );
|
adjustScrollPos( dlgHdr->hDlg, vertChange );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return handled;
|
return handled;
|
||||||
|
@ -483,7 +524,7 @@ ceDoDlgScroll( CEAppGlobals* globals, HWND hDlg, WPARAM wParam )
|
||||||
indicates whether the next or previous control with the WS_TABSTOP
|
indicates whether the next or previous control with the WS_TABSTOP
|
||||||
style receives the focus. */
|
style receives the focus. */
|
||||||
|
|
||||||
void
|
static void
|
||||||
ceDoDlgFocusScroll( CEAppGlobals* globals, HWND hDlg, WPARAM wParam, LPARAM lParam )
|
ceDoDlgFocusScroll( CEAppGlobals* globals, HWND hDlg, WPARAM wParam, LPARAM lParam )
|
||||||
{
|
{
|
||||||
/* Scroll the current focus owner into view.
|
/* Scroll the current focus owner into view.
|
||||||
|
|
|
@ -44,15 +44,22 @@ void ceSetChecked( HWND hDlg, XP_U16 resID, XP_Bool check );
|
||||||
void ceCenterCtl( HWND hDlg, XP_U16 resID );
|
void ceCenterCtl( HWND hDlg, XP_U16 resID );
|
||||||
|
|
||||||
/* set vHeight to 0 to turn off scrolling */
|
/* set vHeight to 0 to turn off scrolling */
|
||||||
void ceDlgSetup( CEAppGlobals* globals, HWND hDlg );
|
typedef enum { DLG_STATE_NONE = 0, DLG_STATE_TRAPBACK = 1 } DlgStateTask;
|
||||||
|
typedef struct CeDlgHdr {
|
||||||
|
CEAppGlobals* globals;
|
||||||
|
HWND hDlg;
|
||||||
|
|
||||||
|
/* Below this line is private to ceutil.c */
|
||||||
|
DlgStateTask doWhat;
|
||||||
|
} CeDlgHdr;
|
||||||
|
void ceDlgSetup( CeDlgHdr* dlgHdr, HWND hDlg, DlgStateTask doWhat );
|
||||||
|
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? */
|
||||||
XP_Bool ceIsLandscape( CEAppGlobals* globals );
|
XP_Bool ceIsLandscape( CEAppGlobals* globals );
|
||||||
|
|
||||||
void ceSetLeftSoftkey( CEAppGlobals* globals, XP_U16 id );
|
void ceSetLeftSoftkey( CEAppGlobals* globals, XP_U16 id );
|
||||||
XP_Bool ceDoDlgScroll( CEAppGlobals* globals, HWND hDlg, WPARAM wParam );
|
|
||||||
void ceDoDlgFocusScroll( CEAppGlobals* globals, HWND hDlg,
|
|
||||||
WPARAM wParam, LPARAM lParam );
|
|
||||||
#ifdef _WIN32_WCE
|
#ifdef _WIN32_WCE
|
||||||
void ceSizeIfFullscreen( CEAppGlobals* globals, HWND hWnd );
|
void ceSizeIfFullscreen( CEAppGlobals* globals, HWND hWnd );
|
||||||
void trapBackspaceKey( HWND hDlg );
|
void trapBackspaceKey( HWND hDlg );
|
||||||
|
|
Loading…
Add table
Reference in a new issue