toqstr("<p style=\"color: #c00000; font-weight: bold; \">")
+ invalid + toqstr("</p>");
- string const layout = fromqstr(locallayoutTE->document()->toPlainText());
- if (layout.empty())
+ string const layout =
+ fromqstr(locallayoutTE->document()->toPlainText().trimmed());
+ if (layout.empty()) {
is_valid_ = true;
- else
+ infoLB->setText("");
+ } else {
is_valid_ = TextClass::validate(layout);
- infoLB->setText(is_valid_ ? vtext : ivtext);
+ infoLB->setText(is_valid_ ? vtext : ivtext);
+ }
validatePB->setEnabled(false);
}
// output
outputModule = new UiWidget<Ui::OutputUi>;
- connect(outputModule->xetexCB, SIGNAL(clicked()),
- this, SLOT(change_adaptor()));
- connect(outputModule->xetexCB, SIGNAL(toggled(bool)),
- this, SLOT(xetexChanged(bool)));
connect(outputModule->defaultFormatCO, SIGNAL(activated(int)),
this, SLOT(change_adaptor()));
connect(outputModule->mathimgSB, SIGNAL(valueChanged(double)),
// fonts
fontModule = new UiWidget<Ui::FontUi>;
+ connect(fontModule->osFontsCB, SIGNAL(clicked()),
+ this, SLOT(change_adaptor()));
+ connect(fontModule->osFontsCB, SIGNAL(toggled(bool)),
+ this, SLOT(osFontsChanged(bool)));
connect(fontModule->fontsRomanCO, SIGNAL(activated(int)),
this, SLOT(change_adaptor()));
connect(fontModule->fontsRomanCO, SIGNAL(activated(int)),
mathsModule->esintCB, SLOT(setDisabled(bool)));
connect(mathsModule->mhchemautoCB, SIGNAL(toggled(bool)),
mathsModule->mhchemCB, SLOT(setDisabled(bool)));
+ connect(mathsModule->mathdotsautoCB, SIGNAL(toggled(bool)),
+ mathsModule->mathdotsCB, SLOT(setDisabled(bool)));
connect(mathsModule->amsCB, SIGNAL(clicked()),
this, SLOT(change_adaptor()));
this, SLOT(change_adaptor()));
connect(mathsModule->mhchemautoCB, SIGNAL(clicked()),
this, SLOT(change_adaptor()));
-
+ connect(mathsModule->mathdotsCB, SIGNAL(clicked()),
+ this, SLOT(change_adaptor()));
+ connect(mathsModule->mathdotsautoCB, SIGNAL(clicked()),
+ this, SLOT(change_adaptor()));
+
// latex class
latexModule = new UiWidget<Ui::LaTeXUi>;
this, SLOT(browseMaster()));
connect(latexModule->suppressDateCB, SIGNAL(clicked()),
this, SLOT(change_adaptor()));
+ connect(latexModule->refstyleCB, SIGNAL(clicked()),
+ this, SLOT(change_adaptor()));
// postscript drivers
for (int n = 0; tex_graphics[n][0]; ++n) {
docPS->addPanel(latexModule, qt_("Document Class"));
docPS->addPanel(masterChildModule, qt_("Child Documents"));
docPS->addPanel(modulesModule, qt_("Modules"));
+ docPS->addPanel(localLayout, qt_("Local Layout"));
docPS->addPanel(fontModule, qt_("Fonts"));
docPS->addPanel(textLayoutModule, qt_("Text Layout"));
docPS->addPanel(pageLayoutModule, qt_("Page Layout"));
docPS->addPanel(branchesModule, qt_("Branches"));
docPS->addPanel(outputModule, qt_("Output"));
docPS->addPanel(preambleModule, qt_("LaTeX Preamble"));
- docPS->addPanel(localLayout, qt_("Local Layout"));
docPS->setCurrentPanel(qt_("Document Class"));
// FIXME: hack to work around resizing bug in Qt >= 4.2
// bug verified with Qt 4.2.{0-3} (JSpitzm)
}
-void GuiDocument::xetexChanged(bool xetex)
+void GuiDocument::osFontsChanged(bool nontexfonts)
{
+ bool const tex_fonts = !nontexfonts;
updateFontlist();
updateDefaultFormat();
- langModule->encodingCO->setEnabled(!xetex &&
+ langModule->encodingCO->setEnabled(tex_fonts &&
!langModule->defaultencodingRB->isChecked());
- langModule->defaultencodingRB->setEnabled(!xetex);
- langModule->otherencodingRB->setEnabled(!xetex);
+ langModule->defaultencodingRB->setEnabled(tex_fonts);
+ langModule->otherencodingRB->setEnabled(tex_fonts);
- fontModule->fontsDefaultCO->setEnabled(!xetex);
- fontModule->fontsDefaultLA->setEnabled(!xetex);
- fontModule->cjkFontLE->setEnabled(!xetex);
- fontModule->cjkFontLA->setEnabled(!xetex);
+ fontModule->fontsDefaultCO->setEnabled(tex_fonts);
+ fontModule->fontsDefaultLA->setEnabled(tex_fonts);
+ fontModule->cjkFontLE->setEnabled(tex_fonts);
+ fontModule->cjkFontLA->setEnabled(tex_fonts);
string font;
- if (!xetex)
+ if (tex_fonts)
font = tex_fonts_sans[fontModule->fontsSansCO->currentIndex()];
bool scaleable = providesScale(font);
fontModule->scaleSansSB->setEnabled(scaleable);
fontModule->scaleSansLA->setEnabled(scaleable);
- if (!xetex)
+ if (tex_fonts)
font = tex_fonts_monospaced[fontModule->fontsTypewriterCO->currentIndex()];
scaleable = providesScale(font);
fontModule->scaleTypewriterSB->setEnabled(scaleable);
fontModule->scaleTypewriterLA->setEnabled(scaleable);
- if (!xetex)
+ if (tex_fonts)
font = tex_fonts_roman[fontModule->fontsRomanCO->currentIndex()];
fontModule->fontScCB->setEnabled(providesSC(font));
fontModule->fontOsfCB->setEnabled(providesOSF(font));
- fontModule->fontencLA->setEnabled(!xetex);
- fontModule->fontencCO->setEnabled(!xetex);
- if (xetex)
+ fontModule->fontencLA->setEnabled(tex_fonts);
+ fontModule->fontencCO->setEnabled(tex_fonts);
+ if (!tex_fonts)
fontModule->fontencLE->setEnabled(false);
else
fontencChanged(fontModule->fontencCO->currentIndex());
fontModule->fontsTypewriterCO->clear();
// With XeTeX, we have access to all system fonts, but not the LaTeX fonts
- if (outputModule->xetexCB->isChecked()) {
+ if (fontModule->osFontsCB->isChecked()) {
fontModule->fontsRomanCO->addItem(qt_("Default"));
fontModule->fontsSansCO->addItem(qt_("Default"));
fontModule->fontsTypewriterCO->addItem(qt_("Default"));
void GuiDocument::romanChanged(int item)
{
- if (outputModule->xetexCB->isChecked())
+ if (fontModule->osFontsCB->isChecked())
return;
string const font = tex_fonts_roman[item];
fontModule->fontScCB->setEnabled(providesSC(font));
void GuiDocument::sansChanged(int item)
{
- if (outputModule->xetexCB->isChecked())
+ if (fontModule->osFontsCB->isChecked())
return;
string const font = tex_fonts_sans[item];
bool scaleable = providesScale(font);
void GuiDocument::ttChanged(int item)
{
- if (outputModule->xetexCB->isChecked())
+ if (fontModule->osFontsCB->isChecked())
return;
string const font = tex_fonts_monospaced[item];
bool scaleable = providesScale(font);
namespace {
+ // FIXME unicode
+ // both of these should take a vector<docstring>
+
// This is an insanely complicated attempt to make this sort of thing
// work with RTL languages.
docstring formatStrVec(vector<string> const & v, docstring const & s)
if (v.size() == 0)
return docstring();
if (v.size() == 1)
- return from_utf8(v[0]);
+ return translateIfPossible(from_utf8(v[0]));
if (v.size() == 2) {
docstring retval = _("%1$s and %2$s");
retval = subst(retval, _("and"), s);
- return bformat(retval, from_utf8(v[0]), from_utf8(v[1]));
+ return bformat(retval, translateIfPossible(from_utf8(v[0])),
+ translateIfPossible(from_utf8(v[1])));
}
// The idea here is to format all but the last two items...
int const vSize = v.size();
docstring t2 = _("%1$s, %2$s");
- docstring retval = from_utf8(v[0]);
+ docstring retval = translateIfPossible(from_utf8(v[0]));
for (int i = 1; i < vSize - 2; ++i)
- retval = bformat(t2, retval, from_utf8(v[i]));
+ retval = bformat(t2, retval, translateIfPossible(from_utf8(v[i])));
//...and then to plug them, and the last two, into this schema
docstring t = _("%1$s, %2$s, and %3$s");
t = subst(t, _("and"), s);
- return bformat(t, retval, from_utf8(v[vSize - 2]), from_utf8(v[vSize - 1]));
+ return bformat(t, retval, translateIfPossible(from_utf8(v[vSize - 2])),
+ translateIfPossible(from_utf8(v[vSize - 1])));
}
vector<string> idsToNames(vector<string> const & idList)
for (; it != end; ++it) {
LyXModule const * const mod = theModuleList[*it];
if (!mod)
- retval.push_back(to_utf8(bformat(_("%1$s (unavailable)"), from_utf8(*it))));
+ retval.push_back(to_utf8(bformat(_("%1$s (unavailable)"),
+ translateIfPossible(from_utf8(*it)))));
else
retval.push_back(mod->getName());
}
pkgdesc = formatStrVec(reqdescs, _("or"));
if (!desc.empty())
desc += "\n";
- desc += bformat(_("Module required: %1$s."), pkgdesc);
+ desc += bformat(_("Modules required: %1$s."), pkgdesc);
}
pkglist = getExcludedList(modName);
return;
// make a copy in order to consider unapplied changes
Buffer * tmpbuf = buffer().clone();
- tmpbuf->params().useXetex = outputModule->xetexCB->isChecked();
+ tmpbuf->params().useNonTeXFonts =
+ fontModule->osFontsCB->isChecked();
int idx = latexModule->classCO->currentIndex();
if (idx >= 0) {
string const classname = classes_model_.getIDString(idx);
// date
bp_.suppress_date = latexModule->suppressDateCB->isChecked();
+ bp_.use_refstyle = latexModule->refstyleCB->isChecked();
// biblio
bp_.setCiteEngine(ENGINE_BASIC);
bp_.user_defined_bullet(3) = bulletsModule->bullet(3);
// packages
- bp_.graphicsDriver =
+ bp_.graphics_driver =
tex_graphics[latexModule->psdriverCO->currentIndex()];
// text layout
modulesToParams(bp_);
// Math
- if (mathsModule->amsautoCB->isChecked()) {
+ if (mathsModule->amsautoCB->isChecked())
bp_.use_amsmath = BufferParams::package_auto;
- } else {
+ else {
if (mathsModule->amsCB->isChecked())
bp_.use_amsmath = BufferParams::package_on;
else
else
bp_.use_mhchem = BufferParams::package_off;
}
-
+ if (mathsModule->mathdotsautoCB->isChecked())
+ bp_.use_mathdots = BufferParams::package_auto;
+ else {
+ if (mathsModule->mathdotsCB->isChecked())
+ bp_.use_mathdots = BufferParams::package_on;
+ else
+ bp_.use_mathdots = BufferParams::package_off;
+ }
+
// Page Layout
if (pageLayoutModule->pagestyleCO->currentIndex() == 0)
bp_.pagestyle = "default";
InsetListingsParams(fromqstr(listingsModule->listingsED->toPlainText())).params();
// output
- bp_.defaultOutputFormat = fromqstr(outputModule->defaultFormatCO->itemData(
+ bp_.default_output_format = fromqstr(outputModule->defaultFormatCO->itemData(
outputModule->defaultFormatCO->currentIndex()).toString());
- bool const xetex = outputModule->xetexCB->isChecked();
- bp_.useXetex = xetex;
+ bool const nontexfonts = fontModule->osFontsCB->isChecked();
+ bp_.useNonTeXFonts = nontexfonts;
bp_.output_sync = outputModule->outputsyncCB->isChecked();
bp_.output_sync_macro = fromqstr(outputModule->synccustomCB->currentText());
bp_.html_math_img_scale = outputModule->mathimgSB->value();
// fonts
- if (xetex) {
+ if (nontexfonts) {
if (fontModule->fontsRomanCO->currentIndex() == 0)
- bp_.fontsRoman = "default";
+ bp_.fonts_roman = "default";
else
- bp_.fontsRoman =
+ bp_.fonts_roman =
fromqstr(fontModule->fontsRomanCO->currentText());
if (fontModule->fontsSansCO->currentIndex() == 0)
- bp_.fontsSans = "default";
+ bp_.fonts_sans = "default";
else
- bp_.fontsSans =
+ bp_.fonts_sans =
fromqstr(fontModule->fontsSansCO->currentText());
if (fontModule->fontsTypewriterCO->currentIndex() == 0)
- bp_.fontsTypewriter = "default";
+ bp_.fonts_typewriter = "default";
else
- bp_.fontsTypewriter =
+ bp_.fonts_typewriter =
fromqstr(fontModule->fontsTypewriterCO->currentText());
} else {
- bp_.fontsRoman =
+ bp_.fonts_roman =
tex_fonts_roman[fontModule->fontsRomanCO->currentIndex()];
- bp_.fontsSans =
+ bp_.fonts_sans =
tex_fonts_sans[fontModule->fontsSansCO->currentIndex()];
- bp_.fontsTypewriter =
+ bp_.fonts_typewriter =
tex_fonts_monospaced[fontModule->fontsTypewriterCO->currentIndex()];
}
else if (fontModule->fontencCO->currentIndex() == 2)
bp_.fontenc = "default";
- bp_.fontsCJK =
+ bp_.fonts_cjk =
fromqstr(fontModule->cjkFontLE->text());
- bp_.fontsSansScale = fontModule->scaleSansSB->value();
+ bp_.fonts_sans_scale = fontModule->scaleSansSB->value();
- bp_.fontsTypewriterScale = fontModule->scaleTypewriterSB->value();
+ bp_.fonts_typewriter_scale = fontModule->scaleTypewriterSB->value();
- bp_.fontsSC = fontModule->fontScCB->isChecked();
+ bp_.fonts_expert_sc = fontModule->fontScCB->isChecked();
- bp_.fontsOSF = fontModule->fontOsfCB->isChecked();
+ bp_.fonts_old_figures = fontModule->fontOsfCB->isChecked();
- if (xetex)
- bp_.fontsDefaultFamily = "default";
+ if (nontexfonts)
+ bp_.fonts_default_family = "default";
else
- bp_.fontsDefaultFamily = GuiDocument::fontfamilies[
+ bp_.fonts_default_family = GuiDocument::fontfamilies[
fontModule->fontsDefaultCO->currentIndex()];
if (fontModule->fontsizeCO->currentIndex() == 0)
// date
latexModule->suppressDateCB->setChecked(bp_.suppress_date);
+ latexModule->refstyleCB->setChecked(bp_.use_refstyle);
// biblio
biblioModule->citeDefaultRB->setChecked(
bulletsModule->init();
// packages
- int nitem = findToken(tex_graphics, bp_.graphicsDriver);
+ int nitem = findToken(tex_graphics, bp_.graphics_driver);
if (nitem >= 0)
latexModule->psdriverCO->setCurrentIndex(nitem);
updateModuleInfo();
mathsModule->mhchemautoCB->setChecked(
bp_.use_mhchem == BufferParams::package_auto);
+ mathsModule->mathdotsCB->setChecked(
+ bp_.use_mathdots == BufferParams::package_on);
+ mathsModule->mathdotsautoCB->setChecked(
+ bp_.use_mathdots == BufferParams::package_auto);
+
switch (bp_.spacing().getSpace()) {
case Spacing::Other: nitem = 3; break;
case Spacing::Double: nitem = 2; break;
}
// Master/Child
- std::vector<Buffer *> children;
- if (bufferview())
- children = buffer().getChildren(false);
- if (children.empty()) {
+ if (!bufferview() || !buffer().hasChildren()) {
masterChildModule->childrenTW->clear();
includeonlys_.clear();
docPS->showPanel(qt_("Child Documents"), false);
// update combobox with formats
updateDefaultFormat();
int index = outputModule->defaultFormatCO->findData(toqstr(
- bp_.defaultOutputFormat));
+ bp_.default_output_format));
// set to default if format is not found
if (index == -1)
index = 0;
outputModule->defaultFormatCO->setCurrentIndex(index);
- outputModule->xetexCB->setEnabled(bp_.baseClass()->outputType() == lyx::LATEX);
- outputModule->xetexCB->setChecked(
- bp_.baseClass()->outputType() == lyx::LATEX && bp_.useXetex);
+ fontModule->osFontsCB->setEnabled(bp_.baseClass()->outputType() == lyx::LATEX);
+ fontModule->osFontsCB->setChecked(
+ bp_.baseClass()->outputType() == lyx::LATEX && bp_.useNonTeXFonts);
outputModule->outputsyncCB->setChecked(bp_.output_sync);
outputModule->synccustomCB->setEditText(toqstr(bp_.output_sync_macro));
updateFontsize(documentClass().opt_fontsize(),
bp_.fontsize);
- if (bp_.useXetex) {
+ if (bp_.useNonTeXFonts) {
fontModule->fontencLA->setEnabled(false);
fontModule->fontencCO->setEnabled(false);
fontModule->fontencLE->setEnabled(false);
for (int i = 0; i < fontModule->fontsRomanCO->count(); ++i) {
- if (fontModule->fontsRomanCO->itemText(i) == toqstr(bp_.fontsRoman)) {
+ if (fontModule->fontsRomanCO->itemText(i) == toqstr(bp_.fonts_roman)) {
fontModule->fontsRomanCO->setCurrentIndex(i);
- return;
+ break;
}
}
for (int i = 0; i < fontModule->fontsSansCO->count(); ++i) {
- if (fontModule->fontsSansCO->itemText(i) == toqstr(bp_.fontsSans)) {
+ if (fontModule->fontsSansCO->itemText(i) == toqstr(bp_.fonts_sans)) {
fontModule->fontsSansCO->setCurrentIndex(i);
- return;
+ break;
}
}
for (int i = 0; i < fontModule->fontsTypewriterCO->count(); ++i) {
if (fontModule->fontsTypewriterCO->itemText(i) ==
- toqstr(bp_.fontsTypewriter)) {
+ toqstr(bp_.fonts_typewriter)) {
fontModule->fontsTypewriterCO->setCurrentIndex(i);
- return;
+ break;
}
}
} else {
fontModule->fontencLA->setEnabled(true);
fontModule->fontencCO->setEnabled(true);
fontModule->fontencLE->setEnabled(true);
- int n = findToken(tex_fonts_roman, bp_.fontsRoman);
+ int n = findToken(tex_fonts_roman, bp_.fonts_roman);
if (n >= 0) {
fontModule->fontsRomanCO->setCurrentIndex(n);
romanChanged(n);
}
- n = findToken(tex_fonts_sans, bp_.fontsSans);
+ n = findToken(tex_fonts_sans, bp_.fonts_sans);
if (n >= 0) {
fontModule->fontsSansCO->setCurrentIndex(n);
sansChanged(n);
}
- n = findToken(tex_fonts_monospaced, bp_.fontsTypewriter);
+ n = findToken(tex_fonts_monospaced, bp_.fonts_typewriter);
if (n >= 0) {
fontModule->fontsTypewriterCO->setCurrentIndex(n);
ttChanged(n);
}
}
- if (!bp_.fontsCJK.empty())
+ if (!bp_.fonts_cjk.empty())
fontModule->cjkFontLE->setText(
- toqstr(bp_.fontsCJK));
+ toqstr(bp_.fonts_cjk));
else
fontModule->cjkFontLE->setText(QString());
- fontModule->fontScCB->setChecked(bp_.fontsSC);
- fontModule->fontOsfCB->setChecked(bp_.fontsOSF);
- fontModule->scaleSansSB->setValue(bp_.fontsSansScale);
- fontModule->scaleTypewriterSB->setValue(bp_.fontsTypewriterScale);
+ fontModule->fontScCB->setChecked(bp_.fonts_expert_sc);
+ fontModule->fontOsfCB->setChecked(bp_.fonts_old_figures);
+ fontModule->scaleSansSB->setValue(bp_.fonts_sans_scale);
+ fontModule->scaleTypewriterSB->setValue(bp_.fonts_typewriter_scale);
- int nn = findToken(GuiDocument::fontfamilies, bp_.fontsDefaultFamily);
+ int nn = findToken(GuiDocument::fontfamilies, bp_.fonts_default_family);
if (nn >= 0)
fontModule->fontsDefaultCO->setCurrentIndex(nn);
masterChildModule->maintainAuxCB->setEnabled(true);
}
QTreeWidgetItem * item = 0;
- std::vector<Buffer *> children = buffer().getChildren(false);
- vector<Buffer *>::const_iterator it = children.begin();
- vector<Buffer *>::const_iterator end = children.end();
+ ListOfBuffers children = buffer().getChildren();
+ ListOfBuffers::const_iterator it = children.begin();
+ ListOfBuffers::const_iterator end = children.end();
bool has_unincluded = false;
bool all_unincluded = true;
for (; it != end; ++it) {
dispatch(FuncRequest(LFUN_SET_COLOR, str));
}
}
- // FIXME: If we used an LFUN, we would not need those two lines:
+ // FIXME LFUN
+ // If we used an LFUN, we would not need these two lines:
BufferView * bv = const_cast<BufferView *>(bufferview());
bv->processUpdateFlags(Update::Force | Update::FitCursor);
}
bool GuiDocument::providesOSF(string const & font) const
{
- if (outputModule->xetexCB->isChecked())
+ if (fontModule->osFontsCB->isChecked())
// FIXME: we should check if the fonts really
// have OSF support. But how?
return true;
bool GuiDocument::providesSC(string const & font) const
{
- if (outputModule->xetexCB->isChecked())
+ if (fontModule->osFontsCB->isChecked())
return false;
if (font == "palatino")
return isFontAvailable("mathpazo");
bool GuiDocument::providesScale(string const & font) const
{
- if (outputModule->xetexCB->isChecked())
+ if (fontModule->osFontsCB->isChecked())
return true;
return font == "helvet" || font == "luximono"
|| font == "berasans" || font == "beramono";