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