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