Fixed warnings.
[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
61 VOID LANGUAGE_LoadMenus(VOID)
62 {
63   HMENU  hMainMenu;
64
65   /* Set frame caption */
66   LANGUAGE_UpdateWindowCaption();
67
68   /* Change Resource names */
69   /*lstrcpyn(STRING_MENU_Xx      + sizeof(STRING_MENU_Xx)      - 3, lang, 3);*/
70   /*lstrcpyn(STRING_PAGESETUP_Xx + sizeof(STRING_PAGESETUP_Xx) - 3, lang, 3);*/
71
72   /* Create menu */
73   hMainMenu = LoadMenu(Globals.hInstance, MAKEINTRESOURCE(MAIN_MENU));
74     Globals.hFileMenu     = GetSubMenu(hMainMenu, 0);
75     Globals.hEditMenu     = GetSubMenu(hMainMenu, 1);
76     Globals.hSearchMenu   = GetSubMenu(hMainMenu, 2);
77     Globals.hLanguageMenu = GetSubMenu(hMainMenu, 3);
78     Globals.hHelpMenu     = GetSubMenu(hMainMenu, 4);
79
80   SetMenu(Globals.hMainWnd, hMainMenu);
81
82   /* Destroy old menu */
83   if (Globals.hMainMenu) DestroyMenu(Globals.hMainMenu);
84   Globals.hMainMenu = hMainMenu;
85 }
86
87 /*VOID LANGUAGE_DefaultHandle(WPARAM wParam)
88 {
89   if ((wParam >=NP_FIRST_LANGUAGE) && (wParam<=NP_LAST_LANGUAGE))
90           LANGUAGE_SelectByNumber(wParam - NP_FIRST_LANGUAGE);
91      else printf("Unimplemented menu command %i\n", wParam);
92 }
93 */