PostScrit print dialog: memorize page size and orientation user's preferences

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@7342 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Manolo Gouy 2010-03-26 18:10:39 +00:00
parent 44d22726b6
commit f766b7930d
3 changed files with 10 additions and 10 deletions

View File

@ -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

View File

@ -392,7 +392,6 @@ static const char * prolog_3 = // prolog relevant only if lang_level >2
// end prolog
Fl_PSfile_Device::Fl_PSfile_Device(void)
{
close_cmd_ = 0;
@ -1257,6 +1256,7 @@ int Fl_Printer::start_job(int pages, int *firstpage, int *lastpage) {
// 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 @@ int Fl_Printer::start_job(int pages, int *firstpage, int *lastpage) {
{ 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;

View File

@ -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 @@ static void cb_Save(Fl_Return_Button*, void*) {
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 @@ void print_update_status() {
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();
}