Minor improvement of printing preferences storage

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@7344 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Manolo Gouy 2010-03-27 08:16:56 +00:00
parent 8863c6d21f
commit 506fa9d034
2 changed files with 5 additions and 9 deletions

View File

@ -1255,8 +1255,6 @@ int Fl_Printer::start_job(int pages, int *firstpage, int *lastpage) {
enum Page_Layout layout;
// 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,7 +1264,6 @@ 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,8 +48,7 @@
#include <FL/Fl_Preferences.H>
#include <FL/Fl_Int_Input.H>
static Fl_Preferences *print_prefs;
static Fl_Preferences print_prefs(Fl_Preferences::USER, "fltk.org", "printers");
static Fl_Double_Window *print_panel=(Fl_Double_Window *)0;
static Fl_Group *print_panel_controls=(Fl_Group *)0;
static Fl_Choice *print_choice=(Fl_Choice *)0;
@ -230,13 +229,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);
print_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;
}
print_prefs->set(name, val);
print_prefs.set(name, val);
}
static void cb_Cancel1(Fl_Button*, void*) {
@ -586,11 +585,11 @@ void print_update_status() {
int val;
snprintf(name, sizeof(name), "%s/page_size", printer);
print_prefs->get(name, val, 1);
print_prefs.get(name, val, 1);
print_page_size->value(val);
snprintf(name, sizeof(name), "%s/output_mode", printer);
print_prefs->get(name, val, 0);
print_prefs.get(name, val, 0);
print_output_mode[val]->setonly();
}