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"
43 #include "wx/prntbase.h"
44 #include "wx/dcprint.h"
45 #include "wx/printdlg.h"
46 #include "wx/module.h"
52 #include "wx/msw/private.h"
60 IMPLEMENT_CLASS(wxPrinterBase
, wxObject
)
61 IMPLEMENT_ABSTRACT_CLASS(wxPrintout
, wxObject
)
62 IMPLEMENT_CLASS(wxPreviewCanvas
, wxWindow
)
63 IMPLEMENT_CLASS(wxPreviewControlBar
, wxWindow
)
64 IMPLEMENT_CLASS(wxPreviewFrame
, wxFrame
)
65 IMPLEMENT_CLASS(wxPrintPreviewBase
, wxObject
)
67 BEGIN_EVENT_TABLE(wxPrintAbortDialog
, wxDialog
)
68 EVT_BUTTON(wxID_CANCEL
, wxPrintAbortDialog::OnCancel
)
71 BEGIN_EVENT_TABLE(wxPreviewCanvas
, wxScrolledWindow
)
72 EVT_PAINT(wxPreviewCanvas::OnPaint
)
73 EVT_SYS_COLOUR_CHANGED(wxPreviewCanvas::OnSysColourChanged
)
80 wxPrinterBase::wxPrinterBase(wxPrintDialogData
*data
)
82 m_currentPrintout
= (wxPrintout
*) NULL
;
83 sm_abortWindow
= (wxWindow
*) NULL
;
86 m_printDialogData
= (*data
);
87 sm_lastError
= wxPRINTER_NO_ERROR
;
90 wxWindow
*wxPrinterBase::sm_abortWindow
= (wxWindow
*) NULL
;
91 bool wxPrinterBase::sm_abortIt
= FALSE
;
92 wxPrinterError
wxPrinterBase::sm_lastError
= wxPRINTER_NO_ERROR
;
94 wxPrinterBase::~wxPrinterBase()
98 void wxPrintAbortDialog::OnCancel(wxCommandEvent
& WXUNUSED(event
))
100 wxPrinterBase::sm_abortIt
= TRUE
;
101 wxPrinterBase::sm_abortWindow
->Show(FALSE
);
102 wxPrinterBase::sm_abortWindow
->Close(TRUE
);
103 wxPrinterBase::sm_abortWindow
= (wxWindow
*) NULL
;
106 wxWindow
*wxPrinterBase::CreateAbortWindow(wxWindow
*parent
, wxPrintout
* printout
)
108 wxPrintAbortDialog
*dialog
= new wxPrintAbortDialog(parent
, _("Printing ") , wxDefaultPosition
, wxDefaultSize
, wxDEFAULT_DIALOG_STYLE
);
110 wxBoxSizer
*button_sizer
= new wxBoxSizer( wxVERTICAL
);
111 button_sizer
->Add( new wxStaticText(dialog
, -1, _("Please wait while printing\n") + printout
->GetTitle() ), 0, wxALL
, 10 );
112 button_sizer
->Add( new wxButton( dialog
, wxID_CANCEL
, wxT("Cancel") ), 0, wxALL
| wxALIGN_CENTER
, 10 );
114 dialog
->SetAutoLayout( TRUE
);
115 dialog
->SetSizer( button_sizer
);
117 button_sizer
->Fit(dialog
);
118 button_sizer
->SetSizeHints (dialog
) ;
123 void wxPrinterBase::ReportError(wxWindow
*parent
, wxPrintout
*WXUNUSED(printout
), const wxString
& message
)
125 wxMessageBox(message
, _("Printing Error"), wxOK
, parent
);
132 wxPrintout::wxPrintout(const wxString
& title
)
134 m_printoutTitle
= title
;
135 m_printoutDC
= (wxDC
*) NULL
;
138 m_pageWidthPixels
= 0;
139 m_pageHeightPixels
= 0;
147 wxPrintout::~wxPrintout()
151 bool wxPrintout::OnBeginDocument(int WXUNUSED(startPage
), int WXUNUSED(endPage
))
153 return GetDC()->StartDoc(_("Printing ") + m_printoutTitle
);
156 void wxPrintout::OnEndDocument()
161 void wxPrintout::OnBeginPrinting()
165 void wxPrintout::OnEndPrinting()
169 bool wxPrintout::HasPage(int page
)
174 void wxPrintout::GetPageInfo(int *minPage
, int *maxPage
, int *fromPage
, int *toPage
)
186 wxPreviewCanvas::wxPreviewCanvas(wxPrintPreviewBase
*preview
, wxWindow
*parent
,
187 const wxPoint
& pos
, const wxSize
& size
, long style
, const wxString
& name
):
188 wxScrolledWindow(parent
, -1, pos
, size
, style
, name
)
190 m_printPreview
= preview
;
191 SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_APPWORKSPACE
));
193 SetScrollbars(15, 18, 100, 100);
196 wxPreviewCanvas::~wxPreviewCanvas()
200 void wxPreviewCanvas::OnPaint(wxPaintEvent
& WXUNUSED(event
))
207 if (!GetUpdateRegion().IsEmpty())
208 dc.SetClippingRegion( GetUpdateRegion() );
214 m_printPreview
->PaintPage(this, dc
);
218 // Responds to colour changes, and passes event on to children.
219 void wxPreviewCanvas::OnSysColourChanged(wxSysColourChangedEvent
& event
)
221 SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_APPWORKSPACE
));
224 // Propagate the event to the non-top-level children
225 wxWindow::OnSysColourChanged(event
);
229 * Preview control bar
232 BEGIN_EVENT_TABLE(wxPreviewControlBar
, wxPanel
)
233 EVT_BUTTON(wxID_PREVIEW_CLOSE
, wxPreviewControlBar::OnWindowClose
)
234 EVT_BUTTON(wxID_PREVIEW_PRINT
, wxPreviewControlBar::OnPrint
)
235 EVT_BUTTON(wxID_PREVIEW_PREVIOUS
, wxPreviewControlBar::OnPreviousButton
)
236 EVT_BUTTON(wxID_PREVIEW_NEXT
, wxPreviewControlBar::OnNextButton
)
237 EVT_BUTTON(wxID_PREVIEW_FIRST
, wxPreviewControlBar::OnFirstButton
)
238 EVT_BUTTON(wxID_PREVIEW_LAST
, wxPreviewControlBar::OnLastButton
)
239 EVT_BUTTON(wxID_PREVIEW_GOTO
, wxPreviewControlBar::OnGotoButton
)
240 EVT_CHAR(wxPreviewControlBar::OnChar
)
241 EVT_CHOICE(wxID_PREVIEW_ZOOM
, wxPreviewControlBar::OnZoom
)
242 EVT_PAINT(wxPreviewControlBar::OnPaint
)
245 wxPreviewControlBar::wxPreviewControlBar(wxPrintPreviewBase
*preview
, long buttons
,
246 wxWindow
*parent
, const wxPoint
& pos
, const wxSize
& size
,
247 long style
, const wxString
& name
):
248 wxPanel(parent
, -1, pos
, size
, style
, name
)
250 m_printPreview
= preview
;
251 m_closeButton
= (wxButton
*) NULL
;
252 m_nextPageButton
= (wxButton
*) NULL
;
253 m_previousPageButton
= (wxButton
*) NULL
;
254 m_printButton
= (wxButton
*) NULL
;
255 m_zoomControl
= (wxChoice
*) NULL
;
256 m_buttonFlags
= buttons
;
259 wxPreviewControlBar::~wxPreviewControlBar()
263 void wxPreviewControlBar::OnPaint(wxPaintEvent
& WXUNUSED(event
))
269 dc
.SetPen(*wxBLACK_PEN
);
270 dc
.SetBrush(*wxTRANSPARENT_BRUSH
);
271 dc
.DrawLine( 0, h
-1, w
, h
-1 );
274 void wxPreviewControlBar::OnWindowClose(wxCommandEvent
& WXUNUSED(event
))
276 wxPreviewFrame
*frame
= (wxPreviewFrame
*)GetParent();
280 void wxPreviewControlBar::OnPrint(wxCommandEvent
& WXUNUSED(event
))
282 wxPrintPreviewBase
*preview
= GetPrintPreview();
283 preview
->Print(TRUE
);
286 void wxPreviewControlBar::OnChar(wxKeyEvent
&event
)
288 switch(event
.GetKeyCode())
305 void wxPreviewControlBar::OnNext(void)
307 wxPrintPreviewBase
*preview
= GetPrintPreview();
310 int currentPage
= preview
->GetCurrentPage();
311 if ((preview
->GetMaxPage() > 0) &&
312 (currentPage
< preview
->GetMaxPage()) &&
313 preview
->GetPrintout()->HasPage(currentPage
+ 1))
315 preview
->SetCurrentPage(currentPage
+ 1);
320 void wxPreviewControlBar::OnPrevious(void)
322 wxPrintPreviewBase
*preview
= GetPrintPreview();
325 int currentPage
= preview
->GetCurrentPage();
326 if ((preview
->GetMinPage() > 0) &&
327 (currentPage
> preview
->GetMinPage()) &&
328 preview
->GetPrintout()->HasPage(currentPage
- 1))
330 preview
->SetCurrentPage(currentPage
- 1);
335 void wxPreviewControlBar::OnFirst(void)
337 wxPrintPreviewBase
*preview
= GetPrintPreview();
340 int currentPage
= preview
->GetMinPage();
341 if (preview
->GetPrintout()->HasPage(currentPage
))
343 preview
->SetCurrentPage(currentPage
);
348 void wxPreviewControlBar::OnLast(void)
350 wxPrintPreviewBase
*preview
= GetPrintPreview();
353 int currentPage
= preview
->GetMaxPage();
354 if (preview
->GetPrintout()->HasPage(currentPage
))
356 preview
->SetCurrentPage(currentPage
);
361 void wxPreviewControlBar::OnGoto(void)
363 wxPrintPreviewBase
*preview
= GetPrintPreview();
368 if (preview
->GetMinPage() > 0)
373 strPrompt
.Printf( wxT("%d...%d"),
374 preview
->GetMinPage(), preview
->GetMaxPage());
375 strPage
.Printf( wxT("%d"), preview
->GetCurrentPage() );
378 wxGetTextFromUser( strPrompt
, _("Goto Page"), strPage
);
380 if ( strPage
.ToLong( ¤tPage
) )
381 if (preview
->GetPrintout()->HasPage(currentPage
))
383 preview
->SetCurrentPage(currentPage
);
389 void wxPreviewControlBar::OnZoom(wxCommandEvent
& WXUNUSED(event
))
391 int zoom
= GetZoomControl();
392 if (GetPrintPreview())
393 GetPrintPreview()->SetZoom(zoom
);
396 void wxPreviewControlBar::CreateButtons()
398 SetSize(0, 0, 400, 40);
407 wxFont buttonFont(fontSize, wxSWISS, wxNORMAL, wxBOLD);
411 int buttonWidth
= 60;
412 int buttonNavigation
= 30;
414 int buttonHeight
= -1;
416 int buttonHeight
= 24;
428 m_closeButton
= new wxButton(this, wxID_PREVIEW_CLOSE
, _("Close"),
429 wxPoint(x
, y
), wxSize(buttonWidth
, buttonHeight
));
431 x
+= gap
+ buttonWidth
;
433 if (m_buttonFlags
& wxPREVIEW_PRINT
)
435 m_printButton
= new wxButton(this, wxID_PREVIEW_PRINT
, _("Print..."), wxPoint(x
, y
),
436 wxSize(buttonWidth
, buttonHeight
));
437 x
+= gap
+ buttonWidth
;
440 if (m_buttonFlags
& wxPREVIEW_FIRST
)
442 m_firstPageButton
= new wxButton(this, wxID_PREVIEW_FIRST
, wxT("|<<"), wxPoint(x
, y
),
443 wxSize(buttonNavigation
, buttonHeight
));
444 x
+= gap
+ buttonNavigation
;
447 if (m_buttonFlags
& wxPREVIEW_PREVIOUS
)
449 m_previousPageButton
= new wxButton(this, wxID_PREVIEW_PREVIOUS
, wxT("<<"), wxPoint(x
, y
),
450 wxSize(buttonNavigation
, buttonHeight
));
451 x
+= gap
+ buttonNavigation
;
454 if (m_buttonFlags
& wxPREVIEW_NEXT
)
456 m_nextPageButton
= new wxButton(this, wxID_PREVIEW_NEXT
, wxT(">>"),
457 wxPoint(x
, y
), wxSize(buttonNavigation
, buttonHeight
));
458 x
+= gap
+ buttonNavigation
;
461 if (m_buttonFlags
& wxPREVIEW_LAST
)
463 m_lastPageButton
= new wxButton(this, wxID_PREVIEW_LAST
, wxT(">>|"), wxPoint(x
, y
),
464 wxSize(buttonNavigation
, buttonHeight
));
465 x
+= gap
+ buttonNavigation
;
468 if (m_buttonFlags
& wxPREVIEW_GOTO
)
470 m_gotoPageButton
= new wxButton(this, wxID_PREVIEW_GOTO
, _("Goto..."), wxPoint(x
, y
),
471 wxSize(buttonWidth
, buttonHeight
));
472 x
+= gap
+ buttonWidth
;
475 if (m_buttonFlags
& wxPREVIEW_ZOOM
)
477 static const wxChar
*choices
[] =
479 wxT("10%"), wxT("15%"), wxT("20%"), wxT("25%"), wxT("30%"), wxT("35%"), wxT("40%"), wxT("45%"), wxT("50%"), wxT("55%"),
480 wxT("60%"), wxT("65%"), wxT("70%"), wxT("75%"), wxT("80%"), wxT("85%"), wxT("90%"), wxT("95%"), wxT("100%"), wxT("110%"),
481 wxT("120%"), wxT("150%"), wxT("200%")
484 int n
= WXSIZEOF(choices
);
486 wxString
* strings
= new wxString
[n
];
488 for (i
= 0; i
< n
; i
++ )
489 strings
[i
] = choices
[i
];
491 m_zoomControl
= new wxChoice(this, wxID_PREVIEW_ZOOM
,
499 SetZoomControl(m_printPreview
->GetZoom());
502 // m_closeButton->SetDefault();
505 void wxPreviewControlBar::SetZoomControl(int zoom
)
508 wxSprintf( buf
, wxT("%d%%"), zoom
);
511 m_zoomControl
->SetStringSelection(buf
);
514 int wxPreviewControlBar::GetZoomControl()
517 if (m_zoomControl
&& (m_zoomControl
->GetStringSelection() != wxT("")))
519 wxStrcpy(buf
, m_zoomControl
->GetStringSelection());
520 buf
[wxStrlen(buf
) - 1] = 0;
521 return (int)wxAtoi(buf
);
531 BEGIN_EVENT_TABLE(wxPreviewFrame
, wxFrame
)
532 EVT_CLOSE(wxPreviewFrame::OnCloseWindow
)
535 wxPreviewFrame::wxPreviewFrame(wxPrintPreviewBase
*preview
, wxFrame
*parent
, const wxString
& title
,
536 const wxPoint
& pos
, const wxSize
& size
, long style
, const wxString
& name
):
537 wxFrame(parent
, -1, title
, pos
, size
, style
, name
)
539 m_printPreview
= preview
;
541 m_previewCanvas
= NULL
;
544 wxPreviewFrame::~wxPreviewFrame()
548 void wxPreviewFrame::OnCloseWindow(wxCloseEvent
& WXUNUSED(event
))
552 // Need to delete the printout and the print preview
553 wxPrintout
*printout
= m_printPreview
->GetPrintout();
557 m_printPreview
->SetPrintout(NULL
);
558 m_printPreview
->SetCanvas(NULL
);
559 m_printPreview
->SetFrame(NULL
);
561 delete m_printPreview
;
566 void wxPreviewFrame::Initialize()
573 m_printPreview
->SetCanvas(m_previewCanvas
);
574 m_printPreview
->SetFrame(this);
576 // Set layout constraints here
578 // Control bar constraints
579 wxLayoutConstraints
*c1
= new wxLayoutConstraints
;
581 // m_controlBar->GetSize(&w, &h);
583 #if (defined(__WXMSW__) || defined(__WXGTK__))
589 c1
->left
.SameAs (this, wxLeft
);
590 c1
->top
.SameAs (this, wxTop
);
591 c1
->right
.SameAs (this, wxRight
);
592 c1
->height
.Absolute (h
);
594 m_controlBar
->SetConstraints(c1
);
596 // Canvas constraints
597 wxLayoutConstraints
*c2
= new wxLayoutConstraints
;
599 c2
->left
.SameAs (this, wxLeft
);
600 c2
->top
.Below (m_controlBar
);
601 c2
->right
.SameAs (this, wxRight
);
602 c2
->bottom
.SameAs (this, wxBottom
);
604 m_previewCanvas
->SetConstraints(c2
);
613 void wxPreviewFrame::CreateCanvas()
615 m_previewCanvas
= new wxPreviewCanvas(m_printPreview
, this);
618 void wxPreviewFrame::CreateControlBar()
620 long buttons
= wxPREVIEW_DEFAULT
;
621 if (m_printPreview
->GetPrintoutForPrinting())
622 buttons
|= wxPREVIEW_PRINT
;
624 m_controlBar
= new wxPreviewControlBar(m_printPreview
, buttons
, this, wxPoint(0, 0), wxSize(400, 40));
625 m_controlBar
->CreateButtons();
632 wxPrintPreviewBase::wxPrintPreviewBase(wxPrintout
*printout
,
633 wxPrintout
*printoutForPrinting
,
637 m_printDialogData
= (*data
);
639 Init(printout
, printoutForPrinting
);
642 wxPrintPreviewBase::wxPrintPreviewBase(wxPrintout
*printout
,
643 wxPrintout
*printoutForPrinting
,
644 wxPrintDialogData
*data
)
647 m_printDialogData
= (*data
);
649 Init(printout
, printoutForPrinting
);
652 void wxPrintPreviewBase::Init(wxPrintout
*printout
,
653 wxPrintout
*printoutForPrinting
)
656 m_previewPrintout
= printout
;
657 if (m_previewPrintout
)
658 m_previewPrintout
->SetIsPreview(TRUE
);
660 m_printPrintout
= printoutForPrinting
;
662 m_previewCanvas
= NULL
;
663 m_previewFrame
= NULL
;
664 m_previewBitmap
= NULL
;
671 m_printingPrepared
= FALSE
;
673 // Too soon! Moved to RenderPage.
674 // printout->OnPreparePrinting();
676 // Get some parameters from the printout, if defined
678 printout
->GetPageInfo(&m_minPage
, &m_maxPage
, &selFrom
, &selTo
);
681 wxPrintPreviewBase::~wxPrintPreviewBase()
683 if (m_previewPrintout
)
684 delete m_previewPrintout
;
686 delete m_previewBitmap
;
688 delete m_printPrintout
;
691 bool wxPrintPreviewBase::SetCurrentPage(int pageNum
)
693 if (m_currentPage
== pageNum
)
696 m_currentPage
= pageNum
;
699 delete m_previewBitmap
;
700 m_previewBitmap
= NULL
;
705 if (!RenderPage(pageNum
))
707 m_previewCanvas
->Refresh();
712 bool wxPrintPreviewBase::PaintPage(wxWindow
*canvas
, wxDC
& dc
)
714 DrawBlankPage(canvas
, dc
);
716 if (!m_previewBitmap
)
717 if (!RenderPage(m_currentPage
))
720 if (!m_previewBitmap
)
726 int canvasWidth
, canvasHeight
;
727 canvas
->GetSize(&canvasWidth
, &canvasHeight
);
729 double zoomScale
= ((float)m_currentZoom
/(float)100);
730 double actualWidth
= (zoomScale
*m_pageWidth
*m_previewScale
);
731 // float actualHeight = (float)(zoomScale*m_pageHeight*m_previewScale);
733 int x
= (int) ((canvasWidth
- actualWidth
)/2.0);
734 if (x
< m_leftMargin
)
739 temp_dc
.SelectObject(*m_previewBitmap
);
741 dc
.Blit(x
, y
, m_previewBitmap
->GetWidth(), m_previewBitmap
->GetHeight(), &temp_dc
, 0, 0);
743 temp_dc
.SelectObject(wxNullBitmap
);
748 bool wxPrintPreviewBase::RenderPage(int pageNum
)
752 int canvasWidth
, canvasHeight
;
754 if (!m_previewCanvas
)
756 wxFAIL_MSG(_T("wxPrintPreviewBase::RenderPage: must use wxPrintPreviewBase::SetCanvas to let me know about the canvas!"));
760 m_previewCanvas
->GetSize(&canvasWidth
, &canvasHeight
);
762 double zoomScale
= (m_currentZoom
/100.0);
763 int actualWidth
= (int)(zoomScale
*m_pageWidth
*m_previewScale
);
764 int actualHeight
= (int)(zoomScale
*m_pageHeight
*m_previewScale
);
766 int x
= (int)((canvasWidth
- actualWidth
)/2.0);
767 if (x
< m_leftMargin
)
769 // int y = m_topMargin;
772 if (!m_previewBitmap
)
774 m_previewBitmap
= new wxBitmap((int)actualWidth
, (int)actualHeight
);
775 if (!m_previewBitmap
|| !m_previewBitmap
->Ok())
777 if (m_previewBitmap
) {
778 delete m_previewBitmap
;
779 m_previewBitmap
= NULL
;
781 wxMessageBox(_("Sorry, not enough memory to create a preview."), _("Print Preview Failure"), wxOK
);
787 memoryDC
.SelectObject(*m_previewBitmap
);
791 m_previewPrintout
->SetDC(&memoryDC
);
792 m_previewPrintout
->SetPageSizePixels(m_pageWidth
, m_pageHeight
);
794 // Need to delay OnPreparePrinting until here, so we have enough information.
795 if (!m_printingPrepared
)
797 m_previewPrintout
->OnPreparePrinting();
798 m_printingPrepared
= TRUE
;
801 m_previewPrintout
->OnBeginPrinting();
803 if (!m_previewPrintout
->OnBeginDocument(m_printDialogData
.GetFromPage(), m_printDialogData
.GetToPage()))
805 wxMessageBox(_("Could not start document preview."), _("Print Preview Failure"), wxOK
);
807 memoryDC
.SelectObject(wxNullBitmap
);
809 delete m_previewBitmap
;
810 m_previewBitmap
= NULL
;
814 m_previewPrintout
->OnPrintPage(pageNum
);
815 m_previewPrintout
->OnEndDocument();
816 m_previewPrintout
->OnEndPrinting();
818 m_previewPrintout
->SetDC(NULL
);
820 memoryDC
.SelectObject(wxNullBitmap
);
824 wxSprintf(buf
, _("Page %d of %d"), pageNum
, m_maxPage
);
826 wxSprintf(buf
, _("Page %d"), pageNum
);
829 m_previewFrame
->SetStatusText(buf
);
835 bool wxPrintPreviewBase::DrawBlankPage(wxWindow
*canvas
, wxDC
& dc
)
837 int canvasWidth
, canvasHeight
;
838 canvas
->GetSize(&canvasWidth
, &canvasHeight
);
840 float zoomScale
= (float)((float)m_currentZoom
/(float)100);
841 float actualWidth
= zoomScale
*m_pageWidth
*m_previewScale
;
842 float actualHeight
= zoomScale
*m_pageHeight
*m_previewScale
;
844 float x
= (float)((canvasWidth
- actualWidth
)/2.0);
845 if (x
< m_leftMargin
)
846 x
= (float)m_leftMargin
;
847 float y
= (float)m_topMargin
;
849 // Draw shadow, allowing for 1-pixel border AROUND the actual page
850 int shadowOffset
= 4;
851 dc
.SetPen(*wxBLACK_PEN
);
852 dc
.SetBrush(*wxBLACK_BRUSH
);
854 dc.DrawRectangle((int)(x-1 + shadowOffset), (int)(y-1 + shadowOffset), (int)(actualWidth+2), (int)(actualHeight+2));
856 dc
.DrawRectangle((int)(x
+ shadowOffset
), (int)(y
+ actualHeight
+1), (int)(actualWidth
), shadowOffset
);
857 dc
.DrawRectangle((int)(x
+ actualWidth
), (int)(y
+ shadowOffset
), shadowOffset
, (int)(actualHeight
));
859 // Draw blank page allowing for 1-pixel border AROUND the actual page
860 dc
.SetPen(*wxBLACK_PEN
);
861 dc
.SetBrush(*wxWHITE_BRUSH
);
864 wxRegion update_region = canvas->GetUpdateRegion();
865 wxRect r = update_region.GetBox();
867 printf( "x: %d y: %d w: %d h: %d.\n", (int)r.x, (int)r.y, (int)r.width, (int)r.height );
870 dc
.DrawRectangle((int)(x
-2), (int)(y
-1), (int)(actualWidth
+3), (int)(actualHeight
+2));
875 void wxPrintPreviewBase::SetZoom(int percent
)
877 if (m_currentZoom
== percent
)
880 m_currentZoom
= percent
;
883 delete m_previewBitmap
;
884 m_previewBitmap
= NULL
;
889 RenderPage(m_currentPage
);
890 ((wxScrolledWindow
*) m_previewCanvas
)->Scroll(0, 0);
891 m_previewCanvas
->Clear();
892 m_previewCanvas
->Refresh();
896 #endif // wxUSE_PRINTING_ARCHITECTURE