Author: manolo
Date: 2010-03-16 08:17:33 -0700 (Tue, 16 Mar 2010)
New Revision: 7277
Log:
Added Fl_PSfile_Device::start_job() with user-given filename.
Modified:
branches/branch-1.3/FL/Fl_Printer.H
branches/branch-1.3/src/Fl_PS_Printer.cxx
Modified: branches/branch-1.3/FL/Fl_Printer.H
===================================================================
--- branches/branch-1.3/FL/Fl_Printer.H 2010-03-16 14:47:40 UTC (rev 7276)
+++ branches/branch-1.3/FL/Fl_Printer.H 2010-03-16 15:17:33 UTC (rev 7277)
@@ -66,9 +66,6 @@
/**
@brief Starts a print job.
*
- Fully implemented for Mac OS X and MSWindows. For other platforms,
temporarily
- implemented as an Fl_PSfile_Device, that is, graphics go to an A4-sized
local PostScript file,
- and frompage/topage arguments are ignored.
@param[in] pagecount the total number of pages of the job
@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
@@ -511,16 +508,26 @@
@return 0 iff OK
*/
int start_job(int pagecount, enum Page_Format format = A4, enum
Page_Layout layout = PORTRAIT);
+
+ /**
+ @brief Begins the session where all graphics will go to named PostScript
file.
+ *
+ @param fname The name of the output local PostScript file.
+ @param pagecount The total number of pages to be created.
+ @param format Desired page format.
+ @param layout Desired page layout.
+ @return 0 iff OK
+ */
+ int start_job(const char *fname, int pagecount, enum Page_Format format =
A4, enum Page_Layout layout = PORTRAIT);
+
};
#ifndef FL_DOXYGEN
#ifdef __APPLE__
-class Fl_Printer : public Fl_Quartz_Printer {
-};
+typedef Fl_Quartz_Printer Fl_Printer;
#elif defined(WIN32)
-class Fl_Printer : public Fl_GDI_Printer {
-};
+typedef Fl_GDI_Printer Fl_Printer;
#else
class Fl_PS_Printer : public Fl_PSfile_Device {
public:
@@ -528,8 +535,7 @@
~Fl_PS_Printer(void) {};
int start_job(int pages, int *firstpage = NULL, int *lastpage = NULL);
};
-class Fl_Printer : public Fl_PS_Printer {
-};
+typedef Fl_PS_Printer Fl_Printer;
#endif // __APPLE__
Modified: branches/branch-1.3/src/Fl_PS_Printer.cxx
===================================================================
--- branches/branch-1.3/src/Fl_PS_Printer.cxx 2010-03-16 14:47:40 UTC (rev
7276)
+++ branches/branch-1.3/src/Fl_PS_Printer.cxx 2010-03-16 15:17:33 UTC (rev
7277)
@@ -178,9 +178,12 @@
// width (string) x y show_pos_width
"/show_pos_width {GS moveto dup stringwidth pop 3 2 roll exch div -1 matrix
scale concat "
"show GR } bind def\n"
-//"/show_pos_width {GS moveto dup stringwidth pop 3 2 roll exch div dup /sx
exch def -1 matrix scale concat "
-//"show 6 FS sx 10 string cvs show GR } bind def\n" // displays also scaling
value
+//"/show_pos_width {GS moveto dup stringwidth pop 3 2 roll exch div "
+//"dup 0.85 lt {pop 0.85} if "
+//"dup /sx exch def -1 matrix scale concat "
+//"show 8 FS sx 10 string cvs 0 4 getinterval 0 -3 rmoveto show GR } bind
def\n" // displays also scaling value
+
;
@@ -1186,6 +1189,14 @@
return start_postscript(pagecount, format, layout);
}
+int Fl_PSfile_Device::start_job (const char *fname, int pagecount, enum
Page_Format format, enum Page_Layout layout)
+{
+ output = fopen(fname, "w");
+ if(output == NULL) return 1;
+ ps_filename_ = strdup(fname);
+ return start_postscript(pagecount, format, layout);
+}
+
void Fl_PSfile_Device::end_job (void)
// finishes PostScript & closes file
{
_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit