#include "ControlPrint.h"
-#include "ButtonController.h"
#include "frontend_helpers.h"
#include "Buffer.h"
#include "BufferParams.h"
#include "FuncRequest.h"
#include "gettext.h"
-#include "PrinterParams.h"
#include "support/convert.h"
#include "support/FileFilterList.h"
ControlPrint::ControlPrint(Dialog & parent)
- : Dialog::Controller(parent),
- params_(0)
+ : Controller(parent)
{}
bool ControlPrint::initialiseParams(std::string const &)
{
/// get global printer parameters
- string const name = changeExtension(kernel().buffer().fileName(),
+ string const name = changeExtension(buffer().fileName(),
lyxrc.print_file_extension);
- params_.reset(new PrinterParams(PrinterParams::PRINTER,
- lyxrc.printer, name));
+ params_ = PrinterParams(PrinterParams::PRINTER, lyxrc.printer, name);
- dialog().bc().valid(); // so that the user can press Ok
+ dialog().setButtonsValid(true); // so that the user can press Ok
return true;
}
void ControlPrint::clearParams()
{
- params_.reset();
-}
-
-
-PrinterParams & ControlPrint::params() const
-{
- BOOST_ASSERT(params_.get());
- return *params_;
+ params_ = PrinterParams();
}
docstring const ControlPrint::browse(docstring const & in_name) const
{
- return browseRelFile(in_name, lyx::from_utf8(kernel().buffer().filePath()),
+ return browseRelFile(in_name, lyx::from_utf8(buffer().filePath()),
_("Print to file"),
FileFilterList(_("PostScript files (*.ps)")),
true);
command += lyxrc.print_extra_options + ' ';
}
- command += kernel().buffer().params().dvips_options() + ' ';
+ command += buffer().params().dvips_options();
string const target = (pp.target == PrinterParams::PRINTER) ?
"printer" : "file";
(pp.printer_name.empty() ? "default" : pp.printer_name) :
pp.file_name;
- string const data = target + " " + target_name + " " + command;
- kernel().dispatch(FuncRequest(getLfun(), data));
+ string const data = target + " \"" + target_name + "\" \"" + command + '"';
+ dispatch(FuncRequest(getLfun(), data));
}
} // namespace frontend