pass parent so dll picker can work from prefs dlg; move warning about

needing to relaunch from picker to separate dlg shown afterwards.
This commit is contained in:
ehouse 2009-05-14 04:35:19 +00:00
parent d12208ee78
commit 02fd3000dc
9 changed files with 53 additions and 52 deletions

View file

@ -88,6 +88,7 @@ messageToStr( UINT message )
CASE_STR( WM_EXITMENULOOP );
CASE_STR( WM_INITMENUPOPUP );
CASE_STR( WM_CANCELMODE );
CASE_STR( WM_GETDLGCODE );
default:
str = "<unknown>";
}

View file

@ -1,4 +1,4 @@
/* -*-mode: C; fill-column: 77; c-basic-offset: 4; -*- */
/* -*- mode: C; fill-column: 77; c-basic-offset: 4; -*- */
/*
* Copyright 2002 by Eric House (xwords@eehouse.org). All rights reserved.
*
@ -335,8 +335,14 @@ PrefsDlg(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
break;
case IDC_PREFLOCALE: {
XP_UCHAR newFile[MAX_PATH];
if ( ceChooseResFile(globals, pState->langFileName,
newFile, VSIZE(newFile)) ) {
if ( ceChooseResFile( hDlg, globals,
pState->langFileName,
newFile, VSIZE(newFile)) ) {
wchar_t* msg
= ceGetResStringL( globals,
IDS_LANG_CHANGE_RESTART );
MessageBox( hDlg, msg, NULL,
MB_OK | MB_ICONINFORMATION );
XP_STRNCPY( pState->langFileName, newFile,
VSIZE(pState->langFileName) );
}
@ -370,7 +376,7 @@ PrefsDlg(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
case IDOK:
ceControlsToPrefs( pState );
case IDCANCEL:
EndDialog(hDlg, id);
EndDialog( hDlg, id );
pState->userCancelled = id == IDCANCEL;
return TRUE;
}

View file

@ -184,6 +184,7 @@ typedef struct _DllSelState {
wchar_t* names[8];
wchar_t* files[8];
XP_U16 nItems;
XP_U16 initialSel;
XP_U16 dllListID;
XP_Bool inited;
@ -218,7 +219,6 @@ getDLLVersion( HINSTANCE hinst )
static void
listDlls( DllSelState* state )
{
LOG_FUNC();
HANDLE fileH;
HWND hDlg = state->dlgHdr.hDlg;
WIN32_FIND_DATA data;
@ -278,7 +278,7 @@ listDlls( DllSelState* state )
selIndex, 0L );
state->nItems = nItems;
LOG_RETURN_VOID();
state->initialSel = selIndex;
} /* listDlls */
static void
@ -304,7 +304,8 @@ getSelText( DllSelState* state )
XP_S16 sel = SendDlgItemMessage( hDlg, state->dllListID,
GETCURSEL(globals), 0, 0 );
if ( sel >= 0 ) {
if ( sel >= 0 && sel != state->initialSel ) {
gotIt = XP_TRUE;
if ( sel > 0 ) {
wcscpy( state->wbuf, state->files[sel] );
@ -346,8 +347,7 @@ DllSelDlg( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam )
&& (BN_CLICKED == HIWORD(wParam)) ) {
switch( LOWORD(wParam) ) {
case IDOK:
state->cancelled = XP_FALSE;
getSelText( state );
state->cancelled = !getSelText( state );
/* fallthrough */
case IDCANCEL:
unlistDlls( state );
@ -363,10 +363,10 @@ DllSelDlg( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam )
} /* DllSelDlg */
/* ceChooseResFile: List all the available .rc files and return if user
* chooses one.
* chooses one different from the one passed in.
*/
XP_Bool
ceChooseResFile( CEAppGlobals* globals, const XP_UCHAR* curFileName,
ceChooseResFile( HWND hwnd, CEAppGlobals* globals, const XP_UCHAR* curFileName,
XP_UCHAR* buf, XP_U16 bufLen )
{
DllSelState state;
@ -383,13 +383,12 @@ ceChooseResFile( CEAppGlobals* globals, const XP_UCHAR* curFileName,
}
(void)DialogBoxParam( globals->locInst, (LPCTSTR)IDD_LOCALESDLG,
globals->hWnd, (DLGPROC)DllSelDlg, (long)&state );
hwnd, (DLGPROC)DllSelDlg, (long)&state );
if ( !state.cancelled ) {
(void)WideCharToMultiByte( CP_ACP, 0, state.wbuf, -1,
buf, bufLen, NULL, NULL );
}
LOG_RETURNF( "%s", buf );
return !state.cancelled;
}
} /* ceChooseResFile */

View file

@ -24,7 +24,8 @@
HINSTANCE ceLoadResFile( const XP_UCHAR* file );
void ceCloseResFile( HINSTANCE inst );
XP_Bool ceChooseResFile( CEAppGlobals* globals, const XP_UCHAR* curFileName,
XP_Bool ceChooseResFile( HWND hwnd, CEAppGlobals* globals,
const XP_UCHAR* curFileName,
XP_UCHAR* buf, XP_U16 bufLen );
const XP_UCHAR* ceGetResString( CEAppGlobals* globals, XP_U16 resID );

View file

@ -774,7 +774,7 @@ END
#endif
IDD_LOCALESDLG DIALOG DISCARDABLE 0, 0, 100, 120
IDD_LOCALESDLG DIALOG DISCARDABLE 0, 0, 100, 95
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | DS_CENTER
CAPTION "LANGUAGE PICKER"// <- translate
FONT 8, "System"
@ -784,13 +784,10 @@ BEGIN
XWCOMBO(LOCALES_COMBO,LEFT_COL,65,70,12,0,58,0)
LTEXT "YOU MUST RESTART CROSSWORDS FOR ANY CHANGE TO TAKE EFFECT.", // <- translate
LOCALES_RESTART,LEFT_COL,80,80,30
# ifndef _WIN32_WCE
DEFPUSHBUTTON "OK",IDOK,LEFT_COL,115,REPOS_BUTTON_WIDTH, // <- translate
DEFPUSHBUTTON "OK",IDOK,LEFT_COL,80,REPOS_BUTTON_WIDTH, // <- translate
REPOS_BUTTON_HT
PUSHBUTTON "CANCEL",IDCANCEL,40,115,REPOS_BUTTON_WIDTH, // <- translate
PUSHBUTTON "CANCEL",IDCANCEL,40,80,REPOS_BUTTON_WIDTH, // <- translate
REPOS_BUTTON_HT
# endif
END
@ -913,7 +910,7 @@ BEGIN
IDS_FILEEXISTSFMT_L "FILE %s ALREADY EXISTS." // <- translate
IDS_NEED_TOUCH "THIS FEATURE REQUIRES A TOUCH SCREEN."
IDS_EDITCOLOR_FORMAT "EDIT COLOR FOR %s"
IDS_LANG_CHANGE_RESTART "YOU MUST RESTART CROSSWORDS FOR THIS CHANGE TO TAKE EFFECT." // <- translate
#ifndef XWFEATURE_STANDALONE_ONLY
IDS_CONN_RELAY_L "RELAY" // <- translate
IDS_CONN_DIRECT "DIRECT CONNECTION" // <- translate

View file

@ -814,7 +814,7 @@ BEGIN
END
#endif
IDD_LOCALESDLG DIALOG DISCARDABLE 0, 0, 100, 115
IDD_LOCALESDLG DIALOG DISCARDABLE 0, 0, 100, 80
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | DS_CENTER
CAPTION "Language Picker"
FONT 8, "System"
@ -824,12 +824,10 @@ BEGIN
XWCOMBO(LOCALES_COMBO,LEFT_COL,53,70,12,0,58,0)
LTEXT "You must restart Crosswords for any change to take effect.", // <- translate
LOCALES_RESTART,LEFT_COL,70,80,30
# ifndef _WIN32_WCE
DEFPUSHBUTTON "OK",IDOK,LEFT_COL,100,REPOS_BUTTON_WIDTH,
DEFPUSHBUTTON "OK",IDOK,LEFT_COL,70,REPOS_BUTTON_WIDTH,
REPOS_BUTTON_HT
PUSHBUTTON "Annuler",IDCANCEL,40,100,REPOS_BUTTON_WIDTH,
PUSHBUTTON "Annuler",IDCANCEL,40,70,REPOS_BUTTON_WIDTH,
REPOS_BUTTON_HT
# endif
END
@ -911,7 +909,7 @@ BEGIN
IDS_TRIPLE_LETTER "Lettre compte triple"
IDS_TRIPLE_WORD "Mot compte triple"
IDS_INTRADE_MW "Echange de lettres. Choisir" XP_CR "'Jouer le coup' quand vous" XP_CR "avez fini"
IDS_INTRADE_MW "Echange de lettres. Choisir" XP_CR "'Jouer le coup' quand vous" XP_CR "avez fini."
IDS_TILES_NOT_IN_LINE "Toutes les lettres jouées doivent être alignées."
IDS_NO_EMPTIES_IN_TURN "Aucune case vide ne peut séparer deux lettres placées."
@ -953,6 +951,7 @@ BEGIN
IDS_FILEEXISTSFMT_L "File %s already exists." // <- translate
IDS_NEED_TOUCH "This feature requires a touch screen." // <- translate
IDS_EDITCOLOR_FORMAT "Edit color for %s" // <- translate
IDS_LANG_CHANGE_RESTART "You must restart Crosswords for this change to take effect." // <-translate
#ifndef XWFEATURE_STANDALONE_ONLY
IDS_CONN_RELAY_L "Transmission"

View file

@ -176,8 +176,6 @@
#define HC_MIN_LABEL 1138
#define HC_MAX_LABEL 1139
#define LOCALES_LABEL 1140
#define LOCALES_RESTART 1141
#define IDC_CCONVIA_LAB 1106

View file

@ -98,37 +98,38 @@
#define IDS_FILEEXISTSFMT_L 40080
#define IDS_NEED_TOUCH 40081
#define IDS_EDITCOLOR_FORMAT 40082
#define IDS_LANG_CHANGE_RESTART 40083
#ifndef XWFEATURE_STANDALONE_ONLY
# define IDS_CONN_RELAY_L 40083
# define IDS_CONN_DIRECT 40084
# define IDS_LOCALPLAYERS 40085
# define IDS_NO_PEEK_REMOTE_TILES 40086
# define IDS_REG_UNEXPECTED_USER 40087
# define IDS_SERVER_DICT_WINS 40088
# define IDS_REG_SERVER_SANS_REMOTE 40089
# define IDS_CONN_RELAY_L 40084
# define IDS_CONN_DIRECT 40085
# define IDS_LOCALPLAYERS 40086
# define IDS_NO_PEEK_REMOTE_TILES 40087
# define IDS_REG_UNEXPECTED_USER 40088
# define IDS_SERVER_DICT_WINS 40089
# define IDS_REG_SERVER_SANS_REMOTE 40090
# ifdef XWFEATURE_SMS
# define IDS_SMS_CONN_L 40090
# define IDS_SMS_CONN_L 40091
# endif
# ifdef XWFEATURE_IP_DIRECT
# define IDS_DIRECT_CONN_L 40091
# define IDS_DIRECT_CONN_L 40092
# endif
# ifdef XWFEATURE_RELAY
# define IDS_XWRELAY_ERROR_TIMEOUT 40092
# define IDS_ERROR_HEART_YOU 40093
# define IDS_XWRELAY_ERROR_HEART_OTHER 40094
# define IDS_XWRELAY_ERROR_LOST_OTHER 40095
# define IDS_RELAY_CONN_L 40096
# define IDS_XWRELAY_ERROR_TIMEOUT 40093
# define IDS_ERROR_HEART_YOU 40094
# define IDS_XWRELAY_ERROR_HEART_OTHER 40095
# define IDS_XWRELAY_ERROR_LOST_OTHER 40096
# define IDS_RELAY_CONN_L 40097
# endif
#endif
#if ! defined XWFEATURE_STANDALONE_ONLY
# define CE_LAST_RES_ID 40096
# define CE_LAST_RES_ID 40097
#else
# define CE_LAST_RES_ID 40082
# define CE_LAST_RES_ID 40083
#endif
#endif

View file

@ -817,7 +817,7 @@ BEGIN
END
#endif
IDD_LOCALESDLG DIALOG DISCARDABLE 0, 0, 100, 115
IDD_LOCALESDLG DIALOG DISCARDABLE 0, 0, 100, 80
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | DS_CENTER
CAPTION "Language Picker"
FONT 8, "System"
@ -826,13 +826,10 @@ BEGIN
LOCALES_LABEL,LEFT_COL,2,80,50
XWCOMBO(LOCALES_COMBO,LEFT_COL,53,70,12,0,58,0)
LTEXT "You must restart Crosswords for any change to take effect.",
LOCALES_RESTART,LEFT_COL,70,80,30
# ifndef _WIN32_WCE
DEFPUSHBUTTON "OK",IDOK,LEFT_COL,100,REPOS_BUTTON_WIDTH,
DEFPUSHBUTTON "OK",IDOK,LEFT_COL,70,REPOS_BUTTON_WIDTH,
REPOS_BUTTON_HT
PUSHBUTTON "Cancel",IDCANCEL,40,100,REPOS_BUTTON_WIDTH,
PUSHBUTTON "Cancel",IDCANCEL,40,70,REPOS_BUTTON_WIDTH,
REPOS_BUTTON_HT
# endif
END
@ -1004,6 +1001,8 @@ BEGIN
IDS_NEED_TOUCH "This feature requires a touch screen."
IDS_EDITCOLOR_FORMAT "Edit color for %s"
IDS_LANG_CHANGE_RESTART "You must restart Crosswords for this change to take effect."
#ifndef XWFEATURE_STANDALONE_ONLY
IDS_CONN_RELAY_L "Relay"
IDS_CONN_DIRECT "Direct connection"