]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/InsetMathGrid.cpp
Fix build with GNU libstdc++ C++11 ABI
[lyx.git] / src / mathed / InsetMathGrid.cpp
index ac8cd491acb8d50dafc3e132722550a1810fb381..d3eb677197dcd2535d717745dae7c2caf3f5f7ba 100644 (file)
@@ -20,6 +20,7 @@
 #include "MetricsInfo.h"
 
 #include "Buffer.h"
+#include "BufferParams.h"
 #include "BufferView.h"
 #include "CutAndPaste.h"
 #include "FuncStatus.h"
@@ -27,7 +28,6 @@
 #include "FuncRequest.h"
 
 #include "frontends/Clipboard.h"
-#include "frontends/FontMetrics.h"
 #include "frontends/Painter.h"
 
 #include "support/debug.h"
@@ -97,9 +97,7 @@ InsetMathGrid::RowInfo::RowInfo()
 
 int InsetMathGrid::RowInfo::skipPixels(MetricsInfo const & mi) const
 {
-       frontend::FontMetrics const & fm = theFontMetrics(mi.base.font);
-       return crskip_.inPixels(mi.base.textwidth,
-                               fm.width(char_type('M')));
+       return crskip_.inPixels(mi.base);
 }
 
 
@@ -674,7 +672,7 @@ docstring InsetMathGrid::eolString(row_type row, bool fragile,
        // make sure an upcoming '[' does not break anything
        if (row + 1 < nrows()) {
                MathData const & c = cell(index(row + 1, 0));
-               if (c.size() && c.front()->getChar() == '[')
+               if (!c.empty() && c.front()->getChar() == '[')
                        //eol += "[0pt]";
                        eol += "{}";
        }
@@ -905,7 +903,7 @@ bool InsetMathGrid::idxDelete(idx_type & idx)
 
        // try to delete entire sequence of ncols() empty cells if possible
        for (idx_type i = idx; i < idx + ncols(); ++i)
-               if (cell(i).size())
+               if (!cell(i).empty())
                        return false;
 
        // move cells if necessary
@@ -1142,7 +1140,7 @@ void InsetMathGrid::doDispatch(Cursor & cur, FuncRequest & cmd)
        switch (act) {
 
        // insert file functions
-       case LFUN_LINE_DELETE:
+       case LFUN_LINE_DELETE_FORWARD:
                cur.recordUndoInset();
                //autocorrect_ = false;
                //macroModeClose();
@@ -1302,7 +1300,7 @@ void InsetMathGrid::doDispatch(Cursor & cur, FuncRequest & cmd)
                        docstring & special = colinfo_[cur.col()].special_;
                        if (!special.empty()) {
                                docstring::size_type i = special.rfind('|');
-                               LASSERT(i != docstring::npos, /**/);
+                               LASSERT(i != docstring::npos, break);
                                special.erase(i, 1);
                        }
                }
@@ -1311,7 +1309,7 @@ void InsetMathGrid::doDispatch(Cursor & cur, FuncRequest & cmd)
                        docstring & special = colinfo_[cur.col()+1].special_;
                        if (!special.empty()) {
                                docstring::size_type i = special.find('|');
-                               LASSERT(i != docstring::npos, /**/);
+                               LASSERT(i != docstring::npos, break);
                                special.erase(i, 1);
                        }
                }
@@ -1334,16 +1332,16 @@ void InsetMathGrid::doDispatch(Cursor & cur, FuncRequest & cmd)
                cap::replaceSelection(cur);
                docstring topaste;
                if (cmd.argument().empty() && !theClipboard().isInternal())
-                       topaste = theClipboard().getAsText();
+                       topaste = theClipboard().getAsText(Clipboard::PlainTextType);
                else {
                        idocstringstream is(cmd.argument());
                        int n = 0;
                        is >> n;
-                       topaste = cap::selection(n);
+                       topaste = cap::selection(n, buffer().params().documentClassPtr());
                }
                InsetMathGrid grid(buffer_, 1, 1);
                if (!topaste.empty())
-                       if ((topaste.size() == 1 && topaste.at(0) < 0x80)
+                       if ((topaste.size() == 1 && isAscii(topaste))
                            || !mathed_parse_normal(grid, topaste, parseflg)) {
                                resetGrid(grid);
                                mathed_parse_normal(grid, topaste, parseflg | Parse::VERBATIM);