]> git.lyx.org Git - features.git/blobdiff - src/insets/InsetTabular.cpp
reduce line noise
[features.git] / src / insets / InsetTabular.cpp
index 25e6a0f8ed4061713deb810167a9957d1bdf6a2c..9bdff844687ca9b5ace65d5f38ff37139cbf959b 100644 (file)
 #include "Paragraph.h"
 #include "ParagraphParameters.h"
 #include "ParIterator.h"
+#include "TextClass.h"
 #include "TextMetrics.h"
 
 #include "support/convert.h"
+#include "support/docstream.h"
 #include "support/lstrings.h"
 
 #include "frontends/alert.h"
@@ -2730,7 +2732,7 @@ void Tabular::plaintextPrintCell(Buffer const & buf, odocstream & os,
 
 void Tabular::plaintext(Buffer const & buf, odocstream & os,
                           OutputParams const & runparams, int const depth,
-                          bool onlydata, unsigned char delim) const
+                          bool onlydata, char_type delim) const
 {
        // first calculate the width of the single columns
        vector<unsigned int> clen(columnCount());
@@ -2774,7 +2776,9 @@ void Tabular::plaintext(Buffer const & buf, odocstream & os,
                        if (isPartOfMultiColumn(i, j))
                                continue;
                        if (onlydata && j > 0)
-                               os << delim;
+                               // we don't use operator<< for single UCS4 character.
+                               // see explanation in docstream.h
+                               os.put(delim);
                        plaintextPrintCell(buf, os, runparams,
                                           cell, i, j, clen, onlydata);
                        ++cell;
@@ -2820,8 +2824,8 @@ Tabular::getCellFromInset(Inset const * inset) const
 
        for (idx_type cell = 0, n = cellCount(); cell < n; ++cell)
                if (getCellInset(cell).get() == inset) {
-                       LYXERR(Debug::INSETTEXT) << "Tabular::getCellFromInset: "
-                               << "cell=" << cell << endl;
+                       LYXERR(Debug::INSETTEXT, "Tabular::getCellFromInset: "
+                               << "cell=" << cell);
                        return cell;
                }
 
@@ -3010,6 +3014,8 @@ void InsetTabular::draw(PainterInfo & pi, int x, int y) const
        x += scx_;
        x += ADD_TO_TABULAR_WIDTH;
 
+       bool const original_drawing_state = pi.pain.isDrawingEnabled();
+
        idx_type idx = 0;
        first_visible_cell = Tabular::npos;
        for (row_type i = 0; i < tabular.rowCount(); ++i) {
@@ -3033,7 +3039,7 @@ void InsetTabular::draw(PainterInfo & pi, int x, int y) const
                                pi.pain.setDrawingEnabled(false);
                                cell(idx)->draw(pi, cx, y);
                                drawCellLines(pi.pain, nx, y, i, idx, pi.erased_);
-                               pi.pain.setDrawingEnabled(true);
+                               pi.pain.setDrawingEnabled(original_drawing_state);
                        } else {
                                cell(idx)->draw(pi, cx, y);
                                drawCellLines(pi.pain, nx, y, i, idx, pi.erased_);
@@ -3066,7 +3072,7 @@ void InsetTabular::drawSelection(PainterInfo & pi, int x, int y) const
 
        if (!cur.selection())
                return;
-       if (!ptr_cmp(&cur.inset(), this))
+       if (&cur.inset() != this)
                return;
 
        //resetPos(cur);
@@ -3201,8 +3207,8 @@ void InsetTabular::updateLabels(Buffer const & buf, ParIterator const & it)
 
 void InsetTabular::doDispatch(Cursor & cur, FuncRequest & cmd)
 {
-       LYXERR(Debug::DEBUG) << "# InsetTabular::doDispatch: cmd: " << cmd
-                            << "\n  cur:" << cur << endl;
+       LYXERR(Debug::DEBUG, "# InsetTabular::doDispatch: cmd: " << cmd
+                            << "\n  cur:" << cur);
        CursorSlice sl = cur.top();
        Cursor & bvcur = cur.bv().cursor();