Listing 3: Important printing functions

//...........
//message response function which responds to the selection of the
// Print item in the File menue

LRESULT TWndw::MsFilePrint(WPARAM,LPARAM)
{
  if (printer)
     {TWndwPrintout printout("Prisma", this);
      printer->Print(this,printout,TRUE);}
  return 1;
}
//...........

//...........
//TWndwPrintout constructor and PrintPage member function
TWndwPrintout::TWndwPrintout(const char *title,
    TWindow *w) : TPrintout(title)
{    
    tw = w;  //stores a pointer to the client window
}

void TWndwPrintout::PrintPage(int, TRect &rct, unsigned)
{
    DC->SetMapMode(MM_ISOTROPIC);
    TRect wndSize = tw->GetClientRect();
    DC->SetWindowExt(wndSize.Size());
    DC->SetViewportExt(PageSize);
    tw->Paint(*DC, FALSE, rct);

}
//...........

//...........
// TWndw::Paint() member function called by TWndwPrintout::PrintPage

void TWndw::Paint(TDC &pDC,BOOL,TRect&)
{
    if (ll->NSpectra()>0) pl->Plot(&pDC);
}
//..........
//End of File