]> git.lyx.org Git - features.git/blob - src/frontends/qt2/QPrefs.C
Finish the migration from namespace grfx to lyx::graphics.
[features.git] / src / frontends / qt2 / QPrefs.C
1 /**
2  * \file QPrefs.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  *
8  * Full author contact details are available in file CREDITS
9  */
10
11 #include <config.h>
12
13 #include "support/lstrings.h"
14 #include "support/tostr.h"
15 #include "Lsstream.h"
16 #include <iomanip>
17
18 #include "ControlPrefs.h"
19 #include "QPrefsDialog.h"
20 #include "ui/QPrefAsciiModule.h"
21 #include "ui/QPrefDateModule.h"
22 #include "ui/QPrefKeyboardModule.h"
23 #include "ui/QPrefLatexModule.h"
24 #include "ui/QPrefScreenFontsModule.h"
25 #include "ui/QPrefColorsModule.h"
26 #include "ui/QPrefDisplayModule.h"
27 #include "ui/QPrefPathsModule.h"
28 #include "ui/QPrefSpellcheckerModule.h"
29 #include "ui/QPrefConvertersModule.h"
30 #include "ui/QPrefFileformatsModule.h"
31 #include "ui/QPrefLanguageModule.h"
32 #include "ui/QPrefPrinterModule.h"
33 #include "ui/QPrefUIModule.h"
34 #include "ui/QPrefIdentityModule.h"
35 #include "lyx_gui.h"
36 #include "QPrefs.h"
37 #include "Qt2BC.h"
38 #include "lyxrc.h"
39 #include "frnt_lang.h"
40 #include "helper_funcs.h"
41 #include "qt_helpers.h"
42 #include "lcolorcache.h"
43 #include "debug.h"
44
45 #include <boost/tuple/tuple.hpp>
46
47 #include <qpushbutton.h>
48 #include <qcheckbox.h>
49 #include <qlineedit.h>
50 #include <qspinbox.h>
51 #include <qcombobox.h>
52 #include <qlistbox.h>
53 #include <qlabel.h>
54 #include <qfontinfo.h>
55 #include "qcoloritem.h"
56
57 using namespace lyx::support;
58
59 using std::vector;
60 using std::pair;
61 using std::ostringstream;
62 using std::setfill;
63 using std::setw;
64 using std::endl;
65
66
67 typedef Qt2CB<ControlPrefs, Qt2DB<QPrefsDialog> > base_class;
68
69
70 QPrefs::QPrefs()
71         : base_class(_("LyX: Preferences"))
72 {
73 }
74
75
76 void QPrefs::build_dialog()
77 {
78         dialog_.reset(new QPrefsDialog(this));
79
80         bcview().setOK(dialog_->savePB);
81         bcview().setApply(dialog_->applyPB);
82         bcview().setCancel(dialog_->closePB);
83         bcview().setRestore(dialog_->restorePB);
84
85         QPrefLanguageModule * langmod(dialog_->languageModule);
86
87         langmod->defaultLanguageCO->clear();
88         // store the lang identifiers for later
89         vector<frnt::LanguagePair> const langs = frnt::getLanguageData(false);
90         lang_ = getSecond(langs);
91
92         vector<frnt::LanguagePair>::const_iterator lit  = langs.begin();
93         vector<frnt::LanguagePair>::const_iterator lend = langs.end();
94         for (; lit != lend; ++lit) {
95                 langmod->defaultLanguageCO->insertItem(toqstr(lit->first));
96         }
97
98         QPrefSpellcheckerModule * spellmod(dialog_->spellcheckerModule);
99         spellmod->spellCommandCO->insertItem(qt_("ispell"));
100         spellmod->spellCommandCO->insertItem(qt_("aspell"));
101         spellmod->spellCommandCO->insertItem(qt_("hspell"));
102 #ifdef USE_PSPELL
103         spellmod->spellCommandCO->insertItem(qt_("pspell (library)"));
104 #else
105 #ifdef USE_ASPELL
106         spellmod->spellCommandCO->insertItem(qt_("aspell (library)"));
107 #endif
108 #endif
109 }
110
111
112 void QPrefs::apply()
113 {
114         LyXRC & rc(controller().rc());
115
116         QPrefLanguageModule * langmod(dialog_->languageModule);
117
118         // FIXME: remove rtl_support bool
119         rc.rtl_support = langmod->rtlCB->isChecked();
120         rc.mark_foreign_language = langmod->markForeignCB->isChecked();
121         rc.language_auto_begin = langmod->autoBeginCB->isChecked();
122         rc.language_auto_end = langmod->autoEndCB->isChecked();
123         rc.language_use_babel = langmod->useBabelCB->isChecked();
124         rc.language_global_options = langmod->globalCB->isChecked();
125         rc.language_package = fromqstr(langmod->languagePackageED->text());
126         rc.language_command_begin = fromqstr(langmod->startCommandED->text());
127         rc.language_command_end = fromqstr(langmod->endCommandED->text());
128         rc.default_language = lang_[langmod->defaultLanguageCO->currentItem()];
129
130         QPrefUIModule * uimod(dialog_->uiModule);
131
132         rc.ui_file = fromqstr(uimod->uiFileED->text());
133         rc.bind_file = fromqstr(uimod->bindFileED->text());
134         rc.cursor_follows_scrollbar = uimod->cursorFollowsCB->isChecked();
135         rc.wheel_jump = uimod->wheelMouseSB->value();
136         rc.autosave = uimod->autoSaveSB->value() * 60;
137         rc.make_backup = uimod->autoSaveCB->isChecked();
138         rc.num_lastfiles = uimod->lastfilesSB->value();
139
140
141         QPrefKeyboardModule * keymod(dialog_->keyboardModule);
142
143         // FIXME: can derive CB from the two EDs
144         rc.use_kbmap = keymod->keymapCB->isChecked();
145         rc.primary_kbmap = fromqstr(keymod->firstKeymapED->text());
146         rc.secondary_kbmap = fromqstr(keymod->secondKeymapED->text());
147
148
149         QPrefAsciiModule * ascmod(dialog_->asciiModule);
150
151         rc.ascii_linelen = ascmod->asciiLinelengthSB->value();
152         rc.ascii_roff_command = fromqstr(ascmod->asciiRoffED->text());
153
154
155         QPrefDateModule * datemod(dialog_->dateModule);
156
157         rc.date_insert_format = fromqstr(datemod->DateED->text());
158
159
160         QPrefLatexModule * latexmod(dialog_->latexModule);
161
162         rc.fontenc = fromqstr(latexmod->latexEncodingED->text());
163         rc.chktex_command = fromqstr(latexmod->latexChecktexED->text());
164         rc.auto_reset_options = latexmod->latexAutoresetCB->isChecked();
165         rc.view_dvi_paper_option = fromqstr(latexmod->latexDviPaperED->text());
166         rc.default_papersize =
167                 static_cast<BufferParams::PAPER_SIZE>(latexmod->latexPaperSizeCO->currentItem());
168
169
170         QPrefDisplayModule * displaymod(dialog_->displayModule);
171
172         rc.preview = displaymod->previewCB->isChecked();
173
174         lyx::graphics::DisplayType dtype(lyx::graphics::ColorDisplay);
175
176         switch (displaymod->displayGraphicsCO->currentItem()) {
177                 case 3: dtype = lyx::graphics::NoDisplay; break;
178                 case 2: dtype = lyx::graphics::ColorDisplay; break;
179                 case 1: dtype = lyx::graphics::GrayscaleDisplay;        break;
180                 case 0: dtype = lyx::graphics::MonochromeDisplay; break;
181         }
182         rc.display_graphics = dtype;
183
184 #ifdef WITH_WARNINGS
185 #warning FIXME!! The graphics cache no longer has a changeDisplay method.
186 #endif
187 #if 0
188         if (old_value != rc.display_graphics) {
189                 lyx::graphics::GCache & gc = lyx::graphics::GCache::get();
190                 gc.changeDisplay();
191         }
192 #endif
193
194         QPrefPathsModule * pathsmod(dialog_->pathsModule);
195
196         rc.document_path = fromqstr(pathsmod->workingDirED->text());
197         rc.template_path = fromqstr(pathsmod->templateDirED->text());
198         rc.backupdir_path = fromqstr(pathsmod->backupDirED->text());
199         rc.use_tempdir = pathsmod->tempDirCB->isChecked();
200         rc.tempdir_path = fromqstr(pathsmod->tempDirED->text());
201         // FIXME: should be a checkbox only
202         rc.lyxpipes = fromqstr(pathsmod->lyxserverDirED->text());
203
204
205         QPrefSpellcheckerModule * spellmod(dialog_->spellcheckerModule);
206
207         switch (spellmod->spellCommandCO->currentItem()) {
208                 case 0:
209                 case 1:
210                 case 2:
211                         rc.use_spell_lib = false;
212                         rc.isp_command = fromqstr(spellmod->spellCommandCO->currentText());
213                         break;
214                 case 3:
215                         rc.use_spell_lib = true;
216                         break;
217         }
218
219         // FIXME: remove isp_use_alt_lang
220         rc.isp_alt_lang = fromqstr(spellmod->altLanguageED->text());
221         rc.isp_use_alt_lang = !rc.isp_alt_lang.empty();
222         // FIXME: remove isp_use_esc_chars
223         rc.isp_esc_chars = fromqstr(spellmod->escapeCharactersED->text());
224         rc.isp_use_esc_chars = !rc.isp_esc_chars.empty();
225         // FIXME: remove isp_use_pers_dict
226         rc.isp_pers_dict = fromqstr(spellmod->persDictionaryED->text());
227         rc.isp_use_pers_dict = !rc.isp_pers_dict.empty();
228         rc.isp_accept_compound = spellmod->compoundWordCB->isChecked();
229         rc.isp_use_input_encoding = spellmod->inputEncodingCB->isChecked();
230
231
232         QPrefPrinterModule * printmod(dialog_->printerModule);
233
234         rc.print_adapt_output = printmod->printerAdaptCB->isChecked();
235         rc.print_command = fromqstr(printmod->printerCommandED->text());
236         rc.printer = fromqstr(printmod->printerNameED->text());
237
238         rc.print_pagerange_flag = fromqstr(printmod->printerPageRangeED->text());
239         rc.print_copies_flag = fromqstr(printmod->printerCopiesED->text());
240         rc.print_reverse_flag = fromqstr(printmod->printerReverseED->text());
241         rc.print_to_printer = fromqstr(printmod->printerToPrinterED->text());
242         rc.print_file_extension = fromqstr(printmod->printerExtensionED->text());
243         rc.print_spool_command = fromqstr(printmod->printerSpoolCommandED->text());
244         rc.print_paper_flag = fromqstr(printmod->printerPaperTypeED->text());
245         rc.print_evenpage_flag = fromqstr(printmod->printerEvenED->text());
246         rc.print_oddpage_flag = fromqstr(printmod->printerOddED->text());
247         rc.print_collcopies_flag = fromqstr(printmod->printerCollatedED->text());
248         rc.print_landscape_flag = fromqstr(printmod->printerLandscapeED->text());
249         rc.print_to_file = fromqstr(printmod->printerToFileED->text());
250         rc.print_extra_options = fromqstr(printmod->printerExtraED->text());
251         rc.print_spool_printerprefix = fromqstr(printmod->printerSpoolPrefixED->text());
252         rc.print_paper_dimension_flag = fromqstr(printmod->printerPaperSizeED->text());
253
254
255         QPrefIdentityModule * idmod(dialog_->identityModule);
256         rc.user_name = fromqstr(idmod->nameED->text());
257         rc.user_email = fromqstr(idmod->emailED->text());
258
259         QPrefScreenFontsModule * fontmod(dialog_->screenfontsModule);
260
261         LyXRC const oldrc(rc);
262
263         boost::tie(rc.roman_font_name, rc.roman_font_foundry)
264                 = parseFontName(fromqstr(fontmod->screenRomanCO->currentText()));
265         boost::tie(rc.sans_font_name, rc.sans_font_foundry) =
266                 parseFontName(fromqstr(fontmod->screenSansCO->currentText()));
267         boost::tie(rc.typewriter_font_name, rc.typewriter_font_foundry) =
268                 parseFontName(fromqstr(fontmod->screenTypewriterCO->currentText()));
269
270         rc.zoom = fontmod->screenZoomSB->value();
271         rc.dpi = fontmod->screenDpiSB->value();
272         rc.font_sizes[LyXFont::SIZE_TINY] = strToDbl(fromqstr(fontmod->screenTinyED->text()));
273         rc.font_sizes[LyXFont::SIZE_SCRIPT] = strToDbl(fromqstr(fontmod->screenSmallestED->text()));
274         rc.font_sizes[LyXFont::SIZE_FOOTNOTE] = strToDbl(fromqstr(fontmod->screenSmallerED->text()));
275         rc.font_sizes[LyXFont::SIZE_SMALL] = strToDbl(fromqstr(fontmod->screenSmallED->text()));
276         rc.font_sizes[LyXFont::SIZE_NORMAL] = strToDbl(fromqstr(fontmod->screenNormalED->text()));
277         rc.font_sizes[LyXFont::SIZE_LARGE] = strToDbl(fromqstr(fontmod->screenLargeED->text()));
278         rc.font_sizes[LyXFont::SIZE_LARGER] = strToDbl(fromqstr(fontmod->screenLargerED->text()));
279         rc.font_sizes[LyXFont::SIZE_LARGEST] = strToDbl(fromqstr(fontmod->screenLargestED->text()));
280         rc.font_sizes[LyXFont::SIZE_HUGE] = strToDbl(fromqstr(fontmod->screenHugeED->text()));
281         rc.font_sizes[LyXFont::SIZE_HUGER] = strToDbl(fromqstr(fontmod->screenHugerED->text()));
282
283         if (rc.font_sizes != oldrc.font_sizes
284                 || rc.roman_font_name != oldrc.roman_font_name
285                 || rc.sans_font_name != oldrc.sans_font_name
286                 || rc.typewriter_font_name != oldrc.typewriter_font_name
287                 || rc.zoom != oldrc.zoom || rc.dpi != oldrc.dpi) {
288                 controller().updateScreenFonts();
289         }
290
291         controller().setFormats(formats_);
292         controller().setConverters(converters_);
293
294         QPrefColorsModule * colmod(dialog_->colorsModule);
295
296         unsigned int i;
297
298         for (i = 0; i < colmod->lyxObjectsLB->count(); ++i) {
299                 QListBoxItem * ib(colmod->lyxObjectsLB->item(i));
300                 QColorItem * ci(static_cast<QColorItem*>(ib));
301
302                 LColor::color const col(dialog_->colors_[i]);
303                 QColor const & qcol(lcolorcache.get(col));
304
305                 // FIXME: dubious, but it's what xforms does
306                 if (qcol != ci->color()) {
307                         ostringstream ostr;
308
309                         ostr << '#' << std::setbase(16) << setfill('0')
310                              << setw(2) << ci->color().red()
311                              << setw(2) << ci->color().green()
312                              << setw(2) << ci->color().blue();
313
314                         string newhex(STRCONV(ostr.str()));
315                         controller().setColor(col, newhex);
316                 }
317         }
318 }
319
320
321 // FIXME: move to helper_funcs.h
322 namespace {
323
324 template<class A>
325 typename std::vector<A>::size_type
326 findPos(std::vector<A> const & vec, A const & val)
327 {
328         typename std::vector<A>::const_iterator it =
329                 std::find(vec.begin(), vec.end(), val);
330         if (it == vec.end())
331                 return 0;
332         return std::distance(vec.begin(), it);
333 }
334
335 void setComboxFont(QComboBox * cb, string const & family, string const & foundry)
336 {
337         string const name = makeFontName(family, foundry);
338         for (int i = 0; i < cb->count(); ++i) {
339                 if (fromqstr(cb->text(i)) == name) {
340                         cb->setCurrentItem(i);
341                         return;
342                 }
343         }
344
345         // Try matching without foundary name
346
347         // We count in reverse in order to prefer the Xft foundry
348         for (int i = cb->count() - 1; i >= 0; --i) {
349                 pair<string, string> tmp = parseFontName(fromqstr(cb->text(i)));
350                 if (compare_no_case(tmp.first, family) == 0) {
351                         cb->setCurrentItem(i);
352                         return;
353                 }
354         }
355
356         // Bleh, default fonts, and the names couldn't be found. Hack
357         // for bug 1063. Qt makes baby Jesus cry.
358
359         QFont font;
360
361         if (family == lyx_gui::roman_font_name()) {
362                 font.setStyleHint(QFont::Serif);
363                 font.setFamily(lyx_gui::roman_font_name().c_str());
364         } else if (family == lyx_gui::sans_font_name()) {
365                 font.setStyleHint(QFont::SansSerif);
366                 font.setFamily(lyx_gui::sans_font_name().c_str());
367         } else if (family == lyx_gui::typewriter_font_name()) {
368                 font.setStyleHint(QFont::TypeWriter);
369                 font.setFamily(lyx_gui::typewriter_font_name().c_str());
370         } else {
371                 lyxerr << "FAILED to find the default font !"
372                         << foundry << ", " << family << endl;
373                 return;
374         }
375
376         QFontInfo info(font);
377         lyxerr << "Apparent font is " << info.family() << endl;
378
379         for (int i = 0; i < cb->count(); ++i) {
380                 lyxerr << "Looking at " << fromqstr(cb->text(i)) << endl;
381                 if (compare_no_case(cb->text(i).latin1(), info.family().latin1()) == 0) {
382                         cb->setCurrentItem(i);
383                         return;
384                 }
385         }
386
387         lyxerr << "FAILED to find the font !"
388                 << foundry << ", " << family << endl;
389 }
390
391 } // end namespace anon
392
393
394 void QPrefs::update_contents()
395 {
396         LyXRC const & rc(controller().rc());
397
398         QPrefLanguageModule * langmod(dialog_->languageModule);
399
400         // FIXME: remove rtl_support bool
401         langmod->rtlCB->setChecked(rc.rtl_support);
402         langmod->markForeignCB->setChecked(rc.mark_foreign_language);
403         langmod->autoBeginCB->setChecked(rc.language_auto_begin);
404         langmod->autoEndCB->setChecked(rc.language_auto_end);
405         langmod->useBabelCB->setChecked(rc.language_use_babel);
406         langmod->globalCB->setChecked(rc.language_global_options);
407         langmod->languagePackageED->setText(toqstr(rc.language_package));
408         langmod->startCommandED->setText(toqstr(rc.language_command_begin));
409         langmod->endCommandED->setText(toqstr(rc.language_command_end));
410
411         int const pos = int(findPos(lang_, rc.default_language));
412         langmod->defaultLanguageCO->setCurrentItem(pos);
413
414         QPrefUIModule * uimod(dialog_->uiModule);
415
416         uimod->uiFileED->setText(toqstr(rc.ui_file));
417         uimod->bindFileED->setText(toqstr(rc.bind_file));
418         uimod->cursorFollowsCB->setChecked(rc.cursor_follows_scrollbar);
419         uimod->wheelMouseSB->setValue(rc.wheel_jump);
420         // convert to minutes
421         int mins(rc.autosave / 60);
422         if (rc.autosave && !mins)
423                 mins = 1;
424         uimod->autoSaveSB->setValue(mins);
425         uimod->autoSaveCB->setChecked(rc.make_backup);
426         uimod->lastfilesSB->setValue(rc.num_lastfiles);
427
428
429         QPrefIdentityModule * idmod(dialog_->identityModule);
430         idmod->nameED->setText(toqstr(rc.user_name));
431         idmod->emailED->setText(toqstr(rc.user_email));
432
433
434         QPrefKeyboardModule * keymod(dialog_->keyboardModule);
435
436         // FIXME: can derive CB from the two EDs
437         keymod->keymapCB->setChecked(rc.use_kbmap);
438         // no idea why we need these. Fscking Qt.
439         keymod->firstKeymapED->setEnabled(rc.use_kbmap);
440         keymod->firstKeymapPB->setEnabled(rc.use_kbmap);
441         keymod->firstKeymapLA->setEnabled(rc.use_kbmap);
442         keymod->secondKeymapED->setEnabled(rc.use_kbmap);
443         keymod->secondKeymapPB->setEnabled(rc.use_kbmap);
444         keymod->secondKeymapLA->setEnabled(rc.use_kbmap);
445         keymod->firstKeymapED->setText(toqstr(rc.primary_kbmap));
446         keymod->secondKeymapED->setText(toqstr(rc.secondary_kbmap));
447
448
449         QPrefAsciiModule * ascmod(dialog_->asciiModule);
450
451         ascmod->asciiLinelengthSB->setValue(rc.ascii_linelen);
452         ascmod->asciiRoffED->setText(toqstr(rc.ascii_roff_command));
453
454
455         QPrefDateModule * datemod(dialog_->dateModule);
456
457         datemod->DateED->setText(toqstr(rc.date_insert_format));
458
459
460         QPrefLatexModule * latexmod(dialog_->latexModule);
461
462         latexmod->latexEncodingED->setText(toqstr(rc.fontenc));
463         latexmod->latexChecktexED->setText(toqstr(rc.chktex_command));
464         latexmod->latexAutoresetCB->setChecked(rc.auto_reset_options);
465         latexmod->latexDviPaperED->setText(toqstr(rc.view_dvi_paper_option));
466         latexmod->latexPaperSizeCO->setCurrentItem(rc.default_papersize);
467
468
469         QPrefDisplayModule * displaymod(dialog_->displayModule);
470
471         displaymod->previewCB->setChecked(rc.preview);
472
473         int item = 2;
474
475         switch (rc.display_graphics) {
476                 case lyx::graphics::NoDisplay:          item = 3; break;
477                 case lyx::graphics::ColorDisplay:       item = 2; break;
478                 case lyx::graphics::GrayscaleDisplay:   item = 1; break;
479                 case lyx::graphics::MonochromeDisplay:  item = 0; break;
480                 default: break;
481         }
482         displaymod->displayGraphicsCO->setCurrentItem(item);
483
484
485         QPrefPathsModule * pathsmod(dialog_->pathsModule);
486
487         pathsmod->workingDirED->setText(toqstr(rc.document_path));
488         pathsmod->templateDirED->setText(toqstr(rc.template_path));
489         pathsmod->backupDirED->setText(toqstr(rc.backupdir_path));
490         pathsmod->tempDirCB->setChecked(rc.use_tempdir);
491         pathsmod->tempDirED->setText(toqstr(rc.tempdir_path));
492         // FIXME: should be a checkbox only
493         pathsmod->lyxserverDirED->setText(toqstr(rc.lyxpipes));
494
495
496         QPrefSpellcheckerModule * spellmod(dialog_->spellcheckerModule);
497
498         spellmod->spellCommandCO->setCurrentItem(0);
499
500         if (rc.isp_command == "ispell") {
501                 spellmod->spellCommandCO->setCurrentItem(0);
502         } else if (rc.isp_command == "aspell") {
503                 spellmod->spellCommandCO->setCurrentItem(1);
504         } else if (rc.isp_command == "hspell") {
505                 spellmod->spellCommandCO->setCurrentItem(2);
506         }
507
508         if (rc.use_spell_lib) {
509 #if defined(USE_ASPELL) || defined(USE_PSPELL)
510                 spellmod->spellCommandCO->setCurrentItem(3);
511 #endif
512         }
513
514         // FIXME: remove isp_use_alt_lang
515         spellmod->altLanguageED->setText(toqstr(rc.isp_alt_lang));
516         // FIXME: remove isp_use_esc_chars
517         spellmod->escapeCharactersED->setText(toqstr(rc.isp_esc_chars));
518         // FIXME: remove isp_use_pers_dict
519         spellmod->persDictionaryED->setText(toqstr(rc.isp_pers_dict));
520         spellmod->compoundWordCB->setChecked(rc.isp_accept_compound);
521         spellmod->inputEncodingCB->setChecked(rc.isp_use_input_encoding);
522
523
524         QPrefPrinterModule * printmod(dialog_->printerModule);
525
526         printmod->printerAdaptCB->setChecked(rc.print_adapt_output);
527         printmod->printerCommandED->setText(toqstr(rc.print_command));
528         printmod->printerNameED->setText(toqstr(rc.printer));
529
530         printmod->printerPageRangeED->setText(toqstr(rc.print_pagerange_flag));
531         printmod->printerCopiesED->setText(toqstr(rc.print_copies_flag));
532         printmod->printerReverseED->setText(toqstr(rc.print_reverse_flag));
533         printmod->printerToPrinterED->setText(toqstr(rc.print_to_printer));
534         printmod->printerExtensionED->setText(toqstr(rc.print_file_extension));
535         printmod->printerSpoolCommandED->setText(toqstr(rc.print_spool_command));
536         printmod->printerPaperTypeED->setText(toqstr(rc.print_paper_flag));
537         printmod->printerEvenED->setText(toqstr(rc.print_evenpage_flag));
538         printmod->printerOddED->setText(toqstr(rc.print_oddpage_flag));
539         printmod->printerCollatedED->setText(toqstr(rc.print_collcopies_flag));
540         printmod->printerLandscapeED->setText(toqstr(rc.print_landscape_flag));
541         printmod->printerToFileED->setText(toqstr(rc.print_to_file));
542         printmod->printerExtraED->setText(toqstr(rc.print_extra_options));
543         printmod->printerSpoolPrefixED->setText(toqstr(rc.print_spool_printerprefix));
544         printmod->printerPaperSizeED->setText(toqstr(rc.print_paper_dimension_flag));
545
546
547         QPrefScreenFontsModule * fontmod(dialog_->screenfontsModule);
548
549         setComboxFont(fontmod->screenRomanCO, rc.roman_font_name,
550                         rc.roman_font_foundry);
551         setComboxFont(fontmod->screenSansCO, rc.sans_font_name,
552                         rc.sans_font_foundry);
553         setComboxFont(fontmod->screenTypewriterCO, rc.typewriter_font_name,
554                         rc.typewriter_font_foundry);
555
556         dialog_->select_roman(fontmod->screenRomanCO->currentText());
557         dialog_->select_sans(fontmod->screenSansCO->currentText());
558         dialog_->select_typewriter(fontmod->screenTypewriterCO->currentText());
559
560         fontmod->screenZoomSB->setValue(rc.zoom);
561         fontmod->screenDpiSB->setValue(int(rc.dpi));
562         fontmod->screenTinyED->setText(toqstr(tostr(rc.font_sizes[LyXFont::SIZE_TINY])));
563         fontmod->screenSmallestED->setText(toqstr(tostr(rc.font_sizes[LyXFont::SIZE_SCRIPT])));
564         fontmod->screenSmallerED->setText(toqstr(tostr(rc.font_sizes[LyXFont::SIZE_FOOTNOTE])));
565         fontmod->screenSmallED->setText(toqstr(tostr(rc.font_sizes[LyXFont::SIZE_SMALL])));
566         fontmod->screenNormalED->setText(toqstr(tostr(rc.font_sizes[LyXFont::SIZE_NORMAL])));
567         fontmod->screenLargeED->setText(toqstr(tostr(rc.font_sizes[LyXFont::SIZE_LARGE])));
568         fontmod->screenLargerED->setText(toqstr(tostr(rc.font_sizes[LyXFont::SIZE_LARGER])));
569         fontmod->screenLargestED->setText(toqstr(tostr(rc.font_sizes[LyXFont::SIZE_LARGEST])));
570         fontmod->screenHugeED->setText(toqstr(tostr(rc.font_sizes[LyXFont::SIZE_HUGE])));
571         fontmod->screenHugerED->setText(toqstr(tostr(rc.font_sizes[LyXFont::SIZE_HUGER])));
572
573         formats_ = formats;
574
575         dialog_->updateFormats();
576
577         converters_ = converters;
578
579         dialog_->updateConverters();
580 }