Commit 4eeadac1 authored by Sylvain Petreolle's avatar Sylvain Petreolle Committed by Alexandre Julliard

Implemented NLS in progman.

parent f871f2d5
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
* Program Manager * Program Manager
* *
* Copyright 1996 Ulrich Schmid * Copyright 1996 Ulrich Schmid
* Copyright 2002 Sylvain Petreolle
* Copyright 2002 Andriy Palamarchuk * Copyright 2002 Andriy Palamarchuk
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
...@@ -48,7 +49,7 @@ INT DIALOG_New(INT nDefault) ...@@ -48,7 +49,7 @@ INT DIALOG_New(INT nDefault)
New.nDefault = nDefault; New.nDefault = nDefault;
ret = DialogBox(Globals.hInstance, STRING_NEW_Xx, ret = DialogBox(Globals.hInstance, STRING_NEW,
Globals.hMainWnd, lpfnDlg); Globals.hMainWnd, lpfnDlg);
FreeProcInstance(lpfnDlg); FreeProcInstance(lpfnDlg);
return ret; return ret;
...@@ -110,7 +111,7 @@ HLOCAL DIALOG_CopyMove(LPCSTR lpszProgramName, LPCSTR lpszFromGroupName, ...@@ -110,7 +111,7 @@ HLOCAL DIALOG_CopyMove(LPCSTR lpszProgramName, LPCSTR lpszFromGroupName,
CopyMove.hToGroup = 0; CopyMove.hToGroup = 0;
ret = DialogBox(Globals.hInstance, ret = DialogBox(Globals.hInstance,
bMove ? STRING_MOVE_Xx : STRING_COPY_Xx, bMove ? STRING_MOVE : STRING_COPY,
Globals.hMainWnd, lpfnDlg); Globals.hMainWnd, lpfnDlg);
FreeProcInstance(lpfnDlg); FreeProcInstance(lpfnDlg);
...@@ -199,7 +200,7 @@ BOOL DIALOG_GroupAttributes(LPSTR lpszTitle, LPSTR lpszGrpFile, INT nSize) ...@@ -199,7 +200,7 @@ BOOL DIALOG_GroupAttributes(LPSTR lpszTitle, LPSTR lpszGrpFile, INT nSize)
GroupAttributes.lpszTitle = lpszTitle; GroupAttributes.lpszTitle = lpszTitle;
GroupAttributes.lpszGrpFile = lpszGrpFile; GroupAttributes.lpszGrpFile = lpszGrpFile;
ret = DialogBox(Globals.hInstance, STRING_GROUP_Xx, ret = DialogBox(Globals.hInstance, STRING_GROUP,
Globals.hMainWnd, lpfnDlg); Globals.hMainWnd, lpfnDlg);
FreeProcInstance(lpfnDlg); FreeProcInstance(lpfnDlg);
return(ret == IDOK); return(ret == IDOK);
...@@ -282,7 +283,7 @@ BOOL DIALOG_ProgramAttributes(LPSTR lpszTitle, LPSTR lpszCmdLine, ...@@ -282,7 +283,7 @@ BOOL DIALOG_ProgramAttributes(LPSTR lpszTitle, LPSTR lpszCmdLine,
ProgramAttributes.lpszTmpIconFile = szTmpIconFile; ProgramAttributes.lpszTmpIconFile = szTmpIconFile;
lstrcpyn(ProgramAttributes.lpszTmpIconFile, lpszIconFile, MAX_PATHNAME_LEN); lstrcpyn(ProgramAttributes.lpszTmpIconFile, lpszIconFile, MAX_PATHNAME_LEN);
ret = DialogBox(Globals.hInstance, STRING_PROGRAM_Xx, ret = DialogBox(Globals.hInstance, STRING_PROGRAM,
Globals.hMainWnd, lpfnDlg); Globals.hMainWnd, lpfnDlg);
FreeProcInstance(lpfnDlg); FreeProcInstance(lpfnDlg);
...@@ -404,7 +405,7 @@ VOID DIALOG_Symbol(HICON *lphIcon, LPSTR lpszIconFile, ...@@ -404,7 +405,7 @@ VOID DIALOG_Symbol(HICON *lphIcon, LPSTR lpszIconFile,
Symbol.lphIcon = lphIcon; Symbol.lphIcon = lphIcon;
Symbol.lpnIconIndex = lpnIconIndex; Symbol.lpnIconIndex = lpnIconIndex;
DialogBox(Globals.hInstance, STRING_SYMBOL_Xx, DialogBox(Globals.hInstance, STRING_SYMBOL,
Globals.hMainWnd, lpfnDlg); Globals.hMainWnd, lpfnDlg);
FreeProcInstance(lpfnDlg); FreeProcInstance(lpfnDlg);
} }
...@@ -488,10 +489,11 @@ static BOOL CALLBACK DIALOG_SYMBOL_DlgProc(HWND hDlg, UINT msg, WPARAM wParam, L ...@@ -488,10 +489,11 @@ static BOOL CALLBACK DIALOG_SYMBOL_DlgProc(HWND hDlg, UINT msg, WPARAM wParam, L
VOID DIALOG_Execute() VOID DIALOG_Execute()
{ {
DLGPROC lpfnDlg = MakeProcInstance(DIALOG_EXECUTE_DlgProc, Globals.hInstance); INT_PTR z;
DialogBox(Globals.hInstance, STRING_EXECUTE_Xx, DLGPROC lpfnDlg = MakeProcInstance(DIALOG_EXECUTE_DlgProc, Globals.hInstance);
z=DialogBox(Globals.hInstance, STRING_EXECUTE,
Globals.hMainWnd, lpfnDlg); Globals.hMainWnd, lpfnDlg);
FreeProcInstance(lpfnDlg); FreeProcInstance(lpfnDlg);
} }
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
......
/* /*
* Copyright 1996 Ulrich Schmid * Copyright 1996 Ulrich Schmid
* Copyright 2002 Sylvain Petreolle
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
...@@ -19,9 +20,9 @@ ...@@ -19,9 +20,9 @@
#include "windows.h" #include "windows.h"
#include "license.h" #include "license.h"
#if 0
static LICENSE* SelectLanguage(LPCSTR Language) static LICENSE* SelectLanguage(LPCSTR Language)
{ {
#if 0
if (!lstrcmp(Language, "Cz")) return(&WineLicense_Cz); if (!lstrcmp(Language, "Cz")) return(&WineLicense_Cz);
if (!lstrcmp(Language, "Da")) return(&WineLicense_Da); if (!lstrcmp(Language, "Da")) return(&WineLicense_Da);
if (!lstrcmp(Language, "De")) return(&WineLicense_De); if (!lstrcmp(Language, "De")) return(&WineLicense_De);
...@@ -37,21 +38,23 @@ static LICENSE* SelectLanguage(LPCSTR Language) ...@@ -37,21 +38,23 @@ static LICENSE* SelectLanguage(LPCSTR Language)
if (!lstrcmp(Language, "Pl")) return(&WineLicense_Pl); if (!lstrcmp(Language, "Pl")) return(&WineLicense_Pl);
if (!lstrcmp(Language, "Po")) return(&WineLicense_Po); if (!lstrcmp(Language, "Po")) return(&WineLicense_Po);
if (!lstrcmp(Language, "Va")) return(&WineLicense_Va); if (!lstrcmp(Language, "Va")) return(&WineLicense_Va);
#endif
return(&WineLicense_En); return(&WineLicense_En);
} }
#endif
VOID WineLicense(HWND Wnd, LPCSTR Language) VOID WineLicense(HWND Wnd)
{ {
LICENSE *License = SelectLanguage(Language); /* LICENSE *License = SelectLanguage(Language); */
LICENSE *License = &WineLicense_En;
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); /* LICENSE *License = SelectLanguage(Language); */
LICENSE *License = &WineLicense_En;
MessageBox(Wnd, License->Warranty, License->WarrantyCaption, MessageBox(Wnd, License->Warranty, License->WarrantyCaption,
MB_ICONEXCLAMATION | MB_OK); MB_ICONEXCLAMATION | MB_OK);
......
/* /*
* Copyright 1996 Ulrich Schmid * Copyright 1996 Ulrich Schmid
* Copyright 2002 Sylvain Petreolle
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
...@@ -16,8 +17,8 @@ ...@@ -16,8 +17,8 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
VOID WineLicense(HWND hWnd, LPCSTR lpszLanguage); VOID WineLicense(HWND hWnd);
VOID WineWarranty(HWND hWnd, LPCSTR language); VOID WineWarranty(HWND hWnd);
typedef struct typedef struct
{ {
......
/* /*
* Program Manager * Program Manager
* *
* Copyright 1996 Ulrich Schmid <uschmid@mail.hh.provi.de> * Copyright 1996 Ulrich Schmid
* Copyright 2002 Sylvain Petreolle
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
...@@ -48,8 +49,6 @@ int PASCAL WinMain (HINSTANCE hInstance, HINSTANCE prev, LPSTR cmdline, int show ...@@ -48,8 +49,6 @@ int PASCAL WinMain (HINSTANCE hInstance, HINSTANCE prev, LPSTR cmdline, int show
Globals.lpszIniFile = "progman.ini"; Globals.lpszIniFile = "progman.ini";
Globals.lpszIcoFile = "progman.ico"; Globals.lpszIcoFile = "progman.ico";
/* Select Language */
Globals.lpszLanguage = "En";
Globals.hInstance = hInstance; Globals.hInstance = hInstance;
Globals.hGroups = 0; Globals.hGroups = 0;
Globals.hActiveGroup = 0; Globals.hActiveGroup = 0;
...@@ -83,7 +82,7 @@ int PASCAL WinMain (HINSTANCE hInstance, HINSTANCE prev, LPSTR cmdline, int show ...@@ -83,7 +82,7 @@ int PASCAL WinMain (HINSTANCE hInstance, HINSTANCE prev, LPSTR cmdline, int show
Globals.hAccel = LoadAccelerators(Globals.hInstance, STRING_ACCEL); Globals.hAccel = LoadAccelerators(Globals.hInstance, STRING_ACCEL);
/* Setup menu, stringtable and resourcenames */ /* Setup menu, stringtable and resourcenames */
STRING_SelectLanguageByName(Globals.lpszLanguage); STRING_LoadMenus();
MAIN_CreateMDIWindow(); MAIN_CreateMDIWindow();
...@@ -180,8 +179,9 @@ static LRESULT CALLBACK MAIN_MainWndProc(HWND hWnd, UINT msg, ...@@ -180,8 +179,9 @@ static LRESULT CALLBACK MAIN_MainWndProc(HWND hWnd, UINT msg,
break; break;
case WM_COMMAND: case WM_COMMAND:
if (wParam < PM_FIRST_CHILD) if (wParam < PM_FIRST_CHILD){
MAIN_MenuCommand(hWnd, wParam, lParam); MAIN_MenuCommand(hWnd, wParam, lParam);
}
break; break;
case WM_DESTROY: case WM_DESTROY:
...@@ -296,6 +296,7 @@ static VOID MAIN_MenuCommand(HWND hWnd, WPARAM wParam, LPARAM lParam) ...@@ -296,6 +296,7 @@ static VOID MAIN_MenuCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
/* Menu Windows */ /* Menu Windows */
case PM_ARRANGE: case PM_ARRANGE:
if (hActiveGroupWnd && !IsIconic(hActiveGroupWnd)) if (hActiveGroupWnd && !IsIconic(hActiveGroupWnd))
ArrangeIconicWindows(hActiveGroupWnd); ArrangeIconicWindows(hActiveGroupWnd);
else else
...@@ -304,7 +305,7 @@ static VOID MAIN_MenuCommand(HWND hWnd, WPARAM wParam, LPARAM lParam) ...@@ -304,7 +305,7 @@ static VOID MAIN_MenuCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
/* Menu Help */ /* Menu Help */
case PM_CONTENTS: case PM_CONTENTS:
if (!WinHelp(Globals.hMainWnd, "progman.hlp", HELP_INDEX, 0)) if (!WinHelp(Globals.hMainWnd, "progman.hlp", HELP_CONTENTS, 0))
MAIN_MessageBoxIDS(IDS_WINHELP_ERROR, IDS_ERROR, MB_OK); MAIN_MessageBoxIDS(IDS_WINHELP_ERROR, IDS_ERROR, MB_OK);
break; break;
...@@ -318,11 +319,11 @@ static VOID MAIN_MenuCommand(HWND hWnd, WPARAM wParam, LPARAM lParam) ...@@ -318,11 +319,11 @@ static VOID MAIN_MenuCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
break; break;
case PM_LICENSE: case PM_LICENSE:
WineLicense(Globals.hMainWnd, Globals.lpszLanguage); WineLicense(Globals.hMainWnd);
break; break;
case PM_NO_WARRANTY: case PM_NO_WARRANTY:
WineWarranty(Globals.hMainWnd, Globals.lpszLanguage); WineWarranty(Globals.hMainWnd);
break; break;
case PM_ABOUT_WINE: case PM_ABOUT_WINE:
...@@ -330,9 +331,6 @@ static VOID MAIN_MenuCommand(HWND hWnd, WPARAM wParam, LPARAM lParam) ...@@ -330,9 +331,6 @@ static VOID MAIN_MenuCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
break; break;
default: default:
if (wParam >= PM_FIRST_LANGUAGE && wParam <= PM_LAST_LANGUAGE)
STRING_SelectLanguageByNumber(wParam - PM_FIRST_LANGUAGE);
else
MAIN_MessageBoxIDS(IDS_NOT_IMPLEMENTED, IDS_ERROR, MB_OK); MAIN_MessageBoxIDS(IDS_NOT_IMPLEMENTED, IDS_ERROR, MB_OK);
break; break;
} }
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
* Program Manager * Program Manager
* *
* Copyright 1996 Ulrich Schmid * Copyright 1996 Ulrich Schmid
* Copyright 2002 Sylvain Petreolle
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
...@@ -25,8 +26,6 @@ ...@@ -25,8 +26,6 @@
#define MAX_PATHNAME_LEN 1024 #define MAX_PATHNAME_LEN 1024
#define MAX_LANGUAGE_NUMBER (PM_LAST_LANGUAGE - PM_FIRST_LANGUAGE) #define MAX_LANGUAGE_NUMBER (PM_LAST_LANGUAGE - PM_FIRST_LANGUAGE)
#ifndef RC_INVOKED
#include "windows.h" #include "windows.h"
/* Fallback icon */ /* Fallback icon */
...@@ -132,8 +131,6 @@ typedef struct ...@@ -132,8 +131,6 @@ typedef struct
BOOL bSaveSettings; BOOL bSaveSettings;
BOOL bMinOnRun; BOOL bMinOnRun;
HLOCAL hGroups; HLOCAL hGroups;
LPCSTR lpszLanguage;
UINT wStringTableOffset;
HLOCAL hActiveGroup; HLOCAL hActiveGroup;
} GLOBALS; } GLOBALS;
...@@ -191,8 +188,7 @@ VOID DIALOG_Symbol(HICON *lphIcon, LPSTR lpszIconFile, ...@@ -191,8 +188,7 @@ VOID DIALOG_Symbol(HICON *lphIcon, LPSTR lpszIconFile,
INT *lpnIconIndex, INT nSize); INT *lpnIconIndex, INT nSize);
VOID DIALOG_Execute(void); VOID DIALOG_Execute(void);
VOID STRING_SelectLanguageByName(LPCSTR); VOID STRING_LoadMenus(VOID);
VOID STRING_SelectLanguageByNumber(UINT);
/* Class names */ /* Class names */
extern CHAR STRING_MAIN_WIN_CLASS_NAME[]; extern CHAR STRING_MAIN_WIN_CLASS_NAME[];
...@@ -202,128 +198,121 @@ extern CHAR STRING_PROGRAM_WIN_CLASS_NAME[]; ...@@ -202,128 +198,121 @@ extern CHAR STRING_PROGRAM_WIN_CLASS_NAME[];
/* Resource names */ /* Resource names */
extern CHAR STRING_ACCEL[]; extern CHAR STRING_ACCEL[];
extern CHAR STRING_MAIN_Xx[]; extern CHAR STRING_MAIN[];
extern CHAR STRING_NEW_Xx[]; extern CHAR STRING_NEW[];
extern CHAR STRING_OPEN_Xx[]; extern CHAR STRING_OPEN[];
extern CHAR STRING_MOVE_Xx[]; extern CHAR STRING_MOVE[];
extern CHAR STRING_COPY_Xx[]; extern CHAR STRING_COPY[];
extern CHAR STRING_DELETE_Xx[]; extern CHAR STRING_DELETE[];
extern CHAR STRING_GROUP_Xx[]; extern CHAR STRING_GROUP[];
extern CHAR STRING_PROGRAM_Xx[]; extern CHAR STRING_PROGRAM[];
extern CHAR STRING_SYMBOL_Xx[]; extern CHAR STRING_SYMBOL[];
extern CHAR STRING_EXECUTE_Xx[]; extern CHAR STRING_EXECUTE[];
#define STRINGID(id) (0x##id + Globals.wStringTableOffset)
#else /* RC_INVOKED */
#define STRINGID(id) id
#endif
/* Stringtable index */ /* Stringtable index */
#define IDS_LANGUAGE_ID STRINGID(00) #define IDS_PROGRAM_MANAGER 0x02
#define IDS_LANGUAGE_MENU_ITEM STRINGID(01) #define IDS_ERROR 0x03
#define IDS_PROGRAM_MANAGER STRINGID(02) #define IDS_WARNING 0x04
#define IDS_ERROR STRINGID(03) #define IDS_INFO 0x05
#define IDS_WARNING STRINGID(04) #define IDS_DELETE 0x06
#define IDS_INFO STRINGID(05) #define IDS_DELETE_GROUP_s 0x07
#define IDS_DELETE STRINGID(06) #define IDS_DELETE_PROGRAM_s 0x08
#define IDS_DELETE_GROUP_s STRINGID(07) #define IDS_NOT_IMPLEMENTED 0x09
#define IDS_DELETE_PROGRAM_s STRINGID(08) #define IDS_FILE_READ_ERROR_s 0x0a
#define IDS_NOT_IMPLEMENTED STRINGID(09) #define IDS_FILE_WRITE_ERROR_s 0x0b
#define IDS_FILE_READ_ERROR_s STRINGID(0a) #define IDS_GRPFILE_READ_ERROR_s 0x0c
#define IDS_FILE_WRITE_ERROR_s STRINGID(0b) #define IDS_OUT_OF_MEMORY 0x0d
#define IDS_GRPFILE_READ_ERROR_s STRINGID(0c) #define IDS_WINHELP_ERROR 0x0e
#define IDS_OUT_OF_MEMORY STRINGID(0d) #define IDS_UNKNOWN_FEATURE_s 0x0f
#define IDS_WINHELP_ERROR STRINGID(0e) #define IDS_FILE_NOT_OVERWRITTEN_s 0x10
#define IDS_UNKNOWN_FEATURE_s STRINGID(0f) #define IDS_SAVE_GROUP_AS_s 0x11
#define IDS_FILE_NOT_OVERWRITTEN_s STRINGID(10) #define IDS_NO_HOT_KEY 0x12
#define IDS_SAVE_GROUP_AS_s STRINGID(11) #define IDS_ALL_FILES 0x13
#define IDS_NO_HOT_KEY STRINGID(12) #define IDS_PROGRAMS 0x14
#define IDS_ALL_FILES STRINGID(13) #define IDS_LIBRARIES_DLL 0x15
#define IDS_PROGRAMS STRINGID(14) #define IDS_SYMBOL_FILES 0x16
#define IDS_LIBRARIES_DLL STRINGID(15) #define IDS_SYMBOLS_ICO 0x17
#define IDS_SYMBOL_FILES STRINGID(16)
#define IDS_SYMBOLS_ICO STRINGID(17)
/* Menu */ /* Menu */
#define PM_NEW 100 #define MAIN_MENU 0x109
#define PM_OPEN 101 #define PM_NEW 0x100
#define PM_MOVE 102 #define PM_OPEN 0x101
#define PM_COPY 103 #define PM_MOVE 0x102
#define PM_DELETE 104 #define PM_COPY 0x103
#define PM_ATTRIBUTES 105 #define PM_DELETE 0x104
#define PM_EXECUTE 107 #define PM_ATTRIBUTES 0x105
#define PM_EXIT 108 #define PM_EXECUTE 0x107
#define PM_EXIT 0x108
#define PM_AUTO_ARRANGE 0x110
#define PM_MIN_ON_RUN 0x111
#define PM_SAVE_SETTINGS 0x113
#define PM_OVERLAP 0x120
#define PM_SIDE_BY_SIDE 0x121
#define PM_ARRANGE 0x122
#define PM_FIRST_CHILD 0x3030
#define PM_AUTO_ARRANGE 200 /*
#define PM_MIN_ON_RUN 201 *#define PM_FIRST_LANGUAGE 0x400
#define PM_SAVE_SETTINGS 203 *#define PM_LAST_LANGUAGE 0x499
*/
#define PM_OVERLAP 300
#define PM_SIDE_BY_SIDE 301
#define PM_ARRANGE 302
#define PM_FIRST_CHILD 3030
#define PM_FIRST_LANGUAGE 400
#define PM_LAST_LANGUAGE 499
#define PM_CONTENTS 501 #define PM_CONTENTS 0x131
#define PM_SEARCH 502 #define PM_SEARCH 0x132
#define PM_HELPONHELP 503 #define PM_HELPONHELP 0x133
#define PM_TUTORIAL 504 #define PM_TUTORIAL 0x134
#define PM_LICENSE 510 #define PM_LICENSE 0x140
#define PM_NO_WARRANTY 511 #define PM_NO_WARRANTY 0x141
#define PM_ABOUT_WINE 512 #define PM_ABOUT_WINE 0x142
/* Dialog `New' */ /* Dialog `New' */
/* RADIOBUTTON: The next two must be in sequence */ /* RADIOBUTTON: The next two must be in sequence */
#define PM_NEW_GROUP 1000 #define PM_NEW_GROUP 0x150
#define PM_NEW_PROGRAM 1001 #define PM_NEW_PROGRAM 0x151
#define PM_NEW_GROUP_TXT 1002 #define PM_NEW_GROUP_TXT 0x152
#define PM_NEW_PROGRAM_TXT 1003 #define PM_NEW_PROGRAM_TXT 0x153
/* Dialogs `Copy', `Move' */ /* Dialogs `Copy', `Move' */
#define PM_PROGRAM 1200 #define PM_PROGRAM 0x160
#define PM_FROM_GROUP 1201 #define PM_FROM_GROUP 0x161
#define PM_TO_GROUP 1202 #define PM_TO_GROUP 0x162
#define PM_TO_GROUP_TXT 1203 #define PM_TO_GROUP_TXT 0x163
/* Dialogs `Group attributes' */ /* Dialogs `Group attributes' */
#define PM_DESCRIPTION 1500 #define PM_DESCRIPTION 0x170
#define PM_DESCRIPTION_TXT 1501 #define PM_DESCRIPTION_TXT 0x171
#define PM_FILE 1502 #define PM_FILE 0x172
#define PM_FILE_TXT 1503 #define PM_FILE_TXT 0x173
/* Dialogs `Program attributes' */ /* Dialogs `Program attributes' */
#define PM_COMMAND_LINE 1510 #define PM_COMMAND_LINE 0x180
#define PM_COMMAND_LINE_TXT 1511 #define PM_COMMAND_LINE_TXT 0x181
#define PM_DIRECTORY 1512 #define PM_DIRECTORY 0x182
#define PM_DIRECTORY_TXT 1513 #define PM_DIRECTORY_TXT 0x183
#define PM_HOT_KEY 1514 #define PM_HOT_KEY 0x184
#define PM_HOT_KEY_TXT 1515 #define PM_HOT_KEY_TXT 0x185
#define PM_ICON 1516 #define PM_ICON 0x186
#define PM_OTHER_SYMBOL 1517 #define PM_OTHER_SYMBOL 0x187
/* Dialog `Symbol' */ /* Dialog `Symbol' */
#define PM_ICON_FILE 1520 #define PM_ICON_FILE 0x190
#define PM_ICON_FILE_TXT 1521 #define PM_ICON_FILE_TXT 0x191
#define PM_SYMBOL_LIST 1522 #define PM_SYMBOL_LIST 0x192
#define PM_SYMBOL_LIST_TXT 1523 #define PM_SYMBOL_LIST_TXT 0x193
/* Dialog `Execute' */ /* Dialog `Execute' */
#define PM_COMMAND 1600 #define PM_COMMAND 0x1a0
#define PM_SYMBOL 1601 #define PM_SYMBOL 0x1a1
#define PM_BROWSE 1602 #define PM_BROWSE 0x1a2
#define PM_HELP 1603 #define PM_HELP 0x1a3
#endif /* PROGMAN_H */ #endif /* PROGMAN_H */
......
...@@ -18,32 +18,21 @@ ...@@ -18,32 +18,21 @@
#include "windows.h" #include "windows.h"
#include "progman.h" #include "progman.h"
#define CONCAT(a, b) CONCAT1(a, b)
#define CONCAT1(a, b) a##b
#define ADDSTRING(str) ADDSTRING1(LANGUAGE_NUMBER, IDS_ ## str) STRING_ ## str
#define ADDSTRING1(langnum, ids) ADDSTRING2(langnum, ids)
#define ADDSTRING2(langnum, ids) 0x ## langnum ## ids
#define STRINGIFY(str) STRINGIFY1(str)
#define STRINGIFY1(str) #str
#include "accel.rc" #include "accel.rc"
#include "Da.rc" /* #include "Da.rc" */
#include "De.rc" /* #include "De.rc" */
#include "En.rc" #include "En.rc"
#include "Es.rc" /* #include "Es.rc" */
#include "Fi.rc" /* #include "Fi.rc" */
#include "Fr.rc" #include "Fr.rc"
#include "Hu.rc" /* #include "Hu.rc" */
#include "It.rc" /* #include "It.rc" */
#include "Ko.rc" /* #include "Ko.rc" */
#include "Pt.rc" /* #include "Pt.rc" */
#include "Si.rc" /* #include "Si.rc" */
#include "Sk.rc" /* #include "Sk.rc" */
#include "Sw.rc" /* #include "Sw.rc" */
#include "Va.rc" /* #include "Va.rc" */
#include "Wa.rc" /* #include "Wa.rc" */
#include "Ru.rc" /* #include "Ru.rc" */
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
* Program Manager * Program Manager
* *
* Copyright 1996 Ulrich Schmid * Copyright 1996 Ulrich Schmid
* Copyright 2002 Sylvain Petreolle
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
...@@ -29,97 +30,35 @@ CHAR STRING_GROUP_WIN_CLASS_NAME[] = "PMGroup"; ...@@ -29,97 +30,35 @@ CHAR STRING_GROUP_WIN_CLASS_NAME[] = "PMGroup";
CHAR STRING_PROGRAM_WIN_CLASS_NAME[] = "PMProgram"; CHAR STRING_PROGRAM_WIN_CLASS_NAME[] = "PMProgram";
/* Resource names */ /* Resource names */
/* Xx will be overwritten with En, ... */
CHAR STRING_ACCEL[] = "ACCEL"; CHAR STRING_ACCEL[] = "ACCEL";
CHAR STRING_MENU_Xx[] = "MENU_Xx"; CHAR STRING_MENU[] = "MENU";
CHAR STRING_NEW_Xx[] = "DIALOG_NEW_Xx"; CHAR STRING_NEW[] = "DIALOG_NEW";
CHAR STRING_OPEN_Xx[] = "DIALOG_OPEN_Xx"; CHAR STRING_OPEN[] = "DIALOG_OPEN";
CHAR STRING_MOVE_Xx[] = "DIALOG_MOVE_Xx"; CHAR STRING_MOVE[] = "DIALOG_MOVE";
CHAR STRING_COPY_Xx[] = "DIALOG_COPY_Xx"; CHAR STRING_COPY[] = "DIALOG_COPY";
CHAR STRING_DELETE_Xx[] = "DIALOG_DELETE_Xx"; CHAR STRING_DELETE[] = "DIALOG_DELETE";
CHAR STRING_GROUP_Xx[] = "DIALOG_GROUP_Xx"; CHAR STRING_GROUP[] = "DIALOG_GROUP";
CHAR STRING_PROGRAM_Xx[] = "DIALOG_PROGRAM_Xx"; CHAR STRING_PROGRAM[] = "DIALOG_PROGRAM";
CHAR STRING_SYMBOL_Xx[] = "DIALOG_SYMBOL_Xx"; CHAR STRING_SYMBOL[] = "DIALOG_SYMBOL";
CHAR STRING_EXECUTE_Xx[] = "DIALOG_EXECUTE_Xx"; CHAR STRING_EXECUTE[] = "DIALOG_EXECUTE";
static BOOL STRING_LoadStringOtherLanguage(UINT num, UINT ids, LPSTR str, UINT len)
{ VOID STRING_LoadMenus(VOID)
ids -= Globals.wStringTableOffset;
ids += num * 0x100;
return(LoadString(Globals.hInstance, ids, str, len));
};
VOID STRING_SelectLanguageByName(LPCSTR lang)
{ {
INT i;
CHAR newlang[3];
for (i = 0; i <= MAX_LANGUAGE_NUMBER; i++)
if (STRING_LoadStringOtherLanguage(i, IDS_LANGUAGE_ID, newlang, sizeof(newlang)) &&
!lstrcmp(lang, newlang))
{
STRING_SelectLanguageByNumber(i);
return;
}
/* Fallback */
for (i = 0; i <= MAX_LANGUAGE_NUMBER; i++)
if (STRING_LoadStringOtherLanguage(i, IDS_LANGUAGE_ID, newlang, sizeof(newlang)))
{
STRING_SelectLanguageByNumber(i);
return;
}
MessageBox(Globals.hMainWnd, "No language found", "FATAL ERROR", MB_OK);
PostQuitMessage(1);
}
VOID STRING_SelectLanguageByNumber(UINT num)
{
INT i;
CHAR lang[3];
CHAR caption[MAX_STRING_LEN]; CHAR caption[MAX_STRING_LEN];
CHAR item[MAX_STRING_LEN];
HMENU hMainMenu; HMENU hMainMenu;
/* Select string table */
Globals.wStringTableOffset = num * 0x100;
/* Get Language id */
LoadString(Globals.hInstance, IDS_LANGUAGE_ID, lang, sizeof(lang));
Globals.lpszLanguage = lang;
/* Set frame caption */ /* Set frame caption */
LoadString(Globals.hInstance, IDS_PROGRAM_MANAGER, caption, sizeof(caption)); LoadString(Globals.hInstance, IDS_PROGRAM_MANAGER, caption, sizeof(caption));
SetWindowText(Globals.hMainWnd, caption); SetWindowText(Globals.hMainWnd, caption);
/* Change Resource names */
lstrcpyn(STRING_MENU_Xx + sizeof(STRING_MENU_Xx) - 3, lang, 3);
lstrcpyn(STRING_NEW_Xx + sizeof(STRING_NEW_Xx) - 3, lang, 3);
lstrcpyn(STRING_OPEN_Xx + sizeof(STRING_OPEN_Xx) - 3, lang, 3);
lstrcpyn(STRING_MOVE_Xx + sizeof(STRING_MOVE_Xx) - 3, lang, 3);
lstrcpyn(STRING_COPY_Xx + sizeof(STRING_COPY_Xx) - 3, lang, 3);
lstrcpyn(STRING_DELETE_Xx + sizeof(STRING_DELETE_Xx) - 3, lang, 3);
lstrcpyn(STRING_GROUP_Xx + sizeof(STRING_GROUP_Xx) - 3, lang, 3);
lstrcpyn(STRING_PROGRAM_Xx + sizeof(STRING_PROGRAM_Xx) - 3, lang, 3);
lstrcpyn(STRING_SYMBOL_Xx + sizeof(STRING_SYMBOL_Xx) - 3, lang, 3);
lstrcpyn(STRING_EXECUTE_Xx + sizeof(STRING_EXECUTE_Xx) - 3, lang, 3);
/* Create menu */ /* Create menu */
hMainMenu = LoadMenu(Globals.hInstance, STRING_MENU_Xx); hMainMenu = LoadMenu(Globals.hInstance, MAKEINTRESOURCE(MAIN_MENU));
Globals.hFileMenu = GetSubMenu(hMainMenu, 0); Globals.hFileMenu = GetSubMenu(hMainMenu, 0);
Globals.hOptionMenu = GetSubMenu(hMainMenu, 1); Globals.hOptionMenu = GetSubMenu(hMainMenu, 1);
Globals.hWindowsMenu = GetSubMenu(hMainMenu, 2); Globals.hWindowsMenu = GetSubMenu(hMainMenu, 2);
Globals.hLanguageMenu = GetSubMenu(hMainMenu, 3); Globals.hLanguageMenu = GetSubMenu(hMainMenu, 3);
/* Remove dummy item */
RemoveMenu(Globals.hLanguageMenu, 0, MF_BYPOSITION);
/* Add language items */
for (i = 0; i <= MAX_LANGUAGE_NUMBER; i++)
if (STRING_LoadStringOtherLanguage(i, IDS_LANGUAGE_MENU_ITEM, item, sizeof(item)))
AppendMenu(Globals.hLanguageMenu, MF_STRING | MF_BYCOMMAND,
PM_FIRST_LANGUAGE + i, item);
if (Globals.hMDIWnd) if (Globals.hMDIWnd)
SendMessage(Globals.hMDIWnd, WM_MDISETMENU, SendMessage(Globals.hMDIWnd, WM_MDISETMENU,
(WPARAM) hMainMenu, (WPARAM) hMainMenu,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment