]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/InsetMathNest.cpp
Get rid of Inset::setPosCache
[lyx.git] / src / mathed / InsetMathNest.cpp
index d1c413b620bcb6fcf072a10183c8001fcab30ac1..ecd823063e092fc357c7b9a4075c16623852671f 100644 (file)
 #include "Encoding.h"
 #include "FuncRequest.h"
 #include "FuncStatus.h"
+#include "LaTeXFeatures.h"
 #include "LyX.h"
 #include "LyXRC.h"
 #include "MetricsInfo.h"
 #include "OutputParams.h"
+#include "TexRow.h"
 #include "Text.h"
 
 #include "frontends/Application.h"
@@ -251,8 +253,7 @@ bool InsetMathNest::idxLast(Cursor & cur) const
 void InsetMathNest::dump() const
 {
        odocstringstream oss;
-       TexRow texrow(false);
-       otexrowstream ots(oss,texrow);
+       otexrowstream ots(oss);
        WriteStream os(ots);
        os << "---------------------------------------------\n";
        write(os);
@@ -264,14 +265,13 @@ void InsetMathNest::dump() const
 }
 
 
-void InsetMathNest::draw(PainterInfo & pi, int x, int y) const
+void InsetMathNest::draw(PainterInfo &, int, int) const
 {
 #if 0
        if (lock_)
                pi.pain.fillRectangle(x, y - ascent(), width(), height(),
                                        Color_mathlockbg);
 #endif
-       setPosCache(pi, x, y);
 }
 
 
@@ -406,9 +406,21 @@ void InsetMathNest::latex(otexstream & os, OutputParams const & runparams) const
        WriteStream wi(os, runparams.moving_arg, true,
                        runparams.dryrun ? WriteStream::wsDryrun : WriteStream::wsDefault,
                        runparams.encoding);
+       wi.strikeoutMath(runparams.inDeletedInset
+                        && (!LaTeXFeatures::isAvailable("dvipost")
+                               || (runparams.flavor != OutputParams::LATEX
+                                   && runparams.flavor != OutputParams::DVILUATEX)));
+       if (runparams.inulemcmd) {
+               wi.ulemCmd(WriteStream::UNDERLINE);
+               if (runparams.local_font) {
+                       FontInfo f = runparams.local_font->fontInfo();
+                       if (f.strikeout() == FONT_ON)
+                               wi.ulemCmd(WriteStream::STRIKEOUT);
+               }
+       }
        wi.canBreakLine(os.canBreakLine());
-       Changer dummy = wi.changeRowEntry(os.texrow().textEntry(runparams.lastid,
-                                                               runparams.lastpos));
+       Changer dummy = wi.changeRowEntry(TexRow::textEntry(runparams.lastid,
+                                                           runparams.lastpos));
        write(wi);
        // Reset parbreak status after a math inset.
        os.lastChar(0);
@@ -578,7 +590,7 @@ void InsetMathNest::doDispatch(Cursor & cur, FuncRequest & cmd)
                replaceSelection(cur);
                docstring topaste;
                if (cmd.argument().empty() && !theClipboard().isInternal())
-                       topaste = theClipboard().getAsText(Clipboard::PlainTextType);
+                       topaste = theClipboard().getAsText(frontend::Clipboard::PlainTextType);
                else {
                        size_t n = 0;
                        idocstringstream is(cmd.argument());
@@ -1550,7 +1562,7 @@ void InsetMathNest::lfunMousePress(Cursor & cur, FuncRequest & cmd)
                }
        }
        bool do_selection = cmd.button() == mouse_button::button1
-               && cmd.argument() == "region-select";
+               && cmd.modifier() == ShiftModifier;
        bv.mouseSetCursor(cur, do_selection);
        if (cmd.button() == mouse_button::button1) {
                //lyxerr << "## lfunMousePress: setting cursor to: " << cur << endl;
@@ -1856,7 +1868,7 @@ bool InsetMathNest::interpretChar(Cursor & cur, char_type const c)
                        cur.niceInsert(createInsetMath("sim", buf));
                        return true;
                }
-               if (currentMode() == InsetMath::MATH_MODE && !isAsciiOrMathAlpha(c)) {
+               if (currentMode() == InsetMath::MATH_MODE && Encodings::isUnicodeTextOnly(c)) {
                        MathAtom at = createInsetMath("text", buf);
                        at.nucleus()->cell(0).push_back(MathAtom(new InsetMathChar(c)));
                        cur.niceInsert(at);