]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/InsetMathGrid.cpp
Change the interface to a paragraph's layout. We still store a LayoutPtr, but now...
[lyx.git] / src / mathed / InsetMathGrid.cpp
index f357c2e43cad36568ab6335c2f5497e5679383e7..11f08ad9914d7a9987896dc892d78c6969625121 100644 (file)
 #include "CutAndPaste.h"
 #include "FuncStatus.h"
 #include "Cursor.h"
-#include "debug.h"
 #include "FuncRequest.h"
-#include "gettext.h"
 
 #include "frontends/Clipboard.h"
 #include "frontends/Painter.h"
 
-#include "support/lstrings.h"
+#include "support/debug.h"
 #include "support/docstream.h"
+#include "support/gettext.h"
+#include "support/lstrings.h"
 
 #include <sstream>
 
+using namespace std;
+using namespace lyx::support;
 
 namespace lyx {
 
-using support::bformat;
-
-using std::endl;
-using std::max;
-using std::min;
-using std::swap;
-
-using std::string;
-using std::istream;
-using std::istringstream;
-using std::vector;
-
-
 namespace {
 
 docstring verboseHLine(int n)
@@ -86,7 +75,7 @@ InsetMathGrid::CellInfo::CellInfo()
 
 
 InsetMathGrid::RowInfo::RowInfo()
-       : lines_(0), skip_(0), allow_pagebreak_(true)
+       : lines_(0), skip_(0), allow_newpage_(true)
 {}
 
 
@@ -224,7 +213,7 @@ void InsetMathGrid::halign(docstring const & hh)
                        }
                        --it;
                        if (newcolumn) {
-                               colinfo_[col].lines_ = std::count(
+                               colinfo_[col].lines_ = count(
                                        colinfo_[col].special_.begin(),
                                        colinfo_[col].special_.end(), '|');
                                LYXERR(Debug::MATHED, "special column separator: `"
@@ -241,7 +230,7 @@ void InsetMathGrid::halign(docstring const & hh)
                        colinfo_[col].align_ = static_cast<char>(c);
                        if (!colinfo_[col].special_.empty()) {
                                colinfo_[col].special_ += c;
-                               colinfo_[col].lines_ = std::count(
+                               colinfo_[col].lines_ = count(
                                                colinfo_[col].special_.begin(),
                                                colinfo_[col].special_.end(), '|');
                                LYXERR(Debug::MATHED, "special column separator: `"
@@ -508,7 +497,7 @@ void InsetMathGrid::metrics(MetricsInfo & mi, Dimension & dim) const
 
 void InsetMathGrid::draw(PainterInfo & pi, int x, int y) const
 {
-       drawWithMargin(pi, x, y, 0, 0);
+       drawWithMargin(pi, x, y, 1, 1);
 }
 
 
@@ -636,7 +625,7 @@ void InsetMathGrid::metricsT(TextMetricsInfo const & mi, Dimension & dim) const
 }
 
 
-void InsetMathGrid::drawT(TextPainter & pain, int x, int y) const
+void InsetMathGrid::drawT(TextPainter & /*pain*/, int /*x*/, int /*y*/) const
 {
 //     for (idx_type idx = 0; idx < nargs(); ++idx)
 //             cell(idx).drawT(pain, x + cellXOffset(idx), y + cellYOffset(idx));
@@ -649,7 +638,7 @@ docstring InsetMathGrid::eolString(row_type row, bool emptyline, bool fragile) c
 
        if (!rowinfo_[row].crskip_.zero())
                eol += '[' + from_utf8(rowinfo_[row].crskip_.asLatexString()) + ']';
-       else if(!rowinfo_[row].allow_pagebreak_)
+       else if(!rowinfo_[row].allow_newpage_)
                eol += '*';
 
        // make sure an upcoming '[' does not break anything
@@ -824,7 +813,7 @@ bool InsetMathGrid::idxUpDown(Cursor & cur, bool up) const
                        return false;
                cur.idx() += ncols();
        }
-       cur.pos() = cur.cell().x2pos(cur.x_target() - cur.cell().xo(cur.bv()));
+       cur.pos() = cur.cell().x2pos(&cur.bv(), cur.x_target() - cur.cell().xo(cur.bv()));
        return true;
 }
 
@@ -1117,7 +1106,7 @@ void InsetMathGrid::doDispatch(Cursor & cur, FuncRequest & cmd)
                }
                break;
 
-       case LFUN_BREAK_LINE: {
+       case LFUN_NEW_LINE: {
                cur.recordUndoInset();
                row_type const r = cur.row();
                addRow(r);
@@ -1264,7 +1253,7 @@ void InsetMathGrid::doDispatch(Cursor & cur, FuncRequest & cmd)
                        idocstringstream is(cmd.argument());
                        int n = 0;
                        is >> n;
-                       topaste = cap::getSelection(cur.buffer(), n);
+                       topaste = cap::selection(n);
                }
                InsetMathGrid grid(1, 1);
                if (!topaste.empty())
@@ -1429,7 +1418,7 @@ bool InsetMathGrid::getStatus(Cursor & cur, FuncRequest const & cmd,
                        status.enable(false);
                        break;
                }
-               if (!support::contains("tcb", cmd.argument()[0])) {
+               if (!contains("tcb", cmd.argument()[0])) {
                        status.enable(false);
                        break;
                }