Added an Fl_Printer destructor that's useful under MSWin when printing is aborted

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@7471 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Manolo Gouy 2010-04-08 16:58:28 +00:00
parent 63b746fabc
commit a9b13f973b
3 changed files with 12 additions and 1 deletions

View File

@ -113,6 +113,10 @@ public:
#endif
int end_page (void);
void end_job (void);
/**
@brief The destructor.
*/
~Fl_Printer(void);
#ifdef FL_DOXYGEN
/** \name These attributes apply to the Xlib platform only.
\{

View File

@ -39,6 +39,10 @@ Fl_Printer::Fl_Printer(void) : Fl_Abstract_Printer() {
type_ = gdi_printer;
}
Fl_Printer::~Fl_Printer(void) {
if (hPr) end_job();
}
static void WIN_SetupPrinterDeviceContext(HDC prHDC)
{
if ( !prHDC ) return;
@ -81,7 +85,7 @@ int Fl_Printer::start_job (int pagecount, int *frompage, int *topage)
prerr = StartDoc (hPr, &di);
if (prerr < 1) {
abortPrint = TRUE;
fl_alert ("StartDoc error %d", prerr);
//fl_alert ("StartDoc error %d", prerr);
err = 1;
}
} else {
@ -129,6 +133,7 @@ void Fl_Printer::end_job (void)
GlobalFree (pd.hDevNames);
}
}
hPr = NULL;
}
void Fl_Printer::absolute_printable_rect(int *x, int *y, int *w, int *h)

View File

@ -43,6 +43,8 @@ Fl_Printer::Fl_Printer(void)
type_ = quartz_printer;
}
Fl_Printer::~Fl_Printer(void) {}
int Fl_Printer::start_job (int pagecount, int *frompage, int *topage)
//printing using a Quartz graphics context
//returns 0 iff OK