2001-02-14 19:43:56 +00:00
|
|
|
/**
|
2001-08-19 13:25:15 +00:00
|
|
|
* \file QPrint.C
|
2001-08-29 21:11:30 +00:00
|
|
|
* Copyright 2001 the LyX Team
|
|
|
|
* Read the file COPYING
|
2001-02-14 19:43:56 +00:00
|
|
|
*
|
2001-08-29 21:11:30 +00:00
|
|
|
* \author John Levon <moz@compsoc.man.ac.uk>
|
|
|
|
* \author Edwin Leuven, leuven@fee.uva.nl
|
2001-02-14 19:43:56 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
2001-08-29 21:11:30 +00:00
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma implementation
|
|
|
|
#endif
|
|
|
|
|
2002-06-19 03:38:44 +00:00
|
|
|
#include "LyXView.h"
|
|
|
|
#include "ControlPrint.h"
|
|
|
|
#include "support/lstrings.h"
|
|
|
|
#include "gettext.h"
|
|
|
|
|
|
|
|
#include "QPrint.h"
|
|
|
|
#include "QPrintDialog.h"
|
|
|
|
#include "Qt2BC.h"
|
|
|
|
|
2001-08-29 21:11:30 +00:00
|
|
|
#include <qlineedit.h>
|
|
|
|
#include <qcheckbox.h>
|
|
|
|
#include <qradiobutton.h>
|
|
|
|
#include <qspinbox.h>
|
|
|
|
#include <qpushbutton.h>
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2002-06-19 03:38:44 +00:00
|
|
|
// FIXME FIXME QPrintDialog is getting destructed twice !!!!
|
|
|
|
|
2001-08-29 21:11:30 +00:00
|
|
|
typedef Qt2CB<ControlPrint, Qt2DB<QPrintDialog> > base_class;
|
2001-02-14 19:43:56 +00:00
|
|
|
|
2002-08-12 14:28:43 +00:00
|
|
|
QPrint::QPrint()
|
|
|
|
: base_class(_("Print"))
|
2001-02-14 19:43:56 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2001-08-19 13:25:15 +00:00
|
|
|
|
2001-08-29 21:11:30 +00:00
|
|
|
void QPrint::build_dialog()
|
2001-02-14 19:43:56 +00:00
|
|
|
{
|
2001-08-29 21:11:30 +00:00
|
|
|
dialog_.reset(new QPrintDialog(this));
|
|
|
|
|
2002-03-21 21:21:28 +00:00
|
|
|
bc().setOK(dialog_->printPB);
|
2001-08-29 21:11:30 +00:00
|
|
|
bc().setCancel(dialog_->closePB);
|
2001-02-14 19:43:56 +00:00
|
|
|
}
|
|
|
|
|
2001-08-19 13:25:15 +00:00
|
|
|
|
2001-08-29 21:11:30 +00:00
|
|
|
void QPrint::update_contents()
|
2001-02-14 19:43:56 +00:00
|
|
|
{
|
2001-08-29 21:11:30 +00:00
|
|
|
PrinterParams & pp = controller().params();
|
2001-08-19 13:25:15 +00:00
|
|
|
|
2001-08-29 21:11:30 +00:00
|
|
|
dialog_->printerED->setText(pp.printer_name.c_str());
|
|
|
|
dialog_->fileED->setText(pp.file_name.c_str());
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2001-08-29 21:11:30 +00:00
|
|
|
dialog_->printerRB->setChecked(true);
|
|
|
|
if (pp.target == PrinterParams::FILE)
|
|
|
|
dialog_->fileRB->setChecked(true);
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2001-08-29 21:11:30 +00:00
|
|
|
dialog_->reverseCB->setChecked(pp.reverse_order);
|
2001-02-14 19:43:56 +00:00
|
|
|
|
2002-09-11 19:57:49 +00:00
|
|
|
dialog_->copiesSB->setValue(pp.count_copies);
|
|
|
|
|
|
|
|
dialog_->oddCB->setChecked(pp.odd_pages);
|
|
|
|
dialog_->evenCB->setChecked(pp.even_pages);
|
|
|
|
|
|
|
|
if (pp.all_pages) {
|
|
|
|
dialog_->allRB->setChecked(true);
|
|
|
|
return;
|
2001-02-14 19:43:56 +00:00
|
|
|
}
|
|
|
|
|
2002-09-11 19:57:49 +00:00
|
|
|
dialog_->rangeRB->setChecked(true);
|
|
|
|
|
|
|
|
QString s;
|
|
|
|
s.setNum(pp.from_page);
|
|
|
|
dialog_->fromED->setText(s);
|
|
|
|
s.setNum(pp.to_page);
|
|
|
|
dialog_->toED->setText(s);
|
2001-02-14 19:43:56 +00:00
|
|
|
}
|
|
|
|
|
2001-08-19 13:25:15 +00:00
|
|
|
|
2001-08-29 21:11:30 +00:00
|
|
|
void QPrint::apply()
|
2001-02-14 19:43:56 +00:00
|
|
|
{
|
2001-08-29 21:11:30 +00:00
|
|
|
PrinterParams::Target t = PrinterParams::PRINTER;
|
|
|
|
if (dialog_->fileRB->isChecked())
|
|
|
|
t = PrinterParams::FILE;
|
|
|
|
|
|
|
|
PrinterParams const pp(t,
|
|
|
|
dialog_->printerED->text().latin1(),
|
|
|
|
dialog_->fileED->text().latin1(),
|
2002-09-11 19:57:49 +00:00
|
|
|
dialog_->allRB->isChecked(),
|
|
|
|
dialog_->fromED->text().toUInt(),
|
|
|
|
dialog_->toED->text().toUInt(),
|
|
|
|
dialog_->oddCB->isChecked(),
|
|
|
|
dialog_->evenCB->isChecked(),
|
|
|
|
dialog_->copiesSB->text().toUInt(),
|
|
|
|
dialog_->collateCB->isChecked(),
|
|
|
|
dialog_->reverseCB->isChecked());
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2001-08-29 21:11:30 +00:00
|
|
|
controller().params() = pp;
|
2001-02-14 19:43:56 +00:00
|
|
|
}
|