// Always put the default encoding in the first position.
langModule->encodingCO->addItem(qt_("Language Default (no inputenc)"));
QStringList encodinglist;
- Encodings::const_iterator it = encodings.begin();
- Encodings::const_iterator const end = encodings.end();
- for (; it != end; ++it)
- if (!it->unsafe())
- encodinglist.append(qt_(it->guiName()));
+ for (auto const & encvar : encodings) {
+ if (!encvar.unsafe() && !encvar.guiName().empty())
+ encodinglist.append(qt_(encvar.guiName()));
+ }
encodinglist.sort();
langModule->encodingCO->addItems(encodinglist);
this, SLOT(updateResetDefaultBiblio()));
connect(biblioModule->biblatexBbxCO, SIGNAL(activated(int)),
this, SLOT(biblioChanged()));
+ connect(biblioModule->biblatexBbxCO, SIGNAL(editTextChanged(QString)),
+ 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(biblioChanged()));
connect(biblioModule->biblatexCbxCO, SIGNAL(editTextChanged(QString)),
this, SLOT(updateResetDefaultBiblio()));
connect(biblioModule->rescanBibliosPB, SIGNAL(clicked()),
fontModule->fontsRomanCO->currentIndex()).toString();
fontModule->fontScCB->setEnabled(providesSC(font));
fontModule->fontOsfCB->setEnabled(providesOSF(font));
- fontModule->dashesCB->setEnabled(tex_fonts);
updateMathFonts(font);
}
}
+void GuiDocument::checkPossibleCiteEngines()
+{
+ // Check if the class provides a specific engine,
+ // and if so, enforce this.
+ string force_engine;
+ if (documentClass().provides("natbib")
+ || documentClass().provides("natbib-internal"))
+ force_engine = "natbib";
+ else if (documentClass().provides("jurabib"))
+ force_engine = "jurabib";
+ else if (documentClass().provides("biblatex"))
+ force_engine = "biblatex";
+ else if (documentClass().provides("biblatex-natbib"))
+ force_engine = "biblatex-natbib";
+
+ if (!force_engine.empty())
+ biblioModule->citeEngineCO->setCurrentIndex(
+ biblioModule->citeEngineCO->findData(toqstr(force_engine)));
+ biblioModule->citeEngineCO->setEnabled(force_engine.empty());
+}
+
+
void GuiDocument::rescanBibFiles()
{
if (isBiblatex())
fromqstr(fontModule->cjkFontLE->text());
bp_.use_microtype = fontModule->microtypeCB->isChecked();
- bp_.use_dash_ligatures = fontModule->dashesCB->isChecked();
+ bp_.use_dash_ligatures = !fontModule->dashesCB->isChecked();
bp_.fonts_sans_scale[nontexfonts] = fontModule->scaleSansSB->value();
bp_.fonts_sans_scale[!nontexfonts] = fontModule->font_sf_scale;
updateEngineType(documentClass().opt_enginetype(),
bp_.citeEngineType());
+ checkPossibleCiteEngines();
+
biblioModule->citeStyleCO->setCurrentIndex(
biblioModule->citeStyleCO->findData(bp_.citeEngineType()));
fontModule->cjkFontLE->setText(QString());
fontModule->microtypeCB->setChecked(bp_.use_microtype);
- fontModule->dashesCB->setChecked(bp_.use_dash_ligatures);
+ fontModule->dashesCB->setChecked(!bp_.use_dash_ligatures);
fontModule->fontScCB->setChecked(bp_.fonts_expert_sc);
fontModule->fontOsfCB->setChecked(bp_.fonts_old_figures);
biblioModule->citeEngineCO->itemData(
biblioModule->citeEngineCO->currentIndex()).toString();
+ // this can happen if the cite engine is unknown, which can happen
+ // if one is using a file that came from someone else, etc. in that
+ // case, we crash if we proceed.
+ if (engine.isEmpty())
+ return false;
+
return theCiteEnginesList[fromqstr(engine)]->getCiteFramework() == "biblatex";
}
}
bp_.useClassDefaults();
paramsToDialog();
+ changed();
}
// We need a non-const buffer object.
Buffer & buf = const_cast<BufferView *>(bufferview())->buffer();
// There may be several undo records; group them (bug #8998)
- buf.undo().beginUndoGroup();
+ // This handles undo groups automagically
+ UndoGroupHelper ugh(&buf);
// This must come first so that a language change is correctly noticed
setLanguage();
// If we used an LFUN, we would not need these two lines:
BufferView * bv = const_cast<BufferView *>(bufferview());
bv->processUpdateFlags(Update::Force | Update::FitCursor);
-
- // Don't forget to close the group. Note that it is important
- // to check that there is no early return in the method.
- buf.undo().endUndoGroup();
}