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"
28 #include "PrinterParams.h"
30 #include "helper_funcs.h" // browseFile
31 #include "lyx_gui_misc.h" // WriteAlert
34 using Liason::printBuffer;
35 using Liason::getPrinterParams;
38 ControlPrint::ControlPrint(LyXView & lv, Dialogs & d)
39 : ControlDialog<ControlConnectBD>(lv, d),
42 d_.showPrint.connect(SigC::slot(this, &ControlPrint::show));
46 void ControlPrint::apply()
48 if (!lv_.view()->available())
53 if (!printBuffer(lv_.buffer(), params())) {
54 WriteAlert(_("Error:"),
56 _("Check that your parameters are correct"));
61 PrinterParams & ControlPrint::params() const
68 void ControlPrint::setParams()
70 if (params_) delete params_;
71 params_ = new PrinterParams(getPrinterParams(lv_.buffer()));
73 bc().valid(); // so that the user can press Ok
77 void ControlPrint::clearParams()
86 string const ControlPrint::Browse(string const & in_name)
88 string const title = N_("Print to file");
89 string const pattern = "*.ps";
91 // Show the file browser dialog
92 return browseFile(&lv_, in_name, title, pattern,
93 make_pair(string(), string()),
94 make_pair(string(), string()));