[FONTVIEW]

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
This commit is contained in:
Eric Kohl 2017-03-16 23:36:08 +00:00
parent c3297be6ce
commit e17745ee73

View 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;
}