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