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