Skip to content

Commit

Permalink
PostScrit print dialog: memorize page size and orientation user's pre…
Browse files Browse the repository at this point in the history
…ferences

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@7342 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
  • Loading branch information
Manolo Gouy authored and Manolo Gouy committed Mar 26, 2010
1 parent 44d2272 commit f766b79
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion FL/Fl_PSfile_Device.H
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion src/Fl_PS_Printer.cxx
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand All @@ -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;
Expand Down
15 changes: 7 additions & 8 deletions src/print_panel.cxx
Expand Up @@ -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;
Expand Down Expand Up @@ -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*) {
Expand Down Expand Up @@ -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();
}

Expand Down

0 comments on commit f766b79

Please sign in to comment.