Author: manolo
Date: 2010-03-01 00:34:20 -0800 (Mon, 01 Mar 2010)
New Revision: 7181
Log:
Better role division between Fl_PSfile_Device::start_job() and 
Fl_PS_Printer::start_job().

Modified:
   branches/branch-1.3-Fl_Printer/FL/Fl_Printer.H
   branches/branch-1.3-Fl_Printer/src/Fl_PS_Printer.cxx

Modified: branches/branch-1.3-Fl_Printer/FL/Fl_Printer.H
===================================================================
--- branches/branch-1.3-Fl_Printer/FL/Fl_Printer.H      2010-03-01 08:05:10 UTC 
(rev 7180)
+++ branches/branch-1.3-Fl_Printer/FL/Fl_Printer.H      2010-03-01 08:34:20 UTC 
(rev 7181)
@@ -319,7 +319,6 @@
   int top_margin;
   void translate(int x, int y);
   void untranslate(void);
-  int start_postscript (int pagecount, enum Page_Format format);
 
 protected:
   FILE *output;
@@ -329,6 +328,7 @@
   static const char *page_format_names[NO_PAGE_FORMATS];
   
   uchar bg_r, bg_g, bg_b;
+  int start_postscript (int pagecount, enum Page_Format format);
   /*  int alpha_mask(const uchar * data, int w, int h, int D, int LD=0);
    */
   void draw(const char* s, int n, int x, int y) {transformed_draw(s,n,x,y); };
@@ -362,8 +362,7 @@
   void place(double x, double y, double tx, double ty, double scale = 1);
   
   Fl_PSfile_Device(void);
-  int start_job(int pagecount, enum Page_Format format, int *frompage = NULL, 
int *topage = NULL);
-  inline int start_job(int pagecount, int *frompage = NULL, int *topage = 
NULL) {return start_job(pagecount,A4,frompage,topage); };
+  int start_job(int pagecount, enum Page_Format format = A4);
   int start_page (void);
   int printable_rect(int *w, int *h);
   void margins(int *left, int *top, int *right, int *bottom);

Modified: branches/branch-1.3-Fl_Printer/src/Fl_PS_Printer.cxx
===================================================================
--- branches/branch-1.3-Fl_Printer/src/Fl_PS_Printer.cxx        2010-03-01 
08:05:10 UTC (rev 7180)
+++ branches/branch-1.3-Fl_Printer/src/Fl_PS_Printer.cxx        2010-03-01 
08:34:20 UTC (rev 7181)
@@ -1139,7 +1139,7 @@
   return 0;
 }
 
-int Fl_PSfile_Device::start_job (int pagecount, enum Page_Format format, int 
*frompage, int *topage)
+int Fl_PSfile_Device::start_job (int pagecount, enum Page_Format format)
 {
   Fl_Native_File_Chooser fnfc;
   fnfc.title("Create a .ps file");
@@ -1150,8 +1150,6 @@
   output = fopen(fnfc.filename(), "w");
   if(output == NULL) return 1;
   ps_filename_ = strdup(fnfc.filename());
-  if(frompage) *frompage = 1;
-  if(topage) *topage = pagecount;
   return start_postscript(pagecount, format);
 }
 
@@ -1181,15 +1179,22 @@
 
 #if ! (defined(__APPLE__) || defined(WIN32) )
 int Fl_PS_Printer::start_job(int pages, int *firstpage, int *lastpage) {
-  // TODO should start a print dialog and return the selected paper format and 
the temp .ps file
-  // and desired page range
-  return Fl_PSfile_Device::start_job(pages,A4,firstpage,lastpage); 
+  // TODO should start and close a print dialog and 
+  // transmit the selected paper format to the 
Fl_PSfile_Device::start_postscript() call,
+  // create a temp .ps file, open it for writing on member var output, 
+  // and strdup its name to member var ps_filename_
+  // return the user's desired page range to the caller and transmit the range 
total to start_postscript()
+  // terminate by : return Fl_PSfile_Device::start_postscript(pages, format); 
+  enum Page_Format format = A4; // temporary
+  if(firstpage) *firstpage = 1; // temporary
+  if(lastpage) *lastpage = pages; // temporary
+  return Fl_PSfile_Device::start_job(pages, format); // temporary
 }
 
 void Fl_PS_Printer::end_job(void)
 {
   Fl_PSfile_Device::end_job(); 
-  // TODO should print the ps_filename_ file
+  // TODO should send the ps_filename_ file to the print queue and delete it
 }
 
 #endif

_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit

Reply via email to