Added regedit unit test, a couple minor changes to regedit.
[wine] / programs / notepad / language.c
1 /*
2  *  Notepad
3  *
4  *  Copyright 1997,98 Marcel Baur <mbaur@g26.ethz.ch>
5  *  Copyright 1998 Karl Backstrm <karl_b@geocities.com>
6  *  Copyright 2002 Sylvain Petreolle <spetreolle@yahoo.fr>
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
21  */
22
23 #include <stdio.h>
24 #include "windows.h"
25 #include "main.h"
26 #include "language.h"
27
28 CHAR STRING_MENU_Xx[]      = "MENU_Xx";
29 CHAR STRING_PAGESETUP_Xx[] = "DIALOG_PAGESETUP_Xx";
30
31 void LANGUAGE_UpdateWindowCaption(void) {
32   /* Sets the caption of the main window according to Globals.szFileName:
33       Notepad - (untitled)      if no file is open
34       Notepad - [filename]      if a file is given
35   */
36
37   CHAR szCaption[MAX_STRING_LEN];
38   CHAR szUntitled[MAX_STRING_LEN];
39
40   LoadString(Globals.hInstance, STRING_NOTEPAD, szCaption, sizeof(szCaption));
41
42   if (strlen(Globals.szFileName)>0) {
43       lstrcat(szCaption, " - [");
44       lstrcat(szCaption, Globals.szFileName);
45       lstrcat(szCaption, "]");
46   }
47   else
48   {
49       LoadString(Globals.hInstance, STRING_UNTITLED, szUntitled, sizeof(szUntitled));
50       lstrcat(szCaption, " - ");
51       lstrcat(szCaption, szUntitled);
52   }
53
54   SetWindowText(Globals.hMainWnd, szCaption);
55
56 }
57
58
59
60 static BOOL LANGUAGE_LoadStringOther(UINT num, UINT ids, LPSTR str, UINT len)
61 {
62   BOOL bOk;
63
64   ids -= Globals.wStringTableOffset;
65   ids += num * 0x100;
66
67   bOk = LoadString(Globals.hInstance, ids, str, len);
68
69   return(bOk);
70 }
71
72 VOID LANGUAGE_LoadMenus(VOID)
73 {
74   HMENU  hMainMenu;
75
76   /* Set frame caption */
77   LANGUAGE_UpdateWindowCaption();
78
79   /* Change Resource names */
80 //  lstrcpyn(STRING_MENU_Xx      + sizeof(STRING_MENU_Xx)      - 3, lang, 3);
81 //  lstrcpyn(STRING_PAGESETUP_Xx + sizeof(STRING_PAGESETUP_Xx) - 3, lang, 3);
82
83   /* Create menu */
84   hMainMenu = LoadMenu(Globals.hInstance, MAIN_MENU);
85     Globals.hFileMenu     = GetSubMenu(hMainMenu, 0);
86     Globals.hEditMenu     = GetSubMenu(hMainMenu, 1);
87     Globals.hSearchMenu   = GetSubMenu(hMainMenu, 2);
88     Globals.hLanguageMenu = GetSubMenu(hMainMenu, 3);
89     Globals.hHelpMenu     = GetSubMenu(hMainMenu, 4);
90
91   SetMenu(Globals.hMainWnd, hMainMenu);
92
93   /* Destroy old menu */
94   if (Globals.hMainMenu) DestroyMenu(Globals.hMainMenu);
95   Globals.hMainMenu = hMainMenu;
96 }
97
98 //VOID LANGUAGE_DefaultHandle(WPARAM wParam)
99 //{
100 //  if ((wParam >=NP_FIRST_LANGUAGE) && (wParam<=NP_LAST_LANGUAGE))
101 //          LANGUAGE_SelectByNumber(wParam - NP_FIRST_LANGUAGE);
102 //     else printf("Unimplemented menu command %i\n", wParam);
103 //}