#include "Buffer.h"
#include "BufferParams.h"
#include "BufferView.h"
+#include "ColorSet.h"
#include "CutAndPaste.h"
#include "Encoding.h"
#include "FuncRequest.h"
}
-void InsetMathHull::updateLabels(ParIterator const & it, UpdateType utype)
+void InsetMathHull::updateBuffer(ParIterator const & it, UpdateType utype)
{
if (!buffer_) {
//FIXME: buffer_ should be set at creation for this inset! Problem is
}
for (size_t i = 0; i != label_.size(); ++i) {
if (label_[i])
- label_[i]->updateLabels(it, utype);
+ label_[i]->updateBuffer(it, utype);
}
// pass down
- InsetMathGrid::updateLabels(it, utype);
+ InsetMathGrid::updateBuffer(it, utype);
}
docstring InsetMathHull::standardFont() const
{
- return from_ascii(type_ == hullNone ? "lyxnochange" : "mathnormal");
+ const char *font_name;
+ switch (type_) {
+ case hullRegexp:
+ font_name = "texttt";
+ break;
+ case hullNone:
+ font_name = "lyxnochange";
+ break;
+ default:
+ font_name = "mathnormal";
+ }
+ return from_ascii(font_name);
}
{
use_preview_ = previewState(pi.base.bv);
+ if (type_ == hullRegexp) {
+ Dimension const dim = dimension(*pi.base.bv);
+ pi.pain.rectangle(x + 1, y - dim.ascent() + 1,
+ dim.width() - 2, dim.height() - 2, Color_regexpframe);
+ }
if (use_preview_) {
// one pixel gap in front
preview_->draw(pi, x + 1, y);
delete label_[row];
label_[row] = dummy_pointer;
// We need an update of the Buffer reference cache.
- // This is achieved by updateLabels().
+ // This is achieved by updateBuffer().
if (buffer_)
- buffer().updateLabels();
+ buffer().updateBuffer();
} else {
if (buffer_)
label_[row]->updateCommand(label);
return;
}
// We need an update of the Buffer reference cache.
- // This is achieved by updateLabels().
- buffer().updateLabels();
+ // This is achieved by updateBuffer().
+ buffer().updateBuffer();
}
}
if (ams())
features.require("amsmath");
+ if (type_ == hullRegexp) {
+ features.require("color");
+ string frcol = lcolor.getLaTeXName(Color_regexpframe);
+ string bgcol = "white";
+ features.addPreambleSnippet(
+ string("\\newcommand{\\regexp}[1]{\\fcolorbox{")
+ + frcol + string("}{")
+ + bgcol + string("}{\\texttt{#1}}}"));
+ }
+
// Validation is necessary only if not using AMS math.
// To be safe, we will always run mathedvalidate.
//if (features.amsstyle)
break;
case hullRegexp:
- os << "\\regexp{";
+ os << "\\regexp{{{";
break;
default:
break;
case hullRegexp:
- os << "}";
+ os << "}}}";
break;
default:
docstring res;
if (numberedType()) {
if (label_[row] && !nonum_[row])
- res += "\\label{" + label_[row]->getParam("name") + '}';
+ res += "\\label{" +
+ escape(label_[row]->getParam("name")) + '}';
if (nonum_[row] && (type_ != hullMultline))
res += "\\nonumber ";
}
}
return InsetMathGrid::getStatus(cur, cmd, status);
- case LFUN_TABULAR_FEATURE: {
+ case LFUN_INSET_MODIFY: {
istringstream is(to_utf8(cmd.argument()));
string s;
is >> s;
+ if (s != "tabular")
+ return InsetMathGrid::getStatus(cur, cmd, status);
+ is >> s;
if (!rowChangeOK()
&& (s == "append-row"
|| s == "delete-row"