Commit d2664e0f authored by Alexander Nicolaysen Sørnes's avatar Alexander Nicolaysen Sørnes Committed by Alexandre Julliard

regedit: Set the unicode flag for the listview.

parent d0991c92
......@@ -165,7 +165,7 @@ static INT_PTR CALLBACK bin_modify_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wPara
if (params->lpszValueName)
SetDlgItemTextW(hwndDlg, IDC_VALUE_NAME, params->lpszValueName);
else
SetDlgItemTextW(hwndDlg, IDC_VALUE_NAME, g_pszDefaultValueNameW);
SetDlgItemTextW(hwndDlg, IDC_VALUE_NAME, g_pszDefaultValueName);
SendDlgItemMessage(hwndDlg, IDC_VALUE_DATA, HEM_SETDATA, (WPARAM)params->cbData, (LPARAM)params->pData);
return TRUE;
case WM_COMMAND:
......@@ -299,7 +299,7 @@ BOOL ModifyValue(HWND hwnd, HKEY hKeyRoot, LPCWSTR keyPath, LPCWSTR valueName)
return FALSE;
}
editValueName = valueName ? valueName : g_pszDefaultValueNameW;
editValueName = valueName ? valueName : g_pszDefaultValueName;
if(!(stringValueData = read_value(hwnd, hKey, valueName, &type, &len))) goto done;
if ( (type == REG_SZ) || (type == REG_EXPAND_SZ) ) {
......@@ -428,7 +428,7 @@ BOOL DeleteValue(HWND hwnd, HKEY hKeyRoot, LPCWSTR keyPath, LPCWSTR valueName, B
BOOL result = FALSE;
LONG lRet;
HKEY hKey;
LPCWSTR visibleValueName = valueName ? valueName : g_pszDefaultValueNameW;
LPCWSTR visibleValueName = valueName ? valueName : g_pszDefaultValueName;
WCHAR empty = 0;
lRet = RegOpenKeyExW(hKeyRoot, keyPath, 0, KEY_READ | KEY_SET_VALUE, &hKey);
......
......@@ -2,6 +2,7 @@
* Regedit listviews
*
* Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
* Copyright (C) 2008 Alexander N. Sørnes <alex@thehandofagony.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -49,8 +50,7 @@ static BOOL g_invertSort = FALSE;
static LPWSTR g_valueName;
static LPWSTR g_currentPath;
static HKEY g_currentRootKey;
static WCHAR g_szValueNotSetW[64];
static TCHAR g_szValueNotSet[64];
static WCHAR 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 };
......@@ -192,7 +192,7 @@ static void AddEntryToList(HWND hwndLV, LPWSTR Name, DWORD dwValType,
if (ValBuf) {
ListView_SetItemTextW(hwndLV, index, 2, ValBuf);
} else {
ListView_SetItemTextW(hwndLV, index, 2, g_szValueNotSetW);
ListView_SetItemTextW(hwndLV, index, 2, g_szValueNotSet);
}
break;
case REG_DWORD: {
......@@ -280,10 +280,10 @@ static BOOL CreateListColumns(HWND hWndListView)
/* OnGetDispInfo - processes the LVN_GETDISPINFO notification message. */
static void OnGetDispInfo(NMLVDISPINFO* plvdi)
static void OnGetDispInfo(NMLVDISPINFOW* plvdi)
{
static TCHAR buffer[200];
static TCHAR reg_szT[] = {'R','E','G','_','S','Z',0},
static WCHAR buffer[200];
static WCHAR reg_szT[] = {'R','E','G','_','S','Z',0},
reg_expand_szT[] = {'R','E','G','_','E','X','P','A','N','D','_','S','Z',0},
reg_binaryT[] = {'R','E','G','_','B','I','N','A','R','Y',0},
reg_dwordT[] = {'R','E','G','_','D','W','O','R','D',0},
......@@ -300,7 +300,7 @@ static void OnGetDispInfo(NMLVDISPINFO* plvdi)
switch (plvdi->item.iSubItem) {
case 0:
plvdi->item.pszText = (LPSTR)g_pszDefaultValueName;
plvdi->item.pszText = g_pszDefaultValueName;
break;
case 1:
switch (((LINE_INFO*)plvdi->item.lParam)->dwValType) {
......@@ -333,9 +333,9 @@ static void OnGetDispInfo(NMLVDISPINFO* plvdi)
break;
default:
{
TCHAR szUnknownFmt[64];
LoadString(hInst, IDS_REGISTRY_UNKNOWN_TYPE, szUnknownFmt, COUNT_OF(szUnknownFmt));
wsprintf(buffer, szUnknownFmt, plvdi->item.lParam);
WCHAR szUnknownFmt[64];
LoadStringW(hInst, IDS_REGISTRY_UNKNOWN_TYPE, szUnknownFmt, COUNT_OF(szUnknownFmt));
wsprintfW(buffer, szUnknownFmt, plvdi->item.lParam);
plvdi->item.pszText = buffer;
break;
}
......@@ -403,12 +403,12 @@ static LRESULT CALLBACK ListWndProc(HWND hWnd, UINT message, WPARAM wParam, LPAR
case WM_NOTIFY_REFLECT:
switch (((LPNMHDR)lParam)->code) {
case LVN_BEGINLABELEDIT:
if (!((NMLVDISPINFO *)lParam)->item.iItem)
case LVN_BEGINLABELEDITW:
if (!((NMLVDISPINFOW *)lParam)->item.iItem)
return 1;
return 0;
case LVN_GETDISPINFO:
OnGetDispInfo((NMLVDISPINFO*)lParam);
case LVN_GETDISPINFOW:
OnGetDispInfo((NMLVDISPINFOW*)lParam);
break;
case LVN_COLUMNCLICK:
if (g_columnToSort == ((LPNMLISTVIEW)lParam)->iSubItem)
......@@ -418,20 +418,18 @@ static LRESULT CALLBACK ListWndProc(HWND hWnd, UINT message, WPARAM wParam, LPAR
g_invertSort = FALSE;
}
SendMessage(hWnd, LVM_SORTITEMS, (WPARAM)hWnd, (LPARAM)CompareFunc);
SendMessageW(hWnd, LVM_SORTITEMS, (WPARAM)hWnd, (LPARAM)CompareFunc);
break;
case LVN_ENDLABELEDIT: {
LPNMLVDISPINFO dispInfo = (LPNMLVDISPINFO)lParam;
case LVN_ENDLABELEDITW: {
LPNMLVDISPINFOW dispInfo = (LPNMLVDISPINFOW)lParam;
LPWSTR oldName = GetItemTextW(hWnd, dispInfo->item.iItem);
WCHAR* newName = GetWideString(dispInfo->item.pszText);
LONG ret;
if (!oldName) return -1; /* cannot rename a default value */
ret = RenameValue(hWnd, g_currentRootKey, g_currentPath, oldName, newName);
ret = RenameValue(hWnd, g_currentRootKey, g_currentPath, oldName, dispInfo->item.pszText);
if (ret)
{
RefreshListView(hWnd, g_currentRootKey, g_currentPath, newName);
RefreshListView(hWnd, g_currentRootKey, g_currentPath, dispInfo->item.pszText);
}
HeapFree(GetProcessHeap(), 0, newName);
HeapFree(GetProcessHeap(), 0, oldName);
return 0;
}
......@@ -496,8 +494,7 @@ HWND CreateListView(HWND hwndParent, UINT id)
WCHAR ListView[] = {'L','i','s','t',' ','V','i','e','w',0};
/* prepare strings */
LoadString(hInst, IDS_REGISTRY_VALUE_NOT_SET, g_szValueNotSet, COUNT_OF(g_szValueNotSet));
LoadStringW(hInst, IDS_REGISTRY_VALUE_NOT_SET, g_szValueNotSetW, COUNT_OF(g_szValueNotSetW));
LoadStringW(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);
......@@ -506,6 +503,7 @@ HWND CreateListView(HWND hwndParent, UINT id)
0, 0, rcClient.right, rcClient.bottom,
hwndParent, (HMENU)ULongToHandle(id), hInst, NULL);
if (!hwndLV) return NULL;
SendMessageW(hwndLV, LVM_SETUNICODEFORMAT, TRUE, 0);
SendMessageW(hwndLV, LVM_SETEXTENDEDLISTVIEWSTYLE, 0, LVS_EX_FULLROWSELECT);
/* Initialize the image list */
......
......@@ -29,8 +29,7 @@
#define REGEDIT_DECLARE_FUNCTIONS
#include "main.h"
TCHAR g_pszDefaultValueName[64];
WCHAR g_pszDefaultValueNameW[64];
WCHAR g_pszDefaultValueName[64];
BOOL ProcessCmdLine(LPSTR lpCmdLine);
......@@ -183,8 +182,7 @@ int APIENTRY WinMain(HINSTANCE hInstance,
/* Initialize global strings */
LoadString(hInstance, IDS_APP_TITLE, szTitle, COUNT_OF(szTitle));
LoadString(hInstance, IDS_REGISTRY_DEFAULT_VALUE, g_pszDefaultValueName, COUNT_OF(g_pszDefaultValueName));
LoadStringW(hInstance, IDS_REGISTRY_DEFAULT_VALUE, g_pszDefaultValueNameW, COUNT_OF(g_pszDefaultValueNameW));
LoadStringW(hInstance, IDS_REGISTRY_DEFAULT_VALUE, g_pszDefaultValueName, COUNT_OF(g_pszDefaultValueName));
/* Store instance handle in our global variable */
hInst = hInstance;
......
......@@ -90,8 +90,7 @@ extern enum OPTION_FLAGS Options;
extern TCHAR szTitle[];
extern const TCHAR szFrameClass[];
extern const TCHAR szChildClass[];
extern TCHAR g_pszDefaultValueName[];
extern WCHAR g_pszDefaultValueNameW[];
extern WCHAR g_pszDefaultValueName[];
/* Registry class names and their indexes */
extern const WCHAR* reg_class_namesW[];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment