X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FVSpace.cpp;h=d176850c876d48fd64e261deab215c1f9ae7fb29;hb=dab71087cf2954b77d3d2c0e67b868f9be82fba9;hp=6e065964039e7ca6e1d3f02da613f81e795b0230;hpb=de990f72e1ba856ed5f8e5c617c17cdf382ab3a7;p=lyx.git diff --git a/src/VSpace.cpp b/src/VSpace.cpp index 6e06596403..d176850c87 100644 --- a/src/VSpace.cpp +++ b/src/VSpace.cpp @@ -16,11 +16,11 @@ #include "BufferParams.h" #include "BufferView.h" #include "support/gettext.h" -#include "Length.h" #include "Text.h" #include "TextMetrics.h" // for defaultRowHeight() #include "support/convert.h" +#include "support/Length.h" #include "support/lstrings.h" #include "support/lassert.h" @@ -78,6 +78,10 @@ VSpace::VSpace(string const & data) kind_ = MEDSKIP; else if (prefixIs(input, "bigskip")) kind_ = BIGSKIP; + else if (prefixIs(input, "halfline")) + kind_ = HALFLINE; + else if (prefixIs(input, "fullline")) + kind_ = FULLLINE; else if (prefixIs(input, "vfill")) kind_ = VFILL; else if (isValidGlueLength(input, &len_)) @@ -111,12 +115,30 @@ string const VSpace::asLyXCommand() const { string result; switch (kind_) { - case DEFSKIP: result = "defskip"; break; - case SMALLSKIP: result = "smallskip"; break; - case MEDSKIP: result = "medskip"; break; - case BIGSKIP: result = "bigskip"; break; - case VFILL: result = "vfill"; break; - case LENGTH: result = len_.asString(); break; + case DEFSKIP: + result = "defskip"; + break; + case SMALLSKIP: + result = "smallskip"; + break; + case MEDSKIP: + result = "medskip"; + break; + case BIGSKIP: + result = "bigskip"; + break; + case HALFLINE: + result = "halfline"; + break; + case FULLLINE: + result = "fullline"; + break; + case VFILL: + result = "vfill"; + break; + case LENGTH: + result = len_.asString(); + break; } if (keep_) result += '*'; @@ -138,6 +160,12 @@ string const VSpace::asLatexCommand(BufferParams const & params) const case BIGSKIP: return keep_ ? "\\vspace*{\\bigskipamount}" : "\\bigskip{}"; + + case HALFLINE: + return keep_ ? "\\vspace*{.5\\baselineskip}" : "\\vspace{.5\\baselineskip}"; + + case FULLLINE: + return keep_ ? "\\vspace*{\\baselineskip}" : "\\vspace{\\baselineskip}"; case VFILL: return keep_ ? "\\vspace*{\\fill}" : "\\vfill{}"; @@ -170,6 +198,12 @@ docstring const VSpace::asGUIName() const case BIGSKIP: result = _("Big skip"); break; + case HALFLINE: + result = _("Half line height"); + break; + case FULLLINE: + result = _("Line height"); + break; case VFILL: result = _("Vertical fill"); break; @@ -183,20 +217,35 @@ docstring const VSpace::asGUIName() const } -string VSpace::asHTMLLength() const +string VSpace::asHTMLLength() const { string result; switch (kind_) { - case DEFSKIP: result = "2ex"; break; - case SMALLSKIP: result = "1ex"; break; - case MEDSKIP: result = "3ex"; break; - case BIGSKIP: result = "5ex"; break; + case DEFSKIP: + result = "2ex"; + break; + case SMALLSKIP: + result = "1ex"; + break; + case MEDSKIP: + result = "3ex"; + break; + case BIGSKIP: + result = "5ex"; + break; + case HALFLINE: + result = "0.6em"; + break; + case FULLLINE: + result = "1.2em"; + break; case LENGTH: { Length tmp = len_.len(); if (tmp.value() > 0) result = tmp.asHTMLString(); } - case VFILL: break; + case VFILL: + break; } return result; } @@ -227,6 +276,12 @@ int VSpace::inPixels(BufferView const & bv) const // leave space for the vfill symbol return 3 * default_height; + case HALFLINE: + return int(default_height / 2); + + case FULLLINE: + return default_height; + case LENGTH: return bv.inPixels(len_.len());