#include "support/docstring.h"
using namespace std;
+using namespace lyx::frontend;
namespace lyx {
{
string token;
lex.setContext("InsetSeparatorParams::read");
- lex >> token;
+ lex >> token;
if (token == "plain")
kind = InsetSeparatorParams::PLAIN;
else if (token == "parbreak")
{
switch (cmd.action()) {
// we handle these
- case LFUN_INSET_MODIFY:
- if (cmd.getArg(0) == "plain") {
- InsetSeparatorParams params;
- string2params(to_utf8(cmd.argument()), params);
- status.setOnOff(params_.kind == params.kind);
- }
+ case LFUN_INSET_MODIFY: {
+ if (cmd.getArg(0) != "separator")
+ break;
+ InsetSeparatorParams params;
+ string2params(to_utf8(cmd.argument()), params);
+ status.setOnOff(params_.kind == params.kind);
status.setEnabled(true);
return true;
+ }
default:
return Inset::getStatus(cur, cmd, status);
}
+ return false;
}
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;
}
void InsetSeparator::latex(otexstream & os, OutputParams const &) const
{
- switch (params_.kind) {
- case InsetSeparatorParams::PLAIN:
- os << breakln << "%\n";
- break;
- case InsetSeparatorParams::PARBREAK:
- os << breakln << "\n";
- break;
- default:
- os << breakln << "%\n";
- break;
+ // Do nothing if a paragraph break was just output
+ if (!os.afterParbreak()) {
+ switch (params_.kind) {
+ case InsetSeparatorParams::PLAIN:
+ os << breakln << "%\n";
+ break;
+ case InsetSeparatorParams::PARBREAK:
+ os << breakln << "\n";
+ break;
+ default:
+ os << breakln << "%\n";
+ break;
+ }
}
}
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);
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);