]> git.lyx.org Git - lyx.git/blob - src/frontends/qt2/QLPrintDialog.C
better selection and scrolling behaviour
[lyx.git] / src / frontends / qt2 / QLPrintDialog.C
1 /**
2  * \file QLPrintDialog.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author John Levon
7  * \author Edwin Leuven
8  *
9  * Full author contact details are available in file CREDITS
10  */
11
12 #include <config.h>
13
14 #ifdef __GNUG__
15 #pragma implementation
16 #endif
17
18 #include "gettext.h"
19 #include "support/filetools.h"
20 #include "support/lstrings.h"
21
22 #include "QPrint.h"
23 #include "QLPrintDialog.h"
24
25 #include <qfiledialog.h>
26 #include <qcheckbox.h>
27 #include <qlabel.h>
28 #include <qlineedit.h>
29 #include <qpushbutton.h>
30 #include <qradiobutton.h>
31 #include <qspinbox.h>
32
33
34 QLPrintDialog::QLPrintDialog(QPrint * f)
35         : QPrintDialogBase(0, 0, false, 0),
36         form_(f)
37 {
38         connect(printPB, SIGNAL(clicked()),
39                 form_, SLOT(slotOK()));
40         connect(closePB, SIGNAL(clicked()),
41                 form_, SLOT(slotClose()));
42 }
43
44
45 void QLPrintDialog::change_adaptor()
46 {
47         form_->changed();
48 }
49
50
51 void QLPrintDialog::browseClicked()
52 {
53         QString file =
54                 QFileDialog::getOpenFileName(QString::null,
55                                              _("PostScript files (*.ps)"),
56                                              this, 0,
57                                              _("Select a file to print to"));
58         if (!file.isNull()) {
59                 fileED->setText(file);
60                 form_->changed();
61         }
62 }
63
64
65 void QLPrintDialog::fileChanged()
66 {
67         if (!fileED->text().isEmpty())
68                 fileRB->setChecked(true);
69         form_->changed();
70 }
71
72
73 void QLPrintDialog::copiesChanged(int i)
74 {
75         collateCB->setEnabled(i != 1);
76         form_->changed();
77 }
78
79
80 void QLPrintDialog::printerChanged()
81 {
82         printerRB->setChecked(true);
83         form_->changed();
84 }
85
86
87 void QLPrintDialog::pagerangeChanged()
88 {
89         int const from = strToUnsignedInt(fromED->text().latin1());
90         int const to = strToUnsignedInt(toED->text().latin1());
91
92         if (!toED->text().isEmpty() && from > to)
93                 fromED->setText(toED->text());
94
95         form_->changed();
96 }