Added more paper sizes for Fl_PostScript_Printer.

Fixed saving of the paper size preference for the "Print to File" printer.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@9158 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Manolo Gouy 2011-10-29 14:50:04 +00:00
parent 1e88511efa
commit c9345e7d01
2 changed files with 41 additions and 6 deletions

View File

@ -140,7 +140,7 @@ Fl_PostScript_File_Device::~Fl_PostScript_File_Device() {
#ifndef FL_DOXYGEN
#if ! (defined(__APPLE__) || defined(WIN32) )
#include "print_panel.cxx"
# include "print_panel.cxx"
#endif
// Prolog string
@ -1538,7 +1538,35 @@ int Fl_PostScript_Printer::start_job(int pages, int *firstpage, int *lastpage) {
// get options
format = print_page_size->value() ? Fl_Paged_Device::A4 : Fl_Paged_Device::LETTER;
switch (print_page_size->value()) {
case 0:
format = Fl_Paged_Device::LETTER;
break;
case 2:
format = Fl_Paged_Device::LEGAL;
break;
case 3:
format = Fl_Paged_Device::EXECUTIVE;
break;
case 4:
format = Fl_Paged_Device::A3;
break;
case 5:
format = Fl_Paged_Device::A5;
break;
case 6:
format = Fl_Paged_Device::B5;
break;
case 7:
format = Fl_Paged_Device::ENVELOPE;
break;
case 8:
format = Fl_Paged_Device::DLE;
break;
default:
format = Fl_Paged_Device::A4;
}
{ // page range choice
int from = 1, to = pages;
if (print_pages->value()) {

View File

@ -111,8 +111,15 @@ static void cb_print_properties_panel(Fl_Double_Window*, void*) {
}
static Fl_Menu_Item menu_print_page_size[] = {
{"Letter", 0, 0, 0, 0, FL_NORMAL_LABEL, 0, 14, 0},
{"A4", 0, 0, 0, 0, FL_NORMAL_LABEL, 0, 14, 0},
{"Letter", 0, 0, 0, 0, FL_NORMAL_LABEL, 0, 14, 0},
{"A4", 0, 0, 0, 0, FL_NORMAL_LABEL, 0, 14, 0},
{"Legal", 0, 0, 0, 0, FL_NORMAL_LABEL, 0, 14, 0},
{"Executive", 0, 0, 0, 0, FL_NORMAL_LABEL, 0, 14, 0},
{"A3", 0, 0, 0, 0, FL_NORMAL_LABEL, 0, 14, 0},
{"A5", 0, 0, 0, 0, FL_NORMAL_LABEL, 0, 14, 0},
{"B5", 0, 0, 0, 0, FL_NORMAL_LABEL, 0, 14, 0},
{"Com10", 0, 0, 0, 0, FL_NORMAL_LABEL, 0, 14, 0},
{"DL", 0, 0, 0, 0, FL_NORMAL_LABEL, 0, 14, 0},
{0,0,0,0,0,0,0,0,0}
};
@ -218,10 +225,10 @@ static void cb_Save(Fl_Return_Button*, void*) {
int val;
const char *printer = (const char *)print_choice->menu()[print_choice->value()].user_data();
snprintf(name, sizeof(name), "%s/page_size", printer);
snprintf(name, sizeof(name), "%s/page_size", printer == NULL ? "" : printer);
print_prefs.set(name, print_page_size->value());
snprintf(name, sizeof(name), "%s/output_mode", printer);
snprintf(name, sizeof(name), "%s/output_mode", printer == NULL ? "" : printer);
for (val = 0; val < 4; val ++) {
if (print_output_mode[val]->value()) break;
}