[CHARMAP]
authorEric Kohl <eric.kohl@reactos.org>
Tue, 5 Apr 2016 20:29:48 +0000 (20:29 +0000)
committerEric Kohl <eric.kohl@reactos.org>
Tue, 5 Apr 2016 20:29:48 +0000 (20:29 +0000)
Statusbar character descriptions.
Patch by Baruch Rutman.
CORE-7386 #resolve #comment Thanks a lot!

svn path=/trunk/; revision=71104

reactos/base/applications/charmap/charmap.c
reactos/base/applications/charmap/lrgcell.c
reactos/base/applications/charmap/precomp.h

index 3fd96aa..f233863 100644 (file)
@@ -24,6 +24,10 @@ HICON     hSmIcon;
 HICON     hBgIcon;
 SETTINGS  Settings;
 
+/* GetUName prototype */
+typedef int (WINAPI * GETUNAME)(WORD wCharCode, LPWSTR lpbuf);
+GETUNAME GetUName;
+
 /* Font-enumeration callback */
 static
 int
@@ -257,6 +261,20 @@ UpdateSettings(HWND hDlg)
 }
 #endif
 
+VOID
+UpdateStatusBar(WCHAR wch)
+{
+    WCHAR buff[MAX_PATH];
+    WCHAR szDesc[MAX_PATH];
+
+    if (GetUName)
+    {
+        GetUName(wch, szDesc);
+        wsprintfW(buff, L"U+%04X: %s", wch, szDesc);
+        SendMessageW(hStatusWnd, SB_SETTEXT, 0, (LPARAM)buff);
+    }
+}
+
 static
 void
 ChangeView(HWND hWnd)
@@ -571,6 +589,7 @@ wWinMain(HINSTANCE hInst,
     INT Ret = 1;
     HMODULE hRichEd20;
     MSG Msg;
+    HINSTANCE hGetUName = NULL;
 
     hInstance = hInst;
 
@@ -578,6 +597,18 @@ wWinMain(HINSTANCE hInst,
     iccx.dwICC = ICC_TAB_CLASSES;
     InitCommonControlsEx(&iccx);
 
+    /* Loading the GetUName function */
+    hGetUName = LoadLibraryW(L"getuname.dll");
+    if (hGetUName != NULL)
+    {
+        GetUName = (GETUNAME) GetProcAddress(hGetUName, "GetUName");
+        if (GetUName == NULL)
+        {
+            FreeLibrary(hGetUName);
+            hGetUName = NULL;
+        }
+    }
+
     if (RegisterMapClasses(hInstance))
     {
         hRichEd20 = LoadLibraryW(L"RICHED20.DLL");
@@ -603,5 +634,8 @@ wWinMain(HINSTANCE hInst,
         UnregisterMapClasses(hInstance);
     }
 
+    if (hGetUName != NULL)
+        FreeLibrary(hGetUName);
+
     return Ret;
 }
index db68df6..3351d22 100644 (file)
@@ -140,6 +140,7 @@ LrgCellWndProc(HWND hwnd,
             EndPaint(hwnd,
                      &ps);
 
+            UpdateStatusBar(infoPtr->pActiveCell->ch);
             break;
         }
 
index 872cbe2..0ade7aa 100644 (file)
@@ -74,6 +74,7 @@ BOOL RegisterMapClasses(HINSTANCE hInstance);
 VOID UnregisterMapClasses(HINSTANCE hInstance);
 
 /* charmap.c */
+VOID UpdateStatusBar(WCHAR wch);
 extern VOID ChangeMapFont(HWND hDlg);
 
 /* settings.c */