2 * \file GuiDocument.cpp
3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
7 * \author Richard Heck (modules)
9 * Full author contact details are available in file CREDITS.
14 #include "GuiDocument.h"
16 #include "BranchList.h"
17 #include "buffer_funcs.h"
19 #include "BufferParams.h"
20 #include "BufferView.h"
22 #include "EmbeddedFiles.h"
24 #include "FloatPlacement.h"
25 #include "FuncRequest.h"
26 #include "support/gettext.h"
27 #include "GuiBranches.h"
29 #include "LaTeXFeatures.h"
30 #include "LaTeXHighlighter.h"
32 #include "LengthCombo.h"
33 #include "LyXRC.h" // defaultUnit
34 #include "ModuleList.h"
35 #include "OutputParams.h"
36 #include "PanelStack.h"
37 #include "PDFOptions.h"
38 #include "qt_helpers.h"
40 #include "TextClassList.h"
41 #include "Validator.h"
43 #include "insets/InsetListingsParams.h"
45 //#include "support/debug.h"
46 #include "support/FileName.h"
47 #include "support/filetools.h"
48 #include "support/lstrings.h"
50 #include <boost/bind.hpp>
52 #include <QCloseEvent>
54 #include <QTextCursor>
60 using namespace lyx::support;
64 vector<typename Pair::second_type> const
65 getSecond(vector<Pair> const & pr)
67 vector<typename Pair::second_type> tmp(pr.size());
68 transform(pr.begin(), pr.end(), tmp.begin(),
69 boost::bind(&Pair::second, _1));
73 char const * const tex_graphics[] =
75 "default", "dvips", "dvitops", "emtex",
76 "ln", "oztex", "textures", "none", ""
80 char const * const tex_graphics_gui[] =
82 N_("Default"), "Dvips", "DVItoPS", "EmTeX",
83 "LN", "OzTeX", "Textures", N_("None"), ""
87 char const * const tex_fonts_roman[] =
89 "default", "cmr", "lmodern", "ae", "times", "palatino",
90 "charter", "newcent", "bookman", "utopia", "beraserif",
91 "ccfonts", "chancery", ""
95 char const * tex_fonts_roman_gui[] =
97 N_("Default"), N_("Computer Modern Roman"), N_("Latin Modern Roman"),
98 N_("AE (Almost European)"), N_("Times Roman"), N_("Palatino"),
99 N_("Bitstream Charter"), N_("New Century Schoolbook"), N_("Bookman"),
100 N_("Utopia"), N_("Bera Serif"), N_("Concrete Roman"), N_("Zapf Chancery"),
105 char const * const tex_fonts_sans[] =
107 "default", "cmss", "lmss", "helvet", "avant", "berasans", "cmbr", ""
111 char const * tex_fonts_sans_gui[] =
113 N_("Default"), N_("Computer Modern Sans"), N_("Latin Modern Sans"),
114 N_("Helvetica"), N_("Avant Garde"), N_("Bera Sans"), N_("CM Bright"), ""
118 char const * const tex_fonts_monospaced[] =
120 "default", "cmtt", "lmtt", "courier", "beramono", "luximono", "cmtl", ""
124 char const * tex_fonts_monospaced_gui[] =
126 N_("Default"), N_("Computer Modern Typewriter"),
127 N_("Latin Modern Typewriter"), N_("Courier"), N_("Bera Mono"),
128 N_("LuxiMono"), N_("CM Typewriter Light"), ""
132 vector<pair<string, lyx::docstring> > pagestyles;
139 vector<string> getRequiredList(string const & modName)
141 LyXModule const * const mod = moduleList[modName];
143 return vector<string>(); //empty such thing
144 return mod->getRequiredModules();
148 vector<string> getExcludedList(string const & modName)
150 LyXModule const * const mod = moduleList[modName];
152 return vector<string>(); //empty such thing
153 return mod->getExcludedModules();
157 docstring getModuleDescription(string const & modName)
159 LyXModule const * const mod = moduleList[modName];
161 return _("Module not found!");
162 return from_ascii(mod->getDescription());
166 vector<string> getPackageList(string const & modName)
168 LyXModule const * const mod = moduleList[modName];
170 return vector<string>(); //empty such thing
171 return mod->getPackageList();
175 bool isModuleAvailable(string const & modName)
177 LyXModule * mod = moduleList[modName];
180 return mod->isAvailable();
182 } //anonymous namespace
185 ModuleSelMan::ModuleSelMan(
186 QListView * availableLV,
187 QListView * selectedLV,
191 QPushButton * downPB,
192 QStringListModel * availableModel,
193 QStringListModel * selectedModel) :
194 GuiSelectionManager(availableLV, selectedLV, addPB, delPB,
195 upPB, downPB, availableModel, selectedModel)
199 void ModuleSelMan::updateAddPB()
201 int const arows = availableModel->stringList().size();
202 QModelIndexList const availSels =
203 availableLV->selectionModel()->selectedIndexes();
204 if (arows == 0 || availSels.isEmpty() || isSelected(availSels.first())) {
205 addPB->setEnabled(false);
209 QModelIndex const & idx = availableLV->selectionModel()->currentIndex();
210 string const modName = fromqstr(idx.data().toString());
211 vector<string> reqs = getRequiredList(modName);
212 vector<string> excl = getExcludedList(modName);
214 if (reqs.empty() && excl.empty()) {
215 addPB->setEnabled(true);
219 QStringList const & qsl = selectedModel->stringList();
221 //Check whether some required module is available
223 bool foundOne = false;
224 vector<string>::const_iterator it = reqs.begin();
225 vector<string>::const_iterator end = reqs.end();
226 for (; it != end; ++it) {
227 if (qsl.contains(toqstr(*it))) {
233 addPB->setEnabled(false);
238 //Check whether any excluded module is being used
240 vector<string>::const_iterator it = excl.begin();
241 vector<string>::const_iterator end = excl.end();
242 for (; it != end; ++it) {
243 if (qsl.contains(toqstr(*it))) {
244 addPB->setEnabled(false);
250 addPB->setEnabled(true);
253 void ModuleSelMan::updateDownPB()
255 int const srows = selectedModel->stringList().size();
257 downPB->setEnabled(false);
260 QModelIndexList const selSels =
261 selectedLV->selectionModel()->selectedIndexes();
262 //disable if empty or last item is selected
263 if (selSels.empty() || selSels.first().row() == srows - 1) {
264 downPB->setEnabled(false);
267 //determine whether immediately succeding element requires this one
268 QString const curModName =
269 selectedLV->selectionModel()->currentIndex().data().toString();
270 QStringList const & qsl = selectedModel->stringList();
271 int const curIdx = qsl.indexOf(curModName);
272 if (curIdx < 0 || curIdx == srows - 1) { //this shouldn't happen...
273 downPB->setEnabled(false);
276 string nextModName = fromqstr(qsl[curIdx + 1]);
278 vector<string> reqs = getRequiredList(nextModName);
280 //if it doesn't require anything....
282 downPB->setEnabled(true);
286 //FIXME This should perhaps be more flexible and check whether, even
287 //if this one is required, there is also an earlier one that is required.
288 //enable it if this module isn't required
290 find(reqs.begin(), reqs.end(), fromqstr(curModName)) == reqs.end());
293 void ModuleSelMan::updateUpPB()
295 int const srows = selectedModel->stringList().size();
297 upPB->setEnabled(false);
300 QModelIndexList const selSels =
301 selectedLV->selectionModel()->selectedIndexes();
302 //disable if empty or first item is selected
303 if (selSels.empty() || selSels.first().row() == 0) {
304 upPB->setEnabled(false);
307 //determine whether immediately preceding element is required by this one
308 QString const curModName =
309 selectedLV->selectionModel()->currentIndex().data().toString();
310 vector<string> reqs = getRequiredList(fromqstr(curModName));
312 //if this one doesn't require anything....
314 upPB->setEnabled(true);
318 QStringList const & qsl = selectedModel->stringList();
319 int const curIdx = qsl.indexOf(curModName);
320 if (curIdx <= 0) { //this shouldn't happen...
321 upPB->setEnabled(false);
324 string preModName = fromqstr(qsl[curIdx - 1]);
326 //NOTE This is less flexible than it might be. You could check whether, even
327 //if this one is required, there is also an earlier one that is required.
328 //enable it if the preceding module isn't required
329 upPB->setEnabled(find(reqs.begin(), reqs.end(), preModName) == reqs.end());
332 void ModuleSelMan::updateDelPB()
334 int const srows = selectedModel->stringList().size();
336 deletePB->setEnabled(false);
339 QModelIndexList const selSels =
340 selectedLV->selectionModel()->selectedIndexes();
341 if (selSels.empty() || selSels.first().row() < 0) {
342 deletePB->setEnabled(false);
346 //determine whether some LATER module requires this one
347 //NOTE Things are arranged so that this is the only way there
348 //can be a problem. At least, we hope so.
349 QString const curModName =
350 selectedLV->selectionModel()->currentIndex().data().toString();
351 QStringList const & qsl = selectedModel->stringList();
353 //We're looking here for a reason NOT to enable the button. If we
354 //find one, we disable it and return. If we don't, we'll end up at
355 //the end of the function, and then we enable it.
356 QStringList::const_iterator it = qsl.begin();
357 QStringList::const_iterator end = qsl.end();
359 for (; it != end; ++it) {
360 //skip over the ones preceding this one
362 if (*it == curModName) {
368 string const mod = fromqstr(*it);
369 vector<string> reqs = getRequiredList(mod);
370 //does this one require us?
371 if (find(reqs.begin(), reqs.end(), fromqstr(curModName)) == reqs.end())
375 //OK, so there is a module that requires us
376 //is there an EARLIER module that satisfies the require?
377 //NOTE We demand that it be earlier to keep the list of modules
378 //consistent with the rule that a module must be proceeded by a
379 //required module. There would be more flexible ways to proceed,
380 //but that would be a lot more complicated, and the logic here is
381 //already complicated. (That's why I've left the debugging code.)
382 //lyxerr << "Testing " << mod << std::endl;
383 QStringList::const_iterator it2 = qsl.begin();
384 QStringList::const_iterator end2 = qsl.end();
385 for (; it2 != end2; ++it2) {
386 //lyxerr << "In loop: Testing " << fromqstr(*it2) << std::endl;
387 if (*it2 == curModName) { //EARLIER!!
388 //no other module was found before this one, so...
389 //lyxerr << "Reached the end of the loop." << std::endl;
390 deletePB->setEnabled(false);
393 //do we satisfy the require?
394 if (find(reqs.begin(), reqs.end(), fromqstr(*it2)) != reqs.end()) {
395 //lyxerr << fromqstr(*it2) << " does the trick." << std::endl;
399 //did we reach the end of the list?
401 //lyxerr << "Reached end of list." << std::endl;
402 deletePB->setEnabled(false);
406 //lyxerr << "All's well that ends well." << std::endl;
407 deletePB->setEnabled(true);
411 /////////////////////////////////////////////////////////////////////
415 /////////////////////////////////////////////////////////////////////
417 PreambleModule::PreambleModule(): current_id_(0)
419 // This is not a memory leak. The object will be destroyed
421 (void) new LaTeXHighlighter(preambleTE->document());
422 setFocusProxy(preambleTE);
423 connect(preambleTE, SIGNAL(textChanged()), this, SIGNAL(changed()));
427 void PreambleModule::update(BufferParams const & params, BufferId id)
429 QString preamble = toqstr(params.preamble);
430 // Nothing to do if the params and preamble are unchanged.
431 if (id == current_id_
432 && preamble == preambleTE->document()->toPlainText())
435 QTextCursor cur = preambleTE->textCursor();
436 // Save the coords before switching to the new one.
437 preamble_coords_[current_id_] =
438 make_pair(cur.position(), preambleTE->verticalScrollBar()->value());
440 // Save the params address for further use.
442 preambleTE->document()->setPlainText(preamble);
443 Coords::const_iterator it = preamble_coords_.find(current_id_);
444 if (it == preamble_coords_.end())
445 // First time we open this one.
446 preamble_coords_[current_id_] = make_pair(0,0);
448 // Restore saved coords.
449 QTextCursor cur = preambleTE->textCursor();
450 cur.setPosition(it->second.first);
451 preambleTE->setTextCursor(cur);
452 preambleTE->verticalScrollBar()->setValue(it->second.second);
457 void PreambleModule::apply(BufferParams & params)
459 params.preamble = fromqstr(preambleTE->document()->toPlainText());
463 void PreambleModule::closeEvent(QCloseEvent * e)
465 // Save the coords before closing.
466 QTextCursor cur = preambleTE->textCursor();
467 preamble_coords_[current_id_] =
468 make_pair(cur.position(), preambleTE->verticalScrollBar()->value());
473 /////////////////////////////////////////////////////////////////////
477 /////////////////////////////////////////////////////////////////////
481 GuiDocument::GuiDocument(GuiView & lv)
482 : GuiDialog(lv, "document")
485 setViewTitle(_("Document Settings"));
487 lang_ = getSecond(getLanguageData(false));
489 connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK()));
490 connect(applyPB, SIGNAL(clicked()), this, SLOT(slotApply()));
491 connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose()));
492 connect(restorePB, SIGNAL(clicked()), this, SLOT(slotRestore()));
494 connect(savePB, SIGNAL(clicked()), this, SLOT(saveDefaultClicked()));
495 connect(defaultPB, SIGNAL(clicked()), this, SLOT(useDefaultsClicked()));
497 // Manage the restore, ok, apply, restore and cancel/close buttons
498 bc().setPolicy(ButtonPolicy::NoRepeatedApplyReadOnlyPolicy);
500 bc().setApply(applyPB);
501 bc().setCancel(closePB);
502 bc().setRestore(restorePB);
504 textLayoutModule = new UiWidget<Ui::TextLayoutUi>;
506 connect(textLayoutModule->lspacingCO, SIGNAL(activated(int)),
507 this, SLOT(change_adaptor()));
508 connect(textLayoutModule->lspacingCO, SIGNAL(activated(int)),
509 this, SLOT(setLSpacing(int)));
510 connect(textLayoutModule->lspacingLE, SIGNAL(textChanged(const QString&)),
511 this, SLOT(change_adaptor()));
512 connect(textLayoutModule->skipRB, SIGNAL(clicked()),
513 this, SLOT(change_adaptor()));
514 connect(textLayoutModule->indentRB, SIGNAL(clicked()),
515 this, SLOT(change_adaptor()));
516 connect(textLayoutModule->skipCO, SIGNAL(activated(int)),
517 this, SLOT(change_adaptor()));
518 connect(textLayoutModule->skipLE, SIGNAL(textChanged(const QString &)),
519 this, SLOT(change_adaptor()));
520 connect(textLayoutModule->skipLengthCO, SIGNAL(activated(int)),
521 this, SLOT(change_adaptor()));
522 connect(textLayoutModule->skipCO, SIGNAL(activated(int)),
523 this, SLOT(setSkip(int)));
524 connect(textLayoutModule->skipRB, SIGNAL(toggled(bool)),
525 this, SLOT(enableSkip(bool)));
526 connect(textLayoutModule->twoColumnCB, SIGNAL(clicked()),
527 this, SLOT(change_adaptor()));
528 connect(textLayoutModule->listingsED, SIGNAL(textChanged()),
529 this, SLOT(change_adaptor()));
530 connect(textLayoutModule->bypassCB, SIGNAL(clicked()),
531 this, SLOT(change_adaptor()));
532 connect(textLayoutModule->bypassCB, SIGNAL(clicked()),
533 this, SLOT(set_listings_msg()));
534 connect(textLayoutModule->listingsED, SIGNAL(textChanged()),
535 this, SLOT(set_listings_msg()));
536 textLayoutModule->listingsTB->setPlainText(
537 qt_("Input listings parameters on the right. Enter ? for a list of parameters."));
538 textLayoutModule->lspacingLE->setValidator(new QDoubleValidator(
539 textLayoutModule->lspacingLE));
540 textLayoutModule->skipLE->setValidator(unsignedLengthValidator(
541 textLayoutModule->skipLE));
543 textLayoutModule->skipCO->addItem(qt_("SmallSkip"));
544 textLayoutModule->skipCO->addItem(qt_("MedSkip"));
545 textLayoutModule->skipCO->addItem(qt_("BigSkip"));
546 textLayoutModule->skipCO->addItem(qt_("Length"));
547 // remove the %-items from the unit choice
548 textLayoutModule->skipLengthCO->noPercents();
549 textLayoutModule->lspacingCO->insertItem(
550 Spacing::Single, qt_("Single"));
551 textLayoutModule->lspacingCO->insertItem(
552 Spacing::Onehalf, qt_("OneHalf"));
553 textLayoutModule->lspacingCO->insertItem(
554 Spacing::Double, qt_("Double"));
555 textLayoutModule->lspacingCO->insertItem(
556 Spacing::Other, qt_("Custom"));
558 // initialize the length validator
559 bc().addCheckedLineEdit(textLayoutModule->skipLE);
561 fontModule = new UiWidget<Ui::FontUi>;
563 connect(fontModule->fontsRomanCO, SIGNAL(activated(int)),
564 this, SLOT(change_adaptor()));
565 connect(fontModule->fontsRomanCO, SIGNAL(activated(int)),
566 this, SLOT(romanChanged(int)));
567 connect(fontModule->fontsSansCO, SIGNAL(activated(int)),
568 this, SLOT(change_adaptor()));
569 connect(fontModule->fontsSansCO, SIGNAL(activated(int)),
570 this, SLOT(sansChanged(int)));
571 connect(fontModule->fontsTypewriterCO, SIGNAL(activated(int)),
572 this, SLOT(change_adaptor()));
573 connect(fontModule->fontsTypewriterCO, SIGNAL(activated(int)),
574 this, SLOT(ttChanged(int)));
575 connect(fontModule->fontsDefaultCO, SIGNAL(activated(int)),
576 this, SLOT(change_adaptor()));
577 connect(fontModule->fontsizeCO, SIGNAL(activated(int)),
578 this, SLOT(change_adaptor()));
579 connect(fontModule->scaleSansSB, SIGNAL(valueChanged(int)),
580 this, SLOT(change_adaptor()));
581 connect(fontModule->scaleTypewriterSB, SIGNAL(valueChanged(int)),
582 this, SLOT(change_adaptor()));
583 connect(fontModule->fontScCB, SIGNAL(clicked()),
584 this, SLOT(change_adaptor()));
585 connect(fontModule->fontOsfCB, SIGNAL(clicked()),
586 this, SLOT(change_adaptor()));
588 for (int n = 0; tex_fonts_roman[n][0]; ++n) {
589 QString font = qt_(tex_fonts_roman_gui[n]);
590 if (!isFontAvailable(tex_fonts_roman[n]))
591 font += qt_(" (not installed)");
592 fontModule->fontsRomanCO->addItem(font);
594 for (int n = 0; tex_fonts_sans[n][0]; ++n) {
595 QString font = qt_(tex_fonts_sans_gui[n]);
596 if (!isFontAvailable(tex_fonts_sans[n]))
597 font += qt_(" (not installed)");
598 fontModule->fontsSansCO->addItem(font);
600 for (int n = 0; tex_fonts_monospaced[n][0]; ++n) {
601 QString font = qt_(tex_fonts_monospaced_gui[n]);
602 if (!isFontAvailable(tex_fonts_monospaced[n]))
603 font += qt_(" (not installed)");
604 fontModule->fontsTypewriterCO->addItem(font);
607 fontModule->fontsizeCO->addItem(qt_("Default"));
608 fontModule->fontsizeCO->addItem(qt_("10"));
609 fontModule->fontsizeCO->addItem(qt_("11"));
610 fontModule->fontsizeCO->addItem(qt_("12"));
612 for (int n = 0; GuiDocument::fontfamilies_gui[n][0]; ++n)
613 fontModule->fontsDefaultCO->addItem(
614 qt_(GuiDocument::fontfamilies_gui[n]));
617 pageLayoutModule = new UiWidget<Ui::PageLayoutUi>;
619 connect(pageLayoutModule->papersizeCO, SIGNAL(activated(int)),
620 this, SLOT(setCustomPapersize(int)));
621 connect(pageLayoutModule->papersizeCO, SIGNAL(activated(int)),
622 this, SLOT(setCustomPapersize(int)));
623 connect(pageLayoutModule->portraitRB, SIGNAL(clicked()),
624 this, SLOT(portraitChanged()));
625 connect(pageLayoutModule->papersizeCO, SIGNAL(activated(int)),
626 this, SLOT(change_adaptor()));
627 connect(pageLayoutModule->paperheightLE, SIGNAL(textChanged(const QString &)),
628 this, SLOT(change_adaptor()));
629 connect(pageLayoutModule->paperwidthLE, SIGNAL(textChanged(const QString &)),
630 this, SLOT(change_adaptor()));
631 connect(pageLayoutModule->paperwidthUnitCO, SIGNAL(activated(int)),
632 this, SLOT(change_adaptor()));
633 connect(pageLayoutModule->paperheightUnitCO, SIGNAL(activated(int)),
634 this, SLOT(change_adaptor()));
635 connect(pageLayoutModule->portraitRB, SIGNAL(clicked()),
636 this, SLOT(change_adaptor()));
637 connect(pageLayoutModule->landscapeRB, SIGNAL(clicked()),
638 this, SLOT(change_adaptor()));
639 connect(pageLayoutModule->facingPagesCB, SIGNAL(clicked()),
640 this, SLOT(change_adaptor()));
641 connect(pageLayoutModule->pagestyleCO, SIGNAL(activated(int)),
642 this, SLOT(change_adaptor()));
644 pageLayoutModule->pagestyleCO->addItem(qt_("Default"));
645 pageLayoutModule->pagestyleCO->addItem(qt_("empty"));
646 pageLayoutModule->pagestyleCO->addItem(qt_("plain"));
647 pageLayoutModule->pagestyleCO->addItem(qt_("headings"));
648 pageLayoutModule->pagestyleCO->addItem(qt_("fancy"));
649 bc().addCheckedLineEdit(pageLayoutModule->paperheightLE,
650 pageLayoutModule->paperheightL);
651 bc().addCheckedLineEdit(pageLayoutModule->paperwidthLE,
652 pageLayoutModule->paperwidthL);
655 QComboBox * cb = pageLayoutModule->papersizeCO;
656 cb->addItem(qt_("Default"));
657 cb->addItem(qt_("Custom"));
658 cb->addItem(qt_("US letter"));
659 cb->addItem(qt_("US legal"));
660 cb->addItem(qt_("US executive"));
661 cb->addItem(qt_("A3"));
662 cb->addItem(qt_("A4"));
663 cb->addItem(qt_("A5"));
664 cb->addItem(qt_("B3"));
665 cb->addItem(qt_("B4"));
666 cb->addItem(qt_("B5"));
667 // remove the %-items from the unit choice
668 pageLayoutModule->paperwidthUnitCO->noPercents();
669 pageLayoutModule->paperheightUnitCO->noPercents();
670 pageLayoutModule->paperheightLE->setValidator(unsignedLengthValidator(
671 pageLayoutModule->paperheightLE));
672 pageLayoutModule->paperwidthLE->setValidator(unsignedLengthValidator(
673 pageLayoutModule->paperwidthLE));
676 marginsModule = new UiWidget<Ui::MarginsUi>;
678 connect(marginsModule->marginCB, SIGNAL(toggled(bool)),
679 this, SLOT(setCustomMargins(bool)));
680 connect(marginsModule->marginCB, SIGNAL(clicked()),
681 this, SLOT(change_adaptor()));
682 connect(marginsModule->topLE, SIGNAL(textChanged(const QString &)),
683 this, SLOT(change_adaptor()));
684 connect(marginsModule->topUnit, SIGNAL(activated(int)),
685 this, SLOT(change_adaptor()));
686 connect(marginsModule->bottomLE, SIGNAL(textChanged(const QString &)),
687 this, SLOT(change_adaptor()));
688 connect(marginsModule->bottomUnit, SIGNAL(activated(int)),
689 this, SLOT(change_adaptor()));
690 connect(marginsModule->innerLE, SIGNAL(textChanged(const QString &)),
691 this, SLOT(change_adaptor()));
692 connect(marginsModule->innerUnit, SIGNAL(activated(int)),
693 this, SLOT(change_adaptor()));
694 connect(marginsModule->outerLE, SIGNAL(textChanged(const QString &)),
695 this, SLOT(change_adaptor()));
696 connect(marginsModule->outerUnit, SIGNAL(activated(int)),
697 this, SLOT(change_adaptor()));
698 connect(marginsModule->headheightLE, SIGNAL(textChanged(const QString &)),
699 this, SLOT(change_adaptor()));
700 connect(marginsModule->headheightUnit, SIGNAL(activated(int)),
701 this, SLOT(change_adaptor()));
702 connect(marginsModule->headsepLE, SIGNAL(textChanged(const QString &)),
703 this, SLOT(change_adaptor()));
704 connect(marginsModule->headsepUnit, SIGNAL(activated(int)),
705 this, SLOT(change_adaptor()));
706 connect(marginsModule->footskipLE, SIGNAL(textChanged(const QString&)),
707 this, SLOT(change_adaptor()));
708 connect(marginsModule->footskipUnit, SIGNAL(activated(int)),
709 this, SLOT(change_adaptor()));
710 marginsModule->topLE->setValidator(unsignedLengthValidator(
711 marginsModule->topLE));
712 marginsModule->bottomLE->setValidator(unsignedLengthValidator(
713 marginsModule->bottomLE));
714 marginsModule->innerLE->setValidator(unsignedLengthValidator(
715 marginsModule->innerLE));
716 marginsModule->outerLE->setValidator(unsignedLengthValidator(
717 marginsModule->outerLE));
718 marginsModule->headsepLE->setValidator(unsignedLengthValidator(
719 marginsModule->headsepLE));
720 marginsModule->headheightLE->setValidator(unsignedLengthValidator(
721 marginsModule->headheightLE));
722 marginsModule->footskipLE->setValidator(unsignedLengthValidator(
723 marginsModule->footskipLE));
725 bc().addCheckedLineEdit(marginsModule->topLE,
726 marginsModule->topL);
727 bc().addCheckedLineEdit(marginsModule->bottomLE,
728 marginsModule->bottomL);
729 bc().addCheckedLineEdit(marginsModule->innerLE,
730 marginsModule->innerL);
731 bc().addCheckedLineEdit(marginsModule->outerLE,
732 marginsModule->outerL);
733 bc().addCheckedLineEdit(marginsModule->headsepLE,
734 marginsModule->headsepL);
735 bc().addCheckedLineEdit(marginsModule->headheightLE,
736 marginsModule->headheightL);
737 bc().addCheckedLineEdit(marginsModule->footskipLE,
738 marginsModule->footskipL);
741 langModule = new UiWidget<Ui::LanguageUi>;
743 connect(langModule->languageCO, SIGNAL(activated(int)),
744 this, SLOT(change_adaptor()));
745 connect(langModule->defaultencodingRB, SIGNAL(clicked()),
746 this, SLOT(change_adaptor()));
747 connect(langModule->otherencodingRB, SIGNAL(clicked()),
748 this, SLOT(change_adaptor()));
749 connect(langModule->encodingCO, SIGNAL(activated(int)),
750 this, SLOT(change_adaptor()));
751 connect(langModule->quoteStyleCO, SIGNAL(activated(int)),
752 this, SLOT(change_adaptor()));
754 vector<LanguagePair> const langs = getLanguageData(false);
755 vector<LanguagePair>::const_iterator lit = langs.begin();
756 vector<LanguagePair>::const_iterator lend = langs.end();
757 for (; lit != lend; ++lit) {
758 langModule->languageCO->addItem(toqstr(lit->first));
761 // Always put the default encoding in the first position.
762 // It is special because the displayed text is translated.
763 langModule->encodingCO->addItem(qt_("LaTeX default"));
764 Encodings::const_iterator it = encodings.begin();
765 Encodings::const_iterator const end = encodings.end();
766 for (; it != end; ++it)
767 langModule->encodingCO->addItem(toqstr(it->latexName()));
769 langModule->quoteStyleCO->addItem(qt_("``text''"));
770 langModule->quoteStyleCO->addItem(qt_("''text''"));
771 langModule->quoteStyleCO->addItem(qt_(",,text``"));
772 langModule->quoteStyleCO->addItem(qt_(",,text''"));
773 langModule->quoteStyleCO->addItem(qt_("<<text>>"));
774 langModule->quoteStyleCO->addItem(qt_(">>text<<"));
778 numberingModule = new UiWidget<Ui::NumberingUi>;
780 connect(numberingModule->depthSL, SIGNAL(valueChanged(int)),
781 this, SLOT(change_adaptor()));
782 connect(numberingModule->tocSL, SIGNAL(valueChanged(int)),
783 this, SLOT(change_adaptor()));
784 connect(numberingModule->depthSL, SIGNAL(valueChanged(int)),
785 this, SLOT(updateNumbering()));
786 connect(numberingModule->tocSL, SIGNAL(valueChanged(int)),
787 this, SLOT(updateNumbering()));
788 numberingModule->tocTW->setColumnCount(3);
789 numberingModule->tocTW->headerItem()->setText(0, qt_("Example"));
790 numberingModule->tocTW->headerItem()->setText(1, qt_("Numbered"));
791 numberingModule->tocTW->headerItem()->setText(2, qt_("Appears in TOC"));
794 biblioModule = new UiWidget<Ui::BiblioUi>;
795 connect(biblioModule->citeNatbibRB, SIGNAL(toggled(bool)),
796 biblioModule->citationStyleL, SLOT(setEnabled(bool)));
797 connect(biblioModule->citeNatbibRB, SIGNAL(toggled(bool)),
798 biblioModule->citeStyleCO, SLOT(setEnabled(bool)));
800 connect(biblioModule->citeDefaultRB, SIGNAL(clicked()),
801 this, SLOT(change_adaptor()));
802 connect(biblioModule->citeNatbibRB, SIGNAL(clicked()),
803 this, SLOT(change_adaptor()));
804 connect(biblioModule->citeStyleCO, SIGNAL(activated(int)),
805 this, SLOT(change_adaptor()));
806 connect(biblioModule->citeJurabibRB, SIGNAL(clicked()),
807 this, SLOT(change_adaptor()));
808 connect(biblioModule->bibtopicCB, SIGNAL(clicked()),
809 this, SLOT(change_adaptor()));
811 biblioModule->citeStyleCO->addItem(qt_("Author-year"));
812 biblioModule->citeStyleCO->addItem(qt_("Numerical"));
813 biblioModule->citeStyleCO->setCurrentIndex(0);
816 mathsModule = new UiWidget<Ui::MathsUi>;
817 connect(mathsModule->amsautoCB, SIGNAL(toggled(bool)),
818 mathsModule->amsCB, SLOT(setDisabled(bool)));
819 connect(mathsModule->esintautoCB, SIGNAL(toggled(bool)),
820 mathsModule->esintCB, SLOT(setDisabled(bool)));
822 connect(mathsModule->amsCB, SIGNAL(clicked()),
823 this, SLOT(change_adaptor()));
824 connect(mathsModule->amsautoCB, SIGNAL(clicked()),
825 this, SLOT(change_adaptor()));
826 connect(mathsModule->esintCB, SIGNAL(clicked()),
827 this, SLOT(change_adaptor()));
828 connect(mathsModule->esintautoCB, SIGNAL(clicked()),
829 this, SLOT(change_adaptor()));
831 latexModule = new UiWidget<Ui::LaTeXUi>;
833 connect(latexModule->classCO, SIGNAL(activated(int)),
834 this, SLOT(change_adaptor()));
835 connect(latexModule->optionsLE, SIGNAL(textChanged(const QString &)),
836 this, SLOT(change_adaptor()));
837 connect(latexModule->psdriverCO, SIGNAL(activated(int)),
838 this, SLOT(change_adaptor()));
839 connect(latexModule->classCO, SIGNAL(activated(int)),
840 this, SLOT(classChanged()));
843 new ModuleSelMan(latexModule->availableLV, latexModule->selectedLV,
844 latexModule->addPB, latexModule->deletePB,
845 latexModule->upPB, latexModule->downPB,
846 availableModel(), selectedModel());
847 connect(selectionManager, SIGNAL(updateHook()),
848 this, SLOT(updateModuleInfo()));
849 connect(selectionManager, SIGNAL(updateHook()),
850 this, SLOT(change_adaptor()));
852 // postscript drivers
853 for (int n = 0; tex_graphics[n][0]; ++n) {
854 QString enc = qt_(tex_graphics_gui[n]);
855 latexModule->psdriverCO->addItem(enc);
858 //FIXME This seems too involved with the kernel. Some of this
859 //should be moved to the kernel---which should perhaps just
860 //give us a list of entries or something of the sort.
861 for (TextClassList::const_iterator cit = textclasslist.begin();
862 cit != textclasslist.end(); ++cit) {
863 if (cit->isTeXClassAvailable()) {
864 latexModule->classCO->addItem(toqstr(cit->description()));
867 bformat(_("Unavailable: %1$s"), from_utf8(cit->description()));
868 latexModule->classCO->addItem(toqstr(item));
873 branchesModule = new GuiBranches;
874 connect(branchesModule, SIGNAL(changed()),
875 this, SLOT(change_adaptor()));
878 preambleModule = new PreambleModule;
879 connect(preambleModule, SIGNAL(changed()),
880 this, SLOT(change_adaptor()));
883 bulletsModule = new BulletsModule;
884 connect(bulletsModule, SIGNAL(changed()),
885 this, SLOT(change_adaptor()));
888 embeddedFilesModule = new UiWidget<Ui::EmbeddedFilesUi>;
889 connect(embeddedFilesModule->bundleCB, SIGNAL(toggled(bool)),
890 this, SLOT(change_adaptor()));
891 connect(embeddedFilesModule->addPB, SIGNAL(clicked()),
892 this, SLOT(change_adaptor()));
893 connect(embeddedFilesModule->removePB, SIGNAL(clicked()),
894 this, SLOT(change_adaptor()));
897 pdfSupportModule = new UiWidget<Ui::PDFSupportUi>;
899 connect(pdfSupportModule->use_hyperrefGB, SIGNAL(toggled(bool)),
900 this, SLOT(change_adaptor()));
901 connect(pdfSupportModule->titleLE, SIGNAL(textChanged(const QString &)),
902 this, SLOT(change_adaptor()));
903 connect(pdfSupportModule->authorLE, SIGNAL(textChanged(const QString &)),
904 this, SLOT(change_adaptor()));
905 connect(pdfSupportModule->subjectLE, SIGNAL(textChanged(const QString &)),
906 this, SLOT(change_adaptor()));
907 connect(pdfSupportModule->keywordsLE, SIGNAL(textChanged(const QString &)),
908 this, SLOT(change_adaptor()));
909 connect(pdfSupportModule->bookmarksGB, SIGNAL(toggled(bool)),
910 this, SLOT(change_adaptor()));
911 connect(pdfSupportModule->bookmarksnumberedCB, SIGNAL(toggled(bool)),
912 this, SLOT(change_adaptor()));
913 connect(pdfSupportModule->bookmarksopenGB, SIGNAL(toggled(bool)),
914 this, SLOT(change_adaptor()));
915 connect(pdfSupportModule->bookmarksopenlevelSB, SIGNAL(valueChanged(int)),
916 this, SLOT(change_adaptor()));
917 connect(pdfSupportModule->breaklinksCB, SIGNAL(toggled(bool)),
918 this, SLOT(change_adaptor()));
919 connect(pdfSupportModule->pdfborderCB, SIGNAL(toggled(bool)),
920 this, SLOT(change_adaptor()));
921 connect(pdfSupportModule->colorlinksCB, SIGNAL(toggled(bool)),
922 this, SLOT(change_adaptor()));
923 connect(pdfSupportModule->backrefCB, SIGNAL(toggled(bool)),
924 this, SLOT(change_adaptor()));
925 connect(pdfSupportModule->pdfusetitleCB, SIGNAL(toggled(bool)),
926 this, SLOT(change_adaptor()));
927 connect(pdfSupportModule->pagebackrefCB, SIGNAL(toggled(bool)),
928 this, SLOT(change_adaptor()));
929 connect(pdfSupportModule->fullscreenCB, SIGNAL(toggled(bool)),
930 this, SLOT(change_adaptor()));
931 connect(pdfSupportModule->optionsLE, SIGNAL(textChanged(const QString &)),
932 this, SLOT(change_adaptor()));
935 floatModule = new FloatPlacement;
936 connect(floatModule, SIGNAL(changed()),
937 this, SLOT(change_adaptor()));
939 docPS->addPanel(latexModule, _("Document Class"));
940 docPS->addPanel(fontModule, _("Fonts"));
941 docPS->addPanel(textLayoutModule, _("Text Layout"));
942 docPS->addPanel(pageLayoutModule, _("Page Layout"));
943 docPS->addPanel(marginsModule, _("Page Margins"));
944 docPS->addPanel(langModule, _("Language"));
945 docPS->addPanel(numberingModule, _("Numbering & TOC"));
946 docPS->addPanel(biblioModule, _("Bibliography"));
947 docPS->addPanel(pdfSupportModule, _("PDF Properties"));
948 docPS->addPanel(mathsModule, _("Math Options"));
949 docPS->addPanel(floatModule, _("Float Placement"));
950 docPS->addPanel(bulletsModule, _("Bullets"));
951 docPS->addPanel(branchesModule, _("Branches"));
952 docPS->addPanel(embeddedFilesModule, _("Embedded Files"));
953 docPS->addPanel(preambleModule, _("LaTeX Preamble"));
954 docPS->setCurrentPanel(_("Document Class"));
955 // FIXME: hack to work around resizing bug in Qt >= 4.2
956 // bug verified with Qt 4.2.{0-3} (JSpitzm)
957 #if QT_VERSION >= 0x040200
958 docPS->updateGeometry();
963 void GuiDocument::showPreamble()
965 docPS->setCurrentPanel(_("LaTeX Preamble"));
969 void GuiDocument::saveDefaultClicked()
975 void GuiDocument::useDefaultsClicked()
981 void GuiDocument::change_adaptor()
987 docstring GuiDocument::validate_listings_params()
989 // use a cache here to avoid repeated validation
990 // of the same parameters
991 static string param_cache = string();
992 static docstring msg_cache = docstring();
994 if (textLayoutModule->bypassCB->isChecked())
997 string params = fromqstr(textLayoutModule->listingsED->toPlainText());
998 if (params != param_cache) {
999 param_cache = params;
1000 msg_cache = InsetListingsParams(params).validate();
1006 void GuiDocument::set_listings_msg()
1008 static bool isOK = true;
1009 docstring msg = validate_listings_params();
1014 // listingsTB->setTextColor("black");
1015 textLayoutModule->listingsTB->setPlainText(
1016 qt_("Input listings parameters on the right. Enter ? for a list of parameters."));
1019 // listingsTB->setTextColor("red");
1020 textLayoutModule->listingsTB->setPlainText(toqstr(msg));
1025 void GuiDocument::closeEvent(QCloseEvent * e)
1032 void GuiDocument::setLSpacing(int item)
1034 textLayoutModule->lspacingLE->setEnabled(item == 3);
1038 void GuiDocument::setSkip(int item)
1040 bool const enable = (item == 3);
1041 textLayoutModule->skipLE->setEnabled(enable);
1042 textLayoutModule->skipLengthCO->setEnabled(enable);
1046 void GuiDocument::enableSkip(bool skip)
1048 textLayoutModule->skipCO->setEnabled(skip);
1049 textLayoutModule->skipLE->setEnabled(skip);
1050 textLayoutModule->skipLengthCO->setEnabled(skip);
1052 setSkip(textLayoutModule->skipCO->currentIndex());
1055 void GuiDocument::portraitChanged()
1057 setMargins(pageLayoutModule->papersizeCO->currentIndex());
1060 void GuiDocument::setMargins(bool custom)
1062 marginsModule->marginCB->setChecked(custom);
1063 setCustomMargins(custom);
1067 void GuiDocument::setCustomPapersize(int papersize)
1069 bool const custom = (papersize == 1);
1071 pageLayoutModule->paperwidthL->setEnabled(custom);
1072 pageLayoutModule->paperwidthLE->setEnabled(custom);
1073 pageLayoutModule->paperwidthUnitCO->setEnabled(custom);
1074 pageLayoutModule->paperheightL->setEnabled(custom);
1075 pageLayoutModule->paperheightLE->setEnabled(custom);
1076 pageLayoutModule->paperheightLE->setFocus();
1077 pageLayoutModule->paperheightUnitCO->setEnabled(custom);
1081 void GuiDocument::setCustomMargins(bool custom)
1083 marginsModule->topL->setEnabled(!custom);
1084 marginsModule->topLE->setEnabled(!custom);
1085 marginsModule->topUnit->setEnabled(!custom);
1087 marginsModule->bottomL->setEnabled(!custom);
1088 marginsModule->bottomLE->setEnabled(!custom);
1089 marginsModule->bottomUnit->setEnabled(!custom);
1091 marginsModule->innerL->setEnabled(!custom);
1092 marginsModule->innerLE->setEnabled(!custom);
1093 marginsModule->innerUnit->setEnabled(!custom);
1095 marginsModule->outerL->setEnabled(!custom);
1096 marginsModule->outerLE->setEnabled(!custom);
1097 marginsModule->outerUnit->setEnabled(!custom);
1099 marginsModule->headheightL->setEnabled(!custom);
1100 marginsModule->headheightLE->setEnabled(!custom);
1101 marginsModule->headheightUnit->setEnabled(!custom);
1103 marginsModule->headsepL->setEnabled(!custom);
1104 marginsModule->headsepLE->setEnabled(!custom);
1105 marginsModule->headsepUnit->setEnabled(!custom);
1107 marginsModule->footskipL->setEnabled(!custom);
1108 marginsModule->footskipLE->setEnabled(!custom);
1109 marginsModule->footskipUnit->setEnabled(!custom);
1113 void GuiDocument::updateFontsize(string const & items, string const & sel)
1115 fontModule->fontsizeCO->clear();
1116 fontModule->fontsizeCO->addItem(qt_("Default"));
1118 for (int n = 0; !token(items,'|',n).empty(); ++n)
1119 fontModule->fontsizeCO->
1120 addItem(toqstr(token(items,'|',n)));
1122 for (int n = 0; n < fontModule->fontsizeCO->count(); ++n) {
1123 if (fromqstr(fontModule->fontsizeCO->itemText(n)) == sel) {
1124 fontModule->fontsizeCO->setCurrentIndex(n);
1131 void GuiDocument::romanChanged(int item)
1133 string const font = tex_fonts_roman[item];
1134 fontModule->fontScCB->setEnabled(providesSC(font));
1135 fontModule->fontOsfCB->setEnabled(providesOSF(font));
1139 void GuiDocument::sansChanged(int item)
1141 string const font = tex_fonts_sans[item];
1142 bool scaleable = providesScale(font);
1143 fontModule->scaleSansSB->setEnabled(scaleable);
1144 fontModule->scaleSansLA->setEnabled(scaleable);
1148 void GuiDocument::ttChanged(int item)
1150 string const font = tex_fonts_monospaced[item];
1151 bool scaleable = providesScale(font);
1152 fontModule->scaleTypewriterSB->setEnabled(scaleable);
1153 fontModule->scaleTypewriterLA->setEnabled(scaleable);
1157 void GuiDocument::updatePagestyle(string const & items, string const & sel)
1160 pageLayoutModule->pagestyleCO->clear();
1161 pageLayoutModule->pagestyleCO->addItem(qt_("Default"));
1163 for (int n = 0; !token(items,'|',n).empty(); ++n) {
1164 string style = token(items, '|', n);
1165 docstring style_gui = _(style);
1166 pagestyles.push_back(pair<string, docstring>(style, style_gui));
1167 pageLayoutModule->pagestyleCO->addItem(toqstr(style_gui));
1170 if (sel == "default") {
1171 pageLayoutModule->pagestyleCO->setCurrentIndex(0);
1177 for (size_t i = 0; i < pagestyles.size(); ++i)
1178 if (pagestyles[i].first == sel)
1179 nn = pageLayoutModule->pagestyleCO->findText(
1180 toqstr(pagestyles[i].second));
1183 pageLayoutModule->pagestyleCO->setCurrentIndex(nn);
1187 void GuiDocument::classChanged()
1189 textclass_type const tc = latexModule->classCO->currentIndex();
1190 bp_.setBaseClass(tc);
1191 if (lyxrc.auto_reset_options) {
1192 bp_.useClassDefaults();
1199 //This is an insanely complicated attempt to make this sort of thing
1200 //work with RTL languages.
1201 docstring formatStrVec(vector<string> const & v, docstring const & s)
1203 //this mess formats the list as "v[0], v[1], ..., [s] v[n]"
1204 int const vSize = v.size();
1207 else if (v.size() == 1)
1208 return from_ascii(v[0]);
1209 else if (v.size() == 2) {
1210 docstring retval = _("%1$s and %2$s");
1211 retval = subst(retval, _("and"), s);
1212 return bformat(retval, from_ascii(v[0]), from_ascii(v[1]));
1214 //The idea here is to format all but the last two items...
1215 docstring t2 = _("%1$s, %2$s");
1216 docstring retval = from_ascii(v[0]);
1217 for (int i = 1; i < vSize - 2; ++i)
1218 retval = bformat(t2, retval, from_ascii(v[i]));
1219 //...and then to plug them, and the last two, into this schema
1220 docstring t = _("%1$s, %2$s, and %3$s");
1221 t = subst(t, _("and"), s);
1222 return bformat(t, retval, from_ascii(v[vSize - 2]), from_ascii(v[vSize - 1]));
1227 void GuiDocument::updateModuleInfo()
1229 selectionManager->update();
1230 //Module description
1231 QListView const * const lv = selectionManager->selectedFocused() ?
1232 latexModule->selectedLV :
1233 latexModule->availableLV;
1234 if (lv->selectionModel()->selectedIndexes().isEmpty())
1235 latexModule->infoML->document()->clear();
1237 QModelIndex const & idx = lv->selectionModel()->currentIndex();
1238 string const modName = fromqstr(idx.data().toString());
1239 docstring desc = getModuleDescription(modName);
1241 vector<string> pkgList = getPackageList(modName);
1242 docstring pkgdesc = formatStrVec(pkgList, _("and"));
1243 if (!pkgdesc.empty()) {
1246 desc += bformat(_("Package(s) required: %1$s."), pkgdesc);
1249 pkgList = getRequiredList(modName);
1250 pkgdesc = formatStrVec(pkgList, _("or"));
1251 if (!pkgdesc.empty()) {
1254 desc += bformat(_("Module required: %1$s."), pkgdesc);
1257 pkgList = getExcludedList(modName);
1258 pkgdesc = formatStrVec(pkgList, _( "and"));
1259 if (!pkgdesc.empty()) {
1262 desc += bformat(_("Modules excluded: %1$s."), pkgdesc);
1265 if (!isModuleAvailable(modName)) {
1268 desc += _("WARNING: Some packages are unavailable!");
1270 latexModule->infoML->document()->setPlainText(toqstr(desc));
1275 void GuiDocument::updateEmbeddedFileList()
1277 embeddedFilesModule->filesLW->clear();
1278 // add current embedded files
1279 EmbeddedFileList & files = buffer().embeddedFiles();
1280 files.update(buffer());
1281 EmbeddedFileList::iterator fit = files.begin();
1282 EmbeddedFileList::iterator fit_end = files.end();
1283 for (; fit != fit_end; ++fit) {
1284 QString label = toqstr(fit->relFilename(buffer().filePath()));
1285 if (fit->refCount() > 1)
1286 label += " (" + QString::number(fit->refCount()) + ")";
1287 QListWidgetItem * item = new QListWidgetItem(label);
1288 item->setFlags(item->flags() | Qt::ItemIsSelectable
1289 | Qt::ItemIsUserCheckable);
1291 item->setCheckState(Qt::Checked);
1293 item->setCheckState(Qt::Unchecked);
1294 // index of the currently used ParConstIterator
1295 embeddedFilesModule->filesLW->addItem(item);
1300 void GuiDocument::updateNumbering()
1302 TextClass const & tclass = bp_.getTextClass();
1304 numberingModule->tocTW->setUpdatesEnabled(false);
1305 numberingModule->tocTW->clear();
1307 int const depth = numberingModule->depthSL->value();
1308 int const toc = numberingModule->tocSL->value();
1309 QString const no = qt_("No");
1310 QString const yes = qt_("Yes");
1311 TextClass::const_iterator end = tclass.end();
1312 TextClass::const_iterator cit = tclass.begin();
1313 QTreeWidgetItem * item = 0;
1314 for ( ; cit != end ; ++cit) {
1315 int const toclevel = (*cit)->toclevel;
1316 if (toclevel != Layout::NOT_IN_TOC
1317 && (*cit)->labeltype == LABEL_COUNTER) {
1318 item = new QTreeWidgetItem(numberingModule->tocTW);
1319 item->setText(0, toqstr(translateIfPossible((*cit)->name())));
1320 item->setText(1, (toclevel <= depth) ? yes : no);
1321 item->setText(2, (toclevel <= toc) ? yes : no);
1325 numberingModule->tocTW->setUpdatesEnabled(true);
1326 numberingModule->tocTW->update();
1330 void GuiDocument::apply(BufferParams & params)
1333 preambleModule->apply(params);
1336 params.setCiteEngine(biblio::ENGINE_BASIC);
1338 if (biblioModule->citeNatbibRB->isChecked()) {
1339 bool const use_numerical_citations =
1340 biblioModule->citeStyleCO->currentIndex();
1341 if (use_numerical_citations)
1342 params.setCiteEngine(biblio::ENGINE_NATBIB_NUMERICAL);
1344 params.setCiteEngine(biblio::ENGINE_NATBIB_AUTHORYEAR);
1346 } else if (biblioModule->citeJurabibRB->isChecked())
1347 params.setCiteEngine(biblio::ENGINE_JURABIB);
1349 params.use_bibtopic =
1350 biblioModule->bibtopicCB->isChecked();
1352 // language & quotes
1353 if (langModule->defaultencodingRB->isChecked()) {
1354 params.inputenc = "auto";
1356 int i = langModule->encodingCO->currentIndex();
1358 params.inputenc = "default";
1361 fromqstr(langModule->encodingCO->currentText());
1364 InsetQuotes::quote_language lga = InsetQuotes::EnglishQ;
1365 switch (langModule->quoteStyleCO->currentIndex()) {
1367 lga = InsetQuotes::EnglishQ;
1370 lga = InsetQuotes::SwedishQ;
1373 lga = InsetQuotes::GermanQ;
1376 lga = InsetQuotes::PolishQ;
1379 lga = InsetQuotes::FrenchQ;
1382 lga = InsetQuotes::DanishQ;
1385 params.quotes_language = lga;
1387 int const pos = langModule->languageCO->currentIndex();
1388 params.language = lyx::languages.getLanguage(lang_[pos]);
1391 if (params.getTextClass().hasTocLevels()) {
1392 params.tocdepth = numberingModule->tocSL->value();
1393 params.secnumdepth = numberingModule->depthSL->value();
1397 params.user_defined_bullet(0) = bulletsModule->getBullet(0);
1398 params.user_defined_bullet(1) = bulletsModule->getBullet(1);
1399 params.user_defined_bullet(2) = bulletsModule->getBullet(2);
1400 params.user_defined_bullet(3) = bulletsModule->getBullet(3);
1403 params.graphicsDriver =
1404 tex_graphics[latexModule->psdriverCO->currentIndex()];
1407 params.setBaseClass(latexModule->classCO->currentIndex());
1410 params.clearLayoutModules();
1411 QStringList const selMods = selectedModel()->stringList();
1412 for (int i = 0; i != selMods.size(); ++i)
1413 params.addLayoutModule(lyx::fromqstr(selMods[i]));
1415 if (mathsModule->amsautoCB->isChecked()) {
1416 params.use_amsmath = BufferParams::package_auto;
1418 if (mathsModule->amsCB->isChecked())
1419 params.use_amsmath = BufferParams::package_on;
1421 params.use_amsmath = BufferParams::package_off;
1424 if (mathsModule->esintautoCB->isChecked())
1425 params.use_esint = BufferParams::package_auto;
1427 if (mathsModule->esintCB->isChecked())
1428 params.use_esint = BufferParams::package_on;
1430 params.use_esint = BufferParams::package_off;
1433 if (pageLayoutModule->pagestyleCO->currentIndex() == 0)
1434 params.pagestyle = "default";
1436 docstring style_gui =
1437 qstring_to_ucs4(pageLayoutModule->pagestyleCO->currentText());
1438 for (size_t i = 0; i < pagestyles.size(); ++i)
1439 if (pagestyles[i].second == style_gui)
1440 params.pagestyle = pagestyles[i].first;
1443 switch (textLayoutModule->lspacingCO->currentIndex()) {
1445 params.spacing().set(Spacing::Single);
1448 params.spacing().set(Spacing::Onehalf);
1451 params.spacing().set(Spacing::Double);
1454 params.spacing().set(Spacing::Other,
1455 fromqstr(textLayoutModule->lspacingLE->text()));
1459 if (textLayoutModule->twoColumnCB->isChecked())
1464 // text should have passed validation
1465 params.listings_params =
1466 InsetListingsParams(fromqstr(textLayoutModule->listingsED->toPlainText())).params();
1468 if (textLayoutModule->indentRB->isChecked())
1469 params.paragraph_separation = BufferParams::PARSEP_INDENT;
1471 params.paragraph_separation = BufferParams::PARSEP_SKIP;
1473 switch (textLayoutModule->skipCO->currentIndex()) {
1475 params.setDefSkip(VSpace(VSpace::SMALLSKIP));
1478 params.setDefSkip(VSpace(VSpace::MEDSKIP));
1481 params.setDefSkip(VSpace(VSpace::BIGSKIP));
1486 widgetsToLength(textLayoutModule->skipLE,
1487 textLayoutModule->skipLengthCO)
1489 params.setDefSkip(vs);
1493 // DocumentDefskipCB assures that this never happens
1494 // so Assert then !!! - jbl
1495 params.setDefSkip(VSpace(VSpace::MEDSKIP));
1500 fromqstr(latexModule->optionsLE->text());
1502 params.float_placement = floatModule->get();
1506 tex_fonts_roman[fontModule->fontsRomanCO->currentIndex()];
1509 tex_fonts_sans[fontModule->fontsSansCO->currentIndex()];
1511 params.fontsTypewriter =
1512 tex_fonts_monospaced[fontModule->fontsTypewriterCO->currentIndex()];
1514 params.fontsSansScale = fontModule->scaleSansSB->value();
1516 params.fontsTypewriterScale = fontModule->scaleTypewriterSB->value();
1518 params.fontsSC = fontModule->fontScCB->isChecked();
1520 params.fontsOSF = fontModule->fontOsfCB->isChecked();
1522 params.fontsDefaultFamily = GuiDocument::fontfamilies[
1523 fontModule->fontsDefaultCO->currentIndex()];
1525 if (fontModule->fontsizeCO->currentIndex() == 0)
1526 params.fontsize = "default";
1529 fromqstr(fontModule->fontsizeCO->currentText());
1532 params.papersize = PAPER_SIZE(
1533 pageLayoutModule->papersizeCO->currentIndex());
1535 // custom, A3, B3 and B4 paper sizes need geometry
1536 int psize = pageLayoutModule->papersizeCO->currentIndex();
1537 bool geom_papersize = (psize == 1 || psize == 5 || psize == 8 || psize == 9);
1539 params.paperwidth = widgetsToLength(pageLayoutModule->paperwidthLE,
1540 pageLayoutModule->paperwidthUnitCO);
1542 params.paperheight = widgetsToLength(pageLayoutModule->paperheightLE,
1543 pageLayoutModule->paperheightUnitCO);
1545 if (pageLayoutModule->facingPagesCB->isChecked())
1546 params.sides = TwoSides;
1548 params.sides = OneSide;
1550 if (pageLayoutModule->landscapeRB->isChecked())
1551 params.orientation = ORIENTATION_LANDSCAPE;
1553 params.orientation = ORIENTATION_PORTRAIT;
1556 params.use_geometry =
1557 (!marginsModule->marginCB->isChecked()
1560 Ui::MarginsUi const * m(marginsModule);
1562 params.leftmargin = widgetsToLength(m->innerLE, m->innerUnit);
1563 params.topmargin = widgetsToLength(m->topLE, m->topUnit);
1564 params.rightmargin = widgetsToLength(m->outerLE, m->outerUnit);
1565 params.bottommargin = widgetsToLength(m->bottomLE, m->bottomUnit);
1566 params.headheight = widgetsToLength(m->headheightLE, m->headheightUnit);
1567 params.headsep = widgetsToLength(m->headsepLE, m->headsepUnit);
1568 params.footskip = widgetsToLength(m->footskipLE, m->footskipUnit);
1570 branchesModule->apply(params);
1573 PDFOptions & pdf = params.pdfoptions();
1574 pdf.use_hyperref = pdfSupportModule->use_hyperrefGB->isChecked();
1575 pdf.title = fromqstr(pdfSupportModule->titleLE->text());
1576 pdf.author = fromqstr(pdfSupportModule->authorLE->text());
1577 pdf.subject = fromqstr(pdfSupportModule->subjectLE->text());
1578 pdf.keywords = fromqstr(pdfSupportModule->keywordsLE->text());
1580 pdf.bookmarks = pdfSupportModule->bookmarksGB->isChecked();
1581 pdf.bookmarksnumbered = pdfSupportModule->bookmarksnumberedCB->isChecked();
1582 pdf.bookmarksopen = pdfSupportModule->bookmarksopenGB->isChecked();
1583 pdf.bookmarksopenlevel = pdfSupportModule->bookmarksopenlevelSB->value();
1585 pdf.breaklinks = pdfSupportModule->breaklinksCB->isChecked();
1586 pdf.pdfborder = pdfSupportModule->pdfborderCB->isChecked();
1587 pdf.pdfusetitle = pdfSupportModule->pdfusetitleCB->isChecked();
1588 pdf.colorlinks = pdfSupportModule->colorlinksCB->isChecked();
1589 pdf.backref = pdfSupportModule->backrefCB->isChecked();
1590 pdf.pagebackref = pdfSupportModule->pagebackrefCB->isChecked();
1591 if (pdfSupportModule->fullscreenCB->isChecked())
1592 pdf.pagemode = pdf.pagemode_fullscreen;
1594 pdf.pagemode.clear();
1595 pdf.quoted_options = fromqstr(pdfSupportModule->optionsLE->text());
1602 /** Return the position of val in the vector if found.
1603 If not found, return 0.
1606 static size_t findPos(vector<A> const & vec, A const & val)
1608 typename vector<A>::const_iterator it =
1609 find(vec.begin(), vec.end(), val);
1610 if (it == vec.end())
1612 return distance(vec.begin(), it);
1616 void GuiDocument::updateParams()
1622 void GuiDocument::updateParams(BufferParams const & params)
1624 // set the default unit
1625 Length::UNIT defaultUnit = Length::CM;
1626 switch (lyxrc.default_papersize) {
1627 case PAPER_DEFAULT: break;
1629 case PAPER_USLETTER:
1631 case PAPER_USEXECUTIVE:
1632 defaultUnit = Length::IN;
1641 defaultUnit = Length::CM;
1648 preambleModule->update(params, id());
1651 biblioModule->citeDefaultRB->setChecked(
1652 params.getEngine() == biblio::ENGINE_BASIC);
1654 biblioModule->citeNatbibRB->setChecked(
1655 params.getEngine() == biblio::ENGINE_NATBIB_NUMERICAL ||
1656 params.getEngine() == biblio::ENGINE_NATBIB_AUTHORYEAR);
1658 biblioModule->citeStyleCO->setCurrentIndex(
1659 params.getEngine() == biblio::ENGINE_NATBIB_NUMERICAL);
1661 biblioModule->citeJurabibRB->setChecked(
1662 params.getEngine() == biblio::ENGINE_JURABIB);
1664 biblioModule->bibtopicCB->setChecked(
1665 params.use_bibtopic);
1667 // language & quotes
1668 int const pos = int(findPos(lang_,
1669 params.language->lang()));
1670 langModule->languageCO->setCurrentIndex(pos);
1672 langModule->quoteStyleCO->setCurrentIndex(
1673 params.quotes_language);
1675 bool default_enc = true;
1676 if (params.inputenc != "auto") {
1677 default_enc = false;
1678 if (params.inputenc == "default") {
1679 langModule->encodingCO->setCurrentIndex(0);
1681 int const i = langModule->encodingCO->findText(
1682 toqstr(params.inputenc));
1684 langModule->encodingCO->setCurrentIndex(i);
1686 // unknown encoding. Set to default.
1690 langModule->defaultencodingRB->setChecked(default_enc);
1691 langModule->otherencodingRB->setChecked(!default_enc);
1694 int const min_toclevel = textClass().min_toclevel();
1695 int const max_toclevel = textClass().max_toclevel();
1696 if (textClass().hasTocLevels()) {
1697 numberingModule->setEnabled(true);
1698 numberingModule->depthSL->setMinimum(min_toclevel - 1);
1699 numberingModule->depthSL->setMaximum(max_toclevel);
1700 numberingModule->depthSL->setValue(params.secnumdepth);
1701 numberingModule->tocSL->setMaximum(min_toclevel - 1);
1702 numberingModule->tocSL->setMaximum(max_toclevel);
1703 numberingModule->tocSL->setValue(params.tocdepth);
1706 numberingModule->setEnabled(false);
1707 numberingModule->tocTW->clear();
1711 bulletsModule->setBullet(0, params.user_defined_bullet(0));
1712 bulletsModule->setBullet(1, params.user_defined_bullet(1));
1713 bulletsModule->setBullet(2, params.user_defined_bullet(2));
1714 bulletsModule->setBullet(3, params.user_defined_bullet(3));
1715 bulletsModule->init();
1718 int nitem = findToken(tex_graphics, params.graphicsDriver);
1720 latexModule->psdriverCO->setCurrentIndex(nitem);
1723 mathsModule->amsCB->setChecked(
1724 params.use_amsmath == BufferParams::package_on);
1725 mathsModule->amsautoCB->setChecked(
1726 params.use_amsmath == BufferParams::package_auto);
1728 mathsModule->esintCB->setChecked(
1729 params.use_esint == BufferParams::package_on);
1730 mathsModule->esintautoCB->setChecked(
1731 params.use_esint == BufferParams::package_auto);
1733 switch (params.spacing().getSpace()) {
1734 case Spacing::Other: nitem = 3; break;
1735 case Spacing::Double: nitem = 2; break;
1736 case Spacing::Onehalf: nitem = 1; break;
1737 case Spacing::Default: case Spacing::Single: nitem = 0; break;
1741 latexModule->classCO->setCurrentIndex(params.getBaseClass());
1743 updatePagestyle(textClass().opt_pagestyle(),
1746 textLayoutModule->lspacingCO->setCurrentIndex(nitem);
1747 if (params.spacing().getSpace() == Spacing::Other) {
1748 textLayoutModule->lspacingLE->setText(
1749 toqstr(params.spacing().getValueAsString()));
1753 if (params.paragraph_separation == BufferParams::PARSEP_INDENT)
1754 textLayoutModule->indentRB->setChecked(true);
1756 textLayoutModule->skipRB->setChecked(true);
1759 switch (params.getDefSkip().kind()) {
1760 case VSpace::SMALLSKIP:
1763 case VSpace::MEDSKIP:
1766 case VSpace::BIGSKIP:
1769 case VSpace::LENGTH:
1772 string const length = params.getDefSkip().asLyXCommand();
1773 lengthToWidgets(textLayoutModule->skipLE,
1774 textLayoutModule->skipLengthCO,
1775 length, defaultUnit);
1782 textLayoutModule->skipCO->setCurrentIndex(skip);
1785 textLayoutModule->twoColumnCB->setChecked(
1786 params.columns == 2);
1788 // break listings_params to multiple lines
1790 InsetListingsParams(params.listings_params).separatedParams();
1791 textLayoutModule->listingsED->setPlainText(toqstr(lstparams));
1793 if (!params.options.empty()) {
1794 latexModule->optionsLE->setText(
1795 toqstr(params.options));
1797 latexModule->optionsLE->setText(QString());
1800 floatModule->set(params.float_placement);
1803 updateFontsize(textClass().opt_fontsize(),
1806 int n = findToken(tex_fonts_roman, params.fontsRoman);
1808 fontModule->fontsRomanCO->setCurrentIndex(n);
1812 n = findToken(tex_fonts_sans, params.fontsSans);
1814 fontModule->fontsSansCO->setCurrentIndex(n);
1818 n = findToken(tex_fonts_monospaced, params.fontsTypewriter);
1820 fontModule->fontsTypewriterCO->setCurrentIndex(n);
1824 fontModule->fontScCB->setChecked(params.fontsSC);
1825 fontModule->fontOsfCB->setChecked(params.fontsOSF);
1826 fontModule->scaleSansSB->setValue(params.fontsSansScale);
1827 fontModule->scaleTypewriterSB->setValue(params.fontsTypewriterScale);
1828 n = findToken(GuiDocument::fontfamilies, params.fontsDefaultFamily);
1830 fontModule->fontsDefaultCO->setCurrentIndex(n);
1833 int const psize = params.papersize;
1834 pageLayoutModule->papersizeCO->setCurrentIndex(psize);
1835 setCustomPapersize(psize);
1837 bool const landscape =
1838 params.orientation == ORIENTATION_LANDSCAPE;
1839 pageLayoutModule->landscapeRB->setChecked(landscape);
1840 pageLayoutModule->portraitRB->setChecked(!landscape);
1842 pageLayoutModule->facingPagesCB->setChecked(
1843 params.sides == TwoSides);
1846 lengthToWidgets(pageLayoutModule->paperwidthLE,
1847 pageLayoutModule->paperwidthUnitCO, params.paperwidth, defaultUnit);
1849 lengthToWidgets(pageLayoutModule->paperheightLE,
1850 pageLayoutModule->paperheightUnitCO, params.paperheight, defaultUnit);
1853 Ui::MarginsUi * m = marginsModule;
1855 setMargins(!params.use_geometry);
1857 lengthToWidgets(m->topLE, m->topUnit,
1858 params.topmargin, defaultUnit);
1860 lengthToWidgets(m->bottomLE, m->bottomUnit,
1861 params.bottommargin, defaultUnit);
1863 lengthToWidgets(m->innerLE, m->innerUnit,
1864 params.leftmargin, defaultUnit);
1866 lengthToWidgets(m->outerLE, m->outerUnit,
1867 params.rightmargin, defaultUnit);
1869 lengthToWidgets(m->headheightLE, m->headheightUnit,
1870 params.headheight, defaultUnit);
1872 lengthToWidgets(m->headsepLE, m->headsepUnit,
1873 params.headsep, defaultUnit);
1875 lengthToWidgets(m->footskipLE, m->footskipUnit,
1876 params.footskip, defaultUnit);
1878 branchesModule->update(params);
1881 PDFOptions const & pdf = params.pdfoptions();
1882 pdfSupportModule->use_hyperrefGB->setChecked(pdf.use_hyperref);
1883 pdfSupportModule->titleLE->setText(toqstr(pdf.title));
1884 pdfSupportModule->authorLE->setText(toqstr(pdf.author));
1885 pdfSupportModule->subjectLE->setText(toqstr(pdf.subject));
1886 pdfSupportModule->keywordsLE->setText(toqstr(pdf.keywords));
1888 pdfSupportModule->bookmarksGB->setChecked(pdf.bookmarks);
1889 pdfSupportModule->bookmarksnumberedCB->setChecked(pdf.bookmarksnumbered);
1890 pdfSupportModule->bookmarksopenGB->setChecked(pdf.bookmarksopen);
1892 pdfSupportModule->bookmarksopenlevelSB->setValue(pdf.bookmarksopenlevel);
1894 pdfSupportModule->breaklinksCB->setChecked(pdf.breaklinks);
1895 pdfSupportModule->pdfborderCB->setChecked(pdf.pdfborder);
1896 pdfSupportModule->pdfusetitleCB->setChecked(pdf.pdfusetitle);
1897 pdfSupportModule->colorlinksCB->setChecked(pdf.colorlinks);
1898 pdfSupportModule->backrefCB->setChecked(pdf.backref);
1899 pdfSupportModule->pagebackrefCB->setChecked(pdf.pagebackref);
1900 pdfSupportModule->fullscreenCB->setChecked
1901 (pdf.pagemode == pdf.pagemode_fullscreen);
1903 pdfSupportModule->optionsLE->setText(
1904 toqstr(pdf.quoted_options));
1907 updateEmbeddedFileList();
1911 void GuiDocument::applyView()
1917 void GuiDocument::saveDocDefault()
1919 // we have to apply the params first
1925 void GuiDocument::updateContents()
1927 //update list of available modules
1928 QStringList strlist;
1929 vector<string> const modNames = getModuleNames();
1930 vector<string>::const_iterator it = modNames.begin();
1931 for (; it != modNames.end(); ++it)
1932 strlist.push_back(toqstr(*it));
1933 available_model_.setStringList(strlist);
1934 //and selected ones, too
1935 QStringList strlist2;
1936 vector<string> const & selMods = getSelectedModules();
1937 it = selMods.begin();
1938 for (; it != selMods.end(); ++it)
1939 strlist2.push_back(toqstr(*it));
1940 //FIXME It'd be nice to make sure here that the selected
1941 //modules are consistent: That required modules are actually
1942 //selected, and that we don't have conflicts. If so, we could
1943 //at least pop up a warning.
1944 selected_model_.setStringList(strlist2);
1949 void GuiDocument::useClassDefaults()
1951 bp_.setBaseClass(latexModule->classCO->currentIndex());
1952 bp_.useClassDefaults();
1957 bool GuiDocument::isValid()
1959 return validate_listings_params().empty();
1963 char const * const GuiDocument::fontfamilies[5] = {
1964 "default", "rmdefault", "sfdefault", "ttdefault", ""
1968 char const * GuiDocument::fontfamilies_gui[5] = {
1969 N_("Default"), N_("Roman"), N_("Sans Serif"), N_("Typewriter"), ""
1973 bool GuiDocument::initialiseParams(string const &)
1975 bp_ = buffer().params();
1981 void GuiDocument::clearParams()
1983 bp_ = BufferParams();
1987 BufferId GuiDocument::id() const
1993 vector<string> const & GuiDocument::getModuleNames()
1995 return moduleNames_;
1999 vector<string> const & GuiDocument::getSelectedModules()
2001 return params().getModules();
2005 TextClass const & GuiDocument::textClass() const
2007 return textclasslist[bp_.getBaseClass()];
2011 static void dispatch_bufferparams(Dialog const & dialog,
2012 BufferParams const & bp, kb_action lfun)
2015 ss << "\\begin_header\n";
2017 ss << "\\end_header\n";
2018 dialog.dispatch(FuncRequest(lfun, ss.str()));
2022 void GuiDocument::dispatchParams()
2024 // This must come first so that a language change is correctly noticed
2027 // Apply the BufferParams. Note that this will set the base class
2028 // and then update the buffer's layout.
2029 dispatch_bufferparams(*this, params(), LFUN_BUFFER_PARAMS_APPLY);
2031 // Generate the colours requested by each new branch.
2032 BranchList & branchlist = params().branchlist();
2033 if (!branchlist.empty()) {
2034 BranchList::const_iterator it = branchlist.begin();
2035 BranchList::const_iterator const end = branchlist.end();
2036 for (; it != end; ++it) {
2037 docstring const & current_branch = it->getBranch();
2038 Branch const * branch = branchlist.find(current_branch);
2039 string const x11hexname = X11hexname(branch->getColor());
2040 // display the new color
2041 docstring const str = current_branch + ' ' + from_ascii(x11hexname);
2042 dispatch(FuncRequest(LFUN_SET_COLOR, str));
2045 // Open insets of selected branches, close deselected ones
2046 dispatch(FuncRequest(LFUN_ALL_INSETS_TOGGLE,
2049 // FIXME: If we used an LFUN, we would not need those two lines:
2050 bufferview()->processUpdateFlags(Update::Force | Update::FitCursor);
2054 void GuiDocument::setLanguage() const
2056 Language const * const newL = bp_.language;
2057 if (buffer().params().language == newL)
2060 string const & lang_name = newL->lang();
2061 dispatch(FuncRequest(LFUN_BUFFER_LANGUAGE, lang_name));
2065 void GuiDocument::saveAsDefault() const
2067 dispatch_bufferparams(*this, params(), LFUN_BUFFER_SAVE_AS_DEFAULT);
2071 bool GuiDocument::isFontAvailable(string const & font) const
2073 if (font == "default" || font == "cmr"
2074 || font == "cmss" || font == "cmtt")
2075 // these are standard
2077 if (font == "lmodern" || font == "lmss" || font == "lmtt")
2078 return LaTeXFeatures::isAvailable("lmodern");
2079 if (font == "times" || font == "palatino"
2080 || font == "helvet" || font == "courier")
2081 return LaTeXFeatures::isAvailable("psnfss");
2082 if (font == "cmbr" || font == "cmtl")
2083 return LaTeXFeatures::isAvailable("cmbright");
2084 if (font == "utopia")
2085 return LaTeXFeatures::isAvailable("utopia")
2086 || LaTeXFeatures::isAvailable("fourier");
2087 if (font == "beraserif" || font == "berasans"
2088 || font == "beramono")
2089 return LaTeXFeatures::isAvailable("bera");
2090 return LaTeXFeatures::isAvailable(font);
2094 bool GuiDocument::providesOSF(string const & font) const
2097 return isFontAvailable("eco");
2098 if (font == "palatino")
2099 return isFontAvailable("mathpazo");
2104 bool GuiDocument::providesSC(string const & font) const
2106 if (font == "palatino")
2107 return isFontAvailable("mathpazo");
2108 if (font == "utopia")
2109 return isFontAvailable("fourier");
2114 bool GuiDocument::providesScale(string const & font) const
2116 return font == "helvet" || font == "luximono"
2117 || font == "berasans" || font == "beramono";
2121 void GuiDocument::loadModuleNames ()
2123 moduleNames_.clear();
2124 LyXModuleList::const_iterator it = moduleList.begin();
2125 for (; it != moduleList.end(); ++it)
2126 moduleNames_.push_back(it->getName());
2127 if (!moduleNames_.empty())
2128 sort(moduleNames_.begin(), moduleNames_.end());
2132 Dialog * createGuiDocument(GuiView & lv) { return new GuiDocument(lv); }
2135 } // namespace frontend
2138 #include "GuiDocument_moc.cpp"