mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-29 08:34:37 +01:00
Implement dup, delete and rename buttons in saved games dialog.
Differs from Palm in having no edit field. Rather, a separate dialog comes up to get the new name. Rather than reload the spinbox with a new set of saved games after an action, just close and reopen the dialog.
This commit is contained in:
parent
9ca72bd61a
commit
b265e3fa18
8 changed files with 219 additions and 147 deletions
|
@ -138,8 +138,6 @@ static void ce_util_engineStarting( XW_UtilCtxt* uc );
|
|||
static void ce_util_engineStopping( XW_UtilCtxt* uc );
|
||||
#endif
|
||||
|
||||
static XP_Bool queryBoxChar( CEAppGlobals* globals, XP_UCHAR* msg );
|
||||
|
||||
static XP_Bool ceMsgFromStream( CEAppGlobals* globals, XWStreamCtxt* stream,
|
||||
wchar_t* title, XP_U16 buttons,
|
||||
XP_Bool destroy );
|
||||
|
@ -166,8 +164,8 @@ static XP_Bool isDefaultName( const XP_UCHAR* name );
|
|||
* "wine obj_win32_dbg/xwords4.exe height=240 width=320"
|
||||
*/
|
||||
|
||||
static int g_dbWidth = 0;
|
||||
static int g_dbHeight = 0;
|
||||
static int g_dbWidth = 240;
|
||||
static int g_dbHeight = 240;
|
||||
|
||||
static void
|
||||
doCmd( const char* cmd )
|
||||
|
@ -1457,38 +1455,44 @@ ceDoNewGame( CEAppGlobals* globals )
|
|||
static void
|
||||
ceChooseAndOpen( CEAppGlobals* globals )
|
||||
{
|
||||
wchar_t path[256];
|
||||
path[0] = 0;
|
||||
if ( ceSavedGamesDlg( globals, globals->curGameName, path, VSIZE(path) ) ) {
|
||||
XP_UCHAR* name;
|
||||
XP_U16 len;
|
||||
// Save in case we'll be duplicating it
|
||||
if ( ceSaveCurGame( globals, XP_FALSE ) ) {
|
||||
wchar_t path[256];
|
||||
path[0] = 0;
|
||||
|
||||
len = wcslen(path);
|
||||
name = XP_MALLOC( globals->mpool, len + 1 );
|
||||
ceSetTitleFromName( globals ); /* in case we named it above */
|
||||
|
||||
WideCharToMultiByte( CP_ACP, 0, path, len + 1,
|
||||
name, len + 1, NULL, NULL );
|
||||
if ( ceSavedGamesDlg( globals, globals->curGameName, path, VSIZE(path) )) {
|
||||
XP_UCHAR* name;
|
||||
XP_U16 len;
|
||||
|
||||
len = wcslen(path);
|
||||
name = XP_MALLOC( globals->mpool, len + 1 );
|
||||
|
||||
WideCharToMultiByte( CP_ACP, 0, path, len + 1,
|
||||
name, len + 1, NULL, NULL );
|
||||
|
||||
if ( globals->curGameName != NULL
|
||||
&& 0 == XP_STRCMP( name, globals->curGameName ) ){ /*already open*/
|
||||
XP_FREE( globals->mpool, name );
|
||||
} else if ( ceSaveCurGame( globals, XP_FALSE )
|
||||
|| queryBoxChar( globals, "Do you really want to "
|
||||
"overwrite the current game?" ) ) {
|
||||
if ( globals->curGameName != NULL
|
||||
&& 0 == XP_STRCMP( name, globals->curGameName ) ){ /*already open*/
|
||||
XP_FREE( globals->mpool, name );
|
||||
} else if ( ceSaveCurGame( globals, XP_FALSE )
|
||||
|| queryBoxChar( globals, "Do you really want to "
|
||||
"overwrite the current game?" ) ) {
|
||||
|
||||
if ( globals->curGameName != NULL ) {
|
||||
XP_FREE( globals->mpool, globals->curGameName );
|
||||
}
|
||||
if ( globals->curGameName != NULL ) {
|
||||
XP_FREE( globals->mpool, globals->curGameName );
|
||||
}
|
||||
|
||||
globals->curGameName = name;
|
||||
if ( ceLoadSavedGame( globals ) ) {
|
||||
ceInitAndStartBoard( globals, XP_FALSE, NULL );
|
||||
} else {
|
||||
XP_LOGF( "failed to open chosen game" );
|
||||
globals->curGameName = name;
|
||||
if ( ceLoadSavedGame( globals ) ) {
|
||||
ceInitAndStartBoard( globals, XP_FALSE, NULL );
|
||||
} else {
|
||||
XP_LOGF( "failed to open chosen game" );
|
||||
}
|
||||
}
|
||||
} else {
|
||||
XP_LOGF( "GetOpenFileName() failed" );
|
||||
}
|
||||
} else {
|
||||
XP_LOGF( "GetOpenFileName() failed" );
|
||||
}
|
||||
} /* ceChooseAndOpen */
|
||||
|
||||
|
@ -1589,9 +1593,10 @@ ceSaveCurGame( CEAppGlobals* globals, XP_Bool autoSave )
|
|||
|
||||
confirmed = XP_TRUE;
|
||||
} else {
|
||||
wchar_t nameBuf[256];
|
||||
wchar_t nameBuf[MAX_PATH];
|
||||
|
||||
confirmed = ceConfirmUniqueName( globals, nameBuf, VSIZE(nameBuf) );
|
||||
confirmed = ceConfirmUniqueName( globals, IDS_SAVENAME,
|
||||
nameBuf, VSIZE(nameBuf) );
|
||||
if ( confirmed ) {
|
||||
XP_U16 len = wcslen(nameBuf);
|
||||
XP_DEBUGF( "len(nameBuf) = %d", len );
|
||||
|
@ -2401,8 +2406,8 @@ messageBoxStream( CEAppGlobals* globals, XWStreamCtxt* stream, wchar_t* title,
|
|||
return result;
|
||||
} /* messageBoxStream */
|
||||
|
||||
static XP_Bool
|
||||
queryBoxChar( CEAppGlobals* globals, XP_UCHAR* msg )
|
||||
XP_Bool
|
||||
queryBoxChar( CEAppGlobals* globals, const XP_UCHAR* msg )
|
||||
{
|
||||
wchar_t widebuf[128];
|
||||
XP_U16 answer;
|
||||
|
|
|
@ -205,6 +205,7 @@ void ce_drawctxt_update( DrawCtx* dctx );
|
|||
|
||||
int messageBoxChar( CEAppGlobals* globals, XP_UCHAR* str, wchar_t* title,
|
||||
XP_U16 buttons );
|
||||
XP_Bool queryBoxChar( CEAppGlobals* globals, const XP_UCHAR* msg );
|
||||
|
||||
#ifdef DEBUG
|
||||
void logLastError( const char* comment );
|
||||
|
|
199
wince/cesvdgms.c
199
wince/cesvdgms.c
|
@ -34,17 +34,11 @@ typedef struct CeSaveGameNameState {
|
|||
CeDlgHdr dlgHdr;
|
||||
wchar_t* buf;
|
||||
XP_U16 buflen;
|
||||
XP_U16 lableTextId;
|
||||
XP_Bool cancelled;
|
||||
XP_Bool inited;
|
||||
} CeSaveGameNameState;
|
||||
|
||||
/* static void */
|
||||
/* notImpl( CEAppGlobals* globals ) */
|
||||
/* { */
|
||||
/* messageBoxChar( globals, "To be implemented soon....", */
|
||||
/* L"Notice", MB_OK ); */
|
||||
/* } */
|
||||
|
||||
static XP_Bool
|
||||
ceFileExists( const wchar_t* name )
|
||||
{
|
||||
|
@ -85,6 +79,11 @@ SaveNameDlg( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam )
|
|||
state->cancelled = XP_TRUE;
|
||||
state->inited = XP_FALSE;
|
||||
|
||||
wchar_t buf[128];
|
||||
LoadString( state->dlgHdr.globals->hInst, state->lableTextId,
|
||||
buf, VSIZE(buf) );
|
||||
(void)SetDlgItemText( hDlg, IDC_SVGN_SELLAB, buf );
|
||||
|
||||
ceDlgSetup( &state->dlgHdr, hDlg, DLG_STATE_TRAPBACK );
|
||||
|
||||
result = TRUE;
|
||||
|
@ -131,7 +130,7 @@ SaveNameDlg( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam )
|
|||
} /* SaveNameDlg */
|
||||
|
||||
XP_Bool
|
||||
ceConfirmUniqueName( CEAppGlobals* globals, wchar_t* buf, XP_U16 buflen )
|
||||
ceConfirmUniqueName( CEAppGlobals* globals, XP_U16 strId, wchar_t* buf, XP_U16 buflen )
|
||||
{
|
||||
CeSaveGameNameState state;
|
||||
|
||||
|
@ -143,6 +142,7 @@ ceConfirmUniqueName( CEAppGlobals* globals, wchar_t* buf, XP_U16 buflen )
|
|||
state.dlgHdr.globals = globals;
|
||||
state.buf = buf;
|
||||
state.buflen = buflen;
|
||||
state.lableTextId = strId;
|
||||
(void)DialogBoxParam( globals->hInst, (LPCTSTR)IDD_SAVENAMEDLG,
|
||||
globals->hWnd,
|
||||
(DLGPROC)SaveNameDlg, (long)&state );
|
||||
|
@ -155,15 +155,13 @@ typedef struct CeSavedGamesState {
|
|||
wchar_t* buf;
|
||||
XP_U16 buflen;
|
||||
XP_S16 sel;
|
||||
XP_U16 openGameIndex;
|
||||
wchar_t curName[128];
|
||||
XP_U16 nItems;
|
||||
|
||||
/* wchar_t** names; */
|
||||
/* XP_U16 nNamesUsed; */
|
||||
/* XP_U16 nNamesAllocd; */
|
||||
|
||||
XP_Bool opened;
|
||||
XP_Bool inited;
|
||||
XP_Bool relaunch;
|
||||
} CeSavedGamesState;
|
||||
|
||||
/* Probably belongs as a utility */
|
||||
|
@ -180,22 +178,27 @@ getCBText( HWND hDlg, XP_U16 id, XP_U16 sel, wchar_t* buf, XP_U16* lenp )
|
|||
} /* getCBText */
|
||||
|
||||
static void
|
||||
setEditFromSel( CeSavedGamesState* XP_UNUSED(state) )
|
||||
getFullSelPath( CeSavedGamesState* state, wchar_t* buf, XP_U16 buflen )
|
||||
{
|
||||
/* wchar_t buf[64]; */
|
||||
/* XP_U16 len = VSIZE(buf); */
|
||||
/* getCBText( state->hDlg, IDC_SVGM_GAMELIST, state->sel, buf, &len ); */
|
||||
/* if ( len <= VSIZE(buf) ) { */
|
||||
/* (void)SetDlgItemText( state->hDlg, IDC_SVGM_EDIT, buf ); */
|
||||
/* } */
|
||||
} /* */
|
||||
XP_U16 len;
|
||||
lstrcpy( buf, DEFAULT_DIR_NAME L"\\" );
|
||||
len = lstrlen( buf );
|
||||
buflen -= len;
|
||||
getCBText( state->dlgHdr.hDlg, IDC_SVGM_GAMELIST, state->sel, &buf[len], &buflen );
|
||||
lstrcat( buf, L".xwg" );
|
||||
}
|
||||
|
||||
static void
|
||||
setButtons( CeSavedGamesState* state )
|
||||
{
|
||||
/* Open button disabled by default in case no games */
|
||||
ceEnOrDisable( state->dlgHdr.hDlg, IDC_SVGM_OPEN, state->nItems > 0 );
|
||||
/* ceEnOrDisable( state->hDlg, IDC_SVGM_DEL, state->nItems > 0 ); */
|
||||
XP_Bool curSelected = state->openGameIndex == state->sel;
|
||||
XP_Bool haveItem = state->nItems > 0;
|
||||
HWND hDlg = state->dlgHdr.hDlg;
|
||||
|
||||
ceEnOrDisable( hDlg, IDC_SVGM_OPEN, haveItem && !curSelected );
|
||||
ceEnOrDisable( hDlg, IDC_SVGM_DUP, haveItem );
|
||||
ceEnOrDisable( hDlg, IDC_SVGM_DEL, haveItem && !curSelected );
|
||||
ceEnOrDisable( hDlg, IDC_SVGM_CHANGE, haveItem && !curSelected );
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -204,7 +207,8 @@ initSavedGamesData( CeSavedGamesState* state )
|
|||
HANDLE fileH;
|
||||
WIN32_FIND_DATA data;
|
||||
wchar_t path[256];
|
||||
XP_U16 curSel = 0, ii;
|
||||
XP_S16 curSel = state->sel;
|
||||
XP_U16 ii;
|
||||
|
||||
XP_MEMSET( &data, 0, sizeof(data) );
|
||||
lstrcpy( path, DEFAULT_DIR_NAME L"\\" );
|
||||
|
@ -213,11 +217,14 @@ initSavedGamesData( CeSavedGamesState* state )
|
|||
fileH = FindFirstFile( path, &data );
|
||||
for ( ii = 0; fileH != INVALID_HANDLE_VALUE; ++ii ) {
|
||||
XP_U16 len = wcslen( data.cFileName );
|
||||
XP_Bool isCurGame;
|
||||
|
||||
XP_LOGW( "comp1", state->curName );
|
||||
XP_LOGW( "comp2", data.cFileName );
|
||||
if ( curSel == 0 && 0 == wcscmp( state->curName, data.cFileName ) ) {
|
||||
curSel = ii;
|
||||
isCurGame = 0 == wcscmp( state->curName, data.cFileName );
|
||||
if ( isCurGame ) {
|
||||
state->openGameIndex = ii;
|
||||
if ( curSel == -1 ) {
|
||||
curSel = ii;
|
||||
}
|
||||
}
|
||||
|
||||
XP_ASSERT( data.cFileName[len-4] == '.');
|
||||
|
@ -235,39 +242,69 @@ initSavedGamesData( CeSavedGamesState* state )
|
|||
|
||||
SendDlgItemMessage( state->dlgHdr.hDlg, IDC_SVGM_GAMELIST, SETCURSEL, curSel, 0 );
|
||||
state->sel = curSel;
|
||||
setEditFromSel( state );
|
||||
|
||||
setButtons( state );
|
||||
|
||||
LOG_RETURN_VOID();
|
||||
} /* initSavedGamesData */
|
||||
|
||||
/* static void */
|
||||
/* deleteSelected( CeSavedGamesState* state ) */
|
||||
/* { */
|
||||
/* wchar_t buf[128]; */
|
||||
/* wchar_t path[128]; */
|
||||
/* XP_U16 len = VSIZE(buf); */
|
||||
static XP_Bool
|
||||
renameSelected( CeSavedGamesState* state )
|
||||
{
|
||||
wchar_t path[MAX_PATH];
|
||||
XP_Bool confirmed = ceConfirmUniqueName( state->dlgHdr.globals, IDS_RENAME,
|
||||
path, VSIZE(path) );
|
||||
if ( confirmed ) {
|
||||
wchar_t curPath[MAX_PATH];
|
||||
getFullSelPath( state, curPath, VSIZE(curPath) );
|
||||
confirmed = MoveFile( curPath, path );
|
||||
}
|
||||
return confirmed;
|
||||
} /* renameSelected */
|
||||
|
||||
/* /\* confirm first!!!! *\/ */
|
||||
static XP_Bool
|
||||
duplicateSelected( CeSavedGamesState* state )
|
||||
{
|
||||
wchar_t newPath[MAX_PATH];
|
||||
XP_Bool confirmed;
|
||||
|
||||
/* getCBText( state->hDlg, IDC_SVGM_GAMELIST, state->sel, buf, &len ); */
|
||||
/* swprintf( path, DEFAULT_DIR_NAME L"\\%s.xwg", buf ); */
|
||||
/* DeleteFile( path ); */
|
||||
confirmed = ceConfirmUniqueName( state->dlgHdr.globals, IDS_DUPENAME,
|
||||
newPath, VSIZE(newPath) );
|
||||
if ( confirmed ) {
|
||||
wchar_t curPath[MAX_PATH];
|
||||
getFullSelPath( state, curPath, VSIZE(curPath) );
|
||||
confirmed = CopyFile( curPath, newPath, TRUE ); /* TRUE is what??? */
|
||||
}
|
||||
return confirmed;
|
||||
} /* duplicateSelected */
|
||||
|
||||
/* SendDlgItemMessage( state->hDlg, IDC_SVGM_GAMELIST, DELETESTRING, */
|
||||
/* state->sel, 0L ); */
|
||||
static XP_Bool
|
||||
deleteSelected( CeSavedGamesState* state )
|
||||
{
|
||||
wchar_t buf[128];
|
||||
wchar_t path[128];
|
||||
XP_U16 len = VSIZE(buf);
|
||||
|
||||
/* --state->nItems; */
|
||||
|
||||
/* setButtons( state ); */
|
||||
/* } */
|
||||
/* confirm first!!!! */
|
||||
XP_Bool confirmed = queryBoxChar( state->dlgHdr.globals,
|
||||
"Are you certain you want to delete the "
|
||||
"selected game? This action cannot be "
|
||||
"undone.");
|
||||
if ( confirmed ) {
|
||||
getCBText( state->dlgHdr.hDlg, IDC_SVGM_GAMELIST, state->sel, buf, &len );
|
||||
swprintf( path, DEFAULT_DIR_NAME L"\\%s.xwg", buf );
|
||||
confirmed = DeleteFile( path );
|
||||
if ( confirmed ) {
|
||||
state->sel = -1;
|
||||
}
|
||||
}
|
||||
return confirmed;
|
||||
} /* deleteSelected */
|
||||
|
||||
static LRESULT CALLBACK
|
||||
SavedGamesDlg( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam )
|
||||
{
|
||||
CeSavedGamesState* state;
|
||||
XP_U16 wid;
|
||||
BOOL result = FALSE;
|
||||
|
||||
if ( message == WM_INITDIALOG ) {
|
||||
|
@ -276,7 +313,7 @@ SavedGamesDlg( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam )
|
|||
state = (CeSavedGamesState*)lParam;
|
||||
state->inited = XP_FALSE;
|
||||
|
||||
ceDlgSetup( &state->dlgHdr, hDlg, DLG_STATE_NONE );
|
||||
ceDlgSetup( &state->dlgHdr, hDlg, DLG_STATE_NONE|DLG_STATE_DONEONLY );
|
||||
|
||||
result = TRUE;
|
||||
} else {
|
||||
|
@ -290,32 +327,28 @@ SavedGamesDlg( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam )
|
|||
|
||||
if ( ceDoDlgHandle( &state->dlgHdr, message, wParam, lParam) ) {
|
||||
result = TRUE;
|
||||
} else {
|
||||
switch (message) {
|
||||
|
||||
case WM_COMMAND:
|
||||
wid = LOWORD(wParam);
|
||||
} else if ( message == WM_COMMAND ) {
|
||||
XP_U16 wid = LOWORD(wParam);
|
||||
if ( (IDC_SVGM_GAMELIST == wid)
|
||||
&& (CBN_SELCHANGE == HIWORD(wParam)) ) {
|
||||
XP_S16 sel = SendDlgItemMessage( hDlg, IDC_SVGM_GAMELIST,
|
||||
GETCURSEL, 0, 0L);
|
||||
if ( sel >= 0 ) {
|
||||
state->sel = sel;
|
||||
setButtons( state );
|
||||
}
|
||||
result = TRUE;
|
||||
} else if ( BN_CLICKED == HIWORD(wParam) ) {
|
||||
switch( wid ) {
|
||||
|
||||
case IDC_SVGM_GAMELIST:
|
||||
if ( HIWORD(wParam) == CBN_SELCHANGE ) {
|
||||
XP_S16 sel = SendDlgItemMessage( hDlg,
|
||||
IDC_SVGM_GAMELIST,
|
||||
GETCURSEL, 0, 0L);
|
||||
if ( sel >= 0 ) {
|
||||
state->sel = sel;
|
||||
setEditFromSel( state );
|
||||
}
|
||||
}
|
||||
case IDC_SVGM_DUP:
|
||||
state->relaunch = duplicateSelected( state );
|
||||
break;
|
||||
case IDC_SVGM_CHANGE:
|
||||
state->relaunch = renameSelected( state );
|
||||
break;
|
||||
case IDC_SVGM_DEL:
|
||||
state->relaunch = deleteSelected( 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];
|
||||
|
@ -327,13 +360,16 @@ SavedGamesDlg( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam )
|
|||
state->opened = XP_TRUE;
|
||||
}
|
||||
/* fallthrough */
|
||||
case IDOK:
|
||||
/* fallthrough */
|
||||
case IDCANCEL:
|
||||
case IDOK: /* Done button */
|
||||
EndDialog(hDlg, wid);
|
||||
result = TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
if ( state->relaunch ) {
|
||||
EndDialog( hDlg, wid );
|
||||
result = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -354,6 +390,7 @@ ceSavedGamesDlg( CEAppGlobals* globals, const XP_UCHAR* curPath,
|
|||
state.dlgHdr.globals = globals;
|
||||
state.buf = buf;
|
||||
state.buflen = buflen;
|
||||
state.sel = -1;
|
||||
|
||||
if ( !!curPath ) {
|
||||
wchar_t shortName[128];
|
||||
|
@ -368,11 +405,17 @@ ceSavedGamesDlg( CEAppGlobals* globals, const XP_UCHAR* curPath,
|
|||
XP_LOGW( "shortName", state.curName );
|
||||
}
|
||||
|
||||
(void)DialogBoxParam( globals->hInst, (LPCTSTR)IDD_SAVEDGAMESDLG,
|
||||
globals->hWnd,
|
||||
(DLGPROC)SavedGamesDlg, (long)&state );
|
||||
for ( ; ; ) {
|
||||
(void)DialogBoxParam( globals->hInst, (LPCTSTR)IDD_SAVEDGAMESDLG,
|
||||
globals->hWnd,
|
||||
(DLGPROC)SavedGamesDlg, (long)&state );
|
||||
|
||||
if ( !state.relaunch ) {
|
||||
break;
|
||||
}
|
||||
state.relaunch = XP_FALSE;
|
||||
}
|
||||
XP_LOGW( __func__, buf );
|
||||
|
||||
return state.opened;
|
||||
} /*ceSavedGamesDlg */
|
||||
} /* ceSavedGamesDlg */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* -*-mode: C; fill-column: 77; c-basic-offset: 4; -*- */
|
||||
/* -*- fill-column: 77; c-basic-offset: 4; compile-command: "make TARGET_OS=wince DEBUG=TRUE" -*- */
|
||||
/*
|
||||
* Copyright 2008 by Eric House (xwords@eehouse.org). All rights reserved.
|
||||
*
|
||||
|
@ -45,6 +45,6 @@
|
|||
|
||||
XP_Bool ceSavedGamesDlg( CEAppGlobals* globals, const XP_UCHAR* curPath,
|
||||
wchar_t* buf, XP_U16 buflen );
|
||||
XP_Bool ceConfirmUniqueName( CEAppGlobals* globals, wchar_t* buf,
|
||||
XP_Bool ceConfirmUniqueName( CEAppGlobals* globals, XP_U16 strId, wchar_t* buf,
|
||||
XP_U16 buflen );
|
||||
#endif
|
||||
|
|
|
@ -303,7 +303,8 @@ ceSizeIfFullscreen( CEAppGlobals* globals, HWND hWnd )
|
|||
}
|
||||
|
||||
static XP_Bool
|
||||
mkFullscreenWithSoftkeys( CEAppGlobals* globals, HWND hDlg, XP_U16 curHt )
|
||||
mkFullscreenWithSoftkeys( CEAppGlobals* globals, HWND hDlg, XP_U16 curHt,
|
||||
XP_Bool doneOnly )
|
||||
{
|
||||
XP_Bool success = XP_FALSE;
|
||||
|
||||
|
@ -311,7 +312,7 @@ mkFullscreenWithSoftkeys( CEAppGlobals* globals, HWND hDlg, XP_U16 curHt )
|
|||
XP_MEMSET( &mbi, 0, sizeof(mbi) );
|
||||
mbi.cbSize = sizeof(mbi);
|
||||
mbi.hwndParent = hDlg;
|
||||
mbi.nToolBarId = IDM_OKCANCEL_MENUBAR;
|
||||
mbi.nToolBarId = doneOnly? IDM_DONE_MENUBAR:IDM_OKCANCEL_MENUBAR;
|
||||
mbi.hInstRes = globals->hInst;
|
||||
success = SHCreateMenuBar( &mbi );
|
||||
if ( !success ) {
|
||||
|
@ -361,7 +362,8 @@ ceDlgSetup( CeDlgHdr* dlgHdr, HWND hDlg, DlgStateTask doWhat )
|
|||
vHeight = rect.bottom; /* This is before we've resized it */
|
||||
|
||||
#ifdef _WIN32_WCE
|
||||
(void)mkFullscreenWithSoftkeys( globals, hDlg, vHeight );
|
||||
(void)mkFullscreenWithSoftkeys( globals, hDlg, vHeight,
|
||||
(doWhat & DLG_STATE_DONEONLY) != 0);
|
||||
#elif defined DEBUG
|
||||
/* Force it to be small so we can test scrolling etc. */
|
||||
if ( globals->dbWidth > 0 && globals->dbHeight > 0) {
|
||||
|
|
|
@ -44,7 +44,10 @@ void ceSetChecked( HWND hDlg, XP_U16 resID, XP_Bool check );
|
|||
void ceCenterCtl( HWND hDlg, XP_U16 resID );
|
||||
|
||||
/* set vHeight to 0 to turn off scrolling */
|
||||
typedef enum { DLG_STATE_NONE = 0, DLG_STATE_TRAPBACK = 1 } DlgStateTask;
|
||||
typedef enum { DLG_STATE_NONE = 0
|
||||
, DLG_STATE_TRAPBACK = 1
|
||||
, DLG_STATE_DONEONLY = 2
|
||||
} DlgStateTask;
|
||||
typedef struct CeDlgHdr {
|
||||
CEAppGlobals* globals;
|
||||
HWND hDlg;
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#define IDD_COLOREDITDLG 119
|
||||
#define IDM_MAIN_MENUBAR 120
|
||||
#define IDM_OKCANCEL_MENUBAR 121
|
||||
#define IDM_DONE_MENUBAR 122
|
||||
#define IDB_ORIGIN 124
|
||||
#ifdef XWFEATURE_SEARCHLIMIT
|
||||
# define IDD_ASKHINTLIMTS 125
|
||||
|
@ -176,11 +177,10 @@
|
|||
#define IDC_SVGM_SELLAB 1118
|
||||
#define IDC_SVGM_GAMELIST 1119
|
||||
/* Let's remove these until they're implemented */
|
||||
/* #define IDC_SVGM_EDITLAB 1111 */
|
||||
/* #define IDC_SVGM_CHANGE 1112 */
|
||||
/* #define IDC_SVGM_EDIT 1113 */
|
||||
/* #define IDC_SVGM_DUP 1114 */
|
||||
/* #define IDC_SVGM_DEL 1115 */
|
||||
#define IDC_SVGM_EDITLAB 1111
|
||||
#define IDC_SVGM_CHANGE 1112
|
||||
#define IDC_SVGM_DUP 1114
|
||||
#define IDC_SVGM_DEL 1115
|
||||
#define IDC_SVGM_OPEN 1120
|
||||
|
||||
#define IDC_SVGN_SELLAB 1121
|
||||
|
@ -230,14 +230,19 @@
|
|||
#define IDS_CANCEL 40004
|
||||
#define IDS_OK 40005
|
||||
#define IDS_ABOUT 40006
|
||||
#define IDS_DONE 40007
|
||||
#define IDS_DICTLOC 40029
|
||||
#define IDS_SAVENAME 40030
|
||||
#define IDS_DUPENAME 40031
|
||||
#define IDS_RENAME 40032
|
||||
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 125
|
||||
#define _APS_NEXT_COMMAND_VALUE 40030
|
||||
#define _APS_NEXT_COMMAND_VALUE 40033
|
||||
#define _APS_NEXT_CONTROL_VALUE 1125
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
|
|
|
@ -153,6 +153,14 @@ BEGIN
|
|||
TBSTYLE_BUTTON | TBSTYLE_AUTOSIZE, IDS_CANCEL, 0,
|
||||
NOMENU
|
||||
END
|
||||
|
||||
IDM_DONE_MENUBAR RCDATA
|
||||
BEGIN
|
||||
0, 1,
|
||||
I_IMAGENONE, IDOK, TBSTATE_ENABLED,
|
||||
TBSTYLE_BUTTON | TBSTYLE_AUTOSIZE, IDS_DONE, 0,
|
||||
NOMENU
|
||||
END
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -387,7 +395,7 @@ STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | DS_CENTER
|
|||
CAPTION "Game name"
|
||||
FONT 8, "System"
|
||||
BEGIN
|
||||
LTEXT "To save this game, give it a name. (You can change the name later using the Saved games dialog.)",
|
||||
LTEXT "",
|
||||
IDC_SVGN_SELLAB,SVGN_LEFT_COL,SVGN_ROW_1,86,40
|
||||
EDITTEXT IDC_SVGN_EDIT,SVGN_LEFT_COL,SVGN_ROW_2,86,12,
|
||||
ES_AUTOHSCROLL
|
||||
|
@ -401,16 +409,16 @@ END
|
|||
|
||||
#define SVGM_LEFT_COL 2
|
||||
#define SVGM_ROW_1 2
|
||||
#define SVGM_ROW_2 (SVGM_ROW_1+22)
|
||||
#define SVGM_ROW_3 (SVGM_ROW_2+23)
|
||||
/* #define SVGM_ROW_4 (SVGM_ROW_3+30) */
|
||||
#define SVGM_ROW_2 (SVGM_ROW_1+35)
|
||||
#define SVGM_ROW_3 (SVGM_ROW_2+16)
|
||||
#define SVGM_ROW_4 (SVGM_ROW_3+20)
|
||||
#ifdef _WIN32_WCE
|
||||
# define SVGM_DLG_HT (SVGM_ROW_3)
|
||||
/* # define SVGM_DLG_HT (SVGM_ROW_4) */
|
||||
/* # define SVGM_DLG_HT (SVGM_ROW_3) */
|
||||
# define SVGM_DLG_HT (SVGM_ROW_4+16)
|
||||
|
||||
#else
|
||||
# define SVGM_ROW_OK (SVGM_ROW_2 + 18)
|
||||
# define SVGM_DLG_HT (SVGM_ROW_OK + 18)
|
||||
/* # define SVGM_DLG_HT (SVGM_ROW_4 + 18) */
|
||||
# define SVGM_ROW_OK (SVGM_ROW_4 + 21)
|
||||
# define SVGM_DLG_HT (SVGM_ROW_OK + 16)
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -419,35 +427,35 @@ STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | DS_CENTER | WS_VSCROLL
|
|||
CAPTION "Saved Games"
|
||||
FONT 8, "System"
|
||||
BEGIN
|
||||
LTEXT "Select a saved game",IDC_SVGM_SELLAB,SVGM_LEFT_COL,
|
||||
SVGM_ROW_1,90,12
|
||||
LTEXT /* wince windres can't handle split lines....*/
|
||||
"Select a saved game. (Some buttons will be disabled when the current game is selected.)",
|
||||
IDC_SVGM_SELLAB,SVGM_LEFT_COL,
|
||||
SVGM_ROW_1,90,35
|
||||
#ifdef _WIN32_WCE
|
||||
LISTBOX IDC_SVGM_GAMELIST, SVGM_LEFT_COL+5,SVGM_ROW_1+12,70,12,
|
||||
LISTBOX IDC_SVGM_GAMELIST, SVGM_LEFT_COL,SVGM_ROW_2,70,12,
|
||||
WS_TABSTOP
|
||||
CONTROL "", IDC_SVGM_UPDOWN, UPDOWN_CLASS,
|
||||
UDS_AUTOBUDDY | UDS_HORZ | UDS_ALIGNRIGHT | UDS_WRAP |
|
||||
UDS_SETBUDDYINT | UDS_EXPANDABLE | UDS_NOSCROLL,
|
||||
0, 0, 0, 0
|
||||
#else
|
||||
COMBOBOX IDC_SVGM_GAMELIST,SVGM_LEFT_COL+5,SVGM_ROW_1+12,70,58,
|
||||
COMBOBOX IDC_SVGM_GAMELIST,SVGM_LEFT_COL,SVGM_ROW_2,70,58,
|
||||
CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||
#endif
|
||||
|
||||
/* PUSHBUTTON "Dup.",IDC_SVGM_DUP,SVGM_LEFT_COL,SVGM_ROW_2,20,14,WS_DISABLED */
|
||||
/* PUSHBUTTON "Delete",IDC_SVGM_DEL,SVGM_LEFT_COL+22,SVGM_ROW_2,25,14,WS_DISABLED */
|
||||
PUSHBUTTON "Open",IDC_SVGM_OPEN,SVGM_LEFT_COL+54,SVGM_ROW_2,25,14,WS_DISABLED
|
||||
PUSHBUTTON "Open",IDC_SVGM_OPEN,
|
||||
SVGM_LEFT_COL,SVGM_ROW_3,40,14,WS_DISABLED
|
||||
|
||||
/* LTEXT "Edit its name",IDC_SVGM_EDITLAB,SVGM_LEFT_COL,SVGM_ROW_3, */
|
||||
/* 45,12 */
|
||||
/* PUSHBUTTON "Rename",IDC_SVGM_CHANGE,SVGM_LEFT_COL+46,SVGM_ROW_3,32,12,WS_DISABLED */
|
||||
/* EDITTEXT IDC_SVGM_EDIT,SVGM_LEFT_COL+5,SVGM_ROW_3+15,70,12, */
|
||||
/* ES_AUTOHSCROLL */
|
||||
PUSHBUTTON "Dup.",IDC_SVGM_DUP,
|
||||
SVGM_LEFT_COL,SVGM_ROW_4,20,14,WS_DISABLED
|
||||
PUSHBUTTON "Delete",IDC_SVGM_DEL,
|
||||
SVGM_LEFT_COL+22,SVGM_ROW_4,28,14,WS_DISABLED
|
||||
PUSHBUTTON "Rename",IDC_SVGM_CHANGE,
|
||||
SVGM_LEFT_COL+52,SVGM_ROW_4,32,14,WS_DISABLED
|
||||
|
||||
#ifndef _WIN32_WCE
|
||||
DEFPUSHBUTTON "OK",IDOK,SVGM_LEFT_COL+10,SVGM_ROW_OK,REPOS_BUTTON_WIDTH,
|
||||
DEFPUSHBUTTON "Done",IDOK,SVGM_LEFT_COL,SVGM_ROW_OK,REPOS_BUTTON_WIDTH,
|
||||
BUTTON_HT
|
||||
PUSHBUTTON "Cancel",IDCANCEL,SVGM_LEFT_COL+10+REPOS_BUTTON_WIDTH+10,
|
||||
SVGM_ROW_OK,REPOS_BUTTON_WIDTH, BUTTON_HT
|
||||
#endif
|
||||
END
|
||||
|
||||
|
@ -853,6 +861,7 @@ BEGIN
|
|||
IDS_DUMMY "--"
|
||||
IDS_CANCEL "Cancel"
|
||||
IDS_OK "Ok"
|
||||
IDS_DONE "Done"
|
||||
IDS_ABOUT "Crosswords 4.2b3 (rev " SVN_REV ") "\
|
||||
"for PocketPC. Copyright 1998-2008 by "\
|
||||
"Eric House. This software is released under the GNU "\
|
||||
|
@ -865,6 +874,10 @@ BEGIN
|
|||
"e.g. in \\Storage Card\\Crosswords. "\
|
||||
"Download dictionaries from http://xwords.sf.net or "\
|
||||
"http://eehouse.org/xwords."
|
||||
IDS_SAVENAME "Enter a name for the current game. (You can change the "\
|
||||
"name later using the Saved games dialog.)"
|
||||
IDS_DUPENAME "Enter a name for a copy of this game."
|
||||
IDS_RENAME "Enter a new name for this game."
|
||||
|
||||
END
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue