language.c 4 KB
Newer Older
Alexandre Julliard's avatar
Alexandre Julliard committed
1 2 3 4 5
/*
 * Clock
 *
 * Copyright 1998 Marcel Baur <mbaur@g26.ethz.ch>
 * Copyright 1998 Karl Backstrm <karl_b@geocities.com>
6 7 8 9 10 11 12 13 14 15 16 17 18 19
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
Alexandre Julliard's avatar
Alexandre Julliard committed
20 21 22 23 24 25
 */

#include <stdio.h>
#include "windows.h"
#include "main.h"
#include "language.h"
Alexandre Julliard's avatar
Alexandre Julliard committed
26
#include "winnls.h"
Alexandre Julliard's avatar
Alexandre Julliard committed
27 28 29

CHAR STRING_MENU_Xx[]      = "MENU_Xx";

Alexandre Julliard's avatar
Alexandre Julliard committed
30 31 32
VOID LANGUAGE_UpdateMenuCheckmarks(VOID) {

    if(Globals.bAnalog == TRUE) {
33

Alexandre Julliard's avatar
Alexandre Julliard committed
34
        /* analog clock */
35

36
        CheckMenuItem(Globals.hPropertiesMenu, 0x100, \
Alexandre Julliard's avatar
Alexandre Julliard committed
37
                       MF_BYCOMMAND | MF_CHECKED);
38
        CheckMenuItem(Globals.hPropertiesMenu, 0x101, \
Alexandre Julliard's avatar
Alexandre Julliard committed
39
                       MF_BYCOMMAND | MF_UNCHECKED);
40
        EnableMenuItem(Globals.hPropertiesMenu, 0x103, \
Alexandre Julliard's avatar
Alexandre Julliard committed
41 42
                       MF_BYCOMMAND | MF_GRAYED);
    }
43
        else
Alexandre Julliard's avatar
Alexandre Julliard committed
44
    {
45

Alexandre Julliard's avatar
Alexandre Julliard committed
46
        /* digital clock */
47

48
        CheckMenuItem(Globals.hPropertiesMenu, 0x100, \
Alexandre Julliard's avatar
Alexandre Julliard committed
49
                       MF_BYCOMMAND | MF_UNCHECKED);
50
        CheckMenuItem(Globals.hPropertiesMenu, 0x101, \
Alexandre Julliard's avatar
Alexandre Julliard committed
51
                       MF_BYCOMMAND | MF_CHECKED);
52
        EnableMenuItem(Globals.hPropertiesMenu, 0x103, \
Alexandre Julliard's avatar
Alexandre Julliard committed
53
                       MF_BYCOMMAND);
54

Alexandre Julliard's avatar
Alexandre Julliard committed
55
    }
56

57
    CheckMenuItem(Globals.hPropertiesMenu, 0x105, MF_BYCOMMAND | \
Alexandre Julliard's avatar
Alexandre Julliard committed
58
                 (Globals.bWithoutTitle ? MF_CHECKED : MF_UNCHECKED));
59
    CheckMenuItem(Globals.hSystemMenu, 0x10D, MF_BYCOMMAND | \
Alexandre Julliard's avatar
Alexandre Julliard committed
60
                 (Globals.bAlwaysOnTop ? MF_CHECKED : MF_UNCHECKED));
61
    CheckMenuItem(Globals.hPropertiesMenu, 0x107, MF_BYCOMMAND | \
Alexandre Julliard's avatar
Alexandre Julliard committed
62
                 (Globals.bSeconds ? MF_CHECKED : MF_UNCHECKED));
63
    CheckMenuItem(Globals.hPropertiesMenu, 0x108, MF_BYCOMMAND | \
Alexandre Julliard's avatar
Alexandre Julliard committed
64 65 66 67 68 69 70
                 (Globals.bDate ? MF_CHECKED : MF_UNCHECKED));
}

VOID LANGUAGE_UpdateWindowCaption(VOID) {

  CHAR szCaption[MAX_STRING_LEN];
  CHAR szDate[MAX_STRING_LEN];
71

Alexandre Julliard's avatar
Alexandre Julliard committed
72
  LPSTR date = szDate;
73

Alexandre Julliard's avatar
Alexandre Julliard committed
74 75 76 77 78 79 80 81
  SYSTEMTIME st;
  LPSYSTEMTIME lpst = &st;

  GetLocalTime(&st);
  GetDateFormat(LOCALE_USER_DEFAULT, LOCALE_SLONGDATE, lpst, NULL, date,
                MAX_STRING_LEN);

  /* Set frame caption */
82
  LoadString(Globals.hInstance, 0x10C, szCaption, sizeof(szCaption));
Alexandre Julliard's avatar
Alexandre Julliard committed
83 84 85 86 87 88 89 90
  if (Globals.bDate) {
     lstrcat(szCaption, " - ");
     lstrcat(szCaption, szDate);
  }
  SetWindowText(Globals.hMainWnd, szCaption);

}

91
VOID LANGUAGE_LoadMenus(VOID)
Alexandre Julliard's avatar
Alexandre Julliard committed
92
{
Alexandre Julliard's avatar
Alexandre Julliard committed
93

Alexandre Julliard's avatar
Alexandre Julliard committed
94
  CHAR   szItem[MAX_STRING_LEN];
Alexandre Julliard's avatar
Alexandre Julliard committed
95 96 97 98
  HMENU  hMainMenu;


  /* Create menu */
Alexandre Julliard's avatar
Alexandre Julliard committed
99
  hMainMenu = LoadMenu(Globals.hInstance, MAKEINTRESOURCE(MAIN_MENU));
Alexandre Julliard's avatar
Alexandre Julliard committed
100
    Globals.hPropertiesMenu     = GetSubMenu(hMainMenu, 0);
Alexandre Julliard's avatar
Alexandre Julliard committed
101 102
    Globals.hLanguageMenu       = GetSubMenu(hMainMenu, 1);
    Globals.hInfoMenu           = GetSubMenu(hMainMenu, 2);
Alexandre Julliard's avatar
Alexandre Julliard committed
103 104 105 106 107 108 109

  SetMenu(Globals.hMainWnd, hMainMenu);

  /* Destroy old menu */
  if (Globals.hMainMenu) DestroyMenu(Globals.hMainMenu);
  Globals.hMainMenu = hMainMenu;

Alexandre Julliard's avatar
Alexandre Julliard committed
110
  /* specific for Clock: */
Alexandre Julliard's avatar
Alexandre Julliard committed
111

Alexandre Julliard's avatar
Alexandre Julliard committed
112
  LANGUAGE_UpdateMenuCheckmarks();
113
  LANGUAGE_UpdateWindowCaption();
Alexandre Julliard's avatar
Alexandre Julliard committed
114 115 116 117 118

  Globals.hSystemMenu = GetSystemMenu(Globals.hMainWnd, TRUE);

  /* FIXME: Append a SEPARATOR to Globals.hSystemMenu here */

119
  LoadString(Globals.hInstance, 0x10D, szItem, sizeof(szItem));
Alexandre Julliard's avatar
Alexandre Julliard committed
120
  AppendMenu(Globals.hSystemMenu, MF_STRING | MF_BYCOMMAND, 1000, szItem);
Alexandre Julliard's avatar
Alexandre Julliard committed
121 122
}

123
/*
Alexandre Julliard's avatar
Alexandre Julliard committed
124
VOID LANGUAGE_DefaultHandle(WPARAM wParam)
Alexandre Julliard's avatar
Alexandre Julliard committed
125 126
{
  if ((wParam >=CL_FIRST_LANGUAGE) && (wParam<=CL_LAST_LANGUAGE))
Alexandre Julliard's avatar
Alexandre Julliard committed
127
          LANGUAGE_SelectByNumber(wParam - CL_FIRST_LANGUAGE);
Alexandre Julliard's avatar
Alexandre Julliard committed
128 129
     else printf("Unimplemented menu command %i\n", wParam);
}
130
*/
Alexandre Julliard's avatar
Alexandre Julliard committed
131 132 133 134

/* Local Variables:    */
/* c-file-style: "GNU" */
/* End:                */