Fixed language handling. Removed some dependencies on Wine internals.

This commit is contained in:
Alexandre Julliard 2000-11-10 01:06:36 +00:00
parent 4bbc0b3aee
commit 3da872daaf
14 changed files with 28 additions and 133 deletions

View file

@ -10,9 +10,6 @@
#include "main.h" #include "main.h"
#include "language.h" #include "language.h"
#include "winnls.h" #include "winnls.h"
#ifdef WINELIB
#include "options.h"
#endif
CHAR STRING_MENU_Xx[] = "MENU_Xx"; CHAR STRING_MENU_Xx[] = "MENU_Xx";
@ -124,7 +121,6 @@ VOID LANGUAGE_SelectByNumber(UINT num)
/* Get Language id */ /* Get Language id */
LoadString(Globals.hInstance, IDS_LANGUAGE_ID, szLanguage, sizeof(szLanguage)); LoadString(Globals.hInstance, IDS_LANGUAGE_ID, szLanguage, sizeof(szLanguage));
Globals.lpszLanguage = szLanguage;
/* Change Resource names */ /* Change Resource names */
lstrcpyn(STRING_MENU_Xx + sizeof(STRING_MENU_Xx) - 3, szLanguage, 3); lstrcpyn(STRING_MENU_Xx + sizeof(STRING_MENU_Xx) - 3, szLanguage, 3);
@ -170,20 +166,6 @@ VOID LANGUAGE_DefaultHandle(WPARAM wParam)
else printf("Unimplemented menu command %i\n", wParam); else printf("Unimplemented menu command %i\n", wParam);
} }
VOID LANGUAGE_Init(VOID)
{
CHAR szBuffer[MAX_PATHNAME_LEN];
if (Globals.lpszLanguage == "En") {
PROFILE_GetWineIniString("programs", "language", "En", szBuffer,
sizeof(szBuffer));
Globals.lpszLanguage = LocalLock(LocalAlloc(LMEM_FIXED, lstrlen(szBuffer)+1));
/* hmemcpy(Globals.lpszLanguage, szBuffer, 1+lstrlen(szBuffer)); */
lstrcpyn(Globals.lpszLanguage, szBuffer, strlen(szBuffer)+1);
}
}
/* Local Variables: */ /* Local Variables: */
/* c-file-style: "GNU" */ /* c-file-style: "GNU" */
/* End: */ /* End: */

View file

@ -10,7 +10,6 @@ VOID LANGUAGE_UpdateMenuCheckmarks(VOID);
VOID LANGUAGE_SelectByNumber(UINT num); VOID LANGUAGE_SelectByNumber(UINT num);
VOID LANGUAGE_SelectByName(LPCSTR lang); VOID LANGUAGE_SelectByName(LPCSTR lang);
VOID LANGUAGE_DefaultHandle(WPARAM wParam); VOID LANGUAGE_DefaultHandle(WPARAM wParam);
VOID LANGUAGE_Init(VOID);
/* Local Variables: */ /* Local Variables: */
/* c-file-style: "GNU" */ /* c-file-style: "GNU" */

View file

@ -8,44 +8,19 @@
#include "windows.h" #include "windows.h"
#include "license.h" #include "license.h"
static LICENSE* SelectLanguage(LPCSTR Language) VOID WineLicense(HWND Wnd)
{ {
/* /* FIXME: should load strings from resources */
if (lstrcmp(Language, "Ca")) return(&WineLicense_Ca); LICENSE *License = &WineLicense_En;
if (lstrcmp(Language, "Cz")) return(&WineLicense_Cz);
if (lstrcmp(Language, "Da")) return(&WineLicense_Da);
if (lstrcmp(Language, "De")) return(&WineLicense_De);
if (lstrcmp(Language, "En")) return(&WineLicense_En);
if (lstrcmp(Language, "Eo")) return(&WineLicense_Eo);
if (lstrcmp(Language, "Es")) return(&WineLicense_Es);
if (lstrcmp(Language, "Fi")) return(&WineLicense_Fi);
if (lstrcmp(Language, "Fr")) return(&WineLicense_Fr);
if (lstrcmp(Language, "Hu")) return(&WineLicense_Hu);
if (lstrcmp(Language, "It")) return(&WineLicense_It);
if (lstrcmp(Langauge, "Ko")) return(&WineLicense_Ko);
if (lstrcmp(Language, "No")) return(&WineLicense_No);
if (lstrcmp(Language, "Pl")) return(&WineLicense_Pl);
if (lstrcmp(Language, "Po")) return(&WineLicense_Po);
if (lstrcmp(Language, "Sw")) return(&WineLicense_Sw);
if (lstrcmp(Language, "Va")) return(&WineLicense_Va);
*/
return(&WineLicense_En);
}
VOID WineLicense(HWND Wnd, LPCSTR Language)
{
LICENSE *License = SelectLanguage(Language);
MessageBox(Wnd, License->License, License->LicenseCaption, MessageBox(Wnd, License->License, License->LicenseCaption,
MB_ICONINFORMATION | MB_OK); MB_ICONINFORMATION | MB_OK);
} }
VOID WineWarranty(HWND Wnd, LPCSTR Language) VOID WineWarranty(HWND Wnd)
{ {
LICENSE *License = SelectLanguage(Language); /* FIXME: should load strings from resources */
LICENSE *License = &WineLicense_En;
MessageBox(Wnd, License->Warranty, License->WarrantyCaption, MessageBox(Wnd, License->Warranty, License->WarrantyCaption,
MB_ICONEXCLAMATION | MB_OK); MB_ICONEXCLAMATION | MB_OK);
} }

View file

@ -8,8 +8,8 @@
/* function prototypes */ /* function prototypes */
VOID WineLicense(HWND hWnd, LPCSTR lpszLanguage); VOID WineLicense(HWND hWnd);
VOID WineWarranty(HWND hWnd, LPCSTR language); VOID WineWarranty(HWND hWnd);
/* typedefs */ /* typedefs */

View file

@ -70,11 +70,11 @@ int CLOCK_MenuCommand (WPARAM wParam)
break; break;
} }
case CL_INFO_LICENSE: { case CL_INFO_LICENSE: {
WineLicense(Globals.hMainWnd, Globals.lpszLanguage); WineLicense(Globals.hMainWnd);
break; break;
} }
case CL_INFO_NO_WARRANTY: { case CL_INFO_NO_WARRANTY: {
WineWarranty(Globals.hMainWnd, Globals.lpszLanguage); WineWarranty(Globals.hMainWnd);
break; break;
} }
case CL_INFO_ABOUT_WINE: { case CL_INFO_ABOUT_WINE: {
@ -119,7 +119,7 @@ VOID MAIN_FileChooseFont(VOID) {
* CLOCK_WndProc * CLOCK_WndProc
*/ */
LRESULT CLOCK_WndProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) LRESULT WINAPI CLOCK_WndProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{ {
PAINTSTRUCT ps; PAINTSTRUCT ps;
HDC context; HDC context;
@ -203,9 +203,6 @@ int PASCAL WinMain (HINSTANCE hInstance, HINSTANCE prev, LPSTR cmdline, int show
Globals.lpszIniFile = "clock.ini"; Globals.lpszIniFile = "clock.ini";
Globals.lpszIcoFile = "clock.ico"; Globals.lpszIcoFile = "clock.ico";
/* Select Language */
LANGUAGE_Init();
Globals.hInstance = hInstance; Globals.hInstance = hInstance;
Globals.hMainIcon = ExtractIcon(Globals.hInstance, Globals.hMainIcon = ExtractIcon(Globals.hInstance,
Globals.lpszIcoFile, 0); Globals.lpszIcoFile, 0);
@ -232,7 +229,7 @@ int PASCAL WinMain (HINSTANCE hInstance, HINSTANCE prev, LPSTR cmdline, int show
CW_USEDEFAULT, CW_USEDEFAULT, Globals.MaxX, Globals.MaxY, 0, CW_USEDEFAULT, CW_USEDEFAULT, Globals.MaxX, Globals.MaxY, 0,
LoadMenu(Globals.hInstance, STRING_MENU_Xx), Globals.hInstance, 0); LoadMenu(Globals.hInstance, STRING_MENU_Xx), Globals.hInstance, 0);
LANGUAGE_SelectByName(Globals.lpszLanguage); LANGUAGE_SelectByName("En");
SetMenu(Globals.hMainWnd, Globals.hMainMenu); SetMenu(Globals.hMainWnd, Globals.hMainMenu);
LANGUAGE_UpdateMenuCheckmarks(); LANGUAGE_UpdateMenuCheckmarks();

View file

@ -28,7 +28,6 @@ typedef struct
HMENU hPopupMenu1; HMENU hPopupMenu1;
LPCSTR lpszIniFile; LPCSTR lpszIniFile;
LPCSTR lpszIcoFile; LPCSTR lpszIcoFile;
LPSTR lpszLanguage;
UINT wStringTableOffset; UINT wStringTableOffset;
BOOL bAnalog; BOOL bAnalog;

View file

@ -11,10 +11,6 @@
#include <commdlg.h> #include <commdlg.h>
#include <winerror.h> #include <winerror.h>
#ifdef WINELIB
#include "options.h"
#endif
#include "main.h" #include "main.h"
#include "license.h" #include "license.h"
#include "language.h" #include "language.h"
@ -28,7 +24,7 @@
#include "winnls.h" #include "winnls.h"
#endif #endif
static LRESULT DIALOG_PAGESETUP_DlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam); static LRESULT WINAPI DIALOG_PAGESETUP_DlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam);
@ -593,12 +589,12 @@ VOID DIALOG_HelpHelp(VOID)
VOID DIALOG_HelpLicense(VOID) VOID DIALOG_HelpLicense(VOID)
{ {
WineLicense(Globals.hMainWnd, Globals.lpszLanguage); WineLicense(Globals.hMainWnd);
} }
VOID DIALOG_HelpNoWarranty(VOID) VOID DIALOG_HelpNoWarranty(VOID)
{ {
WineWarranty(Globals.hMainWnd, Globals.lpszLanguage); WineWarranty(Globals.hMainWnd);
} }
VOID DIALOG_HelpAboutWine(VOID) VOID DIALOG_HelpAboutWine(VOID)
@ -629,7 +625,7 @@ VOID DIALOG_PageSetup(VOID)
* DIALOG_PAGESETUP_DlgProc * DIALOG_PAGESETUP_DlgProc
*/ */
static LRESULT DIALOG_PAGESETUP_DlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) static LRESULT WINAPI DIALOG_PAGESETUP_DlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{ {
switch (msg) switch (msg)

View file

@ -10,10 +10,6 @@
#include "main.h" #include "main.h"
#include "language.h" #include "language.h"
#ifdef WINELIB
#include "options.h"
#endif
CHAR STRING_MENU_Xx[] = "MENU_Xx"; CHAR STRING_MENU_Xx[] = "MENU_Xx";
CHAR STRING_PAGESETUP_Xx[] = "DIALOG_PAGESETUP_Xx"; CHAR STRING_PAGESETUP_Xx[] = "DIALOG_PAGESETUP_Xx";
@ -97,7 +93,6 @@ VOID LANGUAGE_SelectByNumber(UINT num)
/* Get Language id */ /* Get Language id */
LoadString(Globals.hInstance, IDS_LANGUAGE_ID, lang, sizeof(lang)); LoadString(Globals.hInstance, IDS_LANGUAGE_ID, lang, sizeof(lang));
Globals.lpszLanguage = lang;
/* Set frame caption */ /* Set frame caption */
LANGUAGE_UpdateWindowCaption(); LANGUAGE_UpdateWindowCaption();
@ -135,17 +130,3 @@ VOID LANGUAGE_DefaultHandle(WPARAM wParam)
LANGUAGE_SelectByNumber(wParam - NP_FIRST_LANGUAGE); LANGUAGE_SelectByNumber(wParam - NP_FIRST_LANGUAGE);
else printf("Unimplemented menu command %i\n", wParam); else printf("Unimplemented menu command %i\n", wParam);
} }
VOID LANGUAGE_Init(VOID)
{
CHAR buffer[MAX_PATHNAME_LEN], *p;
#ifndef LCC
PROFILE_GetWineIniString("programs", "language", "language",
buffer, sizeof(buffer));
#endif
Globals.lpszLanguage = p = LocalLock(LocalAlloc(LMEM_FIXED, lstrlen(buffer)+1));
strcpy(p, buffer);
/* hmemcpy(p, buffer, 1 + lstrlen(buffer)); */
}

View file

@ -9,5 +9,4 @@ VOID LANGUAGE_UpdateWindowCaption(VOID);
VOID LANGUAGE_SelectByNumber(UINT num); VOID LANGUAGE_SelectByNumber(UINT num);
VOID LANGUAGE_SelectByName(LPCSTR lang); VOID LANGUAGE_SelectByName(LPCSTR lang);
VOID LANGUAGE_DefaultHandle(WPARAM wParam); VOID LANGUAGE_DefaultHandle(WPARAM wParam);
VOID LANGUAGE_Init(VOID);

View file

@ -8,44 +8,19 @@
#include "windows.h" #include "windows.h"
#include "license.h" #include "license.h"
static LICENSE* SelectLanguage(LPCSTR Language) VOID WineLicense(HWND Wnd)
{ {
/* /* FIXME: should load strings from resources */
if (lstrcmp(Language, "Ca")) return(&WineLicense_Ca); LICENSE *License = &WineLicense_En;
if (lstrcmp(Language, "Cz")) return(&WineLicense_Cz);
if (lstrcmp(Language, "Da")) return(&WineLicense_Da);
if (lstrcmp(Language, "De")) return(&WineLicense_En);
if (lstrcmp(Language, "En")) return(&WineLicense_En);
if (lstrcmp(Language, "Eo")) return(&WineLicense_Eo);
if (lstrcmp(Language, "Es")) return(&WineLicense_Es);
if (lstrcmp(Language, "Fi")) return(&WineLicense_Fi);
if (lstrcmp(Language, "Fr")) return(&WineLicense_Fr);
if (lstrcmp(Language, "Hu")) return(&WineLicense_Hu);
if (lstrcmp(Language, "It")) return(&WineLicense_It);
if (lstrcmp(Langauge, "Ko")) return(&WineLicense_Ko);
if (lstrcmp(Language, "No")) return(&WineLicense_No);
if (lstrcmp(Language, "Pl")) return(&WineLicense_Pl);
if (lstrcmp(Language, "Po")) return(&WineLicense_Po);
if (lstrcmp(Language, "Va")) return(&WineLicense_Va);
if (lstrcmp(Language, "Sw")) return(&WineLicense_Sw);
*/
return(&WineLicense_En);
}
VOID WineLicense(HWND Wnd, LPCSTR Language)
{
LICENSE *License = SelectLanguage(Language);
MessageBox(Wnd, License->License, License->LicenseCaption, MessageBox(Wnd, License->License, License->LicenseCaption,
MB_ICONINFORMATION | MB_OK); MB_ICONINFORMATION | MB_OK);
} }
VOID WineWarranty(HWND Wnd, LPCSTR Language) VOID WineWarranty(HWND Wnd)
{ {
LICENSE *License = SelectLanguage(Language); /* FIXME: should load strings from resources */
LICENSE *License = &WineLicense_En;
MessageBox(Wnd, License->Warranty, License->WarrantyCaption, MessageBox(Wnd, License->Warranty, License->WarrantyCaption,
MB_ICONEXCLAMATION | MB_OK); MB_ICONEXCLAMATION | MB_OK);
} }

View file

@ -5,8 +5,8 @@
* To be distributed under the Wine License * To be distributed under the Wine License
*/ */
VOID WineLicense(HWND hWnd, LPCSTR lpszLanguage); VOID WineLicense(HWND hWnd);
VOID WineWarranty(HWND hWnd, LPCSTR language); VOID WineWarranty(HWND hWnd);
typedef struct typedef struct
{ {

View file

@ -443,12 +443,12 @@ DWORD CreateLine(
*/ */
void LoadBufferFromFile(LPCSTR szFileName) void LoadBufferFromFile(LPCSTR szFileName)
{ {
HFILE hFile; HANDLE hFile;
OFSTRUCT ofs; OFSTRUCT ofs;
CHAR *pTemp; CHAR *pTemp;
DWORD size,i,len,bytes_left,bytes_read; DWORD size,i,len,bytes_left,bytes_read;
hFile = OpenFile(szFileName, &ofs, OF_READ); hFile = (HANDLE)OpenFile(szFileName, &ofs, OF_READ);
if(hFile == INVALID_HANDLE_VALUE) if(hFile == INVALID_HANDLE_VALUE)
return; return;
size = BUFFERCHUNKSIZE; size = BUFFERCHUNKSIZE;
@ -749,7 +749,7 @@ int NOTEPAD_MenuCommand (WPARAM wParam)
* NOTEPAD_WndProc * NOTEPAD_WndProc
*/ */
LRESULT NOTEPAD_WndProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) LRESULT WINAPI NOTEPAD_WndProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{ {
PAINTSTRUCT ps; PAINTSTRUCT ps;
HDC hContext; HDC hContext;
@ -861,9 +861,6 @@ int PASCAL WinMain (HINSTANCE hInstance, HINSTANCE prev, LPSTR cmdline, int show
char className[] = "NPClass"; /* To make sure className >= 0x10000 */ char className[] = "NPClass"; /* To make sure className >= 0x10000 */
char winName[] = "Notepad"; char winName[] = "Notepad";
/* Select Language */
LANGUAGE_Init();
/* setup buffer */ /* setup buffer */
InitBuffer(); InitBuffer();
@ -918,7 +915,7 @@ int PASCAL WinMain (HINSTANCE hInstance, HINSTANCE prev, LPSTR cmdline, int show
Globals.hFindReplaceDlg = 0; Globals.hFindReplaceDlg = 0;
LANGUAGE_SelectByName(Globals.lpszLanguage); LANGUAGE_SelectByNumber(0);
SetMenu(Globals.hMainWnd, Globals.hMainMenu); SetMenu(Globals.hMainWnd, Globals.hMainMenu);

View file

@ -33,7 +33,6 @@ typedef struct
HMENU hHelpMenu; HMENU hHelpMenu;
LPCSTR lpszIniFile; LPCSTR lpszIniFile;
LPCSTR lpszIcoFile; LPCSTR lpszIcoFile;
LPCSTR lpszLanguage;
UINT wStringTableOffset; UINT wStringTableOffset;
BOOL bWrapLongLines; BOOL bWrapLongLines;
CHAR szFindText[MAX_PATHNAME_LEN]; CHAR szFindText[MAX_PATHNAME_LEN];

View file

@ -10,10 +10,6 @@
#include "windowsx.h" #include "windowsx.h"
#include "winhelp.h" #include "winhelp.h"
#ifdef WINELIB
#include "options.h"
#endif
static BOOL WINHELP_RegisterWinClasses(); static BOOL WINHELP_RegisterWinClasses();
static LRESULT CALLBACK WINHELP_MainWndProc(HWND, UINT, WPARAM, LPARAM); static LRESULT CALLBACK WINHELP_MainWndProc(HWND, UINT, WPARAM, LPARAM);
static LRESULT CALLBACK WINHELP_TextWndProc(HWND, UINT, WPARAM, LPARAM); static LRESULT CALLBACK WINHELP_TextWndProc(HWND, UINT, WPARAM, LPARAM);