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
21 #include "ControlPrint.h"
26 #include "PrinterParams.h"
28 #include "helper_funcs.h" // browseFile
29 #include "lyx_gui_misc.h" // WriteAlert
31 using Liason::printBuffer;
32 using Liason::getPrinterParams;
35 ControlPrint::ControlPrint(LyXView & lv, Dialogs & d)
36 : ControlDialog<ControlConnectBD>(lv, d)
38 d_.showPrint.connect(SigC::slot(this, &ControlPrint::show));
42 void ControlPrint::apply()
44 if (!lv_.view()->available())
49 if (!printBuffer(lv_.buffer(), params())) {
50 WriteAlert(_("Error:"),
52 _("Check that your parameters are correct"));
57 PrinterParams & ControlPrint::params() const
64 void ControlPrint::setParams()
66 if (params_) delete params_;
67 params_ = new PrinterParams(getPrinterParams(lv_.buffer()));
69 bc().valid(); // so that the user can press Ok
73 void ControlPrint::clearParams()
82 string const ControlPrint::Browse(string const & in_name)
84 string const title = N_("Print to file");
85 string const pattern = "*.ps";
87 // Show the file browser dialog
88 return browseFile(&lv_, in_name, title, pattern,
89 make_pair(string(), string()),
90 make_pair(string(), string()));