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