1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: Printing framework base class implementation
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart and Markus Holzem
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
13 #pragma implementation "prntbase.h"
16 // For compilers that support precompilation, includes "wx.h".
17 #include "wx/wxprec.h"
25 #if wxUSE_PRINTING_ARCHITECTURE
31 #include "wx/msgdlg.h"
32 #include "wx/layout.h"
33 #include "wx/choice.h"
34 #include "wx/button.h"
35 #include "wx/settings.h"
36 #include "wx/dcmemory.h"
37 #include "wx/stattext.h"
39 #include "wx/textdlg.h"
42 #include "wx/prntbase.h"
43 #include "wx/dcprint.h"
44 #include "wx/printdlg.h"
45 #include "wx/module.h"
53 #include "wx/msw/private.h"
61 IMPLEMENT_CLASS(wxPrinterBase
, wxObject
)
62 IMPLEMENT_ABSTRACT_CLASS(wxPrintout
, wxObject
)
63 IMPLEMENT_CLASS(wxPreviewCanvas
, wxWindow
)
64 IMPLEMENT_CLASS(wxPreviewControlBar
, wxWindow
)
65 IMPLEMENT_CLASS(wxPreviewFrame
, wxFrame
)
66 IMPLEMENT_CLASS(wxPrintPreviewBase
, wxObject
)
68 BEGIN_EVENT_TABLE(wxPrintAbortDialog
, wxDialog
)
69 EVT_BUTTON(wxID_CANCEL
, wxPrintAbortDialog::OnCancel
)
72 BEGIN_EVENT_TABLE(wxPreviewCanvas
, wxScrolledWindow
)
73 EVT_PAINT(wxPreviewCanvas::OnPaint
)
74 EVT_SYS_COLOUR_CHANGED(wxPreviewCanvas::OnSysColourChanged
)
81 wxPrinterBase::wxPrinterBase(wxPrintDialogData
*data
)
83 m_currentPrintout
= (wxPrintout
*) NULL
;
84 sm_abortWindow
= (wxWindow
*) NULL
;
87 m_printDialogData
= (*data
);
88 sm_lastError
= wxPRINTER_NO_ERROR
;
91 wxWindow
*wxPrinterBase::sm_abortWindow
= (wxWindow
*) NULL
;
92 bool wxPrinterBase::sm_abortIt
= FALSE
;
93 wxPrinterError
wxPrinterBase::sm_lastError
= wxPRINTER_NO_ERROR
;
95 wxPrinterBase::~wxPrinterBase()
99 void wxPrintAbortDialog::OnCancel(wxCommandEvent
& WXUNUSED(event
))
101 wxPrinterBase::sm_abortIt
= TRUE
;
102 wxPrinterBase::sm_abortWindow
->Show(FALSE
);
103 wxPrinterBase::sm_abortWindow
->Close(TRUE
);
104 wxPrinterBase::sm_abortWindow
= (wxWindow
*) NULL
;
107 wxWindow
*wxPrinterBase::CreateAbortWindow(wxWindow
*parent
, wxPrintout
* printout
)
109 wxPrintAbortDialog
*dialog
= new wxPrintAbortDialog(parent
, _("Printing ") , wxDefaultPosition
, wxDefaultSize
, wxDEFAULT_DIALOG_STYLE
);
111 wxBoxSizer
*button_sizer
= new wxBoxSizer( wxVERTICAL
);
112 button_sizer
->Add( new wxStaticText(dialog
, -1, _("Please wait while printing\n") + printout
->GetTitle() ), 0, wxALL
, 10 );
113 button_sizer
->Add( new wxButton( dialog
, wxID_CANCEL
, wxT("Cancel") ), 0, wxALL
| wxALIGN_CENTER
, 10 );
115 dialog
->SetAutoLayout( TRUE
);
116 dialog
->SetSizer( button_sizer
);
118 button_sizer
->Fit(dialog
);
119 button_sizer
->SetSizeHints (dialog
) ;
124 void wxPrinterBase::ReportError(wxWindow
*parent
, wxPrintout
*WXUNUSED(printout
), const wxString
& message
)
126 wxMessageBox(message
, _("Printing Error"), wxOK
, parent
);
133 wxPrintout::wxPrintout(const wxString
& title
)
135 m_printoutTitle
= title
;
136 m_printoutDC
= (wxDC
*) NULL
;
139 m_pageWidthPixels
= 0;
140 m_pageHeightPixels
= 0;
148 wxPrintout::~wxPrintout()
152 bool wxPrintout::OnBeginDocument(int WXUNUSED(startPage
), int WXUNUSED(endPage
))
154 return GetDC()->StartDoc(_("Printing ") + m_printoutTitle
);
157 void wxPrintout::OnEndDocument()
162 void wxPrintout::OnBeginPrinting()
166 void wxPrintout::OnEndPrinting()
170 bool wxPrintout::HasPage(int page
)
175 void wxPrintout::GetPageInfo(int *minPage
, int *maxPage
, int *fromPage
, int *toPage
)
187 wxPreviewCanvas::wxPreviewCanvas(wxPrintPreviewBase
*preview
, wxWindow
*parent
,
188 const wxPoint
& pos
, const wxSize
& size
, long style
, const wxString
& name
):
189 wxScrolledWindow(parent
, -1, pos
, size
, style
, name
)
191 m_printPreview
= preview
;
192 SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_APPWORKSPACE
));
194 SetScrollbars(15, 18, 100, 100);
197 wxPreviewCanvas::~wxPreviewCanvas()
201 void wxPreviewCanvas::OnPaint(wxPaintEvent
& WXUNUSED(event
))
208 if (!GetUpdateRegion().IsEmpty())
209 dc.SetClippingRegion( GetUpdateRegion() );
215 m_printPreview
->PaintPage(this, dc
);
219 // Responds to colour changes, and passes event on to children.
220 void wxPreviewCanvas::OnSysColourChanged(wxSysColourChangedEvent
& event
)
222 SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_APPWORKSPACE
));
225 // Propagate the event to the non-top-level children
226 wxWindow::OnSysColourChanged(event
);
230 * Preview control bar
233 BEGIN_EVENT_TABLE(wxPreviewControlBar
, wxPanel
)
234 EVT_BUTTON(wxID_PREVIEW_CLOSE
, wxPreviewControlBar::OnWindowClose
)
235 EVT_BUTTON(wxID_PREVIEW_PRINT
, wxPreviewControlBar::OnPrint
)
236 EVT_BUTTON(wxID_PREVIEW_PREVIOUS
, wxPreviewControlBar::OnPreviousButton
)
237 EVT_BUTTON(wxID_PREVIEW_NEXT
, wxPreviewControlBar::OnNextButton
)
238 EVT_BUTTON(wxID_PREVIEW_FIRST
, wxPreviewControlBar::OnFirstButton
)
239 EVT_BUTTON(wxID_PREVIEW_LAST
, wxPreviewControlBar::OnLastButton
)
240 EVT_BUTTON(wxID_PREVIEW_GOTO
, wxPreviewControlBar::OnGotoButton
)
241 EVT_CHAR(wxPreviewControlBar::OnChar
)
242 EVT_CHOICE(wxID_PREVIEW_ZOOM
, wxPreviewControlBar::OnZoom
)
243 EVT_PAINT(wxPreviewControlBar::OnPaint
)
246 wxPreviewControlBar::wxPreviewControlBar(wxPrintPreviewBase
*preview
, long buttons
,
247 wxWindow
*parent
, const wxPoint
& pos
, const wxSize
& size
,
248 long style
, const wxString
& name
):
249 wxPanel(parent
, -1, pos
, size
, style
, name
)
251 m_printPreview
= preview
;
252 m_closeButton
= (wxButton
*) NULL
;
253 m_nextPageButton
= (wxButton
*) NULL
;
254 m_previousPageButton
= (wxButton
*) NULL
;
255 m_printButton
= (wxButton
*) NULL
;
256 m_zoomControl
= (wxChoice
*) NULL
;
257 m_buttonFlags
= buttons
;
260 wxPreviewControlBar::~wxPreviewControlBar()
264 void wxPreviewControlBar::OnPaint(wxPaintEvent
& WXUNUSED(event
))
270 dc
.SetPen(*wxBLACK_PEN
);
271 dc
.SetBrush(*wxTRANSPARENT_BRUSH
);
272 dc
.DrawLine( 0, h
-1, w
, h
-1 );
275 void wxPreviewControlBar::OnWindowClose(wxCommandEvent
& WXUNUSED(event
))
277 wxPreviewFrame
*frame
= (wxPreviewFrame
*)GetParent();
281 void wxPreviewControlBar::OnPrint(wxCommandEvent
& WXUNUSED(event
))
283 wxPrintPreviewBase
*preview
= GetPrintPreview();
284 preview
->Print(TRUE
);
287 void wxPreviewControlBar::OnChar(wxKeyEvent
&event
)
289 switch(event
.KeyCode())
306 void wxPreviewControlBar::OnNext(void)
308 wxPrintPreviewBase
*preview
= GetPrintPreview();
311 int currentPage
= preview
->GetCurrentPage();
312 if ((preview
->GetMaxPage() > 0) &&
313 (currentPage
< preview
->GetMaxPage()) &&
314 preview
->GetPrintout()->HasPage(currentPage
+ 1))
316 preview
->SetCurrentPage(currentPage
+ 1);
321 void wxPreviewControlBar::OnPrevious(void)
323 wxPrintPreviewBase
*preview
= GetPrintPreview();
326 int currentPage
= preview
->GetCurrentPage();
327 if ((preview
->GetMinPage() > 0) &&
328 (currentPage
> preview
->GetMinPage()) &&
329 preview
->GetPrintout()->HasPage(currentPage
- 1))
331 preview
->SetCurrentPage(currentPage
- 1);
336 void wxPreviewControlBar::OnFirst(void)
338 wxPrintPreviewBase
*preview
= GetPrintPreview();
341 int currentPage
= preview
->GetMinPage();
342 if (preview
->GetPrintout()->HasPage(currentPage
))
344 preview
->SetCurrentPage(currentPage
);
349 void wxPreviewControlBar::OnLast(void)
351 wxPrintPreviewBase
*preview
= GetPrintPreview();
354 int currentPage
= preview
->GetMaxPage();
355 if (preview
->GetPrintout()->HasPage(currentPage
))
357 preview
->SetCurrentPage(currentPage
);
362 void wxPreviewControlBar::OnGoto(void)
364 wxPrintPreviewBase
*preview
= GetPrintPreview();
369 if (preview
->GetMinPage() > 0)
374 strPrompt
.Printf( _("%d...%d"),
375 preview
->GetMinPage(), preview
->GetMaxPage());
376 strPage
.Printf( _("%d"), preview
->GetCurrentPage() );
379 wxGetTextFromUser( strPrompt
, _("Goto Page"), strPage
);
381 if ( strPage
.ToLong( ¤tPage
) )
382 if (preview
->GetPrintout()->HasPage(currentPage
))
384 preview
->SetCurrentPage(currentPage
);
390 void wxPreviewControlBar::OnZoom(wxCommandEvent
& WXUNUSED(event
))
392 int zoom
= GetZoomControl();
393 if (GetPrintPreview())
394 GetPrintPreview()->SetZoom(zoom
);
397 void wxPreviewControlBar::CreateButtons()
399 SetSize(0, 0, 400, 40);
408 wxFont buttonFont(fontSize, wxSWISS, wxNORMAL, wxBOLD);
412 int buttonWidth
= 60;
413 int buttonNavigation
= 30;
415 int buttonHeight
= -1;
417 int buttonHeight
= 24;
429 m_closeButton
= new wxButton(this, wxID_PREVIEW_CLOSE
, _("Close"),
430 wxPoint(x
, y
), wxSize(buttonWidth
, buttonHeight
));
432 x
+= gap
+ buttonWidth
;
434 if (m_buttonFlags
& wxPREVIEW_PRINT
)
436 m_printButton
= new wxButton(this, wxID_PREVIEW_PRINT
, _("Print..."), wxPoint(x
, y
),
437 wxSize(buttonWidth
, buttonHeight
));
438 x
+= gap
+ buttonWidth
;
441 if (m_buttonFlags
& wxPREVIEW_FIRST
)
443 m_firstPageButton
= new wxButton(this, wxID_PREVIEW_FIRST
, wxT("|<<"), wxPoint(x
, y
),
444 wxSize(buttonNavigation
, buttonHeight
));
445 x
+= gap
+ buttonNavigation
;
448 if (m_buttonFlags
& wxPREVIEW_PREVIOUS
)
450 m_previousPageButton
= new wxButton(this, wxID_PREVIEW_PREVIOUS
, wxT("<<"), wxPoint(x
, y
),
451 wxSize(buttonNavigation
, buttonHeight
));
452 x
+= gap
+ buttonNavigation
;
455 if (m_buttonFlags
& wxPREVIEW_NEXT
)
457 m_nextPageButton
= new wxButton(this, wxID_PREVIEW_NEXT
, wxT(">>"),
458 wxPoint(x
, y
), wxSize(buttonNavigation
, buttonHeight
));
459 x
+= gap
+ buttonNavigation
;
462 if (m_buttonFlags
& wxPREVIEW_LAST
)
464 m_lastPageButton
= new wxButton(this, wxID_PREVIEW_LAST
, wxT(">>|"), wxPoint(x
, y
),
465 wxSize(buttonNavigation
, buttonHeight
));
466 x
+= gap
+ buttonNavigation
;
469 if (m_buttonFlags
& wxPREVIEW_GOTO
)
471 m_gotoPageButton
= new wxButton(this, wxID_PREVIEW_GOTO
, wxT("Goto..."), wxPoint(x
, y
),
472 wxSize(buttonWidth
, buttonHeight
));
473 x
+= gap
+ buttonWidth
;
476 if (m_buttonFlags
& wxPREVIEW_ZOOM
)
478 static const char *choices
[] =
480 "10%", "15%", "20%", "25%", "30%", "35%", "40%", "45%", "50%", "55%",
481 "60%", "65%", "70%", "75%", "80%", "85%", "90%", "95%", "100%", "110%",
482 "120%", "150%", "200%"
485 int n
= WXSIZEOF(choices
);
487 wxString
* strings
= new wxString
[n
];
489 for (i
= 0; i
< n
; i
++ )
490 strings
[i
] = choices
[i
];
492 m_zoomControl
= new wxChoice(this, wxID_PREVIEW_ZOOM
,
500 SetZoomControl(m_printPreview
->GetZoom());
503 // m_closeButton->SetDefault();
506 void wxPreviewControlBar::SetZoomControl(int zoom
)
509 sprintf(buf
, "%d%%", zoom
);
510 // Someone is calling methods that do no exist in wxChoice!! So I'll just comment out for VA for now
512 m_zoomControl
->SetStringSelection(buf
);
515 int wxPreviewControlBar::GetZoomControl()
518 if (m_zoomControl
&& (m_zoomControl
->GetStringSelection() != wxT("")))
520 wxStrcpy(buf
, m_zoomControl
->GetStringSelection());
521 buf
[wxStrlen(buf
) - 1] = 0;
522 return (int)wxAtoi(buf
);
532 BEGIN_EVENT_TABLE(wxPreviewFrame
, wxFrame
)
533 EVT_CLOSE(wxPreviewFrame::OnCloseWindow
)
536 wxPreviewFrame::wxPreviewFrame(wxPrintPreviewBase
*preview
, wxFrame
*parent
, const wxString
& title
,
537 const wxPoint
& pos
, const wxSize
& size
, long style
, const wxString
& name
):
538 wxFrame(parent
, -1, title
, pos
, size
, style
, name
)
540 m_printPreview
= preview
;
542 m_previewCanvas
= NULL
;
545 wxPreviewFrame::~wxPreviewFrame()
549 void wxPreviewFrame::OnCloseWindow(wxCloseEvent
& WXUNUSED(event
))
553 // Need to delete the printout and the print preview
554 wxPrintout
*printout
= m_printPreview
->GetPrintout();
558 m_printPreview
->SetPrintout(NULL
);
559 m_printPreview
->SetCanvas(NULL
);
560 m_printPreview
->SetFrame(NULL
);
562 delete m_printPreview
;
567 void wxPreviewFrame::Initialize()
574 m_printPreview
->SetCanvas(m_previewCanvas
);
575 m_printPreview
->SetFrame(this);
577 // Set layout constraints here
579 // Control bar constraints
580 wxLayoutConstraints
*c1
= new wxLayoutConstraints
;
582 // m_controlBar->GetSize(&w, &h);
584 #if (defined(__WXMSW__) || defined(__WXGTK__))
590 c1
->left
.SameAs (this, wxLeft
);
591 c1
->top
.SameAs (this, wxTop
);
592 c1
->right
.SameAs (this, wxRight
);
593 c1
->height
.Absolute (h
);
595 m_controlBar
->SetConstraints(c1
);
597 // Canvas constraints
598 wxLayoutConstraints
*c2
= new wxLayoutConstraints
;
600 c2
->left
.SameAs (this, wxLeft
);
601 c2
->top
.Below (m_controlBar
);
602 c2
->right
.SameAs (this, wxRight
);
603 c2
->bottom
.SameAs (this, wxBottom
);
605 m_previewCanvas
->SetConstraints(c2
);
614 void wxPreviewFrame::CreateCanvas()
616 m_previewCanvas
= new wxPreviewCanvas(m_printPreview
, this);
619 void wxPreviewFrame::CreateControlBar()
621 long buttons
= wxPREVIEW_DEFAULT
;
622 if (m_printPreview
->GetPrintoutForPrinting())
623 buttons
|= wxPREVIEW_PRINT
;
625 m_controlBar
= new wxPreviewControlBar(m_printPreview
, buttons
, this, wxPoint(0, 0), wxSize(400, 40));
626 m_controlBar
->CreateButtons();
633 wxPrintPreviewBase::wxPrintPreviewBase(wxPrintout
*printout
,
634 wxPrintout
*printoutForPrinting
,
638 m_printDialogData
= (*data
);
640 Init(printout
, printoutForPrinting
);
643 wxPrintPreviewBase::wxPrintPreviewBase(wxPrintout
*printout
,
644 wxPrintout
*printoutForPrinting
,
645 wxPrintDialogData
*data
)
648 m_printDialogData
= (*data
);
650 Init(printout
, printoutForPrinting
);
653 void wxPrintPreviewBase::Init(wxPrintout
*printout
,
654 wxPrintout
*printoutForPrinting
)
657 m_previewPrintout
= printout
;
658 if (m_previewPrintout
)
659 m_previewPrintout
->SetIsPreview(TRUE
);
661 m_printPrintout
= printoutForPrinting
;
663 m_previewCanvas
= NULL
;
664 m_previewFrame
= NULL
;
665 m_previewBitmap
= NULL
;
672 m_printingPrepared
= FALSE
;
674 // Too soon! Moved to RenderPage.
675 // printout->OnPreparePrinting();
677 // Get some parameters from the printout, if defined
679 printout
->GetPageInfo(&m_minPage
, &m_maxPage
, &selFrom
, &selTo
);
682 wxPrintPreviewBase::~wxPrintPreviewBase()
684 if (m_previewPrintout
)
685 delete m_previewPrintout
;
687 delete m_previewBitmap
;
689 delete m_printPrintout
;
692 bool wxPrintPreviewBase::SetCurrentPage(int pageNum
)
694 if (m_currentPage
== pageNum
)
697 m_currentPage
= pageNum
;
700 delete m_previewBitmap
;
701 m_previewBitmap
= NULL
;
706 if (!RenderPage(pageNum
))
708 m_previewCanvas
->Refresh();
713 bool wxPrintPreviewBase::PaintPage(wxWindow
*canvas
, wxDC
& dc
)
715 DrawBlankPage(canvas
, dc
);
717 if (!m_previewBitmap
)
718 if (!RenderPage(m_currentPage
))
721 if (!m_previewBitmap
)
727 int canvasWidth
, canvasHeight
;
728 canvas
->GetSize(&canvasWidth
, &canvasHeight
);
730 double zoomScale
= ((float)m_currentZoom
/(float)100);
731 double actualWidth
= (zoomScale
*m_pageWidth
*m_previewScale
);
732 // float actualHeight = (float)(zoomScale*m_pageHeight*m_previewScale);
734 int x
= (int) ((canvasWidth
- actualWidth
)/2.0);
735 if (x
< m_leftMargin
)
740 temp_dc
.SelectObject(*m_previewBitmap
);
742 dc
.Blit(x
, y
, m_previewBitmap
->GetWidth(), m_previewBitmap
->GetHeight(), &temp_dc
, 0, 0);
744 temp_dc
.SelectObject(wxNullBitmap
);
749 bool wxPrintPreviewBase::RenderPage(int pageNum
)
753 int canvasWidth
, canvasHeight
;
755 if (!m_previewCanvas
)
757 wxFAIL_MSG(_T("wxPrintPreviewBase::RenderPage: must use wxPrintPreviewBase::SetCanvas to let me know about the canvas!"));
761 m_previewCanvas
->GetSize(&canvasWidth
, &canvasHeight
);
763 double zoomScale
= (m_currentZoom
/100.0);
764 int actualWidth
= (int)(zoomScale
*m_pageWidth
*m_previewScale
);
765 int actualHeight
= (int)(zoomScale
*m_pageHeight
*m_previewScale
);
767 int x
= (int)((canvasWidth
- actualWidth
)/2.0);
768 if (x
< m_leftMargin
)
770 // int y = m_topMargin;
773 if (!m_previewBitmap
)
775 m_previewBitmap
= new wxBitmap((int)actualWidth
, (int)actualHeight
);
776 if (!m_previewBitmap
|| !m_previewBitmap
->Ok())
778 if (m_previewBitmap
) {
779 delete m_previewBitmap
;
780 m_previewBitmap
= NULL
;
782 wxMessageBox(_("Sorry, not enough memory to create a preview."), _("Print Preview Failure"), wxOK
);
788 memoryDC
.SelectObject(*m_previewBitmap
);
792 m_previewPrintout
->SetDC(&memoryDC
);
793 m_previewPrintout
->SetPageSizePixels(m_pageWidth
, m_pageHeight
);
795 // Need to delay OnPreparePrinting until here, so we have enough information.
796 if (!m_printingPrepared
)
798 m_previewPrintout
->OnPreparePrinting();
799 m_printingPrepared
= TRUE
;
802 m_previewPrintout
->OnBeginPrinting();
804 if (!m_previewPrintout
->OnBeginDocument(m_printDialogData
.GetFromPage(), m_printDialogData
.GetToPage()))
806 wxMessageBox(_("Could not start document preview."), _("Print Preview Failure"), wxOK
);
808 memoryDC
.SelectObject(wxNullBitmap
);
810 delete m_previewBitmap
;
811 m_previewBitmap
= NULL
;
815 m_previewPrintout
->OnPrintPage(pageNum
);
816 m_previewPrintout
->OnEndDocument();
817 m_previewPrintout
->OnEndPrinting();
819 m_previewPrintout
->SetDC(NULL
);
821 memoryDC
.SelectObject(wxNullBitmap
);
825 wxSprintf(buf
, _("Page %d of %d"), pageNum
, m_maxPage
);
827 wxSprintf(buf
, _("Page %d"), pageNum
);
830 m_previewFrame
->SetStatusText(buf
);
836 bool wxPrintPreviewBase::DrawBlankPage(wxWindow
*canvas
, wxDC
& dc
)
838 int canvasWidth
, canvasHeight
;
839 canvas
->GetSize(&canvasWidth
, &canvasHeight
);
841 float zoomScale
= (float)((float)m_currentZoom
/(float)100);
842 float actualWidth
= zoomScale
*m_pageWidth
*m_previewScale
;
843 float actualHeight
= zoomScale
*m_pageHeight
*m_previewScale
;
845 float x
= (float)((canvasWidth
- actualWidth
)/2.0);
846 if (x
< m_leftMargin
)
847 x
= (float)m_leftMargin
;
848 float y
= (float)m_topMargin
;
850 // Draw shadow, allowing for 1-pixel border AROUND the actual page
851 int shadowOffset
= 4;
852 dc
.SetPen(*wxBLACK_PEN
);
853 dc
.SetBrush(*wxBLACK_BRUSH
);
855 dc.DrawRectangle((int)(x-1 + shadowOffset), (int)(y-1 + shadowOffset), (int)(actualWidth+2), (int)(actualHeight+2));
857 dc
.DrawRectangle((int)(x
+ shadowOffset
), (int)(y
+ actualHeight
+1), (int)(actualWidth
), shadowOffset
);
858 dc
.DrawRectangle((int)(x
+ actualWidth
), (int)(y
+ shadowOffset
), shadowOffset
, (int)(actualHeight
));
860 // Draw blank page allowing for 1-pixel border AROUND the actual page
861 dc
.SetPen(*wxBLACK_PEN
);
862 dc
.SetBrush(*wxWHITE_BRUSH
);
865 wxRegion update_region = canvas->GetUpdateRegion();
866 wxRect r = update_region.GetBox();
868 printf( "x: %d y: %d w: %d h: %d.\n", (int)r.x, (int)r.y, (int)r.width, (int)r.height );
871 dc
.DrawRectangle((int)(x
-2), (int)(y
-1), (int)(actualWidth
+3), (int)(actualHeight
+2));
876 void wxPrintPreviewBase::SetZoom(int percent
)
878 if (m_currentZoom
== percent
)
881 m_currentZoom
= percent
;
884 delete m_previewBitmap
;
885 m_previewBitmap
= NULL
;
890 RenderPage(m_currentPage
);
891 ((wxScrolledWindow
*) m_previewCanvas
)->Scroll(0, 0);
892 m_previewCanvas
->Clear();
893 m_previewCanvas
->Refresh();
897 #endif // wxUSE_PRINTING_ARCHITECTURE