diff options
| author | Manolo Gouy <Manolo> | 2010-03-28 10:13:26 +0000 |
|---|---|---|
| committer | Manolo Gouy <Manolo> | 2010-03-28 10:13:26 +0000 |
| commit | 99f2e8b5be1c06c877f48850fd47ebc55fedba3a (patch) | |
| tree | 3ea6c0cda8a7a147ca8dbc972a3655f521e8fbf1 /src | |
| parent | 2a75e82e3df5ac792a8d2e780e4374463bcf654c (diff) | |
Fl_PSfile_Device::start_job(): allow user to customize the file chooser title
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@7349 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
| -rw-r--r-- | src/Fl_PS_Printer.cxx | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/Fl_PS_Printer.cxx b/src/Fl_PS_Printer.cxx index 16ca06239..9a41908fe 100644 --- a/src/Fl_PS_Printer.cxx +++ b/src/Fl_PS_Printer.cxx @@ -40,6 +40,8 @@ #include "print_panel.cxx" #endif +const char *Fl_PSfile_Device::file_chooser_title = "Select a .ps file"; + const Fl_PSfile_Device::page_format Fl_PSfile_Device::page_formats[NO_PAGE_FORMATS] = { // order of enum Page_Format // comes from appendix B of 5003.PPD_Spec_v4.3.pdf @@ -1198,7 +1200,7 @@ int Fl_PSfile_Device::end_page (void) int Fl_PSfile_Device::start_job (int pagecount, enum Page_Format format, enum Page_Layout layout) { Fl_Native_File_Chooser fnfc; - fnfc.title("Create a .ps file"); + fnfc.title(Fl_PSfile_Device::file_chooser_title); fnfc.type(Fl_Native_File_Chooser::BROWSE_SAVE_FILE); fnfc.options(Fl_Native_File_Chooser::SAVEAS_CONFIRM); fnfc.filter("PostScript\t*.ps\n"); @@ -1211,12 +1213,12 @@ int Fl_PSfile_Device::start_job (int pagecount, enum Page_Format format, enum Pa return 0; } -int Fl_PSfile_Device::start_job (const char *fname, int pagecount, enum Page_Format format, enum Page_Layout layout) +int Fl_PSfile_Device::start_job (FILE *ps_output, int pagecount, enum Page_Format format, enum Page_Layout layout) { - output = fopen(fname, "w"); - if(output == NULL) return 1; - ps_filename_ = strdup(fname); - return start_postscript(pagecount, format, layout); + output = ps_output; + ps_filename_ = NULL; + start_postscript(pagecount, format, layout); + return 0; } void Fl_PSfile_Device::end_job (void) @@ -1232,6 +1234,10 @@ void Fl_PSfile_Device::end_job (void) fprintf(output, "GR\n restore\n"); fputs("%%EOF",output); reset(); + fflush(output); + if(ferror(output)) { + fl_alert ("Error during PostScript data output."); + } #if ! (defined(__APPLE__) || defined(WIN32) ) if (print_pipe) pclose(output); |
