ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/SheepShaver/src/Windows/user_strings_windows.cpp
Revision: 1.6
Committed: 2008-01-01T09:47:39Z (16 years, 11 months ago) by gbeauche
Branch: MAIN
CVS Tags: HEAD
Changes since 1.5: +1 -1 lines
Error occurred while calculating annotation data.
Log Message:
Happy New Year!

File Contents

# Content
1 /*
2 * user_strings_windows.cpp - Localizable strings, Windows specific strings
3 *
4 * SheepShaver (C) 1997-2008 Christian Bauer and Marc Hellwig
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21 #include "sysdeps.h"
22 #include "user_strings.h"
23
24
25 // Platform-specific string definitions
26 user_string_def platform_strings[] = {
27 // Common strings that have a platform-specific variant
28 {STR_EXTFS_VOLUME_NAME, "My Computer"},
29
30 // Purely platform-specific strings
31 {STR_LOW_MEM_MMAP_ERR, "Cannot map Low Memory Globals: %s."},
32 {STR_KD_SHMGET_ERR, "Cannot create SHM segment for Kernel Data: %s."},
33 {STR_KD_SHMAT_ERR, "Cannot map first Kernel Data area: %s."},
34 {STR_KD2_SHMAT_ERR, "Cannot map second Kernel Data area: %s."},
35 {STR_ROM_MMAP_ERR, "Cannot map ROM: %s."},
36 {STR_RAM_MMAP_ERR, "Cannot map RAM: %s."},
37 {STR_DR_CACHE_MMAP_ERR, "Cannot map DR Cache: %s."},
38 {STR_DR_EMULATOR_MMAP_ERR, "Cannot map DR Emulator: %s."},
39 {STR_SHEEP_MEM_MMAP_ERR, "Cannot map SheepShaver Data area: %s."},
40 {STR_NO_XVISUAL_ERR, "Cannot obtain appropriate X visual."},
41 {STR_SLIRP_NO_DNS_FOUND_WARN, "Cannot get DNS address. Ethernet will not be available."},
42 {STR_NO_AUDIO_WARN, "No audio device found, audio output will be disabled."},
43 {STR_KEYCODE_FILE_WARN, "Cannot open keycode translation file %s (%s)."},
44 {STR_KEYCODE_VENDOR_WARN, "Cannot find vendor '%s' in keycode translation file %s."},
45 {STR_VOSF_INIT_ERR, "Cannot initialize Video on SEGV signals."},
46
47 {STR_OPEN_WINDOW_ERR, "Cannot open Mac window."},
48 {STR_WINDOW_TITLE_GRABBED, "SheepShaver (mouse grabbed, press Ctrl-F5 to release)"},
49 {STR_NO_WIN32_NT_4, "SheepShaver does not run on Windows NT versions less than 4.0"},
50
51 {STR_PREFS_MENU_FILE_GTK, "/_File"},
52 {STR_PREFS_ITEM_START_GTK, "/File/_Start SheepShaver"},
53 {STR_PREFS_ITEM_ZAP_PRAM_GTK, "/File/_Zap PRAM File"},
54 {STR_PREFS_ITEM_SEPL_GTK, "/File/sepl"},
55 {STR_PREFS_ITEM_QUIT_GTK, "/File/_Quit SheepShaver"},
56 {STR_HELP_MENU_GTK, "/_Help"},
57 {STR_HELP_ITEM_ABOUT_GTK, "/Help/_About SheepShaver"},
58
59 {STR_FILE_CTRL, "File"},
60 {STR_BROWSE_TITLE, "Browse file"},
61 {STR_BROWSE_CTRL, "Browse..."},
62 {STR_SERIAL_PANE_TITLE, "Serial"},
63 {STR_NETWORK_PANE_TITLE, "Network"},
64 {STR_INPUT_PANE_TITLE, "Keyboard/Mouse"},
65 {STR_KEYCODES_CTRL, "Use Raw Keycodes"},
66 {STR_KEYCODE_FILE_CTRL, "Keycode Translation File"},
67 {STR_MOUSEWHEELMODE_CTRL, "Mouse Wheel Function"},
68 {STR_MOUSEWHEELMODE_PAGE_LAB, "Page Up/Down"},
69 {STR_MOUSEWHEELMODE_CURSOR_LAB, "Cursor Up/Down"},
70 {STR_MOUSEWHEELLINES_CTRL, "Lines To Scroll"},
71 {STR_POLLMEDIA_CTRL, "Try to automatically detect new removable media (enable polling)"},
72 {STR_EXTFS_ENABLE_CTRL, "Enable \"My Computer\" icon on your Mac desktop (external file system)"},
73 {STR_EXTFS_DRIVES_CTRL, "Mount drives"},
74 {STR_ETHER_FTP_PORT_LIST_CTRL, "FTP ports"},
75 {STR_ETHER_TCP_PORT_LIST_CTRL, "Server ports"},
76
77 {-1, NULL} // End marker
78 };
79
80
81 /*
82 * Search for main volume name
83 */
84
85 static const char *get_volume_name(void)
86 {
87 HKEY hHelpKey;
88 DWORD key_type, cbData;
89
90 static char volume[256];
91 memset(volume, 0, sizeof(volume));
92
93 // Try Windows 2000 key first
94 if (ERROR_SUCCESS == RegOpenKey(
95 HKEY_CURRENT_USER,
96 "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\CLSID\\{20D04FE0-3AEA-1069-A2D8-08002B30309D}",
97 &hHelpKey))
98 {
99 cbData = sizeof(volume);
100 RegQueryValueEx( hHelpKey, 0, NULL, &key_type, (unsigned char *)volume, &cbData );
101 RegCloseKey(hHelpKey);
102 }
103
104 if (volume[0] == 0 &&
105 ERROR_SUCCESS == RegOpenKey(
106 HKEY_CURRENT_USER,
107 "Software\\Classes\\CLSID\\{20D04FE0-3AEA-1069-A2D8-08002B30309D}",
108 &hHelpKey))
109 {
110 cbData = sizeof(volume);
111 RegQueryValueEx( hHelpKey, 0, NULL, &key_type, (unsigned char *)volume, &cbData );
112 RegCloseKey(hHelpKey);
113 }
114
115 if (volume[0] == 0 &&
116 ERROR_SUCCESS == RegOpenKey(
117 HKEY_CLASSES_ROOT,
118 "CLSID\\{20D04FE0-3AEA-1069-A2D8-08002B30309D}",
119 &hHelpKey))
120 {
121 cbData = sizeof(volume);
122 RegQueryValueEx( hHelpKey, 0, NULL, &key_type, (unsigned char *)volume, &cbData );
123 RegCloseKey(hHelpKey);
124 }
125
126 // Fix the error that some "tweak" apps do.
127 if (stricmp(volume, "%USERNAME% on %COMPUTER%") == 0)
128 volume[0] = '\0';
129
130 // No volume name found, default to "My Computer"
131 if (volume[0] == 0)
132 strcpy(volume, "My Computer");
133
134 return volume;
135 }
136
137
138 /*
139 * Fetch pointer to string, given the string number
140 */
141
142 const char *GetString(int num)
143 {
144 // First, search for platform-specific variable string
145 switch (num) {
146 case STR_EXTFS_VOLUME_NAME:
147 return get_volume_name();
148 }
149
150 // Next, search for platform-specific string
151 int i = 0;
152 while (platform_strings[i].num >= 0) {
153 if (platform_strings[i].num == num)
154 return platform_strings[i].str;
155 i++;
156 }
157
158 // Not found, search for common string
159 i = 0;
160 while (common_strings[i].num >= 0) {
161 if (common_strings[i].num == num)
162 return common_strings[i].str;
163 i++;
164 }
165 return NULL;
166 }