X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ffrontends%2Fcontrollers%2FControlPrint.C;h=da85afa9c0aac3ded18768b604834284bd12484b;hb=d891a896f47df2d7f048ad7e4498f2fd4f3c5d3b;hp=f848c79df4a6a7c82b18f29ae30b3eeac9b99da0;hpb=97035ea00a7abf49f66b5bec960458996098449f;p=lyx.git diff --git a/src/frontends/controllers/ControlPrint.C b/src/frontends/controllers/ControlPrint.C index f848c79df4..da85afa9c0 100644 --- a/src/frontends/controllers/ControlPrint.C +++ b/src/frontends/controllers/ControlPrint.C @@ -16,6 +16,7 @@ #include "ButtonController.h" #include "buffer.h" +#include "bufferparams.h" #include "gettext.h" #include "helper_funcs.h" #include "PrinterParams.h" @@ -25,14 +26,25 @@ #include "support/tostr.h" #include "support/filetools.h" +#include "support/globbing.h" #include "support/path.h" #include "support/systemcall.h" #include "debug.h" -using namespace lyx::support; +using lyx::support::bformat; +using lyx::support::ChangeExtension; +using lyx::support::FileFilterList; +using lyx::support::IsDirWriteable; +using lyx::support::MakeAbsPath; +using lyx::support::MakeDisplayPath; +using lyx::support::Path; +using lyx::support::QuoteName; +using lyx::support::Systemcall; using std::endl; +using std::string; + ControlPrint::ControlPrint(LyXView & lv, Dialogs & d) : ControlDialogBD(lv, d), @@ -42,7 +54,7 @@ ControlPrint::ControlPrint(LyXView & lv, Dialogs & d) PrinterParams & ControlPrint::params() const { - Assert(params_); + BOOST_ASSERT(params_); return *params_; } @@ -70,14 +82,12 @@ void ControlPrint::clearParams() } -string const ControlPrint::Browse(string const & in_name) +string const ControlPrint::browse(string const & in_name) const { - string const title = _("Print to file"); - string const pattern = "*.ps"; - - // Show the file browser dialog - return browseRelFile(in_name, buffer()->filePath(), - title, pattern, true); + return browseRelFile(in_name, buffer().filePath(), + _("Print to file"), + FileFilterList("PostScript files (*.ps)"), + true); } @@ -152,7 +162,7 @@ void ControlPrint::apply() command += lyxrc.print_extra_options + ' '; } - command += buffer()->params.dvips_options() + ' '; + command += buffer()->params().dvips_options() + ' '; if (!Exporter::Export(buffer(), "dvi", true)) { showPrintError(buffer()->fileName()); @@ -160,10 +170,7 @@ void ControlPrint::apply() } // Push directory path. - string path = buffer()->filePath(); - if (lyxrc.use_tempdir || !IsDirWriteable(path)) { - path = buffer()->tmppath; - } + string const path = buffer()->temppath(); Path p(path); // there are three cases here: