1 /* This file is part of
2 * ======================================================
4 * LyX, The Document Processor
6 * Copyright 2001 The LyX Team.
8 *======================================================
10 * \file ControlPrint.C
11 * \author Angus Leeming, a.leeming@.ac.uk
18 #pragma implementation
22 #include "ButtonControllerBase.h"
23 #include "ControlPrint.h"
26 #include "frontends/LyXView.h"
27 #include "PrinterParams.h"
29 #include "helper_funcs.h"
30 #include "frontends/Alert.h"
32 #include "BufferView.h"
33 #include "support/LAssert.h"
35 #include <boost/bind.hpp>
37 using Liason::printBuffer;
38 using Liason::getPrinterParams;
41 ControlPrint::ControlPrint(LyXView & lv, Dialogs & d)
42 : ControlDialogBD(lv, d),
45 d_.showPrint = boost::bind(&ControlPrint::show, this);
49 void ControlPrint::apply()
51 if (!lv_.view()->available())
56 if (!printBuffer(lv_.buffer(), params())) {
57 Alert::alert(_("Error:"),
59 _("Check that your parameters are correct"));
64 PrinterParams & ControlPrint::params() const
71 void ControlPrint::setParams()
73 if (params_) delete params_;
74 params_ = new PrinterParams(getPrinterParams(lv_.buffer()));
76 bc().valid(); // so that the user can press Ok
80 void ControlPrint::clearParams()
89 string const ControlPrint::Browse(string const & in_name)
91 string const title = _("Print to file");
92 string const pattern = "*.ps";
94 // Show the file browser dialog
95 return browseRelFile(&lv_, in_name, lv_.buffer()->filePath(),