- F2 is now an accelerator for rename

- panel switching via TAB doesn't use IsDialogMessage anymore
- focus is correctly set after main window activation (Alt+TAB etc),
  removed some focus-related bugs
- pressing ENTER or double-clicking a value edits it
- setting a value to an empty string is now allowed
- adding a new value starts rename automatically
- renaming a value doesn't move the cursor
- removed some unnecessary code (NM_RCLICK in ListView etc)
- right-click on tree view displays "New..." menu
- default values are treated like in Windows RegEdit (displayed even
  when they aren't physically present, can't be renamed or deleted)
- Polish translation had some weird characters added before Polish
  letters
This commit is contained in:
Krzysztof Foltman 2004-05-04 02:55:28 +00:00 committed by Alexandre Julliard
parent 088db8b428
commit b2d8cd3fdf
17 changed files with 206 additions and 144 deletions

View File

@ -64,7 +64,7 @@ BEGIN
END
MENUITEM SEPARATOR
MENUITEM "&Delete\tDel", ID_EDIT_DELETE
MENUITEM "&Rename", ID_EDIT_RENAME
MENUITEM "&Rename\tF2", ID_EDIT_RENAME
MENUITEM SEPARATOR
MENUITEM "&Copy Key Name", ID_EDIT_COPYKEYNAME
MENUITEM SEPARATOR

View File

@ -64,7 +64,7 @@ BEGIN
END
MENUITEM SEPARATOR
MENUITEM "&Eliminar\tDel", ID_EDIT_DELETE
MENUITEM "&Renombrar", ID_EDIT_RENAME
MENUITEM "&Renombrar\tF2", ID_EDIT_RENAME
MENUITEM SEPARATOR
MENUITEM "&Copiar valor de la clave", ID_EDIT_COPYKEYNAME
MENUITEM SEPARATOR

View File

@ -65,7 +65,7 @@ BEGIN
END
MENUITEM SEPARATOR
MENUITEM "&Supprimer\tDel", ID_EDIT_DELETE
MENUITEM "Ren&ommer", ID_EDIT_RENAME
MENUITEM "Ren&ommer\tF2", ID_EDIT_RENAME
MENUITEM SEPARATOR
MENUITEM "&Copier le nom de la clé", ID_EDIT_COPYKEYNAME
MENUITEM SEPARATOR

View File

@ -65,7 +65,7 @@ BEGIN
END
MENUITEM SEPARATOR
MENUITEM "&Elimina\tDel", ID_EDIT_DELETE
MENUITEM "&Rinomina", ID_EDIT_RENAME
MENUITEM "&Rinomina\tF2" ID_EDIT_RENAME
MENUITEM SEPARATOR
MENUITEM "&Copia nome chiave", ID_EDIT_COPYKEYNAME
MENUITEM SEPARATOR

View File

@ -64,7 +64,7 @@ BEGIN
END
MENUITEM SEPARATOR
MENUITEM "&Verwijderen\tDel", ID_EDIT_DELETE
MENUITEM "&Naam wijzigen", ID_EDIT_RENAME
MENUITEM "&Naam wijzigen\tF2" ID_EDIT_RENAME
MENUITEM SEPARATOR
MENUITEM "&Sleutelnaam kopiëren", ID_EDIT_COPYKEYNAME
MENUITEM SEPARATOR

View File

@ -28,7 +28,7 @@ IDC_REGEDIT MENU DISCARDABLE
BEGIN
POPUP "&Plik"
BEGIN
MENUITEM "Za&ko<EFBFBD>ńcz", ID_REGISTRY_EXIT
MENUITEM "Za&kończ", ID_REGISTRY_EXIT
END
POPUP "&Help"
BEGIN
@ -43,12 +43,12 @@ BEGIN
MENUITEM "&Importuj rejestr...", ID_REGISTRY_IMPORTREGISTRYFILE
MENUITEM "&Eksportuj rejestr...", ID_REGISTRY_EXPORTREGISTRYFILE
MENUITEM SEPARATOR
MENUITEM "&Pod<EFBFBD>ł<EFBFBD>ącz rejestr sieciowy...",ID_REGISTRY_CONNECTNETWORKREGISTRY, GRAYED
MENUITEM "&Od<EFBFBD>ł<EFBFBD>ącz rejestr sieciowy...", ID_REGISTRY_DISCONNECTNETWORKREGISTRY, GRAYED
MENUITEM "&Podłącz rejestr sieciowy...",ID_REGISTRY_CONNECTNETWORKREGISTRY, GRAYED
MENUITEM "&Odłącz rejestr sieciowy...", ID_REGISTRY_DISCONNECTNETWORKREGISTRY, GRAYED
MENUITEM SEPARATOR
MENUITEM "&Drukuj\tCtrl+P", ID_REGISTRY_PRINT, GRAYED
MENUITEM SEPARATOR
MENUITEM "Za&ko<EFBFBD>ńcz", ID_REGISTRY_EXIT
MENUITEM "Za&kończ", ID_REGISTRY_EXIT
END
POPUP "&Edycja"
BEGIN
@ -63,13 +63,13 @@ BEGIN
MENUITEM "&Dana liczbowa (DWORD)",ID_EDIT_NEW_DWORDVALUE
END
MENUITEM SEPARATOR
MENUITEM "U&su<EFBFBD>ń\tDel", ID_EDIT_DELETE
MENUITEM "Z&mie<EFBFBD>ń nazw<EFBFBD>ę", ID_EDIT_RENAME
MENUITEM "U&suń\tDel", ID_EDIT_DELETE
MENUITEM "Z&mień nazwę\tF2", ID_EDIT_RENAME
MENUITEM SEPARATOR
MENUITEM "&Kopiuj nazw<EFBFBD>ę klucza", ID_EDIT_COPYKEYNAME
MENUITEM "&Kopiuj nazwę klucza", ID_EDIT_COPYKEYNAME
MENUITEM SEPARATOR
MENUITEM "&ZnajdŸ...\tCtrl+F", ID_EDIT_FIND, GRAYED
MENUITEM "Zn&ajdź nast<EFBFBD>ępny\tF3", ID_EDIT_FINDNEXT, GRAYED
MENUITEM "Zn&ajdź następny\tF3", ID_EDIT_FINDNEXT, GRAYED
END
POPUP "&Widok"
BEGIN
@ -77,13 +77,13 @@ BEGIN
MENUITEM SEPARATOR
MENUITEM "Po&dziel", ID_VIEW_SPLIT
MENUITEM SEPARATOR
MENUITEM "&Odświe<EFBFBD>ż\tF5", ID_VIEW_REFRESH
MENUITEM "&Odśwież\tF5", ID_VIEW_REFRESH
END
POPUP "&Ulubione"
BEGIN
MENUITEM "&Dodaj do ulubionych", ID_FAVOURITES_ADDTOFAVOURITES
, GRAYED
MENUITEM "&Usu<EFBFBD>ń ulubiony", ID_FAVOURITES_REMOVEFAVOURITE
MENUITEM "&Usuń ulubiony", ID_FAVOURITES_REMOVEFAVOURITE
, GRAYED
END
POPUP "Pomo&c"
@ -101,8 +101,8 @@ BEGIN
MENUITEM "&Modyfikuj", ID_EDIT_MODIFY
MENUITEM "Modyfikuj dane binarne", ID_EDIT_MODIFY_BIN
MENUITEM SEPARATOR
MENUITEM "&Usu<EFBFBD>ń\tDel", ID_EDIT_DELETE
MENUITEM "&Zmie<EFBFBD>ń nazw<EFBFBD>ę", ID_EDIT_RENAME
MENUITEM "&Usuń\tDel", ID_EDIT_DELETE
MENUITEM "&Zmień nazwę", ID_EDIT_RENAME
END
POPUP ""
BEGIN
@ -141,7 +141,7 @@ FONT 8, "System"
BEGIN
LTEXT "Nazwa:",IDC_STATIC,5,5,119,8
EDITTEXT IDC_VALUE_NAME,5,15,200,12, WS_BORDER | WS_TABSTOP | WS_DISABLED
LTEXT "Wartoś<EFBFBD>ć:",IDC_STATIC,5,30,119,8
LTEXT "Wartość:",IDC_STATIC,5,30,119,8
EDITTEXT IDC_VALUE_DATA,5,40,200,12, WS_BORDER | WS_TABSTOP
DEFPUSHBUTTON "OK",IDOK,140,60,30,11,WS_GROUP
PUSHBUTTON "Anuluj",IDCANCEL,175,60,30,11,WS_GROUP
@ -154,11 +154,11 @@ FONT 8, "System"
BEGIN
LTEXT "Nazwa:",IDC_STATIC,5,5,119,8
EDITTEXT IDC_VALUE_NAME,5,15,200,12, WS_BORDER | WS_TABSTOP | WS_DISABLED
LTEXT "Wartoś<EFBFBD>ć:",IDC_STATIC,5,30,90,8
LTEXT "Wartość:",IDC_STATIC,5,30,90,8
EDITTEXT IDC_VALUE_DATA,5,40,90,12, WS_BORDER | WS_TABSTOP
GROUPBOX "System", IDC_DWORD_BASE, 120, 30, 85, 37, BS_GROUPBOX
AUTORADIOBUTTON "Szesnastkowy", IDC_DWORD_HEX, 130, 40, 60, 10, WS_TABSTOP
AUTORADIOBUTTON "Dziesi<EFBFBD>ętny", IDC_DWORD_DEC, 130, 52, 60, 10, WS_TABSTOP
AUTORADIOBUTTON "Dziesiętny", IDC_DWORD_DEC, 130, 52, 60, 10, WS_TABSTOP
DEFPUSHBUTTON "OK",IDOK,140,80,30,11,WS_GROUP
PUSHBUTTON "Anuluj",IDCANCEL,175,80,30,11,WS_GROUP
END
@ -171,7 +171,7 @@ STRINGTABLE DISCARDABLE
BEGIN
IDS_LIST_COLUMN_NAME "Nazwa"
IDS_LIST_COLUMN_TYPE "Typ"
IDS_LIST_COLUMN_DATA "Wartoś<EFBFBD>ć"
IDS_LIST_COLUMN_DATA "Wartość"
END
STRINGTABLE DISCARDABLE
@ -183,57 +183,57 @@ END
STRINGTABLE DISCARDABLE
BEGIN
ID_REGISTRY_MENU "Zawiera polecenia operuj<EFBFBD>ące na ca<EFBFBD>łym rejestrze"
ID_EDIT_MENU "Zawiera polecenia dotycz<EFBFBD>ące edycji kluczy i danych"
ID_VIEW_MENU "Zawiera polecenia dotycz<EFBFBD>ące wygl<EFBFBD>ądu programu"
ID_FAVOURITES_MENU "Zawiera polecenia dotycz<EFBFBD>ące skr<EFBFBD>ót<EFBFBD>ów do kluczy rejestru"
ID_HELP_MENU "Zawiera polecenia wyświetlaj<EFBFBD>ące informacje o programie"
ID_EDIT_NEW_MENU "Zawiera polecenia tworz<EFBFBD>ące nowe klucze i dane"
ID_REGISTRY_MENU "Zawiera polecenia operujące na całym rejestrze"
ID_EDIT_MENU "Zawiera polecenia dotyczące edycji kluczy i danych"
ID_VIEW_MENU "Zawiera polecenia dotyczące wyglądu programu"
ID_FAVOURITES_MENU "Zawiera polecenia dotyczące skrótów do kluczy rejestru"
ID_HELP_MENU "Zawiera polecenia wyświetlające informacje o programie"
ID_EDIT_NEW_MENU "Zawiera polecenia tworzące nowe klucze i dane"
END
STRINGTABLE DISCARDABLE
BEGIN
ID_EDIT_MODIFY "Pozwala zmodyfikowa<EFBFBD>ć wartoś<EFBFBD>ć danej"
ID_EDIT_MODIFY "Pozwala zmodyfikować wartość danej"
ID_EDIT_NEW_KEY "Dodaje nowy klucz"
ID_EDIT_NEW_STRINGVALUE "Dodaje now<EFBFBD>ą dan<EFBFBD>ą tekstow<EFBFBD>ą"
ID_EDIT_NEW_BINARYVALUE "Dodaje now<EFBFBD>ą dan<EFBFBD>ą binarn<EFBFBD>ą"
ID_EDIT_NEW_DWORDVALUE "Dodaje now<EFBFBD>ą dan<EFBFBD>ą liczbow<EFBFBD>ą"
ID_EDIT_NEW_STRINGVALUE "Dodaje nową daną tekstową"
ID_EDIT_NEW_BINARYVALUE "Dodaje nową daną binarną"
ID_EDIT_NEW_DWORDVALUE "Dodaje nową daną liczbową"
ID_REGISTRY_IMPORTREGISTRYFILE "Importuje plik tekstowy do rejestru"
ID_REGISTRY_EXPORTREGISTRYFILE
"Eksportuje cz<EFBFBD>ęś<EFBFBD>ć lub ca<EFBFBD>łoś<EFBFBD>ć rejestru do pliku tekstowego"
"Eksportuje część lub całość rejestru do pliku tekstowego"
ID_REGISTRY_CONNECTNETWORKREGISTRY
"<EFBFBD>Ł<EFBFBD>ączy si<EFBFBD>ę do rejestru innego komputera"
"Łączy się do rejestru innego komputera"
ID_REGISTRY_DISCONNECTNETWORKREGISTRY
"Od<EFBFBD>ł<EFBFBD>ącza si<EFBFBD>ę od rejestru innego komputera"
ID_REGISTRY_PRINT "Drukuje ca<EFBFBD>łoś<EFBFBD>ć lub cz<EFBFBD>ęś<EFBFBD>ć rejestru"
"Odłącza się od rejestru innego komputera"
ID_REGISTRY_PRINT "Drukuje całość lub część rejestru"
/* ID_HELP_HELPTOPICS "Opens registry editor help" */
ID_HELP_ABOUT "Wyświetla informacj<EFBFBD>ę o programie, numerze wersji i prawach autorskich"
ID_HELP_ABOUT "Wyświetla informację o programie, numerze wersji i prawach autorskich"
END
STRINGTABLE DISCARDABLE
BEGIN
ID_REGISTRY_EXIT "Ko<EFBFBD>ńczy dzia<EFBFBD>łanie edytora rejestru"
ID_REGISTRY_EXIT "Kończy działanie edytora rejestru"
ID_FAVOURITES_ADDTOFAVOURITES "Dodaje klucze do listy ulubionych"
ID_FAVOURITES_REMOVEFAVOURITE "Usuwa klucze z listy ulubionych"
ID_VIEW_STATUSBAR "Wyœwietla lub ukrywa pasek stanu"
ID_VIEW_SPLIT "Zmienia proporcje szerokoœci paneli"
ID_VIEW_REFRESH "Odświe<EFBFBD>ża zawartoś<EFBFBD>ć okien"
ID_VIEW_REFRESH "Odświeża zawartość okien"
ID_EDIT_DELETE "Kasuje zaznaczony obiekt"
ID_EDIT_RENAME "Zmienia nazw<EFBFBD>ę zaznaczonego obiektu"
ID_EDIT_COPYKEYNAME "Kopiuje nazw<EFBFBD>ę zaznaczonego klucza do schowka"
ID_EDIT_FIND "Znajduje ci<EFBFBD>ąg znak<EFBFBD>ów w kluczu lub danej"
ID_EDIT_FINDNEXT "Znajduje nast<EFBFBD>ępne wyst<EFBFBD>ąpienie ostatnio szukanego ci<EFBFBD>ągu"
ID_EDIT_RENAME "Zmienia nazwę zaznaczonego obiektu"
ID_EDIT_COPYKEYNAME "Kopiuje nazwę zaznaczonego klucza do schowka"
ID_EDIT_FIND "Znajduje ciąg znaków w kluczu lub danej"
ID_EDIT_FINDNEXT "Znajduje następne wystąpienie ostatnio szukanego ciągu"
END
STRINGTABLE DISCARDABLE
BEGIN
IDS_ERROR "B<EFBFBD>ł<EFBFBD>ąd"
IDS_BAD_KEY "Nie uda<EFBFBD>ło sie przeczyta<EFBFBD>ć klucza '%s'"
IDS_BAD_VALUE "Nie uda<EFBFBD>ło sie przeczyta<EFBFBD>ć danej '%s'"
IDS_UNSUPPORTED_TYPE "Nie da si<EFBFBD>ę modyfikowa<EFBFBD>ć kluczy tego typu (%ld)"
IDS_TOO_BIG_VALUE "Wartoś<EFBFBD>ć jest zbyt du<EFBFBD>ża (%ld)"
IDS_ERROR "Błąd"
IDS_BAD_KEY "Nie udało sie przeczytać klucza '%s'"
IDS_BAD_VALUE "Nie udało sie przeczytać danej '%s'"
IDS_UNSUPPORTED_TYPE "Nie da się modyfikować kluczy tego typu (%ld)"
IDS_TOO_BIG_VALUE "Wartość jest zbyt duża (%ld)"
IDS_DELETE_BOX_TITLE "Potwierdzenie kasowania"
IDS_DELETE_BOX_TEXT "Jesteś pewien, <EFBFBD>że chcesz usun<EFBFBD>ą<EFBFBD>ć dan<EFBFBD>ą '%s'?"
IDS_DELETE_BOX_TEXT "Jesteś pewien, że chcesz usunąć daną '%s'?"
IDS_NEWKEY "Nowy klucz #%d"
IDS_NEWVALUE "Nowa dana #%d"
END

View File

@ -64,7 +64,7 @@ BEGIN
END
MENUITEM SEPARATOR
MENUITEM "&Excluir\tDel", ID_EDIT_DELETE
MENUITEM "&Renomear", ID_EDIT_RENAME
MENUITEM "&Renomear\tF2", ID_EDIT_RENAME
MENUITEM SEPARATOR
MENUITEM "&Copiar nome da chave", ID_EDIT_COPYKEYNAME
MENUITEM SEPARATOR

View File

@ -64,7 +64,7 @@ BEGIN
END
MENUITEM SEPARATOR
MENUITEM "&Óäàëèòü\tDel", ID_EDIT_DELETE
MENUITEM "&Переименовать", ID_EDIT_RENAME
MENUITEM "&Переименовать\tF2", ID_EDIT_RENAME
MENUITEM SEPARATOR
MENUITEM "Ñ&êîïèðîâàòü èìÿ êëþ÷à", ID_EDIT_COPYKEYNAME
MENUITEM SEPARATOR

View File

@ -64,7 +64,7 @@ BEGIN
END
MENUITEM SEPARATOR
MENUITEM "Izbri&ši\tDel", ID_EDIT_DELETE
MENUITEM "Prei&menuj", ID_EDIT_RENAME
MENUITEM "Prei&menuj\tF2", ID_EDIT_RENAME
MENUITEM SEPARATOR
MENUITEM "&Kopiraj ime kljuèa", ID_EDIT_COPYKEYNAME
MENUITEM SEPARATOR

View File

@ -26,6 +26,11 @@
#include "main.h"
#include "wine/debug.h"
#include "wine/unicode.h"
WINE_DEFAULT_DEBUG_CHANNEL(regedit);
ChildWnd* g_pChildWnd;
/*******************************************************************************
@ -87,6 +92,7 @@ static void OnPaint(HWND hWnd)
static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
ChildWnd* pChildWnd = g_pChildWnd;
switch (LOWORD(wParam)) {
/* Parse the menu selections: */
case ID_REGISTRY_EXIT:
@ -95,6 +101,10 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
case ID_VIEW_REFRESH:
/* TODO */
break;
case ID_SWITCH_PANELS:
pChildWnd->nFocusPanel = !pChildWnd->nFocusPanel;
SetFocus(pChildWnd->nFocusPanel? pChildWnd->hListWnd: pChildWnd->hTreeWnd);
break;
default:
return FALSE;
}
@ -233,7 +243,7 @@ LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
keyPath = GetItemPath(pChildWnd->hTreeWnd, ((NMTREEVIEW*)lParam)->itemNew.hItem, &hRootKey);
if (keyPath) {
RefreshListView(pChildWnd->hListWnd, hRootKey, keyPath);
RefreshListView(pChildWnd->hListWnd, hRootKey, keyPath, NULL);
rootName = get_root_key_name(hRootKey);
fullPath = HeapAlloc(GetProcessHeap(), 0, (lstrlen(rootName) + 1 + lstrlen(keyPath) + 1) * sizeof(TCHAR));
if (fullPath) {
@ -245,8 +255,15 @@ LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
}
break;
case NM_SETFOCUS:
pChildWnd->nFocusPanel = 1;
pChildWnd->nFocusPanel = 0;
break;
case NM_RCLICK: {
POINT pt;
GetCursorPos(&pt);
TrackPopupMenu(GetSubMenu(hPopupMenus, PM_NEW),
TPM_RIGHTBUTTON, pt.x, pt.y, 0, hFrameWnd, NULL);
break;
}
case TVN_ENDLABELEDIT: {
HKEY hRootKey;
LPNMTVDISPINFO dispInfo = (LPNMTVDISPINFO)lParam;
@ -262,13 +279,13 @@ LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
return res;
}
default:
goto def;
return 0; /* goto def; */
}
} else
if ((int)wParam == LIST_WINDOW) {
if (((LPNMHDR)lParam)->code == NM_SETFOCUS) {
pChildWnd->nFocusPanel = 0;
} else if (!SendMessage(pChildWnd->hListWnd, message, wParam, lParam)) {
pChildWnd->nFocusPanel = 1;
} else if (!SendMessage(pChildWnd->hListWnd, WM_NOTIFY_REFLECT, wParam, lParam)) {
goto def;
}
}

View File

@ -109,12 +109,11 @@ INT_PTR CALLBACK modify_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
break;
case IDOK:
if ((hwndValue = GetDlgItem(hwndDlg, IDC_VALUE_DATA))) {
if ((len = GetWindowTextLength(hwndValue))) {
if ((valueData = HeapReAlloc(GetProcessHeap(), 0, stringValueData, (len + 1) * sizeof(TCHAR)))) {
stringValueData = valueData;
if (!GetWindowText(hwndValue, stringValueData, len + 1))
*stringValueData = 0;
}
len = GetWindowTextLength(hwndValue);
if ((valueData = HeapReAlloc(GetProcessHeap(), 0, stringValueData, (len + 1) * sizeof(TCHAR)))) {
stringValueData = valueData;
if (!GetWindowText(hwndValue, stringValueData, len + 1))
*stringValueData = 0;
}
}
/* Fall through */
@ -126,14 +125,28 @@ INT_PTR CALLBACK modify_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
return FALSE;
}
static BOOL check_value(HWND hwnd, HKEY hKey, LPCTSTR valueName)
{
LONG lRet = RegQueryValueEx(hKey, valueName ? valueName : _T(""), 0, NULL, 0, NULL);
if(lRet != ERROR_SUCCESS) return FALSE;
return TRUE;
}
static LPTSTR read_value(HWND hwnd, HKEY hKey, LPCTSTR valueName, DWORD *lpType, LONG *len)
{
DWORD valueDataLen;
LPTSTR buffer = NULL;
LONG lRet;
lRet = RegQueryValueEx(hKey, valueName, 0, lpType, 0, &valueDataLen);
lRet = RegQueryValueEx(hKey, valueName ? valueName : _T(""), 0, lpType, 0, &valueDataLen);
if (lRet != ERROR_SUCCESS) {
if (lRet == ERROR_FILE_NOT_FOUND && !valueName) { /* no default value here, make it up */
if (len) *len = 1;
if (lpType) *lpType = REG_SZ;
buffer = HeapAlloc(GetProcessHeap(), 0, 1);
*buffer = '\0';
return buffer;
}
error(hwnd, IDS_BAD_VALUE, valueName);
goto done;
}
@ -198,9 +211,7 @@ BOOL ModifyValue(HWND hwnd, HKEY hKeyRoot, LPCTSTR keyPath, LPCTSTR valueName)
lRet = RegOpenKeyEx(hKeyRoot, keyPath, 0, KEY_READ | KEY_SET_VALUE, &hKey);
if (lRet != ERROR_SUCCESS) return FALSE;
editValueName = valueName;
if (!lstrcmp(valueName, _T("(Default)")))
valueName = NULL;
editValueName = valueName ? valueName : g_pszDefaultValueName;
if(!(stringValueData = read_value(hwnd, hKey, valueName, &type, 0))) goto done;
if ( (type == REG_SZ) || (type == REG_EXPAND_SZ) ) {
@ -234,7 +245,7 @@ BOOL DeleteKey(HWND hwnd, HKEY hKeyRoot, LPCTSTR keyPath)
LONG lRet;
HKEY hKey;
lRet = RegOpenKeyEx(hKeyRoot, keyPath, 0, KEY_SET_VALUE, &hKey);
lRet = RegOpenKeyEx(hKeyRoot, keyPath, 0, KEY_READ|KEY_SET_VALUE, &hKey);
if (lRet != ERROR_SUCCESS) return FALSE;
if (messagebox(hwnd, MB_YESNO | MB_ICONEXCLAMATION, IDS_DELETE_BOX_TITLE, IDS_DELETE_BOX_TEXT, keyPath) != IDYES)
@ -257,15 +268,16 @@ BOOL DeleteValue(HWND hwnd, HKEY hKeyRoot, LPCTSTR keyPath, LPCTSTR valueName)
BOOL result = FALSE;
LONG lRet;
HKEY hKey;
LPCSTR visibleValueName = valueName ? valueName : g_pszDefaultValueName;
lRet = RegOpenKeyEx(hKeyRoot, keyPath, 0, KEY_SET_VALUE, &hKey);
lRet = RegOpenKeyEx(hKeyRoot, keyPath, 0, KEY_READ | KEY_SET_VALUE, &hKey);
if (lRet != ERROR_SUCCESS) return FALSE;
if (messagebox(hwnd, MB_YESNO | MB_ICONEXCLAMATION, IDS_DELETE_BOX_TITLE, IDS_DELETE_BOX_TEXT, valueName) != IDYES)
if (messagebox(hwnd, MB_YESNO | MB_ICONEXCLAMATION, IDS_DELETE_BOX_TITLE, IDS_DELETE_BOX_TEXT, visibleValueName) != IDYES)
goto done;
lRet = RegDeleteValue(hKey, valueName);
if (lRet != ERROR_SUCCESS) {
lRet = RegDeleteValue(hKey, valueName ? valueName : "");
if (lRet != ERROR_SUCCESS && valueName) {
error(hwnd, IDS_BAD_VALUE, valueName);
}
if (lRet != ERROR_SUCCESS) goto done;
@ -276,11 +288,10 @@ done:
return result;
}
BOOL CreateValue(HWND hwnd, HKEY hKeyRoot, LPCTSTR keyPath, DWORD valueType)
BOOL CreateValue(HWND hwnd, HKEY hKeyRoot, LPCTSTR keyPath, DWORD valueType, LPTSTR valueName)
{
LONG lRet = ERROR_SUCCESS;
TCHAR valueName[32];
TCHAR newValue[COUNT_OF(valueName) - 4];
TCHAR newValue[256];
DWORD valueDword = 0;
BOOL result = FALSE;
int valueNum;
@ -316,13 +327,13 @@ BOOL RenameValue(HWND hwnd, HKEY hKeyRoot, LPCTSTR keyPath, LPCTSTR oldName, LPC
BOOL result = FALSE;
HKEY hKey;
if (!oldName) return FALSE;
if (!newName) return FALSE;
lRet = RegOpenKeyEx(hKeyRoot, keyPath, 0, KEY_READ | KEY_SET_VALUE, &hKey);
if (lRet != ERROR_SUCCESS) return FALSE;
/* check if value already exists */
value = read_value(hwnd, hKey, newName, &type, &len);
if (value) goto done;
if (check_value(hwnd, hKey, newName)) goto done;
value = read_value(hwnd, hKey, oldName, &type, &len);
if(!value) goto done;
lRet = RegSetValueEx(hKey, newName, 0, type, (BYTE*)value, len);

View File

@ -459,19 +459,20 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
PrintRegistryHive(hWnd, _T(""));
break;
case ID_EDIT_DELETE:
if (keyPath == 0 || *keyPath == 0) {
MessageBeep(MB_ICONHAND);
} else if (GetFocus() == g_pChildWnd->hTreeWnd) {
if (DeleteKey(hWnd, hKeyRoot, keyPath))
if (GetFocus() == g_pChildWnd->hTreeWnd) {
if (keyPath == 0 || *keyPath == 0) {
MessageBeep(MB_ICONHAND);
} else if (DeleteKey(hWnd, hKeyRoot, keyPath)) {
DeleteNode(g_pChildWnd->hTreeWnd, 0);
}
} else if (GetFocus() == g_pChildWnd->hListWnd) {
if (DeleteValue(hWnd, hKeyRoot, keyPath, valueName))
RefreshListView(g_pChildWnd->hListWnd, hKeyRoot, keyPath);
RefreshListView(g_pChildWnd->hListWnd, hKeyRoot, keyPath, NULL);
}
break;
case ID_EDIT_MODIFY:
if (ModifyValue(hWnd, hKeyRoot, keyPath, valueName))
RefreshListView(g_pChildWnd->hListWnd, hKeyRoot, keyPath);
RefreshListView(g_pChildWnd->hListWnd, hKeyRoot, keyPath, valueName);
break;
case ID_EDIT_COPYKEYNAME:
CopyKeyName(hWnd, _T(""));
@ -492,8 +493,9 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
valueType = REG_DWORD;
/* fall through */
create_value:
if (CreateValue(hWnd, hKeyRoot, keyPath, valueType)) {
RefreshListView(g_pChildWnd->hListWnd, hKeyRoot, keyPath);
if (CreateValue(hWnd, hKeyRoot, keyPath, valueType, newKey)) {
RefreshListView(g_pChildWnd->hListWnd, hKeyRoot, keyPath, newKey);
StartValueRename(g_pChildWnd->hListWnd);
/* FIXME: start rename */
}
break;
@ -577,6 +579,10 @@ LRESULT CALLBACK FrameWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
if (!_CmdWndProc(hWnd, message, wParam, lParam))
return DefWindowProc(hWnd, message, wParam, lParam);
break;
case WM_ACTIVATE:
if (LOWORD(hWnd))
SetFocus(g_pChildWnd->hWnd);
break;
case WM_SIZE:
resize_frame_client(hWnd);
break;

View File

@ -28,6 +28,11 @@
#include "main.h"
#include "wine/debug.h"
#include "wine/unicode.h"
WINE_DEFAULT_DEBUG_CHANNEL(regedit);
typedef struct tagLINE_INFO
{
DWORD dwValType;
@ -58,6 +63,7 @@ LPTSTR get_item_text(HWND hwndLV, int item)
curStr = HeapAlloc(GetProcessHeap(), 0, maxLen);
if (!curStr) return NULL;
if (item == 0) return NULL; /* first item is ALWAYS a default */
do {
ListView_GetItemText(hwndLV, item, 0, curStr, maxLen);
if (_tcslen(curStr) < maxLen - 1) return curStr;
@ -74,7 +80,8 @@ LPCTSTR GetValueName(HWND hwndLV)
{
INT item;
if (g_valueName) HeapFree(GetProcessHeap(), 0, g_valueName);
if (g_valueName && g_valueName != LPSTR_TEXTCALLBACK)
HeapFree(GetProcessHeap(), 0, g_valueName);
g_valueName = NULL;
item = ListView_GetNextItem(hwndLV, -1, LVNI_FOCUSED);
@ -88,7 +95,8 @@ LPCTSTR GetValueName(HWND hwndLV)
/*******************************************************************************
* Local module support methods
*/
static void AddEntryToList(HWND hwndLV, LPTSTR Name, DWORD dwValType, void* ValBuf, DWORD dwCount)
static void AddEntryToList(HWND hwndLV, LPTSTR Name, DWORD dwValType,
void* ValBuf, DWORD dwCount, BOOL bHighlight)
{
LINE_INFO* linfo;
LVITEM item;
@ -98,17 +106,22 @@ static void AddEntryToList(HWND hwndLV, LPTSTR Name, DWORD dwValType, void* ValB
linfo->dwValType = dwValType;
linfo->val_len = dwCount;
memcpy(&linfo[1], ValBuf, dwCount);
linfo->name = _tcsdup(Name);
if (Name)
linfo->name = _tcsdup(Name);
else
linfo->name = NULL;
item.mask = LVIF_TEXT | LVIF_PARAM;
item.iItem = 0;/*idx; */
item.mask = LVIF_TEXT | LVIF_PARAM | LVIF_STATE;
item.iItem = ListView_GetItemCount(hwndLV);/*idx; */
item.iSubItem = 0;
item.state = 0;
item.stateMask = 0;
item.pszText = Name;
item.cchTextMax = _tcslen(item.pszText);
if (item.cchTextMax == 0)
item.pszText = LPSTR_TEXTCALLBACK;
item.stateMask = LVIS_FOCUSED | LVIS_SELECTED;
item.pszText = Name ? Name : LPSTR_TEXTCALLBACK;
item.cchTextMax = Name ? _tcslen(item.pszText) : 0;
if (bHighlight) {
item.stateMask = item.state = LVIS_FOCUSED | LVIS_SELECTED;
}
item.iImage = 0;
item.lParam = (LPARAM)linfo;
@ -124,7 +137,11 @@ static void AddEntryToList(HWND hwndLV, LPTSTR Name, DWORD dwValType, void* ValB
switch (dwValType) {
case REG_SZ:
case REG_EXPAND_SZ:
ListView_SetItemText(hwndLV, index, 2, ValBuf);
if (ValBuf) {
ListView_SetItemText(hwndLV, index, 2, ValBuf);
} else {
ListView_SetItemText(hwndLV, index, 2, "(not set)");
}
break;
case REG_DWORD: {
TCHAR buf[64];
@ -184,7 +201,7 @@ static void OnGetDispInfo(NMLVDISPINFO* plvdi)
switch (plvdi->item.iSubItem) {
case 0:
plvdi->item.pszText = _T("(Default)");
plvdi->item.pszText = (LPSTR)g_pszDefaultValueName;
break;
case 1:
switch (((LINE_INFO*)plvdi->item.lParam)->dwValType) {
@ -235,6 +252,8 @@ static int CALLBACK CompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSor
LINE_INFO*l, *r;
l = (LINE_INFO*)lParam1;
r = (LINE_INFO*)lParam2;
if (!l->name) return -1;
if (!r->name) return +1;
if (g_columnToSort == ~0UL)
g_columnToSort = 0;
@ -247,16 +266,15 @@ static int CALLBACK CompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSor
return g_invertSort ? _tcscmp(r->name, l->name) : _tcscmp(l->name, r->name);
}
static void ListViewPopUpMenu(HWND hWnd, POINT pt)
{
}
HWND StartValueRename(HWND hwndLV)
{
int item;
item = ListView_GetNextItem(hwndLV, -1, LVNI_FOCUSED | LVNI_SELECTED);
if (item < 0) return 0;
if (item < 1) { /* cannot rename default key */
MessageBeep(MB_ICONHAND);
return 0;
}
return ListView_EditLabel(hwndLV, item);
}
@ -279,8 +297,13 @@ static LRESULT CALLBACK ListWndProc(HWND hWnd, UINT message, WPARAM wParam, LPAR
return CallWindowProc(g_orgListWndProc, hWnd, message, wParam, lParam);
}
break;
case WM_NOTIFY:
case WM_NOTIFY_REFLECT:
switch (((LPNMHDR)lParam)->code) {
case LVN_BEGINLABELEDIT:
if (!((NMLVDISPINFO *)lParam)->item.iItem)
return 1;
return 0;
case LVN_GETDISPINFO:
OnGetDispInfo((NMLVDISPINFO*)lParam);
break;
@ -297,16 +320,25 @@ static LRESULT CALLBACK ListWndProc(HWND hWnd, UINT message, WPARAM wParam, LPAR
case LVN_ENDLABELEDIT: {
LPNMLVDISPINFO dispInfo = (LPNMLVDISPINFO)lParam;
LPTSTR valueName = get_item_text(hWnd, dispInfo->item.iItem);
BOOL res = RenameValue(hWnd, g_currentRootKey, g_currentPath, valueName, dispInfo->item.pszText);
if (res) RefreshListView(hWnd, g_currentRootKey, g_currentPath);
LONG ret;
if (!valueName) return -1; /* cannot rename a default value */
ret = RenameValue(hWnd, g_currentRootKey, g_currentPath, valueName, dispInfo->item.pszText);
if (ret)
RefreshListView(hWnd, g_currentRootKey, g_currentPath, dispInfo->item.pszText);
HeapFree(GetProcessHeap(), 0, valueName);
return res;
return 0;
}
case NM_RETURN: {
int cnt = ListView_GetNextItem(hWnd, -1, LVNI_FOCUSED | LVNI_SELECTED);
if (cnt != -1)
SendMessage(hFrameWnd, WM_COMMAND, ID_EDIT_MODIFY, 0);
}
break;
case NM_DBLCLK: {
NMITEMACTIVATE* nmitem = (LPNMITEMACTIVATE)lParam;
LVHITTESTINFO info;
if (nmitem->hdr.hwndFrom != hWnd) break;
/* if (nmitem->hdr.hwndFrom != hWnd) break; unnecessary because of WM_NOTIFY_REFLECT */
/* if (nmitem->hdr.idFrom != IDW_LISTVIEW) break; */
/* if (nmitem->hdr.code != ???) break; */
#ifdef _MSC_VER
@ -324,47 +356,25 @@ static LRESULT CALLBACK ListWndProc(HWND hWnd, UINT message, WPARAM wParam, LPAR
info.pt.x = nmitem->ptAction.x;
info.pt.y = nmitem->ptAction.y;
if (ListView_HitTest(hWnd, &info) != -1) {
LVITEM item;
item.mask = LVIF_PARAM;
item.iItem = info.iItem;
if (ListView_GetItem(hWnd, &item)) {}
}
}
break;
case NM_RCLICK: {
int idx;
LV_HITTESTINFO lvH;
NM_LISTVIEW* pNm = (NM_LISTVIEW*)lParam;
lvH.pt.x = pNm->ptAction.x;
lvH.pt.y = pNm->ptAction.y;
idx = ListView_HitTest(hWnd, &lvH);
if (idx != -1) {
POINT pt;
GetCursorPos(&pt);
ListViewPopUpMenu(hWnd, pt);
return idx;
ListView_SetItemState(hWnd, -1, 0, LVIS_FOCUSED|LVIS_SELECTED);
ListView_SetItemState(hWnd, info.iItem, LVIS_FOCUSED|LVIS_SELECTED,
LVIS_FOCUSED|LVIS_SELECTED);
SendMessage(hFrameWnd, WM_COMMAND, ID_EDIT_MODIFY, 0);
}
}
break;
default:
return CallWindowProc(g_orgListWndProc, hWnd, message, wParam, lParam);
return 0; /* shouldn't call default ! */
}
break;
case WM_CONTEXTMENU: {
POINTS pt = MAKEPOINTS(lParam);
int cnt = ListView_GetNextItem(hWnd, -1, LVNI_FOCUSED | LVNI_SELECTED);
int cnt = ListView_GetNextItem(hWnd, -1, LVNI_SELECTED);
TrackPopupMenu(GetSubMenu(hPopupMenus, cnt == -1 ? PM_NEW : PM_MODIFYVALUE),
TPM_RIGHTBUTTON, pt.x, pt.y, 0, hFrameWnd, NULL);
break;
}
case WM_KEYDOWN:
if (wParam == VK_TAB) {
/*TODO: SetFocus(Globals.hDriveBar) */
/*SetFocus(child->nFocusPanel? child->left.hWnd: child->right.hWnd); */
}
/* fall thru... */
default:
return CallWindowProc(g_orgListWndProc, hWnd, message, wParam, lParam);
break;
@ -400,7 +410,7 @@ fail:
return NULL;
}
BOOL RefreshListView(HWND hwndLV, HKEY hKeyRoot, LPCTSTR keyPath)
BOOL RefreshListView(HWND hwndLV, HKEY hKeyRoot, LPCTSTR keyPath, LPCTSTR highlightValue)
{
BOOL result = FALSE;
DWORD max_sub_key_len;
@ -443,20 +453,23 @@ BOOL RefreshListView(HWND hwndLV, HKEY hKeyRoot, LPCTSTR keyPath)
valName = HeapAlloc(GetProcessHeap(), 0, max_val_name_len * sizeof(TCHAR));
valBuf = HeapAlloc(GetProcessHeap(), 0, max_val_size);
/*if (RegQueryValueEx(hKey, NULL, NULL, &dwValType, ValBuf, &dwValSize) == ERROR_SUCCESS) { */
/* AddEntryToList(hwndLV, _T("(Default)"), dwValType, ValBuf, dwValSize); */
/*} */
if (RegQueryValueEx(hKey, NULL, NULL, &valType, valBuf, &valSize) == ERROR_FILE_NOT_FOUND) {
AddEntryToList(hwndLV, NULL, REG_SZ, NULL, 0, !highlightValue);
}
/*dwValSize = max_val_size; */
for(index = 0; index < val_count; index++) {
BOOL bSelected = (valName == highlightValue); /* NOT a bug, we check for double NULL here */
valNameLen = max_val_name_len;
valSize = max_val_size;
valType = 0;
errCode = RegEnumValue(hKey, index, valName, &valNameLen, NULL, &valType, valBuf, &valSize);
if (errCode != ERROR_SUCCESS) goto done;
valBuf[valSize] = 0;
AddEntryToList(hwndLV, valName, valType, valBuf, valSize);
if (valName && highlightValue && !_tcscmp(valName, highlightValue))
bSelected = TRUE;
AddEntryToList(hwndLV, valName[0] ? valName : NULL, valType, valBuf, valSize, bSelected);
}
ListView_SortItems(hwndLV, CompareFunc, hwndLV);
ListView_SortItems(hwndLV, CompareFunc, hwndLV);
g_currentRootKey = hKeyRoot;
if (keyPath != g_currentPath) {

View File

@ -30,6 +30,7 @@
#define REGEDIT_DECLARE_FUNCTIONS
#include "main.h"
LPCSTR g_pszDefaultValueName = _T("(Default)");
BOOL ProcessCmdLine(LPSTR lpCmdLine);
@ -144,6 +145,15 @@ void ExitInstance(void)
DestroyMenu(hMenuFrame);
}
BOOL TranslateChildTabMessage(MSG *msg)
{
if (msg->message != WM_KEYDOWN) return FALSE;
if (msg->wParam != VK_TAB) return FALSE;
if (GetParent(msg->hwnd) != g_pChildWnd->hWnd) return FALSE;
PostMessage(g_pChildWnd->hWnd, WM_COMMAND, ID_SWITCH_PANELS, 0);
return TRUE;
}
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
@ -172,8 +182,8 @@ int APIENTRY WinMain(HINSTANCE hInstance,
/* Main message loop */
while (GetMessage(&msg, (HWND)NULL, 0, 0)) {
if (!TranslateAccelerator(hFrameWnd, hAccel, &msg) &&
!IsDialogMessage(hFrameWnd, &msg)) {
if (!TranslateAccelerator(hFrameWnd, hAccel, &msg)
&& !TranslateChildTabMessage(&msg)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}

View File

@ -37,6 +37,8 @@
#define MAX_NEW_KEY_LEN 128
#define WM_NOTIFY_REFLECT (WM_USER+1024)
extern HINSTANCE hInst;
/******************************************************************************/
@ -76,6 +78,7 @@ extern enum OPTION_FLAGS Options;
extern TCHAR szTitle[];
extern TCHAR szFrameClass[];
extern TCHAR szChildClass[];
extern LPCTSTR g_pszDefaultValueName;
/* about.c */
extern void ShowAboutBox(HWND hWnd);
@ -90,7 +93,7 @@ extern void UpdateStatusBar(void);
/* listview.c */
extern HWND CreateListView(HWND hwndParent, int id);
extern BOOL RefreshListView(HWND hwndLV, HKEY hKeyRoot, LPCTSTR keyPath);
extern BOOL RefreshListView(HWND hwndLV, HKEY hKeyRoot, LPCTSTR keyPath, LPCTSTR highlightValue);
extern HWND StartValueRename(HWND hwndLV);
extern LPCTSTR GetValueName(HWND hwndLV);
extern BOOL ListWndNotifyProc(HWND hWnd, WPARAM wParam, LPARAM lParam, BOOL *Result);
@ -106,7 +109,7 @@ extern HWND StartKeyRename(HWND hwndTV);
/* edit.c */
extern BOOL CreateKey(HWND hwnd, HKEY hKeyRoot, LPCTSTR keyPath, LPTSTR newKeyName);
extern BOOL CreateValue(HWND hwnd, HKEY hKeyRoot, LPCTSTR keyPath, DWORD valueType);
extern BOOL CreateValue(HWND hwnd, HKEY hKeyRoot, LPCTSTR keyPath, DWORD valueType, LPTSTR valueName);
extern BOOL ModifyValue(HWND hwnd, HKEY hKeyRoot, LPCTSTR keyPath, LPCTSTR valueName);
extern BOOL DeleteKey(HWND hwnd, HKEY hKeyRoot, LPCTSTR keyPath);
extern BOOL DeleteValue(HWND hwnd, HKEY hKeyRoot, LPCTSTR keyPath, LPCTSTR valueName);

View File

@ -119,6 +119,7 @@
#define IDS_NEWVALUE 32861
#define IDS_BAD_KEY 32862
#define ID_EDIT_MODIFY_BIN 32870
#define ID_SWITCH_PANELS 32871
#define IDD_EDIT_STRING 2000
#define IDC_VALUE_NAME 2001

View File

@ -31,6 +31,7 @@ IDC_REGEDIT ACCELERATORS
"^P", ID_REGISTRY_PRINT
VK_DELETE, ID_EDIT_DELETE, VIRTKEY
VK_F1, ID_HELP_HELPTOPICS, VIRTKEY
VK_F2, ID_EDIT_RENAME, VIRTKEY
VK_F3, ID_EDIT_FINDNEXT, VIRTKEY
VK_F5, ID_VIEW_REFRESH, VIRTKEY
}