X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/72cdf4c9b3ce92addf09cfb322f0c19bfb0f8744..7b9da2077d0975db6c965a85c91d5aca671ab5e3:/src/html/htmprint.cpp diff --git a/src/html/htmprint.cpp b/src/html/htmprint.cpp index 30b3dc23b3..f7072abf46 100644 --- a/src/html/htmprint.cpp +++ b/src/html/htmprint.cpp @@ -1,3 +1,4 @@ + ///////////////////////////////////////////////////////////////////////////// // Name: htmprint.cpp // Purpose: html printing classes @@ -16,6 +17,8 @@ // For compilers that support precompilation, includes "wx/wx.h". #include "wx/wxprec.h" +#include "wx/defs.h" + #ifdef __BORLANDC__ #pragma hdrstop #endif @@ -104,12 +107,13 @@ void wxHtmlDCRenderer::SetHtmlText(const wxString& html, const wxString& basepat int wxHtmlDCRenderer::Render(int x, int y, int from, int dont_render) { - int pbreak; + int pbreak, hght; if (m_Cells == NULL || m_DC == NULL) return 0; pbreak = (int)(from * m_Scale + m_Height); while (m_Cells -> AdjustPagebreak(&pbreak)) {} + hght = pbreak - (int)(from * m_Scale); if (!dont_render) { int w, h; @@ -119,10 +123,10 @@ int wxHtmlDCRenderer::Render(int x, int y, int from, int dont_render) m_DC -> SetBrush(*wxWHITE_BRUSH); - m_DC -> SetClippingRegion(x * m_Scale, y * m_Scale, m_Width, m_Height); + m_DC -> SetClippingRegion(x * m_Scale, y * m_Scale, m_Width, hght); m_Cells -> Draw(*m_DC, x * m_Scale, (y - from) * m_Scale, - y * m_Scale, pbreak + (y - from) * m_Scale); + y * m_Scale, pbreak + (y /*- from*/) * m_Scale); m_DC -> DestroyClippingRegion(); } @@ -181,12 +185,12 @@ wxHtmlPrintout::~wxHtmlPrintout() -void wxHtmlPrintout::OnBeginPrinting() +bool wxHtmlPrintout::OnBeginDocument(int startPage, int endPage) { int pageWidth, pageHeight, mm_w, mm_h; float ppmm_h, ppmm_v; - wxPrintout::OnBeginPrinting(); + if (!wxPrintout::OnBeginDocument(startPage, endPage)) return FALSE; GetPageSizePixels(&pageWidth, &pageHeight); GetPageSizeMM(&mm_w, &mm_h); @@ -225,6 +229,7 @@ void wxHtmlPrintout::OnBeginPrinting() ); m_Renderer -> SetHtmlText(m_Document, m_BasePath, m_BasePathIsDir); CountPages(); + return TRUE; } @@ -368,11 +373,11 @@ wxString wxHtmlPrintout::TranslateHeader(const wxString& instr, int page) wxString r = instr; wxString num; - num.Printf("%i", page); - r.Replace("@PAGENUM@", num); + num.Printf(wxT("%i"), page); + r.Replace(wxT("@PAGENUM@"), num); - num.Printf("%i", m_NumPages); - r.Replace("@PAGESCNT@", num); + num.Printf(wxT("%i"), m_NumPages); + r.Replace(wxT("@PAGESCNT@"), num); return r; } @@ -403,16 +408,15 @@ wxHtmlEasyPrinting::wxHtmlEasyPrinting(const wxString& name, wxFrame *parent_fra m_Frame = parent_frame; m_Name = name; m_PrintData = new wxPrintData; +#if (defined __WXGTK__) || (defined __WXMOTIF__) + (*m_PrintData) = (*wxThePrintSetupData); +#endif m_PageSetupData = new wxPageSetupDialogData; m_Headers[0] = m_Headers[1] = m_Footers[0] = m_Footers[1] = wxEmptyString; m_PageSetupData -> EnableMargins(TRUE); m_PageSetupData -> SetMarginTopLeft(wxPoint(25, 25)); m_PageSetupData -> SetMarginBottomRight(wxPoint(25, 25)); - -#if defined(__WXGTK__) || defined(__WXMOTIF__) - m_PrintData -> SetPrinterCommand("lpr"); -#endif }