printer fixe

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5275 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
John Levon 2002-09-11 19:57:49 +00:00
parent 60a6e6d346
commit 5f5672e088
3 changed files with 253 additions and 220 deletions

View File

@ -1,3 +1,9 @@
2002-09-11 John Levon <levon@movementarian.org>
* QPrint.h:
* QPrint.C:
* ui/QPrintDialog.ui: update for odd/even changes
2002-09-11 John Levon <levon@movementarian.org> 2002-09-11 John Levon <levon@movementarian.org>
* QCitationDialog.C: show right info when selecting a cite * QCitationDialog.C: show right info when selecting a cite

View File

@ -60,52 +60,28 @@ void QPrint::update_contents()
dialog_->reverseCB->setChecked(pp.reverse_order); dialog_->reverseCB->setChecked(pp.reverse_order);
QRadioButton * button;
switch (pp.which_pages) {
case PrinterParams::ALL: button = dialog_->allRB; break;
case PrinterParams::ODD: button = dialog_->oddRB; break;
case PrinterParams::EVEN: button = dialog_->evenRB; break;
}
button->setChecked(true);
// hmmm... maybe a bit weird but maybe not
// we might just be remembering the last
// time this was printed.
if (!pp.from_page.empty()) {
dialog_->fromED->setText(pp.from_page.c_str());
dialog_->toED->setText("");
if (pp.to_page)
dialog_->toED->setText(tostr(pp.to_page).c_str());
} else {
dialog_->fromED->setText("");
dialog_->toED->setText("");
}
dialog_->copiesSB->setValue(pp.count_copies); 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;
}
dialog_->rangeRB->setChecked(true);
QString s;
s.setNum(pp.from_page);
dialog_->fromED->setText(s);
s.setNum(pp.to_page);
dialog_->toED->setText(s);
} }
void QPrint::apply() void QPrint::apply()
{ {
PrinterParams::WhichPages wp;
if (dialog_->allRB->isChecked())
wp = PrinterParams::ALL;
else if (dialog_->oddRB->isChecked())
wp = PrinterParams::ODD;
else
wp = PrinterParams::EVEN;
string from;
int to(0);
if (!dialog_->fromED->text().isEmpty()) {
// we have at least one page requested
from = dialog_->fromED->text().latin1();
if (!dialog_->toED->text().isEmpty())
to = strToInt(dialog_->toED->text().latin1());
}
PrinterParams::Target t = PrinterParams::PRINTER; PrinterParams::Target t = PrinterParams::PRINTER;
if (dialog_->fileRB->isChecked()) if (dialog_->fileRB->isChecked())
t = PrinterParams::FILE; t = PrinterParams::FILE;
@ -113,10 +89,14 @@ void QPrint::apply()
PrinterParams const pp(t, PrinterParams const pp(t,
dialog_->printerED->text().latin1(), dialog_->printerED->text().latin1(),
dialog_->fileED->text().latin1(), dialog_->fileED->text().latin1(),
wp, from, to, dialog_->allRB->isChecked(),
dialog_->reverseCB->isChecked(), dialog_->fromED->text().toUInt(),
!dialog_->collateCB->isChecked(), dialog_->toED->text().toUInt(),
strToInt(dialog_->copiesSB->text().latin1())); dialog_->oddCB->isChecked(),
dialog_->evenCB->isChecked(),
dialog_->copiesSB->text().toUInt(),
dialog_->collateCB->isChecked(),
dialog_->reverseCB->isChecked());
controller().params() = pp; controller().params() = pp;
} }

View File

@ -13,8 +13,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>327</width> <width>225</width>
<height>342</height> <height>395</height>
</rect> </rect>
</property> </property>
<property stdset="1"> <property stdset="1">
@ -54,8 +54,76 @@
</property> </property>
<property stdset="1"> <property stdset="1">
<name>spacing</name> <name>spacing</name>
<number>3</number> <number>6</number>
</property> </property>
<widget row="1" column="1" >
<class>QLineEdit</class>
<property stdset="1">
<name>name</name>
<cstring>fileED</cstring>
</property>
<property stdset="1">
<name>enabled</name>
<bool>true</bool>
</property>
<property>
<name>toolTip</name>
<string>Send output to a file</string>
</property>
</widget>
<widget row="2" column="1" >
<class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
<cstring>Layout5</cstring>
</property>
<hbox>
<property stdset="1">
<name>margin</name>
<number>0</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>6</number>
</property>
<widget>
<class>QPushButton</class>
<property stdset="1">
<name>name</name>
<cstring>browsePB</cstring>
</property>
<property stdset="1">
<name>enabled</name>
<bool>true</bool>
</property>
<property stdset="1">
<name>text</name>
<string>&amp;Browse ...</string>
</property>
</widget>
<spacer>
<property>
<name>name</name>
<cstring>Spacer15</cstring>
</property>
<property stdset="1">
<name>orientation</name>
<enum>Horizontal</enum>
</property>
<property stdset="1">
<name>sizeType</name>
<enum>Expanding</enum>
</property>
<property>
<name>sizeHint</name>
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</hbox>
</widget>
<widget row="0" column="0" > <widget row="0" column="0" >
<class>QRadioButton</class> <class>QRadioButton</class>
<property stdset="1"> <property stdset="1">
@ -75,6 +143,17 @@
<string>Send output to the printer</string> <string>Send output to the printer</string>
</property> </property>
</widget> </widget>
<widget row="0" column="1" >
<class>QLineEdit</class>
<property stdset="1">
<name>name</name>
<cstring>printerED</cstring>
</property>
<property>
<name>toolTip</name>
<string>Send output to the given printer</string>
</property>
</widget>
<widget row="1" column="0" > <widget row="1" column="0" >
<class>QRadioButton</class> <class>QRadioButton</class>
<property stdset="1"> <property stdset="1">
@ -90,47 +169,6 @@
<string>Send output to a file</string> <string>Send output to a file</string>
</property> </property>
</widget> </widget>
<widget row="0" column="1" >
<class>QLineEdit</class>
<property stdset="1">
<name>name</name>
<cstring>printerED</cstring>
</property>
<property>
<name>toolTip</name>
<string>Send output to the given printer</string>
</property>
</widget>
<widget row="1" column="1" >
<class>QLineEdit</class>
<property stdset="1">
<name>name</name>
<cstring>fileED</cstring>
</property>
<property stdset="1">
<name>enabled</name>
<bool>true</bool>
</property>
<property>
<name>toolTip</name>
<string>Send output to a file</string>
</property>
</widget>
<widget row="1" column="2" >
<class>QPushButton</class>
<property stdset="1">
<name>name</name>
<cstring>browsePB</cstring>
</property>
<property stdset="1">
<name>enabled</name>
<bool>true</bool>
</property>
<property stdset="1">
<name>text</name>
<string>&amp;Browse ...</string>
</property>
</widget>
</grid> </grid>
</widget> </widget>
<widget> <widget>
@ -146,7 +184,7 @@
<property> <property>
<name>layoutSpacing</name> <name>layoutSpacing</name>
</property> </property>
<grid> <vbox>
<property stdset="1"> <property stdset="1">
<name>margin</name> <name>margin</name>
<number>11</number> <number>11</number>
@ -155,6 +193,102 @@
<name>spacing</name> <name>spacing</name>
<number>6</number> <number>6</number>
</property> </property>
<widget>
<class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
<cstring>Layout3</cstring>
</property>
<grid>
<property stdset="1">
<name>margin</name>
<number>0</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>6</number>
</property>
<widget row="1" column="1" >
<class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
<cstring>Layout2</cstring>
</property>
<hbox>
<property stdset="1">
<name>margin</name>
<number>0</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>6</number>
</property>
<widget>
<class>QLineEdit</class>
<property stdset="1">
<name>name</name>
<cstring>fromED</cstring>
</property>
<property stdset="1">
<name>enabled</name>
<bool>false</bool>
</property>
<property>
<name>toolTip</name>
<string>Page number to print from</string>
</property>
</widget>
<widget>
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>toLA</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>&amp;to</string>
</property>
<property>
<name>buddy</name>
<cstring>toED</cstring>
</property>
</widget>
<widget>
<class>QLineEdit</class>
<property stdset="1">
<name>name</name>
<cstring>toED</cstring>
</property>
<property stdset="1">
<name>enabled</name>
<bool>false</bool>
</property>
<property>
<name>toolTip</name>
<string>Page number to print to</string>
</property>
</widget>
</hbox>
</widget>
<widget row="1" column="0" >
<class>QRadioButton</class>
<property stdset="1">
<name>name</name>
<cstring>rangeRB</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Fro&amp;m</string>
</property>
<property stdset="1">
<name>checked</name>
<bool>false</bool>
</property>
<property>
<name>toolTip</name>
<string>Print all pages</string>
</property>
</widget>
<widget row="0" column="0" > <widget row="0" column="0" >
<class>QRadioButton</class> <class>QRadioButton</class>
<property stdset="1"> <property stdset="1">
@ -174,71 +308,39 @@
<string>Print all pages</string> <string>Print all pages</string>
</property> </property>
</widget> </widget>
<widget row="1" column="0" > </grid>
<class>QRadioButton</class> </widget>
<widget>
<class>QCheckBox</class>
<property stdset="1"> <property stdset="1">
<name>name</name> <name>name</name>
<cstring>oddRB</cstring> <cstring>oddCB</cstring>
</property> </property>
<property stdset="1"> <property stdset="1">
<name>text</name> <name>text</name>
<string>&amp;Odd</string> <string>Print &amp;odd-numbered pages</string>
</property>
<property>
<name>toolTip</name>
<string>Print odd pages only</string>
</property>
</widget>
<widget row="2" column="0" >
<class>QRadioButton</class>
<property stdset="1">
<name>name</name>
<cstring>evenRB</cstring>
</property> </property>
<property stdset="1"> <property stdset="1">
<name>text</name> <name>checked</name>
<string>&amp;Even</string>
</property>
<property>
<name>toolTip</name>
<string>Print even pages only</string>
</property>
</widget>
<widget row="3" column="2" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>toPageL</cstring>
</property>
<property stdset="1">
<name>enabled</name>
<bool>true</bool> <bool>true</bool>
</property> </property>
<property stdset="1">
<name>text</name>
<string>&amp;Last page:</string>
</property>
<property>
<name>buddy</name>
<cstring>toED</cstring>
</property>
</widget> </widget>
<widget row="4" column="2" > <widget>
<class>QLineEdit</class> <class>QCheckBox</class>
<property stdset="1"> <property stdset="1">
<name>name</name> <name>name</name>
<cstring>toED</cstring> <cstring>evenCB</cstring>
</property> </property>
<property stdset="1"> <property stdset="1">
<name>enabled</name> <name>text</name>
<string>Print &amp;even-numbered pages</string>
</property>
<property stdset="1">
<name>checked</name>
<bool>true</bool> <bool>true</bool>
</property> </property>
<property>
<name>toolTip</name>
<string>Page number to print to</string>
</property>
</widget> </widget>
<widget row="0" column="2" > <widget>
<class>QCheckBox</class> <class>QCheckBox</class>
<property stdset="1"> <property stdset="1">
<name>name</name> <name>name</name>
@ -253,60 +355,7 @@
<string>Print in reverse order</string> <string>Print in reverse order</string>
</property> </property>
</widget> </widget>
<widget row="4" column="1" > </vbox>
<class>QLineEdit</class>
<property stdset="1">
<name>name</name>
<cstring>fromED</cstring>
</property>
<property stdset="1">
<name>enabled</name>
<bool>true</bool>
</property>
<property>
<name>toolTip</name>
<string>Page number to print from</string>
</property>
</widget>
<widget row="4" column="0" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>rangeLA</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Ran&amp;ge</string>
</property>
<property>
<name>buddy</name>
<cstring>fromED</cstring>
</property>
<property>
<name>toolTip</name>
<string>Set a range of pages to print</string>
</property>
</widget>
<widget row="3" column="1" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>fromPageL</cstring>
</property>
<property stdset="1">
<name>enabled</name>
<bool>true</bool>
</property>
<property stdset="1">
<name>text</name>
<string>&amp;Starting range:</string>
</property>
<property>
<name>buddy</name>
<cstring>fromED</cstring>
</property>
</widget>
</grid>
</widget> </widget>
<widget> <widget>
<class>QGroupBox</class> <class>QGroupBox</class>
@ -485,18 +534,6 @@
<receiver>QPrintDialogBase</receiver> <receiver>QPrintDialogBase</receiver>
<slot>change_adaptor()</slot> <slot>change_adaptor()</slot>
</connection> </connection>
<connection>
<sender>oddRB</sender>
<signal>toggled(bool)</signal>
<receiver>QPrintDialogBase</receiver>
<slot>change_adaptor()</slot>
</connection>
<connection>
<sender>evenRB</sender>
<signal>toggled(bool)</signal>
<receiver>QPrintDialogBase</receiver>
<slot>change_adaptor()</slot>
</connection>
<connection> <connection>
<sender>reverseCB</sender> <sender>reverseCB</sender>
<signal>toggled(bool)</signal> <signal>toggled(bool)</signal>
@ -545,6 +582,18 @@
<receiver>QPrintDialogBase</receiver> <receiver>QPrintDialogBase</receiver>
<slot>change_adaptor()</slot> <slot>change_adaptor()</slot>
</connection> </connection>
<connection>
<sender>rangeRB</sender>
<signal>toggled(bool)</signal>
<receiver>fromED</receiver>
<slot>setEnabled(bool)</slot>
</connection>
<connection>
<sender>rangeRB</sender>
<signal>toggled(bool)</signal>
<receiver>toED</receiver>
<slot>setEnabled(bool)</slot>
</connection>
<slot access="protected">browseClicked()</slot> <slot access="protected">browseClicked()</slot>
<slot access="public">change_adaptor()</slot> <slot access="public">change_adaptor()</slot>
<slot access="public">copiesChanged(int)</slot> <slot access="public">copiesChanged(int)</slot>
@ -559,8 +608,6 @@
<tabstop>fileED</tabstop> <tabstop>fileED</tabstop>
<tabstop>browsePB</tabstop> <tabstop>browsePB</tabstop>
<tabstop>allRB</tabstop> <tabstop>allRB</tabstop>
<tabstop>oddRB</tabstop>
<tabstop>evenRB</tabstop>
<tabstop>fromED</tabstop> <tabstop>fromED</tabstop>
<tabstop>toED</tabstop> <tabstop>toED</tabstop>
<tabstop>reverseCB</tabstop> <tabstop>reverseCB</tabstop>