]> git.lyx.org Git - lyx.git/blobdiff - src/insets/insetnewline.C
The speed patch: redraw only rows that have changed
[lyx.git] / src / insets / insetnewline.C
index 61915f88520be00174abe08eba71c2262bcecb2b..239e2c2fd484cee51e0083341d7e5e29054d7163 100644 (file)
@@ -35,7 +35,7 @@ void InsetNewline::read(Buffer const &, LyXLex &)
 
 void InsetNewline::write(Buffer const &, ostream & os) const
 {
-       os << "\n\\newline \n";
+       os << "\n\\newline\n";
 }
 
 
@@ -50,28 +50,31 @@ void InsetNewline::metrics(MetricsInfo & mi, Dimension & dim) const
 
 
 int InsetNewline::latex(Buffer const &, ostream &,
-                       LatexRunParams const &) const
+                       OutputParams const &) const
 {
        lyxerr << "Eek, calling InsetNewline::latex !" << endl;
        return 0;
 }
 
 
-int InsetNewline::ascii(Buffer const &, ostream & os, int) const
+int InsetNewline::plaintext(Buffer const &, ostream & os,
+                       OutputParams const &) const
 {
        os << '\n';
        return 0;
 }
 
 
-int InsetNewline::linuxdoc(Buffer const &, std::ostream & os) const
+int InsetNewline::linuxdoc(Buffer const &, std::ostream & os,
+                          OutputParams const &) const
 {
        os << '\n';
        return 0;
 }
 
 
-int InsetNewline::docbook(Buffer const &, std::ostream & os, bool) const
+int InsetNewline::docbook(Buffer const &, std::ostream & os,
+                         OutputParams const &) const
 {
        os << '\n';
        return 0;
@@ -83,11 +86,6 @@ void InsetNewline::draw(PainterInfo & pi, int x, int y) const
        int const wid = font_metrics::width('n', pi.base.font);
        int const asc = font_metrics::maxAscent(pi.base.font);
 
-       // hack, and highly dubious
-       lyx::pos_type pos = ownerPar(*pi.base.bv->buffer(), this)
-               .getPositionOfInset(this);
-       bool const ltr_pos = (pi.base.bv->text->bidi_level(pos) % 2 == 0);
-
        int xp[3];
        int yp[3];
 
@@ -95,7 +93,7 @@ void InsetNewline::draw(PainterInfo & pi, int x, int y) const
        yp[1] = int(y - 0.500 * asc * 0.75);
        yp[2] = int(y - 0.125 * asc * 0.75);
 
-       if (ltr_pos) {
+       if (pi.ltr_pos) {
                xp[0] = int(x + wid * 0.375);
                xp[1] = int(x);
                xp[2] = int(x + wid * 0.375);
@@ -111,7 +109,7 @@ void InsetNewline::draw(PainterInfo & pi, int x, int y) const
        yp[1] = int(y - 0.500 * asc * 0.75);
        yp[2] = int(y - asc * 0.75);
 
-       if (ltr_pos) {
+       if (pi.ltr_pos) {
                xp[0] = int(x);
                xp[1] = int(x + wid);
                xp[2] = int(x + wid);
@@ -123,3 +121,9 @@ void InsetNewline::draw(PainterInfo & pi, int x, int y) const
 
        pi.pain.lines(xp, yp, 3, LColor::eolmarker);
 }
+
+
+bool InsetNewline::isSpace() const
+{
+       return true;
+}