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.
This commit is contained in:
Enrico Forestieri 2014-10-25 23:38:52 +02:00
parent b2b71d97b5
commit 498ab8ff23
4 changed files with 30 additions and 19 deletions

View File

@ -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,

View File

@ -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);
}

View File

@ -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);

View File

@ -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);