#include "Buffer.h"
#include "BufferParams.h"
#include "BufferView.h"
+#include "CiteEnginesList.h"
#include "Color.h"
#include "ColorCache.h"
+#include "Converter.h"
#include "Cursor.h"
#include "Encoding.h"
#include "FloatPlacement.h"
{
public:
///
- ModuleSelectionManager(
- QTreeView * availableLV,
- QListView * selectedLV,
- QPushButton * addPB,
- QPushButton * delPB,
- QPushButton * upPB,
- QPushButton * downPB,
- GuiIdListModel * availableModel,
- GuiIdListModel * selectedModel,
- GuiDocument const * container)
- : GuiSelectionManager(availableLV, selectedLV, addPB, delPB,
- upPB, downPB, availableModel, selectedModel), container_(container)
+ ModuleSelectionManager(QObject * parent,
+ QTreeView * availableLV,
+ QListView * selectedLV,
+ QPushButton * addPB,
+ QPushButton * delPB,
+ QPushButton * upPB,
+ QPushButton * downPB,
+ GuiIdListModel * availableModel,
+ GuiIdListModel * selectedModel,
+ GuiDocument const * container)
+ : GuiSelectionManager(parent, availableLV, selectedLV, addPB, delPB,
+ upPB, downPB, availableModel, selectedModel),
+ container_(container)
{}
///
void updateProvidedModules(LayoutModuleList const & pm)
//
/////////////////////////////////////////////////////////////////////
-PreambleModule::PreambleModule() : current_id_(0)
+PreambleModule::PreambleModule(QWidget * parent)
+ : UiWidget<Ui::PreambleUi>(parent), current_id_(0)
{
// This is not a memory leak. The object will be destroyed
// with this.
/////////////////////////////////////////////////////////////////////
-LocalLayout::LocalLayout() : current_id_(0), validated_(false)
+LocalLayout::LocalLayout(QWidget * parent)
+ : UiWidget<Ui::LocalLayoutUi>(parent), current_id_(0), validated_(false)
{
connect(locallayoutTE, SIGNAL(textChanged()), this, SLOT(textChanged()));
connect(validatePB, SIGNAL(clicked()), this, SLOT(validatePressed()));
// text layout
- textLayoutModule = new UiWidget<Ui::TextLayoutUi>;
+ textLayoutModule = new UiWidget<Ui::TextLayoutUi>(this);
connect(textLayoutModule->lspacingCO, SIGNAL(activated(int)),
this, SLOT(change_adaptor()));
connect(textLayoutModule->lspacingCO, SIGNAL(activated(int)),
// master/child handling
- masterChildModule = new UiWidget<Ui::MasterChildUi>;
+ masterChildModule = new UiWidget<Ui::MasterChildUi>(this);
connect(masterChildModule->childrenTW, SIGNAL(itemDoubleClicked(QTreeWidgetItem *, int)),
this, SLOT(includeonlyClicked(QTreeWidgetItem *, int)));
// Formats
- outputModule = new UiWidget<Ui::OutputUi>;
+ outputModule = new UiWidget<Ui::OutputUi>(this);
connect(outputModule->defaultFormatCO, SIGNAL(activated(int)),
this, SLOT(change_adaptor()));
this, SLOT(change_adaptor()));
// fonts
- fontModule = new FontModule;
+ fontModule = new FontModule(this);
connect(fontModule->osFontsCB, SIGNAL(clicked()),
this, SLOT(change_adaptor()));
connect(fontModule->osFontsCB, SIGNAL(toggled(bool)),
// page layout
- pageLayoutModule = new UiWidget<Ui::PageLayoutUi>;
+ pageLayoutModule = new UiWidget<Ui::PageLayoutUi>(this);
connect(pageLayoutModule->papersizeCO, SIGNAL(activated(int)),
this, SLOT(papersizeChanged(int)));
connect(pageLayoutModule->papersizeCO, SIGNAL(activated(int)),
// margins
- marginsModule = new UiWidget<Ui::MarginsUi>;
+ marginsModule = new UiWidget<Ui::MarginsUi>(this);
connect(marginsModule->marginCB, SIGNAL(toggled(bool)),
this, SLOT(setCustomMargins(bool)));
connect(marginsModule->marginCB, SIGNAL(clicked()),
// language & quote
- langModule = new UiWidget<Ui::LanguageUi>;
+ langModule = new UiWidget<Ui::LanguageUi>(this);
connect(langModule->languageCO, SIGNAL(activated(int)),
this, SLOT(change_adaptor()));
connect(langModule->languageCO, SIGNAL(activated(int)),
this, SLOT(change_adaptor()));
connect(langModule->languagePackageCO, SIGNAL(currentIndexChanged(int)),
this, SLOT(languagePackageChanged(int)));
+ connect(langModule->dynamicQuotesCB, SIGNAL(clicked()),
+ this, SLOT(change_adaptor()));
langModule->languagePackageLE->setValidator(new NoNewLineValidator(
langModule->languagePackageLE));
encodinglist.sort();
langModule->encodingCO->addItems(encodinglist);
- langModule->quoteStyleCO->addItem(
- qt_("``text''"),InsetQuotes::EnglishQuotes);
- langModule->quoteStyleCO->addItem(
- qt_("''text''"), InsetQuotes::SwedishQuotes);
- langModule->quoteStyleCO->addItem
- (qt_(",,text``"), InsetQuotes::GermanQuotes);
- langModule->quoteStyleCO->addItem(
- qt_(",,text''"), InsetQuotes::PolishQuotes);
- langModule->quoteStyleCO->addItem(
- qt_("<<text>>"), InsetQuotes::FrenchQuotes);
- langModule->quoteStyleCO->addItem(
- qt_(">>text<<"), InsetQuotes::DanishQuotes);
-
langModule->languagePackageCO->addItem(
qt_("Default"), toqstr("default"));
langModule->languagePackageCO->addItem(
// color
- colorModule = new UiWidget<Ui::ColorUi>;
+ colorModule = new UiWidget<Ui::ColorUi>(this);
connect(colorModule->fontColorPB, SIGNAL(clicked()),
this, SLOT(changeFontColor()));
connect(colorModule->delFontColorTB, SIGNAL(clicked()),
// numbering
- numberingModule = new UiWidget<Ui::NumberingUi>;
+ numberingModule = new UiWidget<Ui::NumberingUi>(this);
connect(numberingModule->depthSL, SIGNAL(valueChanged(int)),
this, SLOT(change_adaptor()));
connect(numberingModule->tocSL, SIGNAL(valueChanged(int)),
setSectionResizeMode(numberingModule->tocTW->header(), QHeaderView::ResizeToContents);
// biblio
- biblioModule = new UiWidget<Ui::BiblioUi>;
- connect(biblioModule->citeDefaultRB, SIGNAL(toggled(bool)),
- this, SLOT(setNumerical(bool)));
- connect(biblioModule->citeJurabibRB, SIGNAL(toggled(bool)),
- this, SLOT(setAuthorYear(bool)));
- connect(biblioModule->citeNatbibRB, SIGNAL(toggled(bool)),
- biblioModule->citationStyleL, SLOT(setEnabled(bool)));
- connect(biblioModule->citeNatbibRB, SIGNAL(toggled(bool)),
- biblioModule->citeStyleCO, SLOT(setEnabled(bool)));
- connect(biblioModule->citeDefaultRB, SIGNAL(clicked()),
- this, SLOT(biblioChanged()));
- connect(biblioModule->citeNatbibRB, SIGNAL(clicked()),
- this, SLOT(biblioChanged()));
+ biblioModule = new UiWidget<Ui::BiblioUi>(this);
+ connect(biblioModule->citeEngineCO, SIGNAL(activated(int)),
+ this, SLOT(citeEngineChanged(int)));
connect(biblioModule->citeStyleCO, SIGNAL(activated(int)),
- this, SLOT(biblioChanged()));
- connect(biblioModule->citeJurabibRB, SIGNAL(clicked()),
- this, SLOT(biblioChanged()));
+ this, SLOT(citeStyleChanged()));
connect(biblioModule->bibtopicCB, SIGNAL(clicked()),
this, SLOT(biblioChanged()));
+ connect(biblioModule->bibunitsCO, SIGNAL(activated(int)),
+ this, SLOT(biblioChanged()));
connect(biblioModule->bibtexCO, SIGNAL(activated(int)),
this, SLOT(bibtexChanged(int)));
connect(biblioModule->bibtexOptionsLE, SIGNAL(textChanged(QString)),
this, SLOT(biblioChanged()));
- connect(biblioModule->bibtexStyleLE, SIGNAL(textChanged(QString)),
+ connect(biblioModule->citePackageOptionsLE, SIGNAL(textChanged(QString)),
+ this, SLOT(biblioChanged()));
+ connect(biblioModule->defaultBiblioCO, SIGNAL(activated(int)),
+ this, SLOT(biblioChanged()));
+ connect(biblioModule->defaultBiblioCO, SIGNAL(editTextChanged(QString)),
this, SLOT(biblioChanged()));
+ connect(biblioModule->defaultBiblioCO, SIGNAL(editTextChanged(QString)),
+ this, SLOT(updateResetDefaultBiblio()));
+ connect(biblioModule->biblatexBbxCO, SIGNAL(activated(int)),
+ this, SLOT(biblioChanged()));
+ connect(biblioModule->biblatexBbxCO, SIGNAL(editTextChanged(QString)),
+ this, SLOT(updateResetDefaultBiblio()));
+ connect(biblioModule->biblatexCbxCO, SIGNAL(activated(int)),
+ this, SLOT(biblioChanged()));
+ connect(biblioModule->biblatexCbxCO, SIGNAL(editTextChanged(QString)),
+ this, SLOT(updateResetDefaultBiblio()));
+ connect(biblioModule->rescanBibliosPB, SIGNAL(clicked()),
+ this, SLOT(rescanBibFiles()));
+ connect(biblioModule->resetDefaultBiblioPB, SIGNAL(clicked()),
+ this, SLOT(resetDefaultBibfile()));
+ connect(biblioModule->resetCbxPB, SIGNAL(clicked()),
+ this, SLOT(resetDefaultCbxBibfile()));
+ connect(biblioModule->resetBbxPB, SIGNAL(clicked()),
+ this, SLOT(resetDefaultBbxBibfile()));
+ connect(biblioModule->matchBbxPB, SIGNAL(clicked()),
+ this, SLOT(matchBiblatexStyles()));
+
+ biblioModule->citeEngineCO->clear();
+ for (LyXCiteEngine const & cet : theCiteEnginesList) {
+ biblioModule->citeEngineCO->addItem(qt_(cet.getName()), toqstr(cet.getID()));
+ int const i = biblioModule->citeEngineCO->findData(toqstr(cet.getID()));
+ biblioModule->citeEngineCO->setItemData(i, qt_(cet.getDescription()),
+ Qt::ToolTipRole);
+ }
biblioModule->bibtexOptionsLE->setValidator(new NoNewLineValidator(
biblioModule->bibtexOptionsLE));
- biblioModule->bibtexStyleLE->setValidator(new NoNewLineValidator(
- biblioModule->bibtexStyleLE));
-
- biblioModule->citeStyleCO->addItem(qt_("Author-year"));
- biblioModule->citeStyleCO->addItem(qt_("Numerical"));
- biblioModule->citeStyleCO->setCurrentIndex(0);
+ biblioModule->defaultBiblioCO->lineEdit()->setValidator(new NoNewLineValidator(
+ biblioModule->defaultBiblioCO->lineEdit()));
// NOTE: we do not provide "custom" here for security reasons!
biblioModule->bibtexCO->clear();
// maths
- mathsModule = new UiWidget<Ui::MathsUi>;
+ mathsModule = new UiWidget<Ui::MathsUi>(this);
QStringList headers;
headers << qt_("Package") << qt_("Load automatically")
<< qt_("Load always") << qt_("Do not load");
// latex class
- latexModule = new UiWidget<Ui::LaTeXUi>;
+ latexModule = new UiWidget<Ui::LaTeXUi>(this);
connect(latexModule->optionsLE, SIGNAL(textChanged(QString)),
this, SLOT(change_adaptor()));
connect(latexModule->defaultOptionsCB, SIGNAL(clicked()),
// branches
- branchesModule = new GuiBranches;
+ branchesModule = new GuiBranches(this);
connect(branchesModule, SIGNAL(changed()),
this, SLOT(change_adaptor()));
connect(branchesModule, SIGNAL(renameBranches(docstring const &, docstring const &)),
// preamble
- preambleModule = new PreambleModule;
+ preambleModule = new PreambleModule(this);
connect(preambleModule, SIGNAL(changed()),
this, SLOT(change_adaptor()));
- localLayout = new LocalLayout;
+ localLayout = new LocalLayout(this);
connect(localLayout, SIGNAL(changed()),
this, SLOT(change_adaptor()));
// bullets
- bulletsModule = new BulletsModule;
+ bulletsModule = new BulletsModule(this);
connect(bulletsModule, SIGNAL(changed()),
this, SLOT(change_adaptor()));
// Modules
- modulesModule = new UiWidget<Ui::ModulesUi>;
+ modulesModule = new UiWidget<Ui::ModulesUi>(this);
modulesModule->availableLV->header()->setVisible(false);
setSectionResizeMode(modulesModule->availableLV->header(), QHeaderView::ResizeToContents);
modulesModule->availableLV->header()->setStretchLastSection(false);
selectionManager =
- new ModuleSelectionManager(modulesModule->availableLV,
- modulesModule->selectedLV,
- modulesModule->addPB, modulesModule->deletePB,
- modulesModule->upPB, modulesModule->downPB,
- availableModel(), selectedModel(), this);
+ new ModuleSelectionManager(this, modulesModule->availableLV,
+ modulesModule->selectedLV,
+ modulesModule->addPB,
+ modulesModule->deletePB,
+ modulesModule->upPB,
+ modulesModule->downPB,
+ availableModel(), selectedModel(), this);
connect(selectionManager, SIGNAL(updateHook()),
this, SLOT(updateModuleInfo()));
connect(selectionManager, SIGNAL(selectionChanged()),
// PDF support
- pdfSupportModule = new UiWidget<Ui::PDFSupportUi>;
+ pdfSupportModule = new UiWidget<Ui::PDFSupportUi>(this);
connect(pdfSupportModule->use_hyperrefGB, SIGNAL(toggled(bool)),
this, SLOT(change_adaptor()));
connect(pdfSupportModule->titleLE, SIGNAL(textChanged(QString)),
// listings
- listingsModule = new UiWidget<Ui::ListingsSettingsUi>;
+ listingsModule = new UiWidget<Ui::ListingsSettingsUi>(this);
connect(listingsModule->listingsED, SIGNAL(textChanged()),
this, SLOT(change_adaptor()));
connect(listingsModule->bypassCB, SIGNAL(clicked()),
}
-void GuiDocument::on_bufferViewChanged()
+void GuiDocument::onBufferViewChanged()
{
if (isVisibleView())
initialiseParams("");
}
+void GuiDocument::updateQuoteStyles(bool const set)
+{
+ Language const * lang = lyx::languages.getLanguage(
+ fromqstr(langModule->languageCO->itemData(
+ langModule->languageCO->currentIndex()).toString()));
+
+ InsetQuotesParams::QuoteStyle def = bp_.getQuoteStyle(lang->quoteStyle());
+
+ langModule->quoteStyleCO->clear();
+
+ bool has_default = false;
+ for (int i = 0; i < quoteparams.stylescount(); ++i) {
+ InsetQuotesParams::QuoteStyle qs = InsetQuotesParams::QuoteStyle(i);
+ if (qs == InsetQuotesParams::DynamicQuotes)
+ continue;
+ bool const langdef = (qs == def);
+ if (langdef) {
+ // add the default style on top
+ langModule->quoteStyleCO->insertItem(0,
+ toqstr(quoteparams.getGuiLabel(qs, langdef)), qs);
+ has_default = true;
+ }
+ else
+ langModule->quoteStyleCO->addItem(
+ toqstr(quoteparams.getGuiLabel(qs, langdef)), qs);
+ }
+ if (set && has_default)
+ // (re)set to the default style
+ langModule->quoteStyleCO->setCurrentIndex(0);
+}
+
+
void GuiDocument::languageChanged(int i)
{
// some languages only work with polyglossia
}
// set appropriate quotation mark style
- if (!lang->quoteStyle().empty()) {
- langModule->quoteStyleCO->setCurrentIndex(
- bp_.getQuoteStyle(lang->quoteStyle()));
- }
+ updateQuoteStyles(true);
}
}
-void GuiDocument::bibtexChanged(int n)
+void GuiDocument::rescanBibFiles()
{
- biblioModule->bibtexOptionsLE->setEnabled(
- biblioModule->bibtexCO->itemData(n).toString() != "default");
+ if (isBiblatex())
+ rescanTexStyles("bbx cbx");
+ else
+ rescanTexStyles("bst");
+}
+
+
+void GuiDocument::resetDefaultBibfile(string const & which)
+{
+ QString const engine =
+ biblioModule->citeEngineCO->itemData(
+ biblioModule->citeEngineCO->currentIndex()).toString();
+
+ CiteEngineType const cet =
+ CiteEngineType(biblioModule->citeStyleCO->itemData(
+ biblioModule->citeStyleCO->currentIndex()).toInt());
+
+ updateDefaultBiblio(theCiteEnginesList[fromqstr(engine)]->getDefaultBiblio(cet), which);
+}
+
+
+void GuiDocument::resetDefaultBbxBibfile()
+{
+ resetDefaultBibfile("bbx");
+}
+
+
+void GuiDocument::resetDefaultCbxBibfile()
+{
+ resetDefaultBibfile("cbx");
+}
+
+
+void GuiDocument::citeEngineChanged(int n)
+{
+ QString const engine =
+ biblioModule->citeEngineCO->itemData(n).toString();
+
+ vector<string> const engs =
+ theCiteEnginesList[fromqstr(engine)]->getEngineType();
+
+ updateCiteStyles(engs);
+ updateEngineDependends();
+ resetDefaultBibfile();
biblioChanged();
}
-void GuiDocument::setAuthorYear(bool authoryear)
+void GuiDocument::updateEngineDependends()
+{
+ bool const biblatex = isBiblatex();
+
+ // These are only useful with BibTeX
+ biblioModule->defaultBiblioCO->setEnabled(!biblatex);
+ biblioModule->bibtexStyleLA->setEnabled(!biblatex);
+ biblioModule->resetDefaultBiblioPB->setEnabled(!biblatex);
+ biblioModule->bibtopicCB->setEnabled(!biblatex);
+
+ // These are only useful with Biblatex
+ biblioModule->biblatexBbxCO->setEnabled(biblatex);
+ biblioModule->biblatexBbxLA->setEnabled(biblatex);
+ biblioModule->biblatexCbxCO->setEnabled(biblatex);
+ biblioModule->biblatexCbxLA->setEnabled(biblatex);
+ biblioModule->resetBbxPB->setEnabled(biblatex);
+ biblioModule->resetCbxPB->setEnabled(biblatex);
+ biblioModule->matchBbxPB->setEnabled(biblatex);
+
+ // These are useful with biblatex, jurabib and natbib
+ QString const engine =
+ biblioModule->citeEngineCO->itemData(
+ biblioModule->citeEngineCO->currentIndex()).toString();
+ LyXCiteEngine const * ce = theCiteEnginesList[fromqstr(engine)];
+
+ bool const citepack = ce->requires("biblatex.sty") || ce->requires("jurabib.sty")
+ || ce->requires("natbib.sty");
+ biblioModule->citePackageOptionsLE->setEnabled(citepack);
+ biblioModule->citePackageOptionsL->setEnabled(citepack);
+}
+
+
+void GuiDocument::citeStyleChanged()
{
- if (authoryear)
- biblioModule->citeStyleCO->setCurrentIndex(0);
+ QString const engine =
+ biblioModule->citeEngineCO->itemData(
+ biblioModule->citeEngineCO->currentIndex()).toString();
+ QString const currentDef = isBiblatex() ?
+ biblioModule->biblatexBbxCO->currentText()
+ : biblioModule->defaultBiblioCO->currentText();
+ if (theCiteEnginesList[fromqstr(engine)]->isDefaultBiblio(fromqstr(currentDef)))
+ resetDefaultBibfile();
+
biblioChanged();
}
-void GuiDocument::setNumerical(bool numerical)
+void GuiDocument::bibtexChanged(int n)
{
- if (numerical)
- biblioModule->citeStyleCO->setCurrentIndex(1);
+ biblioModule->bibtexOptionsLE->setEnabled(
+ biblioModule->bibtexCO->itemData(n).toString() != "default");
biblioChanged();
}
+void GuiDocument::updateCiteStyles(vector<string> const & engs, CiteEngineType const & sel)
+{
+ biblioModule->citeStyleCO->clear();
+
+ vector<string>::const_iterator it = engs.begin();
+ vector<string>::const_iterator end = engs.end();
+ for (; it != end; ++it) {
+ if (*it == "default")
+ biblioModule->citeStyleCO->addItem(qt_("Basic numerical"),
+ ENGINE_TYPE_DEFAULT);
+ else if (*it == "authoryear")
+ biblioModule->citeStyleCO->addItem(qt_("Author-year"),
+ ENGINE_TYPE_AUTHORYEAR);
+ else if (*it == "numerical")
+ biblioModule->citeStyleCO->addItem(qt_("Author-number"),
+ ENGINE_TYPE_NUMERICAL);
+ }
+ int i = biblioModule->citeStyleCO->findData(sel);
+ if (biblioModule->citeStyleCO->findData(sel) == -1)
+ i = 0;
+ biblioModule->citeStyleCO->setCurrentIndex(i);
+
+ biblioModule->citationStyleL->setEnabled(engs.size() > 1);
+ biblioModule->citeStyleCO->setEnabled(engs.size() > 1);
+}
+
+
void GuiDocument::updateEngineType(string const & items, CiteEngineType const & sel)
{
engine_types_.clear();
engine_types_.push_back(style);
}
- switch (sel) {
- case ENGINE_TYPE_AUTHORYEAR:
- biblioModule->citeStyleCO->setCurrentIndex(0);
- break;
- case ENGINE_TYPE_NUMERICAL:
- case ENGINE_TYPE_DEFAULT:
- biblioModule->citeStyleCO->setCurrentIndex(1);
- break;
- }
-
- biblioModule->citationStyleL->setEnabled(nn > 1);
- biblioModule->citeStyleCO->setEnabled(nn > 1);
-
- if (nn != 1)
- return;
-
- // If the textclass allows only one of authoryear or numerical,
- // we have no choice but to force that engine type.
- if (engine_types_[0] == "authoryear")
- biblioModule->citeStyleCO->setCurrentIndex(0);
- else
- biblioModule->citeStyleCO->setCurrentIndex(1);
+ updateCiteStyles(engine_types_, sel);
}
outputModule->defaultFormatCO->clear();
outputModule->defaultFormatCO->addItem(qt_("Default"),
QVariant(QString("default")));
- vector<Format const *> const & formats =
+ FormatList const & formats =
param_copy.exportableFormats(true);
for (Format const * f : formats)
outputModule->defaultFormatCO->addItem
bp_.use_refstyle = latexModule->refstyleCB->isChecked();
// biblio
- if (biblioModule->citeNatbibRB->isChecked())
- bp_.setCiteEngine("natbib");
- else if (biblioModule->citeJurabibRB->isChecked())
- bp_.setCiteEngine("jurabib");
- if (biblioModule->citeDefaultRB->isChecked()) {
- bp_.setCiteEngine("basic");
- bp_.setCiteEngineType(ENGINE_TYPE_DEFAULT);
- }
+ string const engine =
+ fromqstr(biblioModule->citeEngineCO->itemData(
+ biblioModule->citeEngineCO->currentIndex()).toString());
+ bp_.setCiteEngine(engine);
+
+ CiteEngineType const style = CiteEngineType(biblioModule->citeStyleCO->itemData(
+ biblioModule->citeStyleCO->currentIndex()).toInt());
+ if (theCiteEnginesList[engine]->hasEngineType(style))
+ bp_.setCiteEngineType(style);
else
- if (biblioModule->citeStyleCO->currentIndex())
- bp_.setCiteEngineType(ENGINE_TYPE_NUMERICAL);
- else
- bp_.setCiteEngineType(ENGINE_TYPE_AUTHORYEAR);
+ bp_.setCiteEngineType(ENGINE_TYPE_DEFAULT);
+
+ bp_.splitbib(biblioModule->bibtopicCB->isChecked());
+
+ bp_.multibib = fromqstr(biblioModule->bibunitsCO->itemData(
+ biblioModule->bibunitsCO->currentIndex()).toString());
- bp_.use_bibtopic =
- biblioModule->bibtopicCB->isChecked();
+ bp_.setDefaultBiblioStyle(fromqstr(biblioModule->defaultBiblioCO->currentText()));
- bp_.biblio_style = fromqstr(biblioModule->bibtexStyleLE->text());
+ bp_.biblatex_bibstyle = fromqstr(biblioModule->biblatexBbxCO->currentText());
+ bp_.biblatex_citestyle = fromqstr(biblioModule->biblatexCbxCO->currentText());
+ bp_.biblio_opts = fromqstr(biblioModule->citePackageOptionsLE->text());
string const bibtex_command =
fromqstr(biblioModule->bibtexCO->itemData(
}
}
- bp_.quotes_language = (InsetQuotes::QuoteLanguage) langModule->quoteStyleCO->itemData(
+ bp_.quotes_style = (InsetQuotesParams::QuoteStyle) langModule->quoteStyleCO->itemData(
langModule->quoteStyleCO->currentIndex()).toInt();
+ bp_.dynamic_quotes = langModule->dynamicQuotesCB->isChecked();
QString const langname = langModule->languageCO->itemData(
langModule->languageCO->currentIndex()).toString();
// biblio
string const cite_engine = bp_.citeEngine().list().front();
- biblioModule->citeDefaultRB->setChecked(
- cite_engine == "basic");
+ biblioModule->citeEngineCO->setCurrentIndex(
+ biblioModule->citeEngineCO->findData(toqstr(cite_engine)));
- biblioModule->citeJurabibRB->setChecked(
- cite_engine == "jurabib");
-
- biblioModule->citeNatbibRB->setChecked(
- cite_engine == "natbib");
+ updateEngineType(documentClass().opt_enginetype(),
+ bp_.citeEngineType());
biblioModule->citeStyleCO->setCurrentIndex(
- bp_.citeEngineType() & ENGINE_TYPE_NUMERICAL);
+ biblioModule->citeStyleCO->findData(bp_.citeEngineType()));
+
+ biblioModule->bibtopicCB->setChecked(bp_.splitbib());
+
+ biblioModule->bibunitsCO->clear();
+ biblioModule->bibunitsCO->addItem(qt_("No"), QString());
+ if (documentClass().hasLaTeXLayout("part"))
+ biblioModule->bibunitsCO->addItem(qt_("per part"), toqstr("part"));
+ if (documentClass().hasLaTeXLayout("chapter"))
+ biblioModule->bibunitsCO->addItem(qt_("per chapter"), toqstr("chapter"));
+ if (documentClass().hasLaTeXLayout("section"))
+ biblioModule->bibunitsCO->addItem(qt_("per section"), toqstr("section"));
+ if (documentClass().hasLaTeXLayout("subsection"))
+ biblioModule->bibunitsCO->addItem(qt_("per subsection"), toqstr("subsection"));
+ biblioModule->bibunitsCO->addItem(qt_("per child document"), toqstr("child"));
+
+ int const mbpos = biblioModule->bibunitsCO->findData(toqstr(bp_.multibib));
+ if (mbpos != -1)
+ biblioModule->bibunitsCO->setCurrentIndex(mbpos);
+ else
+ biblioModule->bibunitsCO->setCurrentIndex(0);
- updateEngineType(documentClass().opt_enginetype(),
- bp_.citeEngineType());
+ updateEngineDependends();
- biblioModule->bibtopicCB->setChecked(
- bp_.use_bibtopic);
+ if (isBiblatex()) {
+ updateDefaultBiblio(bp_.biblatex_bibstyle, "bbx");
+ updateDefaultBiblio(bp_.biblatex_citestyle, "cbx");
+ } else
+ updateDefaultBiblio(bp_.defaultBiblioStyle());
- biblioModule->bibtexStyleLE->setText(toqstr(bp_.biblio_style));
+ biblioModule->citePackageOptionsLE->setText(toqstr(bp_.biblio_opts));
string command;
string options =
bp_.language->lang()));
langModule->languageCO->setCurrentIndex(pos);
+ updateQuoteStyles();
+
langModule->quoteStyleCO->setCurrentIndex(
- bp_.quotes_language);
+ langModule->quoteStyleCO->findData(bp_.quotes_style));
+ langModule->dynamicQuotesCB->setChecked(bp_.dynamic_quotes);
bool default_enc = true;
if (bp_.inputenc != "auto") {
}
+bool GuiDocument::isBiblatex() const
+{
+ QString const engine =
+ biblioModule->citeEngineCO->itemData(
+ biblioModule->citeEngineCO->currentIndex()).toString();
+
+ return theCiteEnginesList[fromqstr(engine)]->getCiteFramework() == "biblatex";
+}
+
+
+void GuiDocument::updateDefaultBiblio(string const & style,
+ string const & which)
+{
+ QString const bibstyle = toqstr(style);
+ biblioModule->defaultBiblioCO->clear();
+
+ int item_nr = -1;
+
+ if (isBiblatex()) {
+ if (which != "cbx") {
+ // First the bbx styles
+ biblioModule->biblatexBbxCO->clear();
+ QStringList str = texFileList("bbxFiles.lst");
+ // test whether we have a valid list, otherwise run rescan
+ if (str.isEmpty()) {
+ rescanTexStyles("bbx");
+ str = texFileList("bbxFiles.lst");
+ }
+ for (int i = 0; i != str.size(); ++i)
+ str[i] = onlyFileName(str[i]);
+ // sort on filename only (no path)
+ str.sort();
+
+ for (int i = 0; i != str.count(); ++i) {
+ QString item = changeExtension(str[i], "");
+ if (item == bibstyle)
+ item_nr = i;
+ biblioModule->biblatexBbxCO->addItem(item);
+ }
+
+ if (item_nr == -1 && !bibstyle.isEmpty()) {
+ biblioModule->biblatexBbxCO->addItem(bibstyle);
+ item_nr = biblioModule->biblatexBbxCO->count() - 1;
+ }
+
+ if (item_nr != -1)
+ biblioModule->biblatexBbxCO->setCurrentIndex(item_nr);
+ else
+ biblioModule->biblatexBbxCO->clearEditText();
+ }
+
+ if (which != "bbx") {
+ // now the cbx styles
+ biblioModule->biblatexCbxCO->clear();
+ QStringList str = texFileList("cbxFiles.lst");
+ // test whether we have a valid list, otherwise run rescan
+ if (str.isEmpty()) {
+ rescanTexStyles("cbx");
+ str = texFileList("cbxFiles.lst");
+ }
+ for (int i = 0; i != str.size(); ++i)
+ str[i] = onlyFileName(str[i]);
+ // sort on filename only (no path)
+ str.sort();
+
+ for (int i = 0; i != str.count(); ++i) {
+ QString item = changeExtension(str[i], "");
+ if (item == bibstyle)
+ item_nr = i;
+ biblioModule->biblatexCbxCO->addItem(item);
+ }
+
+ if (item_nr == -1 && !bibstyle.isEmpty()) {
+ biblioModule->biblatexCbxCO->addItem(bibstyle);
+ item_nr = biblioModule->biblatexCbxCO->count() - 1;
+ }
+
+ if (item_nr != -1)
+ biblioModule->biblatexCbxCO->setCurrentIndex(item_nr);
+ else
+ biblioModule->biblatexCbxCO->clearEditText();
+ }
+ } else {// BibTeX
+ biblioModule->biblatexBbxCO->clear();
+ biblioModule->biblatexCbxCO->clear();
+ QStringList str = texFileList("bstFiles.lst");
+ // test whether we have a valid list, otherwise run rescan
+ if (str.isEmpty()) {
+ rescanTexStyles("bst");
+ str = texFileList("bstFiles.lst");
+ }
+ for (int i = 0; i != str.size(); ++i)
+ str[i] = onlyFileName(str[i]);
+ // sort on filename only (no path)
+ str.sort();
+
+ for (int i = 0; i != str.count(); ++i) {
+ QString item = changeExtension(str[i], "");
+ if (item == bibstyle)
+ item_nr = i;
+ biblioModule->defaultBiblioCO->addItem(item);
+ }
+
+ if (item_nr == -1 && !bibstyle.isEmpty()) {
+ biblioModule->defaultBiblioCO->addItem(bibstyle);
+ item_nr = biblioModule->defaultBiblioCO->count() - 1;
+ }
+
+ if (item_nr != -1)
+ biblioModule->defaultBiblioCO->setCurrentIndex(item_nr);
+ else
+ biblioModule->defaultBiblioCO->clearEditText();
+ }
+
+ updateResetDefaultBiblio();
+}
+
+
+void GuiDocument::updateResetDefaultBiblio()
+{
+ QString const engine =
+ biblioModule->citeEngineCO->itemData(
+ biblioModule->citeEngineCO->currentIndex()).toString();
+ CiteEngineType const cet =
+ CiteEngineType(biblioModule->citeStyleCO->itemData(
+ biblioModule->citeStyleCO->currentIndex()).toInt());
+
+ string const defbib = theCiteEnginesList[fromqstr(engine)]->getDefaultBiblio(cet);
+ if (isBiblatex()) {
+ QString const bbx = biblioModule->biblatexBbxCO->currentText();
+ QString const cbx = biblioModule->biblatexCbxCO->currentText();
+ biblioModule->resetCbxPB->setEnabled(defbib != fromqstr(cbx));
+ biblioModule->resetBbxPB->setEnabled(defbib != fromqstr(bbx));
+ biblioModule->matchBbxPB->setEnabled(bbx != cbx && !cbx.isEmpty()
+ && biblioModule->biblatexBbxCO->findText(cbx) != -1);
+ } else
+ biblioModule->resetDefaultBiblioPB->setEnabled(
+ defbib != fromqstr(biblioModule->defaultBiblioCO->currentText()));
+}
+
+
+void GuiDocument::matchBiblatexStyles()
+{
+ updateDefaultBiblio(fromqstr(biblioModule->biblatexCbxCO->currentText()), "bbx");
+ biblioChanged();
+}
+
+
void GuiDocument::updateContents()
{
// Nothing to do here as the document settings is not cursor dependant.