bool InsetMathHull::previewState(BufferView * bv) const
{
- if (!editing(bv) && RenderPreview::status() == LyXRC::PREVIEW_ON) {
+ if (!editing(bv) && RenderPreview::status() == LyXRC::PREVIEW_ON
+ && type_ != hullRegexp)
+ {
graphics::PreviewImage const * pimage =
preview_->getPreviewImage(bv->buffer());
return pimage && pimage->image();
void InsetMathHull::preparePreview(DocIterator const & pos,
- bool forexport) const
+ bool forexport) const
{
// there is no need to do all the macro stuff if we're not
// actually going to generate the preview.
if (RenderPreview::status() != LyXRC::PREVIEW_ON && !forexport)
return;
-
+
Buffer const * buffer = pos.buffer();
// collect macros at this position
docstring InsetMathHull::label(row_type row) const
{
- LASSERT(row < nrows(), /**/);
+ LASSERT(row < nrows(), return docstring());
if (InsetLabel * il = label_[row])
return il->screenLabel();
return docstring();
if (features.runparams().isLaTeX()) {
if (ams())
features.require("amsmath");
-
+
if (type_ == hullRegexp) {
features.require("color");
string frcol = lcolor.getLaTeXName(Color_regexpframe);
features.addPreambleSnippet(
string("\\newcommand{\\endregexp}{}"));
}
-
+
// Validation is necessary only if not using AMS math.
// To be safe, we will always run mathedvalidate.
//if (features.amsstyle)
// return;
-
+
//features.binom = true;
} else if (features.runparams().math_flavor == OutputParams::MathAsHTML) {
// it would be better to do this elsewhere, but we can't validate in
void InsetMathHull::splitTo2Cols()
{
- LASSERT(ncols() == 1, /**/);
+ LASSERT(ncols() == 1, return);
InsetMathGrid::addCol(1);
for (row_type row = 0; row < nrows(); ++row) {
idx_type const i = 2 * row;
void InsetMathHull::splitTo3Cols()
{
- LASSERT(ncols() < 3, /**/);
+ LASSERT(ncols() < 3, return);
if (ncols() < 2)
splitTo2Cols();
InsetMathGrid::addCol(2);
void InsetMathHull::check() const
{
- LASSERT(numbered_.size() == nrows(), /**/);
- LASSERT(numbers_.size() == nrows(), /**/);
- LASSERT(label_.size() == nrows(), /**/);
+ LATTEST(numbered_.size() == nrows());
+ LATTEST(numbers_.size() == nrows());
+ LATTEST(label_.size() == nrows());
}
break;
}
- case LFUN_LABEL_COPY_AS_REF: {
+ case LFUN_LABEL_COPY_AS_REFERENCE: {
row_type row;
if (cmd.argument().empty() && &cur.inset() == this)
// if there is no argument and we're inside math, we retrieve
status.setEnabled(type_ != hullSimple);
return true;
- case LFUN_LABEL_COPY_AS_REF: {
+ case LFUN_LABEL_COPY_AS_REFERENCE: {
bool enabled = false;
row_type row;
if (cmd.argument().empty() && &cur.inset() == this) {
// if there is an argument, find the corresponding label, else
// check whether there is at least one label.
for (row_type row = 0; row != nrows(); ++row) {
- if (numbered_[row] && label_[row] &&
+ if (numbered_[row] && label_[row] &&
(cmd.argument().empty() || label(row) == cmd.argument())) {
enabled = true;
break;
docstring InsetMathHull::xhtml(XHTMLStream & xs, OutputParams const & op) const
{
- BufferParams::MathOutput const mathtype =
- buffer().params().html_math_output;
+ BufferParams::MathOutput const mathtype =
+ buffer().masterBuffer()->params().html_math_output;
bool success = false;
} catch (MathExportException const &) {}
if (success) {
if (getType() == hullSimple)
- xs << html::StartTag("math",
+ xs << html::StartTag("math",
"xmlns=\"http://www.w3.org/1998/Math/MathML\"", true);
- else
- xs << html::StartTag("math",
+ else
+ xs << html::StartTag("math",
"display=\"block\" xmlns=\"http://www.w3.org/1998/Math/MathML\"", true);
xs << XHTMLStream::ESCAPE_NONE
<< os.str()
<< html::EndTag(tag);
}
}
-
+
// what we actually want is this:
// if (
- // ((mathtype == BufferParams::MathML || mathtype == BufferParams::HTML)
+ // ((mathtype == BufferParams::MathML || mathtype == BufferParams::HTML)
// && !success)
// || mathtype == BufferParams::Images
// )
- // but what follows is equivalent, since we'll enter only if either (a) we
+ // but what follows is equivalent, since we'll enter only if either (a) we
// tried and failed with MathML or HTML or (b) didn't try yet at all but
// aren't doing LaTeX, in which case we are doing Images.
if (!success && mathtype != BufferParams::LaTeX) {
string const tag = (getType() == hullSimple) ? "span" : "div";
xs << html::CR()
<< html::StartTag(tag)
- << html::CompTag("img", "src=\"" + filename + "\"")
+ << html::CompTag("img", "src=\"" + filename + "\" alt=\"Mathematical Equation\"")
<< html::EndTag(tag)
<< html::CR();
success = true;
}
}
-
+
// so we'll pass this test if we've failed everything else, or
// if mathtype was LaTeX, since we won't have entered any of the
// earlier branches
ModeSpecifier specifier(wi, MATH_MODE);
mathAsLatex(wi);
docstring const latex = ls.str();
-
+
// class='math' allows for use of jsMath
// http://www.math.union.edu/~dpvc/jsMath/
// FIXME XHTML
// probably should allow for some kind of customization here
string const tag = (getType() == hullSimple) ? "span" : "div";
xs << html::StartTag(tag, "class='math'")
- << latex
+ << latex
<< html::EndTag(tag)
<< html::CR();
}