X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fmathed%2FInsetMathHull.cpp;h=38f0226bc77fd97799cf8bef6f9f7be1239f6e1d;hb=98fb638d61d38df1443339de4e8ba58c7c81784a;hp=6b9d8d3cce01e5e8a1c9b0ff52208e315307cbb8;hpb=e44fc571cc4545abb21db62eaa72a8e76b44681f;p=lyx.git diff --git a/src/mathed/InsetMathHull.cpp b/src/mathed/InsetMathHull.cpp index 6b9d8d3cce..38f0226bc7 100644 --- a/src/mathed/InsetMathHull.cpp +++ b/src/mathed/InsetMathHull.cpp @@ -52,6 +52,8 @@ #include "graphics/PreviewImage.h" #include "graphics/PreviewLoader.h" +#include "frontends/Painter.h" + #include "support/lyxlib.h" #include "support/lstrings.h" @@ -335,6 +337,12 @@ void InsetMathHull::draw(PainterInfo & pi, int x, int y) const { use_preview_ = previewState(pi.base.bv); + // background of mathed under focus is not painted because + // selection at the top level of nested inset is difficult to handle. + if (!editing(pi.base.bv)) + pi.pain.fillRectangle(x + 1, y - ascent() + 1, width() - 2, + ascent() + descent() - 1, Color::mathbg); + if (use_preview_) { // one pixel gap in front preview_->draw(pi, x + 1, y); @@ -463,9 +471,9 @@ bool InsetMathHull::ams() const } -bool InsetMathHull::display() const +Inset::DisplayType InsetMathHull::display() const { - return type_ != hullSimple && type_ != hullNone; + return (type_ != hullSimple && type_ != hullNone) ? AlignCenter : Inline; } @@ -1041,8 +1049,6 @@ void InsetMathHull::doDispatch(Cursor & cur, FuncRequest & cmd) case LFUN_FINISHED_LEFT: case LFUN_FINISHED_RIGHT: - case LFUN_FINISHED_UP: - case LFUN_FINISHED_DOWN: //lyxerr << "action: " << cmd.action << endl; InsetMathGrid::doDispatch(cur, cmd); notifyCursorLeaves(cur); @@ -1180,8 +1186,8 @@ bool InsetMathHull::getStatus(Cursor & cur, FuncRequest const & cmd, switch (cmd.action) { case LFUN_FINISHED_LEFT: case LFUN_FINISHED_RIGHT: - case LFUN_FINISHED_UP: - case LFUN_FINISHED_DOWN: + case LFUN_UP: + case LFUN_DOWN: status.enabled(true); return true; case LFUN_BREAK_LINE: @@ -1320,7 +1326,7 @@ void InsetMathHull::edit(Cursor & cur, bool left) left ? idxFirst(cur) : idxLast(cur); // The inset formula dimension is not necessarily the same as the // one of the instant preview image, so we have to indicate to the - // BufferView that a metrics update is needed. + // BufferView that a metrics update is needed. cur.updateFlags(Update::Force); } @@ -1438,7 +1444,7 @@ void InsetMathHull::read(Buffer const &, Lexer & lex) int InsetMathHull::plaintext(Buffer const &, odocstream & os, - OutputParams const &) const + OutputParams const &) const { if (0 && display()) { Dimension dim; @@ -1463,7 +1469,7 @@ int InsetMathHull::plaintext(Buffer const &, odocstream & os, int InsetMathHull::docbook(Buffer const & buf, odocstream & os, - OutputParams const & runparams) const + OutputParams const & runparams) const { MathStream ms(os); int res = 0;