commit 498ab8ff238626498e5eb3f9aed1cd1188e727d0
Author: Enrico Forestieri <[email protected]>
Date:   Sat Oct 25 23:38:52 2014 +0200

    Tweak the shape of the parbreak separator.
    
    The shape of the parbreak separator is slightly changed in order to
    better distinguish it from the forced newline. This allows using the
    same color of the plain version without risk of confusion.

diff --git a/src/frontends/Painter.h b/src/frontends/Painter.h
index 221da4a..7906aa9 100644
--- a/src/frontends/Painter.h
+++ b/src/frontends/Painter.h
@@ -64,6 +64,13 @@ public:
                line_onoffdash //< dashes with spaces
        };
 
+       /// possible fill styles
+       enum fill_style {
+               fill_none,
+               fill_oddeven,
+               fill_winding
+       };
+
        /// possible character styles of preedit string.
        /// This is used for CJK input method support.
        enum preedit_style {
@@ -85,7 +92,8 @@ public:
         * @param np size of the points array
         */
        virtual void lines(int const * xp, int const * yp, int np, Color,
-               line_style = line_solid, float line_width = thin_line) = 0;
+               fill_style = fill_none, line_style = line_solid,
+               float line_width = thin_line) = 0;
 
        /// draw a rectangle
        virtual void rectangle(int x, int y, int w, int h, Color,
diff --git a/src/frontends/qt4/GuiPainter.cpp b/src/frontends/qt4/GuiPainter.cpp
index 0071581..5730819 100644
--- a/src/frontends/qt4/GuiPainter.cpp
+++ b/src/frontends/qt4/GuiPainter.cpp
@@ -196,6 +196,7 @@ void GuiPainter::line(int x1, int y1, int x2, int y2,
 
 void GuiPainter::lines(int const * xp, int const * yp, int np,
        Color col,
+       fill_style fs,
        line_style ls,
        float lw)
 {
@@ -215,10 +216,19 @@ void GuiPainter::lines(int const * xp, int const * yp, 
int np,
                if (i != 0)
                        antialias |= xp[i-1] != xp[i] && yp[i-1] != yp[i];
        }
-       setQPainterPen(computeColor(col), ls, lw);
+       QColor const color = computeColor(col);
+       setQPainterPen(color, ls, lw);
        bool const text_is_antialiased = renderHints() & TextAntialiasing;
        setRenderHint(Antialiasing, antialias && text_is_antialiased);
-       drawPolyline(points.data(), np);
+       if (fs == fill_none) {
+               drawPolyline(points.data(), np);
+       } else {
+               QBrush const oldbrush = brush();
+               setBrush(QBrush(color));
+               drawPolygon(points.data(), np, fs == fill_oddeven ?
+                           Qt::OddEvenFill : Qt::WindingFill);
+               setBrush(oldbrush);
+       }
        setRenderHint(Antialiasing, false);
 }
 
diff --git a/src/frontends/qt4/GuiPainter.h b/src/frontends/qt4/GuiPainter.h
index e9c6fdf..9cbb29a 100644
--- a/src/frontends/qt4/GuiPainter.h
+++ b/src/frontends/qt4/GuiPainter.h
@@ -55,6 +55,7 @@ public:
                int const * yp,
                int np,
                Color,
+               fill_style fs = fill_none,
                line_style ls = line_solid,
                float lw = thin_line);
 
diff --git a/src/insets/InsetSeparator.cpp b/src/insets/InsetSeparator.cpp
index 05aa456..1ec73c2 100644
--- a/src/insets/InsetSeparator.cpp
+++ b/src/insets/InsetSeparator.cpp
@@ -30,6 +30,7 @@
 #include "support/docstring.h"
 
 using namespace std;
+using namespace lyx::frontend;
 
 namespace lyx {
 
@@ -126,15 +127,6 @@ bool InsetSeparator::getStatus(Cursor & cur, FuncRequest 
const & cmd,
 
 ColorCode InsetSeparator::ColorName() const
 {
-       switch (params_.kind) {
-               case InsetSeparatorParams::PLAIN:
-                       return Color_latex;
-                       break;
-               case InsetSeparatorParams::PARBREAK:
-                       return Color_pagebreak;
-                       break;
-       }
-       // not really useful, but to avoids gcc complaints
        return Color_latex;
 }
 
@@ -212,9 +204,9 @@ void InsetSeparator::draw(PainterInfo & pi, int x, int y) 
const
 
                pi.pain.lines(xp, yp, 2, ColorName());
        } else {
-               yp[0] = int(y - 0.875 * asc * 0.75);
-               yp[1] = int(y - 0.500 * asc * 0.75);
-               yp[2] = int(y - 0.125 * asc * 0.75);
+               yp[0] = int(y - 0.875 * asc * 0.5);
+               yp[1] = int(y - 0.500 * asc * 0.5);
+               yp[2] = int(y - 0.125 * asc * 0.5);
 
                if (pi.ltr_pos) {
                        xp[0] = int(x + wid * 0.375);
@@ -226,11 +218,11 @@ void InsetSeparator::draw(PainterInfo & pi, int x, int y) 
const
                        xp[2] = int(x + wid * 0.625);
                }
 
-               pi.pain.lines(xp, yp, 3, ColorName());
+               pi.pain.lines(xp, yp, 3, ColorName(), Painter::fill_oddeven);
 
-               yp[0] = int(y - 0.500 * asc * 0.75);
-               yp[1] = int(y - 0.500 * asc * 0.75);
-               yp[2] = int(y - asc * 0.75);
+               yp[0] = int(y - 0.500 * asc * 0.5);
+               yp[1] = int(y - 0.500 * asc * 0.5);
+               yp[2] = int(y - asc * 0.5);
 
                if (pi.ltr_pos) {
                        xp[0] = int(x);

Reply via email to