From 506fa9d03492189c33f4a86189eda52bffe64b91 Mon Sep 17 00:00:00 2001 From: Manolo Gouy Date: Sat, 27 Mar 2010 08:16:56 +0000 Subject: Minor improvement of printing preferences storage git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@7344 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/Fl_PS_Printer.cxx | 3 --- src/print_panel.cxx | 11 +++++------ 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/Fl_PS_Printer.cxx b/src/Fl_PS_Printer.cxx index eb9268e4c..16ca06239 100644 --- a/src/Fl_PS_Printer.cxx +++ b/src/Fl_PS_Printer.cxx @@ -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; diff --git a/src/print_panel.cxx b/src/print_panel.cxx index e5721a3c8..f8bfc2a1a 100644 --- a/src/print_panel.cxx +++ b/src/print_panel.cxx @@ -48,8 +48,7 @@ #include #include -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(); } -- cgit v1.2.3