Commit 05e6a4e6 authored by Alexander Nicolaysen Sørnes's avatar Alexander Nicolaysen Sørnes Committed by Alexandre Julliard

wordpad: Add support for printing a page range.

parent cd97bf4e
......@@ -936,6 +936,7 @@ static void print(LPPRINTDLGW pd)
FORMATRANGE fr;
DOCINFOW di;
int dpiY, dpiX, width, height;
int printedPages = 0;
fr.hdc = pd->hDC;
fr.hdcTarget = pd->hDC;
......@@ -975,6 +976,18 @@ static void print(LPPRINTDLGW pd)
gt.codepage = 1200;
fr.chrg.cpMin = 0;
fr.chrg.cpMax = SendMessageW(hEditorWnd, EM_GETTEXTLENGTHEX, (WPARAM)&gt, 0);
if(pd->Flags & PD_PAGENUMS)
{
int i;
for(i = 1; i <= pd->nToPage; i++)
{
if(i == pd->nFromPage)
break;
fr.chrg.cpMin = SendMessageW(hEditorWnd, EM_FORMATRANGE, TRUE, (LPARAM)&fr);
}
}
}
StartDocW(fr.hdc, &di);
......@@ -987,6 +1000,10 @@ static void print(LPPRINTDLGW pd)
if(EndPage(fr.hdc) <= 0)
break;
printedPages++;
if((pd->Flags & PD_PAGENUMS) && (printedPages > (pd->nToPage - pd->nFromPage)))
break;
}
while(fr.chrg.cpMin < fr.chrg.cpMax);
......@@ -1061,7 +1078,7 @@ static void dialog_print(void)
pd.hwndOwner = hMainWnd;
pd.Flags = PD_RETURNDC | PD_USEDEVMODECOPIESANDCOLLATE;
pd.nMinPage = 1;
pd.nMaxPage = 1;
pd.nMaxPage = -1;
pd.hDevMode = devMode;
pd.hDevNames = devNames;
......
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