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