Fixed language handling. Removed some dependencies on Wine internals.
This commit is contained in:
parent
4bbc0b3aee
commit
3da872daaf
|
@ -10,9 +10,6 @@
|
|||
#include "main.h"
|
||||
#include "language.h"
|
||||
#include "winnls.h"
|
||||
#ifdef WINELIB
|
||||
#include "options.h"
|
||||
#endif
|
||||
|
||||
CHAR STRING_MENU_Xx[] = "MENU_Xx";
|
||||
|
||||
|
@ -124,7 +121,6 @@ VOID LANGUAGE_SelectByNumber(UINT num)
|
|||
|
||||
/* Get Language id */
|
||||
LoadString(Globals.hInstance, IDS_LANGUAGE_ID, szLanguage, sizeof(szLanguage));
|
||||
Globals.lpszLanguage = szLanguage;
|
||||
|
||||
/* Change Resource names */
|
||||
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);
|
||||
}
|
||||
|
||||
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: */
|
||||
/* c-file-style: "GNU" */
|
||||
/* End: */
|
||||
|
|
|
@ -10,7 +10,6 @@ VOID LANGUAGE_UpdateMenuCheckmarks(VOID);
|
|||
VOID LANGUAGE_SelectByNumber(UINT num);
|
||||
VOID LANGUAGE_SelectByName(LPCSTR lang);
|
||||
VOID LANGUAGE_DefaultHandle(WPARAM wParam);
|
||||
VOID LANGUAGE_Init(VOID);
|
||||
|
||||
/* Local Variables: */
|
||||
/* c-file-style: "GNU" */
|
||||
|
|
|
@ -8,44 +8,19 @@
|
|||
#include "windows.h"
|
||||
#include "license.h"
|
||||
|
||||
static LICENSE* SelectLanguage(LPCSTR Language)
|
||||
VOID WineLicense(HWND Wnd)
|
||||
{
|
||||
/*
|
||||
if (lstrcmp(Language, "Ca")) return(&WineLicense_Ca);
|
||||
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);
|
||||
|
||||
/* FIXME: should load strings from resources */
|
||||
LICENSE *License = &WineLicense_En;
|
||||
MessageBox(Wnd, License->License, License->LicenseCaption,
|
||||
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,
|
||||
MB_ICONEXCLAMATION | MB_OK);
|
||||
}
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
|
||||
/* function prototypes */
|
||||
|
||||
VOID WineLicense(HWND hWnd, LPCSTR lpszLanguage);
|
||||
VOID WineWarranty(HWND hWnd, LPCSTR language);
|
||||
VOID WineLicense(HWND hWnd);
|
||||
VOID WineWarranty(HWND hWnd);
|
||||
|
||||
|
||||
/* typedefs */
|
||||
|
|
|
@ -70,11 +70,11 @@ int CLOCK_MenuCommand (WPARAM wParam)
|
|||
break;
|
||||
}
|
||||
case CL_INFO_LICENSE: {
|
||||
WineLicense(Globals.hMainWnd, Globals.lpszLanguage);
|
||||
WineLicense(Globals.hMainWnd);
|
||||
break;
|
||||
}
|
||||
case CL_INFO_NO_WARRANTY: {
|
||||
WineWarranty(Globals.hMainWnd, Globals.lpszLanguage);
|
||||
WineWarranty(Globals.hMainWnd);
|
||||
break;
|
||||
}
|
||||
case CL_INFO_ABOUT_WINE: {
|
||||
|
@ -119,7 +119,7 @@ VOID MAIN_FileChooseFont(VOID) {
|
|||
* 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;
|
||||
HDC context;
|
||||
|
@ -203,9 +203,6 @@ int PASCAL WinMain (HINSTANCE hInstance, HINSTANCE prev, LPSTR cmdline, int show
|
|||
Globals.lpszIniFile = "clock.ini";
|
||||
Globals.lpszIcoFile = "clock.ico";
|
||||
|
||||
/* Select Language */
|
||||
LANGUAGE_Init();
|
||||
|
||||
Globals.hInstance = hInstance;
|
||||
Globals.hMainIcon = ExtractIcon(Globals.hInstance,
|
||||
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,
|
||||
LoadMenu(Globals.hInstance, STRING_MENU_Xx), Globals.hInstance, 0);
|
||||
|
||||
LANGUAGE_SelectByName(Globals.lpszLanguage);
|
||||
LANGUAGE_SelectByName("En");
|
||||
SetMenu(Globals.hMainWnd, Globals.hMainMenu);
|
||||
|
||||
LANGUAGE_UpdateMenuCheckmarks();
|
||||
|
|
|
@ -28,7 +28,6 @@ typedef struct
|
|||
HMENU hPopupMenu1;
|
||||
LPCSTR lpszIniFile;
|
||||
LPCSTR lpszIcoFile;
|
||||
LPSTR lpszLanguage;
|
||||
UINT wStringTableOffset;
|
||||
|
||||
BOOL bAnalog;
|
||||
|
|
|
@ -11,10 +11,6 @@
|
|||
#include <commdlg.h>
|
||||
#include <winerror.h>
|
||||
|
||||
#ifdef WINELIB
|
||||
#include "options.h"
|
||||
#endif
|
||||
|
||||
#include "main.h"
|
||||
#include "license.h"
|
||||
#include "language.h"
|
||||
|
@ -28,7 +24,7 @@
|
|||
#include "winnls.h"
|
||||
#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)
|
||||
{
|
||||
WineLicense(Globals.hMainWnd, Globals.lpszLanguage);
|
||||
WineLicense(Globals.hMainWnd);
|
||||
}
|
||||
|
||||
VOID DIALOG_HelpNoWarranty(VOID)
|
||||
{
|
||||
WineWarranty(Globals.hMainWnd, Globals.lpszLanguage);
|
||||
WineWarranty(Globals.hMainWnd);
|
||||
}
|
||||
|
||||
VOID DIALOG_HelpAboutWine(VOID)
|
||||
|
@ -629,7 +625,7 @@ VOID DIALOG_PageSetup(VOID)
|
|||
* 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)
|
||||
|
|
|
@ -10,10 +10,6 @@
|
|||
#include "main.h"
|
||||
#include "language.h"
|
||||
|
||||
#ifdef WINELIB
|
||||
#include "options.h"
|
||||
#endif
|
||||
|
||||
CHAR STRING_MENU_Xx[] = "MENU_Xx";
|
||||
CHAR STRING_PAGESETUP_Xx[] = "DIALOG_PAGESETUP_Xx";
|
||||
|
||||
|
@ -97,7 +93,6 @@ VOID LANGUAGE_SelectByNumber(UINT num)
|
|||
|
||||
/* Get Language id */
|
||||
LoadString(Globals.hInstance, IDS_LANGUAGE_ID, lang, sizeof(lang));
|
||||
Globals.lpszLanguage = lang;
|
||||
|
||||
/* Set frame caption */
|
||||
LANGUAGE_UpdateWindowCaption();
|
||||
|
@ -135,17 +130,3 @@ VOID LANGUAGE_DefaultHandle(WPARAM wParam)
|
|||
LANGUAGE_SelectByNumber(wParam - NP_FIRST_LANGUAGE);
|
||||
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)); */
|
||||
}
|
||||
|
||||
|
|
|
@ -9,5 +9,4 @@ VOID LANGUAGE_UpdateWindowCaption(VOID);
|
|||
VOID LANGUAGE_SelectByNumber(UINT num);
|
||||
VOID LANGUAGE_SelectByName(LPCSTR lang);
|
||||
VOID LANGUAGE_DefaultHandle(WPARAM wParam);
|
||||
VOID LANGUAGE_Init(VOID);
|
||||
|
||||
|
|
|
@ -8,44 +8,19 @@
|
|||
#include "windows.h"
|
||||
#include "license.h"
|
||||
|
||||
static LICENSE* SelectLanguage(LPCSTR Language)
|
||||
VOID WineLicense(HWND Wnd)
|
||||
{
|
||||
/*
|
||||
if (lstrcmp(Language, "Ca")) return(&WineLicense_Ca);
|
||||
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);
|
||||
|
||||
/* FIXME: should load strings from resources */
|
||||
LICENSE *License = &WineLicense_En;
|
||||
MessageBox(Wnd, License->License, License->LicenseCaption,
|
||||
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,
|
||||
MB_ICONEXCLAMATION | MB_OK);
|
||||
}
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
* To be distributed under the Wine License
|
||||
*/
|
||||
|
||||
VOID WineLicense(HWND hWnd, LPCSTR lpszLanguage);
|
||||
VOID WineWarranty(HWND hWnd, LPCSTR language);
|
||||
VOID WineLicense(HWND hWnd);
|
||||
VOID WineWarranty(HWND hWnd);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
|
|
@ -443,12 +443,12 @@ DWORD CreateLine(
|
|||
*/
|
||||
void LoadBufferFromFile(LPCSTR szFileName)
|
||||
{
|
||||
HFILE hFile;
|
||||
HANDLE hFile;
|
||||
OFSTRUCT ofs;
|
||||
CHAR *pTemp;
|
||||
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)
|
||||
return;
|
||||
size = BUFFERCHUNKSIZE;
|
||||
|
@ -749,7 +749,7 @@ int NOTEPAD_MenuCommand (WPARAM wParam)
|
|||
* 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;
|
||||
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 winName[] = "Notepad";
|
||||
|
||||
/* Select Language */
|
||||
LANGUAGE_Init();
|
||||
|
||||
/* setup buffer */
|
||||
InitBuffer();
|
||||
|
||||
|
@ -918,7 +915,7 @@ int PASCAL WinMain (HINSTANCE hInstance, HINSTANCE prev, LPSTR cmdline, int show
|
|||
|
||||
Globals.hFindReplaceDlg = 0;
|
||||
|
||||
LANGUAGE_SelectByName(Globals.lpszLanguage);
|
||||
LANGUAGE_SelectByNumber(0);
|
||||
|
||||
SetMenu(Globals.hMainWnd, Globals.hMainMenu);
|
||||
|
||||
|
|
|
@ -33,7 +33,6 @@ typedef struct
|
|||
HMENU hHelpMenu;
|
||||
LPCSTR lpszIniFile;
|
||||
LPCSTR lpszIcoFile;
|
||||
LPCSTR lpszLanguage;
|
||||
UINT wStringTableOffset;
|
||||
BOOL bWrapLongLines;
|
||||
CHAR szFindText[MAX_PATHNAME_LEN];
|
||||
|
|
|
@ -10,10 +10,6 @@
|
|||
#include "windowsx.h"
|
||||
#include "winhelp.h"
|
||||
|
||||
#ifdef WINELIB
|
||||
#include "options.h"
|
||||
#endif
|
||||
|
||||
static BOOL WINHELP_RegisterWinClasses();
|
||||
static LRESULT CALLBACK WINHELP_MainWndProc(HWND, UINT, WPARAM, LPARAM);
|
||||
static LRESULT CALLBACK WINHELP_TextWndProc(HWND, UINT, WPARAM, LPARAM);
|
||||
|
|
Loading…
Reference in New Issue