comparison win/dw.c @ 1140:1c63bf62e0b0

Fix for issues in printing pages on Windows.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Fri, 09 Sep 2011 21:05:57 +0000
parents 65b750569a0a
children b1b23de965d7
comparison
equal deleted inserted replaced
1139:65b750569a0a 1140:1c63bf62e0b0
10020 print->drawdata = drawdata; 10020 print->drawdata = drawdata;
10021 print->pd.lStructSize = sizeof(PRINTDLG); 10021 print->pd.lStructSize = sizeof(PRINTDLG);
10022 print->pd.hwndOwner = HWND_DESKTOP; 10022 print->pd.hwndOwner = HWND_DESKTOP;
10023 print->pd.Flags = PD_USEDEVMODECOPIESANDCOLLATE | PD_RETURNDC; 10023 print->pd.Flags = PD_USEDEVMODECOPIESANDCOLLATE | PD_RETURNDC;
10024 print->pd.nCopies = 1; 10024 print->pd.nCopies = 1;
10025 print->pd.nFromPage = 0xFFFF; 10025 print->pd.nFromPage = 1;
10026 print->pd.nToPage = 0xFFFF; 10026 print->pd.nToPage = pages;
10027 print->pd.nMinPage = 1; 10027 print->pd.nMinPage = 1;
10028 print->pd.nMaxPage = pages; 10028 print->pd.nMaxPage = pages;
10029 10029
10030 if(!PrintDlg(&(print->pd))) 10030 if(!PrintDlg(&(print->pd)))
10031 { 10031 {
10061 pixmap->width = GetDeviceCaps(p->pd.hDC, PHYSICALWIDTH); 10061 pixmap->width = GetDeviceCaps(p->pd.hDC, PHYSICALWIDTH);
10062 pixmap->height = GetDeviceCaps(p->pd.hDC, PHYSICALHEIGHT); 10062 pixmap->height = GetDeviceCaps(p->pd.hDC, PHYSICALHEIGHT);
10063 10063
10064 /*pixmap->handle = handle;*/ 10064 /*pixmap->handle = handle;*/
10065 pixmap->hbm = CreateCompatibleBitmap(p->pd.hDC, pixmap->width, pixmap->height); 10065 pixmap->hbm = CreateCompatibleBitmap(p->pd.hDC, pixmap->width, pixmap->height);
10066 pixmap->hdc = CreateCompatibleDC(p->pd.hDC); 10066 pixmap->hdc = p->pd.hDC;
10067 pixmap->transcolor = DW_RGB_TRANSPARENT; 10067 pixmap->transcolor = DW_RGB_TRANSPARENT;
10068 10068
10069 SelectObject(pixmap->hdc, pixmap->hbm); 10069 SelectObject(pixmap->hdc, pixmap->hbm);
10070 10070
10071 /* Start the job */ 10071 /* Start the job */
10072 StartDoc(p->pd.hDC, &(p->di)); 10072 StartDoc(p->pd.hDC, &(p->di));
10073 10073
10074 /* Cycle through each page */ 10074 /* Cycle through each page */
10075 for(x=p->pd.nFromPage; x<p->pd.nToPage && p->drawfunc; x++) 10075 for(x=p->pd.nFromPage-1; x<p->pd.nToPage && p->drawfunc; x++)
10076 { 10076 {
10077 StartPage(p->pd.hDC); 10077 StartPage(p->pd.hDC);
10078 p->drawfunc(print, pixmap, x-1, p->drawdata); 10078 p->drawfunc(print, pixmap, x, p->drawdata);
10079 EndPage(p->pd.hDC); 10079 EndPage(p->pd.hDC);
10080 } 10080 }
10081 EndDoc(p->pd.hDC); 10081 EndDoc(p->pd.hDC);
10082 /* Free memory */ 10082 /* Free memory */
10083 dw_pixmap_destroy(pixmap); 10083 dw_pixmap_destroy(pixmap);