Browse Source

Merge pull request #187 from Mystler/langChanger

Add language selection to Login form
Branan Purvine-Riley 13 years ago
parent
commit
46c3ab08b3
  1. 16
      Sources/Plasma/Apps/plClient/res/plClient.rc
  2. 1
      Sources/Plasma/Apps/plClient/res/resource.h
  3. 14
      Sources/Plasma/Apps/plClient/winmain.cpp

16
Sources/Plasma/Apps/plClient/res/plClient.rc

@ -80,13 +80,13 @@ BEGIN
PUSHBUTTON "Copy",IDC_COPY,239,26,50,14
END
IDD_URULOGIN_MAIN DIALOGEX 0, 0, 302, 230
IDD_URULOGIN_MAIN DIALOGEX 0, 0, 302, 246
STYLE DS_SETFONT | DS_MODALFRAME | DS_SETFOREGROUND | DS_FIXEDSYS |
DS_CENTER | WS_POPUP
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
DEFPUSHBUTTON "Login",IDOK,87,209,50,14
PUSHBUTTON "Quit",IDCANCEL,163,209,50,14
DEFPUSHBUTTON "Login",IDOK,87,225,50,14
PUSHBUTTON "Quit",IDCANCEL,163,225,50,14
CONTROL 151,IDC_STATIC,"Static",SS_BITMAP | SS_REALSIZEIMAGE |
WS_BORDER,7,7,289,36
LTEXT "Account name:",IDC_STATIC,69,119,49,10
@ -94,15 +94,17 @@ BEGIN
EDITTEXT IDC_URULOGIN_USERNAME,123,119,108,12,ES_AUTOHSCROLL
EDITTEXT IDC_URULOGIN_PASSWORD,123,135,108,12,ES_PASSWORD |
ES_AUTOHSCROLL
GROUPBOX "",IDC_STATIC,14,99,274,96
GROUPBOX "",IDC_STATIC,14,99,274,112
LTEXT "Language:",IDC_STATIC,69,151,49,10
COMBOBOX IDC_LANGUAGE,123,151,108,100,CBS_DROPDOWNLIST | WS_TABSTOP
CONTROL "Remember Password:",IDC_URULOGIN_REMEMBERPASS,"Button",
BS_AUTOCHECKBOX | BS_LEFTTEXT | WS_TABSTOP,69,151,100,10
BS_AUTOCHECKBOX | BS_LEFTTEXT | WS_TABSTOP,69,167,100,10
GROUPBOX "",IDC_STATIC,14,54,274,43
LTEXT "Welcome to URU",IDC_STATUS_TEXT,17,62,267,20
RTEXT "Product String",IDC_PRODUCTSTRING,88,86,194,8
CONTROL "",IDC_STATIC,"Static",SS_BLACKFRAME | SS_SUNKEN,7,49,
288,152
PUSHBUTTON "Need an account?",IDC_URULOGIN_GAMETAPLINK,95,175,110,
288,168
PUSHBUTTON "Need an account?",IDC_URULOGIN_GAMETAPLINK,95,183,110,
14,BS_FLAT
END

1
Sources/Plasma/Apps/plClient/res/resource.h

@ -27,6 +27,7 @@
#define IDC_PRODUCTSTRING 1033
#define IDC_STATUS_TEXT 1034
#define IDC_HOTKEY1 1035
#define IDC_LANGUAGE 1040
// Next default values for new objects
//

14
Sources/Plasma/Apps/plClient/winmain.cpp

@ -177,6 +177,7 @@ struct LoginDialogParam {
ShaDigest namePassHash;
bool remember;
int focus;
int language;
};
static bool AuthenticateNetClientComm(ENetError* result, HWND parentWnd);
@ -1033,6 +1034,7 @@ static void SaveUserPass (LoginDialogParam *pLoginParam, char *password)
stream->Writebool(pLoginParam->remember);
if (pLoginParam->remember)
stream->Write(sizeof(pLoginParam->namePassHash), pLoginParam->namePassHash);
stream->WriteBE32(pLoginParam->language);
stream->Close();
delete stream;
}
@ -1048,6 +1050,7 @@ static void LoadUserPass (LoginDialogParam *pLoginParam)
char* temp;
pLoginParam->remember = false;
pLoginParam->username[0] = '\0';
pLoginParam->language = plLocalization::kEnglish;
wchar_t fileAndPath[MAX_PATH];
PathGetInitDirectory(fileAndPath, arrsize(fileAndPath));
@ -1086,6 +1089,8 @@ static void LoadUserPass (LoginDialogParam *pLoginParam)
{
pLoginParam->focus = IDC_URULOGIN_PASSWORD;
}
pLoginParam->language = stream->ReadBE32();
}
stream->Close();
@ -1174,6 +1179,12 @@ BOOL CALLBACK UruLoginDialogProc( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM
StrToAnsi(windowName, productString, arrsize(windowName));
SendMessage(GetDlgItem(hwndDlg, IDC_PRODUCTSTRING), WM_SETTEXT, 0, (LPARAM) windowName);
for (int i = 0; i < plLocalization::GetNumLocales(); i++)
{
SendMessage(GetDlgItem(hwndDlg, IDC_LANGUAGE), CB_ADDSTRING, 0, (LPARAM)plLocalization::GetLanguageName((plLocalization::Language)i));
}
SendMessage(GetDlgItem(hwndDlg, IDC_LANGUAGE), CB_SETCURSEL, (WPARAM)pLoginParam->language, 0);
SetTimer(hwndDlg, AUTH_LOGIN_TIMER, 10, NULL);
return FALSE;
}
@ -1219,6 +1230,9 @@ BOOL CALLBACK UruLoginDialogProc( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM
GetDlgItemText(hwndDlg, IDC_URULOGIN_PASSWORD, password, kMaxPasswordLength);
pLoginParam->remember = (IsDlgButtonChecked(hwndDlg, IDC_URULOGIN_REMEMBERPASS) == BST_CHECKED);
pLoginParam->language = SendMessage(GetDlgItem(hwndDlg, IDC_LANGUAGE), CB_GETCURSEL, 0, 0L);
plLocalization::SetLanguage((plLocalization::Language)pLoginParam->language);
SaveUserPass (pLoginParam, password);
memset(&pLoginParam->authError, 0, sizeof(pLoginParam->authError));

Loading…
Cancel
Save