Author: manolo
Date: 2010-03-09 07:54:39 -0800 (Tue, 09 Mar 2010)
New Revision: 7234
Log:
Added file overwrite confirm dialog and proper margin values.

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-09 11:10:20 UTC 
(rev 7233)
+++ branches/branch-1.3-Fl_Printer/FL/Fl_Printer.H      2010-03-09 15:54:39 UTC 
(rev 7234)
@@ -100,8 +100,7 @@
       the full page.
       *
       Values are in the same unit as that used by FLTK drawing functions. They 
are changed
-      by scale() calls. Values are as given by the system on Mac OS X and 
MSWindows; they are approximate
-      on other platforms and for PostScript file output (Fl_PSfile_Device).
+      by scale() calls.
       @param[out] left If non-null, *left is set to the left margin size.
       @param[out] top If non-null, *top is set to the top margin size.
       @param[out] right If non-null, *right is set to the right margin size.
@@ -528,7 +527,6 @@
   Fl_PS_Printer(void) {};
   ~Fl_PS_Printer(void) {};
   int start_job(int pages, int *firstpage = NULL, int *lastpage = NULL);
-  void end_job(void);
 };
 class Fl_Printer : public Fl_PS_Printer {
 };

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-09 
11:10:20 UTC (rev 7233)
+++ branches/branch-1.3-Fl_Printer/src/Fl_PS_Printer.cxx        2010-03-09 
15:54:39 UTC (rev 7234)
@@ -326,6 +326,14 @@
 {
   int w, h, x;
   this->set_current();
+  if (format == A4) {
+    left_margin = 18;
+    top_margin = 18;
+  }
+  else {
+    left_margin = 12;
+    top_margin = 12;
+  }
   page_format_ = (enum Page_Format)(format | layout);
   
   fputs("%!PS-Adobe-3.0\n", output);
@@ -1114,8 +1122,6 @@
   x_offset = 0;
   y_offset = 0;
   scale_x = scale_y = 1.;
-  left_margin = 30;
-  top_margin = 30;
   angle = 0;
   fprintf(output, "GR GR GS %d %d translate GS\n", left_margin, top_margin);
   return 0;
@@ -1131,6 +1137,7 @@
   Fl_Native_File_Chooser fnfc;
   fnfc.title("Create a .ps file");
   fnfc.type(Fl_Native_File_Chooser::BROWSE_SAVE_FILE);
+  fnfc.options(Fl_Native_File_Chooser::SAVEAS_CONFIRM);
   fnfc.filter("PostScript\t*.ps\n");
   // Show native chooser
   if ( fnfc.show() ) return 1;
@@ -1173,19 +1180,11 @@
 #if ! (defined(__APPLE__) || defined(WIN32) )
 int Fl_PS_Printer::start_job(int pages, int *firstpage, int *lastpage) {
   // TODO:
-  // should start and close a print dialog             *DONE*
-  // transmit the selected paper format to
-  // the Fl_PSfile_Device::start_postscript() call     *DONE*
-  // create a temp .ps file, open it for writing
-  // on member var output, 
-  // and strdup its name to member var ps_filename_    *DONE*
   // return the user's desired page range to the caller
   // and transmit the range total to start_postscript()        *TODO*
-  // terminate by:
-  // return Fl_PSfile_Device::start_postscript(pages, format); *DONE*
 
-  enum Page_Format format = A4; // default
-  enum Page_Layout layout = PORTRAIT; // default
+  enum Page_Format format;
+  enum Page_Layout layout;
   if(firstpage) *firstpage = 1; // temporary
   if(lastpage) *lastpage = pages; // temporary
 
@@ -1244,11 +1243,5 @@
 }
 */
 
-void Fl_PS_Printer::end_job(void)
-{
-  Fl_PSfile_Device::end_job(); 
-  // 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