Commit b2d8cd3f authored by Krzysztof Foltman's avatar Krzysztof Foltman Committed by Alexandre Julliard

- 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
parent 088db8b4
...@@ -64,7 +64,7 @@ BEGIN ...@@ -64,7 +64,7 @@ BEGIN
END END
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "&Delete\tDel", ID_EDIT_DELETE MENUITEM "&Delete\tDel", ID_EDIT_DELETE
MENUITEM "&Rename", ID_EDIT_RENAME MENUITEM "&Rename\tF2", ID_EDIT_RENAME
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "&Copy Key Name", ID_EDIT_COPYKEYNAME MENUITEM "&Copy Key Name", ID_EDIT_COPYKEYNAME
MENUITEM SEPARATOR MENUITEM SEPARATOR
......
...@@ -64,7 +64,7 @@ BEGIN ...@@ -64,7 +64,7 @@ BEGIN
END END
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "&Eliminar\tDel", ID_EDIT_DELETE MENUITEM "&Eliminar\tDel", ID_EDIT_DELETE
MENUITEM "&Renombrar", ID_EDIT_RENAME MENUITEM "&Renombrar\tF2", ID_EDIT_RENAME
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "&Copiar valor de la clave", ID_EDIT_COPYKEYNAME MENUITEM "&Copiar valor de la clave", ID_EDIT_COPYKEYNAME
MENUITEM SEPARATOR MENUITEM SEPARATOR
......
...@@ -65,7 +65,7 @@ BEGIN ...@@ -65,7 +65,7 @@ BEGIN
END END
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "&Supprimer\tDel", ID_EDIT_DELETE MENUITEM "&Supprimer\tDel", ID_EDIT_DELETE
MENUITEM "Ren&ommer", ID_EDIT_RENAME MENUITEM "Ren&ommer\tF2", ID_EDIT_RENAME
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "&Copier le nom de la clé", ID_EDIT_COPYKEYNAME MENUITEM "&Copier le nom de la clé", ID_EDIT_COPYKEYNAME
MENUITEM SEPARATOR MENUITEM SEPARATOR
......
...@@ -65,7 +65,7 @@ BEGIN ...@@ -65,7 +65,7 @@ BEGIN
END END
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "&Elimina\tDel", ID_EDIT_DELETE MENUITEM "&Elimina\tDel", ID_EDIT_DELETE
MENUITEM "&Rinomina", ID_EDIT_RENAME MENUITEM "&Rinomina\tF2" ID_EDIT_RENAME
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "&Copia nome chiave", ID_EDIT_COPYKEYNAME MENUITEM "&Copia nome chiave", ID_EDIT_COPYKEYNAME
MENUITEM SEPARATOR MENUITEM SEPARATOR
......
...@@ -64,7 +64,7 @@ BEGIN ...@@ -64,7 +64,7 @@ BEGIN
END END
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "&Verwijderen\tDel", ID_EDIT_DELETE MENUITEM "&Verwijderen\tDel", ID_EDIT_DELETE
MENUITEM "&Naam wijzigen", ID_EDIT_RENAME MENUITEM "&Naam wijzigen\tF2" ID_EDIT_RENAME
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "&Sleutelnaam kopiëren", ID_EDIT_COPYKEYNAME MENUITEM "&Sleutelnaam kopiëren", ID_EDIT_COPYKEYNAME
MENUITEM SEPARATOR MENUITEM SEPARATOR
......
...@@ -28,7 +28,7 @@ IDC_REGEDIT MENU DISCARDABLE ...@@ -28,7 +28,7 @@ IDC_REGEDIT MENU DISCARDABLE
BEGIN BEGIN
POPUP "&Plik" POPUP "&Plik"
BEGIN BEGIN
MENUITEM "Za&kocz", ID_REGISTRY_EXIT MENUITEM "Za&kocz", ID_REGISTRY_EXIT
END END
POPUP "&Help" POPUP "&Help"
BEGIN BEGIN
...@@ -43,12 +43,12 @@ BEGIN ...@@ -43,12 +43,12 @@ BEGIN
MENUITEM "&Importuj rejestr...", ID_REGISTRY_IMPORTREGISTRYFILE MENUITEM "&Importuj rejestr...", ID_REGISTRY_IMPORTREGISTRYFILE
MENUITEM "&Eksportuj rejestr...", ID_REGISTRY_EXPORTREGISTRYFILE MENUITEM "&Eksportuj rejestr...", ID_REGISTRY_EXPORTREGISTRYFILE
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "&Podcz rejestr sieciowy...",ID_REGISTRY_CONNECTNETWORKREGISTRY, GRAYED MENUITEM "&Podcz rejestr sieciowy...",ID_REGISTRY_CONNECTNETWORKREGISTRY, GRAYED
MENUITEM "&Odcz rejestr sieciowy...", ID_REGISTRY_DISCONNECTNETWORKREGISTRY, GRAYED MENUITEM "&Odcz rejestr sieciowy...", ID_REGISTRY_DISCONNECTNETWORKREGISTRY, GRAYED
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "&Drukuj\tCtrl+P", ID_REGISTRY_PRINT, GRAYED MENUITEM "&Drukuj\tCtrl+P", ID_REGISTRY_PRINT, GRAYED
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "Za&kocz", ID_REGISTRY_EXIT MENUITEM "Za&kocz", ID_REGISTRY_EXIT
END END
POPUP "&Edycja" POPUP "&Edycja"
BEGIN BEGIN
...@@ -63,13 +63,13 @@ BEGIN ...@@ -63,13 +63,13 @@ BEGIN
MENUITEM "&Dana liczbowa (DWORD)",ID_EDIT_NEW_DWORDVALUE MENUITEM "&Dana liczbowa (DWORD)",ID_EDIT_NEW_DWORDVALUE
END END
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "U&su\tDel", ID_EDIT_DELETE MENUITEM "U&su\tDel", ID_EDIT_DELETE
MENUITEM "Z&mie nazw", ID_EDIT_RENAME MENUITEM "Z&mie nazw\tF2", ID_EDIT_RENAME
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "&Kopiuj nazw klucza", ID_EDIT_COPYKEYNAME MENUITEM "&Kopiuj nazw klucza", ID_EDIT_COPYKEYNAME
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "&Znajd...\tCtrl+F", ID_EDIT_FIND, GRAYED MENUITEM "&Znajd...\tCtrl+F", ID_EDIT_FIND, GRAYED
MENUITEM "Zn&ajd nastpny\tF3", ID_EDIT_FINDNEXT, GRAYED MENUITEM "Zn&ajd nastpny\tF3", ID_EDIT_FINDNEXT, GRAYED
END END
POPUP "&Widok" POPUP "&Widok"
BEGIN BEGIN
...@@ -77,13 +77,13 @@ BEGIN ...@@ -77,13 +77,13 @@ BEGIN
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "Po&dziel", ID_VIEW_SPLIT MENUITEM "Po&dziel", ID_VIEW_SPLIT
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "&Odwie\tF5", ID_VIEW_REFRESH MENUITEM "&Odwie\tF5", ID_VIEW_REFRESH
END END
POPUP "&Ulubione" POPUP "&Ulubione"
BEGIN BEGIN
MENUITEM "&Dodaj do ulubionych", ID_FAVOURITES_ADDTOFAVOURITES MENUITEM "&Dodaj do ulubionych", ID_FAVOURITES_ADDTOFAVOURITES
, GRAYED , GRAYED
MENUITEM "&Usu ulubiony", ID_FAVOURITES_REMOVEFAVOURITE MENUITEM "&Usu ulubiony", ID_FAVOURITES_REMOVEFAVOURITE
, GRAYED , GRAYED
END END
POPUP "Pomo&c" POPUP "Pomo&c"
...@@ -101,8 +101,8 @@ BEGIN ...@@ -101,8 +101,8 @@ BEGIN
MENUITEM "&Modyfikuj", ID_EDIT_MODIFY MENUITEM "&Modyfikuj", ID_EDIT_MODIFY
MENUITEM "Modyfikuj dane binarne", ID_EDIT_MODIFY_BIN MENUITEM "Modyfikuj dane binarne", ID_EDIT_MODIFY_BIN
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "&Usu\tDel", ID_EDIT_DELETE MENUITEM "&Usu\tDel", ID_EDIT_DELETE
MENUITEM "&Zmie nazw", ID_EDIT_RENAME MENUITEM "&Zmie nazw", ID_EDIT_RENAME
END END
POPUP "" POPUP ""
BEGIN BEGIN
...@@ -141,7 +141,7 @@ FONT 8, "System" ...@@ -141,7 +141,7 @@ FONT 8, "System"
BEGIN BEGIN
LTEXT "Nazwa:",IDC_STATIC,5,5,119,8 LTEXT "Nazwa:",IDC_STATIC,5,5,119,8
EDITTEXT IDC_VALUE_NAME,5,15,200,12, WS_BORDER | WS_TABSTOP | WS_DISABLED EDITTEXT IDC_VALUE_NAME,5,15,200,12, WS_BORDER | WS_TABSTOP | WS_DISABLED
LTEXT "Warto:",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 EDITTEXT IDC_VALUE_DATA,5,40,200,12, WS_BORDER | WS_TABSTOP
DEFPUSHBUTTON "OK",IDOK,140,60,30,11,WS_GROUP DEFPUSHBUTTON "OK",IDOK,140,60,30,11,WS_GROUP
PUSHBUTTON "Anuluj",IDCANCEL,175,60,30,11,WS_GROUP PUSHBUTTON "Anuluj",IDCANCEL,175,60,30,11,WS_GROUP
...@@ -154,11 +154,11 @@ FONT 8, "System" ...@@ -154,11 +154,11 @@ FONT 8, "System"
BEGIN BEGIN
LTEXT "Nazwa:",IDC_STATIC,5,5,119,8 LTEXT "Nazwa:",IDC_STATIC,5,5,119,8
EDITTEXT IDC_VALUE_NAME,5,15,200,12, WS_BORDER | WS_TABSTOP | WS_DISABLED EDITTEXT IDC_VALUE_NAME,5,15,200,12, WS_BORDER | WS_TABSTOP | WS_DISABLED
LTEXT "Warto:",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 EDITTEXT IDC_VALUE_DATA,5,40,90,12, WS_BORDER | WS_TABSTOP
GROUPBOX "System", IDC_DWORD_BASE, 120, 30, 85, 37, BS_GROUPBOX GROUPBOX "System", IDC_DWORD_BASE, 120, 30, 85, 37, BS_GROUPBOX
AUTORADIOBUTTON "Szesnastkowy", IDC_DWORD_HEX, 130, 40, 60, 10, WS_TABSTOP AUTORADIOBUTTON "Szesnastkowy", IDC_DWORD_HEX, 130, 40, 60, 10, WS_TABSTOP
AUTORADIOBUTTON "Dziesitny", IDC_DWORD_DEC, 130, 52, 60, 10, WS_TABSTOP AUTORADIOBUTTON "Dziesitny", IDC_DWORD_DEC, 130, 52, 60, 10, WS_TABSTOP
DEFPUSHBUTTON "OK",IDOK,140,80,30,11,WS_GROUP DEFPUSHBUTTON "OK",IDOK,140,80,30,11,WS_GROUP
PUSHBUTTON "Anuluj",IDCANCEL,175,80,30,11,WS_GROUP PUSHBUTTON "Anuluj",IDCANCEL,175,80,30,11,WS_GROUP
END END
...@@ -171,7 +171,7 @@ STRINGTABLE DISCARDABLE ...@@ -171,7 +171,7 @@ STRINGTABLE DISCARDABLE
BEGIN BEGIN
IDS_LIST_COLUMN_NAME "Nazwa" IDS_LIST_COLUMN_NAME "Nazwa"
IDS_LIST_COLUMN_TYPE "Typ" IDS_LIST_COLUMN_TYPE "Typ"
IDS_LIST_COLUMN_DATA "Warto" IDS_LIST_COLUMN_DATA "Warto"
END END
STRINGTABLE DISCARDABLE STRINGTABLE DISCARDABLE
...@@ -183,57 +183,57 @@ END ...@@ -183,57 +183,57 @@ END
STRINGTABLE DISCARDABLE STRINGTABLE DISCARDABLE
BEGIN BEGIN
ID_REGISTRY_MENU "Zawiera polecenia operujce na caym rejestrze" ID_REGISTRY_MENU "Zawiera polecenia operujce na caym rejestrze"
ID_EDIT_MENU "Zawiera polecenia dotyczce edycji kluczy i danych" ID_EDIT_MENU "Zawiera polecenia dotyczce edycji kluczy i danych"
ID_VIEW_MENU "Zawiera polecenia dotyczce wygldu programu" ID_VIEW_MENU "Zawiera polecenia dotyczce wygldu programu"
ID_FAVOURITES_MENU "Zawiera polecenia dotyczce skrtw do kluczy rejestru" ID_FAVOURITES_MENU "Zawiera polecenia dotyczce skrtw do kluczy rejestru"
ID_HELP_MENU "Zawiera polecenia wywietlajce informacje o programie" ID_HELP_MENU "Zawiera polecenia wywietlajce informacje o programie"
ID_EDIT_NEW_MENU "Zawiera polecenia tworzce nowe klucze i dane" ID_EDIT_NEW_MENU "Zawiera polecenia tworzce nowe klucze i dane"
END END
STRINGTABLE DISCARDABLE STRINGTABLE DISCARDABLE
BEGIN BEGIN
ID_EDIT_MODIFY "Pozwala zmodyfikowa warto danej" ID_EDIT_MODIFY "Pozwala zmodyfikowa warto danej"
ID_EDIT_NEW_KEY "Dodaje nowy klucz" ID_EDIT_NEW_KEY "Dodaje nowy klucz"
ID_EDIT_NEW_STRINGVALUE "Dodaje now dan tekstow" ID_EDIT_NEW_STRINGVALUE "Dodaje now dan tekstow"
ID_EDIT_NEW_BINARYVALUE "Dodaje now dan binarn" ID_EDIT_NEW_BINARYVALUE "Dodaje now dan binarn"
ID_EDIT_NEW_DWORDVALUE "Dodaje now dan liczbow" ID_EDIT_NEW_DWORDVALUE "Dodaje now dan liczbow"
ID_REGISTRY_IMPORTREGISTRYFILE "Importuje plik tekstowy do rejestru" ID_REGISTRY_IMPORTREGISTRYFILE "Importuje plik tekstowy do rejestru"
ID_REGISTRY_EXPORTREGISTRYFILE ID_REGISTRY_EXPORTREGISTRYFILE
"Eksportuje cz lub cao rejestru do pliku tekstowego" "Eksportuje cz lub cao rejestru do pliku tekstowego"
ID_REGISTRY_CONNECTNETWORKREGISTRY ID_REGISTRY_CONNECTNETWORKREGISTRY
"czy si do rejestru innego komputera" "czy si do rejestru innego komputera"
ID_REGISTRY_DISCONNECTNETWORKREGISTRY ID_REGISTRY_DISCONNECTNETWORKREGISTRY
"Odcza si od rejestru innego komputera" "Odcza si od rejestru innego komputera"
ID_REGISTRY_PRINT "Drukuje cao lub cz rejestru" ID_REGISTRY_PRINT "Drukuje cao lub cz rejestru"
/* ID_HELP_HELPTOPICS "Opens registry editor help" */ /* ID_HELP_HELPTOPICS "Opens registry editor help" */
ID_HELP_ABOUT "Wywietla informacj o programie, numerze wersji i prawach autorskich" ID_HELP_ABOUT "Wywietla informacj o programie, numerze wersji i prawach autorskich"
END END
STRINGTABLE DISCARDABLE STRINGTABLE DISCARDABLE
BEGIN BEGIN
ID_REGISTRY_EXIT "Koczy dziaanie edytora rejestru" ID_REGISTRY_EXIT "Koczy dziaanie edytora rejestru"
ID_FAVOURITES_ADDTOFAVOURITES "Dodaje klucze do listy ulubionych" ID_FAVOURITES_ADDTOFAVOURITES "Dodaje klucze do listy ulubionych"
ID_FAVOURITES_REMOVEFAVOURITE "Usuwa klucze z listy ulubionych" ID_FAVOURITES_REMOVEFAVOURITE "Usuwa klucze z listy ulubionych"
ID_VIEW_STATUSBAR "Wywietla lub ukrywa pasek stanu" ID_VIEW_STATUSBAR "Wywietla lub ukrywa pasek stanu"
ID_VIEW_SPLIT "Zmienia proporcje szerokoci paneli" ID_VIEW_SPLIT "Zmienia proporcje szerokoci paneli"
ID_VIEW_REFRESH "Odwiea zawarto okien" ID_VIEW_REFRESH "Odwiea zawarto okien"
ID_EDIT_DELETE "Kasuje zaznaczony obiekt" ID_EDIT_DELETE "Kasuje zaznaczony obiekt"
ID_EDIT_RENAME "Zmienia nazw zaznaczonego obiektu" ID_EDIT_RENAME "Zmienia nazw zaznaczonego obiektu"
ID_EDIT_COPYKEYNAME "Kopiuje nazw zaznaczonego klucza do schowka" ID_EDIT_COPYKEYNAME "Kopiuje nazw zaznaczonego klucza do schowka"
ID_EDIT_FIND "Znajduje cig znakw w kluczu lub danej" ID_EDIT_FIND "Znajduje cig znakw w kluczu lub danej"
ID_EDIT_FINDNEXT "Znajduje nastpne wystpienie ostatnio szukanego cigu" ID_EDIT_FINDNEXT "Znajduje nastpne wystpienie ostatnio szukanego cigu"
END END
STRINGTABLE DISCARDABLE STRINGTABLE DISCARDABLE
BEGIN BEGIN
IDS_ERROR "Bd" IDS_ERROR "Bd"
IDS_BAD_KEY "Nie udao sie przeczyta klucza '%s'" IDS_BAD_KEY "Nie udao sie przeczyta klucza '%s'"
IDS_BAD_VALUE "Nie udao sie przeczyta danej '%s'" IDS_BAD_VALUE "Nie udao sie przeczyta danej '%s'"
IDS_UNSUPPORTED_TYPE "Nie da si modyfikowa kluczy tego typu (%ld)" IDS_UNSUPPORTED_TYPE "Nie da si modyfikowa kluczy tego typu (%ld)"
IDS_TOO_BIG_VALUE "Warto jest zbyt dua (%ld)" IDS_TOO_BIG_VALUE "Warto jest zbyt dua (%ld)"
IDS_DELETE_BOX_TITLE "Potwierdzenie kasowania" IDS_DELETE_BOX_TITLE "Potwierdzenie kasowania"
IDS_DELETE_BOX_TEXT "Jeste pewien, e chcesz usun dan '%s'?" IDS_DELETE_BOX_TEXT "Jeste pewien, e chcesz usun dan '%s'?"
IDS_NEWKEY "Nowy klucz #%d" IDS_NEWKEY "Nowy klucz #%d"
IDS_NEWVALUE "Nowa dana #%d" IDS_NEWVALUE "Nowa dana #%d"
END END
......
...@@ -64,7 +64,7 @@ BEGIN ...@@ -64,7 +64,7 @@ BEGIN
END END
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "&Excluir\tDel", ID_EDIT_DELETE MENUITEM "&Excluir\tDel", ID_EDIT_DELETE
MENUITEM "&Renomear", ID_EDIT_RENAME MENUITEM "&Renomear\tF2", ID_EDIT_RENAME
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "&Copiar nome da chave", ID_EDIT_COPYKEYNAME MENUITEM "&Copiar nome da chave", ID_EDIT_COPYKEYNAME
MENUITEM SEPARATOR MENUITEM SEPARATOR
......
...@@ -64,7 +64,7 @@ BEGIN ...@@ -64,7 +64,7 @@ BEGIN
END END
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "&\tDel", ID_EDIT_DELETE MENUITEM "&\tDel", ID_EDIT_DELETE
MENUITEM "&", ID_EDIT_RENAME MENUITEM "&\tF2", ID_EDIT_RENAME
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "& ", ID_EDIT_COPYKEYNAME MENUITEM "& ", ID_EDIT_COPYKEYNAME
MENUITEM SEPARATOR MENUITEM SEPARATOR
......
...@@ -64,7 +64,7 @@ BEGIN ...@@ -64,7 +64,7 @@ BEGIN
END END
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "Izbri&i\tDel", ID_EDIT_DELETE MENUITEM "Izbri&i\tDel", ID_EDIT_DELETE
MENUITEM "Prei&menuj", ID_EDIT_RENAME MENUITEM "Prei&menuj\tF2", ID_EDIT_RENAME
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "&Kopiraj ime kljua", ID_EDIT_COPYKEYNAME MENUITEM "&Kopiraj ime kljua", ID_EDIT_COPYKEYNAME
MENUITEM SEPARATOR MENUITEM SEPARATOR
......
...@@ -26,6 +26,11 @@ ...@@ -26,6 +26,11 @@
#include "main.h" #include "main.h"
#include "wine/debug.h"
#include "wine/unicode.h"
WINE_DEFAULT_DEBUG_CHANNEL(regedit);
ChildWnd* g_pChildWnd; ChildWnd* g_pChildWnd;
/******************************************************************************* /*******************************************************************************
...@@ -87,6 +92,7 @@ static void OnPaint(HWND hWnd) ...@@ -87,6 +92,7 @@ static void OnPaint(HWND hWnd)
static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{ {
ChildWnd* pChildWnd = g_pChildWnd;
switch (LOWORD(wParam)) { switch (LOWORD(wParam)) {
/* Parse the menu selections: */ /* Parse the menu selections: */
case ID_REGISTRY_EXIT: case ID_REGISTRY_EXIT:
...@@ -95,6 +101,10 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) ...@@ -95,6 +101,10 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
case ID_VIEW_REFRESH: case ID_VIEW_REFRESH:
/* TODO */ /* TODO */
break; break;
case ID_SWITCH_PANELS:
pChildWnd->nFocusPanel = !pChildWnd->nFocusPanel;
SetFocus(pChildWnd->nFocusPanel? pChildWnd->hListWnd: pChildWnd->hTreeWnd);
break;
default: default:
return FALSE; return FALSE;
} }
...@@ -233,7 +243,7 @@ LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa ...@@ -233,7 +243,7 @@ LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
keyPath = GetItemPath(pChildWnd->hTreeWnd, ((NMTREEVIEW*)lParam)->itemNew.hItem, &hRootKey); keyPath = GetItemPath(pChildWnd->hTreeWnd, ((NMTREEVIEW*)lParam)->itemNew.hItem, &hRootKey);
if (keyPath) { if (keyPath) {
RefreshListView(pChildWnd->hListWnd, hRootKey, keyPath); RefreshListView(pChildWnd->hListWnd, hRootKey, keyPath, NULL);
rootName = get_root_key_name(hRootKey); rootName = get_root_key_name(hRootKey);
fullPath = HeapAlloc(GetProcessHeap(), 0, (lstrlen(rootName) + 1 + lstrlen(keyPath) + 1) * sizeof(TCHAR)); fullPath = HeapAlloc(GetProcessHeap(), 0, (lstrlen(rootName) + 1 + lstrlen(keyPath) + 1) * sizeof(TCHAR));
if (fullPath) { if (fullPath) {
...@@ -245,8 +255,15 @@ LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa ...@@ -245,8 +255,15 @@ LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
} }
break; break;
case NM_SETFOCUS: case NM_SETFOCUS:
pChildWnd->nFocusPanel = 1; pChildWnd->nFocusPanel = 0;
break; 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: { case TVN_ENDLABELEDIT: {
HKEY hRootKey; HKEY hRootKey;
LPNMTVDISPINFO dispInfo = (LPNMTVDISPINFO)lParam; LPNMTVDISPINFO dispInfo = (LPNMTVDISPINFO)lParam;
...@@ -262,13 +279,13 @@ LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa ...@@ -262,13 +279,13 @@ LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
return res; return res;
} }
default: default:
goto def; return 0; /* goto def; */
} }
} else } else
if ((int)wParam == LIST_WINDOW) { if ((int)wParam == LIST_WINDOW) {
if (((LPNMHDR)lParam)->code == NM_SETFOCUS) { if (((LPNMHDR)lParam)->code == NM_SETFOCUS) {
pChildWnd->nFocusPanel = 0; pChildWnd->nFocusPanel = 1;
} else if (!SendMessage(pChildWnd->hListWnd, message, wParam, lParam)) { } else if (!SendMessage(pChildWnd->hListWnd, WM_NOTIFY_REFLECT, wParam, lParam)) {
goto def; goto def;
} }
} }
......
...@@ -109,12 +109,11 @@ INT_PTR CALLBACK modify_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l ...@@ -109,12 +109,11 @@ INT_PTR CALLBACK modify_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
break; break;
case IDOK: case IDOK:
if ((hwndValue = GetDlgItem(hwndDlg, IDC_VALUE_DATA))) { if ((hwndValue = GetDlgItem(hwndDlg, IDC_VALUE_DATA))) {
if ((len = GetWindowTextLength(hwndValue))) { len = GetWindowTextLength(hwndValue);
if ((valueData = HeapReAlloc(GetProcessHeap(), 0, stringValueData, (len + 1) * sizeof(TCHAR)))) { if ((valueData = HeapReAlloc(GetProcessHeap(), 0, stringValueData, (len + 1) * sizeof(TCHAR)))) {
stringValueData = valueData; stringValueData = valueData;
if (!GetWindowText(hwndValue, stringValueData, len + 1)) if (!GetWindowText(hwndValue, stringValueData, len + 1))
*stringValueData = 0; *stringValueData = 0;
}
} }
} }
/* Fall through */ /* Fall through */
...@@ -126,14 +125,28 @@ INT_PTR CALLBACK modify_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l ...@@ -126,14 +125,28 @@ INT_PTR CALLBACK modify_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
return FALSE; 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) static LPTSTR read_value(HWND hwnd, HKEY hKey, LPCTSTR valueName, DWORD *lpType, LONG *len)
{ {
DWORD valueDataLen; DWORD valueDataLen;
LPTSTR buffer = NULL; LPTSTR buffer = NULL;
LONG lRet; 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_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); error(hwnd, IDS_BAD_VALUE, valueName);
goto done; goto done;
} }
...@@ -198,9 +211,7 @@ BOOL ModifyValue(HWND hwnd, HKEY hKeyRoot, LPCTSTR keyPath, LPCTSTR valueName) ...@@ -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); lRet = RegOpenKeyEx(hKeyRoot, keyPath, 0, KEY_READ | KEY_SET_VALUE, &hKey);
if (lRet != ERROR_SUCCESS) return FALSE; if (lRet != ERROR_SUCCESS) return FALSE;
editValueName = valueName; editValueName = valueName ? valueName : g_pszDefaultValueName;
if (!lstrcmp(valueName, _T("(Default)")))
valueName = NULL;
if(!(stringValueData = read_value(hwnd, hKey, valueName, &type, 0))) goto done; if(!(stringValueData = read_value(hwnd, hKey, valueName, &type, 0))) goto done;
if ( (type == REG_SZ) || (type == REG_EXPAND_SZ) ) { if ( (type == REG_SZ) || (type == REG_EXPAND_SZ) ) {
...@@ -234,7 +245,7 @@ BOOL DeleteKey(HWND hwnd, HKEY hKeyRoot, LPCTSTR keyPath) ...@@ -234,7 +245,7 @@ BOOL DeleteKey(HWND hwnd, HKEY hKeyRoot, LPCTSTR keyPath)
LONG lRet; LONG lRet;
HKEY hKey; 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 (lRet != ERROR_SUCCESS) return FALSE;
if (messagebox(hwnd, MB_YESNO | MB_ICONEXCLAMATION, IDS_DELETE_BOX_TITLE, IDS_DELETE_BOX_TEXT, keyPath) != IDYES) 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) ...@@ -257,15 +268,16 @@ BOOL DeleteValue(HWND hwnd, HKEY hKeyRoot, LPCTSTR keyPath, LPCTSTR valueName)
BOOL result = FALSE; BOOL result = FALSE;
LONG lRet; LONG lRet;
HKEY hKey; 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 (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; goto done;
lRet = RegDeleteValue(hKey, valueName); lRet = RegDeleteValue(hKey, valueName ? valueName : "");
if (lRet != ERROR_SUCCESS) { if (lRet != ERROR_SUCCESS && valueName) {
error(hwnd, IDS_BAD_VALUE, valueName); error(hwnd, IDS_BAD_VALUE, valueName);
} }
if (lRet != ERROR_SUCCESS) goto done; if (lRet != ERROR_SUCCESS) goto done;
...@@ -276,11 +288,10 @@ done: ...@@ -276,11 +288,10 @@ done:
return result; 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; LONG lRet = ERROR_SUCCESS;
TCHAR valueName[32]; TCHAR newValue[256];
TCHAR newValue[COUNT_OF(valueName) - 4];
DWORD valueDword = 0; DWORD valueDword = 0;
BOOL result = FALSE; BOOL result = FALSE;
int valueNum; int valueNum;
...@@ -316,13 +327,13 @@ BOOL RenameValue(HWND hwnd, HKEY hKeyRoot, LPCTSTR keyPath, LPCTSTR oldName, LPC ...@@ -316,13 +327,13 @@ BOOL RenameValue(HWND hwnd, HKEY hKeyRoot, LPCTSTR keyPath, LPCTSTR oldName, LPC
BOOL result = FALSE; BOOL result = FALSE;
HKEY hKey; HKEY hKey;
if (!oldName) return FALSE;
if (!newName) return FALSE; if (!newName) return FALSE;
lRet = RegOpenKeyEx(hKeyRoot, keyPath, 0, KEY_READ | KEY_SET_VALUE, &hKey); lRet = RegOpenKeyEx(hKeyRoot, keyPath, 0, KEY_READ | KEY_SET_VALUE, &hKey);
if (lRet != ERROR_SUCCESS) return FALSE; if (lRet != ERROR_SUCCESS) return FALSE;
/* check if value already exists */ /* check if value already exists */
value = read_value(hwnd, hKey, newName, &type, &len); if (check_value(hwnd, hKey, newName)) goto done;
if (value) goto done;
value = read_value(hwnd, hKey, oldName, &type, &len); value = read_value(hwnd, hKey, oldName, &type, &len);
if(!value) goto done; if(!value) goto done;
lRet = RegSetValueEx(hKey, newName, 0, type, (BYTE*)value, len); lRet = RegSetValueEx(hKey, newName, 0, type, (BYTE*)value, len);
......
...@@ -459,19 +459,20 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) ...@@ -459,19 +459,20 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
PrintRegistryHive(hWnd, _T("")); PrintRegistryHive(hWnd, _T(""));
break; break;
case ID_EDIT_DELETE: case ID_EDIT_DELETE:
if (keyPath == 0 || *keyPath == 0) { if (GetFocus() == g_pChildWnd->hTreeWnd) {
MessageBeep(MB_ICONHAND); if (keyPath == 0 || *keyPath == 0) {
} else if (GetFocus() == g_pChildWnd->hTreeWnd) { MessageBeep(MB_ICONHAND);
if (DeleteKey(hWnd, hKeyRoot, keyPath)) } else if (DeleteKey(hWnd, hKeyRoot, keyPath)) {
DeleteNode(g_pChildWnd->hTreeWnd, 0); DeleteNode(g_pChildWnd->hTreeWnd, 0);
}
} else if (GetFocus() == g_pChildWnd->hListWnd) { } else if (GetFocus() == g_pChildWnd->hListWnd) {
if (DeleteValue(hWnd, hKeyRoot, keyPath, valueName)) if (DeleteValue(hWnd, hKeyRoot, keyPath, valueName))
RefreshListView(g_pChildWnd->hListWnd, hKeyRoot, keyPath); RefreshListView(g_pChildWnd->hListWnd, hKeyRoot, keyPath, NULL);
} }
break; break;
case ID_EDIT_MODIFY: case ID_EDIT_MODIFY:
if (ModifyValue(hWnd, hKeyRoot, keyPath, valueName)) if (ModifyValue(hWnd, hKeyRoot, keyPath, valueName))
RefreshListView(g_pChildWnd->hListWnd, hKeyRoot, keyPath); RefreshListView(g_pChildWnd->hListWnd, hKeyRoot, keyPath, valueName);
break; break;
case ID_EDIT_COPYKEYNAME: case ID_EDIT_COPYKEYNAME:
CopyKeyName(hWnd, _T("")); CopyKeyName(hWnd, _T(""));
...@@ -492,8 +493,9 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) ...@@ -492,8 +493,9 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
valueType = REG_DWORD; valueType = REG_DWORD;
/* fall through */ /* fall through */
create_value: create_value:
if (CreateValue(hWnd, hKeyRoot, keyPath, valueType)) { if (CreateValue(hWnd, hKeyRoot, keyPath, valueType, newKey)) {
RefreshListView(g_pChildWnd->hListWnd, hKeyRoot, keyPath); RefreshListView(g_pChildWnd->hListWnd, hKeyRoot, keyPath, newKey);
StartValueRename(g_pChildWnd->hListWnd);
/* FIXME: start rename */ /* FIXME: start rename */
} }
break; break;
...@@ -577,6 +579,10 @@ LRESULT CALLBACK FrameWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa ...@@ -577,6 +579,10 @@ LRESULT CALLBACK FrameWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
if (!_CmdWndProc(hWnd, message, wParam, lParam)) if (!_CmdWndProc(hWnd, message, wParam, lParam))
return DefWindowProc(hWnd, message, wParam, lParam); return DefWindowProc(hWnd, message, wParam, lParam);
break; break;
case WM_ACTIVATE:
if (LOWORD(hWnd))
SetFocus(g_pChildWnd->hWnd);
break;
case WM_SIZE: case WM_SIZE:
resize_frame_client(hWnd); resize_frame_client(hWnd);
break; break;
......
...@@ -28,6 +28,11 @@ ...@@ -28,6 +28,11 @@
#include "main.h" #include "main.h"
#include "wine/debug.h"
#include "wine/unicode.h"
WINE_DEFAULT_DEBUG_CHANNEL(regedit);
typedef struct tagLINE_INFO typedef struct tagLINE_INFO
{ {
DWORD dwValType; DWORD dwValType;
...@@ -58,6 +63,7 @@ LPTSTR get_item_text(HWND hwndLV, int item) ...@@ -58,6 +63,7 @@ LPTSTR get_item_text(HWND hwndLV, int item)
curStr = HeapAlloc(GetProcessHeap(), 0, maxLen); curStr = HeapAlloc(GetProcessHeap(), 0, maxLen);
if (!curStr) return NULL; if (!curStr) return NULL;
if (item == 0) return NULL; /* first item is ALWAYS a default */
do { do {
ListView_GetItemText(hwndLV, item, 0, curStr, maxLen); ListView_GetItemText(hwndLV, item, 0, curStr, maxLen);
if (_tcslen(curStr) < maxLen - 1) return curStr; if (_tcslen(curStr) < maxLen - 1) return curStr;
...@@ -74,7 +80,8 @@ LPCTSTR GetValueName(HWND hwndLV) ...@@ -74,7 +80,8 @@ LPCTSTR GetValueName(HWND hwndLV)
{ {
INT item; 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; g_valueName = NULL;
item = ListView_GetNextItem(hwndLV, -1, LVNI_FOCUSED); item = ListView_GetNextItem(hwndLV, -1, LVNI_FOCUSED);
...@@ -88,7 +95,8 @@ LPCTSTR GetValueName(HWND hwndLV) ...@@ -88,7 +95,8 @@ LPCTSTR GetValueName(HWND hwndLV)
/******************************************************************************* /*******************************************************************************
* Local module support methods * 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; LINE_INFO* linfo;
LVITEM item; LVITEM item;
...@@ -98,17 +106,22 @@ static void AddEntryToList(HWND hwndLV, LPTSTR Name, DWORD dwValType, void* ValB ...@@ -98,17 +106,22 @@ static void AddEntryToList(HWND hwndLV, LPTSTR Name, DWORD dwValType, void* ValB
linfo->dwValType = dwValType; linfo->dwValType = dwValType;
linfo->val_len = dwCount; linfo->val_len = dwCount;
memcpy(&linfo[1], ValBuf, 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.mask = LVIF_TEXT | LVIF_PARAM | LVIF_STATE;
item.iItem = 0;/*idx; */ item.iItem = ListView_GetItemCount(hwndLV);/*idx; */
item.iSubItem = 0; item.iSubItem = 0;
item.state = 0; item.state = 0;
item.stateMask = 0; item.stateMask = LVIS_FOCUSED | LVIS_SELECTED;
item.pszText = Name; item.pszText = Name ? Name : LPSTR_TEXTCALLBACK;
item.cchTextMax = _tcslen(item.pszText); item.cchTextMax = Name ? _tcslen(item.pszText) : 0;
if (item.cchTextMax == 0) if (bHighlight) {
item.pszText = LPSTR_TEXTCALLBACK; item.stateMask = item.state = LVIS_FOCUSED | LVIS_SELECTED;
}
item.iImage = 0; item.iImage = 0;
item.lParam = (LPARAM)linfo; item.lParam = (LPARAM)linfo;
...@@ -124,7 +137,11 @@ static void AddEntryToList(HWND hwndLV, LPTSTR Name, DWORD dwValType, void* ValB ...@@ -124,7 +137,11 @@ static void AddEntryToList(HWND hwndLV, LPTSTR Name, DWORD dwValType, void* ValB
switch (dwValType) { switch (dwValType) {
case REG_SZ: case REG_SZ:
case REG_EXPAND_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; break;
case REG_DWORD: { case REG_DWORD: {
TCHAR buf[64]; TCHAR buf[64];
...@@ -184,7 +201,7 @@ static void OnGetDispInfo(NMLVDISPINFO* plvdi) ...@@ -184,7 +201,7 @@ static void OnGetDispInfo(NMLVDISPINFO* plvdi)
switch (plvdi->item.iSubItem) { switch (plvdi->item.iSubItem) {
case 0: case 0:
plvdi->item.pszText = _T("(Default)"); plvdi->item.pszText = (LPSTR)g_pszDefaultValueName;
break; break;
case 1: case 1:
switch (((LINE_INFO*)plvdi->item.lParam)->dwValType) { switch (((LINE_INFO*)plvdi->item.lParam)->dwValType) {
...@@ -235,6 +252,8 @@ static int CALLBACK CompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSor ...@@ -235,6 +252,8 @@ static int CALLBACK CompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSor
LINE_INFO*l, *r; LINE_INFO*l, *r;
l = (LINE_INFO*)lParam1; l = (LINE_INFO*)lParam1;
r = (LINE_INFO*)lParam2; r = (LINE_INFO*)lParam2;
if (!l->name) return -1;
if (!r->name) return +1;
if (g_columnToSort == ~0UL) if (g_columnToSort == ~0UL)
g_columnToSort = 0; g_columnToSort = 0;
...@@ -247,16 +266,15 @@ static int CALLBACK CompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSor ...@@ -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); return g_invertSort ? _tcscmp(r->name, l->name) : _tcscmp(l->name, r->name);
} }
static void ListViewPopUpMenu(HWND hWnd, POINT pt)
{
}
HWND StartValueRename(HWND hwndLV) HWND StartValueRename(HWND hwndLV)
{ {
int item; int item;
item = ListView_GetNextItem(hwndLV, -1, LVNI_FOCUSED | LVNI_SELECTED); 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); return ListView_EditLabel(hwndLV, item);
} }
...@@ -279,8 +297,13 @@ static LRESULT CALLBACK ListWndProc(HWND hWnd, UINT message, WPARAM wParam, LPAR ...@@ -279,8 +297,13 @@ static LRESULT CALLBACK ListWndProc(HWND hWnd, UINT message, WPARAM wParam, LPAR
return CallWindowProc(g_orgListWndProc, hWnd, message, wParam, lParam); return CallWindowProc(g_orgListWndProc, hWnd, message, wParam, lParam);
} }
break; break;
case WM_NOTIFY: case WM_NOTIFY_REFLECT:
switch (((LPNMHDR)lParam)->code) { switch (((LPNMHDR)lParam)->code) {
case LVN_BEGINLABELEDIT:
if (!((NMLVDISPINFO *)lParam)->item.iItem)
return 1;
return 0;
case LVN_GETDISPINFO: case LVN_GETDISPINFO:
OnGetDispInfo((NMLVDISPINFO*)lParam); OnGetDispInfo((NMLVDISPINFO*)lParam);
break; break;
...@@ -297,16 +320,25 @@ static LRESULT CALLBACK ListWndProc(HWND hWnd, UINT message, WPARAM wParam, LPAR ...@@ -297,16 +320,25 @@ static LRESULT CALLBACK ListWndProc(HWND hWnd, UINT message, WPARAM wParam, LPAR
case LVN_ENDLABELEDIT: { case LVN_ENDLABELEDIT: {
LPNMLVDISPINFO dispInfo = (LPNMLVDISPINFO)lParam; LPNMLVDISPINFO dispInfo = (LPNMLVDISPINFO)lParam;
LPTSTR valueName = get_item_text(hWnd, dispInfo->item.iItem); LPTSTR valueName = get_item_text(hWnd, dispInfo->item.iItem);
BOOL res = RenameValue(hWnd, g_currentRootKey, g_currentPath, valueName, dispInfo->item.pszText); LONG ret;
if (res) RefreshListView(hWnd, g_currentRootKey, g_currentPath); 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); 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: { case NM_DBLCLK: {
NMITEMACTIVATE* nmitem = (LPNMITEMACTIVATE)lParam; NMITEMACTIVATE* nmitem = (LPNMITEMACTIVATE)lParam;
LVHITTESTINFO info; 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.idFrom != IDW_LISTVIEW) break; */
/* if (nmitem->hdr.code != ???) break; */ /* if (nmitem->hdr.code != ???) break; */
#ifdef _MSC_VER #ifdef _MSC_VER
...@@ -324,47 +356,25 @@ static LRESULT CALLBACK ListWndProc(HWND hWnd, UINT message, WPARAM wParam, LPAR ...@@ -324,47 +356,25 @@ static LRESULT CALLBACK ListWndProc(HWND hWnd, UINT message, WPARAM wParam, LPAR
info.pt.x = nmitem->ptAction.x; info.pt.x = nmitem->ptAction.x;
info.pt.y = nmitem->ptAction.y; info.pt.y = nmitem->ptAction.y;
if (ListView_HitTest(hWnd, &info) != -1) { if (ListView_HitTest(hWnd, &info) != -1) {
LVITEM item; ListView_SetItemState(hWnd, -1, 0, LVIS_FOCUSED|LVIS_SELECTED);
item.mask = LVIF_PARAM; ListView_SetItemState(hWnd, info.iItem, LVIS_FOCUSED|LVIS_SELECTED,
item.iItem = info.iItem; LVIS_FOCUSED|LVIS_SELECTED);
if (ListView_GetItem(hWnd, &item)) {} SendMessage(hFrameWnd, WM_COMMAND, ID_EDIT_MODIFY, 0);
}
}
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;
} }
} }
break; break;
default: default:
return CallWindowProc(g_orgListWndProc, hWnd, message, wParam, lParam); return 0; /* shouldn't call default ! */
} }
break; break;
case WM_CONTEXTMENU: { case WM_CONTEXTMENU: {
POINTS pt = MAKEPOINTS(lParam); 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), TrackPopupMenu(GetSubMenu(hPopupMenus, cnt == -1 ? PM_NEW : PM_MODIFYVALUE),
TPM_RIGHTBUTTON, pt.x, pt.y, 0, hFrameWnd, NULL); TPM_RIGHTBUTTON, pt.x, pt.y, 0, hFrameWnd, NULL);
break; break;
} }
case WM_KEYDOWN:
if (wParam == VK_TAB) {
/*TODO: SetFocus(Globals.hDriveBar) */
/*SetFocus(child->nFocusPanel? child->left.hWnd: child->right.hWnd); */
}
/* fall thru... */
default: default:
return CallWindowProc(g_orgListWndProc, hWnd, message, wParam, lParam); return CallWindowProc(g_orgListWndProc, hWnd, message, wParam, lParam);
break; break;
...@@ -400,7 +410,7 @@ fail: ...@@ -400,7 +410,7 @@ fail:
return NULL; return NULL;
} }
BOOL RefreshListView(HWND hwndLV, HKEY hKeyRoot, LPCTSTR keyPath) BOOL RefreshListView(HWND hwndLV, HKEY hKeyRoot, LPCTSTR keyPath, LPCTSTR highlightValue)
{ {
BOOL result = FALSE; BOOL result = FALSE;
DWORD max_sub_key_len; DWORD max_sub_key_len;
...@@ -443,20 +453,23 @@ BOOL RefreshListView(HWND hwndLV, HKEY hKeyRoot, LPCTSTR keyPath) ...@@ -443,20 +453,23 @@ BOOL RefreshListView(HWND hwndLV, HKEY hKeyRoot, LPCTSTR keyPath)
valName = HeapAlloc(GetProcessHeap(), 0, max_val_name_len * sizeof(TCHAR)); valName = HeapAlloc(GetProcessHeap(), 0, max_val_name_len * sizeof(TCHAR));
valBuf = HeapAlloc(GetProcessHeap(), 0, max_val_size); valBuf = HeapAlloc(GetProcessHeap(), 0, max_val_size);
/*if (RegQueryValueEx(hKey, NULL, NULL, &dwValType, ValBuf, &dwValSize) == ERROR_SUCCESS) { */ if (RegQueryValueEx(hKey, NULL, NULL, &valType, valBuf, &valSize) == ERROR_FILE_NOT_FOUND) {
/* AddEntryToList(hwndLV, _T("(Default)"), dwValType, ValBuf, dwValSize); */ AddEntryToList(hwndLV, NULL, REG_SZ, NULL, 0, !highlightValue);
/*} */ }
/*dwValSize = max_val_size; */ /*dwValSize = max_val_size; */
for(index = 0; index < val_count; index++) { 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; valNameLen = max_val_name_len;
valSize = max_val_size; valSize = max_val_size;
valType = 0; valType = 0;
errCode = RegEnumValue(hKey, index, valName, &valNameLen, NULL, &valType, valBuf, &valSize); errCode = RegEnumValue(hKey, index, valName, &valNameLen, NULL, &valType, valBuf, &valSize);
if (errCode != ERROR_SUCCESS) goto done; if (errCode != ERROR_SUCCESS) goto done;
valBuf[valSize] = 0; 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; g_currentRootKey = hKeyRoot;
if (keyPath != g_currentPath) { if (keyPath != g_currentPath) {
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#define REGEDIT_DECLARE_FUNCTIONS #define REGEDIT_DECLARE_FUNCTIONS
#include "main.h" #include "main.h"
LPCSTR g_pszDefaultValueName = _T("(Default)");
BOOL ProcessCmdLine(LPSTR lpCmdLine); BOOL ProcessCmdLine(LPSTR lpCmdLine);
...@@ -144,6 +145,15 @@ void ExitInstance(void) ...@@ -144,6 +145,15 @@ void ExitInstance(void)
DestroyMenu(hMenuFrame); 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, int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, LPSTR lpCmdLine,
...@@ -172,8 +182,8 @@ int APIENTRY WinMain(HINSTANCE hInstance, ...@@ -172,8 +182,8 @@ int APIENTRY WinMain(HINSTANCE hInstance,
/* Main message loop */ /* Main message loop */
while (GetMessage(&msg, (HWND)NULL, 0, 0)) { while (GetMessage(&msg, (HWND)NULL, 0, 0)) {
if (!TranslateAccelerator(hFrameWnd, hAccel, &msg) && if (!TranslateAccelerator(hFrameWnd, hAccel, &msg)
!IsDialogMessage(hFrameWnd, &msg)) { && !TranslateChildTabMessage(&msg)) {
TranslateMessage(&msg); TranslateMessage(&msg);
DispatchMessage(&msg); DispatchMessage(&msg);
} }
......
...@@ -37,6 +37,8 @@ ...@@ -37,6 +37,8 @@
#define MAX_NEW_KEY_LEN 128 #define MAX_NEW_KEY_LEN 128
#define WM_NOTIFY_REFLECT (WM_USER+1024)
extern HINSTANCE hInst; extern HINSTANCE hInst;
/******************************************************************************/ /******************************************************************************/
...@@ -76,6 +78,7 @@ extern enum OPTION_FLAGS Options; ...@@ -76,6 +78,7 @@ extern enum OPTION_FLAGS Options;
extern TCHAR szTitle[]; extern TCHAR szTitle[];
extern TCHAR szFrameClass[]; extern TCHAR szFrameClass[];
extern TCHAR szChildClass[]; extern TCHAR szChildClass[];
extern LPCTSTR g_pszDefaultValueName;
/* about.c */ /* about.c */
extern void ShowAboutBox(HWND hWnd); extern void ShowAboutBox(HWND hWnd);
...@@ -90,7 +93,7 @@ extern void UpdateStatusBar(void); ...@@ -90,7 +93,7 @@ extern void UpdateStatusBar(void);
/* listview.c */ /* listview.c */
extern HWND CreateListView(HWND hwndParent, int id); 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 HWND StartValueRename(HWND hwndLV);
extern LPCTSTR GetValueName(HWND hwndLV); extern LPCTSTR GetValueName(HWND hwndLV);
extern BOOL ListWndNotifyProc(HWND hWnd, WPARAM wParam, LPARAM lParam, BOOL *Result); extern BOOL ListWndNotifyProc(HWND hWnd, WPARAM wParam, LPARAM lParam, BOOL *Result);
...@@ -106,7 +109,7 @@ extern HWND StartKeyRename(HWND hwndTV); ...@@ -106,7 +109,7 @@ extern HWND StartKeyRename(HWND hwndTV);
/* edit.c */ /* edit.c */
extern BOOL CreateKey(HWND hwnd, HKEY hKeyRoot, LPCTSTR keyPath, LPTSTR newKeyName); 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 ModifyValue(HWND hwnd, HKEY hKeyRoot, LPCTSTR keyPath, LPCTSTR valueName);
extern BOOL DeleteKey(HWND hwnd, HKEY hKeyRoot, LPCTSTR keyPath); extern BOOL DeleteKey(HWND hwnd, HKEY hKeyRoot, LPCTSTR keyPath);
extern BOOL DeleteValue(HWND hwnd, HKEY hKeyRoot, LPCTSTR keyPath, LPCTSTR valueName); extern BOOL DeleteValue(HWND hwnd, HKEY hKeyRoot, LPCTSTR keyPath, LPCTSTR valueName);
......
...@@ -119,6 +119,7 @@ ...@@ -119,6 +119,7 @@
#define IDS_NEWVALUE 32861 #define IDS_NEWVALUE 32861
#define IDS_BAD_KEY 32862 #define IDS_BAD_KEY 32862
#define ID_EDIT_MODIFY_BIN 32870 #define ID_EDIT_MODIFY_BIN 32870
#define ID_SWITCH_PANELS 32871
#define IDD_EDIT_STRING 2000 #define IDD_EDIT_STRING 2000
#define IDC_VALUE_NAME 2001 #define IDC_VALUE_NAME 2001
......
...@@ -31,6 +31,7 @@ IDC_REGEDIT ACCELERATORS ...@@ -31,6 +31,7 @@ IDC_REGEDIT ACCELERATORS
"^P", ID_REGISTRY_PRINT "^P", ID_REGISTRY_PRINT
VK_DELETE, ID_EDIT_DELETE, VIRTKEY VK_DELETE, ID_EDIT_DELETE, VIRTKEY
VK_F1, ID_HELP_HELPTOPICS, VIRTKEY VK_F1, ID_HELP_HELPTOPICS, VIRTKEY
VK_F2, ID_EDIT_RENAME, VIRTKEY
VK_F3, ID_EDIT_FINDNEXT, VIRTKEY VK_F3, ID_EDIT_FINDNEXT, VIRTKEY
VK_F5, ID_VIEW_REFRESH, VIRTKEY VK_F5, ID_VIEW_REFRESH, VIRTKEY
} }
......
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