4 * Copyright 1996 Ulrich Schmid
15 CHAR STRING_MAIN_WIN_CLASS_NAME
[] = "PMMain";
16 CHAR STRING_MDI_WIN_CLASS_NAME
[] = "MDICLIENT";
17 CHAR STRING_GROUP_WIN_CLASS_NAME
[] = "PMGroup";
18 CHAR STRING_PROGRAM_WIN_CLASS_NAME
[] = "PMProgram";
21 /* Xx will be overwritten with En, ... */
22 CHAR STRING_ACCEL
[] = "ACCEL";
23 CHAR STRING_MENU_Xx
[] = "MENU_Xx";
24 CHAR STRING_NEW_Xx
[] = "DIALOG_NEW_Xx";
25 CHAR STRING_OPEN_Xx
[] = "DIALOG_OPEN_Xx";
26 CHAR STRING_MOVE_Xx
[] = "DIALOG_MOVE_Xx";
27 CHAR STRING_COPY_Xx
[] = "DIALOG_COPY_Xx";
28 CHAR STRING_DELETE_Xx
[] = "DIALOG_DELETE_Xx";
29 CHAR STRING_GROUP_Xx
[] = "DIALOG_GROUP_Xx";
30 CHAR STRING_PROGRAM_Xx
[] = "DIALOG_PROGRAM_Xx";
31 CHAR STRING_SYMBOL_Xx
[] = "DIALOG_SYMBOL_Xx";
32 CHAR STRING_EXECUTE_Xx
[] = "DIALOG_EXECUTE_Xx";
34 static BOOL
STRING_LoadStringOtherLanguage(UINT num
, UINT ids
, LPSTR str
, UINT len
)
36 ids
-= Globals
.wStringTableOffset
;
38 return(LoadString(Globals
.hInstance
, ids
, str
, len
));
41 VOID
STRING_SelectLanguageByName(LPCSTR lang
)
46 for (i
= 0; i
<= MAX_LANGUAGE_NUMBER
; i
++)
47 if (STRING_LoadStringOtherLanguage(i
, IDS_LANGUAGE_ID
, newlang
, sizeof(newlang
)) &&
48 !lstrcmp(lang
, newlang
))
50 STRING_SelectLanguageByNumber(i
);
55 for (i
= 0; i
<= MAX_LANGUAGE_NUMBER
; i
++)
56 if (STRING_LoadStringOtherLanguage(i
, IDS_LANGUAGE_ID
, newlang
, sizeof(newlang
)))
58 STRING_SelectLanguageByNumber(i
);
62 MessageBox(Globals
.hMainWnd
, "No language found", "FATAL ERROR", MB_OK
);
66 VOID
STRING_SelectLanguageByNumber(UINT num
)
70 CHAR caption
[MAX_STRING_LEN
];
71 CHAR item
[MAX_STRING_LEN
];
75 /* Select string table */
76 Globals
.wStringTableOffset
= num
* 0x100;
79 LoadString(Globals
.hInstance
, IDS_LANGUAGE_ID
, lang
, sizeof(lang
));
80 Globals
.lpszLanguage
= lang
;
82 /* Set frame caption */
83 LoadString(Globals
.hInstance
, IDS_PROGRAM_MANAGER
, caption
, sizeof(caption
));
84 SetWindowText(Globals
.hMainWnd
, caption
);
86 /* Change Resource names */
87 lstrcpyn(STRING_MENU_Xx
+ sizeof(STRING_MENU_Xx
) - 3, lang
, 3);
88 lstrcpyn(STRING_NEW_Xx
+ sizeof(STRING_NEW_Xx
) - 3, lang
, 3);
89 lstrcpyn(STRING_OPEN_Xx
+ sizeof(STRING_OPEN_Xx
) - 3, lang
, 3);
90 lstrcpyn(STRING_MOVE_Xx
+ sizeof(STRING_MOVE_Xx
) - 3, lang
, 3);
91 lstrcpyn(STRING_COPY_Xx
+ sizeof(STRING_COPY_Xx
) - 3, lang
, 3);
92 lstrcpyn(STRING_DELETE_Xx
+ sizeof(STRING_DELETE_Xx
) - 3, lang
, 3);
93 lstrcpyn(STRING_GROUP_Xx
+ sizeof(STRING_GROUP_Xx
) - 3, lang
, 3);
94 lstrcpyn(STRING_PROGRAM_Xx
+ sizeof(STRING_PROGRAM_Xx
) - 3, lang
, 3);
95 lstrcpyn(STRING_SYMBOL_Xx
+ sizeof(STRING_SYMBOL_Xx
) - 3, lang
, 3);
96 lstrcpyn(STRING_EXECUTE_Xx
+ sizeof(STRING_EXECUTE_Xx
) - 3, lang
, 3);
99 hMainMenu
= LoadMenu(Globals
.hInstance
, STRING_MENU_Xx
);
100 Globals
.hFileMenu
= GetSubMenu(hMainMenu
, 0);
101 Globals
.hOptionMenu
= GetSubMenu(hMainMenu
, 1);
102 Globals
.hWindowsMenu
= GetSubMenu(hMainMenu
, 2);
103 Globals
.hLanguageMenu
= GetSubMenu(hMainMenu
, 3);
105 /* Remove dummy item */
106 RemoveMenu(Globals
.hLanguageMenu
, 0, MF_BYPOSITION
);
107 /* Add language items */
108 for (i
= 0; i
<= MAX_LANGUAGE_NUMBER
; i
++)
109 if (STRING_LoadStringOtherLanguage(i
, IDS_LANGUAGE_MENU_ITEM
, item
, sizeof(item
)))
110 AppendMenu(Globals
.hLanguageMenu
, MF_STRING
| MF_BYCOMMAND
,
111 PM_FIRST_LANGUAGE
+ i
, item
);
114 SendMessage(Globals
.hMDIWnd
, WM_MDISETMENU
,
116 (LPARAM
) Globals
.hWindowsMenu
);
117 else SetMenu(Globals
.hMainWnd
, hMainMenu
);
119 /* Destroy old menu */
120 if (Globals
.hMainMenu
) DestroyMenu(Globals
.hMainMenu
);
121 Globals
.hMainMenu
= hMainMenu
;
124 /* Update system menus */
125 for (i
= 0; Languages
[i
].name
&& lstrcmp(lang
, Languages
[i
].name
);) i
++;
126 if (Languages
[i
].name
) Options
.language
= i
;
128 GetSystemMenu(Globals
.hMainWnd
, TRUE
);
129 for (hGroup
= GROUP_FirstGroup(); hGroup
;
130 hGroup
= GROUP_NextGroup(hGroup
))
132 GROUP
*group
= LocalLock(hGroup
);
133 GetSystemMenu(group
->hWnd
, TRUE
);
138 /* Local Variables: */
139 /* c-file-style: "GNU" */