* Unicode fixes to regedit
authorGregor Brunmar <gbrunmar.ros@gmail.com>
Sun, 30 Sep 2007 13:23:31 +0000 (13:23 +0000)
committerGregor Brunmar <gbrunmar.ros@gmail.com>
Sun, 30 Sep 2007 13:23:31 +0000 (13:23 +0000)
* Fixed bug 2494
Patch by Carlo Bramix [carlo (dot) bramix (at) libero (dot) it].
See issue #2494 for more details.

svn path=/trunk/; revision=29308

reactos/base/applications/regedit/childwnd.c
reactos/base/applications/regedit/framewnd.c
reactos/base/applications/regedit/regproc.c
reactos/base/applications/regedit/treeview.c

index b283e43..3875c31 100644 (file)
@@ -202,7 +202,7 @@ static void SuggestKeys(HKEY hRootKey, LPCTSTR pszKeyPath, LPTSTR pszSuggestions
        iSuggestionsLength--;
 
        /* Are we a root key in HKEY_CLASSES_ROOT? */
-       if ((hRootKey == HKEY_CLASSES_ROOT) && pszKeyPath[0] && !_tcschr(pszKeyPath, '\\'))
+       if ((hRootKey == HKEY_CLASSES_ROOT) && pszKeyPath[0] && !_tcschr(pszKeyPath, TEXT('\\')))
        {
                do
                {
index 5f09e17..4f74693 100644 (file)
@@ -150,7 +150,7 @@ static void OnMenuSelect(HWND hWnd, UINT nItemID, UINT nFlags, HMENU hSysMenu)
         /* load appropriate string*/
         LPTSTR lpsz = str;
         /* first newline terminates actual string*/
-        lpsz = _tcschr(lpsz, '\n');
+        lpsz = _tcschr(lpsz, _T('\n'));
         if (lpsz != NULL)
             *lpsz = '\0';
     }
@@ -877,7 +877,7 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
         if (lRet != ERROR_SUCCESS) hKey = 0;
     }
 
-     switch (LOWORD(wParam)) {
+    switch (LOWORD(wParam)) {
     case ID_EDIT_MODIFY:
         if (valueName && ModifyValue(hWnd, hKey, valueName, FALSE))
             RefreshListView(g_pChildWnd->hListWnd, hKeyRoot, keyPath);
@@ -887,13 +887,23 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
             RefreshListView(g_pChildWnd->hListWnd, hKeyRoot, keyPath);
         break;
     case ID_EDIT_RENAME:
-        if(ListView_GetSelectedCount(g_pChildWnd->hListWnd) == 1)
+        if (GetFocus() == g_pChildWnd->hListWnd)
         {
-          item = ListView_GetNextItem(g_pChildWnd->hListWnd, -1, LVNI_SELECTED);
-          if(item > -1)
-          {
-            (void)ListView_EditLabel(g_pChildWnd->hListWnd, item);
-          }
+            if(ListView_GetSelectedCount(g_pChildWnd->hListWnd) == 1)
+            {
+                item = ListView_GetNextItem(g_pChildWnd->hListWnd, -1, LVNI_SELECTED);
+                if(item > -1)
+                {
+                    (void)ListView_EditLabel(g_pChildWnd->hListWnd, item);
+                }
+            }
+        }
+        if (GetFocus() == g_pChildWnd->hTreeWnd)
+        {
+            /* Get focused entry of treeview (if any) */
+            HTREEITEM hItem = TreeView_GetSelection(g_pChildWnd->hTreeWnd);
+            if (hItem != NULL)
+                (void)TreeView_EditLabel(g_pChildWnd->hTreeWnd, hItem);
         }
         break;
     case ID_EDIT_DELETE:
index 78d2f65..5b360b5 100644 (file)
@@ -1735,7 +1735,7 @@ static LONG RegNextKey(HKEY hKey, LPTSTR lpSubKey, size_t iSubKeyLength)
         /* Go up and find the next sibling key */
         do
         {
-            s = _tcsrchr(lpSubKey, '\\');
+            s = _tcsrchr(lpSubKey, TEXT('\\'));
             if (s)
             {
                 *s = '\0';
@@ -1832,7 +1832,7 @@ LONG RegSearch(HKEY hKey, LPTSTR lpSubKey, size_t iSubKeyLength,
         if (lResult != ERROR_SUCCESS)
             return lResult;
 
-        s = _tcsrchr(lpSubKey, '\\');
+        s = _tcsrchr(lpSubKey, TEXT('\\'));
         s = s ? s + 1 : lpSubKey;
     }
     while(!(dwSearchFlags & RSF_LOOKATKEYS) || !RegSearchCompare(s, pszSearchString, dwSearchFlags));
@@ -1871,3 +1871,4 @@ BOOL RegKeyGetName(LPTSTR pszDest, size_t iDestLength, HKEY hRootKey, LPCTSTR lp
 }
 
 
+
index dc696c0..884da97 100644 (file)
@@ -602,7 +602,7 @@ BOOL SelectNode(HWND hwndTV, LPCTSTR keyPath)
 
        while(keyPath[0])
        {
-               s = _tcschr(keyPath, '\\');
+               s = _tcschr(keyPath, TEXT('\\'));
                lstrcpyn(szPathPart, keyPath, s ? s - keyPath + 1 : _tcslen(keyPath) + 1);
 
                /* Special case for root to expand root key abbreviations */
@@ -656,3 +656,4 @@ BOOL SelectNode(HWND hwndTV, LPCTSTR keyPath)
        return TRUE;
 }
 
+