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