[FONTVIEW]
authorEric Kohl <eric.kohl@reactos.org>
Thu, 16 Mar 2017 23:36:08 +0000 (23:36 +0000)
committerEric Kohl <eric.kohl@reactos.org>
Thu, 16 Mar 2017 23:36:08 +0000 (23:36 +0000)
Implement fontview /p parameter support.
Patch by amber. Patch was slightly modified by me in order to open the print dialog automatically.
CORE-12944 #resolve #comment Thanks a lot!

svn path=/trunk/; revision=74183

reactos/base/applications/fontview/fontview.c

index 654f6a9..fe0bf8a 100644 (file)
@@ -37,6 +37,7 @@ INT g_NumFonts = 0;
 LOGFONTW g_LogFonts[64];
 LPCWSTR g_fileName;
 WCHAR g_FontTitle[1024] = L"";
+BOOL g_FontPrint = FALSE;
 
 static const WCHAR g_szFontViewClassName[] = L"FontViewWClass";
 
@@ -156,7 +157,24 @@ wWinMain(HINSTANCE hThisInstance,
        else
        {
                /* Try to add the font resource from command line */
-               fileName = argv[1];
+//             fileName = argv[1];
+               if (argc == 2)
+               {
+                       fileName = argv[1];
+               }
+               else
+               {
+                       /* Windows fontview supports the /p option, which displays print dialog */
+                       fileName = argv[2];
+                       if (wcscmp(argv[1], L"/p") == 0)
+                       {
+                               g_FontPrint = TRUE;
+                       }
+                       else
+                       {
+                               fileName = argv[1];
+                       }
+               }
                g_fileName = fileName;
        }
 
@@ -361,6 +379,9 @@ MainWnd_OnCreate(HWND hwnd)
        SendMessage(hDisplay, FVM_SETTYPEFACE, 0, (LPARAM)&g_LogFonts[g_FontIndex]);
        ShowWindow(hDisplay, SW_SHOWNORMAL);
 
+       if (g_FontPrint)
+               PostMessage(hwnd, WM_COMMAND, IDC_PRINT, 0);
+
        return 0;
 }