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();
1198 //This is an insanely complicated attempt to make this sort of thing
1199 //work with RTL languages.
1200 docstring formatStrVec(vector<string> const & v, docstring const & s)
1202 //this mess formats the list as "v[0], v[1], ..., [s] v[n]"
1203 int const vSize = v.size();
1206 else if (v.size() == 1)
1207 return from_ascii(v[0]);
1208 else if (v.size() == 2) {
1209 docstring retval = _("%1$s and %2$s");
1210 retval = subst(retval, _("and"), s);
1211 return bformat(retval, from_ascii(v[0]), from_ascii(v[1]));
1213 //The idea here is to format all but the last two items...
1214 docstring t2 = _("%1$s, %2$s");
1215 docstring retval = from_ascii(v[0]);
1216 for (int i = 1; i < vSize - 2; ++i)
1217 retval = bformat(t2, retval, from_ascii(v[i]));
1218 //...and then to plug them, and the last two, into this schema
1219 docstring t = _("%1$s, %2$s, and %3$s");
1220 t = subst(t, _("and"), s);
1221 return bformat(t, retval, from_ascii(v[vSize - 2]), from_ascii(v[vSize - 1]));
1226 void GuiDocument::updateModuleInfo()
1228 selectionManager->update();
1229 //Module description
1230 QListView const * const lv = selectionManager->selectedFocused() ?
1231 latexModule->selectedLV :
1232 latexModule->availableLV;
1233 if (lv->selectionModel()->selectedIndexes().isEmpty())
1234 latexModule->infoML->document()->clear();
1236 QModelIndex const & idx = lv->selectionModel()->currentIndex();
1237 string const modName = fromqstr(idx.data().toString());
1238 docstring desc = getModuleDescription(modName);
1240 vector<string> pkgList = getPackageList(modName);
1241 docstring pkgdesc = formatStrVec(pkgList, _("and"));
1242 if (!pkgdesc.empty()) {
1245 desc += bformat(_("Package(s) required: %1$s."), pkgdesc);
1248 pkgList = getRequiredList(modName);
1249 pkgdesc = formatStrVec(pkgList, _("or"));
1250 if (!pkgdesc.empty()) {
1253 desc += bformat(_("Module required: %1$s."), pkgdesc);
1256 pkgList = getExcludedList(modName);
1257 pkgdesc = formatStrVec(pkgList, _( "and"));
1258 if (!pkgdesc.empty()) {
1261 desc += bformat(_("Modules excluded: %1$s."), pkgdesc);
1264 if (!isModuleAvailable(modName)) {
1267 desc += _("WARNING: Some packages are unavailable!");
1269 latexModule->infoML->document()->setPlainText(toqstr(desc));
1274 void GuiDocument::updateEmbeddedFileList()
1276 embeddedFilesModule->filesLW->clear();
1277 // add current embedded files
1278 EmbeddedFileList & files = buffer().embeddedFiles();
1279 files.update(buffer());
1280 EmbeddedFileList::iterator fit = files.begin();
1281 EmbeddedFileList::iterator fit_end = files.end();
1282 for (; fit != fit_end; ++fit) {
1283 QString label = toqstr(fit->relFilename(buffer().filePath()));
1284 if (fit->refCount() > 1)
1285 label += " (" + QString::number(fit->refCount()) + ")";
1286 QListWidgetItem * item = new QListWidgetItem(label);
1287 item->setFlags(item->flags() | Qt::ItemIsSelectable
1288 | Qt::ItemIsUserCheckable);
1290 item->setCheckState(Qt::Checked);
1292 item->setCheckState(Qt::Unchecked);
1293 // index of the currently used ParConstIterator
1294 embeddedFilesModule->filesLW->addItem(item);
1299 void GuiDocument::updateNumbering()
1301 TextClass const & tclass = bp_.getTextClass();
1303 numberingModule->tocTW->setUpdatesEnabled(false);
1304 numberingModule->tocTW->clear();
1306 int const depth = numberingModule->depthSL->value();
1307 int const toc = numberingModule->tocSL->value();
1308 QString const no = qt_("No");
1309 QString const yes = qt_("Yes");
1310 TextClass::const_iterator end = tclass.end();
1311 TextClass::const_iterator cit = tclass.begin();
1312 QTreeWidgetItem * item = 0;
1313 for ( ; cit != end ; ++cit) {
1314 int const toclevel = (*cit)->toclevel;
1315 if (toclevel != Layout::NOT_IN_TOC
1316 && (*cit)->labeltype == LABEL_COUNTER) {
1317 item = new QTreeWidgetItem(numberingModule->tocTW);
1318 item->setText(0, toqstr(translateIfPossible((*cit)->name())));
1319 item->setText(1, (toclevel <= depth) ? yes : no);
1320 item->setText(2, (toclevel <= toc) ? yes : no);
1324 numberingModule->tocTW->setUpdatesEnabled(true);
1325 numberingModule->tocTW->update();
1329 void GuiDocument::apply(BufferParams & params)
1332 preambleModule->apply(params);
1335 params.setCiteEngine(biblio::ENGINE_BASIC);
1337 if (biblioModule->citeNatbibRB->isChecked()) {
1338 bool const use_numerical_citations =
1339 biblioModule->citeStyleCO->currentIndex();
1340 if (use_numerical_citations)
1341 params.setCiteEngine(biblio::ENGINE_NATBIB_NUMERICAL);
1343 params.setCiteEngine(biblio::ENGINE_NATBIB_AUTHORYEAR);
1345 } else if (biblioModule->citeJurabibRB->isChecked())
1346 params.setCiteEngine(biblio::ENGINE_JURABIB);
1348 params.use_bibtopic =
1349 biblioModule->bibtopicCB->isChecked();
1351 // language & quotes
1352 if (langModule->defaultencodingRB->isChecked()) {
1353 params.inputenc = "auto";
1355 int i = langModule->encodingCO->currentIndex();
1357 params.inputenc = "default";
1360 fromqstr(langModule->encodingCO->currentText());
1363 InsetQuotes::quote_language lga = InsetQuotes::EnglishQ;
1364 switch (langModule->quoteStyleCO->currentIndex()) {
1366 lga = InsetQuotes::EnglishQ;
1369 lga = InsetQuotes::SwedishQ;
1372 lga = InsetQuotes::GermanQ;
1375 lga = InsetQuotes::PolishQ;
1378 lga = InsetQuotes::FrenchQ;
1381 lga = InsetQuotes::DanishQ;
1384 params.quotes_language = lga;
1386 int const pos = langModule->languageCO->currentIndex();
1387 params.language = lyx::languages.getLanguage(lang_[pos]);
1390 if (params.getTextClass().hasTocLevels()) {
1391 params.tocdepth = numberingModule->tocSL->value();
1392 params.secnumdepth = numberingModule->depthSL->value();
1396 params.user_defined_bullet(0) = bulletsModule->getBullet(0);
1397 params.user_defined_bullet(1) = bulletsModule->getBullet(1);
1398 params.user_defined_bullet(2) = bulletsModule->getBullet(2);
1399 params.user_defined_bullet(3) = bulletsModule->getBullet(3);
1402 params.graphicsDriver =
1403 tex_graphics[latexModule->psdriverCO->currentIndex()];
1406 params.setBaseClass(latexModule->classCO->currentIndex());
1409 params.clearLayoutModules();
1410 QStringList const selMods = selectedModel()->stringList();
1411 for (int i = 0; i != selMods.size(); ++i)
1412 params.addLayoutModule(lyx::fromqstr(selMods[i]));
1414 if (mathsModule->amsautoCB->isChecked()) {
1415 params.use_amsmath = BufferParams::package_auto;
1417 if (mathsModule->amsCB->isChecked())
1418 params.use_amsmath = BufferParams::package_on;
1420 params.use_amsmath = BufferParams::package_off;
1423 if (mathsModule->esintautoCB->isChecked())
1424 params.use_esint = BufferParams::package_auto;
1426 if (mathsModule->esintCB->isChecked())
1427 params.use_esint = BufferParams::package_on;
1429 params.use_esint = BufferParams::package_off;
1432 if (pageLayoutModule->pagestyleCO->currentIndex() == 0)
1433 params.pagestyle = "default";
1435 docstring style_gui =
1436 qstring_to_ucs4(pageLayoutModule->pagestyleCO->currentText());
1437 for (size_t i = 0; i < pagestyles.size(); ++i)
1438 if (pagestyles[i].second == style_gui)
1439 params.pagestyle = pagestyles[i].first;
1442 switch (textLayoutModule->lspacingCO->currentIndex()) {
1444 params.spacing().set(Spacing::Single);
1447 params.spacing().set(Spacing::Onehalf);
1450 params.spacing().set(Spacing::Double);
1453 params.spacing().set(Spacing::Other,
1454 fromqstr(textLayoutModule->lspacingLE->text()));
1458 if (textLayoutModule->twoColumnCB->isChecked())
1463 // text should have passed validation
1464 params.listings_params =
1465 InsetListingsParams(fromqstr(textLayoutModule->listingsED->toPlainText())).params();
1467 if (textLayoutModule->indentRB->isChecked())
1468 params.paragraph_separation = BufferParams::PARSEP_INDENT;
1470 params.paragraph_separation = BufferParams::PARSEP_SKIP;
1472 switch (textLayoutModule->skipCO->currentIndex()) {
1474 params.setDefSkip(VSpace(VSpace::SMALLSKIP));
1477 params.setDefSkip(VSpace(VSpace::MEDSKIP));
1480 params.setDefSkip(VSpace(VSpace::BIGSKIP));
1485 widgetsToLength(textLayoutModule->skipLE,
1486 textLayoutModule->skipLengthCO)
1488 params.setDefSkip(vs);
1492 // DocumentDefskipCB assures that this never happens
1493 // so Assert then !!! - jbl
1494 params.setDefSkip(VSpace(VSpace::MEDSKIP));
1499 fromqstr(latexModule->optionsLE->text());
1501 params.float_placement = floatModule->get();
1505 tex_fonts_roman[fontModule->fontsRomanCO->currentIndex()];
1508 tex_fonts_sans[fontModule->fontsSansCO->currentIndex()];
1510 params.fontsTypewriter =
1511 tex_fonts_monospaced[fontModule->fontsTypewriterCO->currentIndex()];
1513 params.fontsSansScale = fontModule->scaleSansSB->value();
1515 params.fontsTypewriterScale = fontModule->scaleTypewriterSB->value();
1517 params.fontsSC = fontModule->fontScCB->isChecked();
1519 params.fontsOSF = fontModule->fontOsfCB->isChecked();
1521 params.fontsDefaultFamily = GuiDocument::fontfamilies[
1522 fontModule->fontsDefaultCO->currentIndex()];
1524 if (fontModule->fontsizeCO->currentIndex() == 0)
1525 params.fontsize = "default";
1528 fromqstr(fontModule->fontsizeCO->currentText());
1531 params.papersize = PAPER_SIZE(
1532 pageLayoutModule->papersizeCO->currentIndex());
1534 // custom, A3, B3 and B4 paper sizes need geometry
1535 int psize = pageLayoutModule->papersizeCO->currentIndex();
1536 bool geom_papersize = (psize == 1 || psize == 5 || psize == 8 || psize == 9);
1538 params.paperwidth = widgetsToLength(pageLayoutModule->paperwidthLE,
1539 pageLayoutModule->paperwidthUnitCO);
1541 params.paperheight = widgetsToLength(pageLayoutModule->paperheightLE,
1542 pageLayoutModule->paperheightUnitCO);
1544 if (pageLayoutModule->facingPagesCB->isChecked())
1545 params.sides = TwoSides;
1547 params.sides = OneSide;
1549 if (pageLayoutModule->landscapeRB->isChecked())
1550 params.orientation = ORIENTATION_LANDSCAPE;
1552 params.orientation = ORIENTATION_PORTRAIT;
1555 params.use_geometry =
1556 (!marginsModule->marginCB->isChecked()
1559 Ui::MarginsUi const * m(marginsModule);
1561 params.leftmargin = widgetsToLength(m->innerLE, m->innerUnit);
1562 params.topmargin = widgetsToLength(m->topLE, m->topUnit);
1563 params.rightmargin = widgetsToLength(m->outerLE, m->outerUnit);
1564 params.bottommargin = widgetsToLength(m->bottomLE, m->bottomUnit);
1565 params.headheight = widgetsToLength(m->headheightLE, m->headheightUnit);
1566 params.headsep = widgetsToLength(m->headsepLE, m->headsepUnit);
1567 params.footskip = widgetsToLength(m->footskipLE, m->footskipUnit);
1569 branchesModule->apply(params);
1572 PDFOptions & pdf = params.pdfoptions();
1573 pdf.use_hyperref = pdfSupportModule->use_hyperrefGB->isChecked();
1574 pdf.title = fromqstr(pdfSupportModule->titleLE->text());
1575 pdf.author = fromqstr(pdfSupportModule->authorLE->text());
1576 pdf.subject = fromqstr(pdfSupportModule->subjectLE->text());
1577 pdf.keywords = fromqstr(pdfSupportModule->keywordsLE->text());
1579 pdf.bookmarks = pdfSupportModule->bookmarksGB->isChecked();
1580 pdf.bookmarksnumbered = pdfSupportModule->bookmarksnumberedCB->isChecked();
1581 pdf.bookmarksopen = pdfSupportModule->bookmarksopenGB->isChecked();
1582 pdf.bookmarksopenlevel = pdfSupportModule->bookmarksopenlevelSB->value();
1584 pdf.breaklinks = pdfSupportModule->breaklinksCB->isChecked();
1585 pdf.pdfborder = pdfSupportModule->pdfborderCB->isChecked();
1586 pdf.pdfusetitle = pdfSupportModule->pdfusetitleCB->isChecked();
1587 pdf.colorlinks = pdfSupportModule->colorlinksCB->isChecked();
1588 pdf.backref = pdfSupportModule->backrefCB->isChecked();
1589 pdf.pagebackref = pdfSupportModule->pagebackrefCB->isChecked();
1590 if (pdfSupportModule->fullscreenCB->isChecked())
1591 pdf.pagemode = pdf.pagemode_fullscreen;
1593 pdf.pagemode.clear();
1594 pdf.quoted_options = fromqstr(pdfSupportModule->optionsLE->text());
1601 /** Return the position of val in the vector if found.
1602 If not found, return 0.
1605 static size_t findPos(vector<A> const & vec, A const & val)
1607 typename vector<A>::const_iterator it =
1608 find(vec.begin(), vec.end(), val);
1609 if (it == vec.end())
1611 return distance(vec.begin(), it);
1615 void GuiDocument::updateParams()
1621 void GuiDocument::updateParams(BufferParams const & params)
1623 // set the default unit
1624 Length::UNIT defaultUnit = Length::CM;
1625 switch (lyxrc.default_papersize) {
1626 case PAPER_DEFAULT: break;
1628 case PAPER_USLETTER:
1630 case PAPER_USEXECUTIVE:
1631 defaultUnit = Length::IN;
1640 defaultUnit = Length::CM;
1647 preambleModule->update(params, id());
1650 biblioModule->citeDefaultRB->setChecked(
1651 params.getEngine() == biblio::ENGINE_BASIC);
1653 biblioModule->citeNatbibRB->setChecked(
1654 params.getEngine() == biblio::ENGINE_NATBIB_NUMERICAL ||
1655 params.getEngine() == biblio::ENGINE_NATBIB_AUTHORYEAR);
1657 biblioModule->citeStyleCO->setCurrentIndex(
1658 params.getEngine() == biblio::ENGINE_NATBIB_NUMERICAL);
1660 biblioModule->citeJurabibRB->setChecked(
1661 params.getEngine() == biblio::ENGINE_JURABIB);
1663 biblioModule->bibtopicCB->setChecked(
1664 params.use_bibtopic);
1666 // language & quotes
1667 int const pos = int(findPos(lang_,
1668 params.language->lang()));
1669 langModule->languageCO->setCurrentIndex(pos);
1671 langModule->quoteStyleCO->setCurrentIndex(
1672 params.quotes_language);
1674 bool default_enc = true;
1675 if (params.inputenc != "auto") {
1676 default_enc = false;
1677 if (params.inputenc == "default") {
1678 langModule->encodingCO->setCurrentIndex(0);
1680 int const i = langModule->encodingCO->findText(
1681 toqstr(params.inputenc));
1683 langModule->encodingCO->setCurrentIndex(i);
1685 // unknown encoding. Set to default.
1689 langModule->defaultencodingRB->setChecked(default_enc);
1690 langModule->otherencodingRB->setChecked(!default_enc);
1693 int const min_toclevel = textClass().min_toclevel();
1694 int const max_toclevel = textClass().max_toclevel();
1695 if (textClass().hasTocLevels()) {
1696 numberingModule->setEnabled(true);
1697 numberingModule->depthSL->setMinimum(min_toclevel - 1);
1698 numberingModule->depthSL->setMaximum(max_toclevel);
1699 numberingModule->depthSL->setValue(params.secnumdepth);
1700 numberingModule->tocSL->setMaximum(min_toclevel - 1);
1701 numberingModule->tocSL->setMaximum(max_toclevel);
1702 numberingModule->tocSL->setValue(params.tocdepth);
1705 numberingModule->setEnabled(false);
1706 numberingModule->tocTW->clear();
1710 bulletsModule->setBullet(0, params.user_defined_bullet(0));
1711 bulletsModule->setBullet(1, params.user_defined_bullet(1));
1712 bulletsModule->setBullet(2, params.user_defined_bullet(2));
1713 bulletsModule->setBullet(3, params.user_defined_bullet(3));
1714 bulletsModule->init();
1717 int nitem = findToken(tex_graphics, params.graphicsDriver);
1719 latexModule->psdriverCO->setCurrentIndex(nitem);
1722 mathsModule->amsCB->setChecked(
1723 params.use_amsmath == BufferParams::package_on);
1724 mathsModule->amsautoCB->setChecked(
1725 params.use_amsmath == BufferParams::package_auto);
1727 mathsModule->esintCB->setChecked(
1728 params.use_esint == BufferParams::package_on);
1729 mathsModule->esintautoCB->setChecked(
1730 params.use_esint == BufferParams::package_auto);
1732 switch (params.spacing().getSpace()) {
1733 case Spacing::Other: nitem = 3; break;
1734 case Spacing::Double: nitem = 2; break;
1735 case Spacing::Onehalf: nitem = 1; break;
1736 case Spacing::Default: case Spacing::Single: nitem = 0; break;
1740 latexModule->classCO->setCurrentIndex(params.getBaseClass());
1742 updatePagestyle(textClass().opt_pagestyle(),
1745 textLayoutModule->lspacingCO->setCurrentIndex(nitem);
1746 if (params.spacing().getSpace() == Spacing::Other) {
1747 textLayoutModule->lspacingLE->setText(
1748 toqstr(params.spacing().getValueAsString()));
1752 if (params.paragraph_separation == BufferParams::PARSEP_INDENT)
1753 textLayoutModule->indentRB->setChecked(true);
1755 textLayoutModule->skipRB->setChecked(true);
1758 switch (params.getDefSkip().kind()) {
1759 case VSpace::SMALLSKIP:
1762 case VSpace::MEDSKIP:
1765 case VSpace::BIGSKIP:
1768 case VSpace::LENGTH:
1771 string const length = params.getDefSkip().asLyXCommand();
1772 lengthToWidgets(textLayoutModule->skipLE,
1773 textLayoutModule->skipLengthCO,
1774 length, defaultUnit);
1781 textLayoutModule->skipCO->setCurrentIndex(skip);
1784 textLayoutModule->twoColumnCB->setChecked(
1785 params.columns == 2);
1787 // break listings_params to multiple lines
1789 InsetListingsParams(params.listings_params).separatedParams();
1790 textLayoutModule->listingsED->setPlainText(toqstr(lstparams));
1792 if (!params.options.empty()) {
1793 latexModule->optionsLE->setText(
1794 toqstr(params.options));
1796 latexModule->optionsLE->setText(QString());
1799 floatModule->set(params.float_placement);
1802 updateFontsize(textClass().opt_fontsize(),
1805 int n = findToken(tex_fonts_roman, params.fontsRoman);
1807 fontModule->fontsRomanCO->setCurrentIndex(n);
1811 n = findToken(tex_fonts_sans, params.fontsSans);
1813 fontModule->fontsSansCO->setCurrentIndex(n);
1817 n = findToken(tex_fonts_monospaced, params.fontsTypewriter);
1819 fontModule->fontsTypewriterCO->setCurrentIndex(n);
1823 fontModule->fontScCB->setChecked(params.fontsSC);
1824 fontModule->fontOsfCB->setChecked(params.fontsOSF);
1825 fontModule->scaleSansSB->setValue(params.fontsSansScale);
1826 fontModule->scaleTypewriterSB->setValue(params.fontsTypewriterScale);
1827 n = findToken(GuiDocument::fontfamilies, params.fontsDefaultFamily);
1829 fontModule->fontsDefaultCO->setCurrentIndex(n);
1832 int const psize = params.papersize;
1833 pageLayoutModule->papersizeCO->setCurrentIndex(psize);
1834 setCustomPapersize(psize);
1836 bool const landscape =
1837 params.orientation == ORIENTATION_LANDSCAPE;
1838 pageLayoutModule->landscapeRB->setChecked(landscape);
1839 pageLayoutModule->portraitRB->setChecked(!landscape);
1841 pageLayoutModule->facingPagesCB->setChecked(
1842 params.sides == TwoSides);
1845 lengthToWidgets(pageLayoutModule->paperwidthLE,
1846 pageLayoutModule->paperwidthUnitCO, params.paperwidth, defaultUnit);
1848 lengthToWidgets(pageLayoutModule->paperheightLE,
1849 pageLayoutModule->paperheightUnitCO, params.paperheight, defaultUnit);
1852 Ui::MarginsUi * m = marginsModule;
1854 setMargins(!params.use_geometry);
1856 lengthToWidgets(m->topLE, m->topUnit,
1857 params.topmargin, defaultUnit);
1859 lengthToWidgets(m->bottomLE, m->bottomUnit,
1860 params.bottommargin, defaultUnit);
1862 lengthToWidgets(m->innerLE, m->innerUnit,
1863 params.leftmargin, defaultUnit);
1865 lengthToWidgets(m->outerLE, m->outerUnit,
1866 params.rightmargin, defaultUnit);
1868 lengthToWidgets(m->headheightLE, m->headheightUnit,
1869 params.headheight, defaultUnit);
1871 lengthToWidgets(m->headsepLE, m->headsepUnit,
1872 params.headsep, defaultUnit);
1874 lengthToWidgets(m->footskipLE, m->footskipUnit,
1875 params.footskip, defaultUnit);
1877 branchesModule->update(params);
1880 PDFOptions const & pdf = params.pdfoptions();
1881 pdfSupportModule->use_hyperrefGB->setChecked(pdf.use_hyperref);
1882 pdfSupportModule->titleLE->setText(toqstr(pdf.title));
1883 pdfSupportModule->authorLE->setText(toqstr(pdf.author));
1884 pdfSupportModule->subjectLE->setText(toqstr(pdf.subject));
1885 pdfSupportModule->keywordsLE->setText(toqstr(pdf.keywords));
1887 pdfSupportModule->bookmarksGB->setChecked(pdf.bookmarks);
1888 pdfSupportModule->bookmarksnumberedCB->setChecked(pdf.bookmarksnumbered);
1889 pdfSupportModule->bookmarksopenGB->setChecked(pdf.bookmarksopen);
1891 pdfSupportModule->bookmarksopenlevelSB->setValue(pdf.bookmarksopenlevel);
1893 pdfSupportModule->breaklinksCB->setChecked(pdf.breaklinks);
1894 pdfSupportModule->pdfborderCB->setChecked(pdf.pdfborder);
1895 pdfSupportModule->pdfusetitleCB->setChecked(pdf.pdfusetitle);
1896 pdfSupportModule->colorlinksCB->setChecked(pdf.colorlinks);
1897 pdfSupportModule->backrefCB->setChecked(pdf.backref);
1898 pdfSupportModule->pagebackrefCB->setChecked(pdf.pagebackref);
1899 pdfSupportModule->fullscreenCB->setChecked
1900 (pdf.pagemode == pdf.pagemode_fullscreen);
1902 pdfSupportModule->optionsLE->setText(
1903 toqstr(pdf.quoted_options));
1906 updateEmbeddedFileList();
1910 void GuiDocument::applyView()
1916 void GuiDocument::saveDocDefault()
1918 // we have to apply the params first
1924 void GuiDocument::updateContents()
1926 //update list of available modules
1927 QStringList strlist;
1928 vector<string> const modNames = getModuleNames();
1929 vector<string>::const_iterator it = modNames.begin();
1930 for (; it != modNames.end(); ++it)
1931 strlist.push_back(toqstr(*it));
1932 available_model_.setStringList(strlist);
1933 //and selected ones, too
1934 QStringList strlist2;
1935 vector<string> const & selMods = getSelectedModules();
1936 it = selMods.begin();
1937 for (; it != selMods.end(); ++it)
1938 strlist2.push_back(toqstr(*it));
1939 //FIXME It'd be nice to make sure here that the selected
1940 //modules are consistent: That required modules are actually
1941 //selected, and that we don't have conflicts. If so, we could
1942 //at least pop up a warning.
1943 selected_model_.setStringList(strlist2);
1948 void GuiDocument::useClassDefaults()
1950 bp_.setBaseClass(latexModule->classCO->currentIndex());
1951 bp_.useClassDefaults();
1956 bool GuiDocument::isValid()
1958 return validate_listings_params().empty();
1962 char const * const GuiDocument::fontfamilies[5] = {
1963 "default", "rmdefault", "sfdefault", "ttdefault", ""
1967 char const * GuiDocument::fontfamilies_gui[5] = {
1968 N_("Default"), N_("Roman"), N_("Sans Serif"), N_("Typewriter"), ""
1972 bool GuiDocument::initialiseParams(string const &)
1974 bp_ = buffer().params();
1980 void GuiDocument::clearParams()
1982 bp_ = BufferParams();
1986 BufferId GuiDocument::id() const
1992 vector<string> const & GuiDocument::getModuleNames()
1994 return moduleNames_;
1998 vector<string> const & GuiDocument::getSelectedModules()
2000 return params().getModules();
2004 TextClass const & GuiDocument::textClass() const
2006 return textclasslist[bp_.getBaseClass()];
2010 static void dispatch_bufferparams(Dialog const & dialog,
2011 BufferParams const & bp, kb_action lfun)
2014 ss << "\\begin_header\n";
2016 ss << "\\end_header\n";
2017 dialog.dispatch(FuncRequest(lfun, ss.str()));
2021 void GuiDocument::dispatchParams()
2023 // This must come first so that a language change is correctly noticed
2026 // Apply the BufferParams. Note that this will set the base class
2027 // and then update the buffer's layout.
2028 dispatch_bufferparams(*this, params(), LFUN_BUFFER_PARAMS_APPLY);
2030 // Generate the colours requested by each new branch.
2031 BranchList & branchlist = params().branchlist();
2032 if (!branchlist.empty()) {
2033 BranchList::const_iterator it = branchlist.begin();
2034 BranchList::const_iterator const end = branchlist.end();
2035 for (; it != end; ++it) {
2036 docstring const & current_branch = it->getBranch();
2037 Branch const * branch = branchlist.find(current_branch);
2038 string const x11hexname = X11hexname(branch->getColor());
2039 // display the new color
2040 docstring const str = current_branch + ' ' + from_ascii(x11hexname);
2041 dispatch(FuncRequest(LFUN_SET_COLOR, str));
2044 // Open insets of selected branches, close deselected ones
2045 dispatch(FuncRequest(LFUN_ALL_INSETS_TOGGLE,
2048 // FIXME: If we used an LFUN, we would not need those two lines:
2049 bufferview()->processUpdateFlags(Update::Force | Update::FitCursor);
2053 void GuiDocument::setLanguage() const
2055 Language const * const newL = bp_.language;
2056 if (buffer().params().language == newL)
2059 string const & lang_name = newL->lang();
2060 dispatch(FuncRequest(LFUN_BUFFER_LANGUAGE, lang_name));
2064 void GuiDocument::saveAsDefault() const
2066 dispatch_bufferparams(*this, params(), LFUN_BUFFER_SAVE_AS_DEFAULT);
2070 bool GuiDocument::isFontAvailable(string const & font) const
2072 if (font == "default" || font == "cmr"
2073 || font == "cmss" || font == "cmtt")
2074 // these are standard
2076 if (font == "lmodern" || font == "lmss" || font == "lmtt")
2077 return LaTeXFeatures::isAvailable("lmodern");
2078 if (font == "times" || font == "palatino"
2079 || font == "helvet" || font == "courier")
2080 return LaTeXFeatures::isAvailable("psnfss");
2081 if (font == "cmbr" || font == "cmtl")
2082 return LaTeXFeatures::isAvailable("cmbright");
2083 if (font == "utopia")
2084 return LaTeXFeatures::isAvailable("utopia")
2085 || LaTeXFeatures::isAvailable("fourier");
2086 if (font == "beraserif" || font == "berasans"
2087 || font == "beramono")
2088 return LaTeXFeatures::isAvailable("bera");
2089 return LaTeXFeatures::isAvailable(font);
2093 bool GuiDocument::providesOSF(string const & font) const
2096 return isFontAvailable("eco");
2097 if (font == "palatino")
2098 return isFontAvailable("mathpazo");
2103 bool GuiDocument::providesSC(string const & font) const
2105 if (font == "palatino")
2106 return isFontAvailable("mathpazo");
2107 if (font == "utopia")
2108 return isFontAvailable("fourier");
2113 bool GuiDocument::providesScale(string const & font) const
2115 return font == "helvet" || font == "luximono"
2116 || font == "berasans" || font == "beramono";
2120 void GuiDocument::loadModuleNames ()
2122 moduleNames_.clear();
2123 LyXModuleList::const_iterator it = moduleList.begin();
2124 for (; it != moduleList.end(); ++it)
2125 moduleNames_.push_back(it->getName());
2126 if (!moduleNames_.empty())
2127 sort(moduleNames_.begin(), moduleNames_.end());
2131 Dialog * createGuiDocument(GuiView & lv) { return new GuiDocument(lv); }
2134 } // namespace frontend
2137 #include "GuiDocument_moc.cpp"