From c0ed5480058bfcdc3d09b3025bd20936730a2fe9 Mon Sep 17 00:00:00 2001 From: Manolo Gouy Date: Thu, 26 Feb 2015 15:38:54 +0000 Subject: 1) More detailed Doxygen documentation for classes Fl_Printer, Fl_Surface_Device, Fl_Display_Device and Fl_Graphics_Driver. 2) Support call of Fl_Printer::start_job(pagecount) with pagecount=0 when the number of pages is unavailable. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10592 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/Fl_GDI_Printer.cxx | 1 + src/Fl_Paged_Device.cxx | 2 +- src/Fl_PostScript.cxx | 4 +++- src/Fl_Quartz_Printer.mm | 6 ++++-- 4 files changed, 9 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/Fl_GDI_Printer.cxx b/src/Fl_GDI_Printer.cxx index 7247da350..60366424f 100644 --- a/src/Fl_GDI_Printer.cxx +++ b/src/Fl_GDI_Printer.cxx @@ -55,6 +55,7 @@ static void WIN_SetupPrinterDeviceContext(HDC prHDC) int Fl_System_Printer::start_job (int pagecount, int *frompage, int *topage) // returns 0 iff OK { + if (pagecount == 0) pagecount = 10000; DWORD commdlgerr; DOCINFO di; char docName [256]; diff --git a/src/Fl_Paged_Device.cxx b/src/Fl_Paged_Device.cxx index 88eeef507..060837c24 100644 --- a/src/Fl_Paged_Device.cxx +++ b/src/Fl_Paged_Device.cxx @@ -146,7 +146,7 @@ void Fl_Paged_Device::print_window_part(Fl_Window *win, int x, int y, int w, int /** @brief Starts a print job. - @param[in] pagecount the total number of pages of the job + @param[in] pagecount the total number of pages of the job (or 0 if you don't know the number of pages) @param[out] frompage if non-null, *frompage is set to the first page the user wants printed @param[out] topage if non-null, *topage is set to the last page the user wants printed @return 0 if OK, non-zero if any error diff --git a/src/Fl_PostScript.cxx b/src/Fl_PostScript.cxx index 6becbd990..967e09cd9 100644 --- a/src/Fl_PostScript.cxx +++ b/src/Fl_PostScript.cxx @@ -1547,7 +1547,10 @@ void Fl_PostScript_File_Device::end_job (void) Fl_Display_Device::display_device()->set_current(); } +#endif // FL_DOXYGEN + #if ! (defined(__APPLE__) || defined(WIN32) ) +/** Starts a print job. */ int Fl_PostScript_Printer::start_job(int pages, int *firstpage, int *lastpage) { enum Fl_Paged_Device::Page_Format format; enum Fl_Paged_Device::Page_Layout layout; @@ -1645,7 +1648,6 @@ int Fl_PostScript_Printer::start_job(int pages, int *firstpage, int *lastpage) { #endif // ! (defined(__APPLE__) || defined(WIN32) ) -#endif // FL_DOXYGEN // // End of "$Id$". diff --git a/src/Fl_Quartz_Printer.mm b/src/Fl_Quartz_Printer.mm index 9770532f6..fba79c5e5 100644 --- a/src/Fl_Quartz_Printer.mm +++ b/src/Fl_Quartz_Printer.mm @@ -80,8 +80,10 @@ int Fl_System_Printer::start_job (int pagecount, int *frompage, int *topage) PMGetFirstPage(printSettings, &from32); if (frompage) *frompage = (int)from32; PMGetLastPage(printSettings, &to32); - if (topage) *topage = (int)to32; - if(topage && *topage > pagecount) *topage = pagecount; + if (topage) { + *topage = (int)to32; + if (*topage > pagecount && pagecount > 0) *topage = pagecount; + } status = PMSessionBeginCGDocumentNoDialog(printSession, printSettings, pageFormat);//from 10.4 } else -- cgit v1.2.3