]> git.saurik.com Git - wxWidgets.git/blame - src/common/prntbase.cpp
Changes to help with Win16 compilation.
[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
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
69typedef signed short int SHORT ;
70#endif
71
72#if !defined(__WIN32__) // 3.x uses FARPROC for dialogs
73#define DLGPROC FARPROC
74#endif
75
76LONG APIENTRY _EXPORT wxAbortProc(HDC hPr, int Code);
77#endif
78 // End __WINDOWS__
79
80#if !USE_SHARED_LIBRARY
81IMPLEMENT_CLASS(wxPrinterBase, wxObject)
82IMPLEMENT_ABSTRACT_CLASS(wxPrintout, wxObject)
83IMPLEMENT_CLASS(wxPreviewCanvas, wxWindow)
84IMPLEMENT_CLASS(wxPreviewControlBar, wxWindow)
85IMPLEMENT_CLASS(wxPreviewFrame, wxFrame)
86IMPLEMENT_CLASS(wxPrintPreviewBase, wxObject)
87
88BEGIN_EVENT_TABLE(wxPrintAbortDialog, wxDialog)
89 EVT_BUTTON(wxID_CANCEL, wxPrintAbortDialog::OnCancel)
90END_EVENT_TABLE()
91
92BEGIN_EVENT_TABLE(wxPreviewCanvas, wxScrolledWindow)
93 EVT_PAINT(wxPreviewCanvas::OnPaint)
94 EVT_SYS_COLOUR_CHANGED(wxPreviewCanvas::OnSysColourChanged)
95END_EVENT_TABLE()
96#endif
97
98/*
99 * Printer
100 */
101
102wxPrinterBase::wxPrinterBase(wxPrintData *data)
103{
104 currentPrintout = NULL;
105 abortWindow = NULL;
106 abortIt = FALSE;
107 if (data)
108 printData = (*data);
109}
110
111wxWindow *wxPrinterBase::abortWindow = NULL;
112bool wxPrinterBase::abortIt = FALSE;
113
114wxPrinterBase::~wxPrinterBase(void)
115{
116}
117
118void 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
126wxWindow *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
140void 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
149wxPrintout::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
164wxPrintout::~wxPrintout(void)
165{
166 if (printoutTitle)
167 delete[] printoutTitle;
168}
169
170bool wxPrintout::OnBeginDocument(int WXUNUSED(startPage), int WXUNUSED(endPage))
171{
172 return GetDC()->StartDoc("Printing");
173}
174
175void wxPrintout::OnEndDocument(void)
176{
177 GetDC()->EndDoc();
178}
179
180void wxPrintout::OnBeginPrinting(void)
181{
182}
183
184void wxPrintout::OnEndPrinting(void)
185{
186}
187
188bool wxPrintout::HasPage(int page)
189{
190 return (page == 1);
191}
192
193void 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
205wxPreviewCanvas::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
215wxPreviewCanvas::~wxPreviewCanvas(void)
216{
217}
218
219void 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.
230void 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
243BEGIN_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)
250END_EVENT_TABLE()
251
252wxPreviewControlBar::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
266wxFont *wxPreviewControlBar::buttonFont = NULL;
267
268wxPreviewControlBar::~wxPreviewControlBar(void)
269{
270}
271
272void 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
283void wxPreviewControlBar::OnClose(wxCommandEvent& WXUNUSED(event))
284{
285 wxPreviewFrame *frame = (wxPreviewFrame *)GetParent();
286 frame->Close(TRUE);
287}
288
289void wxPreviewControlBar::OnPrint(wxCommandEvent& WXUNUSED(event))
290{
291 wxPrintPreviewBase *preview = GetPrintPreview();
292 preview->Print(TRUE);
293}
294
295void 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
310void 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
325void wxPreviewControlBar::OnZoom(wxCommandEvent& WXUNUSED(event))
326{
327 int zoom = GetZoomControl();
328 if (GetPrintPreview())
329 GetPrintPreview()->SetZoom(zoom);
330}
331
332void 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
396void 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
406int 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;
aad5220b
JS
417#else
418 return 0;
c801d85f
KB
419#endif
420}
421
422
423/*
424 * Preview frame
425 */
426
427wxPreviewFrame::wxPreviewFrame(wxPrintPreviewBase *preview, wxFrame *parent, const wxString& title,
428 const wxPoint& pos, const wxSize& size, long style, const wxString& name):
429 wxFrame(parent, -1, title, pos, size, style, name)
430{
431#ifdef __GOOD_COMPILER__ // Robert Roebling
432
433 printPreview = preview;
434 controlBar = NULL;
435 previewCanvas = NULL;
436#endif
437}
438
439wxPreviewFrame::~wxPreviewFrame(void)
440{
441}
442
443bool wxPreviewFrame::OnClose(void)
444{
445#ifdef __GOOD_COMPILER__ // Robert Roebling
446
447 MakeModal(FALSE);
448
449 // Need to delete the printout and the print preview
450 wxPrintout *printout = printPreview->GetPrintout();
451 if (printout)
452 {
453 delete printout;
454 printPreview->SetPrintout(NULL);
455 printPreview->SetCanvas(NULL);
456 printPreview->SetFrame(NULL);
457 }
458 delete printPreview;
459 return TRUE;
aad5220b
JS
460#else
461 return FALSE;
c801d85f
KB
462#endif
463}
464
465void wxPreviewFrame::Initialize(void)
466{
467
468#ifdef __GOOD_COMPILER__ // Robert Roebling
469
470 CreateStatusBar();
471
472 CreateCanvas();
473 CreateControlBar();
474
475 printPreview->SetCanvas(previewCanvas);
476 printPreview->SetFrame(this);
477
478 // Set layout constraints here
479
480 // Control bar constraints
481 wxLayoutConstraints *c1 = new wxLayoutConstraints;
482// int w, h;
483// controlBar->GetSize(&w, &h);
484 int h;
485#ifdef __WINDOWS__
486 h = 40;
487#else
488 h = 60;
489#endif
490
491 c1->left.SameAs (this, wxLeft);
492 c1->top.SameAs (this, wxTop);
493 c1->right.SameAs (this, wxRight);
494 c1->height.Absolute (h);
495
496 controlBar->SetConstraints(c1);
497
498 // Canvas constraints
499 wxLayoutConstraints *c2 = new wxLayoutConstraints;
500
501 c2->left.SameAs (this, wxLeft);
502 c2->top.Below (controlBar);
503 c2->right.SameAs (this, wxRight);
504 c2->bottom.SameAs (this, wxBottom);
505
506 previewCanvas->SetConstraints(c2);
507
508 SetAutoLayout(TRUE);
509
510 MakeModal(TRUE);
511
512 Layout();
513
514#endif
515}
516
517void wxPreviewFrame::CreateCanvas(void)
518{
519#ifdef __GOOD_COMPILER__ // Robert Roebling
520
521 previewCanvas = new wxPreviewCanvas(printPreview, this);
522
523#endif
524}
525
526void wxPreviewFrame::CreateControlBar(void)
527{
528#ifdef __GOOD_COMPILER__ // Robert Roebling
529
530 long buttons = wxPREVIEW_DEFAULT;
531 if (printPreview->GetPrintoutForPrinting())
532 buttons |= wxPREVIEW_PRINT;
533
534 controlBar = new wxPreviewControlBar(printPreview, buttons, this, wxPoint(0, 0), wxSize(400, 40));
535 controlBar->CreateButtons();
536#endif
537}
538
539/*
540 * Print preview
541 */
542
543wxPrintPreviewBase::wxPrintPreviewBase(wxPrintout *printout, wxPrintout *printoutForPrinting, wxPrintData *data)
544{
545
546#ifdef __GOOD_COMPILER__ // Robert Roebling
547
548 isOk = TRUE;
549 previewPrintout = printout;
550 if (previewPrintout)
551 previewPrintout->SetIsPreview(TRUE);
552
553 printPrintout = printoutForPrinting;
554 if (data)
555 printData = (*data);
556
557 previewCanvas = NULL;
558 previewFrame = NULL;
559 previewBitmap = NULL;
560 currentPage = 1;
561 currentZoom = 30;
562 topMargin = 40;
563 leftMargin = 40;
564 pageWidth = 0;
565 pageHeight = 0;
566
567 printout->OnPreparePrinting();
568
569 // Get some parameters from the printout, if defined
570 int selFrom, selTo;
571 printout->GetPageInfo(&minPage, &maxPage, &selFrom, &selTo);
572
573#endif
574}
575
576wxPrintPreviewBase::~wxPrintPreviewBase(void)
577{
578#ifdef __GOOD_COMPILER__ // Robert Roebling
579
580 if (previewPrintout)
581 delete previewPrintout;
582 if (previewBitmap)
583 delete previewBitmap;
584 if (printPrintout)
585 delete printPrintout;
586
587#endif
588}
589
590bool wxPrintPreviewBase::SetCurrentPage(int pageNum)
591{
592#ifdef __GOOD_COMPILER__ // Robert Roebling
593 if (currentPage == pageNum)
594 return TRUE;
595
596 currentPage = pageNum;
597 if (previewBitmap)
598 {
599 delete previewBitmap;
600 previewBitmap = NULL;
601 }
602
603 if (previewCanvas)
604 {
605 RenderPage(pageNum);
606 previewCanvas->Refresh();
607 }
608
609#endif
610 return TRUE;
611}
612
613bool wxPrintPreviewBase::PaintPage(wxWindow *canvas, wxDC& dc)
614{
615
616#ifdef __GOOD_COMPILER__ // Robert Roebling
617
618 DrawBlankPage(canvas, dc);
619
620 if (!previewBitmap)
621 RenderPage(currentPage);
622
623 if (!previewBitmap)
624 return FALSE;
625
626 if (!canvas)
627 return FALSE;
628
629 int canvasWidth, canvasHeight;
630 canvas->GetSize(&canvasWidth, &canvasHeight);
631
632 float zoomScale = (float)((float)currentZoom/(float)100);
633 float actualWidth = (float)(zoomScale*pageWidth*previewScale);
634// float actualHeight = (float)(zoomScale*pageHeight*previewScale);
635
636 float x = (float)((canvasWidth - actualWidth)/2.0);
637 if (x < leftMargin)
638 x = (float)leftMargin;
639 float y = (float)topMargin;
640
641 wxMemoryDC temp_dc;
642 temp_dc.SelectObject(*previewBitmap);
643
644 dc.Blit((float)x, (float)y, (float)previewBitmap->GetWidth(), (float)previewBitmap->GetHeight(), &temp_dc, (float)0, (float)0);
645
646 temp_dc.SelectObject(wxNullBitmap);
647
648#endif
649
650 return TRUE;
651}
652
653bool wxPrintPreviewBase::RenderPage(int pageNum)
654{
655 int canvasWidth, canvasHeight;
656
657#ifdef __GOOD_COMPILER__ // Robert Roebling
658
659 if (!previewCanvas)
660 {
661 wxMessageBox("wxPrintPreviewBase::RenderPage: must use wxPrintPreviewBase::SetCanvas to let me know about the canvas!",
662 "Print Preview Failure", wxOK);
663 return FALSE;
664 }
665 previewCanvas->GetSize(&canvasWidth, &canvasHeight);
666
667 float zoomScale = (float)((float)currentZoom/(float)100);
668 float actualWidth = (float)(zoomScale*pageWidth*previewScale);
669 float actualHeight = (float)(zoomScale*pageHeight*previewScale);
670
671 float x = (float)((canvasWidth - actualWidth)/2.0);
672 if (x < leftMargin)
673 x = (float)leftMargin;
674// float y = topMargin;
675
676
677 if (!previewBitmap)
678 {
679 previewBitmap = new wxBitmap((int)actualWidth, (int)actualHeight);
680 if (!previewBitmap || !previewBitmap->Ok())
681 {
682 if (previewBitmap)
683 delete previewBitmap;
684 wxMessageBox("Sorry, not enough memory to create a preview.", "Print Preview Failure", wxOK);
685 return FALSE;
686 }
687 }
688
689 wxMemoryDC memoryDC;
690 memoryDC.SelectObject(*previewBitmap);
691
692 memoryDC.Clear();
693
694 previewPrintout->SetDC(&memoryDC);
695 previewPrintout->SetPageSizePixels(pageWidth, pageHeight);
696
697 previewPrintout->OnBeginPrinting();
698
699
700 if (!previewPrintout->OnBeginDocument(printData.GetFromPage(), printData.GetToPage()))
701 {
702 wxMessageBox("Could not start document preview.", "Print Preview Failure", wxOK);
703
704 memoryDC.SelectObject(wxNullBitmap);
705
706 delete previewBitmap;
707 return FALSE;
708 }
709
710 previewPrintout->OnPrintPage(pageNum);
711 previewPrintout->OnEndDocument();
712 previewPrintout->OnEndPrinting();
713
714 previewPrintout->SetDC(NULL);
715
716 memoryDC.SelectObject(wxNullBitmap);
717#endif
718
719 char buf[200];
720 if (maxPage != 0)
721 sprintf(buf, "Page %d of %d", pageNum, maxPage);
722 else
723 sprintf(buf, "Page %d", pageNum);
724
725 if (previewFrame)
726 previewFrame->SetStatusText(buf);
727
728 return TRUE;
729}
730
731
732bool wxPrintPreviewBase::DrawBlankPage(wxWindow *canvas, wxDC& dc)
733{
734
735#ifdef __GOOD_COMPILER__ // Robert Roebling
736
737 int canvasWidth, canvasHeight;
738 canvas->GetSize(&canvasWidth, &canvasHeight);
739
740 float zoomScale = (float)((float)currentZoom/(float)100);
741 float actualWidth = zoomScale*pageWidth*previewScale;
742 float actualHeight = zoomScale*pageHeight*previewScale;
743
744 float x = (float)((canvasWidth - actualWidth)/2.0);
745 if (x < leftMargin)
746 x = (float)leftMargin;
747 float y = (float)topMargin;
748
749 // Draw shadow, allowing for 1-pixel border AROUND the actual page
750 int shadowOffset = 4;
751 dc.SetPen(*wxBLACK_PEN);
752 dc.SetBrush(*wxBLACK_BRUSH);
753 dc.DrawRectangle(x-1 + shadowOffset, y-1 + shadowOffset, actualWidth+2, actualHeight+2);
754
755 // Draw blank page allowing for 1-pixel border AROUND the actual page
756 dc.SetPen(*wxBLACK_PEN);
757 dc.SetBrush(*wxWHITE_BRUSH);
758
759
760 dc.DrawRectangle(x-1, y-1, actualWidth+2, actualHeight+2);
761
762#endif
763
764 return TRUE;
765}
766
767void wxPrintPreviewBase::SetZoom(int percent)
768{
769#ifdef __GOOD_COMPILER__ // Robert Roebling
770 if (currentZoom == percent)
771 return;
772
773 currentZoom = percent;
774 if (previewBitmap)
775 {
776 delete previewBitmap;
777 previewBitmap = NULL;
778 }
779 RenderPage(currentPage);
780
781 if (previewCanvas)
782 {
783 previewCanvas->Clear();
784 previewCanvas->Refresh();
785 }
786#endif
787
788}