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