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