-/* This file is part of
- * ======================================================
- *
- * LyX, The Document Processor
- *
- * Copyright 1995 Matthias Ettrich
- * Copyright 1995-2001 The LyX Team.
+/**
+ * \file Liason.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
*
- * ====================================================== */
+ * \author Allan Rae
+ *
+ * Full author contact details are available in file CREDITS
+ */
#include <config.h>
#include "lyxrc.h"
#include "PrinterParams.h"
-#include "LyXView.h"
+#include "frontends/LyXView.h"
#include "BufferView.h"
#include "buffer.h"
#include "exporter.h"
#include "converter.h"
-#include "lyx_gui_misc.h"
#include "support/LAssert.h"
#include "support/lstrings.h"
#include "support/path.h"
#include "support/systemcall.h"
-using std::endl;
+#include "debug.h" // for lyxerr
-extern LyXRC lyxrc;
+using std::endl;
namespace Liason {
}
-bool printBuffer(Buffer * buffer, PrinterParams const & pp)
+bool printBuffer(Buffer * buffer, PrinterParams const & pp)
{
string command(lyxrc.print_command + ' ');
-
+
if (pp.target == PrinterParams::PRINTER
&& lyxrc.print_adapt_output // dvips wants a printer name
&& !pp.printer_name.empty()) {// printer name given
+ ' ';
}
- switch (pp.which_pages) {
- case PrinterParams::EVEN:
- command += lyxrc.print_evenpage_flag + ' ';
- break;
-
- case PrinterParams::ODD:
- command += lyxrc.print_oddpage_flag + ' ';
- break;
-
- default:
- // only option left is print all of them
- break;
- }
-
- if (!pp.from_page.empty()) {
+ if (!pp.all_pages && pp.from_page) {
command += lyxrc.print_pagerange_flag + ' ';
- command += pp.from_page;
+ command += tostr(pp.from_page);
if (pp.to_page) {
- // we have a range "from-to"
+ // we have a range "from-to"
command += '-';
command += tostr(pp.to_page);
}
command += ' ';
}
- if (pp.reverse_order) {
- command += lyxrc.print_reverse_flag + ' ';
+ // If both are, or both are not selected, then skip the odd/even printing
+ if (pp.odd_pages != pp.even_pages) {
+ if (pp.odd_pages) {
+ command += lyxrc.print_oddpage_flag + ' ';
+ } else if (pp.even_pages) {
+ command += lyxrc.print_evenpage_flag + ' ';
+ }
}
- if (1 < pp.count_copies) {
- if (pp.unsorted_copies) {
- command += lyxrc.print_copies_flag;
- } else {
+ if (pp.count_copies > 1) {
+ if (pp.sorted_copies) {
command += lyxrc.print_collcopies_flag;
+ } else {
+ command += lyxrc.print_copies_flag;
}
command += ' ';
command += tostr(pp.count_copies);
command += ' ';
}
+
+ if (pp.reverse_order) {
+ command += lyxrc.print_reverse_flag + ' ';
+ }
if (!lyxrc.print_extra_options.empty()) {
command += lyxrc.print_extra_options + ' ';
res = one.startscript(Systemcall::DontWait, command);
break;
}
+
+ lyxerr[Debug::LATEX] << "printBuffer: \"" << command << "\"\n";
+
return res == 0;
}