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
33 #include "BufferView.h"
35 using Liason::printBuffer;
36 using Liason::getPrinterParams;
39 ControlPrint::ControlPrint(LyXView & lv, Dialogs & d)
40 : ControlDialog<ControlConnectBD>(lv, d),
43 d_.showPrint.connect(SigC::slot(this, &ControlPrint::show));
47 void ControlPrint::apply()
49 if (!lv_.view()->available())
54 if (!printBuffer(lv_.buffer(), params())) {
55 WriteAlert(_("Error:"),
57 _("Check that your parameters are correct"));
62 PrinterParams & ControlPrint::params() const
69 void ControlPrint::setParams()
71 if (params_) delete params_;
72 params_ = new PrinterParams(getPrinterParams(lv_.buffer()));
74 bc().valid(); // so that the user can press Ok
78 void ControlPrint::clearParams()
87 string const ControlPrint::Browse(string const & in_name)
89 string const title = N_("Print to file");
90 string const pattern = "*.ps";
92 // Show the file browser dialog
93 return browseFile(&lv_, in_name, title, pattern,
94 make_pair(string(), string()),
95 make_pair(string(), string()));