};
+char const * lst_packages[] =
+{
+ "Listings", "Minted", ""
+};
+
+
vector<string> engine_types_;
vector<pair<string, QString> > pagestyles;
}
};
-}
+} // namespace
namespace frontend {
namespace {
connect(mathsModule->MathIndentLengthCO, SIGNAL(activated(int)),
this, SLOT(change_adaptor()));
-
+
mathsModule->MathIndentCO->addItem(qt_("Default"));
mathsModule->MathIndentCO->addItem(qt_("Custom"));
mathsModule->MathIndentLE->setValidator(new LengthValidator(
bc().addCheckedLineEdit(mathsModule->MathIndentLE);
mathsModule->MathNumberingPosCO->addItem(qt_("Left"));
mathsModule->MathNumberingPosCO->addItem(qt_("Default"));
- mathsModule->MathNumberingPosCO->setCurrentIndex(2);
-
+ mathsModule->MathNumberingPosCO->addItem(qt_("Right"));
+ mathsModule->MathNumberingPosCO->setCurrentIndex(1);
+
// latex class
latexModule = new UiWidget<Ui::LaTeXUi>(this);
this, SLOT(change_adaptor()));
connect(listingsModule->bypassCB, SIGNAL(clicked()),
this, SLOT(setListingsMessage()));
+ connect(listingsModule->packageCO, SIGNAL(activated(int)),
+ this, SLOT(change_adaptor()));
+ connect(listingsModule->packageCO, SIGNAL(activated(int)),
+ this, SLOT(listingsPackageChanged(int)));
connect(listingsModule->listingsED, SIGNAL(textChanged()),
this, SLOT(setListingsMessage()));
listingsModule->listingsTB->setPlainText(
qt_("Input listings parameters below. Enter ? for a list of parameters."));
+ for (int i = 0; lst_packages[i][0]; ++i)
+ listingsModule->packageCO->addItem(lst_packages[i]);
+
// add the panels
docPS->addPanel(latexModule, N_("Document Class"));
{
if (listingsModule->bypassCB->isChecked())
return QString();
+ string const package =
+ lst_packages[listingsModule->packageCO->currentIndex()];
string params = fromqstr(listingsModule->listingsED->toPlainText());
- return toqstr(InsetListingsParams(params).validate());
+ InsetListingsParams lstparams(params);
+ lstparams.setMinted(package == "Minted");
+ return toqstr(lstparams.validate());
}
}
+void GuiDocument::listingsPackageChanged(int index)
+{
+ string const package = lst_packages[index];
+ if (package == "Minted" && lyxrc.pygmentize_command.empty()) {
+ Alert::warning(_("Pygments driver command not found!"),
+ _("The driver command necessary to use the minted package\n"
+ "(pygmentize) has not been found. Make sure you have\n"
+ "the python-pygments module installed or, if the driver\n"
+ "is named differently, to add the following line to the\n"
+ "document preamble:\n\n"
+ "\\AtBeginDocument{\\renewcommand{\\MintedPygmentize}{driver}}\n\n"
+ "where 'driver' is name of the driver command."));
+ }
+}
+
+
void GuiDocument::setLSpacing(int item)
{
textLayoutModule->lspacingLE->setEnabled(item == 3);
}
switch (mathsModule->MathNumberingPosCO->currentIndex()) {
case 0:
- bp_.math_number_before = true;
+ bp_.math_numbering_side = BufferParams::LEFT;
break;
case 1:
- bp_.math_number_before = false;
+ bp_.math_numbering_side = BufferParams::DEFAULT;
+ break;
+ case 2:
+ bp_.math_numbering_side = BufferParams::RIGHT;
break;
default:
// this should never happen
- bp_.math_number_before = false;
+ bp_.math_numbering_side = BufferParams::DEFAULT;
break;
}
// Listings
// text should have passed validation
+ idx = listingsModule->packageCO->currentIndex();
+ bp_.use_minted = string(lst_packages[idx]) == "Minted";
bp_.listings_params =
InsetListingsParams(fromqstr(listingsModule->listingsED->toPlainText())).params();
biblioChanged_ = false;
// indices
- // We may be called when there is no Buffer, e.g., when
+ // We may be called when there is no Buffer, e.g., when
// the last view has just been closed.
bool const isReadOnly = isBufferAvailable() ? buffer().isReadonly() : false;
indicesModule->update(bp_, isReadOnly);
mathsModule->MathIndentCO->setCurrentIndex(indent);
enableMathIndent(indent);
}
- if (bp_.math_number_before)
+ switch(bp_.math_numbering_side) {
+ case BufferParams::LEFT:
mathsModule->MathNumberingPosCO->setCurrentIndex(0);
- else
+ break;
+ case BufferParams::DEFAULT:
mathsModule->MathNumberingPosCO->setCurrentIndex(1);
+ break;
+ case BufferParams::RIGHT:
+ mathsModule->MathNumberingPosCO->setCurrentIndex(2);
+ }
map<string, string> const & packages = BufferParams::auto_packages();
for (map<string, string>::const_iterator it = packages.begin();
string lstparams =
InsetListingsParams(bp_.listings_params).separatedParams();
listingsModule->listingsED->setPlainText(toqstr(lstparams));
+ int nn = findToken(lst_packages, bp_.use_minted ? "Minted" : "Listings");
+ if (nn >= 0)
+ listingsModule->packageCO->setCurrentIndex(nn);
+
// Fonts
// some languages only work with polyglossia/XeTeX
toqstr(bp_.fonts_cjk));
else
fontModule->cjkFontLE->setText(QString());
-
+
fontModule->microtypeCB->setChecked(bp_.use_microtype);
fontModule->dashesCB->setChecked(bp_.use_dash_ligatures);
fontModule->scaleTypewriterSB->setValue(bp_.fontsTypewriterScale());
fontModule->font_tt_scale = bp_.fonts_typewriter_scale[!bp_.useNonTeXFonts];
- int nn = findToken(GuiDocument::fontfamilies, bp_.fonts_default_family);
+ nn = findToken(GuiDocument::fontfamilies, bp_.fonts_default_family);
if (nn >= 0)
fontModule->fontsDefaultCO->setCurrentIndex(nn);