Author: manolo
Date: 2010-03-26 11:10:39 -0700 (Fri, 26 Mar 2010)
New Revision: 7342
Log:
PostScrit print dialog: memorize page size and orientation user's preferences

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

Modified: branches/branch-1.3/FL/Fl_PSfile_Device.H
===================================================================
--- branches/branch-1.3/FL/Fl_PSfile_Device.H   2010-03-26 16:12:18 UTC (rev 
7341)
+++ branches/branch-1.3/FL/Fl_PSfile_Device.H   2010-03-26 18:10:39 UTC (rev 
7342)
@@ -25,7 +25,7 @@
 //     http://www.fltk.org/str.php
 //
 
-#include <FL/Fl_Printer.H>
+#include <FL/Fl_Printer.H> // must stay here
 
 #ifndef Fl_PSfile_Device_H
 #define Fl_PSfile_Device_H

Modified: branches/branch-1.3/src/Fl_PS_Printer.cxx
===================================================================
--- branches/branch-1.3/src/Fl_PS_Printer.cxx   2010-03-26 16:12:18 UTC (rev 
7341)
+++ branches/branch-1.3/src/Fl_PS_Printer.cxx   2010-03-26 18:10:39 UTC (rev 
7342)
@@ -392,7 +392,6 @@
 
 // end prolog 
 
-
 Fl_PSfile_Device::Fl_PSfile_Device(void)
 {
   close_cmd_ = 0;
@@ -1257,6 +1256,7 @@
 
   // first test version for print dialog
 
+  print_prefs = new Fl_Preferences(Fl_Preferences::USER, "fltk.org", 
"print_support");
   if (!print_panel) make_print_panel();
   print_load();
   print_selection->deactivate();
@@ -1266,6 +1266,7 @@
   { char tmp[10]; snprintf(tmp, sizeof(tmp), "%d", pages); 
print_to->value(tmp); }
   print_panel->show(); // this is modal
   while (print_panel->shown()) Fl::wait();
+  delete print_prefs;
   
   if (!print_start) // user clicked cancel
     return 1;

Modified: branches/branch-1.3/src/print_panel.cxx
===================================================================
--- branches/branch-1.3/src/print_panel.cxx     2010-03-26 16:12:18 UTC (rev 
7341)
+++ branches/branch-1.3/src/print_panel.cxx     2010-03-26 18:10:39 UTC (rev 
7342)
@@ -48,7 +48,7 @@
 #include <FL/Fl_Preferences.H>
 #include <FL/Fl_Int_Input.H>
 
-// extern Fl_Preferences fluid_prefs;
+static Fl_Preferences *print_prefs;
 
 static Fl_Double_Window *print_panel=(Fl_Double_Window *)0;
 static Fl_Group *print_panel_controls=(Fl_Group *)0;
@@ -230,13 +230,13 @@
   const char *printer = (const char 
*)print_choice->menu()[print_choice->value()].user_data();
 
   snprintf(name, sizeof(name), "%s/page_size", printer);
-  // fluid_prefs.set(name, print_page_size->value());
+  print_prefs->set(name, print_page_size->value());
 
   snprintf(name, sizeof(name), "%s/output_mode", printer);
   for (val = 0; val < 4; val ++) {
     if (print_output_mode[val]->value()) break;
   }
-  // fluid_prefs.set(name, val);       // FIXME -- save prefs
+  print_prefs->set(name, val);
 }
 
 static void cb_Cancel1(Fl_Button*, void*) {
@@ -583,15 +583,14 @@
   print_status->label(status);
 
   char name[1024];
-  // int val;
-  int val = 0; // FIXME -- see below: read preferences !
+  int val;
 
   snprintf(name, sizeof(name), "%s/page_size", printer);
-  // fluid_prefs.get(name, val, 0);
-  print_page_size->value(1); // FIXME
+  print_prefs->get(name, val, 1);
+  print_page_size->value(val);
 
   snprintf(name, sizeof(name), "%s/output_mode", printer);
-  // fluid_prefs.get(name, val, 0);
+  print_prefs->get(name, val, 0);
   print_output_mode[val]->setonly();
 }
 

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

Reply via email to