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