]> git.saurik.com Git - wxWidgets.git/blobdiff - src/richtext/richtextprint.cpp
Compile fixes for wxUSE_COLLPANE=0
[wxWidgets.git] / src / richtext / richtextprint.cpp
index 9855d5796647aac74e0e8fe369ef77489dd402d0..b491ac947b33b9a94581d0e4314f6ea3cb4fe36a 100644 (file)
@@ -67,7 +67,8 @@ void wxRichTextPrintout::OnPreparePrinting()
     {
         GetRichTextBuffer()->Invalidate(wxRICHTEXT_ALL);
 
-        GetRichTextBuffer()->Layout(*GetDC(), rect, wxRICHTEXT_FIXED_WIDTH|wxRICHTEXT_VARIABLE_HEIGHT);
+        wxRichTextDrawingContext context(GetRichTextBuffer());
+        GetRichTextBuffer()->Layout(*GetDC(), context, rect, rect, wxRICHTEXT_FIXED_WIDTH|wxRICHTEXT_VARIABLE_HEIGHT);
 
         // Now calculate the page breaks
 
@@ -115,18 +116,18 @@ void wxRichTextPrintout::OnPreparePrinting()
                         lastLine = line;
 
                         m_numPages ++;
-                        
+
                         // Now create page breaks for the rest of the line, if it's larger than the page height
                         int contentLeft = line->GetSize().y - rect.GetHeight();
                         while (contentLeft >= 0)
                         {
                             yOffset += rect.GetHeight();
                             contentLeft -= rect.GetHeight();
-                            
+
                             m_pageBreaksStart.Add(lastStartPos);
                             m_pageBreaksEnd.Add(lastLine->GetAbsoluteRange().GetEnd());
                             m_pageYOffsets.Add(yOffset);
-                        }                        
+                        }
                     }
 
                     lastLine = line;
@@ -194,11 +195,11 @@ void wxRichTextPrintout::RenderPage(wxDC *dc, int page)
 
     if (page > 1 || m_headerFooterData.GetShowOnFirstPage())
     {
-        if (m_headerFooterData.GetFont().Ok())
+        if (m_headerFooterData.GetFont().IsOk())
             dc->SetFont(m_headerFooterData.GetFont());
         else
             dc->SetFont(*wxNORMAL_FONT);
-        if (m_headerFooterData.GetTextColour().Ok())
+        if (m_headerFooterData.GetTextColour().IsOk())
             dc->SetTextForeground(m_headerFooterData.GetTextColour());
         else
             dc->SetTextForeground(*wxBLACK);
@@ -286,7 +287,7 @@ void wxRichTextPrintout::RenderPage(wxDC *dc, int page)
     }
 
     wxRichTextRange rangeToDraw(m_pageBreaksStart[page-1], m_pageBreaksEnd[page-1]);
-    
+
     wxPoint oldOrigin = dc->GetLogicalOrigin();
     double scaleX, scaleY;
     dc->GetUserScale(& scaleX, & scaleY);
@@ -294,13 +295,14 @@ void wxRichTextPrintout::RenderPage(wxDC *dc, int page)
     int yOffset = 0;
     if (page > 1)
         yOffset = m_pageYOffsets[page-2];
-        
+
     if (yOffset != oldOrigin.y)
         dc->SetLogicalOrigin(oldOrigin.x, oldOrigin.y + yOffset);
 
     dc->SetClippingRegion(wxRect(textRect.x, textRect.y + yOffset, textRect.width, textRect.height));
 
-    GetRichTextBuffer()->Draw(*dc, rangeToDraw, wxRichTextSelection(), textRect, 0 /* descent */, wxRICHTEXT_DRAW_IGNORE_CACHE|wxRICHTEXT_DRAW_PRINT /* flags */);
+    wxRichTextDrawingContext context(GetRichTextBuffer());
+    GetRichTextBuffer()->Draw(*dc, context, rangeToDraw, wxRichTextSelection(), textRect, 0 /* descent */, wxRICHTEXT_DRAW_IGNORE_CACHE|wxRICHTEXT_DRAW_PRINT /* flags */);
 
     dc->DestroyClippingRegion();
 
@@ -371,7 +373,7 @@ void wxRichTextPrintout::CalculateScaling(wxDC* dc, wxRect& textRect, wxRect& he
         !m_headerFooterData.GetHeaderText(wxRICHTEXT_PAGE_EVEN, wxRICHTEXT_PAGE_CENTRE).IsEmpty() ||
         !m_headerFooterData.GetHeaderText(wxRICHTEXT_PAGE_EVEN, wxRICHTEXT_PAGE_RIGHT).IsEmpty())
     {
-        if (m_headerFooterData.GetFont().Ok())
+        if (m_headerFooterData.GetFont().IsOk())
             dc->SetFont(m_headerFooterData.GetFont());
         else
             dc->SetFont(*wxNORMAL_FONT);
@@ -396,7 +398,7 @@ void wxRichTextPrintout::CalculateScaling(wxDC* dc, wxRect& textRect, wxRect& he
         !m_headerFooterData.GetFooterText(wxRICHTEXT_PAGE_EVEN, wxRICHTEXT_PAGE_CENTRE).IsEmpty() ||
         !m_headerFooterData.GetFooterText(wxRICHTEXT_PAGE_EVEN, wxRICHTEXT_PAGE_RIGHT).IsEmpty())
     {
-        if (m_headerFooterData.GetFont().Ok())
+        if (m_headerFooterData.GetFont().IsOk())
             dc->SetFont(m_headerFooterData.GetFont());
         else
             dc->SetFont(*wxNORMAL_FONT);
@@ -475,7 +477,7 @@ void wxRichTextPrinting::SetPrintData(const wxPrintData& printData)
     (*GetPrintData()) = printData;
 }
 
-void wxRichTextPrinting::SetPageSetupData(const wxPageSetupData& pageSetupData)
+void wxRichTextPrinting::SetPageSetupData(const wxPageSetupDialogData& pageSetupData)
 {
     (*GetPageSetupData()) = pageSetupData;
 }
@@ -570,7 +572,7 @@ bool wxRichTextPrinting::DoPreview(wxRichTextPrintout *printout1, wxRichTextPrin
     // Pass two printout objects: for preview, and possible printing.
     wxPrintDialogData printDialogData(*GetPrintData());
     wxPrintPreview *preview = new wxPrintPreview(printout1, printout2, &printDialogData);
-    if (!preview->Ok())
+    if (!preview->IsOk())
     {
         delete preview;
         return false;
@@ -601,7 +603,7 @@ bool wxRichTextPrinting::DoPrint(wxRichTextPrintout *printout)
 
 void wxRichTextPrinting::PageSetup()
 {
-    if (!GetPrintData()->Ok())
+    if (!GetPrintData()->IsOk())
     {
         wxLogError(_("There was a problem during page setup: you may need to set a default printer."));
         return;