regedit: Put language-dependent strings in resources.

This commit is contained in:
Mikołaj Zalewski 2006-08-23 14:11:39 +02:00 committed by Alexandre Julliard
parent 798a54f938
commit 1ee7095e41
9 changed files with 74 additions and 16 deletions

View File

@ -363,6 +363,22 @@ BEGIN
IDS_NOTFOUND "Search string '%s' not found"
END
STRINGTABLE DISCARDABLE
BEGIN
IDS_FILEDIALOG_IMPORT_TITLE "Import Registry File"
IDS_FILEDIALOG_EXPORT_TITLE "Export Registry File"
IDS_FILEDIALOG_FILTER "Registration Files\0*.reg\0Win9x/NT4 Registration Files (REGEDIT4)\0*.reg\0All Files (*.*)\0*.*\0\0"
END
STRINGTABLE DISCARDABLE
BEGIN
IDS_REGISTRY_ROOT_NAME "My Computer"
IDS_REGISTRY_DEFAULT_VALUE "(Default)"
IDS_REGISTRY_VALUE_NOT_SET "(value not set)"
IDS_REGISTRY_VALUE_CANT_DISPLAY "(cannot display value)"
IDS_REGISTRY_UNKNOWN_TYPE "(unknown %d)"
END
/*****************************************************************/

View File

@ -282,6 +282,22 @@ BEGIN
IDS_NOTFOUND "Nie udało się wyszukać cišgu '%s'"
END
STRINGTABLE DISCARDABLE
BEGIN
IDS_FILEDIALOG_IMPORT_TITLE "Importuj plik rejestrów"
IDS_FILEDIALOG_EXPORT_TITLE "Eksportuj plik rejestrów"
IDS_FILEDIALOG_FILTER "Pliki rejestrów\0*.reg\0Pliki rejestrów Win9x/NT4 (REGEDIT4)\0*.reg\0Wszystkie pliki (*.*)\0*.*\0\0"
END
STRINGTABLE DISCARDABLE
BEGIN
IDS_REGISTRY_ROOT_NAME "Mój komputer"
IDS_REGISTRY_DEFAULT_VALUE "(Domyœlna)"
IDS_REGISTRY_VALUE_NOT_SET "(wartoϾ nie ustalona)"
IDS_REGISTRY_VALUE_CANT_DISPLAY "(nie mogê wyœwietliæ wartoœci)"
IDS_REGISTRY_UNKNOWN_TYPE "(nieznany: %d)"
END
/*****************************************************************/

View File

@ -28,5 +28,7 @@
void ShowAboutBox(HWND hWnd)
{
ShellAbout(hWnd, _T("Registry Editor"), _T(""), LoadIcon(hInst, MAKEINTRESOURCE(IDI_REGEDIT)));
TCHAR title[64];
LoadString(hInst, IDS_APP_TITLE, title, COUNT_OF(title));
ShellAbout(hWnd, title, _T(""), LoadIcon(hInst, MAKEINTRESOURCE(IDI_REGEDIT)));
}

View File

@ -211,7 +211,7 @@ LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
case WM_CREATE:
g_pChildWnd = pChildWnd = HeapAlloc(GetProcessHeap(), 0, sizeof(ChildWnd));
if (!pChildWnd) return 0;
_tcsncpy(pChildWnd->szPath, _T("My Computer"), MAX_PATH);
LoadString(hInst, IDS_REGISTRY_ROOT_NAME, pChildWnd->szPath, MAX_PATH);
pChildWnd->nSplitPos = 250;
pChildWnd->hWnd = hWnd;
pChildWnd->hTreeWnd = CreateTreeView(hWnd, pChildWnd->szPath, TREE_WINDOW);

View File

@ -260,15 +260,18 @@ static UINT_PTR CALLBACK ImportRegistryFile_OFNHookProc(HWND hdlg, UINT uiMsg, W
TCHAR FileNameBuffer[_MAX_PATH];
TCHAR FileTitleBuffer[_MAX_PATH];
TCHAR FilterBuffer[_MAX_PATH];
static BOOL InitOpenFileName(HWND hWnd, OPENFILENAME* pofn)
static BOOL InitOpenFileName(HWND hWnd, OPENFILENAME *pofn)
{
memset(pofn, 0, sizeof(OPENFILENAME));
pofn->lStructSize = sizeof(OPENFILENAME);
pofn->hwndOwner = hWnd;
pofn->hInstance = hInst;
pofn->lpstrFilter = _T("Registration Files\0*.reg\0Win9x/NT4 Registration Files (REGEDIT4)\0*.reg\0All Files (*.*)\0*.*\0\0");
if (FilterBuffer[0] == 0)
LoadString(hInst, IDS_FILEDIALOG_FILTER, FilterBuffer, _MAX_PATH);
pofn->lpstrFilter = FilterBuffer;
pofn->nFilterIndex = 1;
pofn->lpstrFile = FileNameBuffer;
pofn->nMaxFile = _MAX_PATH;
@ -292,9 +295,11 @@ static BOOL InitOpenFileName(HWND hWnd, OPENFILENAME* pofn)
static BOOL ImportRegistryFile(HWND hWnd)
{
OPENFILENAME ofn;
TCHAR title[128];
InitOpenFileName(hWnd, &ofn);
ofn.lpstrTitle = _T("Import Registry File");
LoadString(hInst, IDS_FILEDIALOG_IMPORT_TITLE, title, COUNT_OF(title));
ofn.lpstrTitle = title;
/* ofn.lCustData = ;*/
if (GetOpenFileName(&ofn)) {
if (!import_registry_file(ofn.lpstrFile)) {
@ -330,10 +335,12 @@ static BOOL ExportRegistryFile(HWND hWnd)
{
OPENFILENAME ofn;
TCHAR ExportKeyPath[_MAX_PATH];
TCHAR title[128];
ExportKeyPath[0] = _T('\0');
InitOpenFileName(hWnd, &ofn);
ofn.lpstrTitle = _T("Export Registry File");
LoadString(hInst, IDS_FILEDIALOG_EXPORT_TITLE, title, COUNT_OF(title));
ofn.lpstrTitle = title;
/* ofn.lCustData = ;*/
ofn.Flags = OFN_ENABLETEMPLATE + OFN_EXPLORER;
ofn.lpfnHook = ImportRegistryFile_OFNHookProc;

View File

@ -52,6 +52,7 @@ static BOOL g_invertSort = FALSE;
static LPTSTR g_valueName;
static LPTSTR g_currentPath;
static HKEY g_currentRootKey;
static TCHAR g_szValueNotSet[64];
#define MAX_LIST_COLUMNS (IDS_LIST_COLUMN_LAST - IDS_LIST_COLUMN_FIRST + 1)
static int default_column_widths[MAX_LIST_COLUMNS] = { 200, 175, 400 };
@ -158,15 +159,13 @@ static void AddEntryToList(HWND hwndLV, LPTSTR Name, DWORD dwValType,
index = ListView_InsertItem(hwndLV, &item);
if (index != -1) {
/* LPTSTR pszText = NULL; */
static TCHAR pszText[] = {'(','c','a','n','n','o','t',' ','d','i','s','p','l','a','y',' ','v','a','l','u','e',')',0};
switch (dwValType) {
case REG_SZ:
case REG_EXPAND_SZ:
if (ValBuf) {
ListView_SetItemText(hwndLV, index, 2, ValBuf);
} else {
static TCHAR textT[] = {'(','n','o','t',' ','s','e','t',')',0};
ListView_SetItemText(hwndLV, index, 2, textT);
ListView_SetItemText(hwndLV, index, 2, g_szValueNotSet);
}
break;
case REG_DWORD: {
@ -192,9 +191,13 @@ static void AddEntryToList(HWND hwndLV, LPTSTR Name, DWORD dwValType,
ListView_SetItemText(hwndLV, index, 2, ValBuf);
break;
default:
{
/* lpsRes = convertHexToHexCSV(lpbData, dwLen); */
ListView_SetItemText(hwndLV, index, 2, pszText);
TCHAR szText[128];
LoadString(hInst, IDS_REGISTRY_VALUE_CANT_DISPLAY, szText, COUNT_OF(szText));
ListView_SetItemText(hwndLV, index, 2, szText);
break;
}
}
}
}
@ -263,9 +266,7 @@ static void OnGetDispInfo(NMLVDISPINFO* plvdi)
reg_linkT[] = {'R','E','G','_','L','I','N','K',0},
reg_resource_listT[] = {'R','E','G','_','R','E','S','O','U','R','C','E','_','L','I','S','T',0},
reg_noneT[] = {'R','E','G','_','N','O','N','E',0},
not_setT[] = {'(','v','a','l','u','e',' ','n','o','t',' ','s','e','t',')',0},
emptyT[] = {0};
static const TCHAR unknownT[] = {'u','n','k','n','o','w','n','(','%','d',')',0};
plvdi->item.pszText = NULL;
plvdi->item.cchTextMax = 0;
@ -304,13 +305,17 @@ static void OnGetDispInfo(NMLVDISPINFO* plvdi)
plvdi->item.pszText = reg_noneT;
break;
default:
wsprintf(buffer, unknownT, plvdi->item.lParam);
{
TCHAR szUnknownFmt[64];
LoadString(hInst, IDS_REGISTRY_UNKNOWN_TYPE, szUnknownFmt, COUNT_OF(szUnknownFmt));
wsprintf(buffer, szUnknownFmt, plvdi->item.lParam);
plvdi->item.pszText = buffer;
break;
}
}
break;
case 2:
plvdi->item.pszText = not_setT;
plvdi->item.pszText = g_szValueNotSet;
break;
case 3:
plvdi->item.pszText = emptyT;
@ -459,6 +464,9 @@ HWND CreateListView(HWND hwndParent, int id)
RECT rcClient;
HWND hwndLV;
/* prepare strings */
LoadString(hInst, IDS_REGISTRY_VALUE_NOT_SET, g_szValueNotSet, COUNT_OF(g_szValueNotSet));
/* Get the dimensions of the parent window's client area, and create the list view control. */
GetClientRect(hwndParent, &rcClient);
hwndLV = CreateWindowEx(WS_EX_CLIENTEDGE, WC_LISTVIEW, _T("List View"),

View File

@ -29,7 +29,7 @@
#define REGEDIT_DECLARE_FUNCTIONS
#include "main.h"
LPCSTR g_pszDefaultValueName = _T("(Default)");
TCHAR g_pszDefaultValueName[64];
BOOL ProcessCmdLine(LPSTR lpCmdLine);
@ -172,6 +172,7 @@ int APIENTRY WinMain(HINSTANCE hInstance,
LoadString(hInstance, IDS_APP_TITLE, szTitle, COUNT_OF(szTitle));
LoadString(hInstance, IDC_REGEDIT_FRAME, szFrameClass, COUNT_OF(szFrameClass));
LoadString(hInstance, IDC_REGEDIT, szChildClass, COUNT_OF(szChildClass));
LoadString(hInstance, IDS_REGISTRY_DEFAULT_VALUE, g_pszDefaultValueName, COUNT_OF(g_pszDefaultValueName));
/* Store instance handle in our global variable */
hInst = hInstance;

View File

@ -90,7 +90,7 @@ extern enum OPTION_FLAGS Options;
extern TCHAR szTitle[];
extern TCHAR szFrameClass[];
extern TCHAR szChildClass[];
extern LPCTSTR g_pszDefaultValueName;
extern TCHAR g_pszDefaultValueName[];
/* about.c */
extern void ShowAboutBox(HWND hWnd);

View File

@ -47,6 +47,14 @@
#define IDD_FIND 135
#define IDI_BIN 136
#define IDR_POPUP_MENUS 137
#define IDS_FILEDIALOG_IMPORT_TITLE 144
#define IDS_FILEDIALOG_EXPORT_TITLE 145
#define IDS_FILEDIALOG_FILTER 146
#define IDS_REGISTRY_ROOT_NAME 160
#define IDS_REGISTRY_DEFAULT_VALUE 161
#define IDS_REGISTRY_VALUE_NOT_SET 162
#define IDS_REGISTRY_VALUE_CANT_DISPLAY 164
#define IDS_REGISTRY_UNKNOWN_TYPE 165
#define IDC_LICENSE_EDIT 1029
#define ID_REGISTRY_EXIT 32770
#define ID_FAVORITES_ADDTOFAVORITES 32772