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