X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Finsets%2FInsetSeparator.cpp;h=af7fb644cd1b04dd83441e7c8aa11b2f24c9c648;hb=cf6ff2cac79d09adafa63e3a1ec02dfb09f707b9;hp=b981d2cc5dff0b18362c59f08a4bddc301df6eb3;hpb=80e2c85474fbad21dc8a40d74127a81447401b34;p=lyx.git diff --git a/src/insets/InsetSeparator.cpp b/src/insets/InsetSeparator.cpp index b981d2cc5d..af7fb644cd 100644 --- a/src/insets/InsetSeparator.cpp +++ b/src/insets/InsetSeparator.cpp @@ -20,6 +20,7 @@ #include "MetricsInfo.h" #include "OutputParams.h" #include "output_xhtml.h" +#include "texstream.h" #include "frontends/Application.h" #include "frontends/FontMetrics.h" @@ -52,6 +53,9 @@ void InsetSeparatorParams::write(ostream & os) const case InsetSeparatorParams::PARBREAK: os << "parbreak"; break; + case InsetSeparatorParams::LATEXPAR: + os << "latexpar"; + break; } } @@ -65,6 +69,8 @@ void InsetSeparatorParams::read(Lexer & lex) kind = InsetSeparatorParams::PLAIN; else if (token == "parbreak") kind = InsetSeparatorParams::PARBREAK; + else if (token == "latexpar") + kind = InsetSeparatorParams::LATEXPAR; else lex.printError("Unknown kind: `$$Token'"); } @@ -130,7 +136,7 @@ ColorCode InsetSeparator::ColorName() const } -void InsetSeparator::latex(otexstream & os, OutputParams const &) const +void InsetSeparator::latex(otexstream & os, OutputParams const & runparams) const { // Do nothing if a paragraph break was just output if (!os.afterParbreak()) { @@ -139,7 +145,11 @@ void InsetSeparator::latex(otexstream & os, OutputParams const &) const os << breakln << "%\n"; break; case InsetSeparatorParams::PARBREAK: - os << breakln << "\n"; + case InsetSeparatorParams::LATEXPAR: + if (runparams.inDeletedInset) + os << breakln << "}\n\n{"; + else + os << breakln << "\n"; break; default: os << breakln << "%\n"; @@ -177,7 +187,7 @@ void InsetSeparator::metrics(MetricsInfo & mi, Dimension & dim) const dim.asc = fm.maxAscent(); dim.des = fm.maxDescent(); dim.wid = fm.width('n'); - if (params_.kind == InsetSeparatorParams::PLAIN) + if (params_.kind != InsetSeparatorParams::LATEXPAR) dim.wid *= 8; } @@ -194,7 +204,7 @@ void InsetSeparator::draw(PainterInfo & pi, int x, int y) const int xp[7]; int yp[7]; - if (params_.kind == InsetSeparatorParams::PLAIN) { + if (params_.kind != InsetSeparatorParams::LATEXPAR) { yp[0] = int(y - 0.500 * asc * 0.75); yp[1] = yp[0]; @@ -202,6 +212,12 @@ void InsetSeparator::draw(PainterInfo & pi, int x, int y) const xp[1] = int(x + wid * 8); pi.pain.lines(xp, yp, 2, ColorName()); + + if (params_.kind == InsetSeparatorParams::PARBREAK) { + yp[0] += int(0.25 * asc * 0.75); + yp[1] = yp[0]; + pi.pain.lines(xp, yp, 2, ColorName()); + } } else { yp[0] = int(y - 0.500 * asc * 0.5); yp[1] = int(y - 0.250 * asc * 0.5); @@ -266,6 +282,9 @@ void InsetSeparator::draw(PainterInfo & pi, int x, int y) const string InsetSeparator::contextMenuName() const { + if (params_.kind == InsetSeparatorParams::LATEXPAR) + return string(); + return "context-separator"; }