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