Author: manolo
Date: 2011-10-29 07:50:04 -0700 (Sat, 29 Oct 2011)
New Revision: 9158
Log:
Added more paper sizes for Fl_PostScript_Printer.
Fixed saving of the paper size preference for the "Print to File" printer.

Modified:
   branches/branch-1.3/src/Fl_PostScript.cxx
   branches/branch-1.3/src/print_panel.cxx

Modified: branches/branch-1.3/src/Fl_PostScript.cxx
===================================================================
--- branches/branch-1.3/src/Fl_PostScript.cxx   2011-10-28 21:01:14 UTC (rev 
9157)
+++ branches/branch-1.3/src/Fl_PostScript.cxx   2011-10-29 14:50:04 UTC (rev 
9158)
@@ -140,7 +140,7 @@
 #ifndef FL_DOXYGEN
 
 #if ! (defined(__APPLE__) || defined(WIN32) )
-  #include "print_panel.cxx"
+#  include "print_panel.cxx"
 #endif
 
 //  Prolog string 
@@ -1538,7 +1538,35 @@
 
   // get options
 
-  format = print_page_size->value() ? Fl_Paged_Device::A4 : 
Fl_Paged_Device::LETTER;
+  switch (print_page_size->value()) {
+    case 0:
+      format = Fl_Paged_Device::LETTER;
+      break;
+    case 2:
+      format = Fl_Paged_Device::LEGAL;
+      break;
+    case 3:
+      format = Fl_Paged_Device::EXECUTIVE;
+      break;
+    case 4:
+      format = Fl_Paged_Device::A3;
+      break;
+    case 5:
+      format = Fl_Paged_Device::A5;
+      break;
+    case 6:
+      format = Fl_Paged_Device::B5;
+      break;
+    case 7:
+      format = Fl_Paged_Device::ENVELOPE;
+      break;
+    case 8:
+      format = Fl_Paged_Device::DLE;
+      break;
+    default:
+      format = Fl_Paged_Device::A4;
+      }
+      
   { // page range choice
     int from = 1, to = pages;
     if (print_pages->value()) {

Modified: branches/branch-1.3/src/print_panel.cxx
===================================================================
--- branches/branch-1.3/src/print_panel.cxx     2011-10-28 21:01:14 UTC (rev 
9157)
+++ branches/branch-1.3/src/print_panel.cxx     2011-10-29 14:50:04 UTC (rev 
9158)
@@ -111,8 +111,15 @@
 }
 
 static Fl_Menu_Item menu_print_page_size[] = {
- {"Letter", 0,  0, 0, 0, FL_NORMAL_LABEL, 0, 14, 0},
- {"A4", 0,  0, 0, 0, FL_NORMAL_LABEL, 0, 14, 0},
+  {"Letter", 0,  0, 0, 0, FL_NORMAL_LABEL, 0, 14, 0},
+  {"A4", 0,  0, 0, 0, FL_NORMAL_LABEL, 0, 14, 0},
+  {"Legal", 0,  0, 0, 0, FL_NORMAL_LABEL, 0, 14, 0},
+  {"Executive", 0,  0, 0, 0, FL_NORMAL_LABEL, 0, 14, 0},
+  {"A3", 0,  0, 0, 0, FL_NORMAL_LABEL, 0, 14, 0},
+  {"A5", 0,  0, 0, 0, FL_NORMAL_LABEL, 0, 14, 0},
+  {"B5", 0,  0, 0, 0, FL_NORMAL_LABEL, 0, 14, 0},
+  {"Com10", 0,  0, 0, 0, FL_NORMAL_LABEL, 0, 14, 0},
+  {"DL", 0,  0, 0, 0, FL_NORMAL_LABEL, 0, 14, 0},
  {0,0,0,0,0,0,0,0,0}
 };
 
@@ -218,10 +225,10 @@
   int val;
   const char *printer = (const char 
*)print_choice->menu()[print_choice->value()].user_data();
 
-  snprintf(name, sizeof(name), "%s/page_size", printer);
+  snprintf(name, sizeof(name), "%s/page_size", printer == NULL ? "" : printer);
   print_prefs.set(name, print_page_size->value());
 
-  snprintf(name, sizeof(name), "%s/output_mode", printer);
+  snprintf(name, sizeof(name), "%s/output_mode", printer == NULL ? "" : 
printer);
   for (val = 0; val < 4; val ++) {
     if (print_output_mode[val]->value()) break;
   }

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

Reply via email to