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