mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
Merge branch 'master' of git.lyx.org:lyx
This commit is contained in:
commit
f28affd421
@ -1712,8 +1712,11 @@ void Cursor::handleNest(MathAtom const & a)
|
||||
{
|
||||
idx_type const idx = a.nucleus()->asNestInset()->firstIdx();
|
||||
//lyxerr << "Cursor::handleNest: " << idx << endl;
|
||||
InsetMath const * im = selectionBegin().inset().asInsetMath();
|
||||
Parse::flags const f = im && im->currentMode() != InsetMath::MATH_MODE
|
||||
? Parse::TEXTMODE : Parse::NORMAL;
|
||||
MathAtom t = a;
|
||||
asArray(cap::grabAndEraseSelection(*this), t.nucleus()->cell(idx));
|
||||
asArray(cap::grabAndEraseSelection(*this), t.nucleus()->cell(idx), f);
|
||||
insert(t);
|
||||
editInsertedInset();
|
||||
}
|
||||
@ -2038,7 +2041,7 @@ bool Cursor::mathForward(bool word)
|
||||
while (pos() < lastpos() && mc == nextMath().mathClass());
|
||||
} else if (openable(nextAtom())) {
|
||||
InsetMathScript const * n = nextMath().asScriptInset();
|
||||
bool to_brace_deco = n
|
||||
bool to_brace_deco = n && !n->nuc().empty()
|
||||
&& n->nuc().back()->lyxCode() == MATH_DECORATION_CODE
|
||||
&& n->nuc().back()->mathClass() == MC_OP;
|
||||
// single step: try to enter the next inset
|
||||
@ -2092,7 +2095,7 @@ bool Cursor::mathBackward(bool word)
|
||||
}
|
||||
} else if (openable(prevAtom())) {
|
||||
InsetMathScript const * p = prevMath().asScriptInset();
|
||||
bool to_brace_deco = p
|
||||
bool to_brace_deco = p && !p->nuc().empty()
|
||||
&& p->nuc().back()->lyxCode() == MATH_DECORATION_CODE
|
||||
&& p->nuc().back()->mathClass() == MC_OP;
|
||||
// single step: try to enter the preceding inset
|
||||
|
@ -275,7 +275,7 @@ static QString version(bool const plain = false)
|
||||
out << '\n';
|
||||
else
|
||||
out << "</span></p><p>";
|
||||
out << toqstr(bformat(_("Qt Version (run-time): %1$s"), from_ascii(qVersion())));
|
||||
out << toqstr(bformat(_("Qt Version (run-time): %1$s on platform %2$s"), from_ascii(qVersion()), qstring_to_ucs4(guiApp->platformName())));
|
||||
if (plain)
|
||||
out << '\n';
|
||||
else
|
||||
|
@ -36,7 +36,8 @@ InsetMathColor::InsetMathColor(Buffer * buf, bool oldstyle, ColorCode color)
|
||||
|
||||
InsetMathColor::InsetMathColor(Buffer * buf, bool oldstyle,
|
||||
docstring const & color)
|
||||
: InsetMathNest(buf, 1), oldstyle_(oldstyle), color_(color)
|
||||
: InsetMathNest(buf, 1), oldstyle_(oldstyle), color_(color),
|
||||
current_mode_(UNDECIDED_MODE)
|
||||
{}
|
||||
|
||||
|
||||
@ -48,12 +49,18 @@ Inset * InsetMathColor::clone() const
|
||||
|
||||
void InsetMathColor::metrics(MetricsInfo & mi, Dimension & dim) const
|
||||
{
|
||||
current_mode_ = isTextFont(mi.base.fontname) ? TEXT_MODE : MATH_MODE;
|
||||
Changer dummy = mi.base.changeEnsureMath(current_mode_);
|
||||
|
||||
cell(0).metrics(mi, dim);
|
||||
}
|
||||
|
||||
|
||||
void InsetMathColor::draw(PainterInfo & pi, int x, int y) const
|
||||
{
|
||||
current_mode_ = isTextFont(pi.base.fontname) ? TEXT_MODE : MATH_MODE;
|
||||
Changer dummy = pi.base.changeEnsureMath(current_mode_);
|
||||
|
||||
ColorCode origcol = pi.base.font.color();
|
||||
pi.base.font.setColor(lcolor.getFromLaTeXName(to_utf8(color_)));
|
||||
cell(0).draw(pi, x, y);
|
||||
|
@ -34,6 +34,8 @@ public:
|
||||
void draw(PainterInfo & pi, int x, int y) const override;
|
||||
/// we need package color
|
||||
void validate(LaTeXFeatures & features) const override;
|
||||
/// we inherit the mode
|
||||
mode_type currentMode() const override { return current_mode_; }
|
||||
///
|
||||
void write(TeXMathStream & os) const override;
|
||||
/// FIXME XHTML For now, we do nothing with color.
|
||||
@ -53,6 +55,8 @@ private:
|
||||
bool oldstyle_;
|
||||
/// Our color. Only valid LaTeX colors are allowed.
|
||||
docstring color_;
|
||||
/// the inherited mode
|
||||
mutable mode_type current_mode_;
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user