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
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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -28,7 +28,7 @@ IDC_REGEDIT MENU DISCARDABLE
BEGIN
POPUP "&Plik"
BEGIN
MENUITEM "Za&kocz", ID_REGISTRY_EXIT
MENUITEM "Za&kocz", 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 "&Podcz rejestr sieciowy...",ID_REGISTRY_CONNECTNETWORKREGISTRY, GRAYED
MENUITEM "&Odcz rejestr sieciowy...", ID_REGISTRY_DISCONNECTNETWORKREGISTRY, GRAYED
MENUITEM "&Podcz rejestr sieciowy...",ID_REGISTRY_CONNECTNETWORKREGISTRY, GRAYED
MENUITEM "&Odcz rejestr sieciowy...", ID_REGISTRY_DISCONNECTNETWORKREGISTRY, GRAYED
MENUITEM SEPARATOR
MENUITEM "&Drukuj\tCtrl+P", ID_REGISTRY_PRINT, GRAYED
MENUITEM SEPARATOR
MENUITEM "Za&kocz", ID_REGISTRY_EXIT
MENUITEM "Za&kocz", 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\tDel", ID_EDIT_DELETE
MENUITEM "Z&mie nazw", ID_EDIT_RENAME
MENUITEM "U&su\tDel", ID_EDIT_DELETE
MENUITEM "Z&mie nazw\tF2", ID_EDIT_RENAME
MENUITEM SEPARATOR
MENUITEM "&Kopiuj nazw klucza", ID_EDIT_COPYKEYNAME
MENUITEM "&Kopiuj nazw klucza", ID_EDIT_COPYKEYNAME
MENUITEM SEPARATOR
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
POPUP "&Widok"
BEGIN
......@@ -77,13 +77,13 @@ BEGIN
MENUITEM SEPARATOR
MENUITEM "Po&dziel", ID_VIEW_SPLIT
MENUITEM SEPARATOR
MENUITEM "&Odwie\tF5", ID_VIEW_REFRESH
MENUITEM "&Odwie\tF5", ID_VIEW_REFRESH
END
POPUP "&Ulubione"
BEGIN
MENUITEM "&Dodaj do ulubionych", ID_FAVOURITES_ADDTOFAVOURITES
, GRAYED
MENUITEM "&Usu 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\tDel", ID_EDIT_DELETE
MENUITEM "&Zmie nazw", 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:",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:",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 "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
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"
IDS_LIST_COLUMN_DATA "Warto"
END
STRINGTABLE DISCARDABLE
......@@ -183,57 +183,57 @@ END
STRINGTABLE DISCARDABLE
BEGIN
ID_REGISTRY_MENU "Zawiera polecenia operujce na caym rejestrze"
ID_EDIT_MENU "Zawiera polecenia dotyczce edycji kluczy i danych"
ID_VIEW_MENU "Zawiera polecenia dotyczce wygldu programu"
ID_FAVOURITES_MENU "Zawiera polecenia dotyczce skrtw do kluczy rejestru"
ID_HELP_MENU "Zawiera polecenia wywietlajce informacje o programie"
ID_EDIT_NEW_MENU "Zawiera polecenia tworzce nowe klucze i dane"
ID_REGISTRY_MENU "Zawiera polecenia operujce na caym rejestrze"
ID_EDIT_MENU "Zawiera polecenia dotyczce edycji kluczy i danych"
ID_VIEW_MENU "Zawiera polecenia dotyczce wygldu programu"
ID_FAVOURITES_MENU "Zawiera polecenia dotyczce skrtw do kluczy rejestru"
ID_HELP_MENU "Zawiera polecenia wywietlajce informacje o programie"
ID_EDIT_NEW_MENU "Zawiera polecenia tworzce nowe klucze i dane"
END
STRINGTABLE DISCARDABLE
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_STRINGVALUE "Dodaje now dan tekstow"
ID_EDIT_NEW_BINARYVALUE "Dodaje now dan binarn"
ID_EDIT_NEW_DWORDVALUE "Dodaje now dan liczbow"
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 lub cao rejestru do pliku tekstowego"
"Eksportuje cz lub cao rejestru do pliku tekstowego"
ID_REGISTRY_CONNECTNETWORKREGISTRY
"czy si do rejestru innego komputera"
"czy si do rejestru innego komputera"
ID_REGISTRY_DISCONNECTNETWORKREGISTRY
"Odcza si od rejestru innego komputera"
ID_REGISTRY_PRINT "Drukuje cao lub cz rejestru"
"Odcza si od rejestru innego komputera"
ID_REGISTRY_PRINT "Drukuje cao lub cz rejestru"
/* 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
STRINGTABLE DISCARDABLE
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_REMOVEFAVOURITE "Usuwa klucze z listy ulubionych"
ID_VIEW_STATUSBAR "Wywietla lub ukrywa pasek stanu"
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_RENAME "Zmienia nazw zaznaczonego obiektu"
ID_EDIT_COPYKEYNAME "Kopiuje nazw zaznaczonego klucza do schowka"
ID_EDIT_FIND "Znajduje cig znakw w kluczu lub danej"
ID_EDIT_FINDNEXT "Znajduje nastpne wystpienie ostatnio szukanego cigu"
ID_EDIT_RENAME "Zmienia nazw zaznaczonego obiektu"
ID_EDIT_COPYKEYNAME "Kopiuje nazw zaznaczonego klucza do schowka"
ID_EDIT_FIND "Znajduje cig znakw w kluczu lub danej"
ID_EDIT_FINDNEXT "Znajduje nastpne wystpienie ostatnio szukanego cigu"
END
STRINGTABLE DISCARDABLE
BEGIN
IDS_ERROR "Bd"
IDS_BAD_KEY "Nie udao sie przeczyta klucza '%s'"
IDS_BAD_VALUE "Nie udao sie przeczyta danej '%s'"
IDS_UNSUPPORTED_TYPE "Nie da si modyfikowa kluczy tego typu (%ld)"
IDS_TOO_BIG_VALUE "Warto jest zbyt dua (%ld)"
IDS_ERROR "Bd"
IDS_BAD_KEY "Nie udao sie przeczyta klucza '%s'"
IDS_BAD_VALUE "Nie udao sie przeczyta danej '%s'"
IDS_UNSUPPORTED_TYPE "Nie da si modyfikowa kluczy tego typu (%ld)"
IDS_TOO_BIG_VALUE "Warto jest zbyt dua (%ld)"
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_NEWVALUE "Nowa dana #%d"
END
......
......@@ -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
......
......@@ -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
......
......@@ -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 kljua", ID_EDIT_COPYKEYNAME
MENUITEM SEPARATOR
......
......@@ -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;
}
}
......
......@@ -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);
......
......@@ -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;
......
......@@ -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);
}
......
......@@ -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);
......
......@@ -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
......
......@@ -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
}
......
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