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