2001-02-14 19:43:56 +00:00
|
|
|
/**
|
2001-08-19 13:25:15 +00:00
|
|
|
* \file QPrintDialog.C
|
2002-09-24 13:57:09 +00:00
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
2001-02-14 19:43:56 +00:00
|
|
|
*
|
2002-09-24 13:57:09 +00:00
|
|
|
* \author John Levon
|
|
|
|
* \author Edwin Leuven
|
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS
|
2001-02-14 19:43:56 +00:00
|
|
|
*/
|
|
|
|
|
2002-06-19 03:38:44 +00:00
|
|
|
#include <config.h>
|
2002-09-24 13:57:09 +00:00
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma implementation
|
|
|
|
#endif
|
|
|
|
|
2002-10-20 01:48:28 +00:00
|
|
|
#include "gettext.h"
|
2002-06-19 03:38:44 +00:00
|
|
|
#include "support/filetools.h"
|
|
|
|
#include "support/lstrings.h"
|
|
|
|
|
|
|
|
#include "QPrint.h"
|
|
|
|
#include "QPrintDialog.h"
|
|
|
|
|
2001-08-19 13:25:15 +00:00
|
|
|
#include <qfiledialog.h>
|
|
|
|
#include <qcheckbox.h>
|
|
|
|
#include <qlabel.h>
|
|
|
|
#include <qlineedit.h>
|
|
|
|
#include <qpushbutton.h>
|
|
|
|
#include <qradiobutton.h>
|
|
|
|
#include <qspinbox.h>
|
2001-02-14 19:43:56 +00:00
|
|
|
|
2002-10-20 01:48:28 +00:00
|
|
|
|
2001-08-29 21:11:30 +00:00
|
|
|
QPrintDialog::QPrintDialog(QPrint * f)
|
|
|
|
: QPrintDialogBase(0, 0, false, 0),
|
2001-08-19 13:25:15 +00:00
|
|
|
form_(f)
|
2001-02-14 19:43:56 +00:00
|
|
|
{
|
2001-08-29 21:11:30 +00:00
|
|
|
connect(printPB, SIGNAL(clicked()),
|
|
|
|
form_, SLOT(slotOK()));
|
|
|
|
connect(closePB, SIGNAL(clicked()),
|
|
|
|
form_, SLOT(slotClose()));
|
2001-02-14 19:43:56 +00:00
|
|
|
}
|
|
|
|
|
2002-09-24 13:57:09 +00:00
|
|
|
|
2001-08-29 21:11:30 +00:00
|
|
|
void QPrintDialog::change_adaptor()
|
2001-02-14 19:43:56 +00:00
|
|
|
{
|
2001-08-29 21:11:30 +00:00
|
|
|
form_->changed();
|
2001-02-14 19:43:56 +00:00
|
|
|
}
|
2002-03-21 21:21:28 +00:00
|
|
|
|
|
|
|
|
2001-08-29 21:11:30 +00:00
|
|
|
void QPrintDialog::browseClicked()
|
|
|
|
{
|
2002-10-20 01:48:28 +00:00
|
|
|
QString file =
|
|
|
|
QFileDialog::getOpenFileName(QString::null,
|
|
|
|
_("PostScript files (*.ps)"),
|
|
|
|
this, 0,
|
|
|
|
_("Select a file to print to"));
|
2001-08-29 21:11:30 +00:00
|
|
|
if (!file.isNull()) {
|
|
|
|
fileED->setText(file);
|
|
|
|
form_->changed();
|
2001-06-05 17:05:51 +00:00
|
|
|
}
|
2001-02-14 19:43:56 +00:00
|
|
|
}
|
|
|
|
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2001-08-29 21:11:30 +00:00
|
|
|
void QPrintDialog::fileChanged()
|
2001-02-14 19:43:56 +00:00
|
|
|
{
|
2001-08-29 21:11:30 +00:00
|
|
|
if (!fileED->text().isEmpty())
|
|
|
|
fileRB->setChecked(true);
|
|
|
|
form_->changed();
|
2001-02-14 19:43:56 +00:00
|
|
|
}
|
|
|
|
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2001-08-29 21:11:30 +00:00
|
|
|
void QPrintDialog::copiesChanged(int i)
|
2001-02-14 19:43:56 +00:00
|
|
|
{
|
2001-08-29 21:11:30 +00:00
|
|
|
collateCB->setEnabled(i != 1);
|
|
|
|
form_->changed();
|
2001-02-14 19:43:56 +00:00
|
|
|
}
|
|
|
|
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2001-08-29 21:11:30 +00:00
|
|
|
void QPrintDialog::printerChanged()
|
2001-02-14 19:43:56 +00:00
|
|
|
{
|
2001-08-29 21:11:30 +00:00
|
|
|
printerRB->setChecked(true);
|
|
|
|
form_->changed();
|
2001-02-14 19:43:56 +00:00
|
|
|
}
|
|
|
|
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2001-08-29 21:11:30 +00:00
|
|
|
void QPrintDialog::pagerangeChanged()
|
2001-02-14 19:43:56 +00:00
|
|
|
{
|
2002-10-20 01:48:28 +00:00
|
|
|
int const from = strToUnsignedInt(fromED->text().latin1());
|
|
|
|
int const to = strToUnsignedInt(toED->text().latin1());
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2001-08-29 21:11:30 +00:00
|
|
|
if (!toED->text().isEmpty() && from > to)
|
|
|
|
fromED->setText(toED->text());
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2001-08-29 21:11:30 +00:00
|
|
|
form_->changed();
|
2001-02-14 19:43:56 +00:00
|
|
|
}
|