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
17 #pragma implementation
20 #include "ControlPrint.h"
22 #include "ButtonControllerBase.h"
24 #include "frontends/LyXView.h"
25 #include "PrinterParams.h"
27 #include "helper_funcs.h"
28 #include "frontends/Alert.h"
30 #include "BufferView.h"
31 #include "support/LAssert.h"
33 using Liason::printBuffer;
34 using Liason::getPrinterParams;
37 ControlPrint::ControlPrint(LyXView & lv, Dialogs & d)
38 : ControlDialogBD(lv, d),
43 void ControlPrint::apply()
45 if (!lv_.view()->available())
50 if (!printBuffer(lv_.buffer(), params())) {
51 Alert::alert(_("Error:"),
53 _("Check that your parameters are correct"));
58 PrinterParams & ControlPrint::params() const
65 void ControlPrint::setParams()
67 if (params_) delete params_;
68 params_ = new PrinterParams(getPrinterParams(lv_.buffer()));
70 bc().valid(); // so that the user can press Ok
74 void ControlPrint::clearParams()
83 string const ControlPrint::Browse(string const & in_name)
85 string const title = _("Print to file");
86 string const pattern = "*.ps";
88 // Show the file browser dialog
89 return browseRelFile(&lv_, in_name, lv_.buffer()->filePath(),