]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/controllers/ControlPrint.C
Georg Baum\'s no-tempdir patch
[lyx.git] / src / frontends / controllers / ControlPrint.C
index f848c79df4a6a7c82b18f29ae30b3eeac9b99da0..da85afa9c0aac3ded18768b604834284bd12484b 100644 (file)
@@ -16,6 +16,7 @@
 #include "ButtonController.h"
 
 #include "buffer.h"
+#include "bufferparams.h"
 #include "gettext.h"
 #include "helper_funcs.h"
 #include "PrinterParams.h"
 
 #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: