]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/QDocumentDialog.C
* LyXView::updateInset(): schedule a redraw instead of redraw immediately.
[lyx.git] / src / frontends / qt4 / QDocumentDialog.C
1 /**
2  * \file QDocumentDialog.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Edwin Leuven
7  * \author Abdelrazak Younes
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #include <config.h>
13
14 #include "QDocument.h"
15 #include "QDocumentDialog.h"
16
17 #include <QCloseEvent>
18
19 #include "FloatPlacement.h"
20 #include "lengthcombo.h"
21 #include "validators.h"
22 #include "panelstack.h"
23 #include "Qt2BC.h"
24 #include "checkedwidgets.h"
25 #include "qt_helpers.h"
26
27 #include "bufferparams.h"
28 #include "encoding.h"
29 #include "gettext.h"
30 #include "helper_funcs.h" // getSecond()
31 #include "language.h"
32 #include "lyxrc.h" // defaultUnit
33 #include "lyxtextclasslist.h"
34 #include "tex-strings.h" // tex_graphics
35 #include "Spacing.h"
36
37 #include "controllers/ControlDocument.h"
38 #include "controllers/frnt_lang.h"
39
40 #include "support/lstrings.h"
41
42 #include "controllers/ControlDocument.h"
43 #include "controllers/frnt_lang.h"
44
45
46 using lyx::support::token;
47 using lyx::support::bformat;
48 using lyx::support::findToken;
49 using lyx::support::getVectorFromString;
50
51 using std::distance;
52 using std::vector;
53 using std::string;
54
55
56 namespace lyx {
57 namespace frontend {
58
59
60 QDocumentDialog::QDocumentDialog(QDocument * form)
61         : form_(form),
62         lang_(getSecond(getLanguageData(false)))
63 {
64         setupUi(this);
65
66         connect(okPB, SIGNAL(clicked()),
67                 form, SLOT(slotOK()));
68         connect(applyPB, SIGNAL(clicked()),
69                 form, SLOT(slotApply()));
70         connect(closePB, SIGNAL(clicked()),
71                 form, SLOT(slotClose()));
72         connect(restorePB, SIGNAL(clicked()),
73                 form, SLOT(slotRestore()));
74
75
76         connect(savePB, SIGNAL( clicked() ), 
77                 this, SLOT( saveDefaultClicked() ) );
78         connect(defaultPB, SIGNAL( clicked() ), 
79                 this, SLOT( useDefaultsClicked() ) );
80
81         // Manage the restore, ok, apply, restore and cancel/close buttons
82         form_->bcview().setOK(okPB);
83         form_->bcview().setApply(applyPB);
84         form_->bcview().setCancel(closePB);
85         form_->bcview().setRestore(restorePB);
86
87
88         textLayoutModule = new UiWidget<Ui::TextLayoutUi>;
89         // text layout
90         connect(textLayoutModule->lspacingCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
91         connect(textLayoutModule->lspacingCO, SIGNAL(activated(int)), this, SLOT(setLSpacing(int)));
92         connect(textLayoutModule->lspacingLE, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
93         connect(textLayoutModule->skipRB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
94         connect(textLayoutModule->indentRB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
95         connect(textLayoutModule->skipCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
96         connect(textLayoutModule->skipLE, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
97         connect(textLayoutModule->skipLengthCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
98         connect(textLayoutModule->skipCO, SIGNAL(activated(int)), this, SLOT(setSkip(int)));
99         connect(textLayoutModule->skipRB, SIGNAL(toggled(bool)), this, SLOT(enableSkip(bool)));
100         connect(textLayoutModule->twoColumnCB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
101         textLayoutModule->lspacingLE->setValidator(new QDoubleValidator(
102                 textLayoutModule->lspacingLE));
103         textLayoutModule->skipLE->setValidator(unsignedLengthValidator(
104                 textLayoutModule->skipLE));
105
106         textLayoutModule->skipCO->addItem(qt_("SmallSkip"));
107         textLayoutModule->skipCO->addItem(qt_("MedSkip"));
108         textLayoutModule->skipCO->addItem(qt_("BigSkip"));
109         textLayoutModule->skipCO->addItem(qt_("Length"));
110         // remove the %-items from the unit choice
111         textLayoutModule->skipLengthCO->noPercents();
112         textLayoutModule->lspacingCO->insertItem(
113                 Spacing::Single, qt_("Single"));
114         textLayoutModule->lspacingCO->insertItem(
115                 Spacing::Onehalf, qt_("OneHalf"));
116         textLayoutModule->lspacingCO->insertItem(
117                 Spacing::Double, qt_("Double"));
118         textLayoutModule->lspacingCO->insertItem(
119                 Spacing::Other, qt_("Custom"));
120
121         // initialize the length validator
122         addCheckedLineEdit(form_->bcview(), textLayoutModule->skipLE);
123
124
125
126
127         fontModule = new UiWidget<Ui::FontUi>;
128         // fonts
129         connect(fontModule->fontsRomanCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
130         connect(fontModule->fontsRomanCO, SIGNAL(activated(int)), this, SLOT(romanChanged(int)));
131         connect(fontModule->fontsSansCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
132         connect(fontModule->fontsSansCO, SIGNAL(activated(int)), this, SLOT(sansChanged(int)));
133         connect(fontModule->fontsTypewriterCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
134         connect(fontModule->fontsTypewriterCO, SIGNAL(activated(int)), this, SLOT(ttChanged(int)));
135         connect(fontModule->fontsDefaultCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
136         connect(fontModule->fontsizeCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
137         connect(fontModule->scaleSansSB, SIGNAL(valueChanged(int)), this, SLOT(change_adaptor()));
138         connect(fontModule->scaleTypewriterSB, SIGNAL(valueChanged(int)), this, SLOT(change_adaptor()));
139         connect(fontModule->fontScCB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
140         connect(fontModule->fontOsfCB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
141
142         for (int n = 0; tex_fonts_roman[n][0]; ++n) {
143                 QString font = toqstr(tex_fonts_roman_gui[n]);
144                 if (!form_->controller().isFontAvailable(tex_fonts_roman[n]))
145                         font += qt_(" (not installed)");
146                 fontModule->fontsRomanCO->addItem(font);
147         }
148         for (int n = 0; tex_fonts_sans[n][0]; ++n) {
149                 QString font = toqstr(tex_fonts_sans_gui[n]);
150                 if (!form_->controller().isFontAvailable(tex_fonts_sans[n]))
151                         font += qt_(" (not installed)");
152                 fontModule->fontsSansCO->addItem(font);
153         }
154         for (int n = 0; tex_fonts_monospaced[n][0]; ++n) {
155                 QString font = toqstr(tex_fonts_monospaced_gui[n]);
156                 if (!form_->controller().isFontAvailable(tex_fonts_monospaced[n]))
157                         font += qt_(" (not installed)");
158                 fontModule->fontsTypewriterCO->addItem(font);
159         }
160
161         fontModule->fontsizeCO->addItem(qt_("default"));
162         fontModule->fontsizeCO->addItem(qt_("10"));
163         fontModule->fontsizeCO->addItem(qt_("11"));
164         fontModule->fontsizeCO->addItem(qt_("12"));
165
166         for (int n = 0; ControlDocument::fontfamilies_gui[n][0]; ++n)
167                 fontModule->fontsDefaultCO->addItem(
168                         qt_(ControlDocument::fontfamilies_gui[n]));
169
170
171
172
173         pageLayoutModule = new UiWidget<Ui::PageLayoutUi>;
174         // page layout
175         connect(pageLayoutModule->papersizeCO, SIGNAL(activated(int)), this, SLOT(setCustomPapersize(int)));
176         connect(pageLayoutModule->papersizeCO, SIGNAL(activated(int)), this, SLOT(setCustomPapersize(int)));
177         connect(pageLayoutModule->portraitRB, SIGNAL(toggled(bool)), this, SLOT(portraitChanged()));
178         connect(pageLayoutModule->papersizeCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
179         connect(pageLayoutModule->paperheightLE, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
180         connect(pageLayoutModule->paperwidthLE, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
181         connect(pageLayoutModule->paperwidthUnitCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
182         connect(pageLayoutModule->paperheightUnitCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
183         connect(pageLayoutModule->portraitRB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
184         connect(pageLayoutModule->landscapeRB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
185         connect(pageLayoutModule->facingPagesCB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
186         connect(pageLayoutModule->pagestyleCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
187         pageLayoutModule->pagestyleCO->addItem(qt_("default"));
188         pageLayoutModule->pagestyleCO->addItem(qt_("empty"));
189         pageLayoutModule->pagestyleCO->addItem(qt_("plain"));
190         pageLayoutModule->pagestyleCO->addItem(qt_("headings"));
191         pageLayoutModule->pagestyleCO->addItem(qt_("fancy"));
192         addCheckedLineEdit(form_->bcview(), pageLayoutModule->paperheightLE,
193                 pageLayoutModule->paperheightL);
194         addCheckedLineEdit(form_->bcview(), pageLayoutModule->paperwidthLE,
195                 pageLayoutModule->paperwidthL);
196
197         // paper
198         QComboBox * cb = pageLayoutModule->papersizeCO;
199         cb->addItem(qt_("Default"));
200         cb->addItem(qt_("Custom"));
201         cb->addItem(qt_("US letter"));
202         cb->addItem(qt_("US legal"));
203         cb->addItem(qt_("US executive"));
204         cb->addItem(qt_("A3"));
205         cb->addItem(qt_("A4"));
206         cb->addItem(qt_("A5"));
207         cb->addItem(qt_("B3"));
208         cb->addItem(qt_("B4"));
209         cb->addItem(qt_("B5"));
210         // remove the %-items from the unit choice
211         pageLayoutModule->paperwidthUnitCO->noPercents();
212         pageLayoutModule->paperheightUnitCO->noPercents();
213         pageLayoutModule->paperheightLE->setValidator(unsignedLengthValidator(
214                 pageLayoutModule->paperheightLE));
215         pageLayoutModule->paperwidthLE->setValidator(unsignedLengthValidator(
216                 pageLayoutModule->paperwidthLE));
217
218
219
220
221         marginsModule = new UiWidget<Ui::MarginsUi>;
222         // margins
223         connect(marginsModule->marginCB, SIGNAL(toggled(bool)), this, SLOT(setCustomMargins(bool)));
224         connect(marginsModule->marginCB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
225         connect(marginsModule->topLE, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
226         connect(marginsModule->topUnit, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
227         connect(marginsModule->bottomLE, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
228         connect(marginsModule->bottomUnit, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
229         connect(marginsModule->innerLE, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
230         connect(marginsModule->innerUnit, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
231         connect(marginsModule->outerLE, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
232         connect(marginsModule->outerUnit, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
233         connect(marginsModule->headheightLE, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
234         connect(marginsModule->headheightUnit, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
235         connect(marginsModule->headsepLE, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
236         connect(marginsModule->headsepUnit, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
237         connect(marginsModule->footskipLE, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
238         connect(marginsModule->footskipUnit, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
239         marginsModule->topLE->setValidator(unsignedLengthValidator(
240                 marginsModule->topLE));
241         marginsModule->bottomLE->setValidator(unsignedLengthValidator(
242                 marginsModule->bottomLE));
243         marginsModule->innerLE->setValidator(unsignedLengthValidator(
244                 marginsModule->innerLE));
245         marginsModule->outerLE->setValidator(unsignedLengthValidator(
246                 marginsModule->outerLE));
247         marginsModule->headsepLE->setValidator(unsignedLengthValidator(
248                 marginsModule->headsepLE));
249         marginsModule->headheightLE->setValidator(unsignedLengthValidator(
250                 marginsModule->headheightLE));
251         marginsModule->footskipLE->setValidator(unsignedLengthValidator(
252                 marginsModule->footskipLE));
253
254         addCheckedLineEdit(form_->bcview(), marginsModule->topLE,
255                 marginsModule->topL);
256         addCheckedLineEdit(form_->bcview(), marginsModule->bottomLE,
257                 marginsModule->bottomL);
258         addCheckedLineEdit(form_->bcview(), marginsModule->innerLE,
259                 marginsModule->innerL);
260         addCheckedLineEdit(form_->bcview(), marginsModule->outerLE,
261                 marginsModule->outerL);
262         addCheckedLineEdit(form_->bcview(), marginsModule->headsepLE,
263                 marginsModule->headsepL);
264         addCheckedLineEdit(form_->bcview(), marginsModule->headheightLE,
265                 marginsModule->headheightL);
266         addCheckedLineEdit(form_->bcview(), marginsModule->footskipLE,
267                 marginsModule->footskipL);
268
269
270
271
272
273         langModule = new UiWidget<Ui::LanguageUi>;
274         connect(langModule->defaultencodingCB, SIGNAL(toggled(bool)), langModule->encodingL, SLOT(setDisabled(bool)));
275         connect(langModule->defaultencodingCB, SIGNAL(toggled(bool)), langModule->encodingCO, SLOT(setDisabled(bool)));
276         // language & quote
277         connect(langModule->languageCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
278         connect(langModule->defaultencodingCB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
279         connect(langModule->encodingCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
280         connect(langModule->quoteStyleCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
281         // language & quotes
282         vector<LanguagePair> const langs = getLanguageData(false);
283         vector<LanguagePair>::const_iterator lit  = langs.begin();
284         vector<LanguagePair>::const_iterator lend = langs.end();
285         for (; lit != lend; ++lit) {
286                 langModule->languageCO->addItem(
287                         toqstr(lit->first));
288         }
289
290         // Always put the default encoding in the first position.
291         // It is special because the displayed text is translated.
292         langModule->encodingCO->addItem(qt_("LaTeX default"));
293         Encodings::const_iterator it = encodings.begin();
294         Encodings::const_iterator const end = encodings.end();
295         for (; it != end; ++it)
296                 langModule->encodingCO->addItem(toqstr(it->latexName()));
297
298         langModule->quoteStyleCO->addItem(qt_("``text''"));
299         langModule->quoteStyleCO->addItem(qt_("''text''"));
300         langModule->quoteStyleCO->addItem(qt_(",,text``"));
301         langModule->quoteStyleCO->addItem(qt_(",,text''"));
302         langModule->quoteStyleCO->addItem(qt_("<<text>>"));
303         langModule->quoteStyleCO->addItem(qt_(">>text<<"));
304
305
306
307         numberingModule = new UiWidget<Ui::NumberingUi>;
308         // numbering
309         connect(numberingModule->depthSL, SIGNAL(valueChanged(int)), this, SLOT(change_adaptor()));
310         connect(numberingModule->tocSL, SIGNAL(valueChanged(int)), this, SLOT(change_adaptor()));
311         connect(numberingModule->depthSL, SIGNAL(valueChanged(int)), this, SLOT(updateNumbering()));
312         connect(numberingModule->tocSL, SIGNAL(valueChanged(int)), this, SLOT(updateNumbering()));
313         numberingModule->tocTW->setColumnCount(3);
314         numberingModule->tocTW->headerItem()->setText(0, qt_("Example"));
315         numberingModule->tocTW->headerItem()->setText(1, qt_("Numbered"));
316         numberingModule->tocTW->headerItem()->setText(2, qt_("Appears in TOC"));
317
318
319         biblioModule = new UiWidget<Ui::BiblioUi>;
320         connect( biblioModule->citeNatbibRB, SIGNAL( toggled(bool) ), biblioModule->citationStyleL, SLOT( setEnabled(bool) ) );
321         connect( biblioModule->citeNatbibRB, SIGNAL( toggled(bool) ), biblioModule->citeStyleCO, SLOT( setEnabled(bool) ) );
322         // biblio
323         connect(biblioModule->citeDefaultRB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
324         connect(biblioModule->citeNatbibRB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
325         connect(biblioModule->citeStyleCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
326         connect(biblioModule->citeJurabibRB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
327         connect(biblioModule->bibtopicCB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
328         // biblio
329         biblioModule->citeStyleCO->addItem(qt_("Author-year"));
330         biblioModule->citeStyleCO->addItem(qt_("Numerical"));
331         biblioModule->citeStyleCO->setCurrentIndex(0);
332
333
334
335         mathsModule = new UiWidget<Ui::MathsUi>;
336         connect(mathsModule->amsautoCB, SIGNAL(toggled(bool)), mathsModule->amsCB, SLOT(setDisabled(bool)));
337         connect(mathsModule->esintautoCB, SIGNAL(toggled(bool)), mathsModule->esintCB, SLOT(setDisabled(bool)));
338         // maths
339         connect(mathsModule->amsCB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
340         connect(mathsModule->amsautoCB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
341         connect(mathsModule->esintCB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
342         connect(mathsModule->esintautoCB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
343
344         latexModule = new UiWidget<Ui::LaTeXUi>;
345         // latex class
346         connect(latexModule->classCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
347         connect(latexModule->optionsLE, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
348         connect(latexModule->psdriverCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
349         connect(latexModule->classCO, SIGNAL(activated(int)), this, SLOT(classChanged()));
350         // packages
351         for (int n = 0; tex_graphics[n][0]; ++n) {
352                 QString enc = tex_graphics[n];
353                 latexModule->psdriverCO->addItem(enc);
354         }
355         // latex
356         for (LyXTextClassList::const_iterator cit = textclasslist.begin();
357              cit != textclasslist.end(); ++cit) {
358                 if (cit->isTeXClassAvailable()) {
359                         latexModule->classCO->addItem(toqstr(cit->description()));
360                 } else {
361                         docstring item =
362                                 bformat(_("Unavailable: %1$s"), lyx::from_utf8(cit->description()));
363                         latexModule->classCO->addItem(toqstr(item));
364                 }
365         }
366
367         // branches
368         branchesModule = new QBranches;
369         connect(branchesModule, SIGNAL(changed()), this, SLOT(change_adaptor()));
370
371         // preamble
372         preambleModule = new UiWidget<Ui::PreambleUi>;
373         connect(preambleModule->preambleTE, SIGNAL(textChanged()), this, SLOT(change_adaptor()));
374
375
376         // bullets
377         bulletsModule = new BulletsModule;
378         connect(bulletsModule, SIGNAL(changed()), this, SLOT(change_adaptor()));
379
380
381         // float
382         floatModule = new FloatPlacement;
383         connect(floatModule, SIGNAL(changed()), this, SLOT(change_adaptor()));
384
385         docPS->addPanel(latexModule, _("Document Class"));
386         docPS->addPanel(fontModule, _("Fonts"));
387         docPS->addPanel(textLayoutModule, _("Text Layout"));
388         docPS->addPanel(pageLayoutModule, _("Page Layout"));
389         docPS->addPanel(marginsModule, _("Page Margins"));
390         docPS->addPanel(langModule, _("Language"));
391         docPS->addPanel(numberingModule, _("Numbering & TOC"));
392         docPS->addPanel(biblioModule, _("Bibliography"));
393         docPS->addPanel(mathsModule, _("Math Options"));
394         docPS->addPanel(floatModule, _("Float Placement"));
395         docPS->addPanel(bulletsModule, _("Bullets"));
396         docPS->addPanel(branchesModule, _("Branches"));
397         docPS->addPanel(preambleModule, _("LaTeX Preamble"));
398         docPS->setCurrentPanel(_("Document Class"));
399 // FIXME: hack to work around resizing bug in Qt >= 4.2
400 // bug verified with Qt 4.2.{0-2} (JSpitzm)
401 #if QT_VERSION >= 0x040200
402         docPS->updateGeometry();
403 #endif
404 }
405
406
407 QDocumentDialog::~QDocumentDialog()
408 {
409 }
410
411
412 void QDocumentDialog::showPreamble()
413 {
414         docPS->setCurrentPanel(_("LaTeX Preamble"));
415 }
416
417
418 void QDocumentDialog::saveDefaultClicked()
419 {
420         form_->saveDocDefault();
421 }
422
423
424 void QDocumentDialog::useDefaultsClicked()
425 {
426         form_->useClassDefaults();
427 }
428
429
430 void QDocumentDialog::change_adaptor()
431 {
432         form_->changed();
433 }
434
435
436 void QDocumentDialog::closeEvent(QCloseEvent * e)
437 {
438         form_->slotWMHide();
439         e->accept();
440 }
441
442
443 void QDocumentDialog::setLSpacing(int item)
444 {
445         textLayoutModule->lspacingLE->setEnabled(item == 3);
446 }
447
448
449 void QDocumentDialog::setSkip(int item)
450 {
451         bool const enable = (item == 3);
452         textLayoutModule->skipLE->setEnabled(enable);
453         textLayoutModule->skipLengthCO->setEnabled(enable);
454 }
455
456
457 void QDocumentDialog::enableSkip(bool skip)
458 {
459         textLayoutModule->skipCO->setEnabled(skip);
460         textLayoutModule->skipLE->setEnabled(skip);
461         textLayoutModule->skipLengthCO->setEnabled(skip);
462         if (skip)
463                 setSkip(textLayoutModule->skipCO->currentIndex());
464 }
465
466 void QDocumentDialog::portraitChanged()
467 {
468         setMargins(pageLayoutModule->papersizeCO->currentIndex());
469 }
470
471 void QDocumentDialog::setMargins(bool custom)
472 {
473         marginsModule->marginCB->setChecked(custom);
474         setCustomMargins(custom);
475 }
476
477
478 void QDocumentDialog::setCustomPapersize(int papersize)
479 {
480         bool const custom = (papersize == 1);
481
482         pageLayoutModule->paperwidthL->setEnabled(custom);
483         pageLayoutModule->paperwidthLE->setEnabled(custom);
484         pageLayoutModule->paperwidthUnitCO->setEnabled(custom);
485         pageLayoutModule->paperheightL->setEnabled(custom);
486         pageLayoutModule->paperheightLE->setEnabled(custom);
487         pageLayoutModule->paperheightLE->setFocus();
488         pageLayoutModule->paperheightUnitCO->setEnabled(custom);
489 }
490
491
492 void QDocumentDialog::setCustomMargins(bool custom)
493 {
494         marginsModule->topL->setEnabled(!custom);
495         marginsModule->topLE->setEnabled(!custom);
496         marginsModule->topUnit->setEnabled(!custom);
497
498         marginsModule->bottomL->setEnabled(!custom);
499         marginsModule->bottomLE->setEnabled(!custom);
500         marginsModule->bottomUnit->setEnabled(!custom);
501
502         marginsModule->innerL->setEnabled(!custom);
503         marginsModule->innerLE->setEnabled(!custom);
504         marginsModule->innerUnit->setEnabled(!custom);
505
506         marginsModule->outerL->setEnabled(!custom);
507         marginsModule->outerLE->setEnabled(!custom);
508         marginsModule->outerUnit->setEnabled(!custom);
509
510         marginsModule->headheightL->setEnabled(!custom);
511         marginsModule->headheightLE->setEnabled(!custom);
512         marginsModule->headheightUnit->setEnabled(!custom);
513
514         marginsModule->headsepL->setEnabled(!custom);
515         marginsModule->headsepLE->setEnabled(!custom);
516         marginsModule->headsepUnit->setEnabled(!custom);
517
518         marginsModule->footskipL->setEnabled(!custom);
519         marginsModule->footskipLE->setEnabled(!custom);
520         marginsModule->footskipUnit->setEnabled(!custom);
521 }
522
523
524 void QDocumentDialog::updateFontsize(string const & items, string const & sel)
525 {
526         fontModule->fontsizeCO->clear();
527         fontModule->fontsizeCO->addItem(qt_("default"));
528
529         for (int n = 0; !token(items,'|',n).empty(); ++n)
530                 fontModule->fontsizeCO->
531                         addItem(toqstr(token(items,'|',n)));
532
533         for (int n = 0; n < fontModule->fontsizeCO->count(); ++n) {
534                 if (fromqstr(fontModule->fontsizeCO->itemText(n)) == sel) {
535                         fontModule->fontsizeCO->setCurrentIndex(n);
536                         break;
537                 }
538         }
539 }
540
541
542 void QDocumentDialog::romanChanged(int item)
543 {
544         string const font = tex_fonts_roman[item];
545         
546         fontModule->fontScCB->setEnabled(
547                 form_->controller().providesSC(font));
548         fontModule->fontOsfCB->setEnabled(
549                 form_->controller().providesOSF(font));
550 }
551
552
553 void QDocumentDialog::sansChanged(int item)
554 {
555         string const font = tex_fonts_sans[item];
556         bool scaleable = form_->controller().providesScale(font);
557         fontModule->scaleSansSB->setEnabled(scaleable);
558         fontModule->scaleSansLA->setEnabled(scaleable);
559 }
560
561
562 void QDocumentDialog::ttChanged(int item)
563 {
564         string const font = tex_fonts_monospaced[item];
565         bool scaleable = form_->controller().providesScale(font);
566         fontModule->scaleTypewriterSB->setEnabled(scaleable);
567         fontModule->scaleTypewriterLA->setEnabled(scaleable);
568 }
569
570
571 void QDocumentDialog::updatePagestyle(string const & items, string const & sel)
572 {
573         pageLayoutModule->pagestyleCO->clear();
574         pageLayoutModule->pagestyleCO->addItem("default");
575
576         for (int n=0; !token(items,'|',n).empty(); ++n)
577                 pageLayoutModule->pagestyleCO->
578                         addItem(toqstr(token(items,'|',n)));
579
580         for (int n = 0; n<pageLayoutModule->pagestyleCO->count(); ++n) {
581                 if (fromqstr(pageLayoutModule->pagestyleCO->itemText(n))==sel) {
582                         pageLayoutModule->pagestyleCO->setCurrentIndex(n);
583                         break;
584                 }
585         }
586 }
587
588
589 void QDocumentDialog::classChanged()
590 {
591         ControlDocument & cntrl = form_->controller();
592         BufferParams & params = cntrl.params();
593
594         lyx::textclass_type const tc = latexModule->classCO->currentIndex();
595
596         if (form_->controller().loadTextclass(tc)) {
597                 params.textclass = tc;
598                 if (lyxrc.auto_reset_options)
599                         params.useClassDefaults();
600                 form_->update_contents();
601         } else {
602                 latexModule->classCO->setCurrentIndex(params.textclass);
603         }
604 }
605
606
607 void QDocumentDialog::updateNumbering()
608 {
609         LyXTextClass const & tclass =
610                 form_->controller().params().getLyXTextClass();
611
612         numberingModule->tocTW->setUpdatesEnabled(false);
613         numberingModule->tocTW->clear();
614
615         int const depth = numberingModule->depthSL->value();
616         int const toc = numberingModule->tocSL->value();
617         QString const no = qt_("No");
618         QString const yes = qt_("Yes");
619         LyXTextClass::const_iterator end = tclass.end();
620         LyXTextClass::const_iterator cit = tclass.begin();
621         QTreeWidgetItem * item = 0;
622         for ( ; cit != end ; ++cit) {
623                 int const toclevel = (*cit)->toclevel;
624                 if (toclevel != LyXLayout::NOT_IN_TOC 
625                     && (*cit)->labeltype == LABEL_COUNTER) {
626                         item = new QTreeWidgetItem(numberingModule->tocTW);
627                         item->setText(0, qt_((*cit)->name()));
628                         item->setText(1, (toclevel <= depth) ? yes : no);
629                         item->setText(2, (toclevel <= toc) ? yes : no);
630                 }
631         }
632
633         numberingModule->tocTW->setUpdatesEnabled(true);
634         numberingModule->tocTW->update();
635 }
636
637 void QDocumentDialog::apply(BufferParams & params)
638 {
639         // preamble
640         params.preamble =
641                 fromqstr(preambleModule->preambleTE->document()->toPlainText());
642
643         // biblio
644         params.cite_engine = biblio::ENGINE_BASIC;
645
646         if (biblioModule->citeNatbibRB->isChecked()) {
647                 bool const use_numerical_citations =
648                         biblioModule->citeStyleCO->currentIndex();
649                 if (use_numerical_citations)
650                         params.cite_engine = biblio::ENGINE_NATBIB_NUMERICAL;
651                 else
652                         params.cite_engine = biblio::ENGINE_NATBIB_AUTHORYEAR;
653
654         } else if (biblioModule->citeJurabibRB->isChecked())
655                 params.cite_engine = biblio::ENGINE_JURABIB;
656
657         params.use_bibtopic =
658                 biblioModule->bibtopicCB->isChecked();
659
660         // language & quotes
661         if (langModule->defaultencodingCB->isChecked()) {
662                 params.inputenc = "auto";
663         } else {
664                 int i = langModule->encodingCO->currentIndex();
665                 if (i == 0)
666                         params.inputenc = "default";
667                 else
668                         params.inputenc =
669                                 fromqstr(langModule->encodingCO->currentText());
670         }
671
672         InsetQuotes::quote_language lga = InsetQuotes::EnglishQ;
673         switch (langModule->quoteStyleCO->currentIndex()) {
674         case 0:
675                 lga = InsetQuotes::EnglishQ;
676                 break;
677         case 1:
678                 lga = InsetQuotes::SwedishQ;
679                 break;
680         case 2:
681                 lga = InsetQuotes::GermanQ;
682                 break;
683         case 3:
684                 lga = InsetQuotes::PolishQ;
685                 break;
686         case 4:
687                 lga = InsetQuotes::FrenchQ;
688                 break;
689         case 5:
690                 lga = InsetQuotes::DanishQ;
691                 break;
692         }
693         params.quotes_language = lga;
694
695         int const pos = langModule->languageCO->currentIndex();
696         params.language = languages.getLanguage(lang_[pos]);
697
698         // numbering
699         if (params.getLyXTextClass().hasTocLevels()) {
700                 params.tocdepth = numberingModule->tocSL->value();
701                 params.secnumdepth = numberingModule->depthSL->value();
702         }
703
704         // bullets
705         params.user_defined_bullet(0) = bulletsModule->getBullet(0);
706         params.user_defined_bullet(1) = bulletsModule->getBullet(1);
707         params.user_defined_bullet(2) = bulletsModule->getBullet(2);
708         params.user_defined_bullet(3) = bulletsModule->getBullet(3);
709
710         // packages
711         params.graphicsDriver =
712                 fromqstr(latexModule->psdriverCO->currentText());
713
714         if (mathsModule->amsautoCB->isChecked()) {
715                 params.use_amsmath = BufferParams::package_auto;
716         } else {
717                 if (mathsModule->amsCB->isChecked())
718                         params.use_amsmath = BufferParams::package_on;
719                 else
720                         params.use_amsmath = BufferParams::package_off;
721         }
722
723         if (mathsModule->esintautoCB->isChecked())
724                 params.use_esint = BufferParams::package_auto;
725         else {
726                 if (mathsModule->esintCB->isChecked())
727                         params.use_esint = BufferParams::package_on;
728                 else
729                         params.use_esint = BufferParams::package_off;
730         }
731
732         // text layout
733         params.textclass =
734                 latexModule->classCO->currentIndex();
735
736         params.pagestyle =
737                 fromqstr(pageLayoutModule->pagestyleCO->currentText());
738
739         switch (textLayoutModule->lspacingCO->currentIndex()) {
740         case 0:
741                 params.spacing().set(Spacing::Single);
742                 break;
743         case 1:
744                 params.spacing().set(Spacing::Onehalf);
745                 break;
746         case 2:
747                 params.spacing().set(Spacing::Double);
748                 break;
749         case 3:
750                 params.spacing().set(Spacing::Other,
751                         fromqstr(textLayoutModule->lspacingLE->text()));
752                 break;
753         }
754
755         if (textLayoutModule->twoColumnCB->isChecked())
756                 params.columns = 2;
757         else
758                 params.columns = 1;
759
760         if (textLayoutModule->indentRB->isChecked())
761                 params.paragraph_separation = BufferParams::PARSEP_INDENT;
762         else
763                 params.paragraph_separation = BufferParams::PARSEP_SKIP;
764
765         switch (textLayoutModule->skipCO->currentIndex()) {
766         case 0:
767                 params.setDefSkip(VSpace(VSpace::SMALLSKIP));
768                 break;
769         case 1:
770                 params.setDefSkip(VSpace(VSpace::MEDSKIP));
771                 break;
772         case 2:
773                 params.setDefSkip(VSpace(VSpace::BIGSKIP));
774                 break;
775         case 3:
776         {
777                 VSpace vs = VSpace(
778                         widgetsToLength(textLayoutModule->skipLE,
779                                 textLayoutModule->skipLengthCO)
780                         );
781                 params.setDefSkip(vs);
782                 break;
783         }
784         default:
785                 // DocumentDefskipCB assures that this never happens
786                 // so Assert then !!!  - jbl
787                 params.setDefSkip(VSpace(VSpace::MEDSKIP));
788                 break;
789         }
790
791         params.options =
792                 fromqstr(latexModule->optionsLE->text());
793
794         params.float_placement = floatModule->get();
795
796         // fonts
797         params.fontsRoman =
798                 tex_fonts_roman[fontModule->fontsRomanCO->currentIndex()];
799
800         params.fontsSans =
801                 tex_fonts_sans[fontModule->fontsSansCO->currentIndex()];
802
803         params.fontsTypewriter =
804                 tex_fonts_monospaced[fontModule->fontsTypewriterCO->currentIndex()];
805
806         params.fontsSansScale = fontModule->scaleSansSB->value();
807
808         params.fontsTypewriterScale = fontModule->scaleTypewriterSB->value();
809
810         params.fontsSC = fontModule->fontScCB->isChecked();
811
812         params.fontsOSF = fontModule->fontOsfCB->isChecked();
813
814         params.fontsDefaultFamily = ControlDocument::fontfamilies[
815                 fontModule->fontsDefaultCO->currentIndex()];
816
817         if (fontModule->fontsizeCO->currentIndex() == 0)
818                 params.fontsize = "default";
819         else
820                 params.fontsize =
821                         fromqstr(fontModule->fontsizeCO->currentText());
822
823         // paper
824         params.papersize = PAPER_SIZE(
825                 pageLayoutModule->papersizeCO->currentIndex());
826
827         // custom, A3, B3 and B4 paper sizes need geometry
828         int psize = pageLayoutModule->papersizeCO->currentIndex();
829         bool geom_papersize = (psize == 1 || psize == 5 || psize == 8 || psize == 9);
830
831         params.paperwidth = widgetsToLength(pageLayoutModule->paperwidthLE,
832                 pageLayoutModule->paperwidthUnitCO);
833
834         params.paperheight = widgetsToLength(pageLayoutModule->paperheightLE,
835                 pageLayoutModule->paperheightUnitCO);
836
837         if (pageLayoutModule->facingPagesCB->isChecked())
838                 params.sides = LyXTextClass::TwoSides;
839         else
840                 params.sides = LyXTextClass::OneSide;
841
842         if (pageLayoutModule->landscapeRB->isChecked())
843                 params.orientation = ORIENTATION_LANDSCAPE;
844         else
845                 params.orientation = ORIENTATION_PORTRAIT;
846
847         // margins
848         params.use_geometry =
849                 (!marginsModule->marginCB->isChecked()
850                 || geom_papersize);
851
852         Ui::MarginsUi const * m(marginsModule);
853
854         params.leftmargin = widgetsToLength(m->innerLE, m->innerUnit);
855
856         params.topmargin = widgetsToLength(m->topLE, m->topUnit);
857
858         params.rightmargin = widgetsToLength(m->outerLE, m->outerUnit);
859
860         params.bottommargin = widgetsToLength(m->bottomLE, m->bottomUnit);
861
862         params.headheight = widgetsToLength(m->headheightLE, m->headheightUnit);
863
864         params.headsep = widgetsToLength(m->headsepLE, m->headsepUnit);
865
866         params.footskip = widgetsToLength(m->footskipLE, m->footskipUnit);
867
868         branchesModule->apply(params);
869 }
870
871 namespace {
872
873 /** Return the position of val in the vector if found.
874     If not found, return 0.
875  */
876 template<class A>
877 typename std::vector<A>::size_type
878 findPos(std::vector<A> const & vec, A const & val)
879 {
880         typename std::vector<A>::const_iterator it =
881                 std::find(vec.begin(), vec.end(), val);
882         if (it == vec.end())
883                 return 0;
884         return distance(vec.begin(), it);
885 }
886
887 } // namespace anom
888
889
890 void QDocumentDialog::update(BufferParams const & params)
891 {
892         // set the default unit
893         // FIXME: move to controller
894         LyXLength::UNIT defaultUnit = LyXLength::CM;
895         switch (lyxrc.default_papersize) {
896                 case PAPER_DEFAULT: break;
897
898                 case PAPER_USLETTER:
899                 case PAPER_USLEGAL:
900                 case PAPER_USEXECUTIVE:
901                         defaultUnit = LyXLength::IN;
902                         break;
903
904                 case PAPER_A3:
905                 case PAPER_A4:
906                 case PAPER_A5:
907                 case PAPER_B3:
908                 case PAPER_B4:
909                 case PAPER_B5:
910                         defaultUnit = LyXLength::CM;
911                         break;
912                 case PAPER_CUSTOM:
913                         break;
914         }
915
916         // preamble
917         QString preamble = toqstr(params.preamble);
918         preambleModule->preambleTE->document()->setPlainText(preamble);
919
920         // biblio
921         biblioModule->citeDefaultRB->setChecked(
922                 params.cite_engine == biblio::ENGINE_BASIC);
923
924         biblioModule->citeNatbibRB->setChecked(
925                 params.cite_engine == biblio::ENGINE_NATBIB_NUMERICAL ||
926                 params.cite_engine == biblio::ENGINE_NATBIB_AUTHORYEAR);
927
928         biblioModule->citeStyleCO->setCurrentIndex(
929                 params.cite_engine == biblio::ENGINE_NATBIB_NUMERICAL);
930
931         biblioModule->citeJurabibRB->setChecked(
932                 params.cite_engine == biblio::ENGINE_JURABIB);
933
934         biblioModule->bibtopicCB->setChecked(
935                 params.use_bibtopic);
936
937         // language & quotes
938         int const pos = int(findPos(lang_,
939                                     params.language->lang()));
940         langModule->languageCO->setCurrentIndex(pos);
941
942         langModule->quoteStyleCO->setCurrentIndex(
943                 params.quotes_language);
944
945         langModule->defaultencodingCB->setChecked(true);
946
947         if (params.inputenc != "auto") {
948                 langModule->defaultencodingCB->setChecked(false);
949                 if (params.inputenc == "default") {
950                         langModule->encodingCO->setCurrentIndex(0);
951                 } else {
952                         int const i = langModule->encodingCO->findText(
953                                         toqstr(params.inputenc));
954                         if (i >= 0)
955                                 langModule->encodingCO->setCurrentIndex(i);
956                         else
957                                 // unknown encoding. Set to default.
958                                 langModule->defaultencodingCB->setChecked(true);
959                 }
960         }
961
962         // numbering
963         int const min_toclevel = form_->controller().textClass().min_toclevel();
964         int const max_toclevel = form_->controller().textClass().max_toclevel();
965         if (form_->controller().textClass().hasTocLevels()) {
966                 numberingModule->setEnabled(true);
967                 numberingModule->depthSL->setMinimum(min_toclevel - 1);
968                 numberingModule->depthSL->setMaximum(max_toclevel);
969                 numberingModule->depthSL->setValue(params.secnumdepth);
970                 numberingModule->tocSL->setMaximum(min_toclevel - 1);
971                 numberingModule->tocSL->setMaximum(max_toclevel);
972                 numberingModule->tocSL->setValue(params.tocdepth);
973                 updateNumbering();
974         } else {
975                 numberingModule->setEnabled(false);
976                 numberingModule->tocTW->clear();
977         }
978
979         // bullets
980         bulletsModule->setBullet(0, params.user_defined_bullet(0));
981         bulletsModule->setBullet(1, params.user_defined_bullet(1));
982         bulletsModule->setBullet(2, params.user_defined_bullet(2));
983         bulletsModule->setBullet(3, params.user_defined_bullet(3));
984         bulletsModule->init();
985
986         // packages
987         QString text = toqstr(params.graphicsDriver);
988         int nitem = latexModule->psdriverCO->count();
989         for (int n = 0; n < nitem ; ++n) {
990                 QString enc = tex_graphics[n];
991                 if (enc == text) {
992                         latexModule->psdriverCO->setCurrentIndex(n);
993                 }
994         }
995
996
997         mathsModule->amsCB->setChecked(
998                 params.use_amsmath == BufferParams::package_on);
999         mathsModule->amsautoCB->setChecked(
1000                 params.use_amsmath == BufferParams::package_auto);
1001
1002         mathsModule->esintCB->setChecked(
1003                 params.use_esint == BufferParams::package_on);
1004         mathsModule->esintautoCB->setChecked(
1005                 params.use_esint == BufferParams::package_auto);
1006
1007         switch (params.spacing().getSpace()) {
1008                 case Spacing::Other: nitem = 3; break;
1009                 case Spacing::Double: nitem = 2; break;
1010                 case Spacing::Onehalf: nitem = 1; break;
1011                 case Spacing::Default: case Spacing::Single: nitem = 0; break;
1012         }
1013
1014         // text layout
1015         latexModule->classCO->setCurrentIndex(params.textclass);
1016
1017         updatePagestyle(form_->controller().textClass().opt_pagestyle(),
1018                                  params.pagestyle);
1019
1020         textLayoutModule->lspacingCO->setCurrentIndex(nitem);
1021         if (params.spacing().getSpace() == Spacing::Other) {
1022                 textLayoutModule->lspacingLE->setText(
1023                         toqstr(params.spacing().getValueAsString()));
1024         }
1025         setLSpacing(nitem);
1026
1027         if (params.paragraph_separation
1028             == BufferParams::PARSEP_INDENT) {
1029                 textLayoutModule->indentRB->setChecked(true);
1030         } else {
1031                 textLayoutModule->skipRB->setChecked(true);
1032         }
1033
1034         int skip = 0;
1035         switch (params.getDefSkip().kind()) {
1036         case VSpace::SMALLSKIP:
1037                 skip = 0;
1038                 break;
1039         case VSpace::MEDSKIP:
1040                 skip = 1;
1041                 break;
1042         case VSpace::BIGSKIP:
1043                 skip = 2;
1044                 break;
1045         case VSpace::LENGTH:
1046         {
1047                 skip = 3;
1048                 string const length = params.getDefSkip().asLyXCommand();
1049                 lengthToWidgets(textLayoutModule->skipLE,
1050                         textLayoutModule->skipLengthCO,
1051                         length, defaultUnit);
1052                 break;
1053         }
1054         default:
1055                 skip = 0;
1056                 break;
1057         }
1058         textLayoutModule->skipCO->setCurrentIndex(skip);
1059         setSkip(skip);
1060
1061         textLayoutModule->twoColumnCB->setChecked(
1062                 params.columns == 2);
1063
1064         if (!params.options.empty()) {
1065                 latexModule->optionsLE->setText(
1066                         toqstr(params.options));
1067         } else {
1068                 latexModule->optionsLE->setText("");
1069         }
1070
1071         floatModule->set(params.float_placement);
1072
1073         //fonts
1074         updateFontsize(form_->controller().textClass().opt_fontsize(),
1075                         params.fontsize);
1076
1077         int n = findToken(tex_fonts_roman, params.fontsRoman);
1078         if (n >= 0) {
1079                 fontModule->fontsRomanCO->setCurrentIndex(n);
1080                 romanChanged(n);
1081         }
1082
1083         n = findToken(tex_fonts_sans, params.fontsSans);
1084         if (n >= 0)     {
1085                 fontModule->fontsSansCO->setCurrentIndex(n);
1086                 sansChanged(n);
1087         }
1088
1089         n = findToken(tex_fonts_monospaced, params.fontsTypewriter);
1090         if (n >= 0) {
1091                 fontModule->fontsTypewriterCO->setCurrentIndex(n);
1092                 ttChanged(n);
1093         }
1094
1095         fontModule->fontScCB->setChecked(params.fontsSC);
1096         fontModule->fontOsfCB->setChecked(params.fontsOSF);
1097         fontModule->scaleSansSB->setValue(params.fontsSansScale);
1098         fontModule->scaleTypewriterSB->setValue(params.fontsTypewriterScale);
1099         n = findToken(ControlDocument::fontfamilies, params.fontsDefaultFamily);
1100         if (n >= 0)
1101                 fontModule->fontsDefaultCO->setCurrentIndex(n);
1102
1103         // paper
1104         int const psize = params.papersize;
1105         pageLayoutModule->papersizeCO->setCurrentIndex(psize);
1106         setCustomPapersize(psize);
1107
1108         bool const landscape =
1109                 params.orientation == ORIENTATION_LANDSCAPE;
1110         pageLayoutModule->landscapeRB->setChecked(landscape);
1111         pageLayoutModule->portraitRB->setChecked(!landscape);
1112
1113         pageLayoutModule->facingPagesCB->setChecked(
1114                 params.sides == LyXTextClass::TwoSides);
1115
1116
1117         lengthToWidgets(pageLayoutModule->paperwidthLE,
1118                 pageLayoutModule->paperwidthUnitCO, params.paperwidth, defaultUnit);
1119
1120         lengthToWidgets(pageLayoutModule->paperheightLE,
1121                 pageLayoutModule->paperheightUnitCO, params.paperheight, defaultUnit);
1122
1123         // margins
1124         Ui::MarginsUi * m = marginsModule;
1125
1126         setMargins(!params.use_geometry);
1127
1128         lengthToWidgets(m->topLE, m->topUnit,
1129                 params.topmargin, defaultUnit);
1130
1131         lengthToWidgets(m->bottomLE, m->bottomUnit,
1132                 params.bottommargin, defaultUnit);
1133
1134         lengthToWidgets(m->innerLE, m->innerUnit,
1135                 params.leftmargin, defaultUnit);
1136
1137         lengthToWidgets(m->outerLE, m->outerUnit,
1138                 params.rightmargin, defaultUnit);
1139
1140         lengthToWidgets(m->headheightLE, m->headheightUnit,
1141                 params.headheight, defaultUnit);
1142
1143         lengthToWidgets(m->headsepLE, m->headsepUnit,
1144                 params.headsep, defaultUnit);
1145
1146         lengthToWidgets(m->footskipLE, m->footskipUnit,
1147                 params.footskip, defaultUnit);
1148
1149         branchesModule->update(params);
1150 }
1151
1152
1153
1154
1155 } // namespace frontend
1156 } // namespace lyx
1157
1158 #include "QDocumentDialog_moc.cpp"