]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/controllers/ControlPrint.C
This file is part of LyX, the document processor.
[lyx.git] / src / frontends / controllers / ControlPrint.C
index e5d631901ea12f81b6aad1666d7bafb7f97d2a54..cd4339cb988ca8610b2709ea6e46e69b2fb4ea24 100644 (file)
@@ -1,56 +1,53 @@
-/* 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)
-{
-       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"));
        }
@@ -67,7 +64,7 @@ PrinterParams & ControlPrint::params() const
 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
 }
@@ -84,11 +81,10 @@ void ControlPrint::clearParams()
 
 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);
 }