]> git.saurik.com Git - wxWidgets.git/blob - src/common/prntbase.cpp
Add support for dynamic event tables
[wxWidgets.git] / src / common / prntbase.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: prntbase.cpp
3 // Purpose: Printing framework base class implementation
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 04/01/98
7 // RCS-ID: $Id$
8 // Copyright: (c) Julian Smart and Markus Holzem
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifdef __GNUG__
13 #pragma implementation "prntbase.h"
14 #endif
15
16 // For compilers that support precompilation, includes "wx.h".
17 #include "wx/wxprec.h"
18
19 #ifdef __BORLANDC__
20 #pragma hdrstop
21 #endif
22
23 // #define __GOOD_COMPILER__
24
25 #include "wx/defs.h"
26
27 #ifndef WX_PRECOMP
28 #include "wx/utils.h"
29 #include "wx/dc.h"
30 #include "wx/app.h"
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"
38 #include "wx/intl.h"
39 #endif
40
41 #include "wx/prntbase.h"
42 #include "wx/dcprint.h"
43 #include "wx/printdlg.h"
44
45 #include <stdlib.h>
46 #include <string.h>
47
48 #ifdef __WINDOWS__
49 #include <windows.h>
50 #include <commdlg.h>
51
52 // Clash with Windows header files
53 #ifdef StartDoc
54 #undef StartDoc
55 #endif
56
57 #ifndef __WIN32__
58 #include <print.h>
59 #endif
60
61 #if !defined(APIENTRY) // NT defines APIENTRY, 3.x not
62 #define APIENTRY FAR PASCAL
63 #endif
64
65 #ifdef __WIN32__
66 #define _EXPORT /**/
67 #else
68 #define _EXPORT _export
69 typedef signed short int SHORT ;
70 #endif
71
72 #if !defined(__WIN32__) // 3.x uses FARPROC for dialogs
73 #define DLGPROC FARPROC
74 #endif
75
76 LONG APIENTRY _EXPORT wxAbortProc(HDC hPr, int Code);
77 #endif
78 // End __WINDOWS__
79
80 #if !USE_SHARED_LIBRARY
81 IMPLEMENT_CLASS(wxPrinterBase, wxObject)
82 IMPLEMENT_ABSTRACT_CLASS(wxPrintout, wxObject)
83 IMPLEMENT_CLASS(wxPreviewCanvas, wxWindow)
84 IMPLEMENT_CLASS(wxPreviewControlBar, wxWindow)
85 IMPLEMENT_CLASS(wxPreviewFrame, wxFrame)
86 IMPLEMENT_CLASS(wxPrintPreviewBase, wxObject)
87
88 BEGIN_EVENT_TABLE(wxPrintAbortDialog, wxDialog)
89 EVT_BUTTON(wxID_CANCEL, wxPrintAbortDialog::OnCancel)
90 END_EVENT_TABLE()
91
92 BEGIN_EVENT_TABLE(wxPreviewCanvas, wxScrolledWindow)
93 EVT_PAINT(wxPreviewCanvas::OnPaint)
94 EVT_SYS_COLOUR_CHANGED(wxPreviewCanvas::OnSysColourChanged)
95 END_EVENT_TABLE()
96 #endif
97
98 /*
99 * Printer
100 */
101
102 wxPrinterBase::wxPrinterBase(wxPrintData *data)
103 {
104 currentPrintout = NULL;
105 abortWindow = NULL;
106 abortIt = FALSE;
107 if (data)
108 printData = (*data);
109 }
110
111 wxWindow *wxPrinterBase::abortWindow = NULL;
112 bool wxPrinterBase::abortIt = FALSE;
113
114 wxPrinterBase::~wxPrinterBase(void)
115 {
116 }
117
118 void wxPrintAbortDialog::OnCancel(wxCommandEvent& WXUNUSED(event))
119 {
120 wxPrinterBase::abortIt = TRUE;
121 wxPrinterBase::abortWindow->Show(FALSE);
122 wxPrinterBase::abortWindow->Close(TRUE);
123 wxPrinterBase::abortWindow = NULL;
124 }
125
126 wxWindow *wxPrinterBase::CreateAbortWindow(wxWindow *parent, wxPrintout *WXUNUSED(printout))
127 {
128 wxPrintAbortDialog *dialog = new wxPrintAbortDialog(parent, _("Printing"), wxPoint(0, 0), wxSize(400, 400));
129 (void) new wxStaticText(dialog, -1, _("Please wait..."), wxPoint(5, 5));
130
131 wxButton *button = new wxButton(dialog, wxID_CANCEL, _("Cancel"), wxPoint(5, 30));
132
133 dialog->Fit();
134 button->Centre(wxHORIZONTAL);
135
136 dialog->Centre();
137 return dialog;
138 }
139
140 void wxPrinterBase::ReportError(wxWindow *parent, wxPrintout *WXUNUSED(printout), char *message)
141 {
142 wxMessageBox(message, "Printing Error", wxOK, parent);
143 }
144
145 /*
146 * Printout class
147 */
148
149 wxPrintout::wxPrintout(char *title)
150 {
151 printoutTitle = title ? copystring(title) : (char*)NULL;
152 printoutDC = NULL;
153 pageWidthMM = 0;
154 pageHeightMM = 0;
155 pageWidthPixels = 0;
156 pageHeightPixels = 0;
157 PPIScreenX = 0;
158 PPIScreenY = 0;
159 PPIPrinterX = 0;
160 PPIPrinterY = 0;
161 isPreview = FALSE;
162 }
163
164 wxPrintout::~wxPrintout(void)
165 {
166 if (printoutTitle)
167 delete[] printoutTitle;
168 }
169
170 bool wxPrintout::OnBeginDocument(int WXUNUSED(startPage), int WXUNUSED(endPage))
171 {
172 return GetDC()->StartDoc("Printing");
173 }
174
175 void wxPrintout::OnEndDocument(void)
176 {
177 GetDC()->EndDoc();
178 }
179
180 void wxPrintout::OnBeginPrinting(void)
181 {
182 }
183
184 void wxPrintout::OnEndPrinting(void)
185 {
186 }
187
188 bool wxPrintout::HasPage(int page)
189 {
190 return (page == 1);
191 }
192
193 void wxPrintout::GetPageInfo(int *minPage, int *maxPage, int *fromPage, int *toPage)
194 {
195 *minPage = 1;
196 *maxPage = 32000;
197 *fromPage = 1;
198 *toPage = 1;
199 }
200
201 /*
202 * Preview canvas
203 */
204
205 wxPreviewCanvas::wxPreviewCanvas(wxPrintPreviewBase *preview, wxWindow *parent,
206 const wxPoint& pos, const wxSize& size, long style, const wxString& name):
207 wxScrolledWindow(parent, -1, pos, size, style, name)
208 {
209 printPreview = preview;
210 SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_APPWORKSPACE));
211
212 SetScrollbars(40, 40, 100, 100);
213 }
214
215 wxPreviewCanvas::~wxPreviewCanvas(void)
216 {
217 }
218
219 void wxPreviewCanvas::OnPaint(wxPaintEvent& WXUNUSED(event))
220 {
221 wxPaintDC dc(this);
222
223 if (printPreview)
224 {
225 printPreview->PaintPage(this, dc);
226 }
227 }
228
229 // Responds to colour changes, and passes event on to children.
230 void wxPreviewCanvas::OnSysColourChanged(wxSysColourChangedEvent& event)
231 {
232 SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_APPWORKSPACE));
233 Refresh();
234
235 // Propagate the event to the non-top-level children
236 wxWindow::OnSysColourChanged(event);
237 }
238
239 /*
240 * Preview control bar
241 */
242
243 BEGIN_EVENT_TABLE(wxPreviewControlBar, wxPanel)
244 EVT_BUTTON(wxID_PREVIEW_CLOSE, wxPreviewControlBar::OnClose)
245 EVT_BUTTON(wxID_PREVIEW_PRINT, wxPreviewControlBar::OnPrint)
246 EVT_BUTTON(wxID_PREVIEW_PREVIOUS, wxPreviewControlBar::OnPrevious)
247 EVT_BUTTON(wxID_PREVIEW_NEXT, wxPreviewControlBar::OnNext)
248 EVT_CHOICE(wxID_PREVIEW_ZOOM, wxPreviewControlBar::OnZoom)
249 EVT_PAINT(wxPreviewControlBar::OnPaint)
250 END_EVENT_TABLE()
251
252 wxPreviewControlBar::wxPreviewControlBar(wxPrintPreviewBase *preview, long buttons,
253 wxWindow *parent, const wxPoint& pos, const wxSize& size,
254 long style, const wxString& name):
255 wxPanel(parent, -1, pos, size, style, name)
256 {
257 printPreview = preview;
258 closeButton = NULL;
259 nextPageButton = NULL;
260 previousPageButton = NULL;
261 printButton = NULL;
262 zoomControl = NULL;
263 buttonFlags = buttons;
264 }
265
266 wxFont *wxPreviewControlBar::buttonFont = NULL;
267
268 wxPreviewControlBar::~wxPreviewControlBar(void)
269 {
270 }
271
272 void wxPreviewControlBar::OnPaint(wxPaintEvent& WXUNUSED(event))
273 {
274 wxPaintDC dc(this);
275
276 int w, h;
277 GetSize(&w, &h);
278 dc.SetPen(*wxBLACK_PEN);
279 dc.SetBrush(*wxTRANSPARENT_BRUSH);
280 dc.DrawLine( 0, h-1, w, h-1 );
281 }
282
283 void wxPreviewControlBar::OnClose(wxCommandEvent& WXUNUSED(event))
284 {
285 wxPreviewFrame *frame = (wxPreviewFrame *)GetParent();
286 frame->Close(TRUE);
287 }
288
289 void wxPreviewControlBar::OnPrint(wxCommandEvent& WXUNUSED(event))
290 {
291 wxPrintPreviewBase *preview = GetPrintPreview();
292 preview->Print(TRUE);
293 }
294
295 void wxPreviewControlBar::OnNext(wxCommandEvent& WXUNUSED(event))
296 {
297 wxPrintPreviewBase *preview = GetPrintPreview();
298 if (preview)
299 {
300 int currentPage = preview->GetCurrentPage();
301 if ((preview->GetMaxPage() > 0) &&
302 (currentPage < preview->GetMaxPage()) &&
303 preview->GetPrintout()->HasPage(currentPage + 1))
304 {
305 preview->SetCurrentPage(currentPage + 1);
306 }
307 }
308 }
309
310 void wxPreviewControlBar::OnPrevious(wxCommandEvent& WXUNUSED(event))
311 {
312 wxPrintPreviewBase *preview = GetPrintPreview();
313 if (preview)
314 {
315 int currentPage = preview->GetCurrentPage();
316 if ((preview->GetMinPage() > 0) &&
317 (currentPage > preview->GetMinPage()) &&
318 preview->GetPrintout()->HasPage(currentPage - 1))
319 {
320 preview->SetCurrentPage(currentPage - 1);
321 }
322 }
323 }
324
325 void wxPreviewControlBar::OnZoom(wxCommandEvent& WXUNUSED(event))
326 {
327 int zoom = GetZoomControl();
328 if (GetPrintPreview())
329 GetPrintPreview()->SetZoom(zoom);
330 }
331
332 void wxPreviewControlBar::CreateButtons(void)
333 {
334 #ifdef __GOOD_COMPILER__ // Robert Roebling
335
336 SetSize(0, 0, 400, 40);
337
338 #ifdef __WINDOWS__
339 int fontSize = 9;
340 #else
341 int fontSize = 10;
342 #endif
343
344 if (!buttonFont)
345 buttonFont = wxTheFontList->FindOrCreateFont(fontSize, wxSWISS, wxNORMAL, wxBOLD);
346 SetButtonFont(*buttonFont);
347
348 int buttonWidth = 65;
349 int buttonHeight = 24;
350
351 int x = 5;
352 int y = 5;
353 int gap = 5;
354
355 closeButton = new wxButton(this, wxID_PREVIEW_CLOSE, "Close",
356 wxPoint(x, y), wxSize(buttonWidth, buttonHeight));
357
358 x += gap + buttonWidth;
359
360 if (buttonFlags & wxPREVIEW_PRINT)
361 {
362 printButton = new wxButton(this, wxID_PREVIEW_PRINT, "Print...", wxPoint(x, y),
363 wxSize(buttonWidth, buttonHeight));
364 x += gap + buttonWidth;
365 }
366
367 if (buttonFlags & wxPREVIEW_PREVIOUS)
368 {
369 previousPageButton = new wxButton(this, wxID_PREVIEW_PREVIOUS, "<<", wxPoint(x, y),
370 wxSize(buttonWidth, buttonHeight));
371 x += gap + buttonWidth;
372 }
373
374 if (buttonFlags & wxPREVIEW_NEXT)
375 {
376 nextPageButton = new wxButton(this, wxID_PREVIEW_NEXT, ">>",
377 wxPoint(x, y), wxSize(buttonWidth, buttonHeight));
378 x += gap + buttonWidth;
379 }
380
381 static wxString choices[] = { "10%", "20%", "25%", "30%", "35%", "40%", "45%", "50%", "55%", "60%",
382 "65%", "70%", "75%", "80%", "85%", "90%", "95%", "100%", "110%", "120%", "150%", "200%" };
383 int n = 22;
384 if (buttonFlags & wxPREVIEW_ZOOM)
385 {
386 zoomControl = new wxChoice(this, wxID_PREVIEW_ZOOM, wxPoint(x, y),
387 wxSize(100, -1), n, (wxString *)choices);
388 SetZoomControl(printPreview->GetZoom());
389 }
390
391 closeButton->SetDefault();
392
393 #endif
394 }
395
396 void wxPreviewControlBar::SetZoomControl(int zoom)
397 {
398 #ifdef __GOOD_COMPILER__ // Robert Roebling
399 char buf[20];
400 sprintf(buf, "%d%%", zoom);
401 if (zoomControl)
402 zoomControl->SetStringSelection(buf);
403 #endif
404 }
405
406 int wxPreviewControlBar::GetZoomControl(void)
407 {
408 #ifdef __GOOD_COMPILER__ // Robert Roebling
409 char buf[20];
410 if (zoomControl && zoomControl->GetStringSelection())
411 {
412 strcpy(buf, zoomControl->GetStringSelection());
413 buf[strlen(buf) - 1] = 0;
414 return (int)atoi(buf);
415 }
416 else return 0;
417 #endif
418 }
419
420
421 /*
422 * Preview frame
423 */
424
425 wxPreviewFrame::wxPreviewFrame(wxPrintPreviewBase *preview, wxFrame *parent, const wxString& title,
426 const wxPoint& pos, const wxSize& size, long style, const wxString& name):
427 wxFrame(parent, -1, title, pos, size, style, name)
428 {
429 #ifdef __GOOD_COMPILER__ // Robert Roebling
430
431 printPreview = preview;
432 controlBar = NULL;
433 previewCanvas = NULL;
434 #endif
435 }
436
437 wxPreviewFrame::~wxPreviewFrame(void)
438 {
439 }
440
441 bool wxPreviewFrame::OnClose(void)
442 {
443 #ifdef __GOOD_COMPILER__ // Robert Roebling
444
445 MakeModal(FALSE);
446
447 // Need to delete the printout and the print preview
448 wxPrintout *printout = printPreview->GetPrintout();
449 if (printout)
450 {
451 delete printout;
452 printPreview->SetPrintout(NULL);
453 printPreview->SetCanvas(NULL);
454 printPreview->SetFrame(NULL);
455 }
456 delete printPreview;
457 return TRUE;
458 #endif
459 }
460
461 void wxPreviewFrame::Initialize(void)
462 {
463
464 #ifdef __GOOD_COMPILER__ // Robert Roebling
465
466 CreateStatusBar();
467
468 CreateCanvas();
469 CreateControlBar();
470
471 printPreview->SetCanvas(previewCanvas);
472 printPreview->SetFrame(this);
473
474 // Set layout constraints here
475
476 // Control bar constraints
477 wxLayoutConstraints *c1 = new wxLayoutConstraints;
478 // int w, h;
479 // controlBar->GetSize(&w, &h);
480 int h;
481 #ifdef __WINDOWS__
482 h = 40;
483 #else
484 h = 60;
485 #endif
486
487 c1->left.SameAs (this, wxLeft);
488 c1->top.SameAs (this, wxTop);
489 c1->right.SameAs (this, wxRight);
490 c1->height.Absolute (h);
491
492 controlBar->SetConstraints(c1);
493
494 // Canvas constraints
495 wxLayoutConstraints *c2 = new wxLayoutConstraints;
496
497 c2->left.SameAs (this, wxLeft);
498 c2->top.Below (controlBar);
499 c2->right.SameAs (this, wxRight);
500 c2->bottom.SameAs (this, wxBottom);
501
502 previewCanvas->SetConstraints(c2);
503
504 SetAutoLayout(TRUE);
505
506 MakeModal(TRUE);
507
508 Layout();
509
510 #endif
511 }
512
513 void wxPreviewFrame::CreateCanvas(void)
514 {
515 #ifdef __GOOD_COMPILER__ // Robert Roebling
516
517 previewCanvas = new wxPreviewCanvas(printPreview, this);
518
519 #endif
520 }
521
522 void wxPreviewFrame::CreateControlBar(void)
523 {
524 #ifdef __GOOD_COMPILER__ // Robert Roebling
525
526 long buttons = wxPREVIEW_DEFAULT;
527 if (printPreview->GetPrintoutForPrinting())
528 buttons |= wxPREVIEW_PRINT;
529
530 controlBar = new wxPreviewControlBar(printPreview, buttons, this, wxPoint(0, 0), wxSize(400, 40));
531 controlBar->CreateButtons();
532 #endif
533 }
534
535 /*
536 * Print preview
537 */
538
539 wxPrintPreviewBase::wxPrintPreviewBase(wxPrintout *printout, wxPrintout *printoutForPrinting, wxPrintData *data)
540 {
541
542 #ifdef __GOOD_COMPILER__ // Robert Roebling
543
544 isOk = TRUE;
545 previewPrintout = printout;
546 if (previewPrintout)
547 previewPrintout->SetIsPreview(TRUE);
548
549 printPrintout = printoutForPrinting;
550 if (data)
551 printData = (*data);
552
553 previewCanvas = NULL;
554 previewFrame = NULL;
555 previewBitmap = NULL;
556 currentPage = 1;
557 currentZoom = 30;
558 topMargin = 40;
559 leftMargin = 40;
560 pageWidth = 0;
561 pageHeight = 0;
562
563 printout->OnPreparePrinting();
564
565 // Get some parameters from the printout, if defined
566 int selFrom, selTo;
567 printout->GetPageInfo(&minPage, &maxPage, &selFrom, &selTo);
568
569 #endif
570 }
571
572 wxPrintPreviewBase::~wxPrintPreviewBase(void)
573 {
574 #ifdef __GOOD_COMPILER__ // Robert Roebling
575
576 if (previewPrintout)
577 delete previewPrintout;
578 if (previewBitmap)
579 delete previewBitmap;
580 if (printPrintout)
581 delete printPrintout;
582
583 #endif
584 }
585
586 bool wxPrintPreviewBase::SetCurrentPage(int pageNum)
587 {
588 #ifdef __GOOD_COMPILER__ // Robert Roebling
589 if (currentPage == pageNum)
590 return TRUE;
591
592 currentPage = pageNum;
593 if (previewBitmap)
594 {
595 delete previewBitmap;
596 previewBitmap = NULL;
597 }
598
599 if (previewCanvas)
600 {
601 RenderPage(pageNum);
602 previewCanvas->Refresh();
603 }
604
605 #endif
606 return TRUE;
607 }
608
609 bool wxPrintPreviewBase::PaintPage(wxWindow *canvas, wxDC& dc)
610 {
611
612 #ifdef __GOOD_COMPILER__ // Robert Roebling
613
614 DrawBlankPage(canvas, dc);
615
616 if (!previewBitmap)
617 RenderPage(currentPage);
618
619 if (!previewBitmap)
620 return FALSE;
621
622 if (!canvas)
623 return FALSE;
624
625 int canvasWidth, canvasHeight;
626 canvas->GetSize(&canvasWidth, &canvasHeight);
627
628 float zoomScale = (float)((float)currentZoom/(float)100);
629 float actualWidth = (float)(zoomScale*pageWidth*previewScale);
630 // float actualHeight = (float)(zoomScale*pageHeight*previewScale);
631
632 float x = (float)((canvasWidth - actualWidth)/2.0);
633 if (x < leftMargin)
634 x = (float)leftMargin;
635 float y = (float)topMargin;
636
637 wxMemoryDC temp_dc;
638 temp_dc.SelectObject(*previewBitmap);
639
640 dc.Blit((float)x, (float)y, (float)previewBitmap->GetWidth(), (float)previewBitmap->GetHeight(), &temp_dc, (float)0, (float)0);
641
642 temp_dc.SelectObject(wxNullBitmap);
643
644 #endif
645
646 return TRUE;
647 }
648
649 bool wxPrintPreviewBase::RenderPage(int pageNum)
650 {
651 int canvasWidth, canvasHeight;
652
653 #ifdef __GOOD_COMPILER__ // Robert Roebling
654
655 if (!previewCanvas)
656 {
657 wxMessageBox("wxPrintPreviewBase::RenderPage: must use wxPrintPreviewBase::SetCanvas to let me know about the canvas!",
658 "Print Preview Failure", wxOK);
659 return FALSE;
660 }
661 previewCanvas->GetSize(&canvasWidth, &canvasHeight);
662
663 float zoomScale = (float)((float)currentZoom/(float)100);
664 float actualWidth = (float)(zoomScale*pageWidth*previewScale);
665 float actualHeight = (float)(zoomScale*pageHeight*previewScale);
666
667 float x = (float)((canvasWidth - actualWidth)/2.0);
668 if (x < leftMargin)
669 x = (float)leftMargin;
670 // float y = topMargin;
671
672
673 if (!previewBitmap)
674 {
675 previewBitmap = new wxBitmap((int)actualWidth, (int)actualHeight);
676 if (!previewBitmap || !previewBitmap->Ok())
677 {
678 if (previewBitmap)
679 delete previewBitmap;
680 wxMessageBox("Sorry, not enough memory to create a preview.", "Print Preview Failure", wxOK);
681 return FALSE;
682 }
683 }
684
685 wxMemoryDC memoryDC;
686 memoryDC.SelectObject(*previewBitmap);
687
688 memoryDC.Clear();
689
690 previewPrintout->SetDC(&memoryDC);
691 previewPrintout->SetPageSizePixels(pageWidth, pageHeight);
692
693 previewPrintout->OnBeginPrinting();
694
695
696 if (!previewPrintout->OnBeginDocument(printData.GetFromPage(), printData.GetToPage()))
697 {
698 wxMessageBox("Could not start document preview.", "Print Preview Failure", wxOK);
699
700 memoryDC.SelectObject(wxNullBitmap);
701
702 delete previewBitmap;
703 return FALSE;
704 }
705
706 previewPrintout->OnPrintPage(pageNum);
707 previewPrintout->OnEndDocument();
708 previewPrintout->OnEndPrinting();
709
710 previewPrintout->SetDC(NULL);
711
712 memoryDC.SelectObject(wxNullBitmap);
713 #endif
714
715 char buf[200];
716 if (maxPage != 0)
717 sprintf(buf, "Page %d of %d", pageNum, maxPage);
718 else
719 sprintf(buf, "Page %d", pageNum);
720
721 if (previewFrame)
722 previewFrame->SetStatusText(buf);
723
724 return TRUE;
725 }
726
727
728 bool wxPrintPreviewBase::DrawBlankPage(wxWindow *canvas, wxDC& dc)
729 {
730
731 #ifdef __GOOD_COMPILER__ // Robert Roebling
732
733 int canvasWidth, canvasHeight;
734 canvas->GetSize(&canvasWidth, &canvasHeight);
735
736 float zoomScale = (float)((float)currentZoom/(float)100);
737 float actualWidth = zoomScale*pageWidth*previewScale;
738 float actualHeight = zoomScale*pageHeight*previewScale;
739
740 float x = (float)((canvasWidth - actualWidth)/2.0);
741 if (x < leftMargin)
742 x = (float)leftMargin;
743 float y = (float)topMargin;
744
745 // Draw shadow, allowing for 1-pixel border AROUND the actual page
746 int shadowOffset = 4;
747 dc.SetPen(*wxBLACK_PEN);
748 dc.SetBrush(*wxBLACK_BRUSH);
749 dc.DrawRectangle(x-1 + shadowOffset, y-1 + shadowOffset, actualWidth+2, actualHeight+2);
750
751 // Draw blank page allowing for 1-pixel border AROUND the actual page
752 dc.SetPen(*wxBLACK_PEN);
753 dc.SetBrush(*wxWHITE_BRUSH);
754
755
756 dc.DrawRectangle(x-1, y-1, actualWidth+2, actualHeight+2);
757
758 #endif
759
760 return TRUE;
761 }
762
763 void wxPrintPreviewBase::SetZoom(int percent)
764 {
765 #ifdef __GOOD_COMPILER__ // Robert Roebling
766 if (currentZoom == percent)
767 return;
768
769 currentZoom = percent;
770 if (previewBitmap)
771 {
772 delete previewBitmap;
773 previewBitmap = NULL;
774 }
775 RenderPage(currentPage);
776
777 if (previewCanvas)
778 {
779 previewCanvas->Clear();
780 previewCanvas->Refresh();
781 }
782 #endif
783
784 }