-/* This file is part of
- * ======================================================
- *
- * LyX, The Document Processor
- *
- * Copyright 2001 The LyX Team.
+/**
+ * \file ControlPrint.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
*
- *======================================================
+ * \author Angus Leeming
*
- * \file ControlPrint.C
- * \author Angus Leeming, a.leeming@.ac.uk
+ * Full author contact details are available in file CREDITS
*/
#include <config.h>
-#include <utility>
#ifdef __GNUG__
#pragma implementation
#endif
+#include "ControlPrint.h"
+
#include "ViewBase.h"
#include "ButtonControllerBase.h"
-#include "ControlPrint.h"
+
#include "buffer.h"
-#include "Dialogs.h"
-#include "LyXView.h"
-#include "lyxrc.h"
-#include "PrinterParams.h"
-#include "Liason.h"
-#include "helper_funcs.h" // browseFile
-#include "lyx_gui_misc.h" // WriteAlert
#include "gettext.h"
+#include "helper_funcs.h"
+#include "PrinterParams.h"
+
+#include "frontends/Alert.h"
+#include "frontends/Liason.h"
+
+#include "support/LAssert.h"
using Liason::printBuffer;
using Liason::getPrinterParams;
-using std::make_pair;
+
ControlPrint::ControlPrint(LyXView & lv, Dialogs & d)
- : ControlDialog<ControlConnectBD>(lv, d),
- params_(0)
-{
- d_.showPrint.connect(SigC::slot(this, &ControlPrint::show));
-}
+ : ControlDialogBD(lv, d),
+ params_(0)
+{}
void ControlPrint::apply()
{
- if (!lv_.view()->available())
+ if (!bufferIsAvailable())
return;
-
+
view().apply();
- if (!printBuffer(lv_.buffer(), params())) {
- WriteAlert(_("Error:"),
+ if (!printBuffer(buffer(), params())) {
+ Alert::alert(_("Error:"),
_("Unable to print"),
_("Check that your parameters are correct"));
}
void ControlPrint::setParams()
{
if (params_) delete params_;
- params_ = new PrinterParams(getPrinterParams(lv_.buffer()));
+ params_ = new PrinterParams(getPrinterParams(buffer()));
bc().valid(); // so that the user can press Ok
}
string const ControlPrint::Browse(string const & in_name)
{
- string const title = N_("Print to file");
+ string const title = _("Print to file");
string const pattern = "*.ps";
// Show the file browser dialog
- return browseFile(&lv_, in_name, title, pattern,
- make_pair(string(), string()),
- make_pair(string(), string()));
+ return browseRelFile(&lv_, in_name, buffer()->filePath(),
+ title, pattern);
}